laif-ds 0.1.30 → 0.1.31

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