adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.9k stars 1.12k forks source link

Ability to use StatusLight in a Picker #4134

Open schenglooi opened 1 year ago

schenglooi commented 1 year ago

๐Ÿ™‹ Feature Request

The ability to use the StatusLight component as an Item in a Picker component

๐Ÿค” Expected Behavior

๐Ÿ˜ฏ Current Behavior

Workaround for selection highlight:

<Text>
   <View>
        <StatusLight ... />
   <View>
<Text>

๐Ÿ’ Possible Solution

๐Ÿ”ฆ Context

This Picker component is intended to show progress. Our list has two items, "In Progress" and "Approved". The user chooses "Approved" to move something forward. The StatusLight was also used in a different view to indicate the "progress" for that item.

I ended up spending some time trying to implement workarounds using other components to duplicate StatusLight. All of which did not work out.

The result of the current implementation: Note that the width of the Picker is too wide compared to the design.

image

๐Ÿ’ป Examples

mockup in dark mode; image

๐Ÿงข Your Company/Team

Adobe/3D&I

3D&I, WF

๐ŸŽ Tracking Ticket (optional)

devongovett commented 1 year ago

I think the solution to this should be an option for StatusLight rather than something specific to Picker. I think if StatusLight was inline-flex rather than flex, and removed its builtin padding (which is problematic in many scenarios), the issue would be solved. The question at this point is how to make those changes in a non-breaking way. We'll either need a new prop, a new component, or a new major version for this package.

reidbarber commented 1 year ago

Is there a downside to just fixing the style issues via slots?

devongovett commented 1 year ago

I don't think we should really do component specific overrides that way if we can help it. The problem isn't unique to Picker - the same padding also affects table cells and lots of other things. e.g. #2629