impact-nova 1.7.39 → 1.7.41

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 (44) hide show
  1. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +58 -48
  2. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.d.ts +0 -2
  3. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +212 -218
  4. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +2 -2
  5. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +97 -127
  6. package/dist/components/ui/ag-grid-react/headers/components/date-filter-picker.d.ts +39 -0
  7. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +433 -299
  8. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.d.ts +33 -1
  9. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.js +60 -26
  10. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +11 -10
  11. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +284 -260
  12. package/dist/components/ui/ag-grid-react/index.js +24 -25
  13. package/dist/components/ui/data-table/column-indicator.d.ts +17 -0
  14. package/dist/components/ui/data-table/column-indicator.js +30 -0
  15. package/dist/components/ui/data-table/data-table-column-list.js +210 -154
  16. package/dist/components/ui/data-table/data-table.js +60 -59
  17. package/dist/components/ui/data-table/index.d.ts +3 -0
  18. package/dist/components/ui/data-table/index.js +34 -28
  19. package/dist/components/ui/data-table/indicator-legend.d.ts +8 -0
  20. package/dist/components/ui/data-table/indicator-legend.js +20 -0
  21. package/dist/components/ui/data-table/pin-switch.d.ts +30 -0
  22. package/dist/components/ui/data-table/pin-switch.js +75 -0
  23. package/dist/components/ui/date-picker/date-picker.js +65 -63
  24. package/dist/components/ui/date-picker/date-range-picker.js +77 -75
  25. package/dist/components/ui/nested-list/components/NestedListContent.js +7 -7
  26. package/dist/components/ui/nested-list/components/SortableItem.d.ts +10 -0
  27. package/dist/components/ui/nested-list/components/SortableItem.js +91 -83
  28. package/dist/components/ui/nested-list/nested-list.js +184 -178
  29. package/dist/components/ui/types/ag-grid.types.d.ts +16 -2
  30. package/dist/components/ui/types/date-picker.types.d.ts +4 -0
  31. package/dist/components/ui/types/nested-list.types.d.ts +12 -0
  32. package/dist/i18n/defaultMessages.d.ts +10 -0
  33. package/dist/i18n/defaultMessages.js +16 -8
  34. package/dist/i18n/locales/de.js +8 -0
  35. package/dist/i18n/locales/es.js +8 -0
  36. package/dist/i18n/locales/hi.js +8 -0
  37. package/dist/i18n/locales/kn.js +8 -0
  38. package/dist/icons/assets/archive.svg.js +5 -0
  39. package/dist/icons/index.d.ts +1 -0
  40. package/dist/icons/index.js +280 -278
  41. package/dist/impact-nova.css +1 -1
  42. package/dist/index.js +180 -174
  43. package/package.json +1 -1
  44. package/tailwind.config.js +16 -0
@@ -1,57 +1,58 @@
1
1
  import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
2
  import * as f from "react";
3
- import { X as ge } from "lucide-react";
4
- import { CalendarMonth as be, Info as G } from "../../../icons/index.js";
3
+ import { X as be } from "lucide-react";
4
+ import { CalendarMonth as ye, Info as J } from "../../../icons/index.js";
5
5
  import { format as p, isValid as g, parse as b } from "date-fns";
6
- import { cn as u, padValidDateString as E, maskDate as J } from "../../../lib/utils.js";
7
- import { Popover as ye, PopoverTrigger as we, PopoverContent as De } from "../popover.js";
8
- import { Calendar as ke } from "../calendar.js";
9
- import { Tooltip as Q, TooltipTrigger as U, TooltipContent as W } from "../tooltip.js";
10
- import { getDateFnsLocale as ve } from "../../../i18n/getDateFnsLocale.js";
11
- import { useImpactNovaI18n as Ne } from "../../../i18n/ImpactNovaI18nContext.js";
12
- const Se = f.forwardRef(
6
+ import { cn as u, padValidDateString as E, maskDate as Q } from "../../../lib/utils.js";
7
+ import { Popover as we, PopoverTrigger as De, PopoverContent as ke } from "../popover.js";
8
+ import { Calendar as ve } from "../calendar.js";
9
+ import { Tooltip as U, TooltipTrigger as W, TooltipContent as Y } from "../tooltip.js";
10
+ import { getDateFnsLocale as Ne } from "../../../i18n/getDateFnsLocale.js";
11
+ import { useImpactNovaI18n as Se } from "../../../i18n/ImpactNovaI18nContext.js";
12
+ const Pe = f.forwardRef(
13
13
  ({
14
14
  value: n,
15
15
  onChange: d,
16
16
  format: t = "MM/dd/yyyy",
17
- startPlaceholder: Y,
18
- endPlaceholder: Z,
19
- minDate: $,
20
- maxDate: _,
21
- startMonth: F,
22
- endMonth: ee,
17
+ startPlaceholder: Z,
18
+ endPlaceholder: $,
19
+ minDate: _,
20
+ maxDate: F,
21
+ startMonth: ee,
22
+ endMonth: te,
23
23
  showFooter: x = !0,
24
+ weekStartsOn: z,
24
25
  disabled: P,
25
- label: z,
26
+ label: B,
26
27
  helperText: V,
27
28
  helperTextPosition: j = "absolute",
28
- prefix: Pe,
29
- prefixClick: Re,
29
+ prefix: Re,
30
+ prefixClick: Ie,
30
31
  isError: v,
31
- size: B,
32
- required: te,
33
- className: ne,
34
- ...oe
35
- }, le) => {
36
- const { locale: O, t: R } = Ne(), o = f.useMemo(() => ve(O), [O]), T = Y ?? R("datePicker.startDate"), H = Z ?? R("datePicker.endDate"), X = f.useRef(null), se = f.useRef(null);
37
- f.useRef(null), f.useRef(null), f.useImperativeHandle(le, () => X.current);
38
- const [i, y] = f.useState(!1), C = f.useRef(!1), [I, w] = f.useState(n), [D, N] = f.useState(n?.from ? p(n.from, t, { locale: o }) : ""), [k, S] = f.useState(n?.to ? p(n.to, t, { locale: o }) : ""), [re, A] = f.useState(n?.from || /* @__PURE__ */ new Date());
32
+ size: O,
33
+ required: ne,
34
+ className: oe,
35
+ ...le
36
+ }, se) => {
37
+ const { locale: T, t: R } = Se(), o = f.useMemo(() => Ne(T), [T]), H = Z ?? R("datePicker.startDate"), X = $ ?? R("datePicker.endDate"), q = f.useRef(null), re = f.useRef(null);
38
+ f.useRef(null), f.useRef(null), f.useImperativeHandle(se, () => q.current);
39
+ const [i, y] = f.useState(!1), C = f.useRef(!1), [I, w] = f.useState(n), [D, N] = f.useState(n?.from ? p(n.from, t, { locale: o }) : ""), [k, S] = f.useState(n?.to ? p(n.to, t, { locale: o }) : ""), [ie, A] = f.useState(n?.from || /* @__PURE__ */ new Date());
39
40
  f.useEffect(() => {
40
41
  i || (N(n?.from ? p(n.from, t, { locale: o }) : ""), S(n?.to ? p(n.to, t, { locale: o }) : ""), w(n));
41
42
  }, [n, t, i, o]), f.useEffect(() => {
42
43
  i && (w(n), N(n?.from ? p(n.from, t, { locale: o }) : ""), S(n?.to ? p(n.to, t, { locale: o }) : ""), A(n?.from || /* @__PURE__ */ new Date()));
43
44
  }, [i, n, t, o]);
44
- const ie = (e) => {
45
+ const ce = (e) => {
45
46
  w(e), e?.from && N(p(e.from, t, { locale: o })), e?.to && S(p(e.to, t, { locale: o })), x || e?.from && e?.to && e.from.getTime() !== e.to.getTime() && (d?.(e), y(!1));
46
- }, ce = (e) => {
47
+ }, ae = (e) => {
47
48
  let s = e !== void 0 ? e : I;
48
49
  s?.from && !s.to && (s = { from: s.from, to: s.from }), d?.(s), y(!1);
49
50
  }, K = () => {
50
51
  w(n), N(n?.from ? p(n.from, t, { locale: o }) : ""), S(n?.to ? p(n.to, t, { locale: o }) : ""), y(!1);
51
52
  }, L = () => {
52
53
  w(void 0), N(""), S(""), d?.(void 0), x || y(!1);
53
- }, ae = (e) => {
54
- const s = e.target.value, c = J(s, t, D);
54
+ }, de = (e) => {
55
+ const s = e.target.value, c = Q(s, t, D);
55
56
  if (N(c), c === "") {
56
57
  const l = { from: void 0, to: I?.to };
57
58
  w(l), x || d?.(l);
@@ -62,8 +63,8 @@ const Se = f.forwardRef(
62
63
  const l = { from: r, to: I?.to };
63
64
  w(l), A(r), x || d?.(l);
64
65
  }
65
- }, de = (e) => {
66
- const s = e.target.value, c = J(s, t, k);
66
+ }, fe = (e) => {
67
+ const s = e.target.value, c = Q(s, t, k);
67
68
  if (S(c), c === "") {
68
69
  const l = { from: I?.from, to: void 0 };
69
70
  w(l), x || d?.(l);
@@ -74,14 +75,14 @@ const Se = f.forwardRef(
74
75
  const l = { from: I?.from, to: r };
75
76
  w(l), r && A(r), x || d?.(l);
76
77
  }
77
- }, q = () => {
78
+ }, G = () => {
78
79
  if (i) return;
79
80
  const e = E(D, t), s = E(k, t), c = b(e, t, /* @__PURE__ */ new Date(), { locale: o }), r = b(s, t, /* @__PURE__ */ new Date(), { locale: o }), l = g(c) && e.length === t.length, h = g(r) && s.length === t.length;
80
81
  D && !l ? N(n?.from ? p(n.from, t, { locale: o }) : "") : l && N(e), k && !h ? S(n?.to ? p(n.to, t, { locale: o }) : "") : h && S(s), l && h && !x ? d?.({ from: c, to: r }) : l && !x ? d?.({ from: c, to: n?.to }) : h && !x && d?.({ from: n?.from, to: r });
81
- }, fe = n?.from ? p(n.from, t, { locale: o }) : "", pe = n?.to ? p(n.to, t, { locale: o }) : "", me = D !== fe, ue = k !== pe, xe = D.length === t.length && !g(b(D, t, /* @__PURE__ */ new Date(), { locale: o })), he = k.length === t.length && !g(b(k, t, /* @__PURE__ */ new Date(), { locale: o }));
82
+ }, pe = n?.from ? p(n.from, t, { locale: o }) : "", me = n?.to ? p(n.to, t, { locale: o }) : "", ue = D !== pe, xe = k !== me, he = D.length === t.length && !g(b(D, t, /* @__PURE__ */ new Date(), { locale: o })), ge = k.length === t.length && !g(b(k, t, /* @__PURE__ */ new Date(), { locale: o }));
82
83
  return /* @__PURE__ */ m("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "date-range-picker", "data-disabled": P || void 0, children: [
83
84
  /* @__PURE__ */ m("div", { className: "flex flex-col gap-[6px]", children: [
84
- z && /* @__PURE__ */ m(
85
+ B && /* @__PURE__ */ m(
85
86
  "label",
86
87
  {
87
88
  className: u(
@@ -90,9 +91,9 @@ const Se = f.forwardRef(
90
91
  v && "text-destructive"
91
92
  ),
92
93
  children: [
93
- z,
94
+ B,
94
95
  " ",
95
- te && /* @__PURE__ */ a("span", { className: "text-destructive", children: "*" })
96
+ ne && /* @__PURE__ */ a("span", { className: "text-destructive", children: "*" })
96
97
  ]
97
98
  }
98
99
  ),
@@ -104,29 +105,29 @@ const Se = f.forwardRef(
104
105
  V && j === "absolute" && "relative"
105
106
  ),
106
107
  children: [
107
- /* @__PURE__ */ m(ye, { open: i, onOpenChange: y, children: [
108
- /* @__PURE__ */ a(we, { asChild: !0, children: /* @__PURE__ */ m(
108
+ /* @__PURE__ */ m(we, { open: i, onOpenChange: y, children: [
109
+ /* @__PURE__ */ a(De, { asChild: !0, children: /* @__PURE__ */ m(
109
110
  "div",
110
111
  {
111
112
  "data-state": i ? "open" : "closed",
112
113
  className: u(
113
114
  "flex w-full items-center justify-between gap-2 rounded-md border bg-canvas-elevated px-3 text-sm shadow-sm transition-colors hover:border-brand disabled:cursor-not-allowed disabled:bg-disabled-surface disabled:text-disabled-foreground disabled:border-stroke",
114
115
  v ? "border-destructive hover:border-destructive" : "border-field",
115
- B === "sm" ? "h-6" : B === "md" ? "h-[28px]" : "h-8",
116
+ O === "sm" ? "h-6" : O === "md" ? "h-[28px]" : "h-8",
116
117
  P && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
117
118
  "cursor-pointer",
118
- ne
119
+ oe
119
120
  ),
120
121
  children: [
121
122
  /* @__PURE__ */ m("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
122
123
  /* @__PURE__ */ a(
123
124
  "input",
124
125
  {
125
- ref: X,
126
+ ref: q,
126
127
  type: "text",
127
128
  value: D,
128
- onChange: ae,
129
- onBlur: q,
129
+ onChange: de,
130
+ onBlur: G,
130
131
  onClick: (e) => i && e.stopPropagation(),
131
132
  onKeyDown: (e) => {
132
133
  if (e.key === "Enter" && !i) {
@@ -136,25 +137,25 @@ const Se = f.forwardRef(
136
137
  }
137
138
  e.key === "ArrowDown" && !i && (e.preventDefault(), C.current = !0, y(!0)), e.key === "Escape" && i && (e.preventDefault(), K());
138
139
  },
139
- placeholder: i ? t : T,
140
+ placeholder: i ? t : H,
140
141
  disabled: !!P,
141
- "aria-label": T,
142
+ "aria-label": H,
142
143
  "data-field": "start",
143
144
  className: u(
144
145
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
145
- xe ? "text-destructive" : me ? "text-content-muted" : ""
146
+ he ? "text-destructive" : ue ? "text-content-muted" : ""
146
147
  ),
147
- ...oe
148
+ ...le
148
149
  }
149
150
  ),
150
151
  /* @__PURE__ */ a(
151
152
  "input",
152
153
  {
153
- ref: se,
154
+ ref: re,
154
155
  type: "text",
155
156
  value: k,
156
- onChange: de,
157
- onBlur: q,
157
+ onChange: fe,
158
+ onBlur: G,
158
159
  onClick: (e) => i && e.stopPropagation(),
159
160
  onKeyDown: (e) => {
160
161
  if (e.key === "Enter" && !i) {
@@ -164,20 +165,20 @@ const Se = f.forwardRef(
164
165
  }
165
166
  e.key === "ArrowDown" && !i && (e.preventDefault(), C.current = !0, y(!0)), e.key === "Escape" && i && (e.preventDefault(), K());
166
167
  },
167
- placeholder: i ? t : H,
168
+ placeholder: i ? t : X,
168
169
  disabled: !!P,
169
- "aria-label": H,
170
+ "aria-label": X,
170
171
  "data-field": "end",
171
172
  className: u(
172
173
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
173
- he ? "text-destructive" : ue ? "text-content-muted" : ""
174
+ ge ? "text-destructive" : xe ? "text-content-muted" : ""
174
175
  )
175
176
  }
176
177
  )
177
178
  ] }),
178
179
  /* @__PURE__ */ m("div", { className: "flex items-center gap-1 shrink-0", children: [
179
- n?.from && !P && /* @__PURE__ */ m(Q, { children: [
180
- /* @__PURE__ */ a(U, { asChild: !0, children: /* @__PURE__ */ a(
180
+ n?.from && !P && /* @__PURE__ */ m(U, { children: [
181
+ /* @__PURE__ */ a(W, { asChild: !0, children: /* @__PURE__ */ a(
181
182
  "button",
182
183
  {
183
184
  type: "button",
@@ -190,25 +191,25 @@ const Se = f.forwardRef(
190
191
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), L());
191
192
  },
192
193
  className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
193
- children: /* @__PURE__ */ a(ge, { className: "h-4 w-4 hover:text-content text-content-muted" })
194
+ children: /* @__PURE__ */ a(be, { className: "h-4 w-4 hover:text-content text-content-muted" })
194
195
  }
195
196
  ) }),
196
- /* @__PURE__ */ a(W, { variant: "tertiary", side: "top", children: R("calendar.clear") })
197
+ /* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: R("calendar.clear") })
197
198
  ] }),
198
- /* @__PURE__ */ m(Q, { children: [
199
- /* @__PURE__ */ a(U, { asChild: !0, children: /* @__PURE__ */ a("button", { type: "button", tabIndex: 0, "aria-label": R("datePicker.selectMonthRange"), onClick: (e) => {
199
+ /* @__PURE__ */ m(U, { children: [
200
+ /* @__PURE__ */ a(W, { asChild: !0, children: /* @__PURE__ */ a("button", { type: "button", tabIndex: 0, "aria-label": R("datePicker.selectMonthRange"), onClick: (e) => {
200
201
  e.stopPropagation(), y(!i);
201
202
  }, onKeyDown: (e) => {
202
203
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), C.current = !0, y(!i));
203
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ a(be, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
204
- /* @__PURE__ */ a(W, { variant: "tertiary", side: "top", children: R("datePicker.selectMonthRange") })
204
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ a(ye, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
205
+ /* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: R("datePicker.selectMonthRange") })
205
206
  ] })
206
207
  ] })
207
208
  ]
208
209
  }
209
210
  ) }),
210
211
  /* @__PURE__ */ a(
211
- De,
212
+ ke,
212
213
  {
213
214
  className: "w-auto p-0",
214
215
  align: "start",
@@ -216,21 +217,22 @@ const Se = f.forwardRef(
216
217
  C.current || e.preventDefault(), C.current = !1;
217
218
  },
218
219
  children: /* @__PURE__ */ a(
219
- ke,
220
+ ve,
220
221
  {
221
222
  mode: "range",
222
223
  selected: I,
223
- onSelect: ie,
224
- month: re,
224
+ onSelect: ce,
225
+ month: ie,
225
226
  onMonthChange: A,
226
- disabled: { before: $, after: _ },
227
- startMonth: F,
228
- endMonth: ee,
227
+ disabled: { before: _, after: F },
228
+ startMonth: ee,
229
+ endMonth: te,
229
230
  showFooter: x,
230
- onApply: ce,
231
+ onApply: ae,
231
232
  onCancel: K,
232
233
  onClear: L,
233
- captionLayout: "dropdown"
234
+ captionLayout: "dropdown",
235
+ ...z !== void 0 ? { weekStartsOn: z } : {}
234
236
  }
235
237
  )
236
238
  }
@@ -238,7 +240,7 @@ const Se = f.forwardRef(
238
240
  ] }),
239
241
  V && j === "absolute" && /* @__PURE__ */ m("div", { className: u("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", v && "text-destructive"), children: [
240
242
  /* @__PURE__ */ a(
241
- G,
243
+ J,
242
244
  {
243
245
  size: "xs",
244
246
  className: u(
@@ -264,7 +266,7 @@ const Se = f.forwardRef(
264
266
  ] }),
265
267
  V && j === "flow" && /* @__PURE__ */ m("div", { className: u("flex items-center gap-[6px]", v && "text-destructive"), children: [
266
268
  /* @__PURE__ */ a(
267
- G,
269
+ J,
268
270
  {
269
271
  size: "xs",
270
272
  className: u(
@@ -287,7 +289,7 @@ const Se = f.forwardRef(
287
289
  ] });
288
290
  }
289
291
  );
290
- Se.displayName = "DateRangePicker";
292
+ Pe.displayName = "DateRangePicker";
291
293
  export {
292
- Se as DateRangePicker
294
+ Pe as DateRangePicker
293
295
  };
@@ -30,8 +30,8 @@ const q = "0 -2px 0 0 var(--color-primary)", G = "0 2px 0 0 var(--color-primary)
30
30
  sensors: p,
31
31
  items: n,
32
32
  renderItem: L,
33
- onDragStart: y,
34
- onDragOver: w,
33
+ onDragStart: w,
34
+ onDragOver: y,
35
35
  onDragEnd: N,
36
36
  onDragCancel: C,
37
37
  activeId: o
@@ -80,11 +80,11 @@ const q = "0 -2px 0 0 var(--color-primary)", G = "0 2px 0 0 var(--color-primary)
80
80
  }
81
81
  return { overId: e, position: t };
82
82
  }, [h, o, x, n]), k = b.useMemo(() => n.map((e) => e.item.id), [n]), S = b.useMemo(() => o && n.find((e) => e.item.id === o) || null, [o, n]), A = f((e) => {
83
- y(e);
84
- }, [y]), B = f((e) => {
83
+ w(e);
84
+ }, [w]), B = f((e) => {
85
85
  const { active: t, over: r } = e;
86
- !r || t.id === r.id ? d(null) : d(r.id), w(e);
87
- }, [w]), F = f((e) => {
86
+ !r || t.id === r.id ? d(null) : d(r.id), y(e);
87
+ }, [y]), F = f((e) => {
88
88
  d(null), N(e);
89
89
  }, [N]), M = f(() => {
90
90
  d(null), C();
@@ -115,7 +115,7 @@ const q = "0 -2px 0 0 var(--color-primary)", G = "0 2px 0 0 var(--color-primary)
115
115
  "div",
116
116
  {
117
117
  ref: E,
118
- className: "flex-1 p-1 overflow-y-auto relative",
118
+ className: "flex-1 p-1 overflow-y-auto overflow-x-hidden relative",
119
119
  children: m ? /* @__PURE__ */ c(
120
120
  X,
121
121
  {
@@ -13,6 +13,16 @@ interface SortableItemProps {
13
13
  enableCollapse?: boolean;
14
14
  shouldBlink?: boolean;
15
15
  isDragDisabled?: boolean;
16
+ /** Render content right after the label (e.g., indicators) */
17
+ renderLabelExtras?: (item: NestedListItem, context: {
18
+ isLeaf: boolean;
19
+ level: number;
20
+ }) => React.ReactNode;
21
+ /** Render content at the end of the row (e.g., actions, switches) */
22
+ renderActions?: (item: NestedListItem, context: {
23
+ isLeaf: boolean;
24
+ level: number;
25
+ }) => React.ReactNode;
16
26
  }
17
27
  export declare const SortableItem: React.NamedExoticComponent<SortableItemProps>;
18
28
  export {};
@@ -1,133 +1,138 @@
1
- import { jsx as r, jsxs as p } from "react/jsx-runtime";
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
- import { cn as d } from "../../../../lib/utils.js";
8
- import { useImpactNovaI18n as f } from "../../../../i18n/ImpactNovaI18nContext.js";
9
- const H = (e, o) => {
10
- const t = "flex items-center gap-1 py-[3px] px-2 rounded transition-colors duration-150";
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
- }, P = ({ item: e, isAnyDragging: o }) => {
13
- const { t } = f(), n = !e.children || e.children.length === 0, {
14
- setNodeRef: c,
15
- isOver: s
16
- } = S({
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import S, { useMemo as j } from "react";
3
+ import { useSortable as z } from "@dnd-kit/sortable";
4
+ import { useDroppable as D } from "@dnd-kit/core";
5
+ import { Checkbox as H } from "../../checkbox.js";
6
+ import { ChevronRight as P, Drag as _ } from "../../../../icons/index.js";
7
+ import { cn as a } from "../../../../lib/utils.js";
8
+ import { useImpactNovaI18n as g } from "../../../../i18n/ImpactNovaI18nContext.js";
9
+ const $ = (e, r) => {
10
+ const n = "flex items-center gap-1 py-[3px] px-2 rounded transition-colors duration-150 min-w-0";
11
+ return e ? a(n, "opacity-40 bg-canvas-muted") : r ? a(n, "bg-feedback-error-surface border border-destructive animate-pulse") : a(n, "hover:bg-canvas-muted");
12
+ }, E = ({ item: e, isAnyDragging: r, renderActions: n }) => {
13
+ const { t: d } = g(), s = !e.children || e.children.length === 0, {
14
+ setNodeRef: p,
15
+ isOver: c
16
+ } = D({
17
17
  id: `droppable-${e.id}`,
18
18
  data: { sectionId: e.id },
19
- disabled: !n
19
+ disabled: !s
20
20
  });
21
- return /* @__PURE__ */ p("div", { ref: n ? c : void 0, children: [
22
- /* @__PURE__ */ p(
21
+ return /* @__PURE__ */ l("div", { ref: s ? p : void 0, children: [
22
+ /* @__PURE__ */ l(
23
23
  "div",
24
24
  {
25
- className: d(
26
- "flex items-center px-2 py-0 text-xs font-[500] leading-4 text-navigation-muted select-none",
25
+ className: a(
26
+ "flex items-center justify-between px-2 py-0 text-xs font-[500] leading-4 text-navigation-muted select-none",
27
27
  e.id === "root-scrollable" ? "mt-2 pt-2 pb-1 border-t border-solid border-stroke-subtle" : "mt-1 pb-1",
28
- s && o && n && "bg-canvas-tint rounded"
28
+ c && r && s && "bg-canvas-tint rounded"
29
29
  ),
30
30
  children: [
31
- e.label,
32
- s && o && n && /* @__PURE__ */ r("span", { className: "ml-2 text-brand text-[11px]", children: t("nestedList.dropHere") })
31
+ /* @__PURE__ */ l("div", { className: "flex items-center", children: [
32
+ e.label,
33
+ c && r && s && /* @__PURE__ */ t("span", { className: "ml-2 text-brand text-[11px]", children: d("nestedList.dropHere") })
34
+ ] }),
35
+ n?.(e, { isLeaf: !1, level: 0 })
33
36
  ]
34
37
  }
35
38
  ),
36
- n && /* @__PURE__ */ r(
39
+ s && /* @__PURE__ */ t(
37
40
  "div",
38
41
  {
39
- className: d(
42
+ className: a(
40
43
  "mx-2 my-1 rounded border-2 border-dashed min-h-[36px] flex items-center justify-center text-[11px] transition-colors",
41
- s && o ? "border-brand bg-canvas-tint text-brand" : "border-stroke-hairline text-content-empty"
44
+ c && r ? "border-brand bg-canvas-tint text-brand" : "border-stroke-hairline text-content-empty"
42
45
  ),
43
- children: t(s && o ? "nestedList.releaseToDrop" : "nestedList.dragHere")
46
+ children: d(c && r ? "nestedList.releaseToDrop" : "nestedList.dragHere")
44
47
  }
45
48
  )
46
49
  ] });
47
- }, _ = ({
50
+ }, O = ({
48
51
  item: e,
49
- level: o,
50
- isCollapsed: t,
51
- onToggle: n,
52
- onToggleCollapse: c,
53
- isAnyDragging: s = !1,
54
- isOver: $ = !1,
55
- isValidDrop: j = !1,
56
- enableDragDrop: x = !0,
57
- enableCollapse: b = !0,
58
- shouldBlink: v = !1,
59
- isDragDisabled: h = !1
52
+ level: r,
53
+ isCollapsed: n,
54
+ onToggle: d,
55
+ onToggleCollapse: s,
56
+ isAnyDragging: p = !1,
57
+ isOver: c = !1,
58
+ isValidDrop: M = !1,
59
+ enableDragDrop: k = !0,
60
+ enableCollapse: h = !0,
61
+ shouldBlink: N = !1,
62
+ isDragDisabled: u = !1,
63
+ renderLabelExtras: y,
64
+ renderActions: f
60
65
  }) => {
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,
66
+ const { t: m } = g(), x = e.category === "structure", i = e.children && e.children.length > 0, v = !i && e.category !== "structure", C = j(() => !e.children || e.children.length === 0 || e.children.every((b) => b.checked) ? !1 : e.children.some((b) => b.checked), [e.children]), {
67
+ attributes: I,
68
+ listeners: w,
69
+ setNodeRef: L,
70
+ isDragging: R,
66
71
  // transform and transition intentionally not applied — we use a custom
67
72
  // FloatingClone and manual insertion line instead of dnd-kit's built-in animations.
68
- transform: E,
69
- transition: O
70
- } = R({
73
+ transform: F,
74
+ transition: T
75
+ } = z({
71
76
  id: e.id,
72
77
  data: {
73
- level: o,
78
+ level: r,
74
79
  hasChildren: i,
75
- isExpanded: !t
80
+ isExpanded: !n
76
81
  },
77
- disabled: m || e.disabled || h
82
+ disabled: x || e.disabled || u
78
83
  });
79
- return m ? /* @__PURE__ */ r(P, { item: e, isAnyDragging: s }) : /* @__PURE__ */ r(
84
+ return x ? /* @__PURE__ */ t(E, { item: e, isAnyDragging: p, renderActions: f }) : /* @__PURE__ */ t(
80
85
  "div",
81
86
  {
82
- ref: y,
87
+ ref: L,
83
88
  className: "relative",
84
89
  "data-item-id": e.id,
85
- "data-level": o,
90
+ "data-level": r,
86
91
  "data-checked": e.checked,
87
92
  "data-disabled": e.disabled,
88
- "data-collapsed": t,
89
- children: /* @__PURE__ */ p(
93
+ "data-collapsed": n,
94
+ children: /* @__PURE__ */ l(
90
95
  "div",
91
96
  {
92
- className: H(C, v),
97
+ className: $(R, N),
93
98
  style: {
94
- paddingLeft: `${8 + o * 20}px`
99
+ paddingLeft: `${8 + r * 20}px`
95
100
  },
96
101
  children: [
97
- b && i && /* @__PURE__ */ r(
102
+ h && i && /* @__PURE__ */ t(
98
103
  "button",
99
104
  {
100
105
  type: "button",
101
- onClick: (a) => {
102
- a.stopPropagation(), c(e.id);
106
+ onClick: (o) => {
107
+ o.stopPropagation(), s(e.id);
103
108
  },
104
- onMouseDown: (a) => a.stopPropagation(),
109
+ onMouseDown: (o) => o.stopPropagation(),
105
110
  className: "p-1 hover:bg-muted rounded-full transition-colors flex items-center text-content-icon hover:text-brand",
106
- "aria-label": u(t ? "nestedList.expand" : "nestedList.collapse"),
107
- children: /* @__PURE__ */ r(
108
- z,
111
+ "aria-label": m(n ? "nestedList.expand" : "nestedList.collapse"),
112
+ children: /* @__PURE__ */ t(
113
+ P,
109
114
  {
110
115
  size: "16px",
111
- className: d("transition-transform", !t && "rotate-90")
116
+ className: a("transition-transform", !n && "rotate-90")
112
117
  }
113
118
  )
114
119
  }
115
120
  ),
116
- (!b || !i) && /* @__PURE__ */ r("div", { className: "w-6" }),
117
- /* @__PURE__ */ r(
118
- w,
121
+ (!h || !i) && /* @__PURE__ */ t("div", { className: "w-6" }),
122
+ /* @__PURE__ */ t(
123
+ H,
119
124
  {
120
125
  id: `checkbox-${e.id}`,
121
- checked: g ? "indeterminate" : e.checked,
122
- onCheckedChange: () => n(e.id),
126
+ checked: C ? "indeterminate" : e.checked,
127
+ onCheckedChange: () => d(e.id),
123
128
  disabled: e.disabled
124
129
  }
125
130
  ),
126
- x && !h && /* @__PURE__ */ r(
131
+ k && !u && /* @__PURE__ */ t(
127
132
  "div",
128
133
  {
129
- ...k,
130
- ...N,
134
+ ...I,
135
+ ...w,
131
136
  className: "cursor-grab active:cursor-grabbing p-0 hover:bg-muted rounded flex items-center",
132
137
  style: {
133
138
  pointerEvents: "auto",
@@ -135,26 +140,29 @@ const H = (e, o) => {
135
140
  zIndex: 30,
136
141
  touchAction: "none"
137
142
  },
138
- onPointerDown: (a) => {
139
- a.stopPropagation();
143
+ onPointerDown: (o) => {
144
+ o.stopPropagation();
140
145
  },
141
- children: /* @__PURE__ */ r(D, { size: "14px", className: "text-content-icon" })
146
+ children: /* @__PURE__ */ t(_, { size: "14px", className: "text-content-icon" })
142
147
  }
143
148
  ),
144
- /* @__PURE__ */ r(
149
+ /* @__PURE__ */ t(
145
150
  "label",
146
151
  {
147
152
  htmlFor: `checkbox-${e.id}`,
148
- className: "flex-1 text-[13px] text-content capitalize ml-1 cursor-pointer select-none",
149
- children: e.label
153
+ className: "text-[13px] text-content capitalize ml-1 cursor-pointer select-none min-w-0",
154
+ children: /* @__PURE__ */ t("span", { className: "break-words", children: e.label })
150
155
  }
151
- )
156
+ ),
157
+ y?.(e, { isLeaf: v, level: r }),
158
+ /* @__PURE__ */ t("div", { className: "flex-1" }),
159
+ f?.(e, { isLeaf: v, level: r })
152
160
  ]
153
161
  }
154
162
  )
155
163
  }
156
164
  );
157
- }, Q = I.memo(_);
165
+ }, X = S.memo(O);
158
166
  export {
159
- Q as SortableItem
167
+ X as SortableItem
160
168
  };