zaravand-ui 7.0.0 → 7.0.2
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/README.md +45 -45
- package/dist/components/Dialog/Dialog.cjs +1 -1
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.d.cts +4 -1
- package/dist/components/Select/Select.d.ts +4 -1
- package/dist/components/Select/Select.interface.d.cts +15 -1
- package/dist/components/Select/Select.interface.d.ts +15 -1
- package/dist/components/Select/Select.js +697 -566
- package/dist/components/Table/Table.cjs +1 -1
- package/dist/components/Table/Table.constants.cjs +1 -1
- package/dist/components/Table/Table.constants.d.cts +1 -0
- package/dist/components/Table/Table.constants.d.ts +1 -0
- package/dist/components/Table/Table.constants.js +2 -2
- package/dist/components/Table/Table.interface.d.cts +39 -0
- package/dist/components/Table/Table.interface.d.ts +39 -0
- package/dist/components/Table/Table.js +448 -371
- package/dist/components/Table/Table.utils.cjs +1 -1
- package/dist/components/Table/Table.utils.d.cts +10 -1
- package/dist/components/Table/Table.utils.d.ts +10 -1
- package/dist/components/Table/Table.utils.js +23 -1
- package/dist/components/Table/Table.variant.cjs +1 -1
- package/dist/components/Table/Table.variant.d.cts +5 -0
- package/dist/components/Table/Table.variant.d.ts +5 -0
- package/dist/components/Table/Table.variant.js +17 -11
- package/dist/components/Table/TableActiveFilters.cjs +1 -0
- package/dist/components/Table/TableActiveFilters.d.cts +12 -0
- package/dist/components/Table/TableActiveFilters.d.ts +12 -0
- package/dist/components/Table/TableActiveFilters.js +55 -0
- package/dist/components/Table/TableColumnFilter.cjs +1 -0
- package/dist/components/Table/TableColumnFilter.d.cts +17 -0
- package/dist/components/Table/TableColumnFilter.d.ts +17 -0
- package/dist/components/Table/TableColumnFilter.js +70 -0
- package/dist/components/Table/TableEmptyState.cjs +1 -1
- package/dist/components/Table/TableEmptyState.d.cts +1 -1
- package/dist/components/Table/TableEmptyState.d.ts +1 -1
- package/dist/components/Table/TableEmptyState.js +16 -7
- package/dist/components/Table/TableSkeletonRows.cjs +1 -1
- package/dist/components/Table/TableSkeletonRows.js +7 -7
- package/dist/components/Table/TableSortToggle.cjs +1 -1
- package/dist/components/Table/TableSortToggle.js +8 -8
- package/dist/components/Table/hooks/useTableFilter.cjs +1 -0
- package/dist/components/Table/hooks/useTableFilter.d.cts +18 -0
- package/dist/components/Table/hooks/useTableFilter.d.ts +18 -0
- package/dist/components/Table/hooks/useTableFilter.js +49 -0
- package/dist/components/Uploader/Uploader.variant.cjs +1 -1
- package/dist/components/Uploader/Uploader.variant.d.cts +1 -1
- package/dist/components/Uploader/Uploader.variant.d.ts +1 -1
- package/dist/components/Uploader/Uploader.variant.js +1 -1
- package/dist/config/messages.cjs +1 -1
- package/dist/config/messages.d.cts +4 -0
- package/dist/config/messages.d.ts +4 -0
- package/dist/config/messages.js +10 -2
- package/dist/index.css +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +99 -98
|
@@ -5,46 +5,48 @@ import { localizeDigits as n } from "../../services/localizeDigits/localizeDigit
|
|
|
5
5
|
import { cn as r, mergeRefs as i } from "../../lib/utils.js";
|
|
6
6
|
import a from "../Button/Button.js";
|
|
7
7
|
import o from "../Dialog/Dialog.js";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import v
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
8
|
+
import s from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { CLEAR_ICON_CLASS as c, FieldClearButton as l, FieldClearButtonSlot as u } from "../shared/FieldClearButton.js";
|
|
10
|
+
import { FieldLabel as d } from "../shared/FieldLabel.js";
|
|
11
|
+
import { useInvalidState as f } from "../shared/useInvalidState.js";
|
|
12
|
+
import p from "../Input/Input.js";
|
|
13
|
+
import { IconActionButton as m } from "../shared/IconActionButton.js";
|
|
14
|
+
import { useControllableState as h } from "../shared/useControllableState.js";
|
|
15
|
+
import { isMobileViewport as g } from "../shared/viewport.js";
|
|
16
|
+
import { useIsomorphicLayoutEffect as _ } from "../shared/useIsomorphicLayoutEffect.js";
|
|
17
|
+
import ee from "../shared/RequiredValidationInput.js";
|
|
18
|
+
import v from "../Skeleton/Skeleton.js";
|
|
19
|
+
import y, { TabsContent as te, TabsList as ne, TabsTrigger as re } from "../Tabs/Tabs.js";
|
|
20
|
+
import { selectActionButtonClassName as ie, selectContentVariants as ae, selectLabelVariants as b, selectModalActionButtonClassName as oe, selectModalOptionClassName as se, selectOptionVariants as x, selectSearchBarClassName as ce, selectSeparatorVariants as S, selectTriggerVariants as C, selectViewportVariants as le } from "./Select.variant.js";
|
|
21
|
+
import * as w from "react";
|
|
22
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
23
|
+
import { Check as O, CheckCheck as ue, ChevronDown as k, X as de } from "lucide-react";
|
|
24
|
+
import * as fe from "@radix-ui/react-popover";
|
|
25
|
+
import { useVirtualizer as pe } from "@tanstack/react-virtual";
|
|
24
26
|
//#region src/components/Select/Select.tsx
|
|
25
|
-
var
|
|
26
|
-
function
|
|
27
|
+
var A = "__zui-ungrouped__", me = 40, he = 24, ge = .3, _e = 1, j = 20, ve = 350, ye = 48, M = 3, be = "zui:size-[calc(var(--zui-scale,10px)*1.92)]", xe = 100, Se = 36, Ce = 8, we = w.createContext(null);
|
|
28
|
+
function N(e, t) {
|
|
27
29
|
return `${e}-option-${t}`;
|
|
28
30
|
}
|
|
29
|
-
function
|
|
31
|
+
function Te(e) {
|
|
30
32
|
return typeof e == "string" && e.length > 0;
|
|
31
33
|
}
|
|
32
|
-
function
|
|
34
|
+
function Ee(e) {
|
|
33
35
|
if (!Array.isArray(e)) return [];
|
|
34
36
|
let t = /* @__PURE__ */ new Set();
|
|
35
37
|
return e.forEach((e) => {
|
|
36
38
|
typeof e == "string" && e.trim().length > 0 && t.add(e.trim());
|
|
37
39
|
}), Array.from(t);
|
|
38
40
|
}
|
|
39
|
-
function
|
|
41
|
+
function P(e, t) {
|
|
40
42
|
return `${t ?? ""}\u0000${e}`;
|
|
41
43
|
}
|
|
42
|
-
function
|
|
44
|
+
function De(e) {
|
|
43
45
|
if (!Array.isArray(e)) return [];
|
|
44
46
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
45
47
|
return e.forEach((e) => {
|
|
46
48
|
if (!e || typeof e != "object") return;
|
|
47
|
-
let r = e, i = typeof r.value == "string" ? r.value.trim() : "", a = typeof r.group == "string" && r.group.trim().length > 0 ? r.group.trim() : void 0, o =
|
|
49
|
+
let r = e, i = typeof r.value == "string" ? r.value.trim() : "", a = typeof r.group == "string" && r.group.trim().length > 0 ? r.group.trim() : void 0, o = P(i, a);
|
|
48
50
|
if (i.length === 0 || n.has(o)) return;
|
|
49
51
|
let s = typeof r.label == "string" && r.label.trim().length > 0 ? r.label.trim() : i;
|
|
50
52
|
n.add(o), t.push({
|
|
@@ -55,16 +57,16 @@ function Ce(e) {
|
|
|
55
57
|
});
|
|
56
58
|
}), t;
|
|
57
59
|
}
|
|
58
|
-
function
|
|
60
|
+
function Oe(e, t) {
|
|
59
61
|
if (t.length === 0) return e;
|
|
60
62
|
let n = /* @__PURE__ */ new Map();
|
|
61
63
|
return e.forEach((e) => {
|
|
62
|
-
n.set(
|
|
64
|
+
n.set(P(e.value, e.group), e);
|
|
63
65
|
}), t.forEach((e) => {
|
|
64
|
-
n.set(
|
|
66
|
+
n.set(P(e.value, e.group), e);
|
|
65
67
|
}), Array.from(n.values());
|
|
66
68
|
}
|
|
67
|
-
function
|
|
69
|
+
function ke(e) {
|
|
68
70
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
69
71
|
return e.forEach((e) => {
|
|
70
72
|
if (e.group === void 0) {
|
|
@@ -83,7 +85,7 @@ function we(e) {
|
|
|
83
85
|
function F(e, n) {
|
|
84
86
|
return t({ value: (e.length > 0 ? e : n).toLocaleLowerCase() });
|
|
85
87
|
}
|
|
86
|
-
function
|
|
88
|
+
function Ae(e) {
|
|
87
89
|
return {
|
|
88
90
|
value: e.value,
|
|
89
91
|
label: e.label,
|
|
@@ -92,60 +94,60 @@ function Te(e) {
|
|
|
92
94
|
group: e.group
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
|
-
function
|
|
96
|
-
if (typeof e != "number" || !Number.isFinite(e)) return
|
|
97
|
+
function I(e) {
|
|
98
|
+
if (typeof e != "number" || !Number.isFinite(e)) return j;
|
|
97
99
|
let t = Math.floor(e);
|
|
98
|
-
return t > 0 ? t :
|
|
100
|
+
return t > 0 ? t : j;
|
|
99
101
|
}
|
|
100
|
-
function
|
|
102
|
+
function je(e, t, n, r) {
|
|
101
103
|
return typeof e.hasMore == "boolean" ? e.hasMore : typeof e.totalItems == "number" && Number.isFinite(e.totalItems) ? t < Math.max(0, Math.floor(e.totalItems)) : typeof e.nextPage == "number" ? Number.isFinite(e.nextPage) && e.nextPage > 0 : n >= r;
|
|
102
104
|
}
|
|
103
|
-
function
|
|
105
|
+
function Me(e, t) {
|
|
104
106
|
return typeof e.nextPage == "number" && Number.isFinite(e.nextPage) && e.nextPage > t ? Math.floor(e.nextPage) : t + 1;
|
|
105
107
|
}
|
|
106
|
-
function
|
|
108
|
+
function Ne(e, t) {
|
|
107
109
|
return e instanceof Error && e.message.trim().length > 0 ? e.message : t;
|
|
108
110
|
}
|
|
109
|
-
function
|
|
110
|
-
return /* @__PURE__ */
|
|
111
|
+
function Pe() {
|
|
112
|
+
return /* @__PURE__ */ E("div", {
|
|
111
113
|
"data-slot": "select-loading",
|
|
112
114
|
className: "zui:space-y-1 zui:px-2 zui:py-2",
|
|
113
|
-
children: Array.from({ length:
|
|
115
|
+
children: Array.from({ length: M }, (e, t) => /* @__PURE__ */ E(v, { className: r("zui:h-5 zui:max-w-full", t === 0 ? "zui:w-[88%]" : t === 1 ? "zui:w-[72%]" : "zui:w-[80%]") }, `select-loading-${t}`))
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
|
-
function
|
|
117
|
-
return typeof e == "string" ? n(e, t) : typeof e == "number" ? n(String(e), t) : Array.isArray(e) ? e.map((e, n) => /* @__PURE__ */
|
|
118
|
+
function L(e, t) {
|
|
119
|
+
return typeof e == "string" ? n(e, t) : typeof e == "number" ? n(String(e), t) : Array.isArray(e) ? e.map((e, n) => /* @__PURE__ */ E(w.Fragment, { children: L(e, t) }, n)) : w.isValidElement(e) ? !("children" in e.props) || e.props.children === void 0 ? e : w.cloneElement(e, void 0, L(e.props.children, t)) : e;
|
|
118
120
|
}
|
|
119
|
-
function
|
|
120
|
-
return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(
|
|
121
|
+
function R(e) {
|
|
122
|
+
return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(R).join(" ") : w.isValidElement(e) ? R(e.props.children) : "";
|
|
121
123
|
}
|
|
122
|
-
function
|
|
124
|
+
function z(e) {
|
|
123
125
|
return null;
|
|
124
126
|
}
|
|
125
|
-
function
|
|
127
|
+
function Fe(e) {
|
|
126
128
|
return null;
|
|
127
129
|
}
|
|
128
|
-
function
|
|
130
|
+
function B(e) {
|
|
129
131
|
return null;
|
|
130
132
|
}
|
|
131
|
-
function
|
|
133
|
+
function V() {
|
|
132
134
|
return null;
|
|
133
135
|
}
|
|
134
|
-
function
|
|
136
|
+
function Ie(e) {
|
|
135
137
|
let t = [], n = /* @__PURE__ */ new Set(), r = !1, i = (e, a) => {
|
|
136
|
-
|
|
137
|
-
if (
|
|
138
|
-
if (e.type ===
|
|
138
|
+
w.Children.forEach(e, (e) => {
|
|
139
|
+
if (w.isValidElement(e)) {
|
|
140
|
+
if (e.type === V) {
|
|
139
141
|
r = t.length > 0;
|
|
140
142
|
return;
|
|
141
143
|
}
|
|
142
|
-
if (e.type ===
|
|
143
|
-
let i = e.props, o = typeof i.value == "string" ? i.value.trim() : "", s =
|
|
144
|
+
if (e.type === z) {
|
|
145
|
+
let i = e.props, o = typeof i.value == "string" ? i.value.trim() : "", s = P(o, a);
|
|
144
146
|
if (o.length === 0 || n.has(s)) return;
|
|
145
147
|
n.add(s), t.push({
|
|
146
148
|
value: o,
|
|
147
149
|
label: i.children,
|
|
148
|
-
searchText: F(
|
|
150
|
+
searchText: F(R(i.children).trim(), o),
|
|
149
151
|
disabled: i.disabled === !0,
|
|
150
152
|
group: a,
|
|
151
153
|
separatorBefore: r,
|
|
@@ -153,11 +155,11 @@ function ke(e) {
|
|
|
153
155
|
}), r = !1;
|
|
154
156
|
return;
|
|
155
157
|
}
|
|
156
|
-
if (e.type ===
|
|
158
|
+
if (e.type === Fe) {
|
|
157
159
|
let t = e.props.children, n;
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
let t =
|
|
160
|
+
w.Children.forEach(t, (e) => {
|
|
161
|
+
if (w.isValidElement(e) && e.type === B) {
|
|
162
|
+
let t = R(e.props.children).trim();
|
|
161
163
|
n = t.length > 0 ? t : void 0;
|
|
162
164
|
}
|
|
163
165
|
}), i(t, n ?? a);
|
|
@@ -169,237 +171,243 @@ function ke(e) {
|
|
|
169
171
|
};
|
|
170
172
|
return i(e), t;
|
|
171
173
|
}
|
|
172
|
-
function
|
|
173
|
-
let { messages: n, dir: i } = e(), { type: a = "single", title: o, required: s = !1, showRequiredMessage:
|
|
174
|
-
|
|
175
|
-
}, [
|
|
176
|
-
|
|
177
|
-
}, []),
|
|
178
|
-
|
|
179
|
-
}, []), [
|
|
180
|
-
value: !
|
|
181
|
-
defaultValue: !
|
|
182
|
-
}),
|
|
183
|
-
value:
|
|
184
|
-
defaultValue: () =>
|
|
185
|
-
}), [
|
|
174
|
+
function H(t) {
|
|
175
|
+
let { messages: n, dir: i } = e(), { type: a = "single", title: o, required: s = !1, showRequiredMessage: c = !1, placeholder: l, options: u, remoteOptions: p, isSearch: m = !1, searchActions: _ = !0, disabled: v = !1, disable: y = !1, onInvalid: te, onOpenChange: ne, open: re, defaultOpen: ie, id: ae, name: b, form: oe, children: se, selectAllLabel: x, selectedCountLabel: ce, multiValueSubmitFormat: S = "separate", onValueChange: C, onChange: le } = t, O = w.useCallback((e) => {
|
|
176
|
+
C?.(e), le?.(e);
|
|
177
|
+
}, [le, C]), ue = w.useId(), k = ae ?? ue, de = `${k}-listbox`, pe = v || y, A = a === "multi", me = w.useRef(null), he = w.useRef(null), ge = w.useRef(null), _e = w.useCallback((e) => {
|
|
178
|
+
ge.current?.(e);
|
|
179
|
+
}, []), j = w.useCallback((e) => {
|
|
180
|
+
ge.current = e;
|
|
181
|
+
}, []), [ve, ye] = w.useState(""), [M, be] = w.useState(-1), { isInvalid: xe, setIsInvalid: Se, handleInvalid: Ce } = f(te), [N, P, Oe] = h({
|
|
182
|
+
value: !A && typeof t.value == "string" ? t.value : void 0,
|
|
183
|
+
defaultValue: !A && typeof t.defaultValue == "string" ? t.defaultValue : void 0
|
|
184
|
+
}), ke = A && Array.isArray(t.value) ? t.value : void 0, [F, Ae] = h({
|
|
185
|
+
value: w.useMemo(() => ke ? Ee(ke) : void 0, [ke]),
|
|
186
|
+
defaultValue: () => Ee(t.defaultValue)
|
|
187
|
+
}), [I, je] = h({
|
|
186
188
|
value: re,
|
|
187
189
|
defaultValue: !!ie,
|
|
188
190
|
onChange: ne
|
|
189
|
-
}), [
|
|
190
|
-
|
|
191
|
-
}, [
|
|
192
|
-
isOpen:
|
|
193
|
-
values:
|
|
191
|
+
}), [Me, Ne] = w.useState(null), Pe = w.useCallback((e) => {
|
|
192
|
+
Ne(e ? g() : null), je(e);
|
|
193
|
+
}, [je]), L = I && (Me ?? g()), R = w.useMemo(() => De(u), [u]), z = w.useMemo(() => Ie(se), [se]), Fe = m ? ve : "", B = A ? F.length > 0 : Te(N), V = xe && !B, [H, Re] = w.useState(() => ({
|
|
194
|
+
isOpen: I,
|
|
195
|
+
values: Ee(t.defaultValue)
|
|
194
196
|
}));
|
|
195
|
-
if (
|
|
196
|
-
let e =
|
|
197
|
-
|
|
198
|
-
isOpen:
|
|
199
|
-
values:
|
|
200
|
-
}),
|
|
197
|
+
if (H.isOpen !== I) {
|
|
198
|
+
let e = A ? F : Te(N) ? [N] : [];
|
|
199
|
+
Re({
|
|
200
|
+
isOpen: I,
|
|
201
|
+
values: I ? e : H.values
|
|
202
|
+
}), be(-1), I || ye("");
|
|
201
203
|
}
|
|
202
|
-
let
|
|
203
|
-
|
|
204
|
+
let Be = w.useMemo(() => !A || F.length === 0 ? "" : typeof ce == "function" ? ce(F.length) : n.select.selectedCount(String(F.length)), [
|
|
205
|
+
A,
|
|
204
206
|
n,
|
|
205
|
-
|
|
207
|
+
F.length,
|
|
206
208
|
ce
|
|
207
|
-
]),
|
|
208
|
-
|
|
209
|
-
}, []),
|
|
210
|
-
|
|
209
|
+
]), Ve = w.useCallback((e) => {
|
|
210
|
+
ye(e), be(-1);
|
|
211
|
+
}, []), He = w.useCallback((e) => {
|
|
212
|
+
P(e), Se(!1), O(e);
|
|
211
213
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
]),
|
|
216
|
-
|
|
214
|
+
O,
|
|
215
|
+
Se,
|
|
216
|
+
P
|
|
217
|
+
]), Ue = w.useCallback(() => {
|
|
218
|
+
A || (P(Oe ? "" : void 0), O(""));
|
|
217
219
|
}, [
|
|
218
|
-
T,
|
|
219
220
|
O,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
A,
|
|
222
|
+
Oe,
|
|
223
|
+
P
|
|
224
|
+
]), W = w.useCallback((e) => {
|
|
225
|
+
let t = Ee(e);
|
|
226
|
+
Ae(t), Se(!1), O(t);
|
|
225
227
|
}, [
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
]),
|
|
230
|
-
if (!
|
|
231
|
-
if (e.type ===
|
|
228
|
+
O,
|
|
229
|
+
Se,
|
|
230
|
+
Ae
|
|
231
|
+
]), We = w.Children.toArray(se), Ge = We.some((e) => w.isValidElement(e) && e.type === ze), Ke = p?.enabled !== !1 && p, qe = !Ge && (R.length > 0 || Ke) ? [...We, /* @__PURE__ */ E(ze, {}, "select-generated-content")] : se, Je = w.Children.toArray(qe).some((e) => w.isValidElement(e) && e.type === U), G = w.Children.map(qe, (e) => {
|
|
232
|
+
if (!w.isValidElement(e)) return e;
|
|
233
|
+
if (e.type === U) {
|
|
232
234
|
let t = e.props;
|
|
233
|
-
return
|
|
234
|
-
id: t.id ??
|
|
235
|
-
disabled: t.disabled ??
|
|
235
|
+
return w.cloneElement(e, {
|
|
236
|
+
id: t.id ?? k,
|
|
237
|
+
disabled: t.disabled ?? pe,
|
|
236
238
|
className: r("zui:text-start", t.className)
|
|
237
239
|
});
|
|
238
240
|
}
|
|
239
|
-
if (e.type ===
|
|
241
|
+
if (e.type === ze) {
|
|
240
242
|
let t = e.props;
|
|
241
|
-
return
|
|
243
|
+
return w.cloneElement(e, { className: r("zui:text-start", t.className) });
|
|
242
244
|
}
|
|
243
245
|
return e;
|
|
244
|
-
}),
|
|
245
|
-
listboxId:
|
|
246
|
-
isSearch:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
}), Ye = w.useMemo(() => ({
|
|
247
|
+
listboxId: de,
|
|
248
|
+
isSearch: m,
|
|
249
|
+
showSearchActions: _,
|
|
250
|
+
searchTerm: Fe,
|
|
251
|
+
setSearchTerm: Ve,
|
|
252
|
+
hasValue: B,
|
|
253
|
+
isInvalid: V,
|
|
251
254
|
selectType: a,
|
|
252
|
-
isOpen:
|
|
253
|
-
setOpen:
|
|
254
|
-
isModal:
|
|
255
|
-
modalLabel: o ??
|
|
256
|
-
isDisabled:
|
|
257
|
-
activeIndex:
|
|
258
|
-
setActiveIndex:
|
|
259
|
-
singleSelectedValue:
|
|
260
|
-
setSingleSelectedValue:
|
|
261
|
-
clearSingleSelection:
|
|
262
|
-
multiSelectedValues:
|
|
263
|
-
pinnedSelectedValues:
|
|
264
|
-
setMultiSelectedValues:
|
|
265
|
-
multiSelectAllLabel:
|
|
266
|
-
multiSelectedCountText:
|
|
267
|
-
options:
|
|
268
|
-
childOptions:
|
|
269
|
-
remoteOptions:
|
|
270
|
-
contentRef:
|
|
271
|
-
fieldRootRef:
|
|
272
|
-
onListKeyDown:
|
|
273
|
-
registerListKeyDown:
|
|
255
|
+
isOpen: I,
|
|
256
|
+
setOpen: Pe,
|
|
257
|
+
isModal: L,
|
|
258
|
+
modalLabel: o ?? l,
|
|
259
|
+
isDisabled: pe,
|
|
260
|
+
activeIndex: M,
|
|
261
|
+
setActiveIndex: be,
|
|
262
|
+
singleSelectedValue: N,
|
|
263
|
+
setSingleSelectedValue: He,
|
|
264
|
+
clearSingleSelection: Ue,
|
|
265
|
+
multiSelectedValues: F,
|
|
266
|
+
pinnedSelectedValues: H.values,
|
|
267
|
+
setMultiSelectedValues: W,
|
|
268
|
+
multiSelectAllLabel: x ?? n.select.selectAll,
|
|
269
|
+
multiSelectedCountText: Be,
|
|
270
|
+
options: R,
|
|
271
|
+
childOptions: z,
|
|
272
|
+
remoteOptions: p,
|
|
273
|
+
contentRef: he,
|
|
274
|
+
fieldRootRef: me,
|
|
275
|
+
onListKeyDown: _e,
|
|
276
|
+
registerListKeyDown: j
|
|
274
277
|
}), [
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
D,
|
|
282
|
-
h,
|
|
283
|
-
H,
|
|
284
|
-
Ne,
|
|
278
|
+
M,
|
|
279
|
+
z,
|
|
280
|
+
Ue,
|
|
281
|
+
W,
|
|
282
|
+
He,
|
|
283
|
+
B,
|
|
285
284
|
pe,
|
|
285
|
+
m,
|
|
286
|
+
_,
|
|
287
|
+
L,
|
|
288
|
+
V,
|
|
289
|
+
de,
|
|
286
290
|
n,
|
|
287
|
-
|
|
291
|
+
l,
|
|
288
292
|
o,
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
I,
|
|
296
|
-
L,
|
|
293
|
+
Be,
|
|
294
|
+
R,
|
|
295
|
+
_e,
|
|
296
|
+
H.values,
|
|
297
|
+
j,
|
|
298
|
+
p,
|
|
297
299
|
F,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
I,
|
|
301
|
+
N,
|
|
302
|
+
Fe,
|
|
303
|
+
x,
|
|
300
304
|
a,
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
Pe,
|
|
306
|
+
Ve
|
|
303
307
|
]);
|
|
304
|
-
return /* @__PURE__ */
|
|
305
|
-
ref:
|
|
308
|
+
return /* @__PURE__ */ D("div", {
|
|
309
|
+
ref: me,
|
|
306
310
|
"data-slot": "select-field",
|
|
307
311
|
dir: i,
|
|
308
312
|
className: "zui:relative zui:w-full zui:space-y-1.5 zui:text-start",
|
|
309
|
-
children: [/* @__PURE__ */
|
|
313
|
+
children: [/* @__PURE__ */ E(d, {
|
|
310
314
|
title: o,
|
|
311
|
-
htmlFor:
|
|
315
|
+
htmlFor: k,
|
|
312
316
|
required: s,
|
|
313
|
-
showRequiredMessage:
|
|
314
|
-
}), /* @__PURE__ */
|
|
315
|
-
value:
|
|
316
|
-
children: [/* @__PURE__ */
|
|
317
|
-
open:
|
|
318
|
-
onOpenChange:
|
|
319
|
-
children: /* @__PURE__ */
|
|
317
|
+
showRequiredMessage: c
|
|
318
|
+
}), /* @__PURE__ */ D(we.Provider, {
|
|
319
|
+
value: Ye,
|
|
320
|
+
children: [/* @__PURE__ */ E(fe.Root, {
|
|
321
|
+
open: I && !L,
|
|
322
|
+
onOpenChange: Pe,
|
|
323
|
+
children: /* @__PURE__ */ E(fe.Anchor, {
|
|
320
324
|
asChild: !0,
|
|
321
|
-
children: /* @__PURE__ */
|
|
325
|
+
children: /* @__PURE__ */ D("div", {
|
|
322
326
|
"data-slot": "select",
|
|
323
327
|
dir: i,
|
|
324
328
|
className: "zui:relative",
|
|
325
|
-
children: [
|
|
326
|
-
id:
|
|
327
|
-
children: /* @__PURE__ */
|
|
328
|
-
}),
|
|
329
|
+
children: [Je ? G : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(U, {
|
|
330
|
+
id: k,
|
|
331
|
+
children: /* @__PURE__ */ E(Le, { placeholder: l })
|
|
332
|
+
}), G] }), b ? A && S === "separate" ? F.map((e) => /* @__PURE__ */ E("input", {
|
|
329
333
|
type: "hidden",
|
|
330
|
-
name:
|
|
331
|
-
form:
|
|
334
|
+
name: b,
|
|
335
|
+
form: oe,
|
|
332
336
|
value: e
|
|
333
|
-
}, e)) : /* @__PURE__ */
|
|
337
|
+
}, e)) : /* @__PURE__ */ E("input", {
|
|
334
338
|
type: "hidden",
|
|
335
|
-
name:
|
|
336
|
-
form:
|
|
337
|
-
value:
|
|
339
|
+
name: b,
|
|
340
|
+
form: oe,
|
|
341
|
+
value: A ? F.join(",") : N ?? ""
|
|
338
342
|
}) : null]
|
|
339
343
|
})
|
|
340
344
|
})
|
|
341
|
-
}), s ? /* @__PURE__ */
|
|
342
|
-
hasValue:
|
|
343
|
-
form:
|
|
344
|
-
disabled:
|
|
345
|
-
onInvalid:
|
|
345
|
+
}), s ? /* @__PURE__ */ E(ee, {
|
|
346
|
+
hasValue: B,
|
|
347
|
+
form: oe,
|
|
348
|
+
disabled: pe,
|
|
349
|
+
onInvalid: Ce
|
|
346
350
|
}) : null]
|
|
347
351
|
})]
|
|
348
352
|
});
|
|
349
353
|
}
|
|
350
|
-
var
|
|
351
|
-
let
|
|
352
|
-
|
|
353
|
-
ref: u,
|
|
354
|
+
var U = w.forwardRef(function({ className: t, children: n, onClick: i, onKeyDown: a, disabled: o, unstyled: d = !1, tooltip: f, ...p }, m) {
|
|
355
|
+
let h = w.useContext(we), { messages: g, dir: _ } = e(), ee = h?.hasValue ?? !1, v = h?.isInvalid ?? !1, y = h?.isOpen ?? !1, te = h?.selectType === "multi", ne = o || (h?.isDisabled ?? !1), re = h?.activeIndex ?? -1, ie = !d && !te && ee && !ne && !!h, ae = /* @__PURE__ */ D("button", {
|
|
356
|
+
ref: m,
|
|
354
357
|
type: "button",
|
|
355
358
|
"data-slot": "select-trigger",
|
|
356
|
-
"data-has-value":
|
|
357
|
-
"data-state":
|
|
358
|
-
dir:
|
|
359
|
-
"aria-expanded":
|
|
359
|
+
"data-has-value": ee,
|
|
360
|
+
"data-state": y ? "open" : "closed",
|
|
361
|
+
dir: _,
|
|
362
|
+
"aria-expanded": y,
|
|
360
363
|
"aria-haspopup": "listbox",
|
|
361
|
-
"aria-controls":
|
|
362
|
-
"aria-activedescendant":
|
|
363
|
-
"aria-invalid":
|
|
364
|
-
disabled:
|
|
365
|
-
className: r(
|
|
364
|
+
"aria-controls": y && h ? h.listboxId : void 0,
|
|
365
|
+
"aria-activedescendant": y && h && re >= 0 ? N(h.listboxId, re) : void 0,
|
|
366
|
+
"aria-invalid": v || void 0,
|
|
367
|
+
disabled: ne,
|
|
368
|
+
className: d ? t : r(C({ className: t }), "zui:text-start"),
|
|
366
369
|
onClick: (e) => {
|
|
367
|
-
i?.(e), !(e.defaultPrevented ||
|
|
370
|
+
i?.(e), !(e.defaultPrevented || ne || !h) && h.setOpen(!y);
|
|
368
371
|
},
|
|
369
372
|
onKeyDown: (e) => {
|
|
370
|
-
a?.(e), e.defaultPrevented ||
|
|
373
|
+
a?.(e), e.defaultPrevented || h?.onListKeyDown(e);
|
|
371
374
|
},
|
|
372
|
-
...
|
|
375
|
+
...p,
|
|
373
376
|
children: [
|
|
374
377
|
n,
|
|
375
|
-
|
|
376
|
-
/* @__PURE__ */
|
|
378
|
+
ie ? /* @__PURE__ */ E(u, {}) : null,
|
|
379
|
+
d ? null : /* @__PURE__ */ E(k, { className: r(c, "zui:shrink-0 zui:text-[var(--zui-color-text)] zui:transition-transform zui:duration-200", y ? "zui:rotate-180" : "zui:rotate-0") })
|
|
377
380
|
]
|
|
378
|
-
})
|
|
381
|
+
});
|
|
382
|
+
return /* @__PURE__ */ D(T, { children: [f ? /* @__PURE__ */ E(s, {
|
|
383
|
+
text: f,
|
|
384
|
+
position: "top",
|
|
385
|
+
trigger: ae
|
|
386
|
+
}) : ae, ie ? /* @__PURE__ */ E(l, {
|
|
379
387
|
"data-slot": "select-clear-button",
|
|
380
|
-
label:
|
|
381
|
-
onClear: () =>
|
|
388
|
+
label: g.select.clearSelection,
|
|
389
|
+
onClear: () => h?.clearSingleSelection()
|
|
382
390
|
}) : null] });
|
|
383
391
|
});
|
|
384
|
-
function
|
|
385
|
-
let o =
|
|
392
|
+
function Le({ className: t, placeholder: n, children: i, ...a }) {
|
|
393
|
+
let o = w.useContext(we), { digits: s } = e();
|
|
386
394
|
if (o?.selectType === "multi") {
|
|
387
395
|
let e = i ?? (o.hasValue ? o.multiSelectedCountText : n);
|
|
388
|
-
return /* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ E("span", {
|
|
389
397
|
"data-slot": "select-value",
|
|
390
398
|
"data-placeholder": o.hasValue ? void 0 : !0,
|
|
391
399
|
className: r("zui:block zui:max-w-full zui:truncate zui:text-start zui:text-[var(--zui-color-text)]", !o.hasValue && "zui:text-[var(--zui-theme-text-muted)] zui:mobile:text-sm", t),
|
|
392
400
|
...a,
|
|
393
|
-
children:
|
|
401
|
+
children: L(e, s)
|
|
394
402
|
});
|
|
395
403
|
}
|
|
396
|
-
let
|
|
397
|
-
return
|
|
404
|
+
let c = o?.options.find((e) => e.value === o.singleSelectedValue) ?? o?.childOptions.find((e) => e.value === o.singleSelectedValue);
|
|
405
|
+
return c ? /* @__PURE__ */ E("span", {
|
|
398
406
|
"data-slot": "select-value",
|
|
399
407
|
className: r("zui:block zui:min-w-0 zui:flex-1 zui:truncate zui:text-start zui:text-[var(--zui-color-text)]", t),
|
|
400
408
|
...a,
|
|
401
|
-
children:
|
|
402
|
-
}) : /* @__PURE__ */
|
|
409
|
+
children: L(i ?? c.label, s)
|
|
410
|
+
}) : /* @__PURE__ */ E("span", {
|
|
403
411
|
"data-slot": "select-value",
|
|
404
412
|
"data-placeholder": "",
|
|
405
413
|
className: r("zui:block zui:min-w-0 zui:flex-1 zui:truncate zui:text-start zui:text-[var(--zui-theme-text-muted)] zui:mobile:text-sm", t),
|
|
@@ -407,162 +415,275 @@ function G({ className: t, placeholder: n, children: i, ...a }) {
|
|
|
407
415
|
children: n
|
|
408
416
|
});
|
|
409
417
|
}
|
|
410
|
-
var
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
+
var Re = w.memo(function({ option: e, index: t, listboxId: n, dir: i, digits: a, isActive: o, isSelected: s, isDisabled: c, isLast: l, isSearchEnabled: u, showSeparator: d, showGroupHeading: f, listSize: p, activeOptionRef: m, onActivateIndex: h, onOptionPointerDown: g, onOptionClick: _ }) {
|
|
419
|
+
return /* @__PURE__ */ D(T, { children: [
|
|
420
|
+
d ? /* @__PURE__ */ E("div", {
|
|
421
|
+
role: "separator",
|
|
422
|
+
"data-slot": "select-separator",
|
|
423
|
+
className: S()
|
|
424
|
+
}) : null,
|
|
425
|
+
f ? /* @__PURE__ */ E("div", {
|
|
426
|
+
role: "presentation",
|
|
427
|
+
"data-slot": "select-group-label",
|
|
428
|
+
className: r(b(), t > 0 && "zui:pt-4"),
|
|
429
|
+
children: L(e.group, a)
|
|
430
|
+
}) : null,
|
|
431
|
+
/* @__PURE__ */ D("button", {
|
|
432
|
+
type: "button",
|
|
433
|
+
id: N(n, t),
|
|
434
|
+
"data-slot": "select-item",
|
|
435
|
+
role: "option",
|
|
436
|
+
"aria-selected": s,
|
|
437
|
+
"aria-disabled": c || void 0,
|
|
438
|
+
"aria-setsize": p,
|
|
439
|
+
"aria-posinset": p === void 0 ? void 0 : t + 1,
|
|
440
|
+
"data-active": o || void 0,
|
|
441
|
+
ref: o ? m : void 0,
|
|
442
|
+
tabIndex: -1,
|
|
443
|
+
onMouseMove: () => {
|
|
444
|
+
!c && !o && h(t);
|
|
445
|
+
},
|
|
446
|
+
dir: i,
|
|
447
|
+
className: r(x(), e.group !== void 0 && "zui:ms-2 zui:w-[calc(100%-var(--zui-spacing)*2)] zui:border-s zui:border-s-[var(--zui-color-border)]", u && "zui:scroll-mt-16", l && "zui:border-b-0", e.className),
|
|
448
|
+
disabled: c,
|
|
449
|
+
onPointerDown: (t) => g(t, e.value, c),
|
|
450
|
+
onClick: () => _(e.value, c),
|
|
451
|
+
children: [/* @__PURE__ */ E("span", {
|
|
452
|
+
className: "zui:line-clamp-2 zui:min-w-0 zui:flex-1 zui:break-words zui:text-start",
|
|
453
|
+
children: L(e.label, a)
|
|
454
|
+
}), /* @__PURE__ */ E("span", {
|
|
455
|
+
"aria-hidden": "true",
|
|
456
|
+
className: "zui:flex zui:shrink-0 zui:items-center zui:justify-center zui:text-[var(--zui-theme-action-primary)]",
|
|
457
|
+
children: /* @__PURE__ */ E(O, { className: r(be, !s && "zui:opacity-0") })
|
|
458
|
+
})]
|
|
459
|
+
})
|
|
460
|
+
] });
|
|
461
|
+
}), ze = w.forwardRef(function({ className: n, children: s }, c) {
|
|
462
|
+
let l = w.useContext(we), { messages: u, digits: d, dir: f } = e(), h = l?.selectType === "multi", g = l?.isSearch ?? !1, ee = l?.showSearchActions ?? !0, v = l?.searchTerm ?? "", b = l?.isOpen ?? !1, x = l?.activeIndex ?? -1, S = l?.listboxId ?? "", C = w.useRef(null), k = w.useRef(null), j = w.useRef(null), M = l?.singleSelectedValue, Ee = l?.multiSelectedValues, F = l?.pinnedSelectedValues, R = l?.options, z = w.useMemo(() => h ? Ee ?? [] : Te(M) ? [M] : [], [
|
|
463
|
+
h,
|
|
464
|
+
Ee,
|
|
465
|
+
M
|
|
466
|
+
]), Fe = w.useMemo(() => F ?? [], [F]), B = w.useMemo(() => R ?? [], [R]), V = l?.remoteOptions, H = typeof V?.loadOptions == "function" && V.enabled !== !1, U = I(V?.pageSize), Le = V?.cacheKey, ze = V?.loadOptions, Be = w.useRef(ze);
|
|
467
|
+
_(() => {
|
|
468
|
+
Be.current = ze;
|
|
418
469
|
});
|
|
419
|
-
let
|
|
420
|
-
let r =
|
|
421
|
-
if (!
|
|
422
|
-
let i =
|
|
423
|
-
|
|
470
|
+
let Ve = w.useRef(null), He = w.useRef(null), Ue = w.useRef([]), W = w.useRef(0), We = w.useRef(!1), [Ge, Ke] = w.useState([]), [qe, Je] = w.useState(""), G = H ? qe : "", [Ye, Xe] = w.useState(_e), [Ze, Qe] = w.useState(!0), [$e, et] = w.useState(!1), [tt, nt] = w.useState(null), rt = w.useMemo(() => new Set(z), [z]), it = w.useMemo(() => new Set(Fe), [Fe]), at = w.useCallback(async (e, t, n) => {
|
|
471
|
+
let r = Be.current;
|
|
472
|
+
if (!H || !r || t === "append" && We.current) return;
|
|
473
|
+
let i = W.current + 1;
|
|
474
|
+
W.current = i, We.current = !0, t === "replace" && (Ue.current = [], Ke([]), Xe(_e), Qe(!0)), et(!0), nt(null);
|
|
424
475
|
try {
|
|
425
476
|
let a = await r({
|
|
426
477
|
page: e,
|
|
427
|
-
pageSize:
|
|
478
|
+
pageSize: U,
|
|
428
479
|
search: n
|
|
429
480
|
});
|
|
430
|
-
if (i !==
|
|
431
|
-
let o =
|
|
432
|
-
|
|
481
|
+
if (i !== W.current) return;
|
|
482
|
+
let o = De(a.options), s = t === "append" ? Oe(Ue.current, o) : o;
|
|
483
|
+
Ue.current = s, Ke(s), Xe(Me(a, e)), Qe(je(a, s.length, o.length, U));
|
|
433
484
|
} catch (e) {
|
|
434
|
-
i ===
|
|
485
|
+
i === W.current && (nt(Ne(e, u.select.loadError)), Qe(!1));
|
|
435
486
|
} finally {
|
|
436
|
-
i ===
|
|
487
|
+
i === W.current && (We.current = !1, et(!1));
|
|
437
488
|
}
|
|
438
489
|
}, [
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
490
|
+
H,
|
|
491
|
+
u.select.loadError,
|
|
492
|
+
U
|
|
442
493
|
]);
|
|
443
|
-
|
|
444
|
-
if (!
|
|
494
|
+
w.useEffect(() => {
|
|
495
|
+
if (!H) return;
|
|
445
496
|
let e = window.setTimeout(() => {
|
|
446
|
-
|
|
497
|
+
Je(v.trim());
|
|
447
498
|
}, ve);
|
|
448
499
|
return () => window.clearTimeout(e);
|
|
449
|
-
}, [
|
|
450
|
-
!
|
|
500
|
+
}, [H, v]), w.useEffect(() => {
|
|
501
|
+
!H || !b || at(_e, "replace", G);
|
|
451
502
|
}, [
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
503
|
+
b,
|
|
504
|
+
H,
|
|
505
|
+
at,
|
|
506
|
+
Le,
|
|
507
|
+
G
|
|
457
508
|
]);
|
|
458
|
-
let
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
]),
|
|
509
|
+
let ot = w.useMemo(() => H ? Oe(G.length === 0 ? B : [], Ge) : B, [
|
|
510
|
+
B,
|
|
511
|
+
H,
|
|
512
|
+
Ge,
|
|
513
|
+
G.length
|
|
514
|
+
]), st = w.useMemo(() => ot.length > 0 || H ? ke(ot).map(Ae) : Ie(s), [
|
|
464
515
|
s,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
]),
|
|
468
|
-
|
|
516
|
+
ot,
|
|
517
|
+
H
|
|
518
|
+
]), K = H && b && Ze && !$e && tt === null, ct = w.useCallback(() => {
|
|
519
|
+
K && at(Ye, "append", G);
|
|
469
520
|
}, [
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
]),
|
|
475
|
-
if (!
|
|
521
|
+
K,
|
|
522
|
+
at,
|
|
523
|
+
Ye,
|
|
524
|
+
G
|
|
525
|
+
]), lt = w.useCallback((e) => {
|
|
526
|
+
if (!K) return;
|
|
476
527
|
let t = e.currentTarget;
|
|
477
|
-
t.scrollHeight - t.scrollTop - t.clientHeight <= ye &&
|
|
478
|
-
}, [
|
|
479
|
-
|
|
480
|
-
if (!
|
|
481
|
-
let e =
|
|
528
|
+
t.scrollHeight - t.scrollTop - t.clientHeight <= ye && ct();
|
|
529
|
+
}, [K, ct]);
|
|
530
|
+
w.useEffect(() => {
|
|
531
|
+
if (!K || typeof window > "u" || !("IntersectionObserver" in window)) return;
|
|
532
|
+
let e = He.current, t = Ve.current;
|
|
482
533
|
if (!e || !t) return;
|
|
483
534
|
let n = new IntersectionObserver((e) => {
|
|
484
|
-
e.some((e) => e.isIntersecting) &&
|
|
535
|
+
e.some((e) => e.isIntersecting) && ct();
|
|
485
536
|
}, { root: t });
|
|
486
537
|
return n.observe(e), () => n.disconnect();
|
|
487
|
-
}, [
|
|
488
|
-
let
|
|
489
|
-
if (!g ||
|
|
490
|
-
let e =
|
|
491
|
-
return e.length === 0 ?
|
|
538
|
+
}, [K, ct]);
|
|
539
|
+
let ut = w.useDeferredValue(v), dt = w.useMemo(() => {
|
|
540
|
+
if (!g || H) return st;
|
|
541
|
+
let e = ut.trim().toLocaleLowerCase();
|
|
542
|
+
return e.length === 0 ? st : st.filter((t) => t.searchText.includes(e));
|
|
492
543
|
}, [
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
]),
|
|
498
|
-
if (
|
|
544
|
+
st,
|
|
545
|
+
ut,
|
|
546
|
+
H,
|
|
547
|
+
g
|
|
548
|
+
]), q = w.useMemo(() => {
|
|
549
|
+
if (dt.some((e) => e.group !== void 0)) return dt;
|
|
499
550
|
let e = [], t = [];
|
|
500
|
-
return
|
|
501
|
-
|
|
551
|
+
return dt.forEach((n) => {
|
|
552
|
+
it.has(n.value) ? e.push(n) : t.push(n);
|
|
502
553
|
}), [...e, ...t];
|
|
503
|
-
}, [
|
|
554
|
+
}, [dt, it]), ft = w.useMemo(() => Array.from(new Set(st.filter((e) => !e.disabled).map((e) => e.value))), [st]), pt = ft.length > 0 && ft.every((e) => rt.has(e)), J = l?.isModal ?? !1, [mt, ht] = w.useState({
|
|
504
555
|
isOpen: !1,
|
|
505
556
|
group: null,
|
|
506
557
|
enterFrom: null
|
|
507
558
|
});
|
|
508
|
-
|
|
509
|
-
isOpen:
|
|
559
|
+
mt.isOpen !== J && ht({
|
|
560
|
+
isOpen: J,
|
|
510
561
|
group: null,
|
|
511
562
|
enterFrom: null
|
|
512
563
|
});
|
|
513
|
-
let
|
|
514
|
-
|
|
515
|
-
if (!g || !
|
|
564
|
+
let gt = w.useRef(null), _t = w.useRef(null), vt = w.useRef(!1);
|
|
565
|
+
w.useEffect(() => {
|
|
566
|
+
if (!g || !b || J) return;
|
|
516
567
|
let e = requestAnimationFrame(() => {
|
|
517
|
-
|
|
568
|
+
C.current?.focus(), C.current?.select();
|
|
518
569
|
});
|
|
519
570
|
return () => cancelAnimationFrame(e);
|
|
520
571
|
}, [
|
|
521
|
-
|
|
522
|
-
|
|
572
|
+
b,
|
|
573
|
+
J,
|
|
523
574
|
g
|
|
524
|
-
])
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
575
|
+
]);
|
|
576
|
+
let Y = q.some((e) => e.group !== void 0), yt = (e) => e.group ?? A, bt = Y ? Array.from(new Set(q.map(yt))) : [], xt = q.find((e) => rt.has(e.value)), St = mt.group ?? (xt ? yt(xt) : void 0), X = St !== void 0 && bt.includes(St) ? St : bt[0], [Z, Ct] = w.useState(null), [wt, Tt] = w.useState(0), [Et, Dt] = w.useState(0), Ot = w.useRef(null), kt = w.useRef(!1), At = w.useMemo(() => {
|
|
577
|
+
if (!J || !Y) return null;
|
|
578
|
+
let e = [];
|
|
579
|
+
return q.forEach((t, n) => {
|
|
580
|
+
(t.group ?? A) === X && e.push(n);
|
|
581
|
+
}), e;
|
|
582
|
+
}, [
|
|
583
|
+
X,
|
|
584
|
+
Y,
|
|
585
|
+
J,
|
|
586
|
+
q
|
|
587
|
+
]), jt = At?.length ?? q.length, Q = jt > xe, Mt = (e) => At?.[e] ?? e, Nt = w.useCallback((e) => {
|
|
588
|
+
Ve.current = e, Ct(e);
|
|
589
|
+
}, []);
|
|
590
|
+
_(() => {
|
|
591
|
+
let e = Ot.current;
|
|
592
|
+
!Q || !Z || !e || (Tt(e.getBoundingClientRect().top - Z.getBoundingClientRect().top + Z.scrollTop), Dt(Z.querySelector("[data-slot=\"select-search\"]")?.offsetHeight ?? 0));
|
|
593
|
+
}, [
|
|
594
|
+
g,
|
|
595
|
+
Q,
|
|
596
|
+
Z
|
|
597
|
+
]);
|
|
598
|
+
let $ = pe({
|
|
599
|
+
count: Q ? jt : 0,
|
|
600
|
+
getScrollElement: () => Z,
|
|
601
|
+
estimateSize: () => Se,
|
|
602
|
+
overscan: Ce,
|
|
603
|
+
scrollMargin: wt,
|
|
604
|
+
scrollPaddingStart: Et,
|
|
605
|
+
useFlushSync: !1,
|
|
606
|
+
getItemKey: (e) => {
|
|
607
|
+
let t = q[Mt(e)];
|
|
608
|
+
return t ? P(t.value, t.group) : e;
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
_(() => {
|
|
612
|
+
!Q || !Z || (Z.scrollTop = 0, $.scrollToOffset(0));
|
|
613
|
+
}, [
|
|
614
|
+
ut,
|
|
615
|
+
$,
|
|
616
|
+
Q,
|
|
617
|
+
Z
|
|
618
|
+
]), w.useEffect(() => {
|
|
619
|
+
if (kt.current) {
|
|
620
|
+
kt.current = !1;
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
if (Q) {
|
|
624
|
+
x >= 0 && !J && $.scrollToIndex(x, { align: "auto" });
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
k.current?.scrollIntoView({ block: "nearest" });
|
|
628
|
+
}, [
|
|
629
|
+
x,
|
|
630
|
+
J,
|
|
631
|
+
$,
|
|
632
|
+
Q
|
|
633
|
+
]);
|
|
634
|
+
let Pt = w.useCallback((e) => {
|
|
635
|
+
l?.setSearchTerm(t({ value: e.target.value }));
|
|
636
|
+
}, [l]), Ft = w.useCallback((e) => {
|
|
637
|
+
if (l) {
|
|
638
|
+
if (h) {
|
|
639
|
+
let t = new Set(z);
|
|
640
|
+
t.has(e) ? t.delete(e) : t.add(e), l.setMultiSelectedValues(Array.from(t));
|
|
534
641
|
return;
|
|
535
642
|
}
|
|
536
|
-
|
|
643
|
+
l.setSingleSelectedValue(e), l.setOpen(!1);
|
|
537
644
|
}
|
|
538
645
|
}, [
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
]),
|
|
543
|
-
e.preventDefault(), !n && (
|
|
544
|
-
}, [
|
|
646
|
+
h,
|
|
647
|
+
l,
|
|
648
|
+
z
|
|
649
|
+
]), It = w.useCallback((e, t, n) => {
|
|
650
|
+
e.preventDefault(), !n && (j.current = t, Ft(t));
|
|
651
|
+
}, [Ft]), Lt = w.useCallback((e, t) => {
|
|
545
652
|
if (!t) {
|
|
546
|
-
if (
|
|
547
|
-
|
|
653
|
+
if (j.current === e) {
|
|
654
|
+
j.current = null;
|
|
548
655
|
return;
|
|
549
656
|
}
|
|
550
|
-
|
|
657
|
+
Ft(e);
|
|
551
658
|
}
|
|
552
|
-
}, [
|
|
553
|
-
|
|
659
|
+
}, [Ft]), Rt = w.useRef({
|
|
660
|
+
activateIndex: () => void 0,
|
|
661
|
+
pointerDown: It,
|
|
662
|
+
click: Lt
|
|
663
|
+
}), zt = l?.setActiveIndex;
|
|
664
|
+
_(() => {
|
|
665
|
+
Rt.current = {
|
|
666
|
+
activateIndex: (e) => {
|
|
667
|
+
kt.current = !0, zt?.(e);
|
|
668
|
+
},
|
|
669
|
+
pointerDown: It,
|
|
670
|
+
click: Lt
|
|
671
|
+
};
|
|
672
|
+
});
|
|
673
|
+
let Bt = w.useCallback((e) => Rt.current.activateIndex(e), []), Vt = w.useCallback((e, t, n) => Rt.current.pointerDown(e, t, n), []), Ht = w.useCallback((e, t) => Rt.current.click(e, t), []), Ut = w.useCallback(() => {
|
|
674
|
+
h && l && l.setMultiSelectedValues(pt ? [] : ft);
|
|
554
675
|
}, [
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
]),
|
|
560
|
-
if (!
|
|
561
|
-
let t =
|
|
562
|
-
let t =
|
|
563
|
-
return !!t && !t.disabled && !
|
|
676
|
+
pt,
|
|
677
|
+
h,
|
|
678
|
+
l,
|
|
679
|
+
ft
|
|
680
|
+
]), Wt = l?.isDisabled ?? !1, Gt = (e) => {
|
|
681
|
+
if (!b || !l) return;
|
|
682
|
+
let t = l.fieldRootRef.current?.querySelector("[data-slot=\"select-trigger\"]"), n = (e) => {
|
|
683
|
+
let t = q[e];
|
|
684
|
+
return !!t && !t.disabled && !Wt;
|
|
564
685
|
}, r = (e, t) => {
|
|
565
|
-
let r =
|
|
686
|
+
let r = q.length;
|
|
566
687
|
for (let i = 1; i <= r; i += 1) {
|
|
567
688
|
let a = ((e + t * i) % r + r) % r;
|
|
568
689
|
if (n(a)) return a;
|
|
@@ -570,27 +691,27 @@ var K = S.forwardRef(function({ className: n, children: s }, ee) {
|
|
|
570
691
|
return -1;
|
|
571
692
|
};
|
|
572
693
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
573
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
574
|
-
let t = r(
|
|
575
|
-
t >= 0 &&
|
|
694
|
+
if (e.preventDefault(), e.stopPropagation(), q.length === 0) return;
|
|
695
|
+
let t = r(x >= 0 ? x : e.key === "ArrowDown" ? -1 : 0, e.key === "ArrowDown" ? 1 : -1);
|
|
696
|
+
t >= 0 && l.setActiveIndex(t);
|
|
576
697
|
return;
|
|
577
698
|
}
|
|
578
|
-
if (e.key === "Enter" && n(
|
|
579
|
-
e.preventDefault(), e.stopPropagation(),
|
|
699
|
+
if (e.key === "Enter" && n(x)) {
|
|
700
|
+
e.preventDefault(), e.stopPropagation(), Ft(q[x].value), h || t?.focus();
|
|
580
701
|
return;
|
|
581
702
|
}
|
|
582
|
-
e.key === "Tab" && (e.target ===
|
|
583
|
-
},
|
|
584
|
-
if (
|
|
585
|
-
|
|
586
|
-
}), !
|
|
587
|
-
let
|
|
588
|
-
|
|
589
|
-
isOpen:
|
|
703
|
+
e.key === "Tab" && (e.target === C.current && t?.focus(), l.setOpen(!1));
|
|
704
|
+
}, Kt = l?.registerListKeyDown;
|
|
705
|
+
if (_(() => {
|
|
706
|
+
Kt?.(Gt);
|
|
707
|
+
}), !l) return null;
|
|
708
|
+
let qt = q.length > 0, Jt = l.isDisabled || z.length === 0, Yt = l.isDisabled || ft.length === 0 || pt, Xt = (e, t) => {
|
|
709
|
+
ht({
|
|
710
|
+
isOpen: J,
|
|
590
711
|
group: e,
|
|
591
712
|
enterFrom: t
|
|
592
713
|
}), window.requestAnimationFrame(() => {
|
|
593
|
-
let e =
|
|
714
|
+
let e = gt.current, t = e?.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
|
|
594
715
|
if (!e || !t) return;
|
|
595
716
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = r.left + r.width / 2 - (n.left + n.width / 2);
|
|
596
717
|
typeof e.scrollTo == "function" ? e.scrollTo({
|
|
@@ -598,191 +719,227 @@ var K = S.forwardRef(function({ className: n, children: s }, ee) {
|
|
|
598
719
|
behavior: "smooth"
|
|
599
720
|
}) : e.scrollLeft += i;
|
|
600
721
|
});
|
|
601
|
-
},
|
|
602
|
-
|
|
722
|
+
}, Zt = (e) => {
|
|
723
|
+
vt.current = !1, _t.current = {
|
|
603
724
|
x: e.clientX,
|
|
604
725
|
y: e.clientY,
|
|
605
726
|
time: e.timeStamp
|
|
606
727
|
};
|
|
607
|
-
},
|
|
608
|
-
let t =
|
|
609
|
-
if (
|
|
728
|
+
}, Qt = (e) => {
|
|
729
|
+
let t = _t.current;
|
|
730
|
+
if (_t.current = null, !t || X === void 0) return;
|
|
610
731
|
let n = e.clientX - t.x, r = e.clientY - t.y, i = Math.abs(n), a = i / Math.max(e.timeStamp - t.time, 1);
|
|
611
|
-
if (!(i >=
|
|
612
|
-
|
|
613
|
-
let o =
|
|
614
|
-
s !== void 0 &&
|
|
615
|
-
},
|
|
616
|
-
|
|
617
|
-
},
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
732
|
+
if (!(i >= me || i >= he && a >= ge) || i < Math.abs(r)) return;
|
|
733
|
+
vt.current = !0;
|
|
734
|
+
let o = f === "rtl" ? n > 0 : n < 0, s = bt[bt.indexOf(X) + (o ? 1 : -1)];
|
|
735
|
+
s !== void 0 && Xt(s, n > 0 ? "left" : "right");
|
|
736
|
+
}, $t = (e) => {
|
|
737
|
+
vt.current && (vt.current = !1, e.preventDefault(), e.stopPropagation());
|
|
738
|
+
}, en = (e, t, n) => /* @__PURE__ */ E(Re, {
|
|
739
|
+
option: e,
|
|
740
|
+
index: t,
|
|
741
|
+
listboxId: S,
|
|
742
|
+
dir: f,
|
|
743
|
+
digits: d,
|
|
744
|
+
isActive: t === x,
|
|
745
|
+
isSelected: rt.has(e.value),
|
|
746
|
+
isDisabled: l.isDisabled || e.disabled,
|
|
747
|
+
isLast: t === q.length - 1,
|
|
748
|
+
isSearchEnabled: g,
|
|
749
|
+
showSeparator: e.separatorBefore === !0 && t > 0,
|
|
750
|
+
showGroupHeading: e.group !== void 0 && e.group !== q[t - 1]?.group,
|
|
751
|
+
listSize: n,
|
|
752
|
+
activeOptionRef: k,
|
|
753
|
+
onActivateIndex: Bt,
|
|
754
|
+
onOptionPointerDown: Vt,
|
|
755
|
+
onOptionClick: Ht
|
|
756
|
+
}), tn = (e, t, n, i) => {
|
|
757
|
+
let a = rt.has(e.value), o = l.isDisabled || e.disabled, s = !Y && e.group !== void 0 && e.group !== q[t - 1]?.group;
|
|
758
|
+
return /* @__PURE__ */ D(T, { children: [
|
|
759
|
+
!Y && e.separatorBefore === !0 && t > 0 ? /* @__PURE__ */ E("div", {
|
|
622
760
|
role: "separator",
|
|
623
761
|
"data-slot": "select-separator",
|
|
624
762
|
className: "zui:my-1 zui:h-px zui:bg-[var(--zui-color-border)]"
|
|
625
763
|
}) : null,
|
|
626
|
-
|
|
764
|
+
s ? /* @__PURE__ */ E("div", {
|
|
627
765
|
role: "presentation",
|
|
628
766
|
"data-slot": "select-group-label",
|
|
629
767
|
className: "zui:px-1 zui:pt-2 zui:text-start zui:text-[max(calc(var(--zui-scale,10px)*1.26),13px)] zui:font-semibold zui:text-[var(--zui-theme-text-muted)]",
|
|
630
|
-
children:
|
|
768
|
+
children: L(e.group, d)
|
|
631
769
|
}) : null,
|
|
632
|
-
/* @__PURE__ */
|
|
770
|
+
/* @__PURE__ */ D("button", {
|
|
633
771
|
type: "button",
|
|
634
|
-
id:
|
|
772
|
+
id: N(S, t),
|
|
635
773
|
"data-slot": "select-item",
|
|
636
774
|
role: "option",
|
|
637
|
-
"aria-selected":
|
|
638
|
-
"aria-disabled":
|
|
639
|
-
|
|
775
|
+
"aria-selected": a,
|
|
776
|
+
"aria-disabled": o || void 0,
|
|
777
|
+
"aria-setsize": n,
|
|
778
|
+
"aria-posinset": i,
|
|
779
|
+
disabled: o,
|
|
640
780
|
tabIndex: -1,
|
|
641
|
-
dir:
|
|
642
|
-
className: r(
|
|
643
|
-
onClick: () =>
|
|
644
|
-
children: [/* @__PURE__ */
|
|
781
|
+
dir: f,
|
|
782
|
+
className: r(se, a && "zui:border-[var(--zui-theme-status-success)] zui:bg-[color-mix(in_srgb,var(--zui-theme-status-success)_8%,var(--zui-color-surface))]", e.className),
|
|
783
|
+
onClick: () => Lt(e.value, o),
|
|
784
|
+
children: [/* @__PURE__ */ E("span", {
|
|
645
785
|
className: "zui:min-w-0 zui:flex-1 zui:break-words zui:text-start",
|
|
646
|
-
children:
|
|
647
|
-
}), /* @__PURE__ */
|
|
786
|
+
children: L(e.label, d)
|
|
787
|
+
}), /* @__PURE__ */ E("span", {
|
|
648
788
|
"aria-hidden": "true",
|
|
649
789
|
className: "zui:flex zui:shrink-0 zui:items-center",
|
|
650
|
-
children:
|
|
790
|
+
children: a ? /* @__PURE__ */ E("span", {
|
|
651
791
|
className: "zui:flex zui:size-7 zui:items-center zui:justify-center zui:rounded-full zui:bg-[var(--zui-theme-status-success)] zui:text-[var(--zui-color-on-solid)]",
|
|
652
|
-
children: /* @__PURE__ */
|
|
792
|
+
children: /* @__PURE__ */ E(O, {
|
|
653
793
|
className: "zui:size-4",
|
|
654
794
|
strokeWidth: 3
|
|
655
795
|
})
|
|
656
796
|
}) : null
|
|
657
797
|
})]
|
|
658
798
|
})
|
|
659
|
-
] }
|
|
660
|
-
}
|
|
661
|
-
ref:
|
|
799
|
+
] });
|
|
800
|
+
}, nn = J && !Q ? q.map((e, t) => Y && yt(e) !== X ? null : /* @__PURE__ */ E(w.Fragment, { children: tn(e, t) }, P(e.value, e.group))) : null, rn = /* @__PURE__ */ D("div", {
|
|
801
|
+
ref: Nt,
|
|
662
802
|
"data-slot": "select-viewport",
|
|
663
|
-
onScroll:
|
|
803
|
+
onScroll: lt,
|
|
664
804
|
className: "zui:-mx-1 zui:min-h-0 zui:flex-1 zui:touch-pan-y zui:overflow-x-hidden zui:overflow-y-auto zui:overscroll-contain zui:px-1 zui:py-1",
|
|
665
805
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
|
|
806
|
+
/* @__PURE__ */ E("div", {
|
|
807
|
+
ref: Ot,
|
|
808
|
+
id: S,
|
|
668
809
|
role: "listbox",
|
|
669
|
-
"aria-multiselectable":
|
|
810
|
+
"aria-multiselectable": h || void 0,
|
|
670
811
|
"data-slot": "select-listbox",
|
|
671
|
-
className: "zui:flex zui:flex-col zui:gap-2.5",
|
|
672
|
-
|
|
812
|
+
className: Q ? void 0 : "zui:flex zui:flex-col zui:gap-2.5",
|
|
813
|
+
style: Q ? {
|
|
814
|
+
position: "relative",
|
|
815
|
+
height: $.getTotalSize()
|
|
816
|
+
} : void 0,
|
|
817
|
+
children: Q ? $.getVirtualItems().map((e) => {
|
|
818
|
+
let t = Mt(e.index), n = q[t];
|
|
819
|
+
return n ? /* @__PURE__ */ E("div", {
|
|
820
|
+
ref: $.measureElement,
|
|
821
|
+
"data-index": e.index,
|
|
822
|
+
role: "presentation",
|
|
823
|
+
className: "zui:pb-2.5",
|
|
824
|
+
style: {
|
|
825
|
+
position: "absolute",
|
|
826
|
+
top: 0,
|
|
827
|
+
left: 0,
|
|
828
|
+
width: "100%",
|
|
829
|
+
transform: `translateY(${e.start - wt}px)`
|
|
830
|
+
},
|
|
831
|
+
children: tn(n, t, jt, e.index + 1)
|
|
832
|
+
}, e.key) : null;
|
|
833
|
+
}) : nn
|
|
673
834
|
}),
|
|
674
|
-
!
|
|
835
|
+
!qt && !$e ? /* @__PURE__ */ E("p", {
|
|
675
836
|
"data-slot": "select-empty",
|
|
676
837
|
className: "zui:px-2 zui:py-4 zui:text-center zui:text-[max(calc(var(--zui-scale,10px)*1.44),15px)] zui:text-[var(--zui-theme-text-muted)]",
|
|
677
|
-
children:
|
|
838
|
+
children: u.select.noResults
|
|
678
839
|
}) : null,
|
|
679
|
-
|
|
680
|
-
|
|
840
|
+
$e ? /* @__PURE__ */ E(Pe, {}) : null,
|
|
841
|
+
tt ? /* @__PURE__ */ E("p", {
|
|
681
842
|
"data-slot": "select-error",
|
|
682
843
|
className: "zui:px-2 zui:py-2 zui:text-sm zui:text-[var(--zui-theme-status-danger)]",
|
|
683
|
-
children:
|
|
844
|
+
children: tt
|
|
684
845
|
}) : null,
|
|
685
|
-
|
|
686
|
-
ref:
|
|
846
|
+
K ? /* @__PURE__ */ E("div", {
|
|
847
|
+
ref: He,
|
|
687
848
|
"data-slot": "select-infinite-scroll-sentinel",
|
|
688
849
|
"aria-hidden": "true",
|
|
689
850
|
className: "zui:h-px zui:w-full"
|
|
690
851
|
}) : null
|
|
691
852
|
]
|
|
692
|
-
}),
|
|
853
|
+
}), an = /* @__PURE__ */ D("div", {
|
|
693
854
|
"data-slot": "select-modal-body",
|
|
694
855
|
className: "zui:flex zui:min-h-0 zui:flex-1 zui:flex-col zui:gap-4",
|
|
695
856
|
children: [
|
|
696
|
-
g ? /* @__PURE__ */
|
|
857
|
+
g ? /* @__PURE__ */ D("div", {
|
|
697
858
|
"data-slot": "select-search",
|
|
698
859
|
className: "zui:flex zui:items-center zui:gap-2",
|
|
699
|
-
children: [
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
860
|
+
children: [/* @__PURE__ */ E("div", {
|
|
861
|
+
className: "zui:min-w-0 zui:flex-1",
|
|
862
|
+
children: /* @__PURE__ */ E(p, {
|
|
863
|
+
ref: C,
|
|
864
|
+
type: "search",
|
|
865
|
+
dir: f,
|
|
866
|
+
role: "combobox",
|
|
867
|
+
"aria-expanded": b,
|
|
868
|
+
"aria-controls": S,
|
|
869
|
+
"aria-autocomplete": "list",
|
|
870
|
+
"aria-label": u.common.searchPlaceholder,
|
|
871
|
+
value: v,
|
|
872
|
+
placeholder: u.common.searchPlaceholder,
|
|
873
|
+
onChange: Pt,
|
|
874
|
+
onKeyDown: (e) => {
|
|
875
|
+
e.stopPropagation(), Gt(e);
|
|
876
|
+
}
|
|
877
|
+
})
|
|
878
|
+
}), ee ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(m, {
|
|
879
|
+
label: u.select.clearAll,
|
|
880
|
+
icon: /* @__PURE__ */ E(de, {
|
|
881
|
+
className: "zui:size-5",
|
|
882
|
+
"aria-hidden": "true"
|
|
718
883
|
}),
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
className:
|
|
726
|
-
|
|
727
|
-
onClick: () => m ? c.setMultiSelectedValues([]) : c.clearSingleSelection()
|
|
884
|
+
className: oe,
|
|
885
|
+
disabled: Jt,
|
|
886
|
+
onClick: () => h ? l.setMultiSelectedValues([]) : l.clearSingleSelection()
|
|
887
|
+
}), h ? /* @__PURE__ */ E(m, {
|
|
888
|
+
label: l.multiSelectAllLabel,
|
|
889
|
+
icon: /* @__PURE__ */ E(ue, {
|
|
890
|
+
className: "zui:size-5",
|
|
891
|
+
"aria-hidden": "true"
|
|
728
892
|
}),
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
"aria-hidden": "true"
|
|
734
|
-
}),
|
|
735
|
-
className: y,
|
|
736
|
-
disabled: xt,
|
|
737
|
-
onClick: ht
|
|
738
|
-
}) : null
|
|
739
|
-
]
|
|
893
|
+
className: oe,
|
|
894
|
+
disabled: Yt,
|
|
895
|
+
onClick: Ut
|
|
896
|
+
}) : null] }) : null]
|
|
740
897
|
}) : null,
|
|
741
|
-
|
|
742
|
-
value:
|
|
743
|
-
onValueChange: (e) =>
|
|
744
|
-
dir:
|
|
898
|
+
Y && X !== void 0 ? /* @__PURE__ */ D(y, {
|
|
899
|
+
value: X,
|
|
900
|
+
onValueChange: (e) => Xt(e, null),
|
|
901
|
+
dir: f,
|
|
745
902
|
className: "zui:min-h-0 zui:flex-1",
|
|
746
|
-
children: [/* @__PURE__ */
|
|
747
|
-
ref:
|
|
903
|
+
children: [/* @__PURE__ */ E("div", {
|
|
904
|
+
ref: gt,
|
|
748
905
|
"data-slot": "select-group-tabs",
|
|
749
906
|
className: "zui:-mx-1 zui:overflow-x-auto zui:px-1 zui:[scrollbar-width:none] zui:[&::-webkit-scrollbar]:hidden",
|
|
750
|
-
children: /* @__PURE__ */
|
|
751
|
-
"aria-label":
|
|
907
|
+
children: /* @__PURE__ */ E(ne, {
|
|
908
|
+
"aria-label": u.select.ungrouped,
|
|
752
909
|
className: "zui:w-max zui:min-w-full",
|
|
753
|
-
children:
|
|
910
|
+
children: bt.map((e) => /* @__PURE__ */ E(re, {
|
|
754
911
|
value: e,
|
|
755
912
|
className: "zui:flex-none",
|
|
756
|
-
children: e ===
|
|
913
|
+
children: e === A ? u.select.ungrouped : L(e, d)
|
|
757
914
|
}, e))
|
|
758
915
|
})
|
|
759
|
-
}), /* @__PURE__ */
|
|
916
|
+
}), /* @__PURE__ */ E("div", {
|
|
760
917
|
"data-slot": "select-group-swipe-area",
|
|
761
918
|
className: "zui:flex zui:min-h-0 zui:flex-1 zui:touch-pan-y zui:flex-col",
|
|
762
|
-
onPointerDown:
|
|
763
|
-
onPointerUp:
|
|
919
|
+
onPointerDown: Zt,
|
|
920
|
+
onPointerUp: Qt,
|
|
764
921
|
onPointerCancel: () => {
|
|
765
|
-
|
|
922
|
+
_t.current = null;
|
|
766
923
|
},
|
|
767
|
-
onClickCapture:
|
|
768
|
-
children: /* @__PURE__ */
|
|
769
|
-
value:
|
|
770
|
-
className: r("zui:mt-0 zui:flex zui:min-h-0 zui:flex-1 zui:flex-col",
|
|
771
|
-
children:
|
|
772
|
-
},
|
|
924
|
+
onClickCapture: $t,
|
|
925
|
+
children: /* @__PURE__ */ E(te, {
|
|
926
|
+
value: X,
|
|
927
|
+
className: r("zui:mt-0 zui:flex zui:min-h-0 zui:flex-1 zui:flex-col", mt.enterFrom === "left" && "zui:slide-in-from-left-8 zui:data-[state=active]:slide-in-from-bottom-0", mt.enterFrom === "right" && "zui:slide-in-from-right-8 zui:data-[state=active]:slide-in-from-bottom-0"),
|
|
928
|
+
children: rn
|
|
929
|
+
}, X)
|
|
773
930
|
})]
|
|
774
|
-
}) :
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
label:
|
|
931
|
+
}) : rn,
|
|
932
|
+
/* @__PURE__ */ E(a, {
|
|
933
|
+
label: u.common.close,
|
|
777
934
|
fullWidth: !0,
|
|
778
|
-
onClick: () =>
|
|
935
|
+
onClick: () => l.setOpen(!1)
|
|
779
936
|
})
|
|
780
937
|
]
|
|
781
938
|
});
|
|
782
|
-
return /* @__PURE__ */
|
|
783
|
-
ref: i(
|
|
939
|
+
return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(fe.Portal, { children: /* @__PURE__ */ E(fe.Content, {
|
|
940
|
+
ref: i(c, l.contentRef),
|
|
784
941
|
"data-slot": "select-content",
|
|
785
|
-
dir:
|
|
942
|
+
dir: f,
|
|
786
943
|
side: "bottom",
|
|
787
944
|
align: "start",
|
|
788
945
|
sideOffset: 6,
|
|
@@ -790,147 +947,121 @@ var K = S.forwardRef(function({ className: n, children: s }, ee) {
|
|
|
790
947
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
791
948
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
792
949
|
onInteractOutside: (e) => {
|
|
793
|
-
|
|
950
|
+
l.fieldRootRef.current?.contains(e.target) && e.preventDefault();
|
|
794
951
|
},
|
|
795
952
|
className: r(ae(), n),
|
|
796
|
-
children: /* @__PURE__ */
|
|
797
|
-
ref:
|
|
953
|
+
children: /* @__PURE__ */ D("div", {
|
|
954
|
+
ref: Nt,
|
|
798
955
|
"data-slot": "select-viewport",
|
|
799
|
-
className: r(
|
|
800
|
-
onScroll:
|
|
956
|
+
className: r(le({ hasSearch: g }), "zui:max-h-72 zui:overflow-y-auto"),
|
|
957
|
+
onScroll: lt,
|
|
801
958
|
children: [
|
|
802
|
-
g ? /* @__PURE__ */
|
|
959
|
+
g ? /* @__PURE__ */ E("div", {
|
|
803
960
|
"data-slot": "select-search",
|
|
804
961
|
className: ce,
|
|
805
|
-
children: /* @__PURE__ */
|
|
806
|
-
dir:
|
|
962
|
+
children: /* @__PURE__ */ D("div", {
|
|
963
|
+
dir: f,
|
|
807
964
|
className: "zui:flex zui:items-center zui:gap-1",
|
|
808
|
-
children: [
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
965
|
+
children: [/* @__PURE__ */ E("div", {
|
|
966
|
+
className: "zui:min-w-0 zui:flex-1",
|
|
967
|
+
children: /* @__PURE__ */ E(p, {
|
|
968
|
+
ref: C,
|
|
969
|
+
type: "search",
|
|
970
|
+
dir: f,
|
|
971
|
+
role: "combobox",
|
|
972
|
+
"aria-expanded": b,
|
|
973
|
+
"aria-controls": S,
|
|
974
|
+
"aria-autocomplete": "list",
|
|
975
|
+
"aria-activedescendant": x >= 0 ? N(S, x) : void 0,
|
|
976
|
+
"aria-label": u.common.searchPlaceholder,
|
|
977
|
+
value: v,
|
|
978
|
+
placeholder: u.common.searchPlaceholder,
|
|
979
|
+
onChange: Pt,
|
|
980
|
+
onKeyDown: (e) => {
|
|
981
|
+
e.stopPropagation(), Gt(e);
|
|
982
|
+
},
|
|
983
|
+
onPointerDown: (e) => e.stopPropagation()
|
|
984
|
+
})
|
|
985
|
+
}), ee ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(m, {
|
|
986
|
+
label: u.select.clearAll,
|
|
987
|
+
icon: /* @__PURE__ */ E(de, {
|
|
988
|
+
className: "zui:size-4 zui:text-[var(--zui-color-text)]",
|
|
989
|
+
"aria-hidden": "true"
|
|
829
990
|
}),
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
onClick: () => m ? c.setMultiSelectedValues([]) : c.clearSingleSelection()
|
|
991
|
+
className: ie,
|
|
992
|
+
disabled: Jt,
|
|
993
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
994
|
+
onClick: () => h ? l.setMultiSelectedValues([]) : l.clearSingleSelection()
|
|
995
|
+
}), h ? /* @__PURE__ */ E(m, {
|
|
996
|
+
label: l.multiSelectAllLabel,
|
|
997
|
+
icon: /* @__PURE__ */ E(ue, {
|
|
998
|
+
className: r(be, "zui:text-[var(--zui-color-text)]"),
|
|
999
|
+
"aria-hidden": "true"
|
|
840
1000
|
}),
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
}),
|
|
847
|
-
className: ie,
|
|
848
|
-
disabled: xt,
|
|
849
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
850
|
-
onClick: ht
|
|
851
|
-
}) : null
|
|
852
|
-
]
|
|
1001
|
+
className: ie,
|
|
1002
|
+
disabled: Yt,
|
|
1003
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
1004
|
+
onClick: Ut
|
|
1005
|
+
}) : null] }) : null]
|
|
853
1006
|
})
|
|
854
1007
|
}) : null,
|
|
855
|
-
/* @__PURE__ */
|
|
856
|
-
|
|
1008
|
+
/* @__PURE__ */ E("div", {
|
|
1009
|
+
ref: Ot,
|
|
1010
|
+
id: S,
|
|
857
1011
|
role: "listbox",
|
|
858
|
-
"aria-multiselectable":
|
|
1012
|
+
"aria-multiselectable": h || void 0,
|
|
859
1013
|
"data-slot": "select-listbox",
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
"aria-disabled": i || void 0,
|
|
881
|
-
"data-active": t === E || void 0,
|
|
882
|
-
ref: t === E ? M : void 0,
|
|
883
|
-
tabIndex: -1,
|
|
884
|
-
onMouseMove: () => {
|
|
885
|
-
!i && t !== E && c.setActiveIndex(t);
|
|
886
|
-
},
|
|
887
|
-
dir: p,
|
|
888
|
-
className: r(se(), e.group !== void 0 && "zui:ms-2 zui:w-[calc(100%-var(--zui-spacing)*2)] zui:border-s zui:border-s-[var(--zui-color-border)]", g && "zui:scroll-mt-16", t === Q.length - 1 && "zui:border-b-0", e.className),
|
|
889
|
-
disabled: i,
|
|
890
|
-
onPointerDown: (t) => pt(t, e.value, i),
|
|
891
|
-
onClick: () => mt(e.value, i),
|
|
892
|
-
children: [/* @__PURE__ */ C("span", {
|
|
893
|
-
className: "zui:line-clamp-2 zui:min-w-0 zui:flex-1 zui:break-words zui:text-start",
|
|
894
|
-
children: R(e.label, u)
|
|
895
|
-
}), /* @__PURE__ */ C("span", {
|
|
896
|
-
"aria-hidden": "true",
|
|
897
|
-
className: "zui:flex zui:shrink-0 zui:items-center zui:justify-center zui:text-[var(--zui-theme-action-primary)]",
|
|
898
|
-
children: /* @__PURE__ */ C(T, { className: r(be, !n && "zui:opacity-0") })
|
|
899
|
-
})]
|
|
900
|
-
})
|
|
901
|
-
] }, N(e.value, e.group));
|
|
902
|
-
})
|
|
1014
|
+
style: Q ? {
|
|
1015
|
+
position: "relative",
|
|
1016
|
+
height: $.getTotalSize()
|
|
1017
|
+
} : void 0,
|
|
1018
|
+
children: Q ? $.getVirtualItems().map((e) => {
|
|
1019
|
+
let t = q[e.index];
|
|
1020
|
+
return t ? /* @__PURE__ */ E("div", {
|
|
1021
|
+
ref: $.measureElement,
|
|
1022
|
+
"data-index": e.index,
|
|
1023
|
+
role: "presentation",
|
|
1024
|
+
style: {
|
|
1025
|
+
position: "absolute",
|
|
1026
|
+
top: 0,
|
|
1027
|
+
left: 0,
|
|
1028
|
+
width: "100%",
|
|
1029
|
+
transform: `translateY(${e.start - wt}px)`
|
|
1030
|
+
},
|
|
1031
|
+
children: en(t, e.index, q.length)
|
|
1032
|
+
}, e.key) : null;
|
|
1033
|
+
}) : q.map((e, t) => /* @__PURE__ */ E(w.Fragment, { children: en(e, t) }, P(e.value, e.group)))
|
|
903
1034
|
}),
|
|
904
|
-
!
|
|
1035
|
+
!qt && !$e ? /* @__PURE__ */ E("p", {
|
|
905
1036
|
"data-slot": "select-empty",
|
|
906
1037
|
className: "zui:px-2 zui:py-2 zui:text-xs zui:text-[var(--zui-color-text)]",
|
|
907
|
-
children:
|
|
1038
|
+
children: u.select.noResults
|
|
908
1039
|
}) : null,
|
|
909
|
-
|
|
910
|
-
|
|
1040
|
+
$e ? /* @__PURE__ */ E(Pe, {}) : null,
|
|
1041
|
+
tt ? /* @__PURE__ */ E("p", {
|
|
911
1042
|
"data-slot": "select-error",
|
|
912
1043
|
className: "zui:px-2 zui:py-2 zui:text-xs zui:text-[var(--zui-theme-status-danger)]",
|
|
913
|
-
children:
|
|
1044
|
+
children: tt
|
|
914
1045
|
}) : null,
|
|
915
|
-
|
|
916
|
-
ref:
|
|
1046
|
+
K ? /* @__PURE__ */ E("div", {
|
|
1047
|
+
ref: He,
|
|
917
1048
|
"data-slot": "select-infinite-scroll-sentinel",
|
|
918
1049
|
"aria-hidden": "true",
|
|
919
1050
|
className: "zui:h-px zui:w-full"
|
|
920
1051
|
}) : null
|
|
921
1052
|
]
|
|
922
1053
|
})
|
|
923
|
-
}) }), /* @__PURE__ */
|
|
1054
|
+
}) }), /* @__PURE__ */ E(o, {
|
|
924
1055
|
trigger: null,
|
|
925
|
-
open:
|
|
926
|
-
onOpenChange: (e) =>
|
|
927
|
-
dir:
|
|
928
|
-
triggerLabel:
|
|
1056
|
+
open: l.isModal,
|
|
1057
|
+
onOpenChange: (e) => l.setOpen(e),
|
|
1058
|
+
dir: f,
|
|
1059
|
+
triggerLabel: l.modalLabel,
|
|
929
1060
|
showCloseButton: !1,
|
|
930
1061
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
931
1062
|
className: "zui:mobile:h-[75dvh] zui:mobile:touch-pan-y zui:mobile:overflow-x-hidden zui:mobile:overscroll-contain zui:mobile:px-3 zui:mobile:[&>[data-slot=dialog-body]]:flex zui:mobile:[&>[data-slot=dialog-body]]:min-h-0 zui:mobile:[&>[data-slot=dialog-body]]:flex-1 zui:mobile:[&>[data-slot=dialog-body]]:flex-col",
|
|
932
|
-
content:
|
|
1063
|
+
content: an
|
|
933
1064
|
})] });
|
|
934
1065
|
});
|
|
935
1066
|
//#endregion
|
|
936
|
-
export {
|
|
1067
|
+
export { ze as SelectContent, Fe as SelectGroup, z as SelectItem, B as SelectLabel, V as SelectSeparator, U as SelectTrigger, Le as SelectValue, H as default };
|