impact-nova 1.7.29 → 1.7.30

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.
@@ -1,30 +1,30 @@
1
- import { jsx as g, jsxs as se } from "react/jsx-runtime";
2
- import re, { useMemo as A, useCallback as D } from "react";
3
- import { SortableItem as He } from "./components/SortableItem.js";
1
+ import { jsx as L, jsxs as ne } from "react/jsx-runtime";
2
+ import F, { useMemo as D, useCallback as T } from "react";
3
+ import { SortableItem as je } from "./components/SortableItem.js";
4
4
  import { SelectionMode as b } from "../types/nested-list.types.js";
5
- import { useNestedListDragDrop as We } from "./hooks/useNestedListDragDrop.js";
6
- import { useNestedListSelectAll as je } from "./hooks/useNestedListSelectAll.js";
7
- import { useNestedListState as Fe } from "./hooks/useNestedListState.js";
8
- import { useNestedListHandlers as Je } from "./hooks/useNestedListHandlers.js";
9
- import { NestedListHeader as qe } from "./components/NestedListHeader.js";
10
- import { NestedListCategoryFilters as Ke } from "./components/NestedListCategoryFilters.js";
11
- import { NestedListContent as Qe } from "./components/NestedListContent.js";
12
- import { NestedListApplyDiscardButtons as Xe } from "./components/NestedListApplyDiscardButtons.js";
13
- import { cn as Ye } from "../../../lib/utils.js";
14
- import { useImpactNovaI18n as Ze } from "../../../i18n/ImpactNovaI18nContext.js";
15
- const ne = (d, t) => {
5
+ import { useNestedListDragDrop as Fe } from "./hooks/useNestedListDragDrop.js";
6
+ import { useNestedListSelectAll as Je } from "./hooks/useNestedListSelectAll.js";
7
+ import { useNestedListState as qe } from "./hooks/useNestedListState.js";
8
+ import { useNestedListHandlers as Ke } from "./hooks/useNestedListHandlers.js";
9
+ import { NestedListHeader as Qe } from "./components/NestedListHeader.js";
10
+ import { NestedListCategoryFilters as Xe } from "./components/NestedListCategoryFilters.js";
11
+ import { NestedListContent as Ye } from "./components/NestedListContent.js";
12
+ import { NestedListApplyDiscardButtons as Ze } from "./components/NestedListApplyDiscardButtons.js";
13
+ import { cn as $e } from "../../../lib/utils.js";
14
+ import { useImpactNovaI18n as Me } from "../../../i18n/ImpactNovaI18nContext.js";
15
+ const le = (d, t) => {
16
16
  if (!t || typeof t != "string") return d;
17
17
  const c = t.toLowerCase(), o = [];
18
18
  return d.forEach((s) => {
19
- const l = s.label.toLowerCase().includes(c), f = s.children ? ne(s.children, t) : void 0;
19
+ const l = s.label.toLowerCase().includes(c), f = s.children ? le(s.children, t) : void 0;
20
20
  (l || f && f.length > 0) && o.push({
21
21
  ...s,
22
22
  children: f || s.children
23
23
  });
24
24
  }), o;
25
- }, le = (d) => d.map((t) => {
25
+ }, ce = (d) => d.map((t) => {
26
26
  if (t.children && t.children.length > 0) {
27
- const c = le(t.children), o = c.every((s) => s.checked);
27
+ const c = ce(t.children), o = c.every((s) => s.checked);
28
28
  return {
29
29
  ...t,
30
30
  checked: o,
@@ -32,7 +32,7 @@ const ne = (d, t) => {
32
32
  };
33
33
  }
34
34
  return t;
35
- }), $e = (d, t) => {
35
+ }), Ge = (d, t) => {
36
36
  const c = /* @__PURE__ */ new Set(), o = (s) => {
37
37
  s.forEach((l) => {
38
38
  const f = t ? t(l) : l.category;
@@ -40,24 +40,24 @@ const ne = (d, t) => {
40
40
  });
41
41
  };
42
42
  return o(d), Array.from(c).sort();
43
- }, ce = (d, t, c) => {
43
+ }, oe = (d, t, c) => {
44
44
  if (t.size === 0) return d;
45
45
  const o = [];
46
46
  return d.forEach((s) => {
47
- const l = c ? c(s) : s.category, f = l && t.has(l), m = s.children ? ce(s.children, t, c) : void 0;
47
+ const l = c ? c(s) : s.category, f = l && t.has(l), m = s.children ? oe(s.children, t, c) : void 0;
48
48
  (f || m && m.length > 0) && o.push({
49
49
  ...s,
50
50
  children: m
51
51
  });
52
52
  }), o;
53
- }, oe = (d, t, c, o = 0) => {
53
+ }, de = (d, t, c, o = 0) => {
54
54
  const s = [];
55
55
  return d.forEach((l) => {
56
56
  s.push({ item: l, level: o }), !t[l.id] && l.children && l.children.length > 0 && l.id !== c && s.push(
57
- ...oe(l.children, t, c, o + 1)
57
+ ...de(l.children, t, c, o + 1)
58
58
  );
59
59
  }), s;
60
- }, ut = ({
60
+ }, pt = ({
61
61
  items: d,
62
62
  onChange: t,
63
63
  onSubmit: c,
@@ -66,71 +66,79 @@ const ne = (d, t) => {
66
66
  onDragEnd: l,
67
67
  enableSearch: f = !0,
68
68
  enableDragDrop: m = !0,
69
- enableSelectAll: de = !0,
70
- enableGroupBy: L = !1,
71
- getCategory: S,
72
- searchPlaceholder: ie,
73
- className: ae = "",
74
- groupLabel: he,
69
+ enableSelectAll: ie = !0,
70
+ enableGroupBy: k = !1,
71
+ getCategory: I,
72
+ searchPlaceholder: ae,
73
+ className: he = "",
74
+ groupLabel: ue,
75
75
  enableApplyDiscard: p = !1,
76
- enableCollapse: F = !0,
77
- enableGlobalCollapse: ue = !0,
78
- submitButtonLabel: fe,
79
- cancelButtonLabel: pe,
80
- selectionMode: I = b.CASCADE_DOWN
76
+ enableCollapse: J = !0,
77
+ enableGlobalCollapse: fe = !0,
78
+ submitButtonLabel: pe,
79
+ cancelButtonLabel: me,
80
+ selectionMode: v = b.CASCADE_DOWN,
81
+ initialCollapsedItems: Ne,
82
+ onCollapseChange: q
81
83
  }) => {
82
- const { t: T } = Ze(), me = ie ?? T("nestedList.searchPlaceholder"), Ce = fe ?? T("nestedList.apply"), Ne = pe ?? T("nestedList.reset"), {
84
+ const { t: w } = Me(), Se = ae ?? w("nestedList.searchPlaceholder"), Ce = pe ?? w("nestedList.apply"), Ie = me ?? w("nestedList.reset"), {
83
85
  items: a,
84
- setItems: v,
85
- savedItems: w,
86
- setSavedItems: J,
87
- isUserChangeRef: P,
88
- searchText: x,
89
- setSearchText: Se,
90
- collapsedItems: z,
91
- setCollapsedItems: Ie,
86
+ setItems: g,
87
+ savedItems: P,
88
+ setSavedItems: K,
89
+ isUserChangeRef: x,
90
+ searchText: z,
91
+ setSearchText: ve,
92
+ collapsedItems: N,
93
+ setCollapsedItems: ge,
92
94
  isListCollapsed: B,
93
- setIsListCollapsed: ve,
94
- activeId: C,
95
+ setIsListCollapsed: Le,
96
+ activeId: S,
95
97
  setActiveId: U,
96
98
  setOverId: _,
97
99
  selectedCategories: O,
98
- setSelectedCategories: ge,
99
- itemsToBlink: q,
100
+ setSelectedCategories: ke,
101
+ itemsToBlink: Q,
100
102
  setItemsToBlink: y,
101
103
  // Normalized state helpers (for optimized operations)
102
- isNormalized: Le,
103
- normalizedState: ke,
104
- batchUpdateItems: Ee
105
- } = Fe({
104
+ isNormalized: Ee,
105
+ normalizedState: Ae,
106
+ batchUpdateItems: De
107
+ } = qe({
106
108
  initialItems: d,
107
109
  enableApplyDiscard: p,
108
110
  // Enable normalized state for large datasets (can be made configurable via props)
109
- enableNormalizedState: d.length > 1e3
110
- }), [R, K] = re.useState(0), [V, Ae] = re.useState(0), {
111
- sensors: De,
112
- handleDragEnd: Te,
113
- isValidDrop: Q
114
- } = We({
111
+ enableNormalizedState: d.length > 1e3,
112
+ initialCollapsedItems: Ne
113
+ });
114
+ F.useEffect(() => {
115
+ q?.(N);
116
+ }, [N, q]);
117
+ const [R, X] = F.useState(0), [V, Te] = F.useState(0), {
118
+ sensors: we,
119
+ handleDragEnd: Pe,
120
+ isValidDrop: Y
121
+ } = Fe({
115
122
  items: a,
116
- onDragEnd: l
117
- }), we = A(
118
- () => L ? $e(a, S) : [],
119
- [a, L, S]
120
- ), N = A(() => {
123
+ onDragEnd: l,
124
+ collapsedItems: N
125
+ }), xe = D(
126
+ () => k ? Ge(a, I) : [],
127
+ [a, k, I]
128
+ ), C = D(() => {
121
129
  let e = a;
122
- return L && O.size > 0 && (e = ce(e, O, S)), x && (e = ne(e, x)), e;
123
- }, [a, x, L, O, S]), Pe = A(
124
- () => oe(N, z, C),
125
- [N, z, C]
126
- ), { allChecked: k, someChecked: xe } = A(() => {
130
+ return k && O.size > 0 && (e = oe(e, O, I)), z && (e = le(e, z)), e;
131
+ }, [a, z, k, O, I]), ze = D(
132
+ () => de(C, N, S),
133
+ [C, N, S]
134
+ ), { allChecked: E, someChecked: Be } = D(() => {
127
135
  let e = !0, r = !1;
128
136
  const n = (u) => {
129
137
  for (const h of u)
130
138
  if (h.children && h.children.length > 0 ? n(h.children) : h.checked ? r = !0 : e = !1, r && !e) return;
131
139
  };
132
- return n(N), { allChecked: e && r, someChecked: r };
133
- }, [N]), ze = xe && !k, H = (e, r) => {
140
+ return n(C), { allChecked: e && r, someChecked: r };
141
+ }, [C]), Oe = Be && !E, H = (e, r) => {
134
142
  for (const n of e) {
135
143
  if (n.id === r) return n;
136
144
  if (n.children) {
@@ -139,69 +147,69 @@ const ne = (d, t) => {
139
147
  }
140
148
  }
141
149
  return null;
142
- }, Be = D(
150
+ }, Re = T(
143
151
  (e, r) => {
144
- if (I === b.INDEPENDENT)
152
+ if (v === b.INDEPENDENT)
145
153
  return e;
146
154
  const n = (h, i) => h.id === i ? !0 : h.children ? h.children.some(
147
- (E) => n(E, i)
155
+ (A) => n(A, i)
148
156
  ) : !1, u = (h) => h.map((i) => {
149
157
  if (i.id === r)
150
158
  return i;
151
159
  if (i.children && n(i, r)) {
152
- const E = u(i.children);
160
+ const A = u(i.children);
153
161
  let W;
154
- return I === b.CASCADE_UP_DOWN ? W = E.some((j) => j.checked) : W = E.every((j) => j.checked), {
162
+ return v === b.CASCADE_UP_DOWN ? W = A.some((j) => j.checked) : W = A.every((j) => j.checked), {
155
163
  ...i,
156
164
  checked: W,
157
- children: E
165
+ children: A
158
166
  };
159
167
  }
160
168
  return i;
161
169
  });
162
170
  return u(e);
163
171
  },
164
- [I]
165
- ), X = (e) => {
172
+ [v]
173
+ ), Z = (e) => {
166
174
  const r = [];
167
175
  return e.forEach((n) => {
168
- n.children && n.children.length > 0 && (r.push(n.id), r.push(...X(n.children)));
176
+ n.children && n.children.length > 0 && (r.push(n.id), r.push(...Z(n.children)));
169
177
  }), r;
170
178
  }, {
171
- handleToggle: Y,
172
- handleToggleCollapse: Z,
173
- handleCollapseAll: Oe,
174
- handleToggleCategory: Re
175
- } = Je({
176
- setItems: v,
179
+ handleToggle: $,
180
+ handleToggleCollapse: M,
181
+ handleCollapseAll: Ve,
182
+ handleToggleCategory: be
183
+ } = Ke({
184
+ setItems: g,
177
185
  findItemById: H,
178
- updateParentsUpward: Be,
186
+ updateParentsUpward: Re,
179
187
  onChange: (e) => {
180
- K((r) => r + 1), t(e);
188
+ X((r) => r + 1), t(e);
181
189
  },
182
190
  onItemToggle: s,
183
- getCategory: S,
184
- setCollapsedItems: Ie,
185
- setIsListCollapsed: ve,
186
- setSelectedCategories: ge,
187
- isUserChangeRef: P,
188
- selectionMode: I,
191
+ getCategory: I,
192
+ setCollapsedItems: ge,
193
+ setIsListCollapsed: Le,
194
+ setSelectedCategories: ke,
195
+ isUserChangeRef: x,
196
+ selectionMode: v,
189
197
  // Pass normalized state helpers for optimized operations
190
- isNormalized: Le,
191
- normalizedState: ke,
192
- batchUpdateItems: Ee
198
+ isNormalized: Ee,
199
+ normalizedState: Ae,
200
+ batchUpdateItems: De
193
201
  }), {
194
- collectVisibleItemIds: $,
195
- findItemsNotSelected: M,
196
- collectVisibleItemsForCallback: G,
197
- updateVisibleItems: ee
198
- } = je({
202
+ collectVisibleItemIds: G,
203
+ findItemsNotSelected: ee,
204
+ collectVisibleItemsForCallback: te,
205
+ updateVisibleItems: se
206
+ } = Je({
199
207
  findItemById: H,
200
- getCategory: S
201
- }), Ve = D(() => {
202
- P.current = !0, v((e) => {
203
- const r = $(N), n = M(
204
- N,
208
+ getCategory: I
209
+ }), Ue = T(() => {
210
+ x.current = !0, g((e) => {
211
+ const r = G(C), n = ee(
212
+ C,
205
213
  e,
206
214
  r
207
215
  );
@@ -209,119 +217,119 @@ const ne = (d, t) => {
209
217
  const i = new Set(n);
210
218
  y(i), setTimeout(() => y(/* @__PURE__ */ new Set()), 600);
211
219
  }
212
- const u = ee(
220
+ const u = se(
213
221
  e,
214
222
  r,
215
- !k
216
- ), h = I === b.INDEPENDENT ? u : le(u);
223
+ !E
224
+ ), h = v === b.INDEPENDENT ? u : ce(u);
217
225
  if (t(h), s) {
218
- const i = G(
226
+ const i = te(
219
227
  e,
220
228
  r,
221
- !k
229
+ !E
222
230
  );
223
231
  s(i);
224
232
  }
225
233
  return h;
226
234
  });
227
235
  }, [
228
- k,
236
+ E,
229
237
  t,
230
238
  s,
231
- N,
232
- $,
233
- M,
239
+ C,
234
240
  G,
235
241
  ee,
236
- P,
237
- v,
242
+ te,
243
+ se,
244
+ x,
245
+ g,
238
246
  y,
239
- I
240
- ]), be = D(
247
+ v
248
+ ]), _e = T(
241
249
  (e, r) => {
242
- const n = C ? Q(C, e.id) : !1, u = q.has(e.id);
243
- return /* @__PURE__ */ g(
244
- He,
250
+ const n = S ? Y(S, e.id) : !1, u = Q.has(e.id);
251
+ return /* @__PURE__ */ L(
252
+ je,
245
253
  {
246
254
  item: e,
247
255
  level: r,
248
- isCollapsed: z[e.id] || !1,
249
- onToggle: Y,
250
- onToggleCollapse: Z,
251
- isAnyDragging: C !== null,
256
+ isCollapsed: N[e.id] || !1,
257
+ onToggle: $,
258
+ onToggleCollapse: M,
259
+ isAnyDragging: S !== null,
252
260
  isValidDrop: n,
253
261
  enableDragDrop: m,
254
- enableCollapse: F,
262
+ enableCollapse: J,
255
263
  shouldBlink: u
256
264
  },
257
265
  e.id
258
266
  );
259
267
  },
260
268
  [
261
- z,
269
+ N,
270
+ $,
271
+ M,
272
+ S,
262
273
  Y,
263
- Z,
264
- C,
265
- Q,
266
274
  m,
267
- q,
268
- F
275
+ Q,
276
+ J
269
277
  ]
270
- ), Ue = X(a).length > 0, te = A(() => p ? a.length > 1e3 ? R !== V : JSON.stringify(a) !== JSON.stringify(w) : !1, [p, a, w, R, V]), _e = D(() => {
271
- p && (J(a), Ae(R), c?.(a));
272
- }, [p, a, c, J, R]), ye = D(() => {
273
- p && (v(w), K(V), o?.());
274
- }, [p, w, o, v, V]);
275
- return /* @__PURE__ */ se(
278
+ ), ye = Z(a).length > 0, re = D(() => p ? a.length > 1e3 ? R !== V : JSON.stringify(a) !== JSON.stringify(P) : !1, [p, a, P, R, V]), He = T(() => {
279
+ p && (K(a), Te(R), c?.(a));
280
+ }, [p, a, c, K, R]), We = T(() => {
281
+ p && (g(P), X(V), o?.());
282
+ }, [p, P, o, g, V]);
283
+ return /* @__PURE__ */ ne(
276
284
  "div",
277
285
  {
278
- className: Ye("flex flex-col", ae),
286
+ className: $e("flex flex-col", he),
279
287
  "data-component": "nested-list",
280
- "data-has-changes": te ? "" : void 0,
288
+ "data-has-changes": re ? "" : void 0,
281
289
  "data-list-collapsed": B ? "" : void 0,
282
290
  children: [
283
- /* @__PURE__ */ se("div", { className: "flex-shrink-0", children: [
284
- /* @__PURE__ */ g(
285
- qe,
291
+ /* @__PURE__ */ ne("div", { className: "flex-shrink-0", children: [
292
+ /* @__PURE__ */ L(
293
+ Qe,
286
294
  {
287
- hasItemsWithChildren: Ue,
295
+ hasItemsWithChildren: ye,
288
296
  isListCollapsed: B,
289
- onCollapseAll: Oe,
297
+ onCollapseAll: Ve,
290
298
  enableSearch: f,
291
- enableSelectAll: de,
292
- groupLabel: he,
293
- allChecked: k,
294
- isIndeterminate: ze,
295
- onSelectAll: Ve,
296
- searchText: x,
299
+ enableSelectAll: ie,
300
+ groupLabel: ue,
301
+ allChecked: E,
302
+ isIndeterminate: Oe,
303
+ onSelectAll: Ue,
304
+ searchText: z,
297
305
  onSearchChange: (e) => {
298
- Se(e.target.value);
306
+ ve(e.target.value);
299
307
  },
300
- searchPlaceholder: me,
301
- selectAllLabel: T("nestedList.selectAll"),
302
- enableCollapse: ue
308
+ searchPlaceholder: Se,
309
+ selectAllLabel: w("nestedList.selectAll"),
310
+ enableCollapse: fe
303
311
  }
304
312
  ),
305
- /* @__PURE__ */ g(
306
- Ke,
313
+ /* @__PURE__ */ L(
314
+ Xe,
307
315
  {
308
316
  isListCollapsed: B,
309
- enableGroupBy: L,
310
- categories: we,
317
+ enableGroupBy: k,
318
+ categories: xe,
311
319
  selectedCategories: O,
312
- onToggleCategory: Re
320
+ onToggleCategory: be
313
321
  }
314
322
  )
315
323
  ] }),
316
- /* @__PURE__ */ g("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ g(
317
- Qe,
324
+ /* @__PURE__ */ L("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ L(
325
+ Ye,
318
326
  {
319
327
  isListCollapsed: B,
320
328
  enableDragDrop: m,
321
- sensors: De,
322
- items: Pe,
323
- renderItem: be,
324
- activeId: C,
329
+ sensors: we,
330
+ items: ze,
331
+ renderItem: _e,
332
+ activeId: S,
325
333
  onDragStart: (e) => {
326
334
  U(e.active.id);
327
335
  },
@@ -329,9 +337,9 @@ const ne = (d, t) => {
329
337
  _(e.over?.id);
330
338
  },
331
339
  onDragEnd: (e) => {
332
- U(null), _(null), P.current = !0, Te(e, (r) => {
340
+ U(null), _(null), x.current = !0, Pe(e, (r) => {
333
341
  const n = r(a);
334
- v(n), t(n);
342
+ g(n), t(n);
335
343
  });
336
344
  },
337
345
  onDragCancel: () => {
@@ -339,14 +347,14 @@ const ne = (d, t) => {
339
347
  }
340
348
  }
341
349
  ) }),
342
- /* @__PURE__ */ g(
343
- Xe,
350
+ /* @__PURE__ */ L(
351
+ Ze,
344
352
  {
345
353
  enableApplyDiscard: p,
346
- hasChanges: te,
347
- onDiscard: ye,
348
- onApply: _e,
349
- cancelButtonLabel: Ne,
354
+ hasChanges: re,
355
+ onDiscard: We,
356
+ onApply: He,
357
+ cancelButtonLabel: Ie,
350
358
  submitButtonLabel: Ce
351
359
  }
352
360
  )
@@ -355,5 +363,5 @@ const ne = (d, t) => {
355
363
  );
356
364
  };
357
365
  export {
358
- ut as NestedList
366
+ pt as NestedList
359
367
  };
@@ -56,6 +56,8 @@ export interface NestedListProps {
56
56
  enableGlobalCollapse?: boolean;
57
57
  selectionMode?: SelectionMode;
58
58
  getCategory?: (item: NestedListItem) => string | undefined;
59
+ initialCollapsedItems?: Record<string, boolean>;
60
+ onCollapseChange?: (collapsedItems: Record<string, boolean>) => void;
59
61
  searchPlaceholder?: string;
60
62
  className?: string;
61
63
  groupLabel?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impact-nova",
3
- "version": "1.7.29",
3
+ "version": "1.7.30",
4
4
  "description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Built-in internationalization (i18n) and comprehensive UI component library for scalable, accessible, and performant applications.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",