@yamada-ui/menu 1.3.15-dev-20241005224505 → 1.3.15-dev-20241006000212

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. package/dist/{chunk-ZUOFHOX6.mjs → chunk-EJHOFPF4.mjs} +11 -11
  2. package/dist/chunk-EJHOFPF4.mjs.map +1 -0
  3. package/dist/{chunk-ZV73JKM5.mjs → chunk-ELQD4RMJ.mjs} +4 -4
  4. package/dist/{chunk-ZV73JKM5.mjs.map → chunk-ELQD4RMJ.mjs.map} +1 -1
  5. package/dist/{chunk-T7CXLEBW.mjs → chunk-HEDZYLPX.mjs} +35 -35
  6. package/dist/chunk-HEDZYLPX.mjs.map +1 -0
  7. package/dist/{chunk-NNSVX2GX.mjs → chunk-I2KIZ6OI.mjs} +28 -28
  8. package/dist/{chunk-NNSVX2GX.mjs.map → chunk-I2KIZ6OI.mjs.map} +1 -1
  9. package/dist/{chunk-O5D4LR5P.mjs → chunk-I473RINV.mjs} +8 -8
  10. package/dist/{chunk-O5D4LR5P.mjs.map → chunk-I473RINV.mjs.map} +1 -1
  11. package/dist/{chunk-OFCEMPQW.mjs → chunk-KZAACFSL.mjs} +3 -3
  12. package/dist/{chunk-OFCEMPQW.mjs.map → chunk-KZAACFSL.mjs.map} +1 -1
  13. package/dist/{chunk-HVOHR2NQ.mjs → chunk-O7MHNHWF.mjs} +4 -4
  14. package/dist/{chunk-HVOHR2NQ.mjs.map → chunk-O7MHNHWF.mjs.map} +1 -1
  15. package/dist/{chunk-SI3WI4AI.mjs → chunk-OETJECD3.mjs} +8 -8
  16. package/dist/chunk-OETJECD3.mjs.map +1 -0
  17. package/dist/{chunk-WQ626PSA.mjs → chunk-T4SSYCLG.mjs} +9 -8
  18. package/dist/chunk-T4SSYCLG.mjs.map +1 -0
  19. package/dist/{chunk-M4PPRRRC.mjs → chunk-TM7BAARA.mjs} +14 -14
  20. package/dist/chunk-TM7BAARA.mjs.map +1 -0
  21. package/dist/context-menu-trigger.js +14 -13
  22. package/dist/context-menu-trigger.js.map +1 -1
  23. package/dist/context-menu-trigger.mjs +2 -2
  24. package/dist/context-menu.js +33 -33
  25. package/dist/context-menu.js.map +1 -1
  26. package/dist/context-menu.mjs +3 -3
  27. package/dist/index.d.mts +6 -6
  28. package/dist/index.d.ts +6 -6
  29. package/dist/index.js +275 -272
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +10 -10
  32. package/dist/menu-button.d.mts +2 -2
  33. package/dist/menu-button.d.ts +2 -2
  34. package/dist/menu-button.js +50 -50
  35. package/dist/menu-button.js.map +1 -1
  36. package/dist/menu-button.mjs +3 -3
  37. package/dist/menu-context.d.mts +116 -116
  38. package/dist/menu-context.d.ts +116 -116
  39. package/dist/menu-context.js +8 -8
  40. package/dist/menu-context.js.map +1 -1
  41. package/dist/menu-context.mjs +1 -1
  42. package/dist/menu-divider.js +8 -8
  43. package/dist/menu-divider.js.map +1 -1
  44. package/dist/menu-divider.mjs +2 -2
  45. package/dist/menu-group.js +9 -9
  46. package/dist/menu-group.js.map +1 -1
  47. package/dist/menu-group.mjs +2 -2
  48. package/dist/menu-item.d.mts +21 -21
  49. package/dist/menu-item.d.ts +21 -21
  50. package/dist/menu-item.js +40 -40
  51. package/dist/menu-item.js.map +1 -1
  52. package/dist/menu-item.mjs +2 -2
  53. package/dist/menu-list.js +14 -14
  54. package/dist/menu-list.js.map +1 -1
  55. package/dist/menu-list.mjs +2 -2
  56. package/dist/menu-option-group.d.mts +8 -8
  57. package/dist/menu-option-group.d.ts +8 -8
  58. package/dist/menu-option-group.js +46 -46
  59. package/dist/menu-option-group.js.map +1 -1
  60. package/dist/menu-option-group.mjs +4 -4
  61. package/dist/menu.js +33 -33
  62. package/dist/menu.js.map +1 -1
  63. package/dist/menu.mjs +2 -2
  64. package/package.json +11 -11
  65. package/dist/chunk-M4PPRRRC.mjs.map +0 -1
  66. package/dist/chunk-SI3WI4AI.mjs.map +0 -1
  67. package/dist/chunk-T7CXLEBW.mjs.map +0 -1
  68. package/dist/chunk-WQ626PSA.mjs.map +0 -1
  69. package/dist/chunk-ZUOFHOX6.mjs.map +0 -1
@@ -5,32 +5,32 @@ import { createDescendant } from "@yamada-ui/use-descendant";
5
5
  import { createContext } from "@yamada-ui/utils";
6
6
  var {
7
7
  DescendantsContextProvider,
8
- useDescendantsContext: useMenuDescendantsContext,
8
+ useDescendant: useMenuDescendant,
9
9
  useDescendants,
10
- useDescendant: useMenuDescendant
10
+ useDescendantsContext: useMenuDescendantsContext
11
11
  } = createDescendant();
12
12
  var [MenuProvider, useMenu] = createContext({
13
13
  name: "MenuContext",
14
14
  errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />"`
15
15
  });
16
16
  var [ContextMenuProvider, useContextMenu] = createContext({
17
- strict: false,
18
- name: "ContextMenuContext"
17
+ name: "ContextMenuContext",
18
+ strict: false
19
19
  });
20
20
  var [UpstreamMenuProvider, useUpstreamMenu] = createContext({
21
- strict: false,
22
- name: "UpstreamMenuContext"
21
+ name: "UpstreamMenuContext",
22
+ strict: false
23
23
  });
24
24
  var [UpstreamMenuItemProvider, useUpstreamMenuItem] = createContext({
25
- strict: false,
26
- name: "UpstreamMenuItemContext"
25
+ name: "UpstreamMenuItemContext",
26
+ strict: false
27
27
  });
28
28
 
29
29
  export {
30
30
  DescendantsContextProvider,
31
- useMenuDescendantsContext,
32
- useDescendants,
33
31
  useMenuDescendant,
32
+ useDescendants,
33
+ useMenuDescendantsContext,
34
34
  MenuProvider,
35
35
  useMenu,
36
36
  ContextMenuProvider,
@@ -40,4 +40,4 @@ export {
40
40
  UpstreamMenuItemProvider,
41
41
  useUpstreamMenuItem
42
42
  };
43
- //# sourceMappingURL=chunk-ZUOFHOX6.mjs.map
43
+ //# sourceMappingURL=chunk-EJHOFPF4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/menu-context.ts"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport const {\n DescendantsContextProvider,\n useDescendant: useMenuDescendant,\n useDescendants,\n useDescendantsContext: useMenuDescendantsContext,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n focusedIndex: number\n isNested: boolean\n isOpen: boolean\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<null | number>\n setFocusedIndex: Dispatch<SetStateAction<number>>\n styles: { [key: string]: CSSUIObject | undefined }\n onClose: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n onOpen: () => void\n onUpstreamClose?: () => void\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 | undefined }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n name: \"ContextMenuContext\",\n strict: false,\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 name: \"UpstreamMenuContext\",\n strict: false,\n })\n\ninterface UpstreamMenuItemContext {\n hasDownstreamRef: MutableRefObject<boolean>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n onUpstreamRestoreFocus: () => void\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n name: \"UpstreamMenuItemContext\",\n strict: false,\n })\n"],"mappings":";;;AASA,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAEvB,IAAM;AAAA,EACX;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA,uBAAuB;AACzB,IAAI,iBAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,IAAI,cAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,IAC/C,cAAkC;AAAA,EAChC,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,IACjD,cAAmC;AAAA,EACjC,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,IACzD,cAAuC;AAAA,EACrC,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;","names":[]}
@@ -1,13 +1,13 @@
1
1
  "use client"
2
2
  import {
3
3
  Menu
4
- } from "./chunk-NNSVX2GX.mjs";
4
+ } from "./chunk-I2KIZ6OI.mjs";
5
5
  import {
6
6
  ContextMenuProvider
7
- } from "./chunk-ZUOFHOX6.mjs";
7
+ } from "./chunk-EJHOFPF4.mjs";
8
8
 
9
9
  // src/context-menu.tsx
10
- import { useComponentMultiStyle, omitThemeProps } from "@yamada-ui/core";
10
+ import { omitThemeProps, useComponentMultiStyle } from "@yamada-ui/core";
11
11
  import { jsx } from "react/jsx-runtime";
12
12
  var ContextMenu = (props) => {
13
13
  const [styles, mergedProps] = useComponentMultiStyle("ContextMenu", props);
@@ -18,4 +18,4 @@ var ContextMenu = (props) => {
18
18
  export {
19
19
  ContextMenu
20
20
  };
21
- //# sourceMappingURL=chunk-ZV73JKM5.mjs.map
21
+ //# sourceMappingURL=chunk-ELQD4RMJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/context-menu.tsx"],"sourcesContent":["import type { ThemeProps } from \"@yamada-ui/core\"\nimport { useComponentMultiStyle, omitThemeProps } from \"@yamada-ui/core\"\nimport type { FC } from \"react\"\nimport type { MenuProps } from \"./menu\"\nimport { Menu } from \"./menu\"\nimport { ContextMenuProvider } from \"./menu-context\"\n\nexport interface ContextMenuProps\n extends Omit<MenuProps, \"trigger\">,\n ThemeProps<\"ContextMenu\"> {}\n\n/**\n * `ContextMenu` is triggered by a right click and displays a menu at the pointer's position.\n *\n * @see Docs https://yamada-ui.com/components/overlay/context-menu\n */\nexport const ContextMenu: FC<ContextMenuProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"ContextMenu\", props)\n const { ...rest } = omitThemeProps(mergedProps)\n\n return (\n <ContextMenuProvider value={{ styles }}>\n <Menu trigger=\"contextmenu\" {...rest} />\n </ContextMenuProvider>\n )\n}\n"],"mappings":";;;;;;;;;AACA,SAAS,wBAAwB,sBAAsB;AAqBjD;AANC,IAAM,cAAoC,CAAC,UAAU;AAC1D,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,eAAe,KAAK;AACzE,QAAM,EAAE,GAAG,KAAK,IAAI,eAAe,WAAW;AAE9C,SACE,oBAAC,uBAAoB,OAAO,EAAE,OAAO,GACnC,8BAAC,QAAK,SAAQ,eAAe,GAAG,MAAM,GACxC;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/context-menu.tsx"],"sourcesContent":["import type { ThemeProps } from \"@yamada-ui/core\"\nimport type { FC } from \"react\"\nimport type { MenuProps } from \"./menu\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { Menu } from \"./menu\"\nimport { ContextMenuProvider } from \"./menu-context\"\n\nexport interface ContextMenuProps\n extends Omit<MenuProps, \"trigger\">,\n ThemeProps<\"ContextMenu\"> {}\n\n/**\n * `ContextMenu` is triggered by a right click and displays a menu at the pointer's position.\n *\n * @see Docs https://yamada-ui.com/components/overlay/context-menu\n */\nexport const ContextMenu: FC<ContextMenuProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"ContextMenu\", props)\n const { ...rest } = omitThemeProps(mergedProps)\n\n return (\n <ContextMenuProvider value={{ styles }}>\n <Menu trigger=\"contextmenu\" {...rest} />\n </ContextMenuProvider>\n )\n}\n"],"mappings":";;;;;;;;;AAGA,SAAS,gBAAgB,8BAA8B;AAmBjD;AANC,IAAM,cAAoC,CAAC,UAAU;AAC1D,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,eAAe,KAAK;AACzE,QAAM,EAAE,GAAG,KAAK,IAAI,eAAe,WAAW;AAE9C,SACE,oBAAC,uBAAoB,OAAO,EAAE,OAAO,GACnC,8BAAC,QAAK,SAAQ,eAAe,GAAG,MAAM,GACxC;AAEJ;","names":[]}
@@ -4,10 +4,10 @@ import {
4
4
  useMenu,
5
5
  useMenuDescendant,
6
6
  useUpstreamMenuItem
7
- } from "./chunk-ZUOFHOX6.mjs";
7
+ } from "./chunk-EJHOFPF4.mjs";
8
8
 
9
9
  // src/menu-item.tsx
10
- import { ui, forwardRef } from "@yamada-ui/core";
10
+ import { forwardRef, ui } from "@yamada-ui/core";
11
11
  import { useClickable } from "@yamada-ui/use-clickable";
12
12
  import {
13
13
  ariaAttr,
@@ -23,31 +23,31 @@ import { useCallback, useRef, useState } from "react";
23
23
  import { jsx, jsxs } from "react/jsx-runtime";
24
24
  var isTargetMenuItem = (target) => {
25
25
  var _a;
26
- return isHTMLElement(target) && !!((_a = target == null ? void 0 : target.getAttribute("role")) == null ? void 0 : _a.startsWith("menuitem"));
26
+ return isHTMLElement(target) && !!((_a = target.getAttribute("role")) == null ? void 0 : _a.startsWith("menuitem"));
27
27
  };
28
28
  var MenuItem = forwardRef(
29
29
  ({
30
30
  className,
31
- isDisabled,
32
- isFocusable,
31
+ children,
33
32
  closeOnSelect: customCloseOnSelect,
34
- icon,
35
33
  command,
36
- children,
34
+ icon,
35
+ isDisabled,
36
+ isFocusable,
37
37
  ...props
38
38
  }, ref) => {
39
39
  var _a;
40
40
  const {
41
+ closeOnSelect: generalCloseOnSelect,
41
42
  focusedIndex,
42
- setFocusedIndex,
43
+ isNested,
43
44
  isOpen,
44
- onClose,
45
- onUpstreamClose,
46
- closeOnSelect: generalCloseOnSelect,
47
45
  menuRef,
48
46
  requestAnimationFrameId,
49
- isNested,
50
- styles
47
+ setFocusedIndex,
48
+ styles,
49
+ onClose,
50
+ onUpstreamClose
51
51
  } = useMenu();
52
52
  const { onUpstreamRestoreFocus } = (_a = useUpstreamMenuItem()) != null ? _a : {};
53
53
  const trulyDisabled = isDisabled && !isFocusable;
@@ -102,14 +102,14 @@ var MenuItem = forwardRef(
102
102
  const rest = useClickable({
103
103
  focusOnClick: false,
104
104
  ...props,
105
+ ref: mergeRefs(register, itemRef, ref),
106
+ isDisabled,
107
+ isFocusable,
105
108
  onClick: handlerAll(props.onClick, onClick),
106
109
  onFocus: handlerAll(props.onFocus, onFocus),
107
- onMouseOver: handlerAll(props.onMouseOver, onMouseOver),
108
- onMouseLeave: handlerAll(props.onMouseLeave, onMouseLeave),
109
110
  onKeyDown: handlerAll(props.onKeyDown, onKeyDown, onKeyDownRef.current),
110
- ref: mergeRefs(register, itemRef, ref),
111
- isDisabled,
112
- isFocusable
111
+ onMouseLeave: handlerAll(props.onMouseLeave, onMouseLeave),
112
+ onMouseOver: handlerAll(props.onMouseOver, onMouseOver)
113
113
  });
114
114
  useUpdateEffect(() => {
115
115
  if (!isOpen) return;
@@ -130,35 +130,35 @@ var MenuItem = forwardRef(
130
130
  }, [isFocused, trulyDisabled, menuRef, isOpen]);
131
131
  children = icon || command ? /* @__PURE__ */ jsx(ui.span, { style: { flex: 1 }, children }) : children;
132
132
  const css = {
133
- textDecoration: "none",
133
+ alignItems: "center",
134
134
  color: "inherit",
135
- userSelect: "none",
136
135
  display: "flex",
137
- width: "100%",
138
- alignItems: "center",
139
- textAlign: "start",
140
136
  flex: "0 0 auto",
141
- outline: 0,
142
137
  gap: "0.75rem",
138
+ outline: 0,
139
+ textAlign: "start",
140
+ textDecoration: "none",
141
+ userSelect: "none",
142
+ width: "100%",
143
143
  ...styles.item
144
144
  };
145
145
  return /* @__PURE__ */ jsx(
146
146
  UpstreamMenuItemProvider,
147
147
  {
148
148
  value: {
149
- onKeyDownRef,
150
- onUpstreamRestoreFocus: onRestoreFocus,
149
+ hasDownstreamRef,
151
150
  setDownstreamOpen,
152
- hasDownstreamRef
151
+ onKeyDownRef,
152
+ onUpstreamRestoreFocus: onRestoreFocus
153
153
  },
154
154
  children: /* @__PURE__ */ jsxs(
155
155
  ui.li,
156
156
  {
157
157
  ...rest,
158
158
  ...isDownstreamOpen ? { "data-active": "" } : {},
159
+ className: cx("ui-menu__item", className),
159
160
  role: "menuitem",
160
161
  tabIndex: isFocused ? 0 : -1,
161
- className: cx("ui-menu__item", className),
162
162
  __css: css,
163
163
  children: [
164
164
  icon ? /* @__PURE__ */ jsx(MenuIcon, { children: icon }) : null,
@@ -172,14 +172,14 @@ var MenuItem = forwardRef(
172
172
  }
173
173
  );
174
174
  var MenuOptionItem = forwardRef(
175
- ({ className, icon, isChecked, closeOnSelect = false, children, ...rest }, ref) => {
175
+ ({ className, children, closeOnSelect = false, icon, isChecked, ...rest }, ref) => {
176
176
  return /* @__PURE__ */ jsxs(
177
177
  MenuItem,
178
178
  {
179
179
  ref,
180
180
  className: cx("ui-menu__item--option", className),
181
- "aria-checked": ariaAttr(isChecked),
182
181
  closeOnSelect,
182
+ "aria-checked": ariaAttr(isChecked),
183
183
  ...rest,
184
184
  children: [
185
185
  icon !== null ? /* @__PURE__ */ jsx(MenuIcon, { opacity: isChecked ? 1 : 0, children: icon || /* @__PURE__ */ jsx(CheckIcon, {}) }) : null,
@@ -193,11 +193,11 @@ var MenuIcon = forwardRef(
193
193
  ({ className, ...rest }, ref) => {
194
194
  const { styles } = useMenu();
195
195
  const css = {
196
- flexShrink: 0,
197
- display: "inline-flex",
198
- justifyContent: "center",
199
196
  alignItems: "center",
197
+ display: "inline-flex",
198
+ flexShrink: 0,
200
199
  fontSize: "0.85em",
200
+ justifyContent: "center",
201
201
  ...styles.icon
202
202
  };
203
203
  return /* @__PURE__ */ jsx(
@@ -226,7 +226,7 @@ var MenuCommand = forwardRef(
226
226
  );
227
227
  }
228
228
  );
229
- var CheckIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 14 14", width: "1em", height: "1em", children: /* @__PURE__ */ jsx(
229
+ var CheckIcon = () => /* @__PURE__ */ jsx("svg", { height: "1em", viewBox: "0 0 14 14", width: "1em", children: /* @__PURE__ */ jsx(
230
230
  "polygon",
231
231
  {
232
232
  fill: "currentColor",
@@ -240,4 +240,4 @@ export {
240
240
  MenuIcon,
241
241
  MenuCommand
242
242
  };
243
- //# sourceMappingURL=chunk-T7CXLEBW.mjs.map
243
+ //# sourceMappingURL=chunk-HEDZYLPX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/menu-item.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport type {\n FC,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n ReactElement,\n} from \"react\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { useClickable } from \"@yamada-ui/use-clickable\"\nimport {\n ariaAttr,\n cx,\n funcAll,\n handlerAll,\n isActiveElement,\n isHTMLElement,\n mergeRefs,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useRef, useState } from \"react\"\nimport {\n UpstreamMenuItemProvider,\n useMenu,\n useMenuDescendant,\n useUpstreamMenuItem,\n} from \"./menu-context\"\n\nconst isTargetMenuItem = (target: EventTarget | null) => {\n return (\n isHTMLElement(target) &&\n !!target.getAttribute(\"role\")?.startsWith(\"menuitem\")\n )\n}\n\ninterface MenuItemOptions {\n /**\n * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * Right-aligned label text content, useful for displaying hotkeys.\n */\n command?: string\n /**\n * The menu item icon to use.\n */\n icon?: ReactElement\n /**\n * If `true`, the menu item will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * If `true`, the menu item will be focusable.\n *\n * @default false\n */\n isFocusable?: boolean\n}\n\nexport interface MenuItemProps extends HTMLUIProps<\"li\">, MenuItemOptions {}\n\nexport const MenuItem = forwardRef<MenuItemProps, \"li\">(\n (\n {\n className,\n children,\n closeOnSelect: customCloseOnSelect,\n command,\n icon,\n isDisabled,\n isFocusable,\n ...props\n },\n ref,\n ) => {\n const {\n closeOnSelect: generalCloseOnSelect,\n focusedIndex,\n isNested,\n isOpen,\n menuRef,\n requestAnimationFrameId,\n setFocusedIndex,\n styles,\n onClose,\n onUpstreamClose,\n } = useMenu()\n const { onUpstreamRestoreFocus } = useUpstreamMenuItem() ?? {}\n\n const trulyDisabled = isDisabled && !isFocusable\n\n const itemRef = useRef<HTMLLIElement>(null)\n const hasDownstreamRef = useRef<boolean>(false)\n const onKeyDownRef = useRef<KeyboardEventHandler<HTMLLIElement>>(\n () => void 0,\n )\n const { index, register } = useMenuDescendant({ disabled: trulyDisabled })\n const [isDownstreamOpen, setDownstreamOpen] = useState<boolean>(false)\n\n const isFocused = index === focusedIndex\n\n const onMouseOver = useCallback(() => {\n if (isDisabled) return\n\n setFocusedIndex(index)\n }, [index, isDisabled, setFocusedIndex])\n\n const onMouseLeave = useCallback(() => {\n if (isDisabled) return\n\n setFocusedIndex(-1)\n }, [setFocusedIndex, isDisabled])\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLLIElement>) => {\n if (!isTargetMenuItem(ev.currentTarget)) return\n\n const hasDownstream = hasDownstreamRef.current\n\n if (customCloseOnSelect ?? (!hasDownstream && generalCloseOnSelect)) {\n onClose()\n onUpstreamClose?.()\n }\n },\n [customCloseOnSelect, generalCloseOnSelect, onClose, onUpstreamClose],\n )\n\n const onFocus = useCallback(() => {\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onRestoreFocus = useCallback(() => {\n itemRef.current?.focus()\n\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLLIElement>) => {\n const actions: { [key: string]: Function | undefined } = {\n ArrowLeft: isNested\n ? funcAll(onUpstreamRestoreFocus, onClose)\n : undefined,\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n ev.stopPropagation()\n\n action()\n },\n [onUpstreamRestoreFocus, onClose, isNested],\n )\n\n const rest = useClickable<HTMLLIElement>({\n focusOnClick: false,\n ...props,\n ref: mergeRefs(register, itemRef, ref),\n isDisabled,\n isFocusable,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown, onKeyDownRef.current),\n onMouseLeave: handlerAll(props.onMouseLeave, onMouseLeave),\n onMouseOver: handlerAll(props.onMouseOver, onMouseOver),\n })\n\n useUpdateEffect(() => {\n if (!isOpen) return\n\n const id = requestAnimationFrameId.current\n\n if (isFocused && !trulyDisabled && itemRef.current) {\n if (id) cancelAnimationFrame(id)\n\n requestAnimationFrameId.current = requestAnimationFrame(() => {\n itemRef.current?.focus({ preventScroll: true })\n\n requestAnimationFrameId.current = null\n })\n } else if (menuRef.current && !isActiveElement(menuRef.current)) {\n menuRef.current.focus({ preventScroll: true })\n }\n\n return () => {\n if (id) cancelAnimationFrame(id)\n }\n }, [isFocused, trulyDisabled, menuRef, isOpen])\n\n children =\n icon || command ? (\n <ui.span style={{ flex: 1 }}>{children}</ui.span>\n ) : (\n children\n )\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n color: \"inherit\",\n display: \"flex\",\n flex: \"0 0 auto\",\n gap: \"0.75rem\",\n outline: 0,\n textAlign: \"start\",\n textDecoration: \"none\",\n userSelect: \"none\",\n width: \"100%\",\n ...styles.item,\n }\n\n return (\n <UpstreamMenuItemProvider\n value={{\n hasDownstreamRef,\n setDownstreamOpen,\n onKeyDownRef,\n onUpstreamRestoreFocus: onRestoreFocus,\n }}\n >\n <ui.li\n {...rest}\n {...(isDownstreamOpen ? { \"data-active\": \"\" } : {})}\n className={cx(\"ui-menu__item\", className)}\n role=\"menuitem\"\n tabIndex={isFocused ? 0 : -1}\n __css={css}\n >\n {icon ? <MenuIcon>{icon}</MenuIcon> : null}\n {children}\n {command ? <MenuCommand>{command}</MenuCommand> : null}\n </ui.li>\n </UpstreamMenuItemProvider>\n )\n },\n)\n\ninterface MenuOptionItemOptions {\n /**\n * The type of the menu option item.\n */\n type?: \"checkbox\" | \"radio\"\n /**\n * The menu option item icon to use.\n */\n icon?: null | ReactElement\n /**\n * If `true`, the checkbox or radio will be checked.\n *\n * @default false\n */\n isChecked?: boolean\n /**\n * The value of the menu option item.\n */\n value?: string\n}\n\nexport interface MenuOptionItemProps\n extends Omit<MenuItemProps, \"command\" | \"icon\" | \"value\">,\n MenuOptionItemOptions {}\n\nexport const MenuOptionItem = forwardRef<MenuOptionItemProps, \"button\">(\n (\n { className, children, closeOnSelect = false, icon, isChecked, ...rest },\n ref,\n ) => {\n return (\n <MenuItem\n ref={ref}\n className={cx(\"ui-menu__item--option\", className)}\n closeOnSelect={closeOnSelect}\n aria-checked={ariaAttr(isChecked)}\n {...rest}\n >\n {icon !== null ? (\n <MenuIcon opacity={isChecked ? 1 : 0}>\n {icon || <CheckIcon />}\n </MenuIcon>\n ) : null}\n {children}\n </MenuItem>\n )\n },\n)\n\nexport interface MenuIconProps extends HTMLUIProps<\"span\"> {}\n\nexport const MenuIcon = forwardRef<MenuIconProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n flexShrink: 0,\n fontSize: \"0.85em\",\n justifyContent: \"center\",\n ...styles.icon,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-menu__item__icon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport interface MenuCommandProps extends HTMLUIProps<\"span\"> {}\n\nexport const MenuCommand = forwardRef<MenuCommandProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.command }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-menu__item__command\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nconst CheckIcon: FC = () => (\n <svg height=\"1em\" viewBox=\"0 0 14 14\" width=\"1em\">\n <polygon\n fill=\"currentColor\"\n points=\"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039\"\n />\n </svg>\n)\n"],"mappings":";;;;;;;;;AAQA,SAAS,YAAY,UAAU;AAC/B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,QAAQ,gBAAgB;AAmLtC,cA4BA,YA5BA;AA3KR,IAAM,mBAAmB,CAAC,WAA+B;AA5BzD;AA6BE,SACE,cAAc,MAAM,KACpB,CAAC,GAAC,YAAO,aAAa,MAAM,MAA1B,mBAA6B,WAAW;AAE9C;AAiCO,IAAM,WAAW;AAAA,EACtB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AA/EP;AAgFI,UAAM;AAAA,MACJ,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI,QAAQ;AACZ,UAAM,EAAE,uBAAuB,KAAI,yBAAoB,MAApB,YAAyB,CAAC;AAE7D,UAAM,gBAAgB,cAAc,CAAC;AAErC,UAAM,UAAU,OAAsB,IAAI;AAC1C,UAAM,mBAAmB,OAAgB,KAAK;AAC9C,UAAM,eAAe;AAAA,MACnB,MAAM;AAAA,IACR;AACA,UAAM,EAAE,OAAO,SAAS,IAAI,kBAAkB,EAAE,UAAU,cAAc,CAAC;AACzE,UAAM,CAAC,kBAAkB,iBAAiB,IAA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,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,UAAM,MAAmB,EAAE,GAAG,OAAO,QAAQ;AAE7C,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,0BAA0B,SAAS;AAAA,QACjD,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,IAAM,YAAgB,MACpB,oBAAC,SAAI,QAAO,OAAM,SAAQ,aAAY,OAAM,OAC1C;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,QAAO;AAAA;AACT,GACF;","names":["_a"]}
@@ -7,10 +7,10 @@ import {
7
7
  useDescendants,
8
8
  useUpstreamMenu,
9
9
  useUpstreamMenuItem
10
- } from "./chunk-ZUOFHOX6.mjs";
10
+ } from "./chunk-EJHOFPF4.mjs";
11
11
 
12
12
  // src/menu.tsx
13
- import { useComponentMultiStyle, omitThemeProps } from "@yamada-ui/core";
13
+ import { omitThemeProps, useComponentMultiStyle } from "@yamada-ui/core";
14
14
  import { Popover } from "@yamada-ui/popover";
15
15
  import { useDisclosure } from "@yamada-ui/use-disclosure";
16
16
  import { funcAll, useUnmountEffect, useUpdateEffect } from "@yamada-ui/utils";
@@ -24,18 +24,18 @@ var Menu = (props) => {
24
24
  styles: contextMenuStyles
25
25
  });
26
26
  let {
27
- initialFocusRef,
28
- closeOnSelect = true,
29
27
  closeOnBlur,
30
- placement,
28
+ closeOnSelect = true,
31
29
  duration = 0.2,
30
+ initialFocusRef,
32
31
  offset,
33
- onOpen: onOpenProp,
32
+ placement,
34
33
  onClose: onCloseProp,
34
+ onOpen: onOpenProp,
35
35
  ...rest
36
36
  } = omitThemeProps(mergedProps);
37
- const { relatedRef, onUpstreamClose, onDownstreamCloseMapRef } = (_b = useUpstreamMenu()) != null ? _b : {};
38
- const { setDownstreamOpen, hasDownstreamRef } = (_c = useUpstreamMenuItem()) != null ? _c : {};
37
+ const { relatedRef, onDownstreamCloseMapRef, onUpstreamClose } = (_b = useUpstreamMenu()) != null ? _b : {};
38
+ const { hasDownstreamRef, setDownstreamOpen } = (_c = useUpstreamMenuItem()) != null ? _c : {};
39
39
  const isNested = !!relatedRef;
40
40
  if (isNested) {
41
41
  placement != null ? placement : placement = "right-start";
@@ -85,10 +85,10 @@ var Menu = (props) => {
85
85
  }
86
86
  }, [onCloseProp]);
87
87
  const id = useId();
88
- const { isOpen, onOpen, onClose } = useDisclosure({
88
+ const { isOpen, onClose, onOpen } = useDisclosure({
89
89
  ...props,
90
- onOpen: onOpenInternal,
91
- onClose: onCloseInternal
90
+ onClose: onCloseInternal,
91
+ onOpen: onOpenInternal
92
92
  });
93
93
  useEffect(() => {
94
94
  const onCloseMap = onDownstreamCloseMapRef == null ? void 0 : onDownstreamCloseMapRef.current;
@@ -125,19 +125,19 @@ var Menu = (props) => {
125
125
  MenuProvider,
126
126
  {
127
127
  value: {
128
- isOpen,
129
- onOpen,
130
- onClose,
131
- onUpstreamClose,
132
- onFocusFirstItem,
133
- onFocusLastItem,
134
128
  closeOnSelect,
135
129
  focusedIndex,
136
- setFocusedIndex,
130
+ isNested,
131
+ isOpen,
137
132
  menuRef,
138
133
  requestAnimationFrameId,
139
- isNested,
140
- styles
134
+ setFocusedIndex,
135
+ styles,
136
+ onClose,
137
+ onFocusFirstItem,
138
+ onFocusLastItem,
139
+ onOpen,
140
+ onUpstreamClose
141
141
  },
142
142
  children: /* @__PURE__ */ jsx(
143
143
  Popover,
@@ -145,16 +145,16 @@ var Menu = (props) => {
145
145
  ...{
146
146
  trigger: isNested ? "hover" : "click",
147
147
  ...rest,
148
- isOpen,
149
- onOpen,
150
- onClose,
151
- placement,
152
- offset,
148
+ closeOnBlur,
149
+ closeOnButton: false,
153
150
  duration,
154
151
  initialFocusRef,
152
+ isOpen,
153
+ offset,
154
+ placement,
155
155
  relatedRef,
156
- closeOnButton: false,
157
- closeOnBlur
156
+ onClose,
157
+ onOpen
158
158
  }
159
159
  }
160
160
  )
@@ -167,4 +167,4 @@ var Menu = (props) => {
167
167
  export {
168
168
  Menu
169
169
  };
170
- //# sourceMappingURL=chunk-NNSVX2GX.mjs.map
170
+ //# sourceMappingURL=chunk-I2KIZ6OI.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu.tsx"],"sourcesContent":["import type { ThemeProps } from \"@yamada-ui/core\"\nimport { useComponentMultiStyle, omitThemeProps } from \"@yamada-ui/core\"\nimport type { PopoverProps } from \"@yamada-ui/popover\"\nimport { Popover } from \"@yamada-ui/popover\"\nimport { useDisclosure } from \"@yamada-ui/use-disclosure\"\nimport { funcAll, useUnmountEffect, useUpdateEffect } from \"@yamada-ui/utils\"\nimport type { FC } from \"react\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n DescendantsContextProvider,\n MenuProvider,\n UpstreamMenuProvider,\n useContextMenu,\n useDescendants,\n useUpstreamMenu,\n useUpstreamMenuItem,\n} from \"./menu-context\"\n\nexport interface 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 interface MenuProps\n extends 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] = useComponentMultiStyle(\"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":";;;;;;;;;;;;AACA,SAAS,wBAAwB,sBAAsB;AAEvD,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,SAAS,kBAAkB,uBAAuB;AAE3D,SAAS,aAAa,WAAW,OAAO,QAAQ,gBAAgB;AAiLtD;AAnJH,IAAM,OAAsB,CAAC,UAAU;AArC9C;AAsCE,QAAM,EAAE,QAAQ,kBAAkB,KAAI,oBAAe,MAAf,YAAoB,CAAC;AAC3D,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,QAAQ,OAAO;AAAA,IAClE,eAAe,CAAC,CAAC;AAAA,IACjB,QAAQ;AAAA,EACV,CAAC;AACD,MAAI;AAAA,IACF;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA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zB,iBAAiB,QAAQ,iBAAiB,OAAO;AAAA,MACnD;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,gBACF,SAAS,WAAW,UAAU;AAAA,gBAC9B,GAAG;AAAA,gBACH;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,eAAe;AAAA,gBACf;AAAA,cACF;AAAA;AAAA,UACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ;","names":["_a","id","onClose"]}
1
+ {"version":3,"sources":["../src/menu.tsx"],"sourcesContent":["import type { ThemeProps } from \"@yamada-ui/core\"\nimport type { PopoverProps } from \"@yamada-ui/popover\"\nimport type { FC } from \"react\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { Popover } from \"@yamada-ui/popover\"\nimport { useDisclosure } from \"@yamada-ui/use-disclosure\"\nimport { funcAll, useUnmountEffect, useUpdateEffect } from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n DescendantsContextProvider,\n MenuProvider,\n UpstreamMenuProvider,\n useContextMenu,\n useDescendants,\n useUpstreamMenu,\n useUpstreamMenuItem,\n} from \"./menu-context\"\n\nexport interface 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 interface MenuProps\n extends 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] = useComponentMultiStyle(\"Menu\", props, {\n isProcessSkip: !!contextMenuStyles,\n styles: contextMenuStyles,\n })\n let {\n closeOnBlur,\n closeOnSelect = true,\n duration = 0.2,\n initialFocusRef,\n offset,\n placement,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n ...rest\n } = omitThemeProps(mergedProps)\n const { relatedRef, onDownstreamCloseMapRef, onUpstreamClose } =\n useUpstreamMenu() ?? {}\n const { hasDownstreamRef, setDownstreamOpen } = 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<null | number>(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, onClose, onOpen } = useDisclosure({\n ...props,\n onClose: onCloseInternal,\n onOpen: onOpenInternal,\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 closeOnSelect,\n focusedIndex,\n isNested,\n isOpen,\n menuRef,\n requestAnimationFrameId,\n setFocusedIndex,\n styles,\n onClose,\n onFocusFirstItem,\n onFocusLastItem,\n onOpen,\n onUpstreamClose,\n }}\n >\n <Popover\n {...{\n trigger: isNested ? \"hover\" : \"click\",\n ...rest,\n closeOnBlur,\n closeOnButton: false,\n duration,\n initialFocusRef,\n isOpen,\n offset,\n placement,\n relatedRef,\n onClose,\n onOpen,\n }}\n />\n </MenuProvider>\n </UpstreamMenuProvider>\n </DescendantsContextProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,gBAAgB,8BAA8B;AACvD,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,SAAS,kBAAkB,uBAAuB;AAC3D,SAAS,aAAa,WAAW,OAA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IACnD;AAAA,EACF,CAAC;AAED,kBAAgB,MAAM;AACpB,QAAI,CAAC,OAAQ,iBAAgB,EAAE;AAAA,EACjC,GAAG,CAAC,MAAM,CAAC;AAEX,mBAAiB,MAAM;AACrB,eAAW,QAAQ,QAAQ,CAACD,QAAO,aAAaA,GAAE,CAAC;AACnD,eAAW,QAAQ,MAAM;AAAA,EAC3B,CAAC;AAED,SACE,oBAAC,8BAA2B,OAAO,aACjC;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,yBAAyB;AAAA,QACzB,iBAAiB,QAAQ,iBAAiB,OAAO;AAAA,MACnD;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,gBACF,SAAS,WAAW,UAAU;AAAA,gBAC9B,GAAG;AAAA,gBACH;AAAA,gBACA,eAAe;AAAA,gBACf;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,cACF;AAAA;AAAA,UACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ;","names":["_a","id","onClose"]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useMenu,
4
4
  useMenuDescendantsContext
5
- } from "./chunk-ZUOFHOX6.mjs";
5
+ } from "./chunk-EJHOFPF4.mjs";
6
6
 
7
7
  // src/menu-list.tsx
8
8
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -11,8 +11,8 @@ import { cx, handlerAll, mergeRefs } from "@yamada-ui/utils";
11
11
  import { useCallback } from "react";
12
12
  import { jsx } from "react/jsx-runtime";
13
13
  var MenuList = forwardRef(
14
- ({ className, contentProps, children, ...rest }, ref) => {
15
- const { menuRef, focusedIndex, setFocusedIndex, onClose, styles } = useMenu();
14
+ ({ className, children, contentProps, ...rest }, ref) => {
15
+ const { focusedIndex, menuRef, setFocusedIndex, styles, onClose } = useMenu();
16
16
  const descendants = useMenuDescendantsContext();
17
17
  const onNext = useCallback(() => {
18
18
  const next = descendants.enabledNextValue(focusedIndex);
@@ -33,12 +33,12 @@ var MenuList = forwardRef(
33
33
  const onKeyDown = useCallback(
34
34
  (ev) => {
35
35
  const actions = {
36
- Tab: (ev2) => ev2.preventDefault(),
37
- Escape: onClose,
38
36
  ArrowDown: focusedIndex === -1 ? onFirst : onNext,
39
37
  ArrowUp: focusedIndex === -1 ? onLast : onPrev,
38
+ End: onLast,
39
+ Escape: onClose,
40
40
  Home: onFirst,
41
- End: onLast
41
+ Tab: (ev2) => ev2.preventDefault()
42
42
  };
43
43
  const action = actions[ev.key];
44
44
  if (!action) return;
@@ -59,8 +59,8 @@ var MenuList = forwardRef(
59
59
  ui.ul,
60
60
  {
61
61
  ref: mergeRefs(menuRef, ref),
62
- role: "menu",
63
62
  className: cx("ui-menu__list", className),
63
+ role: "menu",
64
64
  tabIndex: -1,
65
65
  __css: { ...styles.list },
66
66
  ...rest,
@@ -75,4 +75,4 @@ var MenuList = forwardRef(
75
75
  export {
76
76
  MenuList
77
77
  };
78
- //# sourceMappingURL=chunk-O5D4LR5P.mjs.map
78
+ //# sourceMappingURL=chunk-I473RINV.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu-list.tsx"],"sourcesContent":["import type { HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport type { MotionPropsWithoutChildren } from \"@yamada-ui/motion\"\nimport { PopoverContent } from \"@yamada-ui/popover\"\nimport { cx, handlerAll, mergeRefs } from \"@yamada-ui/utils\"\nimport type { KeyboardEvent, KeyboardEventHandler } from \"react\"\nimport { useCallback } from \"react\"\nimport { useMenu, useMenuDescendantsContext } from \"./menu-context\"\n\nexport interface MenuListProps extends HTMLUIProps<\"ul\"> {\n contentProps?: MotionPropsWithoutChildren\n}\n\nexport const MenuList = forwardRef<MenuListProps, \"ul\">(\n ({ className, contentProps, children, ...rest }, ref) => {\n const { menuRef, focusedIndex, setFocusedIndex, onClose, styles } =\n useMenu()\n\n const descendants = useMenuDescendantsContext()\n\n const onNext = useCallback(() => {\n const next = descendants.enabledNextValue(focusedIndex)\n\n if (next) setFocusedIndex(next.index)\n }, [descendants, focusedIndex, setFocusedIndex])\n\n const onPrev = useCallback(() => {\n const prev = descendants.enabledPrevValue(focusedIndex)\n\n if (prev) setFocusedIndex(prev.index)\n }, [descendants, focusedIndex, setFocusedIndex])\n\n const onFirst = useCallback(() => {\n const first = descendants.enabledFirstValue()\n\n if (first) setFocusedIndex(first.index)\n }, [descendants, setFocusedIndex])\n\n const onLast = useCallback(() => {\n const last = descendants.enabledLastValue()\n\n if (last) setFocusedIndex(last.index)\n }, [descendants, setFocusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n const actions: { [key: string]: KeyboardEventHandler } = {\n Tab: (ev) => ev.preventDefault(),\n Escape: onClose,\n ArrowDown: focusedIndex === -1 ? onFirst : onNext,\n ArrowUp: focusedIndex === -1 ? onLast : onPrev,\n Home: onFirst,\n End: onLast,\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n action(ev)\n },\n [focusedIndex, onClose, onFirst, onLast, onNext, onPrev],\n )\n\n return (\n <PopoverContent\n as=\"div\"\n className=\"ui-menu__content\"\n __css={{ ...styles.content }}\n {...contentProps}\n onKeyDown={handlerAll(contentProps?.onKeyDown, onKeyDown)}\n >\n <ui.ul\n ref={mergeRefs(menuRef, ref)}\n role=\"menu\"\n className={cx(\"ui-menu__list\", className)}\n tabIndex={-1}\n __css={{ ...styles.list }}\n {...rest}\n >\n {children}\n </ui.ul>\n </PopoverContent>\n )\n },\n)\n"],"mappings":";;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Ae;AAClB,eAAO,EAAE;AAAA,MACX;AAAA,MACA,CAAC,cAAc,SAAS,SAAS,QAAQ,QAAQ,MAAM;AAAA,IACzD;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAG;AAAA,QACH,WAAU;AAAA,QACV,OAAO,EAAE,GAAG,OAAO,QAAQ;AAAA,QAC1B,GAAG;AAAA,QACJ,WAAW,WAAW,6CAAc,WAAW,SAAS;AAAA,QAExD;AAAA,UAAC,GAAG;AAAA,UAAH;AAAA,YACC,KAAK,UAAU,SAAS,GAAG;AAAA,YAC3B,MAAK;AAAA,YACL,WAAW,GAAG,iBAAiB,SAAS;AAAA,YACxC,UAAU;AAAA,YACV,OAAO,EAAE,GAAG,OAAO,KAAK;AAAA,YACvB,GAAG;AAAA,YAEH;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;","names":["ev"]}
1
+ {"version":3,"sources":["../src/menu-list.tsx"],"sourcesContent":["import type { HTMLUIProps } from \"@yamada-ui/core\"\nimport type { MotionPropsWithoutChildren } from \"@yamada-ui/motion\"\nimport type { KeyboardEvent, KeyboardEventHandler } from \"react\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { PopoverContent } from \"@yamada-ui/popover\"\nimport { cx, handlerAll, mergeRefs } from \"@yamada-ui/utils\"\nimport { useCallback } from \"react\"\nimport { useMenu, useMenuDescendantsContext } from \"./menu-context\"\n\nexport interface MenuListProps extends HTMLUIProps<\"ul\"> {\n contentProps?: MotionPropsWithoutChildren\n}\n\nexport const MenuList = forwardRef<MenuListProps, \"ul\">(\n ({ className, children, contentProps, ...rest }, ref) => {\n const { focusedIndex, menuRef, setFocusedIndex, styles, onClose } =\n useMenu()\n\n const descendants = useMenuDescendantsContext()\n\n const onNext = useCallback(() => {\n const next = descendants.enabledNextValue(focusedIndex)\n\n if (next) setFocusedIndex(next.index)\n }, [descendants, focusedIndex, setFocusedIndex])\n\n const onPrev = useCallback(() => {\n const prev = descendants.enabledPrevValue(focusedIndex)\n\n if (prev) setFocusedIndex(prev.index)\n }, [descendants, focusedIndex, setFocusedIndex])\n\n const onFirst = useCallback(() => {\n const first = descendants.enabledFirstValue()\n\n if (first) setFocusedIndex(first.index)\n }, [descendants, setFocusedIndex])\n\n const onLast = useCallback(() => {\n const last = descendants.enabledLastValue()\n\n if (last) setFocusedIndex(last.index)\n }, [descendants, setFocusedIndex])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n const actions: { [key: string]: KeyboardEventHandler } = {\n ArrowDown: focusedIndex === -1 ? onFirst : onNext,\n ArrowUp: focusedIndex === -1 ? onLast : onPrev,\n End: onLast,\n Escape: onClose,\n Home: onFirst,\n Tab: (ev) => ev.preventDefault(),\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n action(ev)\n },\n [focusedIndex, onClose, onFirst, onLast, onNext, onPrev],\n )\n\n return (\n <PopoverContent\n as=\"div\"\n className=\"ui-menu__content\"\n __css={{ ...styles.content }}\n {...contentProps}\n onKeyDown={handlerAll(contentProps?.onKeyDown, onKeyDown)}\n >\n <ui.ul\n ref={mergeRefs(menuRef, ref)}\n className={cx(\"ui-menu__list\", className)}\n role=\"menu\"\n tabIndex={-1}\n __css={{ ...styles.list }}\n {...rest}\n >\n {children}\n </ui.ul>\n </PopoverContent>\n )\n },\n)\n"],"mappings":";;;;;;;AAGA,SAAS,YAAY,UAAU;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,IAAI,YAAY,iBAAiB;AAC1C,SAAS,mBAAmB;AAmEpB;AA5DD,IAAM,WAAW;AAAA,EACtB,CAAC,EAAE,WAAW,UAAU,cAAc,GAAG,KAAK,GAAG,QAAQ;AACvD,UAAM,EAAE,cAAc,SAAS,iBAAiB,QAAQ,QAAQ,IAC9D,QAAQ;AAEV,UAAM,cAAc,0BAA0B;AAE9C,UAAM,SAAS,YAAY,MAAM;AAC/B,YAAM,OAAO,YAAY,iBAAiB,YAAY;AAEtD,UAAI,KAAM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;AAAA,YACxC,MAAK;AAAA,YACL,UAAU;AAAA,YACV,OAAO,EAAE,GAAG,OAAO,KAAK;AAAA,YACvB,GAAG;AAAA,YAEH;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;","names":["ev"]}
@@ -1,10 +1,10 @@
1
1
  "use client"
2
2
  import {
3
3
  useMenu
4
- } from "./chunk-ZUOFHOX6.mjs";
4
+ } from "./chunk-EJHOFPF4.mjs";
5
5
 
6
6
  // src/menu-divider.tsx
7
- import { ui, forwardRef } from "@yamada-ui/core";
7
+ import { forwardRef, ui } from "@yamada-ui/core";
8
8
  import { cx } from "@yamada-ui/utils";
9
9
  import { jsx } from "react/jsx-runtime";
10
10
  var MenuDivider = forwardRef(
@@ -26,4 +26,4 @@ var MenuDivider = forwardRef(
26
26
  export {
27
27
  MenuDivider
28
28
  };
29
- //# sourceMappingURL=chunk-OFCEMPQW.mjs.map
29
+ //# sourceMappingURL=chunk-KZAACFSL.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu-divider.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-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"],"mappings":";;;;;;AACA,SAAS,IAAI,kBAAkB;AAC/B,SAAS,UAAU;AAYb;AAPC,IAAM,cAAc;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,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,oBAAoB,SAAS;AAAA,QAC3C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/menu-divider.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } 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"],"mappings":";;;;;;AACA,SAAS,YAAY,UAAU;AAC/B,SAAS,UAAU;AAYb;AAPC,IAAM,cAAc;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,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,oBAAoB,SAAS;AAAA,QAC3C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":[]}
@@ -1,14 +1,14 @@
1
1
  "use client"
2
2
  import {
3
3
  useMenu
4
- } from "./chunk-ZUOFHOX6.mjs";
4
+ } from "./chunk-EJHOFPF4.mjs";
5
5
 
6
6
  // src/menu-group.tsx
7
- import { ui, forwardRef } from "@yamada-ui/core";
7
+ import { forwardRef, ui } from "@yamada-ui/core";
8
8
  import { cx } from "@yamada-ui/utils";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  var MenuGroup = forwardRef(
11
- ({ className, label, children, labelProps, ...rest }, ref) => {
11
+ ({ className, children, label, labelProps, ...rest }, ref) => {
12
12
  const { styles } = useMenu();
13
13
  const css = { ...styles.group };
14
14
  return /* @__PURE__ */ jsxs(
@@ -39,4 +39,4 @@ var MenuGroup = forwardRef(
39
39
  export {
40
40
  MenuGroup
41
41
  };
42
- //# sourceMappingURL=chunk-HVOHR2NQ.mjs.map
42
+ //# sourceMappingURL=chunk-O7MHNHWF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu-group.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-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"],"mappings":";;;;;;AACA,SAAS,IAAI,kBAAkB;AAC/B,SAAS,UAAU;AAqBb,SAQI,KARJ;AAPC,IAAM,YAAY;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,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,iBAAiB,wBAAwB,SAAS;AAAA,QAChE,MAAK;AAAA,QACL,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA,kBACC;AAAA,YAAC,GAAG;AAAA,YAAH;AAAA,cACC,WAAW,GAAG,4BAA4B;AAAA,cAC1C,OAAO,OAAO;AAAA,cACb,GAAG;AAAA,cAEH;AAAA;AAAA,UACH,IACE;AAAA,UAEJ,oBAAC,GAAG,IAAH,EAAM,WAAU,wBAAwB,UAAS;AAAA;AAAA;AAAA,IACpD;AAAA,EAEJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/menu-group.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } 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, children, label, 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"],"mappings":";;;;;;AACA,SAAS,YAAY,UAAU;AAC/B,SAAS,UAAU;AAqBb,SAQI,KARJ;AAPC,IAAM,YAAY;AAAA,EACvB,CAAC,EAAE,WAAW,UAAU,OAAO,YAAY,GAAG,KAAK,GAAG,QAAQ;AAC5D,UAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,UAAM,MAAmB,EAAE,GAAG,OAAO,MAAM;AAE3C,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,iBAAiB,wBAAwB,SAAS;AAAA,QAChE,MAAK;AAAA,QACL,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA,kBACC;AAAA,YAAC,GAAG;AAAA,YAAH;AAAA,cACC,WAAW,GAAG,4BAA4B;AAAA,cAC1C,OAAO,OAAO;AAAA,cACb,GAAG;AAAA,cAEH;AAAA;AAAA,UACH,IACE;AAAA,UAEJ,oBAAC,GAAG,IAAH,EAAM,WAAU,wBAAwB,UAAS;AAAA;AAAA;AAAA,IACpD;AAAA,EAEJ;AACF;","names":[]}
@@ -1,10 +1,10 @@
1
1
  "use client"
2
2
  import {
3
3
  MenuGroup
4
- } from "./chunk-HVOHR2NQ.mjs";
4
+ } from "./chunk-O7MHNHWF.mjs";
5
5
  import {
6
6
  MenuOptionItem
7
- } from "./chunk-T7CXLEBW.mjs";
7
+ } from "./chunk-HEDZYLPX.mjs";
8
8
 
9
9
  // src/menu-option-group.tsx
10
10
  import { useControllableState } from "@yamada-ui/use-controllable-state";
@@ -13,19 +13,19 @@ import { cloneElement, forwardRef, useCallback } from "react";
13
13
  import { jsx } from "react/jsx-runtime";
14
14
  var MenuOptionGroup = forwardRef(
15
15
  ({
16
+ type,
16
17
  className,
17
- value: valueProp,
18
+ children,
18
19
  defaultValue,
20
+ value: valueProp,
19
21
  onChange: onChangeProp,
20
- type,
21
- children,
22
22
  ...rest
23
23
  }, ref) => {
24
24
  const isRadio = type === "radio";
25
25
  defaultValue != null ? defaultValue : defaultValue = isRadio ? "" : [];
26
26
  const [value, setValue] = useControllableState({
27
- value: valueProp,
28
27
  defaultValue,
28
+ value: valueProp,
29
29
  onChange: onChangeProp
30
30
  });
31
31
  const onChange = useCallback(
@@ -47,7 +47,7 @@ var MenuOptionGroup = forwardRef(
47
47
  (_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a, ev);
48
48
  };
49
49
  const isChecked = !isRadio && isArray(value) ? value.includes(child.props.value) : child.props.value === value;
50
- return cloneElement(child, { type, onClick, isChecked });
50
+ return cloneElement(child, { type, isChecked, onClick });
51
51
  });
52
52
  return /* @__PURE__ */ jsx(
53
53
  MenuGroup,
@@ -65,4 +65,4 @@ MenuOptionGroup.displayName = "MenuOptionGroup";
65
65
  export {
66
66
  MenuOptionGroup
67
67
  };
68
- //# sourceMappingURL=chunk-SI3WI4AI.mjs.map
68
+ //# sourceMappingURL=chunk-OETJECD3.mjs.map