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