@cfx-dev/ui-components 5.0.15 → 5.0.16
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-BqQZ17mb.js → DropdownContent-BTzahw95.js} +163 -161
- 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, t) => {
|
|
|
20
20
|
orientation: o,
|
|
21
21
|
loop: r = !1,
|
|
22
22
|
dir: c,
|
|
23
|
-
currentTabStopId:
|
|
23
|
+
currentTabStopId: d,
|
|
24
24
|
defaultCurrentTabStopId: l,
|
|
25
|
-
onCurrentTabStopIdChange:
|
|
26
|
-
onEntryFocus:
|
|
27
|
-
preventScrollOnEntryFocus:
|
|
28
|
-
...
|
|
25
|
+
onCurrentTabStopIdChange: m,
|
|
26
|
+
onEntryFocus: v,
|
|
27
|
+
preventScrollOnEntryFocus: u = !1,
|
|
28
|
+
...i
|
|
29
29
|
} = e, f = a.useRef(null), _ = U(t, f), w = Te(c), [b, M] = ye({
|
|
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 = ve(
|
|
34
|
+
}), [R, T] = a.useState(!1), h = ve(v), D = Ne(n), B = a.useRef(!1), [Q, O] = a.useState(0);
|
|
35
35
|
return a.useEffect(() => {
|
|
36
36
|
const C = f.current;
|
|
37
37
|
if (C)
|
|
@@ -62,7 +62,7 @@ var On = a.forwardRef((e, t) => {
|
|
|
62
62
|
{
|
|
63
63
|
tabIndex: R || Q === 0 ? -1 : 0,
|
|
64
64
|
"data-orientation": o,
|
|
65
|
-
...
|
|
65
|
+
...i,
|
|
66
66
|
ref: _,
|
|
67
67
|
style: { outline: "none", ...e.style },
|
|
68
68
|
onMouseDown: g(e.onMouseDown, () => {
|
|
@@ -76,7 +76,7 @@ var On = a.forwardRef((e, t) => {
|
|
|
76
76
|
const V = D().filter((P) => P.focusable), W = V.find((P) => P.active), ee = V.find((P) => P.id === b), se = [W, ee, ...V].filter(
|
|
77
77
|
Boolean
|
|
78
78
|
).map((P) => P.ref.current);
|
|
79
|
-
Le(se,
|
|
79
|
+
Le(se, u);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
B.current = !1;
|
|
@@ -93,9 +93,9 @@ var On = a.forwardRef((e, t) => {
|
|
|
93
93
|
focusable: o = !0,
|
|
94
94
|
active: r = !1,
|
|
95
95
|
tabStopId: c,
|
|
96
|
-
children:
|
|
96
|
+
children: d,
|
|
97
97
|
...l
|
|
98
|
-
} = e,
|
|
98
|
+
} = e, m = le(), v = c || m, u = Nn(ke, n), i = u.currentTabStopId === v, f = Ne(n), { onFocusableItemAdd: _, onFocusableItemRemove: w, currentTabStopId: b } = u;
|
|
99
99
|
return a.useEffect(() => {
|
|
100
100
|
if (o)
|
|
101
101
|
return _(), () => w();
|
|
@@ -103,27 +103,27 @@ var On = a.forwardRef((e, t) => {
|
|
|
103
103
|
fe.ItemSlot,
|
|
104
104
|
{
|
|
105
105
|
scope: n,
|
|
106
|
-
id:
|
|
106
|
+
id: v,
|
|
107
107
|
focusable: o,
|
|
108
108
|
active: r,
|
|
109
109
|
children: /* @__PURE__ */ s(
|
|
110
110
|
N.span,
|
|
111
111
|
{
|
|
112
|
-
tabIndex:
|
|
113
|
-
"data-orientation":
|
|
112
|
+
tabIndex: i ? 0 : -1,
|
|
113
|
+
"data-orientation": u.orientation,
|
|
114
114
|
...l,
|
|
115
115
|
ref: t,
|
|
116
116
|
onMouseDown: g(e.onMouseDown, (M) => {
|
|
117
|
-
o ?
|
|
117
|
+
o ? u.onItemFocus(v) : M.preventDefault();
|
|
118
118
|
}),
|
|
119
|
-
onFocus: g(e.onFocus, () =>
|
|
119
|
+
onFocus: g(e.onFocus, () => u.onItemFocus(v)),
|
|
120
120
|
onKeyDown: g(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, t) => {
|
|
|
132
132
|
else if (R === "prev" || R === "next") {
|
|
133
133
|
R === "prev" && h.reverse();
|
|
134
134
|
const D = h.indexOf(M.currentTarget);
|
|
135
|
-
h =
|
|
135
|
+
h = u.loop ? Ln(h, D + 1) : h.slice(D + 1);
|
|
136
136
|
}
|
|
137
137
|
setTimeout(() => Le(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 = Fe, Un = Ge, pe = ["Enter", " "], $n = ["ArrowDown", "PageUp", "Home"],
|
|
|
182
182
|
Ae,
|
|
183
183
|
Oe
|
|
184
184
|
]), re = Ae(), $e = Oe(), [Hn, $] = k(q), [jn, J] = k(q), Be = (e) => {
|
|
185
|
-
const { __scopeMenu: t, open: n = !1, children: o, dir: r, onOpenChange: c, modal:
|
|
185
|
+
const { __scopeMenu: t, open: n = !1, children: o, dir: r, onOpenChange: c, modal: d = !0 } = e, l = re(t), [m, v] = a.useState(null), u = a.useRef(!1), i = ve(c), f = Te(r);
|
|
186
186
|
return a.useEffect(() => {
|
|
187
187
|
const _ = () => {
|
|
188
|
-
|
|
189
|
-
}, w = () =>
|
|
188
|
+
u.current = !0, document.addEventListener("pointerdown", w, { capture: !0, once: !0 }), document.addEventListener("pointermove", w, { capture: !0, once: !0 });
|
|
189
|
+
}, w = () => u.current = !1;
|
|
190
190
|
return document.addEventListener("keydown", _, { capture: !0 }), () => {
|
|
191
191
|
document.removeEventListener("keydown", _, { capture: !0 }), document.removeEventListener("pointerdown", w, { capture: !0 }), document.removeEventListener("pointermove", w, { capture: !0 });
|
|
192
192
|
};
|
|
@@ -195,17 +195,17 @@ var Kn = Fe, Un = Ge, pe = ["Enter", " "], $n = ["ArrowDown", "PageUp", "Home"],
|
|
|
195
195
|
{
|
|
196
196
|
scope: t,
|
|
197
197
|
open: n,
|
|
198
|
-
onOpenChange:
|
|
199
|
-
content:
|
|
200
|
-
onContentChange:
|
|
198
|
+
onOpenChange: i,
|
|
199
|
+
content: m,
|
|
200
|
+
onContentChange: v,
|
|
201
201
|
children: /* @__PURE__ */ s(
|
|
202
202
|
jn,
|
|
203
203
|
{
|
|
204
204
|
scope: t,
|
|
205
|
-
onClose: a.useCallback(() =>
|
|
206
|
-
isUsingKeyboardRef:
|
|
205
|
+
onClose: a.useCallback(() => i(!1), [i]),
|
|
206
|
+
isUsingKeyboardRef: u,
|
|
207
207
|
dir: f,
|
|
208
|
-
modal:
|
|
208
|
+
modal: d,
|
|
209
209
|
children: o
|
|
210
210
|
}
|
|
211
211
|
)
|
|
@@ -224,8 +224,8 @@ var Zn = "MenuPortal", [vo, Ve] = k(Zn, {
|
|
|
224
224
|
forceMount: void 0
|
|
225
225
|
}), S = "MenuContent", [qn, _e] = k(S), We = a.forwardRef(
|
|
226
226
|
(e, t) => {
|
|
227
|
-
const n = Ve(S, e.__scopeMenu), { forceMount: o = n.forceMount, ...r } = e, c = $(S, e.__scopeMenu),
|
|
228
|
-
return /* @__PURE__ */ s(j.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ge, { present: o || c.open, children: /* @__PURE__ */ s(j.Slot, { scope: e.__scopeMenu, children:
|
|
227
|
+
const n = Ve(S, e.__scopeMenu), { forceMount: o = n.forceMount, ...r } = e, c = $(S, e.__scopeMenu), d = J(S, e.__scopeMenu);
|
|
228
|
+
return /* @__PURE__ */ s(j.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ge, { present: o || c.open, children: /* @__PURE__ */ s(j.Slot, { scope: e.__scopeMenu, children: d.modal ? /* @__PURE__ */ s(Jn, { ...r, ref: t }) : /* @__PURE__ */ s(Qn, { ...r, ref: t }) }) }) });
|
|
229
229
|
}
|
|
230
230
|
), Jn = a.forwardRef(
|
|
231
231
|
(e, t) => {
|
|
@@ -270,27 +270,27 @@ var Zn = "MenuPortal", [vo, Ve] = k(Zn, {
|
|
|
270
270
|
loop: o = !1,
|
|
271
271
|
trapFocus: r,
|
|
272
272
|
onOpenAutoFocus: c,
|
|
273
|
-
onCloseAutoFocus:
|
|
273
|
+
onCloseAutoFocus: d,
|
|
274
274
|
disableOutsidePointerEvents: l,
|
|
275
|
-
onEntryFocus:
|
|
276
|
-
onEscapeKeyDown:
|
|
277
|
-
onPointerDownOutside:
|
|
278
|
-
onFocusOutside:
|
|
275
|
+
onEntryFocus: m,
|
|
276
|
+
onEscapeKeyDown: v,
|
|
277
|
+
onPointerDownOutside: u,
|
|
278
|
+
onFocusOutside: i,
|
|
279
279
|
onInteractOutside: f,
|
|
280
280
|
onDismiss: _,
|
|
281
281
|
disableOutsideScroll: w,
|
|
282
282
|
...b
|
|
283
|
-
} = e, M = $(S, n), R = J(S, n), T = re(n), h = $e(n), D = Yn(n), [B, Q] = a.useState(null), O = a.useRef(null), C = U(t, O, M.onContentChange), G = a.useRef(0), F = a.useRef(""), V = a.useRef(0), W = a.useRef(null), ee = a.useRef("right"), ne = a.useRef(0), se = w ? Cn : a.Fragment, P = w ? { as: et, allowPinchZoom: !0 } : void 0, vn = (
|
|
283
|
+
} = e, M = $(S, n), R = J(S, n), T = re(n), h = $e(n), D = Yn(n), [B, Q] = a.useState(null), O = a.useRef(null), C = U(t, O, M.onContentChange), G = a.useRef(0), F = a.useRef(""), V = a.useRef(0), W = a.useRef(null), ee = a.useRef("right"), ne = a.useRef(0), se = w ? Cn : a.Fragment, P = w ? { as: et, allowPinchZoom: !0 } : void 0, vn = (p) => {
|
|
284
284
|
var K, be;
|
|
285
|
-
const E = F.current +
|
|
285
|
+
const E = F.current + p, y = D().filter((x) => !x.disabled), A = document.activeElement, ue = (K = y.find((x) => x.ref.current === A)) == null ? void 0 : K.textValue, ie = y.map((x) => x.textValue), Ie = ft(ie, E, ue), Y = (be = y.find((x) => x.textValue === Ie)) == null ? void 0 : be.ref.current;
|
|
286
286
|
(function x(Ee) {
|
|
287
287
|
F.current = Ee, window.clearTimeout(G.current), Ee !== "" && (G.current = window.setTimeout(() => x(""), 1e3));
|
|
288
288
|
})(E), Y && setTimeout(() => Y.focus());
|
|
289
289
|
};
|
|
290
290
|
a.useEffect(() => () => window.clearTimeout(G.current), []), hn();
|
|
291
|
-
const L = a.useCallback((
|
|
291
|
+
const L = a.useCallback((p) => {
|
|
292
292
|
var y, A;
|
|
293
|
-
return ee.current === ((y = W.current) == null ? void 0 : y.side) && mt(
|
|
293
|
+
return ee.current === ((y = W.current) == null ? void 0 : y.side) && mt(p, (A = W.current) == null ? void 0 : A.area);
|
|
294
294
|
}, []);
|
|
295
295
|
return /* @__PURE__ */ s(
|
|
296
296
|
qn,
|
|
@@ -298,46 +298,46 @@ var Zn = "MenuPortal", [vo, Ve] = k(Zn, {
|
|
|
298
298
|
scope: n,
|
|
299
299
|
searchRef: F,
|
|
300
300
|
onItemEnter: a.useCallback(
|
|
301
|
-
(
|
|
302
|
-
L(
|
|
301
|
+
(p) => {
|
|
302
|
+
L(p) && p.preventDefault();
|
|
303
303
|
},
|
|
304
304
|
[L]
|
|
305
305
|
),
|
|
306
306
|
onItemLeave: a.useCallback(
|
|
307
|
-
(
|
|
307
|
+
(p) => {
|
|
308
308
|
var E;
|
|
309
|
-
L(
|
|
309
|
+
L(p) || ((E = O.current) == null || E.focus(), Q(null));
|
|
310
310
|
},
|
|
311
311
|
[L]
|
|
312
312
|
),
|
|
313
313
|
onTriggerLeave: a.useCallback(
|
|
314
|
-
(
|
|
315
|
-
L(
|
|
314
|
+
(p) => {
|
|
315
|
+
L(p) && p.preventDefault();
|
|
316
316
|
},
|
|
317
317
|
[L]
|
|
318
318
|
),
|
|
319
319
|
pointerGraceTimerRef: V,
|
|
320
|
-
onPointerGraceIntentChange: a.useCallback((
|
|
321
|
-
W.current =
|
|
320
|
+
onPointerGraceIntentChange: a.useCallback((p) => {
|
|
321
|
+
W.current = p;
|
|
322
322
|
}, []),
|
|
323
323
|
children: /* @__PURE__ */ s(se, { ...P, children: /* @__PURE__ */ s(
|
|
324
324
|
Rn,
|
|
325
325
|
{
|
|
326
326
|
asChild: !0,
|
|
327
327
|
trapped: r,
|
|
328
|
-
onMountAutoFocus: g(c, (
|
|
328
|
+
onMountAutoFocus: g(c, (p) => {
|
|
329
329
|
var E;
|
|
330
|
-
|
|
330
|
+
p.preventDefault(), (E = O.current) == null || E.focus({ preventScroll: !0 });
|
|
331
331
|
}),
|
|
332
|
-
onUnmountAutoFocus:
|
|
332
|
+
onUnmountAutoFocus: d,
|
|
333
333
|
children: /* @__PURE__ */ s(
|
|
334
334
|
In,
|
|
335
335
|
{
|
|
336
336
|
asChild: !0,
|
|
337
337
|
disableOutsidePointerEvents: l,
|
|
338
|
-
onEscapeKeyDown:
|
|
339
|
-
onPointerDownOutside:
|
|
340
|
-
onFocusOutside:
|
|
338
|
+
onEscapeKeyDown: v,
|
|
339
|
+
onPointerDownOutside: u,
|
|
340
|
+
onFocusOutside: i,
|
|
341
341
|
onInteractOutside: f,
|
|
342
342
|
onDismiss: _,
|
|
343
343
|
children: /* @__PURE__ */ s(
|
|
@@ -350,8 +350,8 @@ var Zn = "MenuPortal", [vo, Ve] = k(Zn, {
|
|
|
350
350
|
loop: o,
|
|
351
351
|
currentTabStopId: B,
|
|
352
352
|
onCurrentTabStopIdChange: Q,
|
|
353
|
-
onEntryFocus: g(
|
|
354
|
-
R.isUsingKeyboardRef.current ||
|
|
353
|
+
onEntryFocus: g(m, (p) => {
|
|
354
|
+
R.isUsingKeyboardRef.current || p.preventDefault();
|
|
355
355
|
}),
|
|
356
356
|
preventScrollOnEntryFocus: !0,
|
|
357
357
|
children: /* @__PURE__ */ s(
|
|
@@ -366,25 +366,25 @@ var Zn = "MenuPortal", [vo, Ve] = k(Zn, {
|
|
|
366
366
|
...b,
|
|
367
367
|
ref: C,
|
|
368
368
|
style: { outline: "none", ...b.style },
|
|
369
|
-
onKeyDown: g(b.onKeyDown, (
|
|
370
|
-
const y =
|
|
371
|
-
y && (
|
|
369
|
+
onKeyDown: g(b.onKeyDown, (p) => {
|
|
370
|
+
const y = p.target.closest("[data-radix-menu-content]") === p.currentTarget, A = p.ctrlKey || p.altKey || p.metaKey, ue = p.key.length === 1;
|
|
371
|
+
y && (p.key === "Tab" && p.preventDefault(), !A && ue && vn(p.key));
|
|
372
372
|
const ie = O.current;
|
|
373
|
-
if (
|
|
374
|
-
|
|
373
|
+
if (p.target !== ie || !Bn.includes(p.key)) return;
|
|
374
|
+
p.preventDefault();
|
|
375
375
|
const Y = D().filter((K) => !K.disabled).map((K) => K.ref.current);
|
|
376
|
-
Ke.includes(
|
|
376
|
+
Ke.includes(p.key) && Y.reverse(), dt(Y);
|
|
377
377
|
}),
|
|
378
|
-
onBlur: g(e.onBlur, (
|
|
379
|
-
|
|
378
|
+
onBlur: g(e.onBlur, (p) => {
|
|
379
|
+
p.currentTarget.contains(p.target) || (window.clearTimeout(G.current), F.current = "");
|
|
380
380
|
}),
|
|
381
381
|
onPointerMove: g(
|
|
382
382
|
e.onPointerMove,
|
|
383
|
-
z((
|
|
384
|
-
const E =
|
|
385
|
-
if (
|
|
386
|
-
const A =
|
|
387
|
-
ee.current = A, ne.current =
|
|
383
|
+
z((p) => {
|
|
384
|
+
const E = p.target, y = ne.current !== p.clientX;
|
|
385
|
+
if (p.currentTarget.contains(E) && y) {
|
|
386
|
+
const A = p.clientX > ne.current ? "right" : "left";
|
|
387
|
+
ee.current = A, ne.current = p.clientX;
|
|
388
388
|
}
|
|
389
389
|
})
|
|
390
390
|
)
|
|
@@ -417,31 +417,31 @@ var tt = "MenuLabel", Ye = a.forwardRef(
|
|
|
417
417
|
Ye.displayName = tt;
|
|
418
418
|
var te = "MenuItem", De = "menu.itemSelect", ae = a.forwardRef(
|
|
419
419
|
(e, t) => {
|
|
420
|
-
const { disabled: n = !1, onSelect: o, ...r } = e, c = a.useRef(null),
|
|
421
|
-
const
|
|
422
|
-
if (!n &&
|
|
420
|
+
const { disabled: n = !1, onSelect: o, ...r } = e, c = a.useRef(null), d = J(te, e.__scopeMenu), l = _e(te, e.__scopeMenu), m = U(t, c), v = a.useRef(!1), u = () => {
|
|
421
|
+
const i = c.current;
|
|
422
|
+
if (!n && i) {
|
|
423
423
|
const f = new CustomEvent(De, { bubbles: !0, cancelable: !0 });
|
|
424
|
-
|
|
424
|
+
i.addEventListener(De, (_) => o == null ? void 0 : o(_), { once: !0 }), wn(i, f), f.defaultPrevented ? v.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: g(e.onClick,
|
|
434
|
-
onPointerDown: (
|
|
433
|
+
onClick: g(e.onClick, u),
|
|
434
|
+
onPointerDown: (i) => {
|
|
435
435
|
var f;
|
|
436
|
-
(f = e.onPointerDown) == null || f.call(e,
|
|
436
|
+
(f = e.onPointerDown) == null || f.call(e, i), v.current = !0;
|
|
437
437
|
},
|
|
438
|
-
onPointerUp: g(e.onPointerUp, (
|
|
438
|
+
onPointerUp: g(e.onPointerUp, (i) => {
|
|
439
439
|
var f;
|
|
440
|
-
|
|
440
|
+
v.current || (f = i.currentTarget) == null || f.click();
|
|
441
441
|
}),
|
|
442
|
-
onKeyDown: g(e.onKeyDown, (
|
|
442
|
+
onKeyDown: g(e.onKeyDown, (i) => {
|
|
443
443
|
const f = l.searchRef.current !== "";
|
|
444
|
-
n || f &&
|
|
444
|
+
n || f && i.key === " " || pe.includes(i.key) && (i.currentTarget.click(), i.preventDefault());
|
|
445
445
|
})
|
|
446
446
|
}
|
|
447
447
|
);
|
|
@@ -450,9 +450,9 @@ var te = "MenuItem", De = "menu.itemSelect", ae = a.forwardRef(
|
|
|
450
450
|
ae.displayName = te;
|
|
451
451
|
var Xe = a.forwardRef(
|
|
452
452
|
(e, t) => {
|
|
453
|
-
const { __scopeMenu: n, disabled: o = !1, textValue: r, ...c } = e,
|
|
453
|
+
const { __scopeMenu: n, disabled: o = !1, textValue: r, ...c } = e, d = _e(te, n), l = $e(n), m = a.useRef(null), v = U(t, m), [u, i] = a.useState(!1), [f, _] = a.useState("");
|
|
454
454
|
return a.useEffect(() => {
|
|
455
|
-
const w =
|
|
455
|
+
const w = m.current;
|
|
456
456
|
w && _((w.textContent ?? "").trim());
|
|
457
457
|
}, [c.children]), /* @__PURE__ */ s(
|
|
458
458
|
j.ItemSlot,
|
|
@@ -464,23 +464,23 @@ 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": o || void 0,
|
|
469
469
|
"data-disabled": o ? "" : void 0,
|
|
470
470
|
...c,
|
|
471
|
-
ref:
|
|
471
|
+
ref: v,
|
|
472
472
|
onPointerMove: g(
|
|
473
473
|
e.onPointerMove,
|
|
474
474
|
z((w) => {
|
|
475
|
-
o ?
|
|
475
|
+
o ? d.onItemLeave(w) : (d.onItemEnter(w), w.defaultPrevented || w.currentTarget.focus({ preventScroll: !0 }));
|
|
476
476
|
})
|
|
477
477
|
),
|
|
478
478
|
onPointerLeave: g(
|
|
479
479
|
e.onPointerLeave,
|
|
480
|
-
z((w) =>
|
|
480
|
+
z((w) => d.onItemLeave(w))
|
|
481
481
|
),
|
|
482
|
-
onFocus: g(e.onFocus, () =>
|
|
483
|
-
onBlur: g(e.onBlur, () =>
|
|
482
|
+
onFocus: g(e.onFocus, () => i(!0)),
|
|
483
|
+
onBlur: g(e.onBlur, () => i(!1))
|
|
484
484
|
}
|
|
485
485
|
) })
|
|
486
486
|
}
|
|
@@ -532,8 +532,8 @@ var Ze = "MenuRadioItem", qe = a.forwardRef(
|
|
|
532
532
|
onSelect: g(
|
|
533
533
|
o.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 ut = "MenuArrow", nn = a.forwardRef(
|
|
|
589
589
|
nn.displayName = ut;
|
|
590
590
|
var it = "MenuSub", [go, tn] = k(it), H = "MenuSubTrigger", on = a.forwardRef(
|
|
591
591
|
(e, t) => {
|
|
592
|
-
const n = $(H, e.__scopeMenu), o = J(H, e.__scopeMenu), r = tn(H, e.__scopeMenu), c = _e(H, e.__scopeMenu),
|
|
593
|
-
|
|
592
|
+
const n = $(H, e.__scopeMenu), o = J(H, e.__scopeMenu), r = tn(H, e.__scopeMenu), c = _e(H, e.__scopeMenu), d = a.useRef(null), { pointerGraceTimerRef: l, onPointerGraceIntentChange: m } = c, v = { __scopeMenu: e.__scopeMenu }, u = a.useCallback(() => {
|
|
593
|
+
d.current && window.clearTimeout(d.current), d.current = null;
|
|
594
594
|
}, []);
|
|
595
|
-
return a.useEffect(() =>
|
|
596
|
-
const
|
|
595
|
+
return a.useEffect(() => u, [u]), a.useEffect(() => {
|
|
596
|
+
const i = l.current;
|
|
597
597
|
return () => {
|
|
598
|
-
window.clearTimeout(
|
|
598
|
+
window.clearTimeout(i), m(null);
|
|
599
599
|
};
|
|
600
|
-
}, [l,
|
|
600
|
+
}, [l, m]), /* @__PURE__ */ s(we, { asChild: !0, ...v, children: /* @__PURE__ */ s(
|
|
601
601
|
Xe,
|
|
602
602
|
{
|
|
603
603
|
id: r.triggerId,
|
|
@@ -607,23 +607,23 @@ var it = "MenuSub", [go, tn] = k(it), H = "MenuSubTrigger", on = a.forwardRef(
|
|
|
607
607
|
"data-state": cn(n.open),
|
|
608
608
|
...e,
|
|
609
609
|
ref: Pe(t, r.onTriggerChange),
|
|
610
|
-
onClick: (
|
|
610
|
+
onClick: (i) => {
|
|
611
611
|
var f;
|
|
612
|
-
(f = e.onClick) == null || f.call(e,
|
|
612
|
+
(f = e.onClick) == null || f.call(e, i), !(e.disabled || i.defaultPrevented) && (i.currentTarget.focus(), n.open || n.onOpenChange(!0));
|
|
613
613
|
},
|
|
614
614
|
onPointerMove: g(
|
|
615
615
|
e.onPointerMove,
|
|
616
|
-
z((
|
|
617
|
-
c.onItemEnter(
|
|
618
|
-
n.onOpenChange(!0),
|
|
616
|
+
z((i) => {
|
|
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
|
),
|
|
622
622
|
onPointerLeave: g(
|
|
623
623
|
e.onPointerLeave,
|
|
624
|
-
z((
|
|
624
|
+
z((i) => {
|
|
625
625
|
var _, w;
|
|
626
|
-
|
|
626
|
+
u();
|
|
627
627
|
const f = (_ = n.content) == null ? void 0 : _.getBoundingClientRect();
|
|
628
628
|
if (f) {
|
|
629
629
|
const b = (w = n.content) == null ? void 0 : w.dataset.side, M = b === "right", R = M ? -5 : 5, T = f[M ? "left" : "right"], h = f[M ? "right" : "left"];
|
|
@@ -631,7 +631,7 @@ var it = "MenuSub", [go, tn] = k(it), H = "MenuSubTrigger", on = a.forwardRef(
|
|
|
631
631
|
area: [
|
|
632
632
|
// Apply a bleed on clientX to ensure that our exit point is
|
|
633
633
|
// consistently within polygon bounds
|
|
634
|
-
{ x:
|
|
634
|
+
{ x: i.clientX + R, y: i.clientY },
|
|
635
635
|
{ x: T, y: f.top },
|
|
636
636
|
{ x: h, y: f.top },
|
|
637
637
|
{ x: h, y: f.bottom },
|
|
@@ -643,15 +643,15 @@ var it = "MenuSub", [go, tn] = k(it), H = "MenuSubTrigger", on = a.forwardRef(
|
|
|
643
643
|
300
|
|
644
644
|
);
|
|
645
645
|
} else {
|
|
646
|
-
if (c.onTriggerLeave(
|
|
646
|
+
if (c.onTriggerLeave(i), i.defaultPrevented) return;
|
|
647
647
|
c.onPointerGraceIntentChange(null);
|
|
648
648
|
}
|
|
649
649
|
})
|
|
650
650
|
),
|
|
651
|
-
onKeyDown: g(e.onKeyDown, (
|
|
651
|
+
onKeyDown: g(e.onKeyDown, (i) => {
|
|
652
652
|
var _;
|
|
653
653
|
const f = c.searchRef.current !== "";
|
|
654
|
-
e.disabled || f &&
|
|
654
|
+
e.disabled || f && i.key === " " || Vn[o.dir].includes(i.key) && (n.onOpenChange(!0), (_ = n.content) == null || _.focus(), i.preventDefault());
|
|
655
655
|
})
|
|
656
656
|
}
|
|
657
657
|
) });
|
|
@@ -660,34 +660,34 @@ var it = "MenuSub", [go, tn] = k(it), H = "MenuSubTrigger", on = a.forwardRef(
|
|
|
660
660
|
on.displayName = H;
|
|
661
661
|
var rn = "MenuSubContent", an = a.forwardRef(
|
|
662
662
|
(e, t) => {
|
|
663
|
-
const n = Ve(S, e.__scopeMenu), { forceMount: o = n.forceMount, ...r } = e, c = $(S, e.__scopeMenu),
|
|
663
|
+
const n = Ve(S, e.__scopeMenu), { forceMount: o = n.forceMount, ...r } = e, c = $(S, e.__scopeMenu), d = J(S, e.__scopeMenu), l = tn(rn, e.__scopeMenu), m = a.useRef(null), v = U(t, m);
|
|
664
664
|
return /* @__PURE__ */ s(j.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ge, { present: o || c.open, children: /* @__PURE__ */ s(j.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(
|
|
665
665
|
Me,
|
|
666
666
|
{
|
|
667
667
|
id: l.contentId,
|
|
668
668
|
"aria-labelledby": l.triggerId,
|
|
669
669
|
...r,
|
|
670
|
-
ref:
|
|
670
|
+
ref: v,
|
|
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: (
|
|
677
|
-
var
|
|
678
|
-
|
|
676
|
+
onOpenAutoFocus: (u) => {
|
|
677
|
+
var i;
|
|
678
|
+
d.isUsingKeyboardRef.current && ((i = m.current) == null || i.focus()), u.preventDefault();
|
|
679
679
|
},
|
|
680
|
-
onCloseAutoFocus: (
|
|
681
|
-
onFocusOutside: g(e.onFocusOutside, (
|
|
682
|
-
|
|
680
|
+
onCloseAutoFocus: (u) => u.preventDefault(),
|
|
681
|
+
onFocusOutside: g(e.onFocusOutside, (u) => {
|
|
682
|
+
u.target !== l.trigger && c.onOpenChange(!1);
|
|
683
683
|
}),
|
|
684
|
-
onEscapeKeyDown: g(e.onEscapeKeyDown, (
|
|
685
|
-
|
|
684
|
+
onEscapeKeyDown: g(e.onEscapeKeyDown, (u) => {
|
|
685
|
+
d.onClose(), u.preventDefault();
|
|
686
686
|
}),
|
|
687
|
-
onKeyDown: g(e.onKeyDown, (
|
|
687
|
+
onKeyDown: g(e.onKeyDown, (u) => {
|
|
688
688
|
var _;
|
|
689
|
-
const
|
|
690
|
-
|
|
689
|
+
const i = u.currentTarget.contains(u.target), f = Wn[d.dir].includes(u.key);
|
|
690
|
+
i && f && (c.onOpenChange(!1), (_ = l.trigger) == null || _.focus(), u.preventDefault());
|
|
691
691
|
})
|
|
692
692
|
}
|
|
693
693
|
) }) }) });
|
|
@@ -712,20 +712,20 @@ function lt(e, t) {
|
|
|
712
712
|
return e.map((n, o) => e[(t + o) % e.length]);
|
|
713
713
|
}
|
|
714
714
|
function ft(e, t, n) {
|
|
715
|
-
const r = t.length > 1 && Array.from(t).every((
|
|
716
|
-
let
|
|
717
|
-
r.length === 1 && (
|
|
718
|
-
const
|
|
719
|
-
(
|
|
715
|
+
const r = t.length > 1 && Array.from(t).every((v) => v === t[0]) ? t[0] : t, c = n ? e.indexOf(n) : -1;
|
|
716
|
+
let d = lt(e, Math.max(c, 0));
|
|
717
|
+
r.length === 1 && (d = d.filter((v) => v !== n));
|
|
718
|
+
const m = d.find(
|
|
719
|
+
(v) => v.toLowerCase().startsWith(r.toLowerCase())
|
|
720
720
|
);
|
|
721
|
-
return
|
|
721
|
+
return m !== n ? m : void 0;
|
|
722
722
|
}
|
|
723
723
|
function pt(e, t) {
|
|
724
724
|
const { x: n, y: o } = e;
|
|
725
725
|
let r = !1;
|
|
726
|
-
for (let c = 0,
|
|
727
|
-
const l = t[c],
|
|
728
|
-
|
|
726
|
+
for (let c = 0, d = t.length - 1; c < t.length; d = c++) {
|
|
727
|
+
const l = t[c], m = t[d], v = l.x, u = l.y, i = m.x, f = m.y;
|
|
728
|
+
u > o != f > o && n < (i - v) * (o - u) / (f - u) + v && (r = !r);
|
|
729
729
|
}
|
|
730
730
|
return r;
|
|
731
731
|
}
|
|
@@ -747,12 +747,12 @@ var vt = Be, gt = we, wt = We, _t = he, Mt = Ye, ht = ae, Ct = He, Rt = ze, It =
|
|
|
747
747
|
dir: o,
|
|
748
748
|
open: r,
|
|
749
749
|
defaultOpen: c,
|
|
750
|
-
onOpenChange:
|
|
750
|
+
onOpenChange: d,
|
|
751
751
|
modal: l = !0
|
|
752
|
-
} = e,
|
|
752
|
+
} = e, m = I(t), v = a.useRef(null), [u, i] = ye({
|
|
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 vt = Be, gt = we, wt = We, _t = he, Mt = Ye, ht = ae, Ct = He, Rt = ze, It =
|
|
|
760
760
|
{
|
|
761
761
|
scope: t,
|
|
762
762
|
triggerId: le(),
|
|
763
|
-
triggerRef:
|
|
763
|
+
triggerRef: v,
|
|
764
764
|
contentId: le(),
|
|
765
|
-
open:
|
|
766
|
-
onOpenChange:
|
|
767
|
-
onOpenToggle: a.useCallback(() =>
|
|
765
|
+
open: u,
|
|
766
|
+
onOpenChange: i,
|
|
767
|
+
onOpenToggle: a.useCallback(() => i((f) => !f), [i]),
|
|
768
768
|
modal: l,
|
|
769
|
-
children: /* @__PURE__ */ s(vt, { ...
|
|
769
|
+
children: /* @__PURE__ */ s(vt, { ...m, open: u, onOpenChange: i, dir: o, modal: l, children: n })
|
|
770
770
|
}
|
|
771
771
|
);
|
|
772
772
|
};
|
|
773
773
|
un.displayName = ce;
|
|
774
774
|
var dn = "DropdownMenuTrigger", ln = a.forwardRef(
|
|
775
775
|
(e, t) => {
|
|
776
|
-
const { __scopeDropdownMenu: n, disabled: o = !1, ...r } = e, c = sn(dn, n),
|
|
777
|
-
return /* @__PURE__ */ s(gt, { asChild: !0, ...
|
|
776
|
+
const { __scopeDropdownMenu: n, disabled: o = !1, ...r } = e, c = sn(dn, n), d = I(n);
|
|
777
|
+
return /* @__PURE__ */ s(gt, { asChild: !0, ...d, children: /* @__PURE__ */ s(
|
|
778
778
|
N.button,
|
|
779
779
|
{
|
|
780
780
|
type: "button",
|
|
@@ -800,7 +800,7 @@ var dn = "DropdownMenuTrigger", ln = a.forwardRef(
|
|
|
800
800
|
ln.displayName = dn;
|
|
801
801
|
var fn = "DropdownMenuContent", pn = a.forwardRef(
|
|
802
802
|
(e, t) => {
|
|
803
|
-
const { __scopeDropdownMenu: n, ...o } = e, r = sn(fn, n), c = I(n),
|
|
803
|
+
const { __scopeDropdownMenu: n, ...o } = e, r = sn(fn, n), c = I(n), d = a.useRef(!1);
|
|
804
804
|
return /* @__PURE__ */ s(
|
|
805
805
|
wt,
|
|
806
806
|
{
|
|
@@ -810,12 +810,12 @@ var fn = "DropdownMenuContent", pn = a.forwardRef(
|
|
|
810
810
|
...o,
|
|
811
811
|
ref: t,
|
|
812
812
|
onCloseAutoFocus: g(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: g(e.onInteractOutside, (l) => {
|
|
817
|
-
const
|
|
818
|
-
(!r.modal ||
|
|
817
|
+
const m = l.detail.originalEvent, v = m.button === 0 && m.ctrlKey === !0, u = m.button === 2 || v;
|
|
818
|
+
(!r.modal || u) && (d.current = !0);
|
|
819
819
|
}),
|
|
820
820
|
style: {
|
|
821
821
|
...e.style,
|
|
@@ -921,15 +921,16 @@ function ao(e) {
|
|
|
921
921
|
triggerWidth: t,
|
|
922
922
|
options: n,
|
|
923
923
|
selectedValue: o,
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
924
|
+
selectedClassName: r,
|
|
925
|
+
fullWidth: c = !1,
|
|
926
|
+
className: d,
|
|
927
|
+
itemClassName: l,
|
|
928
|
+
onSelect: m
|
|
928
929
|
} = e, v = Se(
|
|
929
|
-
|
|
930
|
+
d,
|
|
930
931
|
X.content,
|
|
931
932
|
{
|
|
932
|
-
[X.fullWidth]:
|
|
933
|
+
[X.fullWidth]: c
|
|
933
934
|
}
|
|
934
935
|
);
|
|
935
936
|
return /* @__PURE__ */ s(
|
|
@@ -942,19 +943,20 @@ function ao(e) {
|
|
|
942
943
|
width: t,
|
|
943
944
|
zIndex: yn.zindex("max")
|
|
944
945
|
},
|
|
945
|
-
children: n.map((
|
|
946
|
+
children: n.map((u) => /* @__PURE__ */ s(
|
|
946
947
|
Qt,
|
|
947
948
|
{
|
|
948
|
-
disabled:
|
|
949
|
-
className: Se(X.item,
|
|
950
|
-
[X.disabled]:
|
|
951
|
-
[X.selected]:
|
|
949
|
+
disabled: u.disabled,
|
|
950
|
+
className: Se(X.item, l, {
|
|
951
|
+
[X.disabled]: u.disabled,
|
|
952
|
+
[X.selected]: u.value === o,
|
|
953
|
+
[r || ""]: u.value === o && r
|
|
952
954
|
}),
|
|
953
|
-
onSelect: () =>
|
|
955
|
+
onSelect: () => m(u.value),
|
|
954
956
|
style: { width: t },
|
|
955
|
-
children:
|
|
957
|
+
children: u.label
|
|
956
958
|
},
|
|
957
|
-
|
|
959
|
+
u.value
|
|
958
960
|
))
|
|
959
961
|
}
|
|
960
962
|
);
|
|
@@ -13,6 +13,7 @@ export interface DropdownContentProps {
|
|
|
13
13
|
selectedValue?: DropdownOptionValueType;
|
|
14
14
|
className?: string;
|
|
15
15
|
itemClassName?: string;
|
|
16
|
+
selectedClassName?: string;
|
|
16
17
|
triggerWidth?: React.CSSProperties['width'];
|
|
17
18
|
fullWidth?: boolean;
|
|
18
19
|
onSelect: (value: string) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { R as D, T as W, D as C } from "../../DropdownContent-
|
|
2
|
+
import { R as D, T as W, D as C } from "../../DropdownContent-BTzahw95.js";
|
|
3
3
|
import a, { useRef as R, useState as v, useEffect as b } from "react";
|
|
4
4
|
import N from "../Flex/Flex.js";
|
|
5
5
|
import { clsx as T } from "../../utils/clsx.js";
|