Skip to content
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

fix(react-slider): Export internal CSS vars #33682

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ValentinaKozlova
Copy link
Contributor

@ValentinaKozlova ValentinaKozlova commented Jan 17, 2025

Partner's ask. Discussed it with @micahgodbolt

Previous Behavior

CSS variables were internal

New Behavior

@@ -0,0 +1,7 @@
{
Copy link
Collaborator

@fabricteam fabricteam Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual regressions to review in the fluentuiv9 Visual Regression Report

Avatar Converged 1 screenshots
Image Name Diff(in Pixels) Image Type
Avatar Converged.badgeMask.chromium.png 3 Changed
Drawer 1 screenshots
Image Name Diff(in Pixels) Image Type
Drawer.Full Overlay RTL.chromium.png 1168 Changed

Copy link

github-actions bot commented Jan 17, 2025

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.164 MB
291.433 kB
1.165 MB
291.541 kB
529 B
108 B
react-slider
Slider
37.546 kB
12.631 kB
38.075 kB
12.74 kB
529 B
109 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
69.236 kB
20.182 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
222.641 kB
64.474 kB
react-components
react-components: FluentProvider & webLightTheme
44.473 kB
14.597 kB
react-portal-compat
PortalCompatProvider
8.39 kB
2.64 kB
react-timepicker-compat
TimePicker
108.551 kB
36.094 kB
🤖 This report was generated against cc1756e0cb08f40d5c356166b0d9abe9beb80b5b

Copy link

Pull request demo site: URL

};

const { sliderDirectionVar, sliderStepsPercentVar, sliderProgressVar } = sliderCSSVars;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deconstructing all the vars out here saves a bunch of code below. 61 vars with sliderCSSVars prefix. sliderCSSVars.sliderThumbSizeVar could simply be sliderThumbSizeVar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it this way because of this comment:
#32939 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is good reason to remove the destructuring, that's fine.

@micahgodbolt
Copy link
Member

yeah, this works fine. my only last suggestion would be to write a story about customizing, which would also validate the work.

@ValentinaKozlova ValentinaKozlova marked this pull request as ready for review January 20, 2025 12:28
@ValentinaKozlova ValentinaKozlova requested a review from a team as a code owner January 20, 2025 12:28
Copy link
Contributor

@dmytrokirpa dmytrokirpa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not want to expose all internal variables. For instance, sliderThumbPositionVar is a computed value derived from progressVar, so modifying it independently might not be logical.

However, I agree that color and size variables could be safely exposed.

Copy link
Contributor

@Hotell Hotell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to double check to make sure we are not breaking our public API contract.

can you confirm that these vars were supposed to be exposed since release ? and this is just fix to previous assumption ?

we should be very careful about exposing internal things ( they are called internal for some reason )

ty

Copy link
Member

@micahgodbolt micahgodbolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm fine without the desctructuring if we find that its better for compilers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: internal CSS variables aren't exported for Slider component
5 participants