@fluentui/react-menu 9.0.0-rc.6 → 9.0.0-rc.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. package/CHANGELOG.json +170 -9
  2. package/CHANGELOG.md +184 -139
  3. package/dist/{react-menu.d.ts → index.d.ts} +0 -0
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/index.js +25 -16
  6. package/lib/index.js.map +1 -1
  7. package/lib-commonjs/index.js +486 -17
  8. package/lib-commonjs/index.js.map +1 -1
  9. package/package.json +13 -13
  10. package/lib/Menu.d.ts +0 -1
  11. package/lib/MenuDivider.d.ts +0 -1
  12. package/lib/MenuGroup.d.ts +0 -1
  13. package/lib/MenuGroupHeader.d.ts +0 -1
  14. package/lib/MenuItem.d.ts +0 -1
  15. package/lib/MenuItemCheckbox.d.ts +0 -1
  16. package/lib/MenuItemRadio.d.ts +0 -1
  17. package/lib/MenuList.d.ts +0 -1
  18. package/lib/MenuPopover.d.ts +0 -1
  19. package/lib/MenuSplitGroup.d.ts +0 -1
  20. package/lib/MenuTrigger.d.ts +0 -1
  21. package/lib/components/Menu/Menu.d.ts +0 -6
  22. package/lib/components/Menu/Menu.types.d.ts +0 -113
  23. package/lib/components/Menu/index.d.ts +0 -5
  24. package/lib/components/Menu/renderMenu.d.ts +0 -5
  25. package/lib/components/Menu/useMenu.d.ts +0 -10
  26. package/lib/components/Menu/useMenuContextValues.d.ts +0 -2
  27. package/lib/components/MenuDivider/MenuDivider.d.ts +0 -6
  28. package/lib/components/MenuDivider/MenuDivider.types.d.ts +0 -6
  29. package/lib/components/MenuDivider/index.d.ts +0 -5
  30. package/lib/components/MenuDivider/renderMenuDivider.d.ts +0 -6
  31. package/lib/components/MenuDivider/useMenuDivider.d.ts +0 -6
  32. package/lib/components/MenuDivider/useMenuDividerStyles.d.ts +0 -8
  33. package/lib/components/MenuGroup/MenuGroup.d.ts +0 -6
  34. package/lib/components/MenuGroup/MenuGroup.types.d.ts +0 -15
  35. package/lib/components/MenuGroup/index.d.ts +0 -6
  36. package/lib/components/MenuGroup/renderMenuGroup.d.ts +0 -6
  37. package/lib/components/MenuGroup/useMenuGroup.d.ts +0 -6
  38. package/lib/components/MenuGroup/useMenuGroupContextValues.d.ts +0 -2
  39. package/lib/components/MenuGroup/useMenuGroupStyles.d.ts +0 -8
  40. package/lib/components/MenuGroupHeader/MenuGroupHeader.d.ts +0 -6
  41. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +0 -6
  42. package/lib/components/MenuGroupHeader/index.d.ts +0 -5
  43. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +0 -6
  44. package/lib/components/MenuGroupHeader/useMenuGroupHeader.d.ts +0 -6
  45. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +0 -8
  46. package/lib/components/MenuItem/MenuItem.d.ts +0 -6
  47. package/lib/components/MenuItem/MenuItem.types.d.ts +0 -43
  48. package/lib/components/MenuItem/index.d.ts +0 -5
  49. package/lib/components/MenuItem/renderMenuItem.d.ts +0 -5
  50. package/lib/components/MenuItem/useCharacterSearch.d.ts +0 -3
  51. package/lib/components/MenuItem/useMenuItem.d.ts +0 -6
  52. package/lib/components/MenuItem/useMenuItemStyles.d.ts +0 -9
  53. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +0 -6
  54. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.d.ts +0 -4
  55. package/lib/components/MenuItemCheckbox/index.d.ts +0 -5
  56. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.d.ts +0 -3
  57. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +0 -4
  58. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +0 -9
  59. package/lib/components/MenuItemRadio/MenuItemRadio.d.ts +0 -6
  60. package/lib/components/MenuItemRadio/MenuItemRadio.types.d.ts +0 -4
  61. package/lib/components/MenuItemRadio/index.d.ts +0 -5
  62. package/lib/components/MenuItemRadio/renderMenuItemRadio.d.ts +0 -6
  63. package/lib/components/MenuItemRadio/useMenuItemRadio.d.ts +0 -6
  64. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +0 -9
  65. package/lib/components/MenuList/MenuList.d.ts +0 -6
  66. package/lib/components/MenuList/MenuList.types.d.ts +0 -55
  67. package/lib/components/MenuList/index.d.ts +0 -6
  68. package/lib/components/MenuList/renderMenuList.d.ts +0 -5
  69. package/lib/components/MenuList/useMenuList.d.ts +0 -6
  70. package/lib/components/MenuList/useMenuListContextValues.d.ts +0 -2
  71. package/lib/components/MenuList/useMenuListStyles.d.ts +0 -11
  72. package/lib/components/MenuPopover/MenuPopover.d.ts +0 -6
  73. package/lib/components/MenuPopover/MenuPopover.types.d.ts +0 -18
  74. package/lib/components/MenuPopover/index.d.ts +0 -5
  75. package/lib/components/MenuPopover/renderMenuPopover.d.ts +0 -5
  76. package/lib/components/MenuPopover/useMenuPopover.d.ts +0 -12
  77. package/lib/components/MenuPopover/useMenuPopoverStyles.d.ts +0 -11
  78. package/lib/components/MenuSplitGroup/MenuSplitGroup.d.ts +0 -6
  79. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +0 -14
  80. package/lib/components/MenuSplitGroup/index.d.ts +0 -5
  81. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +0 -5
  82. package/lib/components/MenuSplitGroup/useMenuSplitGroup.d.ts +0 -12
  83. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +0 -11
  84. package/lib/components/MenuTrigger/MenuTrigger.d.ts +0 -8
  85. package/lib/components/MenuTrigger/MenuTrigger.types.d.ts +0 -20
  86. package/lib/components/MenuTrigger/index.d.ts +0 -4
  87. package/lib/components/MenuTrigger/renderMenuTrigger.d.ts +0 -7
  88. package/lib/components/MenuTrigger/useMenuTrigger.d.ts +0 -8
  89. package/lib/components/index.d.ts +0 -2
  90. package/lib/contexts/menuContext.d.ts +0 -16
  91. package/lib/contexts/menuGroupContext.d.ts +0 -13
  92. package/lib/contexts/menuListContext.d.ts +0 -15
  93. package/lib/contexts/menuTriggerContext.d.ts +0 -3
  94. package/lib/index.d.ts +0 -16
  95. package/lib/selectable/index.d.ts +0 -2
  96. package/lib/selectable/types.d.ts +0 -34
  97. package/lib/selectable/useCheckmarkStyles.d.ts +0 -8
  98. package/lib/utils/index.d.ts +0 -1
  99. package/lib/utils/useIsSubmenu.d.ts +0 -9
  100. package/lib/utils/useOnMenuEnter.d.ts +0 -23
  101. package/lib-commonjs/Menu.d.ts +0 -1
  102. package/lib-commonjs/MenuDivider.d.ts +0 -1
  103. package/lib-commonjs/MenuGroup.d.ts +0 -1
  104. package/lib-commonjs/MenuGroupHeader.d.ts +0 -1
  105. package/lib-commonjs/MenuItem.d.ts +0 -1
  106. package/lib-commonjs/MenuItemCheckbox.d.ts +0 -1
  107. package/lib-commonjs/MenuItemRadio.d.ts +0 -1
  108. package/lib-commonjs/MenuList.d.ts +0 -1
  109. package/lib-commonjs/MenuPopover.d.ts +0 -1
  110. package/lib-commonjs/MenuSplitGroup.d.ts +0 -1
  111. package/lib-commonjs/MenuTrigger.d.ts +0 -1
  112. package/lib-commonjs/components/Menu/Menu.d.ts +0 -6
  113. package/lib-commonjs/components/Menu/Menu.types.d.ts +0 -113
  114. package/lib-commonjs/components/Menu/index.d.ts +0 -5
  115. package/lib-commonjs/components/Menu/renderMenu.d.ts +0 -5
  116. package/lib-commonjs/components/Menu/useMenu.d.ts +0 -10
  117. package/lib-commonjs/components/Menu/useMenuContextValues.d.ts +0 -2
  118. package/lib-commonjs/components/MenuDivider/MenuDivider.d.ts +0 -6
  119. package/lib-commonjs/components/MenuDivider/MenuDivider.types.d.ts +0 -6
  120. package/lib-commonjs/components/MenuDivider/index.d.ts +0 -5
  121. package/lib-commonjs/components/MenuDivider/renderMenuDivider.d.ts +0 -6
  122. package/lib-commonjs/components/MenuDivider/useMenuDivider.d.ts +0 -6
  123. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.d.ts +0 -8
  124. package/lib-commonjs/components/MenuGroup/MenuGroup.d.ts +0 -6
  125. package/lib-commonjs/components/MenuGroup/MenuGroup.types.d.ts +0 -15
  126. package/lib-commonjs/components/MenuGroup/index.d.ts +0 -6
  127. package/lib-commonjs/components/MenuGroup/renderMenuGroup.d.ts +0 -6
  128. package/lib-commonjs/components/MenuGroup/useMenuGroup.d.ts +0 -6
  129. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.d.ts +0 -2
  130. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.d.ts +0 -8
  131. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.d.ts +0 -6
  132. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +0 -6
  133. package/lib-commonjs/components/MenuGroupHeader/index.d.ts +0 -5
  134. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +0 -6
  135. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.d.ts +0 -6
  136. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +0 -8
  137. package/lib-commonjs/components/MenuItem/MenuItem.d.ts +0 -6
  138. package/lib-commonjs/components/MenuItem/MenuItem.types.d.ts +0 -43
  139. package/lib-commonjs/components/MenuItem/index.d.ts +0 -5
  140. package/lib-commonjs/components/MenuItem/renderMenuItem.d.ts +0 -5
  141. package/lib-commonjs/components/MenuItem/useCharacterSearch.d.ts +0 -3
  142. package/lib-commonjs/components/MenuItem/useMenuItem.d.ts +0 -6
  143. package/lib-commonjs/components/MenuItem/useMenuItemStyles.d.ts +0 -9
  144. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +0 -6
  145. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.d.ts +0 -4
  146. package/lib-commonjs/components/MenuItemCheckbox/index.d.ts +0 -5
  147. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.d.ts +0 -3
  148. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +0 -4
  149. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +0 -9
  150. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.d.ts +0 -6
  151. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.d.ts +0 -4
  152. package/lib-commonjs/components/MenuItemRadio/index.d.ts +0 -5
  153. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.d.ts +0 -6
  154. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.d.ts +0 -6
  155. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +0 -9
  156. package/lib-commonjs/components/MenuList/MenuList.d.ts +0 -6
  157. package/lib-commonjs/components/MenuList/MenuList.types.d.ts +0 -55
  158. package/lib-commonjs/components/MenuList/index.d.ts +0 -6
  159. package/lib-commonjs/components/MenuList/renderMenuList.d.ts +0 -5
  160. package/lib-commonjs/components/MenuList/useMenuList.d.ts +0 -6
  161. package/lib-commonjs/components/MenuList/useMenuListContextValues.d.ts +0 -2
  162. package/lib-commonjs/components/MenuList/useMenuListStyles.d.ts +0 -11
  163. package/lib-commonjs/components/MenuPopover/MenuPopover.d.ts +0 -6
  164. package/lib-commonjs/components/MenuPopover/MenuPopover.types.d.ts +0 -18
  165. package/lib-commonjs/components/MenuPopover/index.d.ts +0 -5
  166. package/lib-commonjs/components/MenuPopover/renderMenuPopover.d.ts +0 -5
  167. package/lib-commonjs/components/MenuPopover/useMenuPopover.d.ts +0 -12
  168. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.d.ts +0 -11
  169. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.d.ts +0 -6
  170. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +0 -14
  171. package/lib-commonjs/components/MenuSplitGroup/index.d.ts +0 -5
  172. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +0 -5
  173. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.d.ts +0 -12
  174. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +0 -11
  175. package/lib-commonjs/components/MenuTrigger/MenuTrigger.d.ts +0 -8
  176. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.d.ts +0 -20
  177. package/lib-commonjs/components/MenuTrigger/index.d.ts +0 -4
  178. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.d.ts +0 -7
  179. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.d.ts +0 -8
  180. package/lib-commonjs/components/index.d.ts +0 -2
  181. package/lib-commonjs/contexts/menuContext.d.ts +0 -16
  182. package/lib-commonjs/contexts/menuGroupContext.d.ts +0 -13
  183. package/lib-commonjs/contexts/menuListContext.d.ts +0 -15
  184. package/lib-commonjs/contexts/menuTriggerContext.d.ts +0 -3
  185. package/lib-commonjs/index.d.ts +0 -16
  186. package/lib-commonjs/selectable/index.d.ts +0 -2
  187. package/lib-commonjs/selectable/types.d.ts +0 -34
  188. package/lib-commonjs/selectable/useCheckmarkStyles.d.ts +0 -8
  189. package/lib-commonjs/utils/index.d.ts +0 -1
  190. package/lib-commonjs/utils/useIsSubmenu.d.ts +0 -9
  191. package/lib-commonjs/utils/useOnMenuEnter.d.ts +0 -23
@@ -1,7 +0,0 @@
1
- import type { MenuTriggerState } from './MenuTrigger.types';
2
- /**
3
- * Render the final JSX of MenuTrigger
4
- *
5
- * Only renders children
6
- */
7
- export declare const renderMenuTrigger_unstable: (state: MenuTriggerState) => JSX.Element;
@@ -1,8 +0,0 @@
1
- import { MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';
2
- /**
3
- * Create the state required to render MenuTrigger.
4
- * Clones the only child component and adds necessary event handling behaviours to open a popup menu
5
- *
6
- * @param props - props from this instance of MenuTrigger
7
- */
8
- export declare const useMenuTrigger_unstable: (props: MenuTriggerProps) => MenuTriggerState;
@@ -1,2 +0,0 @@
1
- export * from './MenuItem/index';
2
- export * from './MenuList/index';
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
- import type { ContextSelector, Context } from '@fluentui/react-context-selector';
3
- import type { MenuListProps } from '../components/index';
4
- import type { MenuState } from '../components/Menu/index';
5
- export declare const MenuContext: Context<MenuContextValue>;
6
- /**
7
- * Context shared between Menu and its children components
8
- *
9
- * Extends and drills down MenuList props to simplify API
10
- */
11
- export declare type MenuContextValue = MenuListProps & Pick<MenuState, 'openOnHover' | 'openOnContext' | 'triggerRef' | 'menuPopoverRef' | 'setOpen' | 'isSubmenu' | 'triggerId' | 'hasIcons' | 'hasCheckmarks' | 'persistOnItemClick' | 'inline'> & {
12
- open: boolean;
13
- triggerId: string;
14
- };
15
- export declare const MenuProvider: React.Provider<MenuContextValue> & React.FC<React.ProviderProps<MenuContextValue>>;
16
- export declare const useMenuContext_unstable: <T>(selector: ContextSelector<MenuContextValue, T>) => T;
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- /**
3
- * Context used to guarantee correct aria-relationship between header
4
- * and group information
5
- */
6
- export declare type MenuGroupContextValue = {
7
- /**
8
- * Element id applied to the `MenuGroupHeader` component
9
- */
10
- headerId: string;
11
- };
12
- export declare const MenuGroupContextProvider: React.Provider<MenuGroupContextValue>;
13
- export declare const useMenuGroupContext_unstable: () => MenuGroupContextValue;
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import type { ContextSelector, Context } from '@fluentui/react-context-selector';
3
- import type { SelectableHandler } from '../selectable/index';
4
- import type { MenuListProps } from '../components/index';
5
- export declare const MenuListContext: Context<MenuListContextValue>;
6
- /**
7
- * Context shared between MenuList and its children components
8
- */
9
- export declare type MenuListContextValue = Pick<MenuListProps, 'checkedValues' | 'onCheckedValueChange' | 'hasIcons' | 'hasCheckmarks'> & {
10
- setFocusByFirstCharacter?: (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;
11
- toggleCheckbox?: SelectableHandler;
12
- selectRadio?: SelectableHandler;
13
- };
14
- export declare const MenuListProvider: React.Provider<MenuListContextValue> & React.FC<React.ProviderProps<MenuListContextValue>>;
15
- export declare const useMenuListContext_unstable: <T>(selector: ContextSelector<MenuListContextValue, T>) => T;
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- export declare const MenuTriggerContextProvider: React.Provider<boolean>;
3
- export declare const useMenuTriggerContext_unstable: () => boolean;
@@ -1,16 +0,0 @@
1
- export * from './contexts/menuContext';
2
- export * from './contexts/menuTriggerContext';
3
- export * from './contexts/menuGroupContext';
4
- export * from './contexts/menuListContext';
5
- export * from './Menu';
6
- export * from './MenuDivider';
7
- export * from './MenuGroup';
8
- export * from './MenuGroupHeader';
9
- export * from './MenuItem';
10
- export * from './MenuItemCheckbox';
11
- export * from './MenuItemRadio';
12
- export * from './MenuList';
13
- export * from './MenuPopover';
14
- export * from './MenuSplitGroup';
15
- export * from './MenuTrigger';
16
- export * from './selectable/index';
@@ -1,2 +0,0 @@
1
- export * from './useCheckmarkStyles';
2
- export * from './types';
@@ -1,34 +0,0 @@
1
- import * as React from 'react';
2
- export declare type SelectableHandler = (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => void;
3
- /**
4
- * Props for selecatble menu items
5
- */
6
- export declare type MenuItemSelectableProps = {
7
- /**
8
- * Follows input convention
9
- * https://www.w3schools.com/jsref/prop_checkbox_name.asp
10
- */
11
- name: string;
12
- /**
13
- * Follows input convention
14
- * https://www.w3schools.com/jsref/prop_checkbox_value.asp
15
- */
16
- value: string;
17
- };
18
- /**
19
- * State for selectable menu items
20
- */
21
- export declare type MenuItemSelectableState = MenuItemSelectableProps & {
22
- /**
23
- * Checked items for a value with `name`
24
- */
25
- checkedItems: string[];
26
- /**
27
- * Callback when checked items changes for a given value with `name`
28
- */
29
- onCheckedValueChange: (e: React.MouseEvent | React.KeyboardEvent, name: string, checkedItems: string[]) => void;
30
- /**
31
- * Selectable is checked
32
- */
33
- checked: boolean;
34
- };
@@ -1,8 +0,0 @@
1
- import type { MenuItemSelectableState } from './types';
2
- import type { MenuItemState } from '../components/MenuItem/MenuItem.types';
3
- /**
4
- * Applies styles to a checkmark slot for selectable menu items
5
- *
6
- * @param state - should contain a `checkmark` slot
7
- */
8
- export declare const useCheckmarkStyles_unstable: (state: MenuItemSelectableState & Pick<MenuItemState, 'checkmark'>) => void;
@@ -1 +0,0 @@
1
- export * from './useOnMenuEnter';
@@ -1,9 +0,0 @@
1
- /**
2
- * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true
3
- * or whether it is a part of a `MenuList`
4
- *
5
- * A simple hook to check box contexts easily
6
- *
7
- * @returns whether the component is part of a submenu
8
- */
9
- export declare function useIsSubmenu(): boolean;
@@ -1,23 +0,0 @@
1
- import type { UseOnClickOrScrollOutsideOptions } from '@fluentui/react-utilities';
2
- /**
3
- * Name of the custom event
4
- */
5
- export declare const MENU_ENTER_EVENT = "fuimenuenter";
6
- /**
7
- * This hook works similarly to @see {useOnClickOutside}
8
- *
9
- * Problem: Trying to behave the same as system menus:
10
- * When the mouse leaves a stack of nested menus the stack should not dismiss.
11
- * However if the mouse leaves a stack of menus and enters a parent menu all its children menu should dismiss.
12
- *
13
- * We don't use the native mouseenter event because it would trigger too many times in the document
14
- * Instead, dispatch custom DOM event from the menu so that it can bubble
15
- * Each nested menu can use the listener to check if the event is from a child or parent menu
16
- */
17
- export declare const useOnMenuMouseEnter: (options: UseOnClickOrScrollOutsideOptions) => void;
18
- /**
19
- * Dispatches the custom MouseEvent enter event. Similar to calling `el.click()`
20
- * @param el element for the event target
21
- * @param nativeEvent the native mouse event this is mapped to
22
- */
23
- export declare const dispatchMenuEnterEvent: (el: HTMLElement, nativeEvent: MouseEvent) => void;