loopable-cli 0.2.1 → 0.3.0

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 (134) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/_connectorId-CDCuSgpN.js +1 -0
  3. package/.output/public/assets/_loopId-DOnIsVTW.js +1 -0
  4. package/.output/public/assets/_taskId-BO5MZnlZ.js +1 -0
  5. package/.output/public/assets/agents-CBozi7oi.js +1 -0
  6. package/.output/public/assets/alert-Bn_wjgTX.js +1 -0
  7. package/.output/public/assets/button-K3ypIhAZ.js +1 -0
  8. package/.output/public/assets/card-DiVnaTIE.js +1 -0
  9. package/.output/public/assets/chevron-right-BrctLtFK.js +1 -0
  10. package/.output/public/assets/connection-status-DKWelvLO.js +1 -0
  11. package/.output/public/assets/connector-icon-CEbdE71G.js +1 -0
  12. package/.output/public/assets/connectors-JyX3IzJj.js +1 -0
  13. package/.output/public/assets/gaps-PjmcbaWo.js +1 -0
  14. package/.output/public/assets/inbox-CujRR0Cz.js +1 -0
  15. package/.output/public/assets/index-C9SQ_Baq.js +16 -0
  16. package/.output/public/assets/loop-form-Dw3cuTzw.js +1 -0
  17. package/.output/public/assets/loops-DcEfZa2_.js +1 -0
  18. package/.output/public/assets/manifests-yJpevyye.js +1 -0
  19. package/.output/public/assets/new-CwsnNuRW.js +1 -0
  20. package/.output/public/assets/page-bvnfRMum.js +1 -0
  21. package/.output/public/assets/play-yHLs4DjK.js +1 -0
  22. package/.output/public/assets/plus-Ber25lrU.js +1 -0
  23. package/.output/public/assets/preload-helper-BoU_7EQC.js +3 -0
  24. package/.output/public/assets/{refresh-cw-C3xBnKfy.js → refresh-cw-BzSY7M8I.js} +1 -1
  25. package/.output/public/assets/rotate-ccw-DLv9EfCX.js +1 -0
  26. package/.output/public/assets/runners-DzX-RU3i.js +2 -0
  27. package/.output/public/assets/select-C9grIFwG.js +1 -0
  28. package/.output/public/assets/setting-fields-DUc3npgh.js +3 -0
  29. package/.output/public/assets/styles-B9B98zLk.css +2 -0
  30. package/.output/public/assets/switch-DwABVI6d.js +1 -0
  31. package/.output/public/assets/task-list-Ddk8-qt7.js +1 -0
  32. package/.output/public/assets/textarea-Ds-gIYUQ.js +1 -0
  33. package/.output/public/assets/time-goBWd-5J.js +1 -0
  34. package/.output/public/assets/use-live-tasks-DZNNuECy.js +1 -0
  35. package/.output/public/assets/useCompositeListItem-P4Nmmn7j.js +1 -0
  36. package/.output/public/assets/usePositioner-B7i9Ejzh.js +1 -0
  37. package/.output/server/_chunks/ssr-renderer.mjs +1 -1
  38. package/.output/server/{_connectorId-C9yydJrC.mjs → _connectorId-COuQN02a.mjs} +198 -188
  39. package/.output/server/_libs/@base-ui/react+[...].mjs +1410 -804
  40. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  41. package/.output/server/_libs/lucide-react.mjs +93 -84
  42. package/.output/server/_libs/next-themes.mjs +1 -1
  43. package/.output/server/_libs/sonner.mjs +1 -1
  44. package/.output/server/_loopId-CZh6_Yhr.mjs +310 -0
  45. package/.output/server/_ssr/{agents-DG643yoJ.mjs → agents-B_qo1gpL.mjs} +195 -6
  46. package/.output/server/_ssr/{agents-C7B6RJ6-.mjs → agents-Bz10gz_m.mjs} +8 -8
  47. package/.output/server/_ssr/agents-CjbOUp3Z.mjs +206 -0
  48. package/.output/server/_ssr/{alert-DQvzE7bu.mjs → alert-C2WBWfzo.mjs} +2 -2
  49. package/.output/server/_ssr/card-r1cV-PCN.mjs +36 -0
  50. package/.output/server/_ssr/{client-BtVRVhQ2.mjs → client-Dk3SD8Il.mjs} +5 -1
  51. package/.output/server/_ssr/connection-status-BogAL-Fj.mjs +32 -0
  52. package/.output/server/_ssr/{connections-Df-aDpfJ.mjs → connections-Cqvb6Gw2.mjs} +372 -325
  53. package/.output/server/_ssr/connector-icon-DrhVbhs6.mjs +190 -0
  54. package/.output/server/_ssr/connectors-BfS5tQKr.mjs +81 -0
  55. package/.output/server/_ssr/{connectors-e0mf2pMs.mjs → connectors-DJI-rzPU.mjs} +10 -10
  56. package/.output/server/_ssr/{createServerRpc-DPDrnFdH.mjs → createServerRpc-DDrp2nLT.mjs} +2 -2
  57. package/.output/server/_ssr/{gaps-Cz76ZicM.mjs → gaps-CcvHiLcj.mjs} +15 -7
  58. package/.output/server/_ssr/inbox-D1ef761v.mjs +178 -0
  59. package/.output/server/_ssr/loop-form-DWwOR05R.mjs +346 -0
  60. package/.output/server/_ssr/{loops-D8WuK7Ke.mjs → loops-6WhUe_lc.mjs} +37 -27
  61. package/.output/server/_ssr/loops-DHPjzG-t.mjs +217 -0
  62. package/.output/server/_ssr/new-ChKBdcXJ.mjs +245 -0
  63. package/.output/server/_ssr/page-DZVxKvdn.mjs +120 -0
  64. package/.output/server/_ssr/{router-54IDWTVz.mjs → router-DdwREiOf.mjs} +162 -489
  65. package/.output/server/_ssr/runners-CK9Cx9fS.mjs +217 -0
  66. package/.output/server/_ssr/runners-CrznFPHt.mjs +140 -0
  67. package/.output/server/_ssr/{runners-Cj6z9Mqh.mjs → runners-W-pgo5yo.mjs} +5 -5
  68. package/.output/server/_ssr/{secrets-CRnpwGBh.mjs → secrets-CV5scFlt.mjs} +2 -2
  69. package/.output/server/_ssr/select-BtndHhHb.mjs +76 -0
  70. package/.output/server/_ssr/{setting-fields-DzBlslan.mjs → setting-fields-LNgywAW7.mjs} +25 -20
  71. package/.output/server/_ssr/ssr.mjs +43 -42
  72. package/.output/server/_ssr/{start-Vq3Oan3v.mjs → start-C_j-e4vF.mjs} +9 -4
  73. package/.output/server/_ssr/{switch-1pnd_bPJ.mjs → switch-odxNO_S4.mjs} +3 -3
  74. package/.output/server/_ssr/task-list-Dnmq_WeE.mjs +150 -0
  75. package/.output/server/_ssr/{tasks-Qtml5TlK.mjs → tasks-D-kXLgVP.mjs} +13 -13
  76. package/.output/server/_ssr/{tasks-BDqznm57.mjs → tasks-D7aUvA33.mjs} +44 -17
  77. package/.output/server/_ssr/{textarea-CHJTKtsJ.mjs → textarea-D2c_vTIC.mjs} +2 -2
  78. package/.output/server/_ssr/time-Cy8TZP0Z.mjs +13 -0
  79. package/.output/server/_ssr/use-live-tasks-BzhTkEOL.mjs +40 -0
  80. package/.output/server/_tanstack-start-manifest_v-2HUdn-2E.mjs +166 -0
  81. package/.output/server/_taskId-D3KkNJW1.mjs +263 -0
  82. package/.output/server/index.mjs +199 -164
  83. package/README.md +36 -6
  84. package/dist/cli.mjs +161 -8
  85. package/dist/dispatcher.mjs +671 -285
  86. package/dist/runner.mjs +333 -46
  87. package/drizzle/0025_prompt_tasks_done.sql +2 -0
  88. package/drizzle/0026_guidance_into_prompt.sql +3 -0
  89. package/drizzle/0027_relative_folders.sql +5 -0
  90. package/drizzle/0028_runner_version.sql +5 -0
  91. package/drizzle/meta/_journal.json +29 -1
  92. package/package.json +4 -2
  93. package/.output/public/assets/_connectorId-CkygNLny.js +0 -1
  94. package/.output/public/assets/_loopId-Cshlc5Ja.js +0 -1
  95. package/.output/public/assets/_taskId-BKDIJ_Fg.js +0 -1
  96. package/.output/public/assets/alert-BT2EVMJP.js +0 -1
  97. package/.output/public/assets/arrow-left-CWUZt6k2.js +0 -1
  98. package/.output/public/assets/arrow-right-dy_oOg_c.js +0 -1
  99. package/.output/public/assets/connection-status-DCqqmY_6.js +0 -1
  100. package/.output/public/assets/connector-icon-BUoK6Cru.js +0 -1
  101. package/.output/public/assets/connectors-CeLBtEtg.js +0 -1
  102. package/.output/public/assets/external-link-DC11orFA.js +0 -1
  103. package/.output/public/assets/gaps-BtFoD7mF.js +0 -1
  104. package/.output/public/assets/inbox-BYNjkNDJ.js +0 -1
  105. package/.output/public/assets/index-0yP3Jn_G.js +0 -18
  106. package/.output/public/assets/loader-B4Epchm_.js +0 -1
  107. package/.output/public/assets/loop-form-DnSJNc1k.js +0 -1
  108. package/.output/public/assets/loops-1CvbqO6m.js +0 -1
  109. package/.output/public/assets/new-m5NlqYQT.js +0 -1
  110. package/.output/public/assets/play-DD4xQgvi.js +0 -1
  111. package/.output/public/assets/preload-helper-CfdAYKD7.js +0 -3
  112. package/.output/public/assets/rolldown-runtime-CbXtAM7H.js +0 -1
  113. package/.output/public/assets/runners-D8QVl-Y6.js +0 -1
  114. package/.output/public/assets/select-Cppu-hti.js +0 -1
  115. package/.output/public/assets/setting-fields-bJ_gTG7Q.js +0 -3
  116. package/.output/public/assets/styles-ClTGaXU0.css +0 -2
  117. package/.output/public/assets/switch-hRIbNGOj.js +0 -1
  118. package/.output/public/assets/task-list-BAxjcVgr.js +0 -1
  119. package/.output/public/assets/textarea-Fyuzi6Vp.js +0 -1
  120. package/.output/public/assets/trash-2-BXZzBsoV.js +0 -1
  121. package/.output/public/assets/useValueChanged-VVyq4hb9.js +0 -1
  122. package/.output/server/_loopId-B0VG-eBC.mjs +0 -301
  123. package/.output/server/_ssr/connection-status-BZr3Y-IC.mjs +0 -31
  124. package/.output/server/_ssr/connector-icon-WvxwZ5TF.mjs +0 -56
  125. package/.output/server/_ssr/connectors-BU0IiRge.mjs +0 -107
  126. package/.output/server/_ssr/inbox-CAUBa1I3.mjs +0 -114
  127. package/.output/server/_ssr/loop-form-FqSaXiHl.mjs +0 -413
  128. package/.output/server/_ssr/loops-Dqoebe8q.mjs +0 -222
  129. package/.output/server/_ssr/new-bBsVaWD6.mjs +0 -169
  130. package/.output/server/_ssr/runners-D2UAdLyj.mjs +0 -106
  131. package/.output/server/_ssr/runners-DGWaVvWi.mjs +0 -116
  132. package/.output/server/_ssr/task-list-_qgBS9LU.mjs +0 -187
  133. package/.output/server/_tanstack-start-manifest_v-CvheE7ZF.mjs +0 -131
  134. package/.output/server/_taskId-V4QLBO2N.mjs +0 -256
@@ -1360,7 +1360,7 @@ function getReactElementRef(element) {
1360
1360
  //#endregion
1361
1361
  //#region node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/utils/empty.mjs
1362
1362
  function NOOP() {}
1363
- var EMPTY_ARRAY$1 = Object.freeze([]);
1363
+ var EMPTY_ARRAY = Object.freeze([]);
1364
1364
  var EMPTY_OBJECT = Object.freeze({});
1365
1365
  //#endregion
1366
1366
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
@@ -2162,6 +2162,21 @@ function getNextTabbable(referenceElement) {
2162
2162
  function getPreviousTabbable(referenceElement) {
2163
2163
  return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
2164
2164
  }
2165
+ function getTabbableNearElement(referenceElement, dir) {
2166
+ if (!referenceElement) return null;
2167
+ const list = tabbable(ownerDocument(referenceElement).body);
2168
+ const elementCount = list.length;
2169
+ if (elementCount === 0) return null;
2170
+ const index = list.indexOf(referenceElement);
2171
+ if (index === -1) return null;
2172
+ return list[(index + dir + elementCount) % elementCount];
2173
+ }
2174
+ function getTabbableAfterElement(referenceElement) {
2175
+ return getTabbableNearElement(referenceElement, 1);
2176
+ }
2177
+ function getTabbableBeforeElement(referenceElement) {
2178
+ return getTabbableNearElement(referenceElement, -1);
2179
+ }
2165
2180
  function isOutsideEvent(event, container) {
2166
2181
  const containerElement = container || event.currentTarget;
2167
2182
  const relatedTarget = event.relatedTarget;
@@ -2189,7 +2204,7 @@ function enableFocusInside(container) {
2189
2204
  * A React.useEffect equivalent that runs once, when the component is mounted.
2190
2205
  */
2191
2206
  function useOnMount(fn) {
2192
- import_react.useEffect(fn, EMPTY_ARRAY$1);
2207
+ import_react.useEffect(fn, EMPTY_ARRAY);
2193
2208
  }
2194
2209
  //#endregion
2195
2210
  //#region node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/utils/useTimeout.mjs
@@ -2539,9 +2554,8 @@ var focusOut = "focus-out";
2539
2554
  var escapeKey = "escape-key";
2540
2555
  var listNavigation = "list-navigation";
2541
2556
  var cancelOpen = "cancel-open";
2557
+ var siblingOpen = "sibling-open";
2542
2558
  var disabled = "disabled";
2543
- var missing = "missing";
2544
- var initial = "initial";
2545
2559
  var imperativeAction = "imperative-action";
2546
2560
  var windowResize = "window-resize";
2547
2561
  //#endregion
@@ -2687,25 +2701,6 @@ var Input = /*#__PURE__*/ import_react.forwardRef(function Input(props, forwarde
2687
2701
  });
2688
2702
  });
2689
2703
  //#endregion
2690
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/separator/Separator.mjs
2691
- /**
2692
- * A separator element accessible to screen readers.
2693
- * Renders a `<div>` element.
2694
- *
2695
- * Documentation: [Base UI Separator](https://base-ui.com/react/components/separator)
2696
- */
2697
- var Separator = /*#__PURE__*/ import_react.forwardRef(function SeparatorComponent(componentProps, forwardedRef) {
2698
- const { className, render, orientation = "horizontal", style, ...elementProps } = componentProps;
2699
- return useRenderElement("div", componentProps, {
2700
- state: { orientation },
2701
- ref: forwardedRef,
2702
- props: [{
2703
- role: "separator",
2704
- "aria-orientation": orientation
2705
- }, elementProps]
2706
- });
2707
- });
2708
- //#endregion
2709
2704
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/dialog/root/DialogRootContext.mjs
2710
2705
  var DialogRootContext = /*#__PURE__*/ import_react.createContext(void 0);
2711
2706
  function useDialogRootContext(optional) {
@@ -3238,6 +3233,7 @@ function markOthers(avoidElements, options = {}) {
3238
3233
  //#endregion
3239
3234
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/constants.mjs
3240
3235
  var DISABLED_TRANSITIONS_STYLE = { style: { transition: "none" } };
3236
+ var CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger";
3241
3237
  var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
3242
3238
  var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
3243
3239
  `${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}`;
@@ -3421,6 +3417,23 @@ function createEventEmitter() {
3421
3417
  };
3422
3418
  }
3423
3419
  //#endregion
3420
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingTreeStore.mjs
3421
+ /**
3422
+ * Stores and manages floating elements in a tree structure.
3423
+ * This is a backing store for the `FloatingTree` component.
3424
+ */
3425
+ var FloatingTreeStore = class {
3426
+ nodesRef = { current: [] };
3427
+ events = createEventEmitter();
3428
+ addNode(node) {
3429
+ this.nodesRef.current.push(node);
3430
+ }
3431
+ removeNode(node) {
3432
+ const index = this.nodesRef.current.findIndex((n) => n === node);
3433
+ if (index !== -1) this.nodesRef.current.splice(index, 1);
3434
+ }
3435
+ };
3436
+ //#endregion
3424
3437
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3425
3438
  var FloatingNodeContext = /*#__PURE__*/ import_react.createContext(null);
3426
3439
  var FloatingTreeContext = /*#__PURE__*/ import_react.createContext(null);
@@ -3432,6 +3445,66 @@ var useFloatingTree = (externalTree) => {
3432
3445
  const contextTree = import_react.useContext(FloatingTreeContext);
3433
3446
  return externalTree ?? contextTree;
3434
3447
  };
3448
+ /**
3449
+ * Registers a node into the `FloatingTree`, returning its id.
3450
+ * @see https://floating-ui.com/docs/FloatingTree
3451
+ */
3452
+ function useFloatingNodeId(externalTree) {
3453
+ const id = useId();
3454
+ const tree = useFloatingTree(externalTree);
3455
+ const parentId = useFloatingParentNodeId();
3456
+ useIsoLayoutEffect(() => {
3457
+ if (!id) return;
3458
+ const node = {
3459
+ id,
3460
+ parentId
3461
+ };
3462
+ tree?.addNode(node);
3463
+ return () => {
3464
+ tree?.removeNode(node);
3465
+ };
3466
+ }, [
3467
+ tree,
3468
+ id,
3469
+ parentId
3470
+ ]);
3471
+ return id;
3472
+ }
3473
+ /**
3474
+ * Provides parent node context for nested floating elements.
3475
+ * @see https://floating-ui.com/docs/FloatingTree
3476
+ * @internal
3477
+ */
3478
+ function FloatingNode(props) {
3479
+ const { children, id } = props;
3480
+ const parentId = useFloatingParentNodeId();
3481
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingNodeContext.Provider, {
3482
+ value: import_react.useMemo(() => ({
3483
+ id,
3484
+ parentId
3485
+ }), [id, parentId]),
3486
+ children
3487
+ });
3488
+ }
3489
+ /**
3490
+ * Provides context for nested floating elements when they are not children of
3491
+ * each other on the DOM.
3492
+ * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:
3493
+ * - The `bubbles` option in the `useDismiss()` Hook
3494
+ * - Nested virtual list navigation
3495
+ * - Nested floating elements that each open on hover
3496
+ * - Custom communication between parent and child floating elements
3497
+ * @see https://floating-ui.com/docs/FloatingTree
3498
+ * @internal
3499
+ */
3500
+ function FloatingTree(props) {
3501
+ const { children, externalTree } = props;
3502
+ const tree = useRefWithInit(() => externalTree ?? new FloatingTreeStore()).current;
3503
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingTreeContext.Provider, {
3504
+ value: tree,
3505
+ children
3506
+ });
3507
+ }
3435
3508
  //#endregion
3436
3509
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs
3437
3510
  function getEventType(event, lastInteractionType) {
@@ -6075,7 +6148,7 @@ var ReactStore = class extends Store {
6075
6148
  };
6076
6149
  //#endregion
6077
6150
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
6078
- var selectors$3 = {
6151
+ var selectors$4 = {
6079
6152
  open: (state) => state.open,
6080
6153
  transitionStatus: (state) => state.transitionStatus,
6081
6154
  domReferenceElement: (state) => state.domReferenceElement,
@@ -6096,7 +6169,7 @@ var FloatingRootStore = class extends ReactStore {
6096
6169
  events: createEventEmitter(),
6097
6170
  nested,
6098
6171
  triggerElements
6099
- }, selectors$3);
6172
+ }, selectors$4);
6100
6173
  this.syncOnly = syncOnly;
6101
6174
  }
6102
6175
  /**
@@ -7895,7 +7968,7 @@ function useTypeahead(context, props) {
7895
7968
  function isItemAvailable(index) {
7896
7969
  const element = getElement(index);
7897
7970
  if (element && !isElementVisible(element) || element?.matches(":disabled")) return false;
7898
- return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY$1, index, disabledIndices);
7971
+ return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index, disabledIndices);
7899
7972
  }
7900
7973
  function getMatchingIndex(list, string, startIndex = 0) {
7901
7974
  if (list.length === 0) return -1;
@@ -8156,89 +8229,14 @@ function useDialogPortalContext() {
8156
8229
  if (value === void 0) throw new Error(formatErrorMessage(26));
8157
8230
  return value;
8158
8231
  }
8159
- //#endregion
8160
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/composite/composite.mjs
8161
- var ARROW_UP = "ArrowUp";
8162
- var ARROW_DOWN = "ArrowDown";
8163
- var ARROW_LEFT = "ArrowLeft";
8164
- var ARROW_RIGHT = "ArrowRight";
8165
8232
  var COMPOSITE_KEYS = /* @__PURE__ */ new Set([
8166
- ARROW_UP,
8167
- ARROW_DOWN,
8168
- ARROW_LEFT,
8169
- ARROW_RIGHT,
8233
+ "ArrowUp",
8234
+ "ArrowDown",
8235
+ "ArrowLeft",
8236
+ "ArrowRight",
8170
8237
  "Home",
8171
8238
  "End"
8172
8239
  ]);
8173
- var MODIFIER_KEYS = [
8174
- "Shift",
8175
- "Control",
8176
- "Alt",
8177
- "Meta"
8178
- ];
8179
- function isInputElement(element) {
8180
- return isHTMLElement(element) && element.tagName === "INPUT";
8181
- }
8182
- function isNativeInput(element) {
8183
- if (isInputElement(element) && element.selectionStart != null) return true;
8184
- if (isHTMLElement(element) && element.tagName === "TEXTAREA") return true;
8185
- return false;
8186
- }
8187
- function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {
8188
- if (!scrollContainer || !element || !element.scrollTo) return;
8189
- let targetX = scrollContainer.scrollLeft;
8190
- let targetY = scrollContainer.scrollTop;
8191
- const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;
8192
- const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;
8193
- if (isOverflowingX && orientation !== "vertical") {
8194
- const elementOffsetLeft = getOffset(scrollContainer, element, "left");
8195
- const containerStyles = getStyles(scrollContainer);
8196
- const elementStyles = getStyles(element);
8197
- if (direction === "ltr") {
8198
- if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
8199
- else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
8200
- }
8201
- if (direction === "rtl") {
8202
- if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
8203
- else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
8204
- }
8205
- }
8206
- if (isOverflowingY && orientation !== "horizontal") {
8207
- const elementOffsetTop = getOffset(scrollContainer, element, "top");
8208
- const containerStyles = getStyles(scrollContainer);
8209
- const elementStyles = getStyles(element);
8210
- if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;
8211
- else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;
8212
- }
8213
- scrollContainer.scrollTo({
8214
- left: targetX,
8215
- top: targetY,
8216
- behavior: "auto"
8217
- });
8218
- }
8219
- function getOffset(ancestor, element, side) {
8220
- const propName = side === "left" ? "offsetLeft" : "offsetTop";
8221
- let result = 0;
8222
- while (element.offsetParent) {
8223
- result += element[propName];
8224
- if (element.offsetParent === ancestor) break;
8225
- element = element.offsetParent;
8226
- }
8227
- return result;
8228
- }
8229
- function getStyles(element) {
8230
- const styles = getComputedStyle(element);
8231
- return {
8232
- scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,
8233
- scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,
8234
- scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,
8235
- scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,
8236
- scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,
8237
- scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,
8238
- scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,
8239
- scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0
8240
- };
8241
- }
8242
8240
  //#endregion
8243
8241
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/dialog/utils/stateAttributesMapping.mjs
8244
8242
  /**
@@ -8657,7 +8655,7 @@ function DialogInteractions({ store, parentContext, isDrawer }) {
8657
8655
  }
8658
8656
  //#endregion
8659
8657
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/dialog/store/DialogStore.mjs
8660
- var selectors$2 = {
8658
+ var selectors$3 = {
8661
8659
  ...popupStoreSelectors,
8662
8660
  modal: (state) => state.modal,
8663
8661
  nested: (state) => state.nested,
@@ -8678,8 +8676,8 @@ var selectors$2 = {
8678
8676
  var DialogStore = class extends ReactStore {
8679
8677
  constructor(initialState, floatingId, nested) {
8680
8678
  const triggerElements = new PopupTriggerMap();
8681
- const state = createInitialState$1(initialState, triggerElements, floatingId, nested);
8682
- super(state, createInitialContext$1(triggerElements), selectors$2);
8679
+ const state = createInitialState$2(initialState, triggerElements, floatingId, nested);
8680
+ super(state, createInitialContext$2(triggerElements), selectors$3);
8683
8681
  }
8684
8682
  setOpen = (nextOpen, eventDetails) => {
8685
8683
  eventDetails.preventUnmountOnClose = () => {
@@ -8694,7 +8692,7 @@ var DialogStore = class extends ReactStore {
8694
8692
  this.update(updatedState);
8695
8693
  };
8696
8694
  };
8697
- function createInitialState$1(initialState, triggerElements, floatingId, nested = false) {
8695
+ function createInitialState$2(initialState, triggerElements, floatingId, nested = false) {
8698
8696
  const state = {
8699
8697
  ...createInitialPopupStoreState(),
8700
8698
  modal: true,
@@ -8712,7 +8710,7 @@ function createInitialState$1(initialState, triggerElements, floatingId, nested
8712
8710
  state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
8713
8711
  return state;
8714
8712
  }
8715
- function createInitialContext$1(triggerElements) {
8713
+ function createInitialContext$2(triggerElements) {
8716
8714
  return {
8717
8715
  popupRef: /*#__PURE__*/ import_react.createRef(),
8718
8716
  backdropRef: /*#__PURE__*/ import_react.createRef(),
@@ -8874,6 +8872,63 @@ function useOpenInteractionType(open) {
8874
8872
  }), [openMethod, triggerProps]);
8875
8873
  }
8876
8874
  //#endregion
8875
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/dialog/trigger/DialogTrigger.mjs
8876
+ /**
8877
+ * A button that opens the dialog.
8878
+ * Renders a `<button>` element.
8879
+ *
8880
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
8881
+ */
8882
+ var DialogTrigger = /*#__PURE__*/ import_react.forwardRef(function DialogTrigger(componentProps, forwardedRef) {
8883
+ const { render, className, style, disabled = false, nativeButton = true, id: idProp, payload, handle, ...elementProps } = componentProps;
8884
+ const dialogRootStore = useDialogRootContext(true);
8885
+ const store = usePopupHandleStore(handle) ?? dialogRootStore;
8886
+ if (!store) throw new Error(formatErrorMessage(79));
8887
+ const thisTriggerId = useBaseUiId(idProp);
8888
+ const floatingContext = store.useState("floatingRootContext");
8889
+ const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
8890
+ const popupId = store.useState("triggerPopupId", thisTriggerId);
8891
+ const triggerElementRef = import_react.useRef(null);
8892
+ const { registerTrigger, isMountedByThisTrigger } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { payload });
8893
+ const { getButtonProps, buttonRef } = useButton({
8894
+ disabled,
8895
+ native: nativeButton
8896
+ });
8897
+ const click = useClick(floatingContext);
8898
+ const interactionTypeProps = useOpenMethodTriggerProps(() => store.select("open"), (interactionType) => {
8899
+ store.set("openMethod", interactionType);
8900
+ });
8901
+ const state = {
8902
+ disabled,
8903
+ open: isOpenedByThisTrigger
8904
+ };
8905
+ const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
8906
+ return useRenderElement("button", componentProps, {
8907
+ state,
8908
+ ref: [
8909
+ buttonRef,
8910
+ forwardedRef,
8911
+ registerTrigger,
8912
+ triggerElementRef
8913
+ ],
8914
+ props: [
8915
+ click.reference,
8916
+ rootTriggerProps,
8917
+ interactionTypeProps,
8918
+ {
8919
+ [CLICK_TRIGGER_IDENTIFIER]: "",
8920
+ id: thisTriggerId,
8921
+ "aria-haspopup": "dialog",
8922
+ "aria-expanded": isOpenedByThisTrigger,
8923
+ "aria-controls": popupId
8924
+ },
8925
+ elementProps,
8926
+ getButtonProps
8927
+ ],
8928
+ stateAttributesMapping: triggerOpenStateMapping
8929
+ });
8930
+ });
8931
+ //#endregion
8877
8932
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
8878
8933
  var TooltipRootContext = /*#__PURE__*/ import_react.createContext(void 0);
8879
8934
  function useTooltipRootContext(optional) {
@@ -8883,7 +8938,7 @@ function useTooltipRootContext(optional) {
8883
8938
  }
8884
8939
  //#endregion
8885
8940
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
8886
- var selectors$1 = {
8941
+ var selectors$2 = {
8887
8942
  ...popupStoreSelectors,
8888
8943
  disabled: (state) => state.disabled,
8889
8944
  instantType: (state) => state.instantType,
@@ -8906,7 +8961,7 @@ var selectors$1 = {
8906
8961
  var TooltipStore = class extends ReactStore {
8907
8962
  constructor(initialState, floatingId, nested) {
8908
8963
  const triggerElements = new PopupTriggerMap();
8909
- super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors$1);
8964
+ super(createInitialState$1(initialState, triggerElements, floatingId, nested), createInitialContext$1(triggerElements), selectors$2);
8910
8965
  }
8911
8966
  setOpen = (nextOpen, eventDetails) => {
8912
8967
  applyPopupOpenChange(this, nextOpen, eventDetails, { extraState: { openChangeReason: eventDetails.reason } });
@@ -8915,7 +8970,7 @@ var TooltipStore = class extends ReactStore {
8915
8970
  this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(triggerPress, event));
8916
8971
  }
8917
8972
  };
8918
- function createInitialState(initialState, triggerElements, floatingId, nested = false) {
8973
+ function createInitialState$1(initialState, triggerElements, floatingId, nested = false) {
8919
8974
  const state = {
8920
8975
  ...createInitialPopupStoreState(),
8921
8976
  disabled: false,
@@ -8932,7 +8987,7 @@ function createInitialState(initialState, triggerElements, floatingId, nested =
8932
8987
  state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
8933
8988
  return state;
8934
8989
  }
8935
- function createInitialContext(triggerElements) {
8990
+ function createInitialContext$1(triggerElements) {
8936
8991
  return {
8937
8992
  popupRef: /*#__PURE__*/ import_react.createRef(),
8938
8993
  onOpenChange: void 0,
@@ -9989,7 +10044,7 @@ function resolveMultipleLabels(values, items, itemToStringLabel) {
9989
10044
  }
9990
10045
  //#endregion
9991
10046
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/select/store.mjs
9992
- var selectors = {
10047
+ var selectors$1 = {
9993
10048
  id: (state) => state.id,
9994
10049
  labelId: (state) => state.labelId,
9995
10050
  modal: (state) => state.modal,
@@ -10075,7 +10130,7 @@ function SelectRoot(props) {
10075
10130
  const name = fieldName ?? nameProp;
10076
10131
  const [value, setValueUnwrapped] = useControlled({
10077
10132
  controlled: valueProp,
10078
- default: multiple ? defaultValue ?? EMPTY_ARRAY$1 : defaultValue,
10133
+ default: multiple ? defaultValue ?? EMPTY_ARRAY : defaultValue,
10079
10134
  name: "Select",
10080
10135
  state: "value"
10081
10136
  });
@@ -10130,10 +10185,10 @@ function SelectRoot(props) {
10130
10185
  scrollDownArrowVisible: false,
10131
10186
  hasScrollArrows: false
10132
10187
  })).current;
10133
- const activeIndex = useStore(store, selectors.activeIndex);
10134
- const selectedIndex = useStore(store, selectors.selectedIndex);
10135
- const triggerElement = useStore(store, selectors.triggerElement);
10136
- const positionerElement = useStore(store, selectors.positionerElement);
10188
+ const activeIndex = useStore(store, selectors$1.activeIndex);
10189
+ const selectedIndex = useStore(store, selectors$1.selectedIndex);
10190
+ const triggerElement = useStore(store, selectors$1.triggerElement);
10191
+ const positionerElement = useStore(store, selectors$1.positionerElement);
10137
10192
  const previousOpenMethod = usePreviousValue(openMethod);
10138
10193
  const renderedOpenMethod = openMethod ?? previousOpenMethod;
10139
10194
  const serializedValue = import_react.useMemo(() => {
@@ -10248,7 +10303,7 @@ function SelectRoot(props) {
10248
10303
  listRef,
10249
10304
  activeIndex,
10250
10305
  selectedIndex,
10251
- disabledIndices: EMPTY_ARRAY$1,
10306
+ disabledIndices: EMPTY_ARRAY,
10252
10307
  onNavigate(nextActiveIndex) {
10253
10308
  if (nextActiveIndex === null && !open) return;
10254
10309
  store.set("activeIndex", nextActiveIndex);
@@ -10455,7 +10510,7 @@ function getPseudoElementBounds(element) {
10455
10510
  //#endregion
10456
10511
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/select/trigger/SelectTrigger.mjs
10457
10512
  var SELECTED_DELAY = 400;
10458
- var stateAttributesMapping$5 = {
10513
+ var stateAttributesMapping$4 = {
10459
10514
  ...pressableTriggerOpenStateMapping,
10460
10515
  ...fieldValidityMapping,
10461
10516
  popupSide: (side) => side ? { "data-popup-side": side } : null,
@@ -10473,16 +10528,16 @@ var SelectTrigger = /*#__PURE__*/ import_react.forwardRef(function SelectTrigger
10473
10528
  const { labelId: fieldLabelId } = useLabelableContext();
10474
10529
  const { store, setOpen, selectionRef, validation, readOnly, required, alignItemWithTriggerActiveRef, disabled: selectDisabled } = useSelectRootContext();
10475
10530
  const disabled = fieldDisabled || selectDisabled || disabledProp;
10476
- const open = useStore(store, selectors.open);
10477
- const mounted = useStore(store, selectors.mounted);
10478
- const value = useStore(store, selectors.value);
10479
- const triggerProps = useStore(store, selectors.triggerProps);
10480
- const positionerElement = useStore(store, selectors.positionerElement);
10481
- const listElement = useStore(store, selectors.listElement);
10482
- const popupSideValue = useStore(store, selectors.popupSide);
10483
- const rootId = useStore(store, selectors.id);
10484
- const selectLabelId = useStore(store, selectors.labelId);
10485
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
10531
+ const open = useStore(store, selectors$1.open);
10532
+ const mounted = useStore(store, selectors$1.mounted);
10533
+ const value = useStore(store, selectors$1.value);
10534
+ const triggerProps = useStore(store, selectors$1.triggerProps);
10535
+ const positionerElement = useStore(store, selectors$1.positionerElement);
10536
+ const listElement = useStore(store, selectors$1.listElement);
10537
+ const popupSideValue = useStore(store, selectors$1.popupSide);
10538
+ const rootId = useStore(store, selectors$1.id);
10539
+ const selectLabelId = useStore(store, selectors$1.labelId);
10540
+ const hasSelectedValue = useStore(store, selectors$1.hasSelectedValue);
10486
10541
  const popupSide = mounted && positionerElement ? popupSideValue : null;
10487
10542
  const id = idProp ?? rootId;
10488
10543
  const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, selectLabelId);
@@ -10576,13 +10631,13 @@ var SelectTrigger = /*#__PURE__*/ import_react.forwardRef(function SelectTrigger
10576
10631
  setTriggerElement
10577
10632
  ],
10578
10633
  state,
10579
- stateAttributesMapping: stateAttributesMapping$5,
10634
+ stateAttributesMapping: stateAttributesMapping$4,
10580
10635
  props
10581
10636
  });
10582
10637
  });
10583
10638
  //#endregion
10584
10639
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/select/value/SelectValue.mjs
10585
- var stateAttributesMapping$4 = { value: () => null };
10640
+ var stateAttributesMapping$3 = { value: () => null };
10586
10641
  /**
10587
10642
  * A text label of the currently selected item.
10588
10643
  * Renders a `<span>` element.
@@ -10592,12 +10647,12 @@ var stateAttributesMapping$4 = { value: () => null };
10592
10647
  var SelectValue = /*#__PURE__*/ import_react.forwardRef(function SelectValue(componentProps, forwardedRef) {
10593
10648
  const { className, render, children: childrenProp, placeholder, style, ...elementProps } = componentProps;
10594
10649
  const { store, valueRef } = useSelectRootContext();
10595
- const value = useStore(store, selectors.value);
10596
- const items = useStore(store, selectors.items);
10597
- const itemToStringLabel = useStore(store, selectors.itemToStringLabel);
10598
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
10650
+ const value = useStore(store, selectors$1.value);
10651
+ const items = useStore(store, selectors$1.items);
10652
+ const itemToStringLabel = useStore(store, selectors$1.itemToStringLabel);
10653
+ const hasSelectedValue = useStore(store, selectors$1.hasSelectedValue);
10599
10654
  const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;
10600
- const hasNullLabel = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
10655
+ const hasNullLabel = useStore(store, selectors$1.hasNullItemLabel, shouldCheckNullItemLabel);
10601
10656
  const state = {
10602
10657
  value,
10603
10658
  placeholder: !hasSelectedValue
@@ -10612,7 +10667,7 @@ var SelectValue = /*#__PURE__*/ import_react.forwardRef(function SelectValue(com
10612
10667
  state,
10613
10668
  ref: [forwardedRef, valueRef],
10614
10669
  props: [{ children }, elementProps],
10615
- stateAttributesMapping: stateAttributesMapping$4
10670
+ stateAttributesMapping: stateAttributesMapping$3
10616
10671
  });
10617
10672
  });
10618
10673
  //#endregion
@@ -10627,7 +10682,7 @@ var SelectIcon = /*#__PURE__*/ import_react.forwardRef(function SelectIcon(compo
10627
10682
  const { render, className, style, ...elementProps } = componentProps;
10628
10683
  const { store } = useSelectRootContext();
10629
10684
  return useRenderElement("span", componentProps, {
10630
- state: { open: useStore(store, selectors.open) },
10685
+ state: { open: useStore(store, selectors$1.open) },
10631
10686
  ref: forwardedRef,
10632
10687
  props: [{
10633
10688
  "aria-hidden": true,
@@ -10647,8 +10702,8 @@ var SelectIcon = /*#__PURE__*/ import_react.forwardRef(function SelectIcon(compo
10647
10702
  */
10648
10703
  var SelectPortal = /*#__PURE__*/ import_react.forwardRef(function SelectPortal(portalProps, forwardedRef) {
10649
10704
  const { store } = useSelectRootContext();
10650
- const mounted = useStore(store, selectors.mounted);
10651
- const forceMount = useStore(store, selectors.forceMount);
10705
+ const mounted = useStore(store, selectors$1.mounted);
10706
+ const forceMount = useStore(store, selectors$1.forceMount);
10652
10707
  if (!(mounted || forceMount)) return null;
10653
10708
  return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingPortal, {
10654
10709
  ref: forwardedRef,
@@ -10888,15 +10943,15 @@ var FIXED = { position: "fixed" };
10888
10943
  var SelectPositioner = /*#__PURE__*/ import_react.forwardRef(function SelectPositioner(componentProps, forwardedRef) {
10889
10944
  const { anchor, className, render, positionMethod, side, align, sideOffset, alignOffset, collisionBoundary = "clipping-ancestors", collisionPadding, arrowPadding, sticky, disableAnchorTracking, alignItemWithTrigger = true, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style, ...elementProps } = componentProps;
10890
10945
  const { store, listRef, labelsRef, alignItemWithTriggerActiveRef, selectedItemTextRef, valuesRef, initialValueRef, popupRef, setValue, floatingContext: floatingRootContext } = useSelectRootContext();
10891
- const open = useStore(store, selectors.open);
10892
- const mounted = useStore(store, selectors.mounted);
10893
- const modal = useStore(store, selectors.modal);
10894
- const value = useStore(store, selectors.value);
10895
- const openMethod = useStore(store, selectors.openMethod);
10896
- const positionerElement = useStore(store, selectors.positionerElement);
10897
- const triggerElement = useStore(store, selectors.triggerElement);
10898
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
10899
- const transitionStatus = useStore(store, selectors.transitionStatus);
10946
+ const open = useStore(store, selectors$1.open);
10947
+ const mounted = useStore(store, selectors$1.mounted);
10948
+ const modal = useStore(store, selectors$1.modal);
10949
+ const value = useStore(store, selectors$1.value);
10950
+ const openMethod = useStore(store, selectors$1.openMethod);
10951
+ const positionerElement = useStore(store, selectors$1.positionerElement);
10952
+ const triggerElement = useStore(store, selectors$1.triggerElement);
10953
+ const isItemEqualToValue = useStore(store, selectors$1.isItemEqualToValue);
10954
+ const transitionStatus = useStore(store, selectors$1.transitionStatus);
10900
10955
  const scrollUpArrowRef = import_react.useRef(null);
10901
10956
  const scrollDownArrowRef = import_react.useRef(null);
10902
10957
  const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] = import_react.useState(alignItemWithTrigger);
@@ -11035,7 +11090,7 @@ function useCSPContext() {
11035
11090
  }
11036
11091
  //#endregion
11037
11092
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/select/popup/SelectPopup.mjs
11038
- var stateAttributesMapping$3 = {
11093
+ var stateAttributesMapping$2 = {
11039
11094
  ...popupStateMapping,
11040
11095
  ...transitionStatusMapping
11041
11096
  };
@@ -11052,15 +11107,15 @@ var SelectPopup = /*#__PURE__*/ import_react.forwardRef(function SelectPopup(com
11052
11107
  const insideToolbar = useToolbarRootContext(true) != null;
11053
11108
  const direction = useDirection();
11054
11109
  const { nonce, disableStyleElements } = useCSPContext();
11055
- const id = useStore(store, selectors.id);
11056
- const open = useStore(store, selectors.open);
11057
- const openMethod = useStore(store, selectors.openMethod);
11058
- const mounted = useStore(store, selectors.mounted);
11059
- const popupProps = useStore(store, selectors.popupProps);
11060
- const transitionStatus = useStore(store, selectors.transitionStatus);
11061
- const triggerElement = useStore(store, selectors.triggerElement);
11062
- const positionerElement = useStore(store, selectors.positionerElement);
11063
- const listElement = useStore(store, selectors.listElement);
11110
+ const id = useStore(store, selectors$1.id);
11111
+ const open = useStore(store, selectors$1.open);
11112
+ const openMethod = useStore(store, selectors$1.openMethod);
11113
+ const mounted = useStore(store, selectors$1.mounted);
11114
+ const popupProps = useStore(store, selectors$1.popupProps);
11115
+ const transitionStatus = useStore(store, selectors$1.transitionStatus);
11116
+ const triggerElement = useStore(store, selectors$1.triggerElement);
11117
+ const positionerElement = useStore(store, selectors$1.positionerElement);
11118
+ const listElement = useStore(store, selectors$1.listElement);
11064
11119
  const reachedMaxHeightRef = import_react.useRef(false);
11065
11120
  const initialPlacedRef = import_react.useRef(false);
11066
11121
  const originalPositionerStylesRef = import_react.useRef({});
@@ -11160,7 +11215,7 @@ var SelectPopup = /*#__PURE__*/ import_react.forwardRef(function SelectPopup(com
11160
11215
  const restoreTransformStyles = unsetTransformStyles(popupElement);
11161
11216
  try {
11162
11217
  let textElement = selectedItemTextRef.current;
11163
- if (!textElement?.isConnected) textElement = !selectors.hasSelectedValue(store.state) && firstItemTextRef.current?.isConnected ? firstItemTextRef.current : null;
11218
+ if (!textElement?.isConnected) textElement = !selectors$1.hasSelectedValue(store.state) && firstItemTextRef.current?.isConnected ? firstItemTextRef.current : null;
11164
11219
  const valueElement = valueRef.current;
11165
11220
  const win = getWindow(positionerElement);
11166
11221
  const positionerStyles = win.getComputedStyle(positionerElement);
@@ -11291,7 +11346,7 @@ var SelectPopup = /*#__PURE__*/ import_react.forwardRef(function SelectPopup(com
11291
11346
  const element = useRenderElement("div", componentProps, {
11292
11347
  ref: [forwardedRef, popupRef],
11293
11348
  state,
11294
- stateAttributesMapping: stateAttributesMapping$3,
11349
+ stateAttributesMapping: stateAttributesMapping$2,
11295
11350
  props: [
11296
11351
  popupProps,
11297
11352
  defaultProps,
@@ -11362,10 +11417,10 @@ var SelectList = /*#__PURE__*/ import_react.forwardRef(function SelectList(compo
11362
11417
  const { render, className, style, ...elementProps } = componentProps;
11363
11418
  const { store, scrollHandlerRef, multiple } = useSelectRootContext();
11364
11419
  const { alignItemWithTriggerActive } = useSelectPositionerContext();
11365
- const hasScrollArrows = useStore(store, selectors.hasScrollArrows);
11366
- const openMethod = useStore(store, selectors.openMethod);
11420
+ const hasScrollArrows = useStore(store, selectors$1.hasScrollArrows);
11421
+ const openMethod = useStore(store, selectors$1.openMethod);
11367
11422
  const defaultProps = {
11368
- id: `${useStore(store, selectors.id)}-list`,
11423
+ id: `${useStore(store, selectors$1.id)}-list`,
11369
11424
  role: "listbox",
11370
11425
  "aria-multiselectable": multiple || void 0,
11371
11426
  onScroll(event) {
@@ -11454,11 +11509,11 @@ var SelectItem = /*#__PURE__*/ import_react.memo(/*#__PURE__*/ import_react.forw
11454
11509
  });
11455
11510
  const { store, itemProps, setOpen, setValue, selectionRef, typingRef, valuesRef, multiple, selectedItemTextRef, disabled: selectDisabled, readOnly } = useSelectRootContext();
11456
11511
  const disabled = selectDisabled || disabledProp;
11457
- const highlighted = useStore(store, selectors.isActive, listItem.index);
11458
- const open = useStore(store, selectors.open);
11459
- const selected = useStore(store, selectors.isSelected, itemValue);
11460
- const selectedByFocus = useStore(store, selectors.isSelectedByFocus, listItem.index);
11461
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
11512
+ const highlighted = useStore(store, selectors$1.isActive, listItem.index);
11513
+ const open = useStore(store, selectors$1.open);
11514
+ const selected = useStore(store, selectors$1.isSelected, itemValue);
11515
+ const selectedByFocus = useStore(store, selectors$1.isSelectedByFocus, listItem.index);
11516
+ const isItemEqualToValue = useStore(store, selectors$1.isItemEqualToValue);
11462
11517
  const index = listItem.index;
11463
11518
  const itemRef = import_react.useRef(null);
11464
11519
  useIsoLayoutEffect(() => {
@@ -11673,8 +11728,8 @@ var SelectScrollArrow = /*#__PURE__*/ import_react.forwardRef(function SelectScr
11673
11728
  const isUp = direction === "up";
11674
11729
  const { store, popupRef, listRef, handleScrollArrowVisibility, scrollArrowsMountedCountRef } = useSelectRootContext();
11675
11730
  const { side, scrollDownArrowRef, scrollUpArrowRef } = useSelectPositionerContext();
11676
- const stateVisible = useStore(store, isUp ? selectors.scrollUpArrowVisible : selectors.scrollDownArrowVisible);
11677
- const openMethod = useStore(store, selectors.openMethod);
11731
+ const stateVisible = useStore(store, isUp ? selectors$1.scrollUpArrowVisible : selectors$1.scrollDownArrowVisible);
11732
+ const openMethod = useStore(store, selectors$1.openMethod);
11678
11733
  const visible = stateVisible && openMethod !== "touch";
11679
11734
  const timeout = useTimeout();
11680
11735
  const scrollArrowRef = isUp ? scrollUpArrowRef : scrollDownArrowRef;
@@ -11808,7 +11863,7 @@ function useSwitchRootContext() {
11808
11863
  }
11809
11864
  //#endregion
11810
11865
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/switch/stateAttributesMapping.mjs
11811
- var stateAttributesMapping$2 = {
11866
+ var stateAttributesMapping$1 = {
11812
11867
  ...fieldValidityMapping,
11813
11868
  checked(value) {
11814
11869
  if (value) return { "data-checked": "" };
@@ -11945,7 +12000,7 @@ var SwitchRoot = /*#__PURE__*/ import_react.forwardRef(function SwitchRoot(compo
11945
12000
  getButtonProps,
11946
12001
  (props) => validation.getValidationProps(disabled, props)
11947
12002
  ],
11948
- stateAttributesMapping: stateAttributesMapping$2
12003
+ stateAttributesMapping: stateAttributesMapping$1
11949
12004
  });
11950
12005
  return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(SwitchRootContext.Provider, {
11951
12006
  value: state,
@@ -11978,7 +12033,7 @@ var SwitchThumb = /*#__PURE__*/ import_react.forwardRef(function SwitchThumb(com
11978
12033
  return useRenderElement("span", componentProps, {
11979
12034
  state: useSwitchRootContext(),
11980
12035
  ref: forwardedRef,
11981
- stateAttributesMapping: stateAttributesMapping$2,
12036
+ stateAttributesMapping: stateAttributesMapping$1,
11982
12037
  props: elementProps
11983
12038
  });
11984
12039
  });
@@ -12058,7 +12113,7 @@ function useImageLoadingStatus(src, { referrerPolicy, crossOrigin, sizes, srcSet
12058
12113
  }
12059
12114
  //#endregion
12060
12115
  //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/avatar/image/AvatarImage.mjs
12061
- var stateAttributesMapping$1 = {
12116
+ var stateAttributesMapping = {
12062
12117
  ...avatarStateAttributesMapping,
12063
12118
  ...transitionStatusMapping
12064
12119
  };
@@ -12099,7 +12154,7 @@ var AvatarImage = /*#__PURE__*/ import_react.forwardRef(function AvatarImage(com
12099
12154
  },
12100
12155
  ref: [forwardedRef, imageRef],
12101
12156
  props: elementProps,
12102
- stateAttributesMapping: stateAttributesMapping$1,
12157
+ stateAttributesMapping,
12103
12158
  enabled: mounted
12104
12159
  });
12105
12160
  if (!mounted) return null;
@@ -12132,710 +12187,1261 @@ var AvatarFallback = /*#__PURE__*/ import_react.forwardRef(function AvatarFallba
12132
12187
  });
12133
12188
  });
12134
12189
  //#endregion
12135
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs
12136
- /**
12137
- * @internal
12138
- */
12139
- var TabsRootContext = /*#__PURE__*/ import_react.createContext(void 0);
12140
- function useTabsRootContext() {
12141
- const context = import_react.useContext(TabsRootContext);
12142
- if (context === void 0) throw new Error(formatErrorMessage(64));
12190
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/positioner/MenuPositionerContext.mjs
12191
+ var MenuPositionerContext = /*#__PURE__*/ import_react.createContext(void 0);
12192
+ function useMenuPositionerContext(optional) {
12193
+ const context = import_react.useContext(MenuPositionerContext);
12194
+ if (context === void 0 && !optional) throw new Error(formatErrorMessage(33));
12143
12195
  return context;
12144
12196
  }
12145
12197
  //#endregion
12146
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs
12147
- var tabsStateAttributesMapping = { tabActivationDirection: (dir) => ({ "data-activation-direction": dir }) };
12198
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/root/MenuRootContext.mjs
12199
+ var MenuRootContext = /*#__PURE__*/ import_react.createContext(void 0);
12200
+ function useMenuRootContext(optional) {
12201
+ const context = import_react.useContext(MenuRootContext);
12202
+ if (context === void 0 && !optional) throw new Error(formatErrorMessage(36));
12203
+ return context;
12204
+ }
12205
+ //#endregion
12206
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/context-menu/root/ContextMenuRootContext.mjs
12207
+ var ContextMenuRootContext = /*#__PURE__*/ import_react.createContext(void 0);
12208
+ function useContextMenuRootContext(optional = true) {
12209
+ const context = import_react.useContext(ContextMenuRootContext);
12210
+ if (context === void 0 && !optional) throw new Error(formatErrorMessage(25));
12211
+ return context;
12212
+ }
12148
12213
  //#endregion
12149
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tabs/root/TabsRoot.mjs
12214
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/item/useMenuItemCommonProps.mjs
12150
12215
  /**
12151
- * Groups the tabs and the corresponding panels.
12152
- * Renders a `<div>` element.
12153
- *
12154
- * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
12155
- */
12156
- var TabsRoot = /*#__PURE__*/ import_react.forwardRef(function TabsRoot(componentProps, forwardedRef) {
12157
- const { className, defaultValue: defaultValueProp = 0, onValueChange: onValueChangeProp, orientation = "horizontal", render, value: valueProp, style, ...elementProps } = componentProps;
12158
- const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0;
12159
- const tabPanelRefs = import_react.useRef([]);
12160
- const [mountedTabPanels, setMountedTabPanels] = import_react.useState(() => /* @__PURE__ */ new Map());
12161
- const [value, setValue] = useControlled({
12162
- controlled: valueProp,
12163
- default: defaultValueProp,
12164
- name: "Tabs",
12165
- state: "value"
12166
- });
12167
- const isControlled = valueProp !== void 0;
12168
- const [tabMap, setTabMap] = import_react.useState(() => /* @__PURE__ */ new Map());
12169
- const lastKnownTabElementRef = import_react.useRef(void 0);
12170
- const getTabElementBySelectedValue = import_react.useCallback((selectedValue) => findTabElement(tabMap, selectedValue), [tabMap]);
12171
- const [activationDirectionState, setActivationDirectionState] = import_react.useState(() => ({
12172
- previousValue: value,
12173
- tabActivationDirection: "none"
12174
- }));
12175
- const { previousValue, tabActivationDirection: committedTabActivationDirection } = activationDirectionState;
12176
- let tabActivationDirection = committedTabActivationDirection;
12177
- let directionComputationIncomplete = false;
12178
- if (previousValue !== value) {
12179
- tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);
12180
- directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;
12181
- }
12182
- const nextPreviousValue = directionComputationIncomplete ? previousValue : value;
12183
- const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;
12184
- useIsoLayoutEffect(() => {
12185
- if (!shouldSyncActivationDirectionState) return;
12186
- setActivationDirectionState({
12187
- previousValue: nextPreviousValue,
12188
- tabActivationDirection
12189
- });
12190
- }, [
12191
- nextPreviousValue,
12192
- shouldSyncActivationDirectionState,
12193
- tabActivationDirection
12194
- ]);
12195
- const onValueChange = useStableCallback((newValue, eventDetails) => {
12196
- eventDetails.activationDirection = computeActivationDirection(value, newValue, orientation, tabMap);
12197
- onValueChangeProp?.(newValue, eventDetails);
12198
- if (eventDetails.isCanceled) return;
12199
- setValue(newValue);
12200
- });
12201
- const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => {
12202
- onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, { activationDirection: "none" }));
12203
- });
12204
- const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {
12205
- setMountedTabPanels((prev) => {
12206
- const next = new Map(prev);
12207
- next.set(panelValue, panelId);
12208
- return next;
12209
- });
12210
- return () => {
12211
- setMountedTabPanels((prev) => {
12212
- if (prev.get(panelValue) !== panelId) return prev;
12213
- const next = new Map(prev);
12214
- next.delete(panelValue);
12215
- return next;
12216
+ * Returns common props shared by all menu item types.
12217
+ * This hook extracts the shared logic for id, role, tabIndex, onKeyDown,
12218
+ * onMouseMove, onClick, and onMouseUp handlers.
12219
+ */
12220
+ function useMenuItemCommonProps(params) {
12221
+ const { closeOnClick, highlighted, id, nodeId, store, typingRef, itemRef, itemMetadata } = params;
12222
+ const { events: menuEvents } = store.useState("floatingTreeRoot");
12223
+ const open = store.useState("open");
12224
+ const contextMenuContext = useContextMenuRootContext(true);
12225
+ const isContextMenu = contextMenuContext !== void 0;
12226
+ return import_react.useMemo(() => ({
12227
+ id,
12228
+ role: "menuitem",
12229
+ tabIndex: open && highlighted ? 0 : -1,
12230
+ onKeyDown(event) {
12231
+ if (event.key === " " && typingRef?.current) event.preventDefault();
12232
+ },
12233
+ onMouseMove(event) {
12234
+ if (!nodeId) return;
12235
+ menuEvents.emit("itemhover", {
12236
+ nodeId,
12237
+ target: event.currentTarget
12216
12238
  });
12217
- };
12218
- });
12219
- const getTabPanelIdByValue = import_react.useCallback((tabValue) => {
12220
- return mountedTabPanels.get(tabValue);
12221
- }, [mountedTabPanels]);
12222
- const getTabIdByPanelValue = import_react.useCallback((tabPanelValue) => {
12223
- for (const tabMetadata of tabMap.values()) if (tabPanelValue === tabMetadata.value) return tabMetadata.id;
12224
- }, [tabMap]);
12225
- const tabsContextValue = import_react.useMemo(() => ({
12226
- getTabElementBySelectedValue,
12227
- getTabIdByPanelValue,
12228
- getTabPanelIdByValue,
12229
- onValueChange,
12230
- orientation,
12231
- registerMountedTabPanel,
12232
- setTabMap,
12233
- tabActivationDirection,
12234
- value
12235
- }), [
12236
- getTabElementBySelectedValue,
12237
- getTabIdByPanelValue,
12238
- getTabPanelIdByValue,
12239
- onValueChange,
12240
- orientation,
12241
- registerMountedTabPanel,
12242
- setTabMap,
12243
- tabActivationDirection,
12244
- value
12245
- ]);
12246
- const selectedTabMetadata = import_react.useMemo(() => {
12247
- for (const tabMetadata of tabMap.values()) if (tabMetadata.value === value) return tabMetadata;
12248
- }, [tabMap, value]);
12249
- const firstEnabledTabValue = import_react.useMemo(() => {
12250
- for (const tabMetadata of tabMap.values()) if (!tabMetadata.disabled) return tabMetadata.value;
12251
- }, [tabMap]);
12252
- const shouldNotifyInitialValueChangeRef = import_react.useRef(!hasExplicitDefaultValueProp);
12253
- const initialDefaultValueRef = import_react.useRef(defaultValueProp);
12254
- const shouldHonorDisabledDefaultValueRef = import_react.useRef(hasExplicitDefaultValueProp);
12255
- const didRegisterTabsRef = import_react.useRef(false);
12256
- useIsoLayoutEffect(() => {
12257
- if (isControlled) return;
12258
- function commitAutomaticValueChange(fallbackValue, fallbackReason) {
12259
- setValue(fallbackValue);
12260
- setActivationDirectionState({
12261
- previousValue: fallbackValue,
12262
- tabActivationDirection: "none"
12239
+ },
12240
+ onClick(event) {
12241
+ if (closeOnClick) menuEvents.emit("close", {
12242
+ domEvent: event,
12243
+ reason: itemPress
12263
12244
  });
12264
- notifyAutomaticValueChange(fallbackValue, fallbackReason);
12265
- shouldNotifyInitialValueChangeRef.current = false;
12266
- }
12267
- if (tabMap.size === 0) {
12268
- if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) commitAutomaticValueChange(null, missing);
12269
- return;
12270
- }
12271
- didRegisterTabsRef.current = true;
12272
- lastKnownTabElementRef.current = tabMap.keys().next().value;
12273
- const selectionIsDisabled = selectedTabMetadata?.disabled;
12274
- const selectionIsMissing = selectedTabMetadata == null && value !== null;
12275
- if (!selectionIsDisabled && value === initialDefaultValueRef.current) shouldHonorDisabledDefaultValueRef.current = false;
12276
- if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) return;
12277
- const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;
12278
- if (selectionIsDisabled || selectionIsMissing) {
12279
- const fallbackValue = firstEnabledTabValue ?? null;
12280
- if (value === fallbackValue) {
12281
- shouldNotifyInitialValueChangeRef.current = false;
12282
- return;
12245
+ },
12246
+ onMouseUp(event) {
12247
+ if (contextMenuContext) {
12248
+ const initialCursorPoint = contextMenuContext.initialCursorPointRef.current;
12249
+ contextMenuContext.initialCursorPointRef.current = null;
12250
+ if (isContextMenu && initialCursorPoint && Math.abs(event.clientX - initialCursorPoint.x) <= 1 && Math.abs(event.clientY - initialCursorPoint.y) <= 1) return;
12251
+ if (isContextMenu && !mac && event.button === 2) return;
12252
+ }
12253
+ if (itemRef.current && store.context.allowMouseUpTriggerRef.current && (!isContextMenu || event.button === 2)) {
12254
+ if (itemMetadata.type === "regular-item") dispatchClickWithModifiers(itemRef.current, event, { detail: 1 });
12283
12255
  }
12284
- let fallbackReason = missing;
12285
- if (shouldNotifyInitialValueChange) fallbackReason = initial;
12286
- else if (selectionIsDisabled) fallbackReason = disabled;
12287
- commitAutomaticValueChange(fallbackValue, fallbackReason);
12288
- return;
12289
- }
12290
- if (shouldNotifyInitialValueChange && selectedTabMetadata != null) {
12291
- notifyAutomaticValueChange(value, initial);
12292
- shouldNotifyInitialValueChangeRef.current = false;
12293
12256
  }
12294
- }, [
12295
- firstEnabledTabValue,
12296
- isControlled,
12297
- notifyAutomaticValueChange,
12298
- selectedTabMetadata,
12299
- setValue,
12300
- tabMap,
12301
- value
12257
+ }), [
12258
+ closeOnClick,
12259
+ highlighted,
12260
+ id,
12261
+ menuEvents,
12262
+ nodeId,
12263
+ open,
12264
+ store,
12265
+ typingRef,
12266
+ itemRef,
12267
+ contextMenuContext,
12268
+ isContextMenu,
12269
+ itemMetadata
12302
12270
  ]);
12303
- const element = useRenderElement("div", componentProps, {
12304
- state: {
12305
- orientation,
12306
- tabActivationDirection
12307
- },
12308
- ref: forwardedRef,
12309
- props: elementProps,
12310
- stateAttributesMapping: tabsStateAttributesMapping
12311
- });
12312
- return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(TabsRootContext.Provider, {
12313
- value: tabsContextValue,
12314
- children: /*#__PURE__*/ (0, import_jsx_runtime.jsx)(CompositeList, {
12315
- elementsRef: tabPanelRefs,
12316
- children: element
12317
- })
12318
- });
12319
- });
12320
- function findTabElement(tabMap, value) {
12321
- for (const [tabElement, tabMetadata] of tabMap.entries()) if (value === tabMetadata.value) return tabElement;
12322
- return null;
12323
- }
12324
- function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
12325
- if (oldValue == null || newValue == null) return "none";
12326
- const [positionProp, backward, forward] = orientation === "horizontal" ? [
12327
- "left",
12328
- "left",
12329
- "right"
12330
- ] : [
12331
- "top",
12332
- "up",
12333
- "down"
12334
- ];
12335
- const oldTab = findTabElement(tabMap, oldValue);
12336
- const newTab = findTabElement(tabMap, newValue);
12337
- if (oldTab == null || newTab == null) {
12338
- if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) return newValue > oldValue ? forward : backward;
12339
- return "none";
12340
- }
12341
- const oldPosition = oldTab.getBoundingClientRect()[positionProp];
12342
- const newPosition = newTab.getBoundingClientRect()[positionProp];
12343
- if (newPosition < oldPosition) return backward;
12344
- if (newPosition > oldPosition) return forward;
12345
- return "none";
12346
12271
  }
12347
12272
  //#endregion
12348
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/composite/constants.mjs
12349
- var ACTIVE_COMPOSITE_ITEM = "data-composite-item-active";
12350
- //#endregion
12351
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs
12352
- function useCompositeItem(params = {}) {
12353
- const { highlightItemOnHover, highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
12354
- const { ref, index } = useCompositeListItem(params);
12355
- const isHighlighted = highlightedIndex === index;
12273
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/item/useMenuItem.mjs
12274
+ var REGULAR_ITEM = { type: "regular-item" };
12275
+ function useMenuItem(params) {
12276
+ const { closeOnClick, disabled, highlighted, id, store, typingRef = store.context.typingRef, nativeButton, itemMetadata, nodeId } = params;
12356
12277
  const itemRef = import_react.useRef(null);
12357
- const mergedRef = useMergedRefs(ref, itemRef);
12358
- return {
12359
- compositeProps: {
12360
- tabIndex: isHighlighted ? 0 : -1,
12361
- onFocus() {
12362
- onHighlightedIndexChange(index);
12363
- },
12364
- onMouseMove() {
12365
- const item = itemRef.current;
12366
- if (!highlightItemOnHover || !item) return;
12367
- const disabled = item.hasAttribute("disabled") || item.ariaDisabled === "true";
12368
- if (!isHighlighted && !disabled) item.focus();
12369
- }
12370
- },
12371
- compositeRef: mergedRef,
12372
- index
12373
- };
12374
- }
12375
- //#endregion
12376
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tabs/list/TabsListContext.mjs
12377
- var TabsListContext = /*#__PURE__*/ import_react.createContext(void 0);
12378
- function useTabsListContext() {
12379
- const context = import_react.useContext(TabsListContext);
12380
- if (context === void 0) throw new Error(formatErrorMessage(65));
12381
- return context;
12278
+ const { getButtonProps, buttonRef } = useButton({
12279
+ disabled,
12280
+ focusableWhenDisabled: true,
12281
+ native: nativeButton,
12282
+ composite: true
12283
+ });
12284
+ const commonProps = useMenuItemCommonProps({
12285
+ closeOnClick,
12286
+ highlighted,
12287
+ id,
12288
+ nodeId,
12289
+ store,
12290
+ typingRef,
12291
+ itemRef,
12292
+ itemMetadata
12293
+ });
12294
+ const getItemProps = import_react.useCallback((externalProps) => {
12295
+ return mergeProps(commonProps, { onMouseEnter() {
12296
+ if (itemMetadata.type !== "submenu-trigger") return;
12297
+ itemMetadata.setActive();
12298
+ } }, externalProps, getButtonProps);
12299
+ }, [
12300
+ commonProps,
12301
+ getButtonProps,
12302
+ itemMetadata
12303
+ ]);
12304
+ const mergedRef = useMergedRefs(itemRef, buttonRef);
12305
+ return import_react.useMemo(() => ({
12306
+ getItemProps,
12307
+ itemRef: mergedRef
12308
+ }), [getItemProps, mergedRef]);
12382
12309
  }
12383
12310
  //#endregion
12384
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tabs/tab/TabsTab.mjs
12311
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/item/MenuItem.mjs
12385
12312
  /**
12386
- * An individual interactive tab button that toggles the corresponding panel.
12387
- * Renders a `<button>` element.
12313
+ * An individual interactive item in the menu.
12314
+ * Renders a `<div>` element.
12388
12315
  *
12389
- * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
12316
+ * Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
12390
12317
  */
12391
- var TabsTab = /*#__PURE__*/ import_react.forwardRef(function TabsTab(componentProps, forwardedRef) {
12392
- const { className, disabled = false, render, value, id: idProp, nativeButton = true, style, ...elementProps } = componentProps;
12393
- const { value: activeTabValue, getTabPanelIdByValue, onValueChange, orientation, tabActivationDirection } = useTabsRootContext();
12394
- const { activateOnFocus, registerTabResizeObserverElement, tabsListElement } = useTabsListContext();
12395
- const { highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
12318
+ var MenuItem = /*#__PURE__*/ import_react.forwardRef(function MenuItem(componentProps, forwardedRef) {
12319
+ const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = true, style, ...elementProps } = componentProps;
12320
+ const listItem = useCompositeListItem({
12321
+ guess: true,
12322
+ label
12323
+ });
12324
+ const menuPositionerContext = useMenuPositionerContext(true);
12396
12325
  const id = useBaseUiId(idProp);
12397
- const { compositeProps, compositeRef, index } = useCompositeItem({ metadata: import_react.useMemo(() => ({
12398
- disabled,
12399
- id,
12400
- value
12401
- }), [
12326
+ const { store } = useMenuRootContext();
12327
+ const rootDisabled = store.useState("disabled");
12328
+ const disabled = disabledProp || rootDisabled;
12329
+ const highlighted = store.useState("isActive", listItem.index);
12330
+ const itemProps = store.useState("itemProps");
12331
+ const { getItemProps, itemRef } = useMenuItem({
12332
+ closeOnClick,
12402
12333
  disabled,
12334
+ highlighted,
12403
12335
  id,
12404
- value
12405
- ]) });
12406
- const active = value === activeTabValue;
12407
- const isNavigatingRef = import_react.useRef(false);
12408
- const unobserveTabElementRef = import_react.useRef(null);
12409
- const observeTabElement = useStableCallback((element) => {
12410
- unobserveTabElementRef.current?.();
12411
- unobserveTabElementRef.current = element ? registerTabResizeObserverElement(element) : null;
12336
+ store,
12337
+ nativeButton,
12338
+ nodeId: menuPositionerContext?.context.nodeId,
12339
+ itemMetadata: REGULAR_ITEM
12412
12340
  });
12413
- useIsoLayoutEffect(() => {
12414
- if (isNavigatingRef.current) {
12415
- isNavigatingRef.current = false;
12416
- return;
12417
- }
12418
- if (!(active && index > -1 && highlightedIndex !== index)) return;
12419
- const listElement = tabsListElement;
12420
- if (listElement != null) {
12421
- const activeEl = activeElement(ownerDocument(listElement));
12422
- if (activeEl && contains(listElement, activeEl)) return;
12423
- }
12424
- if (!disabled) onHighlightedIndexChange(index);
12425
- }, [
12426
- active,
12427
- index,
12428
- highlightedIndex,
12429
- onHighlightedIndexChange,
12430
- disabled,
12431
- tabsListElement
12432
- ]);
12433
- const { getButtonProps, buttonRef } = useButton({
12434
- disabled,
12435
- native: nativeButton,
12436
- focusableWhenDisabled: true
12437
- });
12438
- const tabPanelId = getTabPanelIdByValue(value);
12439
- const isPressingRef = import_react.useRef(false);
12440
- const isMainButtonRef = import_react.useRef(false);
12441
- function activate(event) {
12442
- onValueChange(value, createChangeEventDetails(none, event.nativeEvent, void 0, { activationDirection: "none" }));
12443
- }
12444
- function onClick(event) {
12445
- if (active || disabled) return;
12446
- activate(event);
12447
- }
12448
- function onFocus(event) {
12449
- if (active || disabled) return;
12450
- if (activateOnFocus && (!isPressingRef.current || isMainButtonRef.current)) activate(event);
12451
- }
12452
- function onPointerDown(event) {
12453
- if (active || disabled) return;
12454
- isPressingRef.current = true;
12455
- isMainButtonRef.current = event.button === 0;
12456
- const doc = ownerDocument(event.currentTarget);
12457
- function handlePointerEnd() {
12458
- isPressingRef.current = false;
12459
- isMainButtonRef.current = false;
12460
- doc.removeEventListener("pointerup", handlePointerEnd);
12461
- doc.removeEventListener("pointercancel", handlePointerEnd);
12462
- }
12463
- doc.addEventListener("pointerup", handlePointerEnd);
12464
- doc.addEventListener("pointercancel", handlePointerEnd);
12465
- }
12466
- return useRenderElement("button", componentProps, {
12341
+ return useRenderElement("div", componentProps, {
12467
12342
  state: {
12468
12343
  disabled,
12469
- active,
12470
- orientation,
12471
- tabActivationDirection
12344
+ highlighted
12472
12345
  },
12473
- ref: [
12474
- forwardedRef,
12475
- buttonRef,
12476
- compositeRef,
12477
- observeTabElement
12478
- ],
12479
12346
  props: [
12480
- compositeProps,
12481
- {
12482
- role: "tab",
12483
- "aria-controls": tabPanelId,
12484
- "aria-selected": active,
12485
- id,
12486
- onClick,
12487
- onFocus,
12488
- onPointerDown,
12489
- [ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0,
12490
- onKeyDownCapture() {
12491
- isNavigatingRef.current = true;
12492
- }
12493
- },
12347
+ itemProps,
12494
12348
  elementProps,
12495
- getButtonProps
12349
+ getItemProps
12496
12350
  ],
12497
- stateAttributesMapping: tabsStateAttributesMapping
12351
+ ref: [
12352
+ itemRef,
12353
+ forwardedRef,
12354
+ listItem.ref
12355
+ ]
12498
12356
  });
12499
12357
  });
12500
12358
  //#endregion
12501
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs
12502
- var stateAttributesMapping = {
12503
- ...tabsStateAttributesMapping,
12504
- ...transitionStatusMapping
12505
- };
12359
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/popup/MenuPopup.mjs
12506
12360
  /**
12507
- * A panel displayed when the corresponding tab is active.
12361
+ * A container for the menu items.
12508
12362
  * Renders a `<div>` element.
12509
12363
  *
12510
- * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
12364
+ * Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
12511
12365
  */
12512
- var TabsPanel = /*#__PURE__*/ import_react.forwardRef(function TabsPanel(componentProps, forwardedRef) {
12513
- const { className, value, render, keepMounted = false, style, ...elementProps } = componentProps;
12514
- const { value: selectedValue, getTabIdByPanelValue, orientation, tabActivationDirection, registerMountedTabPanel } = useTabsRootContext();
12515
- const id = useBaseUiId();
12516
- const { ref: listItemRef, index } = useCompositeListItem();
12517
- const open = value === selectedValue;
12518
- const { mounted, transitionStatus, setMounted } = useTransitionStatus(open);
12519
- const hidden = !mounted;
12520
- const correspondingTabId = getTabIdByPanelValue(value);
12521
- const state = {
12522
- hidden,
12523
- orientation,
12524
- tabActivationDirection,
12525
- transitionStatus
12526
- };
12527
- const panelRef = import_react.useRef(null);
12366
+ var MenuPopup = /*#__PURE__*/ import_react.forwardRef(function MenuPopup(componentProps, forwardedRef) {
12367
+ const { render, className, style, finalFocus, ...elementProps } = componentProps;
12368
+ const { store } = useMenuRootContext();
12369
+ const { side, align } = useMenuPositionerContext();
12370
+ const insideToolbar = useToolbarRootContext(true) != null;
12371
+ const open = store.useState("open");
12372
+ const transitionStatus = store.useState("transitionStatus");
12373
+ const popupProps = store.useState("popupProps");
12374
+ const mounted = store.useState("mounted");
12375
+ const instantType = store.useState("instantType");
12376
+ const activeTriggerElement = store.useState("activeTriggerElement");
12377
+ const parent = store.useState("parent");
12378
+ const lastOpenChangeReason = store.useState("lastOpenChangeReason");
12379
+ const rootId = store.useState("rootId");
12380
+ const floatingContext = store.useState("floatingRootContext");
12381
+ const floatingTreeRoot = store.useState("floatingTreeRoot");
12382
+ const closeDelay = store.useState("closeDelay");
12383
+ const hoverEnabled = store.useState("hoverEnabled");
12384
+ const disabled = store.useState("disabled");
12385
+ const openMethod = store.useState("openMethod");
12386
+ const isContextMenu = parent.type === "context-menu";
12387
+ useOpenChangeComplete({
12388
+ open,
12389
+ ref: store.context.popupRef,
12390
+ onComplete() {
12391
+ if (open) store.context.onOpenChangeComplete?.(true);
12392
+ }
12393
+ });
12394
+ import_react.useEffect(() => {
12395
+ function handleClose(event) {
12396
+ store.setOpen(false, createChangeEventDetails(event.reason, event.domEvent));
12397
+ }
12398
+ floatingTreeRoot.events.on("close", handleClose);
12399
+ return () => {
12400
+ floatingTreeRoot.events.off("close", handleClose);
12401
+ };
12402
+ }, [floatingTreeRoot.events, store]);
12403
+ useHoverFloatingInteraction(floatingContext, {
12404
+ enabled: hoverEnabled && !disabled && !isContextMenu && parent.type !== "menubar",
12405
+ closeDelay
12406
+ });
12407
+ const setPopupElement = store.useStateSetter("popupElement");
12528
12408
  const element = useRenderElement("div", componentProps, {
12529
- state,
12409
+ state: {
12410
+ transitionStatus,
12411
+ side,
12412
+ align,
12413
+ open,
12414
+ nested: parent.type === "menu",
12415
+ instant: instantType
12416
+ },
12530
12417
  ref: [
12531
12418
  forwardedRef,
12532
- listItemRef,
12533
- panelRef
12419
+ store.context.popupRef,
12420
+ setPopupElement
12534
12421
  ],
12535
- props: [{
12536
- "aria-labelledby": correspondingTabId,
12537
- hidden,
12538
- id,
12539
- role: "tabpanel",
12540
- tabIndex: open ? 0 : -1,
12541
- inert: inertValue(!open),
12542
- ["data-index"]: index
12543
- }, elementProps],
12544
- stateAttributesMapping
12422
+ stateAttributesMapping: popupTransitionStateMapping,
12423
+ props: [
12424
+ popupProps,
12425
+ { onKeyDown(event) {
12426
+ if (insideToolbar && COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
12427
+ } },
12428
+ getDisabledMountTransitionStyles(transitionStatus),
12429
+ elementProps,
12430
+ { "data-rootownerid": rootId }
12431
+ ]
12545
12432
  });
12546
- useOpenChangeComplete({
12547
- open,
12548
- ref: panelRef,
12549
- onComplete() {
12550
- if (!open) setMounted(false);
12551
- }
12433
+ let returnFocus = parent.type === void 0 || isContextMenu;
12434
+ if (activeTriggerElement || parent.type === "menubar" && lastOpenChangeReason !== "outside-press") returnFocus = true;
12435
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingFocusManager, {
12436
+ context: floatingContext,
12437
+ openInteractionType: openMethod,
12438
+ modal: isContextMenu,
12439
+ disabled: !mounted,
12440
+ returnFocus: finalFocus === void 0 ? returnFocus : finalFocus,
12441
+ initialFocus: parent.type !== "menu",
12442
+ restoreFocus: true,
12443
+ externalTree: parent.type !== "menubar" ? floatingTreeRoot : void 0,
12444
+ previousFocusableElement: activeTriggerElement,
12445
+ nextFocusableElement: parent.type === void 0 ? store.context.triggerFocusTargetRef : void 0,
12446
+ beforeContentFocusGuardRef: parent.type === void 0 ? store.context.beforeContentFocusGuardRef : void 0,
12447
+ children: element
12552
12448
  });
12553
- useIsoLayoutEffect(() => {
12554
- if (id == null || hidden && !keepMounted) return;
12555
- return registerMountedTabPanel(value, id);
12556
- }, [
12557
- hidden,
12558
- keepMounted,
12559
- value,
12560
- id,
12561
- registerMountedTabPanel
12562
- ]);
12563
- if (!(keepMounted || mounted)) return null;
12564
- return element;
12565
12449
  });
12566
12450
  //#endregion
12567
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs
12568
- var EMPTY_ARRAY = [];
12569
- function useCompositeRoot(params) {
12570
- const { loopFocus = true, orientation = "both", grid, onLoop, direction, highlightedIndex: externalHighlightedIndex, onHighlightedIndexChange: externalSetHighlightedIndex, rootRef: externalRef, enableHomeAndEndKeys = false, stopEventPropagation, disabledIndices, modifierKeys = EMPTY_ARRAY } = params;
12571
- const [internalHighlightedIndex, internalSetHighlightedIndex] = import_react.useState(0);
12572
- const isGrid = grid != null;
12573
- const rootRef = import_react.useRef(null);
12574
- const mergedRef = useMergedRefs(rootRef, externalRef);
12575
- const elementsRef = import_react.useRef([]);
12576
- const hasSetDefaultIndexRef = import_react.useRef(false);
12577
- const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;
12578
- const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false) => {
12579
- (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);
12580
- if (shouldScrollIntoView) {
12581
- const newActiveItem = elementsRef.current[index];
12582
- scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);
12583
- }
12451
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/portal/MenuPortalContext.mjs
12452
+ var MenuPortalContext = /*#__PURE__*/ import_react.createContext(void 0);
12453
+ function useMenuPortalContext() {
12454
+ const value = import_react.useContext(MenuPortalContext);
12455
+ if (value === void 0) throw new Error(formatErrorMessage(32));
12456
+ return value;
12457
+ }
12458
+ //#endregion
12459
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/portal/MenuPortal.mjs
12460
+ /**
12461
+ * A portal element that moves the popup to a different part of the DOM.
12462
+ * By default, the portal element is appended to `<body>`.
12463
+ * Renders a `<div>` element.
12464
+ *
12465
+ * Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
12466
+ */
12467
+ var MenuPortal = /*#__PURE__*/ import_react.forwardRef(function MenuPortal(props, forwardedRef) {
12468
+ const { keepMounted = false, ...portalProps } = props;
12469
+ const { store } = useMenuRootContext();
12470
+ if (!(store.useState("mounted") || keepMounted)) return null;
12471
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(MenuPortalContext.Provider, {
12472
+ value: keepMounted,
12473
+ children: /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingPortal, {
12474
+ ref: forwardedRef,
12475
+ ...portalProps
12476
+ })
12584
12477
  });
12585
- const onMapChange = useStableCallback((map) => {
12586
- if (map.size === 0 || hasSetDefaultIndexRef.current) return;
12587
- hasSetDefaultIndexRef.current = true;
12588
- const sortedElements = Array.from(map.keys());
12589
- const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute("data-composite-item-active")) ?? null;
12590
- const activeIndex = activeItem ? map.get(activeItem)?.index ?? -1 : -1;
12591
- if (activeIndex !== -1) onHighlightedIndexChange(activeIndex);
12592
- else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) {
12593
- const firstEnabledIndex = findNonDisabledListIndex(sortedElements, { disabledIndices });
12594
- if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) onHighlightedIndexChange(firstEnabledIndex);
12595
- }
12596
- scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);
12478
+ });
12479
+ //#endregion
12480
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/positioner/MenuPositioner.mjs
12481
+ /**
12482
+ * Positions the menu popup against the trigger.
12483
+ * Renders a `<div>` element.
12484
+ *
12485
+ * Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
12486
+ */
12487
+ var MenuPositioner = /*#__PURE__*/ import_react.forwardRef(function MenuPositioner(componentProps, forwardedRef) {
12488
+ const { anchor: anchorProp, positionMethod: positionMethodProp = "absolute", className, render, side, align: alignProp, sideOffset: sideOffsetProp = 0, alignOffset: alignOffsetProp = 0, collisionBoundary = "clipping-ancestors", collisionPadding = 5, arrowPadding = 5, sticky = false, disableAnchorTracking = false, collisionAvoidance: collisionAvoidanceProp = DROPDOWN_COLLISION_AVOIDANCE, style, ...elementProps } = componentProps;
12489
+ const { store } = useMenuRootContext();
12490
+ const keepMounted = useMenuPortalContext();
12491
+ const contextMenuContext = useContextMenuRootContext(true);
12492
+ const parent = store.useState("parent");
12493
+ const floatingRootContext = store.useState("floatingRootContext");
12494
+ const floatingTreeRoot = store.useState("floatingTreeRoot");
12495
+ const mounted = store.useState("mounted");
12496
+ const open = store.useState("open");
12497
+ const modal = store.useState("modal");
12498
+ const openMethod = store.useState("openMethod");
12499
+ const triggerElement = store.useState("activeTriggerElement");
12500
+ const transitionStatus = store.useState("transitionStatus");
12501
+ const positionerElement = store.useState("positionerElement");
12502
+ const instantType = store.useState("instantType");
12503
+ const adaptiveOrigin = store.useState("adaptiveOrigin");
12504
+ const lastOpenChangeReason = store.useState("lastOpenChangeReason");
12505
+ const floatingNodeId = store.useState("floatingNodeId");
12506
+ const floatingParentNodeId = store.useState("floatingParentNodeId");
12507
+ const domReference = floatingRootContext.useState("domReferenceElement");
12508
+ const previousTriggerRef = import_react.useRef(null);
12509
+ const runOnceAnimationsFinish = useAnimationsFinished(positionerElement);
12510
+ let anchor = anchorProp;
12511
+ let sideOffset = sideOffsetProp;
12512
+ let alignOffset = alignOffsetProp;
12513
+ let align = alignProp;
12514
+ let collisionAvoidance = collisionAvoidanceProp;
12515
+ if (parent.type === "context-menu") {
12516
+ anchor = anchorProp ?? parent.context?.anchor;
12517
+ align = align ?? "start";
12518
+ if (!side && align !== "center") {
12519
+ alignOffset = componentProps.alignOffset ?? 2;
12520
+ sideOffset = componentProps.sideOffset ?? -5;
12521
+ }
12522
+ }
12523
+ let computedSide = side;
12524
+ let computedAlign = align;
12525
+ if (parent.type === "menu") {
12526
+ computedSide = computedSide ?? "inline-end";
12527
+ computedAlign = computedAlign ?? "start";
12528
+ collisionAvoidance = componentProps.collisionAvoidance ?? POPUP_COLLISION_AVOIDANCE;
12529
+ } else if (parent.type === "menubar") {
12530
+ computedSide = computedSide ?? (parent.context.orientation === "vertical" ? "inline-end" : "bottom");
12531
+ computedAlign = computedAlign ?? "start";
12532
+ }
12533
+ const contextMenu = parent.type === "context-menu";
12534
+ const positioner = useAnchorPositioning({
12535
+ anchor,
12536
+ floatingRootContext,
12537
+ positionMethod: contextMenuContext ? "fixed" : positionMethodProp,
12538
+ mounted,
12539
+ side: computedSide,
12540
+ sideOffset,
12541
+ align: computedAlign,
12542
+ alignOffset,
12543
+ arrowPadding: contextMenu ? 0 : arrowPadding,
12544
+ collisionBoundary,
12545
+ collisionPadding,
12546
+ sticky,
12547
+ nodeId: floatingNodeId,
12548
+ keepMounted,
12549
+ disableAnchorTracking,
12550
+ collisionAvoidance,
12551
+ shift: contextMenu ? {
12552
+ crossAxis: !("side" in collisionAvoidance && collisionAvoidance.side === "flip"),
12553
+ rootBoundary: "layoutViewport"
12554
+ } : void 0,
12555
+ externalTree: floatingTreeRoot,
12556
+ adaptiveOrigin
12597
12557
  });
12558
+ import_react.useEffect(() => {
12559
+ function onMenuOpenChange(details) {
12560
+ if (details.open) {
12561
+ if (details.parentNodeId === floatingNodeId) store.set("hoverEnabled", false);
12562
+ if (details.nodeId !== floatingNodeId && details.parentNodeId === store.select("floatingParentNodeId")) store.setOpen(false, createChangeEventDetails(siblingOpen));
12563
+ }
12564
+ }
12565
+ floatingTreeRoot.events.on("menuopenchange", onMenuOpenChange);
12566
+ return () => {
12567
+ floatingTreeRoot.events.off("menuopenchange", onMenuOpenChange);
12568
+ };
12569
+ }, [
12570
+ store,
12571
+ floatingTreeRoot.events,
12572
+ floatingNodeId
12573
+ ]);
12574
+ import_react.useEffect(() => {
12575
+ if (store.select("floatingParentNodeId") == null) return;
12576
+ function onParentClose(details) {
12577
+ if (details.open || details.nodeId !== store.select("floatingParentNodeId")) return;
12578
+ const reason = details.reason ?? "sibling-open";
12579
+ store.setOpen(false, createChangeEventDetails(reason));
12580
+ }
12581
+ floatingTreeRoot.events.on("menuopenchange", onParentClose);
12582
+ return () => {
12583
+ floatingTreeRoot.events.off("menuopenchange", onParentClose);
12584
+ };
12585
+ }, [floatingTreeRoot.events, store]);
12586
+ const closeTimeout = useTimeout();
12587
+ import_react.useEffect(() => {
12588
+ if (!open) closeTimeout.clear();
12589
+ }, [open, closeTimeout]);
12590
+ import_react.useEffect(() => {
12591
+ function onItemHover(event) {
12592
+ if (!open || event.nodeId !== store.select("floatingParentNodeId")) return;
12593
+ if (event.target && triggerElement && triggerElement !== event.target) {
12594
+ const delay = store.select("closeDelay");
12595
+ if (delay > 0) {
12596
+ if (!closeTimeout.isStarted()) closeTimeout.start(delay, () => {
12597
+ store.setOpen(false, createChangeEventDetails(siblingOpen));
12598
+ });
12599
+ } else store.setOpen(false, createChangeEventDetails(siblingOpen));
12600
+ } else closeTimeout.clear();
12601
+ }
12602
+ floatingTreeRoot.events.on("itemhover", onItemHover);
12603
+ return () => {
12604
+ floatingTreeRoot.events.off("itemhover", onItemHover);
12605
+ };
12606
+ }, [
12607
+ floatingTreeRoot.events,
12608
+ open,
12609
+ triggerElement,
12610
+ store,
12611
+ closeTimeout
12612
+ ]);
12613
+ import_react.useEffect(() => {
12614
+ const eventDetails = {
12615
+ open,
12616
+ nodeId: floatingNodeId,
12617
+ parentNodeId: floatingParentNodeId,
12618
+ reason: store.select("lastOpenChangeReason")
12619
+ };
12620
+ floatingTreeRoot.events.emit("menuopenchange", eventDetails);
12621
+ }, [
12622
+ floatingTreeRoot.events,
12623
+ open,
12624
+ store,
12625
+ floatingNodeId,
12626
+ floatingParentNodeId
12627
+ ]);
12598
12628
  useIsoLayoutEffect(() => {
12599
- if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) return;
12600
- const elements = elementsRef.current;
12601
- if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {
12602
- const firstEnabledIndex = findNonDisabledListIndex(elements, { disabledIndices });
12603
- if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) onHighlightedIndexChange(firstEnabledIndex);
12629
+ const currentTrigger = domReference;
12630
+ const previousTrigger = previousTriggerRef.current;
12631
+ if (currentTrigger) previousTriggerRef.current = currentTrigger;
12632
+ if (previousTrigger && currentTrigger && currentTrigger !== previousTrigger) {
12633
+ store.set("instantType", void 0);
12634
+ const abortController = new AbortController();
12635
+ runOnceAnimationsFinish(() => {
12636
+ store.set("instantType", "trigger-change");
12637
+ }, abortController.signal);
12638
+ return () => {
12639
+ abortController.abort();
12640
+ };
12604
12641
  }
12605
12642
  }, [
12606
- disabledIndices,
12607
- externalHighlightedIndex,
12608
- highlightedIndex,
12609
- elementsRef,
12610
- onHighlightedIndexChange
12643
+ domReference,
12644
+ runOnceAnimationsFinish,
12645
+ store
12611
12646
  ]);
12612
- const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => {
12613
- if (!onLoop) return nextIndex;
12614
- return onLoop(event, prevIndex, nextIndex, elementsRef);
12647
+ const state = {
12648
+ open,
12649
+ side: positioner.side,
12650
+ align: positioner.align,
12651
+ anchorHidden: positioner.anchorHidden,
12652
+ nested: parent.type === "menu",
12653
+ instant: instantType
12654
+ };
12655
+ const menubarModal = parent.type === "menubar" && parent.context.modal;
12656
+ useAnchoredPopupScrollLock(open && (menubarModal || modal && lastOpenChangeReason !== "trigger-hover"), openMethod === "touch", positionerElement, triggerElement);
12657
+ const element = usePositioner(componentProps, state, {
12658
+ styles: positioner.positionerStyles,
12659
+ transitionStatus,
12660
+ props: elementProps,
12661
+ refs: [forwardedRef, store.useStateSetter("positionerElement")],
12662
+ hidden: !mounted,
12663
+ inert: !open
12615
12664
  });
12616
- const onKeyDown = useStableCallback((event) => {
12617
- const isHomeOrEnd = event.key === "Home" || event.key === "End";
12618
- if (!COMPOSITE_KEYS.has(event.key) || !enableHomeAndEndKeys && isHomeOrEnd) return;
12619
- if (isModifierKeySet(event, modifierKeys)) return;
12620
- if (!rootRef.current) return;
12621
- const isRtl = direction === "rtl";
12622
- const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;
12623
- const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;
12624
- const forwardKey = orientation === "vertical" ? ARROW_DOWN : horizontalForwardKey;
12625
- const backwardKey = orientation === "vertical" ? ARROW_UP : horizontalBackwardKey;
12626
- const target = getTarget(event.nativeEvent);
12627
- if (target != null && isNativeInput(target) && !isElementDisabled(target)) {
12628
- const selectionStart = target.selectionStart;
12629
- const selectionEnd = target.selectionEnd;
12630
- const textContent = target.value;
12631
- if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) return;
12632
- if (event.key !== backwardKey && selectionStart < textContent.length) return;
12633
- if (event.key !== forwardKey && selectionStart > 0) return;
12634
- }
12635
- let nextIndex = highlightedIndex;
12636
- const minIndex = getMinListIndex(elementsRef, disabledIndices);
12637
- const maxIndex = getMaxListIndex(elementsRef, disabledIndices);
12638
- if (grid != null) nextIndex = grid({
12639
- disabledIndices,
12640
- elementsRef,
12641
- event,
12642
- highlightedIndex,
12643
- loopFocus,
12644
- maxIndex,
12645
- minIndex,
12646
- onLoop: wrappedOnLoop,
12647
- orientation,
12648
- rtl: isRtl
12665
+ const shouldRenderBackdrop = mounted && parent.type !== "menu" && (parent.type !== "menubar" && modal && lastOpenChangeReason !== "trigger-hover" || parent.type === "menubar" && parent.context.modal);
12666
+ let backdropCutout = null;
12667
+ if (parent.type === "menubar") backdropCutout = parent.context.contentElement;
12668
+ else if (parent.type === void 0) backdropCutout = triggerElement;
12669
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(MenuPositionerContext.Provider, {
12670
+ value: positioner,
12671
+ children: [shouldRenderBackdrop && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(InternalBackdrop, {
12672
+ ref: parent.type === "context-menu" || parent.type === "nested-context-menu" ? parent.context.internalBackdropRef : null,
12673
+ inert: inertValue(!open),
12674
+ cutout: backdropCutout
12675
+ }), /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingNode, {
12676
+ id: floatingNodeId,
12677
+ children: /*#__PURE__*/ (0, import_jsx_runtime.jsx)(CompositeList, {
12678
+ elementsRef: store.context.itemDomElements,
12679
+ labelsRef: store.context.itemLabels,
12680
+ children: element
12681
+ })
12682
+ })]
12683
+ });
12684
+ });
12685
+ //#endregion
12686
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menubar/MenubarContext.mjs
12687
+ var MenubarContext = /*#__PURE__*/ import_react.createContext(null);
12688
+ function useMenubarContext(optional) {
12689
+ const context = import_react.useContext(MenubarContext);
12690
+ if (context === null && !optional) throw new Error(formatErrorMessage(5));
12691
+ return context;
12692
+ }
12693
+ //#endregion
12694
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/store/MenuStore.mjs
12695
+ var selectors = {
12696
+ ...popupStoreSelectors,
12697
+ disabled: (state) => state.parent.type === "menubar" ? state.parent.context.disabled || state.disabled : state.disabled,
12698
+ modal: (state) => (state.parent.type === void 0 || state.parent.type === "context-menu") && (state.modal ?? true),
12699
+ openMethod: (state) => state.openMethod,
12700
+ allowMouseEnter: (state) => state.allowMouseEnter,
12701
+ highlightItemOnHover: (state) => state.highlightItemOnHover,
12702
+ parent: (state) => state.parent,
12703
+ rootId: (state) => {
12704
+ if (state.parent.type === "menu") return state.parent.store.select("rootId");
12705
+ return state.parent.type !== void 0 ? state.parent.context.rootId : state.rootId;
12706
+ },
12707
+ activeIndex: (state) => state.activeIndex,
12708
+ isActive: (state, itemIndex) => state.activeIndex === itemIndex,
12709
+ hoverEnabled: (state) => state.hoverEnabled,
12710
+ instantType: (state) => state.instantType,
12711
+ lastOpenChangeReason: (state) => state.openChangeReason,
12712
+ floatingTreeRoot: (state) => {
12713
+ if (state.parent.type === "menu") return state.parent.store.select("floatingTreeRoot");
12714
+ return state.floatingTreeRoot;
12715
+ },
12716
+ floatingNodeId: (state) => state.floatingNodeId,
12717
+ floatingParentNodeId: (state) => state.floatingParentNodeId,
12718
+ itemProps: (state) => state.itemProps,
12719
+ closeDelay: (state) => state.closeDelay,
12720
+ adaptiveOrigin: (state) => state.adaptiveOrigin,
12721
+ keyboardEventRelay: (state) => {
12722
+ if (state.keyboardEventRelay) return state.keyboardEventRelay;
12723
+ if (state.parent.type === "menu") return state.parent.store.select("keyboardEventRelay");
12724
+ }
12725
+ };
12726
+ /**
12727
+ * The store view that detached handle-backed triggers read from. Both the real `MenuStore` and the
12728
+ * inert fallback store satisfy it, so a trigger can read from whichever store the handle currently
12729
+ * exposes. Narrowed to the members a trigger actually uses — the trigger-data members plus `setOpen`
12730
+ * (called by the focus guards) — so the exposed surface can't bypass the open-change pipeline; on
12731
+ * the detached fallback store every one of these mutations is a no-op.
12732
+ */
12733
+ var MenuStore = class extends ReactStore {
12734
+ constructor(initialState) {
12735
+ super({
12736
+ ...createInitialState(),
12737
+ ...initialState
12738
+ }, createInitialContext(), selectors);
12739
+ this.unsubscribeParentListener = this.observe("parent", (parent) => {
12740
+ this.unsubscribeParentListener?.();
12741
+ if (parent.type === "menu") {
12742
+ let rootId = parent.store.select("rootId");
12743
+ let floatingTreeRoot = parent.store.select("floatingTreeRoot");
12744
+ let keyboardEventRelay = parent.store.select("keyboardEventRelay");
12745
+ this.unsubscribeParentListener = parent.store.subscribe(() => {
12746
+ const nextRootId = parent.store.select("rootId");
12747
+ const nextFloatingTreeRoot = parent.store.select("floatingTreeRoot");
12748
+ const nextKeyboardEventRelay = parent.store.select("keyboardEventRelay");
12749
+ if (rootId === nextRootId && floatingTreeRoot === nextFloatingTreeRoot && keyboardEventRelay === nextKeyboardEventRelay) return;
12750
+ rootId = nextRootId;
12751
+ floatingTreeRoot = nextFloatingTreeRoot;
12752
+ keyboardEventRelay = nextKeyboardEventRelay;
12753
+ this.notifyAll();
12754
+ });
12755
+ this.context.allowMouseUpTriggerRef = parent.store.context.allowMouseUpTriggerRef;
12756
+ return;
12757
+ }
12758
+ if (parent.type !== void 0) this.context.allowMouseUpTriggerRef = parent.context.allowMouseUpTriggerRef;
12759
+ this.unsubscribeParentListener = null;
12649
12760
  });
12650
- const isForwardKey = orientation !== "vertical" && event.key === horizontalForwardKey || orientation !== "horizontal" && event.key === "ArrowDown";
12651
- const isBackwardKey = orientation !== "vertical" && event.key === horizontalBackwardKey || orientation !== "horizontal" && event.key === "ArrowUp";
12652
- if (enableHomeAndEndKeys) {
12653
- if (event.key === "Home") nextIndex = minIndex;
12654
- else if (event.key === "End") nextIndex = maxIndex;
12655
- }
12656
- if (nextIndex === highlightedIndex && (isForwardKey || isBackwardKey)) {
12657
- if (loopFocus && nextIndex === maxIndex && isForwardKey) {
12658
- nextIndex = minIndex;
12659
- if (onLoop) nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
12660
- } else if (loopFocus && nextIndex === minIndex && isBackwardKey) {
12661
- nextIndex = maxIndex;
12662
- if (onLoop) nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
12663
- } else nextIndex = findNonDisabledListIndex(elementsRef.current, {
12664
- startingIndex: nextIndex,
12665
- decrement: isBackwardKey,
12666
- disabledIndices
12667
- });
12761
+ }
12762
+ setOpen(open, eventDetails) {
12763
+ this.state.floatingRootContext.context.events.emit("setOpen", {
12764
+ open,
12765
+ eventDetails
12766
+ });
12767
+ }
12768
+ unsubscribeParentListener = null;
12769
+ };
12770
+ function createInitialContext() {
12771
+ return {
12772
+ positionerRef: /*#__PURE__*/ import_react.createRef(),
12773
+ popupRef: /*#__PURE__*/ import_react.createRef(),
12774
+ typingRef: { current: false },
12775
+ itemDomElements: { current: [] },
12776
+ itemLabels: { current: [] },
12777
+ allowMouseUpTriggerRef: { current: false },
12778
+ triggerFocusTargetRef: /*#__PURE__*/ import_react.createRef(),
12779
+ beforeContentFocusGuardRef: /*#__PURE__*/ import_react.createRef(),
12780
+ onOpenChangeComplete: void 0,
12781
+ triggerElements: new PopupTriggerMap()
12782
+ };
12783
+ }
12784
+ function createInitialState() {
12785
+ return {
12786
+ ...createInitialPopupStoreState(),
12787
+ disabled: false,
12788
+ modal: true,
12789
+ openMethod: null,
12790
+ allowMouseEnter: false,
12791
+ highlightItemOnHover: true,
12792
+ parent: { type: void 0 },
12793
+ rootId: void 0,
12794
+ activeIndex: null,
12795
+ hoverEnabled: true,
12796
+ instantType: void 0,
12797
+ openChangeReason: null,
12798
+ floatingTreeRoot: new FloatingTreeStore(),
12799
+ floatingNodeId: void 0,
12800
+ floatingParentNodeId: null,
12801
+ itemProps: EMPTY_OBJECT,
12802
+ keyboardEventRelay: void 0,
12803
+ closeDelay: 0,
12804
+ adaptiveOrigin: void 0
12805
+ };
12806
+ }
12807
+ //#endregion
12808
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/submenu-root/MenuSubmenuRootContext.mjs
12809
+ var MenuSubmenuRootContext = /*#__PURE__*/ import_react.createContext(void 0);
12810
+ function useMenuSubmenuRootContext() {
12811
+ return import_react.useContext(MenuSubmenuRootContext);
12812
+ }
12813
+ //#endregion
12814
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/root/MenuRoot.mjs
12815
+ /**
12816
+ * Groups all parts of the menu.
12817
+ * Doesn't render its own HTML element.
12818
+ *
12819
+ * Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
12820
+ */
12821
+ var MenuRoot = fastComponent(function MenuRoot(props) {
12822
+ const { children, open: openProp, onOpenChange, onOpenChangeComplete, defaultOpen = false, disabled: disabledProp = false, modal: modalProp, loopFocus = true, orientation = "vertical", actionsRef, closeParentOnEsc = false, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null, highlightItemOnHover = true } = props;
12823
+ const contextMenuContext = useContextMenuRootContext(true);
12824
+ const parentMenuRootContext = useMenuRootContext(true);
12825
+ const menubarContext = useMenubarContext(true);
12826
+ const isSubmenu = useMenuSubmenuRootContext();
12827
+ const parentFromContext = import_react.useMemo(() => {
12828
+ if (isSubmenu && parentMenuRootContext) return {
12829
+ type: "menu",
12830
+ store: parentMenuRootContext.store
12831
+ };
12832
+ if (menubarContext) return {
12833
+ type: "menubar",
12834
+ context: menubarContext
12835
+ };
12836
+ if (contextMenuContext && !parentMenuRootContext) return {
12837
+ type: "context-menu",
12838
+ context: contextMenuContext
12839
+ };
12840
+ return { type: void 0 };
12841
+ }, [
12842
+ contextMenuContext,
12843
+ parentMenuRootContext,
12844
+ menubarContext,
12845
+ isSubmenu
12846
+ ]);
12847
+ const store = useMenuRootStore({
12848
+ open: defaultOpen,
12849
+ openProp,
12850
+ activeTriggerId: defaultTriggerIdProp,
12851
+ triggerIdProp,
12852
+ parent: parentFromContext
12853
+ });
12854
+ store.useControlledProp("openProp", openProp);
12855
+ store.useControlledProp("triggerIdProp", triggerIdProp);
12856
+ store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
12857
+ const rootId = useId();
12858
+ const floatingId = useId();
12859
+ const floatingTreeRoot = store.useState("floatingTreeRoot");
12860
+ const floatingNodeIdFromContext = useFloatingNodeId(floatingTreeRoot);
12861
+ const floatingParentNodeIdFromContext = useFloatingParentNodeId();
12862
+ const open = store.useState("open");
12863
+ const activeTriggerElement = store.useState("activeTriggerElement");
12864
+ const positionerElement = store.useState("positionerElement");
12865
+ const hoverEnabled = store.useState("hoverEnabled");
12866
+ const disabled = store.useState("disabled");
12867
+ const lastOpenChangeReason = store.useState("lastOpenChangeReason");
12868
+ const parent = store.useState("parent");
12869
+ const activeIndex = store.useState("activeIndex");
12870
+ const payload = store.useState("payload");
12871
+ const floatingParentNodeId = store.useState("floatingParentNodeId");
12872
+ const openEventRef = import_react.useRef(null);
12873
+ const allowOutsidePressDismissalRef = import_react.useRef(parent.type !== "context-menu");
12874
+ const allowOutsidePressDismissalTimeout = useTimeout();
12875
+ const allowTouchToCloseRef = import_react.useRef(true);
12876
+ const allowTouchToCloseTimeout = useTimeout();
12877
+ const nested = floatingParentNodeId != null;
12878
+ const { openMethod, triggerProps: interactionTypeProps } = useOpenInteractionType(open);
12879
+ store.useSyncedValues({
12880
+ disabled: disabledProp,
12881
+ highlightItemOnHover,
12882
+ modal: parent.type === void 0 ? modalProp : void 0,
12883
+ openMethod,
12884
+ rootId
12885
+ });
12886
+ useImplicitActiveTrigger(store);
12887
+ const { forceUnmount } = useOpenStateTransitions(open, store, () => {
12888
+ store.set("allowMouseEnter", false);
12889
+ });
12890
+ useIsoLayoutEffect(() => {
12891
+ if (contextMenuContext && !parentMenuRootContext) store.update({
12892
+ parent: {
12893
+ type: "context-menu",
12894
+ context: contextMenuContext
12895
+ },
12896
+ floatingNodeId: floatingNodeIdFromContext,
12897
+ floatingParentNodeId: floatingParentNodeIdFromContext
12898
+ });
12899
+ else if (parentMenuRootContext) store.update({
12900
+ floatingNodeId: floatingNodeIdFromContext,
12901
+ floatingParentNodeId: floatingParentNodeIdFromContext
12902
+ });
12903
+ }, [
12904
+ contextMenuContext,
12905
+ parentMenuRootContext,
12906
+ floatingNodeIdFromContext,
12907
+ floatingParentNodeIdFromContext,
12908
+ store
12909
+ ]);
12910
+ import_react.useEffect(() => {
12911
+ if (!open) openEventRef.current = null;
12912
+ if (parent.type !== "context-menu") return;
12913
+ if (!open) {
12914
+ allowOutsidePressDismissalTimeout.clear();
12915
+ allowOutsidePressDismissalRef.current = false;
12916
+ return;
12668
12917
  }
12669
- if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {
12670
- if (stopEventPropagation) event.stopPropagation();
12671
- if (isGrid || isHomeOrEnd || isForwardKey || isBackwardKey) event.preventDefault();
12672
- onHighlightedIndexChange(nextIndex, true);
12673
- queueMicrotask(() => {
12674
- elementsRef.current[nextIndex]?.focus();
12918
+ allowOutsidePressDismissalTimeout.start(500, () => {
12919
+ allowOutsidePressDismissalRef.current = true;
12920
+ });
12921
+ }, [
12922
+ allowOutsidePressDismissalTimeout,
12923
+ open,
12924
+ parent.type
12925
+ ]);
12926
+ useIsoLayoutEffect(() => {
12927
+ if (!open && !hoverEnabled) store.set("hoverEnabled", true);
12928
+ }, [
12929
+ open,
12930
+ hoverEnabled,
12931
+ store
12932
+ ]);
12933
+ const setOpen = useStableCallback((nextOpen, eventDetails) => {
12934
+ const reason = eventDetails.reason;
12935
+ if (!nextOpen && !store.select("open")) return;
12936
+ if (open === nextOpen && eventDetails.trigger === activeTriggerElement && lastOpenChangeReason === reason) return;
12937
+ const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
12938
+ if (!nextOpen && eventDetails.trigger == null) eventDetails.trigger = activeTriggerElement ?? void 0;
12939
+ onOpenChange?.(nextOpen, eventDetails);
12940
+ if (eventDetails.isCanceled) return;
12941
+ store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
12942
+ const nativeEvent = eventDetails.event;
12943
+ if (nextOpen === false && nativeEvent?.type === "click" && nativeEvent.pointerType === "touch" && !allowTouchToCloseRef.current) return;
12944
+ if (nextOpen && reason === "trigger-focus") {
12945
+ allowTouchToCloseRef.current = false;
12946
+ allowTouchToCloseTimeout.start(300, () => {
12947
+ allowTouchToCloseRef.current = true;
12675
12948
  });
12949
+ } else {
12950
+ allowTouchToCloseRef.current = true;
12951
+ allowTouchToCloseTimeout.clear();
12676
12952
  }
12953
+ const isKeyboardClick = (reason === "trigger-press" || reason === "item-press") && nativeEvent.detail === 0;
12954
+ const isDismissClose = !nextOpen && (reason === "escape-key" || reason == null);
12955
+ const updatedState = {
12956
+ open: nextOpen,
12957
+ openChangeReason: reason
12958
+ };
12959
+ openEventRef.current = eventDetails.event;
12960
+ setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
12961
+ store.update(updatedState);
12962
+ if (parent.type === "menubar" && (reason === "trigger-focus" || reason === "focus-out" || reason === "trigger-hover" || reason === "list-navigation" || reason === "sibling-open")) store.set("instantType", "group");
12963
+ else if (isKeyboardClick || isDismissClose) store.set("instantType", isKeyboardClick ? "click" : "dismiss");
12964
+ else store.set("instantType", void 0);
12965
+ });
12966
+ const floatingRootContext = useSyncedFloatingRootContext({
12967
+ popupStore: store,
12968
+ floatingId,
12969
+ nested: floatingParentNodeIdFromContext != null,
12970
+ onOpenChange: setOpen
12971
+ });
12972
+ const floatingEvents = floatingRootContext.context.events;
12973
+ useIsoLayoutEffect(() => {
12974
+ const handleSetOpenEvent = ({ open: nextOpen, eventDetails }) => setOpen(nextOpen, eventDetails);
12975
+ floatingEvents.on("setOpen", handleSetOpenEvent);
12976
+ return () => {
12977
+ floatingEvents?.off("setOpen", handleSetOpenEvent);
12978
+ };
12979
+ }, [floatingEvents, setOpen]);
12980
+ const handleImperativeClose = import_react.useCallback(() => {
12981
+ store.setOpen(false, createChangeEventDetails(imperativeAction));
12982
+ }, [store]);
12983
+ import_react.useImperativeHandle(actionsRef, () => ({
12984
+ unmount: forceUnmount,
12985
+ close: handleImperativeClose
12986
+ }), [forceUnmount, handleImperativeClose]);
12987
+ let ctx;
12988
+ if (parent.type === "context-menu") ctx = parent.context;
12989
+ import_react.useImperativeHandle(ctx?.positionerRef, () => positionerElement, [positionerElement]);
12990
+ import_react.useImperativeHandle(ctx?.actionsRef, () => ({ setOpen }), [setOpen]);
12991
+ const dismiss = useDismiss(floatingRootContext, {
12992
+ enabled: !disabled,
12993
+ bubbles: { escapeKey: closeParentOnEsc && parent.type === "menu" },
12994
+ outsidePress() {
12995
+ if (parent.type !== "context-menu" || openEventRef.current?.type === "contextmenu") return true;
12996
+ return allowOutsidePressDismissalRef.current;
12997
+ },
12998
+ externalTree: nested ? floatingTreeRoot : void 0
12999
+ });
13000
+ const direction = useDirection();
13001
+ const setActiveIndex = import_react.useCallback((index) => {
13002
+ if (store.select("activeIndex") === index) return;
13003
+ store.set("activeIndex", index);
13004
+ }, [store]);
13005
+ const listNavigation$1 = useListNavigation(floatingRootContext, {
13006
+ enabled: !disabled,
13007
+ listRef: store.context.itemDomElements,
13008
+ activeIndex,
13009
+ nested: parent.type !== void 0,
13010
+ loopFocus,
13011
+ orientation,
13012
+ parentOrientation: parent.type === "menubar" ? parent.context.orientation : void 0,
13013
+ rtl: direction === "rtl",
13014
+ disabledIndices: EMPTY_ARRAY,
13015
+ onNavigate: setActiveIndex,
13016
+ openOnArrowKeyDown: parent.type !== "context-menu",
13017
+ externalTree: nested ? floatingTreeRoot : void 0,
13018
+ focusItemOnHover: highlightItemOnHover
12677
13019
  });
13020
+ const onTyping = import_react.useCallback((nextTyping) => {
13021
+ store.context.typingRef.current = nextTyping;
13022
+ }, [store]);
13023
+ const typeahead = useTypeahead(floatingRootContext, {
13024
+ enabled: !disabled,
13025
+ listRef: store.context.itemLabels,
13026
+ elementsRef: store.context.itemDomElements,
13027
+ activeIndex,
13028
+ resetMs: 500,
13029
+ onMatch: (index) => {
13030
+ if (open && index !== activeIndex) store.set("activeIndex", index);
13031
+ },
13032
+ onTyping
13033
+ });
13034
+ usePopupInteractionProps(store, {
13035
+ floatingRootContext,
13036
+ activeTriggerProps: import_react.useMemo(() => {
13037
+ const mergedProps = mergeProps(typeahead.reference, listNavigation$1.reference, dismiss.reference, { onMouseMove() {
13038
+ store.set("allowMouseEnter", true);
13039
+ } }, interactionTypeProps);
13040
+ mergedProps["aria-haspopup"] = "menu";
13041
+ mergedProps["aria-expanded"] = open;
13042
+ return mergedProps;
13043
+ }, [
13044
+ store,
13045
+ typeahead.reference,
13046
+ listNavigation$1.reference,
13047
+ dismiss.reference,
13048
+ interactionTypeProps,
13049
+ open
13050
+ ]),
13051
+ inactiveTriggerProps: import_react.useMemo(() => {
13052
+ const mergedProps = mergeProps(listNavigation$1.trigger, dismiss.trigger, interactionTypeProps);
13053
+ mergedProps["aria-haspopup"] = "menu";
13054
+ mergedProps["aria-expanded"] = false;
13055
+ return mergedProps;
13056
+ }, [
13057
+ listNavigation$1.trigger,
13058
+ dismiss.trigger,
13059
+ interactionTypeProps
13060
+ ]),
13061
+ popupProps: import_react.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, {
13062
+ id: floatingId,
13063
+ role: "menu",
13064
+ "aria-labelledby": activeTriggerElement?.id,
13065
+ onMouseMove() {
13066
+ store.set("allowMouseEnter", true);
13067
+ if (parent.type === "menu") store.set("hoverEnabled", false);
13068
+ },
13069
+ onClick() {
13070
+ if (store.select("hoverEnabled")) store.set("hoverEnabled", false);
13071
+ },
13072
+ onKeyDown(event) {
13073
+ const relay = store.select("keyboardEventRelay");
13074
+ if (relay && !event.isPropagationStopped()) relay(event);
13075
+ }
13076
+ }, typeahead.floating, listNavigation$1.floating, dismiss.floating), [
13077
+ activeTriggerElement,
13078
+ floatingId,
13079
+ parent.type,
13080
+ store,
13081
+ typeahead.floating,
13082
+ listNavigation$1.floating,
13083
+ dismiss.floating
13084
+ ]),
13085
+ itemProps: listNavigation$1.item ?? EMPTY_OBJECT
13086
+ });
13087
+ const context = import_react.useMemo(() => ({
13088
+ store,
13089
+ parent: parentFromContext
13090
+ }), [store, parentFromContext]);
13091
+ const content = /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(MenuRootContext.Provider, {
13092
+ value: context,
13093
+ children: [handle && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(PopupHandleAttachment, {
13094
+ handle,
13095
+ store
13096
+ }), typeof children === "function" ? children({ payload }) : children]
13097
+ });
13098
+ if (parent.type === void 0 || parent.type === "context-menu") return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingTree, {
13099
+ externalTree: floatingTreeRoot,
13100
+ children: content
13101
+ });
13102
+ return content;
13103
+ });
13104
+ function useMenuRootStore(initialState) {
13105
+ return useRefWithInit(() => new MenuStore(initialState)).current;
13106
+ }
13107
+ //#endregion
13108
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs
13109
+ function useCompositeItem(params = {}) {
13110
+ const { highlightItemOnHover, highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
13111
+ const { ref, index } = useCompositeListItem(params);
13112
+ const isHighlighted = highlightedIndex === index;
13113
+ const itemRef = import_react.useRef(null);
13114
+ const mergedRef = useMergedRefs(ref, itemRef);
12678
13115
  return {
12679
- props: {
12680
- ref: mergedRef,
12681
- onFocus(event) {
12682
- const element = rootRef.current;
12683
- const target = getTarget(event.nativeEvent);
12684
- if (!element || target == null || !isNativeInput(target)) return;
12685
- target.setSelectionRange(0, target.value.length);
13116
+ compositeProps: {
13117
+ tabIndex: isHighlighted ? 0 : -1,
13118
+ onFocus() {
13119
+ onHighlightedIndexChange(index);
12686
13120
  },
12687
- onKeyDown
13121
+ onMouseMove() {
13122
+ const item = itemRef.current;
13123
+ if (!highlightItemOnHover || !item) return;
13124
+ const disabled = item.hasAttribute("disabled") || item.ariaDisabled === "true";
13125
+ if (!isHighlighted && !disabled) item.focus();
13126
+ }
12688
13127
  },
12689
- highlightedIndex,
12690
- onHighlightedIndexChange,
12691
- elementsRef,
12692
- onMapChange,
12693
- relayKeyboardEvent: onKeyDown
13128
+ compositeRef: mergedRef,
13129
+ index
12694
13130
  };
12695
13131
  }
12696
- function isModifierKeySet(event, ignoredModifierKeys) {
12697
- for (const key of MODIFIER_KEYS) {
12698
- if (ignoredModifierKeys.includes(key)) continue;
12699
- if (event.getModifierState(key)) return true;
12700
- }
12701
- return false;
12702
- }
12703
13132
  //#endregion
12704
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs
12705
- function CompositeRoot(componentProps) {
12706
- const { render, className, style, refs = EMPTY_ARRAY$1, props = EMPTY_ARRAY$1, state = EMPTY_OBJECT, stateAttributesMapping, highlightedIndex: highlightedIndexProp, onHighlightedIndexChange: onHighlightedIndexChangeProp, orientation, grid, loopFocus, onLoop, enableHomeAndEndKeys, onMapChange: onMapChangeProp, stopEventPropagation = true, rootRef, disabledIndices, modifierKeys, highlightItemOnHover = false, tag = "div", ...elementProps } = componentProps;
12707
- const { props: defaultProps, highlightedIndex, onHighlightedIndexChange, elementsRef, onMapChange: onMapChangeUnwrapped, relayKeyboardEvent } = useCompositeRoot({
12708
- grid,
12709
- loopFocus,
12710
- onLoop,
12711
- orientation,
12712
- highlightedIndex: highlightedIndexProp,
12713
- onHighlightedIndexChange: onHighlightedIndexChangeProp,
12714
- rootRef,
12715
- stopEventPropagation,
12716
- enableHomeAndEndKeys,
12717
- direction: useDirection(),
12718
- disabledIndices,
12719
- modifierKeys
12720
- });
12721
- const element = useRenderElement(tag, componentProps, {
13133
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/composite/item/CompositeItem.mjs
13134
+ function CompositeItem(componentProps) {
13135
+ const { render, className, style, state = EMPTY_OBJECT, props = EMPTY_ARRAY, refs = EMPTY_ARRAY, metadata, stateAttributesMapping, tag = "div", ...elementProps } = componentProps;
13136
+ const { compositeProps, compositeRef } = useCompositeItem({ metadata });
13137
+ return useRenderElement(tag, componentProps, {
12722
13138
  state,
12723
- ref: refs,
13139
+ ref: [compositeRef, ...refs],
12724
13140
  props: [
12725
- defaultProps,
13141
+ compositeProps,
12726
13142
  ...props,
12727
13143
  elementProps
12728
13144
  ],
12729
13145
  stateAttributesMapping
12730
13146
  });
12731
- const contextValue = import_react.useMemo(() => ({
12732
- highlightedIndex,
12733
- onHighlightedIndexChange,
12734
- highlightItemOnHover,
12735
- relayKeyboardEvent
12736
- }), [
12737
- highlightedIndex,
12738
- onHighlightedIndexChange,
12739
- highlightItemOnHover,
12740
- relayKeyboardEvent
12741
- ]);
12742
- return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(CompositeRootContext.Provider, {
12743
- value: contextValue,
12744
- children: /*#__PURE__*/ (0, import_jsx_runtime.jsx)(CompositeList, {
12745
- elementsRef,
12746
- onMapChange: (newMap) => {
12747
- onMapChangeProp?.(newMap);
12748
- onMapChangeUnwrapped(newMap);
12749
- },
12750
- children: element
12751
- })
12752
- });
12753
13147
  }
12754
13148
  //#endregion
12755
- //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/tabs/list/TabsList.mjs
13149
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/utils/findRootOwnerId.mjs
13150
+ function findRootOwnerId(node) {
13151
+ if (isHTMLElement(node) && node.hasAttribute("data-rootownerid")) return node.getAttribute("data-rootownerid");
13152
+ if (isLastTraversableNode(node)) return;
13153
+ return findRootOwnerId(getParentNode(node));
13154
+ }
13155
+ //#endregion
13156
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/utils/popups/useTriggerFocusGuards.mjs
12756
13157
  /**
12757
- * Groups the individual tab buttons.
12758
- * Renders a `<div>` element.
13158
+ * Minimal store interface required by the focus guard hook.
13159
+ * Both PopoverStore and MenuStore satisfy this interface.
13160
+ */
13161
+ /**
13162
+ * Provides focus guard handlers for popup triggers (Popover, Menu).
12759
13163
  *
12760
- * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
12761
- */
12762
- var TabsList = /*#__PURE__*/ import_react.forwardRef(function TabsList(componentProps, forwardedRef) {
12763
- const { activateOnFocus = false, className, loopFocus = true, render, style, ...elementProps } = componentProps;
12764
- const { orientation, setTabMap, tabActivationDirection } = useTabsRootContext();
12765
- const [highlightedTabIndex, setHighlightedTabIndex] = import_react.useState(0);
12766
- const [tabsListElement, setTabsListElement] = import_react.useState(null);
12767
- const indicatorUpdateListenersRef = import_react.useRef(/* @__PURE__ */ new Set());
12768
- const tabResizeObserverElementsRef = import_react.useRef(/* @__PURE__ */ new Set());
12769
- const resizeObserverRef = import_react.useRef(null);
12770
- useIsoLayoutEffect(() => {
12771
- if (typeof ResizeObserver === "undefined") return;
12772
- const resizeObserver = new ResizeObserver(() => {
12773
- indicatorUpdateListenersRef.current.forEach((listener) => {
12774
- listener();
12775
- });
13164
+ * When the popup is open, invisible focus guard elements are placed before and after
13165
+ * the trigger. These handlers close the popup and move focus to the appropriate
13166
+ * tabbable element when the guards receive focus (i.e. when the user tabs out).
13167
+ */
13168
+ function useTriggerFocusGuards(store, triggerElementRef) {
13169
+ const preFocusGuardRef = import_react.useRef(null);
13170
+ function handlePreFocusGuardFocus(event) {
13171
+ import_react_dom.flushSync(() => {
13172
+ store.setOpen(false, createChangeEventDetails(focusOut, event.nativeEvent, event.currentTarget));
12776
13173
  });
12777
- resizeObserverRef.current = resizeObserver;
12778
- if (tabsListElement) resizeObserver.observe(tabsListElement);
12779
- tabResizeObserverElementsRef.current.forEach((element) => {
12780
- resizeObserver.observe(element);
12781
- });
12782
- return () => {
12783
- resizeObserver.disconnect();
12784
- resizeObserverRef.current = null;
12785
- };
12786
- }, [tabsListElement]);
12787
- const registerIndicatorUpdateListener = useStableCallback((listener) => {
12788
- indicatorUpdateListenersRef.current.add(listener);
12789
- return () => {
12790
- indicatorUpdateListenersRef.current.delete(listener);
13174
+ getTabbableBeforeElement(preFocusGuardRef.current)?.focus();
13175
+ }
13176
+ function handleFocusTargetFocus(event) {
13177
+ const positionerElement = store.select("positionerElement");
13178
+ if (positionerElement && isOutsideEvent(event, positionerElement)) store.context.beforeContentFocusGuardRef.current?.focus();
13179
+ else {
13180
+ import_react_dom.flushSync(() => {
13181
+ store.setOpen(false, createChangeEventDetails(focusOut, event.nativeEvent, event.currentTarget));
13182
+ });
13183
+ let nextTabbable = getTabbableAfterElement(store.context.triggerFocusTargetRef.current || triggerElementRef.current);
13184
+ while (nextTabbable !== null && contains(positionerElement, nextTabbable)) {
13185
+ const prevTabbable = nextTabbable;
13186
+ nextTabbable = getNextTabbable(nextTabbable);
13187
+ if (nextTabbable === prevTabbable) break;
13188
+ }
13189
+ nextTabbable?.focus();
13190
+ }
13191
+ }
13192
+ return {
13193
+ preFocusGuardRef,
13194
+ handlePreFocusGuardFocus,
13195
+ handleFocusTargetFocus
13196
+ };
13197
+ }
13198
+ //#endregion
13199
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/utils/useMixedToggleClickHandler.mjs
13200
+ /**
13201
+ * Returns `click` and `mousedown` handlers that fix the behavior of triggers of popups that are toggled by different events.
13202
+ * For example, a button that opens a popup on mousedown and closes it on click.
13203
+ * This hook prevents the popup from closing immediately after the mouse button is released.
13204
+ */
13205
+ function useMixedToggleClickHandler(params) {
13206
+ const { enabled = true, mouseDownAction, open } = params;
13207
+ const ignoreClickRef = import_react.useRef(false);
13208
+ return import_react.useMemo(() => {
13209
+ if (!enabled) return EMPTY_OBJECT;
13210
+ return {
13211
+ onMouseDown: (event) => {
13212
+ if (mouseDownAction === "open" && !open || mouseDownAction === "close" && open) {
13213
+ ignoreClickRef.current = true;
13214
+ ownerDocument(event.currentTarget).addEventListener("click", () => {
13215
+ ignoreClickRef.current = false;
13216
+ }, { once: true });
13217
+ }
13218
+ },
13219
+ onClick: (event) => {
13220
+ if (ignoreClickRef.current) {
13221
+ ignoreClickRef.current = false;
13222
+ event.preventBaseUIHandler();
13223
+ }
13224
+ }
12791
13225
  };
13226
+ }, [
13227
+ enabled,
13228
+ mouseDownAction,
13229
+ open
13230
+ ]);
13231
+ }
13232
+ //#endregion
13233
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/trigger/MenuTrigger.mjs
13234
+ /**
13235
+ * A button that opens the menu.
13236
+ * Renders a `<button>` element.
13237
+ *
13238
+ * Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
13239
+ */
13240
+ var MenuTrigger = fastComponentRef(function MenuTrigger(componentProps, forwardedRef) {
13241
+ const { render, className, style, disabled: disabledProp = false, nativeButton = true, id: idProp, openOnHover: openOnHoverProp, delay = 100, closeDelay = 0, handle, payload, ...elementProps } = componentProps;
13242
+ const rootContext = useMenuRootContext(true);
13243
+ const store = usePopupHandleStore(handle) ?? rootContext?.store;
13244
+ if (!store) throw new Error(formatErrorMessage(85));
13245
+ const thisTriggerId = useBaseUiId(idProp);
13246
+ const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
13247
+ const floatingRootContext = store.useState("floatingRootContext");
13248
+ const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
13249
+ const popupId = store.useState("triggerPopupId", thisTriggerId);
13250
+ const triggerElementRef = import_react.useRef(null);
13251
+ const parent = useMenuParent();
13252
+ const compositeRootContext = useCompositeRootContext(true);
13253
+ const floatingTreeRootFromContext = useFloatingTree();
13254
+ const floatingTreeRoot = import_react.useMemo(() => {
13255
+ return floatingTreeRootFromContext ?? new FloatingTreeStore();
13256
+ }, [floatingTreeRootFromContext]);
13257
+ const { registerTrigger, isMountedByThisTrigger } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
13258
+ payload,
13259
+ closeDelay,
13260
+ parent,
13261
+ floatingTreeRoot,
13262
+ floatingNodeId: useFloatingNodeId(floatingTreeRoot),
13263
+ floatingParentNodeId: useFloatingParentNodeId(),
13264
+ keyboardEventRelay: compositeRootContext?.relayKeyboardEvent
13265
+ });
13266
+ const isInMenubar = parent.type === "menubar";
13267
+ const rootDisabled = store.useState("disabled");
13268
+ const disabled = disabledProp || rootDisabled || isInMenubar && parent.context.disabled;
13269
+ const { getButtonProps, buttonRef } = useButton({
13270
+ disabled,
13271
+ native: nativeButton
12792
13272
  });
12793
- const registerTabResizeObserverElement = useStableCallback((element) => {
12794
- tabResizeObserverElementsRef.current.add(element);
12795
- resizeObserverRef.current?.observe(element);
12796
- return () => {
12797
- tabResizeObserverElementsRef.current.delete(element);
12798
- resizeObserverRef.current?.unobserve(element);
12799
- };
13273
+ import_react.useEffect(() => {
13274
+ if (!isOpenedByThisTrigger && parent.type === void 0) store.context.allowMouseUpTriggerRef.current = false;
13275
+ }, [
13276
+ store,
13277
+ isOpenedByThisTrigger,
13278
+ parent.type
13279
+ ]);
13280
+ const triggerRef = import_react.useRef(null);
13281
+ const allowMouseUpTriggerTimeout = useTimeout();
13282
+ const handleDocumentMouseUp = useStableCallback((mouseEvent) => {
13283
+ if (!triggerRef.current) return;
13284
+ allowMouseUpTriggerTimeout.clear();
13285
+ store.context.allowMouseUpTriggerRef.current = false;
13286
+ const mouseUpTarget = mouseEvent.target;
13287
+ if (contains(triggerRef.current, mouseUpTarget) || contains(store.select("positionerElement"), mouseUpTarget) || mouseUpTarget === triggerRef.current) return;
13288
+ if (mouseUpTarget != null && findRootOwnerId(mouseUpTarget) === store.select("rootId")) return;
13289
+ if (isMouseWithinBounds(mouseEvent, triggerRef.current)) return;
13290
+ floatingTreeRoot.events.emit("close", {
13291
+ domEvent: mouseEvent,
13292
+ reason: cancelOpen
13293
+ });
13294
+ });
13295
+ import_react.useEffect(() => {
13296
+ if (isOpenedByThisTrigger && store.select("lastOpenChangeReason") === "trigger-hover") ownerDocument(triggerRef.current).addEventListener("mouseup", handleDocumentMouseUp, { once: true });
13297
+ }, [
13298
+ isOpenedByThisTrigger,
13299
+ handleDocumentMouseUp,
13300
+ store
13301
+ ]);
13302
+ const parentMenubarHasSubmenuOpen = isInMenubar && parent.context.hasSubmenuOpen;
13303
+ const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
13304
+ enabled: (openOnHoverProp ?? parentMenubarHasSubmenuOpen) && !disabled && (!isInMenubar || parentMenubarHasSubmenuOpen && !isMountedByThisTrigger),
13305
+ handleClose: safePolygon({ blockPointerEvents: !isInMenubar }),
13306
+ mouseOnly: true,
13307
+ move: false,
13308
+ restMs: parent.type === void 0 ? delay : void 0,
13309
+ delay: { close: closeDelay },
13310
+ triggerElementRef,
13311
+ externalTree: floatingTreeRoot,
13312
+ isActiveTrigger: isTriggerActive,
13313
+ isClosing: () => store.select("transitionStatus") === "ending"
12800
13314
  });
13315
+ const stickIfOpen = useStickIfOpen(isOpenedByThisTrigger, store.select("lastOpenChangeReason"));
13316
+ const click = useClick(floatingRootContext, {
13317
+ enabled: !disabled,
13318
+ event: isOpenedByThisTrigger && isInMenubar ? "click" : "mousedown",
13319
+ toggle: true,
13320
+ ignoreMouse: false,
13321
+ stickIfOpen: parent.type === void 0 ? stickIfOpen : false
13322
+ });
13323
+ const focus = useFocus(floatingRootContext, { enabled: !disabled && parentMenubarHasSubmenuOpen });
13324
+ const mixedToggleHandlers = useMixedToggleClickHandler({
13325
+ open: isOpenedByThisTrigger,
13326
+ enabled: isInMenubar,
13327
+ mouseDownAction: "open"
13328
+ });
13329
+ const localInteractionProps = import_react.useMemo(() => mergeProps(focus.reference, click.reference), [focus.reference, click.reference]);
13330
+ const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
13331
+ const { preFocusGuardRef, handlePreFocusGuardFocus, handleFocusTargetFocus } = useTriggerFocusGuards(store, triggerElementRef);
12801
13332
  const state = {
12802
- orientation,
12803
- tabActivationDirection
13333
+ disabled,
13334
+ open: isOpenedByThisTrigger
12804
13335
  };
12805
- const defaultProps = {
12806
- "aria-orientation": orientation === "vertical" ? "vertical" : void 0,
12807
- role: "tablist"
12808
- };
12809
- const tabsListContextValue = import_react.useMemo(() => ({
12810
- activateOnFocus,
12811
- registerIndicatorUpdateListener,
12812
- registerTabResizeObserverElement,
12813
- tabsListElement
12814
- }), [
12815
- activateOnFocus,
12816
- registerIndicatorUpdateListener,
12817
- registerTabResizeObserverElement,
12818
- tabsListElement
13336
+ const ref = [
13337
+ triggerRef,
13338
+ forwardedRef,
13339
+ buttonRef,
13340
+ registerTrigger,
13341
+ triggerElementRef
13342
+ ];
13343
+ const props = [
13344
+ localInteractionProps,
13345
+ hoverProps ?? EMPTY_OBJECT,
13346
+ rootTriggerProps,
13347
+ {
13348
+ "aria-haspopup": "menu",
13349
+ "aria-controls": popupId,
13350
+ id: thisTriggerId,
13351
+ onMouseDown: (event) => {
13352
+ if (store.select("open")) return;
13353
+ allowMouseUpTriggerTimeout.start(200, () => {
13354
+ store.context.allowMouseUpTriggerRef.current = true;
13355
+ });
13356
+ ownerDocument(event.currentTarget).addEventListener("mouseup", handleDocumentMouseUp, { once: true });
13357
+ }
13358
+ },
13359
+ isInMenubar ? { role: "menuitem" } : {},
13360
+ mixedToggleHandlers,
13361
+ elementProps,
13362
+ getButtonProps
13363
+ ];
13364
+ const element = useRenderElement("button", componentProps, {
13365
+ enabled: !isInMenubar,
13366
+ stateAttributesMapping: pressableTriggerOpenStateMapping,
13367
+ state,
13368
+ ref,
13369
+ props
13370
+ });
13371
+ if (isInMenubar) return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(CompositeItem, {
13372
+ tag: "button",
13373
+ render,
13374
+ className,
13375
+ style,
13376
+ state,
13377
+ refs: ref,
13378
+ props,
13379
+ stateAttributesMapping: pressableTriggerOpenStateMapping
13380
+ });
13381
+ if (isOpenedByThisTrigger) return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
13382
+ /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
13383
+ ref: preFocusGuardRef,
13384
+ onFocus: handlePreFocusGuardFocus
13385
+ }, `${thisTriggerId}-pre-focus-guard`),
13386
+ /*#__PURE__*/ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: element }, thisTriggerId),
13387
+ /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
13388
+ ref: store.context.triggerFocusTargetRef,
13389
+ onFocus: handleFocusTargetFocus
13390
+ }, `${thisTriggerId}-post-focus-guard`)
13391
+ ] });
13392
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: element }, thisTriggerId);
13393
+ });
13394
+ /**
13395
+ * Determines whether to ignore clicks after a hover-open.
13396
+ */
13397
+ function useStickIfOpen(open, openReason) {
13398
+ const stickIfOpenTimeout = useTimeout();
13399
+ const [stickIfOpen, setStickIfOpen] = import_react.useState(false);
13400
+ useIsoLayoutEffect(() => {
13401
+ if (open && openReason === "trigger-hover") {
13402
+ setStickIfOpen(true);
13403
+ stickIfOpenTimeout.start(500, () => {
13404
+ setStickIfOpen(false);
13405
+ });
13406
+ } else if (!open) {
13407
+ stickIfOpenTimeout.clear();
13408
+ setStickIfOpen(false);
13409
+ }
13410
+ }, [
13411
+ open,
13412
+ openReason,
13413
+ stickIfOpenTimeout
12819
13414
  ]);
12820
- return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(TabsListContext.Provider, {
12821
- value: tabsListContextValue,
12822
- children: /*#__PURE__*/ (0, import_jsx_runtime.jsx)(CompositeRoot, {
12823
- render,
12824
- className,
12825
- style,
12826
- state,
12827
- refs: [forwardedRef, setTabsListElement],
12828
- props: [defaultProps, elementProps],
12829
- stateAttributesMapping: tabsStateAttributesMapping,
12830
- highlightedIndex: highlightedTabIndex,
12831
- enableHomeAndEndKeys: true,
12832
- loopFocus,
12833
- orientation,
12834
- onHighlightedIndexChange: setHighlightedTabIndex,
12835
- onMapChange: setTabMap,
12836
- disabledIndices: EMPTY_ARRAY$1
12837
- })
13415
+ return stickIfOpen;
13416
+ }
13417
+ function useMenuParent() {
13418
+ const menubarContext = useMenubarContext(true);
13419
+ return import_react.useMemo(() => {
13420
+ if (menubarContext) return {
13421
+ type: "menubar",
13422
+ context: menubarContext
13423
+ };
13424
+ return { type: void 0 };
13425
+ }, [menubarContext]);
13426
+ }
13427
+ //#endregion
13428
+ //#region node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.18_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/separator/Separator.mjs
13429
+ /**
13430
+ * A separator element accessible to screen readers.
13431
+ * Renders a `<div>` element.
13432
+ *
13433
+ * Documentation: [Base UI Separator](https://base-ui.com/react/components/separator)
13434
+ */
13435
+ var Separator = /*#__PURE__*/ import_react.forwardRef(function SeparatorComponent(componentProps, forwardedRef) {
13436
+ const { className, render, orientation = "horizontal", style, ...elementProps } = componentProps;
13437
+ return useRenderElement("div", componentProps, {
13438
+ state: { orientation },
13439
+ ref: forwardedRef,
13440
+ props: [{
13441
+ role: "separator",
13442
+ "aria-orientation": orientation
13443
+ }, elementProps]
12838
13444
  });
12839
13445
  });
12840
13446
  //#endregion
12841
- export { DialogRoot as A, mergeProps as B, TooltipArrow as C, TooltipTrigger as D, TooltipPortal as E, DialogBackdrop as F, require_with_selector as H, Separator as I, Input as L, DialogPopup as M, DialogDescription as N, TooltipRoot as O, DialogClose as P, useRender as R, SelectRoot as S, TooltipPositioner as T, require_jsx_runtime as U, require_react_dom as V, require_react as W, SelectPositioner as _, AvatarFallback as a, SelectValue as b, SwitchThumb as c, SelectScrollDownArrow as d, SelectItemText as f, SelectPopup as g, SelectList as h, TabsRoot as i, DialogPortal as j, DialogTitle as k, SwitchRoot as l, SelectItem as m, TabsPanel as n, AvatarImage as o, SelectItemIndicator as p, TabsTab as r, AvatarRoot as s, TabsList as t, SelectScrollUpArrow as u, SelectPortal as v, TooltipPopup as w, SelectTrigger as x, SelectIcon as y, Button as z };
13447
+ export { TooltipTrigger as A, Input as B, SelectValue as C, TooltipPopup as D, TooltipArrow as E, DialogPortal as F, require_with_selector as G, Button as H, DialogPopup as I, require_jsx_runtime as K, DialogDescription as L, DialogTrigger as M, DialogTitle as N, TooltipPositioner as O, DialogRoot as P, DialogClose as R, SelectIcon as S, SelectRoot as T, mergeProps as U, useRender as V, require_react_dom as W, SelectItem as _, MenuPortal as a, SelectPositioner as b, AvatarFallback as c, SwitchThumb as d, SwitchRoot as f, SelectItemIndicator as g, SelectItemText as h, MenuPositioner as i, TooltipRoot as j, TooltipPortal as k, AvatarImage as l, SelectScrollDownArrow as m, MenuTrigger as n, MenuPopup as o, SelectScrollUpArrow as p, require_react as q, MenuRoot as r, MenuItem as s, Separator as t, AvatarRoot as u, SelectList as v, SelectTrigger as w, SelectPortal as x, SelectPopup as y, DialogBackdrop as z };