impact-nova 1.7.29 → 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,6 +1,16 @@
1
+ import { MonthSelection } from '../../../calendar';
1
2
  /**
2
- * Date utilities for AG Grid filtering
3
+ * Convert a MonthSelection to an AG Grid inRange date filter range.
4
+ * Returns { dateFrom: 'YYYY-MM-01', dateTo: 'YYYY-MM-lastDay' }.
3
5
  */
6
+ export declare function serializeMonth(month: MonthSelection): {
7
+ dateFrom: string;
8
+ dateTo: string;
9
+ };
10
+ /**
11
+ * Reconstruct a MonthSelection from a YYYY-MM-DD date string.
12
+ */
13
+ export declare function deserializeMonth(dateStr: string | null): MonthSelection | null;
4
14
  /**
5
15
  * Standardize date serialization for AG Grid filter model
6
16
  * Returns YYYY-MM-DD string
@@ -1,38 +1,52 @@
1
1
  function o(t) {
2
- if (!t) return null;
3
- const n = t.getFullYear(), r = String(t.getMonth() + 1).padStart(2, "0"), e = String(t.getDate()).padStart(2, "0");
4
- return `${n}-${r}-${e}`;
2
+ const n = t.year, e = t.month + 1, r = new Date(n, e, 0).getDate(), a = String(e).padStart(2, "0");
3
+ return {
4
+ dateFrom: `${n}-${a}-01`,
5
+ dateTo: `${n}-${a}-${String(r).padStart(2, "0")}`
6
+ };
7
+ }
8
+ function s(t) {
9
+ if (!t || typeof t != "string") return null;
10
+ const n = t.split(" ")[0].split("T")[0], [e, r] = n.split("-").map(Number);
11
+ return isNaN(e) || isNaN(r) ? null : { year: e, month: r - 1 };
5
12
  }
6
13
  function i(t) {
14
+ if (!t) return null;
15
+ const n = t.getFullYear(), e = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
16
+ return `${n}-${e}-${r}`;
17
+ }
18
+ function u(t) {
7
19
  if (!t || typeof t != "string") return null;
8
- const n = t.split(" ")[0].split("T")[0], [r, e, a] = n.split("-").map(Number);
9
- return isNaN(r) || isNaN(e) || isNaN(a) ? null : new Date(r, e - 1, a);
20
+ const n = t.split(" ")[0].split("T")[0], [e, r, a] = n.split("-").map(Number);
21
+ return isNaN(e) || isNaN(r) || isNaN(a) ? null : new Date(e, r - 1, a);
10
22
  }
11
- function s() {
12
- return o(/* @__PURE__ */ new Date());
23
+ function l() {
24
+ return i(/* @__PURE__ */ new Date());
13
25
  }
14
- function u() {
26
+ function c() {
15
27
  const t = /* @__PURE__ */ new Date();
16
- return t.setDate(t.getDate() - 1), o(t);
28
+ return t.setDate(t.getDate() - 1), i(t);
17
29
  }
18
- function c(t) {
30
+ function g(t) {
19
31
  return {
20
32
  from: `${t}-01-01`,
21
33
  to: `${t}-12-31`
22
34
  };
23
35
  }
24
- function g(t, n) {
25
- const r = new Date(n, t, 0).getDate(), e = String(t).padStart(2, "0");
36
+ function f(t, n) {
37
+ const e = new Date(n, t, 0).getDate(), r = String(t).padStart(2, "0");
26
38
  return {
27
- from: `${n}-${e}-01`,
28
- to: `${n}-${e}-${r}`
39
+ from: `${n}-${r}-01`,
40
+ to: `${n}-${r}-${e}`
29
41
  };
30
42
  }
31
43
  export {
32
- i as deserializeDate,
33
- g as getMonthRange,
34
- s as getTodayStr,
35
- c as getYearRange,
36
- u as getYesterdayStr,
37
- o as serializeDate
44
+ u as deserializeDate,
45
+ s as deserializeMonth,
46
+ f as getMonthRange,
47
+ l as getTodayStr,
48
+ g as getYearRange,
49
+ c as getYesterdayStr,
50
+ i as serializeDate,
51
+ o as serializeMonth
38
52
  };
@@ -13,13 +13,13 @@ import { AG_GRID_VALUE_FORMATTERS as ye } from "./value-formatters.js";
13
13
  /* empty css */
14
14
  const be = re(() => import("./headers/advanced-filter/advanced-filter-dialog.js"));
15
15
  ie.registerModules([se, ce, ue]);
16
- const x = "", I = "", H = (s) => {
16
+ const x = "", T = "", H = (s) => {
17
17
  if (!s) return;
18
18
  const r = s.cellRendererParams?.splits;
19
19
  if (Array.isArray(r) && r.length > 0) return r;
20
20
  const l = s.cellEditorParams?.splits;
21
21
  if (Array.isArray(l) && l.length > 0) return l;
22
- }, _ = (s, r) => {
22
+ }, V = (s, r) => {
23
23
  const l = [];
24
24
  for (const g of r) {
25
25
  const f = g?.field?.split(".").pop();
@@ -44,7 +44,7 @@ const x = "", I = "", H = (s) => {
44
44
  l.push("");
45
45
  }
46
46
  return l;
47
- }, V = (s) => {
47
+ }, _ = (s) => {
48
48
  if (typeof navigator < "u" && navigator.clipboard?.writeText) {
49
49
  navigator.clipboard.writeText(s).catch(() => K(s));
50
50
  return;
@@ -69,7 +69,7 @@ function De({
69
69
  onGridReady: a,
70
70
  ...u
71
71
  }) {
72
- const c = b(null), h = b(null), [F, w] = j(null), [P, E] = j(!1), [O, D] = j(null), [W, L] = j(!1), M = b(null), T = b(null), S = b(null), U = v(() => [], []), $ = C(() => ({
72
+ const c = b(null), h = b(null), [F, w] = j(null), [I, E] = j(!1), [O, D] = j(null), [W, L] = j(!1), M = b(null), P = b(null), S = b(null), U = v(() => [], []), $ = C(() => ({
73
73
  numericColumn: {
74
74
  cellClass: "ag-right-aligned-cell",
75
75
  headerClass: "ag-right-aligned-header",
@@ -113,10 +113,10 @@ function De({
113
113
  c.current.setFilterModel(t), c.current.onFilterChanged();
114
114
  },
115
115
  openMenu: (e, t, o = "column") => {
116
- M.current = e, T.current = t, S.current = o, L(!0);
116
+ M.current = e, P.current = t, S.current = o, L(!0);
117
117
  },
118
118
  closeMenu: () => {
119
- M.current = null, T.current = null, S.current = null, L(!1);
119
+ M.current = null, P.current = null, S.current = null, L(!1);
120
120
  },
121
121
  // Getters read from refs - O(1) per header, no memory allocation
122
122
  get activeMenuColumnId() {
@@ -189,12 +189,12 @@ function De({
189
189
  if (t == null || typeof t != "object") return t;
190
190
  const o = H(e.column?.getColDef());
191
191
  if (o && o.length > 0) {
192
- const n = _(t, o);
192
+ const n = V(t, o);
193
193
  if (o.length === 1) {
194
194
  const d = o[0]?.field?.split(".").pop(), y = d ? t[d] : void 0;
195
195
  return y && typeof y == "object" && "value" in y ? y.value ?? "" : n[0];
196
196
  }
197
- return I + n.join(x);
197
+ return T + n.join(x);
198
198
  }
199
199
  const i = Object.entries(t).map(([, n]) => n && typeof n == "object" && "value" in n ? n.value : typeof n != "object" && typeof n < "u" ? n : null).filter((n) => n != null);
200
200
  return i.length === 0 ? "" : i.length === 1 ? i[0] : i.join(x);
@@ -211,8 +211,8 @@ function De({
211
211
  return e.value;
212
212
  }, []), Y = v((e) => {
213
213
  const t = e?.data ?? "";
214
- if (!t.includes(x) && !t.includes(I)) {
215
- V(t);
214
+ if (!t.includes(x) && !t.includes(T)) {
215
+ _(t);
216
216
  return;
217
217
  }
218
218
  const o = [], i = t.split(`
@@ -223,7 +223,7 @@ function De({
223
223
  o.push("");
224
224
  continue;
225
225
  }
226
- const k = d.split(" ").map((p) => p.startsWith(I) ? { isSplit: !0, slots: p.slice(1).split(x) } : { isSplit: !1, slots: p.split(x) }), N = Math.max(1, ...k.map((p) => p.slots.length));
226
+ const k = d.split(" ").map((p) => p.startsWith(T) ? { isSplit: !0, slots: p.slice(1).split(x) } : { isSplit: !1, slots: p.split(x) }), N = Math.max(1, ...k.map((p) => p.slots.length));
227
227
  if (N === 1) {
228
228
  o.push(k.map((p) => p.slots[0] ?? "").join(" "));
229
229
  continue;
@@ -233,7 +233,7 @@ function De({
233
233
  o.push(te.join(" "));
234
234
  }
235
235
  }
236
- V(o.join(`
236
+ _(o.join(`
237
237
  `));
238
238
  }, []), R = v((e) => {
239
239
  const t = e.value;
@@ -241,7 +241,7 @@ function De({
241
241
  if (typeof t != "object") return String(t);
242
242
  const o = H(e.column?.getColDef());
243
243
  if (o && o.length > 0) {
244
- const n = _(t, o);
244
+ const n = V(t, o);
245
245
  return o.length === 1 ? n[0] : n.join(`
246
246
  `);
247
247
  }
@@ -293,7 +293,7 @@ function De({
293
293
  /* @__PURE__ */ m(
294
294
  xe,
295
295
  {
296
- isOpen: P,
296
+ isOpen: I,
297
297
  columnId: O,
298
298
  gridApi: F,
299
299
  onClose: A.closeAdvancedFilter,
@@ -306,7 +306,7 @@ function De({
306
306
  isOpen: W,
307
307
  columnId: M.current,
308
308
  gridApi: F,
309
- anchor: T.current,
309
+ anchor: P.current,
310
310
  variant: S.current,
311
311
  onClose: A.closeMenu
312
312
  }
@@ -335,6 +335,7 @@ function xe({
335
335
  columnType: E,
336
336
  selectOptions: c?.selectOptions,
337
337
  isMultiSelect: c?.isMultiSelect,
338
+ datePickerVariant: c?.datePickerVariant,
338
339
  initialModel: O,
339
340
  api: l
340
341
  }
@@ -1,87 +1,87 @@
1
- import { jsx as R } from "react/jsx-runtime";
2
- import { useState as N, useRef as I, useCallback as C, useEffect as A } from "react";
3
- import { useDataTable as Q } from "./data-table-context.js";
4
- import { NestedList as X } from "../nested-list/nested-list.js";
5
- import { SelectionMode as Y } from "../types/nested-list.types.js";
6
- import { mergePartialOrderedColumnState as Z } from "./data-table-column-state.js";
7
- import { useImpactNovaI18n as ee } from "../../../i18n/ImpactNovaI18nContext.js";
8
- const ue = ({
9
- enableApplyDiscard: T = !1,
10
- showSearch: F = !0,
11
- showSelectAll: q = !0,
12
- showCollapse: j = !0
1
+ import { jsx as x } from "react/jsx-runtime";
2
+ import { useState as N, useRef as C, useCallback as b, useEffect as F } from "react";
3
+ import { useDataTable as X } from "./data-table-context.js";
4
+ import { NestedList as Y } from "../nested-list/nested-list.js";
5
+ import { SelectionMode as Z } from "../types/nested-list.types.js";
6
+ import { mergePartialOrderedColumnState as ee } from "./data-table-column-state.js";
7
+ import { useImpactNovaI18n as te } from "../../../i18n/ImpactNovaI18nContext.js";
8
+ const de = ({
9
+ enableApplyDiscard: v = !1,
10
+ showSearch: q = !0,
11
+ showSelectAll: j = !0,
12
+ showCollapse: K = !0
13
13
  }) => {
14
- const { gridApi: l } = Q(), { t: p } = ee(), [K, w] = N([]), [V, W] = N(!1), f = I(!1), v = I(null), b = I(0), [z, O] = N(!1), B = I(/* @__PURE__ */ new Map()), g = C(() => {
14
+ const { gridApi: l } = X(), { t: p } = te(), [V, w] = N([]), [W, B] = N(!1), f = C(!1), T = C(null), y = C(0), z = C({}), [O, P] = N(!1), L = C(/* @__PURE__ */ new Map()), g = b(() => {
15
15
  if (!l || f.current) return;
16
- const o = l.getColumnState(), s = new Map(o.map((t) => [t.colId, t]));
17
- B.current = s;
18
- const c = l.getColumns() || [], i = new Map(c.map((t) => [t.getColId(), t])), r = [], e = [], k = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), H = (t, a) => {
19
- const n = t.getGroupId(), u = `${n}::${a === r ? "f" : "s"}`, d = k.get(u);
16
+ const r = l.getColumnState(), s = new Map(r.map((t) => [t.colId, t]));
17
+ L.current = s;
18
+ const c = l.getColumns() || [], i = new Map(c.map((t) => [t.getColId(), t])), n = [], e = [], k = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), J = (t, a) => {
19
+ const o = t.getGroupId(), u = `${o}::${a === n ? "f" : "s"}`, d = k.get(u);
20
20
  if (d && d.list === a && a[a.length - 1] === d.node)
21
21
  return d.node;
22
22
  const m = D.get(u) || 0;
23
23
  D.set(u, m + 1);
24
- const S = t.getColGroupDef(), h = a === r ? "f" : "s", x = {
25
- id: m === 0 ? `${n}__${h}` : `${n}__${h}__${m}`,
26
- label: S?.headerName || n,
24
+ const I = t.getColGroupDef(), h = a === n ? "f" : "s", R = {
25
+ id: m === 0 ? `${o}__${h}` : `${o}__${h}__${m}`,
26
+ label: I?.headerName || o,
27
27
  checked: !0,
28
28
  children: [],
29
29
  category: "group"
30
30
  };
31
- return a.push(x), k.set(u, { list: a, node: x }), x;
31
+ return a.push(R), k.set(u, { list: a, node: R }), R;
32
32
  };
33
- let E = 0, _ = 0, G = 0, $ = 0;
34
- o.forEach((t) => {
33
+ let E = 0, $ = 0, G = 0, A = 0;
34
+ r.forEach((t) => {
35
35
  const a = i.get(t.colId);
36
36
  if (!a) return;
37
- let n = l.getDisplayNameForColumn(a, "header");
38
- if (n === "") return;
39
- if (n == null) {
37
+ let o = l.getDisplayNameForColumn(a, "header");
38
+ if (o === "") return;
39
+ if (o == null) {
40
40
  const h = a.getColDef();
41
41
  if (h.headerName === "") return;
42
- n = h.headerName || h.field || t.colId;
42
+ o = h.headerName || h.field || t.colId;
43
43
  }
44
- if (!n || n.trim() === "")
44
+ if (!o || o.trim() === "")
45
45
  return;
46
46
  const u = !t.hide, d = {
47
47
  id: t.colId,
48
- label: n,
48
+ label: o,
49
49
  checked: u
50
50
  };
51
- t.pinned ? (E++, u && _++) : (G++, u && $++);
52
- const m = t.pinned ? r : e, S = a.getOriginalParent();
53
- S?.getColGroupDef()?.children ? H(S, m).children.push(d) : m.push(d);
51
+ t.pinned ? (E++, u && $++) : (G++, u && A++);
52
+ const m = t.pinned ? n : e, I = a.getOriginalParent();
53
+ I?.getColGroupDef()?.children ? J(I, m).children.push(d) : m.push(d);
54
54
  });
55
55
  const M = (t) => {
56
56
  let a = t.length > 0;
57
- for (const n of t)
58
- n.children && (n.checked = M(n.children)), n.checked || (a = !1);
57
+ for (const o of t)
58
+ o.children && (o.checked = M(o.children)), o.checked || (a = !1);
59
59
  return a;
60
60
  };
61
- M(r), M(e);
62
- const J = [
61
+ M(n), M(e);
62
+ const Q = [
63
63
  {
64
64
  id: "root-frozen",
65
65
  label: p("dataTable.frozenColumns"),
66
- checked: E > 0 && _ === E,
67
- children: r,
66
+ checked: E > 0 && $ === E,
67
+ children: n,
68
68
  category: "structure",
69
69
  isDragDisabled: !0
70
70
  },
71
71
  {
72
72
  id: "root-scrollable",
73
73
  label: p("dataTable.scrollableColumns"),
74
- checked: G > 0 && $ === G,
74
+ checked: G > 0 && A === G,
75
75
  children: e,
76
76
  category: "structure",
77
77
  isDragDisabled: !0
78
78
  }
79
79
  ];
80
- w(J), W(!0);
80
+ w(Q), B(!0);
81
81
  }, [l, p]);
82
- A(() => {
82
+ F(() => {
83
83
  if (!l) return;
84
- const o = setTimeout(() => g(), 0), s = [
84
+ const r = setTimeout(() => g(), 0), s = [
85
85
  "columnVisible",
86
86
  "columnPinned",
87
87
  "columnMoved",
@@ -99,23 +99,23 @@ const ue = ({
99
99
  const i = () => {
100
100
  c && clearTimeout(c), c = setTimeout(() => {
101
101
  c = null;
102
- const r = !f.current;
103
- f.current = !1, g(), r && O((e) => !e);
102
+ const n = !f.current;
103
+ f.current = !1, g(), n && P((e) => !e);
104
104
  }, 150);
105
105
  };
106
- return l.isDestroyed() || s.forEach((r) => l.addEventListener(r, i)), () => {
107
- clearTimeout(o), c && clearTimeout(c), l.isDestroyed() || s.forEach((r) => l.removeEventListener(r, i));
106
+ return l.isDestroyed() || s.forEach((n) => l.addEventListener(n, i)), () => {
107
+ clearTimeout(r), c && clearTimeout(c), l.isDestroyed() || s.forEach((n) => l.removeEventListener(n, i));
108
108
  };
109
- }, [l, g]), A(() => {
110
- if (b.current === 0) return;
111
- const o = requestAnimationFrame(() => {
112
- const s = v.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
113
- s && (s.scrollTop = b.current, b.current = 0);
109
+ }, [l, g]), F(() => {
110
+ if (y.current === 0) return;
111
+ const r = requestAnimationFrame(() => {
112
+ const s = T.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
113
+ s && (s.scrollTop = y.current, y.current = 0);
114
114
  });
115
- return () => cancelAnimationFrame(o);
116
- }, [z]);
117
- const P = C((o) => {
118
- const s = [], c = (i, r) => {
115
+ return () => cancelAnimationFrame(r);
116
+ }, [O]);
117
+ const _ = b((r) => {
118
+ const s = [], c = (i, n) => {
119
119
  i.forEach((e) => {
120
120
  if (e.id === "root-frozen") {
121
121
  e.children && c(e.children, "left");
@@ -125,57 +125,61 @@ const ue = ({
125
125
  e.children && c(e.children, null);
126
126
  return;
127
127
  }
128
- e.category === "group" || e.children && e.children.length > 0 ? e.children && c(e.children, r) : l?.getColumn(e.id) && s.push({
128
+ e.category === "group" || e.children && e.children.length > 0 ? e.children && c(e.children, n) : l?.getColumn(e.id) && s.push({
129
129
  colId: e.id,
130
- pinned: r,
130
+ pinned: n,
131
131
  hide: !e.checked
132
132
  });
133
133
  });
134
134
  };
135
- return c(o, null), s;
136
- }, [l]), y = C((o) => {
135
+ return c(r, null), s;
136
+ }, [l]), S = b((r) => {
137
137
  if (!l) return;
138
138
  f.current = !0;
139
- const s = P(o);
139
+ const s = _(r);
140
140
  if (s.length === 0) {
141
141
  setTimeout(() => {
142
142
  f.current = !1;
143
143
  }, 300);
144
144
  return;
145
145
  }
146
- const c = l.getColumnState(), i = Z(c, s);
146
+ const c = l.getColumnState(), i = ee(c, s);
147
147
  l.applyColumnState({
148
148
  state: i,
149
149
  applyOrder: !0
150
150
  }), setTimeout(() => {
151
151
  f.current = !1;
152
- const r = v.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
153
- r && (b.current = r.scrollTop), g(), O((e) => !e);
152
+ const n = T.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
153
+ n && (y.current = n.scrollTop), g(), P((e) => !e);
154
154
  }, 300);
155
- }, [l, P, g]), L = C((o) => {
156
- y(o);
157
- }, [y]), U = C((o) => {
158
- T || y(o), w(o);
159
- }, [T, y]);
160
- return V ? /* @__PURE__ */ R("div", { ref: v, className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ R(
161
- X,
155
+ }, [l, _, g]), U = b((r) => {
156
+ S(r);
157
+ }, [S]), H = b((r) => {
158
+ v || S(r), w(r);
159
+ }, [v, S]);
160
+ return W ? /* @__PURE__ */ x("div", { ref: T, className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ x(
161
+ Y,
162
162
  {
163
- items: K,
164
- onChange: U,
165
- onSubmit: L,
166
- enableApplyDiscard: T,
167
- enableSearch: F,
168
- enableSelectAll: q,
163
+ items: V,
164
+ onChange: H,
165
+ onSubmit: U,
166
+ enableApplyDiscard: v,
167
+ enableSearch: q,
168
+ enableSelectAll: j,
169
169
  enableDragDrop: !0,
170
170
  enableCollapse: !0,
171
- enableGlobalCollapse: j,
172
- selectionMode: Y.CASCADE_DOWN,
171
+ enableGlobalCollapse: K,
172
+ selectionMode: Z.CASCADE_DOWN,
173
173
  searchPlaceholder: p("dataTable.searchColumnsPlaceholder"),
174
- className: "h-full"
174
+ className: "h-full",
175
+ initialCollapsedItems: z.current,
176
+ onCollapseChange: (r) => {
177
+ z.current = r;
178
+ }
175
179
  },
176
- z ? "sync-a" : "sync-b"
177
- ) }) : /* @__PURE__ */ R("div", { className: "p-4 text-[13px] text-content-placeholder", children: p("dataTable.loadingColumns") });
180
+ O ? "sync-a" : "sync-b"
181
+ ) }) : /* @__PURE__ */ x("div", { className: "p-4 text-[13px] text-content-placeholder", children: p("dataTable.loadingColumns") });
178
182
  };
179
183
  export {
180
- ue as DataTableColumnList
184
+ de as DataTableColumnList
181
185
  };
@@ -12,6 +12,7 @@ interface SortableItemProps {
12
12
  enableDragDrop?: boolean;
13
13
  enableCollapse?: boolean;
14
14
  shouldBlink?: boolean;
15
+ isDragDisabled?: boolean;
15
16
  }
16
17
  export declare const SortableItem: React.NamedExoticComponent<SortableItemProps>;
17
18
  export {};
@@ -1,19 +1,19 @@
1
1
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
- import C, { useMemo as I } from "react";
3
- import { useSortable as D } from "@dnd-kit/sortable";
4
- import { useDroppable as L } from "@dnd-kit/core";
5
- import { Checkbox as R } from "../../checkbox.js";
6
- import { ChevronRight as S, Drag as w } from "../../../../icons/index.js";
2
+ import I, { useMemo as L } from "react";
3
+ import { useSortable as R } from "@dnd-kit/sortable";
4
+ import { useDroppable as S } from "@dnd-kit/core";
5
+ import { Checkbox as w } from "../../checkbox.js";
6
+ import { ChevronRight as z, Drag as D } from "../../../../icons/index.js";
7
7
  import { cn as d } from "../../../../lib/utils.js";
8
- import { useImpactNovaI18n as m } from "../../../../i18n/ImpactNovaI18nContext.js";
9
- const z = (e, o) => {
8
+ import { useImpactNovaI18n as f } from "../../../../i18n/ImpactNovaI18nContext.js";
9
+ const H = (e, o) => {
10
10
  const t = "flex items-center gap-1 py-[3px] px-2 rounded transition-colors duration-150";
11
11
  return e ? d(t, "opacity-40 bg-canvas-muted") : o ? d(t, "bg-feedback-error-surface border border-destructive animate-pulse") : d(t, "hover:bg-canvas-muted");
12
- }, H = ({ item: e, isAnyDragging: o }) => {
13
- const { t } = m(), n = !e.children || e.children.length === 0, {
12
+ }, P = ({ item: e, isAnyDragging: o }) => {
13
+ const { t } = f(), n = !e.children || e.children.length === 0, {
14
14
  setNodeRef: c,
15
15
  isOver: s
16
- } = L({
16
+ } = S({
17
17
  id: `droppable-${e.id}`,
18
18
  data: { sectionId: e.id },
19
19
  disabled: !n
@@ -44,41 +44,42 @@ const z = (e, o) => {
44
44
  }
45
45
  )
46
46
  ] });
47
- }, P = ({
47
+ }, _ = ({
48
48
  item: e,
49
49
  level: o,
50
50
  isCollapsed: t,
51
51
  onToggle: n,
52
52
  onToggleCollapse: c,
53
53
  isAnyDragging: s = !1,
54
- isOver: _ = !1,
55
- isValidDrop: $ = !1,
56
- enableDragDrop: f = !0,
54
+ isOver: $ = !1,
55
+ isValidDrop: j = !1,
56
+ enableDragDrop: x = !0,
57
57
  enableCollapse: b = !0,
58
- shouldBlink: x = !1
58
+ shouldBlink: v = !1,
59
+ isDragDisabled: h = !1
59
60
  }) => {
60
- const { t: h } = m(), u = e.category === "structure", i = e.children && e.children.length > 0, v = I(() => !e.children || e.children.length === 0 || e.children.every((l) => l.checked) ? !1 : e.children.some((l) => l.checked), [e.children]), {
61
- attributes: g,
62
- listeners: k,
63
- setNodeRef: N,
64
- isDragging: y,
61
+ const { t: u } = f(), m = e.category === "structure", i = e.children && e.children.length > 0, g = L(() => !e.children || e.children.length === 0 || e.children.every((l) => l.checked) ? !1 : e.children.some((l) => l.checked), [e.children]), {
62
+ attributes: k,
63
+ listeners: N,
64
+ setNodeRef: y,
65
+ isDragging: C,
65
66
  // transform and transition intentionally not applied — we use a custom
66
67
  // FloatingClone and manual insertion line instead of dnd-kit's built-in animations.
67
- transform: j,
68
- transition: E
69
- } = D({
68
+ transform: E,
69
+ transition: O
70
+ } = R({
70
71
  id: e.id,
71
72
  data: {
72
73
  level: o,
73
74
  hasChildren: i,
74
75
  isExpanded: !t
75
76
  },
76
- disabled: u || e.disabled
77
+ disabled: m || e.disabled || h
77
78
  });
78
- return u ? /* @__PURE__ */ r(H, { item: e, isAnyDragging: s }) : /* @__PURE__ */ r(
79
+ return m ? /* @__PURE__ */ r(P, { item: e, isAnyDragging: s }) : /* @__PURE__ */ r(
79
80
  "div",
80
81
  {
81
- ref: N,
82
+ ref: y,
82
83
  className: "relative",
83
84
  "data-item-id": e.id,
84
85
  "data-level": o,
@@ -88,7 +89,7 @@ const z = (e, o) => {
88
89
  children: /* @__PURE__ */ p(
89
90
  "div",
90
91
  {
91
- className: z(y, x),
92
+ className: H(C, v),
92
93
  style: {
93
94
  paddingLeft: `${8 + o * 20}px`
94
95
  },
@@ -102,9 +103,9 @@ const z = (e, o) => {
102
103
  },
103
104
  onMouseDown: (a) => a.stopPropagation(),
104
105
  className: "p-1 hover:bg-muted rounded-full transition-colors flex items-center text-content-icon hover:text-brand",
105
- "aria-label": h(t ? "nestedList.expand" : "nestedList.collapse"),
106
+ "aria-label": u(t ? "nestedList.expand" : "nestedList.collapse"),
106
107
  children: /* @__PURE__ */ r(
107
- S,
108
+ z,
108
109
  {
109
110
  size: "16px",
110
111
  className: d("transition-transform", !t && "rotate-90")
@@ -114,19 +115,19 @@ const z = (e, o) => {
114
115
  ),
115
116
  (!b || !i) && /* @__PURE__ */ r("div", { className: "w-6" }),
116
117
  /* @__PURE__ */ r(
117
- R,
118
+ w,
118
119
  {
119
120
  id: `checkbox-${e.id}`,
120
- checked: v ? "indeterminate" : e.checked,
121
+ checked: g ? "indeterminate" : e.checked,
121
122
  onCheckedChange: () => n(e.id),
122
123
  disabled: e.disabled
123
124
  }
124
125
  ),
125
- f && /* @__PURE__ */ r(
126
+ x && !h && /* @__PURE__ */ r(
126
127
  "div",
127
128
  {
128
- ...g,
129
129
  ...k,
130
+ ...N,
130
131
  className: "cursor-grab active:cursor-grabbing p-0 hover:bg-muted rounded flex items-center",
131
132
  style: {
132
133
  pointerEvents: "auto",
@@ -137,7 +138,7 @@ const z = (e, o) => {
137
138
  onPointerDown: (a) => {
138
139
  a.stopPropagation();
139
140
  },
140
- children: /* @__PURE__ */ r(w, { size: "14px", className: "text-content-icon" })
141
+ children: /* @__PURE__ */ r(D, { size: "14px", className: "text-content-icon" })
141
142
  }
142
143
  ),
143
144
  /* @__PURE__ */ r(
@@ -153,7 +154,7 @@ const z = (e, o) => {
153
154
  )
154
155
  }
155
156
  );
156
- }, K = C.memo(P);
157
+ }, Q = I.memo(_);
157
158
  export {
158
- K as SortableItem
159
+ Q as SortableItem
159
160
  };
@@ -15,8 +15,10 @@ export declare const customCollisionDetection: CollisionDetection;
15
15
  interface UseNestedListDragDropProps {
16
16
  items: NestedListItem[];
17
17
  onDragEnd?: (activeId: string, overId: string | null) => void;
18
+ collapsedItems?: Record<string, boolean>;
19
+ canDrag?: (item: NestedListItem, level: number) => boolean;
18
20
  }
19
- export declare const useNestedListDragDrop: ({ items, onDragEnd, }: UseNestedListDragDropProps) => {
21
+ export declare const useNestedListDragDrop: ({ items, onDragEnd, collapsedItems, canDrag, }: UseNestedListDragDropProps) => {
20
22
  sensors: import('@dnd-kit/core').SensorDescriptor<import('@dnd-kit/core').SensorOptions>[];
21
23
  handleDragEnd: (event: DragEndEvent, setItems: (updater: (prevItems: NestedListItem[]) => NestedListItem[]) => void) => void;
22
24
  isValidDrop: (activeItemId: string | null, overItemId: string | null) => boolean;