@dooherceg/tiptap-controlled-editor-with-table 0.0.6 → 0.0.8

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 (112) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +1 -0
  4. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +1 -0
  5. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +1 -0
  6. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +1 -0
  7. package/dist/assets/components/tiptap-node/image-node/image-node.css +1 -0
  8. package/dist/assets/components/tiptap-node/list-node/list-node.css +1 -0
  9. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +1 -0
  10. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +1 -0
  11. package/dist/assets/{badge.css → components/tiptap-ui-primitive/badge/badge-colors.css} +1 -1
  12. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +1 -0
  13. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +1 -0
  14. package/dist/assets/{button.css → components/tiptap-ui-primitive/button/button-colors.css} +1 -1
  15. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +1 -0
  16. package/dist/assets/components/tiptap-ui-primitive/button/button.css +1 -0
  17. package/dist/assets/styles/_keyframe-animations.css +1 -0
  18. package/dist/assets/styles/_variables.css +1 -0
  19. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +6 -58
  20. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -3
  21. package/dist/components/tiptap-templates/simple/simple-editor.js +160 -1899
  22. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +6 -5
  23. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  24. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  25. package/dist/components/tiptap-ui-primitive/badge/badge.js +19 -16
  26. package/dist/components/tiptap-ui-primitive/button/button.js +18 -15
  27. package/dist/components/tiptap-ui-primitive/card/card.js +13 -12
  28. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +39 -1012
  29. package/dist/components/tiptap-ui-primitive/input/input.js +7 -6
  30. package/dist/components/tiptap-ui-primitive/popover/popover.js +24 -233
  31. package/dist/components/tiptap-ui-primitive/separator/separator.js +9 -8
  32. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +2 -1
  33. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +84 -1330
  34. package/dist/hooks/use-throttled-callback.js +13 -108
  35. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +527 -0
  36. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
  37. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +932 -0
  38. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +185 -0
  39. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
  40. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  41. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
  42. package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
  43. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
  44. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
  45. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
  46. package/dist/node_modules/@radix-ui/react-context/dist/index.js +53 -0
  47. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
  48. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
  49. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +221 -0
  50. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
  51. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +136 -0
  52. package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
  53. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +636 -0
  54. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +239 -0
  55. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
  56. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +15 -0
  57. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
  58. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
  59. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
  60. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
  61. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
  62. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
  63. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
  64. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
  65. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
  66. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +84 -0
  67. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +57 -0
  68. package/dist/node_modules/@tiptap/extension-image/dist/index.js +128 -0
  69. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  70. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +40 -0
  71. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +40 -0
  72. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  73. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +46 -0
  74. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +125 -0
  75. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  76. package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
  77. package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -0
  78. package/dist/node_modules/lodash.throttle/index.js +95 -0
  79. package/dist/{index-Bqw9S4qP.js → node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js} +57 -55
  80. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
  81. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
  82. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
  83. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
  84. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -0
  85. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
  86. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
  87. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
  88. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
  89. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
  90. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
  91. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
  92. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
  93. package/dist/node_modules/tabbable/dist/index.esm.js +197 -0
  94. package/dist/node_modules/tslib/tslib.es6.js +27 -0
  95. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
  96. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
  97. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
  98. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
  99. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
  100. package/package.json +1 -1
  101. package/dist/Combination-CO0ZtURs.js +0 -1333
  102. package/dist/assets/simple-editor.css +0 -1
  103. package/dist/floating-ui.react-dom-DgOuULHo.js +0 -1334
  104. /package/dist/assets/{image-upload-node.css → components/tiptap-node/image-upload-node/image-upload-node.css} +0 -0
  105. /package/dist/assets/{color-highlight-button.css → components/tiptap-ui/color-highlight-button/color-highlight-button.css} +0 -0
  106. /package/dist/assets/{card.css → components/tiptap-ui-primitive/card/card.css} +0 -0
  107. /package/dist/assets/{dropdown-menu.css → components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css} +0 -0
  108. /package/dist/assets/{input.css → components/tiptap-ui-primitive/input/input.css} +0 -0
  109. /package/dist/assets/{popover.css → components/tiptap-ui-primitive/popover/popover.css} +0 -0
  110. /package/dist/assets/{separator.css → components/tiptap-ui-primitive/separator/separator.css} +0 -0
  111. /package/dist/assets/{toolbar.css → components/tiptap-ui-primitive/toolbar/toolbar.css} +0 -0
  112. /package/dist/assets/{tooltip.css → components/tiptap-ui-primitive/tooltip/tooltip.css} +0 -0
@@ -0,0 +1,636 @@
1
+ import * as o from "react";
2
+ import { composeEventHandlers as v } from "../../primitive/dist/index.js";
3
+ import { createCollection as ze } from "../../react-collection/dist/index.js";
4
+ import { useComposedRefs as D, composeRefs as Ze } from "../../react-compose-refs/dist/index.js";
5
+ import { createContextScope as $e } from "../../react-context/dist/index.js";
6
+ import { useDirection as qe } from "../../react-direction/dist/index.js";
7
+ import { DismissableLayer as Je } from "../../react-dismissable-layer/dist/index.js";
8
+ import { useFocusGuards as Qe } from "../../react-focus-guards/dist/index.js";
9
+ import { FocusScope as et } from "../../react-focus-scope/dist/index.js";
10
+ import { useId as de } from "../../react-id/dist/index.js";
11
+ import { createPopperScope as pe, Anchor as tt, Content as nt, Root as me, Arrow as ot } from "../../react-popper/dist/index.js";
12
+ import { Portal as rt } from "../../react-portal/dist/index.js";
13
+ import { Presence as X } from "../../react-presence/dist/index.js";
14
+ import { Primitive as N, dispatchDiscreteCustomEvent as ct } from "../../react-primitive/dist/index.js";
15
+ import { createRovingFocusGroupScope as he, Root as at, Item as st } from "../../react-roving-focus/dist/index.js";
16
+ import { createSlot as ut } from "../../react-slot/dist/index.js";
17
+ import { useCallbackRef as q } from "../../react-use-callback-ref/dist/index.js";
18
+ import { hideOthers as it } from "../../../aria-hidden/dist/es2015/index.js";
19
+ import lt from "../../../react-remove-scroll/dist/es2015/Combination.js";
20
+ import { jsx as s } from "react/jsx-runtime";
21
+ var $ = ["Enter", " "], dt = ["ArrowDown", "PageUp", "Home"], Me = ["ArrowUp", "PageDown", "End"], ft = [...dt, ...Me], pt = {
22
+ ltr: [...$, "ArrowRight"],
23
+ rtl: [...$, "ArrowLeft"]
24
+ }, mt = {
25
+ ltr: ["ArrowLeft"],
26
+ rtl: ["ArrowRight"]
27
+ }, F = "Menu", [O, ht, Mt] = ze(F), [P, on] = $e(F, [
28
+ Mt,
29
+ pe,
30
+ he
31
+ ]), L = pe(), ve = he(), [Ce, R] = P(F), [vt, K] = P(F), ge = (e) => {
32
+ const { __scopeMenu: n, open: t = !1, children: r, dir: u, onOpenChange: c, modal: d = !0 } = e, m = L(n), [h, p] = o.useState(null), l = o.useRef(!1), a = q(c), f = qe(u);
33
+ return o.useEffect(() => {
34
+ const g = () => {
35
+ l.current = !0, document.addEventListener("pointerdown", M, { capture: !0, once: !0 }), document.addEventListener("pointermove", M, { capture: !0, once: !0 });
36
+ }, M = () => l.current = !1;
37
+ return document.addEventListener("keydown", g, { capture: !0 }), () => {
38
+ document.removeEventListener("keydown", g, { capture: !0 }), document.removeEventListener("pointerdown", M, { capture: !0 }), document.removeEventListener("pointermove", M, { capture: !0 });
39
+ };
40
+ }, []), /* @__PURE__ */ s(me, { ...m, children: /* @__PURE__ */ s(
41
+ Ce,
42
+ {
43
+ scope: n,
44
+ open: t,
45
+ onOpenChange: a,
46
+ content: h,
47
+ onContentChange: p,
48
+ children: /* @__PURE__ */ s(
49
+ vt,
50
+ {
51
+ scope: n,
52
+ onClose: o.useCallback(() => a(!1), [a]),
53
+ isUsingKeyboardRef: l,
54
+ dir: f,
55
+ modal: d,
56
+ children: r
57
+ }
58
+ )
59
+ }
60
+ ) });
61
+ };
62
+ ge.displayName = F;
63
+ var Ct = "MenuAnchor", J = o.forwardRef(
64
+ (e, n) => {
65
+ const { __scopeMenu: t, ...r } = e, u = L(t);
66
+ return /* @__PURE__ */ s(tt, { ...u, ...r, ref: n });
67
+ }
68
+ );
69
+ J.displayName = Ct;
70
+ var Q = "MenuPortal", [gt, _e] = P(Q, {
71
+ forceMount: void 0
72
+ }), Re = (e) => {
73
+ const { __scopeMenu: n, forceMount: t, children: r, container: u } = e, c = R(Q, n);
74
+ return /* @__PURE__ */ s(gt, { scope: n, forceMount: t, children: /* @__PURE__ */ s(X, { present: t || c.open, children: /* @__PURE__ */ s(rt, { asChild: !0, container: u, children: r }) }) });
75
+ };
76
+ Re.displayName = Q;
77
+ var _ = "MenuContent", [_t, ee] = P(_), Se = o.forwardRef(
78
+ (e, n) => {
79
+ const t = _e(_, e.__scopeMenu), { forceMount: r = t.forceMount, ...u } = e, c = R(_, e.__scopeMenu), d = K(_, e.__scopeMenu);
80
+ return /* @__PURE__ */ s(O.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(X, { present: r || c.open, children: /* @__PURE__ */ s(O.Slot, { scope: e.__scopeMenu, children: d.modal ? /* @__PURE__ */ s(Rt, { ...u, ref: n }) : /* @__PURE__ */ s(St, { ...u, ref: n }) }) }) });
81
+ }
82
+ ), Rt = o.forwardRef(
83
+ (e, n) => {
84
+ const t = R(_, e.__scopeMenu), r = o.useRef(null), u = D(n, r);
85
+ return o.useEffect(() => {
86
+ const c = r.current;
87
+ if (c) return it(c);
88
+ }, []), /* @__PURE__ */ s(
89
+ te,
90
+ {
91
+ ...e,
92
+ ref: u,
93
+ trapFocus: t.open,
94
+ disableOutsidePointerEvents: t.open,
95
+ disableOutsideScroll: !0,
96
+ onFocusOutside: v(
97
+ e.onFocusOutside,
98
+ (c) => c.preventDefault(),
99
+ { checkForDefaultPrevented: !1 }
100
+ ),
101
+ onDismiss: () => t.onOpenChange(!1)
102
+ }
103
+ );
104
+ }
105
+ ), St = o.forwardRef((e, n) => {
106
+ const t = R(_, e.__scopeMenu);
107
+ return /* @__PURE__ */ s(
108
+ te,
109
+ {
110
+ ...e,
111
+ ref: n,
112
+ trapFocus: !1,
113
+ disableOutsidePointerEvents: !1,
114
+ disableOutsideScroll: !1,
115
+ onDismiss: () => t.onOpenChange(!1)
116
+ }
117
+ );
118
+ }), Pt = ut("MenuContent.ScrollLock"), te = o.forwardRef(
119
+ (e, n) => {
120
+ const {
121
+ __scopeMenu: t,
122
+ loop: r = !1,
123
+ trapFocus: u,
124
+ onOpenAutoFocus: c,
125
+ onCloseAutoFocus: d,
126
+ disableOutsidePointerEvents: m,
127
+ onEntryFocus: h,
128
+ onEscapeKeyDown: p,
129
+ onPointerDownOutside: l,
130
+ onFocusOutside: a,
131
+ onInteractOutside: f,
132
+ onDismiss: g,
133
+ disableOutsideScroll: M,
134
+ ...E
135
+ } = e, x = R(_, t), w = K(_, t), Ue = L(t), Be = ve(t), ae = ht(t), [Ve, se] = o.useState(null), G = o.useRef(null), Ye = D(n, G, x.onContentChange), U = o.useRef(0), B = o.useRef(""), Xe = o.useRef(0), H = o.useRef(null), ue = o.useRef("right"), W = o.useRef(0), je = M ? lt : o.Fragment, He = M ? { as: Pt, allowPinchZoom: !0 } : void 0, We = (i) => {
136
+ const y = B.current + i, S = ae().filter((C) => !C.disabled), b = document.activeElement, z = S.find((C) => C.ref.current === b)?.textValue, Z = S.map((C) => C.textValue), ie = Nt(Z, y, z), T = S.find((C) => C.textValue === ie)?.ref.current;
137
+ (function C(le) {
138
+ B.current = le, window.clearTimeout(U.current), le !== "" && (U.current = window.setTimeout(() => C(""), 1e3));
139
+ })(y), T && setTimeout(() => T.focus());
140
+ };
141
+ o.useEffect(() => () => window.clearTimeout(U.current), []), Qe();
142
+ const I = o.useCallback((i) => ue.current === H.current?.side && Lt(i, H.current?.area), []);
143
+ return /* @__PURE__ */ s(
144
+ _t,
145
+ {
146
+ scope: t,
147
+ searchRef: B,
148
+ onItemEnter: o.useCallback(
149
+ (i) => {
150
+ I(i) && i.preventDefault();
151
+ },
152
+ [I]
153
+ ),
154
+ onItemLeave: o.useCallback(
155
+ (i) => {
156
+ I(i) || (G.current?.focus(), se(null));
157
+ },
158
+ [I]
159
+ ),
160
+ onTriggerLeave: o.useCallback(
161
+ (i) => {
162
+ I(i) && i.preventDefault();
163
+ },
164
+ [I]
165
+ ),
166
+ pointerGraceTimerRef: Xe,
167
+ onPointerGraceIntentChange: o.useCallback((i) => {
168
+ H.current = i;
169
+ }, []),
170
+ children: /* @__PURE__ */ s(je, { ...He, children: /* @__PURE__ */ s(
171
+ et,
172
+ {
173
+ asChild: !0,
174
+ trapped: u,
175
+ onMountAutoFocus: v(c, (i) => {
176
+ i.preventDefault(), G.current?.focus({ preventScroll: !0 });
177
+ }),
178
+ onUnmountAutoFocus: d,
179
+ children: /* @__PURE__ */ s(
180
+ Je,
181
+ {
182
+ asChild: !0,
183
+ disableOutsidePointerEvents: m,
184
+ onEscapeKeyDown: p,
185
+ onPointerDownOutside: l,
186
+ onFocusOutside: a,
187
+ onInteractOutside: f,
188
+ onDismiss: g,
189
+ children: /* @__PURE__ */ s(
190
+ at,
191
+ {
192
+ asChild: !0,
193
+ ...Be,
194
+ dir: w.dir,
195
+ orientation: "vertical",
196
+ loop: r,
197
+ currentTabStopId: Ve,
198
+ onCurrentTabStopIdChange: se,
199
+ onEntryFocus: v(h, (i) => {
200
+ w.isUsingKeyboardRef.current || i.preventDefault();
201
+ }),
202
+ preventScrollOnEntryFocus: !0,
203
+ children: /* @__PURE__ */ s(
204
+ nt,
205
+ {
206
+ role: "menu",
207
+ "aria-orientation": "vertical",
208
+ "data-state": Ge(x.open),
209
+ "data-radix-menu-content": "",
210
+ dir: w.dir,
211
+ ...Ue,
212
+ ...E,
213
+ ref: Ye,
214
+ style: { outline: "none", ...E.style },
215
+ onKeyDown: v(E.onKeyDown, (i) => {
216
+ const S = i.target.closest("[data-radix-menu-content]") === i.currentTarget, b = i.ctrlKey || i.altKey || i.metaKey, z = i.key.length === 1;
217
+ S && (i.key === "Tab" && i.preventDefault(), !b && z && We(i.key));
218
+ const Z = G.current;
219
+ if (i.target !== Z || !ft.includes(i.key)) return;
220
+ i.preventDefault();
221
+ const T = ae().filter((C) => !C.disabled).map((C) => C.ref.current);
222
+ Me.includes(i.key) && T.reverse(), kt(T);
223
+ }),
224
+ onBlur: v(e.onBlur, (i) => {
225
+ i.currentTarget.contains(i.target) || (window.clearTimeout(U.current), B.current = "");
226
+ }),
227
+ onPointerMove: v(
228
+ e.onPointerMove,
229
+ k((i) => {
230
+ const y = i.target, S = W.current !== i.clientX;
231
+ if (i.currentTarget.contains(y) && S) {
232
+ const b = i.clientX > W.current ? "right" : "left";
233
+ ue.current = b, W.current = i.clientX;
234
+ }
235
+ })
236
+ )
237
+ }
238
+ )
239
+ }
240
+ )
241
+ }
242
+ )
243
+ }
244
+ ) })
245
+ }
246
+ );
247
+ }
248
+ );
249
+ Se.displayName = _;
250
+ var Et = "MenuGroup", ne = o.forwardRef(
251
+ (e, n) => {
252
+ const { __scopeMenu: t, ...r } = e;
253
+ return /* @__PURE__ */ s(N.div, { role: "group", ...r, ref: n });
254
+ }
255
+ );
256
+ ne.displayName = Et;
257
+ var wt = "MenuLabel", Pe = o.forwardRef(
258
+ (e, n) => {
259
+ const { __scopeMenu: t, ...r } = e;
260
+ return /* @__PURE__ */ s(N.div, { ...r, ref: n });
261
+ }
262
+ );
263
+ Pe.displayName = wt;
264
+ var V = "MenuItem", fe = "menu.itemSelect", j = o.forwardRef(
265
+ (e, n) => {
266
+ const { disabled: t = !1, onSelect: r, ...u } = e, c = o.useRef(null), d = K(V, e.__scopeMenu), m = ee(V, e.__scopeMenu), h = D(n, c), p = o.useRef(!1), l = () => {
267
+ const a = c.current;
268
+ if (!t && a) {
269
+ const f = new CustomEvent(fe, { bubbles: !0, cancelable: !0 });
270
+ a.addEventListener(fe, (g) => r?.(g), { once: !0 }), ct(a, f), f.defaultPrevented ? p.current = !1 : d.onClose();
271
+ }
272
+ };
273
+ return /* @__PURE__ */ s(
274
+ Ee,
275
+ {
276
+ ...u,
277
+ ref: h,
278
+ disabled: t,
279
+ onClick: v(e.onClick, l),
280
+ onPointerDown: (a) => {
281
+ e.onPointerDown?.(a), p.current = !0;
282
+ },
283
+ onPointerUp: v(e.onPointerUp, (a) => {
284
+ p.current || a.currentTarget?.click();
285
+ }),
286
+ onKeyDown: v(e.onKeyDown, (a) => {
287
+ const f = m.searchRef.current !== "";
288
+ t || f && a.key === " " || $.includes(a.key) && (a.currentTarget.click(), a.preventDefault());
289
+ })
290
+ }
291
+ );
292
+ }
293
+ );
294
+ j.displayName = V;
295
+ var Ee = o.forwardRef(
296
+ (e, n) => {
297
+ const { __scopeMenu: t, disabled: r = !1, textValue: u, ...c } = e, d = ee(V, t), m = ve(t), h = o.useRef(null), p = D(n, h), [l, a] = o.useState(!1), [f, g] = o.useState("");
298
+ return o.useEffect(() => {
299
+ const M = h.current;
300
+ M && g((M.textContent ?? "").trim());
301
+ }, [c.children]), /* @__PURE__ */ s(
302
+ O.ItemSlot,
303
+ {
304
+ scope: t,
305
+ disabled: r,
306
+ textValue: u ?? f,
307
+ children: /* @__PURE__ */ s(st, { asChild: !0, ...m, focusable: !r, children: /* @__PURE__ */ s(
308
+ N.div,
309
+ {
310
+ role: "menuitem",
311
+ "data-highlighted": l ? "" : void 0,
312
+ "aria-disabled": r || void 0,
313
+ "data-disabled": r ? "" : void 0,
314
+ ...c,
315
+ ref: p,
316
+ onPointerMove: v(
317
+ e.onPointerMove,
318
+ k((M) => {
319
+ r ? d.onItemLeave(M) : (d.onItemEnter(M), M.defaultPrevented || M.currentTarget.focus({ preventScroll: !0 }));
320
+ })
321
+ ),
322
+ onPointerLeave: v(
323
+ e.onPointerLeave,
324
+ k((M) => d.onItemLeave(M))
325
+ ),
326
+ onFocus: v(e.onFocus, () => a(!0)),
327
+ onBlur: v(e.onBlur, () => a(!1))
328
+ }
329
+ ) })
330
+ }
331
+ );
332
+ }
333
+ ), It = "MenuCheckboxItem", we = o.forwardRef(
334
+ (e, n) => {
335
+ const { checked: t = !1, onCheckedChange: r, ...u } = e;
336
+ return /* @__PURE__ */ s(Te, { scope: e.__scopeMenu, checked: t, children: /* @__PURE__ */ s(
337
+ j,
338
+ {
339
+ role: "menuitemcheckbox",
340
+ "aria-checked": Y(t) ? "mixed" : t,
341
+ ...u,
342
+ ref: n,
343
+ "data-state": ce(t),
344
+ onSelect: v(
345
+ u.onSelect,
346
+ () => r?.(Y(t) ? !0 : !t),
347
+ { checkForDefaultPrevented: !1 }
348
+ )
349
+ }
350
+ ) });
351
+ }
352
+ );
353
+ we.displayName = It;
354
+ var Ie = "MenuRadioGroup", [yt, xt] = P(
355
+ Ie,
356
+ { value: void 0, onValueChange: () => {
357
+ } }
358
+ ), ye = o.forwardRef(
359
+ (e, n) => {
360
+ const { value: t, onValueChange: r, ...u } = e, c = q(r);
361
+ return /* @__PURE__ */ s(yt, { scope: e.__scopeMenu, value: t, onValueChange: c, children: /* @__PURE__ */ s(ne, { ...u, ref: n }) });
362
+ }
363
+ );
364
+ ye.displayName = Ie;
365
+ var xe = "MenuRadioItem", be = o.forwardRef(
366
+ (e, n) => {
367
+ const { value: t, ...r } = e, u = xt(xe, e.__scopeMenu), c = t === u.value;
368
+ return /* @__PURE__ */ s(Te, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ s(
369
+ j,
370
+ {
371
+ role: "menuitemradio",
372
+ "aria-checked": c,
373
+ ...r,
374
+ ref: n,
375
+ "data-state": ce(c),
376
+ onSelect: v(
377
+ r.onSelect,
378
+ () => u.onValueChange?.(t),
379
+ { checkForDefaultPrevented: !1 }
380
+ )
381
+ }
382
+ ) });
383
+ }
384
+ );
385
+ be.displayName = xe;
386
+ var oe = "MenuItemIndicator", [Te, bt] = P(
387
+ oe,
388
+ { checked: !1 }
389
+ ), Ae = o.forwardRef(
390
+ (e, n) => {
391
+ const { __scopeMenu: t, forceMount: r, ...u } = e, c = bt(oe, t);
392
+ return /* @__PURE__ */ s(
393
+ X,
394
+ {
395
+ present: r || Y(c.checked) || c.checked === !0,
396
+ children: /* @__PURE__ */ s(
397
+ N.span,
398
+ {
399
+ ...u,
400
+ ref: n,
401
+ "data-state": ce(c.checked)
402
+ }
403
+ )
404
+ }
405
+ );
406
+ }
407
+ );
408
+ Ae.displayName = oe;
409
+ var Tt = "MenuSeparator", Oe = o.forwardRef(
410
+ (e, n) => {
411
+ const { __scopeMenu: t, ...r } = e;
412
+ return /* @__PURE__ */ s(
413
+ N.div,
414
+ {
415
+ role: "separator",
416
+ "aria-orientation": "horizontal",
417
+ ...r,
418
+ ref: n
419
+ }
420
+ );
421
+ }
422
+ );
423
+ Oe.displayName = Tt;
424
+ var At = "MenuArrow", ke = o.forwardRef(
425
+ (e, n) => {
426
+ const { __scopeMenu: t, ...r } = e, u = L(t);
427
+ return /* @__PURE__ */ s(ot, { ...u, ...r, ref: n });
428
+ }
429
+ );
430
+ ke.displayName = At;
431
+ var re = "MenuSub", [Ot, De] = P(re), Ne = (e) => {
432
+ const { __scopeMenu: n, children: t, open: r = !1, onOpenChange: u } = e, c = R(re, n), d = L(n), [m, h] = o.useState(null), [p, l] = o.useState(null), a = q(u);
433
+ return o.useEffect(() => (c.open === !1 && a(!1), () => a(!1)), [c.open, a]), /* @__PURE__ */ s(me, { ...d, children: /* @__PURE__ */ s(
434
+ Ce,
435
+ {
436
+ scope: n,
437
+ open: r,
438
+ onOpenChange: a,
439
+ content: p,
440
+ onContentChange: l,
441
+ children: /* @__PURE__ */ s(
442
+ Ot,
443
+ {
444
+ scope: n,
445
+ contentId: de(),
446
+ triggerId: de(),
447
+ trigger: m,
448
+ onTriggerChange: h,
449
+ children: t
450
+ }
451
+ )
452
+ }
453
+ ) });
454
+ };
455
+ Ne.displayName = re;
456
+ var A = "MenuSubTrigger", Fe = o.forwardRef(
457
+ (e, n) => {
458
+ const t = R(A, e.__scopeMenu), r = K(A, e.__scopeMenu), u = De(A, e.__scopeMenu), c = ee(A, e.__scopeMenu), d = o.useRef(null), { pointerGraceTimerRef: m, onPointerGraceIntentChange: h } = c, p = { __scopeMenu: e.__scopeMenu }, l = o.useCallback(() => {
459
+ d.current && window.clearTimeout(d.current), d.current = null;
460
+ }, []);
461
+ return o.useEffect(() => l, [l]), o.useEffect(() => {
462
+ const a = m.current;
463
+ return () => {
464
+ window.clearTimeout(a), h(null);
465
+ };
466
+ }, [m, h]), /* @__PURE__ */ s(J, { asChild: !0, ...p, children: /* @__PURE__ */ s(
467
+ Ee,
468
+ {
469
+ id: u.triggerId,
470
+ "aria-haspopup": "menu",
471
+ "aria-expanded": t.open,
472
+ "aria-controls": u.contentId,
473
+ "data-state": Ge(t.open),
474
+ ...e,
475
+ ref: Ze(n, u.onTriggerChange),
476
+ onClick: (a) => {
477
+ e.onClick?.(a), !(e.disabled || a.defaultPrevented) && (a.currentTarget.focus(), t.open || t.onOpenChange(!0));
478
+ },
479
+ onPointerMove: v(
480
+ e.onPointerMove,
481
+ k((a) => {
482
+ c.onItemEnter(a), !a.defaultPrevented && !e.disabled && !t.open && !d.current && (c.onPointerGraceIntentChange(null), d.current = window.setTimeout(() => {
483
+ t.onOpenChange(!0), l();
484
+ }, 100));
485
+ })
486
+ ),
487
+ onPointerLeave: v(
488
+ e.onPointerLeave,
489
+ k((a) => {
490
+ l();
491
+ const f = t.content?.getBoundingClientRect();
492
+ if (f) {
493
+ const g = t.content?.dataset.side, M = g === "right", E = M ? -5 : 5, x = f[M ? "left" : "right"], w = f[M ? "right" : "left"];
494
+ c.onPointerGraceIntentChange({
495
+ area: [
496
+ // Apply a bleed on clientX to ensure that our exit point is
497
+ // consistently within polygon bounds
498
+ { x: a.clientX + E, y: a.clientY },
499
+ { x, y: f.top },
500
+ { x: w, y: f.top },
501
+ { x: w, y: f.bottom },
502
+ { x, y: f.bottom }
503
+ ],
504
+ side: g
505
+ }), window.clearTimeout(m.current), m.current = window.setTimeout(
506
+ () => c.onPointerGraceIntentChange(null),
507
+ 300
508
+ );
509
+ } else {
510
+ if (c.onTriggerLeave(a), a.defaultPrevented) return;
511
+ c.onPointerGraceIntentChange(null);
512
+ }
513
+ })
514
+ ),
515
+ onKeyDown: v(e.onKeyDown, (a) => {
516
+ const f = c.searchRef.current !== "";
517
+ e.disabled || f && a.key === " " || pt[r.dir].includes(a.key) && (t.onOpenChange(!0), t.content?.focus(), a.preventDefault());
518
+ })
519
+ }
520
+ ) });
521
+ }
522
+ );
523
+ Fe.displayName = A;
524
+ var Le = "MenuSubContent", Ke = o.forwardRef(
525
+ (e, n) => {
526
+ const t = _e(_, e.__scopeMenu), { forceMount: r = t.forceMount, ...u } = e, c = R(_, e.__scopeMenu), d = K(_, e.__scopeMenu), m = De(Le, e.__scopeMenu), h = o.useRef(null), p = D(n, h);
527
+ return /* @__PURE__ */ s(O.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(X, { present: r || c.open, children: /* @__PURE__ */ s(O.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(
528
+ te,
529
+ {
530
+ id: m.contentId,
531
+ "aria-labelledby": m.triggerId,
532
+ ...u,
533
+ ref: p,
534
+ align: "start",
535
+ side: d.dir === "rtl" ? "left" : "right",
536
+ disableOutsidePointerEvents: !1,
537
+ disableOutsideScroll: !1,
538
+ trapFocus: !1,
539
+ onOpenAutoFocus: (l) => {
540
+ d.isUsingKeyboardRef.current && h.current?.focus(), l.preventDefault();
541
+ },
542
+ onCloseAutoFocus: (l) => l.preventDefault(),
543
+ onFocusOutside: v(e.onFocusOutside, (l) => {
544
+ l.target !== m.trigger && c.onOpenChange(!1);
545
+ }),
546
+ onEscapeKeyDown: v(e.onEscapeKeyDown, (l) => {
547
+ d.onClose(), l.preventDefault();
548
+ }),
549
+ onKeyDown: v(e.onKeyDown, (l) => {
550
+ const a = l.currentTarget.contains(l.target), f = mt[d.dir].includes(l.key);
551
+ a && f && (c.onOpenChange(!1), m.trigger?.focus(), l.preventDefault());
552
+ })
553
+ }
554
+ ) }) }) });
555
+ }
556
+ );
557
+ Ke.displayName = Le;
558
+ function Ge(e) {
559
+ return e ? "open" : "closed";
560
+ }
561
+ function Y(e) {
562
+ return e === "indeterminate";
563
+ }
564
+ function ce(e) {
565
+ return Y(e) ? "indeterminate" : e ? "checked" : "unchecked";
566
+ }
567
+ function kt(e) {
568
+ const n = document.activeElement;
569
+ for (const t of e)
570
+ if (t === n || (t.focus(), document.activeElement !== n)) return;
571
+ }
572
+ function Dt(e, n) {
573
+ return e.map((t, r) => e[(n + r) % e.length]);
574
+ }
575
+ function Nt(e, n, t) {
576
+ const u = n.length > 1 && Array.from(n).every((p) => p === n[0]) ? n[0] : n, c = t ? e.indexOf(t) : -1;
577
+ let d = Dt(e, Math.max(c, 0));
578
+ u.length === 1 && (d = d.filter((p) => p !== t));
579
+ const h = d.find(
580
+ (p) => p.toLowerCase().startsWith(u.toLowerCase())
581
+ );
582
+ return h !== t ? h : void 0;
583
+ }
584
+ function Ft(e, n) {
585
+ const { x: t, y: r } = e;
586
+ let u = !1;
587
+ for (let c = 0, d = n.length - 1; c < n.length; d = c++) {
588
+ const m = n[c], h = n[d], p = m.x, l = m.y, a = h.x, f = h.y;
589
+ l > r != f > r && t < (a - p) * (r - l) / (f - l) + p && (u = !u);
590
+ }
591
+ return u;
592
+ }
593
+ function Lt(e, n) {
594
+ if (!n) return !1;
595
+ const t = { x: e.clientX, y: e.clientY };
596
+ return Ft(t, n);
597
+ }
598
+ function k(e) {
599
+ return (n) => n.pointerType === "mouse" ? e(n) : void 0;
600
+ }
601
+ var rn = ge, cn = J, an = Re, sn = Se, un = ne, ln = Pe, dn = j, fn = we, pn = ye, mn = be, hn = Ae, Mn = Oe, vn = ke, Cn = Ne, gn = Fe, _n = Ke;
602
+ export {
603
+ cn as Anchor,
604
+ vn as Arrow,
605
+ fn as CheckboxItem,
606
+ sn as Content,
607
+ un as Group,
608
+ dn as Item,
609
+ hn as ItemIndicator,
610
+ ln as Label,
611
+ ge as Menu,
612
+ J as MenuAnchor,
613
+ ke as MenuArrow,
614
+ we as MenuCheckboxItem,
615
+ Se as MenuContent,
616
+ ne as MenuGroup,
617
+ j as MenuItem,
618
+ Ae as MenuItemIndicator,
619
+ Pe as MenuLabel,
620
+ Re as MenuPortal,
621
+ ye as MenuRadioGroup,
622
+ be as MenuRadioItem,
623
+ Oe as MenuSeparator,
624
+ Ne as MenuSub,
625
+ Ke as MenuSubContent,
626
+ Fe as MenuSubTrigger,
627
+ an as Portal,
628
+ pn as RadioGroup,
629
+ mn as RadioItem,
630
+ rn as Root,
631
+ Mn as Separator,
632
+ Cn as Sub,
633
+ _n as SubContent,
634
+ gn as SubTrigger,
635
+ on as createMenuScope
636
+ };