impact-nova 1.7.30 → 1.7.31

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