@component-labs/ui 0.0.1
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/HMKTUWOU-DlOdK4rt.js +25 -0
- package/dist/HMKTUWOU-DlOdK4rt.js.map +1 -0
- package/dist/HOITXJDS-DBccNHOl.js +48 -0
- package/dist/HOITXJDS-DBccNHOl.js.map +1 -0
- package/dist/I7KWAPMF-CcAk8kiH.js +86 -0
- package/dist/I7KWAPMF-CcAk8kiH.js.map +1 -0
- package/dist/IQYAUKXT-CoP_Jrsi.js +546 -0
- package/dist/IQYAUKXT-CoP_Jrsi.js.map +1 -0
- package/dist/PZ3OL7I2-h7WHitqi.js +61 -0
- package/dist/PZ3OL7I2-h7WHitqi.js.map +1 -0
- package/dist/Provider.d.ts +8 -0
- package/dist/Provider.d.ts.map +1 -0
- package/dist/Q5W46E73-DjlVG3LH.js +353 -0
- package/dist/Q5W46E73-DjlVG3LH.js.map +1 -0
- package/dist/U6HHPQDW-BkT6kvCd.js +888 -0
- package/dist/U6HHPQDW-BkT6kvCd.js.map +1 -0
- package/dist/X6LNAU2F-DroCIVyL.js +1692 -0
- package/dist/X6LNAU2F-DroCIVyL.js.map +1 -0
- package/dist/Z32PU2LQ-CPSDShGU.js +1116 -0
- package/dist/Z32PU2LQ-CPSDShGU.js.map +1 -0
- package/dist/button.d.ts +4 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +252 -0
- package/dist/button.js.map +1 -0
- package/dist/checkbox.d.ts +4 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +210 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/combobox.d.ts +4 -0
- package/dist/combobox.d.ts.map +1 -0
- package/dist/combobox.js +948 -0
- package/dist/combobox.js.map +1 -0
- package/dist/components/button/Button.d.ts +26 -0
- package/dist/components/button/Button.d.ts.map +1 -0
- package/dist/components/button/Button.docs.d.ts +4 -0
- package/dist/components/button/Button.docs.d.ts.map +1 -0
- package/dist/components/button/Button.showcase.d.ts +40 -0
- package/dist/components/button/Button.showcase.d.ts.map +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +19 -0
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/Checkbox.docs.d.ts +4 -0
- package/dist/components/checkbox/Checkbox.docs.d.ts.map +1 -0
- package/dist/components/checkbox/Checkbox.showcase.d.ts +35 -0
- package/dist/components/checkbox/Checkbox.showcase.d.ts.map +1 -0
- package/dist/components/combobox/Combobox.d.ts +36 -0
- package/dist/components/combobox/Combobox.d.ts.map +1 -0
- package/dist/components/combobox/Combobox.docs.d.ts +4 -0
- package/dist/components/combobox/Combobox.docs.d.ts.map +1 -0
- package/dist/components/combobox/Combobox.showcase.d.ts +43 -0
- package/dist/components/combobox/Combobox.showcase.d.ts.map +1 -0
- package/dist/components/data-table/DataTable.d.ts +86 -0
- package/dist/components/data-table/DataTable.d.ts.map +1 -0
- package/dist/components/data-table/DataTable.docs.d.ts +4 -0
- package/dist/components/data-table/DataTable.docs.d.ts.map +1 -0
- package/dist/components/data-table/DataTable.showcase.d.ts +36 -0
- package/dist/components/data-table/DataTable.showcase.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.d.ts +1 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.d.ts +56 -0
- package/dist/components/dialog/Dialog.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.docs.d.ts +4 -0
- package/dist/components/dialog/Dialog.docs.d.ts.map +1 -0
- package/dist/components/input/Input.d.ts +22 -0
- package/dist/components/input/Input.d.ts.map +1 -0
- package/dist/components/input/Input.docs.d.ts +4 -0
- package/dist/components/input/Input.docs.d.ts.map +1 -0
- package/dist/components/menu/Menu.d.ts +41 -0
- package/dist/components/menu/Menu.d.ts.map +1 -0
- package/dist/components/menu/Menu.docs.d.ts +4 -0
- package/dist/components/menu/Menu.docs.d.ts.map +1 -0
- package/dist/components/menu/Menu.showcase.d.ts +43 -0
- package/dist/components/menu/Menu.showcase.d.ts.map +1 -0
- package/dist/components/slider/date-picker.d.ts +1 -0
- package/dist/components/slider/date-picker.d.ts.map +1 -0
- package/dist/components/sub-menu/date-picker.d.ts +1 -0
- package/dist/components/sub-menu/date-picker.d.ts.map +1 -0
- package/dist/components/switch/Switch.d.ts +17 -0
- package/dist/components/switch/Switch.d.ts.map +1 -0
- package/dist/components/switch/Switch.docs.d.ts +4 -0
- package/dist/components/switch/Switch.docs.d.ts.map +1 -0
- package/dist/components/toast/date-picker.d.ts +1 -0
- package/dist/components/toast/date-picker.d.ts.map +1 -0
- package/dist/data-table.d.ts +4 -0
- package/dist/data-table.d.ts.map +1 -0
- package/dist/data-table.js +298 -0
- package/dist/data-table.js.map +1 -0
- package/dist/dialog.d.ts +4 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +323 -0
- package/dist/dialog.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +230 -0
- package/dist/input.js.map +1 -0
- package/dist/lib/IntersectionObserver.d.ts +30 -0
- package/dist/lib/IntersectionObserver.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/menu.d.ts +4 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +1335 -0
- package/dist/menu.js.map +1 -0
- package/dist/switch.d.ts +4 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.js +194 -0
- package/dist/switch.js.map +1 -0
- package/dist/types/docs.d.ts +24 -0
- package/dist/types/docs.d.ts.map +1 -0
- package/dist/utils-BZvHF7th.js +2806 -0
- package/dist/utils-BZvHF7th.js.map +1 -0
- package/package.json +98 -0
- package/src/styles.css +91 -0
package/dist/menu.js
ADDED
|
@@ -0,0 +1,1335 @@
|
|
|
1
|
+
import { jsx as P, jsxs as Pe } from "react/jsx-runtime";
|
|
2
|
+
import { P as Ee, m as vt, i as gt, j as ht, k as bt, n as Mt, a as Ct, o as xt, c as yt, d as wt, u as St } from "./X6LNAU2F-DroCIVyL.js";
|
|
3
|
+
import { c as E, f as k, a as T, i as R, E as me, K as pt, L as ke, k as Y, G as Ce, M as W, N as Pt, h as Et, w as oe, m as U, p as Te, O as le, d as V, P as q, Q as Ie, R as kt, F as L, S as Tt, o as Ae, C as De, D as Ne, T as It, y as At, U as Dt, t as Nt, j as Fe, l as Oe, V as Ft, W as Re, x as He, z as Ot, A as Rt, X as Ht, Y as Lt, Z as Vt } from "./U6HHPQDW-BkT6kvCd.js";
|
|
4
|
+
import { g as Le, C as Ve, a as _e, h as _t, u as Bt, c as $t, d as Kt } from "./IQYAUKXT-CoP_Jrsi.js";
|
|
5
|
+
import { useRef as K, useState as Q, useEffect as O, useContext as Be, createContext as fe, useCallback as $e, useMemo as Ke, createRef as jt, forwardRef as Z } from "react";
|
|
6
|
+
import { c as je, e as zt, f as Wt, i as qt, R as Ut } from "./Z32PU2LQ-CPSDShGU.js";
|
|
7
|
+
import { s as de, c as ve, f as X, t as ze, e as We, a as z, m as Gt, o as Xt, p as Yt, b as xe } from "./Q5W46E73-DjlVG3LH.js";
|
|
8
|
+
import { u as Qt } from "./HMKTUWOU-DlOdK4rt.js";
|
|
9
|
+
import { u as Zt } from "./HOITXJDS-DBccNHOl.js";
|
|
10
|
+
import { u as Jt } from "./I7KWAPMF-CcAk8kiH.js";
|
|
11
|
+
import { c as J, a as ue } from "./utils-BZvHF7th.js";
|
|
12
|
+
var en = "hr", qe = E(
|
|
13
|
+
function({ orientation: e = "horizontal", ...t }) {
|
|
14
|
+
return t = {
|
|
15
|
+
role: "separator",
|
|
16
|
+
"aria-orientation": e,
|
|
17
|
+
...t
|
|
18
|
+
}, t;
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
k(function(e) {
|
|
22
|
+
const t = qe(e);
|
|
23
|
+
return T(en, t);
|
|
24
|
+
});
|
|
25
|
+
var tn = "hr", Ue = E(function({ store: e, ...t }) {
|
|
26
|
+
const r = Le();
|
|
27
|
+
e = e || r, R(
|
|
28
|
+
e,
|
|
29
|
+
process.env.NODE_ENV !== "production" && "CompositeSeparator must be wrapped in a Composite component."
|
|
30
|
+
);
|
|
31
|
+
const o = e.useState(
|
|
32
|
+
(u) => u.orientation === "horizontal" ? "vertical" : "horizontal"
|
|
33
|
+
);
|
|
34
|
+
return t = qe({ ...t, orientation: o }), t;
|
|
35
|
+
});
|
|
36
|
+
k(function(e) {
|
|
37
|
+
const t = Ue(e);
|
|
38
|
+
return T(tn, t);
|
|
39
|
+
});
|
|
40
|
+
var ee = me(
|
|
41
|
+
[vt],
|
|
42
|
+
[Ee]
|
|
43
|
+
);
|
|
44
|
+
ee.useContext;
|
|
45
|
+
ee.useScopedContext;
|
|
46
|
+
var ge = ee.useProviderContext, nn = ee.ContextProvider, Ge = ee.ScopedContextProvider;
|
|
47
|
+
function ae(n) {
|
|
48
|
+
return [n.clientX, n.clientY];
|
|
49
|
+
}
|
|
50
|
+
function ye(n, e) {
|
|
51
|
+
const [t, r] = n;
|
|
52
|
+
let o = !1;
|
|
53
|
+
const u = e.length;
|
|
54
|
+
for (let i = u, a = 0, c = i - 1; a < i; c = a++) {
|
|
55
|
+
const [s, d] = e[a], [l, v] = e[c], [, f] = e[c === 0 ? i - 1 : c - 1] || [0, 0], h = (d - v) * (t - s) - (s - l) * (r - d);
|
|
56
|
+
if (v < d) {
|
|
57
|
+
if (r >= v && r < d) {
|
|
58
|
+
if (h === 0) return !0;
|
|
59
|
+
h > 0 && (r === v ? r > f && (o = !o) : o = !o);
|
|
60
|
+
}
|
|
61
|
+
} else if (d < v) {
|
|
62
|
+
if (r > d && r <= v) {
|
|
63
|
+
if (h === 0) return !0;
|
|
64
|
+
h < 0 && (r === v ? r < f && (o = !o) : o = !o);
|
|
65
|
+
}
|
|
66
|
+
} else if (r === d && (t >= l && t <= s || t >= s && t <= l))
|
|
67
|
+
return !0;
|
|
68
|
+
}
|
|
69
|
+
return o;
|
|
70
|
+
}
|
|
71
|
+
function rn(n, e) {
|
|
72
|
+
const { top: t, right: r, bottom: o, left: u } = e, [i, a] = n, c = i < u ? "left" : i > r ? "right" : null, s = a < t ? "top" : a > o ? "bottom" : null;
|
|
73
|
+
return [c, s];
|
|
74
|
+
}
|
|
75
|
+
function we(n, e) {
|
|
76
|
+
const t = n.getBoundingClientRect(), { top: r, right: o, bottom: u, left: i } = t, [a, c] = rn(e, t), s = [e];
|
|
77
|
+
return a ? (c !== "top" && s.push([a === "left" ? i : o, r]), s.push([a === "left" ? o : i, r]), s.push([a === "left" ? o : i, u]), c !== "bottom" && s.push([a === "left" ? i : o, u])) : c === "top" ? (s.push([i, r]), s.push([i, u]), s.push([o, u]), s.push([o, r])) : (s.push([i, u]), s.push([i, r]), s.push([o, r]), s.push([o, u])), s;
|
|
78
|
+
}
|
|
79
|
+
var on = "div";
|
|
80
|
+
function Xe(n, e, t, r) {
|
|
81
|
+
return q(e) ? !0 : n ? !!(le(e, n) || t && le(t, n) || r != null && r.some((o) => Xe(n, o, t))) : !1;
|
|
82
|
+
}
|
|
83
|
+
function un({
|
|
84
|
+
store: n,
|
|
85
|
+
...e
|
|
86
|
+
}) {
|
|
87
|
+
const [t, r] = Q(!1), o = n.useState("mounted");
|
|
88
|
+
O(() => {
|
|
89
|
+
o || r(!1);
|
|
90
|
+
}, [o]);
|
|
91
|
+
const u = e.onFocus, i = V((c) => {
|
|
92
|
+
u == null || u(c), !c.defaultPrevented && r(!0);
|
|
93
|
+
}), a = K(null);
|
|
94
|
+
return O(() => de(n, ["anchorElement"], (c) => {
|
|
95
|
+
a.current = c.anchorElement;
|
|
96
|
+
}), []), e = {
|
|
97
|
+
autoFocusOnHide: t,
|
|
98
|
+
finalFocus: a,
|
|
99
|
+
...e,
|
|
100
|
+
onFocus: i
|
|
101
|
+
}, e;
|
|
102
|
+
}
|
|
103
|
+
var Se = fe(null), Ye = E(
|
|
104
|
+
function({
|
|
105
|
+
store: e,
|
|
106
|
+
modal: t = !1,
|
|
107
|
+
portal: r = !!t,
|
|
108
|
+
hideOnEscape: o = !0,
|
|
109
|
+
hideOnHoverOutside: u = !0,
|
|
110
|
+
disablePointerEventsOnApproach: i = !!u,
|
|
111
|
+
...a
|
|
112
|
+
}) {
|
|
113
|
+
const c = ge();
|
|
114
|
+
e = e || c, R(
|
|
115
|
+
e,
|
|
116
|
+
process.env.NODE_ENV !== "production" && "Hovercard must receive a `store` prop or be wrapped in a HovercardProvider component."
|
|
117
|
+
);
|
|
118
|
+
const s = K(null), [d, l] = Q([]), v = K(0), f = K(null), { portalRef: h, domReady: g } = pt(r, a.portalRef), m = ke(), S = !!u, p = Y(u), M = !!i, A = Y(
|
|
119
|
+
i
|
|
120
|
+
), x = e.useState("open"), D = e.useState("mounted");
|
|
121
|
+
O(() => {
|
|
122
|
+
if (!g || !D || !S && !M) return;
|
|
123
|
+
const b = s.current;
|
|
124
|
+
return b ? Ce(
|
|
125
|
+
W("mousemove", (y) => {
|
|
126
|
+
if (!e || !m()) return;
|
|
127
|
+
const { anchorElement: w, hideTimeout: _, timeout: ne } = e.getState(), G = f.current, [j] = y.composedPath(), B = w;
|
|
128
|
+
if (Xe(j, b, B, d)) {
|
|
129
|
+
f.current = j && B && le(B, j) ? ae(y) : null, window.clearTimeout(v.current), v.current = 0;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (!v.current) {
|
|
133
|
+
if (G) {
|
|
134
|
+
const Me = ae(y), ft = we(b, G);
|
|
135
|
+
if (ye(Me, ft)) {
|
|
136
|
+
if (f.current = Me, !A(y)) return;
|
|
137
|
+
y.preventDefault(), y.stopPropagation();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
p(y) && (v.current = window.setTimeout(() => {
|
|
142
|
+
v.current = 0, e == null || e.hide();
|
|
143
|
+
}, _ ?? ne));
|
|
144
|
+
}
|
|
145
|
+
}, !0),
|
|
146
|
+
() => clearTimeout(v.current)
|
|
147
|
+
) : void 0;
|
|
148
|
+
}, [
|
|
149
|
+
e,
|
|
150
|
+
m,
|
|
151
|
+
g,
|
|
152
|
+
D,
|
|
153
|
+
S,
|
|
154
|
+
M,
|
|
155
|
+
d,
|
|
156
|
+
A,
|
|
157
|
+
p
|
|
158
|
+
]), O(() => {
|
|
159
|
+
if (!g || !D || !M) return;
|
|
160
|
+
const b = (N) => {
|
|
161
|
+
const y = s.current;
|
|
162
|
+
if (!y) return;
|
|
163
|
+
const w = f.current;
|
|
164
|
+
if (!w) return;
|
|
165
|
+
const _ = we(y, w);
|
|
166
|
+
if (ye(ae(N), _)) {
|
|
167
|
+
if (!A(N)) return;
|
|
168
|
+
N.preventDefault(), N.stopPropagation();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
return Ce(
|
|
172
|
+
// Note: we may need to add pointer events here in the future.
|
|
173
|
+
W("mouseenter", b, !0),
|
|
174
|
+
W("mouseover", b, !0),
|
|
175
|
+
W("mouseout", b, !0),
|
|
176
|
+
W("mouseleave", b, !0)
|
|
177
|
+
);
|
|
178
|
+
}, [g, D, M, A]), O(() => {
|
|
179
|
+
g && (x || e == null || e.setAutoFocusOnShow(!1));
|
|
180
|
+
}, [e, g, x]);
|
|
181
|
+
const F = Pt(x);
|
|
182
|
+
O(() => {
|
|
183
|
+
if (g)
|
|
184
|
+
return () => {
|
|
185
|
+
F.current || e == null || e.setAutoFocusOnShow(!1);
|
|
186
|
+
};
|
|
187
|
+
}, [e, g]);
|
|
188
|
+
const H = Be(Se);
|
|
189
|
+
Et(() => {
|
|
190
|
+
if (t || !r || !D || !g) return;
|
|
191
|
+
const b = s.current;
|
|
192
|
+
if (b)
|
|
193
|
+
return H == null ? void 0 : H(b);
|
|
194
|
+
}, [t, r, D, g]);
|
|
195
|
+
const C = $e(
|
|
196
|
+
(b) => {
|
|
197
|
+
l((y) => [...y, b]);
|
|
198
|
+
const N = H == null ? void 0 : H(b);
|
|
199
|
+
return () => {
|
|
200
|
+
l(
|
|
201
|
+
(y) => y.filter((w) => w !== b)
|
|
202
|
+
), N == null || N();
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
[H]
|
|
206
|
+
);
|
|
207
|
+
a = oe(
|
|
208
|
+
a,
|
|
209
|
+
(b) => /* @__PURE__ */ P(Ge, { value: e, children: /* @__PURE__ */ P(Se.Provider, { value: C, children: b }) }),
|
|
210
|
+
[e, C]
|
|
211
|
+
), a = {
|
|
212
|
+
...a,
|
|
213
|
+
ref: U(s, a.ref)
|
|
214
|
+
}, a = un({ store: e, ...a });
|
|
215
|
+
const I = e.useState(
|
|
216
|
+
(b) => t || b.autoFocusOnShow
|
|
217
|
+
);
|
|
218
|
+
return a = gt({
|
|
219
|
+
store: e,
|
|
220
|
+
modal: t,
|
|
221
|
+
portal: r,
|
|
222
|
+
autoFocusOnShow: I,
|
|
223
|
+
...a,
|
|
224
|
+
portalRef: h,
|
|
225
|
+
hideOnEscape(b) {
|
|
226
|
+
return Te(o, b) ? !1 : (requestAnimationFrame(() => {
|
|
227
|
+
requestAnimationFrame(() => {
|
|
228
|
+
e == null || e.hide();
|
|
229
|
+
});
|
|
230
|
+
}), !0);
|
|
231
|
+
}
|
|
232
|
+
}), a;
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
je(
|
|
236
|
+
k(function(e) {
|
|
237
|
+
const t = Ye(e);
|
|
238
|
+
return T(on, t);
|
|
239
|
+
}),
|
|
240
|
+
ge
|
|
241
|
+
);
|
|
242
|
+
var an = "a", Qe = E(
|
|
243
|
+
function({ store: e, showOnHover: t = !0, ...r }) {
|
|
244
|
+
const o = ge();
|
|
245
|
+
e = e || o, R(
|
|
246
|
+
e,
|
|
247
|
+
process.env.NODE_ENV !== "production" && "HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component."
|
|
248
|
+
);
|
|
249
|
+
const u = Ie(r), i = K(0);
|
|
250
|
+
O(() => () => window.clearTimeout(i.current), []), O(() => W("mouseleave", (g) => {
|
|
251
|
+
if (!e) return;
|
|
252
|
+
const { anchorElement: m } = e.getState();
|
|
253
|
+
m && g.target === m && (window.clearTimeout(i.current), i.current = 0);
|
|
254
|
+
}, !0), [e]);
|
|
255
|
+
const a = r.onMouseMove, c = Y(t), s = ke(), d = V((h) => {
|
|
256
|
+
if (a == null || a(h), u || !e || h.defaultPrevented || i.current || !s() || !c(h)) return;
|
|
257
|
+
const g = h.currentTarget;
|
|
258
|
+
e.setAnchorElement(g), e.setDisclosureElement(g);
|
|
259
|
+
const { showTimeout: m, timeout: S } = e.getState(), p = () => {
|
|
260
|
+
i.current = 0, s() && (e == null || e.setAnchorElement(g), e == null || e.show(), queueMicrotask(() => {
|
|
261
|
+
e == null || e.setDisclosureElement(g);
|
|
262
|
+
}));
|
|
263
|
+
}, M = m ?? S;
|
|
264
|
+
M === 0 ? p() : i.current = window.setTimeout(p, M);
|
|
265
|
+
}), l = r.onClick, v = V((h) => {
|
|
266
|
+
l == null || l(h), e && (window.clearTimeout(i.current), i.current = 0);
|
|
267
|
+
}), f = $e(
|
|
268
|
+
(h) => {
|
|
269
|
+
if (!e) return;
|
|
270
|
+
const { anchorElement: g } = e.getState();
|
|
271
|
+
g != null && g.isConnected || e.setAnchorElement(h);
|
|
272
|
+
},
|
|
273
|
+
[e]
|
|
274
|
+
);
|
|
275
|
+
return r = {
|
|
276
|
+
...r,
|
|
277
|
+
ref: U(f, r.ref),
|
|
278
|
+
onMouseMove: d,
|
|
279
|
+
onClick: v
|
|
280
|
+
}, r = kt(r), r;
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
k(function(e) {
|
|
284
|
+
const t = Qe(e);
|
|
285
|
+
return T(an, t);
|
|
286
|
+
});
|
|
287
|
+
function cn(n = {}) {
|
|
288
|
+
var e;
|
|
289
|
+
const t = (e = n.store) == null ? void 0 : e.getState(), r = ht({
|
|
290
|
+
...n,
|
|
291
|
+
placement: L(
|
|
292
|
+
n.placement,
|
|
293
|
+
t == null ? void 0 : t.placement,
|
|
294
|
+
"bottom"
|
|
295
|
+
)
|
|
296
|
+
}), o = L(n.timeout, t == null ? void 0 : t.timeout, 500), u = {
|
|
297
|
+
...r.getState(),
|
|
298
|
+
timeout: o,
|
|
299
|
+
showTimeout: L(n.showTimeout, t == null ? void 0 : t.showTimeout),
|
|
300
|
+
hideTimeout: L(n.hideTimeout, t == null ? void 0 : t.hideTimeout),
|
|
301
|
+
autoFocusOnShow: L(t == null ? void 0 : t.autoFocusOnShow, !1)
|
|
302
|
+
}, i = ve(u, r, n.store);
|
|
303
|
+
return {
|
|
304
|
+
...r,
|
|
305
|
+
...i,
|
|
306
|
+
setAutoFocusOnShow: (a) => i.setState("autoFocusOnShow", a)
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function sn(n, e, t) {
|
|
310
|
+
return X(n, t, "timeout"), X(n, t, "showTimeout"), X(n, t, "hideTimeout"), bt(n, e, t);
|
|
311
|
+
}
|
|
312
|
+
var Ze = me(
|
|
313
|
+
[_e],
|
|
314
|
+
[Ve]
|
|
315
|
+
), ln = Ze.useContext, dn = Ze.useScopedContext;
|
|
316
|
+
fe(
|
|
317
|
+
void 0
|
|
318
|
+
);
|
|
319
|
+
var mn = "button", fn = Symbol("disclosure"), Je = E(
|
|
320
|
+
function({ store: e, toggleOnClick: t = !0, ...r }) {
|
|
321
|
+
const o = zt();
|
|
322
|
+
e = e || o, R(
|
|
323
|
+
e,
|
|
324
|
+
process.env.NODE_ENV !== "production" && "Disclosure must receive a `store` prop or be wrapped in a DisclosureProvider component."
|
|
325
|
+
);
|
|
326
|
+
const u = K(null), [i, a] = Q(!1), c = e.useState("disclosureElement"), s = e.useState("open");
|
|
327
|
+
O(() => {
|
|
328
|
+
let m = c === u.current;
|
|
329
|
+
c != null && c.isConnected || (e == null || e.setDisclosureElement(u.current), m = !0), a(s && m);
|
|
330
|
+
}, [c, e, s]);
|
|
331
|
+
const d = r.onClick, l = Y(t), [v, f] = Tt(r, fn, !0), h = V((m) => {
|
|
332
|
+
d == null || d(m), !m.defaultPrevented && (v || l(m) && (e == null || e.setDisclosureElement(m.currentTarget), e == null || e.toggle()));
|
|
333
|
+
}), g = e.useState("contentElement");
|
|
334
|
+
return r = {
|
|
335
|
+
"aria-expanded": i,
|
|
336
|
+
"aria-controls": g == null ? void 0 : g.id,
|
|
337
|
+
...f,
|
|
338
|
+
...r,
|
|
339
|
+
ref: U(u, r.ref),
|
|
340
|
+
onClick: h
|
|
341
|
+
}, r = Qt(r), r;
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
k(function(e) {
|
|
345
|
+
const t = Je(e);
|
|
346
|
+
return T(mn, t);
|
|
347
|
+
});
|
|
348
|
+
var vn = "button", et = E(
|
|
349
|
+
function({ store: e, ...t }) {
|
|
350
|
+
const r = Wt();
|
|
351
|
+
e = e || r, R(
|
|
352
|
+
e,
|
|
353
|
+
process.env.NODE_ENV !== "production" && "DialogDisclosure must receive a `store` prop or be wrapped in a DialogProvider component."
|
|
354
|
+
);
|
|
355
|
+
const o = e.useState("contentElement");
|
|
356
|
+
return t = {
|
|
357
|
+
"aria-haspopup": Ae(o, "dialog"),
|
|
358
|
+
...t
|
|
359
|
+
}, t = Je({ store: e, ...t }), t;
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
k(function(e) {
|
|
363
|
+
const t = et(e);
|
|
364
|
+
return T(vn, t);
|
|
365
|
+
});
|
|
366
|
+
var gn = "button", tt = E(function({ store: e, ...t }) {
|
|
367
|
+
const r = Mt();
|
|
368
|
+
e = e || r, R(
|
|
369
|
+
e,
|
|
370
|
+
process.env.NODE_ENV !== "production" && "PopoverDisclosure must receive a `store` prop or be wrapped in a PopoverProvider component."
|
|
371
|
+
);
|
|
372
|
+
const o = t.onClick, u = V((i) => {
|
|
373
|
+
e == null || e.setAnchorElement(i.currentTarget), o == null || o(i);
|
|
374
|
+
});
|
|
375
|
+
return t = oe(
|
|
376
|
+
t,
|
|
377
|
+
(i) => /* @__PURE__ */ P(Ee, { value: e, children: i }),
|
|
378
|
+
[e]
|
|
379
|
+
), t = {
|
|
380
|
+
...t,
|
|
381
|
+
onClick: u
|
|
382
|
+
}, t = Ct({ store: e, ...t }), t = et({ store: e, ...t }), t;
|
|
383
|
+
});
|
|
384
|
+
k(function(e) {
|
|
385
|
+
const t = tt(e);
|
|
386
|
+
return T(gn, t);
|
|
387
|
+
});
|
|
388
|
+
var hn = "span", bn = {
|
|
389
|
+
top: "4,10 8,6 12,10",
|
|
390
|
+
right: "6,4 10,8 6,12",
|
|
391
|
+
bottom: "4,6 8,10 12,6",
|
|
392
|
+
left: "10,4 6,8 10,12"
|
|
393
|
+
}, nt = E(function({ store: e, placement: t, ...r }) {
|
|
394
|
+
const o = xt();
|
|
395
|
+
e = e || o, R(
|
|
396
|
+
e,
|
|
397
|
+
process.env.NODE_ENV !== "production" && "PopoverDisclosureArrow must be wrapped in a PopoverDisclosure component."
|
|
398
|
+
);
|
|
399
|
+
const i = e.useState((s) => t || s.placement).split("-")[0], a = bn[i];
|
|
400
|
+
return r = {
|
|
401
|
+
children: Ke(
|
|
402
|
+
() => /* @__PURE__ */ P(
|
|
403
|
+
"svg",
|
|
404
|
+
{
|
|
405
|
+
display: "block",
|
|
406
|
+
fill: "none",
|
|
407
|
+
stroke: "currentColor",
|
|
408
|
+
strokeLinecap: "round",
|
|
409
|
+
strokeLinejoin: "round",
|
|
410
|
+
strokeWidth: 1.5,
|
|
411
|
+
viewBox: "0 0 16 16",
|
|
412
|
+
height: "1em",
|
|
413
|
+
width: "1em",
|
|
414
|
+
children: /* @__PURE__ */ P("polyline", { points: a })
|
|
415
|
+
}
|
|
416
|
+
),
|
|
417
|
+
[a]
|
|
418
|
+
),
|
|
419
|
+
"aria-hidden": !0,
|
|
420
|
+
...r,
|
|
421
|
+
style: {
|
|
422
|
+
width: "1em",
|
|
423
|
+
height: "1em",
|
|
424
|
+
pointerEvents: "none",
|
|
425
|
+
...r.style
|
|
426
|
+
}
|
|
427
|
+
}, De(r);
|
|
428
|
+
});
|
|
429
|
+
k(
|
|
430
|
+
function(e) {
|
|
431
|
+
const t = nt(e);
|
|
432
|
+
return T(hn, t);
|
|
433
|
+
}
|
|
434
|
+
);
|
|
435
|
+
var Mn = "div", $ = "";
|
|
436
|
+
function ce() {
|
|
437
|
+
$ = "";
|
|
438
|
+
}
|
|
439
|
+
function Cn(n) {
|
|
440
|
+
const e = n.target;
|
|
441
|
+
return e && At(e) ? !1 : n.key === " " && $.length ? !0 : n.key.length === 1 && !n.ctrlKey && !n.altKey && !n.metaKey && /^[\p{Letter}\p{Number}]$/u.test(n.key);
|
|
442
|
+
}
|
|
443
|
+
function xn(n, e) {
|
|
444
|
+
if (Dt(n)) return !0;
|
|
445
|
+
const t = n.target;
|
|
446
|
+
return t ? e.some((o) => o.element === t) : !1;
|
|
447
|
+
}
|
|
448
|
+
function yn(n) {
|
|
449
|
+
return n.filter((e) => !e.disabled);
|
|
450
|
+
}
|
|
451
|
+
function re(n, e) {
|
|
452
|
+
var t;
|
|
453
|
+
const r = ((t = n.element) == null ? void 0 : t.textContent) || n.children || // The composite item object itself doesn't include a value property, but
|
|
454
|
+
// other components like Select do. Since CompositeTypeahead is a generic
|
|
455
|
+
// component that can be used with those as well, we also consider the value
|
|
456
|
+
// property as a fallback for the typeahead text content.
|
|
457
|
+
"value" in n && n.value;
|
|
458
|
+
return r ? Nt(r).trim().toLowerCase().startsWith(e.toLowerCase()) : !1;
|
|
459
|
+
}
|
|
460
|
+
function wn(n, e, t) {
|
|
461
|
+
if (!t) return n;
|
|
462
|
+
const r = n.find((o) => o.id === t);
|
|
463
|
+
return !r || !re(r, e) || $ !== e && re(r, $) ? n : ($ = e, _t(
|
|
464
|
+
n.filter((o) => re(o, $)),
|
|
465
|
+
t
|
|
466
|
+
).filter((o) => o.id !== t));
|
|
467
|
+
}
|
|
468
|
+
var he = E(function({ store: e, typeahead: t = !0, ...r }) {
|
|
469
|
+
const o = Le();
|
|
470
|
+
e = e || o, R(
|
|
471
|
+
e,
|
|
472
|
+
process.env.NODE_ENV !== "production" && "CompositeTypeahead must be a Composite component"
|
|
473
|
+
);
|
|
474
|
+
const u = r.onKeyDownCapture, i = K(0), a = V((c) => {
|
|
475
|
+
if (u == null || u(c), c.defaultPrevented || !t || !e) return;
|
|
476
|
+
if (!Cn(c))
|
|
477
|
+
return ce();
|
|
478
|
+
const { renderedItems: s, items: d, activeId: l, id: v } = e.getState();
|
|
479
|
+
let f = yn(
|
|
480
|
+
d.length > s.length ? d : s
|
|
481
|
+
);
|
|
482
|
+
const h = Ne(c.currentTarget), g = `[data-offscreen-id="${v}"]`, m = h.querySelectorAll(g);
|
|
483
|
+
for (const M of m) {
|
|
484
|
+
const A = M.ariaDisabled === "true" || "disabled" in M && !!M.disabled;
|
|
485
|
+
f.push({ id: M.id, element: M, disabled: A });
|
|
486
|
+
}
|
|
487
|
+
if (m.length && (f = It(f, (M) => M.element)), !xn(c, f)) return ce();
|
|
488
|
+
c.preventDefault(), window.clearTimeout(i.current), i.current = window.setTimeout(() => {
|
|
489
|
+
$ = "";
|
|
490
|
+
}, 500);
|
|
491
|
+
const S = c.key.toLowerCase();
|
|
492
|
+
$ += S, f = wn(f, S, l);
|
|
493
|
+
const p = f.find((M) => re(M, $));
|
|
494
|
+
p ? e.move(p.id) : ce();
|
|
495
|
+
});
|
|
496
|
+
return r = {
|
|
497
|
+
...r,
|
|
498
|
+
onKeyDownCapture: a
|
|
499
|
+
}, De(r);
|
|
500
|
+
});
|
|
501
|
+
k(function(e) {
|
|
502
|
+
const t = he(e);
|
|
503
|
+
return T(Mn, t);
|
|
504
|
+
});
|
|
505
|
+
function Sn(n = {}) {
|
|
506
|
+
var e;
|
|
507
|
+
ze(n, n.store);
|
|
508
|
+
const t = (e = n.store) == null ? void 0 : e.getState(), r = {
|
|
509
|
+
value: L(
|
|
510
|
+
n.value,
|
|
511
|
+
t == null ? void 0 : t.value,
|
|
512
|
+
n.defaultValue,
|
|
513
|
+
!1
|
|
514
|
+
)
|
|
515
|
+
}, o = ve(r, n.store);
|
|
516
|
+
return {
|
|
517
|
+
...o,
|
|
518
|
+
setValue: (u) => o.setState("value", u)
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
function pn(n, e, t) {
|
|
522
|
+
return Fe(e, [t.store]), X(n, t, "value", "setValue"), n;
|
|
523
|
+
}
|
|
524
|
+
function Pn(n = {}) {
|
|
525
|
+
const [e, t] = We(Sn, n);
|
|
526
|
+
return pn(e, t, n);
|
|
527
|
+
}
|
|
528
|
+
var te = me(
|
|
529
|
+
[_e, nn],
|
|
530
|
+
[Ve, Ge]
|
|
531
|
+
), be = te.useContext, rt = te.useScopedContext, ie = te.useProviderContext, ot = te.ContextProvider, En = te.ScopedContextProvider, kn = fe(
|
|
532
|
+
void 0
|
|
533
|
+
), Tn = "div";
|
|
534
|
+
function In({ store: n, ...e }) {
|
|
535
|
+
const [t, r] = Q(void 0), o = e["aria-label"], u = z(n, "disclosureElement"), i = z(n, "contentElement");
|
|
536
|
+
return O(() => {
|
|
537
|
+
const a = u;
|
|
538
|
+
if (!a) return;
|
|
539
|
+
const c = i;
|
|
540
|
+
if (!c) return;
|
|
541
|
+
o || c.hasAttribute("aria-label") ? r(void 0) : a.id && r(a.id);
|
|
542
|
+
}, [o, u, i]), t;
|
|
543
|
+
}
|
|
544
|
+
var ut = E(
|
|
545
|
+
function({ store: e, alwaysVisible: t, composite: r, ...o }) {
|
|
546
|
+
const u = ie();
|
|
547
|
+
e = e || u, R(
|
|
548
|
+
e,
|
|
549
|
+
process.env.NODE_ENV !== "production" && "MenuList must receive a `store` prop or be wrapped in a MenuProvider component."
|
|
550
|
+
);
|
|
551
|
+
const i = e.parent, a = e.menubar, c = !!i, s = Oe(o.id), d = o.onKeyDown, l = e.useState(
|
|
552
|
+
(x) => x.placement.split("-")[0]
|
|
553
|
+
), v = e.useState(
|
|
554
|
+
(x) => x.orientation === "both" ? void 0 : x.orientation
|
|
555
|
+
), f = v !== "vertical", h = z(
|
|
556
|
+
a,
|
|
557
|
+
(x) => !!x && x.orientation !== "vertical"
|
|
558
|
+
), g = V((x) => {
|
|
559
|
+
if (d == null || d(x), !x.defaultPrevented) {
|
|
560
|
+
if (c || a && !f) {
|
|
561
|
+
const F = {
|
|
562
|
+
ArrowRight: () => l === "left" && !f,
|
|
563
|
+
ArrowLeft: () => l === "right" && !f,
|
|
564
|
+
ArrowUp: () => l === "bottom" && f,
|
|
565
|
+
ArrowDown: () => l === "top" && f
|
|
566
|
+
}[x.key];
|
|
567
|
+
if (F != null && F())
|
|
568
|
+
return x.stopPropagation(), x.preventDefault(), e == null ? void 0 : e.hide();
|
|
569
|
+
}
|
|
570
|
+
if (a) {
|
|
571
|
+
const F = {
|
|
572
|
+
ArrowRight: () => {
|
|
573
|
+
if (h)
|
|
574
|
+
return a.next();
|
|
575
|
+
},
|
|
576
|
+
ArrowLeft: () => {
|
|
577
|
+
if (h)
|
|
578
|
+
return a.previous();
|
|
579
|
+
},
|
|
580
|
+
ArrowDown: () => {
|
|
581
|
+
if (!h)
|
|
582
|
+
return a.next();
|
|
583
|
+
},
|
|
584
|
+
ArrowUp: () => {
|
|
585
|
+
if (!h)
|
|
586
|
+
return a.previous();
|
|
587
|
+
}
|
|
588
|
+
}[x.key], H = F == null ? void 0 : F();
|
|
589
|
+
H !== void 0 && (x.stopPropagation(), x.preventDefault(), a.move(H));
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
o = oe(
|
|
594
|
+
o,
|
|
595
|
+
(x) => /* @__PURE__ */ P(En, { value: e, children: x }),
|
|
596
|
+
[e]
|
|
597
|
+
);
|
|
598
|
+
const m = In({ store: e, ...o }), S = e.useState("mounted"), p = qt(S, o.hidden, t), M = p ? { ...o.style, display: "none" } : o.style;
|
|
599
|
+
o = {
|
|
600
|
+
id: s,
|
|
601
|
+
"aria-labelledby": m,
|
|
602
|
+
hidden: p,
|
|
603
|
+
...o,
|
|
604
|
+
ref: U(s ? e.setContentElement : null, o.ref),
|
|
605
|
+
style: M,
|
|
606
|
+
onKeyDown: g
|
|
607
|
+
};
|
|
608
|
+
const A = !!e.combobox;
|
|
609
|
+
return r = r ?? !A, r && (o = {
|
|
610
|
+
role: "menu",
|
|
611
|
+
"aria-orientation": v,
|
|
612
|
+
...o
|
|
613
|
+
}), o = Bt({ store: e, composite: r, ...o }), o = he({ store: e, typeahead: !A, ...o }), o;
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
k(function(e) {
|
|
617
|
+
const t = ut(e);
|
|
618
|
+
return T(Tn, t);
|
|
619
|
+
});
|
|
620
|
+
var An = "div", Dn = E(function({
|
|
621
|
+
store: e,
|
|
622
|
+
modal: t = !1,
|
|
623
|
+
portal: r = !!t,
|
|
624
|
+
hideOnEscape: o = !0,
|
|
625
|
+
autoFocusOnShow: u = !0,
|
|
626
|
+
hideOnHoverOutside: i,
|
|
627
|
+
alwaysVisible: a,
|
|
628
|
+
...c
|
|
629
|
+
}) {
|
|
630
|
+
const s = ie();
|
|
631
|
+
e = e || s, R(
|
|
632
|
+
e,
|
|
633
|
+
process.env.NODE_ENV !== "production" && "Menu must receive a `store` prop or be wrapped in a MenuProvider component."
|
|
634
|
+
);
|
|
635
|
+
const d = K(null), l = e.parent, v = e.menubar, f = !!l, h = !!v && !f;
|
|
636
|
+
c = {
|
|
637
|
+
...c,
|
|
638
|
+
ref: U(d, c.ref)
|
|
639
|
+
};
|
|
640
|
+
const { "aria-labelledby": g, ...m } = ut({
|
|
641
|
+
store: e,
|
|
642
|
+
alwaysVisible: a,
|
|
643
|
+
...c
|
|
644
|
+
});
|
|
645
|
+
c = m;
|
|
646
|
+
const [S, p] = Q(), M = e.useState("autoFocusOnShow"), A = e.useState("initialFocus"), x = e.useState("baseElement"), D = e.useState("renderedItems");
|
|
647
|
+
O(() => {
|
|
648
|
+
let y = !1;
|
|
649
|
+
return p((w) => {
|
|
650
|
+
var _, ne, G;
|
|
651
|
+
if (y || !M) return;
|
|
652
|
+
if ((_ = w == null ? void 0 : w.current) != null && _.isConnected) return w;
|
|
653
|
+
const j = jt();
|
|
654
|
+
switch (A) {
|
|
655
|
+
case "first":
|
|
656
|
+
j.current = ((ne = D.find((B) => !B.disabled && B.element)) == null ? void 0 : ne.element) || null;
|
|
657
|
+
break;
|
|
658
|
+
case "last":
|
|
659
|
+
j.current = ((G = [...D].reverse().find((B) => !B.disabled && B.element)) == null ? void 0 : G.element) || null;
|
|
660
|
+
break;
|
|
661
|
+
default:
|
|
662
|
+
j.current = x;
|
|
663
|
+
}
|
|
664
|
+
return j;
|
|
665
|
+
}), () => {
|
|
666
|
+
y = !0;
|
|
667
|
+
};
|
|
668
|
+
}, [e, M, A, D, x]);
|
|
669
|
+
const F = f ? !1 : t, H = !!u, C = !!S || !!c.initialFocus || !!F, I = z(
|
|
670
|
+
e.combobox || e,
|
|
671
|
+
"contentElement"
|
|
672
|
+
), b = z(
|
|
673
|
+
(l == null ? void 0 : l.combobox) || l,
|
|
674
|
+
"contentElement"
|
|
675
|
+
), N = Ke(() => {
|
|
676
|
+
if (!b || !I) return;
|
|
677
|
+
const y = I.getAttribute("role"), w = b.getAttribute("role");
|
|
678
|
+
if (!((w === "menu" || w === "menubar") && y === "menu"))
|
|
679
|
+
return b;
|
|
680
|
+
}, [I, b]);
|
|
681
|
+
return N !== void 0 && (c = {
|
|
682
|
+
preserveTabOrderAnchor: N,
|
|
683
|
+
...c
|
|
684
|
+
}), c = Ye({
|
|
685
|
+
store: e,
|
|
686
|
+
alwaysVisible: a,
|
|
687
|
+
initialFocus: S,
|
|
688
|
+
autoFocusOnShow: H ? C && u : M || !!F,
|
|
689
|
+
...c,
|
|
690
|
+
hideOnEscape(y) {
|
|
691
|
+
return Te(o, y) ? !1 : (e == null || e.hideAll(), !0);
|
|
692
|
+
},
|
|
693
|
+
hideOnHoverOutside(y) {
|
|
694
|
+
const w = e == null ? void 0 : e.getState().disclosureElement;
|
|
695
|
+
return (typeof i == "function" ? i(y) : i ?? (f ? !0 : h ? w ? !q(w) : !0 : !1)) ? y.defaultPrevented || !f || !w || (Ft(w, "mouseout", y), !q(w)) ? !0 : (requestAnimationFrame(() => {
|
|
696
|
+
q(w) || e == null || e.hide();
|
|
697
|
+
}), !1) : !1;
|
|
698
|
+
},
|
|
699
|
+
modal: F,
|
|
700
|
+
portal: r,
|
|
701
|
+
backdrop: f ? !1 : c.backdrop
|
|
702
|
+
}), c = {
|
|
703
|
+
"aria-labelledby": g,
|
|
704
|
+
...c
|
|
705
|
+
}, c;
|
|
706
|
+
}), Nn = je(
|
|
707
|
+
k(function(e) {
|
|
708
|
+
const t = Dn(e);
|
|
709
|
+
return T(An, t);
|
|
710
|
+
}),
|
|
711
|
+
ie
|
|
712
|
+
), Fn = "button";
|
|
713
|
+
function On(n, e) {
|
|
714
|
+
return {
|
|
715
|
+
ArrowDown: e === "bottom" || e === "top" ? "first" : !1,
|
|
716
|
+
ArrowUp: e === "bottom" || e === "top" ? "last" : !1,
|
|
717
|
+
ArrowRight: e === "right" ? "first" : !1,
|
|
718
|
+
ArrowLeft: e === "left" ? "first" : !1
|
|
719
|
+
}[n.key];
|
|
720
|
+
}
|
|
721
|
+
function pe(n, e) {
|
|
722
|
+
return !!(n != null && n.some((t) => !t.element || t.element === e ? !1 : t.element.getAttribute("aria-expanded") === "true"));
|
|
723
|
+
}
|
|
724
|
+
var Rn = E(
|
|
725
|
+
function({
|
|
726
|
+
store: e,
|
|
727
|
+
focusable: t,
|
|
728
|
+
accessibleWhenDisabled: r,
|
|
729
|
+
showOnHover: o,
|
|
730
|
+
...u
|
|
731
|
+
}) {
|
|
732
|
+
const i = ie();
|
|
733
|
+
e = e || i, R(
|
|
734
|
+
e,
|
|
735
|
+
process.env.NODE_ENV !== "production" && "MenuButton must receive a `store` prop or be wrapped in a MenuProvider component."
|
|
736
|
+
);
|
|
737
|
+
const a = K(null), c = e.parent, s = e.menubar, d = !!c, l = !!s && !d, v = Ie(u), f = () => {
|
|
738
|
+
const C = a.current;
|
|
739
|
+
C && (e == null || e.setDisclosureElement(C), e == null || e.setAnchorElement(C), e == null || e.show());
|
|
740
|
+
}, h = u.onFocus, g = V((C) => {
|
|
741
|
+
if (h == null || h(C), v || C.defaultPrevented || (e == null || e.setAutoFocusOnShow(!1), e == null || e.setActiveId(null), !s) || !l) return;
|
|
742
|
+
const { items: I } = s.getState();
|
|
743
|
+
pe(I, C.currentTarget) && f();
|
|
744
|
+
}), m = z(
|
|
745
|
+
e,
|
|
746
|
+
(C) => C.placement.split("-")[0]
|
|
747
|
+
), S = u.onKeyDown, p = V((C) => {
|
|
748
|
+
if (S == null || S(C), v || C.defaultPrevented) return;
|
|
749
|
+
const I = On(C, m);
|
|
750
|
+
I && (C.preventDefault(), f(), e == null || e.setAutoFocusOnShow(!0), e == null || e.setInitialFocus(I));
|
|
751
|
+
}), M = u.onClick, A = V((C) => {
|
|
752
|
+
if (M == null || M(C), C.defaultPrevented || !e) return;
|
|
753
|
+
const I = !C.detail, { open: b } = e.getState();
|
|
754
|
+
(!b || I) && ((!d || I) && e.setAutoFocusOnShow(!0), e.setInitialFocus(I ? "first" : "container")), d && f();
|
|
755
|
+
});
|
|
756
|
+
u = oe(
|
|
757
|
+
u,
|
|
758
|
+
(C) => /* @__PURE__ */ P(ot, { value: e, children: C }),
|
|
759
|
+
[e]
|
|
760
|
+
), d && (u = {
|
|
761
|
+
...u,
|
|
762
|
+
render: /* @__PURE__ */ P(Ut.div, { render: u.render })
|
|
763
|
+
});
|
|
764
|
+
const x = Oe(u.id), D = z(
|
|
765
|
+
(c == null ? void 0 : c.combobox) || c,
|
|
766
|
+
"contentElement"
|
|
767
|
+
), F = d || l ? Re(D, "menuitem") : void 0, H = e.useState("contentElement");
|
|
768
|
+
return u = {
|
|
769
|
+
id: x,
|
|
770
|
+
role: F,
|
|
771
|
+
"aria-haspopup": Ae(H, "menu"),
|
|
772
|
+
...u,
|
|
773
|
+
ref: U(a, u.ref),
|
|
774
|
+
onFocus: g,
|
|
775
|
+
onKeyDown: p,
|
|
776
|
+
onClick: A
|
|
777
|
+
}, u = Qe({
|
|
778
|
+
store: e,
|
|
779
|
+
focusable: t,
|
|
780
|
+
accessibleWhenDisabled: r,
|
|
781
|
+
...u,
|
|
782
|
+
showOnHover: (C) => {
|
|
783
|
+
if (!(() => {
|
|
784
|
+
if (typeof o == "function") return o(C);
|
|
785
|
+
if (o != null) return o;
|
|
786
|
+
if (d) return !0;
|
|
787
|
+
if (!s) return !1;
|
|
788
|
+
const { items: y } = s.getState();
|
|
789
|
+
return l && pe(y);
|
|
790
|
+
})()) return !1;
|
|
791
|
+
const N = l ? s : c;
|
|
792
|
+
return N && N.setActiveId(C.currentTarget.id), !0;
|
|
793
|
+
}
|
|
794
|
+
}), u = tt({
|
|
795
|
+
store: e,
|
|
796
|
+
toggleOnClick: !d,
|
|
797
|
+
focusable: t,
|
|
798
|
+
accessibleWhenDisabled: r,
|
|
799
|
+
...u
|
|
800
|
+
}), u = he({
|
|
801
|
+
store: e,
|
|
802
|
+
typeahead: l,
|
|
803
|
+
...u
|
|
804
|
+
}), u;
|
|
805
|
+
}
|
|
806
|
+
), Hn = k(function(e) {
|
|
807
|
+
const t = Rn(e);
|
|
808
|
+
return T(Fn, t);
|
|
809
|
+
}), Ln = "span", Vn = E(
|
|
810
|
+
function({ store: e, ...t }) {
|
|
811
|
+
const r = be();
|
|
812
|
+
return e = e || r, t = nt({ store: e, ...t }), t;
|
|
813
|
+
}
|
|
814
|
+
), _n = k(function(e) {
|
|
815
|
+
const t = Vn(e);
|
|
816
|
+
return T(Ln, t);
|
|
817
|
+
}), Bn = "div";
|
|
818
|
+
function $n(n, e, t) {
|
|
819
|
+
var r;
|
|
820
|
+
if (!n) return !1;
|
|
821
|
+
if (q(n)) return !0;
|
|
822
|
+
const o = e == null ? void 0 : e.find((c) => {
|
|
823
|
+
var s;
|
|
824
|
+
return c.element === t ? !1 : ((s = c.element) == null ? void 0 : s.getAttribute("aria-expanded")) === "true";
|
|
825
|
+
}), u = (r = o == null ? void 0 : o.element) == null ? void 0 : r.getAttribute("aria-controls");
|
|
826
|
+
if (!u) return !1;
|
|
827
|
+
const a = Ne(n).getElementById(u);
|
|
828
|
+
return a ? q(a) ? !0 : !!a.querySelector("[role=menuitem][aria-expanded=true]") : !1;
|
|
829
|
+
}
|
|
830
|
+
var it = E(
|
|
831
|
+
function({
|
|
832
|
+
store: e,
|
|
833
|
+
hideOnClick: t = !0,
|
|
834
|
+
preventScrollOnKeyDown: r = !0,
|
|
835
|
+
focusOnHover: o,
|
|
836
|
+
blurOnHoverEnd: u,
|
|
837
|
+
...i
|
|
838
|
+
}) {
|
|
839
|
+
const a = rt(!0), c = dn();
|
|
840
|
+
e = e || a || c, R(
|
|
841
|
+
e,
|
|
842
|
+
process.env.NODE_ENV !== "production" && "MenuItem must be wrapped in a MenuList, Menu or Menubar component"
|
|
843
|
+
);
|
|
844
|
+
const s = i.onClick, d = Y(t), l = "hideAll" in e ? e.hideAll : void 0, v = !!l, f = V((m) => {
|
|
845
|
+
s == null || s(m), !(m.defaultPrevented || Ot(m) || Rt(m) || !l || m.currentTarget.getAttribute("aria-haspopup") === "menu") && d(m) && l();
|
|
846
|
+
}), h = z(
|
|
847
|
+
e,
|
|
848
|
+
(m) => "contentElement" in m ? m.contentElement : null
|
|
849
|
+
);
|
|
850
|
+
return i = {
|
|
851
|
+
role: Re(h, "menuitem"),
|
|
852
|
+
...i,
|
|
853
|
+
onClick: f
|
|
854
|
+
}, i = yt({
|
|
855
|
+
store: e,
|
|
856
|
+
preventScrollOnKeyDown: r,
|
|
857
|
+
...i
|
|
858
|
+
}), i = wt({
|
|
859
|
+
store: e,
|
|
860
|
+
...i,
|
|
861
|
+
focusOnHover(m) {
|
|
862
|
+
const S = () => typeof o == "function" ? o(m) : o ?? !0;
|
|
863
|
+
if (!e || !S()) return !1;
|
|
864
|
+
const { baseElement: p, items: M } = e.getState();
|
|
865
|
+
return v ? (m.currentTarget.hasAttribute("aria-expanded") && m.currentTarget.focus(), !0) : $n(p, M, m.currentTarget) ? (m.currentTarget.focus(), !0) : !1;
|
|
866
|
+
},
|
|
867
|
+
blurOnHoverEnd(m) {
|
|
868
|
+
return typeof u == "function" ? u(m) : u ?? v;
|
|
869
|
+
}
|
|
870
|
+
}), i;
|
|
871
|
+
}
|
|
872
|
+
), Kn = He(
|
|
873
|
+
k(function(e) {
|
|
874
|
+
const t = it(e);
|
|
875
|
+
return T(Bn, t);
|
|
876
|
+
})
|
|
877
|
+
), jn = "span", zn = E(
|
|
878
|
+
function({ store: e, checked: t, ...r }) {
|
|
879
|
+
const o = Be(kn);
|
|
880
|
+
return t = t ?? o, r = Zt({ ...r, checked: t }), r;
|
|
881
|
+
}
|
|
882
|
+
), Wn = k(function(e) {
|
|
883
|
+
const t = zn(e);
|
|
884
|
+
return T(jn, t);
|
|
885
|
+
}), qn = "div";
|
|
886
|
+
function Un(n) {
|
|
887
|
+
return Array.isArray(n) ? n.toString() : n;
|
|
888
|
+
}
|
|
889
|
+
function se(n, e, t) {
|
|
890
|
+
if (e === void 0)
|
|
891
|
+
return Array.isArray(n) ? n : !!t;
|
|
892
|
+
const r = Un(e);
|
|
893
|
+
return Array.isArray(n) ? t ? n.includes(r) ? n : [...n, r] : n.filter((o) => o !== r) : t ? r : n === r ? !1 : n;
|
|
894
|
+
}
|
|
895
|
+
var Gn = E(
|
|
896
|
+
function({
|
|
897
|
+
store: e,
|
|
898
|
+
name: t,
|
|
899
|
+
value: r,
|
|
900
|
+
checked: o,
|
|
901
|
+
defaultChecked: u,
|
|
902
|
+
hideOnClick: i = !1,
|
|
903
|
+
...a
|
|
904
|
+
}) {
|
|
905
|
+
const c = rt();
|
|
906
|
+
e = e || c, R(
|
|
907
|
+
e,
|
|
908
|
+
process.env.NODE_ENV !== "production" && "MenuItemCheckbox must be wrapped in a MenuList or Menu component"
|
|
909
|
+
);
|
|
910
|
+
const s = Ht(u);
|
|
911
|
+
O(() => {
|
|
912
|
+
e == null || e.setValue(t, (l = []) => s ? se(l, r, !0) : l);
|
|
913
|
+
}, [e, t, r, s]), O(() => {
|
|
914
|
+
o !== void 0 && (e == null || e.setValue(t, (l) => se(l, r, o)));
|
|
915
|
+
}, [e, t, r, o]);
|
|
916
|
+
const d = Pn({
|
|
917
|
+
value: e.useState((l) => l.values[t]),
|
|
918
|
+
setValue(l) {
|
|
919
|
+
e == null || e.setValue(t, () => {
|
|
920
|
+
if (o === void 0) return l;
|
|
921
|
+
const v = se(l, r, o);
|
|
922
|
+
return !Array.isArray(v) || !Array.isArray(l) ? v : Lt(l, v) ? l : v;
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
return a = {
|
|
927
|
+
role: "menuitemcheckbox",
|
|
928
|
+
...a
|
|
929
|
+
}, a = Jt({
|
|
930
|
+
store: d,
|
|
931
|
+
name: t,
|
|
932
|
+
value: r,
|
|
933
|
+
checked: o,
|
|
934
|
+
...a
|
|
935
|
+
}), a = it({ store: e, hideOnClick: i, ...a }), a;
|
|
936
|
+
}
|
|
937
|
+
), Xn = He(
|
|
938
|
+
k(function(e) {
|
|
939
|
+
const t = Gn(e);
|
|
940
|
+
return T(qn, t);
|
|
941
|
+
})
|
|
942
|
+
);
|
|
943
|
+
function Yn({
|
|
944
|
+
combobox: n,
|
|
945
|
+
parent: e,
|
|
946
|
+
menubar: t,
|
|
947
|
+
...r
|
|
948
|
+
} = {}) {
|
|
949
|
+
const o = !!t && !e, u = Gt(
|
|
950
|
+
r.store,
|
|
951
|
+
Yt(e, ["values"]),
|
|
952
|
+
Xt(n, [
|
|
953
|
+
"arrowElement",
|
|
954
|
+
"anchorElement",
|
|
955
|
+
"contentElement",
|
|
956
|
+
"popoverElement",
|
|
957
|
+
"disclosureElement"
|
|
958
|
+
])
|
|
959
|
+
);
|
|
960
|
+
ze(r, u);
|
|
961
|
+
const i = u.getState(), a = $t({
|
|
962
|
+
...r,
|
|
963
|
+
store: u,
|
|
964
|
+
orientation: L(
|
|
965
|
+
r.orientation,
|
|
966
|
+
i.orientation,
|
|
967
|
+
"vertical"
|
|
968
|
+
)
|
|
969
|
+
}), c = cn({
|
|
970
|
+
...r,
|
|
971
|
+
store: u,
|
|
972
|
+
placement: L(
|
|
973
|
+
r.placement,
|
|
974
|
+
i.placement,
|
|
975
|
+
"bottom-start"
|
|
976
|
+
),
|
|
977
|
+
timeout: L(
|
|
978
|
+
r.timeout,
|
|
979
|
+
i.timeout,
|
|
980
|
+
o ? 0 : 150
|
|
981
|
+
),
|
|
982
|
+
hideTimeout: L(r.hideTimeout, i.hideTimeout, 0)
|
|
983
|
+
}), s = {
|
|
984
|
+
...a.getState(),
|
|
985
|
+
...c.getState(),
|
|
986
|
+
initialFocus: L(i.initialFocus, "container"),
|
|
987
|
+
values: L(
|
|
988
|
+
r.values,
|
|
989
|
+
i.values,
|
|
990
|
+
r.defaultValues,
|
|
991
|
+
{}
|
|
992
|
+
)
|
|
993
|
+
}, d = ve(s, a, c, u);
|
|
994
|
+
return xe(
|
|
995
|
+
d,
|
|
996
|
+
() => de(d, ["mounted"], (l) => {
|
|
997
|
+
l.mounted || d.setState("activeId", null);
|
|
998
|
+
})
|
|
999
|
+
), xe(
|
|
1000
|
+
d,
|
|
1001
|
+
() => de(e, ["orientation"], (l) => {
|
|
1002
|
+
d.setState(
|
|
1003
|
+
"placement",
|
|
1004
|
+
l.orientation === "vertical" ? "right-start" : "bottom-start"
|
|
1005
|
+
);
|
|
1006
|
+
})
|
|
1007
|
+
), {
|
|
1008
|
+
...a,
|
|
1009
|
+
...c,
|
|
1010
|
+
...d,
|
|
1011
|
+
combobox: n,
|
|
1012
|
+
parent: e,
|
|
1013
|
+
menubar: t,
|
|
1014
|
+
hideAll: () => {
|
|
1015
|
+
c.hide(), e == null || e.hideAll();
|
|
1016
|
+
},
|
|
1017
|
+
setInitialFocus: (l) => d.setState("initialFocus", l),
|
|
1018
|
+
setValues: (l) => d.setState("values", l),
|
|
1019
|
+
setValue: (l, v) => {
|
|
1020
|
+
l !== "__proto__" && l !== "constructor" && (Array.isArray(l) || d.setState("values", (f) => {
|
|
1021
|
+
const h = f[l], g = Vt(v, h);
|
|
1022
|
+
return g === h ? f : {
|
|
1023
|
+
...f,
|
|
1024
|
+
[l]: g !== void 0 && g
|
|
1025
|
+
};
|
|
1026
|
+
}));
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
function Qn(n, e, t) {
|
|
1031
|
+
return Fe(e, [t.combobox, t.parent, t.menubar]), X(n, t, "values", "setValues"), Object.assign(
|
|
1032
|
+
sn(
|
|
1033
|
+
Kt(n, e, t),
|
|
1034
|
+
e,
|
|
1035
|
+
t
|
|
1036
|
+
),
|
|
1037
|
+
{
|
|
1038
|
+
combobox: t.combobox,
|
|
1039
|
+
parent: t.parent,
|
|
1040
|
+
menubar: t.menubar
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
function Zn(n = {}) {
|
|
1045
|
+
const e = be(), t = ln(), r = St();
|
|
1046
|
+
n = {
|
|
1047
|
+
...n,
|
|
1048
|
+
parent: n.parent !== void 0 ? n.parent : e,
|
|
1049
|
+
menubar: n.menubar !== void 0 ? n.menubar : t,
|
|
1050
|
+
combobox: n.combobox !== void 0 ? n.combobox : r
|
|
1051
|
+
};
|
|
1052
|
+
const [o, u] = We(Yn, n);
|
|
1053
|
+
return Qn(o, u, n);
|
|
1054
|
+
}
|
|
1055
|
+
function Jn(n = {}) {
|
|
1056
|
+
const e = Zn(n);
|
|
1057
|
+
return /* @__PURE__ */ P(ot, { value: e, children: n.children });
|
|
1058
|
+
}
|
|
1059
|
+
var er = "hr", tr = E(
|
|
1060
|
+
function({ store: e, ...t }) {
|
|
1061
|
+
const r = be();
|
|
1062
|
+
return e = e || r, t = Ue({ store: e, ...t }), t;
|
|
1063
|
+
}
|
|
1064
|
+
), nr = k(function(e) {
|
|
1065
|
+
const t = tr(e);
|
|
1066
|
+
return T(er, t);
|
|
1067
|
+
});
|
|
1068
|
+
const rr = ue(
|
|
1069
|
+
[
|
|
1070
|
+
"inline-flex items-center justify-center gap-2",
|
|
1071
|
+
"font-medium transition-all duration-200",
|
|
1072
|
+
"rounded-lg",
|
|
1073
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
1074
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1075
|
+
],
|
|
1076
|
+
{
|
|
1077
|
+
variants: {
|
|
1078
|
+
variant: {
|
|
1079
|
+
default: [
|
|
1080
|
+
"bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-700",
|
|
1081
|
+
"hover:bg-gray-50 dark:hover:bg-gray-800",
|
|
1082
|
+
"focus-visible:ring-primary-600",
|
|
1083
|
+
"shadow-sm hover:shadow"
|
|
1084
|
+
],
|
|
1085
|
+
primary: [
|
|
1086
|
+
"bg-primary-600 text-white border border-transparent",
|
|
1087
|
+
"hover:bg-primary-700",
|
|
1088
|
+
"focus-visible:ring-primary-600",
|
|
1089
|
+
"shadow-sm hover:shadow"
|
|
1090
|
+
],
|
|
1091
|
+
ghost: [
|
|
1092
|
+
"text-gray-900 dark:text-gray-100 bg-transparent border-transparent",
|
|
1093
|
+
"hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
1094
|
+
"focus-visible:ring-primary-600"
|
|
1095
|
+
]
|
|
1096
|
+
},
|
|
1097
|
+
size: {
|
|
1098
|
+
sm: "h-9 px-3 text-sm",
|
|
1099
|
+
md: "h-10 px-4 text-base",
|
|
1100
|
+
lg: "h-11 px-6 text-lg"
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
defaultVariants: {
|
|
1104
|
+
variant: "default",
|
|
1105
|
+
size: "md"
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
), or = ue([
|
|
1109
|
+
"z-50 min-w-[200px] rounded-lg border bg-white p-1 shadow-lg",
|
|
1110
|
+
"dark:bg-gray-900 dark:border-gray-700",
|
|
1111
|
+
"opacity-0 transition-all duration-200 ease-out",
|
|
1112
|
+
"data-enter:opacity-100 data-enter:translate-y-0",
|
|
1113
|
+
"data-leave:opacity-0 data-leave:-translate-y-1"
|
|
1114
|
+
]), at = ue(
|
|
1115
|
+
[
|
|
1116
|
+
"flex items-center gap-2 px-3 py-2 rounded-md",
|
|
1117
|
+
"text-sm cursor-pointer",
|
|
1118
|
+
"transition-colors duration-150",
|
|
1119
|
+
"outline-none",
|
|
1120
|
+
"text-gray-900 dark:text-gray-100",
|
|
1121
|
+
"data-active-item:bg-primary-100 dark:data-active-item:bg-primary-900",
|
|
1122
|
+
"data-active-item:text-primary-900 dark:data-active-item:text-primary-100",
|
|
1123
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1124
|
+
]
|
|
1125
|
+
), ur = ue([
|
|
1126
|
+
"my-1 h-px bg-gray-200 dark:bg-gray-700"
|
|
1127
|
+
]);
|
|
1128
|
+
function ir({ children: n, ...e }) {
|
|
1129
|
+
return /* @__PURE__ */ P(Jn, { ...e, children: n });
|
|
1130
|
+
}
|
|
1131
|
+
const ct = Z(
|
|
1132
|
+
({ variant: n, size: e, showArrow: t = !0, className: r, children: o, ...u }, i) => /* @__PURE__ */ Pe(
|
|
1133
|
+
Hn,
|
|
1134
|
+
{
|
|
1135
|
+
ref: i,
|
|
1136
|
+
className: J(rr({ variant: n, size: e, className: r })),
|
|
1137
|
+
...u,
|
|
1138
|
+
children: [
|
|
1139
|
+
o,
|
|
1140
|
+
t && /* @__PURE__ */ P(_n, { className: "transition-transform duration-200 group-data-[open]:rotate-180" })
|
|
1141
|
+
]
|
|
1142
|
+
}
|
|
1143
|
+
)
|
|
1144
|
+
);
|
|
1145
|
+
ct.displayName = "MenuTrigger";
|
|
1146
|
+
const st = Z(
|
|
1147
|
+
({ gutter: n = 8, className: e, children: t, ...r }, o) => /* @__PURE__ */ P(
|
|
1148
|
+
Nn,
|
|
1149
|
+
{
|
|
1150
|
+
ref: o,
|
|
1151
|
+
gutter: n,
|
|
1152
|
+
className: J(or(), e),
|
|
1153
|
+
...r,
|
|
1154
|
+
children: t
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
);
|
|
1158
|
+
st.displayName = "MenuContent";
|
|
1159
|
+
const lt = Z(({ className: n, children: e, ...t }, r) => /* @__PURE__ */ P(
|
|
1160
|
+
Kn,
|
|
1161
|
+
{
|
|
1162
|
+
ref: r,
|
|
1163
|
+
className: J(at(), n),
|
|
1164
|
+
...t,
|
|
1165
|
+
children: e
|
|
1166
|
+
}
|
|
1167
|
+
));
|
|
1168
|
+
lt.displayName = "MenuItem";
|
|
1169
|
+
const dt = Z(({ className: n, children: e, ...t }, r) => /* @__PURE__ */ Pe(
|
|
1170
|
+
Xn,
|
|
1171
|
+
{
|
|
1172
|
+
ref: r,
|
|
1173
|
+
className: J(at(), "pl-8 relative", n),
|
|
1174
|
+
...t,
|
|
1175
|
+
children: [
|
|
1176
|
+
/* @__PURE__ */ P(Wn, { className: "absolute left-2 flex items-center justify-center", children: /* @__PURE__ */ P(
|
|
1177
|
+
"svg",
|
|
1178
|
+
{
|
|
1179
|
+
width: "16",
|
|
1180
|
+
height: "16",
|
|
1181
|
+
viewBox: "0 0 16 16",
|
|
1182
|
+
fill: "none",
|
|
1183
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1184
|
+
className: "text-primary-600 dark:text-primary-400",
|
|
1185
|
+
children: /* @__PURE__ */ P(
|
|
1186
|
+
"path",
|
|
1187
|
+
{
|
|
1188
|
+
d: "M13 4L6 11L3 8",
|
|
1189
|
+
stroke: "currentColor",
|
|
1190
|
+
strokeWidth: "2",
|
|
1191
|
+
strokeLinecap: "round",
|
|
1192
|
+
strokeLinejoin: "round"
|
|
1193
|
+
}
|
|
1194
|
+
)
|
|
1195
|
+
}
|
|
1196
|
+
) }),
|
|
1197
|
+
e
|
|
1198
|
+
]
|
|
1199
|
+
}
|
|
1200
|
+
));
|
|
1201
|
+
dt.displayName = "MenuItemCheckbox";
|
|
1202
|
+
const mt = Z(({ className: n, ...e }, t) => /* @__PURE__ */ P(
|
|
1203
|
+
nr,
|
|
1204
|
+
{
|
|
1205
|
+
ref: t,
|
|
1206
|
+
className: J(ur(), n),
|
|
1207
|
+
...e
|
|
1208
|
+
}
|
|
1209
|
+
));
|
|
1210
|
+
mt.displayName = "MenuSeparator";
|
|
1211
|
+
const Mr = {
|
|
1212
|
+
Root: ir,
|
|
1213
|
+
Trigger: ct,
|
|
1214
|
+
Content: st,
|
|
1215
|
+
Item: lt,
|
|
1216
|
+
ItemCheckbox: dt,
|
|
1217
|
+
Separator: mt
|
|
1218
|
+
}, Cr = {
|
|
1219
|
+
name: "Menu",
|
|
1220
|
+
description: "Dropdown menu with keyboard navigation and checkbox support, built on Ariakit.",
|
|
1221
|
+
category: "Navigation",
|
|
1222
|
+
installation: "pnpm add @component-labs/ui",
|
|
1223
|
+
usage: `import { Menu } from "@component-labs/ui";
|
|
1224
|
+
|
|
1225
|
+
<Menu.Root>
|
|
1226
|
+
<Menu.Trigger>Open Menu</Menu.Trigger>
|
|
1227
|
+
<Menu.Content>
|
|
1228
|
+
<Menu.Item>Item 1</Menu.Item>
|
|
1229
|
+
<Menu.Item>Item 2</Menu.Item>
|
|
1230
|
+
</Menu.Content>
|
|
1231
|
+
</Menu.Root>`,
|
|
1232
|
+
props: [
|
|
1233
|
+
{
|
|
1234
|
+
name: "variant",
|
|
1235
|
+
type: "'default' | 'primary' | 'ghost'",
|
|
1236
|
+
description: "Visual style variant of the menu trigger button (Menu.Trigger)",
|
|
1237
|
+
default: "'default'"
|
|
1238
|
+
},
|
|
1239
|
+
{
|
|
1240
|
+
name: "size",
|
|
1241
|
+
type: "'sm' | 'md' | 'lg'",
|
|
1242
|
+
description: "Size of the menu trigger button (Menu.Trigger)",
|
|
1243
|
+
default: "'md'"
|
|
1244
|
+
},
|
|
1245
|
+
{
|
|
1246
|
+
name: "showArrow",
|
|
1247
|
+
type: "boolean",
|
|
1248
|
+
description: "Whether to show arrow icon on trigger (Menu.Trigger)",
|
|
1249
|
+
default: "true"
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
name: "gutter",
|
|
1253
|
+
type: "number",
|
|
1254
|
+
description: "Space between trigger and menu content (Menu.Content)",
|
|
1255
|
+
default: "8"
|
|
1256
|
+
}
|
|
1257
|
+
],
|
|
1258
|
+
examples: [
|
|
1259
|
+
{
|
|
1260
|
+
title: "Basic Menu",
|
|
1261
|
+
code: `<Menu.Root>
|
|
1262
|
+
<Menu.Trigger>Actions</Menu.Trigger>
|
|
1263
|
+
<Menu.Content>
|
|
1264
|
+
<Menu.Item>Edit</Menu.Item>
|
|
1265
|
+
<Menu.Item>Duplicate</Menu.Item>
|
|
1266
|
+
<Menu.Separator />
|
|
1267
|
+
<Menu.Item>Delete</Menu.Item>
|
|
1268
|
+
</Menu.Content>
|
|
1269
|
+
</Menu.Root>`,
|
|
1270
|
+
description: "Simple dropdown menu with items and separator"
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
title: "With Checkboxes",
|
|
1274
|
+
code: `<Menu.Root>
|
|
1275
|
+
<Menu.Trigger>View Options</Menu.Trigger>
|
|
1276
|
+
<Menu.Content>
|
|
1277
|
+
<Menu.ItemCheckbox defaultChecked>Show toolbar</Menu.ItemCheckbox>
|
|
1278
|
+
<Menu.ItemCheckbox>Show sidebar</Menu.ItemCheckbox>
|
|
1279
|
+
<Menu.ItemCheckbox defaultChecked>Show footer</Menu.ItemCheckbox>
|
|
1280
|
+
</Menu.Content>
|
|
1281
|
+
</Menu.Root>`,
|
|
1282
|
+
description: "Menu with checkbox items for toggleable options"
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
title: "Trigger Variants",
|
|
1286
|
+
code: `<div className="flex gap-2">
|
|
1287
|
+
<Menu.Root>
|
|
1288
|
+
<Menu.Trigger variant="default">Default</Menu.Trigger>
|
|
1289
|
+
<Menu.Content>
|
|
1290
|
+
<Menu.Item>Item 1</Menu.Item>
|
|
1291
|
+
</Menu.Content>
|
|
1292
|
+
</Menu.Root>
|
|
1293
|
+
|
|
1294
|
+
<Menu.Root>
|
|
1295
|
+
<Menu.Trigger variant="primary">Primary</Menu.Trigger>
|
|
1296
|
+
<Menu.Content>
|
|
1297
|
+
<Menu.Item>Item 1</Menu.Item>
|
|
1298
|
+
</Menu.Content>
|
|
1299
|
+
</Menu.Root>
|
|
1300
|
+
|
|
1301
|
+
<Menu.Root>
|
|
1302
|
+
<Menu.Trigger variant="ghost">Ghost</Menu.Trigger>
|
|
1303
|
+
<Menu.Content>
|
|
1304
|
+
<Menu.Item>Item 1</Menu.Item>
|
|
1305
|
+
</Menu.Content>
|
|
1306
|
+
</Menu.Root>
|
|
1307
|
+
</div>`,
|
|
1308
|
+
description: "Different trigger button styles"
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
title: "Without Arrow",
|
|
1312
|
+
code: `<Menu.Root>
|
|
1313
|
+
<Menu.Trigger showArrow={false}>No Arrow</Menu.Trigger>
|
|
1314
|
+
<Menu.Content>
|
|
1315
|
+
<Menu.Item>Item 1</Menu.Item>
|
|
1316
|
+
</Menu.Content>
|
|
1317
|
+
</Menu.Root>`,
|
|
1318
|
+
description: "Menu trigger without arrow indicator"
|
|
1319
|
+
}
|
|
1320
|
+
],
|
|
1321
|
+
accessibility: [
|
|
1322
|
+
"Built on Ariakit's accessible Menu component",
|
|
1323
|
+
"Full keyboard navigation (Arrow keys, Enter, Escape)",
|
|
1324
|
+
"Proper ARIA attributes (aria-haspopup, aria-expanded)",
|
|
1325
|
+
"Focus management and trap within menu",
|
|
1326
|
+
"Screen reader announcements",
|
|
1327
|
+
"Automatic focus return to trigger on close"
|
|
1328
|
+
],
|
|
1329
|
+
relatedComponents: ["Combobox", "Command"]
|
|
1330
|
+
};
|
|
1331
|
+
export {
|
|
1332
|
+
Mr as Menu,
|
|
1333
|
+
Cr as menuDocs
|
|
1334
|
+
};
|
|
1335
|
+
//# sourceMappingURL=menu.js.map
|