@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
package/dist/index.js CHANGED
@@ -37,6 +37,9 @@ __export(src_exports, {
37
37
  });
38
38
  module.exports = __toCommonJS(src_exports);
39
39
 
40
+ // src/context-menu.tsx
41
+ var import_core2 = require("@yamada-ui/core");
42
+
40
43
  // src/menu.tsx
41
44
  var import_core = require("@yamada-ui/core");
42
45
  var import_popover = require("@yamada-ui/popover");
@@ -49,25 +52,25 @@ var import_use_descendant = require("@yamada-ui/use-descendant");
49
52
  var import_utils = require("@yamada-ui/utils");
50
53
  var {
51
54
  DescendantsContextProvider,
52
- useDescendantsContext: useMenuDescendantsContext,
55
+ useDescendant: useMenuDescendant,
53
56
  useDescendants,
54
- useDescendant: useMenuDescendant
57
+ useDescendantsContext: useMenuDescendantsContext
55
58
  } = (0, import_use_descendant.createDescendant)();
56
59
  var [MenuProvider, useMenu] = (0, import_utils.createContext)({
57
60
  name: "MenuContext",
58
61
  errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />"`
59
62
  });
60
63
  var [ContextMenuProvider, useContextMenu] = (0, import_utils.createContext)({
61
- strict: false,
62
- name: "ContextMenuContext"
64
+ name: "ContextMenuContext",
65
+ strict: false
63
66
  });
64
67
  var [UpstreamMenuProvider, useUpstreamMenu] = (0, import_utils.createContext)({
65
- strict: false,
66
- name: "UpstreamMenuContext"
68
+ name: "UpstreamMenuContext",
69
+ strict: false
67
70
  });
68
71
  var [UpstreamMenuItemProvider, useUpstreamMenuItem] = (0, import_utils.createContext)({
69
- strict: false,
70
- name: "UpstreamMenuItemContext"
72
+ name: "UpstreamMenuItemContext",
73
+ strict: false
71
74
  });
72
75
 
73
76
  // src/menu.tsx
@@ -80,18 +83,18 @@ var Menu = (props) => {
80
83
  styles: contextMenuStyles
81
84
  });
82
85
  let {
83
- initialFocusRef,
84
- closeOnSelect = true,
85
86
  closeOnBlur,
86
- placement,
87
+ closeOnSelect = true,
87
88
  duration = 0.2,
89
+ initialFocusRef,
88
90
  offset,
89
- onOpen: onOpenProp,
91
+ placement,
90
92
  onClose: onCloseProp,
93
+ onOpen: onOpenProp,
91
94
  ...rest
92
95
  } = (0, import_core.omitThemeProps)(mergedProps);
93
- const { relatedRef, onUpstreamClose, onDownstreamCloseMapRef } = (_b = useUpstreamMenu()) != null ? _b : {};
94
- const { setDownstreamOpen, hasDownstreamRef } = (_c = useUpstreamMenuItem()) != null ? _c : {};
96
+ const { relatedRef, onDownstreamCloseMapRef, onUpstreamClose } = (_b = useUpstreamMenu()) != null ? _b : {};
97
+ const { hasDownstreamRef, setDownstreamOpen } = (_c = useUpstreamMenuItem()) != null ? _c : {};
95
98
  const isNested = !!relatedRef;
96
99
  if (isNested) {
97
100
  placement != null ? placement : placement = "right-start";
@@ -141,10 +144,10 @@ var Menu = (props) => {
141
144
  }
142
145
  }, [onCloseProp]);
143
146
  const id = (0, import_react.useId)();
144
- const { isOpen, onOpen, onClose } = (0, import_use_disclosure.useDisclosure)({
147
+ const { isOpen, onClose, onOpen } = (0, import_use_disclosure.useDisclosure)({
145
148
  ...props,
146
- onOpen: onOpenInternal,
147
- onClose: onCloseInternal
149
+ onClose: onCloseInternal,
150
+ onOpen: onOpenInternal
148
151
  });
149
152
  (0, import_react.useEffect)(() => {
150
153
  const onCloseMap = onDownstreamCloseMapRef == null ? void 0 : onDownstreamCloseMapRef.current;
@@ -181,19 +184,19 @@ var Menu = (props) => {
181
184
  MenuProvider,
182
185
  {
183
186
  value: {
184
- isOpen,
185
- onOpen,
186
- onClose,
187
- onUpstreamClose,
188
- onFocusFirstItem,
189
- onFocusLastItem,
190
187
  closeOnSelect,
191
188
  focusedIndex,
192
- setFocusedIndex,
189
+ isNested,
190
+ isOpen,
193
191
  menuRef,
194
192
  requestAnimationFrameId,
195
- isNested,
196
- styles
193
+ setFocusedIndex,
194
+ styles,
195
+ onClose,
196
+ onFocusFirstItem,
197
+ onFocusLastItem,
198
+ onOpen,
199
+ onUpstreamClose
197
200
  },
198
201
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
199
202
  import_popover.Popover,
@@ -201,16 +204,16 @@ var Menu = (props) => {
201
204
  ...{
202
205
  trigger: isNested ? "hover" : "click",
203
206
  ...rest,
204
- isOpen,
205
- onOpen,
206
- onClose,
207
- placement,
208
- offset,
207
+ closeOnBlur,
208
+ closeOnButton: false,
209
209
  duration,
210
210
  initialFocusRef,
211
+ isOpen,
212
+ offset,
213
+ placement,
211
214
  relatedRef,
212
- closeOnButton: false,
213
- closeOnBlur
215
+ onClose,
216
+ onOpen
214
217
  }
215
218
  }
216
219
  )
@@ -220,66 +223,112 @@ var Menu = (props) => {
220
223
  ) });
221
224
  };
222
225
 
223
- // src/menu-button.tsx
226
+ // src/context-menu.tsx
227
+ var import_jsx_runtime2 = require("react/jsx-runtime");
228
+ var ContextMenu = (props) => {
229
+ const [styles, mergedProps] = (0, import_core2.useComponentMultiStyle)("ContextMenu", props);
230
+ const { ...rest } = (0, import_core2.omitThemeProps)(mergedProps);
231
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ContextMenuProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Menu, { trigger: "contextmenu", ...rest }) });
232
+ };
233
+
234
+ // src/context-menu-trigger.tsx
224
235
  var import_core3 = require("@yamada-ui/core");
225
- var import_icon = require("@yamada-ui/icon");
226
236
  var import_popover2 = require("@yamada-ui/popover");
227
- var import_utils4 = require("@yamada-ui/utils");
228
- var import_react3 = require("react");
237
+ var import_utils3 = require("@yamada-ui/utils");
238
+ var import_react2 = require("react");
239
+ var import_jsx_runtime3 = require("react/jsx-runtime");
240
+ var ContextMenuTrigger = (0, import_core3.forwardRef)(
241
+ ({ className, children, ...rest }, ref) => {
242
+ var _a;
243
+ const { styles } = (_a = useContextMenu()) != null ? _a : {};
244
+ const [position, setPosition] = (0, import_react2.useState)({ left: 0, top: 0 });
245
+ const css = { ...styles == null ? void 0 : styles.container };
246
+ const onContextMenu = (ev) => {
247
+ setPosition({ left: ev.pageX, top: ev.pageY });
248
+ };
249
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
250
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_popover2.PopoverAnchor, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
251
+ import_core3.ui.div,
252
+ {
253
+ className: "ui-context-menu__anchor",
254
+ style: { position: "absolute", ...position }
255
+ }
256
+ ) }),
257
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_popover2.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
258
+ import_core3.ui.div,
259
+ {
260
+ ref,
261
+ className: (0, import_utils3.cx)("ui-context-menu", className),
262
+ __css: css,
263
+ ...rest,
264
+ onContextMenu: (0, import_utils3.handlerAll)(rest.onContextMenu, onContextMenu),
265
+ children
266
+ }
267
+ ) })
268
+ ] });
269
+ }
270
+ );
271
+
272
+ // src/menu-button.tsx
273
+ var import_core5 = require("@yamada-ui/core");
274
+ var import_icon = require("@yamada-ui/icon");
275
+ var import_popover3 = require("@yamada-ui/popover");
276
+ var import_utils5 = require("@yamada-ui/utils");
277
+ var import_react4 = require("react");
229
278
 
230
279
  // src/menu-item.tsx
231
- var import_core2 = require("@yamada-ui/core");
280
+ var import_core4 = require("@yamada-ui/core");
232
281
  var import_use_clickable = require("@yamada-ui/use-clickable");
233
- var import_utils3 = require("@yamada-ui/utils");
234
- var import_react2 = require("react");
235
- var import_jsx_runtime2 = require("react/jsx-runtime");
282
+ var import_utils4 = require("@yamada-ui/utils");
283
+ var import_react3 = require("react");
284
+ var import_jsx_runtime4 = require("react/jsx-runtime");
236
285
  var isTargetMenuItem = (target) => {
237
286
  var _a;
238
- return (0, import_utils3.isHTMLElement)(target) && !!((_a = target == null ? void 0 : target.getAttribute("role")) == null ? void 0 : _a.startsWith("menuitem"));
287
+ return (0, import_utils4.isHTMLElement)(target) && !!((_a = target.getAttribute("role")) == null ? void 0 : _a.startsWith("menuitem"));
239
288
  };
240
- var MenuItem = (0, import_core2.forwardRef)(
289
+ var MenuItem = (0, import_core4.forwardRef)(
241
290
  ({
242
291
  className,
243
- isDisabled,
244
- isFocusable,
292
+ children,
245
293
  closeOnSelect: customCloseOnSelect,
246
- icon,
247
294
  command,
248
- children,
295
+ icon,
296
+ isDisabled,
297
+ isFocusable,
249
298
  ...props
250
299
  }, ref) => {
251
300
  var _a;
252
301
  const {
302
+ closeOnSelect: generalCloseOnSelect,
253
303
  focusedIndex,
254
- setFocusedIndex,
304
+ isNested,
255
305
  isOpen,
256
- onClose,
257
- onUpstreamClose,
258
- closeOnSelect: generalCloseOnSelect,
259
306
  menuRef,
260
307
  requestAnimationFrameId,
261
- isNested,
262
- styles
308
+ setFocusedIndex,
309
+ styles,
310
+ onClose,
311
+ onUpstreamClose
263
312
  } = useMenu();
264
313
  const { onUpstreamRestoreFocus } = (_a = useUpstreamMenuItem()) != null ? _a : {};
265
314
  const trulyDisabled = isDisabled && !isFocusable;
266
- const itemRef = (0, import_react2.useRef)(null);
267
- const hasDownstreamRef = (0, import_react2.useRef)(false);
268
- const onKeyDownRef = (0, import_react2.useRef)(
315
+ const itemRef = (0, import_react3.useRef)(null);
316
+ const hasDownstreamRef = (0, import_react3.useRef)(false);
317
+ const onKeyDownRef = (0, import_react3.useRef)(
269
318
  () => void 0
270
319
  );
271
320
  const { index, register } = useMenuDescendant({ disabled: trulyDisabled });
272
- const [isDownstreamOpen, setDownstreamOpen] = (0, import_react2.useState)(false);
321
+ const [isDownstreamOpen, setDownstreamOpen] = (0, import_react3.useState)(false);
273
322
  const isFocused = index === focusedIndex;
274
- const onMouseOver = (0, import_react2.useCallback)(() => {
323
+ const onMouseOver = (0, import_react3.useCallback)(() => {
275
324
  if (isDisabled) return;
276
325
  setFocusedIndex(index);
277
326
  }, [index, isDisabled, setFocusedIndex]);
278
- const onMouseLeave = (0, import_react2.useCallback)(() => {
327
+ const onMouseLeave = (0, import_react3.useCallback)(() => {
279
328
  if (isDisabled) return;
280
329
  setFocusedIndex(-1);
281
330
  }, [setFocusedIndex, isDisabled]);
282
- const onClick = (0, import_react2.useCallback)(
331
+ const onClick = (0, import_react3.useCallback)(
283
332
  (ev) => {
284
333
  if (!isTargetMenuItem(ev.currentTarget)) return;
285
334
  const hasDownstream = hasDownstreamRef.current;
@@ -290,18 +339,18 @@ var MenuItem = (0, import_core2.forwardRef)(
290
339
  },
291
340
  [customCloseOnSelect, generalCloseOnSelect, onClose, onUpstreamClose]
292
341
  );
293
- const onFocus = (0, import_react2.useCallback)(() => {
342
+ const onFocus = (0, import_react3.useCallback)(() => {
294
343
  setFocusedIndex(index);
295
344
  }, [setFocusedIndex, index]);
296
- const onRestoreFocus = (0, import_react2.useCallback)(() => {
345
+ const onRestoreFocus = (0, import_react3.useCallback)(() => {
297
346
  var _a2;
298
347
  (_a2 = itemRef.current) == null ? void 0 : _a2.focus();
299
348
  setFocusedIndex(index);
300
349
  }, [setFocusedIndex, index]);
301
- const onKeyDown = (0, import_react2.useCallback)(
350
+ const onKeyDown = (0, import_react3.useCallback)(
302
351
  (ev) => {
303
352
  const actions = {
304
- ArrowLeft: isNested ? (0, import_utils3.funcAll)(onUpstreamRestoreFocus, onClose) : void 0
353
+ ArrowLeft: isNested ? (0, import_utils4.funcAll)(onUpstreamRestoreFocus, onClose) : void 0
305
354
  };
306
355
  const action = actions[ev.key];
307
356
  if (!action) return;
@@ -314,16 +363,16 @@ var MenuItem = (0, import_core2.forwardRef)(
314
363
  const rest = (0, import_use_clickable.useClickable)({
315
364
  focusOnClick: false,
316
365
  ...props,
317
- onClick: (0, import_utils3.handlerAll)(props.onClick, onClick),
318
- onFocus: (0, import_utils3.handlerAll)(props.onFocus, onFocus),
319
- onMouseOver: (0, import_utils3.handlerAll)(props.onMouseOver, onMouseOver),
320
- onMouseLeave: (0, import_utils3.handlerAll)(props.onMouseLeave, onMouseLeave),
321
- onKeyDown: (0, import_utils3.handlerAll)(props.onKeyDown, onKeyDown, onKeyDownRef.current),
322
- ref: (0, import_utils3.mergeRefs)(register, itemRef, ref),
366
+ ref: (0, import_utils4.mergeRefs)(register, itemRef, ref),
323
367
  isDisabled,
324
- isFocusable
368
+ isFocusable,
369
+ onClick: (0, import_utils4.handlerAll)(props.onClick, onClick),
370
+ onFocus: (0, import_utils4.handlerAll)(props.onFocus, onFocus),
371
+ onKeyDown: (0, import_utils4.handlerAll)(props.onKeyDown, onKeyDown, onKeyDownRef.current),
372
+ onMouseLeave: (0, import_utils4.handlerAll)(props.onMouseLeave, onMouseLeave),
373
+ onMouseOver: (0, import_utils4.handlerAll)(props.onMouseOver, onMouseOver)
325
374
  });
326
- (0, import_utils3.useUpdateEffect)(() => {
375
+ (0, import_utils4.useUpdateEffect)(() => {
327
376
  if (!isOpen) return;
328
377
  const id = requestAnimationFrameId.current;
329
378
  if (isFocused && !trulyDisabled && itemRef.current) {
@@ -333,49 +382,49 @@ var MenuItem = (0, import_core2.forwardRef)(
333
382
  (_a2 = itemRef.current) == null ? void 0 : _a2.focus({ preventScroll: true });
334
383
  requestAnimationFrameId.current = null;
335
384
  });
336
- } else if (menuRef.current && !(0, import_utils3.isActiveElement)(menuRef.current)) {
385
+ } else if (menuRef.current && !(0, import_utils4.isActiveElement)(menuRef.current)) {
337
386
  menuRef.current.focus({ preventScroll: true });
338
387
  }
339
388
  return () => {
340
389
  if (id) cancelAnimationFrame(id);
341
390
  };
342
391
  }, [isFocused, trulyDisabled, menuRef, isOpen]);
343
- children = icon || command ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.span, { style: { flex: 1 }, children }) : children;
392
+ children = icon || command ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.ui.span, { style: { flex: 1 }, children }) : children;
344
393
  const css = {
345
- textDecoration: "none",
394
+ alignItems: "center",
346
395
  color: "inherit",
347
- userSelect: "none",
348
396
  display: "flex",
349
- width: "100%",
350
- alignItems: "center",
351
- textAlign: "start",
352
397
  flex: "0 0 auto",
353
- outline: 0,
354
398
  gap: "0.75rem",
399
+ outline: 0,
400
+ textAlign: "start",
401
+ textDecoration: "none",
402
+ userSelect: "none",
403
+ width: "100%",
355
404
  ...styles.item
356
405
  };
357
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
406
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
358
407
  UpstreamMenuItemProvider,
359
408
  {
360
409
  value: {
361
- onKeyDownRef,
362
- onUpstreamRestoreFocus: onRestoreFocus,
410
+ hasDownstreamRef,
363
411
  setDownstreamOpen,
364
- hasDownstreamRef
412
+ onKeyDownRef,
413
+ onUpstreamRestoreFocus: onRestoreFocus
365
414
  },
366
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
367
- import_core2.ui.li,
415
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
416
+ import_core4.ui.li,
368
417
  {
369
418
  ...rest,
370
419
  ...isDownstreamOpen ? { "data-active": "" } : {},
420
+ className: (0, import_utils4.cx)("ui-menu__item", className),
371
421
  role: "menuitem",
372
422
  tabIndex: isFocused ? 0 : -1,
373
- className: (0, import_utils3.cx)("ui-menu__item", className),
374
423
  __css: css,
375
424
  children: [
376
- icon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MenuIcon, { children: icon }) : null,
425
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MenuIcon, { children: icon }) : null,
377
426
  children,
378
- command ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MenuCommand, { children: command }) : null
427
+ command ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MenuCommand, { children: command }) : null
379
428
  ]
380
429
  }
381
430
  )
@@ -383,62 +432,62 @@ var MenuItem = (0, import_core2.forwardRef)(
383
432
  );
384
433
  }
385
434
  );
386
- var MenuOptionItem = (0, import_core2.forwardRef)(
387
- ({ className, icon, isChecked, closeOnSelect = false, children, ...rest }, ref) => {
388
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
435
+ var MenuOptionItem = (0, import_core4.forwardRef)(
436
+ ({ className, children, closeOnSelect = false, icon, isChecked, ...rest }, ref) => {
437
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
389
438
  MenuItem,
390
439
  {
391
440
  ref,
392
- className: (0, import_utils3.cx)("ui-menu__item--option", className),
393
- "aria-checked": (0, import_utils3.ariaAttr)(isChecked),
441
+ className: (0, import_utils4.cx)("ui-menu__item--option", className),
394
442
  closeOnSelect,
443
+ "aria-checked": (0, import_utils4.ariaAttr)(isChecked),
395
444
  ...rest,
396
445
  children: [
397
- icon !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MenuIcon, { opacity: isChecked ? 1 : 0, children: icon || /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CheckIcon, {}) }) : null,
446
+ icon !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MenuIcon, { opacity: isChecked ? 1 : 0, children: icon || /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckIcon, {}) }) : null,
398
447
  children
399
448
  ]
400
449
  }
401
450
  );
402
451
  }
403
452
  );
404
- var MenuIcon = (0, import_core2.forwardRef)(
453
+ var MenuIcon = (0, import_core4.forwardRef)(
405
454
  ({ className, ...rest }, ref) => {
406
455
  const { styles } = useMenu();
407
456
  const css = {
408
- flexShrink: 0,
409
- display: "inline-flex",
410
- justifyContent: "center",
411
457
  alignItems: "center",
458
+ display: "inline-flex",
459
+ flexShrink: 0,
412
460
  fontSize: "0.85em",
461
+ justifyContent: "center",
413
462
  ...styles.icon
414
463
  };
415
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
416
- import_core2.ui.span,
464
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
465
+ import_core4.ui.span,
417
466
  {
418
467
  ref,
419
- className: (0, import_utils3.cx)("ui-menu__item__icon", className),
468
+ className: (0, import_utils4.cx)("ui-menu__item__icon", className),
420
469
  __css: css,
421
470
  ...rest
422
471
  }
423
472
  );
424
473
  }
425
474
  );
426
- var MenuCommand = (0, import_core2.forwardRef)(
475
+ var MenuCommand = (0, import_core4.forwardRef)(
427
476
  ({ className, ...rest }, ref) => {
428
477
  const { styles } = useMenu();
429
478
  const css = { ...styles.command };
430
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
431
- import_core2.ui.span,
479
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
480
+ import_core4.ui.span,
432
481
  {
433
482
  ref,
434
- className: (0, import_utils3.cx)("ui-menu__item__command", className),
483
+ className: (0, import_utils4.cx)("ui-menu__item__command", className),
435
484
  __css: css,
436
485
  ...rest
437
486
  }
438
487
  );
439
488
  }
440
489
  );
441
- var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 14 14", width: "1em", height: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
490
+ var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { height: "1em", viewBox: "0 0 14 14", width: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
442
491
  "polygon",
443
492
  {
444
493
  fill: "currentColor",
@@ -447,18 +496,18 @@ var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { view
447
496
  ) });
448
497
 
449
498
  // src/menu-button.tsx
450
- var import_jsx_runtime3 = require("react/jsx-runtime");
451
- var MenuButton = (0, import_core3.forwardRef)(
452
- ({ className, children, as, ...rest }, ref) => {
499
+ var import_jsx_runtime5 = require("react/jsx-runtime");
500
+ var MenuButton = (0, import_core5.forwardRef)(
501
+ ({ as, className, children, ...rest }, ref) => {
453
502
  var _a;
454
503
  const { onKeyDownRef, onUpstreamRestoreFocus } = (_a = useUpstreamMenuItem()) != null ? _a : {};
455
- const { isOpen, onOpen, onClose, onFocusFirstItem, onFocusLastItem } = useMenu();
456
- const onKeyDown = (0, import_react3.useCallback)(
504
+ const { isOpen, onClose, onFocusFirstItem, onFocusLastItem, onOpen } = useMenu();
505
+ const onKeyDown = (0, import_react4.useCallback)(
457
506
  (ev) => {
458
507
  const actions = {
459
- Enter: (0, import_utils4.funcAll)(onOpen, onFocusFirstItem),
460
- ArrowDown: (0, import_utils4.funcAll)(onOpen, onFocusFirstItem),
461
- ArrowUp: (0, import_utils4.funcAll)(onOpen, onFocusLastItem)
508
+ ArrowDown: (0, import_utils5.funcAll)(onOpen, onFocusFirstItem),
509
+ ArrowUp: (0, import_utils5.funcAll)(onOpen, onFocusLastItem),
510
+ Enter: (0, import_utils5.funcAll)(onOpen, onFocusFirstItem)
462
511
  };
463
512
  const action = actions[ev.key];
464
513
  if (!action) return;
@@ -467,11 +516,11 @@ var MenuButton = (0, import_core3.forwardRef)(
467
516
  },
468
517
  [onFocusFirstItem, onFocusLastItem, onOpen]
469
518
  );
470
- const onItemKeyDown = (0, import_react3.useCallback)(
519
+ const onItemKeyDown = (0, import_react4.useCallback)(
471
520
  (ev) => {
472
521
  const actions = {
473
- ArrowRight: !isOpen ? (0, import_utils4.funcAll)(onOpen, onFocusFirstItem) : void 0,
474
- ArrowLeft: isOpen ? (0, import_utils4.funcAll)(onUpstreamRestoreFocus, onClose) : void 0
522
+ ArrowLeft: isOpen ? (0, import_utils5.funcAll)(onUpstreamRestoreFocus, onClose) : void 0,
523
+ ArrowRight: !isOpen ? (0, import_utils5.funcAll)(onOpen, onFocusFirstItem) : void 0
475
524
  };
476
525
  const action = actions[ev.key];
477
526
  if (!action) return;
@@ -480,46 +529,99 @@ var MenuButton = (0, import_core3.forwardRef)(
480
529
  },
481
530
  [isOpen, onOpen, onFocusFirstItem, onUpstreamRestoreFocus, onClose]
482
531
  );
483
- (0, import_utils4.assignRef)(onKeyDownRef, onItemKeyDown);
484
- const Component = (0, import_react3.useMemo)(() => as ? (0, import_core3.ui)(as) : Button, [as]);
485
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_popover2.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
532
+ (0, import_utils5.assignRef)(onKeyDownRef, onItemKeyDown);
533
+ const Component = (0, import_react4.useMemo)(() => as ? (0, import_core5.ui)(as) : Button, [as]);
534
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_popover3.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
486
535
  Component,
487
536
  {
488
537
  ref,
489
- className: (0, import_utils4.cx)("ui-menu", className),
490
- "aria-haspopup": "menu",
538
+ className: (0, import_utils5.cx)("ui-menu", className),
491
539
  "aria-expanded": isOpen,
540
+ "aria-haspopup": "menu",
492
541
  ...rest,
493
- "data-active": (0, import_utils4.dataAttr)(isOpen),
494
- onKeyDown: (0, import_utils4.handlerAll)(rest.onKeyDown, onKeyDown),
542
+ "data-active": (0, import_utils5.dataAttr)(isOpen),
543
+ onKeyDown: (0, import_utils5.handlerAll)(rest.onKeyDown, onKeyDown),
495
544
  children
496
545
  }
497
546
  ) });
498
547
  }
499
548
  );
500
- var Button = (0, import_core3.forwardRef)((rest, ref) => {
549
+ var Button = (0, import_core5.forwardRef)((rest, ref) => {
501
550
  const { styles } = useMenu();
502
551
  const css = {
503
- display: "inline-flex",
504
- appearance: "none",
505
552
  alignItems: "center",
553
+ appearance: "none",
554
+ display: "inline-flex",
506
555
  outline: 0,
507
556
  ...styles.button
508
557
  };
509
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.button, { ref, __css: css, ...rest });
558
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core5.ui.button, { ref, __css: css, ...rest });
510
559
  });
511
- var MenuItemButton = (0, import_core3.forwardRef)(
512
- ({ className, children, innerProps, icon, iconProps, ...rest }, ref) => {
513
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
560
+ var MenuItemButton = (0, import_core5.forwardRef)(
561
+ ({ className, children, icon, iconProps, innerProps, ...rest }, ref) => {
562
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
514
563
  MenuButton,
515
564
  {
516
565
  ref,
517
- className: (0, import_utils4.cx)("ui-menu__item-button", className),
566
+ className: (0, import_utils5.cx)("ui-menu__item-button", className),
518
567
  flex: "1",
519
568
  ...rest,
520
569
  children: [
521
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.span, { as: "span", flex: "1", ...innerProps, children }),
522
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuIcon, { ...iconProps, children: icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icon.ChevronIcon, { fontSize: "1.5em", transform: "rotate(-90deg)" }) })
570
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core5.ui.span, { as: "span", flex: "1", ...innerProps, children }),
571
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MenuIcon, { ...iconProps, children: icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icon.ChevronIcon, { fontSize: "1.5em", transform: "rotate(-90deg)" }) })
572
+ ]
573
+ }
574
+ );
575
+ }
576
+ );
577
+
578
+ // src/menu-divider.tsx
579
+ var import_core6 = require("@yamada-ui/core");
580
+ var import_utils6 = require("@yamada-ui/utils");
581
+ var import_jsx_runtime6 = require("react/jsx-runtime");
582
+ var MenuDivider = (0, import_core6.forwardRef)(
583
+ ({ className, ...rest }, ref) => {
584
+ const { styles } = useMenu();
585
+ const css = { ...styles.divider };
586
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
587
+ import_core6.ui.hr,
588
+ {
589
+ ref,
590
+ className: (0, import_utils6.cx)("ui-menu__divider", className),
591
+ __css: css,
592
+ ...rest
593
+ }
594
+ );
595
+ }
596
+ );
597
+
598
+ // src/menu-group.tsx
599
+ var import_core7 = require("@yamada-ui/core");
600
+ var import_utils7 = require("@yamada-ui/utils");
601
+ var import_jsx_runtime7 = require("react/jsx-runtime");
602
+ var MenuGroup = (0, import_core7.forwardRef)(
603
+ ({ className, children, label, labelProps, ...rest }, ref) => {
604
+ const { styles } = useMenu();
605
+ const css = { ...styles.group };
606
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
607
+ import_core7.ui.li,
608
+ {
609
+ ref,
610
+ className: (0, import_utils7.cx)("ui-menu__item", "ui-menu__item--group", className),
611
+ role: "group",
612
+ __css: css,
613
+ ...rest,
614
+ children: [
615
+ label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
616
+ import_core7.ui.span,
617
+ {
618
+ className: (0, import_utils7.cx)("ui-menu__item--group-label"),
619
+ __css: styles.groupLabel,
620
+ ...labelProps,
621
+ children: label
622
+ }
623
+ ) : null,
624
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.ui.ul, { className: "ui-menu__item__group", children })
523
625
  ]
524
626
  }
525
627
  );
@@ -527,40 +629,40 @@ var MenuItemButton = (0, import_core3.forwardRef)(
527
629
  );
528
630
 
529
631
  // src/menu-list.tsx
530
- var import_core4 = require("@yamada-ui/core");
531
- var import_popover3 = require("@yamada-ui/popover");
532
- var import_utils5 = require("@yamada-ui/utils");
533
- var import_react4 = require("react");
534
- var import_jsx_runtime4 = require("react/jsx-runtime");
535
- var MenuList = (0, import_core4.forwardRef)(
536
- ({ className, contentProps, children, ...rest }, ref) => {
537
- const { menuRef, focusedIndex, setFocusedIndex, onClose, styles } = useMenu();
632
+ var import_core8 = require("@yamada-ui/core");
633
+ var import_popover4 = require("@yamada-ui/popover");
634
+ var import_utils8 = require("@yamada-ui/utils");
635
+ var import_react5 = require("react");
636
+ var import_jsx_runtime8 = require("react/jsx-runtime");
637
+ var MenuList = (0, import_core8.forwardRef)(
638
+ ({ className, children, contentProps, ...rest }, ref) => {
639
+ const { focusedIndex, menuRef, setFocusedIndex, styles, onClose } = useMenu();
538
640
  const descendants = useMenuDescendantsContext();
539
- const onNext = (0, import_react4.useCallback)(() => {
641
+ const onNext = (0, import_react5.useCallback)(() => {
540
642
  const next = descendants.enabledNextValue(focusedIndex);
541
643
  if (next) setFocusedIndex(next.index);
542
644
  }, [descendants, focusedIndex, setFocusedIndex]);
543
- const onPrev = (0, import_react4.useCallback)(() => {
645
+ const onPrev = (0, import_react5.useCallback)(() => {
544
646
  const prev = descendants.enabledPrevValue(focusedIndex);
545
647
  if (prev) setFocusedIndex(prev.index);
546
648
  }, [descendants, focusedIndex, setFocusedIndex]);
547
- const onFirst = (0, import_react4.useCallback)(() => {
649
+ const onFirst = (0, import_react5.useCallback)(() => {
548
650
  const first = descendants.enabledFirstValue();
549
651
  if (first) setFocusedIndex(first.index);
550
652
  }, [descendants, setFocusedIndex]);
551
- const onLast = (0, import_react4.useCallback)(() => {
653
+ const onLast = (0, import_react5.useCallback)(() => {
552
654
  const last = descendants.enabledLastValue();
553
655
  if (last) setFocusedIndex(last.index);
554
656
  }, [descendants, setFocusedIndex]);
555
- const onKeyDown = (0, import_react4.useCallback)(
657
+ const onKeyDown = (0, import_react5.useCallback)(
556
658
  (ev) => {
557
659
  const actions = {
558
- Tab: (ev2) => ev2.preventDefault(),
559
- Escape: onClose,
560
660
  ArrowDown: focusedIndex === -1 ? onFirst : onNext,
561
661
  ArrowUp: focusedIndex === -1 ? onLast : onPrev,
662
+ End: onLast,
663
+ Escape: onClose,
562
664
  Home: onFirst,
563
- End: onLast
665
+ Tab: (ev2) => ev2.preventDefault()
564
666
  };
565
667
  const action = actions[ev.key];
566
668
  if (!action) return;
@@ -569,20 +671,20 @@ var MenuList = (0, import_core4.forwardRef)(
569
671
  },
570
672
  [focusedIndex, onClose, onFirst, onLast, onNext, onPrev]
571
673
  );
572
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
573
- import_popover3.PopoverContent,
674
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
675
+ import_popover4.PopoverContent,
574
676
  {
575
677
  as: "div",
576
678
  className: "ui-menu__content",
577
679
  __css: { ...styles.content },
578
680
  ...contentProps,
579
- onKeyDown: (0, import_utils5.handlerAll)(contentProps == null ? void 0 : contentProps.onKeyDown, onKeyDown),
580
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
581
- import_core4.ui.ul,
681
+ onKeyDown: (0, import_utils8.handlerAll)(contentProps == null ? void 0 : contentProps.onKeyDown, onKeyDown),
682
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
683
+ import_core8.ui.ul,
582
684
  {
583
- ref: (0, import_utils5.mergeRefs)(menuRef, ref),
685
+ ref: (0, import_utils8.mergeRefs)(menuRef, ref),
686
+ className: (0, import_utils8.cx)("ui-menu__list", className),
584
687
  role: "menu",
585
- className: (0, import_utils5.cx)("ui-menu__list", className),
586
688
  tabIndex: -1,
587
689
  __css: { ...styles.list },
588
690
  ...rest,
@@ -594,72 +696,39 @@ var MenuList = (0, import_core4.forwardRef)(
594
696
  }
595
697
  );
596
698
 
597
- // src/menu-group.tsx
598
- var import_core5 = require("@yamada-ui/core");
599
- var import_utils6 = require("@yamada-ui/utils");
600
- var import_jsx_runtime5 = require("react/jsx-runtime");
601
- var MenuGroup = (0, import_core5.forwardRef)(
602
- ({ className, label, children, labelProps, ...rest }, ref) => {
603
- const { styles } = useMenu();
604
- const css = { ...styles.group };
605
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
606
- import_core5.ui.li,
607
- {
608
- ref,
609
- className: (0, import_utils6.cx)("ui-menu__item", "ui-menu__item--group", className),
610
- role: "group",
611
- __css: css,
612
- ...rest,
613
- children: [
614
- label ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
615
- import_core5.ui.span,
616
- {
617
- className: (0, import_utils6.cx)("ui-menu__item--group-label"),
618
- __css: styles.groupLabel,
619
- ...labelProps,
620
- children: label
621
- }
622
- ) : null,
623
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core5.ui.ul, { className: "ui-menu__item__group", children })
624
- ]
625
- }
626
- );
627
- }
628
- );
629
-
630
699
  // src/menu-option-group.tsx
631
700
  var import_use_controllable_state = require("@yamada-ui/use-controllable-state");
632
- var import_utils7 = require("@yamada-ui/utils");
633
- var import_react5 = require("react");
634
- var import_jsx_runtime6 = require("react/jsx-runtime");
635
- var MenuOptionGroup = (0, import_react5.forwardRef)(
701
+ var import_utils9 = require("@yamada-ui/utils");
702
+ var import_react6 = require("react");
703
+ var import_jsx_runtime9 = require("react/jsx-runtime");
704
+ var MenuOptionGroup = (0, import_react6.forwardRef)(
636
705
  ({
706
+ type,
637
707
  className,
638
- value: valueProp,
708
+ children,
639
709
  defaultValue,
710
+ value: valueProp,
640
711
  onChange: onChangeProp,
641
- type,
642
- children,
643
712
  ...rest
644
713
  }, ref) => {
645
714
  const isRadio = type === "radio";
646
715
  defaultValue != null ? defaultValue : defaultValue = isRadio ? "" : [];
647
716
  const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
648
- value: valueProp,
649
717
  defaultValue,
718
+ value: valueProp,
650
719
  onChange: onChangeProp
651
720
  });
652
- const onChange = (0, import_react5.useCallback)(
721
+ const onChange = (0, import_react6.useCallback)(
653
722
  (selectedValue) => {
654
723
  if (isRadio && typeof value === "string") setValue(selectedValue);
655
- if (!isRadio && (0, import_utils7.isArray)(value)) {
724
+ if (!isRadio && (0, import_utils9.isArray)(value)) {
656
725
  const nextValue = value.includes(selectedValue) ? value.filter((item) => item !== selectedValue) : value.concat(selectedValue);
657
726
  setValue(nextValue);
658
727
  }
659
728
  },
660
729
  [isRadio, value, setValue]
661
730
  );
662
- const validChildren = (0, import_utils7.getValidChildren)(children);
731
+ const validChildren = (0, import_utils9.getValidChildren)(children);
663
732
  const cloneChildren = validChildren.map((child) => {
664
733
  if (child.type !== MenuOptionItem) return child;
665
734
  const onClick = (ev) => {
@@ -667,14 +736,14 @@ var MenuOptionGroup = (0, import_react5.forwardRef)(
667
736
  onChange(child.props.value);
668
737
  (_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a, ev);
669
738
  };
670
- const isChecked = !isRadio && (0, import_utils7.isArray)(value) ? value.includes(child.props.value) : child.props.value === value;
671
- return (0, import_react5.cloneElement)(child, { type, onClick, isChecked });
739
+ const isChecked = !isRadio && (0, import_utils9.isArray)(value) ? value.includes(child.props.value) : child.props.value === value;
740
+ return (0, import_react6.cloneElement)(child, { type, isChecked, onClick });
672
741
  });
673
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
742
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
674
743
  MenuGroup,
675
744
  {
676
745
  ref,
677
- className: (0, import_utils7.cx)("ui-menu__item--group--option", className),
746
+ className: (0, import_utils9.cx)("ui-menu__item--group--option", className),
678
747
  ...rest,
679
748
  children: cloneChildren
680
749
  }
@@ -682,72 +751,6 @@ var MenuOptionGroup = (0, import_react5.forwardRef)(
682
751
  }
683
752
  );
684
753
  MenuOptionGroup.displayName = "MenuOptionGroup";
685
-
686
- // src/menu-divider.tsx
687
- var import_core6 = require("@yamada-ui/core");
688
- var import_utils8 = require("@yamada-ui/utils");
689
- var import_jsx_runtime7 = require("react/jsx-runtime");
690
- var MenuDivider = (0, import_core6.forwardRef)(
691
- ({ className, ...rest }, ref) => {
692
- const { styles } = useMenu();
693
- const css = { ...styles.divider };
694
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
695
- import_core6.ui.hr,
696
- {
697
- ref,
698
- className: (0, import_utils8.cx)("ui-menu__divider", className),
699
- __css: css,
700
- ...rest
701
- }
702
- );
703
- }
704
- );
705
-
706
- // src/context-menu.tsx
707
- var import_core7 = require("@yamada-ui/core");
708
- var import_jsx_runtime8 = require("react/jsx-runtime");
709
- var ContextMenu = (props) => {
710
- const [styles, mergedProps] = (0, import_core7.useComponentMultiStyle)("ContextMenu", props);
711
- const { ...rest } = (0, import_core7.omitThemeProps)(mergedProps);
712
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ContextMenuProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Menu, { trigger: "contextmenu", ...rest }) });
713
- };
714
-
715
- // src/context-menu-trigger.tsx
716
- var import_core8 = require("@yamada-ui/core");
717
- var import_popover4 = require("@yamada-ui/popover");
718
- var import_utils9 = require("@yamada-ui/utils");
719
- var import_react6 = require("react");
720
- var import_jsx_runtime9 = require("react/jsx-runtime");
721
- var ContextMenuTrigger = (0, import_core8.forwardRef)(
722
- ({ children, className, ...rest }, ref) => {
723
- const { styles } = useContextMenu();
724
- const [position, setPosition] = (0, import_react6.useState)({ top: 0, left: 0 });
725
- const css = { ...styles.container };
726
- const onContextMenu = (ev) => {
727
- setPosition({ top: ev.pageY, left: ev.pageX });
728
- };
729
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
730
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover4.PopoverAnchor, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
731
- import_core8.ui.div,
732
- {
733
- className: "ui-context-menu__anchor",
734
- style: { position: "absolute", ...position }
735
- }
736
- ) }),
737
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover4.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
738
- import_core8.ui.div,
739
- {
740
- ref,
741
- className: (0, import_utils9.cx)("ui-context-menu", className),
742
- __css: css,
743
- ...rest,
744
- onContextMenu: (0, import_utils9.handlerAll)(rest.onContextMenu, onContextMenu),
745
- children
746
- }
747
- ) })
748
- ] });
749
- }
750
- );
751
754
  // Annotate the CommonJS export names for ESM import in node:
752
755
  0 && (module.exports = {
753
756
  ContextMenu,