@fluentui/react-menu 9.4.1 → 9.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/CHANGELOG.json +60 -1
  2. package/CHANGELOG.md +17 -2
  3. package/dist/index.d.ts +45 -4
  4. package/lib/components/Menu/Menu.types.js.map +1 -1
  5. package/lib/components/Menu/useMenu.js +13 -7
  6. package/lib/components/Menu/useMenu.js.map +1 -1
  7. package/lib/components/MenuItem/useMenuItem.js +3 -1
  8. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  9. package/lib/components/MenuPopover/useMenuPopover.js +20 -14
  10. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  11. package/lib/components/MenuTrigger/useMenuTrigger.js +42 -28
  12. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  13. package/lib/index.js.map +1 -1
  14. package/lib-amd/Menu.js +6 -0
  15. package/lib-amd/Menu.js.map +1 -0
  16. package/lib-amd/MenuDivider.js +6 -0
  17. package/lib-amd/MenuDivider.js.map +1 -0
  18. package/lib-amd/MenuGroup.js +6 -0
  19. package/lib-amd/MenuGroup.js.map +1 -0
  20. package/lib-amd/MenuGroupHeader.js +6 -0
  21. package/lib-amd/MenuGroupHeader.js.map +1 -0
  22. package/lib-amd/MenuItem.js +6 -0
  23. package/lib-amd/MenuItem.js.map +1 -0
  24. package/lib-amd/MenuItemCheckbox.js +6 -0
  25. package/lib-amd/MenuItemCheckbox.js.map +1 -0
  26. package/lib-amd/MenuItemRadio.js +6 -0
  27. package/lib-amd/MenuItemRadio.js.map +1 -0
  28. package/lib-amd/MenuList.js +6 -0
  29. package/lib-amd/MenuList.js.map +1 -0
  30. package/lib-amd/MenuPopover.js +6 -0
  31. package/lib-amd/MenuPopover.js.map +1 -0
  32. package/lib-amd/MenuSplitGroup.js +6 -0
  33. package/lib-amd/MenuSplitGroup.js.map +1 -0
  34. package/lib-amd/MenuTrigger.js +6 -0
  35. package/lib-amd/MenuTrigger.js.map +1 -0
  36. package/lib-amd/components/Menu/Menu.js +16 -0
  37. package/lib-amd/components/Menu/Menu.js.map +1 -0
  38. package/lib-amd/components/Menu/Menu.types.js +5 -0
  39. package/lib-amd/components/Menu/Menu.types.js.map +1 -0
  40. package/lib-amd/components/Menu/index.js +10 -0
  41. package/lib-amd/components/Menu/index.js.map +1 -0
  42. package/lib-amd/components/Menu/renderMenu.js +15 -0
  43. package/lib-amd/components/Menu/renderMenu.js.map +1 -0
  44. package/lib-amd/components/Menu/useMenu.js +233 -0
  45. package/lib-amd/components/Menu/useMenu.js.map +1 -0
  46. package/lib-amd/components/Menu/useMenuContextValues.js +29 -0
  47. package/lib-amd/components/Menu/useMenuContextValues.js.map +1 -0
  48. package/lib-amd/components/MenuDivider/MenuDivider.js +15 -0
  49. package/lib-amd/components/MenuDivider/MenuDivider.js.map +1 -0
  50. package/lib-amd/components/MenuDivider/MenuDivider.types.js +5 -0
  51. package/lib-amd/components/MenuDivider/MenuDivider.types.js.map +1 -0
  52. package/lib-amd/components/MenuDivider/index.js +10 -0
  53. package/lib-amd/components/MenuDivider/index.js.map +1 -0
  54. package/lib-amd/components/MenuDivider/renderMenuDivider.js +15 -0
  55. package/lib-amd/components/MenuDivider/renderMenuDivider.js.map +1 -0
  56. package/lib-amd/components/MenuDivider/useMenuDivider.js +18 -0
  57. package/lib-amd/components/MenuDivider/useMenuDivider.js.map +1 -0
  58. package/lib-amd/components/MenuDivider/useMenuDividerStyles.js +18 -0
  59. package/lib-amd/components/MenuDivider/useMenuDividerStyles.js.map +1 -0
  60. package/lib-amd/components/MenuGroup/MenuGroup.js +16 -0
  61. package/lib-amd/components/MenuGroup/MenuGroup.js.map +1 -0
  62. package/lib-amd/components/MenuGroup/MenuGroup.types.js +5 -0
  63. package/lib-amd/components/MenuGroup/MenuGroup.types.js.map +1 -0
  64. package/lib-amd/components/MenuGroup/index.js +11 -0
  65. package/lib-amd/components/MenuGroup/index.js.map +1 -0
  66. package/lib-amd/components/MenuGroup/renderMenuGroup.js +16 -0
  67. package/lib-amd/components/MenuGroup/renderMenuGroup.js.map +1 -0
  68. package/lib-amd/components/MenuGroup/useMenuGroup.js +20 -0
  69. package/lib-amd/components/MenuGroup/useMenuGroup.js.map +1 -0
  70. package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js +12 -0
  71. package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js.map +1 -0
  72. package/lib-amd/components/MenuGroup/useMenuGroupStyles.js +14 -0
  73. package/lib-amd/components/MenuGroup/useMenuGroupStyles.js.map +1 -0
  74. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js +15 -0
  75. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -0
  76. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js +5 -0
  77. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -0
  78. package/lib-amd/components/MenuGroupHeader/index.js +10 -0
  79. package/lib-amd/components/MenuGroupHeader/index.js.map +1 -0
  80. package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js +15 -0
  81. package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -0
  82. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js +19 -0
  83. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -0
  84. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +27 -0
  85. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -0
  86. package/lib-amd/components/MenuItem/MenuItem.js +15 -0
  87. package/lib-amd/components/MenuItem/MenuItem.js.map +1 -0
  88. package/lib-amd/components/MenuItem/MenuItem.types.js +5 -0
  89. package/lib-amd/components/MenuItem/MenuItem.types.js.map +1 -0
  90. package/lib-amd/components/MenuItem/index.js +10 -0
  91. package/lib-amd/components/MenuItem/index.js.map +1 -0
  92. package/lib-amd/components/MenuItem/renderMenuItem.js +19 -0
  93. package/lib-amd/components/MenuItem/renderMenuItem.js.map +1 -0
  94. package/lib-amd/components/MenuItem/useCharacterSearch.js +22 -0
  95. package/lib-amd/components/MenuItem/useCharacterSearch.js.map +1 -0
  96. package/lib-amd/components/MenuItem/useMenuItem.js +80 -0
  97. package/lib-amd/components/MenuItem/useMenuItem.js.map +1 -0
  98. package/lib-amd/components/MenuItem/useMenuItemStyles.js +100 -0
  99. package/lib-amd/components/MenuItem/useMenuItemStyles.js.map +1 -0
  100. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js +15 -0
  101. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -0
  102. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js +5 -0
  103. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -0
  104. package/lib-amd/components/MenuItemCheckbox/index.js +10 -0
  105. package/lib-amd/components/MenuItemCheckbox/index.js.map +1 -0
  106. package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js +16 -0
  107. package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -0
  108. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js +26 -0
  109. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -0
  110. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +31 -0
  111. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -0
  112. package/lib-amd/components/MenuItemRadio/MenuItemRadio.js +15 -0
  113. package/lib-amd/components/MenuItemRadio/MenuItemRadio.js.map +1 -0
  114. package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js +5 -0
  115. package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -0
  116. package/lib-amd/components/MenuItemRadio/index.js +10 -0
  117. package/lib-amd/components/MenuItemRadio/index.js.map +1 -0
  118. package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js +19 -0
  119. package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -0
  120. package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js +27 -0
  121. package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js.map +1 -0
  122. package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js +31 -0
  123. package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -0
  124. package/lib-amd/components/MenuList/MenuList.js +16 -0
  125. package/lib-amd/components/MenuList/MenuList.js.map +1 -0
  126. package/lib-amd/components/MenuList/MenuList.types.js +5 -0
  127. package/lib-amd/components/MenuList/MenuList.types.js.map +1 -0
  128. package/lib-amd/components/MenuList/index.js +11 -0
  129. package/lib-amd/components/MenuList/index.js.map +1 -0
  130. package/lib-amd/components/MenuList/renderMenuList.js +15 -0
  131. package/lib-amd/components/MenuList/renderMenuList.js.map +1 -0
  132. package/lib-amd/components/MenuList/useMenuList.js +119 -0
  133. package/lib-amd/components/MenuList/useMenuList.js.map +1 -0
  134. package/lib-amd/components/MenuList/useMenuListContextValues.js +21 -0
  135. package/lib-amd/components/MenuList/useMenuListContextValues.js.map +1 -0
  136. package/lib-amd/components/MenuList/useMenuListStyles.js +21 -0
  137. package/lib-amd/components/MenuList/useMenuListStyles.js.map +1 -0
  138. package/lib-amd/components/MenuPopover/MenuPopover.js +15 -0
  139. package/lib-amd/components/MenuPopover/MenuPopover.js.map +1 -0
  140. package/lib-amd/components/MenuPopover/MenuPopover.types.js +5 -0
  141. package/lib-amd/components/MenuPopover/MenuPopover.types.js.map +1 -0
  142. package/lib-amd/components/MenuPopover/index.js +10 -0
  143. package/lib-amd/components/MenuPopover/index.js.map +1 -0
  144. package/lib-amd/components/MenuPopover/renderMenuPopover.js +18 -0
  145. package/lib-amd/components/MenuPopover/renderMenuPopover.js.map +1 -0
  146. package/lib-amd/components/MenuPopover/useMenuPopover.js +82 -0
  147. package/lib-amd/components/MenuPopover/useMenuPopover.js.map +1 -0
  148. package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js +21 -0
  149. package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js.map +1 -0
  150. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js +15 -0
  151. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
  152. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js +5 -0
  153. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
  154. package/lib-amd/components/MenuSplitGroup/index.js +10 -0
  155. package/lib-amd/components/MenuSplitGroup/index.js.map +1 -0
  156. package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js +14 -0
  157. package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
  158. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js +47 -0
  159. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
  160. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js +43 -0
  161. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
  162. package/lib-amd/components/MenuTrigger/MenuTrigger.js +18 -0
  163. package/lib-amd/components/MenuTrigger/MenuTrigger.js.map +1 -0
  164. package/lib-amd/components/MenuTrigger/MenuTrigger.types.js +5 -0
  165. package/lib-amd/components/MenuTrigger/MenuTrigger.types.js.map +1 -0
  166. package/lib-amd/components/MenuTrigger/index.js +9 -0
  167. package/lib-amd/components/MenuTrigger/index.js.map +1 -0
  168. package/lib-amd/components/MenuTrigger/renderMenuTrigger.js +15 -0
  169. package/lib-amd/components/MenuTrigger/renderMenuTrigger.js.map +1 -0
  170. package/lib-amd/components/MenuTrigger/useMenuTrigger.js +112 -0
  171. package/lib-amd/components/MenuTrigger/useMenuTrigger.js.map +1 -0
  172. package/lib-amd/components/index.js +7 -0
  173. package/lib-amd/components/index.js.map +1 -0
  174. package/lib-amd/contexts/menuContext.js +32 -0
  175. package/lib-amd/contexts/menuContext.js.map +1 -0
  176. package/lib-amd/contexts/menuGroupContext.js +13 -0
  177. package/lib-amd/contexts/menuGroupContext.js.map +1 -0
  178. package/lib-amd/contexts/menuListContext.js +24 -0
  179. package/lib-amd/contexts/menuListContext.js.map +1 -0
  180. package/lib-amd/contexts/menuTriggerContext.js +14 -0
  181. package/lib-amd/contexts/menuTriggerContext.js.map +1 -0
  182. package/lib-amd/index.js +69 -0
  183. package/lib-amd/index.js.map +1 -0
  184. package/lib-amd/selectable/index.js +7 -0
  185. package/lib-amd/selectable/index.js.map +1 -0
  186. package/lib-amd/selectable/types.js +5 -0
  187. package/lib-amd/selectable/types.js.map +1 -0
  188. package/lib-amd/selectable/useCheckmarkStyles.js +28 -0
  189. package/lib-amd/selectable/useCheckmarkStyles.js.map +1 -0
  190. package/lib-amd/utils/index.js +6 -0
  191. package/lib-amd/utils/index.js.map +1 -0
  192. package/lib-amd/utils/useIsSubmenu.js +20 -0
  193. package/lib-amd/utils/useIsSubmenu.js.map +1 -0
  194. package/lib-amd/utils/useOnMenuEnter.js +59 -0
  195. package/lib-amd/utils/useOnMenuEnter.js.map +1 -0
  196. package/lib-commonjs/components/Menu/useMenu.js +13 -7
  197. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  198. package/lib-commonjs/components/MenuItem/useMenuItem.js +3 -1
  199. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  200. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +20 -14
  201. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  202. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +42 -28
  203. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  204. package/lib-commonjs/index.js.map +1 -1
  205. package/package.json +7 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMenuSplitGroupStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuSplitGroup/useMenuSplitGroupStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,wBAAwB,GAAwC;QAC3E,IAAI,EAAE,oBAAoB;KAC3B,CAAC;IACF;;OAEG;IACH,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI;gBACF,OAAO,EAAE,MAAM;;YACf,GAAC,UAAQ,sCAAkB,CAAC,IAAI,kBAAe,IAAG;gBAChD,KAAK,EAAE,MAAM;aACd;YACD,GAAC,UAAQ,sCAAkB,CAAC,IAAI,kBAAe,IAAG;gBAChD,mBAAmB,EAAE,CAAC;gBACtB,sBAAsB,EAAE,CAAC;gBACzB,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,MAAM;gBAClB,UAAU,EAAE;oBACV,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,oBAAM,CAAC,eAAe;oBAC7B,MAAM,EAAE,MAAM;oBACd,eAAe,EAAE,oBAAM,CAAC,mBAAmB;iBAC5C;aACF;eACF;KACF,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,gCAAgC,GAAG,UAAC,KAA0B;QACzE,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CAAC,gCAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtG,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAJW,QAAA,gCAAgC,oCAI3C","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { menuItemClassNames } from '../MenuItem/useMenuItemStyles';\nimport type { MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const menuSplitGroupClassNames: SlotClassNames<MenuSplitGroupSlots> = {\n root: 'fui-MenuSplitGroup',\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n [`& > .${menuItemClassNames.root}:nth-child(1)`]: {\n width: '100%',\n },\n [`& > .${menuItemClassNames.root}:nth-child(2)`]: {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n paddingLeft: 0,\n marginLeft: 'auto',\n '::before': {\n content: '\"\"',\n width: tokens.strokeWidthThin,\n height: '24px',\n backgroundColor: tokens.colorNeutralStroke1,\n },\n },\n },\n});\n\n/**\n * Apply styling to the MenuSplitGroup slots based on the state\n */\nexport const useMenuSplitGroupStyles_unstable = (state: MenuSplitGroupState): MenuSplitGroupState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuSplitGroupClassNames.root, styles.root, state.root.className);\n return state;\n};\n"]}
@@ -0,0 +1,18 @@
1
+ define(["require", "exports", "./useMenuTrigger", "./renderMenuTrigger"], function (require, exports, useMenuTrigger_1, renderMenuTrigger_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MenuTrigger = void 0;
5
+ /**
6
+ * Wraps a trigger element as an only child
7
+ * and adds the necessary event handling to open a popup menu
8
+ */
9
+ var MenuTrigger = function (props) {
10
+ var state = useMenuTrigger_1.useMenuTrigger_unstable(props);
11
+ return renderMenuTrigger_1.renderMenuTrigger_unstable(state);
12
+ };
13
+ exports.MenuTrigger = MenuTrigger;
14
+ exports.MenuTrigger.displayName = 'MenuTrigger';
15
+ // type casting here is required to ensure internal type FluentTriggerComponent is not leaked
16
+ exports.MenuTrigger.isFluentTriggerComponent = true;
17
+ });
18
+ //# sourceMappingURL=MenuTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuTrigger/MenuTrigger.tsx"],"names":[],"mappings":";;;;IAMA;;;OAGG;IACI,IAAM,WAAW,GAA+B,UAAA,KAAK;QAC1D,IAAM,KAAK,GAAG,wCAAuB,CAAC,KAAK,CAAC,CAAC;QAE7C,OAAO,8CAA0B,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC;IAJW,QAAA,WAAW,eAItB;IAEF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC;IACxC,6FAA6F;IAC5F,mBAAsC,CAAC,wBAAwB,GAAG,IAAI,CAAC","sourcesContent":["import * as React from 'react';\nimport { useMenuTrigger_unstable } from './useMenuTrigger';\nimport { renderMenuTrigger_unstable } from './renderMenuTrigger';\nimport type { MenuTriggerProps } from './MenuTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * Wraps a trigger element as an only child\n * and adds the necessary event handling to open a popup menu\n */\nexport const MenuTrigger: React.FC<MenuTriggerProps> = props => {\n const state = useMenuTrigger_unstable(props);\n\n return renderMenuTrigger_unstable(state);\n};\n\nMenuTrigger.displayName = 'MenuTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(MenuTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"]}
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=MenuTrigger.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuTrigger.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuTrigger/MenuTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type MenuTriggerProps = TriggerProps<MenuTriggerChildProps> & {\n /**\n * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.\n * @default false\n */\n disableButtonEnhancement?: boolean;\n};\n\n/**\n * Props that are passed to the child of the MenuTrigger when cloned to ensure correct behaviour for the Menu\n */\nexport type MenuTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<\n Type,\n Props & {\n 'aria-haspopup'?: 'menu';\n 'aria-expanded'?: boolean;\n id: string;\n ref: React.Ref<never>;\n onMouseEnter: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n onMouseLeave: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n onMouseMove: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n onContextMenu: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n }\n>;\n\nexport type MenuTriggerState = {\n children: React.ReactElement | null;\n isSubmenu: boolean;\n};\n"]}
@@ -0,0 +1,9 @@
1
+ define(["require", "exports", "tslib", "./MenuTrigger", "./MenuTrigger.types", "./renderMenuTrigger", "./useMenuTrigger"], function (require, exports, tslib_1, MenuTrigger_1, MenuTrigger_types_1, renderMenuTrigger_1, useMenuTrigger_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(MenuTrigger_1, exports);
5
+ tslib_1.__exportStar(MenuTrigger_types_1, exports);
6
+ tslib_1.__exportStar(renderMenuTrigger_1, exports);
7
+ tslib_1.__exportStar(useMenuTrigger_1, exports);
8
+ });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuTrigger/index.ts"],"names":[],"mappings":";;;IAAA,6CAA8B;IAC9B,mDAAoC;IACpC,mDAAoC;IACpC,gDAAiC","sourcesContent":["export * from './MenuTrigger';\nexport * from './MenuTrigger.types';\nexport * from './renderMenuTrigger';\nexport * from './useMenuTrigger';\n"]}
@@ -0,0 +1,15 @@
1
+ define(["require", "exports", "react", "../../contexts/menuTriggerContext"], function (require, exports, React, menuTriggerContext_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderMenuTrigger_unstable = void 0;
5
+ /**
6
+ * Render the final JSX of MenuTrigger
7
+ *
8
+ * Only renders children
9
+ */
10
+ var renderMenuTrigger_unstable = function (state) {
11
+ return React.createElement(menuTriggerContext_1.MenuTriggerContextProvider, { value: state.isSubmenu }, state.children);
12
+ };
13
+ exports.renderMenuTrigger_unstable = renderMenuTrigger_unstable;
14
+ });
15
+ //# sourceMappingURL=renderMenuTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderMenuTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuTrigger/renderMenuTrigger.tsx"],"names":[],"mappings":";;;;IAIA;;;;OAIG;IACI,IAAM,0BAA0B,GAAG,UAAC,KAAuB;QAChE,OAAO,oBAAC,+CAA0B,IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,IAAG,KAAK,CAAC,QAAQ,CAA8B,CAAC;IAC3G,CAAC,CAAC;IAFW,QAAA,0BAA0B,8BAErC","sourcesContent":["import * as React from 'react';\nimport { MenuTriggerContextProvider } from '../../contexts/menuTriggerContext';\nimport type { MenuTriggerState } from './MenuTrigger.types';\n\n/**\n * Render the final JSX of MenuTrigger\n *\n * Only renders children\n */\nexport const renderMenuTrigger_unstable = (state: MenuTriggerState) => {\n return <MenuTriggerContextProvider value={state.isSubmenu}>{state.children}</MenuTriggerContextProvider>;\n};\n"]}
@@ -0,0 +1,112 @@
1
+ define(["require", "exports", "tslib", "react", "../../contexts/menuContext", "../../utils/useIsSubmenu", "@fluentui/react-tabster", "@fluentui/react-shared-contexts", "@fluentui/keyboard-keys", "@fluentui/react-utilities", "@fluentui/react-aria"], function (require, exports, tslib_1, React, menuContext_1, useIsSubmenu_1, react_tabster_1, react_shared_contexts_1, keyboard_keys_1, react_utilities_1, react_aria_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useMenuTrigger_unstable = void 0;
5
+ /**
6
+ * Create the state required to render MenuTrigger.
7
+ * Clones the only child component and adds necessary event handling behaviours to open a popup menu
8
+ *
9
+ * @param props - props from this instance of MenuTrigger
10
+ */
11
+ var useMenuTrigger_unstable = function (props) {
12
+ var children = props.children, _a = props.disableButtonEnhancement, disableButtonEnhancement = _a === void 0 ? false : _a;
13
+ var triggerRef = menuContext_1.useMenuContext_unstable(function (context) { return context.triggerRef; });
14
+ var menuPopoverRef = menuContext_1.useMenuContext_unstable(function (context) { return context.menuPopoverRef; });
15
+ var setOpen = menuContext_1.useMenuContext_unstable(function (context) { return context.setOpen; });
16
+ var open = menuContext_1.useMenuContext_unstable(function (context) { return context.open; });
17
+ var triggerId = menuContext_1.useMenuContext_unstable(function (context) { return context.triggerId; });
18
+ var openOnHover = menuContext_1.useMenuContext_unstable(function (context) { return context.openOnHover; });
19
+ var openOnContext = menuContext_1.useMenuContext_unstable(function (context) { return context.openOnContext; });
20
+ var isSubmenu = useIsSubmenu_1.useIsSubmenu();
21
+ var findFirstFocusable = react_tabster_1.useFocusFinders().findFirstFocusable;
22
+ var focusFirst = React.useCallback(function () {
23
+ var firstFocusable = findFirstFocusable(menuPopoverRef.current);
24
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
25
+ }, [findFirstFocusable, menuPopoverRef]);
26
+ var openedWithKeyboardRef = React.useRef(false);
27
+ var hasMouseMoved = React.useRef(false);
28
+ var dir = react_shared_contexts_1.useFluent_unstable().dir;
29
+ var OpenArrowKey = dir === 'ltr' ? keyboard_keys_1.ArrowRight : keyboard_keys_1.ArrowLeft;
30
+ var child = react_utilities_1.getTriggerChild(children);
31
+ var onContextMenu = function (event) {
32
+ if (isTargetDisabled(event)) {
33
+ return;
34
+ }
35
+ if (openOnContext) {
36
+ event.preventDefault();
37
+ setOpen(event, { open: true, keyboard: false, type: 'menuTriggerContextMenu', event: event });
38
+ }
39
+ };
40
+ var onClick = function (event) {
41
+ if (isTargetDisabled(event)) {
42
+ return;
43
+ }
44
+ if (!openOnContext) {
45
+ setOpen(event, { open: !open, keyboard: openedWithKeyboardRef.current, type: 'menuTriggerClick', event: event });
46
+ openedWithKeyboardRef.current = false;
47
+ }
48
+ };
49
+ var onKeyDown = function (event) {
50
+ if (isTargetDisabled(event)) {
51
+ return;
52
+ }
53
+ var key = event.key;
54
+ if (!openOnContext && ((isSubmenu && key === OpenArrowKey) || (!isSubmenu && key === keyboard_keys_1.ArrowDown))) {
55
+ setOpen(event, { open: true, keyboard: true, type: 'menuTriggerKeyDown', event: event });
56
+ }
57
+ if (key === keyboard_keys_1.Escape && !isSubmenu) {
58
+ setOpen(event, { open: false, keyboard: true, type: 'menuTriggerKeyDown', event: event });
59
+ }
60
+ // if menu is already open, can't rely on effects to focus
61
+ if (open && key === OpenArrowKey && isSubmenu) {
62
+ focusFirst();
63
+ }
64
+ };
65
+ var onMouseEnter = function (event) {
66
+ if (isTargetDisabled(event)) {
67
+ return;
68
+ }
69
+ if (openOnHover && hasMouseMoved.current) {
70
+ setOpen(event, { open: true, keyboard: false, type: 'menuTriggerMouseEnter', event: event });
71
+ }
72
+ };
73
+ // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience
74
+ // First time open the mouse using mousemove and then continue with mouseenter
75
+ // Only use once to determine that the user is using the mouse since it is an expensive event to handle
76
+ var onMouseMove = function (event) {
77
+ if (isTargetDisabled(event)) {
78
+ return;
79
+ }
80
+ if (openOnHover && !hasMouseMoved.current) {
81
+ setOpen(event, { open: true, keyboard: false, type: 'menuTriggerMouseMove', event: event });
82
+ hasMouseMoved.current = true;
83
+ }
84
+ };
85
+ var onMouseLeave = function (event) {
86
+ if (isTargetDisabled(event)) {
87
+ return;
88
+ }
89
+ if (openOnHover) {
90
+ setOpen(event, { open: false, keyboard: false, type: 'menuTriggerMouseLeave', event: event });
91
+ }
92
+ };
93
+ var contextMenuProps = tslib_1.__assign(tslib_1.__assign({ id: triggerId }, child === null || child === void 0 ? void 0 : child.props), { ref: react_utilities_1.useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref), onMouseEnter: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)), onMouseLeave: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)), onContextMenu: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)), onMouseMove: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseMove, onMouseMove)) });
94
+ var triggerChildProps = tslib_1.__assign(tslib_1.__assign({ 'aria-haspopup': 'menu', 'aria-expanded': !open && !isSubmenu ? undefined : open }, contextMenuProps), { onClick: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)), onKeyDown: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown)) });
95
+ var ariaButtonTriggerChildProps = react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);
96
+ return {
97
+ isSubmenu: isSubmenu,
98
+ children: react_utilities_1.applyTriggerPropsToChildren(children, openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps),
99
+ };
100
+ };
101
+ exports.useMenuTrigger_unstable = useMenuTrigger_unstable;
102
+ var isTargetDisabled = function (e) {
103
+ var isDisabled = function (el) {
104
+ return el.hasAttribute('disabled') || (el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true');
105
+ };
106
+ if (e.target instanceof HTMLElement && isDisabled(e.target)) {
107
+ return true;
108
+ }
109
+ return e.currentTarget instanceof HTMLElement && isDisabled(e.currentTarget);
110
+ };
111
+ });
112
+ //# sourceMappingURL=useMenuTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMenuTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components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aAAa,YAAY,WAAW,IAAI,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAC/E,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n\n/**\n * Create the state required to render MenuTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup menu\n *\n * @param props - props from this instance of MenuTrigger\n */\nexport const useMenuTrigger_unstable = (props: MenuTriggerProps): MenuTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n\n const triggerRef = useMenuContext_unstable(context => context.triggerRef);\n const menuPopoverRef = useMenuContext_unstable(context => context.menuPopoverRef);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n const open = useMenuContext_unstable(context => context.open);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const openOnHover = useMenuContext_unstable(context => context.openOnHover);\n const openOnContext = useMenuContext_unstable(context => context.openOnContext);\n\n const isSubmenu = useIsSubmenu();\n\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, menuPopoverRef]);\n\n const openedWithKeyboardRef = React.useRef(false);\n const hasMouseMoved = React.useRef(false);\n\n const { dir } = useFluent();\n const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;\n\n const child = getTriggerChild(children);\n\n const onContextMenu = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n\n if (openOnContext) {\n event.preventDefault();\n setOpen(event, { open: true, keyboard: false, type: 'menuTriggerContextMenu', event });\n }\n };\n\n const onClick = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n\n if (!openOnContext) {\n setOpen(event, { open: !open, keyboard: openedWithKeyboardRef.current, type: 'menuTriggerClick', event });\n openedWithKeyboardRef.current = false;\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n\n const key = event.key;\n\n if (!openOnContext && ((isSubmenu && key === OpenArrowKey) || (!isSubmenu && key === ArrowDown))) {\n setOpen(event, { open: true, keyboard: true, type: 'menuTriggerKeyDown', event });\n }\n\n if (key === Escape && !isSubmenu) {\n setOpen(event, { open: false, keyboard: true, type: 'menuTriggerKeyDown', event });\n }\n\n // if menu is already open, can't rely on effects to focus\n if (open && key === OpenArrowKey && isSubmenu) {\n focusFirst();\n }\n };\n\n const onMouseEnter = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && hasMouseMoved.current) {\n setOpen(event, { open: true, keyboard: false, type: 'menuTriggerMouseEnter', event });\n }\n };\n\n // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience\n // First time open the mouse using mousemove and then continue with mouseenter\n // Only use once to determine that the user is using the mouse since it is an expensive event to handle\n const onMouseMove = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && !hasMouseMoved.current) {\n setOpen(event, { open: true, keyboard: false, type: 'menuTriggerMouseMove', event });\n hasMouseMoved.current = true;\n }\n };\n\n const onMouseLeave = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover) {\n setOpen(event, { open: false, keyboard: false, type: 'menuTriggerMouseLeave', event });\n }\n };\n\n const contextMenuProps = {\n id: triggerId,\n ...child?.props,\n ref: useMergedRefs(triggerRef, child?.ref),\n onMouseEnter: useEventCallback(mergeCallbacks(child?.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child?.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child?.props.onContextMenu, onContextMenu)),\n onMouseMove: useEventCallback(mergeCallbacks(child?.props.onMouseMove, onMouseMove)),\n };\n\n const triggerChildProps = {\n 'aria-haspopup': 'menu',\n 'aria-expanded': !open && !isSubmenu ? undefined : open,\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child?.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child?.props.onKeyDown, onKeyDown)),\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n triggerChildProps,\n );\n\n return {\n isSubmenu,\n children: applyTriggerPropsToChildren(\n children,\n openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n\nconst isTargetDisabled = (e: React.SyntheticEvent | Event) => {\n const isDisabled = (el: HTMLElement) =>\n el.hasAttribute('disabled') || (el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true');\n if (e.target instanceof HTMLElement && isDisabled(e.target)) {\n return true;\n }\n\n return e.currentTarget instanceof HTMLElement && isDisabled(e.currentTarget);\n};\n"]}
@@ -0,0 +1,7 @@
1
+ define(["require", "exports", "tslib", "./MenuItem/index", "./MenuList/index"], function (require, exports, tslib_1, index_1, index_2) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(index_1, exports);
5
+ tslib_1.__exportStar(index_2, exports);
6
+ });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/components/index.ts"],"names":[],"mappings":";;;IAAA,uCAAiC;IACjC,uCAAiC","sourcesContent":["export * from './MenuItem/index';\nexport * from './MenuList/index';\n"]}
@@ -0,0 +1,32 @@
1
+ define(["require", "exports", "@fluentui/react-context-selector"], function (require, exports, react_context_selector_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useMenuContext_unstable = exports.MenuProvider = exports.MenuContext = void 0;
5
+ exports.MenuContext = react_context_selector_1.createContext(undefined);
6
+ var menuContextDefaultValue = {
7
+ open: false,
8
+ setOpen: function () { return false; },
9
+ checkedValues: {},
10
+ onCheckedValueChange: function () { return null; },
11
+ defaultCheckedValues: {},
12
+ isSubmenu: false,
13
+ triggerRef: { current: null },
14
+ menuPopoverRef: { current: null },
15
+ triggerId: '',
16
+ openOnContext: false,
17
+ openOnHover: false,
18
+ hasIcons: false,
19
+ hasCheckmarks: false,
20
+ inline: false,
21
+ persistOnItemClick: false,
22
+ };
23
+ exports.MenuProvider = exports.MenuContext.Provider;
24
+ var useMenuContext_unstable = function (selector) {
25
+ return react_context_selector_1.useContextSelector(exports.MenuContext, function (ctx) {
26
+ if (ctx === void 0) { ctx = menuContextDefaultValue; }
27
+ return selector(ctx);
28
+ });
29
+ };
30
+ exports.useMenuContext_unstable = useMenuContext_unstable;
31
+ });
32
+ //# sourceMappingURL=menuContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menuContext.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/contexts/menuContext.ts"],"names":[],"mappings":";;;;IAKa,QAAA,WAAW,GAA8B,sCAAa,CACjE,SAAS,CACmB,CAAC;IAE/B,IAAM,uBAAuB,GAAqB;QAChD,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK;QACpB,aAAa,EAAE,EAAE;QACjB,oBAAoB,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QAChC,oBAAoB,EAAE,EAAE;QACxB,SAAS,EAAE,KAAK;QAChB,UAAU,EAAG,EAAE,OAAO,EAAE,IAAI,EAAqD;QACjF,cAAc,EAAG,EAAE,OAAO,EAAE,IAAI,EAAqD;QACrF,SAAS,EAAE,EAAE;QACb,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,KAAK;QACpB,MAAM,EAAE,KAAK;QACb,kBAAkB,EAAE,KAAK;KAC1B,CAAC;IA4BW,QAAA,YAAY,GAAG,mBAAW,CAAC,QAAQ,CAAC;IAE1C,IAAM,uBAAuB,GAAG,UAAI,QAA8C;QACvF,OAAA,2CAAkB,CAAC,mBAAW,EAAE,UAAC,GAA6B;YAA7B,oBAAA,EAAA,6BAA6B;YAAK,OAAA,QAAQ,CAAC,GAAG,CAAC;QAAb,CAAa,CAAC;IAAjF,CAAiF,CAAC;IADvE,QAAA,uBAAuB,2BACgD","sourcesContent":["import * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { MenuState } from '../components/Menu/index';\n\nexport const MenuContext: Context<MenuContextValue> = createContext<MenuContextValue | undefined>(\n undefined,\n) as Context<MenuContextValue>;\n\nconst menuContextDefaultValue: MenuContextValue = {\n open: false,\n setOpen: () => false,\n checkedValues: {},\n onCheckedValueChange: () => null,\n defaultCheckedValues: {},\n isSubmenu: false,\n triggerRef: ({ current: null } as unknown) as React.MutableRefObject<HTMLElement>,\n menuPopoverRef: ({ current: null } as unknown) as React.MutableRefObject<HTMLElement>,\n triggerId: '',\n openOnContext: false,\n openOnHover: false,\n hasIcons: false,\n hasCheckmarks: false,\n inline: false,\n persistOnItemClick: false,\n};\n\n/**\n * Context shared between Menu and its children components\n *\n * Extends and drills down MenuList props to simplify API\n */\nexport type MenuContextValue = Pick<\n MenuState,\n | 'openOnHover'\n | 'openOnContext'\n | 'triggerRef'\n | 'menuPopoverRef'\n | 'setOpen'\n | 'isSubmenu'\n | 'triggerId'\n | 'hasIcons'\n | 'hasCheckmarks'\n | 'persistOnItemClick'\n | 'inline'\n | 'checkedValues'\n | 'onCheckedValueChange'\n | 'defaultCheckedValues'\n> & {\n open: boolean;\n triggerId: string;\n};\n\nexport const MenuProvider = MenuContext.Provider;\n\nexport const useMenuContext_unstable = <T>(selector: ContextSelector<MenuContextValue, T>) =>\n useContextSelector(MenuContext, (ctx = menuContextDefaultValue) => selector(ctx));\n"]}
@@ -0,0 +1,13 @@
1
+ define(["require", "exports", "react"], function (require, exports, React) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useMenuGroupContext_unstable = exports.MenuGroupContextProvider = void 0;
5
+ var MenuGroupContext = React.createContext(undefined);
6
+ var menuGroupContextDefaultValue = {
7
+ headerId: '',
8
+ };
9
+ exports.MenuGroupContextProvider = MenuGroupContext.Provider;
10
+ var useMenuGroupContext_unstable = function () { var _a; return (_a = React.useContext(MenuGroupContext)) !== null && _a !== void 0 ? _a : menuGroupContextDefaultValue; };
11
+ exports.useMenuGroupContext_unstable = useMenuGroupContext_unstable;
12
+ });
13
+ //# sourceMappingURL=menuGroupContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menuGroupContext.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/contexts/menuGroupContext.ts"],"names":[],"mappings":";;;;IAEA,IAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAC1C,SAAS,CAC8B,CAAC;IAE1C,IAAM,4BAA4B,GAA0B;QAC1D,QAAQ,EAAE,EAAE;KACb,CAAC;IAaW,QAAA,wBAAwB,GAAG,gBAAgB,CAAC,QAAQ,CAAC;IAC3D,IAAM,4BAA4B,GAAG,sBAAM,OAAA,MAAA,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,mCAAI,4BAA4B,CAAA,EAAA,CAAC;IAAxG,QAAA,4BAA4B,gCAA4E","sourcesContent":["import * as React from 'react';\n\nconst MenuGroupContext = React.createContext<MenuGroupContextValue | undefined>(\n undefined,\n) as React.Context<MenuGroupContextValue>;\n\nconst menuGroupContextDefaultValue: MenuGroupContextValue = {\n headerId: '',\n};\n\n/**\n * Context used to guarantee correct aria-relationship between header\n * and group information\n */\nexport type MenuGroupContextValue = {\n /**\n * Element id applied to the `MenuGroupHeader` component\n */\n headerId: string;\n};\n\nexport const MenuGroupContextProvider = MenuGroupContext.Provider;\nexport const useMenuGroupContext_unstable = () => React.useContext(MenuGroupContext) ?? menuGroupContextDefaultValue;\n"]}
@@ -0,0 +1,24 @@
1
+ define(["require", "exports", "@fluentui/react-context-selector"], function (require, exports, react_context_selector_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useMenuListContext_unstable = exports.MenuListProvider = exports.MenuListContext = void 0;
5
+ exports.MenuListContext = react_context_selector_1.createContext(undefined);
6
+ var menuListContextDefaultValue = {
7
+ checkedValues: {},
8
+ onCheckedValueChange: function () { return null; },
9
+ setFocusByFirstCharacter: function () { return null; },
10
+ toggleCheckbox: function () { return null; },
11
+ selectRadio: function () { return null; },
12
+ hasIcons: false,
13
+ hasCheckmarks: false,
14
+ };
15
+ exports.MenuListProvider = exports.MenuListContext.Provider;
16
+ var useMenuListContext_unstable = function (selector) {
17
+ return react_context_selector_1.useContextSelector(exports.MenuListContext, function (ctx) {
18
+ if (ctx === void 0) { ctx = menuListContextDefaultValue; }
19
+ return selector(ctx);
20
+ });
21
+ };
22
+ exports.useMenuListContext_unstable = useMenuListContext_unstable;
23
+ });
24
+ //# sourceMappingURL=menuListContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menuListContext.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/contexts/menuListContext.tsx"],"names":[],"mappings":";;;;IAMa,QAAA,eAAe,GAAkC,sCAAa,CACzE,SAAS,CACuB,CAAC;IAEnC,IAAM,2BAA2B,GAAyB;QACxD,aAAa,EAAE,EAAE;QACjB,oBAAoB,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QAChC,wBAAwB,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QACpC,cAAc,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QAC1B,WAAW,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QACvB,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,KAAK;KACrB,CAAC;IAcW,QAAA,gBAAgB,GAAG,uBAAe,CAAC,QAAQ,CAAC;IAElD,IAAM,2BAA2B,GAAG,UAAK,QAAkD;QAChG,OAAA,2CAAkB,CAAC,uBAAe,EAAE,UAAC,GAAiC;YAAjC,oBAAA,EAAA,iCAAiC;YAAK,OAAA,QAAQ,CAAC,GAAG,CAAC;QAAb,CAAa,CAAC;IAAzF,CAAyF,CAAC;IAD/E,QAAA,2BAA2B,+BACoD","sourcesContent":["import * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { SelectableHandler } from '../selectable/index';\nimport type { MenuListProps } from '../components/index';\n\nexport const MenuListContext: Context<MenuListContextValue> = createContext<MenuListContextValue | undefined>(\n undefined,\n) as Context<MenuListContextValue>;\n\nconst menuListContextDefaultValue: MenuListContextValue = {\n checkedValues: {},\n onCheckedValueChange: () => null,\n setFocusByFirstCharacter: () => null,\n toggleCheckbox: () => null,\n selectRadio: () => null,\n hasIcons: false,\n hasCheckmarks: false,\n};\n\n/**\n * Context shared between MenuList and its children components\n */\nexport type MenuListContextValue = Pick<\n MenuListProps,\n 'checkedValues' | 'onCheckedValueChange' | 'hasIcons' | 'hasCheckmarks'\n> & {\n setFocusByFirstCharacter?: (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;\n toggleCheckbox?: SelectableHandler;\n selectRadio?: SelectableHandler;\n};\n\nexport const MenuListProvider = MenuListContext.Provider;\n\nexport const useMenuListContext_unstable = <T,>(selector: ContextSelector<MenuListContextValue, T>) =>\n useContextSelector(MenuListContext, (ctx = menuListContextDefaultValue) => selector(ctx));\n"]}
@@ -0,0 +1,14 @@
1
+ define(["require", "exports", "react"], function (require, exports, React) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useMenuTriggerContext_unstable = exports.MenuTriggerContextProvider = void 0;
5
+ /**
6
+ * Context used communicate with a child menu item that it is a trigger for a submenu
7
+ */
8
+ var MenuTriggerContext = React.createContext(undefined);
9
+ var menuTriggerContextDefaultValue = false;
10
+ exports.MenuTriggerContextProvider = MenuTriggerContext.Provider;
11
+ var useMenuTriggerContext_unstable = function () { var _a; return (_a = React.useContext(MenuTriggerContext)) !== null && _a !== void 0 ? _a : menuTriggerContextDefaultValue; };
12
+ exports.useMenuTriggerContext_unstable = useMenuTriggerContext_unstable;
13
+ });
14
+ //# sourceMappingURL=menuTriggerContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menuTriggerContext.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/contexts/menuTriggerContext.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACH,IAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAsB,SAAS,CAA2B,CAAC;IAEzG,IAAM,8BAA8B,GAAG,KAAK,CAAC;IAEhC,QAAA,0BAA0B,GAAG,kBAAkB,CAAC,QAAQ,CAAC;IAC/D,IAAM,8BAA8B,GAAG,sBAC5C,OAAA,MAAA,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,mCAAI,8BAA8B,CAAA,EAAA,CAAC;IAD5D,QAAA,8BAA8B,kCAC8B","sourcesContent":["import * as React from 'react';\n\n/**\n * Context used communicate with a child menu item that it is a trigger for a submenu\n */\nconst MenuTriggerContext = React.createContext<boolean | undefined>(undefined) as React.Context<boolean>;\n\nconst menuTriggerContextDefaultValue = false;\n\nexport const MenuTriggerContextProvider = MenuTriggerContext.Provider;\nexport const useMenuTriggerContext_unstable = () =>\n React.useContext(MenuTriggerContext) ?? menuTriggerContextDefaultValue;\n"]}
@@ -0,0 +1,69 @@
1
+ define(["require", "exports", "./contexts/menuContext", "./contexts/menuTriggerContext", "./contexts/menuGroupContext", "./contexts/menuListContext", "./Menu", "./MenuDivider", "./MenuGroup", "./MenuGroupHeader", "./MenuItem", "./MenuItemCheckbox", "./MenuItemRadio", "./MenuList", "./MenuPopover", "./MenuSplitGroup", "./MenuTrigger", "./selectable/index"], function (require, exports, menuContext_1, menuTriggerContext_1, menuGroupContext_1, menuListContext_1, Menu_1, MenuDivider_1, MenuGroup_1, MenuGroupHeader_1, MenuItem_1, MenuItemCheckbox_1, MenuItemRadio_1, MenuList_1, MenuPopover_1, MenuSplitGroup_1, MenuTrigger_1, index_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useCheckmarkStyles_unstable = exports.useMenuTrigger_unstable = exports.renderMenuTrigger_unstable = exports.MenuTrigger = exports.useMenuSplitGroup_unstable = exports.useMenuSplitGroupStyles_unstable = exports.renderMenuSplitGroup_unstable = exports.menuSplitGroupClassNames = exports.MenuSplitGroup = exports.useMenuPopover_unstable = exports.useMenuPopoverStyles_unstable = exports.renderMenuPopover_unstable = exports.menuPopoverClassNames = exports.MenuPopover = exports.useMenuList_unstable = exports.useMenuListStyles_unstable = exports.useMenuListContextValues_unstable = exports.renderMenuList_unstable = exports.menuListClassNames = exports.MenuList = exports.useMenuItemRadio_unstable = exports.useMenuItemRadioStyles_unstable = exports.renderMenuItemRadio_unstable = exports.menuItemRadioClassNames = exports.MenuItemRadio = exports.useMenuItemCheckbox_unstable = exports.useMenuItemCheckboxStyles_unstable = exports.renderMenuItemCheckbox_unstable = exports.menuItemCheckboxClassNames = exports.MenuItemCheckbox = exports.useMenuItem_unstable = exports.useMenuItemStyles_unstable = exports.renderMenuItem_unstable = exports.menuItemClassNames = exports.MenuItem = exports.useMenuGroupHeader_unstable = exports.useMenuGroupHeaderStyles_unstable = exports.renderMenuGroupHeader_unstable = exports.menuGroupHeaderClassNames = exports.MenuGroupHeader = exports.useMenuGroup_unstable = exports.useMenuGroupStyles_unstable = exports.useMenuGroupContextValues_unstable = exports.renderMenuGroup_unstable = exports.menuGroupClassNames = exports.MenuGroup = exports.useMenuDivider_unstable = exports.useMenuDividerStyles_unstable = exports.renderMenuDivider_unstable = exports.menuDividerClassNames = exports.MenuDivider = exports.useMenu_unstable = exports.useMenuContextValues_unstable = exports.renderMenu_unstable = exports.Menu = exports.useMenuListContext_unstable = exports.MenuListProvider = exports.useMenuGroupContext_unstable = exports.MenuGroupContextProvider = exports.useMenuTriggerContext_unstable = exports.MenuTriggerContextProvider = exports.useMenuContext_unstable = exports.MenuProvider = void 0;
5
+ Object.defineProperty(exports, "MenuProvider", { enumerable: true, get: function () { return menuContext_1.MenuProvider; } });
6
+ Object.defineProperty(exports, "useMenuContext_unstable", { enumerable: true, get: function () { return menuContext_1.useMenuContext_unstable; } });
7
+ Object.defineProperty(exports, "MenuTriggerContextProvider", { enumerable: true, get: function () { return menuTriggerContext_1.MenuTriggerContextProvider; } });
8
+ Object.defineProperty(exports, "useMenuTriggerContext_unstable", { enumerable: true, get: function () { return menuTriggerContext_1.useMenuTriggerContext_unstable; } });
9
+ Object.defineProperty(exports, "MenuGroupContextProvider", { enumerable: true, get: function () { return menuGroupContext_1.MenuGroupContextProvider; } });
10
+ Object.defineProperty(exports, "useMenuGroupContext_unstable", { enumerable: true, get: function () { return menuGroupContext_1.useMenuGroupContext_unstable; } });
11
+ Object.defineProperty(exports, "MenuListProvider", { enumerable: true, get: function () { return menuListContext_1.MenuListProvider; } });
12
+ Object.defineProperty(exports, "useMenuListContext_unstable", { enumerable: true, get: function () { return menuListContext_1.useMenuListContext_unstable; } });
13
+ Object.defineProperty(exports, "Menu", { enumerable: true, get: function () { return Menu_1.Menu; } });
14
+ Object.defineProperty(exports, "renderMenu_unstable", { enumerable: true, get: function () { return Menu_1.renderMenu_unstable; } });
15
+ Object.defineProperty(exports, "useMenuContextValues_unstable", { enumerable: true, get: function () { return Menu_1.useMenuContextValues_unstable; } });
16
+ Object.defineProperty(exports, "useMenu_unstable", { enumerable: true, get: function () { return Menu_1.useMenu_unstable; } });
17
+ Object.defineProperty(exports, "MenuDivider", { enumerable: true, get: function () { return MenuDivider_1.MenuDivider; } });
18
+ Object.defineProperty(exports, "menuDividerClassNames", { enumerable: true, get: function () { return MenuDivider_1.menuDividerClassNames; } });
19
+ Object.defineProperty(exports, "renderMenuDivider_unstable", { enumerable: true, get: function () { return MenuDivider_1.renderMenuDivider_unstable; } });
20
+ Object.defineProperty(exports, "useMenuDividerStyles_unstable", { enumerable: true, get: function () { return MenuDivider_1.useMenuDividerStyles_unstable; } });
21
+ Object.defineProperty(exports, "useMenuDivider_unstable", { enumerable: true, get: function () { return MenuDivider_1.useMenuDivider_unstable; } });
22
+ Object.defineProperty(exports, "MenuGroup", { enumerable: true, get: function () { return MenuGroup_1.MenuGroup; } });
23
+ Object.defineProperty(exports, "menuGroupClassNames", { enumerable: true, get: function () { return MenuGroup_1.menuGroupClassNames; } });
24
+ Object.defineProperty(exports, "renderMenuGroup_unstable", { enumerable: true, get: function () { return MenuGroup_1.renderMenuGroup_unstable; } });
25
+ Object.defineProperty(exports, "useMenuGroupContextValues_unstable", { enumerable: true, get: function () { return MenuGroup_1.useMenuGroupContextValues_unstable; } });
26
+ Object.defineProperty(exports, "useMenuGroupStyles_unstable", { enumerable: true, get: function () { return MenuGroup_1.useMenuGroupStyles_unstable; } });
27
+ Object.defineProperty(exports, "useMenuGroup_unstable", { enumerable: true, get: function () { return MenuGroup_1.useMenuGroup_unstable; } });
28
+ Object.defineProperty(exports, "MenuGroupHeader", { enumerable: true, get: function () { return MenuGroupHeader_1.MenuGroupHeader; } });
29
+ Object.defineProperty(exports, "menuGroupHeaderClassNames", { enumerable: true, get: function () { return MenuGroupHeader_1.menuGroupHeaderClassNames; } });
30
+ Object.defineProperty(exports, "renderMenuGroupHeader_unstable", { enumerable: true, get: function () { return MenuGroupHeader_1.renderMenuGroupHeader_unstable; } });
31
+ Object.defineProperty(exports, "useMenuGroupHeaderStyles_unstable", { enumerable: true, get: function () { return MenuGroupHeader_1.useMenuGroupHeaderStyles_unstable; } });
32
+ Object.defineProperty(exports, "useMenuGroupHeader_unstable", { enumerable: true, get: function () { return MenuGroupHeader_1.useMenuGroupHeader_unstable; } });
33
+ Object.defineProperty(exports, "MenuItem", { enumerable: true, get: function () { return MenuItem_1.MenuItem; } });
34
+ Object.defineProperty(exports, "menuItemClassNames", { enumerable: true, get: function () { return MenuItem_1.menuItemClassNames; } });
35
+ Object.defineProperty(exports, "renderMenuItem_unstable", { enumerable: true, get: function () { return MenuItem_1.renderMenuItem_unstable; } });
36
+ Object.defineProperty(exports, "useMenuItemStyles_unstable", { enumerable: true, get: function () { return MenuItem_1.useMenuItemStyles_unstable; } });
37
+ Object.defineProperty(exports, "useMenuItem_unstable", { enumerable: true, get: function () { return MenuItem_1.useMenuItem_unstable; } });
38
+ Object.defineProperty(exports, "MenuItemCheckbox", { enumerable: true, get: function () { return MenuItemCheckbox_1.MenuItemCheckbox; } });
39
+ Object.defineProperty(exports, "menuItemCheckboxClassNames", { enumerable: true, get: function () { return MenuItemCheckbox_1.menuItemCheckboxClassNames; } });
40
+ Object.defineProperty(exports, "renderMenuItemCheckbox_unstable", { enumerable: true, get: function () { return MenuItemCheckbox_1.renderMenuItemCheckbox_unstable; } });
41
+ Object.defineProperty(exports, "useMenuItemCheckboxStyles_unstable", { enumerable: true, get: function () { return MenuItemCheckbox_1.useMenuItemCheckboxStyles_unstable; } });
42
+ Object.defineProperty(exports, "useMenuItemCheckbox_unstable", { enumerable: true, get: function () { return MenuItemCheckbox_1.useMenuItemCheckbox_unstable; } });
43
+ Object.defineProperty(exports, "MenuItemRadio", { enumerable: true, get: function () { return MenuItemRadio_1.MenuItemRadio; } });
44
+ Object.defineProperty(exports, "menuItemRadioClassNames", { enumerable: true, get: function () { return MenuItemRadio_1.menuItemRadioClassNames; } });
45
+ Object.defineProperty(exports, "renderMenuItemRadio_unstable", { enumerable: true, get: function () { return MenuItemRadio_1.renderMenuItemRadio_unstable; } });
46
+ Object.defineProperty(exports, "useMenuItemRadioStyles_unstable", { enumerable: true, get: function () { return MenuItemRadio_1.useMenuItemRadioStyles_unstable; } });
47
+ Object.defineProperty(exports, "useMenuItemRadio_unstable", { enumerable: true, get: function () { return MenuItemRadio_1.useMenuItemRadio_unstable; } });
48
+ Object.defineProperty(exports, "MenuList", { enumerable: true, get: function () { return MenuList_1.MenuList; } });
49
+ Object.defineProperty(exports, "menuListClassNames", { enumerable: true, get: function () { return MenuList_1.menuListClassNames; } });
50
+ Object.defineProperty(exports, "renderMenuList_unstable", { enumerable: true, get: function () { return MenuList_1.renderMenuList_unstable; } });
51
+ Object.defineProperty(exports, "useMenuListContextValues_unstable", { enumerable: true, get: function () { return MenuList_1.useMenuListContextValues_unstable; } });
52
+ Object.defineProperty(exports, "useMenuListStyles_unstable", { enumerable: true, get: function () { return MenuList_1.useMenuListStyles_unstable; } });
53
+ Object.defineProperty(exports, "useMenuList_unstable", { enumerable: true, get: function () { return MenuList_1.useMenuList_unstable; } });
54
+ Object.defineProperty(exports, "MenuPopover", { enumerable: true, get: function () { return MenuPopover_1.MenuPopover; } });
55
+ Object.defineProperty(exports, "menuPopoverClassNames", { enumerable: true, get: function () { return MenuPopover_1.menuPopoverClassNames; } });
56
+ Object.defineProperty(exports, "renderMenuPopover_unstable", { enumerable: true, get: function () { return MenuPopover_1.renderMenuPopover_unstable; } });
57
+ Object.defineProperty(exports, "useMenuPopoverStyles_unstable", { enumerable: true, get: function () { return MenuPopover_1.useMenuPopoverStyles_unstable; } });
58
+ Object.defineProperty(exports, "useMenuPopover_unstable", { enumerable: true, get: function () { return MenuPopover_1.useMenuPopover_unstable; } });
59
+ Object.defineProperty(exports, "MenuSplitGroup", { enumerable: true, get: function () { return MenuSplitGroup_1.MenuSplitGroup; } });
60
+ Object.defineProperty(exports, "menuSplitGroupClassNames", { enumerable: true, get: function () { return MenuSplitGroup_1.menuSplitGroupClassNames; } });
61
+ Object.defineProperty(exports, "renderMenuSplitGroup_unstable", { enumerable: true, get: function () { return MenuSplitGroup_1.renderMenuSplitGroup_unstable; } });
62
+ Object.defineProperty(exports, "useMenuSplitGroupStyles_unstable", { enumerable: true, get: function () { return MenuSplitGroup_1.useMenuSplitGroupStyles_unstable; } });
63
+ Object.defineProperty(exports, "useMenuSplitGroup_unstable", { enumerable: true, get: function () { return MenuSplitGroup_1.useMenuSplitGroup_unstable; } });
64
+ Object.defineProperty(exports, "MenuTrigger", { enumerable: true, get: function () { return MenuTrigger_1.MenuTrigger; } });
65
+ Object.defineProperty(exports, "renderMenuTrigger_unstable", { enumerable: true, get: function () { return MenuTrigger_1.renderMenuTrigger_unstable; } });
66
+ Object.defineProperty(exports, "useMenuTrigger_unstable", { enumerable: true, get: function () { return MenuTrigger_1.useMenuTrigger_unstable; } });
67
+ Object.defineProperty(exports, "useCheckmarkStyles_unstable", { enumerable: true, get: function () { return index_1.useCheckmarkStyles_unstable; } });
68
+ });
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/index.ts"],"names":[],"mappings":";;;;IAAS,2GAAA,YAAY,OAAA;IAAE,sHAAA,uBAAuB,OAAA;IAErC,gIAAA,0BAA0B,OAAA;IAAE,oIAAA,8BAA8B,OAAA;IAC1D,4HAAA,wBAAwB,OAAA;IAAE,gIAAA,4BAA4B,OAAA;IAEtD,mHAAA,gBAAgB,OAAA;IAAE,8HAAA,2BAA2B,OAAA;IAG7C,4FAAA,IAAI,OAAA;IAAE,2GAAA,mBAAmB,OAAA;IAAE,qHAA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;IACd,0HAAA,wBAAwB,OAAA;IACxB,+HAAA,6BAA6B,OAAA;IAC7B,kIAAA,gCAAgC,OAAA;IAChC,4HAAA,0BAA0B,OAAA;IAGnB,0GAAA,WAAW,OAAA;IAAE,yHAAA,0BAA0B,OAAA;IAAE,sHAAA,uBAAuB,OAAA;IAGhE,oHAAA,2BAA2B,OAAA","sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport type { MenuContextValue } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport type { MenuGroupContextValue } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport type { MenuListContextValue } from './contexts/menuListContext';\n\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport type {\n MenuContextValues,\n MenuOpenChangeData,\n MenuOpenEvent,\n // MenuOpenEvents is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n MenuOpenEvents,\n MenuProps,\n MenuSlots,\n MenuState,\n} from './Menu';\nexport {\n MenuDivider,\n menuDividerClassNames,\n renderMenuDivider_unstable,\n useMenuDividerStyles_unstable,\n useMenuDivider_unstable,\n} from './MenuDivider';\nexport type { MenuDividerProps, MenuDividerSlots, MenuDividerState } from './MenuDivider';\nexport {\n MenuGroup,\n menuGroupClassNames,\n renderMenuGroup_unstable,\n useMenuGroupContextValues_unstable,\n useMenuGroupStyles_unstable,\n useMenuGroup_unstable,\n} from './MenuGroup';\nexport type { MenuGroupContextValues, MenuGroupProps, MenuGroupSlots, MenuGroupState } from './MenuGroup';\nexport {\n MenuGroupHeader,\n menuGroupHeaderClassNames,\n renderMenuGroupHeader_unstable,\n useMenuGroupHeaderStyles_unstable,\n useMenuGroupHeader_unstable,\n} from './MenuGroupHeader';\nexport type { MenuGroupHeaderProps, MenuGroupHeaderSlots, MenuGroupHeaderState } from './MenuGroupHeader';\nexport {\n MenuItem,\n menuItemClassNames,\n renderMenuItem_unstable,\n useMenuItemStyles_unstable,\n useMenuItem_unstable,\n} from './MenuItem';\nexport type { MenuItemProps, MenuItemSlots, MenuItemState } from './MenuItem';\nexport {\n MenuItemCheckbox,\n menuItemCheckboxClassNames,\n renderMenuItemCheckbox_unstable,\n useMenuItemCheckboxStyles_unstable,\n useMenuItemCheckbox_unstable,\n} from './MenuItemCheckbox';\nexport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox';\nexport {\n MenuItemRadio,\n menuItemRadioClassNames,\n renderMenuItemRadio_unstable,\n useMenuItemRadioStyles_unstable,\n useMenuItemRadio_unstable,\n} from './MenuItemRadio';\nexport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio';\nexport {\n MenuList,\n menuListClassNames,\n renderMenuList_unstable,\n useMenuListContextValues_unstable,\n useMenuListStyles_unstable,\n useMenuList_unstable,\n} from './MenuList';\nexport type {\n MenuCheckedValueChangeData,\n MenuCheckedValueChangeEvent,\n MenuListContextValues,\n MenuListProps,\n MenuListSlots,\n MenuListState,\n UninitializedMenuListState,\n} from './MenuList';\nexport {\n MenuPopover,\n menuPopoverClassNames,\n renderMenuPopover_unstable,\n useMenuPopoverStyles_unstable,\n useMenuPopover_unstable,\n} from './MenuPopover';\nexport type { MenuPopoverProps, MenuPopoverSlots, MenuPopoverState } from './MenuPopover';\nexport {\n MenuSplitGroup,\n menuSplitGroupClassNames,\n renderMenuSplitGroup_unstable,\n useMenuSplitGroupStyles_unstable,\n useMenuSplitGroup_unstable,\n} from './MenuSplitGroup';\nexport type { MenuSplitGroupProps, MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport type { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './MenuTrigger';\n\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport type { MenuItemSelectableProps, MenuItemSelectableState, SelectableHandler } from './selectable/index';\n"]}
@@ -0,0 +1,7 @@
1
+ define(["require", "exports", "tslib", "./useCheckmarkStyles", "./types"], function (require, exports, tslib_1, useCheckmarkStyles_1, types_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(useCheckmarkStyles_1, exports);
5
+ tslib_1.__exportStar(types_1, exports);
6
+ });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/selectable/index.ts"],"names":[],"mappings":";;;IAAA,oDAAqC;IACrC,uCAAwB","sourcesContent":["export * from './useCheckmarkStyles';\nexport * from './types';\n"]}
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/selectable/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport type SelectableHandler = (\n e: React.MouseEvent | React.KeyboardEvent,\n name: string,\n value: string,\n checked: boolean,\n) => void;\n\n/**\n * Props for selecatble menu items\n */\nexport type MenuItemSelectableProps = {\n /**\n * Follows input convention\n * https://www.w3schools.com/jsref/prop_checkbox_name.asp\n */\n name: string;\n\n /**\n * Follows input convention\n * https://www.w3schools.com/jsref/prop_checkbox_value.asp\n */\n value: string;\n};\n\n/**\n * State for selectable menu items\n */\nexport type MenuItemSelectableState = MenuItemSelectableProps & {\n /**\n * Selectable is checked\n */\n checked: boolean;\n};\n"]}
@@ -0,0 +1,28 @@
1
+ define(["require", "exports", "@griffel/react"], function (require, exports, react_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useCheckmarkStyles_unstable = void 0;
5
+ var useStyles = react_1.makeStyles({
6
+ root: {
7
+ width: '16px',
8
+ height: '16px',
9
+ visibility: 'hidden',
10
+ },
11
+ rootChecked: {
12
+ visibility: 'visible',
13
+ },
14
+ });
15
+ /**
16
+ * Applies styles to a checkmark slot for selectable menu items
17
+ *
18
+ * @param state - should contain a `checkmark` slot
19
+ */
20
+ var useCheckmarkStyles_unstable = function (state) {
21
+ var styles = useStyles();
22
+ if (state.checkmark) {
23
+ state.checkmark.className = react_1.mergeClasses(styles.root, state.checked && styles.rootChecked, state.checkmark.className);
24
+ }
25
+ };
26
+ exports.useCheckmarkStyles_unstable = useCheckmarkStyles_unstable;
27
+ });
28
+ //# sourceMappingURL=useCheckmarkStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCheckmarkStyles.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/selectable/useCheckmarkStyles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,QAAQ;SACrB;QACD,WAAW,EAAE;YACX,UAAU,EAAE,SAAS;SACtB;KACF,CAAC,CAAC;IAEH;;;;OAIG;IACI,IAAM,2BAA2B,GAAG,UAAC,KAAiE;QAC3G,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,SAAS,EAAE;YACnB,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,oBAAY,CACtC,MAAM,CAAC,IAAI,EACX,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,WAAW,EACnC,KAAK,CAAC,SAAS,CAAC,SAAS,CAC1B,CAAC;SACH;IACH,CAAC,CAAC;IATW,QAAA,2BAA2B,+BAStC","sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nimport type { MenuItemSelectableState } from './types';\nimport type { MenuItemState } from '../components/MenuItem/MenuItem.types';\n\nconst useStyles = makeStyles({\n root: {\n width: '16px',\n height: '16px',\n visibility: 'hidden',\n },\n rootChecked: {\n visibility: 'visible',\n },\n});\n\n/**\n * Applies styles to a checkmark slot for selectable menu items\n *\n * @param state - should contain a `checkmark` slot\n */\nexport const useCheckmarkStyles_unstable = (state: MenuItemSelectableState & Pick<MenuItemState, 'checkmark'>) => {\n const styles = useStyles();\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(\n styles.root,\n state.checked && styles.rootChecked,\n state.checkmark.className,\n );\n }\n};\n"]}
@@ -0,0 +1,6 @@
1
+ define(["require", "exports", "tslib", "./useOnMenuEnter"], function (require, exports, tslib_1, useOnMenuEnter_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(useOnMenuEnter_1, exports);
5
+ });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/utils/index.ts"],"names":[],"mappings":";;;IAAA,gDAAiC","sourcesContent":["export * from './useOnMenuEnter';\n"]}
@@ -0,0 +1,20 @@
1
+ define(["require", "exports", "@fluentui/react-context-selector", "../contexts/menuContext", "../contexts/menuListContext"], function (require, exports, react_context_selector_1, menuContext_1, menuListContext_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useIsSubmenu = void 0;
5
+ /**
6
+ * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true
7
+ * or whether it is a part of a `MenuList`
8
+ *
9
+ * A simple hook to check box contexts easily
10
+ *
11
+ * @returns whether the component is part of a submenu
12
+ */
13
+ function useIsSubmenu() {
14
+ var menuContextValue = menuContext_1.useMenuContext_unstable(function (context) { return context.isSubmenu; });
15
+ var hasMenuListContext = react_context_selector_1.useHasParentContext(menuListContext_1.MenuListContext);
16
+ return menuContextValue || hasMenuListContext;
17
+ }
18
+ exports.useIsSubmenu = useIsSubmenu;
19
+ });
20
+ //# sourceMappingURL=useIsSubmenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsSubmenu.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-menu/src/utils/useIsSubmenu.ts"],"names":[],"mappings":";;;;IAIA;;;;;;;OAOG;IACH,SAAgB,YAAY;QAC1B,IAAM,gBAAgB,GAAG,qCAAuB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,SAAS,EAAjB,CAAiB,CAAC,CAAC;QAC/E,IAAM,kBAAkB,GAAG,4CAAmB,CAAC,iCAAe,CAAC,CAAC;QAEhE,OAAO,gBAAgB,IAAI,kBAAkB,CAAC;IAChD,CAAC;IALD,oCAKC","sourcesContent":["import { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../contexts/menuContext';\nimport { MenuListContext } from '../contexts/menuListContext';\n\n/**\n * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true\n * or whether it is a part of a `MenuList`\n *\n * A simple hook to check box contexts easily\n *\n * @returns whether the component is part of a submenu\n */\nexport function useIsSubmenu() {\n const menuContextValue = useMenuContext_unstable(context => context.isSubmenu);\n const hasMenuListContext = useHasParentContext(MenuListContext);\n\n return menuContextValue || hasMenuListContext;\n}\n"]}