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,199 +1,208 @@
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 g, jsx as p } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { X as re } from "lucide-react";
4
+ import { CalendarMonth as ie, Info as de } from "../../../icons/index.js";
5
+ import { format as s, isValid as S, parse as D } from "date-fns";
6
+ import { cn as N, padValidDateString as A, maskDate as j } from "../../../lib/utils.js";
7
+ import { Popover as ce, PopoverTrigger as le, PopoverContent as fe } from "../popover.js";
8
+ import { Calendar as pe } from "../calendar.js";
9
+ const ae = i.forwardRef(
10
10
  ({
11
- value: t,
12
- onChange: f,
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,
11
+ value: e,
12
+ onChange: a,
13
+ format: t = "MM/dd/yyyy",
14
+ startPlaceholder: B = "Start Date",
15
+ endPlaceholder: O = "End Date",
16
+ minDate: T,
17
+ maxDate: z,
18
+ fromYear: H,
19
+ toYear: L,
20
20
  showFooter: m = !0,
21
- disabled: g,
22
- label: D,
23
- helperText: P,
24
- prefix: oe,
25
- prefixClick: re,
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);
21
+ disabled: x,
22
+ label: P,
23
+ helperText: V,
24
+ prefix: me,
25
+ prefixClick: ue,
26
+ isError: R,
27
+ size: k,
28
+ required: X,
29
+ className: q,
30
+ ...G
31
+ }, J) => {
32
+ const E = i.useRef(null), K = i.useRef(null);
33
+ i.useRef(null), i.useRef(null), i.useImperativeHandle(J, () => E.current);
34
+ const [c, C] = i.useState(!1), [b, f] = i.useState(e), [w, u] = i.useState(e?.from ? s(e.from, t) : ""), [y, h] = i.useState(e?.to ? s(e.to, t) : ""), [Q, I] = i.useState(e?.from || /* @__PURE__ */ new Date());
35
+ i.useEffect(() => {
36
+ !c && e && (u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), f(e));
37
+ }, [e, t, c]), i.useEffect(() => {
38
+ c && (f(e), u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), I(e?.from || /* @__PURE__ */ new Date()));
39
+ }, [c, e]);
40
+ const U = (n) => {
41
+ f(n), n?.from && u(s(n.from, t)), n?.to && h(s(n.to, t)), m || n?.from && n?.to && n.from.getTime() !== n.to.getTime() && (a?.(n), C(!1));
42
+ }, W = (n) => {
43
+ let o = n !== void 0 ? n : b;
44
+ o?.from && !o.to && (o = { from: o.from, to: o.from }), a?.(o), C(!1);
45
+ }, Y = () => {
46
+ f(e), u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), C(!1);
47
+ }, M = () => {
48
+ f(void 0), u(""), h(""), a?.(void 0), m || C(!1);
49
+ }, Z = (n) => {
50
+ const o = n.target.value, d = j(o, t, w);
51
+ if (u(d), d === "") {
52
+ const r = { from: void 0, to: b?.to };
53
+ f(r), m || a?.(r);
55
54
  return;
56
55
  }
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);
56
+ const l = D(d, t, /* @__PURE__ */ new Date());
57
+ if (S(l) && d.length === t.length) {
58
+ const r = { from: l, to: b?.to };
59
+ f(r), I(l), m || a?.(r);
61
60
  }
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);
61
+ }, $ = (n) => {
62
+ const o = n.target.value, d = j(o, t, y);
63
+ if (h(d), d === "") {
64
+ const r = { from: b?.from, to: void 0 };
65
+ f(r), m || a?.(r);
67
66
  return;
68
67
  }
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);
68
+ const l = D(d, t, /* @__PURE__ */ new Date());
69
+ if (S(l) && d.length === t.length) {
70
+ const r = { from: b?.from, to: l };
71
+ f(r), l && I(l), m || a?.(r);
73
72
  }
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(
73
+ }, v = () => {
74
+ if (c) return;
75
+ const n = A(w, t), o = A(y, t), d = D(n, t, /* @__PURE__ */ new Date()), l = D(o, t, /* @__PURE__ */ new Date()), r = S(d) && n.length === t.length, se = S(l) && o.length === t.length;
76
+ !r || !se ? (u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), f(e)) : (u(n), h(o), m || a?.({ from: d, to: l }));
77
+ }, _ = e?.from ? s(e.from, t) : "", F = e?.to ? s(e.to, t) : "", ee = w !== _, te = y !== F, ne = w.length === t.length && !S(D(w, t, /* @__PURE__ */ new Date())), oe = y.length === t.length && !S(D(y, t, /* @__PURE__ */ new Date()));
78
+ return /* @__PURE__ */ g("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "date-range-picker", "data-disabled": x || void 0, children: [
79
+ P && /* @__PURE__ */ g(
79
80
  "label",
80
81
  {
81
- className: v(
82
+ className: N(
82
83
  "text-xs font-medium leading-[18px] text-[#60697d]",
83
- g && "opacity-70",
84
- h && "text-destructive"
84
+ x && "opacity-70",
85
+ R && "text-destructive"
85
86
  ),
86
87
  children: [
87
- D,
88
+ P,
88
89
  " ",
89
- E && /* @__PURE__ */ s("span", { className: "text-destructive", children: "*" })
90
+ X && /* @__PURE__ */ p("span", { className: "text-destructive", children: "*" })
90
91
  ]
91
92
  }
92
93
  ),
93
- /* @__PURE__ */ u(_, { open: l, onOpenChange: x, children: [
94
- /* @__PURE__ */ s(F, { asChild: !0, children: /* @__PURE__ */ u(
94
+ /* @__PURE__ */ g(ce, { open: c, onOpenChange: C, children: [
95
+ /* @__PURE__ */ p(le, { asChild: !0, children: /* @__PURE__ */ g(
95
96
  "div",
96
97
  {
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",
99
- 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
+ "data-state": c ? "open" : "closed",
99
+ className: N(
100
+ "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",
101
+ R ? "border-destructive hover:border-destructive" : "border-input",
102
+ k === "sm" ? "h-6" : k === "md" ? "h-[28px]" : "h-8",
103
+ x && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
102
104
  "cursor-pointer",
103
- z
105
+ q
104
106
  ),
105
107
  children: [
106
- /* @__PURE__ */ u("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
107
- /* @__PURE__ */ s(
108
+ /* @__PURE__ */ g("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
109
+ /* @__PURE__ */ p(
108
110
  "input",
109
111
  {
110
- ref: T,
112
+ ref: E,
111
113
  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
114
+ value: w,
115
+ onChange: Z,
116
+ onBlur: v,
117
+ onClick: (n) => c && n.stopPropagation(),
118
+ placeholder: c ? t : B,
119
+ disabled: !!x,
120
+ "data-field": "start",
121
+ className: N(
122
+ "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",
123
+ ne ? "text-destructive" : ee ? "text-muted-foreground" : ""
124
+ ),
125
+ ...G
120
126
  }
121
127
  ),
122
- /* @__PURE__ */ s(
128
+ /* @__PURE__ */ p(
123
129
  "input",
124
130
  {
131
+ ref: K,
125
132
  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"
133
+ value: y,
134
+ onChange: $,
135
+ onBlur: v,
136
+ onClick: (n) => c && n.stopPropagation(),
137
+ placeholder: c ? t : O,
138
+ disabled: !!x,
139
+ "data-field": "end",
140
+ className: N(
141
+ "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",
142
+ oe ? "text-destructive" : te ? "text-muted-foreground" : ""
143
+ )
133
144
  }
134
145
  )
135
146
  ] }),
136
- /* @__PURE__ */ u("div", { className: "flex items-center gap-1 shrink-0", children: [
137
- t?.from && !g && /* @__PURE__ */ s(
138
- Y,
147
+ /* @__PURE__ */ g("div", { className: "flex items-center gap-1 shrink-0", children: [
148
+ e?.from && !x && /* @__PURE__ */ p(
149
+ re,
139
150
  {
140
151
  className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
141
- onClick: (e) => {
142
- e.stopPropagation(), C();
152
+ onClick: (n) => {
153
+ n.stopPropagation(), M();
143
154
  }
144
155
  }
145
156
  ),
146
- /* @__PURE__ */ s(Z, { className: "h-4 w-4 text-secondary-foreground" })
157
+ /* @__PURE__ */ p(ie, { className: "h-4 w-4 text-secondary-foreground" })
147
158
  ] })
148
159
  ]
149
160
  }
150
161
  ) }),
151
- /* @__PURE__ */ s(
152
- ee,
162
+ /* @__PURE__ */ p(
163
+ fe,
153
164
  {
154
165
  className: "w-auto p-0",
155
166
  align: "start",
156
- onOpenAutoFocus: (e) => e.preventDefault(),
157
- onInteractOutside: (e) => e.preventDefault(),
158
- children: /* @__PURE__ */ s(
159
- te,
167
+ onOpenAutoFocus: (n) => n.preventDefault(),
168
+ children: /* @__PURE__ */ p(
169
+ pe,
160
170
  {
161
171
  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,
172
+ selected: b,
173
+ onSelect: U,
174
+ month: Q,
175
+ onMonthChange: I,
176
+ disabled: { before: T, after: z },
177
+ fromYear: H,
178
+ toYear: L,
170
179
  showFooter: m,
171
- onApply: K,
172
- onCancel: Q,
173
- onClear: C,
180
+ onApply: W,
181
+ onCancel: Y,
182
+ onClear: M,
174
183
  captionLayout: "dropdown"
175
184
  }
176
185
  )
177
186
  }
178
187
  )
179
188
  ] }),
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(
189
+ V && /* @__PURE__ */ g("div", { className: N("flex items-center gap-1", R && "text-destructive"), children: [
190
+ !R && /* @__PURE__ */ p(de, { size: 10, className: "shrink-0 text-muted-foreground" }),
191
+ /* @__PURE__ */ p(
183
192
  "p",
184
193
  {
185
- className: v(
194
+ className: N(
186
195
  "text-[10px] text-[#7a8294]",
187
- h && "text-destructive"
196
+ R && "text-destructive"
188
197
  ),
189
- children: P
198
+ children: V
190
199
  }
191
200
  )
192
201
  ] })
193
202
  ] });
194
203
  }
195
204
  );
196
- ne.displayName = "DateRangePicker";
205
+ ae.displayName = "DateRangePicker";
197
206
  export {
198
- ne as DateRangePicker
207
+ ae as DateRangePicker
199
208
  };
@@ -1,114 +1,117 @@
1
- import { jsxs as P, jsx as o } from "react/jsx-runtime";
2
- import * as r from "react";
3
- import { X as B } from "lucide-react";
4
- import { CalendarMonth as E } from "../../../icons/index.js";
5
- import { parse as T, isValid as j } from "date-fns";
6
- import { cn as R, maskDate as $ } from "../../../lib/utils.js";
7
- import { Input as X } from "../input.js";
8
- import { Popover as q, PopoverTrigger as z, PopoverContent as G } from "../popover.js";
9
- import { Calendar as H } from "../calendar.js";
10
- const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, J = r.forwardRef(
1
+ import { jsxs as P, jsx as i } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { X } from "lucide-react";
4
+ import { CalendarMonth as q } from "../../../icons/index.js";
5
+ import { isValid as M, parse as g } from "date-fns";
6
+ import { cn as z, padValidDateString as G, maskDate as J } from "../../../lib/utils.js";
7
+ import { Input as K } from "../input.js";
8
+ import { Popover as L, PopoverTrigger as Q, PopoverContent as U } from "../popover.js";
9
+ import { Calendar as W } from "../calendar.js";
10
+ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, Z = n.forwardRef(
11
11
  ({
12
- value: e,
12
+ value: t,
13
13
  onChange: a,
14
- placeholder: C = "Select Month",
15
- minDate: k,
16
- maxDate: S,
17
- fromYear: D,
18
- toYear: w,
19
- showFooter: i = !0,
14
+ placeholder: k = "Select Month",
15
+ minDate: V,
16
+ maxDate: I,
17
+ fromYear: N,
18
+ toYear: Y,
19
+ showFooter: p = !0,
20
20
  disabled: u,
21
- className: x,
22
- ...I
23
- }, N) => {
24
- const [l, p] = r.useState(!1), [c, s] = r.useState(e), [M, h] = r.useState(e ? f(e) : ""), [A, m] = r.useState(() => e ? new Date(e.year, e.month, 1) : /* @__PURE__ */ new Date());
25
- r.useEffect(() => {
26
- h(e ? f(e) : "");
27
- }, [e]), r.useEffect(() => {
28
- console.log("[MonthPicker] useEffect - open:", l, "value:", e, "pendingMonth:", c), l && (s(e), m(e ? new Date(e.year, e.month, 1) : /* @__PURE__ */ new Date()));
29
- }, [l]);
30
- const Y = (n) => {
31
- console.log("[MonthPicker] handleSelect called:", n), s(n), i || (console.log("[MonthPicker] No footer - applying immediately"), a?.(n), p(!1));
32
- }, O = (n) => {
33
- const t = n;
34
- h(t ? f(t) : "");
35
- }, V = (n) => {
36
- const t = n !== void 0 ? n : c;
37
- console.log("[MonthPicker] handleApply called, appliedMonth:", n, "pendingMonth:", c, "using:", t), a?.(t), p(!1);
38
- }, v = () => {
39
- console.log("[MonthPicker] handleCancel called"), s(e), p(!1);
40
- }, g = () => {
41
- console.log("[MonthPicker] handleClear called"), s(void 0), h(""), a?.(void 0), i || p(!1);
42
- };
43
- return /* @__PURE__ */ P(q, { open: l, onOpenChange: p, children: [
44
- /* @__PURE__ */ o(z, { asChild: !0, children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
45
- X,
21
+ className: A,
22
+ ...R
23
+ }, T) => {
24
+ const S = n.useRef(null);
25
+ n.useRef(null), n.useImperativeHandle(T, () => S.current);
26
+ const [o, m] = n.useState(!1), [w, r] = n.useState(t), [d, s] = n.useState(t ? c(t) : ""), [O, y] = n.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
27
+ n.useEffect(() => {
28
+ !o && t && (s(c(t)), r(t));
29
+ }, [o, t]), n.useEffect(() => {
30
+ o && (r(t), y(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), s(t ? c(t) : ""));
31
+ }, [o, t]);
32
+ const j = (e) => {
33
+ r(e), e && s(c(e)), p || (a?.(e), m(!1));
34
+ }, B = (e) => {
35
+ a?.(e !== void 0 ? e : w), m(!1);
36
+ }, E = () => {
37
+ r(t), s(t ? c(t) : ""), m(!1);
38
+ }, D = () => {
39
+ r(void 0), s(""), a?.(void 0), p || m(!1);
40
+ }, $ = (e) => {
41
+ const f = e.target.value, l = J(f, "MM/yyyy", d);
42
+ if (s(l), l === "") {
43
+ r(void 0), p || a?.(void 0);
44
+ return;
45
+ }
46
+ const h = g(l, "MM/yyyy", /* @__PURE__ */ new Date());
47
+ if (M(h) && l.length === 7) {
48
+ const C = { month: h.getMonth(), year: h.getFullYear() };
49
+ r(C), y(h), p || a?.(C);
50
+ }
51
+ }, b = () => {
52
+ if (o) return;
53
+ const e = G(d, "MM/yyyy"), f = g(e, "MM/yyyy", /* @__PURE__ */ new Date());
54
+ if (!M(f) || e.length !== 7)
55
+ s(t ? c(t) : ""), r(t);
56
+ else if (s(e), !p) {
57
+ const l = { month: f.getMonth(), year: f.getFullYear() };
58
+ a?.(l);
59
+ }
60
+ }, x = (t ? c(t) : "") !== d, H = d.length === 7 && !M(g(d, "MM/yyyy", /* @__PURE__ */ new Date()));
61
+ return /* @__PURE__ */ P(L, { open: o, onOpenChange: m, children: [
62
+ /* @__PURE__ */ i(Q, { asChild: !0, children: /* @__PURE__ */ i("div", { "data-component": "month-picker", "data-state": o ? "open" : "closed", "data-pending": x || void 0, children: /* @__PURE__ */ i(
63
+ K,
46
64
  {
47
- ref: N,
48
- value: M,
49
- onChange: (n) => {
50
- const t = $(n.target.value, "MM/yyyy");
51
- if (h(t), t === "") {
52
- s(void 0), i || a?.(void 0);
53
- return;
54
- }
55
- const d = T(t, "MM/yyyy", /* @__PURE__ */ new Date());
56
- if (j(d)) {
57
- const y = { month: d.getMonth(), year: d.getFullYear() };
58
- s(y), m(d), i || a?.(y);
59
- }
60
- },
61
- onBlur: () => {
62
- if (M === "") {
63
- g();
64
- return;
65
- }
66
- h(c ? f(c) : "");
67
- },
68
- onClick: (n) => l && n.stopPropagation(),
69
- placeholder: l ? "MM/YYYY" : C,
65
+ ref: S,
66
+ value: d,
67
+ onChange: $,
68
+ onBlur: b,
69
+ onClick: (e) => o && e.stopPropagation(),
70
+ placeholder: o ? "MM/YYYY" : k,
70
71
  disabled: u,
71
- className: R("cursor-pointer", x),
72
+ "data-form-control": "input",
73
+ className: z(
74
+ "cursor-pointer",
75
+ H ? "text-destructive" : x ? "text-muted-foreground" : "",
76
+ A
77
+ ),
72
78
  suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
73
- e && !u && /* @__PURE__ */ o(
74
- B,
79
+ t && !u && /* @__PURE__ */ i(
80
+ X,
75
81
  {
76
82
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
77
- onClick: (n) => {
78
- n.stopPropagation(), g();
83
+ onClick: (e) => {
84
+ e.stopPropagation(), D();
79
85
  }
80
86
  }
81
87
  ),
82
- /* @__PURE__ */ o(E, { className: "h-4 w-4 text-secondary-foreground" })
88
+ /* @__PURE__ */ i(q, { className: "h-4 w-4 text-secondary-foreground" })
83
89
  ] }),
84
- ...I
90
+ ...R
85
91
  }
86
92
  ) }) }),
87
- /* @__PURE__ */ o(
88
- G,
93
+ /* @__PURE__ */ i(
94
+ U,
89
95
  {
90
96
  className: "w-auto p-0",
91
97
  align: "start",
92
- onOpenAutoFocus: (n) => n.preventDefault(),
93
- onInteractOutside: (n) => n.preventDefault(),
94
- children: /* @__PURE__ */ o(
95
- H,
98
+ onOpenAutoFocus: (e) => e.preventDefault(),
99
+ children: /* @__PURE__ */ i(
100
+ W,
96
101
  {
97
102
  pickerType: "month",
98
103
  monthMode: "single",
99
- selectedMonths: c,
100
- onMonthSelect: Y,
101
- onPendingChange: O,
102
- month: A,
103
- onMonthChange: m,
104
- fromDate: k,
105
- toDate: S,
106
- fromYear: D,
107
- toYear: w,
108
- showFooter: i,
109
- onApply: V,
110
- onCancel: v,
111
- onClear: g
104
+ selectedMonths: w,
105
+ onMonthSelect: j,
106
+ month: O,
107
+ onMonthChange: y,
108
+ disabled: { before: V, after: I },
109
+ fromYear: N,
110
+ toYear: Y,
111
+ showFooter: p,
112
+ onApply: B,
113
+ onCancel: E,
114
+ onClear: D
112
115
  }
113
116
  )
114
117
  }
@@ -116,7 +119,7 @@ const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, J = r
116
119
  ] });
117
120
  }
118
121
  );
119
- J.displayName = "MonthPicker";
122
+ Z.displayName = "MonthPicker";
120
123
  export {
121
- J as MonthPicker
124
+ Z as MonthPicker
122
125
  };