@yamada-ui/menu 1.0.24-dev-20240418191913 → 1.1.0-dev-20240420143734

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/{chunk-3I42NCZV.mjs → chunk-ATDFQB5W.mjs} +2 -2
  2. package/dist/{chunk-J4OG7DMN.mjs → chunk-B6YWHVG4.mjs} +2 -2
  3. package/dist/{chunk-D6AU4S44.mjs → chunk-JHE6GKYD.mjs} +2 -2
  4. package/dist/chunk-KRNJ4HQH.mjs +63720 -0
  5. package/dist/chunk-KRNJ4HQH.mjs.map +1 -0
  6. package/dist/chunk-RX3BDZRV.mjs +521 -0
  7. package/dist/chunk-RX3BDZRV.mjs.map +1 -0
  8. package/dist/{chunk-6OASXRNF.mjs → chunk-ZADUBQ5D.mjs} +3 -3
  9. package/dist/index.d.mts +3 -3
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +63402 -357
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +14 -10
  14. package/dist/menu-button.d.mts +9 -1
  15. package/dist/menu-button.d.ts +9 -1
  16. package/dist/menu-button.js +63519 -47
  17. package/dist/menu-button.js.map +1 -1
  18. package/dist/menu-button.mjs +10 -4
  19. package/dist/menu-divider.js +4 -0
  20. package/dist/menu-divider.js.map +1 -1
  21. package/dist/menu-divider.mjs +2 -2
  22. package/dist/menu-group.js +4 -0
  23. package/dist/menu-group.js.map +1 -1
  24. package/dist/menu-group.mjs +2 -2
  25. package/dist/menu-item.d.mts +15 -2
  26. package/dist/menu-item.d.ts +15 -2
  27. package/dist/menu-item.js +132 -22
  28. package/dist/menu-item.js.map +1 -1
  29. package/dist/menu-item.mjs +11 -4
  30. package/dist/menu-list.js +4 -0
  31. package/dist/menu-list.js.map +1 -1
  32. package/dist/menu-list.mjs +2 -2
  33. package/dist/menu-option-group.js +196 -92
  34. package/dist/menu-option-group.js.map +1 -1
  35. package/dist/menu-option-group.mjs +3 -4
  36. package/dist/menu.d.mts +19 -9
  37. package/dist/menu.d.ts +19 -9
  38. package/dist/menu.js +391 -50
  39. package/dist/menu.js.map +1 -1
  40. package/dist/menu.mjs +7 -3
  41. package/package.json +3 -3
  42. package/dist/chunk-SP4GE4RO.mjs +0 -190
  43. package/dist/chunk-SP4GE4RO.mjs.map +0 -1
  44. package/dist/chunk-SUYEIZLL.mjs +0 -61
  45. package/dist/chunk-SUYEIZLL.mjs.map +0 -1
  46. package/dist/chunk-TWAYMPIS.mjs +0 -123
  47. package/dist/chunk-TWAYMPIS.mjs.map +0 -1
  48. /package/dist/{chunk-3I42NCZV.mjs.map → chunk-ATDFQB5W.mjs.map} +0 -0
  49. /package/dist/{chunk-J4OG7DMN.mjs.map → chunk-B6YWHVG4.mjs.map} +0 -0
  50. /package/dist/{chunk-D6AU4S44.mjs.map → chunk-JHE6GKYD.mjs.map} +0 -0
  51. /package/dist/{chunk-6OASXRNF.mjs.map → chunk-ZADUBQ5D.mjs.map} +0 -0
package/dist/menu.d.ts CHANGED
@@ -1,12 +1,7 @@
1
+ import * as react from 'react';
2
+ import { FC, Dispatch, SetStateAction, RefObject, MutableRefObject } from 'react';
1
3
  import { ThemeProps, CSSUIObject } from '@yamada-ui/core';
2
4
  import { PopoverProps } from '@yamada-ui/popover';
3
- import { FC, Dispatch, SetStateAction, RefObject } from 'react';
4
-
5
- /**
6
- * `Menu` is a component that displays a common dropdown menu.
7
- *
8
- * @see Docs https://yamada-ui.com/components/overlay/menu
9
- */
10
5
 
11
6
  declare const useMenuDescendantsContext: () => {
12
7
  register: (nodeOrOptions: HTMLElement | {
@@ -2122,14 +2117,24 @@ type MenuContext = MenuOptions & {
2122
2117
  isOpen: boolean;
2123
2118
  onOpen: () => void;
2124
2119
  onClose: () => void;
2120
+ onUpstreamClose?: () => void;
2125
2121
  onFocusFirstItem: () => void;
2126
2122
  onFocusLastItem: () => void;
2127
2123
  focusedIndex: number;
2128
2124
  setFocusedIndex: Dispatch<SetStateAction<number>>;
2129
2125
  menuRef: RefObject<HTMLDivElement>;
2126
+ requestAnimationFrameId: MutableRefObject<number | null>;
2127
+ isNested: boolean;
2130
2128
  styles: Record<string, CSSUIObject>;
2131
2129
  };
2132
2130
  declare const useMenu: () => MenuContext;
2131
+ type UpstreamMenuContext = {
2132
+ relatedRef: RefObject<HTMLElement>;
2133
+ onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>;
2134
+ onUpstreamClose: () => void;
2135
+ };
2136
+ declare const UpstreamMenuProvider: react.Provider<UpstreamMenuContext>;
2137
+ declare const useUpstreamMenu: () => UpstreamMenuContext;
2133
2138
 
2134
2139
  type MenuOptions = {
2135
2140
  /**
@@ -2139,7 +2144,12 @@ type MenuOptions = {
2139
2144
  */
2140
2145
  closeOnSelect?: boolean;
2141
2146
  };
2142
- type MenuProps = ThemeProps<"Menu"> & Omit<PopoverProps, "closeOnButton"> & MenuOptions;
2147
+ type MenuProps = ThemeProps<"Menu"> & Omit<PopoverProps, "closeOnButton" | "relatedRef"> & MenuOptions;
2148
+ /**
2149
+ * `Menu` is a component that displays a common dropdown menu.
2150
+ *
2151
+ * @see Docs https://yamada-ui.com/components/overlay/menu
2152
+ */
2143
2153
  declare const Menu: FC<MenuProps>;
2144
2154
 
2145
- export { Menu, type MenuProps, useMenu, useMenuDescendant, useMenuDescendantsContext };
2155
+ export { Menu, type MenuProps, UpstreamMenuProvider, useMenu, useMenuDescendant, useMenuDescendantsContext, useUpstreamMenu };
package/dist/menu.js CHANGED
@@ -22,114 +22,453 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var menu_exports = {};
23
23
  __export(menu_exports, {
24
24
  Menu: () => Menu,
25
+ UpstreamMenuProvider: () => UpstreamMenuProvider,
25
26
  useMenu: () => useMenu,
26
27
  useMenuDescendant: () => useMenuDescendant,
27
- useMenuDescendantsContext: () => useMenuDescendantsContext
28
+ useMenuDescendantsContext: () => useMenuDescendantsContext,
29
+ useUpstreamMenu: () => useUpstreamMenu
28
30
  });
29
31
  module.exports = __toCommonJS(menu_exports);
30
- var import_core = require("@yamada-ui/core");
32
+ var import_core2 = require("@yamada-ui/core");
31
33
  var import_popover = require("@yamada-ui/popover");
32
34
  var import_use_descendant = require("@yamada-ui/use-descendant");
33
35
  var import_use_disclosure = require("@yamada-ui/use-disclosure");
36
+ var import_utils2 = require("@yamada-ui/utils");
37
+ var import_react2 = require("react");
38
+
39
+ // src/menu-item.tsx
40
+ var import_core = require("@yamada-ui/core");
41
+ var import_use_clickable = require("@yamada-ui/use-clickable");
34
42
  var import_utils = require("@yamada-ui/utils");
35
43
  var import_react = require("react");
36
44
  var import_jsx_runtime = require("react/jsx-runtime");
45
+ var [UpstreamMenuItemProvider, useUpstreamMenuItem] = (0, import_utils.createContext)({
46
+ strict: false,
47
+ name: "UpstreamMenuItemContext"
48
+ });
49
+ var isTargetMenuItem = (target) => {
50
+ var _a;
51
+ return (0, import_utils.isHTMLElement)(target) && !!((_a = target == null ? void 0 : target.getAttribute("role")) == null ? void 0 : _a.startsWith("menu-item"));
52
+ };
53
+ var MenuItem = (0, import_core.forwardRef)(
54
+ ({
55
+ as,
56
+ className,
57
+ type,
58
+ isDisabled,
59
+ isFocusable,
60
+ closeOnSelect: customCloseOnSelect,
61
+ icon,
62
+ command,
63
+ children,
64
+ onClick: onClickProp,
65
+ onFocus: onFocusProp,
66
+ onMouseEnter: onMouseEnterProp,
67
+ onMouseMove: onMouseMoveProp,
68
+ onMouseLeave: onMouseLeaveProp,
69
+ onKeyDown: onKeyDownProp,
70
+ ...props
71
+ }, ref) => {
72
+ var _a;
73
+ const {
74
+ focusedIndex,
75
+ setFocusedIndex,
76
+ isOpen,
77
+ onClose,
78
+ onUpstreamClose,
79
+ closeOnSelect: generalCloseOnSelect,
80
+ menuRef,
81
+ requestAnimationFrameId,
82
+ isNested,
83
+ styles
84
+ } = useMenu();
85
+ const { onUpstreamRestoreFocus } = (_a = useUpstreamMenuItem()) != null ? _a : {};
86
+ const trulyDisabled = isDisabled && !isFocusable;
87
+ const buttonRef = (0, import_react.useRef)(null);
88
+ const hasDownstreamRef = (0, import_react.useRef)(false);
89
+ const onKeyDownRef = (0, import_react.useRef)(
90
+ () => void 0
91
+ );
92
+ const { index, register } = useMenuDescendant({ disabled: trulyDisabled });
93
+ const [isDownstreamOpen, setDownstreamOpen] = (0, import_react.useState)(false);
94
+ const isFocused = index === focusedIndex;
95
+ const onMouseEnter = (0, import_react.useCallback)(
96
+ (event) => {
97
+ onMouseEnterProp == null ? void 0 : onMouseEnterProp(event);
98
+ if (isDisabled)
99
+ return;
100
+ setFocusedIndex(index);
101
+ },
102
+ [setFocusedIndex, index, isDisabled, onMouseEnterProp]
103
+ );
104
+ const onMouseMove = (0, import_react.useCallback)(
105
+ (event) => {
106
+ onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
107
+ if (buttonRef.current && !(0, import_utils.isActiveElement)(buttonRef.current))
108
+ onMouseEnter(event);
109
+ },
110
+ [onMouseEnter, onMouseMoveProp]
111
+ );
112
+ const onMouseLeave = (0, import_react.useCallback)(
113
+ (event) => {
114
+ onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
115
+ if (isDisabled)
116
+ return;
117
+ setFocusedIndex(-1);
118
+ },
119
+ [setFocusedIndex, isDisabled, onMouseLeaveProp]
120
+ );
121
+ const onClick = (0, import_react.useCallback)(
122
+ (ev) => {
123
+ onClickProp == null ? void 0 : onClickProp(ev);
124
+ if (!isTargetMenuItem(ev.currentTarget))
125
+ return;
126
+ const hasDownstream = hasDownstreamRef.current;
127
+ if (customCloseOnSelect != null ? customCloseOnSelect : !hasDownstream && generalCloseOnSelect) {
128
+ onClose();
129
+ onUpstreamClose == null ? void 0 : onUpstreamClose();
130
+ }
131
+ },
132
+ [
133
+ onClickProp,
134
+ customCloseOnSelect,
135
+ generalCloseOnSelect,
136
+ onClose,
137
+ onUpstreamClose
138
+ ]
139
+ );
140
+ const onFocus = (0, import_react.useCallback)(
141
+ (ev) => {
142
+ onFocusProp == null ? void 0 : onFocusProp(ev);
143
+ setFocusedIndex(index);
144
+ },
145
+ [onFocusProp, setFocusedIndex, index]
146
+ );
147
+ const onRestoreFocus = (0, import_react.useCallback)(() => {
148
+ var _a2;
149
+ (_a2 = buttonRef.current) == null ? void 0 : _a2.focus();
150
+ setFocusedIndex(index);
151
+ }, [setFocusedIndex, index]);
152
+ const onKeyDown = (0, import_react.useCallback)(
153
+ (ev) => {
154
+ onKeyDownProp == null ? void 0 : onKeyDownProp(ev);
155
+ const actions = {
156
+ ArrowLeft: isNested ? (0, import_utils.funcAll)(onUpstreamRestoreFocus, onClose) : void 0
157
+ };
158
+ const action = actions[ev.key];
159
+ if (!action)
160
+ return;
161
+ ev.preventDefault();
162
+ ev.stopPropagation();
163
+ action();
164
+ },
165
+ [onKeyDownProp, onUpstreamRestoreFocus, onClose, isNested]
166
+ );
167
+ const rest = (0, import_use_clickable.useClickable)({
168
+ focusOnClick: false,
169
+ ...props,
170
+ onClick,
171
+ onFocus,
172
+ onMouseEnter,
173
+ onMouseMove,
174
+ onMouseLeave,
175
+ onKeyDown: (0, import_utils.handlerAll)(onKeyDown, onKeyDownRef.current),
176
+ ref: (0, import_utils.mergeRefs)(register, buttonRef, ref),
177
+ isDisabled,
178
+ isFocusable
179
+ });
180
+ (0, import_utils.useUpdateEffect)(() => {
181
+ if (!isOpen)
182
+ return;
183
+ const id = requestAnimationFrameId.current;
184
+ if (isFocused && !trulyDisabled && buttonRef.current) {
185
+ if (id)
186
+ cancelAnimationFrame(id);
187
+ requestAnimationFrameId.current = requestAnimationFrame(() => {
188
+ var _a2;
189
+ (_a2 = buttonRef.current) == null ? void 0 : _a2.focus({ preventScroll: true });
190
+ requestAnimationFrameId.current = null;
191
+ });
192
+ } else if (menuRef.current && !(0, import_utils.isActiveElement)(menuRef.current)) {
193
+ menuRef.current.focus({ preventScroll: true });
194
+ }
195
+ return () => {
196
+ if (id)
197
+ cancelAnimationFrame(id);
198
+ };
199
+ }, [isFocused, trulyDisabled, menuRef, isOpen]);
200
+ type = as || type ? type != null ? type : void 0 : "button";
201
+ children = icon || command ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.span, { style: { flex: 1 }, children }) : children;
202
+ const css = {
203
+ textDecoration: "none",
204
+ color: "inherit",
205
+ userSelect: "none",
206
+ display: "flex",
207
+ width: "100%",
208
+ alignItems: "center",
209
+ textAlign: "start",
210
+ flex: "0 0 auto",
211
+ outline: 0,
212
+ gap: "0.75rem",
213
+ ...styles.item
214
+ };
215
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
216
+ UpstreamMenuItemProvider,
217
+ {
218
+ value: {
219
+ onKeyDownRef,
220
+ onUpstreamRestoreFocus: onRestoreFocus,
221
+ setDownstreamOpen,
222
+ hasDownstreamRef
223
+ },
224
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
225
+ import_core.ui.li,
226
+ {
227
+ ...rest,
228
+ ...isDownstreamOpen ? { "data-active": "" } : {},
229
+ as,
230
+ type,
231
+ role: "menu-item",
232
+ tabIndex: isFocused ? 0 : -1,
233
+ className: (0, import_utils.cx)("ui-menu__item", className),
234
+ __css: css,
235
+ children: [
236
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuIcon, { children: icon }) : null,
237
+ children,
238
+ command ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuCommand, { children: command }) : null
239
+ ]
240
+ }
241
+ )
242
+ }
243
+ );
244
+ }
245
+ );
246
+ var MenuOptionItem = (0, import_core.forwardRef)(
247
+ ({ className, icon, isChecked, closeOnSelect = false, children, ...rest }, ref) => {
248
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
249
+ MenuItem,
250
+ {
251
+ ref,
252
+ className: (0, import_utils.cx)("ui-menu__item--option", className),
253
+ "aria-checked": (0, import_utils.ariaAttr)(isChecked),
254
+ closeOnSelect,
255
+ ...rest,
256
+ children: [
257
+ icon !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuIcon, { opacity: isChecked ? 1 : 0, children: icon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckIcon, {}) }) : null,
258
+ children
259
+ ]
260
+ }
261
+ );
262
+ }
263
+ );
264
+ var MenuIcon = (0, import_core.forwardRef)(
265
+ ({ className, ...rest }, ref) => {
266
+ const { styles } = useMenu();
267
+ const css = {
268
+ flexShrink: 0,
269
+ display: "inline-flex",
270
+ justifyContent: "center",
271
+ alignItems: "center",
272
+ fontSize: "0.85em",
273
+ ...styles.icon
274
+ };
275
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
276
+ import_core.ui.span,
277
+ {
278
+ ref,
279
+ className: (0, import_utils.cx)("ui-menu__item__icon", className),
280
+ __css: css,
281
+ ...rest
282
+ }
283
+ );
284
+ }
285
+ );
286
+ var MenuCommand = (0, import_core.forwardRef)(
287
+ ({ className, ...rest }, ref) => {
288
+ const { styles } = useMenu();
289
+ const css = { ...styles.command };
290
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
291
+ import_core.ui.span,
292
+ {
293
+ ref,
294
+ className: (0, import_utils.cx)("ui-menu__item__command", className),
295
+ __css: css,
296
+ ...rest
297
+ }
298
+ );
299
+ }
300
+ );
301
+ var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 14 14", width: "1em", height: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
302
+ "polygon",
303
+ {
304
+ fill: "currentColor",
305
+ points: "5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"
306
+ }
307
+ ) });
308
+
309
+ // src/menu.tsx
310
+ var import_jsx_runtime2 = require("react/jsx-runtime");
37
311
  var {
38
312
  DescendantsContextProvider,
39
313
  useDescendantsContext: useMenuDescendantsContext,
40
314
  useDescendants,
41
315
  useDescendant: useMenuDescendant
42
316
  } = (0, import_use_descendant.createDescendant)();
43
- var [MenuProvider, useMenu] = (0, import_utils.createContext)({
317
+ var [MenuProvider, useMenu] = (0, import_utils2.createContext)({
44
318
  name: "MenuContext",
45
319
  errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />"`
46
320
  });
321
+ var [UpstreamMenuProvider, useUpstreamMenu] = (0, import_utils2.createContext)({
322
+ strict: false,
323
+ name: "UpstreamMenuContext"
324
+ });
47
325
  var Menu = (props) => {
48
- const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Menu", props);
49
- const {
326
+ var _a, _b;
327
+ const [styles, mergedProps] = (0, import_core2.useMultiComponentStyle)("Menu", props);
328
+ let {
50
329
  initialFocusRef,
51
330
  closeOnSelect = true,
52
- placement = "bottom-start",
331
+ closeOnBlur,
332
+ placement,
53
333
  duration = 0.2,
334
+ offset,
335
+ onOpen: onOpenProp,
336
+ onClose: onCloseProp,
54
337
  ...rest
55
- } = (0, import_core.omitThemeProps)(mergedProps);
338
+ } = (0, import_core2.omitThemeProps)(mergedProps);
339
+ const { relatedRef, onUpstreamClose, onDownstreamCloseMapRef } = (_a = useUpstreamMenu()) != null ? _a : {};
340
+ const { setDownstreamOpen, hasDownstreamRef } = (_b = useUpstreamMenuItem()) != null ? _b : {};
341
+ const isNested = !!relatedRef;
342
+ if (isNested) {
343
+ placement != null ? placement : placement = "right-start";
344
+ offset != null ? offset : offset = [-8, 8];
345
+ closeOnBlur != null ? closeOnBlur : closeOnBlur = false;
346
+ } else {
347
+ placement != null ? placement : placement = "bottom-start";
348
+ }
56
349
  const descendants = useDescendants();
57
- const [focusedIndex, setFocusedIndex] = (0, import_react.useState)(-1);
58
- const menuRef = (0, import_react.useRef)(null);
59
- const timeoutIds = (0, import_react.useRef)(/* @__PURE__ */ new Set([]));
60
- const onFocusMenu = (0, import_react.useCallback)(() => {
350
+ const [focusedIndex, setFocusedIndex] = (0, import_react2.useState)(-1);
351
+ const menuRef = (0, import_react2.useRef)(null);
352
+ const timeoutIds = (0, import_react2.useRef)(/* @__PURE__ */ new Set([]));
353
+ const requestAnimationFrameId = (0, import_react2.useRef)(null);
354
+ const onCloseMapRef = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
355
+ const onFocusMenu = (0, import_react2.useCallback)(() => {
61
356
  requestAnimationFrame(
62
357
  () => {
63
- var _a;
64
- return (_a = menuRef.current) == null ? void 0 : _a.focus({ preventScroll: false });
358
+ var _a2;
359
+ return (_a2 = menuRef.current) == null ? void 0 : _a2.focus({ preventScroll: false });
65
360
  }
66
361
  );
67
362
  }, []);
68
- const onFocusFirstItem = (0, import_react.useCallback)(() => {
69
- const id = setTimeout(() => {
363
+ const onFocusFirstItem = (0, import_react2.useCallback)(() => {
364
+ const id2 = setTimeout(() => {
70
365
  if (initialFocusRef)
71
366
  return;
72
367
  const first = descendants.enabledFirstValue();
73
368
  if (first)
74
369
  setFocusedIndex(first.index);
75
370
  });
76
- timeoutIds.current.add(id);
371
+ timeoutIds.current.add(id2);
77
372
  }, [descendants, initialFocusRef]);
78
- const onFocusLastItem = (0, import_react.useCallback)(() => {
79
- const id = setTimeout(() => {
373
+ const onFocusLastItem = (0, import_react2.useCallback)(() => {
374
+ const id2 = setTimeout(() => {
80
375
  if (initialFocusRef)
81
376
  return;
82
377
  const last = descendants.enabledLastValue();
83
378
  if (last)
84
379
  setFocusedIndex(last.index);
85
380
  });
86
- timeoutIds.current.add(id);
381
+ timeoutIds.current.add(id2);
87
382
  }, [descendants, initialFocusRef]);
88
- const onOpenInternal = (0, import_react.useCallback)(() => {
89
- var _a;
90
- (_a = rest.onOpen) == null ? void 0 : _a.call(rest);
91
- onFocusMenu();
92
- }, [onFocusMenu, rest]);
383
+ const onOpenInternal = (0, import_react2.useCallback)(() => {
384
+ onOpenProp == null ? void 0 : onOpenProp();
385
+ if (!isNested)
386
+ onFocusMenu();
387
+ }, [onOpenProp, isNested, onFocusMenu]);
388
+ const onCloseInternal = (0, import_react2.useCallback)(() => {
389
+ onCloseProp == null ? void 0 : onCloseProp();
390
+ for (const onClose2 of onCloseMapRef.current.values()) {
391
+ onClose2();
392
+ }
393
+ }, [onCloseProp]);
394
+ const id = (0, import_react2.useId)();
93
395
  const { isOpen, onOpen, onClose } = (0, import_use_disclosure.useDisclosure)({
94
396
  ...props,
95
- onOpen: onOpenInternal
397
+ onOpen: onOpenInternal,
398
+ onClose: onCloseInternal
399
+ });
400
+ (0, import_react2.useEffect)(() => {
401
+ const onCloseMap = onDownstreamCloseMapRef == null ? void 0 : onDownstreamCloseMapRef.current;
402
+ onCloseMap == null ? void 0 : onCloseMap.set(id, onClose);
403
+ return () => {
404
+ onCloseMap == null ? void 0 : onCloseMap.delete(id);
405
+ };
406
+ }, [id, onClose, onDownstreamCloseMapRef]);
407
+ (0, import_react2.useEffect)(() => {
408
+ if (setDownstreamOpen)
409
+ setDownstreamOpen(isOpen);
410
+ }, [setDownstreamOpen, isOpen]);
411
+ (0, import_react2.useEffect)(() => {
412
+ if (hasDownstreamRef)
413
+ hasDownstreamRef.current = true;
414
+ return () => {
415
+ if (hasDownstreamRef)
416
+ hasDownstreamRef.current = false;
417
+ };
96
418
  });
97
- (0, import_utils.useUpdateEffect)(() => {
419
+ (0, import_utils2.useUpdateEffect)(() => {
98
420
  if (!isOpen)
99
421
  setFocusedIndex(-1);
100
422
  }, [isOpen]);
101
- (0, import_utils.useUnmountEffect)(() => {
102
- timeoutIds.current.forEach((id) => clearTimeout(id));
423
+ (0, import_utils2.useUnmountEffect)(() => {
424
+ timeoutIds.current.forEach((id2) => clearTimeout(id2));
103
425
  timeoutIds.current.clear();
104
426
  });
105
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
106
- MenuProvider,
427
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
428
+ UpstreamMenuProvider,
107
429
  {
108
430
  value: {
109
- isOpen,
110
- onOpen,
111
- onClose,
112
- onFocusFirstItem,
113
- onFocusLastItem,
114
- closeOnSelect,
115
- focusedIndex,
116
- setFocusedIndex,
117
- menuRef,
118
- styles
431
+ relatedRef: menuRef,
432
+ onDownstreamCloseMapRef: onCloseMapRef,
433
+ onUpstreamClose: (0, import_utils2.funcAll)(onUpstreamClose, onClose)
119
434
  },
120
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
121
- import_popover.Popover,
435
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
436
+ MenuProvider,
122
437
  {
123
- ...{
124
- ...rest,
438
+ value: {
125
439
  isOpen,
126
440
  onOpen,
127
441
  onClose,
128
- placement,
129
- duration,
130
- initialFocusRef,
131
- closeOnButton: false
132
- }
442
+ onUpstreamClose,
443
+ onFocusFirstItem,
444
+ onFocusLastItem,
445
+ closeOnSelect,
446
+ focusedIndex,
447
+ setFocusedIndex,
448
+ menuRef,
449
+ requestAnimationFrameId,
450
+ isNested,
451
+ styles
452
+ },
453
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
454
+ import_popover.Popover,
455
+ {
456
+ ...{
457
+ trigger: isNested ? "hover" : "click",
458
+ ...rest,
459
+ isOpen,
460
+ onOpen,
461
+ onClose,
462
+ placement,
463
+ offset,
464
+ duration,
465
+ initialFocusRef,
466
+ relatedRef,
467
+ closeOnButton: false,
468
+ closeOnBlur
469
+ }
470
+ }
471
+ )
133
472
  }
134
473
  )
135
474
  }
@@ -138,8 +477,10 @@ var Menu = (props) => {
138
477
  // Annotate the CommonJS export names for ESM import in node:
139
478
  0 && (module.exports = {
140
479
  Menu,
480
+ UpstreamMenuProvider,
141
481
  useMenu,
142
482
  useMenuDescendant,
143
- useMenuDescendantsContext
483
+ useMenuDescendantsContext,
484
+ useUpstreamMenu
144
485
  });
145
486
  //# sourceMappingURL=menu.js.map
package/dist/menu.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu.tsx"],"sourcesContent":["/**\n * `Menu` is a component that displays a common dropdown menu.\n *\n * @see Docs https://yamada-ui.com/components/overlay/menu\n */\nimport 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 useUnmountEffect,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport type { Dispatch, FC, RefObject, SetStateAction } from \"react\"\nimport { useCallback, useRef, useState } from \"react\"\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 onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\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\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\"> &\n MenuOptions\n\nexport const Menu: FC<MenuProps> = (props) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Menu\", props)\n const {\n initialFocusRef,\n closeOnSelect = true,\n placement = \"bottom-start\",\n duration = 0.2,\n ...rest\n } = omitThemeProps(mergedProps)\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\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 rest.onOpen?.()\n\n onFocusMenu()\n }, [onFocusMenu, rest])\n\n const { isOpen, onOpen, onClose } = useDisclosure({\n ...props,\n onOpen: onOpenInternal,\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 <MenuProvider\n value={{\n isOpen,\n onOpen,\n onClose,\n onFocusFirstItem,\n onFocusLastItem,\n closeOnSelect,\n focusedIndex,\n setFocusedIndex,\n menuRef,\n styles,\n }}\n >\n <Popover\n {...{\n ...rest,\n isOpen,\n onOpen,\n onClose,\n placement,\n duration,\n initialFocusRef,\n closeOnButton: false,\n }}\n />\n </MenuProvider>\n </DescendantsContextProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,kBAAuD;AAEvD,qBAAwB;AACxB,4BAAiC;AACjC,4BAA8B;AAC9B,mBAIO;AAEP,mBAA8C;AA8HtC;AA5HR,IAAM;AAAA,EACJ;AAAA,EAC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0BAAY,MAAM;AA3G3C;AA4GI,eAAK,WAAL;AAEA,gBAAY;AAAA,EACd,GAAG,CAAC,aAAa,IAAI,CAAC;AAEtB,QAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAI,qCAAc;AAAA,IAChD,GAAG;AAAA,IACH,QAAQ;AAAA,EACV,CAAC;AAED,oCAAgB,MAAM;AACpB,QAAI,CAAC;AAAQ,sBAAgB,EAAE;AAAA,EACjC,GAAG,CAAC,MAAM,CAAC;AAEX,qCAAiB,MAAM;AACrB,eAAW,QAAQ,QAAQ,CAAC,OAAO,aAAa,EAAE,CAAC;AACnD,eAAW,QAAQ,MAAM;AAAA,EAC3B,CAAC;AAED,SACE,4CAAC,8BAA2B,OAAO,aACjC;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,YACF,GAAG;AAAA,YACH;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe;AAAA,UACjB;AAAA;AAAA,MACF;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/menu.tsx","../src/menu-item.tsx"],"sourcesContent":["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 { 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, mergedProps] = useMultiComponentStyle(\"Menu\", props)\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","import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { useClickable } from \"@yamada-ui/use-clickable\"\nimport {\n ariaAttr,\n createContext,\n cx,\n funcAll,\n handlerAll,\n isActiveElement,\n isHTMLElement,\n mergeRefs,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n FC,\n FocusEvent,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n MutableRefObject,\n ReactElement,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport { useCallback, useRef, useState } from \"react\"\nimport { useMenu, useMenuDescendant } from \"./menu\"\n\ntype UpstreamMenuItemContext = {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLButtonElement>>\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\nconst isTargetMenuItem = (target: EventTarget | null) => {\n return (\n isHTMLElement(target) &&\n !!target?.getAttribute(\"role\")?.startsWith(\"menu-item\")\n )\n}\n\ntype MenuItemOptions = {\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 * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * The menu item icon to use.\n */\n icon?: ReactElement\n /**\n * Right-aligned label text content, useful for displaying hotkeys.\n */\n command?: string\n}\n\nexport type MenuItemProps = HTMLUIProps<\"button\"> & MenuItemOptions\n\nexport const MenuItem = forwardRef<MenuItemProps, \"button\">(\n (\n {\n as,\n className,\n type,\n isDisabled,\n isFocusable,\n closeOnSelect: customCloseOnSelect,\n icon,\n command,\n children,\n onClick: onClickProp,\n onFocus: onFocusProp,\n onMouseEnter: onMouseEnterProp,\n onMouseMove: onMouseMoveProp,\n onMouseLeave: onMouseLeaveProp,\n onKeyDown: onKeyDownProp,\n ...props\n },\n ref,\n ) => {\n const {\n focusedIndex,\n setFocusedIndex,\n isOpen,\n onClose,\n onUpstreamClose,\n closeOnSelect: generalCloseOnSelect,\n menuRef,\n requestAnimationFrameId,\n isNested,\n styles,\n } = useMenu()\n const { onUpstreamRestoreFocus } = useUpstreamMenuItem() ?? {}\n\n const trulyDisabled = isDisabled && !isFocusable\n\n const buttonRef = useRef<HTMLButtonElement>(null)\n const hasDownstreamRef = useRef<boolean>(false)\n const onKeyDownRef = useRef<KeyboardEventHandler<HTMLButtonElement>>(\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 onMouseEnter = useCallback(\n (event: any) => {\n onMouseEnterProp?.(event)\n\n if (isDisabled) return\n\n setFocusedIndex(index)\n },\n [setFocusedIndex, index, isDisabled, onMouseEnterProp],\n )\n\n const onMouseMove = useCallback(\n (event: any) => {\n onMouseMoveProp?.(event)\n\n if (buttonRef.current && !isActiveElement(buttonRef.current))\n onMouseEnter(event)\n },\n [onMouseEnter, onMouseMoveProp],\n )\n\n const onMouseLeave = useCallback(\n (event: any) => {\n onMouseLeaveProp?.(event)\n\n if (isDisabled) return\n\n setFocusedIndex(-1)\n },\n [setFocusedIndex, isDisabled, onMouseLeaveProp],\n )\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLButtonElement>) => {\n onClickProp?.(ev)\n\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 [\n onClickProp,\n customCloseOnSelect,\n generalCloseOnSelect,\n onClose,\n onUpstreamClose,\n ],\n )\n\n const onFocus = useCallback(\n (ev: FocusEvent<HTMLButtonElement>) => {\n onFocusProp?.(ev)\n\n setFocusedIndex(index)\n },\n [onFocusProp, setFocusedIndex, index],\n )\n\n const onRestoreFocus = useCallback(() => {\n buttonRef.current?.focus()\n\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDownProp?.(ev)\n\n const actions: Record<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 [onKeyDownProp, onUpstreamRestoreFocus, onClose, isNested],\n )\n\n const rest = useClickable<HTMLButtonElement>({\n focusOnClick: false,\n ...props,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseMove,\n onMouseLeave,\n onKeyDown: handlerAll(onKeyDown, onKeyDownRef.current),\n ref: mergeRefs(register, buttonRef, ref),\n isDisabled,\n isFocusable,\n })\n\n useUpdateEffect(() => {\n if (!isOpen) return\n\n const id = requestAnimationFrameId.current\n\n if (isFocused && !trulyDisabled && buttonRef.current) {\n if (id) cancelAnimationFrame(id)\n\n requestAnimationFrameId.current = requestAnimationFrame(() => {\n buttonRef.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 type = as || type ? type ?? undefined : \"button\"\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 textDecoration: \"none\",\n color: \"inherit\",\n userSelect: \"none\",\n display: \"flex\",\n width: \"100%\",\n alignItems: \"center\",\n textAlign: \"start\",\n flex: \"0 0 auto\",\n outline: 0,\n gap: \"0.75rem\",\n ...styles.item,\n }\n\n return (\n <UpstreamMenuItemProvider\n value={{\n onKeyDownRef,\n onUpstreamRestoreFocus: onRestoreFocus,\n setDownstreamOpen,\n hasDownstreamRef,\n }}\n >\n <ui.li\n {...rest}\n {...(isDownstreamOpen ? { \"data-active\": \"\" } : {})}\n as={as}\n type={type}\n role=\"menu-item\"\n tabIndex={isFocused ? 0 : -1}\n className={cx(\"ui-menu__item\", className)}\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\ntype MenuOptionItemOptions = {\n /**\n * The menu option item icon to use.\n */\n icon?: ReactElement | null\n /**\n * The value of the menu option item.\n */\n value?: string\n /**\n * If `true`, the checkbox or radio will be checked.\n *\n * @default false\n */\n isChecked?: boolean\n /**\n * The type of the menu option item.\n */\n type?: \"radio\" | \"checkbox\"\n}\n\nexport type MenuOptionItemProps = Omit<MenuItemProps, \"icon\" | \"command\"> &\n MenuOptionItemOptions\n\nexport const MenuOptionItem = forwardRef<MenuOptionItemProps, \"button\">(\n (\n { className, icon, isChecked, closeOnSelect = false, children, ...rest },\n ref,\n ) => {\n return (\n <MenuItem\n ref={ref}\n className={cx(\"ui-menu__item--option\", className)}\n aria-checked={ariaAttr(isChecked)}\n closeOnSelect={closeOnSelect}\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 type MenuIconProps = HTMLUIProps<\"span\">\n\nexport const MenuIcon = forwardRef<MenuIconProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = {\n flexShrink: 0,\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n fontSize: \"0.85em\",\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 type MenuCommandProps = 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 viewBox=\"0 0 14 14\" width=\"1em\" height=\"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.9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OAAO,aACjC;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,yBAAyB;AAAA,QACzB,qBAAiB,uBAAQ,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":["import_core","import_utils","import_react","_a","import_jsx_runtime","_a","id","onClose"]}
package/dist/menu.mjs CHANGED
@@ -1,14 +1,18 @@
1
1
  "use client"
2
2
  import {
3
3
  Menu,
4
+ UpstreamMenuProvider,
4
5
  useMenu,
5
6
  useMenuDescendant,
6
- useMenuDescendantsContext
7
- } from "./chunk-TWAYMPIS.mjs";
7
+ useMenuDescendantsContext,
8
+ useUpstreamMenu
9
+ } from "./chunk-RX3BDZRV.mjs";
8
10
  export {
9
11
  Menu,
12
+ UpstreamMenuProvider,
10
13
  useMenu,
11
14
  useMenuDescendant,
12
- useMenuDescendantsContext
15
+ useMenuDescendantsContext,
16
+ useUpstreamMenu
13
17
  };
14
18
  //# sourceMappingURL=menu.mjs.map