impact-nova 1.6.2 → 1.6.3
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/components/ui/accordion-nested-list/accordion-nested-list.js +7 -7
- package/dist/components/ui/accordion.d.ts +0 -1
- package/dist/components/ui/accordion.js +30 -33
- package/dist/components/ui/ag-grid-react/index.js +38 -35
- package/dist/components/ui/ag-grid-react/process-backend-columndefs.js +10 -10
- package/dist/components/ui/ag-grid-react/value-formatters.js +18 -18
- package/dist/components/ui/calendar.js +255 -247
- package/dist/components/ui/data-table/data-table.d.ts +0 -4
- package/dist/components/ui/data-table/data-table.js +94 -60
- package/dist/components/ui/date-picker/date-picker.js +90 -81
- package/dist/components/ui/date-picker/date-range-picker.js +144 -130
- package/dist/components/ui/date-picker/week-range-picker.js +157 -143
- package/dist/components/ui/filter-strip/filter-summary.js +161 -234
- package/dist/components/ui/filter-strip/filter-tag-list.js +97 -124
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +29 -29
- package/dist/components/ui/select/select.js +521 -493
- package/dist/components/ui/sheet.js +71 -94
- package/dist/impact-nova.css +1 -1
- package/package.json +1 -1
|
@@ -1,123 +1,124 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import * as
|
|
4
|
-
import { useVirtualizer as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { LoadingSpinner as
|
|
8
|
-
import { Checkbox as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { isInvertedSelection as
|
|
12
|
-
import { useFlattenOptions as
|
|
13
|
-
import { useSelectionModel as
|
|
14
|
-
import { useVisibleStats as
|
|
15
|
-
import { useImpactNovaI18n as
|
|
16
|
-
const
|
|
1
|
+
import { jsxs as g, jsx as a, Fragment as pt } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useRef as G, useEffect as M } from "react";
|
|
3
|
+
import * as le from "@radix-ui/react-popover";
|
|
4
|
+
import { useVirtualizer as mt } from "@tanstack/react-virtual";
|
|
5
|
+
import ht from "./components/LabelWithSequence.js";
|
|
6
|
+
import xt from "./components/Submenu.js";
|
|
7
|
+
import { LoadingSpinner as gt, Cross as bt, ChevronRight as $e, Search as vt, Info as xe } from "../../../icons/index.js";
|
|
8
|
+
import { Checkbox as Ge } from "../checkbox.js";
|
|
9
|
+
import { Button as St } from "../button.js";
|
|
10
|
+
import { cn as O } from "../../../lib/utils.js";
|
|
11
|
+
import { isInvertedSelection as T, isOptionArray as w, isSelected as yt, getSequence as wt, getLeafOptions as Vt } from "./utils/select.js";
|
|
12
|
+
import { useFlattenOptions as Nt } from "./hooks/useFlattenOptions.js";
|
|
13
|
+
import { useSelectionModel as kt } from "./hooks/useSelectionModel.js";
|
|
14
|
+
import { useVisibleStats as Dt } from "./hooks/useVisibleStats.js";
|
|
15
|
+
import { useImpactNovaI18n as Pt } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
16
|
+
const Ot = (ge) => {
|
|
17
17
|
const {
|
|
18
|
-
options:
|
|
19
|
-
value:
|
|
20
|
-
defaultValue:
|
|
21
|
-
onChange:
|
|
18
|
+
options: z,
|
|
19
|
+
value: ne,
|
|
20
|
+
defaultValue: Me,
|
|
21
|
+
onChange: u,
|
|
22
22
|
isMulti: f,
|
|
23
|
-
isDisabled:
|
|
24
|
-
isLoading:
|
|
25
|
-
isClearable:
|
|
26
|
-
isSearchable:
|
|
27
|
-
placeholder:
|
|
23
|
+
isDisabled: A,
|
|
24
|
+
isLoading: C,
|
|
25
|
+
isClearable: ze = !0,
|
|
26
|
+
isSearchable: q = !0,
|
|
27
|
+
placeholder: Le,
|
|
28
28
|
// menuPortalTarget is kept for API compatibility but no longer used (Radix handles portalling)
|
|
29
|
-
menuPortalTarget:
|
|
30
|
-
autoFocus:
|
|
31
|
-
closeMenuOnSelect:
|
|
32
|
-
defaultMenuIsOpen:
|
|
33
|
-
scrollToSelectedOnOpen:
|
|
34
|
-
maxSelectableOptions:
|
|
35
|
-
showSequence:
|
|
36
|
-
selectionOrder:
|
|
37
|
-
label:
|
|
38
|
-
isRequired:
|
|
39
|
-
error:
|
|
40
|
-
helperText:
|
|
29
|
+
menuPortalTarget: At,
|
|
30
|
+
autoFocus: Re,
|
|
31
|
+
closeMenuOnSelect: Fe = !f,
|
|
32
|
+
defaultMenuIsOpen: He = !1,
|
|
33
|
+
scrollToSelectedOnOpen: be = !1,
|
|
34
|
+
maxSelectableOptions: x,
|
|
35
|
+
showSequence: ve,
|
|
36
|
+
selectionOrder: je,
|
|
37
|
+
label: L,
|
|
38
|
+
isRequired: _e,
|
|
39
|
+
error: Se,
|
|
40
|
+
helperText: ye,
|
|
41
41
|
id: V,
|
|
42
|
-
className:
|
|
43
|
-
parentClassName:
|
|
44
|
-
onMenuScrollToBottom:
|
|
45
|
-
name:
|
|
46
|
-
isSelectAllEnabled:
|
|
47
|
-
isReadOnly:
|
|
48
|
-
searchPosition:
|
|
49
|
-
footerContent:
|
|
50
|
-
onInputChange:
|
|
51
|
-
getOptionLabel:
|
|
52
|
-
renderOption:
|
|
53
|
-
onMenuOpen:
|
|
54
|
-
onMenuClose:
|
|
55
|
-
labelOrientation:
|
|
56
|
-
leftContent:
|
|
57
|
-
ignoreCase:
|
|
58
|
-
ignoreAccents:
|
|
59
|
-
matchFrom:
|
|
60
|
-
stringify:
|
|
61
|
-
trim:
|
|
62
|
-
filterOption:
|
|
63
|
-
enableSubMenus:
|
|
64
|
-
enableGroups:
|
|
65
|
-
fetchError:
|
|
66
|
-
onRefetch:
|
|
67
|
-
menuWidth:
|
|
68
|
-
onClearAll:
|
|
69
|
-
onFocus:
|
|
70
|
-
onBlur:
|
|
71
|
-
} =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Q !== void 0 && v(Q);
|
|
76
|
-
}, [Q]), F(() => {
|
|
42
|
+
className: qe,
|
|
43
|
+
parentClassName: Be,
|
|
44
|
+
onMenuScrollToBottom: se,
|
|
45
|
+
name: Ke,
|
|
46
|
+
isSelectAllEnabled: X = !0,
|
|
47
|
+
isReadOnly: h = !1,
|
|
48
|
+
searchPosition: B = "menu",
|
|
49
|
+
footerContent: we,
|
|
50
|
+
onInputChange: Ue,
|
|
51
|
+
getOptionLabel: Ve,
|
|
52
|
+
renderOption: Ne,
|
|
53
|
+
onMenuOpen: We,
|
|
54
|
+
onMenuClose: ke,
|
|
55
|
+
labelOrientation: De = "top",
|
|
56
|
+
leftContent: Pe,
|
|
57
|
+
ignoreCase: Xe,
|
|
58
|
+
ignoreAccents: Ye,
|
|
59
|
+
matchFrom: Je,
|
|
60
|
+
stringify: Qe,
|
|
61
|
+
trim: Ze,
|
|
62
|
+
filterOption: et,
|
|
63
|
+
enableSubMenus: S = !1,
|
|
64
|
+
enableGroups: N = !1,
|
|
65
|
+
fetchError: R,
|
|
66
|
+
onRefetch: Oe,
|
|
67
|
+
menuWidth: tt,
|
|
68
|
+
onClearAll: Ae,
|
|
69
|
+
onFocus: lt,
|
|
70
|
+
onBlur: nt
|
|
71
|
+
} = ge, { t: K } = Pt(), ie = Le ?? K("select.placeholder"), [b, Ce] = _(He), [E, Y] = _(""), [Ie, re] = _(void 0), [d, v] = _(Me || (f ? [] : null)), [st, ae] = _(null), U = -2, [k, I] = _(-1), oe = G(!1), ce = G(null), ue = G(null), it = G(null), W = G(null), de = G(null);
|
|
72
|
+
M(() => {
|
|
73
|
+
ne !== void 0 && v(ne);
|
|
74
|
+
}, [ne]), M(() => {
|
|
77
75
|
let e;
|
|
78
|
-
return
|
|
79
|
-
|
|
76
|
+
return b && q && B === "menu" && de.current && (e = setTimeout(() => {
|
|
77
|
+
de.current?.focus();
|
|
80
78
|
}, 50)), () => {
|
|
81
79
|
e && clearTimeout(e);
|
|
82
80
|
};
|
|
83
|
-
}, [
|
|
84
|
-
const { flatOptions:
|
|
85
|
-
ignoreCase:
|
|
86
|
-
ignoreAccents:
|
|
87
|
-
matchFrom:
|
|
88
|
-
stringify:
|
|
89
|
-
trim:
|
|
90
|
-
filterOption:
|
|
91
|
-
enableSubMenus:
|
|
92
|
-
enableGroups:
|
|
93
|
-
}),
|
|
94
|
-
|
|
81
|
+
}, [b, q, B]);
|
|
82
|
+
const { flatOptions: p, isProcessing: P, totalOptionsCount: Te, workerSelectAll: rt } = Nt(z, E, {
|
|
83
|
+
ignoreCase: Xe,
|
|
84
|
+
ignoreAccents: Ye,
|
|
85
|
+
matchFrom: Je,
|
|
86
|
+
stringify: Qe,
|
|
87
|
+
trim: Ze,
|
|
88
|
+
filterOption: et,
|
|
89
|
+
enableSubMenus: S,
|
|
90
|
+
enableGroups: N
|
|
91
|
+
}), y = kt(d, f ?? !1), { stats: F, getGroupStats: fe } = Dt(
|
|
92
|
+
p,
|
|
93
|
+
Te,
|
|
94
|
+
E,
|
|
95
|
+
y,
|
|
96
|
+
d,
|
|
95
97
|
f ?? !1
|
|
96
|
-
),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
S,
|
|
101
|
-
u,
|
|
102
|
-
f ?? !1
|
|
103
|
-
), D = rt({
|
|
104
|
-
count: x.length,
|
|
105
|
-
getScrollElement: () => q.current,
|
|
106
|
-
/** Figma Dropdown V3: 35px option row + 2px gap (`11541:41944`). */
|
|
107
|
-
estimateSize: () => 37,
|
|
98
|
+
), D = mt({
|
|
99
|
+
count: p.length,
|
|
100
|
+
getScrollElement: () => W.current,
|
|
101
|
+
estimateSize: () => 34,
|
|
108
102
|
overscan: 5
|
|
109
103
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (
|
|
104
|
+
M(() => {
|
|
105
|
+
if (!b)
|
|
106
|
+
re(void 0), I(-1);
|
|
107
|
+
else if (oe.current) {
|
|
108
|
+
const e = !C && !P && !R && f && X && !h && p.length > 0;
|
|
109
|
+
I(e ? U : 0), oe.current = !1;
|
|
110
|
+
}
|
|
111
|
+
}, [b]), M(() => {
|
|
112
|
+
k !== -1 && I(0);
|
|
113
|
+
}, [E]), M(() => {
|
|
114
|
+
if (!b) return;
|
|
114
115
|
const e = requestAnimationFrame(() => {
|
|
115
116
|
D.measure();
|
|
116
117
|
});
|
|
117
118
|
return () => cancelAnimationFrame(e);
|
|
118
|
-
}, [
|
|
119
|
-
if (
|
|
120
|
-
const e =
|
|
119
|
+
}, [b, D]), M(() => {
|
|
120
|
+
if (b && be && !P && p.length > 0) {
|
|
121
|
+
const e = p.findIndex((t) => f ? y.mode === "exclude" ? !y.set.has(t.value) : y.set.has(t.value) : d?.value === t.value);
|
|
121
122
|
if (e !== -1) {
|
|
122
123
|
const t = setTimeout(() => {
|
|
123
124
|
D.scrollToIndex(e, { align: "center" });
|
|
@@ -125,407 +126,456 @@ const wt = (re) => {
|
|
|
125
126
|
return () => clearTimeout(t);
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
|
-
}, [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
x.length,
|
|
133
|
-
f,
|
|
134
|
-
S.mode,
|
|
135
|
-
S.set,
|
|
136
|
-
u,
|
|
137
|
-
D
|
|
138
|
-
]);
|
|
139
|
-
const E = L(null);
|
|
140
|
-
F(() => {
|
|
141
|
-
if (!q.current || !X) return;
|
|
129
|
+
}, [b, be, P, p.length, f, y.mode, y.set, d, D]);
|
|
130
|
+
const H = G(null);
|
|
131
|
+
M(() => {
|
|
132
|
+
if (!W.current || !se) return;
|
|
142
133
|
const e = () => {
|
|
143
|
-
if (
|
|
144
|
-
const { scrollTop: l, scrollHeight:
|
|
145
|
-
if (
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
134
|
+
if (C || P) return;
|
|
135
|
+
const { scrollTop: l, scrollHeight: s, clientHeight: n } = W.current;
|
|
136
|
+
if (s - l - n <= 10) {
|
|
137
|
+
if (H.current) return;
|
|
138
|
+
se(), H.current = setTimeout(() => {
|
|
139
|
+
H.current = null;
|
|
149
140
|
}, 500);
|
|
150
141
|
}
|
|
151
|
-
}, t =
|
|
152
|
-
return t.addEventListener("scroll", e), !
|
|
153
|
-
t.removeEventListener("scroll", e),
|
|
142
|
+
}, t = W.current;
|
|
143
|
+
return t.addEventListener("scroll", e), !C && !P && e(), () => {
|
|
144
|
+
t.removeEventListener("scroll", e), H.current && (clearTimeout(H.current), H.current = null);
|
|
154
145
|
};
|
|
155
146
|
}, [
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
se,
|
|
148
|
+
p.length,
|
|
149
|
+
b,
|
|
150
|
+
C,
|
|
151
|
+
P
|
|
161
152
|
]);
|
|
162
|
-
const
|
|
163
|
-
if (!
|
|
164
|
-
if (
|
|
165
|
-
|
|
153
|
+
const J = (e) => {
|
|
154
|
+
if (!A)
|
|
155
|
+
if (Ce(e), e)
|
|
156
|
+
We?.();
|
|
166
157
|
else {
|
|
167
|
-
const t =
|
|
168
|
-
|
|
158
|
+
const t = d, l = f && w(d) ? d.map((s) => s.value) : void 0;
|
|
159
|
+
ke?.(t, l), Y(""), ae(null);
|
|
169
160
|
}
|
|
170
|
-
},
|
|
171
|
-
if (!(
|
|
161
|
+
}, Q = (e) => {
|
|
162
|
+
if (!(A || h || e.isDisabled || ("children" in e || "options" in e) && e.isParentSelectable === !1))
|
|
172
163
|
if (f) {
|
|
173
|
-
const l =
|
|
164
|
+
const l = d || [];
|
|
174
165
|
if ("children" in e || "options" in e) {
|
|
175
|
-
const
|
|
166
|
+
const n = Vt(
|
|
176
167
|
e,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
).filter((
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
(m) => !
|
|
168
|
+
S,
|
|
169
|
+
N
|
|
170
|
+
).filter((i) => !i.isDisabled);
|
|
171
|
+
if (T(l)) {
|
|
172
|
+
const i = l.excludedValues, r = n.every(
|
|
173
|
+
(m) => !i.includes(m.value)
|
|
183
174
|
);
|
|
184
|
-
let c = [...
|
|
185
|
-
|
|
175
|
+
let c = [...i];
|
|
176
|
+
r ? n.forEach((m) => {
|
|
186
177
|
c.includes(m.value) || c.push(m.value);
|
|
187
178
|
}) : c = c.filter(
|
|
188
|
-
(m) => !
|
|
179
|
+
(m) => !n.some((ee) => ee.value === m)
|
|
189
180
|
);
|
|
190
181
|
const o = {
|
|
191
182
|
isAllSelected: !0,
|
|
192
183
|
excludedValues: c
|
|
193
184
|
};
|
|
194
|
-
v(o),
|
|
185
|
+
v(o), u && u(o, {
|
|
195
186
|
action: "select-option",
|
|
196
187
|
option: e
|
|
197
188
|
});
|
|
198
189
|
} else if (w(l)) {
|
|
199
|
-
const
|
|
200
|
-
(o) =>
|
|
190
|
+
const i = l, r = n.every(
|
|
191
|
+
(o) => i.some((m) => m.value === o.value)
|
|
201
192
|
);
|
|
202
|
-
let c = [...
|
|
203
|
-
if (
|
|
204
|
-
(o) => !
|
|
205
|
-
) :
|
|
193
|
+
let c = [...i];
|
|
194
|
+
if (r ? c = c.filter(
|
|
195
|
+
(o) => !n.some((m) => m.value === o.value)
|
|
196
|
+
) : n.forEach((o) => {
|
|
206
197
|
c.some((m) => m.value === o.value) || c.push(o);
|
|
207
|
-
}),
|
|
198
|
+
}), x && c.length > x)
|
|
208
199
|
return;
|
|
209
|
-
v(c),
|
|
200
|
+
v(c), u && u(c, {
|
|
210
201
|
action: "select-option",
|
|
211
202
|
option: e
|
|
212
203
|
});
|
|
213
204
|
}
|
|
214
|
-
} else if (
|
|
215
|
-
const
|
|
216
|
-
let
|
|
217
|
-
|
|
218
|
-
const
|
|
205
|
+
} else if (T(l)) {
|
|
206
|
+
const s = l.excludedValues, n = s.includes(e.value);
|
|
207
|
+
let i = [...s];
|
|
208
|
+
n ? i = i.filter((c) => c !== e.value) : i.push(e.value);
|
|
209
|
+
const r = {
|
|
219
210
|
isAllSelected: !0,
|
|
220
|
-
excludedValues:
|
|
211
|
+
excludedValues: i
|
|
221
212
|
};
|
|
222
|
-
v(
|
|
223
|
-
action:
|
|
213
|
+
v(r), u && u(r, {
|
|
214
|
+
action: n ? "select-option" : "deselect-option",
|
|
224
215
|
option: e
|
|
225
216
|
});
|
|
226
217
|
} else if (w(l)) {
|
|
227
|
-
const
|
|
228
|
-
let
|
|
229
|
-
if (
|
|
230
|
-
|
|
218
|
+
const s = l, n = f ? y.mode === "exclude" ? !y.set.has(e.value) : y.set.has(e.value) : d?.value === e.value;
|
|
219
|
+
let i = [];
|
|
220
|
+
if (n)
|
|
221
|
+
i = s.filter((r) => r.value !== e.value);
|
|
231
222
|
else {
|
|
232
|
-
if (
|
|
223
|
+
if (x && l.length >= x)
|
|
233
224
|
return;
|
|
234
|
-
|
|
225
|
+
i = [...s, e];
|
|
235
226
|
}
|
|
236
|
-
v(
|
|
237
|
-
action:
|
|
227
|
+
v(i), u && u(i, {
|
|
228
|
+
action: n ? "deselect-option" : "select-option",
|
|
238
229
|
option: e
|
|
239
230
|
});
|
|
240
231
|
}
|
|
241
232
|
} else
|
|
242
|
-
v(e),
|
|
233
|
+
v(e), u && u(e, {
|
|
243
234
|
action: "select-option",
|
|
244
235
|
option: e
|
|
245
|
-
}),
|
|
246
|
-
},
|
|
247
|
-
if (!(!f ||
|
|
248
|
-
if (
|
|
236
|
+
}), Fe && (Ce(!1), ke?.(e, void 0), Y(""));
|
|
237
|
+
}, pe = async () => {
|
|
238
|
+
if (!(!f || A || h)) {
|
|
239
|
+
if (z.length > 3e3) {
|
|
249
240
|
try {
|
|
250
|
-
const e = await
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
const e = await rt(
|
|
242
|
+
d,
|
|
243
|
+
T(d),
|
|
244
|
+
x
|
|
254
245
|
);
|
|
255
|
-
v(e),
|
|
246
|
+
v(e), u && u(e, { action: "select-option" });
|
|
256
247
|
} catch {
|
|
257
248
|
}
|
|
258
249
|
return;
|
|
259
250
|
}
|
|
260
|
-
if (
|
|
251
|
+
if (E) {
|
|
261
252
|
let e = !1;
|
|
262
|
-
for (const l of
|
|
253
|
+
for (const l of p)
|
|
263
254
|
if (!l.isGroup && !l.isSubmenuParent && !l.isDisabled) {
|
|
264
255
|
e = !0;
|
|
265
256
|
break;
|
|
266
257
|
}
|
|
267
258
|
if (!e)
|
|
268
259
|
return;
|
|
269
|
-
const t =
|
|
270
|
-
if (
|
|
271
|
-
const l = t.excludedValues, { totalVisible:
|
|
272
|
-
let
|
|
273
|
-
if (
|
|
274
|
-
for (const o of
|
|
275
|
-
!o.isGroup && !o.isSubmenuParent && !o.isDisabled && (
|
|
260
|
+
const t = d || [];
|
|
261
|
+
if (T(t)) {
|
|
262
|
+
const l = t.excludedValues, { totalVisible: s, selectedVisible: n } = F, i = s > 0 && s === n;
|
|
263
|
+
let r = [...l];
|
|
264
|
+
if (i)
|
|
265
|
+
for (const o of p)
|
|
266
|
+
!o.isGroup && !o.isSubmenuParent && !o.isDisabled && (r.includes(o.value) || r.push(o.value));
|
|
276
267
|
else {
|
|
277
268
|
const o = /* @__PURE__ */ new Set();
|
|
278
|
-
for (const m of
|
|
269
|
+
for (const m of p)
|
|
279
270
|
!m.isGroup && !m.isSubmenuParent && !m.isDisabled && o.add(m.value);
|
|
280
|
-
|
|
271
|
+
r = r.filter((m) => !o.has(m));
|
|
281
272
|
}
|
|
282
273
|
const c = {
|
|
283
274
|
isAllSelected: !0,
|
|
284
|
-
excludedValues:
|
|
275
|
+
excludedValues: r
|
|
285
276
|
};
|
|
286
|
-
v(c),
|
|
277
|
+
v(c), u && u(c, { action: "select-option" });
|
|
287
278
|
} else if (w(t)) {
|
|
288
|
-
const l = t, { totalVisible:
|
|
289
|
-
let
|
|
290
|
-
if (
|
|
279
|
+
const l = t, { totalVisible: s, selectedVisible: n } = F, i = s > 0 && s === n;
|
|
280
|
+
let r = [...l];
|
|
281
|
+
if (i) {
|
|
291
282
|
const c = /* @__PURE__ */ new Set();
|
|
292
|
-
for (const o of
|
|
283
|
+
for (const o of p)
|
|
293
284
|
!o.isGroup && !o.isSubmenuParent && !o.isDisabled && c.add(o.value);
|
|
294
|
-
|
|
285
|
+
r = r.filter((o) => !c.has(o.value));
|
|
295
286
|
} else {
|
|
296
|
-
const c = new Set(
|
|
297
|
-
for (const o of
|
|
298
|
-
!o.isGroup && !o.isSubmenuParent && !o.isDisabled && (c.has(o.value) || (
|
|
287
|
+
const c = new Set(r.map((o) => o.value));
|
|
288
|
+
for (const o of p)
|
|
289
|
+
!o.isGroup && !o.isSubmenuParent && !o.isDisabled && (c.has(o.value) || (r.push(o), c.add(o.value)));
|
|
299
290
|
}
|
|
300
|
-
if (
|
|
291
|
+
if (x && r.length > x)
|
|
301
292
|
return;
|
|
302
|
-
v(
|
|
293
|
+
v(r), u && u(r, { action: "select-option" });
|
|
303
294
|
}
|
|
304
|
-
} else if (
|
|
305
|
-
const e =
|
|
306
|
-
if (w(e) && l >=
|
|
307
|
-
const
|
|
308
|
-
v(
|
|
295
|
+
} else if (x) {
|
|
296
|
+
const e = d, { totalVisible: t } = F, l = w(e) ? e.length : 0, s = Math.min(t, x);
|
|
297
|
+
if (w(e) && l >= s && l > 0) {
|
|
298
|
+
const n = e.filter((i) => i.isDisabled);
|
|
299
|
+
v(n), u && u(n, {
|
|
309
300
|
action: "select-option"
|
|
310
301
|
});
|
|
311
302
|
} else if (w(e)) {
|
|
312
|
-
const
|
|
313
|
-
(
|
|
303
|
+
const n = e.filter(
|
|
304
|
+
(r) => r.isDisabled
|
|
314
305
|
);
|
|
315
|
-
let
|
|
316
|
-
for (const
|
|
317
|
-
if (!
|
|
306
|
+
let i = n.length;
|
|
307
|
+
for (const r of p)
|
|
308
|
+
if (!r.isGroup && !r.isSubmenuParent && !r.isDisabled && (n.push(r), i++, i >= x))
|
|
318
309
|
break;
|
|
319
|
-
v(
|
|
310
|
+
v(n), u && u(n, {
|
|
320
311
|
action: "select-option"
|
|
321
312
|
});
|
|
322
313
|
}
|
|
323
314
|
} else {
|
|
324
|
-
const e =
|
|
325
|
-
if (
|
|
315
|
+
const e = d, t = T(e) && e.excludedValues.length === 0;
|
|
316
|
+
if (ge.enableInvertedSelection)
|
|
326
317
|
if (t) {
|
|
327
|
-
const l = w(e) ? e.filter((
|
|
328
|
-
v(l),
|
|
318
|
+
const l = w(e) ? e.filter((s) => s.isDisabled) : [];
|
|
319
|
+
v(l), u && u(l, {
|
|
329
320
|
action: "select-option"
|
|
330
321
|
});
|
|
331
322
|
} else {
|
|
332
|
-
const
|
|
323
|
+
const s = {
|
|
333
324
|
isAllSelected: !0,
|
|
334
|
-
excludedValues:
|
|
335
|
-
(
|
|
336
|
-
).map((
|
|
325
|
+
excludedValues: p.filter(
|
|
326
|
+
(n) => n.isDisabled && (w(e) ? !e.some((i) => i.value === n.value) : !0)
|
|
327
|
+
).map((n) => n.value)
|
|
337
328
|
};
|
|
338
|
-
v(
|
|
329
|
+
v(s), u && u(s, { action: "select-option" });
|
|
339
330
|
}
|
|
340
331
|
else {
|
|
341
|
-
const { totalVisible: l, selectedVisible:
|
|
342
|
-
if (l > 0 && l ===
|
|
343
|
-
const
|
|
344
|
-
v(
|
|
332
|
+
const { totalVisible: l, selectedVisible: s } = F;
|
|
333
|
+
if (l > 0 && l === s) {
|
|
334
|
+
const n = w(e) ? e.filter((i) => i.isDisabled) : [];
|
|
335
|
+
v(n), u && u(n, {
|
|
345
336
|
action: "select-option"
|
|
346
337
|
});
|
|
347
338
|
} else {
|
|
348
|
-
const
|
|
349
|
-
for (const
|
|
350
|
-
!
|
|
351
|
-
v(
|
|
339
|
+
const n = w(e) ? e.filter((i) => i.isDisabled) : [];
|
|
340
|
+
for (const i of p)
|
|
341
|
+
!i.isGroup && !i.isSubmenuParent && !i.isDisabled && n.push(i);
|
|
342
|
+
v(n), u && u(n, {
|
|
352
343
|
action: "select-option"
|
|
353
344
|
});
|
|
354
345
|
}
|
|
355
346
|
}
|
|
356
347
|
}
|
|
357
348
|
}
|
|
358
|
-
},
|
|
359
|
-
if (e.stopPropagation(), !
|
|
349
|
+
}, at = (e) => {
|
|
350
|
+
if (e.stopPropagation(), !h)
|
|
360
351
|
if (f) {
|
|
361
|
-
const t = [], l = (
|
|
362
|
-
for (const
|
|
363
|
-
if (
|
|
352
|
+
const t = [], l = (n) => {
|
|
353
|
+
for (const i of n) {
|
|
354
|
+
if (N && "options" in i) {
|
|
364
355
|
l(
|
|
365
|
-
|
|
356
|
+
i.options
|
|
366
357
|
);
|
|
367
358
|
continue;
|
|
368
359
|
}
|
|
369
|
-
if (
|
|
370
|
-
l(
|
|
360
|
+
if (S && "children" in i && Array.isArray(i.children)) {
|
|
361
|
+
l(i.children);
|
|
371
362
|
continue;
|
|
372
363
|
}
|
|
373
|
-
const
|
|
374
|
-
|
|
364
|
+
const r = i;
|
|
365
|
+
r.isDisabled && (y.mode === "exclude" ? !y.set.has(r.value) : y.set.has(r.value)) && t.push(r);
|
|
375
366
|
}
|
|
376
367
|
};
|
|
377
|
-
l(
|
|
378
|
-
const
|
|
379
|
-
v(
|
|
368
|
+
l(z);
|
|
369
|
+
const s = t;
|
|
370
|
+
v(s), u && u(s, { action: "clear" }), Ae?.();
|
|
380
371
|
} else {
|
|
381
|
-
const t =
|
|
372
|
+
const t = d;
|
|
382
373
|
if (t) {
|
|
383
|
-
let
|
|
384
|
-
const
|
|
385
|
-
for (const
|
|
386
|
-
if (
|
|
387
|
-
if (
|
|
388
|
-
if (
|
|
389
|
-
|
|
390
|
-
),
|
|
374
|
+
let s;
|
|
375
|
+
const n = (i) => {
|
|
376
|
+
for (const r of i) {
|
|
377
|
+
if (s) return;
|
|
378
|
+
if (N && "options" in r) {
|
|
379
|
+
if (n(
|
|
380
|
+
r.options
|
|
381
|
+
), s) return;
|
|
391
382
|
continue;
|
|
392
383
|
}
|
|
393
|
-
if (
|
|
394
|
-
if (
|
|
395
|
-
|
|
396
|
-
),
|
|
384
|
+
if (S && "children" in r && Array.isArray(r.children)) {
|
|
385
|
+
if (n(
|
|
386
|
+
r.children
|
|
387
|
+
), s) return;
|
|
397
388
|
continue;
|
|
398
389
|
}
|
|
399
|
-
const c =
|
|
390
|
+
const c = r;
|
|
400
391
|
if (c.value === t.value) {
|
|
401
|
-
|
|
392
|
+
s = c;
|
|
402
393
|
return;
|
|
403
394
|
}
|
|
404
395
|
}
|
|
405
396
|
};
|
|
406
|
-
if (
|
|
397
|
+
if (n(z), s?.isDisabled)
|
|
407
398
|
return;
|
|
408
399
|
}
|
|
409
400
|
const l = null;
|
|
410
|
-
v(l),
|
|
401
|
+
v(l), u && u(l, { action: "clear" }), Ae?.();
|
|
411
402
|
}
|
|
412
|
-
},
|
|
403
|
+
}, ot = (e) => wt(
|
|
413
404
|
e,
|
|
414
|
-
|
|
405
|
+
ve ?? !1,
|
|
415
406
|
f ?? !1,
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
),
|
|
407
|
+
je,
|
|
408
|
+
d
|
|
409
|
+
), Z = (e) => Ve ? Ve(e) : e.label, Ee = () => {
|
|
410
|
+
const e = [];
|
|
411
|
+
return !C && !P && !R && f && X && !h && p.length > 0 && e.push(U), p.forEach((l, s) => {
|
|
412
|
+
!l.isGroup && !(S && l.isSubmenuParent) && !l.isDisabled && e.push(s);
|
|
413
|
+
}), e;
|
|
414
|
+
}, ct = (e) => {
|
|
415
|
+
if (A || h) return;
|
|
416
|
+
if (!b) {
|
|
417
|
+
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), oe.current = !0, J(!0));
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const t = Ee();
|
|
421
|
+
if (t.length === 0) return;
|
|
422
|
+
const l = t.indexOf(k);
|
|
423
|
+
if (e.key === "ArrowDown") {
|
|
424
|
+
e.preventDefault();
|
|
425
|
+
const s = l < t.length - 1 ? l + 1 : 0, n = t[s];
|
|
426
|
+
I(n), n >= 0 && D.scrollToIndex(n, { align: "auto" });
|
|
427
|
+
} else if (e.key === "ArrowUp") {
|
|
428
|
+
e.preventDefault();
|
|
429
|
+
const s = l > 0 ? l - 1 : t.length - 1, n = t[s];
|
|
430
|
+
I(n), n >= 0 && D.scrollToIndex(n, { align: "auto" });
|
|
431
|
+
} else if (e.key === "Enter" || e.key === " ") {
|
|
432
|
+
if (e.preventDefault(), k === U)
|
|
433
|
+
pe();
|
|
434
|
+
else if (k >= 0 && k < p.length) {
|
|
435
|
+
const s = p[k];
|
|
436
|
+
s.isDisabled || Q(s);
|
|
437
|
+
}
|
|
438
|
+
} else if (e.key === "Escape")
|
|
439
|
+
e.preventDefault(), J(!1), ce.current?.focus();
|
|
440
|
+
else if (e.key === "Home")
|
|
441
|
+
e.preventDefault(), t.length > 0 && (I(t[0]), t[0] >= 0 && D.scrollToIndex(t[0], { align: "auto" }));
|
|
442
|
+
else if (e.key === "End" && (e.preventDefault(), t.length > 0)) {
|
|
443
|
+
const s = t[t.length - 1];
|
|
444
|
+
I(s), s >= 0 && D.scrollToIndex(s, { align: "auto" });
|
|
445
|
+
}
|
|
446
|
+
}, ut = (e) => {
|
|
447
|
+
const t = Ee();
|
|
448
|
+
if (t.length === 0) return;
|
|
449
|
+
const l = t.indexOf(k);
|
|
450
|
+
if (e.key === "ArrowDown") {
|
|
451
|
+
e.preventDefault();
|
|
452
|
+
const s = l < t.length - 1 ? l + 1 : 0, n = t[s];
|
|
453
|
+
I(n), n >= 0 && D.scrollToIndex(n, { align: "auto" });
|
|
454
|
+
} else if (e.key === "ArrowUp") {
|
|
455
|
+
e.preventDefault();
|
|
456
|
+
const s = l > 0 ? l - 1 : t.length - 1, n = t[s];
|
|
457
|
+
I(n), n >= 0 && D.scrollToIndex(n, { align: "auto" });
|
|
458
|
+
} else if (e.key === "Enter") {
|
|
459
|
+
if (e.preventDefault(), k === U)
|
|
460
|
+
pe();
|
|
461
|
+
else if (k >= 0 && k < p.length) {
|
|
462
|
+
const s = p[k];
|
|
463
|
+
s.isDisabled || Q(s);
|
|
464
|
+
}
|
|
465
|
+
} else e.key === "Escape" && (e.preventDefault(), J(!1), ce.current?.focus());
|
|
466
|
+
}, dt = () => {
|
|
419
467
|
if (f) {
|
|
420
|
-
const e =
|
|
468
|
+
const e = d || [];
|
|
421
469
|
let t = 0;
|
|
422
|
-
return
|
|
470
|
+
return T(e) ? t = Te - e.excludedValues.length : w(e) && (t = e.length), t === 0 ? null : t === 1 && w(e) ? /* @__PURE__ */ a("span", { className: "text-[#1f2b4d] text-[14px] font-medium truncate min-w-0 block", children: Z(e[0]) }) : /* @__PURE__ */ a("span", { className: "text-[#1f2b4d] text-[14px] font-medium truncate min-w-0 block", children: K("select.selectedCount", { count: t }) });
|
|
423
471
|
} else {
|
|
424
|
-
const e =
|
|
425
|
-
return e ? /* @__PURE__ */ a("span", { className: "
|
|
472
|
+
const e = d;
|
|
473
|
+
return e ? /* @__PURE__ */ a("span", { className: "text-[#1f2b4d] text-[14px] font-medium truncate min-w-0 block", children: Z(e) }) : null;
|
|
426
474
|
}
|
|
427
475
|
};
|
|
428
|
-
return /* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ g(
|
|
429
477
|
"div",
|
|
430
478
|
{
|
|
431
|
-
className:
|
|
479
|
+
className: O(
|
|
432
480
|
"flex gap-[6px]",
|
|
433
|
-
|
|
434
|
-
|
|
481
|
+
De === "left" ? "w-fit flex-row items-center" : "w-full flex-col",
|
|
482
|
+
Be
|
|
435
483
|
),
|
|
436
|
-
onFocus: Ye,
|
|
437
|
-
onBlur: Je,
|
|
438
|
-
tabIndex: O ? -1 : 0,
|
|
439
484
|
"data-testid": `select-${V || "default"}`,
|
|
440
485
|
"data-component": "select",
|
|
441
486
|
children: [
|
|
442
|
-
|
|
487
|
+
L && /* @__PURE__ */ g(
|
|
443
488
|
"label",
|
|
444
489
|
{
|
|
445
|
-
className:
|
|
446
|
-
"text-
|
|
447
|
-
|
|
490
|
+
className: O(
|
|
491
|
+
"text-[12px] font-medium text-[#60697d] leading-[18px]",
|
|
492
|
+
De === "left" ? "shrink-0" : ""
|
|
448
493
|
),
|
|
449
494
|
children: [
|
|
450
|
-
|
|
495
|
+
L,
|
|
451
496
|
" ",
|
|
452
|
-
|
|
497
|
+
_e && /* @__PURE__ */ a("span", { className: "text-[red]", children: "*" })
|
|
453
498
|
]
|
|
454
499
|
}
|
|
455
500
|
),
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
/* @__PURE__ */ a(
|
|
501
|
+
/* @__PURE__ */ g(le.Root, { open: b, onOpenChange: J, children: [
|
|
502
|
+
/* @__PURE__ */ a(le.Trigger, { asChild: !0, children: /* @__PURE__ */ a(
|
|
458
503
|
"div",
|
|
459
504
|
{
|
|
460
|
-
ref:
|
|
461
|
-
className:
|
|
462
|
-
"relative
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
Ee
|
|
505
|
+
ref: ce,
|
|
506
|
+
className: O(
|
|
507
|
+
"relative h-[32px] w-full cursor-pointer rounded-[8px] border border-solid px-3 py-1 text-left shadow-sm sm:text-sm transition-all flex items-center overflow-hidden",
|
|
508
|
+
Se ? "border-[#e15554] focus:ring-[#e15554]" : "border-[#c3c8d4] hover:border-gray-400 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500",
|
|
509
|
+
A ? "bg-[#f2f4fb] cursor-not-allowed opacity-75" : "",
|
|
510
|
+
h ? "cursor-default bg-[#f2f4fb]" : "",
|
|
511
|
+
b ? "ring-1 ring-indigo-500 border-indigo-500" : "",
|
|
512
|
+
!A && !h && "bg-white",
|
|
513
|
+
qe
|
|
470
514
|
),
|
|
471
515
|
id: V,
|
|
516
|
+
tabIndex: A ? -1 : 0,
|
|
517
|
+
onFocus: lt,
|
|
518
|
+
onBlur: nt,
|
|
519
|
+
role: "combobox",
|
|
520
|
+
"aria-expanded": b,
|
|
521
|
+
"aria-haspopup": "listbox",
|
|
522
|
+
"aria-label": L ? String(L) : ie,
|
|
472
523
|
"data-component": "select-trigger",
|
|
473
|
-
"data-disabled":
|
|
474
|
-
"data-state":
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
/* @__PURE__ */
|
|
524
|
+
"data-disabled": A || void 0,
|
|
525
|
+
"data-state": b ? "open" : "closed",
|
|
526
|
+
onKeyDown: ct,
|
|
527
|
+
children: /* @__PURE__ */ g("div", { className: "flex items-center justify-between w-full min-w-0 max-w-full", children: [
|
|
528
|
+
Pe && /* @__PURE__ */ a("div", { className: "flex items-center text-gray-500 shrink-0", children: Pe }),
|
|
529
|
+
/* @__PURE__ */ g(
|
|
478
530
|
"div",
|
|
479
531
|
{
|
|
480
532
|
className: "flex-1 flex items-center overflow-hidden min-w-0 max-w-full",
|
|
481
533
|
"data-testid": `select-value-${V || "default"}`,
|
|
482
534
|
children: [
|
|
483
|
-
|
|
535
|
+
dt() || /* @__PURE__ */ a(
|
|
484
536
|
"span",
|
|
485
537
|
{
|
|
486
|
-
className: "
|
|
538
|
+
className: "text-[#b4bac7] font-normal text-[14px] truncate min-w-0 block",
|
|
487
539
|
"data-testid": `select-placeholder-${V || "default"}`,
|
|
488
540
|
"data-has-value": !1,
|
|
489
|
-
children:
|
|
541
|
+
children: ie
|
|
490
542
|
}
|
|
491
543
|
),
|
|
492
|
-
|
|
544
|
+
q && b && B === "trigger" && !h && /* @__PURE__ */ a(
|
|
493
545
|
"input",
|
|
494
546
|
{
|
|
495
|
-
ref:
|
|
547
|
+
ref: it,
|
|
496
548
|
type: "text",
|
|
497
549
|
className: "flex-1 min-w-[50px] border-none p-0 focus:ring-0 text-sm outline-none h-full",
|
|
498
|
-
value:
|
|
499
|
-
onChange: (e) =>
|
|
550
|
+
value: E,
|
|
551
|
+
onChange: (e) => Y(e.target.value),
|
|
500
552
|
onClick: (e) => e.stopPropagation(),
|
|
501
|
-
autoFocus:
|
|
502
|
-
name:
|
|
553
|
+
autoFocus: Re,
|
|
554
|
+
name: Ke || void 0
|
|
503
555
|
}
|
|
504
556
|
)
|
|
505
557
|
]
|
|
506
558
|
}
|
|
507
559
|
),
|
|
508
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
) &&
|
|
512
|
-
u
|
|
513
|
-
) && u.length > 0) || !f && u) && /* @__PURE__ */ a(
|
|
560
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-gray-400 shrink-0", children: !b && (C || P) ? /* @__PURE__ */ a(gt, { size: "14px" }) : /* @__PURE__ */ g(pt, { children: [
|
|
561
|
+
ze && !h && (f && (T(
|
|
562
|
+
d
|
|
563
|
+
) && d.isAllSelected || w(d) && d.length > 0) || !f && d) && /* @__PURE__ */ a(
|
|
514
564
|
"div",
|
|
515
565
|
{
|
|
516
566
|
role: "button",
|
|
517
|
-
onClick:
|
|
518
|
-
className: "hover:text-
|
|
519
|
-
children: /* @__PURE__ */ a(
|
|
567
|
+
onClick: at,
|
|
568
|
+
className: "hover:text-gray-600 p-0.5",
|
|
569
|
+
children: /* @__PURE__ */ a(bt, { size: "11px", color: "#758490" })
|
|
520
570
|
}
|
|
521
571
|
),
|
|
522
572
|
/* @__PURE__ */ a(
|
|
523
|
-
|
|
573
|
+
$e,
|
|
524
574
|
{
|
|
525
575
|
size: "16px",
|
|
526
|
-
className:
|
|
576
|
+
className: O(
|
|
527
577
|
"transition-transform duration-200",
|
|
528
|
-
|
|
578
|
+
b ? "-rotate-90" : "rotate-90"
|
|
529
579
|
)
|
|
530
580
|
}
|
|
531
581
|
)
|
|
@@ -533,63 +583,57 @@ const wt = (re) => {
|
|
|
533
583
|
] })
|
|
534
584
|
}
|
|
535
585
|
) }),
|
|
536
|
-
/* @__PURE__ */ a(
|
|
537
|
-
|
|
586
|
+
/* @__PURE__ */ a(le.Portal, { children: /* @__PURE__ */ g(
|
|
587
|
+
le.Content,
|
|
538
588
|
{
|
|
539
|
-
ref:
|
|
589
|
+
ref: ue,
|
|
540
590
|
side: "bottom",
|
|
541
|
-
sideOffset:
|
|
591
|
+
sideOffset: 4,
|
|
542
592
|
align: "start",
|
|
543
593
|
avoidCollisions: !0,
|
|
544
594
|
collisionPadding: 8,
|
|
545
595
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
546
596
|
onWheel: (e) => e.stopPropagation(),
|
|
547
597
|
style: {
|
|
548
|
-
width:
|
|
598
|
+
width: tt || "var(--radix-popover-trigger-width)",
|
|
549
599
|
maxHeight: "var(--radix-popover-content-available-height)",
|
|
550
|
-
minHeight:
|
|
600
|
+
minHeight: Ie ? `${Ie}px` : void 0
|
|
551
601
|
},
|
|
552
|
-
className:
|
|
553
|
-
"z-50
|
|
554
|
-
|
|
602
|
+
className: O(
|
|
603
|
+
"z-50 overflow-hidden rounded-[12px] text-base shadow-[0px_1px_6px_0px_rgba(26,39,124,0.14)] focus:outline-none sm:text-sm flex flex-col border-none pointer-events-auto",
|
|
604
|
+
h ? "bg-[#f5f5f5]" : "bg-white"
|
|
555
605
|
),
|
|
556
606
|
"data-testid": `select-menu-${V || "default"}`,
|
|
557
607
|
"data-component": "select-menu",
|
|
558
608
|
children: [
|
|
559
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ g(
|
|
560
610
|
"div",
|
|
561
611
|
{
|
|
562
|
-
className:
|
|
612
|
+
className: O(
|
|
563
613
|
"flex flex-col z-10 sticky top-0 px-[6px] pt-[8px]",
|
|
564
|
-
|
|
565
|
-
!
|
|
614
|
+
h ? "bg-[#f5f5f5]" : "bg-white",
|
|
615
|
+
!R && (q && B === "menu" && !h || f && X && !h && p.length > 0) ? "border-b border-solid border-gray-100" : ""
|
|
566
616
|
),
|
|
567
617
|
children: [
|
|
568
|
-
|
|
618
|
+
q && B === "menu" && !h && !R && /* @__PURE__ */ a(
|
|
569
619
|
"div",
|
|
570
620
|
{
|
|
571
621
|
className: "p-0",
|
|
572
622
|
"data-testid": `select-search-container-${V || "default"}`,
|
|
573
|
-
children: /* @__PURE__ */
|
|
574
|
-
/* @__PURE__ */ a(
|
|
575
|
-
ft,
|
|
576
|
-
{
|
|
577
|
-
size: 15,
|
|
578
|
-
className: "pointer-events-none shrink-0 text-content-placeholder",
|
|
579
|
-
"aria-hidden": !0
|
|
580
|
-
}
|
|
581
|
-
),
|
|
623
|
+
children: /* @__PURE__ */ g("div", { className: "relative", children: [
|
|
624
|
+
/* @__PURE__ */ a("div", { className: "absolute inset-y-0 left-[12px] flex items-center pointer-events-none", children: /* @__PURE__ */ a(vt, { size: "14px", color: "#AFAFAF" }) }),
|
|
582
625
|
/* @__PURE__ */ a(
|
|
583
626
|
"input",
|
|
584
627
|
{
|
|
585
|
-
ref:
|
|
628
|
+
ref: de,
|
|
586
629
|
type: "text",
|
|
587
|
-
className: "
|
|
588
|
-
placeholder:
|
|
589
|
-
value:
|
|
630
|
+
className: "block w-full pl-[34px] pr-4 h-[35px] border-none border-b border-primary text-sm outline-none focus:ring-0",
|
|
631
|
+
placeholder: K("select.searchHere"),
|
|
632
|
+
value: E,
|
|
633
|
+
onKeyDown: ut,
|
|
590
634
|
onChange: (e) => {
|
|
591
635
|
const t = e.target.value;
|
|
592
|
-
|
|
636
|
+
E === "" && t !== "" ? ue.current && re(ue.current.offsetHeight) : t === "" && re(void 0), Y(t), Ue?.(t);
|
|
593
637
|
},
|
|
594
638
|
onClick: (e) => e.stopPropagation(),
|
|
595
639
|
"data-testid": `select-search-input-${V || "default"}`
|
|
@@ -598,66 +642,52 @@ const wt = (re) => {
|
|
|
598
642
|
] })
|
|
599
643
|
}
|
|
600
644
|
),
|
|
601
|
-
!
|
|
645
|
+
!C && !P && !R && f && X && !h && p.length > 0 && /* @__PURE__ */ a(
|
|
602
646
|
"div",
|
|
603
647
|
{
|
|
604
648
|
className: "pb-1",
|
|
605
649
|
"data-testid": `select-select-all-container-${V || "default"}`,
|
|
606
|
-
children: /* @__PURE__ */
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
"
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
children:
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
{
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
),
|
|
648
|
-
/* @__PURE__ */ a(
|
|
649
|
-
"button",
|
|
650
|
-
{
|
|
651
|
-
type: "button",
|
|
652
|
-
className: "shrink-0 text-left text-xs font-normal leading-4 text-content-tertiary transition-colors hover:text-content-secondary",
|
|
653
|
-
"data-testid": `select-clear-selection-${V || "default"}`,
|
|
654
|
-
onClick: (e) => {
|
|
655
|
-
e.stopPropagation(), Ce(e);
|
|
656
|
-
},
|
|
657
|
-
children: M("select.clear")
|
|
658
|
-
}
|
|
659
|
-
)
|
|
660
|
-
] })
|
|
650
|
+
children: /* @__PURE__ */ a(
|
|
651
|
+
"div",
|
|
652
|
+
{
|
|
653
|
+
className: O(
|
|
654
|
+
"flex items-center justify-between cursor-pointer rounded-md hover:bg-gray-100 transition-colors py-[6px] px-3 w-full",
|
|
655
|
+
k === U && "ring-2 ring-inset ring-primary bg-[#edf0ff]"
|
|
656
|
+
),
|
|
657
|
+
onClick: pe,
|
|
658
|
+
role: "option",
|
|
659
|
+
"aria-selected": !1,
|
|
660
|
+
"data-testid": `select-select-all-button-${V || "default"}`,
|
|
661
|
+
children: /* @__PURE__ */ g("div", { className: "flex items-center flex-1", children: [
|
|
662
|
+
/* @__PURE__ */ a("div", { className: "pointer-events-none flex", children: /* @__PURE__ */ a(
|
|
663
|
+
Ge,
|
|
664
|
+
{
|
|
665
|
+
checked: (() => {
|
|
666
|
+
const { totalVisible: e, selectedVisible: t } = F;
|
|
667
|
+
if (e === 0) return !1;
|
|
668
|
+
const l = x ? Math.min(e, x) : e;
|
|
669
|
+
return t > 0 && t < l ? "indeterminate" : t >= l;
|
|
670
|
+
})(),
|
|
671
|
+
disabled: A || h,
|
|
672
|
+
onChange: () => {
|
|
673
|
+
},
|
|
674
|
+
"data-testid": `select-select-all-checkbox-${V || "default"}`
|
|
675
|
+
}
|
|
676
|
+
) }),
|
|
677
|
+
/* @__PURE__ */ a(
|
|
678
|
+
"span",
|
|
679
|
+
{
|
|
680
|
+
className: "text-sm font-medium text-gray-700",
|
|
681
|
+
"data-testid": `select-select-all-label-${V || "default"}`,
|
|
682
|
+
children: (() => {
|
|
683
|
+
const { totalVisible: e, selectedVisible: t } = F, l = x ? Math.min(e, x) : e, s = e > 0 && t >= l;
|
|
684
|
+
return K(s ? "select.unselectAll" : "select.selectAll");
|
|
685
|
+
})()
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
] })
|
|
689
|
+
}
|
|
690
|
+
)
|
|
661
691
|
}
|
|
662
692
|
)
|
|
663
693
|
]
|
|
@@ -666,31 +696,33 @@ const wt = (re) => {
|
|
|
666
696
|
/* @__PURE__ */ a(
|
|
667
697
|
"div",
|
|
668
698
|
{
|
|
669
|
-
ref:
|
|
670
|
-
|
|
699
|
+
ref: W,
|
|
700
|
+
role: "listbox",
|
|
701
|
+
"aria-label": L ? String(L) : ie,
|
|
702
|
+
className: "flex-1 overflow-auto py-1 px-[6px]",
|
|
671
703
|
style: {
|
|
672
704
|
maxHeight: "297px",
|
|
673
705
|
overscrollBehavior: "contain"
|
|
674
706
|
},
|
|
675
707
|
onWheel: (e) => e.stopPropagation(),
|
|
676
|
-
children:
|
|
677
|
-
/* @__PURE__ */ a("p", { className: "text-sm text-
|
|
678
|
-
|
|
679
|
-
|
|
708
|
+
children: R ? /* @__PURE__ */ g("div", { className: "flex flex-col items-center justify-center py-8 px-4 text-center", children: [
|
|
709
|
+
/* @__PURE__ */ a("p", { className: "text-sm text-gray-500 font-medium mb-3", children: "Something went wrong" }),
|
|
710
|
+
Oe && /* @__PURE__ */ a(
|
|
711
|
+
St,
|
|
680
712
|
{
|
|
681
713
|
size: "sm",
|
|
682
714
|
variant: "outline",
|
|
683
|
-
onClick: () =>
|
|
715
|
+
onClick: () => Oe(),
|
|
684
716
|
children: "Refetch"
|
|
685
717
|
}
|
|
686
718
|
)
|
|
687
|
-
] }) :
|
|
719
|
+
] }) : p.length === 0 && !C && !P ? /* @__PURE__ */ a("div", { className: "flex items-center justify-center py-8 text-sm text-gray-500", children: "No options found" }) : C || P ? /* @__PURE__ */ a("div", { className: "px-1 py-1 space-y-1", children: Array.from({ length: 6 }).map((e, t) => /* @__PURE__ */ g(
|
|
688
720
|
"div",
|
|
689
721
|
{
|
|
690
|
-
className: "flex
|
|
722
|
+
className: "flex items-center gap-2 px-3 py-2 animate-pulse",
|
|
691
723
|
children: [
|
|
692
|
-
f && /* @__PURE__ */ a("div", { className: "w-4 h-4 bg-
|
|
693
|
-
/* @__PURE__ */ a("div", { className: "h-4 bg-
|
|
724
|
+
f && /* @__PURE__ */ a("div", { className: "w-4 h-4 bg-gray-200 rounded shrink-0" }),
|
|
725
|
+
/* @__PURE__ */ a("div", { className: "h-4 bg-gray-200 rounded w-full" })
|
|
694
726
|
]
|
|
695
727
|
},
|
|
696
728
|
t
|
|
@@ -703,10 +735,10 @@ const wt = (re) => {
|
|
|
703
735
|
position: "relative"
|
|
704
736
|
},
|
|
705
737
|
children: D.getVirtualItems().map((e) => {
|
|
706
|
-
const t =
|
|
738
|
+
const t = p[e.index], l = f ? y.mode === "exclude" ? !y.set.has(t.value) : y.set.has(t.value) : d?.value === t.value, s = d || [], n = f && x ? T(s) ? !1 : w(s) && s.length >= x : !1, i = t.isDisabled || n && !l && !(N && t.isGroup) && !(S && t.isSubmenuParent), r = N && t.isGroup || S && t.isSubmenuParent ? fe(t.original) : void 0, c = r?.selected || 0, o = r?.total || 0, m = c > 0 && c < o, ee = t.isParentSelectable !== !1, me = V || "default", te = String(t.value || ""), he = Z(
|
|
707
739
|
t
|
|
708
|
-
),
|
|
709
|
-
return /* @__PURE__ */
|
|
740
|
+
), ft = typeof he == "string" ? he : te;
|
|
741
|
+
return /* @__PURE__ */ g(
|
|
710
742
|
"div",
|
|
711
743
|
{
|
|
712
744
|
"data-index": e.index,
|
|
@@ -716,100 +748,105 @@ const wt = (re) => {
|
|
|
716
748
|
transform: `translateY(${e.start}px)`,
|
|
717
749
|
width: "100%"
|
|
718
750
|
},
|
|
719
|
-
"data-testid": `select-option-wrapper-${
|
|
751
|
+
"data-testid": `select-option-wrapper-${me}-${te}`,
|
|
720
752
|
children: [
|
|
721
753
|
/* @__PURE__ */ a(
|
|
722
754
|
"div",
|
|
723
755
|
{
|
|
724
|
-
className:
|
|
725
|
-
"
|
|
726
|
-
|
|
727
|
-
l && !
|
|
756
|
+
className: O(
|
|
757
|
+
"cursor-default select-none py-[6px] px-3 flex items-center justify-between transition-colors rounded-md",
|
|
758
|
+
i ? "opacity-50 cursor-not-allowed bg-[#f5f5f5]" : h ? "cursor-default" : "hover:bg-gray-100 cursor-pointer",
|
|
759
|
+
l && !i && !(N && t.isGroup) && !(S && t.isSubmenuParent) ? "bg-[#edf0ff] text-[#1f2b4d]" : "text-[#1f2b4d]",
|
|
760
|
+
k === e.index && !i && "ring-2 ring-inset ring-primary bg-[#edf0ff]"
|
|
728
761
|
),
|
|
729
762
|
style: {
|
|
730
763
|
paddingLeft: `${t.depth * 16 + 12}px`
|
|
731
764
|
},
|
|
732
765
|
onClick: () => {
|
|
733
|
-
|
|
766
|
+
i || (N && t.isGroup || S && t.isSubmenuParent) && !ee || Q(t);
|
|
734
767
|
},
|
|
735
768
|
onMouseEnter: ($) => {
|
|
736
|
-
if (
|
|
737
|
-
|
|
738
|
-
const
|
|
739
|
-
t.rect =
|
|
769
|
+
if (S && t.isSubmenuParent) {
|
|
770
|
+
ae(t.value);
|
|
771
|
+
const j = $.currentTarget.getBoundingClientRect();
|
|
772
|
+
t.rect = j;
|
|
740
773
|
} else
|
|
741
|
-
|
|
774
|
+
ae(null);
|
|
742
775
|
},
|
|
743
|
-
"data-testid": `select-option-${
|
|
776
|
+
"data-testid": `select-option-${me}-${te}`,
|
|
744
777
|
"data-state": l ? "checked" : "unchecked",
|
|
745
|
-
"data-disabled":
|
|
778
|
+
"data-disabled": i || void 0,
|
|
746
779
|
"data-component": "select-option",
|
|
747
|
-
|
|
780
|
+
role: "option",
|
|
781
|
+
"aria-selected": l,
|
|
782
|
+
"aria-disabled": i || void 0,
|
|
783
|
+
children: Ne ? Ne(
|
|
748
784
|
{
|
|
749
785
|
onClick: () => {
|
|
750
786
|
},
|
|
751
787
|
className: "w-full",
|
|
752
788
|
selected: l,
|
|
753
|
-
disabled:
|
|
789
|
+
disabled: i
|
|
754
790
|
},
|
|
755
791
|
t
|
|
756
|
-
) : /* @__PURE__ */
|
|
757
|
-
f && (
|
|
758
|
-
|
|
792
|
+
) : /* @__PURE__ */ g("div", { className: "flex items-center flex-1 overflow-hidden", children: [
|
|
793
|
+
f && (N && t.isGroup || S && t.isSubmenuParent ? ee : !0) && /* @__PURE__ */ a(
|
|
794
|
+
Ge,
|
|
759
795
|
{
|
|
760
796
|
checked: m ? "indeterminate" : l,
|
|
761
|
-
disabled:
|
|
797
|
+
disabled: i || h,
|
|
762
798
|
onChange: () => {
|
|
763
799
|
}
|
|
764
800
|
}
|
|
765
801
|
),
|
|
766
|
-
|
|
767
|
-
|
|
802
|
+
ve && !(N && t.isGroup) && !(S && t.isSubmenuParent) ? /* @__PURE__ */ a(
|
|
803
|
+
ht,
|
|
768
804
|
{
|
|
769
|
-
label:
|
|
805
|
+
label: Z(
|
|
770
806
|
t
|
|
771
807
|
),
|
|
772
|
-
sequence:
|
|
808
|
+
sequence: ot(t)
|
|
773
809
|
}
|
|
774
|
-
) : /* @__PURE__ */
|
|
810
|
+
) : /* @__PURE__ */ g("div", { className: "flex items-center gap-2 overflow-hidden w-full", children: [
|
|
775
811
|
/* @__PURE__ */ a(
|
|
776
812
|
"span",
|
|
777
813
|
{
|
|
778
|
-
className:
|
|
814
|
+
className: O(
|
|
779
815
|
"block truncate",
|
|
780
|
-
|
|
816
|
+
N && t.isGroup ? "text-xs font-semibold text-gray-400 uppercase tracking-wider" : l && !(S && t.isSubmenuParent) ? "font-medium" : "font-normal",
|
|
817
|
+
!(N && t.isGroup) && "text-[14px]"
|
|
781
818
|
),
|
|
782
|
-
"data-testid": `select-option-label-${
|
|
819
|
+
"data-testid": `select-option-label-${me}-${te}`,
|
|
783
820
|
"data-state": l ? "checked" : "unchecked",
|
|
784
|
-
title:
|
|
785
|
-
children:
|
|
821
|
+
title: ft,
|
|
822
|
+
children: he
|
|
786
823
|
}
|
|
787
824
|
),
|
|
788
|
-
(
|
|
825
|
+
(N && t.isGroup || S && t.isSubmenuParent) && c > 0 && /* @__PURE__ */ a("span", { className: "inline-flex items-center justify-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-800", children: c })
|
|
789
826
|
] }),
|
|
790
|
-
|
|
791
|
-
|
|
827
|
+
S && t.isSubmenuParent && /* @__PURE__ */ a(
|
|
828
|
+
$e,
|
|
792
829
|
{
|
|
793
830
|
size: "12px",
|
|
794
|
-
className: "text-
|
|
831
|
+
className: "text-gray-400"
|
|
795
832
|
}
|
|
796
833
|
)
|
|
797
834
|
] })
|
|
798
835
|
}
|
|
799
836
|
),
|
|
800
|
-
|
|
801
|
-
|
|
837
|
+
S && st === t.value && t.isSubmenuParent && t.rect && /* @__PURE__ */ a(
|
|
838
|
+
xt,
|
|
802
839
|
{
|
|
803
840
|
parentOption: t,
|
|
804
841
|
isMulti: !!f,
|
|
805
|
-
isReadOnly: !!
|
|
806
|
-
isSelected: ($) =>
|
|
842
|
+
isReadOnly: !!h,
|
|
843
|
+
isSelected: ($) => yt($, d, !!f),
|
|
807
844
|
getIndeterminateState: ($) => {
|
|
808
|
-
const
|
|
809
|
-
return
|
|
845
|
+
const j = fe($);
|
|
846
|
+
return j ? j.selected > 0 && j.selected < j.total : !1;
|
|
810
847
|
},
|
|
811
|
-
getSelectedCount: ($) =>
|
|
812
|
-
handleSelect:
|
|
848
|
+
getSelectedCount: ($) => fe($)?.selected || 0,
|
|
849
|
+
handleSelect: Q,
|
|
813
850
|
id: V
|
|
814
851
|
}
|
|
815
852
|
)
|
|
@@ -822,40 +859,31 @@ const wt = (re) => {
|
|
|
822
859
|
)
|
|
823
860
|
}
|
|
824
861
|
),
|
|
825
|
-
(
|
|
826
|
-
/* @__PURE__ */ a(
|
|
827
|
-
/* @__PURE__ */
|
|
862
|
+
(we || x || z.length > 5e3) && /* @__PURE__ */ a("div", { className: "px-3 py-[10px] border-t border-solid border-gray-100 z-10 sticky bottom-0 bg-white", children: x ? /* @__PURE__ */ g("div", { className: "flex items-center gap-2 text-gray-500 px-2", children: [
|
|
863
|
+
/* @__PURE__ */ a(xe, { size: "12px", className: "text-gray-400" }),
|
|
864
|
+
/* @__PURE__ */ g("span", { className: "text-xs font-medium leading-4 text-[#60697d]", children: [
|
|
828
865
|
"Maximum ",
|
|
829
|
-
|
|
866
|
+
x,
|
|
830
867
|
" selections"
|
|
831
868
|
] })
|
|
832
|
-
] }) :
|
|
833
|
-
/* @__PURE__ */ a(
|
|
834
|
-
/* @__PURE__ */ a("span", { className: "text-xs font-medium leading-4 text-
|
|
835
|
-
] }) :
|
|
869
|
+
] }) : z.length > 5e3 ? /* @__PURE__ */ g("div", { className: "flex items-center gap-2 text-gray-500 px-2", children: [
|
|
870
|
+
/* @__PURE__ */ a(xe, { size: "12px", className: "text-gray-400" }),
|
|
871
|
+
/* @__PURE__ */ a("span", { className: "text-xs font-medium leading-4 text-[#60697d]", children: "Large dataset detected. Operations might be slower." })
|
|
872
|
+
] }) : we })
|
|
836
873
|
]
|
|
837
874
|
}
|
|
838
875
|
) })
|
|
839
876
|
] }),
|
|
840
|
-
|
|
841
|
-
"
|
|
877
|
+
ye && /* @__PURE__ */ g(
|
|
878
|
+
"p",
|
|
842
879
|
{
|
|
843
|
-
className:
|
|
844
|
-
"flex items-center gap-
|
|
845
|
-
|
|
880
|
+
className: O(
|
|
881
|
+
"text-[12px] mt-1 flex items-center gap-1",
|
|
882
|
+
Se ? "text-[#e15554]" : "text-gray-500"
|
|
846
883
|
),
|
|
847
884
|
children: [
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
"p",
|
|
851
|
-
{
|
|
852
|
-
className: k(
|
|
853
|
-
"text-[10px] leading-4",
|
|
854
|
-
T ? "text-validation" : "text-content-muted"
|
|
855
|
-
),
|
|
856
|
-
children: ue
|
|
857
|
-
}
|
|
858
|
-
)
|
|
885
|
+
/* @__PURE__ */ a(xe, { size: "12px" }),
|
|
886
|
+
ye
|
|
859
887
|
]
|
|
860
888
|
}
|
|
861
889
|
)
|
|
@@ -863,7 +891,7 @@ const wt = (re) => {
|
|
|
863
891
|
}
|
|
864
892
|
);
|
|
865
893
|
};
|
|
866
|
-
|
|
894
|
+
Ot.displayName = "Select";
|
|
867
895
|
export {
|
|
868
|
-
|
|
896
|
+
Ot as default
|
|
869
897
|
};
|