impact-nova 2.1.0-alpha.5 → 2.1.0-alpha.7
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/data/ag-grid-react/index.js +120 -119
- package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +7 -0
- package/dist/components/data/ag-grid-react/notify-column-indicator-sync.js +6 -0
- package/dist/components/data/ag-grid-react/theme.js +5 -4
- package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +14 -0
- package/dist/components/data/data-table/build-column-tree-from-grid.js +95 -0
- package/dist/components/data/data-table/data-table-column-apply.d.ts +14 -1
- package/dist/components/data/data-table/data-table-column-apply.js +97 -13
- package/dist/components/data/data-table/data-table-column-def-pin.d.ts +25 -0
- package/dist/components/data/data-table/data-table-column-def-pin.js +66 -0
- package/dist/components/data/data-table/data-table-column-list-sync.d.ts +8 -0
- package/dist/components/data/data-table/data-table-column-list-sync.js +15 -0
- package/dist/components/data/data-table/data-table-column-list.d.ts +1 -1
- package/dist/components/data/data-table/data-table-column-list.js +73 -283
- package/dist/components/data/data-table/data-table-sheet.js +18 -18
- package/dist/components/data/data-table/data-table.js +86 -77
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +16 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +222 -0
- package/dist/components/forms/select/hooks/useSelectValueState.d.ts +19 -0
- package/dist/components/forms/select/hooks/useSelectValueState.js +41 -0
- package/dist/components/forms/select/index.js +4 -3
- package/dist/components/forms/select/select.js +163 -158
- package/dist/components/forms/select/select.types.d.ts +3 -2
- package/dist/components/forms/select/utils/select.d.ts +2 -1
- package/dist/components/forms/select/utils/select.js +47 -37
- package/dist/impact-nova-components.css +26 -17
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +297 -296
- package/dist/lib/primitives/create-component.d.ts +1 -1
- package/dist/lib/primitives/create-component.js +4 -4
- package/dist/lib/primitives/field.js +17 -18
- package/dist/lib/virtualized/virtualized-list-parts.d.ts +1 -2
- package/dist/lib/virtualized/virtualized-list-parts.js +23 -23
- package/dist/lib/virtualized/virtualized.types.d.ts +10 -0
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/migration.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as u, jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as u, jsxs as Z } from "react/jsx-runtime";
|
|
2
|
+
import ee, { useState as x, useRef as S } from "react";
|
|
3
3
|
import * as te from "@radix-ui/react-popover";
|
|
4
4
|
import { useVirtualizer as ut } from "@tanstack/react-virtual";
|
|
5
5
|
import { SelectMenuFooter as dt } from "./components/SelectMenuFooter.js";
|
|
@@ -11,24 +11,25 @@ import { cn as le } from "../../../lib/utils.js";
|
|
|
11
11
|
import { useFieldChrome as ht } from "../../../lib/primitives/use-field-chrome.js";
|
|
12
12
|
import { isOptionArray as gt, getSequence as bt } from "./utils/select.js";
|
|
13
13
|
import { useImpactNovaI18n as Ot } from "../../../i18n/use-impact-nova-i18n.js";
|
|
14
|
-
import { useFlattenOptions as
|
|
15
|
-
import { useSelectKeyboardHandlers as
|
|
14
|
+
import { useFlattenOptions as Mt } from "./hooks/useFlattenOptions.js";
|
|
15
|
+
import { useSelectKeyboardHandlers as Ct } from "./hooks/useSelectKeyboardHandlers.js";
|
|
16
|
+
import { useSelectValueState as It } from "./hooks/useSelectValueState.js";
|
|
16
17
|
import { useSelectMenuHeight as Vt } from "./hooks/useSelectMenuHeight.js";
|
|
17
18
|
import { useSelectMenuScroll as vt } from "./hooks/useSelectMenuScroll.js";
|
|
18
|
-
import { useSelectOpenEffects as
|
|
19
|
-
import { useSelectOutsideScrollLock as
|
|
20
|
-
import { useSelectSearchFocus as
|
|
21
|
-
import { useSelectSelectionHandlers as
|
|
22
|
-
import { useSelectionModel as
|
|
23
|
-
import { useVisibleStats as
|
|
24
|
-
import { SELECT_ALL_INDEX as
|
|
25
|
-
import { getSelectableOptionIndices as
|
|
26
|
-
const
|
|
19
|
+
import { useSelectOpenEffects as Lt } from "./hooks/useSelectOpenEffects.js";
|
|
20
|
+
import { useSelectOutsideScrollLock as xt } from "./hooks/useSelectOutsideScrollLock.js";
|
|
21
|
+
import { useSelectSearchFocus as At } from "./hooks/useSelectSearchFocus.js";
|
|
22
|
+
import { useSelectSelectionHandlers as yt } from "./hooks/useSelectSelectionHandlers.js";
|
|
23
|
+
import { useSelectionModel as Rt } from "./hooks/useSelectionModel.js";
|
|
24
|
+
import { useVisibleStats as Pt } from "./hooks/useVisibleStats.js";
|
|
25
|
+
import { SELECT_ALL_INDEX as wt } from "./select.constants.js";
|
|
26
|
+
import { getSelectableOptionIndices as Et } from "./utils/getSelectableOptionIndices.js";
|
|
27
|
+
const qt = (oe) => {
|
|
27
28
|
const {
|
|
28
|
-
options:
|
|
29
|
-
value:
|
|
30
|
-
defaultValue:
|
|
31
|
-
onChange:
|
|
29
|
+
options: C,
|
|
30
|
+
value: ne,
|
|
31
|
+
defaultValue: se,
|
|
32
|
+
onChange: F,
|
|
32
33
|
isMulti: re,
|
|
33
34
|
multiple: ie,
|
|
34
35
|
isDisabled: ae,
|
|
@@ -38,36 +39,36 @@ const Et = (oe) => {
|
|
|
38
39
|
isSearchable: h = !0,
|
|
39
40
|
placeholder: de,
|
|
40
41
|
// menuPortalTarget is kept for API compatibility but no longer used (Radix handles portalling)
|
|
41
|
-
menuPortalTarget:
|
|
42
|
+
menuPortalTarget: Dt,
|
|
42
43
|
autoFocus: me,
|
|
43
44
|
closeMenuOnSelect: fe,
|
|
44
45
|
defaultMenuIsOpen: pe = !1,
|
|
45
46
|
scrollToSelectedOnOpen: Se = !1,
|
|
46
47
|
maxSelectableOptions: g,
|
|
47
|
-
showSequence:
|
|
48
|
+
showSequence: T,
|
|
48
49
|
selectionOrder: he,
|
|
49
50
|
label: d,
|
|
50
51
|
required: ge,
|
|
51
52
|
isRequired: be,
|
|
52
53
|
error: Oe,
|
|
53
|
-
helperText:
|
|
54
|
-
helperTextPosition:
|
|
54
|
+
helperText: Me,
|
|
55
|
+
helperTextPosition: Ce = "absolute",
|
|
55
56
|
id: m,
|
|
56
|
-
className:
|
|
57
|
-
parentClassName:
|
|
58
|
-
onMenuScrollToBottom:
|
|
57
|
+
className: Ie,
|
|
58
|
+
parentClassName: Ve,
|
|
59
|
+
onMenuScrollToBottom: ve,
|
|
59
60
|
totalCount: Le,
|
|
60
61
|
name: xe,
|
|
61
62
|
isSelectAllEnabled: A = !0,
|
|
62
|
-
isReadOnly:
|
|
63
|
+
isReadOnly: n = !1,
|
|
63
64
|
searchPosition: b = "menu",
|
|
64
|
-
footerContent:
|
|
65
|
+
footerContent: N,
|
|
65
66
|
onInputChange: Ae,
|
|
66
|
-
getOptionLabel:
|
|
67
|
+
getOptionLabel: H,
|
|
67
68
|
renderOption: ye,
|
|
68
69
|
onMenuOpen: Re,
|
|
69
|
-
onMenuClose:
|
|
70
|
-
labelOrientation:
|
|
70
|
+
onMenuClose: B,
|
|
71
|
+
labelOrientation: K = "top",
|
|
71
72
|
size: Pe = "default",
|
|
72
73
|
leftContent: we,
|
|
73
74
|
ignoreCase: Ee,
|
|
@@ -76,175 +77,179 @@ const Et = (oe) => {
|
|
|
76
77
|
stringify: Fe,
|
|
77
78
|
trim: Te,
|
|
78
79
|
filterOption: Ne,
|
|
79
|
-
enableSubMenus:
|
|
80
|
+
enableSubMenus: I = !1,
|
|
80
81
|
enableGroups: y = !1,
|
|
81
82
|
enableInvertedSelection: He,
|
|
82
|
-
fetchError:
|
|
83
|
-
onRefetch:
|
|
84
|
-
menuWidth:
|
|
85
|
-
onClearAll:
|
|
83
|
+
fetchError: V,
|
|
84
|
+
onRefetch: Be,
|
|
85
|
+
menuWidth: Ke,
|
|
86
|
+
onClearAll: ze,
|
|
86
87
|
onFocus: $e,
|
|
87
88
|
onBlur: _e
|
|
88
|
-
} = oe, t = ie ?? re ?? !1, i = ce ?? ae ?? !1,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
} = oe, t = ie ?? re ?? !1, i = ce ?? ae ?? !1, je = ge ?? be ?? !1, ke = fe ?? !t, { t: O } = Ot(), R = de ?? O("select.placeholder"), [l, z] = x(pe), [f, v] = x(""), {
|
|
90
|
+
usesMenuSession: Ge,
|
|
91
|
+
currentValue: s,
|
|
92
|
+
setCurrentValue: We,
|
|
93
|
+
beginMenuSession: Xe,
|
|
94
|
+
endMenuSession: Je
|
|
95
|
+
} = It({
|
|
96
|
+
value: ne,
|
|
97
|
+
defaultValue: se,
|
|
98
|
+
isMulti: !!t,
|
|
99
|
+
onChange: F
|
|
100
|
+
}), [Qe, $] = x(null), [a, _] = x(-1), j = S(!1), Ue = ee.useId(), p = m ?? Ue, k = `${p}-listbox`, Ye = l && a >= 0 ? a === wt ? `${p}-option-select-all` : `${p}-option-${a}` : void 0, G = S(null), P = S(null), Ze = S(null), w = S(null), E = S(null);
|
|
101
|
+
At(l, h, b, E);
|
|
102
|
+
const { flatOptions: o, isProcessing: c, totalOptionsCount: W, workerSelectAll: et } = Mt(C, f, {
|
|
98
103
|
ignoreCase: Ee,
|
|
99
104
|
ignoreAccents: qe,
|
|
100
105
|
matchFrom: De,
|
|
101
106
|
stringify: Fe,
|
|
102
107
|
trim: Te,
|
|
103
108
|
filterOption: Ne,
|
|
104
|
-
enableSubMenus:
|
|
109
|
+
enableSubMenus: I,
|
|
105
110
|
enableGroups: y
|
|
106
|
-
}),
|
|
111
|
+
}), tt = Vt(
|
|
107
112
|
l,
|
|
108
113
|
!!r,
|
|
109
114
|
c,
|
|
110
|
-
|
|
111
|
-
),
|
|
112
|
-
|
|
115
|
+
P
|
|
116
|
+
), M = Rt(s, t ?? !1), { stats: X, getGroupStats: lt } = Pt(
|
|
117
|
+
o,
|
|
113
118
|
W,
|
|
114
119
|
f,
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
M,
|
|
121
|
+
s,
|
|
117
122
|
t ?? !1
|
|
118
|
-
),
|
|
119
|
-
count:
|
|
120
|
-
getScrollElement: () =>
|
|
123
|
+
), L = ut({
|
|
124
|
+
count: o.length,
|
|
125
|
+
getScrollElement: () => w.current,
|
|
121
126
|
estimateSize: () => 34,
|
|
122
127
|
overscan: 5
|
|
123
128
|
});
|
|
124
|
-
|
|
129
|
+
Lt({
|
|
125
130
|
isOpen: l,
|
|
126
131
|
isSearchable: h,
|
|
127
132
|
searchPosition: b,
|
|
128
|
-
isReadOnly:
|
|
133
|
+
isReadOnly: n,
|
|
129
134
|
isLoading: r,
|
|
130
135
|
isProcessing: c,
|
|
131
|
-
fetchError:
|
|
136
|
+
fetchError: V,
|
|
132
137
|
isMulti: t,
|
|
133
138
|
isSelectAllEnabled: A,
|
|
134
|
-
flatOptions:
|
|
139
|
+
flatOptions: o,
|
|
135
140
|
searchValue: f,
|
|
136
141
|
highlightedIndex: a,
|
|
137
|
-
setHighlightedIndex:
|
|
142
|
+
setHighlightedIndex: _,
|
|
138
143
|
openedViaKeyboardRef: j,
|
|
139
144
|
scrollToSelectedOnOpen: Se,
|
|
140
|
-
selectionModel:
|
|
141
|
-
internalValue:
|
|
142
|
-
rowVirtualizer:
|
|
145
|
+
selectionModel: M,
|
|
146
|
+
internalValue: s,
|
|
147
|
+
rowVirtualizer: L
|
|
143
148
|
}), vt({
|
|
144
149
|
isOpen: l,
|
|
145
150
|
isLoading: r,
|
|
146
151
|
isProcessing: c,
|
|
147
|
-
flatOptions:
|
|
148
|
-
listRef:
|
|
149
|
-
rowVirtualizer:
|
|
150
|
-
onMenuScrollToBottom:
|
|
152
|
+
flatOptions: o,
|
|
153
|
+
listRef: w,
|
|
154
|
+
rowVirtualizer: L,
|
|
155
|
+
onMenuScrollToBottom: ve
|
|
151
156
|
});
|
|
152
|
-
const
|
|
157
|
+
const q = (e) => {
|
|
153
158
|
if (!(i && e))
|
|
154
|
-
if (
|
|
155
|
-
Re?.();
|
|
159
|
+
if (z(e), e)
|
|
160
|
+
Xe(), Re?.();
|
|
156
161
|
else {
|
|
157
|
-
const
|
|
158
|
-
|
|
162
|
+
const D = Ge ? Je() : s, at = t && gt(D) ? D.map((ct) => ct.value) : void 0;
|
|
163
|
+
B?.(D, at), v(""), $(null);
|
|
159
164
|
}
|
|
160
165
|
};
|
|
161
|
-
|
|
166
|
+
xt(l, P), ee.useEffect(() => {
|
|
162
167
|
}, [l]);
|
|
163
|
-
const J = (e) =>
|
|
168
|
+
const J = (e) => H ? H(e) : e.label, { handleSelect: Q, handleSelectAll: U, clearValue: ot } = yt({
|
|
164
169
|
isMulti: t,
|
|
165
170
|
isDisabled: i,
|
|
166
|
-
isReadOnly:
|
|
167
|
-
internalValue:
|
|
171
|
+
isReadOnly: n,
|
|
172
|
+
internalValue: s,
|
|
168
173
|
setInternalValue: We,
|
|
169
|
-
onChange:
|
|
170
|
-
onMenuClose:
|
|
171
|
-
onClearAll:
|
|
172
|
-
enableSubMenus:
|
|
174
|
+
onChange: F,
|
|
175
|
+
onMenuClose: B,
|
|
176
|
+
onClearAll: ze,
|
|
177
|
+
enableSubMenus: I,
|
|
173
178
|
enableGroups: y,
|
|
174
179
|
enableInvertedSelection: He,
|
|
175
180
|
maxSelectableOptions: g,
|
|
176
|
-
closeMenuOnSelect:
|
|
177
|
-
options:
|
|
178
|
-
flatOptions:
|
|
181
|
+
closeMenuOnSelect: ke,
|
|
182
|
+
options: C,
|
|
183
|
+
flatOptions: o,
|
|
179
184
|
searchValue: f,
|
|
180
|
-
selectionModel:
|
|
185
|
+
selectionModel: M,
|
|
181
186
|
visibleStats: X,
|
|
182
|
-
workerSelectAll:
|
|
183
|
-
setIsOpen:
|
|
184
|
-
setSearchValue:
|
|
185
|
-
}),
|
|
187
|
+
workerSelectAll: et,
|
|
188
|
+
setIsOpen: z,
|
|
189
|
+
setSearchValue: v
|
|
190
|
+
}), nt = (e) => bt(
|
|
186
191
|
e,
|
|
187
|
-
|
|
192
|
+
T ?? !1,
|
|
188
193
|
t ?? !1,
|
|
189
194
|
he,
|
|
190
|
-
|
|
191
|
-
),
|
|
195
|
+
s
|
|
196
|
+
), st = () => Et({
|
|
192
197
|
isLoading: !!r,
|
|
193
198
|
isProcessing: c,
|
|
194
|
-
fetchError:
|
|
199
|
+
fetchError: V,
|
|
195
200
|
isMulti: t,
|
|
196
201
|
isSelectAllEnabled: A,
|
|
197
|
-
isReadOnly:
|
|
198
|
-
flatOptions:
|
|
199
|
-
enableSubMenus:
|
|
200
|
-
}), { handleTriggerKeyDown:
|
|
202
|
+
isReadOnly: n,
|
|
203
|
+
flatOptions: o,
|
|
204
|
+
enableSubMenus: I
|
|
205
|
+
}), { handleTriggerKeyDown: rt, handleSearchKeyDown: it } = Ct({
|
|
201
206
|
isDisabled: i,
|
|
202
|
-
isReadOnly:
|
|
207
|
+
isReadOnly: n,
|
|
203
208
|
isOpen: l,
|
|
204
209
|
isSearchable: h,
|
|
205
210
|
searchPosition: b,
|
|
206
|
-
getSelectableIndices:
|
|
211
|
+
getSelectableIndices: st,
|
|
207
212
|
highlightedIndex: a,
|
|
208
|
-
setHighlightedIndex:
|
|
209
|
-
flatOptions:
|
|
210
|
-
rowVirtualizer:
|
|
211
|
-
handleOpenChange:
|
|
213
|
+
setHighlightedIndex: _,
|
|
214
|
+
flatOptions: o,
|
|
215
|
+
rowVirtualizer: L,
|
|
216
|
+
handleOpenChange: q,
|
|
212
217
|
handleSelect: Q,
|
|
213
|
-
handleSelectAll:
|
|
218
|
+
handleSelectAll: U,
|
|
214
219
|
openedViaKeyboardRef: j,
|
|
215
|
-
searchInputRef:
|
|
216
|
-
triggerRef:
|
|
217
|
-
}),
|
|
220
|
+
searchInputRef: E,
|
|
221
|
+
triggerRef: G
|
|
222
|
+
}), Y = ht({
|
|
218
223
|
label: d,
|
|
219
|
-
helperText:
|
|
220
|
-
helperTextPosition:
|
|
221
|
-
labelOrientation:
|
|
224
|
+
helperText: Me,
|
|
225
|
+
helperTextPosition: Ce,
|
|
226
|
+
labelOrientation: K,
|
|
222
227
|
error: Oe,
|
|
223
|
-
required:
|
|
228
|
+
required: je,
|
|
224
229
|
disabled: i,
|
|
225
|
-
className: le(
|
|
226
|
-
rootClassName:
|
|
230
|
+
className: le(K === "left" && "w-fit items-center"),
|
|
231
|
+
rootClassName: Ve
|
|
227
232
|
});
|
|
228
233
|
return /* @__PURE__ */ u(
|
|
229
234
|
"div",
|
|
230
235
|
{
|
|
231
236
|
"data-testid": `select-${m || "default"}`,
|
|
232
237
|
"data-component": "select",
|
|
233
|
-
children:
|
|
234
|
-
/* @__PURE__ */
|
|
238
|
+
children: Y.wrapControl(
|
|
239
|
+
/* @__PURE__ */ Z(te.Root, { open: l && !i, onOpenChange: q, modal: !1, children: [
|
|
235
240
|
/* @__PURE__ */ u(te.Anchor, { asChild: !0, children: /* @__PURE__ */ u(
|
|
236
241
|
St,
|
|
237
242
|
{
|
|
238
|
-
triggerRef:
|
|
239
|
-
inputRef:
|
|
243
|
+
triggerRef: G,
|
|
244
|
+
inputRef: Ze,
|
|
240
245
|
selectFieldId: p,
|
|
241
|
-
listboxId:
|
|
246
|
+
listboxId: k,
|
|
242
247
|
id: m,
|
|
243
|
-
className:
|
|
248
|
+
className: Ie,
|
|
244
249
|
size: Pe,
|
|
245
|
-
error:
|
|
250
|
+
error: Y.hasError,
|
|
246
251
|
isDisabled: i,
|
|
247
|
-
isReadOnly:
|
|
252
|
+
isReadOnly: n,
|
|
248
253
|
isOpen: l,
|
|
249
254
|
isLoading: r,
|
|
250
255
|
isProcessing: c,
|
|
@@ -252,14 +257,14 @@ const Et = (oe) => {
|
|
|
252
257
|
isSearchable: h,
|
|
253
258
|
searchPosition: b,
|
|
254
259
|
searchValue: f,
|
|
255
|
-
setSearchValue:
|
|
260
|
+
setSearchValue: v,
|
|
256
261
|
autoFocus: me,
|
|
257
262
|
name: xe,
|
|
258
263
|
label: d,
|
|
259
264
|
placeholder: R,
|
|
260
265
|
leftContent: we,
|
|
261
|
-
activeDescendantId:
|
|
262
|
-
internalValue:
|
|
266
|
+
activeDescendantId: Ye,
|
|
267
|
+
internalValue: s,
|
|
263
268
|
totalCount: Le,
|
|
264
269
|
totalOptionsCount: W,
|
|
265
270
|
formatSelectedCount: (e) => O("select.selectedCount", { count: e }),
|
|
@@ -267,18 +272,18 @@ const Et = (oe) => {
|
|
|
267
272
|
isMulti: t,
|
|
268
273
|
onFocus: $e,
|
|
269
274
|
onBlur: _e,
|
|
270
|
-
onKeyDown:
|
|
271
|
-
onToggle: () =>
|
|
272
|
-
onClear:
|
|
275
|
+
onKeyDown: rt,
|
|
276
|
+
onToggle: () => q(!l),
|
|
277
|
+
onClear: ot
|
|
273
278
|
}
|
|
274
279
|
) }),
|
|
275
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ Z(
|
|
276
281
|
pt,
|
|
277
282
|
{
|
|
278
|
-
menuRef:
|
|
279
|
-
menuMinHeight:
|
|
280
|
-
menuWidth:
|
|
281
|
-
isReadOnly:
|
|
283
|
+
menuRef: P,
|
|
284
|
+
menuMinHeight: tt,
|
|
285
|
+
menuWidth: Ke,
|
|
286
|
+
isReadOnly: n,
|
|
282
287
|
id: m,
|
|
283
288
|
menuLabel: String(d || R),
|
|
284
289
|
children: [
|
|
@@ -287,17 +292,17 @@ const Et = (oe) => {
|
|
|
287
292
|
{
|
|
288
293
|
id: m,
|
|
289
294
|
selectFieldId: p,
|
|
290
|
-
isReadOnly:
|
|
295
|
+
isReadOnly: n,
|
|
291
296
|
isDisabled: i,
|
|
292
297
|
isMulti: t,
|
|
293
298
|
isSearchable: h,
|
|
294
299
|
searchPosition: b,
|
|
295
|
-
fetchError:
|
|
300
|
+
fetchError: V,
|
|
296
301
|
isLoading: r,
|
|
297
302
|
isProcessing: c,
|
|
298
303
|
isSelectAllEnabled: A ?? !1,
|
|
299
|
-
flatOptionsLength:
|
|
300
|
-
searchInputRef:
|
|
304
|
+
flatOptionsLength: o.length,
|
|
305
|
+
searchInputRef: E,
|
|
301
306
|
searchValue: f,
|
|
302
307
|
searchPlaceholder: O("select.searchHere"),
|
|
303
308
|
highlightedIndex: a,
|
|
@@ -306,10 +311,10 @@ const Et = (oe) => {
|
|
|
306
311
|
selectAllLabel: O("select.selectAll"),
|
|
307
312
|
unselectAllLabel: O("select.unselectAll"),
|
|
308
313
|
onSearchChange: (e) => {
|
|
309
|
-
|
|
314
|
+
v(e), Ae?.(e);
|
|
310
315
|
},
|
|
311
|
-
onSearchKeyDown:
|
|
312
|
-
onSelectAll:
|
|
316
|
+
onSearchKeyDown: it,
|
|
317
|
+
onSelectAll: U
|
|
313
318
|
}
|
|
314
319
|
),
|
|
315
320
|
/* @__PURE__ */ u(
|
|
@@ -317,39 +322,39 @@ const Et = (oe) => {
|
|
|
317
322
|
{
|
|
318
323
|
className: le(
|
|
319
324
|
"flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
320
|
-
!(
|
|
325
|
+
!(N || g || C.length > 5e3) && "rounded-b-[12px]"
|
|
321
326
|
),
|
|
322
327
|
children: /* @__PURE__ */ u(
|
|
323
328
|
ft,
|
|
324
329
|
{
|
|
325
|
-
fetchError:
|
|
326
|
-
onRefetch:
|
|
327
|
-
flatOptions:
|
|
330
|
+
fetchError: V,
|
|
331
|
+
onRefetch: Be,
|
|
332
|
+
flatOptions: o,
|
|
328
333
|
isLoading: r,
|
|
329
334
|
isProcessing: c,
|
|
330
335
|
isMulti: t,
|
|
331
|
-
isReadOnly:
|
|
336
|
+
isReadOnly: n,
|
|
332
337
|
enableGroups: y,
|
|
333
|
-
enableSubMenus:
|
|
334
|
-
showSequence:
|
|
338
|
+
enableSubMenus: I,
|
|
339
|
+
showSequence: T,
|
|
335
340
|
maxSelectableOptions: g,
|
|
336
|
-
listRef:
|
|
337
|
-
listboxId:
|
|
341
|
+
listRef: w,
|
|
342
|
+
listboxId: k,
|
|
338
343
|
listboxLabel: d ? String(d) : R,
|
|
339
|
-
rowVirtualizer:
|
|
344
|
+
rowVirtualizer: L,
|
|
340
345
|
selectFieldId: p,
|
|
341
346
|
id: m,
|
|
342
347
|
highlightedIndex: a,
|
|
343
|
-
activeSubmenu:
|
|
344
|
-
setActiveSubmenu:
|
|
345
|
-
internalValue:
|
|
346
|
-
selectionMode:
|
|
347
|
-
selectionSet:
|
|
348
|
+
activeSubmenu: Qe,
|
|
349
|
+
setActiveSubmenu: $,
|
|
350
|
+
internalValue: s,
|
|
351
|
+
selectionMode: M.mode,
|
|
352
|
+
selectionSet: M.set,
|
|
348
353
|
resolveOptionLabel: J,
|
|
349
|
-
getSequenceForOption:
|
|
354
|
+
getSequenceForOption: nt,
|
|
350
355
|
renderOption: ye,
|
|
351
356
|
onSelect: Q,
|
|
352
|
-
getGroupStats:
|
|
357
|
+
getGroupStats: lt
|
|
353
358
|
}
|
|
354
359
|
)
|
|
355
360
|
}
|
|
@@ -357,9 +362,9 @@ const Et = (oe) => {
|
|
|
357
362
|
/* @__PURE__ */ u(
|
|
358
363
|
dt,
|
|
359
364
|
{
|
|
360
|
-
footerContent:
|
|
365
|
+
footerContent: N,
|
|
361
366
|
maxSelectableOptions: g,
|
|
362
|
-
optionCount:
|
|
367
|
+
optionCount: C.length
|
|
363
368
|
}
|
|
364
369
|
)
|
|
365
370
|
]
|
|
@@ -370,7 +375,7 @@ const Et = (oe) => {
|
|
|
370
375
|
}
|
|
371
376
|
);
|
|
372
377
|
};
|
|
373
|
-
|
|
378
|
+
qt.displayName = "Select";
|
|
374
379
|
export {
|
|
375
|
-
|
|
380
|
+
qt as Select
|
|
376
381
|
};
|
|
@@ -82,8 +82,9 @@ export interface SelectProps<OptionType extends Option = Option, IsMulti extends
|
|
|
82
82
|
defaultValue?: PropsValue<OptionType>;
|
|
83
83
|
/**
|
|
84
84
|
* Callback fired when the value changes.
|
|
85
|
-
* Optional - if not provided,
|
|
86
|
-
*
|
|
85
|
+
* Optional - if not provided, the select keeps in-menu edits locally and
|
|
86
|
+
* commits through `onMenuClose` when the menu closes (controlled mode).
|
|
87
|
+
* Use `onChange` for immediate parent updates on every selection.
|
|
87
88
|
*/
|
|
88
89
|
onChange?: (newValue: OnChangeValue<OptionType, IsMulti>, actionMeta: ActionMeta<OptionType>) => void;
|
|
89
90
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Option, Group, MultiValue, SingleValue, InvertedSelection } from '../select.types';
|
|
1
|
+
import { Option, Group, MultiValue, SingleValue, InvertedSelection, PropsValue } from '../select.types';
|
|
2
2
|
export declare const cx: (...classes: (string | undefined | null | false)[]) => string;
|
|
3
3
|
export declare const isInvertedSelection: <OptionType extends Option>(value: MultiValue<OptionType>) => value is InvertedSelection;
|
|
4
4
|
export declare const isOptionArray: <OptionType extends Option>(value: MultiValue<OptionType>) => value is readonly OptionType[];
|
|
@@ -10,3 +10,4 @@ export declare const getSequence: <OptionType extends Option>(option: Option | {
|
|
|
10
10
|
value: string;
|
|
11
11
|
}, showSequence: boolean, isMulti: boolean, selectionOrder: string[] | undefined, internalValue: MultiValue<OptionType> | SingleValue<OptionType> | undefined) => number | undefined;
|
|
12
12
|
export declare const getSelectedCount: <OptionType extends Option>(option: Option, isMulti: boolean, internalValue: MultiValue<OptionType> | OptionType | null) => number;
|
|
13
|
+
export declare function cloneSelectValue<OptionType extends Option>(value: PropsValue<OptionType> | undefined | null, isMulti: boolean): PropsValue<OptionType>;
|
|
@@ -1,72 +1,82 @@
|
|
|
1
|
-
const h = (...e) => e.filter(Boolean).join(" "),
|
|
1
|
+
const h = (...e) => e.filter(Boolean).join(" "), d = (e) => typeof e == "object" && e !== null && "isAllSelected" in e && e.isAllSelected === !0 && "excludedValues" in e && Array.isArray(e.excludedValues), a = (e) => Array.isArray(e), f = (e, s = !1, i = !1) => {
|
|
2
2
|
const u = [], n = [e];
|
|
3
3
|
for (; n.length > 0; ) {
|
|
4
|
-
const
|
|
5
|
-
if (i && "options" in
|
|
6
|
-
const
|
|
7
|
-
for (let r =
|
|
8
|
-
n.push(
|
|
4
|
+
const t = n.pop();
|
|
5
|
+
if (i && "options" in t) {
|
|
6
|
+
const l = t.options;
|
|
7
|
+
for (let r = l.length - 1; r >= 0; r--)
|
|
8
|
+
n.push(l[r]);
|
|
9
9
|
continue;
|
|
10
10
|
}
|
|
11
|
-
if (s && "children" in
|
|
12
|
-
const
|
|
13
|
-
for (let r =
|
|
14
|
-
n.push(
|
|
11
|
+
if (s && "children" in t && Array.isArray(t.children)) {
|
|
12
|
+
const l = t.children;
|
|
13
|
+
for (let r = l.length - 1; r >= 0; r--)
|
|
14
|
+
n.push(l[r]);
|
|
15
15
|
continue;
|
|
16
16
|
}
|
|
17
|
-
u.push(
|
|
17
|
+
u.push(t);
|
|
18
18
|
}
|
|
19
19
|
return u;
|
|
20
|
-
},
|
|
20
|
+
}, x = (e, s, i) => {
|
|
21
21
|
if (i) {
|
|
22
22
|
const n = s;
|
|
23
|
-
return
|
|
23
|
+
return d(n) ? !n.excludedValues.includes(e.value) : a(n) ? n.some((t) => t.value === e.value) : !1;
|
|
24
24
|
}
|
|
25
25
|
return s?.value === e.value;
|
|
26
26
|
}, g = (e, s, i) => {
|
|
27
27
|
if (!s || !("children" in e || "options" in e)) return !1;
|
|
28
|
-
const n = i,
|
|
29
|
-
if (
|
|
28
|
+
const n = i, l = f(e).filter((c) => !c.isDisabled);
|
|
29
|
+
if (l.length === 0) return !1;
|
|
30
30
|
let r = 0;
|
|
31
|
-
return
|
|
31
|
+
return d(n) ? r = l.filter(
|
|
32
32
|
(c) => !n.excludedValues.includes(c.value)
|
|
33
|
-
).length :
|
|
33
|
+
).length : a(n) && (r = l.filter(
|
|
34
34
|
(c) => n.some((o) => o.value === c.value)
|
|
35
|
-
).length), r > 0 && r <
|
|
36
|
-
},
|
|
35
|
+
).length), r > 0 && r < l.length;
|
|
36
|
+
}, v = (e, s, i, u, n) => {
|
|
37
37
|
if (!s || !i || "children" in e || "options" in e)
|
|
38
38
|
return;
|
|
39
39
|
if (u) {
|
|
40
|
-
const
|
|
41
|
-
return
|
|
40
|
+
const l = u.indexOf(e.value);
|
|
41
|
+
return l !== -1 ? l + 1 : void 0;
|
|
42
42
|
}
|
|
43
43
|
if (!n) return;
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
44
|
+
const t = n;
|
|
45
|
+
if (d(t))
|
|
46
|
+
return t.excludedValues.includes(e.value) ? void 0 : e.naturalIndex;
|
|
47
|
+
if (a(t)) {
|
|
48
|
+
const l = t.findIndex((r) => r.value === e.value);
|
|
49
|
+
if (l !== -1)
|
|
50
|
+
return l + 1;
|
|
51
51
|
if ("sequence" in e && typeof e.sequence == "number")
|
|
52
52
|
return e.sequence;
|
|
53
53
|
}
|
|
54
54
|
}, V = (e, s, i) => {
|
|
55
55
|
if (!s || !("children" in e || "options" in e)) return 0;
|
|
56
|
-
const n = i,
|
|
57
|
-
return
|
|
58
|
-
(
|
|
59
|
-
).length :
|
|
60
|
-
(
|
|
56
|
+
const n = i, t = f(e);
|
|
57
|
+
return d(n) ? t.filter(
|
|
58
|
+
(l) => !n.excludedValues.includes(l.value)
|
|
59
|
+
).length : a(n) ? t.filter(
|
|
60
|
+
(l) => n.some((r) => r.value === l.value)
|
|
61
61
|
).length : 0;
|
|
62
62
|
};
|
|
63
|
+
function A(e, s) {
|
|
64
|
+
if (e == null)
|
|
65
|
+
return s ? [] : null;
|
|
66
|
+
const i = e;
|
|
67
|
+
return d(i) ? {
|
|
68
|
+
isAllSelected: i.isAllSelected,
|
|
69
|
+
excludedValues: [...i.excludedValues]
|
|
70
|
+
} : a(i) ? [...i] : e;
|
|
71
|
+
}
|
|
63
72
|
export {
|
|
73
|
+
A as cloneSelectValue,
|
|
64
74
|
h as cx,
|
|
65
75
|
g as getIndeterminateState,
|
|
66
76
|
f as getLeafOptions,
|
|
67
77
|
V as getSelectedCount,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
v as getSequence,
|
|
79
|
+
d as isInvertedSelection,
|
|
80
|
+
a as isOptionArray,
|
|
81
|
+
x as isSelected
|
|
72
82
|
};
|