impact-nova 0.1.13 → 1.1.0

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 (120) hide show
  1. package/dist/components/layout/dashboard-layout.d.ts +21 -6
  2. package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +32 -33
  3. package/dist/components/ui/accordion.js +25 -23
  4. package/dist/components/ui/ag-grid-react/cell-renderers/date-display-renderer.js +32 -21
  5. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.d.ts +3 -5
  6. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +57 -55
  7. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +5 -0
  8. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +50 -52
  9. package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +1 -1
  10. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +34 -34
  11. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +8 -11
  12. package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +17 -17
  13. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +3 -3
  14. package/dist/components/ui/alert-dialog.js +45 -40
  15. package/dist/components/ui/alert.d.ts +21 -4
  16. package/dist/components/ui/alert.js +45 -25
  17. package/dist/components/ui/avatar.js +19 -16
  18. package/dist/components/ui/badge.js +8 -1
  19. package/dist/components/ui/breadcrumb.js +1 -0
  20. package/dist/components/ui/button-group.d.ts +1 -1
  21. package/dist/components/ui/button-group.js +27 -32
  22. package/dist/components/ui/button-variants.d.ts +1 -1
  23. package/dist/components/ui/button.d.ts +11 -0
  24. package/dist/components/ui/button.js +11 -9
  25. package/dist/components/ui/calendar.d.ts +14 -2
  26. package/dist/components/ui/calendar.js +443 -376
  27. package/dist/components/ui/card.js +7 -6
  28. package/dist/components/ui/checkbox.js +64 -48
  29. package/dist/components/ui/chips.d.ts +1 -0
  30. package/dist/components/ui/chips.js +27 -19
  31. package/dist/components/ui/data-table/data-table-column-list.d.ts +4 -1
  32. package/dist/components/ui/data-table/data-table-column-list.js +58 -54
  33. package/dist/components/ui/data-table/data-table-sheet.d.ts +1 -1
  34. package/dist/components/ui/data-table/data-table-sheet.js +43 -40
  35. package/dist/components/ui/data-table/data-table-view-options.js +17 -17
  36. package/dist/components/ui/data-table/data-table.js +21 -20
  37. package/dist/components/ui/date-picker/date-picker.js +93 -93
  38. package/dist/components/ui/date-picker/date-range-picker.js +142 -133
  39. package/dist/components/ui/date-picker/month-picker.js +96 -93
  40. package/dist/components/ui/date-picker/month-range-picker.js +144 -134
  41. package/dist/components/ui/date-picker/multi-date-picker.js +43 -45
  42. package/dist/components/ui/date-picker/multi-month-picker.js +37 -39
  43. package/dist/components/ui/date-picker/multi-week-picker.js +56 -46
  44. package/dist/components/ui/date-picker/week-picker.js +119 -109
  45. package/dist/components/ui/date-picker/week-range-picker.js +170 -147
  46. package/dist/components/ui/dialog.js +15 -6
  47. package/dist/components/ui/drawer.js +16 -13
  48. package/dist/components/ui/dropdown-menu.js +4 -2
  49. package/dist/components/ui/dynamic-layout.d.ts +2 -2
  50. package/dist/components/ui/dynamic-layout.js +18 -15
  51. package/dist/components/ui/empty-container.js +69 -64
  52. package/dist/components/ui/file-upload.js +113 -106
  53. package/dist/components/ui/filter-panel/filter-panel.js +49 -46
  54. package/dist/components/ui/filter-strip/filter-strip.js +41 -37
  55. package/dist/components/ui/header.js +26 -25
  56. package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +43 -40
  57. package/dist/components/ui/hover-card.js +6 -5
  58. package/dist/components/ui/input.d.ts +1 -1
  59. package/dist/components/ui/input.js +79 -68
  60. package/dist/components/ui/loader.d.ts +1 -0
  61. package/dist/components/ui/loader.js +23 -13
  62. package/dist/components/ui/nested-list/components/NestedListContent.d.ts +1 -3
  63. package/dist/components/ui/nested-list/components/NestedListContent.js +16 -15
  64. package/dist/components/ui/nested-list/components/SortableItem.js +116 -80
  65. package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.d.ts +13 -1
  66. package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +162 -112
  67. package/dist/components/ui/nested-list/nested-list.js +182 -189
  68. package/dist/components/ui/notification-panel/notification-item.js +19 -17
  69. package/dist/components/ui/notification-panel/notification-list.js +21 -21
  70. package/dist/components/ui/notification-panel/notification-panel.js +25 -25
  71. package/dist/components/ui/popover.js +37 -34
  72. package/dist/components/ui/progress.js +12 -10
  73. package/dist/components/ui/prompt.js +29 -27
  74. package/dist/components/ui/radio-group.js +55 -46
  75. package/dist/components/ui/select/components/Submenu.d.ts +1 -2
  76. package/dist/components/ui/select/components/Submenu.js +52 -48
  77. package/dist/components/ui/select/select.js +321 -324
  78. package/dist/components/ui/sheet.js +18 -15
  79. package/dist/components/ui/sidebar.d.ts +2 -2
  80. package/dist/components/ui/sidebar.js +3 -3
  81. package/dist/components/ui/skeleton.d.ts +2 -1
  82. package/dist/components/ui/skeleton.js +12 -11
  83. package/dist/components/ui/slider.js +39 -12
  84. package/dist/components/ui/smart-input.js +44 -39
  85. package/dist/components/ui/stepper.js +33 -29
  86. package/dist/components/ui/switch.js +6 -4
  87. package/dist/components/ui/tabs.js +50 -45
  88. package/dist/components/ui/tag-group.d.ts +2 -1
  89. package/dist/components/ui/tag-group.js +29 -25
  90. package/dist/components/ui/tag.d.ts +1 -0
  91. package/dist/components/ui/tag.js +26 -20
  92. package/dist/components/ui/textarea.js +18 -17
  93. package/dist/components/ui/toast.d.ts +1 -1
  94. package/dist/components/ui/toast.js +47 -41
  95. package/dist/components/ui/toaster.js +42 -42
  96. package/dist/components/ui/tooltip.js +18 -16
  97. package/dist/components/ui/types/date-picker.types.d.ts +33 -0
  98. package/dist/components/ui/types/empty-container.types.d.ts +5 -0
  99. package/dist/components/ui/types/nested-list.types.d.ts +1 -0
  100. package/dist/components/ui/types/select.types.d.ts +0 -1
  101. package/dist/icons/assets/bookmark.svg.js +4 -0
  102. package/dist/icons/assets/bookmark.svg2.js +5 -0
  103. package/dist/icons/assets/bookmarkFilled.svg.js +4 -0
  104. package/dist/icons/assets/bookmarkFilled.svg2.js +5 -0
  105. package/dist/icons/assets/download.svg.js +4 -0
  106. package/dist/icons/assets/download.svg2.js +5 -0
  107. package/dist/icons/index.d.ts +20 -6
  108. package/dist/icons/index.js +398 -370
  109. package/dist/impact-nova.css +1 -1
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.js +318 -314
  112. package/dist/lib/fiscal-calendar.d.ts +62 -0
  113. package/dist/lib/fiscal-calendar.js +99 -0
  114. package/dist/lib/utils.d.ts +2 -1
  115. package/dist/lib/utils.js +29 -13
  116. package/package.json +5 -5
  117. package/dist/components/ui/select/hooks/useClickOutside.d.ts +0 -15
  118. package/dist/components/ui/select/hooks/useClickOutside.js +0 -43
  119. package/dist/components/ui/select/hooks/useMenuPosition.d.ts +0 -2
  120. package/dist/components/ui/select/hooks/useMenuPosition.js +0 -89
@@ -1,4 +1,4 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as a, jsx as d } from "react/jsx-runtime";
2
2
  import * as x from "react";
3
3
  import { Info as h } from "../../icons/index.js";
4
4
  import { cva as v } from "class-variance-authority";
@@ -14,7 +14,8 @@ const g = v(
14
14
  size: {
15
15
  default: "h-8",
16
16
  sm: "h-6",
17
- md: "h-[28px]"
17
+ md: "h-[28px]",
18
+ lg: "h-10"
18
19
  },
19
20
  disabled: {
20
21
  true: "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
@@ -27,79 +28,89 @@ const g = v(
27
28
  }
28
29
  }
29
30
  ), y = x.forwardRef(
30
- ({ className: u, type: b, label: a, helperText: o, isError: r, size: p, disabled: d, prefix: i, suffix: n, prefixClick: l, suffixClick: c, ...m }, f) => /* @__PURE__ */ s("div", { className: "w-full space-y-1.5", children: [
31
- a && /* @__PURE__ */ s(
32
- "label",
33
- {
34
- className: e(
35
- "text-xs font-medium leading-[18px] text-[#60697d]",
36
- // Exact legacy color
37
- d && "opacity-70",
38
- r && "text-destructive"
31
+ ({ className: u, type: p, label: o, helperText: s, isError: t, size: b, disabled: r, prefix: n, suffix: i, prefixClick: l, suffixClick: c, ...m }, f) => /* @__PURE__ */ a(
32
+ "div",
33
+ {
34
+ className: "w-full space-y-1.5",
35
+ "data-component": "input",
36
+ "data-disabled": r || void 0,
37
+ "data-invalid": t || void 0,
38
+ children: [
39
+ o && /* @__PURE__ */ a(
40
+ "label",
41
+ {
42
+ className: e(
43
+ "text-xs font-medium leading-[18px] text-[#60697d]",
44
+ // Exact legacy color
45
+ r && "opacity-70",
46
+ t && "text-destructive"
47
+ ),
48
+ children: [
49
+ o,
50
+ " ",
51
+ m.required && /* @__PURE__ */ d("span", { className: "text-destructive", children: "*" })
52
+ ]
53
+ }
39
54
  ),
40
- children: [
41
- a,
42
- " ",
43
- m.required && /* @__PURE__ */ t("span", { className: "text-destructive", children: "*" })
44
- ]
45
- }
46
- ),
47
- /* @__PURE__ */ s(
48
- "div",
49
- {
50
- className: e(
51
- g({ size: p, isError: r, disabled: d, className: u }),
52
- "bg-background",
53
- d && "bg-disabled-secondary-bg"
55
+ /* @__PURE__ */ a(
56
+ "div",
57
+ {
58
+ className: e(
59
+ g({ size: b, isError: t, disabled: r, className: u }),
60
+ "bg-background",
61
+ r && "bg-disabled-secondary-bg"
62
+ ),
63
+ children: [
64
+ n && /* @__PURE__ */ d(
65
+ "div",
66
+ {
67
+ onClick: l,
68
+ className: e("flex shrink-0 items-center justify-center text-muted-foreground pointer-events-auto", l && "cursor-pointer"),
69
+ children: n
70
+ }
71
+ ),
72
+ /* @__PURE__ */ d(
73
+ "input",
74
+ {
75
+ type: p,
76
+ className: e(
77
+ "flex h-full w-full bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-[#dfe2e7] disabled:cursor-not-allowed disabled:opacity-50",
78
+ r && "opacity-100 text-disabled-text placeholder:text-disabled-text"
79
+ ),
80
+ ref: f,
81
+ disabled: !!r,
82
+ "data-form-control": "input",
83
+ ...m
84
+ }
85
+ ),
86
+ i && /* @__PURE__ */ d(
87
+ "div",
88
+ {
89
+ onClick: c,
90
+ className: e("flex shrink-0 items-center justify-center text-muted-foreground pointer-events-auto", c && "cursor-pointer"),
91
+ children: i
92
+ }
93
+ )
94
+ ]
95
+ }
54
96
  ),
55
- children: [
56
- i && /* @__PURE__ */ t(
57
- "div",
58
- {
59
- onClick: l,
60
- className: e("flex shrink-0 items-center justify-center text-muted-foreground pointer-events-auto", l && "cursor-pointer"),
61
- children: i
62
- }
63
- ),
64
- /* @__PURE__ */ t(
65
- "input",
97
+ s && /* @__PURE__ */ a("div", { className: e("flex items-center gap-1", t && "text-destructive"), children: [
98
+ !t && /* @__PURE__ */ d(h, { size: "xs", className: "shrink-0 text-muted-foreground" }),
99
+ /* @__PURE__ */ d(
100
+ "p",
66
101
  {
67
- type: b,
68
102
  className: e(
69
- "flex h-full w-full bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-[#dfe2e7] disabled:cursor-not-allowed disabled:opacity-50",
70
- d && "opacity-100 text-disabled-text placeholder:text-disabled-text"
103
+ "text-[10px] text-[#7a8294]",
104
+ // Exact legacy color
105
+ t && "text-destructive"
71
106
  ),
72
- ref: f,
73
- disabled: !!d,
74
- ...m
75
- }
76
- ),
77
- n && /* @__PURE__ */ t(
78
- "div",
79
- {
80
- onClick: c,
81
- className: e("flex shrink-0 items-center justify-center text-muted-foreground pointer-events-auto", c && "cursor-pointer"),
82
- children: n
107
+ children: s
83
108
  }
84
109
  )
85
- ]
86
- }
87
- ),
88
- o && /* @__PURE__ */ s("div", { className: e("flex items-center gap-1", r && "text-destructive"), children: [
89
- !r && /* @__PURE__ */ t(h, { size: 10, className: "shrink-0 text-muted-foreground" }),
90
- /* @__PURE__ */ t(
91
- "p",
92
- {
93
- className: e(
94
- "text-[10px] text-[#7a8294]",
95
- // Exact legacy color
96
- r && "text-destructive"
97
- ),
98
- children: o
99
- }
100
- )
101
- ] })
102
- ] })
110
+ ] })
111
+ ]
112
+ }
113
+ )
103
114
  );
104
115
  y.displayName = "Input";
105
116
  export {
@@ -6,6 +6,7 @@ declare const loaderVariants: (props?: {
6
6
  export interface LoaderProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof loaderVariants> {
7
7
  progress?: string | number;
8
8
  text?: string;
9
+ asChild?: boolean;
9
10
  }
10
11
  declare const Loader: React.ForwardRefExoticComponent<LoaderProps & React.RefAttributes<HTMLDivElement>>;
11
12
  export { Loader, loaderVariants };
@@ -1,8 +1,9 @@
1
- import { jsxs as m, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
+ import "@radix-ui/react-slot";
3
4
  import { cva as f } from "class-variance-authority";
4
5
  import { cn as u } from "../../lib/utils.js";
5
- const x = f(
6
+ const y = f(
6
7
  "relative rounded-full flex items-center justify-center overflow-hidden",
7
8
  {
8
9
  variants: {
@@ -18,23 +19,25 @@ const x = f(
18
19
  }
19
20
  }
20
21
  ), h = c.forwardRef(
21
- ({ className: s, size: n = "md", progress: o, text: t, ...d }, l) => {
22
- const a = {
22
+ ({ className: o, size: t = "md", progress: d, text: a, asChild: p = !1, ...s }, l) => {
23
+ const i = {
23
24
  sm: { outer: 24, inner: 20 },
24
25
  md: { outer: 48, inner: 40 },
25
26
  lg: { outer: 72, inner: 60 },
26
27
  xl: { outer: 96, inner: 80 }
27
- }, { outer: e, inner: r } = a[n] || a.md;
28
+ }, { outer: e, inner: r } = i[t] || i.md;
28
29
  return /* @__PURE__ */ m(
29
30
  "div",
30
31
  {
31
32
  ref: l,
32
- className: u("flex flex-col items-center justify-center", s),
33
+ className: u("flex flex-col items-center justify-center", o),
33
34
  role: "status",
34
- "aria-label": t || "Loading",
35
- ...d,
35
+ "aria-label": a || "Loading",
36
+ "data-component": "loader",
37
+ "data-size": t ?? "md",
38
+ ...s,
36
39
  children: [
37
- /* @__PURE__ */ i(
40
+ /* @__PURE__ */ n(
38
41
  "div",
39
42
  {
40
43
  className: "relative animate-spin rounded-full",
@@ -43,7 +46,7 @@ const x = f(
43
46
  width: e,
44
47
  background: "conic-gradient(from 180deg at 50% 50%, rgba(66, 89, 238, 0) 0deg, hsl(var(--primary)) 360deg)"
45
48
  },
46
- children: /* @__PURE__ */ i(
49
+ children: /* @__PURE__ */ n(
47
50
  "div",
48
51
  {
49
52
  className: "absolute bg-background rounded-full flex items-center justify-center font-medium animate-[spin_1s_linear_infinite_reverse]",
@@ -54,12 +57,19 @@ const x = f(
54
57
  left: (e - r) / 2,
55
58
  fontSize: e / 6
56
59
  },
57
- children: n !== "sm" && o
60
+ children: t !== "sm" && d
58
61
  }
59
62
  )
60
63
  }
61
64
  ),
62
- t && /* @__PURE__ */ i("span", { className: "mt-2 text-[12px] font-medium text-foreground", children: t })
65
+ a && /* @__PURE__ */ n(
66
+ "span",
67
+ {
68
+ className: "mt-2 text-[12px] font-medium text-foreground",
69
+ "data-component": "loader-text",
70
+ children: a
71
+ }
72
+ )
63
73
  ]
64
74
  }
65
75
  );
@@ -68,5 +78,5 @@ const x = f(
68
78
  h.displayName = "Loader";
69
79
  export {
70
80
  h as Loader,
71
- x as loaderVariants
81
+ y as loaderVariants
72
82
  };
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { useSensors, DropAnimation, DragStartEvent, DragOverEvent, DragEndEvent } from '@dnd-kit/core';
2
+ import { useSensors, DragStartEvent, DragOverEvent, DragEndEvent } from '@dnd-kit/core';
3
3
  import { NestedListItem } from '../../types/nested-list.types';
4
4
  interface NestedListContentProps {
5
5
  isListCollapsed: boolean;
@@ -10,8 +10,6 @@ interface NestedListContentProps {
10
10
  level: number;
11
11
  }[];
12
12
  renderItem: (item: NestedListItem, level: number) => React.ReactNode;
13
- activeItem?: NestedListItem | null;
14
- dropAnimationConfig: DropAnimation;
15
13
  onDragStart: (event: DragStartEvent) => void;
16
14
  onDragOver: (event: DragOverEvent) => void;
17
15
  onDragEnd: (event: DragEndEvent) => void;
@@ -1,9 +1,10 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import b, { useRef as y } from "react";
3
- import { DndContext as z, closestCenter as C } from "@dnd-kit/core";
4
- import { SortableContext as w, verticalListSortingStrategy as I } from "@dnd-kit/sortable";
5
- import { useVirtualizer as N } from "@tanstack/react-virtual";
6
- const T = ({
2
+ import z, { useRef as C } from "react";
3
+ import { DndContext as S } from "@dnd-kit/core";
4
+ import { SortableContext as w } from "@dnd-kit/sortable";
5
+ import { useVirtualizer as y } from "@tanstack/react-virtual";
6
+ import { customCollisionDetection as D } from "../hooks/useNestedListDragDrop.js";
7
+ const _ = ({
7
8
  isListCollapsed: a,
8
9
  enableDragDrop: d,
9
10
  sensors: c,
@@ -14,18 +15,18 @@ const T = ({
14
15
  onDragEnd: p,
15
16
  onDragCancel: h
16
17
  }) => {
17
- const r = y(null), n = N({
18
+ const r = C(null), n = y({
18
19
  count: e.length,
19
20
  getScrollElement: () => r.current,
20
21
  estimateSize: () => 32,
21
22
  overscan: 5
22
- }), g = b.useMemo(() => e.map((o) => o.item.id), [e]);
23
+ }), x = z.useMemo(() => e.map((o) => o.item.id), [e]);
23
24
  if (a) return null;
24
- const i = n.getVirtualItems(), x = n.getTotalSize(), v = i.length > 0 ? i[0].start : 0, l = /* @__PURE__ */ t(
25
+ const i = n.getVirtualItems(), g = n.getTotalSize(), v = i.length > 0 ? i[0].start : 0, l = /* @__PURE__ */ t(
25
26
  "div",
26
27
  {
27
28
  style: {
28
- height: `${x + 48}px`,
29
+ height: `${g + 48}px`,
29
30
  width: "100%",
30
31
  position: "relative"
31
32
  },
@@ -40,13 +41,13 @@ const T = ({
40
41
  transform: `translateY(${v}px)`
41
42
  },
42
43
  children: i.map((o) => {
43
- const { item: s, level: S } = e[o.index];
44
+ const { item: s, level: b } = e[o.index];
44
45
  return /* @__PURE__ */ t(
45
46
  "div",
46
47
  {
47
48
  "data-index": o.index,
48
49
  ref: n.measureElement,
49
- children: m(s, S)
50
+ children: m(s, b)
50
51
  },
51
52
  s.id
52
53
  );
@@ -56,18 +57,18 @@ const T = ({
56
57
  }
57
58
  );
58
59
  return /* @__PURE__ */ t("div", { className: "flex flex-col min-h-0 h-full", children: /* @__PURE__ */ t("div", { ref: r, className: "flex-1 p-1 overflow-y-auto", children: d ? /* @__PURE__ */ t(
59
- z,
60
+ S,
60
61
  {
61
62
  sensors: c,
62
- collisionDetection: C,
63
+ collisionDetection: D,
63
64
  onDragStart: f,
64
65
  onDragOver: u,
65
66
  onDragEnd: p,
66
67
  onDragCancel: h,
67
- children: /* @__PURE__ */ t(w, { items: g, strategy: I, children: l })
68
+ children: /* @__PURE__ */ t(w, { items: x, children: l })
68
69
  }
69
70
  ) : l }) });
70
71
  };
71
72
  export {
72
- T as NestedListContent
73
+ _ as NestedListContent
73
74
  };
@@ -1,119 +1,148 @@
1
- import { jsx as r, jsxs as z } from "react/jsx-runtime";
2
- import D, { useMemo as P } from "react";
3
- import { useSortable as R, defaultAnimateLayoutChanges as E } from "@dnd-kit/sortable";
4
- import { CSS as L } from "@dnd-kit/utilities";
1
+ import { jsx as t, jsxs as h } from "react/jsx-runtime";
2
+ import D, { useMemo as z } from "react";
3
+ import { useSortable as E, defaultAnimateLayoutChanges as O } from "@dnd-kit/sortable";
4
+ import { useDroppable as P } from "@dnd-kit/core";
5
+ import { CSS as $ } from "@dnd-kit/utilities";
5
6
  import { Checkbox as j } from "../../checkbox.js";
6
- import { ChevronRight as A, Drag as H } from "../../../../icons/index.js";
7
- import { cn as a } from "../../../../lib/utils.js";
8
- const M = (e, s, o, d, i) => {
9
- const t = "flex items-center gap-1 py-[3px] px-2 rounded transition-all duration-200";
10
- return e ? a(t, "bg-transparent") : i ? a(t, "bg-red-100 border border-red-300 animate-pulse") : s && o ? d ? a(t, "bg-blue-50 border-2 border-blue-300 shadow-sm") : a(t, "bg-red-50 border-2 border-red-300 shadow-sm") : a(t, "hover:bg-gray-50");
11
- }, O = (e) => E({ ...e, wasDragging: !0 }), _ = ({
7
+ import { ChevronRight as H, Drag as L } from "../../../../icons/index.js";
8
+ import { cn as n } from "../../../../lib/utils.js";
9
+ const F = (e, o, r, l, a) => {
10
+ const d = "flex items-center gap-1 py-[3px] px-2 rounded transition-all duration-200";
11
+ return e ? n(d, "bg-transparent") : a ? n(d, "bg-red-100 border border-red-300 animate-pulse") : o && r ? l ? n(d, "bg-blue-50 border-2 border-blue-300 shadow-sm") : n(d, "bg-red-50 border-2 border-red-300 shadow-sm") : n(d, "hover:bg-gray-50");
12
+ }, M = (e) => O({ ...e, wasDragging: !0 }), _ = ({ item: e, isAnyDragging: o }) => {
13
+ const r = !e.children || e.children.length === 0, {
14
+ setNodeRef: l,
15
+ isOver: a
16
+ } = P({
17
+ id: `droppable-${e.id}`,
18
+ data: { sectionId: e.id },
19
+ disabled: !r
20
+ });
21
+ return /* @__PURE__ */ h("div", { ref: r ? l : void 0, children: [
22
+ /* @__PURE__ */ h(
23
+ "div",
24
+ {
25
+ className: n(
26
+ "flex items-center px-2 py-0 text-xs font-[500] leading-4 text-[#7a8294] select-none",
27
+ e.id === "root-scrollable" ? "mt-2 pt-2 pb-1 border-t border-solid border-gray-100" : "mt-1 pb-1",
28
+ a && o && r && "bg-blue-50 rounded"
29
+ ),
30
+ children: [
31
+ e.label,
32
+ a && o && r && /* @__PURE__ */ t("span", { className: "ml-2 text-blue-400 text-[11px]", children: "Drop here" })
33
+ ]
34
+ }
35
+ ),
36
+ r && /* @__PURE__ */ t(
37
+ "div",
38
+ {
39
+ className: n(
40
+ "mx-2 my-1 rounded border-2 border-dashed min-h-[36px] flex items-center justify-center text-[11px] transition-colors",
41
+ a && o ? "border-blue-400 bg-blue-50 text-blue-400" : "border-gray-200 text-gray-300"
42
+ ),
43
+ children: a && o ? "Release to drop" : "Drag here"
44
+ }
45
+ )
46
+ ] });
47
+ }, T = ({
12
48
  item: e,
13
- level: s,
14
- isCollapsed: o,
15
- onToggle: d,
16
- onToggleCollapse: i,
17
- isAnyDragging: t = !1,
18
- isOver: b = !1,
19
- isValidDrop: m = !1,
49
+ level: o,
50
+ isCollapsed: r,
51
+ onToggle: l,
52
+ onToggleCollapse: a,
53
+ isAnyDragging: d = !1,
54
+ isOver: p = !1,
55
+ isValidDrop: f = !1,
20
56
  enableDragDrop: x = !0,
21
- enableCollapse: p = !0,
22
- shouldBlink: C = !1
57
+ enableCollapse: u = !0,
58
+ shouldBlink: g = !1
23
59
  }) => {
24
- const g = e.category === "structure", l = e.children && e.children.length > 0, v = P(() => !e.children || e.children.length === 0 || e.children.every((h) => h.checked) ? !1 : e.children.some((h) => h.checked), [e.children]), {
25
- attributes: y,
26
- listeners: k,
27
- setNodeRef: u,
60
+ const m = e.category === "structure", c = e.children && e.children.length > 0, v = z(() => !e.children || e.children.length === 0 || e.children.every((b) => b.checked) ? !1 : e.children.some((b) => b.checked), [e.children]), {
61
+ attributes: C,
62
+ listeners: y,
63
+ setNodeRef: k,
28
64
  transform: N,
29
- transition: w,
30
- isDragging: c,
31
- isOver: I
32
- } = R({
65
+ transition: I,
66
+ isDragging: i,
67
+ isOver: S
68
+ } = E({
33
69
  id: e.id,
34
- animateLayoutChanges: O,
70
+ animateLayoutChanges: M,
35
71
  data: {
36
- level: s,
37
- hasChildren: l,
38
- isExpanded: !o
72
+ level: o,
73
+ hasChildren: c,
74
+ isExpanded: !r
39
75
  },
40
- disabled: g || e.disabled
41
- }), S = b !== void 0 ? b : I, f = {
42
- transform: L.Transform.toString(N),
43
- transition: w,
44
- opacity: c ? 0.5 : 1,
45
- zIndex: c ? 100 : "auto",
76
+ disabled: m || e.disabled
77
+ });
78
+ if (m)
79
+ return /* @__PURE__ */ t(_, { item: e, isAnyDragging: d });
80
+ const w = p !== void 0 ? p : S, R = {
81
+ transform: $.Transform.toString(N),
82
+ transition: I,
83
+ opacity: i ? 0.5 : 1,
84
+ zIndex: i ? 100 : "auto",
46
85
  height: "auto"
47
86
  };
48
- return g ? /* @__PURE__ */ r(
87
+ return /* @__PURE__ */ t(
49
88
  "div",
50
89
  {
51
- ref: u,
52
- style: f,
53
- className: a(
54
- "flex items-center px-2 py-0 text-xs font-[500] leading-4 text-[#7a8294] select-none",
55
- e.id === "root-scrollable" ? "mt-2 pt-2 pb-1 border-t border-solid border-gray-100" : "mt-1 pb-1"
56
- ),
57
- children: e.label
58
- }
59
- ) : /* @__PURE__ */ r(
60
- "div",
61
- {
62
- ref: u,
63
- style: f,
90
+ ref: k,
91
+ style: R,
64
92
  className: "relative",
65
93
  "data-item-id": e.id,
66
- "data-level": s,
94
+ "data-level": o,
67
95
  "data-checked": e.checked,
68
96
  "data-disabled": e.disabled,
69
- "data-collapsed": o,
70
- children: /* @__PURE__ */ z(
97
+ "data-collapsed": r,
98
+ children: /* @__PURE__ */ h(
71
99
  "div",
72
100
  {
73
- className: M(
74
- c,
75
- S,
76
- t,
77
- m,
78
- C
101
+ className: F(
102
+ i,
103
+ w,
104
+ d,
105
+ f,
106
+ g
79
107
  ),
80
108
  style: {
81
- paddingLeft: `${8 + s * 20}px`
109
+ paddingLeft: `${8 + o * 20}px`
82
110
  },
83
111
  children: [
84
- p && l && /* @__PURE__ */ r(
112
+ u && c && /* @__PURE__ */ t(
85
113
  "button",
86
114
  {
87
115
  type: "button",
88
- onClick: (n) => {
89
- n.stopPropagation(), i(e.id);
116
+ onClick: (s) => {
117
+ s.stopPropagation(), a(e.id);
90
118
  },
91
- onMouseDown: (n) => n.stopPropagation(),
119
+ onMouseDown: (s) => s.stopPropagation(),
92
120
  className: "p-1 hover:bg-gray-200 rounded-full transition-colors flex items-center text-[#8C8C8C] hover:text-primary",
93
- "aria-label": o ? "Expand" : "Collapse",
94
- children: /* @__PURE__ */ r(
95
- A,
121
+ "aria-label": r ? "Expand" : "Collapse",
122
+ children: /* @__PURE__ */ t(
123
+ H,
96
124
  {
97
125
  size: "16px",
98
- className: a("transition-transform", !o && "rotate-90")
126
+ className: n("transition-transform", !r && "rotate-90")
99
127
  }
100
128
  )
101
129
  }
102
130
  ),
103
- (!p || !l) && /* @__PURE__ */ r("div", { className: "w-4" }),
104
- /* @__PURE__ */ r(
131
+ (!u || !c) && /* @__PURE__ */ t("div", { className: "w-4" }),
132
+ /* @__PURE__ */ t(
105
133
  j,
106
134
  {
135
+ id: `checkbox-${e.id}`,
107
136
  checked: v ? "indeterminate" : e.checked,
108
- onCheckedChange: () => d(e.id),
137
+ onCheckedChange: () => l(e.id),
109
138
  disabled: e.disabled
110
139
  }
111
140
  ),
112
- x && /* @__PURE__ */ r(
141
+ x && /* @__PURE__ */ t(
113
142
  "div",
114
143
  {
144
+ ...C,
115
145
  ...y,
116
- ...k,
117
146
  className: "cursor-grab active:cursor-grabbing p-0 hover:bg-gray-200 rounded flex items-center",
118
147
  style: {
119
148
  pointerEvents: "auto",
@@ -121,19 +150,26 @@ const M = (e, s, o, d, i) => {
121
150
  zIndex: 30,
122
151
  touchAction: "none"
123
152
  },
124
- onPointerDown: (n) => {
125
- n.stopPropagation();
153
+ onPointerDown: (s) => {
154
+ s.stopPropagation();
126
155
  },
127
- children: /* @__PURE__ */ r(H, { size: "14px", color: "#8C8C8C" })
156
+ children: /* @__PURE__ */ t(L, { size: "14px", color: "#8C8C8C" })
128
157
  }
129
158
  ),
130
- /* @__PURE__ */ r("span", { className: "flex-1 text-[13px] text-gray-900 capitalize ml-1", children: e.label })
159
+ /* @__PURE__ */ t(
160
+ "label",
161
+ {
162
+ htmlFor: `checkbox-${e.id}`,
163
+ className: "flex-1 text-[13px] text-gray-900 capitalize ml-1 cursor-pointer select-none",
164
+ children: e.label
165
+ }
166
+ )
131
167
  ]
132
168
  }
133
169
  )
134
170
  }
135
171
  );
136
- }, Q = D.memo(_);
172
+ }, X = D.memo(T);
137
173
  export {
138
- Q as SortableItem
174
+ X as SortableItem
139
175
  };
@@ -1,5 +1,17 @@
1
- import { DragEndEvent } from '@dnd-kit/core';
1
+ import { DragEndEvent, CollisionDetection } from '@dnd-kit/core';
2
2
  import { NestedListItem } from '../../types/nested-list.types';
3
+ /**
4
+ * Custom collision detection: closestCorners but filters out section header
5
+ * sortable nodes from results. This prevents headers from "stealing" drops
6
+ * that should target child items.
7
+ *
8
+ * - When children exist nearby: header is filtered → closest child wins →
9
+ * handleCrossParentReorder gives precise positioning
10
+ * - When section is empty: only the droppable node (droppable-root-*)
11
+ * exists → not filtered → handleDropOnSection handles it
12
+ * - Edge case (no children nearby): headers are included as fallback
13
+ */
14
+ export declare const customCollisionDetection: CollisionDetection;
3
15
  interface UseNestedListDragDropProps {
4
16
  items: NestedListItem[];
5
17
  onDragEnd?: (activeId: string, overId: string | null) => void;