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

Select vNext styles #21068

Merged
merged 16 commits into from
Mar 29, 2022
Merged

Select vNext styles #21068

merged 16 commits into from
Mar 29, 2022

Conversation

smhigley
Copy link
Contributor

@smhigley smhigley commented Dec 15, 2021

This PR depends on #20944.

The relevant file to review is useSelectStyles.ts.

Default:
screenshot of default select example

Focused:
screenshot of focused example, with a blue bottom border

Appearance:
screenshot of four select appearance variants

Size:
three size variations, small, medium, and large

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 15, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7d40275:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam
Copy link
Collaborator

fabricteam commented Dec 15, 2021

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-select
Select
7.853 kB
3.297 kB
16.562 kB
6.264 kB
8.709 kB
2.967 kB
Unchanged fixtures
Package & Exports Size (minified/GZIP)
priority-overflow
createOverflowManager
2.836 kB
1.209 kB
react-accordion
Accordion (including children components)
74.792 kB
22.516 kB
react-avatar
Avatar
45.18 kB
13.128 kB
react-badge
Badge
20.895 kB
6.567 kB
react-badge
CounterBadge
21.848 kB
6.883 kB
react-badge
PresenceBadge
21.951 kB
6.565 kB
react-button
Button
28.013 kB
8.059 kB
react-button
CompoundButton
33.508 kB
9.092 kB
react-button
MenuButton
29.796 kB
8.665 kB
react-button
SplitButton
36.268 kB
9.863 kB
react-button
ToggleButton
37.395 kB
8.68 kB
react-card
Card - All
53.619 kB
15.372 kB
react-card
Card
48.904 kB
14.089 kB
react-card
CardFooter
7.686 kB
3.264 kB
react-card
CardHeader
9.251 kB
3.78 kB
react-card
CardPreview
7.658 kB
3.291 kB
react-combobox
Combobox
6.817 kB
2.901 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
176.084 kB
49.112 kB
react-components
react-components: FluentProvider & webLightTheme
32.526 kB
10.645 kB
react-divider
Divider
15.385 kB
5.539 kB
react-image
Image
10.109 kB
3.958 kB
react-input
Input
21.635 kB
7.166 kB
react-label
Label
8.371 kB
3.504 kB
react-link
Link
11.106 kB
4.507 kB
react-menu
Menu (including children components)
105.847 kB
32.431 kB
react-menu
Menu (including selectable components)
109.026 kB
32.895 kB
react-popover
Popover
96.782 kB
29.558 kB
react-portal
Portal
6.267 kB
2.168 kB
react-positioning
usePopper
23.21 kB
8.084 kB
react-priority-overflow
hooks only
10.606 kB
4.087 kB
react-provider
FluentProvider
14.009 kB
5.25 kB
react-slider
Slider
25.402 kB
8.251 kB
react-spinner
Spinner
6.815 kB
2.9 kB
react-switch
Switch
24.279 kB
8.001 kB
react-text
Text - Default
10.797 kB
4.233 kB
react-text
Text - Wrappers
14.113 kB
4.576 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
29.426 kB
6.551 kB
react-theme
Teams: Light theme
18.42 kB
5.27 kB
react-tooltip
Tooltip
42.789 kB
14.712 kB
react-utilities
SSRProvider
189 B
161 B
🤖 This report was generated against f4ed6d116e253769f298f787de8a9461f76184b3

@size-auditor
Copy link

size-auditor bot commented Dec 15, 2021

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: f4ed6d116e253769f298f787de8a9461f76184b3 (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Dec 15, 2021

Perf Analysis (@fluentui/react)

Scenario Render type Master Ticks PR Ticks Iterations Status
buttonNative mount 95 114 5000 Possible regression
All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 776 793 5000
Breadcrumb mount 2371 2268 1000
Checkbox mount 1197 1282 5000
CheckboxBase mount 1097 1092 5000
ChoiceGroup mount 3961 4095 5000
ComboBox mount 848 859 1000
CommandBar mount 8858 8891 1000
ContextualMenu mount 11083 11596 1000
DefaultButton mount 987 967 5000
DetailsRow mount 3290 3221 5000
DetailsRowFast mount 3267 3321 5000
DetailsRowNoStyles mount 3051 3168 5000
Dialog mount 1869 1972 1000
DocumentCardTitle mount 144 143 1000
Dropdown mount 2895 2781 5000
FocusTrapZone mount 1571 1566 5000
FocusZone mount 1577 1589 5000
IconButton mount 1499 1519 5000
Label mount 297 302 5000
Layer mount 2499 2557 5000
Link mount 404 415 5000
MenuButton mount 1277 1274 5000
MessageBar mount 1803 1655 5000
Nav mount 2886 2790 1000
OverflowSet mount 942 971 5000
Panel mount 1875 1840 1000
Persona mount 739 742 1000
Pivot mount 1247 1257 1000
PrimaryButton mount 1131 1093 5000
Rating mount 6552 6597 5000
SearchBox mount 1094 1116 5000
Shimmer mount 2156 2142 5000
Slider mount 1678 1645 5000
SpinButton mount 4411 4420 5000
Spinner mount 367 379 5000
SplitButton mount 2728 2769 5000
Stack mount 453 414 5000
StackWithIntrinsicChildren mount 1988 1924 5000
StackWithTextChildren mount 4571 4576 5000
SwatchColorPicker mount 10056 10053 5000
TagPicker mount 2256 2307 5000
TeachingBubble mount 87237 101068 5000
Text mount 367 371 5000
TextField mount 1185 1213 5000
ThemeProvider mount 1014 1016 5000
ThemeProvider virtual-rerender 564 567 5000
ThemeProvider virtual-rerender-with-unmount 1602 1582 5000
Toggle mount 643 692 5000
buttonNative mount 95 114 5000 Possible regression

@smhigley smhigley changed the title DRAFT: Select vNext styles Select vNext styles Mar 16, 2022
@smhigley smhigley marked this pull request as ready for review March 16, 2022 19:04
@smhigley smhigley requested review from a team as code owners March 16, 2022 19:04
@micahgodbolt
Copy link
Member

are there any pngs/animated gifs you can add to this PR description?

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 16, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 844 903 5000
Button mount 549 532 5000
FluentProvider mount 1774 1765 5000
FluentProviderWithTheme mount 258 273 10
FluentProviderWithTheme virtual-rerender 234 239 10
FluentProviderWithTheme virtual-rerender-with-unmount 266 283 10
MakeStyles mount 1506 1471 50000

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 16, 2022

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
TooltipMinimalPerf.default 870 757 1.15:1
CardMinimalPerf.default 479 422 1.14:1
ChatDuplicateMessagesPerf.default 263 234 1.12:1
TextMinimalPerf.default 280 255 1.1:1
DropdownMinimalPerf.default 2581 2366 1.09:1
PopupMinimalPerf.default 533 490 1.09:1
HeaderMinimalPerf.default 308 288 1.07:1
ListMinimalPerf.default 437 407 1.07:1
ReactionMinimalPerf.default 327 308 1.06:1
TreeMinimalPerf.default 641 605 1.06:1
FlexMinimalPerf.default 252 241 1.05:1
LabelMinimalPerf.default 336 321 1.05:1
PortalMinimalPerf.default 155 148 1.05:1
DividerMinimalPerf.default 310 297 1.04:1
ProviderMergeThemesPerf.default 1403 1353 1.04:1
VideoMinimalPerf.default 581 560 1.04:1
AccordionMinimalPerf.default 118 115 1.03:1
ChatMinimalPerf.default 600 580 1.03:1
ListWith60ListItems.default 552 536 1.03:1
ProviderMinimalPerf.default 891 864 1.03:1
StatusMinimalPerf.default 570 555 1.03:1
TableManyItemsPerf.default 1583 1532 1.03:1
CarouselMinimalPerf.default 355 348 1.02:1
DropdownManyItemsPerf.default 573 563 1.02:1
ItemLayoutMinimalPerf.default 960 945 1.02:1
TableMinimalPerf.default 348 341 1.02:1
ButtonOverridesMissPerf.default 1423 1412 1.01:1
EmbedMinimalPerf.default 3441 3418 1.01:1
ListCommonPerf.default 536 533 1.01:1
RefMinimalPerf.default 211 208 1.01:1
SliderMinimalPerf.default 1376 1361 1.01:1
CustomToolbarPrototype.default 3461 3435 1.01:1
TreeWith60ListItems.default 160 158 1.01:1
AnimationMinimalPerf.default 462 462 1:1
DialogMinimalPerf.default 636 638 1:1
SplitButtonMinimalPerf.default 3461 3445 1:1
ToolbarMinimalPerf.default 767 767 1:1
AlertMinimalPerf.default 231 234 0.99:1
ButtonSlotsPerf.default 472 478 0.99:1
CheckboxMinimalPerf.default 2184 2205 0.99:1
SegmentMinimalPerf.default 289 291 0.99:1
HeaderSlotsPerf.default 625 636 0.98:1
BoxMinimalPerf.default 268 277 0.97:1
AttachmentMinimalPerf.default 127 132 0.96:1
ImageMinimalPerf.default 270 280 0.96:1
RadioGroupMinimalPerf.default 359 373 0.96:1
FormMinimalPerf.default 338 356 0.95:1
LoaderMinimalPerf.default 554 582 0.95:1
DatepickerMinimalPerf.default 4366 4655 0.94:1
GridMinimalPerf.default 273 291 0.94:1
ListNestedPerf.default 414 442 0.94:1
RosterPerf.default 878 934 0.94:1
IconMinimalPerf.default 461 489 0.94:1
TextAreaMinimalPerf.default 385 411 0.94:1
AttachmentSlotsPerf.default 807 867 0.93:1
ChatWithPopoverPerf.default 308 331 0.93:1
LayoutMinimalPerf.default 280 300 0.93:1
MenuMinimalPerf.default 645 690 0.93:1
AvatarMinimalPerf.default 154 170 0.91:1
InputMinimalPerf.default 999 1105 0.9:1
MenuButtonMinimalPerf.default 1252 1386 0.9:1
SkeletonMinimalPerf.default 268 298 0.9:1
ButtonMinimalPerf.default 122 144 0.85:1

@smhigley
Copy link
Contributor Author

@micahgodbolt good call, updated!


// TODO: borrowed from Input, also seems like animation should be included in the theme:
const motionDurations = {
ultraFast: '0.05s',
Copy link
Member

Choose a reason for hiding this comment

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

Having decimal seconds reads strange rather than specifying in milliseconds, but maybe I'm old school CSS here.

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 borrowed these wholesale from Input so we could rip them out and put them somewhere else easily :)

I actually kinda do like putting all animation durations in seconds b/c I've found it easier to compare values across different durations. That's a super light personal preference though, and I don't actually care much whether we use s or ms :D

)`,
...shorthands.borderRadius(0, 0, tokens.borderRadiusMedium, tokens.borderRadiusMedium),
content: '""',
height: tokens.borderRadiusMedium,
Copy link
Member

Choose a reason for hiding this comment

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

Do you mean to have a height value set to a border radius? (I don't really understand what is going on with this after element though :) )

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 did! This is for the focus indicator :)

disabled: {
backgroundColor: tokens.colorTransparentBackground,
color: tokens.colorNeutralForegroundDisabled,
cursor: 'not-allowed',
Copy link
Member

Choose a reason for hiding this comment

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

Should we do not-allowed on other clickable controls when they are disabled? I didn't do that on tabs, but maybe I should.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! I remember talking about it with Elizabeth, and aligned the Select styles with Input, which also does this. I don't have strong opinions on the cursor style in general either way.

Comment on lines +59 to +62
const motionCurves = {
accelerateMid: 'cubic-bezier(0.7,0,1,0.5)',
decelerateMid: 'cubic-bezier(0.1,0.9,0.2,1)',
};
Copy link
Member

@ling1726 ling1726 Mar 17, 2022

Choose a reason for hiding this comment

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

Suggested change
const motionCurves = {
accelerateMid: 'cubic-bezier(0.7,0,1,0.5)',
decelerateMid: 'cubic-bezier(0.1,0.9,0.2,1)',
};

I don't think you reuse these values anywhere, you can just inline them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I pulled them out is b/c they're also used in Input styles, and I think it'd be good to find a way in the future to share a bunch of these values with the input package (and in the future other components like spinbutton, maybe textarea, etc).

I have a mild preference for keeping it separate so all the shared values are in one place, but I agree that if these values continue being defined in useSelectStyles, it'd make sense to just put them inline.

I'll restructure the shared values slightly and put a bigger TODO comment above all of them with more explanation -- how does that sound to you for now?

Copy link
Member

Choose a reason for hiding this comment

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

Can we track this in an issue instead and add it to the react-components board, TODOs in the code will always be lost

Copy link
Member

Choose a reason for hiding this comment

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

it seems that the styles have found a home in react-tabster in #22096 thanks to @sopranopillow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

issue created!

Copy link
Contributor

Choose a reason for hiding this comment

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

react-tabster will be its home for now, we'll probably decide where it should live on wednesday.

m: '12px',
};
const contentSizes = {
// TODO: borrowed this from Input, should be in the theme somewhere?
Copy link
Member

Choose a reason for hiding this comment

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

aren't these styles exported by react-text ?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from chatting with @ling1726 -- I'm going to update these to pull from react-text, and I'll create a separate PR to update in Input as well 👍

Copy link
Member

Choose a reason for hiding this comment

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

@andrefcdias is it intentional that only the text components are exported but not the typography styles ? this seems like exactly the case where we would need the styles to avoid duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, since typographyStyles are not currently exported from react-text, @ling1726 how would you feel about keeping this as-is for now and updating both Select and Input when that gets resolved?

Copy link
Contributor

Choose a reason for hiding this comment

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

Outcome from tech sync was not to export until needed due to bundle size concerns. Let me know if you want me to open a PR with the exports or feel free to open one and tag me.

Copy link
Member

Choose a reason for hiding this comment

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

The main issue with duplicating text styles internally is that it would increase bundle size for the whole library since these styles will not be deduplicated

Copy link
Member

Choose a reason for hiding this comment

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

I've added this to tech sync we will discuss offline how to deal with the duplicated styles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created this issue: #22231

@smhigley smhigley requested a review from ling1726 March 22, 2022 21:05
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.

8 participants