@cfx-dev/ui-components 4.3.10 → 4.3.11

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.
@@ -0,0 +1,984 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import gn from "react";
4
+ import { c as me, P as N, e as w, u as z, d as Se, g as vn, b as Mn, h as xe } from "./index-DCuJlMqr.js";
5
+ import { c as ye, u as Pe } from "./index-BMU9X4M-.js";
6
+ import { u as le, a as _e, c as Te, h as hn, b as Cn, R as Rn, F as In, D as Dn, C as bn, d as En, A as Sn, e as xn } from "./Combination-2dfXEDc9.js";
7
+ import { P as we } from "./index-DWzyrn_L.js";
8
+ import { clsx as Ae } from "./utils/clsx.js";
9
+ import { ui as Ne } from "./utils/ui/ui.js";
10
+ var de = "rovingFocusGroup.onEntryFocus", yn = { bubbles: !1, cancelable: !0 }, j = "RovingFocusGroup", [fe, Oe, Pn] = ye(j), [Tn, Fe] = me(
11
+ j,
12
+ [Pn]
13
+ ), [An, Nn] = Tn(j), ke = a.forwardRef(
14
+ (e, o) => /* @__PURE__ */ s(fe.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(fe.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(On, { ...e, ref: o }) }) })
15
+ );
16
+ ke.displayName = j;
17
+ var On = a.forwardRef((e, o) => {
18
+ const {
19
+ __scopeRovingFocusGroup: n,
20
+ orientation: t,
21
+ loop: r = !1,
22
+ dir: c,
23
+ currentTabStopId: u,
24
+ defaultCurrentTabStopId: l,
25
+ onCurrentTabStopIdChange: _,
26
+ onEntryFocus: m,
27
+ preventScrollOnEntryFocus: d = !1,
28
+ ...i
29
+ } = e, f = a.useRef(null), v = z(o, f), g = Pe(c), [D, M] = Se({
30
+ prop: u,
31
+ defaultProp: l ?? null,
32
+ onChange: _,
33
+ caller: j
34
+ }), [R, T] = a.useState(!1), h = _e(m), S = Oe(n), $ = a.useRef(!1), [J, O] = a.useState(0);
35
+ return a.useEffect(() => {
36
+ const C = f.current;
37
+ if (C)
38
+ return C.addEventListener(de, h), () => C.removeEventListener(de, h);
39
+ }, [h]), /* @__PURE__ */ s(
40
+ An,
41
+ {
42
+ scope: n,
43
+ orientation: t,
44
+ dir: g,
45
+ loop: r,
46
+ currentTabStopId: D,
47
+ onItemFocus: a.useCallback(
48
+ (C) => M(C),
49
+ [M]
50
+ ),
51
+ onItemShiftTab: a.useCallback(() => T(!0), []),
52
+ onFocusableItemAdd: a.useCallback(
53
+ () => O((C) => C + 1),
54
+ []
55
+ ),
56
+ onFocusableItemRemove: a.useCallback(
57
+ () => O((C) => C - 1),
58
+ []
59
+ ),
60
+ children: /* @__PURE__ */ s(
61
+ N.div,
62
+ {
63
+ tabIndex: R || J === 0 ? -1 : 0,
64
+ "data-orientation": t,
65
+ ...i,
66
+ ref: v,
67
+ style: { outline: "none", ...e.style },
68
+ onMouseDown: w(e.onMouseDown, () => {
69
+ $.current = !0;
70
+ }),
71
+ onFocus: w(e.onFocus, (C) => {
72
+ const G = !$.current;
73
+ if (C.target === C.currentTarget && G && !R) {
74
+ const F = new CustomEvent(de, yn);
75
+ if (C.currentTarget.dispatchEvent(F), !F.defaultPrevented) {
76
+ const B = S().filter((y) => y.focusable), V = B.find((y) => y.active), Q = B.find((y) => y.id === D), se = [V, Q, ...B].filter(
77
+ Boolean
78
+ ).map((y) => y.ref.current);
79
+ Ke(se, d);
80
+ }
81
+ }
82
+ $.current = !1;
83
+ }),
84
+ onBlur: w(e.onBlur, () => T(!1))
85
+ }
86
+ )
87
+ }
88
+ );
89
+ }), Ge = "RovingFocusGroupItem", Le = a.forwardRef(
90
+ (e, o) => {
91
+ const {
92
+ __scopeRovingFocusGroup: n,
93
+ focusable: t = !0,
94
+ active: r = !1,
95
+ tabStopId: c,
96
+ children: u,
97
+ ...l
98
+ } = e, _ = le(), m = c || _, d = Nn(Ge, n), i = d.currentTabStopId === m, f = Oe(n), { onFocusableItemAdd: v, onFocusableItemRemove: g, currentTabStopId: D } = d;
99
+ return a.useEffect(() => {
100
+ if (t)
101
+ return v(), () => g();
102
+ }, [t, v, g]), /* @__PURE__ */ s(
103
+ fe.ItemSlot,
104
+ {
105
+ scope: n,
106
+ id: m,
107
+ focusable: t,
108
+ active: r,
109
+ children: /* @__PURE__ */ s(
110
+ N.span,
111
+ {
112
+ tabIndex: i ? 0 : -1,
113
+ "data-orientation": d.orientation,
114
+ ...l,
115
+ ref: o,
116
+ onMouseDown: w(e.onMouseDown, (M) => {
117
+ t ? d.onItemFocus(m) : M.preventDefault();
118
+ }),
119
+ onFocus: w(e.onFocus, () => d.onItemFocus(m)),
120
+ onKeyDown: w(e.onKeyDown, (M) => {
121
+ if (M.key === "Tab" && M.shiftKey) {
122
+ d.onItemShiftTab();
123
+ return;
124
+ }
125
+ if (M.target !== M.currentTarget) return;
126
+ const R = Gn(M, d.orientation, d.dir);
127
+ if (R !== void 0) {
128
+ if (M.metaKey || M.ctrlKey || M.altKey || M.shiftKey) return;
129
+ M.preventDefault();
130
+ let h = f().filter((S) => S.focusable).map((S) => S.ref.current);
131
+ if (R === "last") h.reverse();
132
+ else if (R === "prev" || R === "next") {
133
+ R === "prev" && h.reverse();
134
+ const S = h.indexOf(M.currentTarget);
135
+ h = d.loop ? Ln(h, S + 1) : h.slice(S + 1);
136
+ }
137
+ setTimeout(() => Ke(h));
138
+ }
139
+ }),
140
+ children: typeof u == "function" ? u({ isCurrentTabStop: i, hasTabStop: D != null }) : u
141
+ }
142
+ )
143
+ }
144
+ );
145
+ }
146
+ );
147
+ Le.displayName = Ge;
148
+ var Fn = {
149
+ ArrowLeft: "prev",
150
+ ArrowUp: "prev",
151
+ ArrowRight: "next",
152
+ ArrowDown: "next",
153
+ PageUp: "first",
154
+ Home: "first",
155
+ PageDown: "last",
156
+ End: "last"
157
+ };
158
+ function kn(e, o) {
159
+ return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
160
+ }
161
+ function Gn(e, o, n) {
162
+ const t = kn(e.key, n);
163
+ if (!(o === "vertical" && ["ArrowLeft", "ArrowRight"].includes(t)) && !(o === "horizontal" && ["ArrowUp", "ArrowDown"].includes(t)))
164
+ return Fn[t];
165
+ }
166
+ function Ke(e, o = !1) {
167
+ const n = document.activeElement;
168
+ for (const t of e)
169
+ if (t === n || (t.focus({ preventScroll: o }), document.activeElement !== n)) return;
170
+ }
171
+ function Ln(e, o) {
172
+ return e.map((n, t) => e[(o + t) % e.length]);
173
+ }
174
+ var Kn = ke, zn = Le, pe = ["Enter", " "], Un = ["ArrowDown", "PageUp", "Home"], ze = ["ArrowUp", "PageDown", "End"], $n = [...Un, ...ze], Bn = {
175
+ ltr: [...pe, "ArrowRight"],
176
+ rtl: [...pe, "ArrowLeft"]
177
+ }, Vn = {
178
+ ltr: ["ArrowLeft"],
179
+ rtl: ["ArrowRight"]
180
+ }, Z = "Menu", [X, Wn, Yn] = ye(Z), [k, Ue] = me(Z, [
181
+ Yn,
182
+ Te,
183
+ Fe
184
+ ]), re = Te(), $e = Fe(), [Xn, U] = k(Z), [Hn, q] = k(Z), Be = (e) => {
185
+ const { __scopeMenu: o, open: n = !1, children: t, dir: r, onOpenChange: c, modal: u = !0 } = e, l = re(o), [_, m] = a.useState(null), d = a.useRef(!1), i = _e(c), f = Pe(r);
186
+ return a.useEffect(() => {
187
+ const v = () => {
188
+ d.current = !0, document.addEventListener("pointerdown", g, { capture: !0, once: !0 }), document.addEventListener("pointermove", g, { capture: !0, once: !0 });
189
+ }, g = () => d.current = !1;
190
+ return document.addEventListener("keydown", v, { capture: !0 }), () => {
191
+ document.removeEventListener("keydown", v, { capture: !0 }), document.removeEventListener("pointerdown", g, { capture: !0 }), document.removeEventListener("pointermove", g, { capture: !0 });
192
+ };
193
+ }, []), /* @__PURE__ */ s(En, { ...l, children: /* @__PURE__ */ s(
194
+ Xn,
195
+ {
196
+ scope: o,
197
+ open: n,
198
+ onOpenChange: i,
199
+ content: _,
200
+ onContentChange: m,
201
+ children: /* @__PURE__ */ s(
202
+ Hn,
203
+ {
204
+ scope: o,
205
+ onClose: a.useCallback(() => i(!1), [i]),
206
+ isUsingKeyboardRef: d,
207
+ dir: f,
208
+ modal: u,
209
+ children: t
210
+ }
211
+ )
212
+ }
213
+ ) });
214
+ };
215
+ Be.displayName = Z;
216
+ var jn = "MenuAnchor", ge = a.forwardRef(
217
+ (e, o) => {
218
+ const { __scopeMenu: n, ...t } = e, r = re(n);
219
+ return /* @__PURE__ */ s(Sn, { ...r, ...t, ref: o });
220
+ }
221
+ );
222
+ ge.displayName = jn;
223
+ var Zn = "MenuPortal", [gt, Ve] = k(Zn, {
224
+ forceMount: void 0
225
+ }), E = "MenuContent", [qn, ve] = k(E), We = a.forwardRef(
226
+ (e, o) => {
227
+ const n = Ve(E, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = U(E, e.__scopeMenu), u = q(E, e.__scopeMenu);
228
+ return /* @__PURE__ */ s(X.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(we, { present: t || c.open, children: /* @__PURE__ */ s(X.Slot, { scope: e.__scopeMenu, children: u.modal ? /* @__PURE__ */ s(Jn, { ...r, ref: o }) : /* @__PURE__ */ s(Qn, { ...r, ref: o }) }) }) });
229
+ }
230
+ ), Jn = a.forwardRef(
231
+ (e, o) => {
232
+ const n = U(E, e.__scopeMenu), t = a.useRef(null), r = z(o, t);
233
+ return a.useEffect(() => {
234
+ const c = t.current;
235
+ if (c) return hn(c);
236
+ }, []), /* @__PURE__ */ s(
237
+ Me,
238
+ {
239
+ ...e,
240
+ ref: r,
241
+ trapFocus: n.open,
242
+ disableOutsidePointerEvents: n.open,
243
+ disableOutsideScroll: !0,
244
+ onFocusOutside: w(
245
+ e.onFocusOutside,
246
+ (c) => c.preventDefault(),
247
+ { checkForDefaultPrevented: !1 }
248
+ ),
249
+ onDismiss: () => n.onOpenChange(!1)
250
+ }
251
+ );
252
+ }
253
+ ), Qn = a.forwardRef((e, o) => {
254
+ const n = U(E, e.__scopeMenu);
255
+ return /* @__PURE__ */ s(
256
+ Me,
257
+ {
258
+ ...e,
259
+ ref: o,
260
+ trapFocus: !1,
261
+ disableOutsidePointerEvents: !1,
262
+ disableOutsideScroll: !1,
263
+ onDismiss: () => n.onOpenChange(!1)
264
+ }
265
+ );
266
+ }), eo = Mn("MenuContent.ScrollLock"), Me = a.forwardRef(
267
+ (e, o) => {
268
+ const {
269
+ __scopeMenu: n,
270
+ loop: t = !1,
271
+ trapFocus: r,
272
+ onOpenAutoFocus: c,
273
+ onCloseAutoFocus: u,
274
+ disableOutsidePointerEvents: l,
275
+ onEntryFocus: _,
276
+ onEscapeKeyDown: m,
277
+ onPointerDownOutside: d,
278
+ onFocusOutside: i,
279
+ onInteractOutside: f,
280
+ onDismiss: v,
281
+ disableOutsideScroll: g,
282
+ ...D
283
+ } = e, M = U(E, n), R = q(E, n), T = re(n), h = $e(n), S = Wn(n), [$, J] = a.useState(null), O = a.useRef(null), C = z(o, O, M.onContentChange), G = a.useRef(0), F = a.useRef(""), B = a.useRef(0), V = a.useRef(null), Q = a.useRef("right"), ee = a.useRef(0), se = g ? Rn : a.Fragment, y = g ? { as: eo, allowPinchZoom: !0 } : void 0, wn = (p) => {
284
+ var K, De;
285
+ const b = F.current + p, x = S().filter((P) => !P.disabled), A = document.activeElement, ie = (K = x.find((P) => P.ref.current === A)) == null ? void 0 : K.textValue, ue = x.map((P) => P.textValue), Ie = po(ue, b, ie), W = (De = x.find((P) => P.textValue === Ie)) == null ? void 0 : De.ref.current;
286
+ (function P(be) {
287
+ F.current = be, window.clearTimeout(G.current), be !== "" && (G.current = window.setTimeout(() => P(""), 1e3));
288
+ })(b), W && setTimeout(() => W.focus());
289
+ };
290
+ a.useEffect(() => () => window.clearTimeout(G.current), []), Cn();
291
+ const L = a.useCallback((p) => {
292
+ var x, A;
293
+ return Q.current === ((x = V.current) == null ? void 0 : x.side) && _o(p, (A = V.current) == null ? void 0 : A.area);
294
+ }, []);
295
+ return /* @__PURE__ */ s(
296
+ qn,
297
+ {
298
+ scope: n,
299
+ searchRef: F,
300
+ onItemEnter: a.useCallback(
301
+ (p) => {
302
+ L(p) && p.preventDefault();
303
+ },
304
+ [L]
305
+ ),
306
+ onItemLeave: a.useCallback(
307
+ (p) => {
308
+ var b;
309
+ L(p) || ((b = O.current) == null || b.focus(), J(null));
310
+ },
311
+ [L]
312
+ ),
313
+ onTriggerLeave: a.useCallback(
314
+ (p) => {
315
+ L(p) && p.preventDefault();
316
+ },
317
+ [L]
318
+ ),
319
+ pointerGraceTimerRef: B,
320
+ onPointerGraceIntentChange: a.useCallback((p) => {
321
+ V.current = p;
322
+ }, []),
323
+ children: /* @__PURE__ */ s(se, { ...y, children: /* @__PURE__ */ s(
324
+ In,
325
+ {
326
+ asChild: !0,
327
+ trapped: r,
328
+ onMountAutoFocus: w(c, (p) => {
329
+ var b;
330
+ p.preventDefault(), (b = O.current) == null || b.focus({ preventScroll: !0 });
331
+ }),
332
+ onUnmountAutoFocus: u,
333
+ children: /* @__PURE__ */ s(
334
+ Dn,
335
+ {
336
+ asChild: !0,
337
+ disableOutsidePointerEvents: l,
338
+ onEscapeKeyDown: m,
339
+ onPointerDownOutside: d,
340
+ onFocusOutside: i,
341
+ onInteractOutside: f,
342
+ onDismiss: v,
343
+ children: /* @__PURE__ */ s(
344
+ Kn,
345
+ {
346
+ asChild: !0,
347
+ ...h,
348
+ dir: R.dir,
349
+ orientation: "vertical",
350
+ loop: t,
351
+ currentTabStopId: $,
352
+ onCurrentTabStopIdChange: J,
353
+ onEntryFocus: w(_, (p) => {
354
+ R.isUsingKeyboardRef.current || p.preventDefault();
355
+ }),
356
+ preventScrollOnEntryFocus: !0,
357
+ children: /* @__PURE__ */ s(
358
+ bn,
359
+ {
360
+ role: "menu",
361
+ "aria-orientation": "vertical",
362
+ "data-state": sn(M.open),
363
+ "data-radix-menu-content": "",
364
+ dir: R.dir,
365
+ ...T,
366
+ ...D,
367
+ ref: C,
368
+ style: { outline: "none", ...D.style },
369
+ onKeyDown: w(D.onKeyDown, (p) => {
370
+ const x = p.target.closest("[data-radix-menu-content]") === p.currentTarget, A = p.ctrlKey || p.altKey || p.metaKey, ie = p.key.length === 1;
371
+ x && (p.key === "Tab" && p.preventDefault(), !A && ie && wn(p.key));
372
+ const ue = O.current;
373
+ if (p.target !== ue || !$n.includes(p.key)) return;
374
+ p.preventDefault();
375
+ const W = S().filter((K) => !K.disabled).map((K) => K.ref.current);
376
+ ze.includes(p.key) && W.reverse(), lo(W);
377
+ }),
378
+ onBlur: w(e.onBlur, (p) => {
379
+ p.currentTarget.contains(p.target) || (window.clearTimeout(G.current), F.current = "");
380
+ }),
381
+ onPointerMove: w(
382
+ e.onPointerMove,
383
+ H((p) => {
384
+ const b = p.target, x = ee.current !== p.clientX;
385
+ if (p.currentTarget.contains(b) && x) {
386
+ const A = p.clientX > ee.current ? "right" : "left";
387
+ Q.current = A, ee.current = p.clientX;
388
+ }
389
+ })
390
+ )
391
+ }
392
+ )
393
+ }
394
+ )
395
+ }
396
+ )
397
+ }
398
+ ) })
399
+ }
400
+ );
401
+ }
402
+ );
403
+ We.displayName = E;
404
+ var no = "MenuGroup", he = a.forwardRef(
405
+ (e, o) => {
406
+ const { __scopeMenu: n, ...t } = e;
407
+ return /* @__PURE__ */ s(N.div, { role: "group", ...t, ref: o });
408
+ }
409
+ );
410
+ he.displayName = no;
411
+ var oo = "MenuLabel", Ye = a.forwardRef(
412
+ (e, o) => {
413
+ const { __scopeMenu: n, ...t } = e;
414
+ return /* @__PURE__ */ s(N.div, { ...t, ref: o });
415
+ }
416
+ );
417
+ Ye.displayName = oo;
418
+ var ne = "MenuItem", Ee = "menu.itemSelect", ae = a.forwardRef(
419
+ (e, o) => {
420
+ const { disabled: n = !1, onSelect: t, ...r } = e, c = a.useRef(null), u = q(ne, e.__scopeMenu), l = ve(ne, e.__scopeMenu), _ = z(o, c), m = a.useRef(!1), d = () => {
421
+ const i = c.current;
422
+ if (!n && i) {
423
+ const f = new CustomEvent(Ee, { bubbles: !0, cancelable: !0 });
424
+ i.addEventListener(Ee, (v) => t == null ? void 0 : t(v), { once: !0 }), vn(i, f), f.defaultPrevented ? m.current = !1 : u.onClose();
425
+ }
426
+ };
427
+ return /* @__PURE__ */ s(
428
+ Xe,
429
+ {
430
+ ...r,
431
+ ref: _,
432
+ disabled: n,
433
+ onClick: w(e.onClick, d),
434
+ onPointerDown: (i) => {
435
+ var f;
436
+ (f = e.onPointerDown) == null || f.call(e, i), m.current = !0;
437
+ },
438
+ onPointerUp: w(e.onPointerUp, (i) => {
439
+ var f;
440
+ m.current || (f = i.currentTarget) == null || f.click();
441
+ }),
442
+ onKeyDown: w(e.onKeyDown, (i) => {
443
+ const f = l.searchRef.current !== "";
444
+ n || f && i.key === " " || pe.includes(i.key) && (i.currentTarget.click(), i.preventDefault());
445
+ })
446
+ }
447
+ );
448
+ }
449
+ );
450
+ ae.displayName = ne;
451
+ var Xe = a.forwardRef(
452
+ (e, o) => {
453
+ const { __scopeMenu: n, disabled: t = !1, textValue: r, ...c } = e, u = ve(ne, n), l = $e(n), _ = a.useRef(null), m = z(o, _), [d, i] = a.useState(!1), [f, v] = a.useState("");
454
+ return a.useEffect(() => {
455
+ const g = _.current;
456
+ g && v((g.textContent ?? "").trim());
457
+ }, [c.children]), /* @__PURE__ */ s(
458
+ X.ItemSlot,
459
+ {
460
+ scope: n,
461
+ disabled: t,
462
+ textValue: r ?? f,
463
+ children: /* @__PURE__ */ s(zn, { asChild: !0, ...l, focusable: !t, children: /* @__PURE__ */ s(
464
+ N.div,
465
+ {
466
+ role: "menuitem",
467
+ "data-highlighted": d ? "" : void 0,
468
+ "aria-disabled": t || void 0,
469
+ "data-disabled": t ? "" : void 0,
470
+ ...c,
471
+ ref: m,
472
+ onPointerMove: w(
473
+ e.onPointerMove,
474
+ H((g) => {
475
+ t ? u.onItemLeave(g) : (u.onItemEnter(g), g.defaultPrevented || g.currentTarget.focus({ preventScroll: !0 }));
476
+ })
477
+ ),
478
+ onPointerLeave: w(
479
+ e.onPointerLeave,
480
+ H((g) => u.onItemLeave(g))
481
+ ),
482
+ onFocus: w(e.onFocus, () => i(!0)),
483
+ onBlur: w(e.onBlur, () => i(!1))
484
+ }
485
+ ) })
486
+ }
487
+ );
488
+ }
489
+ ), to = "MenuCheckboxItem", He = a.forwardRef(
490
+ (e, o) => {
491
+ const { checked: n = !1, onCheckedChange: t, ...r } = e;
492
+ return /* @__PURE__ */ s(Qe, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ s(
493
+ ae,
494
+ {
495
+ role: "menuitemcheckbox",
496
+ "aria-checked": oe(n) ? "mixed" : n,
497
+ ...r,
498
+ ref: o,
499
+ "data-state": Re(n),
500
+ onSelect: w(
501
+ r.onSelect,
502
+ () => t == null ? void 0 : t(oe(n) ? !0 : !n),
503
+ { checkForDefaultPrevented: !1 }
504
+ )
505
+ }
506
+ ) });
507
+ }
508
+ );
509
+ He.displayName = to;
510
+ var je = "MenuRadioGroup", [ro, ao] = k(
511
+ je,
512
+ { value: void 0, onValueChange: () => {
513
+ } }
514
+ ), Ze = a.forwardRef(
515
+ (e, o) => {
516
+ const { value: n, onValueChange: t, ...r } = e, c = _e(t);
517
+ return /* @__PURE__ */ s(ro, { scope: e.__scopeMenu, value: n, onValueChange: c, children: /* @__PURE__ */ s(he, { ...r, ref: o }) });
518
+ }
519
+ );
520
+ Ze.displayName = je;
521
+ var qe = "MenuRadioItem", Je = a.forwardRef(
522
+ (e, o) => {
523
+ const { value: n, ...t } = e, r = ao(qe, e.__scopeMenu), c = n === r.value;
524
+ return /* @__PURE__ */ s(Qe, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ s(
525
+ ae,
526
+ {
527
+ role: "menuitemradio",
528
+ "aria-checked": c,
529
+ ...t,
530
+ ref: o,
531
+ "data-state": Re(c),
532
+ onSelect: w(
533
+ t.onSelect,
534
+ () => {
535
+ var u;
536
+ return (u = r.onValueChange) == null ? void 0 : u.call(r, n);
537
+ },
538
+ { checkForDefaultPrevented: !1 }
539
+ )
540
+ }
541
+ ) });
542
+ }
543
+ );
544
+ Je.displayName = qe;
545
+ var Ce = "MenuItemIndicator", [Qe, co] = k(
546
+ Ce,
547
+ { checked: !1 }
548
+ ), en = a.forwardRef(
549
+ (e, o) => {
550
+ const { __scopeMenu: n, forceMount: t, ...r } = e, c = co(Ce, n);
551
+ return /* @__PURE__ */ s(
552
+ we,
553
+ {
554
+ present: t || oe(c.checked) || c.checked === !0,
555
+ children: /* @__PURE__ */ s(
556
+ N.span,
557
+ {
558
+ ...r,
559
+ ref: o,
560
+ "data-state": Re(c.checked)
561
+ }
562
+ )
563
+ }
564
+ );
565
+ }
566
+ );
567
+ en.displayName = Ce;
568
+ var so = "MenuSeparator", nn = a.forwardRef(
569
+ (e, o) => {
570
+ const { __scopeMenu: n, ...t } = e;
571
+ return /* @__PURE__ */ s(
572
+ N.div,
573
+ {
574
+ role: "separator",
575
+ "aria-orientation": "horizontal",
576
+ ...t,
577
+ ref: o
578
+ }
579
+ );
580
+ }
581
+ );
582
+ nn.displayName = so;
583
+ var io = "MenuArrow", on = a.forwardRef(
584
+ (e, o) => {
585
+ const { __scopeMenu: n, ...t } = e, r = re(n);
586
+ return /* @__PURE__ */ s(xn, { ...r, ...t, ref: o });
587
+ }
588
+ );
589
+ on.displayName = io;
590
+ var uo = "MenuSub", [vt, tn] = k(uo), Y = "MenuSubTrigger", rn = a.forwardRef(
591
+ (e, o) => {
592
+ const n = U(Y, e.__scopeMenu), t = q(Y, e.__scopeMenu), r = tn(Y, e.__scopeMenu), c = ve(Y, e.__scopeMenu), u = a.useRef(null), { pointerGraceTimerRef: l, onPointerGraceIntentChange: _ } = c, m = { __scopeMenu: e.__scopeMenu }, d = a.useCallback(() => {
593
+ u.current && window.clearTimeout(u.current), u.current = null;
594
+ }, []);
595
+ return a.useEffect(() => d, [d]), a.useEffect(() => {
596
+ const i = l.current;
597
+ return () => {
598
+ window.clearTimeout(i), _(null);
599
+ };
600
+ }, [l, _]), /* @__PURE__ */ s(ge, { asChild: !0, ...m, children: /* @__PURE__ */ s(
601
+ Xe,
602
+ {
603
+ id: r.triggerId,
604
+ "aria-haspopup": "menu",
605
+ "aria-expanded": n.open,
606
+ "aria-controls": r.contentId,
607
+ "data-state": sn(n.open),
608
+ ...e,
609
+ ref: xe(o, r.onTriggerChange),
610
+ onClick: (i) => {
611
+ var f;
612
+ (f = e.onClick) == null || f.call(e, i), !(e.disabled || i.defaultPrevented) && (i.currentTarget.focus(), n.open || n.onOpenChange(!0));
613
+ },
614
+ onPointerMove: w(
615
+ e.onPointerMove,
616
+ H((i) => {
617
+ c.onItemEnter(i), !i.defaultPrevented && !e.disabled && !n.open && !u.current && (c.onPointerGraceIntentChange(null), u.current = window.setTimeout(() => {
618
+ n.onOpenChange(!0), d();
619
+ }, 100));
620
+ })
621
+ ),
622
+ onPointerLeave: w(
623
+ e.onPointerLeave,
624
+ H((i) => {
625
+ var v, g;
626
+ d();
627
+ const f = (v = n.content) == null ? void 0 : v.getBoundingClientRect();
628
+ if (f) {
629
+ const D = (g = n.content) == null ? void 0 : g.dataset.side, M = D === "right", R = M ? -5 : 5, T = f[M ? "left" : "right"], h = f[M ? "right" : "left"];
630
+ c.onPointerGraceIntentChange({
631
+ area: [
632
+ // Apply a bleed on clientX to ensure that our exit point is
633
+ // consistently within polygon bounds
634
+ { x: i.clientX + R, y: i.clientY },
635
+ { x: T, y: f.top },
636
+ { x: h, y: f.top },
637
+ { x: h, y: f.bottom },
638
+ { x: T, y: f.bottom }
639
+ ],
640
+ side: D
641
+ }), window.clearTimeout(l.current), l.current = window.setTimeout(
642
+ () => c.onPointerGraceIntentChange(null),
643
+ 300
644
+ );
645
+ } else {
646
+ if (c.onTriggerLeave(i), i.defaultPrevented) return;
647
+ c.onPointerGraceIntentChange(null);
648
+ }
649
+ })
650
+ ),
651
+ onKeyDown: w(e.onKeyDown, (i) => {
652
+ var v;
653
+ const f = c.searchRef.current !== "";
654
+ e.disabled || f && i.key === " " || Bn[t.dir].includes(i.key) && (n.onOpenChange(!0), (v = n.content) == null || v.focus(), i.preventDefault());
655
+ })
656
+ }
657
+ ) });
658
+ }
659
+ );
660
+ rn.displayName = Y;
661
+ var an = "MenuSubContent", cn = a.forwardRef(
662
+ (e, o) => {
663
+ const n = Ve(E, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = U(E, e.__scopeMenu), u = q(E, e.__scopeMenu), l = tn(an, e.__scopeMenu), _ = a.useRef(null), m = z(o, _);
664
+ return /* @__PURE__ */ s(X.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(we, { present: t || c.open, children: /* @__PURE__ */ s(X.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(
665
+ Me,
666
+ {
667
+ id: l.contentId,
668
+ "aria-labelledby": l.triggerId,
669
+ ...r,
670
+ ref: m,
671
+ align: "start",
672
+ side: u.dir === "rtl" ? "left" : "right",
673
+ disableOutsidePointerEvents: !1,
674
+ disableOutsideScroll: !1,
675
+ trapFocus: !1,
676
+ onOpenAutoFocus: (d) => {
677
+ var i;
678
+ u.isUsingKeyboardRef.current && ((i = _.current) == null || i.focus()), d.preventDefault();
679
+ },
680
+ onCloseAutoFocus: (d) => d.preventDefault(),
681
+ onFocusOutside: w(e.onFocusOutside, (d) => {
682
+ d.target !== l.trigger && c.onOpenChange(!1);
683
+ }),
684
+ onEscapeKeyDown: w(e.onEscapeKeyDown, (d) => {
685
+ u.onClose(), d.preventDefault();
686
+ }),
687
+ onKeyDown: w(e.onKeyDown, (d) => {
688
+ var v;
689
+ const i = d.currentTarget.contains(d.target), f = Vn[u.dir].includes(d.key);
690
+ i && f && (c.onOpenChange(!1), (v = l.trigger) == null || v.focus(), d.preventDefault());
691
+ })
692
+ }
693
+ ) }) }) });
694
+ }
695
+ );
696
+ cn.displayName = an;
697
+ function sn(e) {
698
+ return e ? "open" : "closed";
699
+ }
700
+ function oe(e) {
701
+ return e === "indeterminate";
702
+ }
703
+ function Re(e) {
704
+ return oe(e) ? "indeterminate" : e ? "checked" : "unchecked";
705
+ }
706
+ function lo(e) {
707
+ const o = document.activeElement;
708
+ for (const n of e)
709
+ if (n === o || (n.focus(), document.activeElement !== o)) return;
710
+ }
711
+ function fo(e, o) {
712
+ return e.map((n, t) => e[(o + t) % e.length]);
713
+ }
714
+ function po(e, o, n) {
715
+ const r = o.length > 1 && Array.from(o).every((m) => m === o[0]) ? o[0] : o, c = n ? e.indexOf(n) : -1;
716
+ let u = fo(e, Math.max(c, 0));
717
+ r.length === 1 && (u = u.filter((m) => m !== n));
718
+ const _ = u.find(
719
+ (m) => m.toLowerCase().startsWith(r.toLowerCase())
720
+ );
721
+ return _ !== n ? _ : void 0;
722
+ }
723
+ function mo(e, o) {
724
+ const { x: n, y: t } = e;
725
+ let r = !1;
726
+ for (let c = 0, u = o.length - 1; c < o.length; u = c++) {
727
+ const l = o[c], _ = o[u], m = l.x, d = l.y, i = _.x, f = _.y;
728
+ d > t != f > t && n < (i - m) * (t - d) / (f - d) + m && (r = !r);
729
+ }
730
+ return r;
731
+ }
732
+ function _o(e, o) {
733
+ if (!o) return !1;
734
+ const n = { x: e.clientX, y: e.clientY };
735
+ return mo(n, o);
736
+ }
737
+ function H(e) {
738
+ return (o) => o.pointerType === "mouse" ? e(o) : void 0;
739
+ }
740
+ var wo = Be, go = ge, vo = We, Mo = he, ho = Ye, Co = ae, Ro = He, Io = Ze, Do = Je, bo = en, Eo = nn, So = on, xo = rn, yo = cn, ce = "DropdownMenu", [Po, Mt] = me(
741
+ ce,
742
+ [Ue]
743
+ ), I = Ue(), [To, un] = Po(ce), dn = (e) => {
744
+ const {
745
+ __scopeDropdownMenu: o,
746
+ children: n,
747
+ dir: t,
748
+ open: r,
749
+ defaultOpen: c,
750
+ onOpenChange: u,
751
+ modal: l = !0
752
+ } = e, _ = I(o), m = a.useRef(null), [d, i] = Se({
753
+ prop: r,
754
+ defaultProp: c ?? !1,
755
+ onChange: u,
756
+ caller: ce
757
+ });
758
+ return /* @__PURE__ */ s(
759
+ To,
760
+ {
761
+ scope: o,
762
+ triggerId: le(),
763
+ triggerRef: m,
764
+ contentId: le(),
765
+ open: d,
766
+ onOpenChange: i,
767
+ onOpenToggle: a.useCallback(() => i((f) => !f), [i]),
768
+ modal: l,
769
+ children: /* @__PURE__ */ s(wo, { ..._, open: d, onOpenChange: i, dir: t, modal: l, children: n })
770
+ }
771
+ );
772
+ };
773
+ dn.displayName = ce;
774
+ var ln = "DropdownMenuTrigger", fn = a.forwardRef(
775
+ (e, o) => {
776
+ const { __scopeDropdownMenu: n, disabled: t = !1, ...r } = e, c = un(ln, n), u = I(n);
777
+ return /* @__PURE__ */ s(go, { asChild: !0, ...u, children: /* @__PURE__ */ s(
778
+ N.button,
779
+ {
780
+ type: "button",
781
+ id: c.triggerId,
782
+ "aria-haspopup": "menu",
783
+ "aria-expanded": c.open,
784
+ "aria-controls": c.open ? c.contentId : void 0,
785
+ "data-state": c.open ? "open" : "closed",
786
+ "data-disabled": t ? "" : void 0,
787
+ disabled: t,
788
+ ...r,
789
+ ref: xe(o, c.triggerRef),
790
+ onPointerDown: w(e.onPointerDown, (l) => {
791
+ !t && l.button === 0 && l.ctrlKey === !1 && (c.onOpenToggle(), c.open || l.preventDefault());
792
+ }),
793
+ onKeyDown: w(e.onKeyDown, (l) => {
794
+ t || (["Enter", " "].includes(l.key) && c.onOpenToggle(), l.key === "ArrowDown" && c.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(l.key) && l.preventDefault());
795
+ })
796
+ }
797
+ ) });
798
+ }
799
+ );
800
+ fn.displayName = ln;
801
+ var pn = "DropdownMenuContent", mn = a.forwardRef(
802
+ (e, o) => {
803
+ const { __scopeDropdownMenu: n, ...t } = e, r = un(pn, n), c = I(n), u = a.useRef(!1);
804
+ return /* @__PURE__ */ s(
805
+ vo,
806
+ {
807
+ id: r.contentId,
808
+ "aria-labelledby": r.triggerId,
809
+ ...c,
810
+ ...t,
811
+ ref: o,
812
+ onCloseAutoFocus: w(e.onCloseAutoFocus, (l) => {
813
+ var _;
814
+ u.current || (_ = r.triggerRef.current) == null || _.focus(), u.current = !1, l.preventDefault();
815
+ }),
816
+ onInteractOutside: w(e.onInteractOutside, (l) => {
817
+ const _ = l.detail.originalEvent, m = _.button === 0 && _.ctrlKey === !0, d = _.button === 2 || m;
818
+ (!r.modal || d) && (u.current = !0);
819
+ }),
820
+ style: {
821
+ ...e.style,
822
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
823
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
824
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
825
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
826
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
827
+ }
828
+ }
829
+ );
830
+ }
831
+ );
832
+ mn.displayName = pn;
833
+ var Ao = "DropdownMenuGroup", No = a.forwardRef(
834
+ (e, o) => {
835
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
836
+ return /* @__PURE__ */ s(Mo, { ...r, ...t, ref: o });
837
+ }
838
+ );
839
+ No.displayName = Ao;
840
+ var Oo = "DropdownMenuLabel", Fo = a.forwardRef(
841
+ (e, o) => {
842
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
843
+ return /* @__PURE__ */ s(ho, { ...r, ...t, ref: o });
844
+ }
845
+ );
846
+ Fo.displayName = Oo;
847
+ var ko = "DropdownMenuItem", _n = a.forwardRef(
848
+ (e, o) => {
849
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
850
+ return /* @__PURE__ */ s(Co, { ...r, ...t, ref: o });
851
+ }
852
+ );
853
+ _n.displayName = ko;
854
+ var Go = "DropdownMenuCheckboxItem", Lo = a.forwardRef((e, o) => {
855
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
856
+ return /* @__PURE__ */ s(Ro, { ...r, ...t, ref: o });
857
+ });
858
+ Lo.displayName = Go;
859
+ var Ko = "DropdownMenuRadioGroup", zo = a.forwardRef((e, o) => {
860
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
861
+ return /* @__PURE__ */ s(Io, { ...r, ...t, ref: o });
862
+ });
863
+ zo.displayName = Ko;
864
+ var Uo = "DropdownMenuRadioItem", $o = a.forwardRef((e, o) => {
865
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
866
+ return /* @__PURE__ */ s(Do, { ...r, ...t, ref: o });
867
+ });
868
+ $o.displayName = Uo;
869
+ var Bo = "DropdownMenuItemIndicator", Vo = a.forwardRef((e, o) => {
870
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
871
+ return /* @__PURE__ */ s(bo, { ...r, ...t, ref: o });
872
+ });
873
+ Vo.displayName = Bo;
874
+ var Wo = "DropdownMenuSeparator", Yo = a.forwardRef((e, o) => {
875
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
876
+ return /* @__PURE__ */ s(Eo, { ...r, ...t, ref: o });
877
+ });
878
+ Yo.displayName = Wo;
879
+ var Xo = "DropdownMenuArrow", Ho = a.forwardRef(
880
+ (e, o) => {
881
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
882
+ return /* @__PURE__ */ s(So, { ...r, ...t, ref: o });
883
+ }
884
+ );
885
+ Ho.displayName = Xo;
886
+ var jo = "DropdownMenuSubTrigger", Zo = a.forwardRef((e, o) => {
887
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
888
+ return /* @__PURE__ */ s(xo, { ...r, ...t, ref: o });
889
+ });
890
+ Zo.displayName = jo;
891
+ var qo = "DropdownMenuSubContent", Jo = a.forwardRef((e, o) => {
892
+ const { __scopeDropdownMenu: n, ...t } = e, r = I(n);
893
+ return /* @__PURE__ */ s(
894
+ yo,
895
+ {
896
+ ...r,
897
+ ...t,
898
+ ref: o,
899
+ style: {
900
+ ...e.style,
901
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
902
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
903
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
904
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
905
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
906
+ }
907
+ }
908
+ );
909
+ });
910
+ Jo.displayName = qo;
911
+ var ht = dn, Ct = fn, Qo = mn, et = _n;
912
+ const nt = "cfxui__DropdownContent__content__ea3aa", ot = "cfxui__DropdownContent__onlight__352dc", tt = "cfxui__DropdownContent__item__8feac", rt = "cfxui__DropdownContent__fullWidth__c56c3", at = "cfxui__DropdownContent__trigger__4bac0", ct = "cfxui__DropdownContent__icon__2ede5", te = {
913
+ content: nt,
914
+ onlight: ot,
915
+ item: tt,
916
+ fullWidth: rt,
917
+ "dropdownselect-size-initial-large": "cfxui__DropdownContent__dropdownselect-size-initial-large__04104",
918
+ trigger: at,
919
+ icon: ct,
920
+ "dropdownselect-size-initial-small": "cfxui__DropdownContent__dropdownselect-size-initial-small__1d3ca",
921
+ "dropdownselect-size-small-large": "cfxui__DropdownContent__dropdownselect-size-small-large__269b0",
922
+ "dropdownselect-size-small-small": "cfxui__DropdownContent__dropdownselect-size-small-small__faa09",
923
+ "dropdownselect-size-small-medium-large": "cfxui__DropdownContent__dropdownselect-size-small-medium-large__3106f",
924
+ "dropdownselect-size-small-medium-small": "cfxui__DropdownContent__dropdownselect-size-small-medium-small__88821",
925
+ "dropdownselect-size-medium-large": "cfxui__DropdownContent__dropdownselect-size-medium-large__a7e74",
926
+ "dropdownselect-size-medium-small": "cfxui__DropdownContent__dropdownselect-size-medium-small__d130d",
927
+ "dropdownselect-size-medium-large-large": "cfxui__DropdownContent__dropdownselect-size-medium-large-large__ca9d3",
928
+ "dropdownselect-size-medium-large-small": "cfxui__DropdownContent__dropdownselect-size-medium-large-small__a2a72",
929
+ "dropdownselect-size-large-large": "cfxui__DropdownContent__dropdownselect-size-large-large__87b4b",
930
+ "dropdownselect-size-large-small": "cfxui__DropdownContent__dropdownselect-size-large-small__e42f3",
931
+ "dropdownselect-size-xlarge-large": "cfxui__DropdownContent__dropdownselect-size-xlarge-large__026e8",
932
+ "dropdownselect-size-xlarge-small": "cfxui__DropdownContent__dropdownselect-size-xlarge-small__fa5cb"
933
+ };
934
+ function st(e = "normal", o = "content") {
935
+ return Ae(
936
+ te[o],
937
+ Ne.getResponsiveFlatClassnames("dropdownselect-size", e).map((n) => te[n])
938
+ );
939
+ }
940
+ function it(e) {
941
+ const {
942
+ triggerWidth: o,
943
+ options: n,
944
+ size: t,
945
+ fullWidth: r = !1,
946
+ className: c,
947
+ onSelect: u
948
+ } = e, l = st(t), _ = Ae(
949
+ c,
950
+ l,
951
+ {
952
+ [te.fullWidth]: r
953
+ }
954
+ );
955
+ return /* @__PURE__ */ s(
956
+ Qo,
957
+ {
958
+ align: "end",
959
+ side: "bottom",
960
+ className: _,
961
+ style: {
962
+ width: o,
963
+ zIndex: Ne.zindex("max")
964
+ },
965
+ children: n.map((m) => /* @__PURE__ */ s(
966
+ et,
967
+ {
968
+ className: te.item,
969
+ onSelect: () => u(m.value),
970
+ style: { width: o },
971
+ children: m.label
972
+ },
973
+ m.value
974
+ ))
975
+ }
976
+ );
977
+ }
978
+ const Rt = gn.memo(it);
979
+ export {
980
+ Rt as D,
981
+ ht as R,
982
+ Ct as T,
983
+ st as g
984
+ };