@drjoshcsimmons/scl 0.1.11 → 0.1.13
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/index100.js +29 -47
- package/dist/index101.js +10 -52
- package/dist/index102.js +55 -30
- package/dist/index103.js +30 -4
- package/dist/index104.js +3 -218
- package/dist/index105.js +216 -45
- package/dist/index106.js +47 -29
- package/dist/index107.js +30 -9
- package/dist/index108.js +30 -181
- package/dist/index11.js +2 -2
- package/dist/index110.js +9 -30
- package/dist/index111.js +159 -628
- package/dist/index112.js +1 -1
- package/dist/index115.js +12 -6
- package/dist/index116.js +47 -11
- package/dist/index117.js +6 -21
- package/dist/index118.js +206 -9
- package/dist/index119.js +21 -37
- package/dist/index12.js +1 -1
- package/dist/index120.js +399 -17
- package/dist/index121.js +21 -206
- package/dist/index122.js +9 -22
- package/dist/index123.js +38 -400
- package/dist/index124.js +18 -48
- package/dist/index125.js +25 -2
- package/dist/index126.js +29 -53
- package/dist/index127.js +5 -65
- package/dist/index128.js +2 -25
- package/dist/index129.js +53 -29
- package/dist/index13.js +2 -2
- package/dist/index130.js +65 -5
- package/dist/index136.js +1 -1
- package/dist/index137.js +1 -1
- package/dist/index14.js +2 -2
- package/dist/index141.js +1 -1
- package/dist/index15.js +2 -2
- package/dist/index17.js +4 -4
- package/dist/index18.js +2 -2
- package/dist/index20.js +1 -1
- package/dist/index21.js +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.js +2 -2
- package/dist/index24.js +1 -1
- package/dist/index25.js +3 -3
- package/dist/index26.js +1 -1
- package/dist/index27.js +2 -2
- package/dist/index29.js +1 -1
- package/dist/index33.js +1 -1
- package/dist/index36.js +1 -1
- package/dist/index37.js +1 -1
- package/dist/index45.js +1 -1
- package/dist/index46.js +1 -1
- package/dist/index48.js +245 -295
- package/dist/index49.js +5 -5
- package/dist/index50.js +303 -118
- package/dist/index51.js +12 -73
- package/dist/index52.js +244 -55
- package/dist/index53.js +9 -260
- package/dist/index54.js +225 -12
- package/dist/index55.js +11 -249
- package/dist/index56.js +5 -3
- package/dist/index57.js +114 -107
- package/dist/index58.js +73 -12
- package/dist/index59.js +82 -31
- package/dist/index6.js +1 -1
- package/dist/index60.js +846 -68
- package/dist/index61.js +9 -860
- package/dist/index62.js +118 -9
- package/dist/index63.js +16 -159
- package/dist/index64.js +54 -330
- package/dist/index65.js +213 -407
- package/dist/index66.js +407 -213
- package/dist/index67.js +332 -18
- package/dist/index68.js +148 -212
- package/dist/index69.js +31 -11
- package/dist/index7.js +1 -1
- package/dist/index70.js +236 -11
- package/dist/index71.js +2 -2
- package/dist/index72.js +12 -236
- package/dist/index73.js +242 -518
- package/dist/index74.js +530 -18
- package/dist/index75.js +20 -252
- package/dist/index80.js +1 -1
- package/dist/index82.js +1 -1
- package/dist/index84.js +122 -12
- package/dist/index85.js +130 -50
- package/dist/index86.js +13 -10
- package/dist/index87.js +68 -3
- package/dist/index88.js +15 -30
- package/dist/index89.js +9 -13
- package/dist/index9.js +1 -1
- package/dist/index90.js +50 -9
- package/dist/index91.js +47 -5
- package/dist/index92.js +5 -24
- package/dist/index93.js +23 -67
- package/dist/index94.js +12 -122
- package/dist/index95.js +633 -118
- package/dist/index96.js +9 -14
- package/dist/index97.js +52 -12
- package/dist/index98.js +10 -8
- package/dist/index99.js +3 -49
- package/package.json +1 -1
package/dist/index111.js
CHANGED
|
@@ -1,652 +1,183 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { composeEventHandlers as
|
|
3
|
-
import { createCollection as
|
|
4
|
-
import { useComposedRefs as
|
|
5
|
-
import { createContextScope as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
import { composeEventHandlers as p } from "./index79.js";
|
|
3
|
+
import { createCollection as V } from "./index77.js";
|
|
4
|
+
import { useComposedRefs as j } from "./index78.js";
|
|
5
|
+
import { createContextScope as z } from "./index76.js";
|
|
6
|
+
import { useId as q } from "./index82.js";
|
|
7
|
+
import { Primitive as G } from "./index81.js";
|
|
8
|
+
import { useCallbackRef as J } from "./index98.js";
|
|
9
|
+
import { useControllableState as Q } from "./index80.js";
|
|
10
|
+
import { useDirection as W } from "./index83.js";
|
|
11
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
12
|
+
var y = "rovingFocusGroup.onEntryFocus", X = { bubbles: !1, cancelable: !0 }, I = "RovingFocusGroup", [D, N, Z] = V(I), [$, Fe] = z(
|
|
13
|
+
I,
|
|
14
|
+
[Z]
|
|
15
|
+
), [ee, oe] = $(I), O = c.forwardRef(
|
|
16
|
+
(e, r) => /* @__PURE__ */ d(D.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(D.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(te, { ...e, ref: r }) }) })
|
|
17
|
+
);
|
|
18
|
+
O.displayName = I;
|
|
19
|
+
var te = c.forwardRef((e, r) => {
|
|
20
|
+
const {
|
|
21
|
+
__scopeRovingFocusGroup: s,
|
|
22
|
+
orientation: o,
|
|
23
|
+
loop: T = !1,
|
|
24
|
+
dir: w,
|
|
25
|
+
currentTabStopId: v,
|
|
26
|
+
defaultCurrentTabStopId: C,
|
|
27
|
+
onCurrentTabStopIdChange: S,
|
|
28
|
+
onEntryFocus: m,
|
|
29
|
+
preventScrollOnEntryFocus: u = !1,
|
|
30
|
+
...b
|
|
31
|
+
} = e, F = c.useRef(null), g = j(r, F), R = W(w), [E, t] = Q({
|
|
32
|
+
prop: v,
|
|
33
|
+
defaultProp: C ?? null,
|
|
34
|
+
onChange: S,
|
|
35
|
+
caller: I
|
|
36
|
+
}), [i, h] = c.useState(!1), a = J(m), l = N(s), A = c.useRef(!1), [L, P] = c.useState(0);
|
|
37
|
+
return c.useEffect(() => {
|
|
38
|
+
const n = F.current;
|
|
39
|
+
if (n)
|
|
40
|
+
return n.addEventListener(y, a), () => n.removeEventListener(y, a);
|
|
41
|
+
}, [a]), /* @__PURE__ */ d(
|
|
42
|
+
ee,
|
|
42
43
|
{
|
|
43
|
-
scope:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
scope: s,
|
|
45
|
+
orientation: o,
|
|
46
|
+
dir: R,
|
|
47
|
+
loop: T,
|
|
48
|
+
currentTabStopId: E,
|
|
49
|
+
onItemFocus: c.useCallback(
|
|
50
|
+
(n) => t(n),
|
|
51
|
+
[t]
|
|
52
|
+
),
|
|
53
|
+
onItemShiftTab: c.useCallback(() => h(!0), []),
|
|
54
|
+
onFocusableItemAdd: c.useCallback(
|
|
55
|
+
() => P((n) => n + 1),
|
|
56
|
+
[]
|
|
57
|
+
),
|
|
58
|
+
onFocusableItemRemove: c.useCallback(
|
|
59
|
+
() => P((n) => n - 1),
|
|
60
|
+
[]
|
|
61
|
+
),
|
|
62
|
+
children: /* @__PURE__ */ d(
|
|
63
|
+
G.div,
|
|
50
64
|
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
tabIndex: i || L === 0 ? -1 : 0,
|
|
66
|
+
"data-orientation": o,
|
|
67
|
+
...b,
|
|
68
|
+
ref: g,
|
|
69
|
+
style: { outline: "none", ...e.style },
|
|
70
|
+
onMouseDown: p(e.onMouseDown, () => {
|
|
71
|
+
A.current = !0;
|
|
72
|
+
}),
|
|
73
|
+
onFocus: p(e.onFocus, (n) => {
|
|
74
|
+
const U = !A.current;
|
|
75
|
+
if (n.target === n.currentTarget && U && !i) {
|
|
76
|
+
const x = new CustomEvent(y, X);
|
|
77
|
+
if (n.currentTarget.dispatchEvent(x), !x.defaultPrevented) {
|
|
78
|
+
const _ = l().filter((f) => f.focusable), B = _.find((f) => f.active), Y = _.find((f) => f.id === E), H = [B, Y, ..._].filter(
|
|
79
|
+
Boolean
|
|
80
|
+
).map((f) => f.ref.current);
|
|
81
|
+
k(H, u);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
A.current = !1;
|
|
85
|
+
}),
|
|
86
|
+
onBlur: p(e.onBlur, () => h(!1))
|
|
57
87
|
}
|
|
58
88
|
)
|
|
59
89
|
}
|
|
60
|
-
) });
|
|
61
|
-
};
|
|
62
|
-
Pe.displayName = L;
|
|
63
|
-
var _t = "MenuAnchor", te = r.forwardRef(
|
|
64
|
-
(e, n) => {
|
|
65
|
-
const { __scopeMenu: t, ...o } = e, s = K(t);
|
|
66
|
-
return /* @__PURE__ */ u(ot, { ...s, ...o, ref: n });
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
te.displayName = _t;
|
|
70
|
-
var ne = "MenuPortal", [Rt, Ee] = I(ne, {
|
|
71
|
-
forceMount: void 0
|
|
72
|
-
}), we = (e) => {
|
|
73
|
-
const { __scopeMenu: n, forceMount: t, children: o, container: s } = e, a = E(ne, n);
|
|
74
|
-
return /* @__PURE__ */ u(Rt, { scope: n, forceMount: t, children: /* @__PURE__ */ u(W, { present: t || a.open, children: /* @__PURE__ */ u(at, { asChild: !0, container: s, children: o }) }) });
|
|
75
|
-
};
|
|
76
|
-
we.displayName = ne;
|
|
77
|
-
var _ = "MenuContent", [St, oe] = I(_), Ie = r.forwardRef(
|
|
78
|
-
(e, n) => {
|
|
79
|
-
const t = Ee(_, e.__scopeMenu), { forceMount: o = t.forceMount, ...s } = e, a = E(_, e.__scopeMenu), l = G(_, e.__scopeMenu);
|
|
80
|
-
return /* @__PURE__ */ u(D.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ u(W, { present: o || a.open, children: /* @__PURE__ */ u(D.Slot, { scope: e.__scopeMenu, children: l.modal ? /* @__PURE__ */ u(Pt, { ...s, ref: n }) : /* @__PURE__ */ u(Et, { ...s, ref: n }) }) }) });
|
|
81
|
-
}
|
|
82
|
-
), Pt = r.forwardRef(
|
|
83
|
-
(e, n) => {
|
|
84
|
-
const t = E(_, e.__scopeMenu), o = r.useRef(null), s = N(n, o);
|
|
85
|
-
return r.useEffect(() => {
|
|
86
|
-
const a = o.current;
|
|
87
|
-
if (a) return dt(a);
|
|
88
|
-
}, []), /* @__PURE__ */ u(
|
|
89
|
-
re,
|
|
90
|
-
{
|
|
91
|
-
...e,
|
|
92
|
-
ref: s,
|
|
93
|
-
trapFocus: t.open,
|
|
94
|
-
disableOutsidePointerEvents: t.open,
|
|
95
|
-
disableOutsideScroll: !0,
|
|
96
|
-
onFocusOutside: h(
|
|
97
|
-
e.onFocusOutside,
|
|
98
|
-
(a) => a.preventDefault(),
|
|
99
|
-
{ checkForDefaultPrevented: !1 }
|
|
100
|
-
),
|
|
101
|
-
onDismiss: () => t.onOpenChange(!1)
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
), Et = r.forwardRef((e, n) => {
|
|
106
|
-
const t = E(_, e.__scopeMenu);
|
|
107
|
-
return /* @__PURE__ */ u(
|
|
108
|
-
re,
|
|
109
|
-
{
|
|
110
|
-
...e,
|
|
111
|
-
ref: n,
|
|
112
|
-
trapFocus: !1,
|
|
113
|
-
disableOutsidePointerEvents: !1,
|
|
114
|
-
disableOutsideScroll: !1,
|
|
115
|
-
onDismiss: () => t.onOpenChange(!1)
|
|
116
|
-
}
|
|
117
90
|
);
|
|
118
|
-
}),
|
|
119
|
-
(e,
|
|
91
|
+
}), K = "RovingFocusGroupItem", M = c.forwardRef(
|
|
92
|
+
(e, r) => {
|
|
120
93
|
const {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
disableOutsideScroll: v,
|
|
134
|
-
...w
|
|
135
|
-
} = e, y = E(_, t), T = G(_, t), U = K(t), B = Re(t), ie = vt(t), [Xe, le] = r.useState(null), V = r.useRef(null), je = N(n, V, y.onContentChange), Y = r.useRef(0), X = r.useRef(""), He = r.useRef(0), Z = r.useRef(null), de = r.useRef("right"), $ = r.useRef(0), We = v ? ft : r.Fragment, ze = v ? { as: wt, allowPinchZoom: !0 } : void 0, Ze = (i) => {
|
|
136
|
-
var b, me;
|
|
137
|
-
const g = X.current + i, R = ie().filter((S) => !S.disabled), P = document.activeElement, q = (b = R.find((S) => S.ref.current === P)) == null ? void 0 : b.textValue, J = R.map((S) => S.textValue), fe = Lt(J, g, q), A = (me = R.find((S) => S.textValue === fe)) == null ? void 0 : me.ref.current;
|
|
138
|
-
(function S(pe) {
|
|
139
|
-
X.current = pe, window.clearTimeout(Y.current), pe !== "" && (Y.current = window.setTimeout(() => S(""), 1e3));
|
|
140
|
-
})(g), A && setTimeout(() => A.focus());
|
|
141
|
-
};
|
|
142
|
-
r.useEffect(() => () => window.clearTimeout(Y.current), []), tt();
|
|
143
|
-
const x = r.useCallback((i) => {
|
|
144
|
-
var R, P;
|
|
145
|
-
return de.current === ((R = Z.current) == null ? void 0 : R.side) && Gt(i, (P = Z.current) == null ? void 0 : P.area);
|
|
146
|
-
}, []);
|
|
147
|
-
return /* @__PURE__ */ u(
|
|
148
|
-
St,
|
|
94
|
+
__scopeRovingFocusGroup: s,
|
|
95
|
+
focusable: o = !0,
|
|
96
|
+
active: T = !1,
|
|
97
|
+
tabStopId: w,
|
|
98
|
+
children: v,
|
|
99
|
+
...C
|
|
100
|
+
} = e, S = q(), m = w || S, u = oe(K, s), b = u.currentTabStopId === m, F = N(s), { onFocusableItemAdd: g, onFocusableItemRemove: R, currentTabStopId: E } = u;
|
|
101
|
+
return c.useEffect(() => {
|
|
102
|
+
if (o)
|
|
103
|
+
return g(), () => R();
|
|
104
|
+
}, [o, g, R]), /* @__PURE__ */ d(
|
|
105
|
+
D.ItemSlot,
|
|
149
106
|
{
|
|
150
|
-
scope:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
[x]
|
|
157
|
-
),
|
|
158
|
-
onItemLeave: r.useCallback(
|
|
159
|
-
(i) => {
|
|
160
|
-
var g;
|
|
161
|
-
x(i) || ((g = V.current) == null || g.focus(), le(null));
|
|
162
|
-
},
|
|
163
|
-
[x]
|
|
164
|
-
),
|
|
165
|
-
onTriggerLeave: r.useCallback(
|
|
166
|
-
(i) => {
|
|
167
|
-
x(i) && i.preventDefault();
|
|
168
|
-
},
|
|
169
|
-
[x]
|
|
170
|
-
),
|
|
171
|
-
pointerGraceTimerRef: He,
|
|
172
|
-
onPointerGraceIntentChange: r.useCallback((i) => {
|
|
173
|
-
Z.current = i;
|
|
174
|
-
}, []),
|
|
175
|
-
children: /* @__PURE__ */ u(We, { ...ze, children: /* @__PURE__ */ u(
|
|
176
|
-
nt,
|
|
107
|
+
scope: s,
|
|
108
|
+
id: m,
|
|
109
|
+
focusable: o,
|
|
110
|
+
active: T,
|
|
111
|
+
children: /* @__PURE__ */ d(
|
|
112
|
+
G.span,
|
|
177
113
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
114
|
+
tabIndex: b ? 0 : -1,
|
|
115
|
+
"data-orientation": u.orientation,
|
|
116
|
+
...C,
|
|
117
|
+
ref: r,
|
|
118
|
+
onMouseDown: p(e.onMouseDown, (t) => {
|
|
119
|
+
o ? u.onItemFocus(m) : t.preventDefault();
|
|
183
120
|
}),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
disableOutsidePointerEvents: p,
|
|
190
|
-
onEscapeKeyDown: m,
|
|
191
|
-
onPointerDownOutside: f,
|
|
192
|
-
onFocusOutside: c,
|
|
193
|
-
onInteractOutside: d,
|
|
194
|
-
onDismiss: C,
|
|
195
|
-
children: /* @__PURE__ */ u(
|
|
196
|
-
it,
|
|
197
|
-
{
|
|
198
|
-
asChild: !0,
|
|
199
|
-
...B,
|
|
200
|
-
dir: T.dir,
|
|
201
|
-
orientation: "vertical",
|
|
202
|
-
loop: o,
|
|
203
|
-
currentTabStopId: Xe,
|
|
204
|
-
onCurrentTabStopIdChange: le,
|
|
205
|
-
onEntryFocus: h(M, (i) => {
|
|
206
|
-
T.isUsingKeyboardRef.current || i.preventDefault();
|
|
207
|
-
}),
|
|
208
|
-
preventScrollOnEntryFocus: !0,
|
|
209
|
-
children: /* @__PURE__ */ u(
|
|
210
|
-
rt,
|
|
211
|
-
{
|
|
212
|
-
role: "menu",
|
|
213
|
-
"aria-orientation": "vertical",
|
|
214
|
-
"data-state": Ye(y.open),
|
|
215
|
-
"data-radix-menu-content": "",
|
|
216
|
-
dir: T.dir,
|
|
217
|
-
...U,
|
|
218
|
-
...w,
|
|
219
|
-
ref: je,
|
|
220
|
-
style: { outline: "none", ...w.style },
|
|
221
|
-
onKeyDown: h(w.onKeyDown, (i) => {
|
|
222
|
-
const R = i.target.closest("[data-radix-menu-content]") === i.currentTarget, P = i.ctrlKey || i.altKey || i.metaKey, q = i.key.length === 1;
|
|
223
|
-
R && (i.key === "Tab" && i.preventDefault(), !P && q && Ze(i.key));
|
|
224
|
-
const J = V.current;
|
|
225
|
-
if (i.target !== J || !pt.includes(i.key)) return;
|
|
226
|
-
i.preventDefault();
|
|
227
|
-
const A = ie().filter((b) => !b.disabled).map((b) => b.ref.current);
|
|
228
|
-
_e.includes(i.key) && A.reverse(), Nt(A);
|
|
229
|
-
}),
|
|
230
|
-
onBlur: h(e.onBlur, (i) => {
|
|
231
|
-
i.currentTarget.contains(i.target) || (window.clearTimeout(Y.current), X.current = "");
|
|
232
|
-
}),
|
|
233
|
-
onPointerMove: h(
|
|
234
|
-
e.onPointerMove,
|
|
235
|
-
k((i) => {
|
|
236
|
-
const g = i.target, R = $.current !== i.clientX;
|
|
237
|
-
if (i.currentTarget.contains(g) && R) {
|
|
238
|
-
const P = i.clientX > $.current ? "right" : "left";
|
|
239
|
-
de.current = P, $.current = i.clientX;
|
|
240
|
-
}
|
|
241
|
-
})
|
|
242
|
-
)
|
|
243
|
-
}
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
)
|
|
121
|
+
onFocus: p(e.onFocus, () => u.onItemFocus(m)),
|
|
122
|
+
onKeyDown: p(e.onKeyDown, (t) => {
|
|
123
|
+
if (t.key === "Tab" && t.shiftKey) {
|
|
124
|
+
u.onItemShiftTab();
|
|
125
|
+
return;
|
|
247
126
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
(e, n) => {
|
|
265
|
-
const { __scopeMenu: t, ...o } = e;
|
|
266
|
-
return /* @__PURE__ */ u(F.div, { ...o, ref: n });
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
ye.displayName = yt;
|
|
270
|
-
var j = "MenuItem", he = "menu.itemSelect", z = r.forwardRef(
|
|
271
|
-
(e, n) => {
|
|
272
|
-
const { disabled: t = !1, onSelect: o, ...s } = e, a = r.useRef(null), l = G(j, e.__scopeMenu), p = oe(j, e.__scopeMenu), M = N(n, a), m = r.useRef(!1), f = () => {
|
|
273
|
-
const c = a.current;
|
|
274
|
-
if (!t && c) {
|
|
275
|
-
const d = new CustomEvent(he, { bubbles: !0, cancelable: !0 });
|
|
276
|
-
c.addEventListener(he, (C) => o == null ? void 0 : o(C), { once: !0 }), st(c, d), d.defaultPrevented ? m.current = !1 : l.onClose();
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
return /* @__PURE__ */ u(
|
|
280
|
-
xe,
|
|
281
|
-
{
|
|
282
|
-
...s,
|
|
283
|
-
ref: M,
|
|
284
|
-
disabled: t,
|
|
285
|
-
onClick: h(e.onClick, f),
|
|
286
|
-
onPointerDown: (c) => {
|
|
287
|
-
var d;
|
|
288
|
-
(d = e.onPointerDown) == null || d.call(e, c), m.current = !0;
|
|
289
|
-
},
|
|
290
|
-
onPointerUp: h(e.onPointerUp, (c) => {
|
|
291
|
-
var d;
|
|
292
|
-
m.current || (d = c.currentTarget) == null || d.click();
|
|
293
|
-
}),
|
|
294
|
-
onKeyDown: h(e.onKeyDown, (c) => {
|
|
295
|
-
const d = p.searchRef.current !== "";
|
|
296
|
-
t || d && c.key === " " || Q.includes(c.key) && (c.currentTarget.click(), c.preventDefault());
|
|
297
|
-
})
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
z.displayName = j;
|
|
303
|
-
var xe = r.forwardRef(
|
|
304
|
-
(e, n) => {
|
|
305
|
-
const { __scopeMenu: t, disabled: o = !1, textValue: s, ...a } = e, l = oe(j, t), p = Re(t), M = r.useRef(null), m = N(n, M), [f, c] = r.useState(!1), [d, C] = r.useState("");
|
|
306
|
-
return r.useEffect(() => {
|
|
307
|
-
const v = M.current;
|
|
308
|
-
v && C((v.textContent ?? "").trim());
|
|
309
|
-
}, [a.children]), /* @__PURE__ */ u(
|
|
310
|
-
D.ItemSlot,
|
|
311
|
-
{
|
|
312
|
-
scope: t,
|
|
313
|
-
disabled: o,
|
|
314
|
-
textValue: s ?? d,
|
|
315
|
-
children: /* @__PURE__ */ u(ut, { asChild: !0, ...p, focusable: !o, children: /* @__PURE__ */ u(
|
|
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
|
-
...a,
|
|
323
|
-
ref: m,
|
|
324
|
-
onPointerMove: h(
|
|
325
|
-
e.onPointerMove,
|
|
326
|
-
k((v) => {
|
|
327
|
-
o ? l.onItemLeave(v) : (l.onItemEnter(v), v.defaultPrevented || v.currentTarget.focus({ preventScroll: !0 }));
|
|
328
|
-
})
|
|
329
|
-
),
|
|
330
|
-
onPointerLeave: h(
|
|
331
|
-
e.onPointerLeave,
|
|
332
|
-
k((v) => l.onItemLeave(v))
|
|
333
|
-
),
|
|
334
|
-
onFocus: h(e.onFocus, () => c(!0)),
|
|
335
|
-
onBlur: h(e.onBlur, () => c(!1))
|
|
336
|
-
}
|
|
337
|
-
) })
|
|
338
|
-
}
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
), xt = "MenuCheckboxItem", be = r.forwardRef(
|
|
342
|
-
(e, n) => {
|
|
343
|
-
const { checked: t = !1, onCheckedChange: o, ...s } = e;
|
|
344
|
-
return /* @__PURE__ */ u(ke, { scope: e.__scopeMenu, checked: t, children: /* @__PURE__ */ u(
|
|
345
|
-
z,
|
|
346
|
-
{
|
|
347
|
-
role: "menuitemcheckbox",
|
|
348
|
-
"aria-checked": H(t) ? "mixed" : t,
|
|
349
|
-
...s,
|
|
350
|
-
ref: n,
|
|
351
|
-
"data-state": ue(t),
|
|
352
|
-
onSelect: h(
|
|
353
|
-
s.onSelect,
|
|
354
|
-
() => o == null ? void 0 : o(H(t) ? !0 : !t),
|
|
355
|
-
{ checkForDefaultPrevented: !1 }
|
|
356
|
-
)
|
|
357
|
-
}
|
|
358
|
-
) });
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
be.displayName = xt;
|
|
362
|
-
var Te = "MenuRadioGroup", [bt, Tt] = I(
|
|
363
|
-
Te,
|
|
364
|
-
{ value: void 0, onValueChange: () => {
|
|
365
|
-
} }
|
|
366
|
-
), Ae = r.forwardRef(
|
|
367
|
-
(e, n) => {
|
|
368
|
-
const { value: t, onValueChange: o, ...s } = e, a = ee(o);
|
|
369
|
-
return /* @__PURE__ */ u(bt, { scope: e.__scopeMenu, value: t, onValueChange: a, children: /* @__PURE__ */ u(ce, { ...s, ref: n }) });
|
|
370
|
-
}
|
|
371
|
-
);
|
|
372
|
-
Ae.displayName = Te;
|
|
373
|
-
var Oe = "MenuRadioItem", De = r.forwardRef(
|
|
374
|
-
(e, n) => {
|
|
375
|
-
const { value: t, ...o } = e, s = Tt(Oe, e.__scopeMenu), a = t === s.value;
|
|
376
|
-
return /* @__PURE__ */ u(ke, { scope: e.__scopeMenu, checked: a, children: /* @__PURE__ */ u(
|
|
377
|
-
z,
|
|
378
|
-
{
|
|
379
|
-
role: "menuitemradio",
|
|
380
|
-
"aria-checked": a,
|
|
381
|
-
...o,
|
|
382
|
-
ref: n,
|
|
383
|
-
"data-state": ue(a),
|
|
384
|
-
onSelect: h(
|
|
385
|
-
o.onSelect,
|
|
386
|
-
() => {
|
|
387
|
-
var l;
|
|
388
|
-
return (l = s.onValueChange) == null ? void 0 : l.call(s, t);
|
|
389
|
-
},
|
|
390
|
-
{ checkForDefaultPrevented: !1 }
|
|
391
|
-
)
|
|
392
|
-
}
|
|
393
|
-
) });
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
De.displayName = Oe;
|
|
397
|
-
var ae = "MenuItemIndicator", [ke, At] = I(
|
|
398
|
-
ae,
|
|
399
|
-
{ checked: !1 }
|
|
400
|
-
), Ne = r.forwardRef(
|
|
401
|
-
(e, n) => {
|
|
402
|
-
const { __scopeMenu: t, forceMount: o, ...s } = e, a = At(ae, t);
|
|
403
|
-
return /* @__PURE__ */ u(
|
|
404
|
-
W,
|
|
405
|
-
{
|
|
406
|
-
present: o || H(a.checked) || a.checked === !0,
|
|
407
|
-
children: /* @__PURE__ */ u(
|
|
408
|
-
F.span,
|
|
409
|
-
{
|
|
410
|
-
...s,
|
|
411
|
-
ref: n,
|
|
412
|
-
"data-state": ue(a.checked)
|
|
127
|
+
if (t.target !== t.currentTarget) return;
|
|
128
|
+
const i = ce(t, u.orientation, u.dir);
|
|
129
|
+
if (i !== void 0) {
|
|
130
|
+
if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey) return;
|
|
131
|
+
t.preventDefault();
|
|
132
|
+
let a = F().filter((l) => l.focusable).map((l) => l.ref.current);
|
|
133
|
+
if (i === "last") a.reverse();
|
|
134
|
+
else if (i === "prev" || i === "next") {
|
|
135
|
+
i === "prev" && a.reverse();
|
|
136
|
+
const l = a.indexOf(t.currentTarget);
|
|
137
|
+
a = u.loop ? se(a, l + 1) : a.slice(l + 1);
|
|
138
|
+
}
|
|
139
|
+
setTimeout(() => k(a));
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
children: typeof v == "function" ? v({ isCurrentTabStop: b, hasTabStop: E != null }) : v
|
|
413
143
|
}
|
|
414
144
|
)
|
|
415
145
|
}
|
|
416
146
|
);
|
|
417
147
|
}
|
|
418
148
|
);
|
|
419
|
-
|
|
420
|
-
var
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
ref: n
|
|
430
|
-
}
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
);
|
|
434
|
-
Fe.displayName = Ot;
|
|
435
|
-
var Dt = "MenuArrow", Le = r.forwardRef(
|
|
436
|
-
(e, n) => {
|
|
437
|
-
const { __scopeMenu: t, ...o } = e, s = K(t);
|
|
438
|
-
return /* @__PURE__ */ u(ct, { ...s, ...o, ref: n });
|
|
439
|
-
}
|
|
440
|
-
);
|
|
441
|
-
Le.displayName = Dt;
|
|
442
|
-
var se = "MenuSub", [kt, Ke] = I(se), Ge = (e) => {
|
|
443
|
-
const { __scopeMenu: n, children: t, open: o = !1, onOpenChange: s } = e, a = E(se, n), l = K(n), [p, M] = r.useState(null), [m, f] = r.useState(null), c = ee(s);
|
|
444
|
-
return r.useEffect(() => (a.open === !1 && c(!1), () => c(!1)), [a.open, c]), /* @__PURE__ */ u(Ce, { ...l, children: /* @__PURE__ */ u(
|
|
445
|
-
Se,
|
|
446
|
-
{
|
|
447
|
-
scope: n,
|
|
448
|
-
open: o,
|
|
449
|
-
onOpenChange: c,
|
|
450
|
-
content: m,
|
|
451
|
-
onContentChange: f,
|
|
452
|
-
children: /* @__PURE__ */ u(
|
|
453
|
-
kt,
|
|
454
|
-
{
|
|
455
|
-
scope: n,
|
|
456
|
-
contentId: Me(),
|
|
457
|
-
triggerId: Me(),
|
|
458
|
-
trigger: p,
|
|
459
|
-
onTriggerChange: M,
|
|
460
|
-
children: t
|
|
461
|
-
}
|
|
462
|
-
)
|
|
463
|
-
}
|
|
464
|
-
) });
|
|
149
|
+
M.displayName = K;
|
|
150
|
+
var re = {
|
|
151
|
+
ArrowLeft: "prev",
|
|
152
|
+
ArrowUp: "prev",
|
|
153
|
+
ArrowRight: "next",
|
|
154
|
+
ArrowDown: "next",
|
|
155
|
+
PageUp: "first",
|
|
156
|
+
Home: "first",
|
|
157
|
+
PageDown: "last",
|
|
158
|
+
End: "last"
|
|
465
159
|
};
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
(e, n) => {
|
|
469
|
-
const t = E(O, e.__scopeMenu), o = G(O, e.__scopeMenu), s = Ke(O, e.__scopeMenu), a = oe(O, e.__scopeMenu), l = r.useRef(null), { pointerGraceTimerRef: p, onPointerGraceIntentChange: M } = a, m = { __scopeMenu: e.__scopeMenu }, f = r.useCallback(() => {
|
|
470
|
-
l.current && window.clearTimeout(l.current), l.current = null;
|
|
471
|
-
}, []);
|
|
472
|
-
return r.useEffect(() => f, [f]), r.useEffect(() => {
|
|
473
|
-
const c = p.current;
|
|
474
|
-
return () => {
|
|
475
|
-
window.clearTimeout(c), M(null);
|
|
476
|
-
};
|
|
477
|
-
}, [p, M]), /* @__PURE__ */ u(te, { asChild: !0, ...m, children: /* @__PURE__ */ u(
|
|
478
|
-
xe,
|
|
479
|
-
{
|
|
480
|
-
id: s.triggerId,
|
|
481
|
-
"aria-haspopup": "menu",
|
|
482
|
-
"aria-expanded": t.open,
|
|
483
|
-
"aria-controls": s.contentId,
|
|
484
|
-
"data-state": Ye(t.open),
|
|
485
|
-
...e,
|
|
486
|
-
ref: qe(n, s.onTriggerChange),
|
|
487
|
-
onClick: (c) => {
|
|
488
|
-
var d;
|
|
489
|
-
(d = e.onClick) == null || d.call(e, c), !(e.disabled || c.defaultPrevented) && (c.currentTarget.focus(), t.open || t.onOpenChange(!0));
|
|
490
|
-
},
|
|
491
|
-
onPointerMove: h(
|
|
492
|
-
e.onPointerMove,
|
|
493
|
-
k((c) => {
|
|
494
|
-
a.onItemEnter(c), !c.defaultPrevented && !e.disabled && !t.open && !l.current && (a.onPointerGraceIntentChange(null), l.current = window.setTimeout(() => {
|
|
495
|
-
t.onOpenChange(!0), f();
|
|
496
|
-
}, 100));
|
|
497
|
-
})
|
|
498
|
-
),
|
|
499
|
-
onPointerLeave: h(
|
|
500
|
-
e.onPointerLeave,
|
|
501
|
-
k((c) => {
|
|
502
|
-
var C, v;
|
|
503
|
-
f();
|
|
504
|
-
const d = (C = t.content) == null ? void 0 : C.getBoundingClientRect();
|
|
505
|
-
if (d) {
|
|
506
|
-
const w = (v = t.content) == null ? void 0 : v.dataset.side, y = w === "right", T = y ? -5 : 5, U = d[y ? "left" : "right"], B = d[y ? "right" : "left"];
|
|
507
|
-
a.onPointerGraceIntentChange({
|
|
508
|
-
area: [
|
|
509
|
-
// Apply a bleed on clientX to ensure that our exit point is
|
|
510
|
-
// consistently within polygon bounds
|
|
511
|
-
{ x: c.clientX + T, y: c.clientY },
|
|
512
|
-
{ x: U, y: d.top },
|
|
513
|
-
{ x: B, y: d.top },
|
|
514
|
-
{ x: B, y: d.bottom },
|
|
515
|
-
{ x: U, y: d.bottom }
|
|
516
|
-
],
|
|
517
|
-
side: w
|
|
518
|
-
}), window.clearTimeout(p.current), p.current = window.setTimeout(
|
|
519
|
-
() => a.onPointerGraceIntentChange(null),
|
|
520
|
-
300
|
|
521
|
-
);
|
|
522
|
-
} else {
|
|
523
|
-
if (a.onTriggerLeave(c), c.defaultPrevented) return;
|
|
524
|
-
a.onPointerGraceIntentChange(null);
|
|
525
|
-
}
|
|
526
|
-
})
|
|
527
|
-
),
|
|
528
|
-
onKeyDown: h(e.onKeyDown, (c) => {
|
|
529
|
-
var C;
|
|
530
|
-
const d = a.searchRef.current !== "";
|
|
531
|
-
e.disabled || d && c.key === " " || Mt[o.dir].includes(c.key) && (t.onOpenChange(!0), (C = t.content) == null || C.focus(), c.preventDefault());
|
|
532
|
-
})
|
|
533
|
-
}
|
|
534
|
-
) });
|
|
535
|
-
}
|
|
536
|
-
);
|
|
537
|
-
Ue.displayName = O;
|
|
538
|
-
var Be = "MenuSubContent", Ve = r.forwardRef(
|
|
539
|
-
(e, n) => {
|
|
540
|
-
const t = Ee(_, e.__scopeMenu), { forceMount: o = t.forceMount, ...s } = e, a = E(_, e.__scopeMenu), l = G(_, e.__scopeMenu), p = Ke(Be, e.__scopeMenu), M = r.useRef(null), m = N(n, M);
|
|
541
|
-
return /* @__PURE__ */ u(D.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ u(W, { present: o || a.open, children: /* @__PURE__ */ u(D.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ u(
|
|
542
|
-
re,
|
|
543
|
-
{
|
|
544
|
-
id: p.contentId,
|
|
545
|
-
"aria-labelledby": p.triggerId,
|
|
546
|
-
...s,
|
|
547
|
-
ref: m,
|
|
548
|
-
align: "start",
|
|
549
|
-
side: l.dir === "rtl" ? "left" : "right",
|
|
550
|
-
disableOutsidePointerEvents: !1,
|
|
551
|
-
disableOutsideScroll: !1,
|
|
552
|
-
trapFocus: !1,
|
|
553
|
-
onOpenAutoFocus: (f) => {
|
|
554
|
-
var c;
|
|
555
|
-
l.isUsingKeyboardRef.current && ((c = M.current) == null || c.focus()), f.preventDefault();
|
|
556
|
-
},
|
|
557
|
-
onCloseAutoFocus: (f) => f.preventDefault(),
|
|
558
|
-
onFocusOutside: h(e.onFocusOutside, (f) => {
|
|
559
|
-
f.target !== p.trigger && a.onOpenChange(!1);
|
|
560
|
-
}),
|
|
561
|
-
onEscapeKeyDown: h(e.onEscapeKeyDown, (f) => {
|
|
562
|
-
l.onClose(), f.preventDefault();
|
|
563
|
-
}),
|
|
564
|
-
onKeyDown: h(e.onKeyDown, (f) => {
|
|
565
|
-
var C;
|
|
566
|
-
const c = f.currentTarget.contains(f.target), d = ht[l.dir].includes(f.key);
|
|
567
|
-
c && d && (a.onOpenChange(!1), (C = p.trigger) == null || C.focus(), f.preventDefault());
|
|
568
|
-
})
|
|
569
|
-
}
|
|
570
|
-
) }) }) });
|
|
571
|
-
}
|
|
572
|
-
);
|
|
573
|
-
Ve.displayName = Be;
|
|
574
|
-
function Ye(e) {
|
|
575
|
-
return e ? "open" : "closed";
|
|
576
|
-
}
|
|
577
|
-
function H(e) {
|
|
578
|
-
return e === "indeterminate";
|
|
579
|
-
}
|
|
580
|
-
function ue(e) {
|
|
581
|
-
return H(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
160
|
+
function ne(e, r) {
|
|
161
|
+
return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
582
162
|
}
|
|
583
|
-
function
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
function Ft(e, n) {
|
|
589
|
-
return e.map((t, o) => e[(n + o) % e.length]);
|
|
590
|
-
}
|
|
591
|
-
function Lt(e, n, t) {
|
|
592
|
-
const s = n.length > 1 && Array.from(n).every((m) => m === n[0]) ? n[0] : n, a = t ? e.indexOf(t) : -1;
|
|
593
|
-
let l = Ft(e, Math.max(a, 0));
|
|
594
|
-
s.length === 1 && (l = l.filter((m) => m !== t));
|
|
595
|
-
const M = l.find(
|
|
596
|
-
(m) => m.toLowerCase().startsWith(s.toLowerCase())
|
|
597
|
-
);
|
|
598
|
-
return M !== t ? M : void 0;
|
|
599
|
-
}
|
|
600
|
-
function Kt(e, n) {
|
|
601
|
-
const { x: t, y: o } = e;
|
|
602
|
-
let s = !1;
|
|
603
|
-
for (let a = 0, l = n.length - 1; a < n.length; l = a++) {
|
|
604
|
-
const p = n[a], M = n[l], m = p.x, f = p.y, c = M.x, d = M.y;
|
|
605
|
-
f > o != d > o && t < (c - m) * (o - f) / (d - f) + m && (s = !s);
|
|
606
|
-
}
|
|
607
|
-
return s;
|
|
163
|
+
function ce(e, r, s) {
|
|
164
|
+
const o = ne(e.key, s);
|
|
165
|
+
if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
|
|
166
|
+
return re[o];
|
|
608
167
|
}
|
|
609
|
-
function
|
|
610
|
-
|
|
611
|
-
const
|
|
612
|
-
|
|
168
|
+
function k(e, r = !1) {
|
|
169
|
+
const s = document.activeElement;
|
|
170
|
+
for (const o of e)
|
|
171
|
+
if (o === s || (o.focus({ preventScroll: r }), document.activeElement !== s)) return;
|
|
613
172
|
}
|
|
614
|
-
function
|
|
615
|
-
return (
|
|
173
|
+
function se(e, r) {
|
|
174
|
+
return e.map((s, o) => e[(r + o) % e.length]);
|
|
616
175
|
}
|
|
617
|
-
var
|
|
176
|
+
var ge = O, Re = M;
|
|
618
177
|
export {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
mn as Item,
|
|
625
|
-
vn as ItemIndicator,
|
|
626
|
-
fn as Label,
|
|
627
|
-
Pe as Menu,
|
|
628
|
-
te as MenuAnchor,
|
|
629
|
-
Le as MenuArrow,
|
|
630
|
-
be as MenuCheckboxItem,
|
|
631
|
-
Ie as MenuContent,
|
|
632
|
-
ce as MenuGroup,
|
|
633
|
-
z as MenuItem,
|
|
634
|
-
Ne as MenuItemIndicator,
|
|
635
|
-
ye as MenuLabel,
|
|
636
|
-
we as MenuPortal,
|
|
637
|
-
Ae as MenuRadioGroup,
|
|
638
|
-
De as MenuRadioItem,
|
|
639
|
-
Fe as MenuSeparator,
|
|
640
|
-
Ge as MenuSub,
|
|
641
|
-
Ve as MenuSubContent,
|
|
642
|
-
Ue as MenuSubTrigger,
|
|
643
|
-
un as Portal,
|
|
644
|
-
Mn as RadioGroup,
|
|
645
|
-
hn as RadioItem,
|
|
646
|
-
an as Root,
|
|
647
|
-
Cn as Separator,
|
|
648
|
-
_n as Sub,
|
|
649
|
-
Sn as SubContent,
|
|
650
|
-
Rn as SubTrigger,
|
|
651
|
-
cn as createMenuScope
|
|
178
|
+
Re as Item,
|
|
179
|
+
ge as Root,
|
|
180
|
+
O as RovingFocusGroup,
|
|
181
|
+
M as RovingFocusGroupItem,
|
|
182
|
+
Fe as createRovingFocusGroupScope
|
|
652
183
|
};
|