@fluentui/react-menu 9.25.8 → 9.25.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +33 -2
  2. package/lib/components/Menu/useMenu.js +12 -20
  3. package/lib/components/Menu/useMenu.js.map +1 -1
  4. package/lib/components/MenuItem/useCharacterSearch.js +3 -4
  5. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  6. package/lib/components/MenuItem/useMenuItem.js +2 -2
  7. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  8. package/lib/components/MenuItem/useMenuItemBase.js +4 -8
  9. package/lib/components/MenuItem/useMenuItemBase.js.map +1 -1
  10. package/lib/components/MenuItem/useMenuItemStyles.styles.js +4 -4
  11. package/lib/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
  12. package/lib/components/MenuItem/useMenuItemStyles.styles.raw.js +4 -4
  13. package/lib/components/MenuItem/useMenuItemStyles.styles.raw.js.map +1 -1
  14. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +5 -7
  15. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  16. package/lib/components/MenuItemRadio/useMenuItemRadio.js +5 -7
  17. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  18. package/lib/components/MenuItemSwitch/useMenuItemSwitch.js +3 -3
  19. package/lib/components/MenuItemSwitch/useMenuItemSwitch.js.map +1 -1
  20. package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js +1 -1
  21. package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js.map +1 -1
  22. package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.raw.js +1 -1
  23. package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.raw.js.map +1 -1
  24. package/lib/components/MenuList/useMenuList.js +8 -12
  25. package/lib/components/MenuList/useMenuList.js.map +1 -1
  26. package/lib/components/MenuPopover/useMenuPopover.js +6 -12
  27. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  28. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +1 -2
  29. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  30. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +5 -6
  31. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  32. package/lib/components/MenuTrigger/useMenuTrigger.js +16 -17
  33. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  34. package/lib/contexts/menuGroupContext.js +1 -4
  35. package/lib/contexts/menuGroupContext.js.map +1 -1
  36. package/lib/contexts/menuSplitGroupContext.js +1 -4
  37. package/lib/contexts/menuSplitGroupContext.js.map +1 -1
  38. package/lib/contexts/menuTriggerContext.js +1 -4
  39. package/lib/contexts/menuTriggerContext.js.map +1 -1
  40. package/lib/utils/useOnMenuEnter.js +1 -2
  41. package/lib/utils/useOnMenuEnter.js.map +1 -1
  42. package/lib/utils/useOnMenuSafeZoneTimeout.js +2 -3
  43. package/lib/utils/useOnMenuSafeZoneTimeout.js.map +1 -1
  44. package/lib/utils/useValidateNesting.js +11 -13
  45. package/lib/utils/useValidateNesting.js.map +1 -1
  46. package/lib-commonjs/components/Menu/useMenu.cjs +13 -19
  47. package/lib-commonjs/components/Menu/useMenu.cjs.map +1 -1
  48. package/lib-commonjs/components/MenuItem/useCharacterSearch.cjs +3 -4
  49. package/lib-commonjs/components/MenuItem/useCharacterSearch.cjs.map +1 -1
  50. package/lib-commonjs/components/MenuItem/useMenuItem.cjs +2 -2
  51. package/lib-commonjs/components/MenuItem/useMenuItem.cjs.map +1 -1
  52. package/lib-commonjs/components/MenuItem/useMenuItemBase.cjs +4 -8
  53. package/lib-commonjs/components/MenuItem/useMenuItemBase.cjs.map +1 -1
  54. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.cjs +4 -4
  55. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.cjs.map +1 -1
  56. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.raw.cjs +4 -4
  57. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.raw.cjs.map +1 -1
  58. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.cjs +5 -7
  59. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.cjs.map +1 -1
  60. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.cjs +5 -7
  61. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.cjs.map +1 -1
  62. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitch.cjs +3 -3
  63. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitch.cjs.map +1 -1
  64. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.cjs +1 -1
  65. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.cjs.map +1 -1
  66. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.raw.cjs +1 -1
  67. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.raw.cjs.map +1 -1
  68. package/lib-commonjs/components/MenuList/useMenuList.cjs +8 -12
  69. package/lib-commonjs/components/MenuList/useMenuList.cjs.map +1 -1
  70. package/lib-commonjs/components/MenuPopover/useMenuPopover.cjs +6 -12
  71. package/lib-commonjs/components/MenuPopover/useMenuPopover.cjs.map +1 -1
  72. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.cjs +1 -2
  73. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.cjs.map +1 -1
  74. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.cjs +5 -6
  75. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.cjs.map +1 -1
  76. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.cjs +16 -17
  77. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.cjs.map +1 -1
  78. package/lib-commonjs/contexts/menuGroupContext.cjs +1 -4
  79. package/lib-commonjs/contexts/menuGroupContext.cjs.map +1 -1
  80. package/lib-commonjs/contexts/menuSplitGroupContext.cjs +1 -4
  81. package/lib-commonjs/contexts/menuSplitGroupContext.cjs.map +1 -1
  82. package/lib-commonjs/contexts/menuTriggerContext.cjs +1 -4
  83. package/lib-commonjs/contexts/menuTriggerContext.cjs.map +1 -1
  84. package/lib-commonjs/utils/useOnMenuEnter.cjs +1 -2
  85. package/lib-commonjs/utils/useOnMenuEnter.cjs.map +1 -1
  86. package/lib-commonjs/utils/useOnMenuSafeZoneTimeout.cjs +2 -3
  87. package/lib-commonjs/utils/useOnMenuSafeZoneTimeout.cjs.map +1 -1
  88. package/lib-commonjs/utils/useValidateNesting.cjs +11 -13
  89. package/lib-commonjs/utils/useValidateNesting.cjs.map +1 -1
  90. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuItem/useMenuItemStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { mergeClasses, makeStyles, makeResetStyles } from '@griffel/react';\nimport { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { useCheckmarkStyles_unstable } from '../../selectable/index';\nimport type { MenuItemCheckboxState } from '../MenuItemCheckbox/index';\nimport type { MenuItemSlots, MenuItemState } from './MenuItem.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const menuItemClassNames: SlotClassNames<MenuItemSlots> = {\n root: 'fui-MenuItem',\n icon: 'fui-MenuItem__icon',\n checkmark: 'fui-MenuItem__checkmark',\n submenuIndicator: 'fui-MenuItem__submenuIndicator',\n content: 'fui-MenuItem__content',\n secondaryContent: 'fui-MenuItem__secondaryContent',\n subText: 'fui-MenuItem__subText',\n};\n\nconst slotsSelector = `& .${menuItemClassNames.icon}, & .${menuItemClassNames.checkmark}, & .${menuItemClassNames.subText}, & .${menuItemClassNames.secondaryContent}`;\n\nconst useRootBaseStyles = makeResetStyles({\n borderRadius: tokens.borderRadiusMedium,\n position: 'relative',\n color: tokens.colorNeutralForeground2,\n backgroundColor: tokens.colorNeutralBackground1,\n paddingRight: tokens.spacingVerticalSNudge, // 6px\n paddingLeft: tokens.spacingVerticalSNudge,\n paddingTop: tokens.spacingVerticalSNudge,\n paddingBottom: tokens.spacingVerticalSNudge,\n boxSizing: 'border-box',\n maxWidth: '290px',\n minHeight: '32px',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'start',\n fontSize: tokens.fontSizeBase300,\n cursor: 'pointer',\n gap: '4px',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n [`& .${menuItemClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForeground3Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n },\n },\n\n // High contrast styles\n '@media (forced-colors: active)': {\n ':hover': {\n forcedColorAdjust: 'none',\n backgroundColor: 'Highlight',\n color: 'HighlightText',\n\n [slotsSelector]: {\n color: 'HighlightText',\n },\n },\n ...createFocusOutlineStyle({ style: { outlineColor: 'Highlight' } }),\n },\n\n userSelect: 'none',\n ...createFocusOutlineStyle(),\n});\n\nconst useContentBaseStyles = makeResetStyles({\n paddingLeft: '2px',\n paddingRight: '2px',\n backgroundColor: 'transparent',\n flexGrow: 1,\n});\n\nconst useSecondaryContentBaseStyles = makeResetStyles({\n paddingLeft: '2px',\n paddingRight: '2px',\n ...typographyStyles.caption1,\n lineHeight: tokens.lineHeightBase300,\n color: tokens.colorNeutralForeground3,\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n },\n ':focus': {\n color: tokens.colorNeutralForeground3Hover,\n },\n});\n\nconst useIconBaseStyles = makeResetStyles({\n width: '20px',\n height: '20px',\n fontSize: '20px',\n lineHeight: 0,\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n flexShrink: 0,\n});\n\nconst useSubmenuIndicatorBaseStyles = makeResetStyles({\n width: '20px',\n height: '20px',\n fontSize: '20px',\n lineHeight: 0,\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n});\n\nconst useSubtextBaseStyles = makeResetStyles({\n ...typographyStyles.caption2,\n color: tokens.colorNeutralForeground3,\n});\n\nconst useStyles = makeStyles({\n checkmark: {\n marginTop: '2px',\n },\n\n splitItemMain: {\n flexGrow: 1,\n },\n\n splitItemTrigger: {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n paddingLeft: 0,\n '::before': {\n content: '\"\"',\n width: tokens.strokeWidthThin,\n height: '24px',\n backgroundColor: tokens.colorNeutralStroke1,\n },\n },\n submenuOpen: {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n [`& .${menuItemClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForeground3Hover,\n },\n\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'none',\n backgroundColor: 'Highlight',\n color: 'HighlightText',\n\n [slotsSelector]: {\n color: 'HighlightText',\n },\n },\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorNeutralBackground1,\n cursor: 'not-allowed',\n [`& .${iconFilledClassName}`]: {\n display: 'none',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'inline',\n },\n [`& .${menuItemClassNames.icon}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n ':hover:active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorNeutralBackground1,\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n ':focus': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n ':hover': {\n forcedColorAdjust: 'auto',\n color: 'GrayText',\n backgroundColor: 'Canvas',\n [`& .${menuItemClassNames.icon}`]: {\n color: 'GrayText',\n backgroundColor: 'Canvas',\n },\n [slotsSelector]: {\n color: 'GrayText',\n },\n },\n ':hover:active': {\n color: 'GrayText',\n backgroundColor: 'Canvas',\n [`& .${menuItemClassNames.subText}`]: {\n color: 'GrayText',\n },\n },\n ':focus': {\n color: 'GrayText',\n backgroundColor: 'Canvas',\n },\n },\n },\n});\n\nconst useSubTextStyles = makeStyles({\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n});\n\nconst useMultilineStyles = makeStyles({\n content: {\n display: 'flex',\n flexDirection: 'column',\n },\n\n secondaryContent: {\n alignSelf: 'center',\n },\n\n submenuIndicator: {\n alignSelf: 'center',\n },\n});\n\n/** Applies style classnames to slots */\nexport const useMenuItemStyles_unstable = (state: MenuItemState): MenuItemState => {\n const styles = useStyles();\n const rootBaseStyles = useRootBaseStyles();\n const contentBaseStyles = useContentBaseStyles();\n const secondaryContentBaseStyles = useSecondaryContentBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const submenuIndicatorBaseStyles = useSubmenuIndicatorBaseStyles();\n const multilineStyles = useMultilineStyles();\n const subtextBaseStyles = useSubtextBaseStyles();\n const subTextStyles = useSubTextStyles();\n const multiline = !!state.subText;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n menuItemClassNames.root,\n rootBaseStyles,\n state.submenuOpen && styles.submenuOpen,\n state.disabled && styles.disabled,\n state.root.className,\n );\n\n if (state.content) {\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(\n menuItemClassNames.content,\n contentBaseStyles,\n state.content.className,\n multiline && multilineStyles.content,\n );\n }\n\n if (state.checkmark) {\n // eslint-disable-next-line react-hooks/immutability\n state.checkmark.className = mergeClasses(menuItemClassNames.checkmark, styles.checkmark, state.checkmark.className);\n }\n\n if (state.secondaryContent) {\n // eslint-disable-next-line react-hooks/immutability\n state.secondaryContent.className = mergeClasses(\n menuItemClassNames.secondaryContent,\n secondaryContentBaseStyles,\n state.disabled && styles.disabled,\n state.secondaryContent.className,\n multiline && multilineStyles.secondaryContent,\n );\n }\n\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(menuItemClassNames.icon, iconBaseStyles, state.icon.className);\n }\n\n if (state.submenuIndicator) {\n // eslint-disable-next-line react-hooks/immutability\n state.submenuIndicator.className = mergeClasses(\n menuItemClassNames.submenuIndicator,\n submenuIndicatorBaseStyles,\n state.submenuIndicator.className,\n multiline && multilineStyles.submenuIndicator,\n );\n }\n\n if (state.subText) {\n // eslint-disable-next-line react-hooks/immutability\n state.subText.className = mergeClasses(\n menuItemClassNames.subText,\n state.disabled && subTextStyles.disabled,\n state.subText.className,\n subtextBaseStyles,\n );\n }\n\n useCheckmarkStyles_unstable(state as MenuItemCheckboxState);\n\n return state;\n};\n"],"names":["mergeClasses","makeStyles","makeResetStyles","iconFilledClassName","iconRegularClassName","createFocusOutlineStyle","tokens","typographyStyles","useCheckmarkStyles_unstable","menuItemClassNames","root","icon","checkmark","submenuIndicator","content","secondaryContent","subText","slotsSelector","useRootBaseStyles","borderRadius","borderRadiusMedium","position","color","colorNeutralForeground2","backgroundColor","colorNeutralBackground1","paddingRight","spacingVerticalSNudge","paddingLeft","paddingTop","paddingBottom","boxSizing","maxWidth","minHeight","flexShrink","display","alignItems","fontSize","fontSizeBase300","cursor","gap","colorNeutralBackground1Hover","colorNeutralForeground2Hover","colorNeutralForeground2BrandSelected","colorNeutralForeground3Hover","colorNeutralBackground1Pressed","colorNeutralForeground2Pressed","colorNeutralForeground3Pressed","forcedColorAdjust","style","outlineColor","userSelect","useContentBaseStyles","flexGrow","useSecondaryContentBaseStyles","caption1","lineHeight","lineHeightBase300","colorNeutralForeground3","useIconBaseStyles","width","height","justifyContent","useSubmenuIndicatorBaseStyles","useSubtextBaseStyles","caption2","useStyles","marginTop","splitItemMain","splitItemTrigger","borderTopLeftRadius","borderBottomLeftRadius","strokeWidthThin","colorNeutralStroke1","submenuOpen","disabled","colorNeutralForegroundDisabled","useSubTextStyles","useMultilineStyles","flexDirection","alignSelf","useMenuItemStyles_unstable","state","styles","rootBaseStyles","contentBaseStyles","secondaryContentBaseStyles","iconBaseStyles","submenuIndicatorBaseStyles","multilineStyles","subtextBaseStyles","subTextStyles","multiline","className"],"mappings":"AAAA;AAEA,SAASA,YAAY,EAAEC,UAAU,EAAEC,eAAe,QAAQ,iBAAiB;AAC3E,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,wBAAwB;AAClF,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,wBAAwB;AACjE,SAASC,2BAA2B,QAAQ,4BAAyB;AAKrE,OAAO,MAAMC,qBAAoD;IAC/DC,MAAM;IACNC,MAAM;IACNC,WAAW;IACXC,kBAAkB;IAClBC,SAAS;IACTC,kBAAkB;IAClBC,SAAS;AACX,EAAE;AAEF,MAAMC,gBAAgB,CAAC,GAAG,EAAER,mBAAmBE,IAAI,CAAC,KAAK,EAAEF,mBAAmBG,SAAS,CAAC,KAAK,EAAEH,mBAAmBO,OAAO,CAAC,KAAK,EAAEP,mBAAmBM,gBAAgB,EAAE;AAEtK,MAAMG,oBAAoB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sourcesContent":["'use client';\n\nimport { mergeClasses, makeStyles, makeResetStyles } from '@griffel/react';\nimport { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { useCheckmarkStyles_unstable } from '../../selectable/index';\nimport type { MenuItemCheckboxState } from '../MenuItemCheckbox/index';\nimport type { MenuItemSlots, MenuItemState } from './MenuItem.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const menuItemClassNames: SlotClassNames<MenuItemSlots> = {\n root: 'fui-MenuItem',\n icon: 'fui-MenuItem__icon',\n checkmark: 'fui-MenuItem__checkmark',\n submenuIndicator: 'fui-MenuItem__submenuIndicator',\n content: 'fui-MenuItem__content',\n secondaryContent: 'fui-MenuItem__secondaryContent',\n subText: 'fui-MenuItem__subText',\n};\n\nconst slotsSelector = `& .${menuItemClassNames.icon}, & .${menuItemClassNames.checkmark}, & .${menuItemClassNames.subText}, & .${menuItemClassNames.secondaryContent}`;\n\nconst useRootBaseStyles = makeResetStyles({\n borderRadius: tokens.borderRadiusMedium,\n position: 'relative',\n color: tokens.colorNeutralForeground2,\n backgroundColor: tokens.colorNeutralBackground1,\n paddingRight: tokens.spacingVerticalSNudge, // 6px\n paddingLeft: tokens.spacingVerticalSNudge,\n paddingTop: tokens.spacingVerticalSNudge,\n paddingBottom: tokens.spacingVerticalSNudge,\n boxSizing: 'border-box',\n maxWidth: '290px',\n minHeight: '32px',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'start',\n fontSize: tokens.fontSizeBase300,\n cursor: 'pointer',\n gap: '4px',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n [`& .${menuItemClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForeground3Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n },\n },\n\n // High contrast styles\n '@media (forced-colors: active)': {\n ':hover': {\n forcedColorAdjust: 'none',\n backgroundColor: 'Highlight',\n color: 'HighlightText',\n\n [slotsSelector]: {\n color: 'HighlightText',\n },\n },\n ...createFocusOutlineStyle({ style: { outlineColor: 'Highlight' } }),\n },\n\n userSelect: 'none',\n ...createFocusOutlineStyle(),\n});\n\nconst useContentBaseStyles = makeResetStyles({\n paddingLeft: '2px',\n paddingRight: '2px',\n backgroundColor: 'transparent',\n flexGrow: 1,\n});\n\nconst useSecondaryContentBaseStyles = makeResetStyles({\n paddingLeft: '2px',\n paddingRight: '2px',\n ...typographyStyles.caption1,\n lineHeight: tokens.lineHeightBase300,\n color: tokens.colorNeutralForeground3,\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n },\n ':focus': {\n color: tokens.colorNeutralForeground3Hover,\n },\n});\n\nconst useIconBaseStyles = makeResetStyles({\n width: '20px',\n height: '20px',\n fontSize: '20px',\n lineHeight: 0,\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n flexShrink: 0,\n});\n\nconst useSubmenuIndicatorBaseStyles = makeResetStyles({\n width: '20px',\n height: '20px',\n fontSize: '20px',\n lineHeight: 0,\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n});\n\nconst useSubtextBaseStyles = makeResetStyles({\n ...typographyStyles.caption2,\n color: tokens.colorNeutralForeground3,\n});\n\nconst useStyles = makeStyles({\n checkmark: {\n marginTop: '2px',\n },\n\n splitItemMain: {\n flexGrow: 1,\n },\n\n splitItemTrigger: {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n paddingLeft: 0,\n '::before': {\n content: '\"\"',\n width: tokens.strokeWidthThin,\n height: '24px',\n backgroundColor: tokens.colorNeutralStroke1,\n },\n },\n submenuOpen: {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n [`& .${menuItemClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForeground3Hover,\n },\n\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'none',\n backgroundColor: 'Highlight',\n color: 'HighlightText',\n\n [slotsSelector]: {\n color: 'HighlightText',\n },\n },\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorNeutralBackground1,\n cursor: 'not-allowed',\n [`& .${iconFilledClassName}`]: {\n display: 'none',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'inline',\n },\n [`& .${menuItemClassNames.icon}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n ':hover:active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorNeutralBackground1,\n\n [`& .${menuItemClassNames.subText}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n ':focus': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n ':hover': {\n forcedColorAdjust: 'auto',\n color: 'GrayText',\n backgroundColor: 'Canvas',\n [`& .${menuItemClassNames.icon}`]: {\n color: 'GrayText',\n backgroundColor: 'Canvas',\n },\n [slotsSelector]: {\n color: 'GrayText',\n },\n },\n ':hover:active': {\n color: 'GrayText',\n backgroundColor: 'Canvas',\n [`& .${menuItemClassNames.subText}`]: {\n color: 'GrayText',\n },\n },\n ':focus': {\n color: 'GrayText',\n backgroundColor: 'Canvas',\n },\n },\n },\n});\n\nconst useSubTextStyles = makeStyles({\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n});\n\nconst useMultilineStyles = makeStyles({\n content: {\n display: 'flex',\n flexDirection: 'column',\n },\n\n secondaryContent: {\n alignSelf: 'center',\n },\n\n submenuIndicator: {\n alignSelf: 'center',\n },\n});\n\n/** Applies style classnames to slots */\nexport const useMenuItemStyles_unstable = (state: MenuItemState): MenuItemState => {\n const styles = useStyles();\n const rootBaseStyles = useRootBaseStyles();\n const contentBaseStyles = useContentBaseStyles();\n const secondaryContentBaseStyles = useSecondaryContentBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const submenuIndicatorBaseStyles = useSubmenuIndicatorBaseStyles();\n const multilineStyles = useMultilineStyles();\n const subtextBaseStyles = useSubtextBaseStyles();\n const subTextStyles = useSubTextStyles();\n const multiline = !!state.subText;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n menuItemClassNames.root,\n rootBaseStyles,\n state.submenuOpen && styles.submenuOpen,\n state.disabled && styles.disabled,\n state.root.className,\n );\n\n if (state.content) {\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(\n menuItemClassNames.content,\n contentBaseStyles,\n multiline && multilineStyles.content,\n state.content.className,\n );\n }\n\n if (state.checkmark) {\n // eslint-disable-next-line react-hooks/immutability\n state.checkmark.className = mergeClasses(menuItemClassNames.checkmark, styles.checkmark, state.checkmark.className);\n }\n\n if (state.secondaryContent) {\n // eslint-disable-next-line react-hooks/immutability\n state.secondaryContent.className = mergeClasses(\n menuItemClassNames.secondaryContent,\n secondaryContentBaseStyles,\n state.disabled && styles.disabled,\n multiline && multilineStyles.secondaryContent,\n state.secondaryContent.className,\n );\n }\n\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(menuItemClassNames.icon, iconBaseStyles, state.icon.className);\n }\n\n if (state.submenuIndicator) {\n // eslint-disable-next-line react-hooks/immutability\n state.submenuIndicator.className = mergeClasses(\n menuItemClassNames.submenuIndicator,\n submenuIndicatorBaseStyles,\n multiline && multilineStyles.submenuIndicator,\n state.submenuIndicator.className,\n );\n }\n\n if (state.subText) {\n // eslint-disable-next-line react-hooks/immutability\n state.subText.className = mergeClasses(\n menuItemClassNames.subText,\n subtextBaseStyles,\n state.disabled && subTextStyles.disabled,\n state.subText.className,\n );\n }\n\n useCheckmarkStyles_unstable(state as MenuItemCheckboxState);\n\n return state;\n};\n"],"names":["mergeClasses","makeStyles","makeResetStyles","iconFilledClassName","iconRegularClassName","createFocusOutlineStyle","tokens","typographyStyles","useCheckmarkStyles_unstable","menuItemClassNames","root","icon","checkmark","submenuIndicator","content","secondaryContent","subText","slotsSelector","useRootBaseStyles","borderRadius","borderRadiusMedium","position","color","colorNeutralForeground2","backgroundColor","colorNeutralBackground1","paddingRight","spacingVerticalSNudge","paddingLeft","paddingTop","paddingBottom","boxSizing","maxWidth","minHeight","flexShrink","display","alignItems","fontSize","fontSizeBase300","cursor","gap","colorNeutralBackground1Hover","colorNeutralForeground2Hover","colorNeutralForeground2BrandSelected","colorNeutralForeground3Hover","colorNeutralBackground1Pressed","colorNeutralForeground2Pressed","colorNeutralForeground3Pressed","forcedColorAdjust","style","outlineColor","userSelect","useContentBaseStyles","flexGrow","useSecondaryContentBaseStyles","caption1","lineHeight","lineHeightBase300","colorNeutralForeground3","useIconBaseStyles","width","height","justifyContent","useSubmenuIndicatorBaseStyles","useSubtextBaseStyles","caption2","useStyles","marginTop","splitItemMain","splitItemTrigger","borderTopLeftRadius","borderBottomLeftRadius","strokeWidthThin","colorNeutralStroke1","submenuOpen","disabled","colorNeutralForegroundDisabled","useSubTextStyles","useMultilineStyles","flexDirection","alignSelf","useMenuItemStyles_unstable","state","styles","rootBaseStyles","contentBaseStyles","secondaryContentBaseStyles","iconBaseSt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MvE,IAAI,CAACkF,SAAS,GAAG7F,aAAaS,mBAAmBE,IAAI,EAAE4E,gBAAgBL,MAAMvE,IAAI,CAACkF,SAAS;IACnG;IAEA,IAAIX,MAAMrE,gBAAgB,EAAE;QAC1B,oDAAoD;QACpDqE,MAAMrE,gBAAgB,CAACgF,SAAS,GAAG7F,aACjCS,mBAAmBI,gBAAgB,EACnC2E,4BACAI,aAAaH,gBAAgB5E,gBAAgB,EAC7CqE,MAAMrE,gBAAgB,CAACgF,SAAS;IAEpC;IAEA,IAAIX,MAAMlE,OAAO,EAAE;QACjB,oDAAoD;QACpDkE,MAAMlE,OAAO,CAAC6E,SAAS,GAAG7F,aACxBS,mBAAmBO,OAAO,EAC1B0E,mBACAR,MAAMP,QAAQ,IAAIgB,cAAchB,QAAQ,EACxCO,MAAMlE,OAAO,CAAC6E,SAAS;IAE3B;IAEArF,4BAA4B0E;IAE5B,OAAOA;AACT,EAAE"}
@@ -8,8 +8,8 @@ import { useMenuItemBase_unstable } from "../MenuItem/useMenuItemBase.js";
8
8
  const state = useMenuItemCheckboxBase_unstable(props, ref);
9
9
  // Set default checkmark icon
10
10
  if (state.checkmark) {
11
- var _state_checkmark, _children;
12
- (_children = (_state_checkmark = state.checkmark).children) !== null && _children !== void 0 ? _children : _state_checkmark.children = /*#__PURE__*/ React.createElement(Checkmark16Filled, null);
11
+ var _state_checkmark;
12
+ (_state_checkmark = state.checkmark).children ?? (_state_checkmark.children = /*#__PURE__*/ React.createElement(Checkmark16Filled, null));
13
13
  }
14
14
  return state;
15
15
  };
@@ -19,8 +19,7 @@ import { useMenuItemBase_unstable } from "../MenuItem/useMenuItemBase.js";
19
19
  const toggleCheckbox = useMenuListContext_unstable((context)=>context.toggleCheckbox);
20
20
  const { name, value } = props;
21
21
  const checked = useMenuListContext_unstable((context)=>{
22
- var _context_checkedValues;
23
- const checkedItems = ((_context_checkedValues = context.checkedValues) === null || _context_checkedValues === void 0 ? void 0 : _context_checkedValues[name]) || [];
22
+ const checkedItems = context.checkedValues?.[name] || [];
24
23
  return checkedItems.indexOf(value) !== -1;
25
24
  });
26
25
  const state = {
@@ -34,9 +33,8 @@ import { useMenuItemBase_unstable } from "../MenuItem/useMenuItemBase.js";
34
33
  elementType: 'span'
35
34
  }),
36
35
  onClick: (e)=>{
37
- var _props_onClick;
38
- toggleCheckbox === null || toggleCheckbox === void 0 ? void 0 : toggleCheckbox(e, name, value, checked);
39
- (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
36
+ toggleCheckbox?.(e, name, value, checked);
37
+ props.onClick?.(e);
40
38
  }
41
39
  }, ref),
42
40
  name,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuItemCheckbox/useMenuItemCheckbox.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItemBase_unstable } from '../MenuItem/useMenuItemBase';\nimport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/** Returns the props and state required to render the component */\nexport const useMenuItemCheckbox_unstable = (\n props: MenuItemCheckboxProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemCheckboxState => {\n const state = useMenuItemCheckboxBase_unstable(props, ref);\n\n // Set default checkmark icon\n if (state.checkmark) {\n state.checkmark.children ??= <Checkmark16Filled />;\n }\n\n return state;\n};\n\n/**\n * Base hook for MenuItemCheckbox component, produces state required to render the component\n */\nexport const useMenuItemCheckboxBase_unstable = (\n props: MenuItemCheckboxProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemCheckboxState => {\n const toggleCheckbox = useMenuListContext_unstable(context => context.toggleCheckbox);\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const state: MenuItemCheckboxState = {\n ...useMenuItemBase_unstable(\n {\n role: 'menuitemcheckbox',\n persistOnClick: true,\n ...props,\n 'aria-checked': checked,\n checkmark: slot.optional(props.checkmark, {\n renderByDefault: true,\n elementType: 'span',\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n toggleCheckbox?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n name,\n value,\n checked,\n };\n\n return state;\n};\n"],"names":["React","slot","Checkmark16Filled","useMenuListContext_unstable","useMenuItemBase_unstable","useMenuItemCheckbox_unstable","props","ref","state","useMenuItemCheckboxBase_unstable","checkmark","children","toggleCheckbox","context","name","value","checked","checkedItems","checkedValues","indexOf","role","persistOnClick","optional","renderByDefault","elementType","onClick","e"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,2BAA2B,QAAQ,oCAAiC;AAC7E,SAASC,wBAAwB,QAAQ,iCAA8B;AAIvE,iEAAiE,GACjE,OAAO,MAAMC,+BAA+B,CAC1CC,OACAC;IAEA,MAAMC,QAAQC,iCAAiCH,OAAOC;IAEtD,6BAA6B;IAC7B,IAAIC,MAAME,SAAS,EAAE;YACnBF,kBAAAA;SAAAA,YAAAA,CAAAA,mBAAAA,MAAME,SAAS,EAACC,QAAQ,cAAxBH,uBAAAA,YAAAA,iBAAgBG,QAAQ,iBAAK,oBAACT;IAChC;IAEA,OAAOM;AACT,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAC9CH,OACAC;IAEA,MAAMK,iBAAiBT,4BAA4BU,CAAAA,UAAWA,QAAQD,cAAc;IACpF,MAAM,EAAEE,IAAI,EAAEC,KAAK,EAAE,GAAGT;IAExB,MAAMU,UAAUb,4BAA4BU,CAAAA;YACrBA;QAArB,MAAMI,eAAeJ,EAAAA,yBAAAA,QAAQK,aAAa,cAArBL,6CAAAA,sBAAuB,CAACC,KAAK,KAAI,EAAE;QACxD,OAAOG,aAAaE,OAAO,CAACJ,WAAW,CAAC;IAC1C;IAEA,MAAMP,QAA+B;QACnC,GAAGJ,yBACD;YACEgB,MAAM;YACNC,gBAAgB;YAChB,GAAGf,KAAK;YACR,gBAAgBU;YAChBN,WAAWT,KAAKqB,QAAQ,CAAChB,MAAMI,SAAS,EAAE;gBACxCa,iBAAiB;gBACjBC,aAAa;YACf;YACAC,SAAS,CAACC;oBAERpB;gBADAM,2BAAAA,qCAAAA,eAAiBc,GAAGZ,MAAMC,OAAOC;iBACjCV,iBAAAA,MAAMmB,OAAO,cAAbnB,qCAAAA,oBAAAA,OAAgBoB;YAClB;QACF,GACAnB,IACD;QACDO;QACAC;QACAC;IACF;IAEA,OAAOR;AACT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/MenuItemCheckbox/useMenuItemCheckbox.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItemBase_unstable } from '../MenuItem/useMenuItemBase';\nimport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/** Returns the props and state required to render the component */\nexport const useMenuItemCheckbox_unstable = (\n props: MenuItemCheckboxProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemCheckboxState => {\n const state = useMenuItemCheckboxBase_unstable(props, ref);\n\n // Set default checkmark icon\n if (state.checkmark) {\n state.checkmark.children ??= <Checkmark16Filled />;\n }\n\n return state;\n};\n\n/**\n * Base hook for MenuItemCheckbox component, produces state required to render the component\n */\nexport const useMenuItemCheckboxBase_unstable = (\n props: MenuItemCheckboxProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemCheckboxState => {\n const toggleCheckbox = useMenuListContext_unstable(context => context.toggleCheckbox);\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const state: MenuItemCheckboxState = {\n ...useMenuItemBase_unstable(\n {\n role: 'menuitemcheckbox',\n persistOnClick: true,\n ...props,\n 'aria-checked': checked,\n checkmark: slot.optional(props.checkmark, {\n renderByDefault: true,\n elementType: 'span',\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n toggleCheckbox?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n name,\n value,\n checked,\n };\n\n return state;\n};\n"],"names":["React","slot","Checkmark16Filled","useMenuListContext_unstable","useMenuItemBase_unstable","useMenuItemCheckbox_unstable","props","ref","state","useMenuItemCheckboxBase_unstable","checkmark","children","toggleCheckbox","context","name","value","checked","checkedItems","checkedValues","indexOf","role","persistOnClick","optional","renderByDefault","elementType","onClick","e"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,2BAA2B,QAAQ,oCAAiC;AAC7E,SAASC,wBAAwB,QAAQ,iCAA8B;AAIvE,iEAAiE,GACjE,OAAO,MAAMC,+BAA+B,CAC1CC,OACAC;IAEA,MAAMC,QAAQC,iCAAiCH,OAAOC;IAEtD,6BAA6B;IAC7B,IAAIC,MAAME,SAAS,EAAE;YACnBF;QAAAA,CAAAA,mBAAAA,MAAME,SAAS,EAACC,QAAQ,KAAxBH,iBAAgBG,QAAQ,iBAAK,oBAACT;IAChC;IAEA,OAAOM;AACT,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAC9CH,OACAC;IAEA,MAAMK,iBAAiBT,4BAA4BU,CAAAA,UAAWA,QAAQD,cAAc;IACpF,MAAM,EAAEE,IAAI,EAAEC,KAAK,EAAE,GAAGT;IAExB,MAAMU,UAAUb,4BAA4BU,CAAAA;QAC1C,MAAMI,eAAeJ,QAAQK,aAAa,EAAE,CAACJ,KAAK,IAAI,EAAE;QACxD,OAAOG,aAAaE,OAAO,CAACJ,WAAW,CAAC;IAC1C;IAEA,MAAMP,QAA+B;QACnC,GAAGJ,yBACD;YACEgB,MAAM;YACNC,gBAAgB;YAChB,GAAGf,KAAK;YACR,gBAAgBU;YAChBN,WAAWT,KAAKqB,QAAQ,CAAChB,MAAMI,SAAS,EAAE;gBACxCa,iBAAiB;gBACjBC,aAAa;YACf;YACAC,SAAS,CAACC;gBACRd,iBAAiBc,GAAGZ,MAAMC,OAAOC;gBACjCV,MAAMmB,OAAO,GAAGC;YAClB;QACF,GACAnB,IACD;QACDO;QACAC;QACAC;IACF;IAEA,OAAOR;AACT,EAAE"}
@@ -10,8 +10,8 @@ import { useMenuItemBase_unstable } from "../MenuItem/useMenuItemBase.js";
10
10
  const state = useMenuItemRadioBase_unstable(props, ref);
11
11
  // Set default checkmark icon
12
12
  if (state.checkmark) {
13
- var _state_checkmark, _children;
14
- (_children = (_state_checkmark = state.checkmark).children) !== null && _children !== void 0 ? _children : _state_checkmark.children = /*#__PURE__*/ React.createElement(Checkmark16Filled, null);
13
+ var _state_checkmark;
14
+ (_state_checkmark = state.checkmark).children ?? (_state_checkmark.children = /*#__PURE__*/ React.createElement(Checkmark16Filled, null));
15
15
  }
16
16
  return state;
17
17
  };
@@ -21,8 +21,7 @@ import { useMenuItemBase_unstable } from "../MenuItem/useMenuItemBase.js";
21
21
  */ export const useMenuItemRadioBase_unstable = (props, ref)=>{
22
22
  const { name, value } = props;
23
23
  const checked = useMenuListContext_unstable((context)=>{
24
- var _context_checkedValues;
25
- const checkedItems = ((_context_checkedValues = context.checkedValues) === null || _context_checkedValues === void 0 ? void 0 : _context_checkedValues[name]) || [];
24
+ const checkedItems = context.checkedValues?.[name] || [];
26
25
  return checkedItems.indexOf(value) !== -1;
27
26
  });
28
27
  const selectRadio = useMenuListContext_unstable((context)=>context.selectRadio);
@@ -36,9 +35,8 @@ import { useMenuItemBase_unstable } from "../MenuItem/useMenuItemBase.js";
36
35
  elementType: 'span'
37
36
  }),
38
37
  onClick: (e)=>{
39
- var _props_onClick;
40
- selectRadio === null || selectRadio === void 0 ? void 0 : selectRadio(e, name, value, checked);
41
- (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
38
+ selectRadio?.(e, name, value, checked);
39
+ props.onClick?.(e);
42
40
  }
43
41
  }, ref),
44
42
  checked,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuItemRadio/useMenuItemRadio.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItemBase_unstable } from '../MenuItem/useMenuItemBase';\nimport type {\n MenuItemRadioBaseProps,\n MenuItemRadioBaseState,\n MenuItemRadioProps,\n MenuItemRadioState,\n} from './MenuItemRadio.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/**\n * Given user props, returns state and render function for a MenuItemRadio.\n */\nexport const useMenuItemRadio_unstable = (\n props: MenuItemRadioProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemRadioState => {\n const state = useMenuItemRadioBase_unstable(props, ref);\n\n // Set default checkmark icon\n if (state.checkmark) {\n state.checkmark.children ??= <Checkmark16Filled />;\n }\n\n return state;\n};\n\n/**\n * Base hook for MenuItemRadio component, produces state required to render the component.\n * It doesn't set any design-related props specific to MenuItemRadio.\n */\nexport const useMenuItemRadioBase_unstable = (\n props: MenuItemRadioBaseProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemRadioBaseState => {\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const selectRadio = useMenuListContext_unstable(context => context.selectRadio);\n\n return {\n ...useMenuItemBase_unstable(\n {\n ...props,\n role: 'menuitemradio',\n 'aria-checked': checked,\n checkmark: slot.optional(props.checkmark, {\n renderByDefault: true,\n elementType: 'span',\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n selectRadio?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n checked,\n name,\n value,\n };\n};\n"],"names":["React","slot","Checkmark16Filled","useMenuListContext_unstable","useMenuItemBase_unstable","useMenuItemRadio_unstable","props","ref","state","useMenuItemRadioBase_unstable","checkmark","children","name","value","checked","context","checkedItems","checkedValues","indexOf","selectRadio","role","optional","renderByDefault","elementType","onClick","e"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,2BAA2B,QAAQ,oCAAiC;AAC7E,SAASC,wBAAwB,QAAQ,iCAA8B;AASvE;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;IAEA,MAAMC,QAAQC,8BAA8BH,OAAOC;IAEnD,6BAA6B;IAC7B,IAAIC,MAAME,SAAS,EAAE;YACnBF,kBAAAA;SAAAA,YAAAA,CAAAA,mBAAAA,MAAME,SAAS,EAACC,QAAQ,cAAxBH,uBAAAA,YAAAA,iBAAgBG,QAAQ,iBAAK,oBAACT;IAChC;IAEA,OAAOM;AACT,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMC,gCAAgC,CAC3CH,OACAC;IAEA,MAAM,EAAEK,IAAI,EAAEC,KAAK,EAAE,GAAGP;IAExB,MAAMQ,UAAUX,4BAA4BY,CAAAA;YACrBA;QAArB,MAAMC,eAAeD,EAAAA,yBAAAA,QAAQE,aAAa,cAArBF,6CAAAA,sBAAuB,CAACH,KAAK,KAAI,EAAE;QACxD,OAAOI,aAAaE,OAAO,CAACL,WAAW,CAAC;IAC1C;IAEA,MAAMM,cAAchB,4BAA4BY,CAAAA,UAAWA,QAAQI,WAAW;IAE9E,OAAO;QACL,GAAGf,yBACD;YACE,GAAGE,KAAK;YACRc,MAAM;YACN,gBAAgBN;YAChBJ,WAAWT,KAAKoB,QAAQ,CAACf,MAAMI,SAAS,EAAE;gBACxCY,iBAAiB;gBACjBC,aAAa;YACf;YACAC,SAAS,CAACC;oBAERnB;gBADAa,wBAAAA,kCAAAA,YAAcM,GAAGb,MAAMC,OAAOC;iBAC9BR,iBAAAA,MAAMkB,OAAO,cAAblB,qCAAAA,oBAAAA,OAAgBmB;YAClB;QACF,GACAlB,IACD;QACDO;QACAF;QACAC;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/MenuItemRadio/useMenuItemRadio.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItemBase_unstable } from '../MenuItem/useMenuItemBase';\nimport type {\n MenuItemRadioBaseProps,\n MenuItemRadioBaseState,\n MenuItemRadioProps,\n MenuItemRadioState,\n} from './MenuItemRadio.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/**\n * Given user props, returns state and render function for a MenuItemRadio.\n */\nexport const useMenuItemRadio_unstable = (\n props: MenuItemRadioProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemRadioState => {\n const state = useMenuItemRadioBase_unstable(props, ref);\n\n // Set default checkmark icon\n if (state.checkmark) {\n state.checkmark.children ??= <Checkmark16Filled />;\n }\n\n return state;\n};\n\n/**\n * Base hook for MenuItemRadio component, produces state required to render the component.\n * It doesn't set any design-related props specific to MenuItemRadio.\n */\nexport const useMenuItemRadioBase_unstable = (\n props: MenuItemRadioBaseProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemRadioBaseState => {\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const selectRadio = useMenuListContext_unstable(context => context.selectRadio);\n\n return {\n ...useMenuItemBase_unstable(\n {\n ...props,\n role: 'menuitemradio',\n 'aria-checked': checked,\n checkmark: slot.optional(props.checkmark, {\n renderByDefault: true,\n elementType: 'span',\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n selectRadio?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n checked,\n name,\n value,\n };\n};\n"],"names":["React","slot","Checkmark16Filled","useMenuListContext_unstable","useMenuItemBase_unstable","useMenuItemRadio_unstable","props","ref","state","useMenuItemRadioBase_unstable","checkmark","children","name","value","checked","context","checkedItems","checkedValues","indexOf","selectRadio","role","optional","renderByDefault","elementType","onClick","e"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,2BAA2B,QAAQ,oCAAiC;AAC7E,SAASC,wBAAwB,QAAQ,iCAA8B;AASvE;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;IAEA,MAAMC,QAAQC,8BAA8BH,OAAOC;IAEnD,6BAA6B;IAC7B,IAAIC,MAAME,SAAS,EAAE;YACnBF;QAAAA,CAAAA,mBAAAA,MAAME,SAAS,EAACC,QAAQ,KAAxBH,iBAAgBG,QAAQ,iBAAK,oBAACT;IAChC;IAEA,OAAOM;AACT,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMC,gCAAgC,CAC3CH,OACAC;IAEA,MAAM,EAAEK,IAAI,EAAEC,KAAK,EAAE,GAAGP;IAExB,MAAMQ,UAAUX,4BAA4BY,CAAAA;QAC1C,MAAMC,eAAeD,QAAQE,aAAa,EAAE,CAACL,KAAK,IAAI,EAAE;QACxD,OAAOI,aAAaE,OAAO,CAACL,WAAW,CAAC;IAC1C;IAEA,MAAMM,cAAchB,4BAA4BY,CAAAA,UAAWA,QAAQI,WAAW;IAE9E,OAAO;QACL,GAAGf,yBACD;YACE,GAAGE,KAAK;YACRc,MAAM;YACN,gBAAgBN;YAChBJ,WAAWT,KAAKoB,QAAQ,CAACf,MAAMI,SAAS,EAAE;gBACxCY,iBAAiB;gBACjBC,aAAa;YACf;YACAC,SAAS,CAACC;gBACRN,cAAcM,GAAGb,MAAMC,OAAOC;gBAC9BR,MAAMkB,OAAO,GAAGC;YAClB;QACF,GACAlB,IACD;QACDO;QACAF;QACAC;IACF;AACF,EAAE"}
@@ -16,10 +16,10 @@ import { circleFilledClassName } from "./useMenuItemSwitchStyles.styles.js";
16
16
  const state = useMenuItemSwitchBase_unstable(props, ref);
17
17
  // Set default icon for switch indicator
18
18
  if (state.switchIndicator) {
19
- var _state_switchIndicator, _children;
20
- (_children = (_state_switchIndicator = state.switchIndicator).children) !== null && _children !== void 0 ? _children : _state_switchIndicator.children = /*#__PURE__*/ React.createElement(CircleFilled, {
19
+ var _state_switchIndicator;
20
+ (_state_switchIndicator = state.switchIndicator).children ?? (_state_switchIndicator.children = /*#__PURE__*/ React.createElement(CircleFilled, {
21
21
  className: circleFilledClassName
22
- });
22
+ }));
23
23
  }
24
24
  return state;
25
25
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuItemSwitch/useMenuItemSwitch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchProps, MenuItemSwitchState } from './MenuItemSwitch.types';\nimport { useMenuItemCheckboxBase_unstable } from '../MenuItemCheckbox/useMenuItemCheckbox';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { circleFilledClassName } from './useMenuItemSwitchStyles.styles';\n\n/**\n * Create the state required to render MenuItemSwitch.\n *\n * The returned state can be modified with hooks such as useMenuItemSwitchStyles_unstable,\n * before being passed to renderMenuItemSwitch_unstable.\n *\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */\nexport const useMenuItemSwitch_unstable = (\n props: MenuItemSwitchProps,\n ref: React.Ref<HTMLDivElement>,\n): MenuItemSwitchState => {\n const state = useMenuItemSwitchBase_unstable(props, ref);\n\n // Set default icon for switch indicator\n if (state.switchIndicator) {\n state.switchIndicator.children ??= <CircleFilled className={circleFilledClassName} />;\n }\n\n return state;\n};\n\n/**\n * Base hook for MenuItemSwitch component, produces state required to render the component.\n * It doesn't set any design-related props specific to MenuItemSwitch.\n *\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */\nexport const useMenuItemSwitchBase_unstable = (\n props: MenuItemSwitchProps,\n ref: React.Ref<HTMLDivElement>,\n): MenuItemSwitchState => {\n const baseState = useMenuItemCheckboxBase_unstable(props, ref);\n return {\n ...baseState,\n switchIndicator: slot.optional(props.switchIndicator, {\n renderByDefault: true,\n elementType: 'span',\n }),\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...baseState.components,\n switchIndicator: 'span',\n },\n };\n};\n"],"names":["React","slot","useMenuItemCheckboxBase_unstable","CircleFilled","circleFilledClassName","useMenuItemSwitch_unstable","props","ref","state","useMenuItemSwitchBase_unstable","switchIndicator","children","className","baseState","optional","renderByDefault","elementType","components"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AAEjD,SAASC,gCAAgC,QAAQ,6CAA0C;AAC3F,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,qBAAqB,QAAQ,sCAAmC;AAEzE;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,QAAQC,+BAA+BH,OAAOC;IAEpD,wCAAwC;IACxC,IAAIC,MAAME,eAAe,EAAE;YACzBF,wBAAAA;SAAAA,YAAAA,CAAAA,yBAAAA,MAAME,eAAe,EAACC,QAAQ,cAA9BH,uBAAAA,YAAAA,uBAAsBG,QAAQ,iBAAK,oBAACR;YAAaS,WAAWR;;IAC9D;IAEA,OAAOI;AACT,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMC,iCAAiC,CAC5CH,OACAC;IAEA,MAAMM,YAAYX,iCAAiCI,OAAOC;IAC1D,OAAO;QACL,GAAGM,SAAS;QACZH,iBAAiBT,KAAKa,QAAQ,CAACR,MAAMI,eAAe,EAAE;YACpDK,iBAAiB;YACjBC,aAAa;QACf;QACAC,YAAY;YACV,4DAA4D;YAC5D,GAAGJ,UAAUI,UAAU;YACvBP,iBAAiB;QACnB;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/MenuItemSwitch/useMenuItemSwitch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchProps, MenuItemSwitchState } from './MenuItemSwitch.types';\nimport { useMenuItemCheckboxBase_unstable } from '../MenuItemCheckbox/useMenuItemCheckbox';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { circleFilledClassName } from './useMenuItemSwitchStyles.styles';\n\n/**\n * Create the state required to render MenuItemSwitch.\n *\n * The returned state can be modified with hooks such as useMenuItemSwitchStyles_unstable,\n * before being passed to renderMenuItemSwitch_unstable.\n *\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */\nexport const useMenuItemSwitch_unstable = (\n props: MenuItemSwitchProps,\n ref: React.Ref<HTMLDivElement>,\n): MenuItemSwitchState => {\n const state = useMenuItemSwitchBase_unstable(props, ref);\n\n // Set default icon for switch indicator\n if (state.switchIndicator) {\n state.switchIndicator.children ??= <CircleFilled className={circleFilledClassName} />;\n }\n\n return state;\n};\n\n/**\n * Base hook for MenuItemSwitch component, produces state required to render the component.\n * It doesn't set any design-related props specific to MenuItemSwitch.\n *\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */\nexport const useMenuItemSwitchBase_unstable = (\n props: MenuItemSwitchProps,\n ref: React.Ref<HTMLDivElement>,\n): MenuItemSwitchState => {\n const baseState = useMenuItemCheckboxBase_unstable(props, ref);\n return {\n ...baseState,\n switchIndicator: slot.optional(props.switchIndicator, {\n renderByDefault: true,\n elementType: 'span',\n }),\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...baseState.components,\n switchIndicator: 'span',\n },\n };\n};\n"],"names":["React","slot","useMenuItemCheckboxBase_unstable","CircleFilled","circleFilledClassName","useMenuItemSwitch_unstable","props","ref","state","useMenuItemSwitchBase_unstable","switchIndicator","children","className","baseState","optional","renderByDefault","elementType","components"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AAEjD,SAASC,gCAAgC,QAAQ,6CAA0C;AAC3F,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,qBAAqB,QAAQ,sCAAmC;AAEzE;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,QAAQC,+BAA+BH,OAAOC;IAEpD,wCAAwC;IACxC,IAAIC,MAAME,eAAe,EAAE;YACzBF;QAAAA,CAAAA,yBAAAA,MAAME,eAAe,EAACC,QAAQ,KAA9BH,uBAAsBG,QAAQ,iBAAK,oBAACR;YAAaS,WAAWR;;IAC9D;IAEA,OAAOI;AACT,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMC,iCAAiC,CAC5CH,OACAC;IAEA,MAAMM,YAAYX,iCAAiCI,OAAOC;IAC1D,OAAO;QACL,GAAGM,SAAS;QACZH,iBAAiBT,KAAKa,QAAQ,CAACR,MAAMI,eAAe,EAAE;YACpDK,iBAAiB;YACjBC,aAAa;QACf;QACAC,YAAY;YACV,4DAA4D;YAC5D,GAAGJ,UAAUI,UAAU;YACvBP,iBAAiB;QACnB;IACF;AACF,EAAE"}
@@ -86,7 +86,7 @@ export const useMenuItemSwitchStyles_unstable = state => {
86
86
  }
87
87
  if (state.switchIndicator) {
88
88
  // eslint-disable-next-line react-hooks/immutability
89
- state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className, multiline && multilineStyles.switch);
89
+ state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, multiline && multilineStyles.switch, state.switchIndicator.className);
90
90
  }
91
91
  useMenuItemStyles_unstable({
92
92
  ...state,
@@ -1 +1 @@
1
- {"version":3,"names":["__styles","__resetStyles","mergeClasses","shorthands","tokens","useMenuItemStyles_unstable","menuItemSwitchClassNames","root","icon","content","secondaryContent","switchIndicator","subText","circleFilledClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useSwitchIndicatorBaseClassName","r","s","useSwitchIndicatorStyles","checked","G4r02d","De3pzq","sj55zd","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bi91k9c","Jwef8y","Bgoe8wy","Bwzppfd","oetu4i","gg5e9n","B2d53fq","iro3zm","b661bw","Bk6r4ia","B9zn80p","Bpld233","d","h","useMultilineStyles","qb2dma","useMenuItemSwitchStyles_unstable","state","multiline","switchIndicatorStyles","switchIndicatorBaseStyles","multilineStyles","className","switch","components","checkmark","submenuIndicator","undefined","hasSubmenu","submenuOpen","persistOnClick"],"sources":["useMenuItemSwitchStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, makeResetStyles, mergeClasses, shorthands } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { useMenuItemStyles_unstable } from \"../MenuItem/useMenuItemStyles.styles.js\";\nexport const menuItemSwitchClassNames = {\n root: 'fui-MenuItemSwitch',\n icon: 'fui-MenuItemSwitch__icon',\n content: 'fui-MenuItemSwitch__content',\n secondaryContent: 'fui-MenuItemSwitch__secondaryContent',\n switchIndicator: 'fui-MenuItemSwitch__switchIndicator',\n subText: 'fui-MenuItemSwitch__subText'\n};\nexport const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useSwitchIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n marginRight: tokens.spacingHorizontalXS,\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n },\n color: tokens.colorNeutralStrokeAccessible,\n ':hover': {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover\n },\n ':hover:active': {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed\n },\n [`& .${circleFilledClassName}`]: {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n }\n }\n});\nconst useSwitchIndicatorStyles = makeStyles({\n checked: {\n [`& .${circleFilledClassName}`]: {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`\n },\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n ':hover': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive)\n },\n ':hover:active': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive)\n }\n }\n});\nconst useMultilineStyles = makeStyles({\n switch: {\n alignSelf: 'center'\n }\n});\n/**\n * Apply styling to the MenuItemSwitch slots based on the state\n */ export const useMenuItemSwitchStyles_unstable = (state)=>{\n const { checked, subText } = state;\n const multiline = !!subText;\n const switchIndicatorStyles = useSwitchIndicatorStyles();\n const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();\n const multilineStyles = useMultilineStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(menuItemSwitchClassNames.root, state.root.className);\n if (state.content) {\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(menuItemSwitchClassNames.content, state.content.className);\n }\n if (state.secondaryContent) {\n // eslint-disable-next-line react-hooks/immutability\n state.secondaryContent.className = mergeClasses(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);\n }\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(menuItemSwitchClassNames.icon, state.icon.className);\n }\n if (state.subText) {\n // eslint-disable-next-line react-hooks/immutability\n state.subText.className = mergeClasses(menuItemSwitchClassNames.subText, state.subText.className);\n }\n if (state.switchIndicator) {\n // eslint-disable-next-line react-hooks/immutability\n state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className, multiline && multilineStyles.switch);\n }\n useMenuItemStyles_unstable({\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\n checkmark: 'span',\n submenuIndicator: 'span'\n },\n checkmark: undefined,\n submenuIndicator: undefined,\n hasSubmenu: false,\n submenuOpen: false,\n persistOnClick: true\n });\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAAC,aAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,0BAA0B,QAAQ,yCAAyC;AACpF,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE,oBAAoB;EAC1BC,IAAI,EAAE,0BAA0B;EAChCC,OAAO,EAAE,6BAA6B;EACtCC,gBAAgB,EAAE,sCAAsC;EACxDC,eAAe,EAAE,qCAAqC;EACtDC,OAAO,EAAE;AACb,CAAC;AACD,OAAO,MAAMC,qBAAqB,GAAG,mDAAmD;AACxF;AACA,MAAMC,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GAAGF,WAAW,GAAGD,yBAAyB;AACzD,MAAMI,+BAA+B,gBAAGjB,aAAA;EAAAkB,CAAA;EAAAC,CAAA;AAAA,CAkCvC,CAAC;AACF,MAAMC,wBAAwB,gBAAGrB,QAAA;EAAAsB,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;EAAAC,CAAA;AAAA,CAmBhC,CAAC;AACF,MAAMC,kBAAkB,gBAAG5C,QAAA;EAAA;IAAA6C,MAAA;EAAA;AAAA;EAAAH,CAAA;AAAA,CAI1B,CAAC;AACF;AACA;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C,eAAe,CAACyC,SAAS,GAAGlD,YAAY,CAACI,wBAAwB,CAACK,eAAe,EAAEuC,yBAAyB,EAAE5B,OAAO,IAAI2B,qBAAqB,CAAC3B,OAAO,EAAEyB,KAAK,CAACpC,eAAe,CAACyC,SAAS,EAAEJ,SAAS,IAAIG,eAAe,CAACE,MAAM,CAAC;EACvO;EACAhD,0BAA0B,CAAC;IACvB,GAAG0C,KAAK;IACRO,UAAU,EAAE;MACR;MACA,GAAGP,KAAK,CAACO,UAAU;MACnBC,SAAS,EAAE,MAAM;MACjBC,gBAAgB,EAAE;IACtB,CAAC;IACDD,SAAS,EAAEE,SAAS;IACpBD,gBAAgB,EAAEC,SAAS;IAC3BC,UAAU,EAAE,KAAK;IACjBC,WAAW,EAAE,KAAK;IAClBC,cAAc,EAAE;EACpB,CAAC,CAAC;EACF,OAAOb,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__styles","__resetStyles","mergeClasses","shorthands","tokens","useMenuItemStyles_unstable","menuItemSwitchClassNames","root","icon","content","secondaryContent","switchIndicator","subText","circleFilledClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useSwitchIndicatorBaseClassName","r","s","useSwitchIndicatorStyles","checked","G4r02d","De3pzq","sj55zd","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bi91k9c","Jwef8y","Bgoe8wy","Bwzppfd","oetu4i","gg5e9n","B2d53fq","iro3zm","b661bw","Bk6r4ia","B9zn80p","Bpld233","d","h","useMultilineStyles","qb2dma","useMenuItemSwitchStyles_unstable","state","multiline","switchIndicatorStyles","switchIndicatorBaseStyles","multilineStyles","className","switch","components","checkmark","submenuIndicator","undefined","hasSubmenu","submenuOpen","persistOnClick"],"sources":["useMenuItemSwitchStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, makeResetStyles, mergeClasses, shorthands } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { useMenuItemStyles_unstable } from \"../MenuItem/useMenuItemStyles.styles.js\";\nexport const menuItemSwitchClassNames = {\n root: 'fui-MenuItemSwitch',\n icon: 'fui-MenuItemSwitch__icon',\n content: 'fui-MenuItemSwitch__content',\n secondaryContent: 'fui-MenuItemSwitch__secondaryContent',\n switchIndicator: 'fui-MenuItemSwitch__switchIndicator',\n subText: 'fui-MenuItemSwitch__subText'\n};\nexport const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useSwitchIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n marginRight: tokens.spacingHorizontalXS,\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n },\n color: tokens.colorNeutralStrokeAccessible,\n ':hover': {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover\n },\n ':hover:active': {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed\n },\n [`& .${circleFilledClassName}`]: {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n }\n }\n});\nconst useSwitchIndicatorStyles = makeStyles({\n checked: {\n [`& .${circleFilledClassName}`]: {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`\n },\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n ':hover': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive)\n },\n ':hover:active': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive)\n }\n }\n});\nconst useMultilineStyles = makeStyles({\n switch: {\n alignSelf: 'center'\n }\n});\n/**\n * Apply styling to the MenuItemSwitch slots based on the state\n */ export const useMenuItemSwitchStyles_unstable = (state)=>{\n const { checked, subText } = state;\n const multiline = !!subText;\n const switchIndicatorStyles = useSwitchIndicatorStyles();\n const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();\n const multilineStyles = useMultilineStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(menuItemSwitchClassNames.root, state.root.className);\n if (state.content) {\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(menuItemSwitchClassNames.content, state.content.className);\n }\n if (state.secondaryContent) {\n // eslint-disable-next-line react-hooks/immutability\n state.secondaryContent.className = mergeClasses(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);\n }\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(menuItemSwitchClassNames.icon, state.icon.className);\n }\n if (state.subText) {\n // eslint-disable-next-line react-hooks/immutability\n state.subText.className = mergeClasses(menuItemSwitchClassNames.subText, state.subText.className);\n }\n if (state.switchIndicator) {\n // eslint-disable-next-line react-hooks/immutability\n state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, multiline && multilineStyles.switch, state.switchIndicator.className);\n }\n useMenuItemStyles_unstable({\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\n checkmark: 'span',\n submenuIndicator: 'span'\n },\n checkmark: undefined,\n submenuIndicator: undefined,\n hasSubmenu: false,\n submenuOpen: false,\n persistOnClick: true\n });\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAAC,aAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,0BAA0B,QAAQ,yCAAyC;AACpF,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE,oBAAoB;EAC1BC,IAAI,EAAE,0BAA0B;EAChCC,OAAO,EAAE,6BAA6B;EACtCC,gBAAgB,EAAE,sCAAsC;EACxDC,eAAe,EAAE,qCAAqC;EACtDC,OAAO,EAAE;AACb,CAAC;AACD,OAAO,MAAMC,qBAAqB,GAAG,mDAAmD;AACxF;AACA,MAAMC,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GAAGF,WAAW,GAAGD,yBAAyB;AACzD,MAAMI,+BAA+B,gBAAGjB,aAAA;EAAAkB,CAAA;EAAAC,CAAA;AAAA,CAkCvC,CAAC;AACF,MAAMC,wBAAwB,gBAAGrB,QAAA;EAAAsB,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;EAAAC,CAAA;AAAA,CAmBhC,CAAC;AACF,MAAMC,kBAAkB,gBAAG5C,QAAA;EAAA;IAAA6C,MAAA;EAAA;AAAA;EAAAH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eAAe,EAAE;IACvB;IACAoC,KAAK,CAACpC,eAAe,CAACyC,SAAS,GAAGlD,YAAY,CAACI,wBAAwB,CAACK,eAAe,EAAEuC,yBAAyB,EAAE5B,OAAO,IAAI2B,qBAAqB,CAAC3B,OAAO,EAAE0B,SAAS,IAAIG,eAAe,CAACE,MAAM,EAAEN,KAAK,CAACpC,eAAe,CAACyC,SAAS,CAAC;EACvO;EACA/C,0BAA0B,CAAC;IACvB,GAAG0C,KAAK;IACRO,UAAU,EAAE;MACR;MACA,GAAGP,KAAK,CAACO,UAAU;MACnBC,SAAS,EAAE,MAAM;MACjBC,gBAAgB,EAAE;IACtB,CAAC;IACDD,SAAS,EAAEE,SAAS;IACpBD,gBAAgB,EAAEC,SAAS;IAC3BC,UAAU,EAAE,KAAK;IACjBC,WAAW,EAAE,KAAK;IAClBC,cAAc,EAAE;EACpB,CAAC,CAAC;EACF,OAAOb,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -104,7 +104,7 @@ const useMultilineStyles = makeStyles({
104
104
  }
105
105
  if (state.switchIndicator) {
106
106
  // eslint-disable-next-line react-hooks/immutability
107
- state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className, multiline && multilineStyles.switch);
107
+ state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, multiline && multilineStyles.switch, state.switchIndicator.className);
108
108
  }
109
109
  useMenuItemStyles_unstable({
110
110
  ...state,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, makeResetStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { type SlotClassNames } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchSlots, MenuItemSwitchState } from './MenuItemSwitch.types';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles.styles';\n\nexport const menuItemSwitchClassNames: SlotClassNames<MenuItemSwitchSlots> = {\n root: 'fui-MenuItemSwitch',\n icon: 'fui-MenuItemSwitch__icon',\n content: 'fui-MenuItemSwitch__content',\n secondaryContent: 'fui-MenuItemSwitch__secondaryContent',\n switchIndicator: 'fui-MenuItemSwitch__switchIndicator',\n subText: 'fui-MenuItemSwitch__subText',\n};\n\nexport const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useSwitchIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n marginRight: tokens.spacingHorizontalXS,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n color: tokens.colorNeutralStrokeAccessible,\n ':hover': {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n\n ':hover:active': {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n [`& .${circleFilledClassName}`]: {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useSwitchIndicatorStyles = makeStyles({\n checked: {\n [`& .${circleFilledClassName}`]: {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n\n ':hover': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n\n ':hover:active': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n});\n\nconst useMultilineStyles = makeStyles({\n switch: {\n alignSelf: 'center',\n },\n});\n\n/**\n * Apply styling to the MenuItemSwitch slots based on the state\n */\nexport const useMenuItemSwitchStyles_unstable = (state: MenuItemSwitchState): MenuItemSwitchState => {\n const { checked, subText } = state;\n const multiline = !!subText;\n const switchIndicatorStyles = useSwitchIndicatorStyles();\n const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();\n const multilineStyles = useMultilineStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(menuItemSwitchClassNames.root, state.root.className);\n if (state.content) {\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(menuItemSwitchClassNames.content, state.content.className);\n }\n\n if (state.secondaryContent) {\n // eslint-disable-next-line react-hooks/immutability\n state.secondaryContent.className = mergeClasses(\n menuItemSwitchClassNames.secondaryContent,\n state.secondaryContent.className,\n );\n }\n\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(menuItemSwitchClassNames.icon, state.icon.className);\n }\n\n if (state.subText) {\n // eslint-disable-next-line react-hooks/immutability\n state.subText.className = mergeClasses(menuItemSwitchClassNames.subText, state.subText.className);\n }\n\n if (state.switchIndicator) {\n // eslint-disable-next-line react-hooks/immutability\n state.switchIndicator.className = mergeClasses(\n menuItemSwitchClassNames.switchIndicator,\n switchIndicatorBaseStyles,\n checked && switchIndicatorStyles.checked,\n state.switchIndicator.className,\n multiline && multilineStyles.switch,\n );\n }\n\n useMenuItemStyles_unstable({\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\n checkmark: 'span',\n submenuIndicator: 'span',\n },\n checkmark: undefined,\n submenuIndicator: undefined,\n hasSubmenu: false,\n submenuOpen: false,\n persistOnClick: true,\n });\n\n return state;\n};\n"],"names":["makeStyles","makeResetStyles","mergeClasses","shorthands","tokens","useMenuItemStyles_unstable","menuItemSwitchClassNames","root","icon","content","secondaryContent","switchIndicator","subText","circleFilledClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useSwitchIndicatorBaseClassName","borderRadius","borderRadiusCircular","border","strokeWidthThin","colorNeutralStrokeAccessible","lineHeight","boxSizing","fill","flexShrink","fontSize","height","transitionDuration","durationNormal","transitionTimingFunction","curveEasyEase","transitionProperty","width","marginRight","spacingHorizontalXS","color","colorNeutralStrokeAccessibleHover","borderColor","colorNeutralStrokeAccessiblePressed","useSwitchIndicatorStyles","checked","transform","backgroundColor","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorTransparentStroke","colorCompoundBrandBackgroundHover","colorTransparentStrokeInteractive","colorCompoundBrandBackgroundPressed","useMultilineStyles","switch","alignSelf","useMenuItemSwitchStyles_unstable","state","multiline","switchIndicatorStyles","switchIndicatorBaseStyles","multilineStyles","className","components","checkmark","submenuIndicator","undefined","hasSubmenu","submenuOpen","persistOnClick"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,eAAe,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACvF,SAASC,MAAM,QAAQ,wBAAwB;AAG/C,SAASC,0BAA0B,QAAQ,0CAAuC;AAElF,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;IACNC,MAAM;IACNC,SAAS;IACTC,kBAAkB;IAClBC,iBAAiB;IACjBC,SA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IAAI,CAACqD,SAAS;IACzF;IAEA,IAAIL,MAAM5C,OAAO,EAAE;QACjB,oDAAoD;QACpD4C,MAAM5C,OAAO,CAACiD,SAAS,GAAG3D,aAAaI,yBAAyBM,OAAO,EAAE4C,MAAM5C,OAAO,CAACiD,SAAS;IAClG;IAEA,IAAIL,MAAM7C,eAAe,EAAE;QACzB,oDAAoD;QACpD6C,MAAM7C,eAAe,CAACkD,SAAS,GAAG3D,aAChCI,yBAAyBK,eAAe,EACxCgD,2BACAhB,WAAWe,sBAAsBf,OAAO,EACxCa,MAAM7C,eAAe,CAACkD,SAAS,EAC/BJ,aAAaG,gBAAgBP,MAAM;IAEvC;IAEAhD,2BAA2B;QACzB,GAAGmD,KAAK;QACRM,YAAY;YACV,4DAA4D;YAC5D,GAAGN,MAAMM,UAAU;YACnBC,WAAW;YACXC,kBAAkB;QACpB;QACAD,WAAWE;QACXD,kBAAkBC;QAClBC,YAAY;QACZC,aAAa;QACbC,gBAAgB;IAClB;IAEA,OAAOZ;AACT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, makeResetStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { type SlotClassNames } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchSlots, MenuItemSwitchState } from './MenuItemSwitch.types';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles.styles';\n\nexport const menuItemSwitchClassNames: SlotClassNames<MenuItemSwitchSlots> = {\n root: 'fui-MenuItemSwitch',\n icon: 'fui-MenuItemSwitch__icon',\n content: 'fui-MenuItemSwitch__content',\n secondaryContent: 'fui-MenuItemSwitch__secondaryContent',\n switchIndicator: 'fui-MenuItemSwitch__switchIndicator',\n subText: 'fui-MenuItemSwitch__subText',\n};\n\nexport const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useSwitchIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n marginRight: tokens.spacingHorizontalXS,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n color: tokens.colorNeutralStrokeAccessible,\n ':hover': {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n\n ':hover:active': {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n [`& .${circleFilledClassName}`]: {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useSwitchIndicatorStyles = makeStyles({\n checked: {\n [`& .${circleFilledClassName}`]: {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n\n ':hover': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n\n ':hover:active': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n});\n\nconst useMultilineStyles = makeStyles({\n switch: {\n alignSelf: 'center',\n },\n});\n\n/**\n * Apply styling to the MenuItemSwitch slots based on the state\n */\nexport const useMenuItemSwitchStyles_unstable = (state: MenuItemSwitchState): MenuItemSwitchState => {\n const { checked, subText } = state;\n const multiline = !!subText;\n const switchIndicatorStyles = useSwitchIndicatorStyles();\n const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();\n const multilineStyles = useMultilineStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(menuItemSwitchClassNames.root, state.root.className);\n if (state.content) {\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(menuItemSwitchClassNames.content, state.content.className);\n }\n\n if (state.secondaryContent) {\n // eslint-disable-next-line react-hooks/immutability\n state.secondaryContent.className = mergeClasses(\n menuItemSwitchClassNames.secondaryContent,\n state.secondaryContent.className,\n );\n }\n\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(menuItemSwitchClassNames.icon, state.icon.className);\n }\n\n if (state.subText) {\n // eslint-disable-next-line react-hooks/immutability\n state.subText.className = mergeClasses(menuItemSwitchClassNames.subText, state.subText.className);\n }\n\n if (state.switchIndicator) {\n // eslint-disable-next-line react-hooks/immutability\n state.switchIndicator.className = mergeClasses(\n menuItemSwitchClassNames.switchIndicator,\n switchIndicatorBaseStyles,\n checked && switchIndicatorStyles.checked,\n multiline && multilineStyles.switch,\n state.switchIndicator.className,\n );\n }\n\n useMenuItemStyles_unstable({\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\n checkmark: 'span',\n submenuIndicator: 'span',\n },\n checkmark: undefined,\n submenuIndicator: undefined,\n hasSubmenu: false,\n submenuOpen: false,\n persistOnClick: true,\n });\n\n return state;\n};\n"],"names":["makeStyles","makeResetStyles","mergeClasses","shorthands","tokens","useMenuItemStyles_unstable","menuItemSwitchClassNames","root","icon","content","secondaryContent","switchIndicator","subText","circleFilledClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useSwitchIndicatorBaseClassName","borderRadius","borderRadiusCircular","border","strokeWidthThin","colorNeutralStrokeAccessible","lineHeight","boxSizing","fill","flexShrink","fontSize","height","transitionDuration","durationNormal","transitionTimingFunction","curveEasyEase","transitionProperty","width","marginRight","spacingHorizontalXS","color","colorNeutralStrokeAccessibleHover","borderColor","colorNeutralStrokeAccessiblePressed","useSwitchIndicatorStyles","checked","transform","backgroundColor","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorTransparentStroke","colorCompoundBrandBackgroundHover","colorTransparentStrokeInteractive","colorCompoundBrandBackgroundPressed","useMultilineStyles","switch","alignSelf","useMenuItemSwitchStyles_unstable","state","multiline","switchIndicatorStyles","switchIndicatorBaseStyles","multilineStyles","className","components","checkmark","submenuIndicator","undefined","hasSubmenu","submenuOpen","persistOnClick"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,eAAe,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACvF,SAASC,MAAM,QAAQ,wBAAwB;AAG/C,SAASC,0BAA0B,QAAQ,0CAAuC;AAElF,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;IACNC,MAAM;IACNC,SAAS;IACTC,kBAAkB;IAClBC,iBAAiB;IACjBC,SAAS;AACX,EAAE;AAEF,OAAO,MAAMC,wBAAwB,oDAAoD;AAEzF,+CAA+C;AAC/C,MAAMC,4BAA4B;AAClC,MAAMC,cAAc;AACpB,MAAMC,aAAa;AACnB,MAAMC,YAAYF,cAAcD;AAEhC,MAAMI,kCAAkCjB,gBAAgB;IACtDkB,cAAcf,OAAOgB,oBAAoB;IACzCC,QAAQ,GAAGjB,OAAOkB,eAAe,CAAC,OAAO,EAAElB,OAAOmB,4BAA4B,EAAE;IAChFC,YAAY;IACZC,WAAW;IACXC,MAAM;IACNC,YAAY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aG,gBAAgBP,MAAM,EACnCG,MAAM7C,eAAe,CAACkD,SAAS;IAEnC;IAEAxD,2BAA2B;QACzB,GAAGmD,KAAK;QACRM,YAAY;YACV,4DAA4D;YAC5D,GAAGN,MAAMM,UAAU;YACnBC,WAAW;YACXC,kBAAkB;QACpB;QACAD,WAAWE;QACXD,kBAAkBC;QAClBC,YAAY;QACZC,aAAa;QACbC,gBAAgB;IAClB;IAEA,OAAOZ;AACT,EAAE"}
@@ -90,7 +90,6 @@ const MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map((role)=>`[role="${role}"]`)
90
90
  * @param props - props from this instance of MenuList
91
91
  * @param ref - reference to root HTMLElement of MenuList
92
92
  */ export const useMenuListBase_unstable = (props, ref)=>{
93
- var _props_checkedValues, _props_onCheckedValueChange, _ref, _props_hasIcons, _ref1, _props_hasCheckmarks;
94
93
  const triggerId = useMenuContext_unstable((context)=>context.triggerId);
95
94
  const checkedValuesContext = useMenuContext_unstable((context)=>context.checkedValues);
96
95
  const onCheckedValueChangeContext = useMenuContext_unstable((context)=>context.onCheckedValueChange);
@@ -107,13 +106,13 @@ const MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map((role)=>`[role="${role}"]`)
107
106
  focusItemMatchingFirstCharacter(menuItems, e.key, itemEl);
108
107
  }, []);
109
108
  const [checkedValues, setCheckedValues] = useControllableState({
110
- state: (_props_checkedValues = props.checkedValues) !== null && _props_checkedValues !== void 0 ? _props_checkedValues : hasMenuContext ? checkedValuesContext : undefined,
109
+ state: props.checkedValues ?? (hasMenuContext ? checkedValuesContext : undefined),
111
110
  defaultState: props.defaultCheckedValues,
112
111
  initialState: {}
113
112
  });
114
- const handleCheckedValueChange = (_props_onCheckedValueChange = props.onCheckedValueChange) !== null && _props_onCheckedValueChange !== void 0 ? _props_onCheckedValueChange : hasMenuContext ? onCheckedValueChangeContext : undefined;
113
+ const handleCheckedValueChange = props.onCheckedValueChange ?? (hasMenuContext ? onCheckedValueChangeContext : undefined);
115
114
  const toggleCheckbox = useEventCallback((e, name, value, checked)=>{
116
- const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
115
+ const checkedItems = checkedValues?.[name] || [];
117
116
  const newCheckedItems = [
118
117
  ...checkedItems
119
118
  ];
@@ -122,7 +121,7 @@ const MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map((role)=>`[role="${role}"]`)
122
121
  } else {
123
122
  newCheckedItems.push(value);
124
123
  }
125
- handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
124
+ handleCheckedValueChange?.(e, {
126
125
  name,
127
126
  checkedItems: newCheckedItems
128
127
  });
@@ -139,7 +138,7 @@ const MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map((role)=>`[role="${role}"]`)
139
138
  ...s,
140
139
  [name]: newCheckedItems
141
140
  }));
142
- handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
141
+ handleCheckedValueChange?.(e, {
143
142
  name,
144
143
  checkedItems: newCheckedItems
145
144
  });
@@ -160,8 +159,8 @@ const MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map((role)=>`[role="${role}"]`)
160
159
  elementType: 'div'
161
160
  }),
162
161
  checkedValues,
163
- hasIcons: (_ref = (_props_hasIcons = props.hasIcons) !== null && _props_hasIcons !== void 0 ? _props_hasIcons : hasIconsContext) !== null && _ref !== void 0 ? _ref : false,
164
- hasCheckmarks: (_ref1 = (_props_hasCheckmarks = props.hasCheckmarks) !== null && _props_hasCheckmarks !== void 0 ? _props_hasCheckmarks : hasCheckmarksContext) !== null && _ref1 !== void 0 ? _ref1 : false,
162
+ hasIcons: props.hasIcons ?? hasIconsContext ?? false,
163
+ hasCheckmarks: props.hasCheckmarks ?? hasCheckmarksContext ?? false,
165
164
  hasMenuContext,
166
165
  setFocusByFirstCharacter,
167
166
  selectRadio,
@@ -177,10 +176,7 @@ const MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map((role)=>`[role="${role}"]`)
177
176
  if (startIndex === menuItems.length) {
178
177
  startIndex = 0;
179
178
  }
180
- const firstChars = menuItems.map((menuItem)=>{
181
- var _menuItem_textContent;
182
- return (_menuItem_textContent = menuItem.textContent) === null || _menuItem_textContent === void 0 ? void 0 : _menuItem_textContent.charAt(0).toLowerCase();
183
- });
179
+ const firstChars = menuItems.map((menuItem)=>menuItem.textContent?.charAt(0).toLowerCase());
184
180
  const char = key.toLowerCase();
185
181
  const getIndexFirstChars = (start)=>{
186
182
  for(let i = start; i < firstChars.length; i++){
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuList/useMenuList.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getIntrinsicElementProps,\n slot,\n} from '@fluentui/react-utilities';\nimport {\n useArrowNavigationGroup,\n useFocusFinders,\n TabsterMoveFocusEventName,\n type TabsterMoveFocusEvent,\n} from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\nconst MENU_ITEM_ROLES = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\nconst MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map(role => `[role=\"${role}\"]`).join(',');\n\n/**\n * Returns the props and state required to render the component.\n *\n * Composes with `useMenuListBase_unstable` and adds Tabster-driven keyboard\n * navigation: circular arrow-key focus, a `TabsterMoveFocusEvent` listener\n * that lets `useMenuPopover_unstable` handle Tab key presses, a focus-aware\n * `setFocusByFirstCharacter`, and the `hasIcons` / `hasCheckmarks` slot\n * alignment hints sourced from the parent `MenuContext`.\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const wrapperRef = React.useRef<HTMLElement>(null);\n const { findAllFocusable } = useFocusFinders();\n const { targetDocument } = useFluent();\n const focusAttributes = useArrowNavigationGroup({ circular: true });\n\n const baseState = useMenuListBase_unstable(props, ref);\n // recreate root non-mutatively: merge wrapperRef so the effect below can\n // observe the rendered DOM element, and add Tabster arrow-nav attributes\n const mergedRootRef = useMergedRefs(baseState.root.ref, wrapperRef) as React.Ref<HTMLDivElement>;\n\n React.useEffect(() => {\n const element = wrapperRef.current;\n\n if (!hasMenuContext || !targetDocument || !element) {\n return;\n }\n\n const onTabsterMoveFocus = (e: TabsterMoveFocusEvent) => {\n const nextElement = e.detail.next;\n if (nextElement && element.contains(targetDocument.activeElement) && !element.contains(nextElement)) {\n // Preventing Tabster from handling Tab press, useMenuPopover will handle it.\n e.preventDefault();\n }\n };\n\n targetDocument.addEventListener(TabsterMoveFocusEventName, onTabsterMoveFocus);\n return () => {\n targetDocument.removeEventListener(TabsterMoveFocusEventName, onTabsterMoveFocus);\n };\n }, [hasMenuContext, targetDocument]);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n if (!wrapperRef.current) {\n return;\n }\n const menuItems = findAllFocusable(\n wrapperRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && MENU_ITEM_ROLES.indexOf(el.getAttribute('role')!) !== -1,\n );\n focusItemMatchingFirstCharacter(menuItems, e.key, itemEl);\n },\n [findAllFocusable],\n );\n\n return {\n ...baseState,\n root: {\n ...focusAttributes,\n ...baseState.root,\n ref: mergedRootRef,\n },\n setFocusByFirstCharacter,\n };\n};\n\n/**\n * Base hook for MenuList component, produces state required to render the component.\n *\n * Does not invoke any Tabster APIs internally: arrow-key navigation and the\n * focus-aware `setFocusByFirstCharacter` are added by the wrapper\n * `useMenuList_unstable`. The base's `setFocusByFirstCharacter` walks the DOM\n * via `querySelectorAll` and does not filter by Tabster's focusability rules,\n * so consumers integrating their own focus management should layer that on top.\n *\n * @param props - props from this instance of MenuList\n * @param ref - reference to root HTMLElement of MenuList\n */\nexport const useMenuListBase_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const checkedValuesContext = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChangeContext = useMenuContext_unstable(context => context.onCheckedValueChange);\n const hasIconsContext = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarksContext = useMenuContext_unstable(context => context.hasCheckmarks);\n const hasMenuContext = useHasParentContext(MenuContext);\n\n const innerRef = React.useRef<HTMLElement>(null);\n const validateNestingRef = useValidateNesting('MenuList');\n\n const setFocusByFirstCharacter = React.useCallback((e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n if (!innerRef.current) {\n return;\n }\n const menuItems = Array.from(innerRef.current.querySelectorAll<HTMLElement>(MENU_ITEM_ROLES_SELECTOR));\n focusItemMatchingFirstCharacter(menuItems, e.key, itemEl);\n }, []);\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues ?? (hasMenuContext ? checkedValuesContext : undefined),\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange =\n props.onCheckedValueChange ?? (hasMenuContext ? onCheckedValueChangeContext : undefined);\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef, validateNestingRef) as React.Ref<HTMLDivElement>,\n role: 'menu',\n 'aria-labelledby': triggerId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n checkedValues,\n hasIcons: props.hasIcons ?? hasIconsContext ?? false,\n hasCheckmarks: props.hasCheckmarks ?? hasCheckmarksContext ?? false,\n hasMenuContext,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Focuses the next menu item whose textContent starts with the typed character,\n * wrapping around the list. Shared between the Tabster-free base impl and the\n * Tabster-aware wrapper.\n */\nconst focusItemMatchingFirstCharacter = (menuItems: HTMLElement[], key: string, current: HTMLElement) => {\n let startIndex = menuItems.indexOf(current) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = key.toLowerCase();\n\n const getIndexFirstChars = (start: number) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n let index = getIndexFirstChars(startIndex);\n if (index === -1) {\n index = getIndexFirstChars(0);\n }\n if (index > -1) {\n menuItems[index].focus();\n }\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"names":["React","useMergedRefs","useEventCallback","useControllableState","getIntrinsicElementProps","slot","useArrowNavigationGroup","useFocusFinders","TabsterMoveFocusEventName","useFluent_unstable","useFluent","useHasParentContext","useMenuContext_unstable","MenuContext","useValidateNesting","MENU_ITEM_ROLES","MENU_ITEM_ROLES_SELECTOR","map","role","join","useMenuList_unstable","props","ref","menuContext","useMenuContextSelectors","hasMenuContext","usingPropsAndMenuContext","console","warn","wrapperRef","useRef","findAllFocusable","targetDocument","focusAttributes","circular","baseState","useMenuListBase_unstable","mergedRootRef","root","useEffect","element","current","onTabsterMoveFocus","e","nextElement","detail","next","contains","activeElement","preventDefault","addEventListener","removeEventListener","setFocusByFirstCharacter","useCallback","itemEl","menuItems","el","hasAttribute","indexOf","getAttribute","focusItemMatchingFirstCharacter","key","triggerId","context","checkedValuesContext","checkedValues","onCheckedValueChangeContext","onCheckedValueChange","hasIconsContext","hasIcons","hasCheckmarksContext","hasCheckmarks","innerRef","validateNestingRef","Array","from","querySelectorAll","setCheckedValues","state","undefined","defaultState","defaultCheckedValues","initialState","handleCheckedValueChange","toggleCheckbox","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","always","elementType","startIndex","length","firstChars","menuItem","textContent","charAt","toLowerCase","char","getIndexFirstChars","start","i","index","focus","contextValue","isUsingPropsAndContext","val"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,wBAAwB,EACxBC,IAAI,QACC,4BAA4B;AACnC,SACEC,uBAAuB,EACvBC,eAAe,EACfC,yBAAyB,QAEpB,0BAA0B;AACjC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,mBAAmB,QAAQ,mCAAmC;AACvE,SAASC,uBAAuB,QAAQ,gCAA6B;AACrE,SAASC,WAAW,QAAQ,gCAA6B;AAEzD,SAASC,kBAAkB,QAAQ,oCAAiC;AAEpE,MAAMC,kBAAkB;IAAC;IAAY;IAAoB;CAAgB;AACzE,MAAMC,2BAA2BD,gBAAgBE,GAAG,CAACC,CAAAA,OAAQ,CAAC,OAAO,EAAEA,KAAK,EAAE,CAAC,EAAEC,IAAI,CAAC;AAEtF;;;;;;;;CAQC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,MAAMC,cAAcC;IACpB,MAAMC,iBAAiBd,oBAAoBE;IAE3C,IAAIa,yBAAyBL,OAAOE,aAAaE,iBAAiB;QAChE,4CAA4C;QAC5C,sCAAsC;QACtCE,QAAQC,IAAI,CAAC;IACf;IAEA,MAAMC,aAAa7B,MAAM8B,MAAM,CAAc;IAC7C,MAAM,EAAEC,gBAAgB,EAAE,GAAGxB;IAC7B,MAAM,EAAEyB,cAAc,EAAE,GAAGtB;IAC3B,MAAMuB,kBAAkB3B,wBAAwB;QAAE4B,UAAU;IAAK;IAEjE,MAAMC,YAAYC,yBAAyBf,OAAOC;IAClD,yEAAyE;IACzE,yEAAyE;IACzE,MAAMe,gBAAgBpC,cAAckC,UAAUG,IAAI,CAAChB,GAAG,EAAEO;IAExD7B,MAA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AOC,IAAIR,WAAWD,MAAM,EAAES,IAAK;YAC9C,IAAIH,SAASL,UAAU,CAACQ,EAAE,EAAE;gBAC1B,OAAOA;YACT;QACF;QACA,OAAO,CAAC;IACV;IAEA,IAAIC,QAAQH,mBAAmBR;IAC/B,IAAIW,UAAU,CAAC,GAAG;QAChBA,QAAQH,mBAAmB;IAC7B;IACA,IAAIG,QAAQ,CAAC,GAAG;QACdrD,SAAS,CAACqD,MAAM,CAACC,KAAK;IACxB;AACF;AAEA;;CAEC,GACD,MAAMrF,0BAA0B;IAC9B,MAAMyC,gBAAgBrD,wBAAwBmD,CAAAA,UAAWA,QAAQE,aAAa;IAC9E,MAAME,uBAAuBvD,wBAAwBmD,CAAAA,UAAWA,QAAQI,oBAAoB;IAC5F,MAAML,YAAYlD,wBAAwBmD,CAAAA,UAAWA,QAAQD,SAAS;IACtE,MAAMO,WAAWzD,wBAAwBmD,CAAAA,UAAWA,QAAQM,QAAQ;IACpE,MAAME,gBAAgB3D,wBAAwBmD,CAAAA,UAAWA,QAAQQ,aAAa;IAE9E,OAAO;QACLN;QACAE;QACAL;QACAO;QACAE;IACF;AACF;AAEA;;CAEC,GACD,MAAM7C,2BAA2B,CAC/BL,OACAyF,cACArF;IAEA,IAAIsF,yBAAyB;IAC7B,IAAK,MAAMC,OAAOF,aAAc;QAC9B,IAAIzF,KAAK,CAAC2F,IAAgG,EAAE;YAC1GD,yBAAyB;QAC3B;IACF;IAEA,OAAOtF,kBAAkBsF;AAC3B"}
1
+ {"version":3,"sources":["../../../src/components/MenuList/useMenuList.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getIntrinsicElementProps,\n slot,\n} from '@fluentui/react-utilities';\nimport {\n useArrowNavigationGroup,\n useFocusFinders,\n TabsterMoveFocusEventName,\n type TabsterMoveFocusEvent,\n} from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\nconst MENU_ITEM_ROLES = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\nconst MENU_ITEM_ROLES_SELECTOR = MENU_ITEM_ROLES.map(role => `[role=\"${role}\"]`).join(',');\n\n/**\n * Returns the props and state required to render the component.\n *\n * Composes with `useMenuListBase_unstable` and adds Tabster-driven keyboard\n * navigation: circular arrow-key focus, a `TabsterMoveFocusEvent` listener\n * that lets `useMenuPopover_unstable` handle Tab key presses, a focus-aware\n * `setFocusByFirstCharacter`, and the `hasIcons` / `hasCheckmarks` slot\n * alignment hints sourced from the parent `MenuContext`.\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const wrapperRef = React.useRef<HTMLElement>(null);\n const { findAllFocusable } = useFocusFinders();\n const { targetDocument } = useFluent();\n const focusAttributes = useArrowNavigationGroup({ circular: true });\n\n const baseState = useMenuListBase_unstable(props, ref);\n // recreate root non-mutatively: merge wrapperRef so the effect below can\n // observe the rendered DOM element, and add Tabster arrow-nav attributes\n const mergedRootRef = useMergedRefs(baseState.root.ref, wrapperRef) as React.Ref<HTMLDivElement>;\n\n React.useEffect(() => {\n const element = wrapperRef.current;\n\n if (!hasMenuContext || !targetDocument || !element) {\n return;\n }\n\n const onTabsterMoveFocus = (e: TabsterMoveFocusEvent) => {\n const nextElement = e.detail.next;\n if (nextElement && element.contains(targetDocument.activeElement) && !element.contains(nextElement)) {\n // Preventing Tabster from handling Tab press, useMenuPopover will handle it.\n e.preventDefault();\n }\n };\n\n targetDocument.addEventListener(TabsterMoveFocusEventName, onTabsterMoveFocus);\n return () => {\n targetDocument.removeEventListener(TabsterMoveFocusEventName, onTabsterMoveFocus);\n };\n }, [hasMenuContext, targetDocument]);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n if (!wrapperRef.current) {\n return;\n }\n const menuItems = findAllFocusable(\n wrapperRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && MENU_ITEM_ROLES.indexOf(el.getAttribute('role')!) !== -1,\n );\n focusItemMatchingFirstCharacter(menuItems, e.key, itemEl);\n },\n [findAllFocusable],\n );\n\n return {\n ...baseState,\n root: {\n ...focusAttributes,\n ...baseState.root,\n ref: mergedRootRef,\n },\n setFocusByFirstCharacter,\n };\n};\n\n/**\n * Base hook for MenuList component, produces state required to render the component.\n *\n * Does not invoke any Tabster APIs internally: arrow-key navigation and the\n * focus-aware `setFocusByFirstCharacter` are added by the wrapper\n * `useMenuList_unstable`. The base's `setFocusByFirstCharacter` walks the DOM\n * via `querySelectorAll` and does not filter by Tabster's focusability rules,\n * so consumers integrating their own focus management should layer that on top.\n *\n * @param props - props from this instance of MenuList\n * @param ref - reference to root HTMLElement of MenuList\n */\nexport const useMenuListBase_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const checkedValuesContext = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChangeContext = useMenuContext_unstable(context => context.onCheckedValueChange);\n const hasIconsContext = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarksContext = useMenuContext_unstable(context => context.hasCheckmarks);\n const hasMenuContext = useHasParentContext(MenuContext);\n\n const innerRef = React.useRef<HTMLElement>(null);\n const validateNestingRef = useValidateNesting('MenuList');\n\n const setFocusByFirstCharacter = React.useCallback((e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n if (!innerRef.current) {\n return;\n }\n const menuItems = Array.from(innerRef.current.querySelectorAll<HTMLElement>(MENU_ITEM_ROLES_SELECTOR));\n focusItemMatchingFirstCharacter(menuItems, e.key, itemEl);\n }, []);\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues ?? (hasMenuContext ? checkedValuesContext : undefined),\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange =\n props.onCheckedValueChange ?? (hasMenuContext ? onCheckedValueChangeContext : undefined);\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef, validateNestingRef) as React.Ref<HTMLDivElement>,\n role: 'menu',\n 'aria-labelledby': triggerId,\n ...props,\n }),\n { elementType: 'div' },\n ),\n checkedValues,\n hasIcons: props.hasIcons ?? hasIconsContext ?? false,\n hasCheckmarks: props.hasCheckmarks ?? hasCheckmarksContext ?? false,\n hasMenuContext,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Focuses the next menu item whose textContent starts with the typed character,\n * wrapping around the list. Shared between the Tabster-free base impl and the\n * Tabster-aware wrapper.\n */\nconst focusItemMatchingFirstCharacter = (menuItems: HTMLElement[], key: string, current: HTMLElement) => {\n let startIndex = menuItems.indexOf(current) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = key.toLowerCase();\n\n const getIndexFirstChars = (start: number) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n let index = getIndexFirstChars(startIndex);\n if (index === -1) {\n index = getIndexFirstChars(0);\n }\n if (index > -1) {\n menuItems[index].focus();\n }\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"names":["React","useMergedRefs","useEventCallback","useControllableState","getIntrinsicElementProps","slot","useArrowNavigationGroup","useFocusFinders","TabsterMoveFocusEventName","useFluent_unstable","useFluent","useHasParentContext","useMenuContext_unstable","MenuContext","useValidateNesting","MENU_ITEM_ROLES","MENU_ITEM_ROLES_SELECTOR","map","role","join","useMenuList_unstable","props","ref","menuContext","useMenuContextSelectors","hasMenuContext","usingPropsAndMenuContext","console","warn","wrapperRef","useRef","findAllFocusable","targetDocument","focusAttributes","circular","baseState","useMenuListBase_unstable","mergedRootRef","root","useEffect","element","current","onTabsterMoveFocus","e","nextElement","detail","next","contains","activeElement","preventDefault","addEventListener","removeEventListener","setFocusByFirstCharacter","useCallback","itemEl","menuItems","el","hasAttribute","indexOf","getAttribute","focusItemMatchingFirstCharacter","key","triggerId","context","checkedValuesContext","checkedValues","onCheckedValueChangeContext","onCheckedValueChange","hasIconsContext","hasIcons","hasCheckmarksContext","hasCheckmarks","innerRef","validateNestingRef","Array","from","querySelectorAll","setCheckedValues","state","undefined","defaultState","defaultCheckedValues","initialState","handleCheckedValueChange","toggleCheckbox","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","always","elementType","startIndex","length","firstChars","menuItem","textContent","charAt","toLowerCase","char","getIndexFirstChars","start","i","index","focus","contextValue","isUsingPropsAndContext","val"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,wBAAwB,EACxBC,IAAI,QACC,4BAA4B;AACnC,SACEC,uBAAuB,EACvBC,eAAe,EACfC,yBAAyB,QAEpB,0BAA0B;AACjC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,mBAAmB,QAAQ,mCAAmC;AACvE,SAASC,uBAAuB,QAAQ,gCAA6B;AACrE,SAASC,WAAW,QAAQ,gCAA6B;AAEzD,SAASC,kBAAkB,QAAQ,oCAAiC;AAEpE,MAAMC,kBAAkB;IAAC;IAAY;IAAoB;CAAgB;AACzE,MAAMC,2BAA2BD,gBAAgBE,GAAG,CAACC,CAAAA,OAAQ,CAAC,OAAO,EAAEA,KAAK,EAAE,CAAC,EAAEC,IAAI,CAAC;AAEtF;;;;;;;;CAQC,GACD,OAAO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EAAE;QACnCD,aAAa;IACf;IAEA,MAAME,aAAa5C,UAAUtC,GAAG,CAACmF,CAAAA,WAAYA,SAASC,WAAW,EAAEC,OAAO,GAAGC;IAC7E,MAAMC,OAAO3C,IAAI0C,WAAW;IAE5B,MAAME,qBAAqB,CAACC;QAC1B,IAAK,IAAIC,IAAID,OAAOC,IAAIR,WAAWD,MAAM,EAAES,IAAK;YAC9C,IAAIH,SAASL,UAAU,CAACQ,EAAE,EAAE;gBAC1B,OAAOA;YACT;QACF;QACA,OAAO,CAAC;IACV;IAEA,IAAIC,QAAQH,mBAAmBR;IAC/B,IAAIW,UAAU,CAAC,GAAG;QAChBA,QAAQH,mBAAmB;IAC7B;IACA,IAAIG,QAAQ,CAAC,GAAG;QACdrD,SAAS,CAACqD,MAAM,CAACC,KAAK;IACxB;AACF;AAEA;;CAEC,GACD,MAAMrF,0BAA0B;IAC9B,MAAMyC,gBAAgBrD,wBAAwBmD,CAAAA,UAAWA,QAAQE,aAAa;IAC9E,MAAME,uBAAuBvD,wBAAwBmD,CAAAA,UAAWA,QAAQI,oBAAoB;IAC5F,MAAML,YAAYlD,wBAAwBmD,CAAAA,UAAWA,QAAQD,SAAS;IACtE,MAAMO,WAAWzD,wBAAwBmD,CAAAA,UAAWA,QAAQM,QAAQ;IACpE,MAAME,gBAAgB3D,wBAAwBmD,CAAAA,UAAWA,QAAQQ,aAAa;IAE9E,OAAO;QACLN;QACAE;QACAL;QACAO;QACAE;IACF;AACF;AAEA;;CAEC,GACD,MAAM7C,2BAA2B,CAC/BL,OACAyF,cACArF;IAEA,IAAIsF,yBAAyB;IAC7B,IAAK,MAAMC,OAAOF,aAAc;QAC9B,IAAIzF,KAAK,CAAC2F,IAAgG,EAAE;YAC1GD,yBAAyB;QAC3B;IACF;IAEA,OAAOtF,kBAAkBsF;AAC3B"}
@@ -18,7 +18,6 @@ import { dispatchMenuEnterEvent, useIsSubmenu } from "../../utils/index.js";
18
18
  * @param props - props from this instance of MenuPopover
19
19
  * @param ref - reference to root HTMLElement of MenuPopover
20
20
  */ export const useMenuPopoverBase_unstable = (props, ref)=>{
21
- var _useMenuContext_unstable;
22
21
  'use no memo'; // justified: compiler would optimize useMenuPopoverBase_unstable — manual opt-out to preserve runtime behavior
23
22
  const safeZone = useMenuContext_unstable((context)=>context.safeZone);
24
23
  const popoverRef = useMenuContext_unstable((context)=>context.menuPopoverRef);
@@ -27,10 +26,7 @@ import { dispatchMenuEnterEvent, useIsSubmenu } from "../../utils/index.js";
27
26
  const openOnHover = useMenuContext_unstable((context)=>context.openOnHover);
28
27
  const triggerRef = useMenuContext_unstable((context)=>context.triggerRef);
29
28
  const isSubmenu = useIsSubmenu();
30
- const shouldCloseOnArrowLeft = useMenuListContext_unstable((ctx)=>{
31
- var _ctx_shouldCloseOnArrowLeft;
32
- return (_ctx_shouldCloseOnArrowLeft = ctx.shouldCloseOnArrowLeft) !== null && _ctx_shouldCloseOnArrowLeft !== void 0 ? _ctx_shouldCloseOnArrowLeft : true;
33
- });
29
+ const shouldCloseOnArrowLeft = useMenuListContext_unstable((ctx)=>ctx.shouldCloseOnArrowLeft ?? true);
34
30
  const canDispatchCustomEventRef = React.useRef(true);
35
31
  const [setThrottleTimeout, clearThrottleTimeout] = useTimeout();
36
32
  const { dir } = useFluent();
@@ -61,7 +57,7 @@ import { dispatchMenuEnterEvent, useIsSubmenu } from "../../utils/index.js";
61
57
  }, [
62
58
  clearThrottleTimeout
63
59
  ]);
64
- const inline = (_useMenuContext_unstable = useMenuContext_unstable((context)=>context.inline)) !== null && _useMenuContext_unstable !== void 0 ? _useMenuContext_unstable : false;
60
+ const inline = useMenuContext_unstable((context)=>context.inline) ?? false;
65
61
  const mountNode = useMenuContext_unstable((context)=>context.mountNode);
66
62
  const rootProps = slot.always(getIntrinsicElementProps('div', {
67
63
  role: 'presentation',
@@ -83,13 +79,12 @@ import { dispatchMenuEnterEvent, useIsSubmenu } from "../../utils/index.js";
83
79
  event
84
80
  });
85
81
  }
86
- onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(event);
82
+ onMouseEnterOriginal?.(event);
87
83
  });
88
84
  rootProps.onKeyDown = useEventCallback((event)=>{
89
85
  const key = event.key;
90
86
  if (key === Escape || isSubmenu && shouldCloseOnArrowLeft && key === CloseArrowKey) {
91
- var _popoverRef_current;
92
- if (open && ((_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.contains(event.target)) && !event.isDefaultPrevented()) {
87
+ if (open && popoverRef.current?.contains(event.target) && !event.isDefaultPrevented()) {
93
88
  setOpen(event, {
94
89
  open: false,
95
90
  keyboard: true,
@@ -109,11 +104,10 @@ import { dispatchMenuEnterEvent, useIsSubmenu } from "../../utils/index.js";
109
104
  event
110
105
  });
111
106
  if (!isSubmenu) {
112
- var _triggerRef_current;
113
- (_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.focus();
107
+ triggerRef.current?.focus();
114
108
  }
115
109
  }
116
- onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(event);
110
+ onKeyDownOriginal?.(event);
117
111
  });
118
112
  return {
119
113
  inline,