-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement Slider and RangeSlider components #1083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
Feedback from design:
|
btw, I'm guessing that the CSS for slider that's currently in the repo is a bit out of date. You could see if updating it from the spectrum-css repo fixes any of the RTL issues... |
Done
Done & opened CSS pr: adobe/spectrum-css#967
Done
The whole component takes 100% of the parent component. So with the side labels, the parent element would have to be wider than without the side labels. Making the slider container be One of the problems was caused by the storybook styles, not sure if this was needed for other reasons? We might need to change the API to allow a |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8f41f62
to
f087476
Compare
This comment has been minimized.
This comment has been minimized.
f087476
to
797685e
Compare
This comment has been minimized.
This comment has been minimized.
Looking good! One thing I noticed about the active state is that it doesn't apply when you click on the track rather than on the handle itself. You might need to make that a class and apply it with JS rather than an
Maybe taking up 100% of the width of the parent by default doesn't make sense? Maybe the slider bar itself should have a default width, and then the labels could be additional width to that. We should try to match the behavior of textfield and other field components. CSS for that here: https://github.com/adobe/react-spectrum/blob/main/packages/@adobe/spectrum-css-temp/components/fieldlabel/index.css#L60-L85
Yeah I think that might be the best way. The CSS syntax is probably a bit too flexible anyway given that you could change the angle of the gradient (e.g. make it go from top-to-bottom rather than only left-to-right). Maybe we should change the prop to // Basic gradient
trackGradient={['red', 'green']}
// With percentages
trackGradient={['red 20%', 'green 40%']} These could generate the following CSS: linear-gradient(to right, red, green);
linear-gradient(to right, red 20%, green 20%); And in RTL we could flip the |
This comment has been minimized.
This comment has been minimized.
85edc64
to
536de46
Compare
This comment has been minimized.
This comment has been minimized.
FYI: Reserving space for the value label doesn't seem to be working anymore? Looks like because of the change from |
Good catch, I forgot to check the normal label position after fixing the side label (where |
2ee59a7
to
a87f6c4
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
9a1bfb3
to
3752d4b
Compare
218e1ce
to
c0e4d59
Compare
Build successful! 🎉 |
Closes #1070, Closes #1096
Haven't added docs yet so that this can be merged without having the website update before the package is released...
react-spectrum/packages/@react-aria/i18n/src/utils.ts
Line 35 in 797685e
Known Bugs
Spectrum/CSS
line for first and last tick doesn't correspond to the value like the other ones (= end stop for handle should be half-way off the track).
cursor: pointer
or similar spectrum-css#965-> design said: doesn't exist yet
font-feature-settings: "tnum"
so that it jumps around lessto upstream: Slider: constant width for value label spectrum-css#968