@krosoft/react 0.0.75 → 0.0.76
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/Combination-CzdDhqdB.js +564 -0
- package/dist/DataTable-CjFA9p4V.js +2216 -0
- package/dist/{DateRangePicker-BAn4LMHi.js → DateRangePicker-rrXXEYz8.js} +19 -16
- package/dist/LoadingState-CqRLmkxn.js +29 -0
- package/dist/{MetricCard-H--Bf1Ib.js → MetricCard-88djqC4o.js} +22 -20
- package/dist/{ThemeSelector-DQmkKmzE.js → ThemeSelector-sTd9T2OD.js} +8 -8
- package/dist/{Topbar-CFALRIJn.js → Topbar-BqC05zWP.js} +27 -26
- package/dist/{badge-C4pCH7IL.js → badge-kADcbb2Y.js} +1 -1
- package/dist/{calendar-cHag6u-j.js → calendar-BMReToKR.js} +771 -802
- package/dist/card-7XPLAra3.js +23 -0
- package/dist/checkbox-BI6Lm_p-.js +358 -0
- package/dist/chevron-down-ki5-dwtL.js +11 -0
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/index.d.ts +1 -0
- package/dist/components/core/index.d.ts.map +1 -1
- package/dist/components/core/index.js +25 -14
- package/dist/components/core/inputs/index.js +1 -1
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/CardSkeleton.d.ts +3 -0
- package/dist/components/core/states/CardSkeleton.d.ts.map +1 -0
- package/dist/components/core/states/CardsSkeleton.d.ts +7 -0
- package/dist/components/core/states/CardsSkeleton.d.ts.map +1 -0
- package/dist/components/core/states/index.d.ts +2 -0
- package/dist/components/core/states/index.d.ts.map +1 -1
- package/dist/components/core/states/index.js +5 -3
- package/dist/components/core/table/DataTable.d.ts +5 -0
- package/dist/components/core/table/DataTable.d.ts.map +1 -0
- package/dist/components/core/table/TableActions.d.ts +8 -0
- package/dist/components/core/table/TableActions.d.ts.map +1 -0
- package/dist/components/core/table/TableBody.d.ts +21 -0
- package/dist/components/core/table/TableBody.d.ts.map +1 -0
- package/dist/components/core/table/TableBulkActions.d.ts +9 -0
- package/dist/components/core/table/TableBulkActions.d.ts.map +1 -0
- package/dist/components/core/table/TableHeader.d.ts +23 -0
- package/dist/components/core/table/TableHeader.d.ts.map +1 -0
- package/dist/components/core/table/TablePagination.d.ts +14 -0
- package/dist/components/core/table/TablePagination.d.ts.map +1 -0
- package/dist/components/core/table/TableSettings.d.ts +9 -0
- package/dist/components/core/table/TableSettings.d.ts.map +1 -0
- package/dist/components/core/table/index.d.ts +10 -0
- package/dist/components/core/table/index.d.ts.map +1 -0
- package/dist/components/core/table/index.js +11 -0
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +62 -48
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +33 -30
- package/dist/components/ui/select.d.ts +1 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/constants/datatable.d.ts +3 -0
- package/dist/constants/datatable.d.ts.map +1 -0
- package/dist/{index-BQOmHRsD.js → floating-ui.react-dom-BPCyLQfI.js} +315 -323
- package/dist/hooks/ui/useDataTable.d.ts +4 -0
- package/dist/hooks/ui/useDataTable.d.ts.map +1 -0
- package/dist/loader-circle-BhJXKs31.js +11 -0
- package/dist/select-B-hcmC3K.js +1468 -0
- package/dist/{tooltip-Dep8OR3c.js → tooltip-gI1Mp9DG.js} +1 -1
- package/dist/types/BulkAction.d.ts +8 -0
- package/dist/types/BulkAction.d.ts.map +1 -0
- package/dist/types/ColumnDef.d.ts +11 -0
- package/dist/types/ColumnDef.d.ts.map +1 -0
- package/dist/types/DataTableProps.d.ts +19 -0
- package/dist/types/DataTableProps.d.ts.map +1 -0
- package/dist/types/RowAction.d.ts +8 -0
- package/dist/types/RowAction.d.ts.map +1 -0
- package/dist/types/UseDataTableProps.d.ts +13 -0
- package/dist/types/UseDataTableProps.d.ts.map +1 -0
- package/dist/types/UseDataTableResult.d.ts +34 -0
- package/dist/types/UseDataTableResult.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +3 -1
- package/dist/LoadingState-C0uS6aGT.js +0 -19
- package/dist/select-Dv9bdUCB.js +0 -2023
|
@@ -0,0 +1,1468 @@
|
|
|
1
|
+
import { jsx as p, jsxs as se, Fragment as Oe } from "react/jsx-runtime";
|
|
2
|
+
import { c as ee } from "./index-gWiv5-6R.js";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import re from "react";
|
|
5
|
+
import * as Me from "react-dom";
|
|
6
|
+
import Zt from "react-dom";
|
|
7
|
+
import { h as De, u as D, d as Se, i as Jt, f as O, j as le, g as Qt, k as eo, a as X, o as to, s as oo, m as no, n as ro, p as so, q as ao, r as io, l as co, v as Le, e as He } from "./floating-ui.react-dom-BPCyLQfI.js";
|
|
8
|
+
import { h as lo, a as uo, R as po, b as fo, u as mo, C as ho } from "./Combination-CzdDhqdB.js";
|
|
9
|
+
import { C as je } from "./chevron-down-ki5-dwtL.js";
|
|
10
|
+
import { c as vo } from "./createLucideIcon-CRdjzt2A.js";
|
|
11
|
+
/**
|
|
12
|
+
* @license lucide-react v1.16.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
const go = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], wo = vo("chevron-up", go);
|
|
18
|
+
function Ue(e, [o, t]) {
|
|
19
|
+
return Math.min(t, Math.max(o, e));
|
|
20
|
+
}
|
|
21
|
+
function So(e) {
|
|
22
|
+
const o = e + "CollectionProvider", [t, n] = De(o), [a, c] = t(
|
|
23
|
+
o,
|
|
24
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
25
|
+
), i = (l) => {
|
|
26
|
+
const { scope: v, children: g } = l, f = re.useRef(null), m = re.useRef(/* @__PURE__ */ new Map()).current;
|
|
27
|
+
return /* @__PURE__ */ p(a, { scope: v, itemMap: m, collectionRef: f, children: g });
|
|
28
|
+
};
|
|
29
|
+
i.displayName = o;
|
|
30
|
+
const s = e + "CollectionSlot", d = Se(s), u = re.forwardRef(
|
|
31
|
+
(l, v) => {
|
|
32
|
+
const { scope: g, children: f } = l, m = c(s, g), C = D(v, m.collectionRef);
|
|
33
|
+
return /* @__PURE__ */ p(d, { ref: C, children: f });
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
u.displayName = s;
|
|
37
|
+
const h = e + "CollectionItemSlot", S = "data-radix-collection-item", x = Se(h), y = re.forwardRef(
|
|
38
|
+
(l, v) => {
|
|
39
|
+
const { scope: g, children: f, ...m } = l, C = re.useRef(null), R = D(v, C), _ = c(h, g);
|
|
40
|
+
return re.useEffect(() => (_.itemMap.set(C, { ref: C, ...m }), () => void _.itemMap.delete(C))), /* @__PURE__ */ p(x, { [S]: "", ref: R, children: f });
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
y.displayName = h;
|
|
44
|
+
function b(l) {
|
|
45
|
+
const v = c(e + "CollectionConsumer", l);
|
|
46
|
+
return re.useCallback(() => {
|
|
47
|
+
const f = v.collectionRef.current;
|
|
48
|
+
if (!f) return [];
|
|
49
|
+
const m = Array.from(f.querySelectorAll(`[${S}]`));
|
|
50
|
+
return Array.from(v.itemMap.values()).sort(
|
|
51
|
+
(_, E) => m.indexOf(_.ref.current) - m.indexOf(E.ref.current)
|
|
52
|
+
);
|
|
53
|
+
}, [v.collectionRef, v.itemMap]);
|
|
54
|
+
}
|
|
55
|
+
return [
|
|
56
|
+
{ Provider: i, Slot: u, ItemSlot: y },
|
|
57
|
+
b,
|
|
58
|
+
n
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
var yo = [
|
|
62
|
+
"a",
|
|
63
|
+
"button",
|
|
64
|
+
"div",
|
|
65
|
+
"form",
|
|
66
|
+
"h2",
|
|
67
|
+
"h3",
|
|
68
|
+
"img",
|
|
69
|
+
"input",
|
|
70
|
+
"label",
|
|
71
|
+
"li",
|
|
72
|
+
"nav",
|
|
73
|
+
"ol",
|
|
74
|
+
"p",
|
|
75
|
+
"select",
|
|
76
|
+
"span",
|
|
77
|
+
"svg",
|
|
78
|
+
"ul"
|
|
79
|
+
], A = yo.reduce((e, o) => {
|
|
80
|
+
const t = Se(`Primitive.${o}`), n = r.forwardRef((a, c) => {
|
|
81
|
+
const { asChild: i, ...s } = a, d = i ? t : o;
|
|
82
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ p(d, { ...s, ref: c });
|
|
83
|
+
});
|
|
84
|
+
return n.displayName = `Primitive.${o}`, { ...e, [o]: n };
|
|
85
|
+
}, {});
|
|
86
|
+
function Co(e, o) {
|
|
87
|
+
e && Me.flushSync(() => e.dispatchEvent(o));
|
|
88
|
+
}
|
|
89
|
+
var Eo = "DismissableLayer", Ne = "dismissableLayer.update", xo = "dismissableLayer.pointerDownOutside", bo = "dismissableLayer.focusOutside", Ve, Ge = r.createContext({
|
|
90
|
+
layers: /* @__PURE__ */ new Set(),
|
|
91
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
92
|
+
branches: /* @__PURE__ */ new Set()
|
|
93
|
+
}), Xe = r.forwardRef(
|
|
94
|
+
(e, o) => {
|
|
95
|
+
const {
|
|
96
|
+
disableOutsidePointerEvents: t = !1,
|
|
97
|
+
onEscapeKeyDown: n,
|
|
98
|
+
onPointerDownOutside: a,
|
|
99
|
+
onFocusOutside: c,
|
|
100
|
+
onInteractOutside: i,
|
|
101
|
+
onDismiss: s,
|
|
102
|
+
...d
|
|
103
|
+
} = e, u = r.useContext(Ge), [h, S] = r.useState(null), x = (h == null ? void 0 : h.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, y] = r.useState({}), b = D(o, (E) => S(E)), l = Array.from(u.layers), [v] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), g = l.indexOf(v), f = h ? l.indexOf(h) : -1, m = u.layersWithOutsidePointerEventsDisabled.size > 0, C = f >= g, R = To((E) => {
|
|
104
|
+
const M = E.target, H = [...u.branches].some((U) => U.contains(M));
|
|
105
|
+
!C || H || (a == null || a(E), i == null || i(E), E.defaultPrevented || s == null || s());
|
|
106
|
+
}, x), _ = Io((E) => {
|
|
107
|
+
const M = E.target;
|
|
108
|
+
[...u.branches].some((U) => U.contains(M)) || (c == null || c(E), i == null || i(E), E.defaultPrevented || s == null || s());
|
|
109
|
+
}, x);
|
|
110
|
+
return Jt((E) => {
|
|
111
|
+
f === u.layers.size - 1 && (n == null || n(E), !E.defaultPrevented && s && (E.preventDefault(), s()));
|
|
112
|
+
}, x), r.useEffect(() => {
|
|
113
|
+
if (h)
|
|
114
|
+
return t && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (Ve = x.body.style.pointerEvents, x.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(h)), u.layers.add(h), We(), () => {
|
|
115
|
+
t && u.layersWithOutsidePointerEventsDisabled.size === 1 && (x.body.style.pointerEvents = Ve);
|
|
116
|
+
};
|
|
117
|
+
}, [h, x, t, u]), r.useEffect(() => () => {
|
|
118
|
+
h && (u.layers.delete(h), u.layersWithOutsidePointerEventsDisabled.delete(h), We());
|
|
119
|
+
}, [h, u]), r.useEffect(() => {
|
|
120
|
+
const E = () => y({});
|
|
121
|
+
return document.addEventListener(Ne, E), () => document.removeEventListener(Ne, E);
|
|
122
|
+
}, []), /* @__PURE__ */ p(
|
|
123
|
+
A.div,
|
|
124
|
+
{
|
|
125
|
+
...d,
|
|
126
|
+
ref: b,
|
|
127
|
+
style: {
|
|
128
|
+
pointerEvents: m ? C ? "auto" : "none" : void 0,
|
|
129
|
+
...e.style
|
|
130
|
+
},
|
|
131
|
+
onFocusCapture: O(e.onFocusCapture, _.onFocusCapture),
|
|
132
|
+
onBlurCapture: O(e.onBlurCapture, _.onBlurCapture),
|
|
133
|
+
onPointerDownCapture: O(
|
|
134
|
+
e.onPointerDownCapture,
|
|
135
|
+
R.onPointerDownCapture
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
Xe.displayName = Eo;
|
|
142
|
+
var Po = "DismissableLayerBranch", No = r.forwardRef((e, o) => {
|
|
143
|
+
const t = r.useContext(Ge), n = r.useRef(null), a = D(o, n);
|
|
144
|
+
return r.useEffect(() => {
|
|
145
|
+
const c = n.current;
|
|
146
|
+
if (c)
|
|
147
|
+
return t.branches.add(c), () => {
|
|
148
|
+
t.branches.delete(c);
|
|
149
|
+
};
|
|
150
|
+
}, [t.branches]), /* @__PURE__ */ p(A.div, { ...e, ref: a });
|
|
151
|
+
});
|
|
152
|
+
No.displayName = Po;
|
|
153
|
+
function To(e, o = globalThis == null ? void 0 : globalThis.document) {
|
|
154
|
+
const t = le(e), n = r.useRef(!1), a = r.useRef(() => {
|
|
155
|
+
});
|
|
156
|
+
return r.useEffect(() => {
|
|
157
|
+
const c = (s) => {
|
|
158
|
+
if (s.target && !n.current) {
|
|
159
|
+
let d = function() {
|
|
160
|
+
qe(
|
|
161
|
+
xo,
|
|
162
|
+
t,
|
|
163
|
+
u,
|
|
164
|
+
{ discrete: !0 }
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
const u = { originalEvent: s };
|
|
168
|
+
s.pointerType === "touch" ? (o.removeEventListener("click", a.current), a.current = d, o.addEventListener("click", a.current, { once: !0 })) : d();
|
|
169
|
+
} else
|
|
170
|
+
o.removeEventListener("click", a.current);
|
|
171
|
+
n.current = !1;
|
|
172
|
+
}, i = window.setTimeout(() => {
|
|
173
|
+
o.addEventListener("pointerdown", c);
|
|
174
|
+
}, 0);
|
|
175
|
+
return () => {
|
|
176
|
+
window.clearTimeout(i), o.removeEventListener("pointerdown", c), o.removeEventListener("click", a.current);
|
|
177
|
+
};
|
|
178
|
+
}, [o, t]), {
|
|
179
|
+
// ensures we check React component tree (not just DOM tree)
|
|
180
|
+
onPointerDownCapture: () => n.current = !0
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function Io(e, o = globalThis == null ? void 0 : globalThis.document) {
|
|
184
|
+
const t = le(e), n = r.useRef(!1);
|
|
185
|
+
return r.useEffect(() => {
|
|
186
|
+
const a = (c) => {
|
|
187
|
+
c.target && !n.current && qe(bo, t, { originalEvent: c }, {
|
|
188
|
+
discrete: !1
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
return o.addEventListener("focusin", a), () => o.removeEventListener("focusin", a);
|
|
192
|
+
}, [o, t]), {
|
|
193
|
+
onFocusCapture: () => n.current = !0,
|
|
194
|
+
onBlurCapture: () => n.current = !1
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function We() {
|
|
198
|
+
const e = new CustomEvent(Ne);
|
|
199
|
+
document.dispatchEvent(e);
|
|
200
|
+
}
|
|
201
|
+
function qe(e, o, t, { discrete: n }) {
|
|
202
|
+
const a = t.originalEvent.target, c = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: t });
|
|
203
|
+
o && a.addEventListener(e, o, { once: !0 }), n ? Co(a, c) : a.dispatchEvent(c);
|
|
204
|
+
}
|
|
205
|
+
var be = "focusScope.autoFocusOnMount", Pe = "focusScope.autoFocusOnUnmount", $e = { bubbles: !1, cancelable: !0 }, Ro = "FocusScope", Ze = r.forwardRef((e, o) => {
|
|
206
|
+
const {
|
|
207
|
+
loop: t = !1,
|
|
208
|
+
trapped: n = !1,
|
|
209
|
+
onMountAutoFocus: a,
|
|
210
|
+
onUnmountAutoFocus: c,
|
|
211
|
+
...i
|
|
212
|
+
} = e, [s, d] = r.useState(null), u = le(a), h = le(c), S = r.useRef(null), x = D(o, (l) => d(l)), y = r.useRef({
|
|
213
|
+
paused: !1,
|
|
214
|
+
pause() {
|
|
215
|
+
this.paused = !0;
|
|
216
|
+
},
|
|
217
|
+
resume() {
|
|
218
|
+
this.paused = !1;
|
|
219
|
+
}
|
|
220
|
+
}).current;
|
|
221
|
+
r.useEffect(() => {
|
|
222
|
+
if (n) {
|
|
223
|
+
let l = function(m) {
|
|
224
|
+
if (y.paused || !s) return;
|
|
225
|
+
const C = m.target;
|
|
226
|
+
s.contains(C) ? S.current = C : Q(S.current, { select: !0 });
|
|
227
|
+
}, v = function(m) {
|
|
228
|
+
if (y.paused || !s) return;
|
|
229
|
+
const C = m.relatedTarget;
|
|
230
|
+
C !== null && (s.contains(C) || Q(S.current, { select: !0 }));
|
|
231
|
+
}, g = function(m) {
|
|
232
|
+
if (document.activeElement === document.body)
|
|
233
|
+
for (const R of m)
|
|
234
|
+
R.removedNodes.length > 0 && Q(s);
|
|
235
|
+
};
|
|
236
|
+
document.addEventListener("focusin", l), document.addEventListener("focusout", v);
|
|
237
|
+
const f = new MutationObserver(g);
|
|
238
|
+
return s && f.observe(s, { childList: !0, subtree: !0 }), () => {
|
|
239
|
+
document.removeEventListener("focusin", l), document.removeEventListener("focusout", v), f.disconnect();
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}, [n, s, y.paused]), r.useEffect(() => {
|
|
243
|
+
if (s) {
|
|
244
|
+
ze.add(y);
|
|
245
|
+
const l = document.activeElement;
|
|
246
|
+
if (!s.contains(l)) {
|
|
247
|
+
const g = new CustomEvent(be, $e);
|
|
248
|
+
s.addEventListener(be, u), s.dispatchEvent(g), g.defaultPrevented || (Ao(Lo(Je(s)), { select: !0 }), document.activeElement === l && Q(s));
|
|
249
|
+
}
|
|
250
|
+
return () => {
|
|
251
|
+
s.removeEventListener(be, u), setTimeout(() => {
|
|
252
|
+
const g = new CustomEvent(Pe, $e);
|
|
253
|
+
s.addEventListener(Pe, h), s.dispatchEvent(g), g.defaultPrevented || Q(l ?? document.body, { select: !0 }), s.removeEventListener(Pe, h), ze.remove(y);
|
|
254
|
+
}, 0);
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}, [s, u, h, y]);
|
|
258
|
+
const b = r.useCallback(
|
|
259
|
+
(l) => {
|
|
260
|
+
if (!t && !n || y.paused) return;
|
|
261
|
+
const v = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, g = document.activeElement;
|
|
262
|
+
if (v && g) {
|
|
263
|
+
const f = l.currentTarget, [m, C] = _o(f);
|
|
264
|
+
m && C ? !l.shiftKey && g === C ? (l.preventDefault(), t && Q(m, { select: !0 })) : l.shiftKey && g === m && (l.preventDefault(), t && Q(C, { select: !0 })) : g === f && l.preventDefault();
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
[t, n, y.paused]
|
|
268
|
+
);
|
|
269
|
+
return /* @__PURE__ */ p(A.div, { tabIndex: -1, ...i, ref: x, onKeyDown: b });
|
|
270
|
+
});
|
|
271
|
+
Ze.displayName = Ro;
|
|
272
|
+
function Ao(e, { select: o = !1 } = {}) {
|
|
273
|
+
const t = document.activeElement;
|
|
274
|
+
for (const n of e)
|
|
275
|
+
if (Q(n, { select: o }), document.activeElement !== t) return;
|
|
276
|
+
}
|
|
277
|
+
function _o(e) {
|
|
278
|
+
const o = Je(e), t = Ke(o, e), n = Ke(o.reverse(), e);
|
|
279
|
+
return [t, n];
|
|
280
|
+
}
|
|
281
|
+
function Je(e) {
|
|
282
|
+
const o = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
283
|
+
acceptNode: (n) => {
|
|
284
|
+
const a = n.tagName === "INPUT" && n.type === "hidden";
|
|
285
|
+
return n.disabled || n.hidden || a ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
for (; t.nextNode(); ) o.push(t.currentNode);
|
|
289
|
+
return o;
|
|
290
|
+
}
|
|
291
|
+
function Ke(e, o) {
|
|
292
|
+
for (const t of e)
|
|
293
|
+
if (!Oo(t, { upTo: o })) return t;
|
|
294
|
+
}
|
|
295
|
+
function Oo(e, { upTo: o }) {
|
|
296
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
297
|
+
for (; e; ) {
|
|
298
|
+
if (o !== void 0 && e === o) return !1;
|
|
299
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
300
|
+
e = e.parentElement;
|
|
301
|
+
}
|
|
302
|
+
return !1;
|
|
303
|
+
}
|
|
304
|
+
function Mo(e) {
|
|
305
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
306
|
+
}
|
|
307
|
+
function Q(e, { select: o = !1 } = {}) {
|
|
308
|
+
if (e && e.focus) {
|
|
309
|
+
const t = document.activeElement;
|
|
310
|
+
e.focus({ preventScroll: !0 }), e !== t && Mo(e) && o && e.select();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
var ze = Do();
|
|
314
|
+
function Do() {
|
|
315
|
+
let e = [];
|
|
316
|
+
return {
|
|
317
|
+
add(o) {
|
|
318
|
+
const t = e[0];
|
|
319
|
+
o !== t && (t == null || t.pause()), e = Ye(e, o), e.unshift(o);
|
|
320
|
+
},
|
|
321
|
+
remove(o) {
|
|
322
|
+
var t;
|
|
323
|
+
e = Ye(e, o), (t = e[0]) == null || t.resume();
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function Ye(e, o) {
|
|
328
|
+
const t = [...e], n = t.indexOf(o);
|
|
329
|
+
return n !== -1 && t.splice(n, 1), t;
|
|
330
|
+
}
|
|
331
|
+
function Lo(e) {
|
|
332
|
+
return e.filter((o) => o.tagName !== "A");
|
|
333
|
+
}
|
|
334
|
+
var Fo = "Arrow", Qe = r.forwardRef((e, o) => {
|
|
335
|
+
const { children: t, width: n = 10, height: a = 5, ...c } = e;
|
|
336
|
+
return /* @__PURE__ */ p(
|
|
337
|
+
A.svg,
|
|
338
|
+
{
|
|
339
|
+
...c,
|
|
340
|
+
ref: o,
|
|
341
|
+
width: n,
|
|
342
|
+
height: a,
|
|
343
|
+
viewBox: "0 0 30 10",
|
|
344
|
+
preserveAspectRatio: "none",
|
|
345
|
+
children: e.asChild ? t : /* @__PURE__ */ p("polygon", { points: "0,0 30,0 15,10" })
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
});
|
|
349
|
+
Qe.displayName = Fo;
|
|
350
|
+
var ko = Qe, Fe = "Popper", [et, tt] = De(Fe), [Bo, ot] = et(Fe), nt = (e) => {
|
|
351
|
+
const { __scopePopper: o, children: t } = e, [n, a] = r.useState(null);
|
|
352
|
+
return /* @__PURE__ */ p(Bo, { scope: o, anchor: n, onAnchorChange: a, children: t });
|
|
353
|
+
};
|
|
354
|
+
nt.displayName = Fe;
|
|
355
|
+
var rt = "PopperAnchor", st = r.forwardRef(
|
|
356
|
+
(e, o) => {
|
|
357
|
+
const { __scopePopper: t, virtualRef: n, ...a } = e, c = ot(rt, t), i = r.useRef(null), s = D(o, i), d = r.useRef(null);
|
|
358
|
+
return r.useEffect(() => {
|
|
359
|
+
const u = d.current;
|
|
360
|
+
d.current = (n == null ? void 0 : n.current) || i.current, u !== d.current && c.onAnchorChange(d.current);
|
|
361
|
+
}), n ? null : /* @__PURE__ */ p(A.div, { ...a, ref: s });
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
st.displayName = rt;
|
|
365
|
+
var ke = "PopperContent", [Ho, Uo] = et(ke), at = r.forwardRef(
|
|
366
|
+
(e, o) => {
|
|
367
|
+
var w, I, k, T, P, N;
|
|
368
|
+
const {
|
|
369
|
+
__scopePopper: t,
|
|
370
|
+
side: n = "bottom",
|
|
371
|
+
sideOffset: a = 0,
|
|
372
|
+
align: c = "center",
|
|
373
|
+
alignOffset: i = 0,
|
|
374
|
+
arrowPadding: s = 0,
|
|
375
|
+
avoidCollisions: d = !0,
|
|
376
|
+
collisionBoundary: u = [],
|
|
377
|
+
collisionPadding: h = 0,
|
|
378
|
+
sticky: S = "partial",
|
|
379
|
+
hideWhenDetached: x = !1,
|
|
380
|
+
updatePositionStrategy: y = "optimized",
|
|
381
|
+
onPlaced: b,
|
|
382
|
+
...l
|
|
383
|
+
} = e, v = ot(ke, t), [g, f] = r.useState(null), m = D(o, (W) => f(W)), [C, R] = r.useState(null), _ = Qt(C), E = (_ == null ? void 0 : _.width) ?? 0, M = (_ == null ? void 0 : _.height) ?? 0, H = n + (c !== "center" ? "-" + c : ""), U = typeof h == "number" ? h : { top: 0, right: 0, bottom: 0, left: 0, ...h }, $ = Array.isArray(u) ? u : [u], z = $.length > 0, V = {
|
|
384
|
+
padding: U,
|
|
385
|
+
boundary: $.filter(Wo),
|
|
386
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
387
|
+
altBoundary: z
|
|
388
|
+
}, { refs: Y, floatingStyles: K, placement: L, isPositioned: B, middlewareData: F } = eo({
|
|
389
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
390
|
+
strategy: "fixed",
|
|
391
|
+
placement: H,
|
|
392
|
+
whileElementsMounted: (...W) => io(...W, {
|
|
393
|
+
animationFrame: y === "always"
|
|
394
|
+
}),
|
|
395
|
+
elements: {
|
|
396
|
+
reference: v.anchor
|
|
397
|
+
},
|
|
398
|
+
middleware: [
|
|
399
|
+
to({ mainAxis: a + M, alignmentAxis: i }),
|
|
400
|
+
d && oo({
|
|
401
|
+
mainAxis: !0,
|
|
402
|
+
crossAxis: !1,
|
|
403
|
+
limiter: S === "partial" ? co() : void 0,
|
|
404
|
+
...V
|
|
405
|
+
}),
|
|
406
|
+
d && no({ ...V }),
|
|
407
|
+
ro({
|
|
408
|
+
...V,
|
|
409
|
+
apply: ({ elements: W, rects: q, availableWidth: me, availableHeight: he }) => {
|
|
410
|
+
const { width: ve, height: qt } = q.reference, we = W.floating.style;
|
|
411
|
+
we.setProperty("--radix-popper-available-width", `${me}px`), we.setProperty("--radix-popper-available-height", `${he}px`), we.setProperty("--radix-popper-anchor-width", `${ve}px`), we.setProperty("--radix-popper-anchor-height", `${qt}px`);
|
|
412
|
+
}
|
|
413
|
+
}),
|
|
414
|
+
C && so({ element: C, padding: s }),
|
|
415
|
+
$o({ arrowWidth: E, arrowHeight: M }),
|
|
416
|
+
x && ao({ strategy: "referenceHidden", ...V })
|
|
417
|
+
]
|
|
418
|
+
}), [j, ue] = lt(L), Z = le(b);
|
|
419
|
+
X(() => {
|
|
420
|
+
B && (Z == null || Z());
|
|
421
|
+
}, [B, Z]);
|
|
422
|
+
const pe = (w = F.arrow) == null ? void 0 : w.x, fe = (I = F.arrow) == null ? void 0 : I.y, J = ((k = F.arrow) == null ? void 0 : k.centerOffset) !== 0, [ce, ne] = r.useState();
|
|
423
|
+
return X(() => {
|
|
424
|
+
g && ne(window.getComputedStyle(g).zIndex);
|
|
425
|
+
}, [g]), /* @__PURE__ */ p(
|
|
426
|
+
"div",
|
|
427
|
+
{
|
|
428
|
+
ref: Y.setFloating,
|
|
429
|
+
"data-radix-popper-content-wrapper": "",
|
|
430
|
+
style: {
|
|
431
|
+
...K,
|
|
432
|
+
transform: B ? K.transform : "translate(0, -200%)",
|
|
433
|
+
// keep off the page when measuring
|
|
434
|
+
minWidth: "max-content",
|
|
435
|
+
zIndex: ce,
|
|
436
|
+
"--radix-popper-transform-origin": [
|
|
437
|
+
(T = F.transformOrigin) == null ? void 0 : T.x,
|
|
438
|
+
(P = F.transformOrigin) == null ? void 0 : P.y
|
|
439
|
+
].join(" "),
|
|
440
|
+
// hide the content if using the hide middleware and should be hidden
|
|
441
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
442
|
+
// as if the PopperContent isn't there at all
|
|
443
|
+
...((N = F.hide) == null ? void 0 : N.referenceHidden) && {
|
|
444
|
+
visibility: "hidden",
|
|
445
|
+
pointerEvents: "none"
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
dir: e.dir,
|
|
449
|
+
children: /* @__PURE__ */ p(
|
|
450
|
+
Ho,
|
|
451
|
+
{
|
|
452
|
+
scope: t,
|
|
453
|
+
placedSide: j,
|
|
454
|
+
onArrowChange: R,
|
|
455
|
+
arrowX: pe,
|
|
456
|
+
arrowY: fe,
|
|
457
|
+
shouldHideArrow: J,
|
|
458
|
+
children: /* @__PURE__ */ p(
|
|
459
|
+
A.div,
|
|
460
|
+
{
|
|
461
|
+
"data-side": j,
|
|
462
|
+
"data-align": ue,
|
|
463
|
+
...l,
|
|
464
|
+
ref: m,
|
|
465
|
+
style: {
|
|
466
|
+
...l.style,
|
|
467
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
468
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
469
|
+
animation: B ? void 0 : "none"
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
}
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
at.displayName = ke;
|
|
480
|
+
var it = "PopperArrow", Vo = {
|
|
481
|
+
top: "bottom",
|
|
482
|
+
right: "left",
|
|
483
|
+
bottom: "top",
|
|
484
|
+
left: "right"
|
|
485
|
+
}, ct = r.forwardRef(function(o, t) {
|
|
486
|
+
const { __scopePopper: n, ...a } = o, c = Uo(it, n), i = Vo[c.placedSide];
|
|
487
|
+
return (
|
|
488
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
489
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
490
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
491
|
+
/* @__PURE__ */ p(
|
|
492
|
+
"span",
|
|
493
|
+
{
|
|
494
|
+
ref: c.onArrowChange,
|
|
495
|
+
style: {
|
|
496
|
+
position: "absolute",
|
|
497
|
+
left: c.arrowX,
|
|
498
|
+
top: c.arrowY,
|
|
499
|
+
[i]: 0,
|
|
500
|
+
transformOrigin: {
|
|
501
|
+
top: "",
|
|
502
|
+
right: "0 0",
|
|
503
|
+
bottom: "center 0",
|
|
504
|
+
left: "100% 0"
|
|
505
|
+
}[c.placedSide],
|
|
506
|
+
transform: {
|
|
507
|
+
top: "translateY(100%)",
|
|
508
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
509
|
+
bottom: "rotate(180deg)",
|
|
510
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
511
|
+
}[c.placedSide],
|
|
512
|
+
visibility: c.shouldHideArrow ? "hidden" : void 0
|
|
513
|
+
},
|
|
514
|
+
children: /* @__PURE__ */ p(
|
|
515
|
+
ko,
|
|
516
|
+
{
|
|
517
|
+
...a,
|
|
518
|
+
ref: t,
|
|
519
|
+
style: {
|
|
520
|
+
...a.style,
|
|
521
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
522
|
+
display: "block"
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
);
|
|
529
|
+
});
|
|
530
|
+
ct.displayName = it;
|
|
531
|
+
function Wo(e) {
|
|
532
|
+
return e !== null;
|
|
533
|
+
}
|
|
534
|
+
var $o = (e) => ({
|
|
535
|
+
name: "transformOrigin",
|
|
536
|
+
options: e,
|
|
537
|
+
fn(o) {
|
|
538
|
+
var v, g, f;
|
|
539
|
+
const { placement: t, rects: n, middlewareData: a } = o, i = ((v = a.arrow) == null ? void 0 : v.centerOffset) !== 0, s = i ? 0 : e.arrowWidth, d = i ? 0 : e.arrowHeight, [u, h] = lt(t), S = { start: "0%", center: "50%", end: "100%" }[h], x = (((g = a.arrow) == null ? void 0 : g.x) ?? 0) + s / 2, y = (((f = a.arrow) == null ? void 0 : f.y) ?? 0) + d / 2;
|
|
540
|
+
let b = "", l = "";
|
|
541
|
+
return u === "bottom" ? (b = i ? S : `${x}px`, l = `${-d}px`) : u === "top" ? (b = i ? S : `${x}px`, l = `${n.floating.height + d}px`) : u === "right" ? (b = `${-d}px`, l = i ? S : `${y}px`) : u === "left" && (b = `${n.floating.width + d}px`, l = i ? S : `${y}px`), { data: { x: b, y: l } };
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
function lt(e) {
|
|
545
|
+
const [o, t = "center"] = e.split("-");
|
|
546
|
+
return [o, t];
|
|
547
|
+
}
|
|
548
|
+
var Ko = nt, zo = st, Yo = at, jo = ct, Go = "Portal", dt = r.forwardRef((e, o) => {
|
|
549
|
+
var s;
|
|
550
|
+
const { container: t, ...n } = e, [a, c] = r.useState(!1);
|
|
551
|
+
X(() => c(!0), []);
|
|
552
|
+
const i = t || a && ((s = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : s.body);
|
|
553
|
+
return i ? Zt.createPortal(/* @__PURE__ */ p(A.div, { ...n, ref: o }), i) : null;
|
|
554
|
+
});
|
|
555
|
+
dt.displayName = Go;
|
|
556
|
+
var ut = Object.freeze({
|
|
557
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
558
|
+
position: "absolute",
|
|
559
|
+
border: 0,
|
|
560
|
+
width: 1,
|
|
561
|
+
height: 1,
|
|
562
|
+
padding: 0,
|
|
563
|
+
margin: -1,
|
|
564
|
+
overflow: "hidden",
|
|
565
|
+
clip: "rect(0, 0, 0, 0)",
|
|
566
|
+
whiteSpace: "nowrap",
|
|
567
|
+
wordWrap: "normal"
|
|
568
|
+
}), Xo = "VisuallyHidden", qo = r.forwardRef(
|
|
569
|
+
(e, o) => /* @__PURE__ */ p(
|
|
570
|
+
A.span,
|
|
571
|
+
{
|
|
572
|
+
...e,
|
|
573
|
+
ref: o,
|
|
574
|
+
style: { ...ut, ...e.style }
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
);
|
|
578
|
+
qo.displayName = Xo;
|
|
579
|
+
var Zo = [" ", "Enter", "ArrowUp", "ArrowDown"], Jo = [" ", "Enter"], ae = "Select", [Ce, Ee, Qo] = So(ae), [de] = De(ae, [
|
|
580
|
+
Qo,
|
|
581
|
+
tt
|
|
582
|
+
]), xe = tt(), [en, te] = de(ae), [tn, on] = de(ae), pt = (e) => {
|
|
583
|
+
const {
|
|
584
|
+
__scopeSelect: o,
|
|
585
|
+
children: t,
|
|
586
|
+
open: n,
|
|
587
|
+
defaultOpen: a,
|
|
588
|
+
onOpenChange: c,
|
|
589
|
+
value: i,
|
|
590
|
+
defaultValue: s,
|
|
591
|
+
onValueChange: d,
|
|
592
|
+
dir: u,
|
|
593
|
+
name: h,
|
|
594
|
+
autoComplete: S,
|
|
595
|
+
disabled: x,
|
|
596
|
+
required: y,
|
|
597
|
+
form: b
|
|
598
|
+
} = e, l = xe(o), [v, g] = r.useState(null), [f, m] = r.useState(null), [C, R] = r.useState(!1), _ = fo(u), [E, M] = He({
|
|
599
|
+
prop: n,
|
|
600
|
+
defaultProp: a ?? !1,
|
|
601
|
+
onChange: c,
|
|
602
|
+
caller: ae
|
|
603
|
+
}), [H, U] = He({
|
|
604
|
+
prop: i,
|
|
605
|
+
defaultProp: s,
|
|
606
|
+
onChange: d,
|
|
607
|
+
caller: ae
|
|
608
|
+
}), $ = r.useRef(null), z = v ? b || !!v.closest("form") : !0, [V, Y] = r.useState(/* @__PURE__ */ new Set()), K = Array.from(V).map((L) => L.props.value).join(";");
|
|
609
|
+
return /* @__PURE__ */ p(Ko, { ...l, children: /* @__PURE__ */ se(
|
|
610
|
+
en,
|
|
611
|
+
{
|
|
612
|
+
required: y,
|
|
613
|
+
scope: o,
|
|
614
|
+
trigger: v,
|
|
615
|
+
onTriggerChange: g,
|
|
616
|
+
valueNode: f,
|
|
617
|
+
onValueNodeChange: m,
|
|
618
|
+
valueNodeHasChildren: C,
|
|
619
|
+
onValueNodeHasChildrenChange: R,
|
|
620
|
+
contentId: Le(),
|
|
621
|
+
value: H,
|
|
622
|
+
onValueChange: U,
|
|
623
|
+
open: E,
|
|
624
|
+
onOpenChange: M,
|
|
625
|
+
dir: _,
|
|
626
|
+
triggerPointerDownPosRef: $,
|
|
627
|
+
disabled: x,
|
|
628
|
+
children: [
|
|
629
|
+
/* @__PURE__ */ p(Ce.Provider, { scope: o, children: /* @__PURE__ */ p(
|
|
630
|
+
tn,
|
|
631
|
+
{
|
|
632
|
+
scope: e.__scopeSelect,
|
|
633
|
+
onNativeOptionAdd: r.useCallback((L) => {
|
|
634
|
+
Y((B) => new Set(B).add(L));
|
|
635
|
+
}, []),
|
|
636
|
+
onNativeOptionRemove: r.useCallback((L) => {
|
|
637
|
+
Y((B) => {
|
|
638
|
+
const F = new Set(B);
|
|
639
|
+
return F.delete(L), F;
|
|
640
|
+
});
|
|
641
|
+
}, []),
|
|
642
|
+
children: t
|
|
643
|
+
}
|
|
644
|
+
) }),
|
|
645
|
+
z ? /* @__PURE__ */ se(
|
|
646
|
+
kt,
|
|
647
|
+
{
|
|
648
|
+
"aria-hidden": !0,
|
|
649
|
+
required: y,
|
|
650
|
+
tabIndex: -1,
|
|
651
|
+
name: h,
|
|
652
|
+
autoComplete: S,
|
|
653
|
+
value: H,
|
|
654
|
+
onChange: (L) => U(L.target.value),
|
|
655
|
+
disabled: x,
|
|
656
|
+
form: b,
|
|
657
|
+
children: [
|
|
658
|
+
H === void 0 ? /* @__PURE__ */ p("option", { value: "" }) : null,
|
|
659
|
+
Array.from(V)
|
|
660
|
+
]
|
|
661
|
+
},
|
|
662
|
+
K
|
|
663
|
+
) : null
|
|
664
|
+
]
|
|
665
|
+
}
|
|
666
|
+
) });
|
|
667
|
+
};
|
|
668
|
+
pt.displayName = ae;
|
|
669
|
+
var ft = "SelectTrigger", mt = r.forwardRef(
|
|
670
|
+
(e, o) => {
|
|
671
|
+
const { __scopeSelect: t, disabled: n = !1, ...a } = e, c = xe(t), i = te(ft, t), s = i.disabled || n, d = D(o, i.onTriggerChange), u = Ee(t), h = r.useRef("touch"), [S, x, y] = Ht((l) => {
|
|
672
|
+
const v = u().filter((m) => !m.disabled), g = v.find((m) => m.value === i.value), f = Ut(v, l, g);
|
|
673
|
+
f !== void 0 && i.onValueChange(f.value);
|
|
674
|
+
}), b = (l) => {
|
|
675
|
+
s || (i.onOpenChange(!0), y()), l && (i.triggerPointerDownPosRef.current = {
|
|
676
|
+
x: Math.round(l.pageX),
|
|
677
|
+
y: Math.round(l.pageY)
|
|
678
|
+
});
|
|
679
|
+
};
|
|
680
|
+
return /* @__PURE__ */ p(zo, { asChild: !0, ...c, children: /* @__PURE__ */ p(
|
|
681
|
+
A.button,
|
|
682
|
+
{
|
|
683
|
+
type: "button",
|
|
684
|
+
role: "combobox",
|
|
685
|
+
"aria-controls": i.contentId,
|
|
686
|
+
"aria-expanded": i.open,
|
|
687
|
+
"aria-required": i.required,
|
|
688
|
+
"aria-autocomplete": "none",
|
|
689
|
+
dir: i.dir,
|
|
690
|
+
"data-state": i.open ? "open" : "closed",
|
|
691
|
+
disabled: s,
|
|
692
|
+
"data-disabled": s ? "" : void 0,
|
|
693
|
+
"data-placeholder": Bt(i.value) ? "" : void 0,
|
|
694
|
+
...a,
|
|
695
|
+
ref: d,
|
|
696
|
+
onClick: O(a.onClick, (l) => {
|
|
697
|
+
l.currentTarget.focus(), h.current !== "mouse" && b(l);
|
|
698
|
+
}),
|
|
699
|
+
onPointerDown: O(a.onPointerDown, (l) => {
|
|
700
|
+
h.current = l.pointerType;
|
|
701
|
+
const v = l.target;
|
|
702
|
+
v.hasPointerCapture(l.pointerId) && v.releasePointerCapture(l.pointerId), l.button === 0 && l.ctrlKey === !1 && l.pointerType === "mouse" && (b(l), l.preventDefault());
|
|
703
|
+
}),
|
|
704
|
+
onKeyDown: O(a.onKeyDown, (l) => {
|
|
705
|
+
const v = S.current !== "";
|
|
706
|
+
!(l.ctrlKey || l.altKey || l.metaKey) && l.key.length === 1 && x(l.key), !(v && l.key === " ") && Zo.includes(l.key) && (b(), l.preventDefault());
|
|
707
|
+
})
|
|
708
|
+
}
|
|
709
|
+
) });
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
mt.displayName = ft;
|
|
713
|
+
var ht = "SelectValue", vt = r.forwardRef(
|
|
714
|
+
(e, o) => {
|
|
715
|
+
const { __scopeSelect: t, className: n, style: a, children: c, placeholder: i = "", ...s } = e, d = te(ht, t), { onValueNodeHasChildrenChange: u } = d, h = c !== void 0, S = D(o, d.onValueNodeChange);
|
|
716
|
+
return X(() => {
|
|
717
|
+
u(h);
|
|
718
|
+
}, [u, h]), /* @__PURE__ */ p(
|
|
719
|
+
A.span,
|
|
720
|
+
{
|
|
721
|
+
...s,
|
|
722
|
+
ref: S,
|
|
723
|
+
style: { pointerEvents: "none" },
|
|
724
|
+
children: Bt(d.value) ? /* @__PURE__ */ p(Oe, { children: i }) : c
|
|
725
|
+
}
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
vt.displayName = ht;
|
|
730
|
+
var nn = "SelectIcon", gt = r.forwardRef(
|
|
731
|
+
(e, o) => {
|
|
732
|
+
const { __scopeSelect: t, children: n, ...a } = e;
|
|
733
|
+
return /* @__PURE__ */ p(A.span, { "aria-hidden": !0, ...a, ref: o, children: n || "▼" });
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
gt.displayName = nn;
|
|
737
|
+
var rn = "SelectPortal", wt = (e) => /* @__PURE__ */ p(dt, { asChild: !0, ...e });
|
|
738
|
+
wt.displayName = rn;
|
|
739
|
+
var ie = "SelectContent", St = r.forwardRef(
|
|
740
|
+
(e, o) => {
|
|
741
|
+
const t = te(ie, e.__scopeSelect), [n, a] = r.useState();
|
|
742
|
+
if (X(() => {
|
|
743
|
+
a(new DocumentFragment());
|
|
744
|
+
}, []), !t.open) {
|
|
745
|
+
const c = n;
|
|
746
|
+
return c ? Me.createPortal(
|
|
747
|
+
/* @__PURE__ */ p(yt, { scope: e.__scopeSelect, children: /* @__PURE__ */ p(Ce.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ p("div", { children: e.children }) }) }),
|
|
748
|
+
c
|
|
749
|
+
) : null;
|
|
750
|
+
}
|
|
751
|
+
return /* @__PURE__ */ p(Ct, { ...e, ref: o });
|
|
752
|
+
}
|
|
753
|
+
);
|
|
754
|
+
St.displayName = ie;
|
|
755
|
+
var G = 10, [yt, oe] = de(ie), sn = "SelectContentImpl", an = Se("SelectContent.RemoveScroll"), Ct = r.forwardRef(
|
|
756
|
+
(e, o) => {
|
|
757
|
+
const {
|
|
758
|
+
__scopeSelect: t,
|
|
759
|
+
position: n = "item-aligned",
|
|
760
|
+
onCloseAutoFocus: a,
|
|
761
|
+
onEscapeKeyDown: c,
|
|
762
|
+
onPointerDownOutside: i,
|
|
763
|
+
//
|
|
764
|
+
// PopperContent props
|
|
765
|
+
side: s,
|
|
766
|
+
sideOffset: d,
|
|
767
|
+
align: u,
|
|
768
|
+
alignOffset: h,
|
|
769
|
+
arrowPadding: S,
|
|
770
|
+
collisionBoundary: x,
|
|
771
|
+
collisionPadding: y,
|
|
772
|
+
sticky: b,
|
|
773
|
+
hideWhenDetached: l,
|
|
774
|
+
avoidCollisions: v,
|
|
775
|
+
//
|
|
776
|
+
...g
|
|
777
|
+
} = e, f = te(ie, t), [m, C] = r.useState(null), [R, _] = r.useState(null), E = D(o, (w) => C(w)), [M, H] = r.useState(null), [U, $] = r.useState(
|
|
778
|
+
null
|
|
779
|
+
), z = Ee(t), [V, Y] = r.useState(!1), K = r.useRef(!1);
|
|
780
|
+
r.useEffect(() => {
|
|
781
|
+
if (m) return lo(m);
|
|
782
|
+
}, [m]), uo();
|
|
783
|
+
const L = r.useCallback(
|
|
784
|
+
(w) => {
|
|
785
|
+
const [I, ...k] = z().map((N) => N.ref.current), [T] = k.slice(-1), P = document.activeElement;
|
|
786
|
+
for (const N of w)
|
|
787
|
+
if (N === P || (N == null || N.scrollIntoView({ block: "nearest" }), N === I && R && (R.scrollTop = 0), N === T && R && (R.scrollTop = R.scrollHeight), N == null || N.focus(), document.activeElement !== P)) return;
|
|
788
|
+
},
|
|
789
|
+
[z, R]
|
|
790
|
+
), B = r.useCallback(
|
|
791
|
+
() => L([M, m]),
|
|
792
|
+
[L, M, m]
|
|
793
|
+
);
|
|
794
|
+
r.useEffect(() => {
|
|
795
|
+
V && B();
|
|
796
|
+
}, [V, B]);
|
|
797
|
+
const { onOpenChange: F, triggerPointerDownPosRef: j } = f;
|
|
798
|
+
r.useEffect(() => {
|
|
799
|
+
if (m) {
|
|
800
|
+
let w = { x: 0, y: 0 };
|
|
801
|
+
const I = (T) => {
|
|
802
|
+
var P, N;
|
|
803
|
+
w = {
|
|
804
|
+
x: Math.abs(Math.round(T.pageX) - (((P = j.current) == null ? void 0 : P.x) ?? 0)),
|
|
805
|
+
y: Math.abs(Math.round(T.pageY) - (((N = j.current) == null ? void 0 : N.y) ?? 0))
|
|
806
|
+
};
|
|
807
|
+
}, k = (T) => {
|
|
808
|
+
w.x <= 10 && w.y <= 10 ? T.preventDefault() : m.contains(T.target) || F(!1), document.removeEventListener("pointermove", I), j.current = null;
|
|
809
|
+
};
|
|
810
|
+
return j.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", k, { capture: !0, once: !0 })), () => {
|
|
811
|
+
document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", k, { capture: !0 });
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
}, [m, F, j]), r.useEffect(() => {
|
|
815
|
+
const w = () => F(!1);
|
|
816
|
+
return window.addEventListener("blur", w), window.addEventListener("resize", w), () => {
|
|
817
|
+
window.removeEventListener("blur", w), window.removeEventListener("resize", w);
|
|
818
|
+
};
|
|
819
|
+
}, [F]);
|
|
820
|
+
const [ue, Z] = Ht((w) => {
|
|
821
|
+
const I = z().filter((P) => !P.disabled), k = I.find((P) => P.ref.current === document.activeElement), T = Ut(I, w, k);
|
|
822
|
+
T && setTimeout(() => T.ref.current.focus());
|
|
823
|
+
}), pe = r.useCallback(
|
|
824
|
+
(w, I, k) => {
|
|
825
|
+
const T = !K.current && !k;
|
|
826
|
+
(f.value !== void 0 && f.value === I || T) && (H(w), T && (K.current = !0));
|
|
827
|
+
},
|
|
828
|
+
[f.value]
|
|
829
|
+
), fe = r.useCallback(() => m == null ? void 0 : m.focus(), [m]), J = r.useCallback(
|
|
830
|
+
(w, I, k) => {
|
|
831
|
+
const T = !K.current && !k;
|
|
832
|
+
(f.value !== void 0 && f.value === I || T) && $(w);
|
|
833
|
+
},
|
|
834
|
+
[f.value]
|
|
835
|
+
), ce = n === "popper" ? Te : Et, ne = ce === Te ? {
|
|
836
|
+
side: s,
|
|
837
|
+
sideOffset: d,
|
|
838
|
+
align: u,
|
|
839
|
+
alignOffset: h,
|
|
840
|
+
arrowPadding: S,
|
|
841
|
+
collisionBoundary: x,
|
|
842
|
+
collisionPadding: y,
|
|
843
|
+
sticky: b,
|
|
844
|
+
hideWhenDetached: l,
|
|
845
|
+
avoidCollisions: v
|
|
846
|
+
} : {};
|
|
847
|
+
return /* @__PURE__ */ p(
|
|
848
|
+
yt,
|
|
849
|
+
{
|
|
850
|
+
scope: t,
|
|
851
|
+
content: m,
|
|
852
|
+
viewport: R,
|
|
853
|
+
onViewportChange: _,
|
|
854
|
+
itemRefCallback: pe,
|
|
855
|
+
selectedItem: M,
|
|
856
|
+
onItemLeave: fe,
|
|
857
|
+
itemTextRefCallback: J,
|
|
858
|
+
focusSelectedItem: B,
|
|
859
|
+
selectedItemText: U,
|
|
860
|
+
position: n,
|
|
861
|
+
isPositioned: V,
|
|
862
|
+
searchRef: ue,
|
|
863
|
+
children: /* @__PURE__ */ p(po, { as: an, allowPinchZoom: !0, children: /* @__PURE__ */ p(
|
|
864
|
+
Ze,
|
|
865
|
+
{
|
|
866
|
+
asChild: !0,
|
|
867
|
+
trapped: f.open,
|
|
868
|
+
onMountAutoFocus: (w) => {
|
|
869
|
+
w.preventDefault();
|
|
870
|
+
},
|
|
871
|
+
onUnmountAutoFocus: O(a, (w) => {
|
|
872
|
+
var I;
|
|
873
|
+
(I = f.trigger) == null || I.focus({ preventScroll: !0 }), w.preventDefault();
|
|
874
|
+
}),
|
|
875
|
+
children: /* @__PURE__ */ p(
|
|
876
|
+
Xe,
|
|
877
|
+
{
|
|
878
|
+
asChild: !0,
|
|
879
|
+
disableOutsidePointerEvents: !0,
|
|
880
|
+
onEscapeKeyDown: c,
|
|
881
|
+
onPointerDownOutside: i,
|
|
882
|
+
onFocusOutside: (w) => w.preventDefault(),
|
|
883
|
+
onDismiss: () => f.onOpenChange(!1),
|
|
884
|
+
children: /* @__PURE__ */ p(
|
|
885
|
+
ce,
|
|
886
|
+
{
|
|
887
|
+
role: "listbox",
|
|
888
|
+
id: f.contentId,
|
|
889
|
+
"data-state": f.open ? "open" : "closed",
|
|
890
|
+
dir: f.dir,
|
|
891
|
+
onContextMenu: (w) => w.preventDefault(),
|
|
892
|
+
...g,
|
|
893
|
+
...ne,
|
|
894
|
+
onPlaced: () => Y(!0),
|
|
895
|
+
ref: E,
|
|
896
|
+
style: {
|
|
897
|
+
// flex layout so we can place the scroll buttons properly
|
|
898
|
+
display: "flex",
|
|
899
|
+
flexDirection: "column",
|
|
900
|
+
// reset the outline by default as the content MAY get focused
|
|
901
|
+
outline: "none",
|
|
902
|
+
...g.style
|
|
903
|
+
},
|
|
904
|
+
onKeyDown: O(g.onKeyDown, (w) => {
|
|
905
|
+
const I = w.ctrlKey || w.altKey || w.metaKey;
|
|
906
|
+
if (w.key === "Tab" && w.preventDefault(), !I && w.key.length === 1 && Z(w.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(w.key)) {
|
|
907
|
+
let T = z().filter((P) => !P.disabled).map((P) => P.ref.current);
|
|
908
|
+
if (["ArrowUp", "End"].includes(w.key) && (T = T.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(w.key)) {
|
|
909
|
+
const P = w.target, N = T.indexOf(P);
|
|
910
|
+
T = T.slice(N + 1);
|
|
911
|
+
}
|
|
912
|
+
setTimeout(() => L(T)), w.preventDefault();
|
|
913
|
+
}
|
|
914
|
+
})
|
|
915
|
+
}
|
|
916
|
+
)
|
|
917
|
+
}
|
|
918
|
+
)
|
|
919
|
+
}
|
|
920
|
+
) })
|
|
921
|
+
}
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
Ct.displayName = sn;
|
|
926
|
+
var cn = "SelectItemAlignedPosition", Et = r.forwardRef((e, o) => {
|
|
927
|
+
const { __scopeSelect: t, onPlaced: n, ...a } = e, c = te(ie, t), i = oe(ie, t), [s, d] = r.useState(null), [u, h] = r.useState(null), S = D(o, (E) => h(E)), x = Ee(t), y = r.useRef(!1), b = r.useRef(!0), { viewport: l, selectedItem: v, selectedItemText: g, focusSelectedItem: f } = i, m = r.useCallback(() => {
|
|
928
|
+
if (c.trigger && c.valueNode && s && u && l && v && g) {
|
|
929
|
+
const E = c.trigger.getBoundingClientRect(), M = u.getBoundingClientRect(), H = c.valueNode.getBoundingClientRect(), U = g.getBoundingClientRect();
|
|
930
|
+
if (c.dir !== "rtl") {
|
|
931
|
+
const P = U.left - M.left, N = H.left - P, W = E.left - N, q = E.width + W, me = Math.max(q, M.width), he = window.innerWidth - G, ve = Ue(N, [
|
|
932
|
+
G,
|
|
933
|
+
// Prevents the content from going off the starting edge of the
|
|
934
|
+
// viewport. It may still go off the ending edge, but this can be
|
|
935
|
+
// controlled by the user since they may want to manage overflow in a
|
|
936
|
+
// specific way.
|
|
937
|
+
// https://github.com/radix-ui/primitives/issues/2049
|
|
938
|
+
Math.max(G, he - me)
|
|
939
|
+
]);
|
|
940
|
+
s.style.minWidth = q + "px", s.style.left = ve + "px";
|
|
941
|
+
} else {
|
|
942
|
+
const P = M.right - U.right, N = window.innerWidth - H.right - P, W = window.innerWidth - E.right - N, q = E.width + W, me = Math.max(q, M.width), he = window.innerWidth - G, ve = Ue(N, [
|
|
943
|
+
G,
|
|
944
|
+
Math.max(G, he - me)
|
|
945
|
+
]);
|
|
946
|
+
s.style.minWidth = q + "px", s.style.right = ve + "px";
|
|
947
|
+
}
|
|
948
|
+
const $ = x(), z = window.innerHeight - G * 2, V = l.scrollHeight, Y = window.getComputedStyle(u), K = parseInt(Y.borderTopWidth, 10), L = parseInt(Y.paddingTop, 10), B = parseInt(Y.borderBottomWidth, 10), F = parseInt(Y.paddingBottom, 10), j = K + L + V + F + B, ue = Math.min(v.offsetHeight * 5, j), Z = window.getComputedStyle(l), pe = parseInt(Z.paddingTop, 10), fe = parseInt(Z.paddingBottom, 10), J = E.top + E.height / 2 - G, ce = z - J, ne = v.offsetHeight / 2, w = v.offsetTop + ne, I = K + L + w, k = j - I;
|
|
949
|
+
if (I <= J) {
|
|
950
|
+
const P = $.length > 0 && v === $[$.length - 1].ref.current;
|
|
951
|
+
s.style.bottom = "0px";
|
|
952
|
+
const N = u.clientHeight - l.offsetTop - l.offsetHeight, W = Math.max(
|
|
953
|
+
ce,
|
|
954
|
+
ne + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
955
|
+
(P ? fe : 0) + N + B
|
|
956
|
+
), q = I + W;
|
|
957
|
+
s.style.height = q + "px";
|
|
958
|
+
} else {
|
|
959
|
+
const P = $.length > 0 && v === $[0].ref.current;
|
|
960
|
+
s.style.top = "0px";
|
|
961
|
+
const W = Math.max(
|
|
962
|
+
J,
|
|
963
|
+
K + l.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
964
|
+
(P ? pe : 0) + ne
|
|
965
|
+
) + k;
|
|
966
|
+
s.style.height = W + "px", l.scrollTop = I - J + l.offsetTop;
|
|
967
|
+
}
|
|
968
|
+
s.style.margin = `${G}px 0`, s.style.minHeight = ue + "px", s.style.maxHeight = z + "px", n == null || n(), requestAnimationFrame(() => y.current = !0);
|
|
969
|
+
}
|
|
970
|
+
}, [
|
|
971
|
+
x,
|
|
972
|
+
c.trigger,
|
|
973
|
+
c.valueNode,
|
|
974
|
+
s,
|
|
975
|
+
u,
|
|
976
|
+
l,
|
|
977
|
+
v,
|
|
978
|
+
g,
|
|
979
|
+
c.dir,
|
|
980
|
+
n
|
|
981
|
+
]);
|
|
982
|
+
X(() => m(), [m]);
|
|
983
|
+
const [C, R] = r.useState();
|
|
984
|
+
X(() => {
|
|
985
|
+
u && R(window.getComputedStyle(u).zIndex);
|
|
986
|
+
}, [u]);
|
|
987
|
+
const _ = r.useCallback(
|
|
988
|
+
(E) => {
|
|
989
|
+
E && b.current === !0 && (m(), f == null || f(), b.current = !1);
|
|
990
|
+
},
|
|
991
|
+
[m, f]
|
|
992
|
+
);
|
|
993
|
+
return /* @__PURE__ */ p(
|
|
994
|
+
dn,
|
|
995
|
+
{
|
|
996
|
+
scope: t,
|
|
997
|
+
contentWrapper: s,
|
|
998
|
+
shouldExpandOnScrollRef: y,
|
|
999
|
+
onScrollButtonChange: _,
|
|
1000
|
+
children: /* @__PURE__ */ p(
|
|
1001
|
+
"div",
|
|
1002
|
+
{
|
|
1003
|
+
ref: d,
|
|
1004
|
+
style: {
|
|
1005
|
+
display: "flex",
|
|
1006
|
+
flexDirection: "column",
|
|
1007
|
+
position: "fixed",
|
|
1008
|
+
zIndex: C
|
|
1009
|
+
},
|
|
1010
|
+
children: /* @__PURE__ */ p(
|
|
1011
|
+
A.div,
|
|
1012
|
+
{
|
|
1013
|
+
...a,
|
|
1014
|
+
ref: S,
|
|
1015
|
+
style: {
|
|
1016
|
+
// When we get the height of the content, it includes borders. If we were to set
|
|
1017
|
+
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
1018
|
+
boxSizing: "border-box",
|
|
1019
|
+
// We need to ensure the content doesn't get taller than the wrapper
|
|
1020
|
+
maxHeight: "100%",
|
|
1021
|
+
...a.style
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
)
|
|
1025
|
+
}
|
|
1026
|
+
)
|
|
1027
|
+
}
|
|
1028
|
+
);
|
|
1029
|
+
});
|
|
1030
|
+
Et.displayName = cn;
|
|
1031
|
+
var ln = "SelectPopperPosition", Te = r.forwardRef((e, o) => {
|
|
1032
|
+
const {
|
|
1033
|
+
__scopeSelect: t,
|
|
1034
|
+
align: n = "start",
|
|
1035
|
+
collisionPadding: a = G,
|
|
1036
|
+
...c
|
|
1037
|
+
} = e, i = xe(t);
|
|
1038
|
+
return /* @__PURE__ */ p(
|
|
1039
|
+
Yo,
|
|
1040
|
+
{
|
|
1041
|
+
...i,
|
|
1042
|
+
...c,
|
|
1043
|
+
ref: o,
|
|
1044
|
+
align: n,
|
|
1045
|
+
collisionPadding: a,
|
|
1046
|
+
style: {
|
|
1047
|
+
// Ensure border-box for floating-ui calculations
|
|
1048
|
+
boxSizing: "border-box",
|
|
1049
|
+
...c.style,
|
|
1050
|
+
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1051
|
+
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
1052
|
+
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
1053
|
+
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1054
|
+
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
);
|
|
1058
|
+
});
|
|
1059
|
+
Te.displayName = ln;
|
|
1060
|
+
var [dn, Be] = de(ie, {}), Ie = "SelectViewport", xt = r.forwardRef(
|
|
1061
|
+
(e, o) => {
|
|
1062
|
+
const { __scopeSelect: t, nonce: n, ...a } = e, c = oe(Ie, t), i = Be(Ie, t), s = D(o, c.onViewportChange), d = r.useRef(0);
|
|
1063
|
+
return /* @__PURE__ */ se(Oe, { children: [
|
|
1064
|
+
/* @__PURE__ */ p(
|
|
1065
|
+
"style",
|
|
1066
|
+
{
|
|
1067
|
+
dangerouslySetInnerHTML: {
|
|
1068
|
+
__html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
|
|
1069
|
+
},
|
|
1070
|
+
nonce: n
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
/* @__PURE__ */ p(Ce.Slot, { scope: t, children: /* @__PURE__ */ p(
|
|
1074
|
+
A.div,
|
|
1075
|
+
{
|
|
1076
|
+
"data-radix-select-viewport": "",
|
|
1077
|
+
role: "presentation",
|
|
1078
|
+
...a,
|
|
1079
|
+
ref: s,
|
|
1080
|
+
style: {
|
|
1081
|
+
// we use position: 'relative' here on the `viewport` so that when we call
|
|
1082
|
+
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
1083
|
+
// (independent of the scrollUpButton).
|
|
1084
|
+
position: "relative",
|
|
1085
|
+
flex: 1,
|
|
1086
|
+
// Viewport should only be scrollable in the vertical direction.
|
|
1087
|
+
// This won't work in vertical writing modes, so we'll need to
|
|
1088
|
+
// revisit this if/when that is supported
|
|
1089
|
+
// https://developer.chrome.com/blog/vertical-form-controls
|
|
1090
|
+
overflow: "hidden auto",
|
|
1091
|
+
...a.style
|
|
1092
|
+
},
|
|
1093
|
+
onScroll: O(a.onScroll, (u) => {
|
|
1094
|
+
const h = u.currentTarget, { contentWrapper: S, shouldExpandOnScrollRef: x } = i;
|
|
1095
|
+
if (x != null && x.current && S) {
|
|
1096
|
+
const y = Math.abs(d.current - h.scrollTop);
|
|
1097
|
+
if (y > 0) {
|
|
1098
|
+
const b = window.innerHeight - G * 2, l = parseFloat(S.style.minHeight), v = parseFloat(S.style.height), g = Math.max(l, v);
|
|
1099
|
+
if (g < b) {
|
|
1100
|
+
const f = g + y, m = Math.min(b, f), C = f - m;
|
|
1101
|
+
S.style.height = m + "px", S.style.bottom === "0px" && (h.scrollTop = C > 0 ? C : 0, S.style.justifyContent = "flex-end");
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
d.current = h.scrollTop;
|
|
1106
|
+
})
|
|
1107
|
+
}
|
|
1108
|
+
) })
|
|
1109
|
+
] });
|
|
1110
|
+
}
|
|
1111
|
+
);
|
|
1112
|
+
xt.displayName = Ie;
|
|
1113
|
+
var bt = "SelectGroup", [un, pn] = de(bt), Pt = r.forwardRef(
|
|
1114
|
+
(e, o) => {
|
|
1115
|
+
const { __scopeSelect: t, ...n } = e, a = Le();
|
|
1116
|
+
return /* @__PURE__ */ p(un, { scope: t, id: a, children: /* @__PURE__ */ p(A.div, { role: "group", "aria-labelledby": a, ...n, ref: o }) });
|
|
1117
|
+
}
|
|
1118
|
+
);
|
|
1119
|
+
Pt.displayName = bt;
|
|
1120
|
+
var Nt = "SelectLabel", Tt = r.forwardRef(
|
|
1121
|
+
(e, o) => {
|
|
1122
|
+
const { __scopeSelect: t, ...n } = e, a = pn(Nt, t);
|
|
1123
|
+
return /* @__PURE__ */ p(A.div, { id: a.id, ...n, ref: o });
|
|
1124
|
+
}
|
|
1125
|
+
);
|
|
1126
|
+
Tt.displayName = Nt;
|
|
1127
|
+
var ye = "SelectItem", [fn, It] = de(ye), Rt = r.forwardRef(
|
|
1128
|
+
(e, o) => {
|
|
1129
|
+
const {
|
|
1130
|
+
__scopeSelect: t,
|
|
1131
|
+
value: n,
|
|
1132
|
+
disabled: a = !1,
|
|
1133
|
+
textValue: c,
|
|
1134
|
+
...i
|
|
1135
|
+
} = e, s = te(ye, t), d = oe(ye, t), u = s.value === n, [h, S] = r.useState(c ?? ""), [x, y] = r.useState(!1), b = D(
|
|
1136
|
+
o,
|
|
1137
|
+
(f) => {
|
|
1138
|
+
var m;
|
|
1139
|
+
return (m = d.itemRefCallback) == null ? void 0 : m.call(d, f, n, a);
|
|
1140
|
+
}
|
|
1141
|
+
), l = Le(), v = r.useRef("touch"), g = () => {
|
|
1142
|
+
a || (s.onValueChange(n), s.onOpenChange(!1));
|
|
1143
|
+
};
|
|
1144
|
+
if (n === "")
|
|
1145
|
+
throw new Error(
|
|
1146
|
+
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
|
|
1147
|
+
);
|
|
1148
|
+
return /* @__PURE__ */ p(
|
|
1149
|
+
fn,
|
|
1150
|
+
{
|
|
1151
|
+
scope: t,
|
|
1152
|
+
value: n,
|
|
1153
|
+
disabled: a,
|
|
1154
|
+
textId: l,
|
|
1155
|
+
isSelected: u,
|
|
1156
|
+
onItemTextChange: r.useCallback((f) => {
|
|
1157
|
+
S((m) => m || ((f == null ? void 0 : f.textContent) ?? "").trim());
|
|
1158
|
+
}, []),
|
|
1159
|
+
children: /* @__PURE__ */ p(
|
|
1160
|
+
Ce.ItemSlot,
|
|
1161
|
+
{
|
|
1162
|
+
scope: t,
|
|
1163
|
+
value: n,
|
|
1164
|
+
disabled: a,
|
|
1165
|
+
textValue: h,
|
|
1166
|
+
children: /* @__PURE__ */ p(
|
|
1167
|
+
A.div,
|
|
1168
|
+
{
|
|
1169
|
+
role: "option",
|
|
1170
|
+
"aria-labelledby": l,
|
|
1171
|
+
"data-highlighted": x ? "" : void 0,
|
|
1172
|
+
"aria-selected": u && x,
|
|
1173
|
+
"data-state": u ? "checked" : "unchecked",
|
|
1174
|
+
"aria-disabled": a || void 0,
|
|
1175
|
+
"data-disabled": a ? "" : void 0,
|
|
1176
|
+
tabIndex: a ? void 0 : -1,
|
|
1177
|
+
...i,
|
|
1178
|
+
ref: b,
|
|
1179
|
+
onFocus: O(i.onFocus, () => y(!0)),
|
|
1180
|
+
onBlur: O(i.onBlur, () => y(!1)),
|
|
1181
|
+
onClick: O(i.onClick, () => {
|
|
1182
|
+
v.current !== "mouse" && g();
|
|
1183
|
+
}),
|
|
1184
|
+
onPointerUp: O(i.onPointerUp, () => {
|
|
1185
|
+
v.current === "mouse" && g();
|
|
1186
|
+
}),
|
|
1187
|
+
onPointerDown: O(i.onPointerDown, (f) => {
|
|
1188
|
+
v.current = f.pointerType;
|
|
1189
|
+
}),
|
|
1190
|
+
onPointerMove: O(i.onPointerMove, (f) => {
|
|
1191
|
+
var m;
|
|
1192
|
+
v.current = f.pointerType, a ? (m = d.onItemLeave) == null || m.call(d) : v.current === "mouse" && f.currentTarget.focus({ preventScroll: !0 });
|
|
1193
|
+
}),
|
|
1194
|
+
onPointerLeave: O(i.onPointerLeave, (f) => {
|
|
1195
|
+
var m;
|
|
1196
|
+
f.currentTarget === document.activeElement && ((m = d.onItemLeave) == null || m.call(d));
|
|
1197
|
+
}),
|
|
1198
|
+
onKeyDown: O(i.onKeyDown, (f) => {
|
|
1199
|
+
var C;
|
|
1200
|
+
((C = d.searchRef) == null ? void 0 : C.current) !== "" && f.key === " " || (Jo.includes(f.key) && g(), f.key === " " && f.preventDefault());
|
|
1201
|
+
})
|
|
1202
|
+
}
|
|
1203
|
+
)
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
}
|
|
1207
|
+
);
|
|
1208
|
+
}
|
|
1209
|
+
);
|
|
1210
|
+
Rt.displayName = ye;
|
|
1211
|
+
var ge = "SelectItemText", At = r.forwardRef(
|
|
1212
|
+
(e, o) => {
|
|
1213
|
+
const { __scopeSelect: t, className: n, style: a, ...c } = e, i = te(ge, t), s = oe(ge, t), d = It(ge, t), u = on(ge, t), [h, S] = r.useState(null), x = D(
|
|
1214
|
+
o,
|
|
1215
|
+
(g) => S(g),
|
|
1216
|
+
d.onItemTextChange,
|
|
1217
|
+
(g) => {
|
|
1218
|
+
var f;
|
|
1219
|
+
return (f = s.itemTextRefCallback) == null ? void 0 : f.call(s, g, d.value, d.disabled);
|
|
1220
|
+
}
|
|
1221
|
+
), y = h == null ? void 0 : h.textContent, b = r.useMemo(
|
|
1222
|
+
() => /* @__PURE__ */ p("option", { value: d.value, disabled: d.disabled, children: y }, d.value),
|
|
1223
|
+
[d.disabled, d.value, y]
|
|
1224
|
+
), { onNativeOptionAdd: l, onNativeOptionRemove: v } = u;
|
|
1225
|
+
return X(() => (l(b), () => v(b)), [l, v, b]), /* @__PURE__ */ se(Oe, { children: [
|
|
1226
|
+
/* @__PURE__ */ p(A.span, { id: d.textId, ...c, ref: x }),
|
|
1227
|
+
d.isSelected && i.valueNode && !i.valueNodeHasChildren ? Me.createPortal(c.children, i.valueNode) : null
|
|
1228
|
+
] });
|
|
1229
|
+
}
|
|
1230
|
+
);
|
|
1231
|
+
At.displayName = ge;
|
|
1232
|
+
var _t = "SelectItemIndicator", Ot = r.forwardRef(
|
|
1233
|
+
(e, o) => {
|
|
1234
|
+
const { __scopeSelect: t, ...n } = e;
|
|
1235
|
+
return It(_t, t).isSelected ? /* @__PURE__ */ p(A.span, { "aria-hidden": !0, ...n, ref: o }) : null;
|
|
1236
|
+
}
|
|
1237
|
+
);
|
|
1238
|
+
Ot.displayName = _t;
|
|
1239
|
+
var Re = "SelectScrollUpButton", Mt = r.forwardRef((e, o) => {
|
|
1240
|
+
const t = oe(Re, e.__scopeSelect), n = Be(Re, e.__scopeSelect), [a, c] = r.useState(!1), i = D(o, n.onScrollButtonChange);
|
|
1241
|
+
return X(() => {
|
|
1242
|
+
if (t.viewport && t.isPositioned) {
|
|
1243
|
+
let s = function() {
|
|
1244
|
+
const u = d.scrollTop > 0;
|
|
1245
|
+
c(u);
|
|
1246
|
+
};
|
|
1247
|
+
const d = t.viewport;
|
|
1248
|
+
return s(), d.addEventListener("scroll", s), () => d.removeEventListener("scroll", s);
|
|
1249
|
+
}
|
|
1250
|
+
}, [t.viewport, t.isPositioned]), a ? /* @__PURE__ */ p(
|
|
1251
|
+
Lt,
|
|
1252
|
+
{
|
|
1253
|
+
...e,
|
|
1254
|
+
ref: i,
|
|
1255
|
+
onAutoScroll: () => {
|
|
1256
|
+
const { viewport: s, selectedItem: d } = t;
|
|
1257
|
+
s && d && (s.scrollTop = s.scrollTop - d.offsetHeight);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
) : null;
|
|
1261
|
+
});
|
|
1262
|
+
Mt.displayName = Re;
|
|
1263
|
+
var Ae = "SelectScrollDownButton", Dt = r.forwardRef((e, o) => {
|
|
1264
|
+
const t = oe(Ae, e.__scopeSelect), n = Be(Ae, e.__scopeSelect), [a, c] = r.useState(!1), i = D(o, n.onScrollButtonChange);
|
|
1265
|
+
return X(() => {
|
|
1266
|
+
if (t.viewport && t.isPositioned) {
|
|
1267
|
+
let s = function() {
|
|
1268
|
+
const u = d.scrollHeight - d.clientHeight, h = Math.ceil(d.scrollTop) < u;
|
|
1269
|
+
c(h);
|
|
1270
|
+
};
|
|
1271
|
+
const d = t.viewport;
|
|
1272
|
+
return s(), d.addEventListener("scroll", s), () => d.removeEventListener("scroll", s);
|
|
1273
|
+
}
|
|
1274
|
+
}, [t.viewport, t.isPositioned]), a ? /* @__PURE__ */ p(
|
|
1275
|
+
Lt,
|
|
1276
|
+
{
|
|
1277
|
+
...e,
|
|
1278
|
+
ref: i,
|
|
1279
|
+
onAutoScroll: () => {
|
|
1280
|
+
const { viewport: s, selectedItem: d } = t;
|
|
1281
|
+
s && d && (s.scrollTop = s.scrollTop + d.offsetHeight);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
) : null;
|
|
1285
|
+
});
|
|
1286
|
+
Dt.displayName = Ae;
|
|
1287
|
+
var Lt = r.forwardRef((e, o) => {
|
|
1288
|
+
const { __scopeSelect: t, onAutoScroll: n, ...a } = e, c = oe("SelectScrollButton", t), i = r.useRef(null), s = Ee(t), d = r.useCallback(() => {
|
|
1289
|
+
i.current !== null && (window.clearInterval(i.current), i.current = null);
|
|
1290
|
+
}, []);
|
|
1291
|
+
return r.useEffect(() => () => d(), [d]), X(() => {
|
|
1292
|
+
var h;
|
|
1293
|
+
const u = s().find((S) => S.ref.current === document.activeElement);
|
|
1294
|
+
(h = u == null ? void 0 : u.ref.current) == null || h.scrollIntoView({ block: "nearest" });
|
|
1295
|
+
}, [s]), /* @__PURE__ */ p(
|
|
1296
|
+
A.div,
|
|
1297
|
+
{
|
|
1298
|
+
"aria-hidden": !0,
|
|
1299
|
+
...a,
|
|
1300
|
+
ref: o,
|
|
1301
|
+
style: { flexShrink: 0, ...a.style },
|
|
1302
|
+
onPointerDown: O(a.onPointerDown, () => {
|
|
1303
|
+
i.current === null && (i.current = window.setInterval(n, 50));
|
|
1304
|
+
}),
|
|
1305
|
+
onPointerMove: O(a.onPointerMove, () => {
|
|
1306
|
+
var u;
|
|
1307
|
+
(u = c.onItemLeave) == null || u.call(c), i.current === null && (i.current = window.setInterval(n, 50));
|
|
1308
|
+
}),
|
|
1309
|
+
onPointerLeave: O(a.onPointerLeave, () => {
|
|
1310
|
+
d();
|
|
1311
|
+
})
|
|
1312
|
+
}
|
|
1313
|
+
);
|
|
1314
|
+
}), mn = "SelectSeparator", Ft = r.forwardRef(
|
|
1315
|
+
(e, o) => {
|
|
1316
|
+
const { __scopeSelect: t, ...n } = e;
|
|
1317
|
+
return /* @__PURE__ */ p(A.div, { "aria-hidden": !0, ...n, ref: o });
|
|
1318
|
+
}
|
|
1319
|
+
);
|
|
1320
|
+
Ft.displayName = mn;
|
|
1321
|
+
var _e = "SelectArrow", hn = r.forwardRef(
|
|
1322
|
+
(e, o) => {
|
|
1323
|
+
const { __scopeSelect: t, ...n } = e, a = xe(t), c = te(_e, t), i = oe(_e, t);
|
|
1324
|
+
return c.open && i.position === "popper" ? /* @__PURE__ */ p(jo, { ...a, ...n, ref: o }) : null;
|
|
1325
|
+
}
|
|
1326
|
+
);
|
|
1327
|
+
hn.displayName = _e;
|
|
1328
|
+
var vn = "SelectBubbleInput", kt = r.forwardRef(
|
|
1329
|
+
({ __scopeSelect: e, value: o, ...t }, n) => {
|
|
1330
|
+
const a = r.useRef(null), c = D(n, a), i = mo(o);
|
|
1331
|
+
return r.useEffect(() => {
|
|
1332
|
+
const s = a.current;
|
|
1333
|
+
if (!s) return;
|
|
1334
|
+
const d = window.HTMLSelectElement.prototype, h = Object.getOwnPropertyDescriptor(
|
|
1335
|
+
d,
|
|
1336
|
+
"value"
|
|
1337
|
+
).set;
|
|
1338
|
+
if (i !== o && h) {
|
|
1339
|
+
const S = new Event("change", { bubbles: !0 });
|
|
1340
|
+
h.call(s, o), s.dispatchEvent(S);
|
|
1341
|
+
}
|
|
1342
|
+
}, [i, o]), /* @__PURE__ */ p(
|
|
1343
|
+
A.select,
|
|
1344
|
+
{
|
|
1345
|
+
...t,
|
|
1346
|
+
style: { ...ut, ...t.style },
|
|
1347
|
+
ref: c,
|
|
1348
|
+
defaultValue: o
|
|
1349
|
+
}
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
);
|
|
1353
|
+
kt.displayName = vn;
|
|
1354
|
+
function Bt(e) {
|
|
1355
|
+
return e === "" || e === void 0;
|
|
1356
|
+
}
|
|
1357
|
+
function Ht(e) {
|
|
1358
|
+
const o = le(e), t = r.useRef(""), n = r.useRef(0), a = r.useCallback(
|
|
1359
|
+
(i) => {
|
|
1360
|
+
const s = t.current + i;
|
|
1361
|
+
o(s), (function d(u) {
|
|
1362
|
+
t.current = u, window.clearTimeout(n.current), u !== "" && (n.current = window.setTimeout(() => d(""), 1e3));
|
|
1363
|
+
})(s);
|
|
1364
|
+
},
|
|
1365
|
+
[o]
|
|
1366
|
+
), c = r.useCallback(() => {
|
|
1367
|
+
t.current = "", window.clearTimeout(n.current);
|
|
1368
|
+
}, []);
|
|
1369
|
+
return r.useEffect(() => () => window.clearTimeout(n.current), []), [t, a, c];
|
|
1370
|
+
}
|
|
1371
|
+
function Ut(e, o, t) {
|
|
1372
|
+
const a = o.length > 1 && Array.from(o).every((u) => u === o[0]) ? o[0] : o, c = t ? e.indexOf(t) : -1;
|
|
1373
|
+
let i = gn(e, Math.max(c, 0));
|
|
1374
|
+
a.length === 1 && (i = i.filter((u) => u !== t));
|
|
1375
|
+
const d = i.find(
|
|
1376
|
+
(u) => u.textValue.toLowerCase().startsWith(a.toLowerCase())
|
|
1377
|
+
);
|
|
1378
|
+
return d !== t ? d : void 0;
|
|
1379
|
+
}
|
|
1380
|
+
function gn(e, o) {
|
|
1381
|
+
return e.map((t, n) => e[(o + n) % e.length]);
|
|
1382
|
+
}
|
|
1383
|
+
var wn = pt, Vt = mt, Sn = vt, yn = gt, Cn = wt, Wt = St, En = xt, xn = Pt, $t = Tt, Kt = Rt, bn = At, Pn = Ot, zt = Mt, Yt = Dt, jt = Ft;
|
|
1384
|
+
const Hn = wn, Un = xn, Vn = Sn, Nn = r.forwardRef(
|
|
1385
|
+
({ className: e, children: o, ...t }, n) => /* @__PURE__ */ se(
|
|
1386
|
+
Vt,
|
|
1387
|
+
{
|
|
1388
|
+
ref: n,
|
|
1389
|
+
className: ee(
|
|
1390
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
1391
|
+
e
|
|
1392
|
+
),
|
|
1393
|
+
...t,
|
|
1394
|
+
children: [
|
|
1395
|
+
o,
|
|
1396
|
+
/* @__PURE__ */ p(yn, { asChild: !0, children: /* @__PURE__ */ p(je, { className: "size-4 opacity-50" }) })
|
|
1397
|
+
]
|
|
1398
|
+
}
|
|
1399
|
+
)
|
|
1400
|
+
);
|
|
1401
|
+
Nn.displayName = Vt.displayName;
|
|
1402
|
+
const Gt = r.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ p(zt, { ref: t, className: ee("flex cursor-default items-center justify-center py-1", e), ...o, children: /* @__PURE__ */ p(wo, { className: "size-4" }) }));
|
|
1403
|
+
Gt.displayName = zt.displayName;
|
|
1404
|
+
const Xt = r.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ p(Yt, { ref: t, className: ee("flex cursor-default items-center justify-center py-1", e), ...o, children: /* @__PURE__ */ p(je, { className: "size-4" }) }));
|
|
1405
|
+
Xt.displayName = Yt.displayName;
|
|
1406
|
+
const Tn = r.forwardRef(
|
|
1407
|
+
({ className: e, children: o, position: t = "popper", ...n }, a) => /* @__PURE__ */ p(Cn, { children: /* @__PURE__ */ se(
|
|
1408
|
+
Wt,
|
|
1409
|
+
{
|
|
1410
|
+
ref: a,
|
|
1411
|
+
className: ee(
|
|
1412
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
1413
|
+
t === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
1414
|
+
e
|
|
1415
|
+
),
|
|
1416
|
+
position: t,
|
|
1417
|
+
...n,
|
|
1418
|
+
children: [
|
|
1419
|
+
/* @__PURE__ */ p(Gt, {}),
|
|
1420
|
+
/* @__PURE__ */ p(
|
|
1421
|
+
En,
|
|
1422
|
+
{
|
|
1423
|
+
className: ee("p-1", t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
|
|
1424
|
+
children: o
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
/* @__PURE__ */ p(Xt, {})
|
|
1428
|
+
]
|
|
1429
|
+
}
|
|
1430
|
+
) })
|
|
1431
|
+
);
|
|
1432
|
+
Tn.displayName = Wt.displayName;
|
|
1433
|
+
const In = r.forwardRef(
|
|
1434
|
+
({ className: e, ...o }, t) => /* @__PURE__ */ p($t, { ref: t, className: ee("py-1.5 pl-8 pr-2 text-sm font-semibold", e), ...o })
|
|
1435
|
+
);
|
|
1436
|
+
In.displayName = $t.displayName;
|
|
1437
|
+
const Rn = r.forwardRef(
|
|
1438
|
+
({ className: e, children: o, ...t }, n) => /* @__PURE__ */ se(
|
|
1439
|
+
Kt,
|
|
1440
|
+
{
|
|
1441
|
+
ref: n,
|
|
1442
|
+
className: ee(
|
|
1443
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
1444
|
+
e
|
|
1445
|
+
),
|
|
1446
|
+
...t,
|
|
1447
|
+
children: [
|
|
1448
|
+
/* @__PURE__ */ p("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ p(Pn, { children: /* @__PURE__ */ p(ho, { className: "size-4" }) }) }),
|
|
1449
|
+
/* @__PURE__ */ p(bn, { children: o })
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
)
|
|
1453
|
+
);
|
|
1454
|
+
Rn.displayName = Kt.displayName;
|
|
1455
|
+
const An = r.forwardRef(
|
|
1456
|
+
({ className: e, ...o }, t) => /* @__PURE__ */ p(jt, { ref: t, className: ee("-mx-1 my-1 h-px bg-muted", e), ...o })
|
|
1457
|
+
);
|
|
1458
|
+
An.displayName = jt.displayName;
|
|
1459
|
+
export {
|
|
1460
|
+
Hn as S,
|
|
1461
|
+
Tn as a,
|
|
1462
|
+
Un as b,
|
|
1463
|
+
Rn as c,
|
|
1464
|
+
In as d,
|
|
1465
|
+
An as e,
|
|
1466
|
+
Nn as f,
|
|
1467
|
+
Vn as g
|
|
1468
|
+
};
|