@cfx-dev/ui-components 4.5.11 → 4.5.12
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.
- package/dist/{DropdownContent-BertjH0y.js → DropdownContent-CLtPVRZg.js} +103 -102
- package/dist/components/DropdownContent/DropdownContent.d.ts +1 -0
- package/dist/components/DropdownContent/DropdownContent.js +1 -1
- package/dist/components/DropdownContent/index.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/components/DropdownSelect/DropdownSelect.js +1 -1
- package/package.json +1 -1
|
@@ -20,18 +20,18 @@ var On = a.forwardRef((e, o) => {
|
|
|
20
20
|
orientation: t,
|
|
21
21
|
loop: r = !1,
|
|
22
22
|
dir: c,
|
|
23
|
-
currentTabStopId:
|
|
23
|
+
currentTabStopId: d,
|
|
24
24
|
defaultCurrentTabStopId: l,
|
|
25
|
-
onCurrentTabStopIdChange:
|
|
26
|
-
onEntryFocus:
|
|
27
|
-
preventScrollOnEntryFocus:
|
|
25
|
+
onCurrentTabStopIdChange: m,
|
|
26
|
+
onEntryFocus: _,
|
|
27
|
+
preventScrollOnEntryFocus: u = !1,
|
|
28
28
|
...i
|
|
29
29
|
} = e, f = a.useRef(null), v = z(o, f), g = Te(c), [b, M] = xe({
|
|
30
|
-
prop:
|
|
30
|
+
prop: d,
|
|
31
31
|
defaultProp: l ?? null,
|
|
32
|
-
onChange:
|
|
32
|
+
onChange: m,
|
|
33
33
|
caller: Z
|
|
34
|
-
}), [R, T] = a.useState(!1), h = we(
|
|
34
|
+
}), [R, T] = a.useState(!1), h = we(_), S = Oe(n), $ = a.useRef(!1), [Q, O] = a.useState(0);
|
|
35
35
|
return a.useEffect(() => {
|
|
36
36
|
const C = f.current;
|
|
37
37
|
if (C)
|
|
@@ -76,7 +76,7 @@ var On = a.forwardRef((e, o) => {
|
|
|
76
76
|
const B = S().filter((y) => y.focusable), V = B.find((y) => y.active), ee = B.find((y) => y.id === b), se = [V, ee, ...B].filter(
|
|
77
77
|
Boolean
|
|
78
78
|
).map((y) => y.ref.current);
|
|
79
|
-
Ke(se,
|
|
79
|
+
Ke(se, u);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
$.current = !1;
|
|
@@ -93,9 +93,9 @@ var On = a.forwardRef((e, o) => {
|
|
|
93
93
|
focusable: t = !0,
|
|
94
94
|
active: r = !1,
|
|
95
95
|
tabStopId: c,
|
|
96
|
-
children:
|
|
96
|
+
children: d,
|
|
97
97
|
...l
|
|
98
|
-
} = e,
|
|
98
|
+
} = e, m = le(), _ = c || m, u = Nn(Ge, n), i = u.currentTabStopId === _, f = Oe(n), { onFocusableItemAdd: v, onFocusableItemRemove: g, currentTabStopId: b } = u;
|
|
99
99
|
return a.useEffect(() => {
|
|
100
100
|
if (t)
|
|
101
101
|
return v(), () => g();
|
|
@@ -103,27 +103,27 @@ var On = a.forwardRef((e, o) => {
|
|
|
103
103
|
pe.ItemSlot,
|
|
104
104
|
{
|
|
105
105
|
scope: n,
|
|
106
|
-
id:
|
|
106
|
+
id: _,
|
|
107
107
|
focusable: t,
|
|
108
108
|
active: r,
|
|
109
109
|
children: /* @__PURE__ */ s(
|
|
110
110
|
N.span,
|
|
111
111
|
{
|
|
112
112
|
tabIndex: i ? 0 : -1,
|
|
113
|
-
"data-orientation":
|
|
113
|
+
"data-orientation": u.orientation,
|
|
114
114
|
...l,
|
|
115
115
|
ref: o,
|
|
116
116
|
onMouseDown: w(e.onMouseDown, (M) => {
|
|
117
|
-
t ?
|
|
117
|
+
t ? u.onItemFocus(_) : M.preventDefault();
|
|
118
118
|
}),
|
|
119
|
-
onFocus: w(e.onFocus, () =>
|
|
119
|
+
onFocus: w(e.onFocus, () => u.onItemFocus(_)),
|
|
120
120
|
onKeyDown: w(e.onKeyDown, (M) => {
|
|
121
121
|
if (M.key === "Tab" && M.shiftKey) {
|
|
122
|
-
|
|
122
|
+
u.onItemShiftTab();
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
if (M.target !== M.currentTarget) return;
|
|
126
|
-
const R = Gn(M,
|
|
126
|
+
const R = Gn(M, u.orientation, u.dir);
|
|
127
127
|
if (R !== void 0) {
|
|
128
128
|
if (M.metaKey || M.ctrlKey || M.altKey || M.shiftKey) return;
|
|
129
129
|
M.preventDefault();
|
|
@@ -132,12 +132,12 @@ var On = a.forwardRef((e, o) => {
|
|
|
132
132
|
else if (R === "prev" || R === "next") {
|
|
133
133
|
R === "prev" && h.reverse();
|
|
134
134
|
const S = h.indexOf(M.currentTarget);
|
|
135
|
-
h =
|
|
135
|
+
h = u.loop ? Ln(h, S + 1) : h.slice(S + 1);
|
|
136
136
|
}
|
|
137
137
|
setTimeout(() => Ke(h));
|
|
138
138
|
}
|
|
139
139
|
}),
|
|
140
|
-
children: typeof
|
|
140
|
+
children: typeof d == "function" ? d({ isCurrentTabStop: i, hasTabStop: b != null }) : d
|
|
141
141
|
}
|
|
142
142
|
)
|
|
143
143
|
}
|
|
@@ -182,11 +182,11 @@ var Kn = ke, zn = Le, me = ["Enter", " "], Un = ["ArrowDown", "PageUp", "Home"],
|
|
|
182
182
|
Ae,
|
|
183
183
|
Fe
|
|
184
184
|
]), re = Ae(), $e = Fe(), [Xn, U] = k(q), [Hn, J] = k(q), Be = (e) => {
|
|
185
|
-
const { __scopeMenu: o, open: n = !1, children: t, dir: r, onOpenChange: c, modal:
|
|
185
|
+
const { __scopeMenu: o, open: n = !1, children: t, dir: r, onOpenChange: c, modal: d = !0 } = e, l = re(o), [m, _] = a.useState(null), u = a.useRef(!1), i = we(c), f = Te(r);
|
|
186
186
|
return a.useEffect(() => {
|
|
187
187
|
const v = () => {
|
|
188
|
-
|
|
189
|
-
}, g = () =>
|
|
188
|
+
u.current = !0, document.addEventListener("pointerdown", g, { capture: !0, once: !0 }), document.addEventListener("pointermove", g, { capture: !0, once: !0 });
|
|
189
|
+
}, g = () => u.current = !1;
|
|
190
190
|
return document.addEventListener("keydown", v, { capture: !0 }), () => {
|
|
191
191
|
document.removeEventListener("keydown", v, { capture: !0 }), document.removeEventListener("pointerdown", g, { capture: !0 }), document.removeEventListener("pointermove", g, { capture: !0 });
|
|
192
192
|
};
|
|
@@ -196,16 +196,16 @@ var Kn = ke, zn = Le, me = ["Enter", " "], Un = ["ArrowDown", "PageUp", "Home"],
|
|
|
196
196
|
scope: o,
|
|
197
197
|
open: n,
|
|
198
198
|
onOpenChange: i,
|
|
199
|
-
content:
|
|
200
|
-
onContentChange:
|
|
199
|
+
content: m,
|
|
200
|
+
onContentChange: _,
|
|
201
201
|
children: /* @__PURE__ */ s(
|
|
202
202
|
Hn,
|
|
203
203
|
{
|
|
204
204
|
scope: o,
|
|
205
205
|
onClose: a.useCallback(() => i(!1), [i]),
|
|
206
|
-
isUsingKeyboardRef:
|
|
206
|
+
isUsingKeyboardRef: u,
|
|
207
207
|
dir: f,
|
|
208
|
-
modal:
|
|
208
|
+
modal: d,
|
|
209
209
|
children: t
|
|
210
210
|
}
|
|
211
211
|
)
|
|
@@ -224,8 +224,8 @@ var Zn = "MenuPortal", [vt, Ve] = k(Zn, {
|
|
|
224
224
|
forceMount: void 0
|
|
225
225
|
}), E = "MenuContent", [qn, Me] = k(E), We = a.forwardRef(
|
|
226
226
|
(e, o) => {
|
|
227
|
-
const n = Ve(E, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = U(E, e.__scopeMenu),
|
|
228
|
-
return /* @__PURE__ */ s(H.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ge, { present: t || c.open, children: /* @__PURE__ */ s(H.Slot, { scope: e.__scopeMenu, children:
|
|
227
|
+
const n = Ve(E, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = U(E, e.__scopeMenu), d = J(E, e.__scopeMenu);
|
|
228
|
+
return /* @__PURE__ */ s(H.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ge, { present: t || c.open, children: /* @__PURE__ */ s(H.Slot, { scope: e.__scopeMenu, children: d.modal ? /* @__PURE__ */ s(Jn, { ...r, ref: o }) : /* @__PURE__ */ s(Qn, { ...r, ref: o }) }) }) });
|
|
229
229
|
}
|
|
230
230
|
), Jn = a.forwardRef(
|
|
231
231
|
(e, o) => {
|
|
@@ -270,11 +270,11 @@ var Zn = "MenuPortal", [vt, Ve] = k(Zn, {
|
|
|
270
270
|
loop: t = !1,
|
|
271
271
|
trapFocus: r,
|
|
272
272
|
onOpenAutoFocus: c,
|
|
273
|
-
onCloseAutoFocus:
|
|
273
|
+
onCloseAutoFocus: d,
|
|
274
274
|
disableOutsidePointerEvents: l,
|
|
275
|
-
onEntryFocus:
|
|
276
|
-
onEscapeKeyDown:
|
|
277
|
-
onPointerDownOutside:
|
|
275
|
+
onEntryFocus: m,
|
|
276
|
+
onEscapeKeyDown: _,
|
|
277
|
+
onPointerDownOutside: u,
|
|
278
278
|
onFocusOutside: i,
|
|
279
279
|
onInteractOutside: f,
|
|
280
280
|
onDismiss: v,
|
|
@@ -329,14 +329,14 @@ var Zn = "MenuPortal", [vt, Ve] = k(Zn, {
|
|
|
329
329
|
var D;
|
|
330
330
|
p.preventDefault(), (D = O.current) == null || D.focus({ preventScroll: !0 });
|
|
331
331
|
}),
|
|
332
|
-
onUnmountAutoFocus:
|
|
332
|
+
onUnmountAutoFocus: d,
|
|
333
333
|
children: /* @__PURE__ */ s(
|
|
334
334
|
bn,
|
|
335
335
|
{
|
|
336
336
|
asChild: !0,
|
|
337
337
|
disableOutsidePointerEvents: l,
|
|
338
|
-
onEscapeKeyDown:
|
|
339
|
-
onPointerDownOutside:
|
|
338
|
+
onEscapeKeyDown: _,
|
|
339
|
+
onPointerDownOutside: u,
|
|
340
340
|
onFocusOutside: i,
|
|
341
341
|
onInteractOutside: f,
|
|
342
342
|
onDismiss: v,
|
|
@@ -350,7 +350,7 @@ var Zn = "MenuPortal", [vt, Ve] = k(Zn, {
|
|
|
350
350
|
loop: t,
|
|
351
351
|
currentTabStopId: $,
|
|
352
352
|
onCurrentTabStopIdChange: Q,
|
|
353
|
-
onEntryFocus: w(
|
|
353
|
+
onEntryFocus: w(m, (p) => {
|
|
354
354
|
R.isUsingKeyboardRef.current || p.preventDefault();
|
|
355
355
|
}),
|
|
356
356
|
preventScrollOnEntryFocus: !0,
|
|
@@ -417,27 +417,27 @@ var oo = "MenuLabel", Ye = a.forwardRef(
|
|
|
417
417
|
Ye.displayName = oo;
|
|
418
418
|
var oe = "MenuItem", Se = "menu.itemSelect", ae = a.forwardRef(
|
|
419
419
|
(e, o) => {
|
|
420
|
-
const { disabled: n = !1, onSelect: t, ...r } = e, c = a.useRef(null),
|
|
420
|
+
const { disabled: n = !1, onSelect: t, ...r } = e, c = a.useRef(null), d = J(oe, e.__scopeMenu), l = Me(oe, e.__scopeMenu), m = z(o, c), _ = a.useRef(!1), u = () => {
|
|
421
421
|
const i = c.current;
|
|
422
422
|
if (!n && i) {
|
|
423
423
|
const f = new CustomEvent(Se, { bubbles: !0, cancelable: !0 });
|
|
424
|
-
i.addEventListener(Se, (v) => t == null ? void 0 : t(v), { once: !0 }), vn(i, f), f.defaultPrevented ?
|
|
424
|
+
i.addEventListener(Se, (v) => t == null ? void 0 : t(v), { once: !0 }), vn(i, f), f.defaultPrevented ? _.current = !1 : d.onClose();
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
return /* @__PURE__ */ s(
|
|
428
428
|
Xe,
|
|
429
429
|
{
|
|
430
430
|
...r,
|
|
431
|
-
ref:
|
|
431
|
+
ref: m,
|
|
432
432
|
disabled: n,
|
|
433
|
-
onClick: w(e.onClick,
|
|
433
|
+
onClick: w(e.onClick, u),
|
|
434
434
|
onPointerDown: (i) => {
|
|
435
435
|
var f;
|
|
436
|
-
(f = e.onPointerDown) == null || f.call(e, i),
|
|
436
|
+
(f = e.onPointerDown) == null || f.call(e, i), _.current = !0;
|
|
437
437
|
},
|
|
438
438
|
onPointerUp: w(e.onPointerUp, (i) => {
|
|
439
439
|
var f;
|
|
440
|
-
|
|
440
|
+
_.current || (f = i.currentTarget) == null || f.click();
|
|
441
441
|
}),
|
|
442
442
|
onKeyDown: w(e.onKeyDown, (i) => {
|
|
443
443
|
const f = l.searchRef.current !== "";
|
|
@@ -450,9 +450,9 @@ var oe = "MenuItem", Se = "menu.itemSelect", ae = a.forwardRef(
|
|
|
450
450
|
ae.displayName = oe;
|
|
451
451
|
var Xe = a.forwardRef(
|
|
452
452
|
(e, o) => {
|
|
453
|
-
const { __scopeMenu: n, disabled: t = !1, textValue: r, ...c } = e,
|
|
453
|
+
const { __scopeMenu: n, disabled: t = !1, textValue: r, ...c } = e, d = Me(oe, n), l = $e(n), m = a.useRef(null), _ = z(o, m), [u, i] = a.useState(!1), [f, v] = a.useState("");
|
|
454
454
|
return a.useEffect(() => {
|
|
455
|
-
const g =
|
|
455
|
+
const g = m.current;
|
|
456
456
|
g && v((g.textContent ?? "").trim());
|
|
457
457
|
}, [c.children]), /* @__PURE__ */ s(
|
|
458
458
|
H.ItemSlot,
|
|
@@ -464,20 +464,20 @@ var Xe = a.forwardRef(
|
|
|
464
464
|
N.div,
|
|
465
465
|
{
|
|
466
466
|
role: "menuitem",
|
|
467
|
-
"data-highlighted":
|
|
467
|
+
"data-highlighted": u ? "" : void 0,
|
|
468
468
|
"aria-disabled": t || void 0,
|
|
469
469
|
"data-disabled": t ? "" : void 0,
|
|
470
470
|
...c,
|
|
471
|
-
ref:
|
|
471
|
+
ref: _,
|
|
472
472
|
onPointerMove: w(
|
|
473
473
|
e.onPointerMove,
|
|
474
474
|
j((g) => {
|
|
475
|
-
t ?
|
|
475
|
+
t ? d.onItemLeave(g) : (d.onItemEnter(g), g.defaultPrevented || g.currentTarget.focus({ preventScroll: !0 }));
|
|
476
476
|
})
|
|
477
477
|
),
|
|
478
478
|
onPointerLeave: w(
|
|
479
479
|
e.onPointerLeave,
|
|
480
|
-
j((g) =>
|
|
480
|
+
j((g) => d.onItemLeave(g))
|
|
481
481
|
),
|
|
482
482
|
onFocus: w(e.onFocus, () => i(!0)),
|
|
483
483
|
onBlur: w(e.onBlur, () => i(!1))
|
|
@@ -532,8 +532,8 @@ var qe = "MenuRadioItem", Je = a.forwardRef(
|
|
|
532
532
|
onSelect: w(
|
|
533
533
|
t.onSelect,
|
|
534
534
|
() => {
|
|
535
|
-
var
|
|
536
|
-
return (
|
|
535
|
+
var d;
|
|
536
|
+
return (d = r.onValueChange) == null ? void 0 : d.call(r, n);
|
|
537
537
|
},
|
|
538
538
|
{ checkForDefaultPrevented: !1 }
|
|
539
539
|
)
|
|
@@ -589,15 +589,15 @@ var io = "MenuArrow", on = a.forwardRef(
|
|
|
589
589
|
on.displayName = io;
|
|
590
590
|
var uo = "MenuSub", [Mt, tn] = k(uo), Y = "MenuSubTrigger", rn = a.forwardRef(
|
|
591
591
|
(e, o) => {
|
|
592
|
-
const n = U(Y, e.__scopeMenu), t = J(Y, e.__scopeMenu), r = tn(Y, e.__scopeMenu), c = Me(Y, e.__scopeMenu),
|
|
593
|
-
|
|
592
|
+
const n = U(Y, e.__scopeMenu), t = J(Y, e.__scopeMenu), r = tn(Y, e.__scopeMenu), c = Me(Y, e.__scopeMenu), d = a.useRef(null), { pointerGraceTimerRef: l, onPointerGraceIntentChange: m } = c, _ = { __scopeMenu: e.__scopeMenu }, u = a.useCallback(() => {
|
|
593
|
+
d.current && window.clearTimeout(d.current), d.current = null;
|
|
594
594
|
}, []);
|
|
595
|
-
return a.useEffect(() =>
|
|
595
|
+
return a.useEffect(() => u, [u]), a.useEffect(() => {
|
|
596
596
|
const i = l.current;
|
|
597
597
|
return () => {
|
|
598
|
-
window.clearTimeout(i),
|
|
598
|
+
window.clearTimeout(i), m(null);
|
|
599
599
|
};
|
|
600
|
-
}, [l,
|
|
600
|
+
}, [l, m]), /* @__PURE__ */ s(ve, { asChild: !0, ..._, children: /* @__PURE__ */ s(
|
|
601
601
|
Xe,
|
|
602
602
|
{
|
|
603
603
|
id: r.triggerId,
|
|
@@ -614,8 +614,8 @@ var uo = "MenuSub", [Mt, tn] = k(uo), Y = "MenuSubTrigger", rn = a.forwardRef(
|
|
|
614
614
|
onPointerMove: w(
|
|
615
615
|
e.onPointerMove,
|
|
616
616
|
j((i) => {
|
|
617
|
-
c.onItemEnter(i), !i.defaultPrevented && !e.disabled && !n.open && !
|
|
618
|
-
n.onOpenChange(!0),
|
|
617
|
+
c.onItemEnter(i), !i.defaultPrevented && !e.disabled && !n.open && !d.current && (c.onPointerGraceIntentChange(null), d.current = window.setTimeout(() => {
|
|
618
|
+
n.onOpenChange(!0), u();
|
|
619
619
|
}, 100));
|
|
620
620
|
})
|
|
621
621
|
),
|
|
@@ -623,7 +623,7 @@ var uo = "MenuSub", [Mt, tn] = k(uo), Y = "MenuSubTrigger", rn = a.forwardRef(
|
|
|
623
623
|
e.onPointerLeave,
|
|
624
624
|
j((i) => {
|
|
625
625
|
var v, g;
|
|
626
|
-
|
|
626
|
+
u();
|
|
627
627
|
const f = (v = n.content) == null ? void 0 : v.getBoundingClientRect();
|
|
628
628
|
if (f) {
|
|
629
629
|
const b = (g = n.content) == null ? void 0 : g.dataset.side, M = b === "right", R = M ? -5 : 5, T = f[M ? "left" : "right"], h = f[M ? "right" : "left"];
|
|
@@ -660,34 +660,34 @@ var uo = "MenuSub", [Mt, tn] = k(uo), Y = "MenuSubTrigger", rn = a.forwardRef(
|
|
|
660
660
|
rn.displayName = Y;
|
|
661
661
|
var an = "MenuSubContent", cn = a.forwardRef(
|
|
662
662
|
(e, o) => {
|
|
663
|
-
const n = Ve(E, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = U(E, e.__scopeMenu),
|
|
663
|
+
const n = Ve(E, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = U(E, e.__scopeMenu), d = J(E, e.__scopeMenu), l = tn(an, e.__scopeMenu), m = a.useRef(null), _ = z(o, m);
|
|
664
664
|
return /* @__PURE__ */ s(H.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ge, { present: t || c.open, children: /* @__PURE__ */ s(H.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(
|
|
665
665
|
he,
|
|
666
666
|
{
|
|
667
667
|
id: l.contentId,
|
|
668
668
|
"aria-labelledby": l.triggerId,
|
|
669
669
|
...r,
|
|
670
|
-
ref:
|
|
670
|
+
ref: _,
|
|
671
671
|
align: "start",
|
|
672
|
-
side:
|
|
672
|
+
side: d.dir === "rtl" ? "left" : "right",
|
|
673
673
|
disableOutsidePointerEvents: !1,
|
|
674
674
|
disableOutsideScroll: !1,
|
|
675
675
|
trapFocus: !1,
|
|
676
|
-
onOpenAutoFocus: (
|
|
676
|
+
onOpenAutoFocus: (u) => {
|
|
677
677
|
var i;
|
|
678
|
-
|
|
678
|
+
d.isUsingKeyboardRef.current && ((i = m.current) == null || i.focus()), u.preventDefault();
|
|
679
679
|
},
|
|
680
|
-
onCloseAutoFocus: (
|
|
681
|
-
onFocusOutside: w(e.onFocusOutside, (
|
|
682
|
-
|
|
680
|
+
onCloseAutoFocus: (u) => u.preventDefault(),
|
|
681
|
+
onFocusOutside: w(e.onFocusOutside, (u) => {
|
|
682
|
+
u.target !== l.trigger && c.onOpenChange(!1);
|
|
683
683
|
}),
|
|
684
|
-
onEscapeKeyDown: w(e.onEscapeKeyDown, (
|
|
685
|
-
|
|
684
|
+
onEscapeKeyDown: w(e.onEscapeKeyDown, (u) => {
|
|
685
|
+
d.onClose(), u.preventDefault();
|
|
686
686
|
}),
|
|
687
|
-
onKeyDown: w(e.onKeyDown, (
|
|
687
|
+
onKeyDown: w(e.onKeyDown, (u) => {
|
|
688
688
|
var v;
|
|
689
|
-
const i =
|
|
690
|
-
i && f && (c.onOpenChange(!1), (v = l.trigger) == null || v.focus(),
|
|
689
|
+
const i = u.currentTarget.contains(u.target), f = Vn[d.dir].includes(u.key);
|
|
690
|
+
i && f && (c.onOpenChange(!1), (v = l.trigger) == null || v.focus(), u.preventDefault());
|
|
691
691
|
})
|
|
692
692
|
}
|
|
693
693
|
) }) }) });
|
|
@@ -712,20 +712,20 @@ function fo(e, o) {
|
|
|
712
712
|
return e.map((n, t) => e[(o + t) % e.length]);
|
|
713
713
|
}
|
|
714
714
|
function po(e, o, n) {
|
|
715
|
-
const r = o.length > 1 && Array.from(o).every((
|
|
716
|
-
let
|
|
717
|
-
r.length === 1 && (
|
|
718
|
-
const
|
|
719
|
-
(
|
|
715
|
+
const r = o.length > 1 && Array.from(o).every((_) => _ === o[0]) ? o[0] : o, c = n ? e.indexOf(n) : -1;
|
|
716
|
+
let d = fo(e, Math.max(c, 0));
|
|
717
|
+
r.length === 1 && (d = d.filter((_) => _ !== n));
|
|
718
|
+
const m = d.find(
|
|
719
|
+
(_) => _.toLowerCase().startsWith(r.toLowerCase())
|
|
720
720
|
);
|
|
721
|
-
return
|
|
721
|
+
return m !== n ? m : void 0;
|
|
722
722
|
}
|
|
723
723
|
function mo(e, o) {
|
|
724
724
|
const { x: n, y: t } = e;
|
|
725
725
|
let r = !1;
|
|
726
|
-
for (let c = 0,
|
|
727
|
-
const l = o[c],
|
|
728
|
-
|
|
726
|
+
for (let c = 0, d = o.length - 1; c < o.length; d = c++) {
|
|
727
|
+
const l = o[c], m = o[d], _ = l.x, u = l.y, i = m.x, f = m.y;
|
|
728
|
+
u > t != f > t && n < (i - _) * (t - u) / (f - u) + _ && (r = !r);
|
|
729
729
|
}
|
|
730
730
|
return r;
|
|
731
731
|
}
|
|
@@ -747,12 +747,12 @@ var wo = Be, go = ve, vo = We, Mo = Ce, ho = Ye, Co = ae, Ro = He, Io = Ze, bo =
|
|
|
747
747
|
dir: t,
|
|
748
748
|
open: r,
|
|
749
749
|
defaultOpen: c,
|
|
750
|
-
onOpenChange:
|
|
750
|
+
onOpenChange: d,
|
|
751
751
|
modal: l = !0
|
|
752
|
-
} = e,
|
|
752
|
+
} = e, m = I(o), _ = a.useRef(null), [u, i] = xe({
|
|
753
753
|
prop: r,
|
|
754
754
|
defaultProp: c ?? !1,
|
|
755
|
-
onChange:
|
|
755
|
+
onChange: d,
|
|
756
756
|
caller: ce
|
|
757
757
|
});
|
|
758
758
|
return /* @__PURE__ */ s(
|
|
@@ -760,21 +760,21 @@ var wo = Be, go = ve, vo = We, Mo = Ce, ho = Ye, Co = ae, Ro = He, Io = Ze, bo =
|
|
|
760
760
|
{
|
|
761
761
|
scope: o,
|
|
762
762
|
triggerId: le(),
|
|
763
|
-
triggerRef:
|
|
763
|
+
triggerRef: _,
|
|
764
764
|
contentId: le(),
|
|
765
|
-
open:
|
|
765
|
+
open: u,
|
|
766
766
|
onOpenChange: i,
|
|
767
767
|
onOpenToggle: a.useCallback(() => i((f) => !f), [i]),
|
|
768
768
|
modal: l,
|
|
769
|
-
children: /* @__PURE__ */ s(wo, { ...
|
|
769
|
+
children: /* @__PURE__ */ s(wo, { ...m, open: u, onOpenChange: i, dir: t, modal: l, children: n })
|
|
770
770
|
}
|
|
771
771
|
);
|
|
772
772
|
};
|
|
773
773
|
dn.displayName = ce;
|
|
774
774
|
var ln = "DropdownMenuTrigger", fn = a.forwardRef(
|
|
775
775
|
(e, o) => {
|
|
776
|
-
const { __scopeDropdownMenu: n, disabled: t = !1, ...r } = e, c = un(ln, n),
|
|
777
|
-
return /* @__PURE__ */ s(go, { asChild: !0, ...
|
|
776
|
+
const { __scopeDropdownMenu: n, disabled: t = !1, ...r } = e, c = un(ln, n), d = I(n);
|
|
777
|
+
return /* @__PURE__ */ s(go, { asChild: !0, ...d, children: /* @__PURE__ */ s(
|
|
778
778
|
N.button,
|
|
779
779
|
{
|
|
780
780
|
type: "button",
|
|
@@ -800,7 +800,7 @@ var ln = "DropdownMenuTrigger", fn = a.forwardRef(
|
|
|
800
800
|
fn.displayName = ln;
|
|
801
801
|
var pn = "DropdownMenuContent", mn = a.forwardRef(
|
|
802
802
|
(e, o) => {
|
|
803
|
-
const { __scopeDropdownMenu: n, ...t } = e, r = un(pn, n), c = I(n),
|
|
803
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = un(pn, n), c = I(n), d = a.useRef(!1);
|
|
804
804
|
return /* @__PURE__ */ s(
|
|
805
805
|
vo,
|
|
806
806
|
{
|
|
@@ -810,12 +810,12 @@ var pn = "DropdownMenuContent", mn = a.forwardRef(
|
|
|
810
810
|
...t,
|
|
811
811
|
ref: o,
|
|
812
812
|
onCloseAutoFocus: w(e.onCloseAutoFocus, (l) => {
|
|
813
|
-
var
|
|
814
|
-
|
|
813
|
+
var m;
|
|
814
|
+
d.current || (m = r.triggerRef.current) == null || m.focus(), d.current = !1, l.preventDefault();
|
|
815
815
|
}),
|
|
816
816
|
onInteractOutside: w(e.onInteractOutside, (l) => {
|
|
817
|
-
const
|
|
818
|
-
(!r.modal ||
|
|
817
|
+
const m = l.detail.originalEvent, _ = m.button === 0 && m.ctrlKey === !0, u = m.button === 2 || _;
|
|
818
|
+
(!r.modal || u) && (d.current = !0);
|
|
819
819
|
}),
|
|
820
820
|
style: {
|
|
821
821
|
...e.style,
|
|
@@ -945,10 +945,11 @@ function ut(e) {
|
|
|
945
945
|
size: t,
|
|
946
946
|
fullWidth: r = !1,
|
|
947
947
|
className: c,
|
|
948
|
-
|
|
949
|
-
|
|
948
|
+
itemClassName: d,
|
|
949
|
+
onSelect: l
|
|
950
|
+
} = e, m = it(t), _ = fe(
|
|
950
951
|
c,
|
|
951
|
-
|
|
952
|
+
m,
|
|
952
953
|
{
|
|
953
954
|
[X.fullWidth]: r
|
|
954
955
|
}
|
|
@@ -963,18 +964,18 @@ function ut(e) {
|
|
|
963
964
|
width: o,
|
|
964
965
|
zIndex: Ne.zindex("max")
|
|
965
966
|
},
|
|
966
|
-
children: n.map((
|
|
967
|
+
children: n.map((u) => /* @__PURE__ */ s(
|
|
967
968
|
et,
|
|
968
969
|
{
|
|
969
|
-
disabled:
|
|
970
|
-
className: fe(X.item, {
|
|
971
|
-
[X.disabled]:
|
|
970
|
+
disabled: u.disabled,
|
|
971
|
+
className: fe(X.item, d, {
|
|
972
|
+
[X.disabled]: u.disabled
|
|
972
973
|
}),
|
|
973
|
-
onSelect: () => u
|
|
974
|
+
onSelect: () => l(u.value),
|
|
974
975
|
style: { width: o },
|
|
975
|
-
children:
|
|
976
|
+
children: u.label
|
|
976
977
|
},
|
|
977
|
-
|
|
978
|
+
u.value
|
|
978
979
|
))
|
|
979
980
|
}
|
|
980
981
|
);
|
|
@@ -12,6 +12,7 @@ export type DropdownContentOption = DropdownOption<string>;
|
|
|
12
12
|
export interface DropdownContentProps {
|
|
13
13
|
options: DropdownContentOption[];
|
|
14
14
|
className?: string;
|
|
15
|
+
itemClassName?: string;
|
|
15
16
|
triggerWidth?: React.CSSProperties['width'];
|
|
16
17
|
size?: ResponsiveValueType<InputSize>;
|
|
17
18
|
fullWidth?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as f, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { g as W, R as N, T as R, D as v } from "../../DropdownContent-
|
|
2
|
+
import { g as W, R as N, T as R, D as v } from "../../DropdownContent-CLtPVRZg.js";
|
|
3
3
|
import _, { useRef as b, useState as z, useEffect as I } from "react";
|
|
4
4
|
import T from "../Flex/Flex.js";
|
|
5
5
|
import { clsx as j } from "../../utils/clsx.js";
|