@yamada-ui/menu 1.3.12 → 1.3.13-dev-20240917033401

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/dist/{chunk-5ZWRZF6M.mjs → chunk-DPC5A6DV.mjs} +2 -2
  2. package/dist/chunk-DPC5A6DV.mjs.map +1 -0
  3. package/dist/{chunk-AG6UJA7D.mjs → chunk-HVOHR2NQ.mjs} +2 -2
  4. package/dist/chunk-HVOHR2NQ.mjs.map +1 -0
  5. package/dist/{chunk-G4OMCC2Y.mjs → chunk-M4PPRRRC.mjs} +5 -3
  6. package/dist/chunk-M4PPRRRC.mjs.map +1 -0
  7. package/dist/chunk-NNSVX2GX.mjs +170 -0
  8. package/dist/chunk-NNSVX2GX.mjs.map +1 -0
  9. package/dist/{chunk-73KHS3JD.mjs → chunk-O5D4LR5P.mjs} +2 -2
  10. package/dist/chunk-O5D4LR5P.mjs.map +1 -0
  11. package/dist/chunk-OFCEMPQW.mjs +29 -0
  12. package/dist/chunk-OFCEMPQW.mjs.map +1 -0
  13. package/dist/{chunk-6YBKZRIZ.mjs → chunk-SI3WI4AI.mjs} +3 -3
  14. package/dist/chunk-SI3WI4AI.mjs.map +1 -0
  15. package/dist/chunk-T7CXLEBW.mjs +243 -0
  16. package/dist/chunk-T7CXLEBW.mjs.map +1 -0
  17. package/dist/chunk-ZUOFHOX6.mjs +43 -0
  18. package/dist/chunk-ZUOFHOX6.mjs.map +1 -0
  19. package/dist/chunk-ZV73JKM5.mjs +21 -0
  20. package/dist/chunk-ZV73JKM5.mjs.map +1 -0
  21. package/dist/context-menu-trigger.d.mts +2 -1
  22. package/dist/context-menu-trigger.d.ts +2 -1
  23. package/dist/context-menu-trigger.js +32 -17
  24. package/dist/context-menu-trigger.js.map +1 -1
  25. package/dist/context-menu-trigger.mjs +2 -2
  26. package/dist/context-menu.d.mts +4 -10
  27. package/dist/context-menu.d.ts +4 -10
  28. package/dist/context-menu.js +43 -264
  29. package/dist/context-menu.js.map +1 -1
  30. package/dist/context-menu.mjs +5 -5
  31. package/dist/index.d.mts +1 -2
  32. package/dist/index.d.ts +1 -2
  33. package/dist/index.js +259 -255
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +16 -11
  36. package/dist/menu-button.d.mts +4 -3
  37. package/dist/menu-button.d.ts +4 -3
  38. package/dist/menu-button.js +55 -58
  39. package/dist/menu-button.js.map +1 -1
  40. package/dist/menu-button.mjs +3 -2
  41. package/dist/menu-context.d.mts +210 -0
  42. package/dist/menu-context.d.ts +210 -0
  43. package/dist/menu-context.js +77 -0
  44. package/dist/menu-context.js.map +1 -0
  45. package/dist/menu-context.mjs +30 -0
  46. package/dist/menu-context.mjs.map +1 -0
  47. package/dist/menu-divider.d.mts +3 -2
  48. package/dist/menu-divider.d.ts +3 -2
  49. package/dist/menu-divider.js +26 -21
  50. package/dist/menu-divider.js.map +1 -1
  51. package/dist/menu-divider.mjs +2 -2
  52. package/dist/menu-group.d.mts +3 -3
  53. package/dist/menu-group.d.ts +3 -3
  54. package/dist/menu-group.js +17 -14
  55. package/dist/menu-group.js.map +1 -1
  56. package/dist/menu-group.mjs +2 -2
  57. package/dist/menu-item.d.mts +14 -19
  58. package/dist/menu-item.d.ts +14 -19
  59. package/dist/menu-item.js +40 -45
  60. package/dist/menu-item.js.map +1 -1
  61. package/dist/menu-item.mjs +4 -7
  62. package/dist/menu-list.d.mts +2 -2
  63. package/dist/menu-list.d.ts +2 -2
  64. package/dist/menu-list.js +23 -20
  65. package/dist/menu-list.js.map +1 -1
  66. package/dist/menu-list.mjs +2 -2
  67. package/dist/menu-option-group.d.mts +6 -7
  68. package/dist/menu-option-group.d.ts +6 -7
  69. package/dist/menu-option-group.js +97 -100
  70. package/dist/menu-option-group.js.map +1 -1
  71. package/dist/menu-option-group.mjs +4 -3
  72. package/dist/menu.d.mts +7 -87
  73. package/dist/menu.d.ts +7 -87
  74. package/dist/menu.js +41 -274
  75. package/dist/menu.js.map +1 -1
  76. package/dist/menu.mjs +4 -13
  77. package/package.json +11 -11
  78. package/dist/chunk-5ZWRZF6M.mjs.map +0 -1
  79. package/dist/chunk-6IPLI42Z.mjs +0 -447
  80. package/dist/chunk-6IPLI42Z.mjs.map +0 -1
  81. package/dist/chunk-6YBKZRIZ.mjs.map +0 -1
  82. package/dist/chunk-73KHS3JD.mjs.map +0 -1
  83. package/dist/chunk-AG6UJA7D.mjs.map +0 -1
  84. package/dist/chunk-G4OMCC2Y.mjs.map +0 -1
  85. package/dist/chunk-ZOUBZWDN.mjs +0 -27
  86. package/dist/chunk-ZOUBZWDN.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/menu-context.ts"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\n\nexport const {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n strict: false,\n name: \"ContextMenuContext\",\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\ninterface UpstreamMenuItemContext {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n hasDownstreamRef: MutableRefObject<boolean>\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n strict: false,\n name: \"UpstreamMenuItemContext\",\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,4BAAiC;AACjC,mBAA8B;AAUvB,IAAM;AAAA,EACX;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;","names":[]}
@@ -0,0 +1,30 @@
1
+ "use client"
2
+ import {
3
+ ContextMenuProvider,
4
+ DescendantsContextProvider,
5
+ MenuProvider,
6
+ UpstreamMenuItemProvider,
7
+ UpstreamMenuProvider,
8
+ useContextMenu,
9
+ useDescendants,
10
+ useMenu,
11
+ useMenuDescendant,
12
+ useMenuDescendantsContext,
13
+ useUpstreamMenu,
14
+ useUpstreamMenuItem
15
+ } from "./chunk-ZUOFHOX6.mjs";
16
+ export {
17
+ ContextMenuProvider,
18
+ DescendantsContextProvider,
19
+ MenuProvider,
20
+ UpstreamMenuItemProvider,
21
+ UpstreamMenuProvider,
22
+ useContextMenu,
23
+ useDescendants,
24
+ useMenu,
25
+ useMenuDescendant,
26
+ useMenuDescendantsContext,
27
+ useUpstreamMenu,
28
+ useUpstreamMenuItem
29
+ };
30
+ //# sourceMappingURL=menu-context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,7 +1,8 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps } from '@yamada-ui/core';
3
3
 
4
- type MenuDividerProps = HTMLUIProps<"hr">;
5
- declare const MenuDivider: _yamada_ui_core.Component<_yamada_ui_core.As, object>;
4
+ interface MenuDividerProps extends HTMLUIProps<"hr"> {
5
+ }
6
+ declare const MenuDivider: _yamada_ui_core.Component<"hr", MenuDividerProps>;
6
7
 
7
8
  export { MenuDivider, type MenuDividerProps };
@@ -1,7 +1,8 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps } from '@yamada-ui/core';
3
3
 
4
- type MenuDividerProps = HTMLUIProps<"hr">;
5
- declare const MenuDivider: _yamada_ui_core.Component<_yamada_ui_core.As, object>;
4
+ interface MenuDividerProps extends HTMLUIProps<"hr"> {
5
+ }
6
+ declare const MenuDivider: _yamada_ui_core.Component<"hr", MenuDividerProps>;
6
7
 
7
8
  export { MenuDivider, type MenuDividerProps };
@@ -24,17 +24,12 @@ __export(menu_divider_exports, {
24
24
  MenuDivider: () => MenuDivider
25
25
  });
26
26
  module.exports = __toCommonJS(menu_divider_exports);
27
- var import_core2 = require("@yamada-ui/core");
27
+ var import_core = require("@yamada-ui/core");
28
28
  var import_utils2 = require("@yamada-ui/utils");
29
29
 
30
- // src/menu.tsx
31
- var import_core = require("@yamada-ui/core");
32
- var import_popover = require("@yamada-ui/popover");
30
+ // src/menu-context.ts
33
31
  var import_use_descendant = require("@yamada-ui/use-descendant");
34
- var import_use_disclosure = require("@yamada-ui/use-disclosure");
35
32
  var import_utils = require("@yamada-ui/utils");
36
- var import_react = require("react");
37
- var import_jsx_runtime = require("react/jsx-runtime");
38
33
  var {
39
34
  DescendantsContextProvider,
40
35
  useDescendantsContext: useMenuDescendantsContext,
@@ -45,26 +40,36 @@ var [MenuProvider, useMenu] = (0, import_utils.createContext)({
45
40
  name: "MenuContext",
46
41
  errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />"`
47
42
  });
43
+ var [ContextMenuProvider, useContextMenu] = (0, import_utils.createContext)({
44
+ strict: false,
45
+ name: "ContextMenuContext"
46
+ });
48
47
  var [UpstreamMenuProvider, useUpstreamMenu] = (0, import_utils.createContext)({
49
48
  strict: false,
50
49
  name: "UpstreamMenuContext"
51
50
  });
51
+ var [UpstreamMenuItemProvider, useUpstreamMenuItem] = (0, import_utils.createContext)({
52
+ strict: false,
53
+ name: "UpstreamMenuItemContext"
54
+ });
52
55
 
53
56
  // src/menu-divider.tsx
54
- var import_jsx_runtime2 = require("react/jsx-runtime");
55
- var MenuDivider = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
56
- const { styles } = useMenu();
57
- const css = { ...styles.divider };
58
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
59
- import_core2.ui.hr,
60
- {
61
- ref,
62
- className: (0, import_utils2.cx)("ui-menu__divider", className),
63
- __css: css,
64
- ...rest
65
- }
66
- );
67
- });
57
+ var import_jsx_runtime = require("react/jsx-runtime");
58
+ var MenuDivider = (0, import_core.forwardRef)(
59
+ ({ className, ...rest }, ref) => {
60
+ const { styles } = useMenu();
61
+ const css = { ...styles.divider };
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
63
+ import_core.ui.hr,
64
+ {
65
+ ref,
66
+ className: (0, import_utils2.cx)("ui-menu__divider", className),
67
+ __css: css,
68
+ ...rest
69
+ }
70
+ );
71
+ }
72
+ );
68
73
  // Annotate the CommonJS export names for ESM import in node:
69
74
  0 && (module.exports = {
70
75
  MenuDivider
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu-divider.tsx","../src/menu.tsx"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMenu } from \"./menu\"\n\nexport type MenuDividerProps = HTMLUIProps<\"hr\">\n\nexport const MenuDivider = forwardRef(({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.divider }\n\n return (\n <ui.hr\n ref={ref}\n className={cx(\"ui-menu__divider\", className)}\n __css={css}\n {...rest}\n />\n )\n})\n","import type { CSSUIObject, ThemeProps } from \"@yamada-ui/core\"\nimport { useMultiComponentStyle, omitThemeProps } from \"@yamada-ui/core\"\nimport type { PopoverProps } from \"@yamada-ui/popover\"\nimport { Popover } from \"@yamada-ui/popover\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { useDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n createContext,\n funcAll,\n useUnmountEffect,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n FC,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport { useContextMenu } from \"./context-menu\"\nimport { useUpstreamMenuItem } from \"./menu-item\"\n\nconst {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant<HTMLElement>()\n\nexport { useMenuDescendantsContext, useMenuDescendant }\n\ntype MenuContext = MenuOptions & {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: Record<string, CSSUIObject>\n}\n\nconst [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ntype UpstreamMenuContext = {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\nexport { useMenu }\n\ntype MenuOptions = {\n /**\n * If `true`, the list element will be closed when value is selected.\n *\n * @default true\n */\n closeOnSelect?: boolean\n}\n\nexport type MenuProps = ThemeProps<\"Menu\"> &\n Omit<PopoverProps, \"closeOnButton\" | \"relatedRef\"> &\n MenuOptions\n\n/**\n * `Menu` is a component that displays a common dropdown menu.\n *\n * @see Docs https://yamada-ui.com/components/overlay/menu\n */\nexport const Menu: FC<MenuProps> = (props) => {\n const { styles: contextMenuStyles } = useContextMenu() ?? {}\n const [styles, mergedProps] = useMultiComponentStyle(\"Menu\", props, {\n isProcessSkip: !!contextMenuStyles,\n styles: contextMenuStyles,\n })\n let {\n initialFocusRef,\n closeOnSelect = true,\n closeOnBlur,\n placement,\n duration = 0.2,\n offset,\n onOpen: onOpenProp,\n onClose: onCloseProp,\n ...rest\n } = omitThemeProps(mergedProps)\n const { relatedRef, onUpstreamClose, onDownstreamCloseMapRef } =\n useUpstreamMenu() ?? {}\n const { setDownstreamOpen, hasDownstreamRef } = useUpstreamMenuItem() ?? {}\n const isNested = !!relatedRef\n\n if (isNested) {\n placement ??= \"right-start\"\n offset ??= [-8, 8]\n closeOnBlur ??= false\n } else {\n placement ??= \"bottom-start\"\n }\n\n const descendants = useDescendants()\n\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n\n const menuRef = useRef<HTMLDivElement>(null)\n const timeoutIds = useRef<Set<any>>(new Set([]))\n const requestAnimationFrameId = useRef<number | null>(null)\n const onCloseMapRef = useRef<Map<string, () => void>>(new Map())\n\n const onFocusMenu = useCallback(() => {\n requestAnimationFrame(() =>\n menuRef.current?.focus({ preventScroll: false }),\n )\n }, [])\n\n const onFocusFirstItem = useCallback(() => {\n const id = setTimeout(() => {\n if (initialFocusRef) return\n\n const first = descendants.enabledFirstValue()\n\n if (first) setFocusedIndex(first.index)\n })\n\n timeoutIds.current.add(id)\n }, [descendants, initialFocusRef])\n\n const onFocusLastItem = useCallback(() => {\n const id = setTimeout(() => {\n if (initialFocusRef) return\n\n const last = descendants.enabledLastValue()\n\n if (last) setFocusedIndex(last.index)\n })\n\n timeoutIds.current.add(id)\n }, [descendants, initialFocusRef])\n\n const onOpenInternal = useCallback(() => {\n onOpenProp?.()\n\n if (!isNested) onFocusMenu()\n }, [onOpenProp, isNested, onFocusMenu])\n\n const onCloseInternal = useCallback(() => {\n onCloseProp?.()\n\n for (const onClose of onCloseMapRef.current.values()) {\n onClose()\n }\n }, [onCloseProp])\n\n const id = useId()\n const { isOpen, onOpen, onClose } = useDisclosure({\n ...props,\n onOpen: onOpenInternal,\n onClose: onCloseInternal,\n })\n\n useEffect(() => {\n const onCloseMap = onDownstreamCloseMapRef?.current\n\n onCloseMap?.set(id, onClose)\n\n return () => {\n onCloseMap?.delete(id)\n }\n }, [id, onClose, onDownstreamCloseMapRef])\n\n useEffect(() => {\n if (setDownstreamOpen) setDownstreamOpen(isOpen)\n }, [setDownstreamOpen, isOpen])\n\n useEffect(() => {\n if (hasDownstreamRef) hasDownstreamRef.current = true\n\n return () => {\n if (hasDownstreamRef) hasDownstreamRef.current = false\n }\n })\n\n useUpdateEffect(() => {\n if (!isOpen) setFocusedIndex(-1)\n }, [isOpen])\n\n useUnmountEffect(() => {\n timeoutIds.current.forEach((id) => clearTimeout(id))\n timeoutIds.current.clear()\n })\n\n return (\n <DescendantsContextProvider value={descendants}>\n <UpstreamMenuProvider\n value={{\n relatedRef: menuRef,\n onDownstreamCloseMapRef: onCloseMapRef,\n onUpstreamClose: funcAll(onUpstreamClose, onClose),\n }}\n >\n <MenuProvider\n value={{\n isOpen,\n onOpen,\n onClose,\n onUpstreamClose,\n onFocusFirstItem,\n onFocusLastItem,\n closeOnSelect,\n focusedIndex,\n setFocusedIndex,\n menuRef,\n requestAnimationFrameId,\n isNested,\n styles,\n }}\n >\n <Popover\n {...{\n trigger: isNested ? \"hover\" : \"click\",\n ...rest,\n isOpen,\n onOpen,\n onClose,\n placement,\n offset,\n duration,\n initialFocusRef,\n relatedRef,\n closeOnButton: false,\n closeOnBlur,\n }}\n />\n </MenuProvider>\n </UpstreamMenuProvider>\n </DescendantsContextProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACDnB,kBAAuD;AAEvD,qBAAwB;AACxB,4BAAiC;AACjC,4BAA8B;AAC9B,mBAKO;AAQP,mBAAgE;AAoNtD;AAhNV,IAAM;AAAA,EACJ;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAA8B;AAmBlC,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EACzD,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAQM,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;;;ADjDC,IAAAC,sBAAA;AANG,IAAM,kBAAc,yBAAW,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AACrE,QAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,QAAM,MAAmB,EAAE,GAAG,OAAO,QAAQ;AAE7C,SACE;AAAA,IAAC,gBAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,kBAAG,oBAAoB,SAAS;AAAA,MAC3C,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["import_core","import_utils","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/menu-divider.tsx","../src/menu-context.ts"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMenu } from \"./menu-context\"\n\nexport interface MenuDividerProps extends HTMLUIProps<\"hr\"> {}\n\nexport const MenuDivider = forwardRef<MenuDividerProps, \"hr\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.divider }\n\n return (\n <ui.hr\n ref={ref}\n className={cx(\"ui-menu__divider\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\n\nexport const {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n strict: false,\n name: \"ContextMenuContext\",\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\ninterface UpstreamMenuItemContext {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n hasDownstreamRef: MutableRefObject<boolean>\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n strict: false,\n name: \"UpstreamMenuItemContext\",\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;;;ACDnB,4BAAiC;AACjC,mBAA8B;AAUvB,IAAM;AAAA,EACX;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;;;AD1DG;AAPC,IAAM,kBAAc;AAAA,EACzB,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,UAAM,MAAmB,EAAE,GAAG,OAAO,QAAQ;AAE7C,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,oBAAoB,SAAS;AAAA,QAC3C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_utils"]}
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  import {
3
3
  MenuDivider
4
- } from "./chunk-ZOUBZWDN.mjs";
5
- import "./chunk-6IPLI42Z.mjs";
4
+ } from "./chunk-OFCEMPQW.mjs";
5
+ import "./chunk-ZUOFHOX6.mjs";
6
6
  export {
7
7
  MenuDivider
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps } from '@yamada-ui/core';
3
3
 
4
- type MenuGroupProps = HTMLUIProps<"div"> & {
4
+ interface MenuGroupProps extends HTMLUIProps<"li"> {
5
5
  /**
6
6
  * The label of the group.
7
7
  */
@@ -10,7 +10,7 @@ type MenuGroupProps = HTMLUIProps<"div"> & {
10
10
  * Props for menu group element.
11
11
  */
12
12
  labelProps?: HTMLUIProps<"span">;
13
- };
14
- declare const MenuGroup: _yamada_ui_core.Component<"div", MenuGroupProps>;
13
+ }
14
+ declare const MenuGroup: _yamada_ui_core.Component<"li", MenuGroupProps>;
15
15
 
16
16
  export { MenuGroup, type MenuGroupProps };
@@ -1,7 +1,7 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps } from '@yamada-ui/core';
3
3
 
4
- type MenuGroupProps = HTMLUIProps<"div"> & {
4
+ interface MenuGroupProps extends HTMLUIProps<"li"> {
5
5
  /**
6
6
  * The label of the group.
7
7
  */
@@ -10,7 +10,7 @@ type MenuGroupProps = HTMLUIProps<"div"> & {
10
10
  * Props for menu group element.
11
11
  */
12
12
  labelProps?: HTMLUIProps<"span">;
13
- };
14
- declare const MenuGroup: _yamada_ui_core.Component<"div", MenuGroupProps>;
13
+ }
14
+ declare const MenuGroup: _yamada_ui_core.Component<"li", MenuGroupProps>;
15
15
 
16
16
  export { MenuGroup, type MenuGroupProps };
@@ -24,17 +24,12 @@ __export(menu_group_exports, {
24
24
  MenuGroup: () => MenuGroup
25
25
  });
26
26
  module.exports = __toCommonJS(menu_group_exports);
27
- var import_core2 = require("@yamada-ui/core");
27
+ var import_core = require("@yamada-ui/core");
28
28
  var import_utils2 = require("@yamada-ui/utils");
29
29
 
30
- // src/menu.tsx
31
- var import_core = require("@yamada-ui/core");
32
- var import_popover = require("@yamada-ui/popover");
30
+ // src/menu-context.ts
33
31
  var import_use_descendant = require("@yamada-ui/use-descendant");
34
- var import_use_disclosure = require("@yamada-ui/use-disclosure");
35
32
  var import_utils = require("@yamada-ui/utils");
36
- var import_react = require("react");
37
- var import_jsx_runtime = require("react/jsx-runtime");
38
33
  var {
39
34
  DescendantsContextProvider,
40
35
  useDescendantsContext: useMenuDescendantsContext,
@@ -45,19 +40,27 @@ var [MenuProvider, useMenu] = (0, import_utils.createContext)({
45
40
  name: "MenuContext",
46
41
  errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />"`
47
42
  });
43
+ var [ContextMenuProvider, useContextMenu] = (0, import_utils.createContext)({
44
+ strict: false,
45
+ name: "ContextMenuContext"
46
+ });
48
47
  var [UpstreamMenuProvider, useUpstreamMenu] = (0, import_utils.createContext)({
49
48
  strict: false,
50
49
  name: "UpstreamMenuContext"
51
50
  });
51
+ var [UpstreamMenuItemProvider, useUpstreamMenuItem] = (0, import_utils.createContext)({
52
+ strict: false,
53
+ name: "UpstreamMenuItemContext"
54
+ });
52
55
 
53
56
  // src/menu-group.tsx
54
- var import_jsx_runtime2 = require("react/jsx-runtime");
55
- var MenuGroup = (0, import_core2.forwardRef)(
57
+ var import_jsx_runtime = require("react/jsx-runtime");
58
+ var MenuGroup = (0, import_core.forwardRef)(
56
59
  ({ className, label, children, labelProps, ...rest }, ref) => {
57
60
  const { styles } = useMenu();
58
61
  const css = { ...styles.group };
59
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
60
- import_core2.ui.li,
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
63
+ import_core.ui.li,
61
64
  {
62
65
  ref,
63
66
  className: (0, import_utils2.cx)("ui-menu__item", "ui-menu__item--group", className),
@@ -65,8 +68,8 @@ var MenuGroup = (0, import_core2.forwardRef)(
65
68
  __css: css,
66
69
  ...rest,
67
70
  children: [
68
- label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
69
- import_core2.ui.span,
71
+ label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
+ import_core.ui.span,
70
73
  {
71
74
  className: (0, import_utils2.cx)("ui-menu__item--group-label"),
72
75
  __css: styles.groupLabel,
@@ -74,7 +77,7 @@ var MenuGroup = (0, import_core2.forwardRef)(
74
77
  children: label
75
78
  }
76
79
  ) : null,
77
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.ul, { className: "ui-menu__item__group", children })
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.ul, { className: "ui-menu__item__group", children })
78
81
  ]
79
82
  }
80
83
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu-group.tsx","../src/menu.tsx"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMenu } from \"./menu\"\n\nexport type MenuGroupProps = HTMLUIProps<\"div\"> & {\n /**\n * The label of the group.\n */\n label?: string\n /**\n * Props for menu group element.\n */\n labelProps?: HTMLUIProps<\"span\">\n}\n\nexport const MenuGroup = forwardRef<MenuGroupProps, \"div\">(\n ({ className, label, children, labelProps, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.group }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-menu__item\", \"ui-menu__item--group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {label ? (\n <ui.span\n className={cx(\"ui-menu__item--group-label\")}\n __css={styles.groupLabel}\n {...labelProps}\n >\n {label}\n </ui.span>\n ) : null}\n\n <ui.ul className=\"ui-menu__item__group\">{children}</ui.ul>\n </ui.li>\n )\n },\n)\n","import type { CSSUIObject, ThemeProps } from \"@yamada-ui/core\"\nimport { useMultiComponentStyle, omitThemeProps } from \"@yamada-ui/core\"\nimport type { PopoverProps } from \"@yamada-ui/popover\"\nimport { Popover } from \"@yamada-ui/popover\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { useDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n createContext,\n funcAll,\n useUnmountEffect,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n FC,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport { useContextMenu } from \"./context-menu\"\nimport { useUpstreamMenuItem } from \"./menu-item\"\n\nconst {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant<HTMLElement>()\n\nexport { useMenuDescendantsContext, useMenuDescendant }\n\ntype MenuContext = MenuOptions & {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: Record<string, CSSUIObject>\n}\n\nconst [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ntype UpstreamMenuContext = {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\nexport { useMenu }\n\ntype MenuOptions = {\n /**\n * If `true`, the list element will be closed when value is selected.\n *\n * @default true\n */\n closeOnSelect?: boolean\n}\n\nexport type MenuProps = ThemeProps<\"Menu\"> &\n Omit<PopoverProps, \"closeOnButton\" | \"relatedRef\"> &\n MenuOptions\n\n/**\n * `Menu` is a component that displays a common dropdown menu.\n *\n * @see Docs https://yamada-ui.com/components/overlay/menu\n */\nexport const Menu: FC<MenuProps> = (props) => {\n const { styles: contextMenuStyles } = useContextMenu() ?? {}\n const [styles, mergedProps] = useMultiComponentStyle(\"Menu\", props, {\n isProcessSkip: !!contextMenuStyles,\n styles: contextMenuStyles,\n })\n let {\n initialFocusRef,\n closeOnSelect = true,\n closeOnBlur,\n placement,\n duration = 0.2,\n offset,\n onOpen: onOpenProp,\n onClose: onCloseProp,\n ...rest\n } = omitThemeProps(mergedProps)\n const { relatedRef, onUpstreamClose, onDownstreamCloseMapRef } =\n useUpstreamMenu() ?? {}\n const { setDownstreamOpen, hasDownstreamRef } = useUpstreamMenuItem() ?? {}\n const isNested = !!relatedRef\n\n if (isNested) {\n placement ??= \"right-start\"\n offset ??= [-8, 8]\n closeOnBlur ??= false\n } else {\n placement ??= \"bottom-start\"\n }\n\n const descendants = useDescendants()\n\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n\n const menuRef = useRef<HTMLDivElement>(null)\n const timeoutIds = useRef<Set<any>>(new Set([]))\n const requestAnimationFrameId = useRef<number | null>(null)\n const onCloseMapRef = useRef<Map<string, () => void>>(new Map())\n\n const onFocusMenu = useCallback(() => {\n requestAnimationFrame(() =>\n menuRef.current?.focus({ preventScroll: false }),\n )\n }, [])\n\n const onFocusFirstItem = useCallback(() => {\n const id = setTimeout(() => {\n if (initialFocusRef) return\n\n const first = descendants.enabledFirstValue()\n\n if (first) setFocusedIndex(first.index)\n })\n\n timeoutIds.current.add(id)\n }, [descendants, initialFocusRef])\n\n const onFocusLastItem = useCallback(() => {\n const id = setTimeout(() => {\n if (initialFocusRef) return\n\n const last = descendants.enabledLastValue()\n\n if (last) setFocusedIndex(last.index)\n })\n\n timeoutIds.current.add(id)\n }, [descendants, initialFocusRef])\n\n const onOpenInternal = useCallback(() => {\n onOpenProp?.()\n\n if (!isNested) onFocusMenu()\n }, [onOpenProp, isNested, onFocusMenu])\n\n const onCloseInternal = useCallback(() => {\n onCloseProp?.()\n\n for (const onClose of onCloseMapRef.current.values()) {\n onClose()\n }\n }, [onCloseProp])\n\n const id = useId()\n const { isOpen, onOpen, onClose } = useDisclosure({\n ...props,\n onOpen: onOpenInternal,\n onClose: onCloseInternal,\n })\n\n useEffect(() => {\n const onCloseMap = onDownstreamCloseMapRef?.current\n\n onCloseMap?.set(id, onClose)\n\n return () => {\n onCloseMap?.delete(id)\n }\n }, [id, onClose, onDownstreamCloseMapRef])\n\n useEffect(() => {\n if (setDownstreamOpen) setDownstreamOpen(isOpen)\n }, [setDownstreamOpen, isOpen])\n\n useEffect(() => {\n if (hasDownstreamRef) hasDownstreamRef.current = true\n\n return () => {\n if (hasDownstreamRef) hasDownstreamRef.current = false\n }\n })\n\n useUpdateEffect(() => {\n if (!isOpen) setFocusedIndex(-1)\n }, [isOpen])\n\n useUnmountEffect(() => {\n timeoutIds.current.forEach((id) => clearTimeout(id))\n timeoutIds.current.clear()\n })\n\n return (\n <DescendantsContextProvider value={descendants}>\n <UpstreamMenuProvider\n value={{\n relatedRef: menuRef,\n onDownstreamCloseMapRef: onCloseMapRef,\n onUpstreamClose: funcAll(onUpstreamClose, onClose),\n }}\n >\n <MenuProvider\n value={{\n isOpen,\n onOpen,\n onClose,\n onUpstreamClose,\n onFocusFirstItem,\n onFocusLastItem,\n closeOnSelect,\n focusedIndex,\n setFocusedIndex,\n menuRef,\n requestAnimationFrameId,\n isNested,\n styles,\n }}\n >\n <Popover\n {...{\n trigger: isNested ? \"hover\" : \"click\",\n ...rest,\n isOpen,\n onOpen,\n onClose,\n placement,\n offset,\n duration,\n initialFocusRef,\n relatedRef,\n closeOnButton: false,\n closeOnBlur,\n }}\n />\n </MenuProvider>\n </UpstreamMenuProvider>\n </DescendantsContextProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACDnB,kBAAuD;AAEvD,qBAAwB;AACxB,4BAAiC;AACjC,4BAA8B;AAC9B,mBAKO;AAQP,mBAAgE;AAoNtD;AAhNV,IAAM;AAAA,EACJ;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAA8B;AAmBlC,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EACzD,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAQM,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;;;ADvCG,IAAAC,sBAAA;AAPC,IAAM,gBAAY;AAAA,EACvB,CAAC,EAAE,WAAW,OAAO,UAAU,YAAY,GAAG,KAAK,GAAG,QAAQ;AAC5D,UAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,UAAM,MAAmB,EAAE,GAAG,OAAO,MAAM;AAE3C,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,iBAAiB,wBAAwB,SAAS;AAAA,QAChE,MAAK;AAAA,QACL,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA,kBACC;AAAA,YAAC,gBAAG;AAAA,YAAH;AAAA,cACC,eAAW,kBAAG,4BAA4B;AAAA,cAC1C,OAAO,OAAO;AAAA,cACb,GAAG;AAAA,cAEH;AAAA;AAAA,UACH,IACE;AAAA,UAEJ,6CAAC,gBAAG,IAAH,EAAM,WAAU,wBAAwB,UAAS;AAAA;AAAA;AAAA,IACpD;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/menu-group.tsx","../src/menu-context.ts"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMenu } from \"./menu-context\"\n\nexport interface MenuGroupProps extends HTMLUIProps<\"li\"> {\n /**\n * The label of the group.\n */\n label?: string\n /**\n * Props for menu group element.\n */\n labelProps?: HTMLUIProps<\"span\">\n}\n\nexport const MenuGroup = forwardRef<MenuGroupProps, \"li\">(\n ({ className, label, children, labelProps, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.group }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-menu__item\", \"ui-menu__item--group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {label ? (\n <ui.span\n className={cx(\"ui-menu__item--group-label\")}\n __css={styles.groupLabel}\n {...labelProps}\n >\n {label}\n </ui.span>\n ) : null}\n\n <ui.ul className=\"ui-menu__item__group\">{children}</ui.ul>\n </ui.li>\n )\n },\n)\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\n\nexport const {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n strict: false,\n name: \"ContextMenuContext\",\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\ninterface UpstreamMenuItemContext {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n hasDownstreamRef: MutableRefObject<boolean>\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n strict: false,\n name: \"UpstreamMenuItemContext\",\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;;;ACDnB,4BAAiC;AACjC,mBAA8B;AAUvB,IAAM;AAAA,EACX;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;;;ADjDG;AAPC,IAAM,gBAAY;AAAA,EACvB,CAAC,EAAE,WAAW,OAAO,UAAU,YAAY,GAAG,KAAK,GAAG,QAAQ;AAC5D,UAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,UAAM,MAAmB,EAAE,GAAG,OAAO,MAAM;AAE3C,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,iBAAiB,wBAAwB,SAAS;AAAA,QAChE,MAAK;AAAA,QACL,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA,kBACC;AAAA,YAAC,eAAG;AAAA,YAAH;AAAA,cACC,eAAW,kBAAG,4BAA4B;AAAA,cAC1C,OAAO,OAAO;AAAA,cACb,GAAG;AAAA,cAEH;AAAA;AAAA,UACH,IACE;AAAA,UAEJ,4CAAC,eAAG,IAAH,EAAM,WAAU,wBAAwB,UAAS;AAAA;AAAA;AAAA,IACpD;AAAA,EAEJ;AACF;","names":["import_utils"]}
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  import {
3
3
  MenuGroup
4
- } from "./chunk-AG6UJA7D.mjs";
5
- import "./chunk-6IPLI42Z.mjs";
4
+ } from "./chunk-HVOHR2NQ.mjs";
5
+ import "./chunk-ZUOFHOX6.mjs";
6
6
  export {
7
7
  MenuGroup
8
8
  };
@@ -1,17 +1,8 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps } from '@yamada-ui/core';
3
- import * as react from 'react';
4
- import { RefObject, KeyboardEventHandler, Dispatch, SetStateAction, MutableRefObject, ReactElement } from 'react';
3
+ import { ReactElement } from 'react';
5
4
 
6
- type UpstreamMenuItemContext = {
7
- onUpstreamRestoreFocus: () => void;
8
- onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>;
9
- setDownstreamOpen: Dispatch<SetStateAction<boolean>>;
10
- hasDownstreamRef: MutableRefObject<boolean>;
11
- };
12
- declare const UpstreamMenuItemProvider: react.Provider<UpstreamMenuItemContext>;
13
- declare const useUpstreamMenuItem: () => UpstreamMenuItemContext;
14
- type MenuItemOptions = {
5
+ interface MenuItemOptions {
15
6
  /**
16
7
  * If `true`, the menu item will be disabled.
17
8
  *
@@ -38,10 +29,11 @@ type MenuItemOptions = {
38
29
  * Right-aligned label text content, useful for displaying hotkeys.
39
30
  */
40
31
  command?: string;
41
- };
42
- type MenuItemProps = HTMLUIProps<"li"> & MenuItemOptions;
32
+ }
33
+ interface MenuItemProps extends HTMLUIProps<"li">, MenuItemOptions {
34
+ }
43
35
  declare const MenuItem: _yamada_ui_core.Component<"li", MenuItemProps>;
44
- type MenuOptionItemOptions = {
36
+ interface MenuOptionItemOptions {
45
37
  /**
46
38
  * The menu option item icon to use.
47
39
  */
@@ -60,12 +52,15 @@ type MenuOptionItemOptions = {
60
52
  * The type of the menu option item.
61
53
  */
62
54
  type?: "radio" | "checkbox";
63
- };
64
- type MenuOptionItemProps = Omit<MenuItemProps, "icon" | "command"> & MenuOptionItemOptions;
55
+ }
56
+ interface MenuOptionItemProps extends Omit<MenuItemProps, "icon" | "command" | "value">, MenuOptionItemOptions {
57
+ }
65
58
  declare const MenuOptionItem: _yamada_ui_core.Component<"button", MenuOptionItemProps>;
66
- type MenuIconProps = HTMLUIProps<"span">;
59
+ interface MenuIconProps extends HTMLUIProps<"span"> {
60
+ }
67
61
  declare const MenuIcon: _yamada_ui_core.Component<"span", MenuIconProps>;
68
- type MenuCommandProps = HTMLUIProps<"span">;
62
+ interface MenuCommandProps extends HTMLUIProps<"span"> {
63
+ }
69
64
  declare const MenuCommand: _yamada_ui_core.Component<"span", MenuCommandProps>;
70
65
 
71
- export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps, UpstreamMenuItemProvider, useUpstreamMenuItem };
66
+ export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps };
@@ -1,17 +1,8 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps } from '@yamada-ui/core';
3
- import * as react from 'react';
4
- import { RefObject, KeyboardEventHandler, Dispatch, SetStateAction, MutableRefObject, ReactElement } from 'react';
3
+ import { ReactElement } from 'react';
5
4
 
6
- type UpstreamMenuItemContext = {
7
- onUpstreamRestoreFocus: () => void;
8
- onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>;
9
- setDownstreamOpen: Dispatch<SetStateAction<boolean>>;
10
- hasDownstreamRef: MutableRefObject<boolean>;
11
- };
12
- declare const UpstreamMenuItemProvider: react.Provider<UpstreamMenuItemContext>;
13
- declare const useUpstreamMenuItem: () => UpstreamMenuItemContext;
14
- type MenuItemOptions = {
5
+ interface MenuItemOptions {
15
6
  /**
16
7
  * If `true`, the menu item will be disabled.
17
8
  *
@@ -38,10 +29,11 @@ type MenuItemOptions = {
38
29
  * Right-aligned label text content, useful for displaying hotkeys.
39
30
  */
40
31
  command?: string;
41
- };
42
- type MenuItemProps = HTMLUIProps<"li"> & MenuItemOptions;
32
+ }
33
+ interface MenuItemProps extends HTMLUIProps<"li">, MenuItemOptions {
34
+ }
43
35
  declare const MenuItem: _yamada_ui_core.Component<"li", MenuItemProps>;
44
- type MenuOptionItemOptions = {
36
+ interface MenuOptionItemOptions {
45
37
  /**
46
38
  * The menu option item icon to use.
47
39
  */
@@ -60,12 +52,15 @@ type MenuOptionItemOptions = {
60
52
  * The type of the menu option item.
61
53
  */
62
54
  type?: "radio" | "checkbox";
63
- };
64
- type MenuOptionItemProps = Omit<MenuItemProps, "icon" | "command"> & MenuOptionItemOptions;
55
+ }
56
+ interface MenuOptionItemProps extends Omit<MenuItemProps, "icon" | "command" | "value">, MenuOptionItemOptions {
57
+ }
65
58
  declare const MenuOptionItem: _yamada_ui_core.Component<"button", MenuOptionItemProps>;
66
- type MenuIconProps = HTMLUIProps<"span">;
59
+ interface MenuIconProps extends HTMLUIProps<"span"> {
60
+ }
67
61
  declare const MenuIcon: _yamada_ui_core.Component<"span", MenuIconProps>;
68
- type MenuCommandProps = HTMLUIProps<"span">;
62
+ interface MenuCommandProps extends HTMLUIProps<"span"> {
63
+ }
69
64
  declare const MenuCommand: _yamada_ui_core.Component<"span", MenuCommandProps>;
70
65
 
71
- export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps, UpstreamMenuItemProvider, useUpstreamMenuItem };
66
+ export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps };