impact-nova 0.1.13 → 1.0.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 (115) 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/editors/split-cell-editor.d.ts +5 -0
  5. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +50 -52
  6. package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +1 -1
  7. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +34 -34
  8. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +8 -11
  9. package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +17 -17
  10. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +3 -3
  11. package/dist/components/ui/alert-dialog.js +45 -40
  12. package/dist/components/ui/alert.d.ts +21 -4
  13. package/dist/components/ui/alert.js +45 -25
  14. package/dist/components/ui/avatar.js +19 -16
  15. package/dist/components/ui/badge.js +8 -1
  16. package/dist/components/ui/breadcrumb.js +1 -0
  17. package/dist/components/ui/button-group.d.ts +1 -1
  18. package/dist/components/ui/button-group.js +27 -32
  19. package/dist/components/ui/button-variants.d.ts +1 -1
  20. package/dist/components/ui/button.d.ts +11 -0
  21. package/dist/components/ui/button.js +11 -9
  22. package/dist/components/ui/calendar.d.ts +14 -2
  23. package/dist/components/ui/calendar.js +443 -376
  24. package/dist/components/ui/card.js +7 -6
  25. package/dist/components/ui/checkbox.js +64 -48
  26. package/dist/components/ui/chips.d.ts +1 -0
  27. package/dist/components/ui/chips.js +27 -19
  28. package/dist/components/ui/data-table/data-table-column-list.d.ts +4 -1
  29. package/dist/components/ui/data-table/data-table-column-list.js +58 -54
  30. package/dist/components/ui/data-table/data-table-sheet.d.ts +1 -1
  31. package/dist/components/ui/data-table/data-table-sheet.js +43 -40
  32. package/dist/components/ui/data-table/data-table-view-options.js +17 -17
  33. package/dist/components/ui/data-table/data-table.js +21 -20
  34. package/dist/components/ui/date-picker/date-picker.js +83 -87
  35. package/dist/components/ui/date-picker/date-range-picker.js +129 -125
  36. package/dist/components/ui/date-picker/month-picker.js +90 -93
  37. package/dist/components/ui/date-picker/month-range-picker.js +132 -129
  38. package/dist/components/ui/date-picker/multi-date-picker.js +37 -38
  39. package/dist/components/ui/date-picker/multi-month-picker.js +29 -30
  40. package/dist/components/ui/date-picker/multi-week-picker.js +49 -38
  41. package/dist/components/ui/date-picker/week-picker.js +116 -112
  42. package/dist/components/ui/date-picker/week-range-picker.js +153 -142
  43. package/dist/components/ui/dialog.js +15 -6
  44. package/dist/components/ui/drawer.js +16 -13
  45. package/dist/components/ui/dropdown-menu.js +4 -2
  46. package/dist/components/ui/dynamic-layout.d.ts +2 -2
  47. package/dist/components/ui/dynamic-layout.js +18 -15
  48. package/dist/components/ui/empty-container.js +69 -64
  49. package/dist/components/ui/file-upload.js +113 -106
  50. package/dist/components/ui/filter-panel/filter-panel.js +49 -46
  51. package/dist/components/ui/filter-strip/filter-strip.js +41 -37
  52. package/dist/components/ui/header.js +26 -25
  53. package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +43 -40
  54. package/dist/components/ui/hover-card.js +6 -5
  55. package/dist/components/ui/input.d.ts +1 -1
  56. package/dist/components/ui/input.js +79 -68
  57. package/dist/components/ui/loader.d.ts +1 -0
  58. package/dist/components/ui/loader.js +23 -13
  59. package/dist/components/ui/nested-list/components/NestedListContent.d.ts +1 -3
  60. package/dist/components/ui/nested-list/components/NestedListContent.js +16 -15
  61. package/dist/components/ui/nested-list/components/SortableItem.js +116 -80
  62. package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.d.ts +13 -1
  63. package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +162 -112
  64. package/dist/components/ui/nested-list/nested-list.js +182 -189
  65. package/dist/components/ui/notification-panel/notification-item.js +19 -17
  66. package/dist/components/ui/notification-panel/notification-list.js +21 -21
  67. package/dist/components/ui/notification-panel/notification-panel.js +25 -25
  68. package/dist/components/ui/popover.js +37 -34
  69. package/dist/components/ui/progress.js +12 -10
  70. package/dist/components/ui/prompt.js +29 -27
  71. package/dist/components/ui/radio-group.js +55 -46
  72. package/dist/components/ui/select/components/Submenu.d.ts +1 -2
  73. package/dist/components/ui/select/components/Submenu.js +52 -48
  74. package/dist/components/ui/select/select.js +321 -324
  75. package/dist/components/ui/sheet.js +18 -15
  76. package/dist/components/ui/sidebar.d.ts +2 -2
  77. package/dist/components/ui/sidebar.js +3 -3
  78. package/dist/components/ui/skeleton.d.ts +2 -1
  79. package/dist/components/ui/skeleton.js +12 -11
  80. package/dist/components/ui/slider.js +39 -12
  81. package/dist/components/ui/smart-input.js +44 -39
  82. package/dist/components/ui/stepper.js +33 -29
  83. package/dist/components/ui/switch.js +6 -4
  84. package/dist/components/ui/tabs.js +50 -45
  85. package/dist/components/ui/tag-group.d.ts +2 -1
  86. package/dist/components/ui/tag-group.js +29 -25
  87. package/dist/components/ui/tag.d.ts +1 -0
  88. package/dist/components/ui/tag.js +26 -20
  89. package/dist/components/ui/textarea.js +18 -17
  90. package/dist/components/ui/toast.d.ts +1 -1
  91. package/dist/components/ui/toast.js +47 -41
  92. package/dist/components/ui/toaster.js +42 -42
  93. package/dist/components/ui/tooltip.js +18 -16
  94. package/dist/components/ui/types/date-picker.types.d.ts +33 -0
  95. package/dist/components/ui/types/empty-container.types.d.ts +5 -0
  96. package/dist/components/ui/types/nested-list.types.d.ts +1 -0
  97. package/dist/components/ui/types/select.types.d.ts +0 -1
  98. package/dist/icons/assets/bookmark.svg.js +4 -0
  99. package/dist/icons/assets/bookmark.svg2.js +5 -0
  100. package/dist/icons/assets/bookmarkFilled.svg.js +4 -0
  101. package/dist/icons/assets/bookmarkFilled.svg2.js +5 -0
  102. package/dist/icons/assets/download.svg.js +4 -0
  103. package/dist/icons/assets/download.svg2.js +5 -0
  104. package/dist/icons/index.d.ts +20 -6
  105. package/dist/icons/index.js +398 -370
  106. package/dist/impact-nova.css +1 -1
  107. package/dist/index.d.ts +1 -0
  108. package/dist/index.js +318 -314
  109. package/dist/lib/fiscal-calendar.d.ts +62 -0
  110. package/dist/lib/fiscal-calendar.js +99 -0
  111. package/package.json +5 -5
  112. package/dist/components/ui/select/hooks/useClickOutside.d.ts +0 -15
  113. package/dist/components/ui/select/hooks/useClickOutside.js +0 -43
  114. package/dist/components/ui/select/hooks/useMenuPosition.d.ts +0 -2
  115. package/dist/components/ui/select/hooks/useMenuPosition.js +0 -89
@@ -1,5 +1,5 @@
1
- import { jsx as r, jsxs as w } from "react/jsx-runtime";
2
- import { useState as i, useCallback as y } from "react";
1
+ import { jsx as o, jsxs as w } from "react/jsx-runtime";
2
+ import { useState as a, useCallback as y } from "react";
3
3
  import { AgGridWrapper as T } from "../ag-grid-react/index.js";
4
4
  import { cn as l } from "../../../lib/utils.js";
5
5
  import { DataTableContext as v, useDataTable as S } from "./data-table-context.js";
@@ -7,21 +7,21 @@ const R = ({
7
7
  children: e,
8
8
  className: t
9
9
  }) => {
10
- const [a, n] = i(null), [o, m] = i(null), [s, c] = i("medium"), [u, f] = i("full"), [d, h] = i("default"), g = y((b) => {
11
- n(b);
12
- }, []), p = {
10
+ const [i, n] = a(null), [r, m] = a(null), [s, c] = a("medium"), [u, f] = a("full"), [d, h] = a("default"), p = y((x) => {
11
+ n(x);
12
+ }, []), g = {
13
13
  small: "12px",
14
14
  medium: "14px",
15
15
  large: "16px"
16
- }[s], x = {
16
+ }[s], b = {
17
17
  default: "46px",
18
18
  compact: "30px",
19
19
  comfort: "52px"
20
20
  }[d];
21
- return /* @__PURE__ */ r(v.Provider, { value: {
22
- gridApi: a,
23
- registerApi: g,
24
- sheetTarget: o,
21
+ return /* @__PURE__ */ o(v.Provider, { value: {
22
+ gridApi: i,
23
+ registerApi: p,
24
+ sheetTarget: r,
25
25
  setSheetTarget: m,
26
26
  fontSize: s,
27
27
  setFontSize: c,
@@ -29,29 +29,30 @@ const R = ({
29
29
  setNumericFormat: f,
30
30
  rowHeight: d,
31
31
  setRowHeight: h
32
- }, children: /* @__PURE__ */ r(
32
+ }, children: /* @__PURE__ */ o(
33
33
  "div",
34
34
  {
35
+ "data-component": "data-table",
35
36
  className: l("flex flex-col w-full h-full min-h-0 rounded-[inherit]", t),
36
37
  style: {
37
- "--ag-font-size": p,
38
- "--ag-row-height": x
38
+ "--ag-font-size": g,
39
+ "--ag-row-height": b
39
40
  },
40
41
  children: e
41
42
  }
42
43
  ) });
43
44
  };
44
45
  function j(e) {
45
- const { registerApi: t, setSheetTarget: a } = S(), n = (o) => {
46
- t(o.api), e.onGridReady && e.onGridReady(o);
46
+ const { registerApi: t, setSheetTarget: i } = S(), n = (r) => {
47
+ t(r.api), e.onGridReady && e.onGridReady(r);
47
48
  };
48
49
  return /* @__PURE__ */ w("div", { className: l("relative flex-1 min-h-0 w-full bg-white rounded-b-[inherit] grid-rounded-bottom", e.className), children: [
49
- /* @__PURE__ */ r(T, { ...e, onGridReady: n }),
50
- /* @__PURE__ */ r(
50
+ /* @__PURE__ */ o(T, { ...e, onGridReady: n }),
51
+ /* @__PURE__ */ o(
51
52
  "div",
52
53
  {
53
- ref: a,
54
- className: "absolute inset-0 pointer-events-none z-[100] flex overflow-hidden"
54
+ ref: i,
55
+ className: "absolute inset-0 pointer-events-none z-[39] flex overflow-hidden"
55
56
  }
56
57
  )
57
58
  ] });
@@ -59,7 +60,7 @@ function j(e) {
59
60
  const C = ({
60
61
  children: e,
61
62
  className: t
62
- }) => /* @__PURE__ */ r("div", { className: l("flex items-center justify-between px-4 py-3 shrink-0 bg-white rounded-t-[inherit]", t), children: e });
63
+ }) => /* @__PURE__ */ o("div", { "data-component": "data-table-toolbar", className: l("flex items-center justify-between px-4 py-3 shrink-0 bg-white rounded-t-[inherit]", t), children: e });
63
64
  export {
64
65
  R as DataTable,
65
66
  j as DataTableContent,
@@ -1,76 +1,74 @@
1
- import { jsxs as C, jsx as a } from "react/jsx-runtime";
2
- import * as l from "react";
3
- import { X as R } from "lucide-react";
4
- import { CalendarMonth as T } from "../../../icons/index.js";
5
- import { format as g, parse as y, isValid as k } from "date-fns";
6
- import { cn as L, maskDate as X } from "../../../lib/utils.js";
7
- import { Input as q } from "../input.js";
8
- import { Popover as z, PopoverTrigger as G, PopoverContent as H } from "../popover.js";
9
- import { Calendar as J } from "../calendar.js";
10
- const K = l.forwardRef(
1
+ import { jsxs as P, jsx as a } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { X } from "lucide-react";
4
+ import { CalendarMonth as q } from "../../../icons/index.js";
5
+ import { format as f, parse as x, isValid as v } from "date-fns";
6
+ import { cn as z, maskDate as G } from "../../../lib/utils.js";
7
+ import { Input as H } from "../input.js";
8
+ import { Popover as J, PopoverTrigger as K, PopoverContent as Q } from "../popover.js";
9
+ import { Calendar as U } from "../calendar.js";
10
+ const W = i.forwardRef(
11
11
  ({
12
- value: n,
13
- onChange: i,
14
- format: t = "MM/dd/yyyy",
12
+ value: t,
13
+ onChange: p,
14
+ format: n = "MM/dd/yyyy",
15
15
  placeholder: S = "Select Date",
16
- minDate: v,
17
- maxDate: w,
18
- fromYear: x,
19
- toYear: I,
20
- showFooter: p = !0,
21
- disabled: P,
22
- className: N,
23
- ...M
24
- }, A) => {
25
- const [r, d] = l.useState(!1), [c, s] = l.useState(n), [h, f] = l.useState(n ? g(n, t) : ""), [O, m] = l.useState(n || /* @__PURE__ */ new Date());
26
- l.useEffect(() => {
27
- f(n ? g(n, t) : "");
28
- }, [n, t]), l.useEffect(() => {
29
- console.log("[DatePicker] useEffect - open:", r, "value:", n, "pendingDate:", c), r && (s(n), m(n || /* @__PURE__ */ new Date()));
30
- }, [r]);
31
- const V = (e) => {
32
- console.log("[DatePicker] handleSelect called:", e), s(e), p || (console.log("[DatePicker] No footer - applying immediately"), i?.(e), d(!1));
33
- }, B = (e) => {
34
- const o = e;
35
- f(o ? g(o, t) : "");
36
- }, E = (e) => {
37
- const o = e !== void 0 ? e : c;
38
- console.log("[DatePicker] handleApply called, appliedDate:", e, "pendingDate:", c, "using:", o), i?.(o), d(!1);
39
- }, j = () => {
40
- console.log("[DatePicker] handleCancel called"), s(n), d(!1);
16
+ minDate: k,
17
+ maxDate: M,
18
+ fromYear: N,
19
+ toYear: w,
20
+ showFooter: s = !0,
21
+ disabled: y,
22
+ className: A,
23
+ ...V
24
+ }, I) => {
25
+ const [o, l] = i.useState(!1), [r, c] = i.useState(t), [d, u] = i.useState(t ? f(t, n) : ""), [O, h] = i.useState(t || /* @__PURE__ */ new Date());
26
+ i.useEffect(() => {
27
+ u(t ? f(t, n) : "");
28
+ }, [t, n]), i.useEffect(() => {
29
+ o && (c(t), h(t || /* @__PURE__ */ new Date()));
30
+ }, [o]);
31
+ const T = (e) => {
32
+ c(e), s || (p?.(e), l(!1));
33
+ }, j = (e) => {
34
+ p?.(e !== void 0 ? e : r), l(!1);
35
+ }, B = () => {
36
+ c(t), l(!1);
41
37
  }, D = () => {
42
- console.log("[DatePicker] handleClear called"), s(void 0), f(""), i?.(void 0), p || d(!1);
43
- };
44
- return /* @__PURE__ */ C(z, { open: r, onOpenChange: d, children: [
45
- /* @__PURE__ */ a(G, { asChild: !0, children: /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
46
- q,
38
+ c(void 0), u(""), p?.(void 0), s || l(!1);
39
+ }, E = (e) => {
40
+ const m = G(e.target.value, n);
41
+ if (u(m), m === "") {
42
+ c(void 0), s || p?.(void 0);
43
+ return;
44
+ }
45
+ const g = x(m, n, /* @__PURE__ */ new Date());
46
+ v(g) && (c(g), h(g), s || p?.(g));
47
+ }, R = () => {
48
+ if (o) return;
49
+ if (d === "") {
50
+ D();
51
+ return;
52
+ }
53
+ const e = x(d, n, /* @__PURE__ */ new Date());
54
+ v(e) || u(r ? f(r, n) : "");
55
+ }, C = s && o && (r ? f(r, n) : "") !== d, L = s && o ? r ? f(r, n) : "" : d;
56
+ return /* @__PURE__ */ P(J, { open: o, onOpenChange: l, children: [
57
+ /* @__PURE__ */ a(K, { asChild: !0, children: /* @__PURE__ */ a("div", { "data-component": "date-picker", "data-state": o ? "open" : "closed", "data-pending": C || void 0, children: /* @__PURE__ */ a(
58
+ H,
47
59
  {
48
- ref: A,
49
- value: h,
50
- onChange: (e) => {
51
- const o = X(e.target.value, t);
52
- if (f(o), o === "") {
53
- s(void 0), p || i?.(void 0);
54
- return;
55
- }
56
- const u = y(o, t, /* @__PURE__ */ new Date());
57
- k(u) && (s(u), m(u), p || i?.(u));
58
- },
59
- onBlur: () => {
60
- if (h === "") {
61
- D();
62
- return;
63
- }
64
- const e = y(h, t, /* @__PURE__ */ new Date());
65
- k(e) || f(c ? g(c, t) : "");
66
- },
67
- onClick: (e) => r && e.stopPropagation(),
68
- placeholder: r ? t : S,
69
- disabled: P,
70
- className: L("cursor-pointer", N),
71
- suffix: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
72
- n && !P && /* @__PURE__ */ a(
73
- R,
60
+ ref: I,
61
+ value: L,
62
+ onChange: E,
63
+ onBlur: R,
64
+ onClick: (e) => o && e.stopPropagation(),
65
+ placeholder: o ? n : S,
66
+ disabled: y,
67
+ "data-form-control": "input",
68
+ className: z("cursor-pointer", C && "text-muted-foreground", A),
69
+ suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
70
+ t && !y && /* @__PURE__ */ a(
71
+ X,
74
72
  {
75
73
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
76
74
  onClick: (e) => {
@@ -78,34 +76,32 @@ const K = l.forwardRef(
78
76
  }
79
77
  }
80
78
  ),
81
- /* @__PURE__ */ a(T, { className: "h-4 w-4 text-secondary-foreground" })
79
+ /* @__PURE__ */ a(q, { className: "h-4 w-4 text-secondary-foreground" })
82
80
  ] }),
83
- ...M
81
+ ...V
84
82
  }
85
83
  ) }) }),
86
84
  /* @__PURE__ */ a(
87
- H,
85
+ Q,
88
86
  {
89
87
  className: "w-auto p-0",
90
88
  align: "start",
91
89
  onOpenAutoFocus: (e) => e.preventDefault(),
92
- onInteractOutside: (e) => e.preventDefault(),
93
90
  children: /* @__PURE__ */ a(
94
- J,
91
+ U,
95
92
  {
96
93
  mode: "single",
97
- selected: c,
98
- onSelect: V,
99
- onPendingChange: B,
94
+ selected: r,
95
+ onSelect: T,
100
96
  month: O,
101
- onMonthChange: m,
102
- fromDate: v,
103
- toDate: w,
104
- fromYear: x,
105
- toYear: I,
106
- showFooter: p,
107
- onApply: E,
108
- onCancel: j,
97
+ onMonthChange: h,
98
+ fromDate: k,
99
+ toDate: M,
100
+ fromYear: N,
101
+ toYear: w,
102
+ showFooter: s,
103
+ onApply: j,
104
+ onCancel: B,
109
105
  onClear: D,
110
106
  captionLayout: "dropdown"
111
107
  }
@@ -115,7 +111,7 @@ const K = l.forwardRef(
115
111
  ] });
116
112
  }
117
113
  );
118
- K.displayName = "DatePicker";
114
+ W.displayName = "DatePicker";
119
115
  export {
120
- K as DatePicker
116
+ W as DatePicker
121
117
  };
@@ -1,199 +1,203 @@
1
- import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
- import * as c from "react";
3
- import { X as Y } from "lucide-react";
4
- import { CalendarMonth as Z, Info as $ } from "../../../icons/index.js";
5
- import { format as p, parse as k, isValid as S } from "date-fns";
6
- import { cn as v, maskDate as I } from "../../../lib/utils.js";
7
- import { Popover as _, PopoverTrigger as F, PopoverContent as ee } from "../popover.js";
8
- import { Calendar as te } from "../calendar.js";
9
- const ne = c.forwardRef(
1
+ import { jsxs as u, jsx as c } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { X as ee } from "lucide-react";
4
+ import { CalendarMonth as te, Info as ne } from "../../../icons/index.js";
5
+ import { format as a, parse as I, isValid as M } from "date-fns";
6
+ import { cn as g, maskDate as V } from "../../../lib/utils.js";
7
+ import { Popover as oe, PopoverTrigger as re, PopoverContent as se } from "../popover.js";
8
+ import { Calendar as ie } from "../calendar.js";
9
+ const de = m.forwardRef(
10
10
  ({
11
11
  value: t,
12
- onChange: f,
12
+ onChange: p,
13
13
  format: n = "MM/dd/yyyy",
14
- startPlaceholder: M = "Start Date",
15
- endPlaceholder: V = "End Date",
16
- minDate: A,
17
- maxDate: O,
18
- fromYear: j,
19
- toYear: B,
20
- showFooter: m = !0,
21
- disabled: g,
22
- label: D,
23
- helperText: P,
24
- prefix: oe,
25
- prefixClick: re,
14
+ startPlaceholder: A = "Start Date",
15
+ endPlaceholder: E = "End Date",
16
+ minDate: j,
17
+ maxDate: B,
18
+ fromYear: O,
19
+ toYear: T,
20
+ showFooter: i = !0,
21
+ disabled: x,
22
+ label: N,
23
+ helperText: C,
24
+ prefix: ae,
25
+ prefixClick: ce,
26
26
  isError: h,
27
- size: R,
28
- required: E,
29
- className: z,
30
- ...L
31
- }, T) => {
32
- const [l, x] = c.useState(!1), [r, i] = c.useState(t), [X, b] = c.useState(t?.from ? p(t.from, n) : ""), [q, y] = c.useState(t?.to ? p(t.to, n) : ""), [G, w] = c.useState(t?.from || /* @__PURE__ */ new Date());
33
- c.useEffect(() => {
34
- b(t?.from ? p(t.from, n) : ""), y(t?.to ? p(t.to, n) : "");
35
- }, [t, n]), c.useEffect(() => {
36
- console.log("[DateRangePicker] useEffect - open:", l, "value:", t, "pendingRange:", r), l && (i(t), w(t?.from || /* @__PURE__ */ new Date()));
37
- }, [l]);
38
- const H = (e) => {
39
- console.log("[DateRangePicker] handleSelect called:", e), i(e), !m && e?.from && e?.to && (console.log("[DateRangePicker] No footer - applying immediately"), f?.(e), x(!1));
40
- }, J = (e) => {
41
- const o = e;
42
- b(o?.from ? p(o.from, n) : ""), y(o?.to ? p(o.to, n) : "");
43
- }, K = (e) => {
44
- const o = e !== void 0 ? e : r;
45
- console.log("[DateRangePicker] handleApply called, appliedRange:", e, "pendingRange:", r, "using:", o), f?.(o), x(!1);
46
- }, Q = () => {
47
- console.log("[DateRangePicker] handleCancel called"), i(t), x(!1);
48
- }, C = () => {
49
- console.log("[DateRangePicker] handleClear called"), i(void 0), b(""), y(""), f?.(void 0), m || x(!1);
50
- }, U = (e) => {
51
- const o = I(e.target.value, n);
52
- if (b(o), o === "") {
53
- const a = { from: void 0, to: r?.to };
54
- i(a), m || f?.(a);
27
+ size: D,
28
+ required: z,
29
+ className: L,
30
+ ...X
31
+ }, q) => {
32
+ const [s, b] = m.useState(!1), [o, l] = m.useState(t), [G, y] = m.useState(t?.from ? a(t.from, n) : ""), [H, w] = m.useState(t?.to ? a(t.to, n) : ""), [J, v] = m.useState(t?.from || /* @__PURE__ */ new Date());
33
+ m.useEffect(() => {
34
+ y(t?.from ? a(t.from, n) : ""), w(t?.to ? a(t.to, n) : "");
35
+ }, [t, n]), m.useEffect(() => {
36
+ s && (l(t), v(t?.from || /* @__PURE__ */ new Date()));
37
+ }, [s]);
38
+ const K = (e) => {
39
+ l(e), i || e?.from && e?.to && e.from.getTime() !== e.to.getTime() && (p?.(e), b(!1));
40
+ }, Q = (e) => {
41
+ let r = e !== void 0 ? e : o;
42
+ r?.from && !r.to && (r = { from: r.from, to: r.from }), p?.(r), b(!1);
43
+ }, U = () => {
44
+ l(t), b(!1);
45
+ }, S = () => {
46
+ l(void 0), y(""), w(""), p?.(void 0), i || b(!1);
47
+ }, W = (e) => {
48
+ const r = V(e.target.value, n);
49
+ if (y(r), r === "") {
50
+ const d = { from: void 0, to: o?.to };
51
+ l(d), i || p?.(d);
55
52
  return;
56
53
  }
57
- const d = k(o, n, /* @__PURE__ */ new Date());
58
- if (S(d)) {
59
- const a = { from: d, to: r?.to };
60
- i(a), w(d), m || f?.(a);
54
+ const f = I(r, n, /* @__PURE__ */ new Date());
55
+ if (M(f)) {
56
+ const d = { from: f, to: o?.to };
57
+ l(d), v(f), i || p?.(d);
61
58
  }
62
- }, W = (e) => {
63
- const o = I(e.target.value, n);
64
- if (y(o), o === "") {
65
- const a = { from: r?.from, to: void 0 };
66
- i(a), m || f?.(a);
59
+ }, Y = (e) => {
60
+ const r = V(e.target.value, n);
61
+ if (w(r), r === "") {
62
+ const d = { from: o?.from, to: void 0 };
63
+ l(d), i || p?.(d);
67
64
  return;
68
65
  }
69
- const d = k(o, n, /* @__PURE__ */ new Date());
70
- if (S(d)) {
71
- const a = { from: r?.from, to: d };
72
- i(a), d && w(d), m || f?.(a);
66
+ const f = I(r, n, /* @__PURE__ */ new Date());
67
+ if (M(f)) {
68
+ const d = { from: o?.from, to: f };
69
+ l(d), f && v(f), i || p?.(d);
73
70
  }
74
- }, N = () => {
75
- b(r?.from ? p(r.from, n) : ""), y(r?.to ? p(r.to, n) : "");
76
- };
77
- return /* @__PURE__ */ u("div", { className: "w-full space-y-1.5 min-w-[240px]", children: [
78
- D && /* @__PURE__ */ u(
71
+ }, P = () => {
72
+ s || (y(o?.from ? a(o.from, n) : ""), w(o?.to ? a(o.to, n) : ""));
73
+ }, Z = t?.from ? a(t.from, n) : "", $ = t?.to ? a(t.to, n) : "", k = i && s ? o?.from ? a(o.from, n) : "" : G, R = i && s ? o?.to ? a(o.to, n) : o?.from ? a(o.from, n) : "" : H, _ = i && s && k !== Z, F = i && s && R !== $;
74
+ return /* @__PURE__ */ u("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "date-range-picker", "data-disabled": x || void 0, children: [
75
+ N && /* @__PURE__ */ u(
79
76
  "label",
80
77
  {
81
- className: v(
78
+ className: g(
82
79
  "text-xs font-medium leading-[18px] text-[#60697d]",
83
- g && "opacity-70",
80
+ x && "opacity-70",
84
81
  h && "text-destructive"
85
82
  ),
86
83
  children: [
87
- D,
84
+ N,
88
85
  " ",
89
- E && /* @__PURE__ */ s("span", { className: "text-destructive", children: "*" })
86
+ z && /* @__PURE__ */ c("span", { className: "text-destructive", children: "*" })
90
87
  ]
91
88
  }
92
89
  ),
93
- /* @__PURE__ */ u(_, { open: l, onOpenChange: x, children: [
94
- /* @__PURE__ */ s(F, { asChild: !0, children: /* @__PURE__ */ u(
90
+ /* @__PURE__ */ u(oe, { open: s, onOpenChange: b, children: [
91
+ /* @__PURE__ */ c(re, { asChild: !0, children: /* @__PURE__ */ u(
95
92
  "div",
96
93
  {
97
- className: v(
98
- "flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 text-sm shadow-sm transition-colors hover:border-primary disabled:cursor-not-allowed disabled:bg-disabled-secondary-bg disabled:text-disabled-text disabled:border-border",
94
+ "data-state": s ? "open" : "closed",
95
+ className: g(
96
+ "flex w-full items-center justify-between gap-2 rounded-md border bg-white px-3 text-sm shadow-sm transition-colors hover:border-primary disabled:cursor-not-allowed disabled:bg-disabled-secondary-bg disabled:text-disabled-text disabled:border-border",
99
97
  h ? "border-destructive hover:border-destructive" : "border-input",
100
- R === "sm" ? "h-6" : R === "md" ? "h-[28px]" : "h-8",
101
- g && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
98
+ D === "sm" ? "h-6" : D === "md" ? "h-[28px]" : "h-8",
99
+ x && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
102
100
  "cursor-pointer",
103
- z
101
+ L
104
102
  ),
105
103
  children: [
106
104
  /* @__PURE__ */ u("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
107
- /* @__PURE__ */ s(
105
+ /* @__PURE__ */ c(
108
106
  "input",
109
107
  {
110
- ref: T,
108
+ ref: q,
111
109
  type: "text",
112
- value: X,
113
- onChange: U,
114
- onBlur: N,
115
- onClick: (e) => l && e.stopPropagation(),
116
- placeholder: l ? n : M,
117
- disabled: !!g,
118
- className: "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-[#dfe2e7] disabled:cursor-not-allowed disabled:opacity-50",
119
- ...L
110
+ value: k,
111
+ onChange: W,
112
+ onBlur: P,
113
+ onClick: (e) => s && e.stopPropagation(),
114
+ placeholder: s ? n : A,
115
+ disabled: !!x,
116
+ "data-field": "start",
117
+ className: g(
118
+ "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-[#dfe2e7] disabled:cursor-not-allowed disabled:opacity-50",
119
+ _ && "text-muted-foreground"
120
+ ),
121
+ ...X
120
122
  }
121
123
  ),
122
- /* @__PURE__ */ s(
124
+ /* @__PURE__ */ c(
123
125
  "input",
124
126
  {
125
127
  type: "text",
126
- value: q,
127
- onChange: W,
128
- onBlur: N,
129
- onClick: (e) => l && e.stopPropagation(),
130
- placeholder: l ? n : V,
131
- disabled: !!g,
132
- className: "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-[#dfe2e7] disabled:cursor-not-allowed disabled:opacity-50"
128
+ value: R,
129
+ onChange: Y,
130
+ onBlur: P,
131
+ onClick: (e) => s && e.stopPropagation(),
132
+ placeholder: s ? n : E,
133
+ disabled: !!x,
134
+ "data-field": "end",
135
+ className: g(
136
+ "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-[#dfe2e7] disabled:cursor-not-allowed disabled:opacity-50",
137
+ F && "text-muted-foreground"
138
+ )
133
139
  }
134
140
  )
135
141
  ] }),
136
142
  /* @__PURE__ */ u("div", { className: "flex items-center gap-1 shrink-0", children: [
137
- t?.from && !g && /* @__PURE__ */ s(
138
- Y,
143
+ t?.from && !x && /* @__PURE__ */ c(
144
+ ee,
139
145
  {
140
146
  className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
141
147
  onClick: (e) => {
142
- e.stopPropagation(), C();
148
+ e.stopPropagation(), S();
143
149
  }
144
150
  }
145
151
  ),
146
- /* @__PURE__ */ s(Z, { className: "h-4 w-4 text-secondary-foreground" })
152
+ /* @__PURE__ */ c(te, { className: "h-4 w-4 text-secondary-foreground" })
147
153
  ] })
148
154
  ]
149
155
  }
150
156
  ) }),
151
- /* @__PURE__ */ s(
152
- ee,
157
+ /* @__PURE__ */ c(
158
+ se,
153
159
  {
154
160
  className: "w-auto p-0",
155
161
  align: "start",
156
162
  onOpenAutoFocus: (e) => e.preventDefault(),
157
- onInteractOutside: (e) => e.preventDefault(),
158
- children: /* @__PURE__ */ s(
159
- te,
163
+ children: /* @__PURE__ */ c(
164
+ ie,
160
165
  {
161
166
  mode: "range",
162
- selected: r,
163
- onSelect: H,
164
- onPendingChange: J,
165
- month: G,
166
- onMonthChange: w,
167
- disabled: { before: A, after: O },
168
- fromYear: j,
169
- toYear: B,
170
- showFooter: m,
171
- onApply: K,
172
- onCancel: Q,
173
- onClear: C,
167
+ selected: o,
168
+ onSelect: K,
169
+ month: J,
170
+ onMonthChange: v,
171
+ disabled: { before: j, after: B },
172
+ fromYear: O,
173
+ toYear: T,
174
+ showFooter: i,
175
+ onApply: Q,
176
+ onCancel: U,
177
+ onClear: S,
174
178
  captionLayout: "dropdown"
175
179
  }
176
180
  )
177
181
  }
178
182
  )
179
183
  ] }),
180
- P && /* @__PURE__ */ u("div", { className: v("flex items-center gap-1", h && "text-destructive"), children: [
181
- !h && /* @__PURE__ */ s($, { size: 10, className: "shrink-0 text-muted-foreground" }),
182
- /* @__PURE__ */ s(
184
+ C && /* @__PURE__ */ u("div", { className: g("flex items-center gap-1", h && "text-destructive"), children: [
185
+ !h && /* @__PURE__ */ c(ne, { size: 10, className: "shrink-0 text-muted-foreground" }),
186
+ /* @__PURE__ */ c(
183
187
  "p",
184
188
  {
185
- className: v(
189
+ className: g(
186
190
  "text-[10px] text-[#7a8294]",
187
191
  h && "text-destructive"
188
192
  ),
189
- children: P
193
+ children: C
190
194
  }
191
195
  )
192
196
  ] })
193
197
  ] });
194
198
  }
195
199
  );
196
- ne.displayName = "DateRangePicker";
200
+ de.displayName = "DateRangePicker";
197
201
  export {
198
- ne as DateRangePicker
202
+ de as DateRangePicker
199
203
  };