feat(menu, popover): add static classes - #20450
Conversation
| export const menuGroupClassName = 'fui-MenuGroup'; | ||
|
|
||
| export const useMenuGroupStyles = (state: MenuGroupState): MenuGroupState => { | ||
| state.root.className = mergeClasses(menuGroupClassName, state.root.className); |
There was a problem hiding this comment.
Some components does not have use*Styles hook, but I decided to add it to follow the same pattern rather than merging classes in the state.
| export * from './MenuItemRadio'; | ||
| export * from './renderMenuItemRadio'; | ||
| export * from './useMenuItemRadio'; | ||
| export * from './useMenuItemRadioStyles'; |
There was a problem hiding this comment.
Oops, was not exported before.
| import { useMenuItemStyles } from '../MenuItem/useMenuItemStyles'; | ||
| import type { MenuItemCheckboxState } from './MenuItemCheckbox.types'; | ||
|
|
||
| export const useMenuItemCheckBoxStyles = (state: MenuItemCheckboxState) => { |
There was a problem hiding this comment.
Oops, this hook was named differently before (useMenuItemCheckBoxStyles).
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 08bd47e97c2a14080793f78ccb57ebfb798c32eb (build) |
📊 Bundle size reportUnchanged fixtures
|
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 992 | 978 | 5000 | |
| BaseButton | mount | 978 | 958 | 5000 | |
| Breadcrumb | mount | 2836 | 2871 | 1000 | |
| ButtonNext | mount | 529 | 535 | 5000 | |
| Checkbox | mount | 1612 | 1602 | 5000 | |
| CheckboxBase | mount | 1434 | 1316 | 5000 | |
| ChoiceGroup | mount | 4976 | 4985 | 5000 | |
| ComboBox | mount | 1078 | 977 | 1000 | |
| CommandBar | mount | 10879 | 10746 | 1000 | |
| ContextualMenu | mount | 6717 | 6772 | 1000 | |
| DefaultButton | mount | 1213 | 1160 | 5000 | |
| DetailsRow | mount | 3855 | 3880 | 5000 | |
| DetailsRowFast | mount | 3873 | 3912 | 5000 | |
| DetailsRowNoStyles | mount | 3683 | 3715 | 5000 | |
| Dialog | mount | 2636 | 2605 | 1000 | |
| DocumentCardTitle | mount | 188 | 163 | 1000 | |
| Dropdown | mount | 3384 | 3406 | 5000 | |
| FluentProviderNext | mount | 3554 | 3470 | 5000 | |
| FluentProviderWithTheme | mount | 226 | 205 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 106 | 109 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 271 | 254 | 10 | |
| FocusTrapZone | mount | 1777 | 1877 | 5000 | |
| FocusZone | mount | 1870 | 1850 | 5000 | |
| IconButton | mount | 1744 | 1774 | 5000 | |
| Label | mount | 361 | 357 | 5000 | |
| Layer | mount | 3062 | 3094 | 5000 | |
| Link | mount | 492 | 503 | 5000 | |
| MakeStyles | mount | 1888 | 1938 | 50000 | |
| MenuButton | mount | 1519 | 1488 | 5000 | |
| MessageBar | mount | 2091 | 2113 | 5000 | |
| Nav | mount | 3489 | 3369 | 1000 | |
| OverflowSet | mount | 1166 | 1183 | 5000 | |
| Panel | mount | 2467 | 2517 | 1000 | |
| Persona | mount | 895 | 907 | 1000 | |
| Pivot | mount | 1485 | 1488 | 1000 | |
| PrimaryButton | mount | 1339 | 1357 | 5000 | |
| Rating | mount | 7867 | 7962 | 5000 | |
| SearchBox | mount | 1325 | 1390 | 5000 | |
| Shimmer | mount | 2604 | 2550 | 5000 | |
| Slider | mount | 2022 | 1990 | 5000 | |
| SpinButton | mount | 5213 | 5239 | 5000 | |
| Spinner | mount | 448 | 462 | 5000 | |
| SplitButton | mount | 3229 | 3263 | 5000 | |
| Stack | mount | 550 | 526 | 5000 | |
| StackWithIntrinsicChildren | mount | 1786 | 1776 | 5000 | |
| StackWithTextChildren | mount | 4757 | 4837 | 5000 | |
| SwatchColorPicker | mount | 10703 | 10678 | 5000 | |
| TagPicker | mount | 2826 | 2728 | 5000 | |
| TeachingBubble | mount | 13553 | 13463 | 5000 | |
| Text | mount | 451 | 457 | 5000 | |
| TextField | mount | 1464 | 1438 | 5000 | |
| ThemeProvider | mount | 1230 | 1253 | 5000 | |
| ThemeProvider | virtual-rerender | 651 | 620 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 1941 | 1959 | 5000 | |
| Toggle | mount | 836 | 853 | 5000 | |
| buttonNative | mount | 140 | 147 | 5000 |
Perf Analysis (@fluentui/react-northstar)
Perf tests with no regressions
| Scenario | Current PR Ticks | Baseline Ticks | Ratio |
|---|---|---|---|
| AccordionMinimalPerf.default | 171 | 157 | 1.09:1 |
| TreeWith60ListItems.default | 198 | 182 | 1.09:1 |
| TableMinimalPerf.default | 426 | 393 | 1.08:1 |
| BoxMinimalPerf.default | 364 | 345 | 1.06:1 |
| SegmentMinimalPerf.default | 381 | 358 | 1.06:1 |
| TextAreaMinimalPerf.default | 526 | 496 | 1.06:1 |
| ButtonMinimalPerf.default | 181 | 172 | 1.05:1 |
| FormMinimalPerf.default | 429 | 408 | 1.05:1 |
| ListNestedPerf.default | 617 | 587 | 1.05:1 |
| AlertMinimalPerf.default | 287 | 277 | 1.04:1 |
| ChatDuplicateMessagesPerf.default | 315 | 302 | 1.04:1 |
| ImageMinimalPerf.default | 395 | 378 | 1.04:1 |
| ListMinimalPerf.default | 525 | 503 | 1.04:1 |
| RefMinimalPerf.default | 252 | 242 | 1.04:1 |
| ToolbarMinimalPerf.default | 969 | 929 | 1.04:1 |
| ChatWithPopoverPerf.default | 400 | 389 | 1.03:1 |
| FlexMinimalPerf.default | 300 | 290 | 1.03:1 |
| ItemLayoutMinimalPerf.default | 1277 | 1234 | 1.03:1 |
| LoaderMinimalPerf.default | 740 | 717 | 1.03:1 |
| PortalMinimalPerf.default | 183 | 177 | 1.03:1 |
| StatusMinimalPerf.default | 687 | 669 | 1.03:1 |
| TextMinimalPerf.default | 368 | 359 | 1.03:1 |
| TooltipMinimalPerf.default | 1067 | 1031 | 1.03:1 |
| AnimationMinimalPerf.default | 432 | 425 | 1.02:1 |
| ButtonOverridesMissPerf.default | 1846 | 1817 | 1.02:1 |
| CardMinimalPerf.default | 572 | 561 | 1.02:1 |
| GridMinimalPerf.default | 372 | 363 | 1.02:1 |
| ButtonSlotsPerf.default | 582 | 577 | 1.01:1 |
| CheckboxMinimalPerf.default | 2892 | 2866 | 1.01:1 |
| DialogMinimalPerf.default | 779 | 772 | 1.01:1 |
| DropdownMinimalPerf.default | 3325 | 3299 | 1.01:1 |
| InputMinimalPerf.default | 1398 | 1385 | 1.01:1 |
| LabelMinimalPerf.default | 408 | 405 | 1.01:1 |
| ListCommonPerf.default | 673 | 668 | 1.01:1 |
| MenuMinimalPerf.default | 873 | 867 | 1.01:1 |
| SliderMinimalPerf.default | 1766 | 1751 | 1.01:1 |
| SplitButtonMinimalPerf.default | 4434 | 4398 | 1.01:1 |
| TableManyItemsPerf.default | 1961 | 1945 | 1.01:1 |
| CustomToolbarPrototype.default | 4241 | 4198 | 1.01:1 |
| DatepickerMinimalPerf.default | 6176 | 6195 | 1:1 |
| DropdownManyItemsPerf.default | 708 | 711 | 1:1 |
| RadioGroupMinimalPerf.default | 455 | 455 | 1:1 |
| ReactionMinimalPerf.default | 379 | 380 | 1:1 |
| AttachmentMinimalPerf.default | 167 | 169 | 0.99:1 |
| AvatarMinimalPerf.default | 203 | 205 | 0.99:1 |
| ChatMinimalPerf.default | 659 | 669 | 0.99:1 |
| DividerMinimalPerf.default | 368 | 371 | 0.99:1 |
| EmbedMinimalPerf.default | 4359 | 4405 | 0.99:1 |
| HeaderSlotsPerf.default | 769 | 778 | 0.99:1 |
| LayoutMinimalPerf.default | 382 | 384 | 0.99:1 |
| TreeMinimalPerf.default | 806 | 817 | 0.99:1 |
| AttachmentSlotsPerf.default | 1104 | 1132 | 0.98:1 |
| HeaderMinimalPerf.default | 370 | 378 | 0.98:1 |
| MenuButtonMinimalPerf.default | 1675 | 1707 | 0.98:1 |
| SkeletonMinimalPerf.default | 365 | 372 | 0.98:1 |
| ListWith60ListItems.default | 662 | 685 | 0.97:1 |
| RosterPerf.default | 1150 | 1189 | 0.97:1 |
| VideoMinimalPerf.default | 641 | 661 | 0.97:1 |
| CarouselMinimalPerf.default | 468 | 487 | 0.96:1 |
| ProviderMergeThemesPerf.default | 1755 | 1827 | 0.96:1 |
| ProviderMinimalPerf.default | 1139 | 1182 | 0.96:1 |
| PopupMinimalPerf.default | 591 | 627 | 0.94:1 |
| IconMinimalPerf.default | 623 | 664 | 0.94:1 |
|
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 a0a02a7:
|
Pull request checklist
$ yarn changeDescription of changes
✅ Extracted from #20383, these changes passed conformance test on that PR
This PR adds static classes to components
@fluentui/react-menu&@fluentui/react-popover.fui-ComponentNamecomponentNameClassNameClasses that are added to DOM are "chained" if they are composed: