impact-nova 2.1.0-alpha.5 → 2.1.0-alpha.6

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.
Files changed (34) hide show
  1. package/dist/components/data/ag-grid-react/index.js +120 -119
  2. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +7 -0
  3. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.js +6 -0
  4. package/dist/components/data/ag-grid-react/theme.js +5 -4
  5. package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +14 -0
  6. package/dist/components/data/data-table/build-column-tree-from-grid.js +95 -0
  7. package/dist/components/data/data-table/data-table-column-apply.d.ts +14 -1
  8. package/dist/components/data/data-table/data-table-column-apply.js +97 -13
  9. package/dist/components/data/data-table/data-table-column-def-pin.d.ts +25 -0
  10. package/dist/components/data/data-table/data-table-column-def-pin.js +66 -0
  11. package/dist/components/data/data-table/data-table-column-list-sync.d.ts +8 -0
  12. package/dist/components/data/data-table/data-table-column-list-sync.js +15 -0
  13. package/dist/components/data/data-table/data-table-column-list.d.ts +1 -1
  14. package/dist/components/data/data-table/data-table-column-list.js +73 -283
  15. package/dist/components/data/data-table/data-table-sheet.js +3 -1
  16. package/dist/components/data/data-table/data-table.js +80 -71
  17. package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +16 -0
  18. package/dist/components/data/data-table/use-data-table-column-list-sync.js +222 -0
  19. package/dist/components/forms/select/hooks/useSelectValueState.d.ts +19 -0
  20. package/dist/components/forms/select/hooks/useSelectValueState.js +41 -0
  21. package/dist/components/forms/select/index.js +4 -3
  22. package/dist/components/forms/select/select.js +163 -158
  23. package/dist/components/forms/select/select.types.d.ts +3 -2
  24. package/dist/components/forms/select/utils/select.d.ts +2 -1
  25. package/dist/components/forms/select/utils/select.js +47 -37
  26. package/dist/impact-nova-components.css +26 -17
  27. package/dist/impact-nova.css +1 -1
  28. package/dist/index.js +297 -296
  29. package/dist/llms/rules/ag-grid.js +1 -1
  30. package/dist/llms/rules/installation.js +1 -1
  31. package/dist/llms/rules/migration.js +1 -1
  32. package/dist/llms/rules/real-world-patterns.js +1 -1
  33. package/dist/llms/rules/requirements.js +1 -1
  34. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
- import { jsx as u, jsxs as ee } from "react/jsx-runtime";
2
- import F, { useState as M, useRef as S } from "react";
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 Ct } from "./hooks/useFlattenOptions.js";
15
- import { useSelectKeyboardHandlers as Mt } from "./hooks/useSelectKeyboardHandlers.js";
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 It } from "./hooks/useSelectOpenEffects.js";
19
- import { useSelectOutsideScrollLock as Lt } from "./hooks/useSelectOutsideScrollLock.js";
20
- import { useSelectSearchFocus as xt } from "./hooks/useSelectSearchFocus.js";
21
- import { useSelectSelectionHandlers as At } from "./hooks/useSelectSelectionHandlers.js";
22
- import { useSelectionModel as yt } from "./hooks/useSelectionModel.js";
23
- import { useVisibleStats as Rt } from "./hooks/useVisibleStats.js";
24
- import { SELECT_ALL_INDEX as Pt } from "./select.constants.js";
25
- import { getSelectableOptionIndices as wt } from "./utils/getSelectableOptionIndices.js";
26
- const Et = (oe) => {
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: V,
29
- value: T,
30
- defaultValue: ne,
31
- onChange: se,
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: qt,
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: N,
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: Ce,
54
- helperTextPosition: Me = "absolute",
54
+ helperText: Me,
55
+ helperTextPosition: Ce = "absolute",
55
56
  id: m,
56
- className: Ve,
57
- parentClassName: ve,
58
- onMenuScrollToBottom: Ie,
57
+ className: Ie,
58
+ parentClassName: Ve,
59
+ onMenuScrollToBottom: ve,
59
60
  totalCount: Le,
60
61
  name: xe,
61
62
  isSelectAllEnabled: A = !0,
62
- isReadOnly: s = !1,
63
+ isReadOnly: n = !1,
63
64
  searchPosition: b = "menu",
64
- footerContent: H,
65
+ footerContent: N,
65
66
  onInputChange: Ae,
66
- getOptionLabel: K,
67
+ getOptionLabel: H,
67
68
  renderOption: ye,
68
69
  onMenuOpen: Re,
69
- onMenuClose: z,
70
- labelOrientation: B = "top",
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: v = !1,
80
+ enableSubMenus: I = !1,
80
81
  enableGroups: y = !1,
81
82
  enableInvertedSelection: He,
82
- fetchError: I,
83
- onRefetch: Ke,
84
- menuWidth: ze,
85
- onClearAll: Be,
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, ke = ge ?? be ?? !1, je = fe ?? !t, { t: O } = Ot(), R = de ?? O("select.placeholder"), [l, $] = M(pe), [f, L] = M(""), P = T !== void 0, [Ge, Ue] = M(
89
- ne ?? (t ? [] : null)
90
- ), o = P ? T : Ge, We = F.useCallback(
91
- (e) => {
92
- P || Ue(e);
93
- },
94
- [P]
95
- ), [Xe, _] = M(null), [a, k] = M(-1), j = S(!1), Je = F.useId(), p = m ?? Je, G = `${p}-listbox`, Qe = l && a >= 0 ? a === Pt ? `${p}-option-select-all` : `${p}-option-${a}` : void 0, U = S(null), w = S(null), Ye = S(null), E = S(null), q = S(null);
96
- xt(l, h, b, q);
97
- const { flatOptions: n, isProcessing: c, totalOptionsCount: W, workerSelectAll: Ze } = Ct(V, f, {
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: v,
109
+ enableSubMenus: I,
105
110
  enableGroups: y
106
- }), et = Vt(
111
+ }), tt = Vt(
107
112
  l,
108
113
  !!r,
109
114
  c,
110
- w
111
- ), C = yt(o, t ?? !1), { stats: X, getGroupStats: tt } = Rt(
112
- n,
115
+ P
116
+ ), M = Rt(s, t ?? !1), { stats: X, getGroupStats: lt } = Pt(
117
+ o,
113
118
  W,
114
119
  f,
115
- C,
116
- o,
120
+ M,
121
+ s,
117
122
  t ?? !1
118
- ), x = ut({
119
- count: n.length,
120
- getScrollElement: () => E.current,
123
+ ), L = ut({
124
+ count: o.length,
125
+ getScrollElement: () => w.current,
121
126
  estimateSize: () => 34,
122
127
  overscan: 5
123
128
  });
124
- It({
129
+ Lt({
125
130
  isOpen: l,
126
131
  isSearchable: h,
127
132
  searchPosition: b,
128
- isReadOnly: s,
133
+ isReadOnly: n,
129
134
  isLoading: r,
130
135
  isProcessing: c,
131
- fetchError: I,
136
+ fetchError: V,
132
137
  isMulti: t,
133
138
  isSelectAllEnabled: A,
134
- flatOptions: n,
139
+ flatOptions: o,
135
140
  searchValue: f,
136
141
  highlightedIndex: a,
137
- setHighlightedIndex: k,
142
+ setHighlightedIndex: _,
138
143
  openedViaKeyboardRef: j,
139
144
  scrollToSelectedOnOpen: Se,
140
- selectionModel: C,
141
- internalValue: o,
142
- rowVirtualizer: x
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: n,
148
- listRef: E,
149
- rowVirtualizer: x,
150
- onMenuScrollToBottom: Ie
152
+ flatOptions: o,
153
+ listRef: w,
154
+ rowVirtualizer: L,
155
+ onMenuScrollToBottom: ve
151
156
  });
152
- const D = (e) => {
157
+ const q = (e) => {
153
158
  if (!(i && e))
154
- if ($(e), e)
155
- Re?.();
159
+ if (z(e), e)
160
+ Xe(), Re?.();
156
161
  else {
157
- const it = o, at = t && gt(o) ? o.map((ct) => ct.value) : void 0;
158
- z?.(it, at), L(""), _(null);
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
- Lt(l, w), F.useEffect(() => {
166
+ xt(l, P), ee.useEffect(() => {
162
167
  }, [l]);
163
- const J = (e) => K ? K(e) : e.label, { handleSelect: Q, handleSelectAll: Y, clearValue: lt } = At({
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: s,
167
- internalValue: o,
171
+ isReadOnly: n,
172
+ internalValue: s,
168
173
  setInternalValue: We,
169
- onChange: se,
170
- onMenuClose: z,
171
- onClearAll: Be,
172
- enableSubMenus: v,
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: je,
177
- options: V,
178
- flatOptions: n,
181
+ closeMenuOnSelect: ke,
182
+ options: C,
183
+ flatOptions: o,
179
184
  searchValue: f,
180
- selectionModel: C,
185
+ selectionModel: M,
181
186
  visibleStats: X,
182
- workerSelectAll: Ze,
183
- setIsOpen: $,
184
- setSearchValue: L
185
- }), ot = (e) => bt(
187
+ workerSelectAll: et,
188
+ setIsOpen: z,
189
+ setSearchValue: v
190
+ }), nt = (e) => bt(
186
191
  e,
187
- N ?? !1,
192
+ T ?? !1,
188
193
  t ?? !1,
189
194
  he,
190
- o
191
- ), nt = () => wt({
195
+ s
196
+ ), st = () => Et({
192
197
  isLoading: !!r,
193
198
  isProcessing: c,
194
- fetchError: I,
199
+ fetchError: V,
195
200
  isMulti: t,
196
201
  isSelectAllEnabled: A,
197
- isReadOnly: s,
198
- flatOptions: n,
199
- enableSubMenus: v
200
- }), { handleTriggerKeyDown: st, handleSearchKeyDown: rt } = Mt({
202
+ isReadOnly: n,
203
+ flatOptions: o,
204
+ enableSubMenus: I
205
+ }), { handleTriggerKeyDown: rt, handleSearchKeyDown: it } = Ct({
201
206
  isDisabled: i,
202
- isReadOnly: s,
207
+ isReadOnly: n,
203
208
  isOpen: l,
204
209
  isSearchable: h,
205
210
  searchPosition: b,
206
- getSelectableIndices: nt,
211
+ getSelectableIndices: st,
207
212
  highlightedIndex: a,
208
- setHighlightedIndex: k,
209
- flatOptions: n,
210
- rowVirtualizer: x,
211
- handleOpenChange: D,
213
+ setHighlightedIndex: _,
214
+ flatOptions: o,
215
+ rowVirtualizer: L,
216
+ handleOpenChange: q,
212
217
  handleSelect: Q,
213
- handleSelectAll: Y,
218
+ handleSelectAll: U,
214
219
  openedViaKeyboardRef: j,
215
- searchInputRef: q,
216
- triggerRef: U
217
- }), Z = ht({
220
+ searchInputRef: E,
221
+ triggerRef: G
222
+ }), Y = ht({
218
223
  label: d,
219
- helperText: Ce,
220
- helperTextPosition: Me,
221
- labelOrientation: B,
224
+ helperText: Me,
225
+ helperTextPosition: Ce,
226
+ labelOrientation: K,
222
227
  error: Oe,
223
- required: ke,
228
+ required: je,
224
229
  disabled: i,
225
- className: le(B === "left" && "w-fit items-center"),
226
- rootClassName: ve
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: Z.wrapControl(
234
- /* @__PURE__ */ ee(te.Root, { open: l && !i, onOpenChange: D, modal: !1, children: [
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: U,
239
- inputRef: Ye,
243
+ triggerRef: G,
244
+ inputRef: Ze,
240
245
  selectFieldId: p,
241
- listboxId: G,
246
+ listboxId: k,
242
247
  id: m,
243
- className: Ve,
248
+ className: Ie,
244
249
  size: Pe,
245
- error: Z.hasError,
250
+ error: Y.hasError,
246
251
  isDisabled: i,
247
- isReadOnly: s,
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: L,
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: Qe,
262
- internalValue: o,
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: st,
271
- onToggle: () => D(!l),
272
- onClear: lt
275
+ onKeyDown: rt,
276
+ onToggle: () => q(!l),
277
+ onClear: ot
273
278
  }
274
279
  ) }),
275
- /* @__PURE__ */ ee(
280
+ /* @__PURE__ */ Z(
276
281
  pt,
277
282
  {
278
- menuRef: w,
279
- menuMinHeight: et,
280
- menuWidth: ze,
281
- isReadOnly: s,
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: s,
295
+ isReadOnly: n,
291
296
  isDisabled: i,
292
297
  isMulti: t,
293
298
  isSearchable: h,
294
299
  searchPosition: b,
295
- fetchError: I,
300
+ fetchError: V,
296
301
  isLoading: r,
297
302
  isProcessing: c,
298
303
  isSelectAllEnabled: A ?? !1,
299
- flatOptionsLength: n.length,
300
- searchInputRef: q,
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
- L(e), Ae?.(e);
314
+ v(e), Ae?.(e);
310
315
  },
311
- onSearchKeyDown: rt,
312
- onSelectAll: Y
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
- !(H || g || V.length > 5e3) && "rounded-b-[12px]"
325
+ !(N || g || C.length > 5e3) && "rounded-b-[12px]"
321
326
  ),
322
327
  children: /* @__PURE__ */ u(
323
328
  ft,
324
329
  {
325
- fetchError: I,
326
- onRefetch: Ke,
327
- flatOptions: n,
330
+ fetchError: V,
331
+ onRefetch: Be,
332
+ flatOptions: o,
328
333
  isLoading: r,
329
334
  isProcessing: c,
330
335
  isMulti: t,
331
- isReadOnly: s,
336
+ isReadOnly: n,
332
337
  enableGroups: y,
333
- enableSubMenus: v,
334
- showSequence: N,
338
+ enableSubMenus: I,
339
+ showSequence: T,
335
340
  maxSelectableOptions: g,
336
- listRef: E,
337
- listboxId: G,
341
+ listRef: w,
342
+ listboxId: k,
338
343
  listboxLabel: d ? String(d) : R,
339
- rowVirtualizer: x,
344
+ rowVirtualizer: L,
340
345
  selectFieldId: p,
341
346
  id: m,
342
347
  highlightedIndex: a,
343
- activeSubmenu: Xe,
344
- setActiveSubmenu: _,
345
- internalValue: o,
346
- selectionMode: C.mode,
347
- selectionSet: C.set,
348
+ activeSubmenu: Qe,
349
+ setActiveSubmenu: $,
350
+ internalValue: s,
351
+ selectionMode: M.mode,
352
+ selectionSet: M.set,
348
353
  resolveOptionLabel: J,
349
- getSequenceForOption: ot,
354
+ getSequenceForOption: nt,
350
355
  renderOption: ye,
351
356
  onSelect: Q,
352
- getGroupStats: tt
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: H,
365
+ footerContent: N,
361
366
  maxSelectableOptions: g,
362
- optionCount: V.length
367
+ optionCount: C.length
363
368
  }
364
369
  )
365
370
  ]
@@ -370,7 +375,7 @@ const Et = (oe) => {
370
375
  }
371
376
  );
372
377
  };
373
- Et.displayName = "Select";
378
+ qt.displayName = "Select";
374
379
  export {
375
- Et as Select
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, component will use internal state only.
86
- * Use `onMenuClose` for batched updates when menu closes.
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(" "), a = (e) => typeof e == "object" && e !== null && "isAllSelected" in e && e.isAllSelected === !0 && "excludedValues" in e && Array.isArray(e.excludedValues), d = (e) => Array.isArray(e), f = (e, s = !1, i = !1) => {
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 l = n.pop();
5
- if (i && "options" in l) {
6
- const t = l.options;
7
- for (let r = t.length - 1; r >= 0; r--)
8
- n.push(t[r]);
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 l && Array.isArray(l.children)) {
12
- const t = l.children;
13
- for (let r = t.length - 1; r >= 0; r--)
14
- n.push(t[r]);
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(l);
17
+ u.push(t);
18
18
  }
19
19
  return u;
20
- }, v = (e, s, i) => {
20
+ }, x = (e, s, i) => {
21
21
  if (i) {
22
22
  const n = s;
23
- return a(n) ? !n.excludedValues.includes(e.value) : d(n) ? n.some((l) => l.value === e.value) : !1;
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, t = f(e).filter((c) => !c.isDisabled);
29
- if (t.length === 0) return !1;
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 a(n) ? r = t.filter(
31
+ return d(n) ? r = l.filter(
32
32
  (c) => !n.excludedValues.includes(c.value)
33
- ).length : d(n) && (r = t.filter(
33
+ ).length : a(n) && (r = l.filter(
34
34
  (c) => n.some((o) => o.value === c.value)
35
- ).length), r > 0 && r < t.length;
36
- }, x = (e, s, i, u, n) => {
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 t = u.indexOf(e.value);
41
- return t !== -1 ? t + 1 : void 0;
40
+ const l = u.indexOf(e.value);
41
+ return l !== -1 ? l + 1 : void 0;
42
42
  }
43
43
  if (!n) return;
44
- const l = n;
45
- if (a(l))
46
- return l.excludedValues.includes(e.value) ? void 0 : e.naturalIndex;
47
- if (d(l)) {
48
- const t = l.findIndex((r) => r.value === e.value);
49
- if (t !== -1)
50
- return t + 1;
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, l = f(e);
57
- return a(n) ? l.filter(
58
- (t) => !n.excludedValues.includes(t.value)
59
- ).length : d(n) ? l.filter(
60
- (t) => n.some((r) => r.value === t.value)
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
- x as getSequence,
69
- a as isInvertedSelection,
70
- d as isOptionArray,
71
- v as isSelected
78
+ v as getSequence,
79
+ d as isInvertedSelection,
80
+ a as isOptionArray,
81
+ x as isSelected
72
82
  };