impact-nova 1.3.0 → 1.5.2

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 (117) hide show
  1. package/README.md +49 -0
  2. package/dist/components/layout/dashboard-layout.d.ts +15 -1
  3. package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
  4. package/dist/components/ui/accordion.js +38 -34
  5. package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
  6. package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
  7. package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
  8. package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
  9. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
  10. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
  11. package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
  12. package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
  13. package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
  14. package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
  15. package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
  16. package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
  17. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
  18. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
  19. package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
  20. package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
  21. package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
  22. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
  23. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
  24. package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
  25. package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
  26. package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
  27. package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
  28. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
  29. package/dist/components/ui/alert.js +62 -58
  30. package/dist/components/ui/breadcrumb.js +81 -74
  31. package/dist/components/ui/calendar.js +354 -354
  32. package/dist/components/ui/chart/chart.js +63 -62
  33. package/dist/components/ui/chips.js +42 -38
  34. package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
  35. package/dist/components/ui/command-palette/command-palette-context.js +110 -0
  36. package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
  37. package/dist/components/ui/command-palette/command-palette.js +402 -0
  38. package/dist/components/ui/command-palette/index.d.ts +23 -0
  39. package/dist/components/ui/command-palette/index.js +44 -0
  40. package/dist/components/ui/command-palette/kbd.d.ts +28 -0
  41. package/dist/components/ui/command-palette/kbd.js +52 -0
  42. package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
  43. package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
  44. package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
  45. package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
  46. package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
  47. package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
  48. package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
  49. package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
  50. package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
  51. package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
  52. package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
  53. package/dist/components/ui/command-palette/use-shortcut.js +49 -0
  54. package/dist/components/ui/command-palette/utils.d.ts +119 -0
  55. package/dist/components/ui/command-palette/utils.js +248 -0
  56. package/dist/components/ui/data-table/data-table-column-list.js +87 -86
  57. package/dist/components/ui/data-table/data-table-format-options.js +45 -44
  58. package/dist/components/ui/data-table/data-table-view-options.js +39 -38
  59. package/dist/components/ui/date-picker/date-picker.js +89 -87
  60. package/dist/components/ui/date-picker/date-range-picker.js +140 -138
  61. package/dist/components/ui/date-picker/month-picker.js +82 -81
  62. package/dist/components/ui/date-picker/month-range-picker.js +108 -105
  63. package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
  64. package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
  65. package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
  66. package/dist/components/ui/date-picker/week-picker.js +117 -115
  67. package/dist/components/ui/date-picker/week-range-picker.js +166 -164
  68. package/dist/components/ui/dialog.js +78 -73
  69. package/dist/components/ui/drawer.js +71 -66
  70. package/dist/components/ui/file-upload.js +131 -127
  71. package/dist/components/ui/filter-panel/filter-panel.js +98 -94
  72. package/dist/components/ui/filter-strip/filter-strip.js +95 -91
  73. package/dist/components/ui/filter-strip/filter-summary.js +91 -90
  74. package/dist/components/ui/header.js +57 -53
  75. package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
  76. package/dist/components/ui/loader.js +17 -16
  77. package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
  78. package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
  79. package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
  80. package/dist/components/ui/nested-list/nested-list.js +184 -182
  81. package/dist/components/ui/notification-panel/notification-panel.js +60 -53
  82. package/dist/components/ui/popover.js +45 -40
  83. package/dist/components/ui/prompt.js +90 -86
  84. package/dist/components/ui/select/select.js +206 -209
  85. package/dist/components/ui/sheet.d.ts +1 -0
  86. package/dist/components/ui/sheet.js +50 -48
  87. package/dist/components/ui/sidebar.js +273 -267
  88. package/dist/components/ui/stepper.js +75 -63
  89. package/dist/components/ui/tag.js +48 -44
  90. package/dist/components/ui/toast.js +46 -41
  91. package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
  92. package/dist/i18n/ImpactNovaI18nContext.js +76 -0
  93. package/dist/i18n/defaultMessages.d.ts +231 -0
  94. package/dist/i18n/defaultMessages.js +206 -0
  95. package/dist/i18n/getDateFnsLocale.d.ts +11 -0
  96. package/dist/i18n/getDateFnsLocale.js +21 -0
  97. package/dist/i18n/index.d.ts +5 -0
  98. package/dist/i18n/locales/de.d.ts +2 -0
  99. package/dist/i18n/locales/de.js +206 -0
  100. package/dist/i18n/locales/es.d.ts +2 -0
  101. package/dist/i18n/locales/es.js +206 -0
  102. package/dist/i18n/locales/hi.d.ts +2 -0
  103. package/dist/i18n/locales/hi.js +206 -0
  104. package/dist/i18n/locales/index.d.ts +4 -0
  105. package/dist/i18n/locales/kn.d.ts +2 -0
  106. package/dist/i18n/locales/kn.js +206 -0
  107. package/dist/icons/assets/boxAdd.svg.js +5 -0
  108. package/dist/icons/assets/boxed.svg.js +5 -0
  109. package/dist/icons/assets/trolley.svg.js +5 -0
  110. package/dist/icons/assets/unlocked.svg.js +5 -0
  111. package/dist/icons/index.d.ts +4 -0
  112. package/dist/icons/index.js +179 -171
  113. package/dist/impact-nova.css +1 -1
  114. package/dist/index.d.ts +4 -0
  115. package/dist/index.js +232 -172
  116. package/package.json +36 -4
  117. package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
@@ -1,124 +1,125 @@
1
- import { jsxs as y, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as M, jsx as n } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
- import { X as G } from "lucide-react";
4
- import { CalendarMonth as J } from "../../../icons/index.js";
5
- import { isValid as g, parse as u } from "date-fns";
6
- import { cn as K, padValidDateString as L, maskDate as Q } from "../../../lib/utils.js";
7
- import { Input as U } from "../input.js";
8
- import { Popover as W, PopoverTrigger as Z, PopoverContent as _ } from "../popover.js";
9
- import { Calendar as F } from "../calendar.js";
10
- import { Tooltip as k, TooltipTrigger as T, TooltipContent as V } from "../tooltip.js";
11
- const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, v = o.forwardRef(
3
+ import { X as K } from "lucide-react";
4
+ import { CalendarMonth as L } from "../../../icons/index.js";
5
+ import { isValid as u, parse as C } from "date-fns";
6
+ import { cn as Q, padValidDateString as U, maskDate as W } from "../../../lib/utils.js";
7
+ import { Input as Z } from "../input.js";
8
+ import { Popover as _, PopoverTrigger as F, PopoverContent as v } from "../popover.js";
9
+ import { Calendar as tt } from "../calendar.js";
10
+ import { Tooltip as I, TooltipTrigger as T, TooltipContent as N } from "../tooltip.js";
11
+ import { useImpactNovaI18n as et } from "../../../i18n/ImpactNovaI18nContext.js";
12
+ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt = o.forwardRef(
12
13
  ({
13
14
  value: t,
14
15
  onChange: s,
15
- placeholder: I = "Select Month",
16
- minDate: N,
17
- maxDate: Y,
18
- startMonth: A,
19
- endMonth: R,
16
+ placeholder: V,
17
+ minDate: A,
18
+ maxDate: R,
19
+ startMonth: O,
20
+ endMonth: Y,
20
21
  showFooter: d = !0,
21
- disabled: C,
22
- className: O,
23
- ...j
24
- }, B) => {
25
- const S = o.useRef(null);
26
- o.useRef(null), o.useImperativeHandle(B, () => S.current);
27
- const [r, h] = o.useState(!1), [w, i] = o.useState(t), [p, a] = o.useState(t ? c(t) : ""), [E, M] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
22
+ disabled: P,
23
+ className: j,
24
+ ...B
25
+ }, E) => {
26
+ const { t: m } = et(), $ = V ?? m("datePicker.selectMonth"), w = o.useRef(null);
27
+ o.useRef(null), o.useImperativeHandle(E, () => w.current);
28
+ const [r, h] = o.useState(!1), [S, a] = o.useState(t), [l, i] = o.useState(t ? c(t) : ""), [b, g] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
28
29
  o.useEffect(() => {
29
- r || (a(t ? c(t) : ""), i(t));
30
+ r || (i(t ? c(t) : ""), a(t));
30
31
  }, [r, t]), o.useEffect(() => {
31
- r && (i(t), M(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), a(t ? c(t) : ""));
32
+ r && (a(t), g(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), i(t ? c(t) : ""));
32
33
  }, [r, t]);
33
- const $ = (e) => {
34
- i(e), e && a(c(e)), d || (s?.(e), h(!1));
35
- }, b = (e) => {
36
- s?.(e !== void 0 ? e : w), h(!1);
37
- }, H = () => {
38
- i(t), a(t ? c(t) : ""), h(!1);
39
- }, D = () => {
40
- i(void 0), a(""), s?.(void 0), d || h(!1);
34
+ const H = (e) => {
35
+ a(e), e && i(c(e)), d || (s?.(e), h(!1));
41
36
  }, X = (e) => {
42
- const l = e.target.value, f = Q(l, "MM/yyyy", p);
43
- if (a(f), f === "") {
44
- i(void 0), d || s?.(void 0);
37
+ s?.(e !== void 0 ? e : S), h(!1);
38
+ }, q = () => {
39
+ a(t), i(t ? c(t) : ""), h(!1);
40
+ }, k = () => {
41
+ a(void 0), i(""), s?.(void 0), d || h(!1);
42
+ }, z = (e) => {
43
+ const p = e.target.value, f = W(p, "MM/yyyy", l);
44
+ if (i(f), f === "") {
45
+ a(void 0), d || s?.(void 0);
45
46
  return;
46
47
  }
47
- const m = u(f, "MM/yyyy", /* @__PURE__ */ new Date());
48
- if (g(m) && f.length === 7) {
49
- const x = { month: m.getMonth(), year: m.getFullYear() };
50
- i(x), M(m), d || s?.(x);
48
+ const y = C(f, "MM/yyyy", /* @__PURE__ */ new Date());
49
+ if (u(y) && f.length === 7) {
50
+ const x = { month: y.getMonth(), year: y.getFullYear() };
51
+ a(x), g(y), d || s?.(x);
51
52
  }
52
- }, q = () => {
53
+ }, G = () => {
53
54
  if (r) return;
54
- const e = L(p, "MM/yyyy"), l = u(e, "MM/yyyy", /* @__PURE__ */ new Date());
55
- if (!g(l) || e.length !== 7)
56
- a(t ? c(t) : ""), i(t);
57
- else if (a(e), !d) {
58
- const f = { month: l.getMonth(), year: l.getFullYear() };
55
+ const e = U(l, "MM/yyyy"), p = C(e, "MM/yyyy", /* @__PURE__ */ new Date());
56
+ if (!u(p) || e.length !== 7)
57
+ i(t ? c(t) : ""), a(t);
58
+ else if (i(e), !d) {
59
+ const f = { month: p.getMonth(), year: p.getFullYear() };
59
60
  s?.(f);
60
61
  }
61
- }, P = (t ? c(t) : "") !== p, z = p.length === 7 && !g(u(p, "MM/yyyy", /* @__PURE__ */ new Date()));
62
- return /* @__PURE__ */ y(W, { open: r, onOpenChange: h, children: [
63
- /* @__PURE__ */ n(Z, { asChild: !0, children: /* @__PURE__ */ n("div", { "data-component": "month-picker", "data-state": r ? "open" : "closed", "data-pending": P || void 0, children: /* @__PURE__ */ n(
64
- U,
62
+ }, D = (t ? c(t) : "") !== l, J = l.length === 7 && !u(C(l, "MM/yyyy", /* @__PURE__ */ new Date()));
63
+ return /* @__PURE__ */ M(_, { open: r, onOpenChange: h, children: [
64
+ /* @__PURE__ */ n(F, { asChild: !0, children: /* @__PURE__ */ n("div", { "data-component": "month-picker", "data-state": r ? "open" : "closed", "data-pending": D || void 0, children: /* @__PURE__ */ n(
65
+ Z,
65
66
  {
66
- ref: S,
67
- value: p,
68
- onChange: X,
69
- onBlur: q,
67
+ ref: w,
68
+ value: l,
69
+ onChange: z,
70
+ onBlur: G,
70
71
  onClick: (e) => r && e.stopPropagation(),
71
- placeholder: r ? "MM/YYYY" : I,
72
- disabled: C,
72
+ placeholder: r ? m("datePicker.monthYearFormat") : $,
73
+ disabled: P,
73
74
  "data-form-control": "input",
74
- className: K(
75
+ className: Q(
75
76
  "cursor-pointer",
76
- z ? "text-destructive" : P ? "text-muted-foreground" : "",
77
- O
77
+ J ? "text-destructive" : D ? "text-muted-foreground" : "",
78
+ j
78
79
  ),
79
- suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
80
- t && !C && /* @__PURE__ */ y(k, { children: [
80
+ suffix: /* @__PURE__ */ M("div", { className: "flex items-center gap-1", children: [
81
+ t && !P && /* @__PURE__ */ M(I, { children: [
81
82
  /* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(
82
- G,
83
+ K,
83
84
  {
84
85
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
85
86
  onClick: (e) => {
86
- e.stopPropagation(), D();
87
+ e.stopPropagation(), k();
87
88
  }
88
89
  }
89
90
  ) }),
90
- /* @__PURE__ */ n(V, { variant: "tertiary", side: "top", children: "Clear" })
91
+ /* @__PURE__ */ n(N, { variant: "tertiary", side: "top", children: m("calendar.clear") })
91
92
  ] }),
92
- /* @__PURE__ */ y(k, { children: [
93
- /* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(J, { className: "h-4 w-4 text-secondary-foreground" }) }),
94
- /* @__PURE__ */ n(V, { variant: "tertiary", side: "top", children: "Pick a month" })
93
+ /* @__PURE__ */ M(I, { children: [
94
+ /* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(L, { className: "h-4 w-4 text-secondary-foreground" }) }),
95
+ /* @__PURE__ */ n(N, { variant: "tertiary", side: "top", children: m("datePicker.selectMonth") })
95
96
  ] })
96
97
  ] }),
97
- ...j
98
+ ...B
98
99
  }
99
100
  ) }) }),
100
101
  /* @__PURE__ */ n(
101
- _,
102
+ v,
102
103
  {
103
104
  className: "w-auto p-0",
104
105
  align: "start",
105
106
  onOpenAutoFocus: (e) => e.preventDefault(),
106
107
  children: /* @__PURE__ */ n(
107
- F,
108
+ tt,
108
109
  {
109
110
  pickerType: "month",
110
111
  monthMode: "single",
111
- selectedMonths: w,
112
- onMonthSelect: $,
113
- month: E,
114
- onMonthChange: M,
115
- disabled: { before: N, after: Y },
116
- startMonth: A,
117
- endMonth: R,
112
+ selectedMonths: S,
113
+ onMonthSelect: H,
114
+ month: b,
115
+ onMonthChange: g,
116
+ disabled: { before: A, after: R },
117
+ startMonth: O,
118
+ endMonth: Y,
118
119
  showFooter: d,
119
- onApply: b,
120
- onCancel: H,
121
- onClear: D
120
+ onApply: X,
121
+ onCancel: q,
122
+ onClear: k
122
123
  }
123
124
  )
124
125
  }
@@ -126,7 +127,7 @@ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, v = o
126
127
  ] });
127
128
  }
128
129
  );
129
- v.displayName = "MonthPicker";
130
+ nt.displayName = "MonthPicker";
130
131
  export {
131
- v as MonthPicker
132
+ nt as MonthPicker
132
133
  };
@@ -1,127 +1,130 @@
1
1
  import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { X as dt } from "lucide-react";
4
- import { CalendarMonth as st, Info as at } from "../../../icons/index.js";
5
- import { isValid as b, parse as w } from "date-fns";
6
- import { cn as S, padValidDateString as T, maskDate as A } from "../../../lib/utils.js";
7
- import { Popover as it, PopoverTrigger as ct, PopoverContent as lt } from "../popover.js";
8
- import { Calendar as mt } from "../calendar.js";
9
- import { Tooltip as j, TooltipTrigger as B, TooltipContent as O } from "../tooltip.js";
10
- const n = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, ft = s.forwardRef(
2
+ import * as d from "react";
3
+ import { X as ct } from "lucide-react";
4
+ import { CalendarMonth as lt, Info as mt } from "../../../icons/index.js";
5
+ import { isValid as w, parse as S } from "date-fns";
6
+ import { cn as P, padValidDateString as A, maskDate as j } from "../../../lib/utils.js";
7
+ import { Popover as ft, PopoverTrigger as pt, PopoverContent as ht } from "../popover.js";
8
+ import { Calendar as yt } from "../calendar.js";
9
+ import { Tooltip as B, TooltipTrigger as O, TooltipContent as $ } from "../tooltip.js";
10
+ import { useImpactNovaI18n as ut } from "../../../i18n/ImpactNovaI18nContext.js";
11
+ const n = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, gt = d.forwardRef(
11
12
  ({
12
13
  value: t,
13
14
  onChange: l,
14
- placeholder: pt = "Select Month Range",
15
- minDate: $,
16
- maxDate: z,
17
- startMonth: H,
18
- endMonth: X,
15
+ placeholder: z,
16
+ minDate: H,
17
+ maxDate: X,
18
+ startMonth: q,
19
+ endMonth: v,
19
20
  showFooter: p = !0,
20
- disabled: g,
21
- className: q,
22
- isError: C,
21
+ disabled: x,
22
+ className: F,
23
+ isError: k,
23
24
  size: N,
24
- label: D,
25
- helperText: I,
25
+ label: I,
26
+ helperText: D,
26
27
  required: G,
27
- prefix: ht,
28
- prefixClick: yt,
28
+ prefix: xt,
29
+ prefixClick: Mt,
29
30
  ...J
30
31
  }, K) => {
31
- const Y = s.useRef(null), L = s.useRef(null);
32
- s.useRef(null), s.useRef(null), s.useImperativeHandle(K, () => Y.current);
33
- const [a, P] = s.useState(!1), [k, i] = s.useState(t), [x, h] = s.useState(t?.from ? n(t.from) : ""), [M, y] = s.useState(t?.to ? n(t.to) : ""), [Q, R] = s.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : /* @__PURE__ */ new Date());
34
- s.useEffect(() => {
35
- a || (h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), i(t));
36
- }, [a, t]), s.useEffect(() => {
37
- a && (i(t), h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), R(t?.from ? new Date(t.from.year, t.from.month, 1) : /* @__PURE__ */ new Date()));
38
- }, [a, t]);
32
+ const { t: u } = ut();
33
+ z ?? u("datePicker.selectMonthRange");
34
+ const V = d.useRef(null), L = d.useRef(null);
35
+ d.useRef(null), d.useRef(null), d.useImperativeHandle(K, () => V.current);
36
+ const [s, R] = d.useState(!1), [E, i] = d.useState(t), [M, h] = d.useState(t?.from ? n(t.from) : ""), [b, y] = d.useState(t?.to ? n(t.to) : ""), [Q, C] = d.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : /* @__PURE__ */ new Date());
37
+ d.useEffect(() => {
38
+ s || (h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), i(t));
39
+ }, [s, t]), d.useEffect(() => {
40
+ s && (i(t), h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), C(t?.from ? new Date(t.from.year, t.from.month, 1) : /* @__PURE__ */ new Date()));
41
+ }, [s, t]);
39
42
  const U = (e) => {
40
- i(e), e?.from && h(n(e.from)), e?.to && y(n(e.to)), !p && e?.from && e?.to && (e.from.month !== e.to.month || e.from.year !== e.to.year) && (l?.(e), P(!1));
43
+ i(e), e?.from && h(n(e.from)), e?.to && y(n(e.to)), !p && e?.from && e?.to && (e.from.month !== e.to.month || e.from.year !== e.to.year) && (l?.(e), R(!1));
41
44
  }, W = (e) => {
42
- l?.(e !== void 0 ? e : k), P(!1);
45
+ l?.(e !== void 0 ? e : E), R(!1);
43
46
  }, Z = () => {
44
- i(t), h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), P(!1);
45
- }, V = () => {
46
- i(void 0), h(""), y(""), l?.(void 0), p || P(!1);
47
- }, v = (e) => {
48
- const m = e.target.value, r = A(m, "MM/yyyy", x);
47
+ i(t), h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), R(!1);
48
+ }, T = () => {
49
+ i(void 0), h(""), y(""), l?.(void 0), p || R(!1);
50
+ }, _ = (e) => {
51
+ const m = e.target.value, r = j(m, "MM/yyyy", M);
49
52
  if (h(r), r === "") {
50
53
  const c = { from: void 0, to: t?.to };
51
54
  i(c), p || l?.(c);
52
55
  return;
53
56
  }
54
- const d = w(r, "MM/yyyy", /* @__PURE__ */ new Date());
55
- if (b(d) && r.length === 7) {
56
- const u = { from: { month: d.getMonth(), year: d.getFullYear() }, to: t?.to };
57
- i(u), R(d), p || l?.(u);
57
+ const a = S(r, "MM/yyyy", /* @__PURE__ */ new Date());
58
+ if (w(a) && r.length === 7) {
59
+ const g = { from: { month: a.getMonth(), year: a.getFullYear() }, to: t?.to };
60
+ i(g), C(a), p || l?.(g);
58
61
  }
59
- }, F = (e) => {
60
- const m = e.target.value, r = A(m, "MM/yyyy", M);
62
+ }, tt = (e) => {
63
+ const m = e.target.value, r = j(m, "MM/yyyy", b);
61
64
  if (y(r), r === "") {
62
65
  const c = { from: t?.from, to: void 0 };
63
66
  i(c), p || l?.(c);
64
67
  return;
65
68
  }
66
- const d = w(r, "MM/yyyy", /* @__PURE__ */ new Date());
67
- if (b(d) && r.length === 7) {
68
- const c = { month: d.getMonth(), year: d.getFullYear() }, u = { from: t?.from, to: c };
69
- i(u), R(d), p || l?.(u);
69
+ const a = S(r, "MM/yyyy", /* @__PURE__ */ new Date());
70
+ if (w(a) && r.length === 7) {
71
+ const c = { month: a.getMonth(), year: a.getFullYear() }, g = { from: t?.from, to: c };
72
+ i(g), C(a), p || l?.(g);
70
73
  }
71
- }, E = () => {
72
- if (a) return;
73
- const e = T(x, "MM/yyyy"), m = T(M, "MM/yyyy"), r = w(e, "MM/yyyy", /* @__PURE__ */ new Date()), d = w(m, "MM/yyyy", /* @__PURE__ */ new Date()), c = b(r) && e.length === 7, u = b(d) && m.length === 7;
74
- !c || !u ? (h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), i(t)) : (h(e), y(m), p || l?.({
74
+ }, Y = () => {
75
+ if (s) return;
76
+ const e = A(M, "MM/yyyy"), m = A(b, "MM/yyyy"), r = S(e, "MM/yyyy", /* @__PURE__ */ new Date()), a = S(m, "MM/yyyy", /* @__PURE__ */ new Date()), c = w(r) && e.length === 7, g = w(a) && m.length === 7;
77
+ !c || !g ? (h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), i(t)) : (h(e), y(m), p || l?.({
75
78
  from: { month: r.getMonth(), year: r.getFullYear() },
76
- to: { month: d.getMonth(), year: d.getFullYear() }
79
+ to: { month: a.getMonth(), year: a.getFullYear() }
77
80
  }));
78
- }, _ = t?.from ? n(t.from) : "", tt = t?.to ? n(t.to) : "", et = x !== _, ot = M !== tt, nt = x.length === 7 && !b(w(x, "MM/yyyy", /* @__PURE__ */ new Date())), rt = M.length === 7 && !b(w(M, "MM/yyyy", /* @__PURE__ */ new Date()));
79
- return /* @__PURE__ */ f("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "month-range-picker", "data-disabled": g || void 0, children: [
80
- D && /* @__PURE__ */ f(
81
+ }, et = t?.from ? n(t.from) : "", ot = t?.to ? n(t.to) : "", nt = M !== et, rt = b !== ot, at = M.length === 7 && !w(S(M, "MM/yyyy", /* @__PURE__ */ new Date())), dt = b.length === 7 && !w(S(b, "MM/yyyy", /* @__PURE__ */ new Date())), st = u("datePicker.startMonth"), it = u("datePicker.endMonth");
82
+ return /* @__PURE__ */ f("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "month-range-picker", "data-disabled": x || void 0, children: [
83
+ I && /* @__PURE__ */ f(
81
84
  "label",
82
85
  {
83
- className: S(
86
+ className: P(
84
87
  "text-xs font-medium leading-[18px] text-[#60697d]",
85
- g && "opacity-70",
86
- C && "text-destructive"
88
+ x && "opacity-70",
89
+ k && "text-destructive"
87
90
  ),
88
91
  children: [
89
- D,
92
+ I,
90
93
  " ",
91
94
  G && /* @__PURE__ */ o("span", { className: "text-destructive", children: "*" })
92
95
  ]
93
96
  }
94
97
  ),
95
- /* @__PURE__ */ f(it, { open: a, onOpenChange: P, children: [
96
- /* @__PURE__ */ o(ct, { asChild: !0, children: /* @__PURE__ */ f(
98
+ /* @__PURE__ */ f(ft, { open: s, onOpenChange: R, children: [
99
+ /* @__PURE__ */ o(pt, { asChild: !0, children: /* @__PURE__ */ f(
97
100
  "div",
98
101
  {
99
- "data-state": a ? "open" : "closed",
100
- className: S(
102
+ "data-state": s ? "open" : "closed",
103
+ className: P(
101
104
  "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",
102
- C ? "border-destructive hover:border-destructive" : "border-input",
105
+ k ? "border-destructive hover:border-destructive" : "border-input",
103
106
  N === "sm" ? "h-6" : N === "md" ? "h-[28px]" : "h-8",
104
- g && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
107
+ x && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
105
108
  "cursor-pointer",
106
- q
109
+ F
107
110
  ),
108
111
  children: [
109
112
  /* @__PURE__ */ f("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
110
113
  /* @__PURE__ */ o(
111
114
  "input",
112
115
  {
113
- ref: Y,
116
+ ref: V,
114
117
  type: "text",
115
- value: x,
116
- onChange: v,
117
- onBlur: E,
118
- onClick: (e) => a && e.stopPropagation(),
119
- placeholder: a ? "MM/YYYY" : "Start Month",
120
- disabled: !!g,
118
+ value: M,
119
+ onChange: _,
120
+ onBlur: Y,
121
+ onClick: (e) => s && e.stopPropagation(),
122
+ placeholder: s ? u("datePicker.monthYearFormat") : st,
123
+ disabled: !!x,
121
124
  "data-field": "start",
122
- className: S(
125
+ className: P(
123
126
  "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",
124
- nt ? "text-destructive" : et ? "text-muted-foreground" : ""
127
+ at ? "text-destructive" : nt ? "text-muted-foreground" : ""
125
128
  ),
126
129
  ...J
127
130
  }
@@ -131,85 +134,85 @@ const n = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, ft =
131
134
  {
132
135
  ref: L,
133
136
  type: "text",
134
- value: M,
135
- onChange: F,
136
- onBlur: E,
137
- onClick: (e) => a && e.stopPropagation(),
138
- placeholder: a ? "MM/YYYY" : "End Month",
139
- disabled: !!g,
137
+ value: b,
138
+ onChange: tt,
139
+ onBlur: Y,
140
+ onClick: (e) => s && e.stopPropagation(),
141
+ placeholder: s ? u("datePicker.monthYearFormat") : it,
142
+ disabled: !!x,
140
143
  "data-field": "end",
141
- className: S(
144
+ className: P(
142
145
  "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",
143
- rt ? "text-destructive" : ot ? "text-muted-foreground" : ""
146
+ dt ? "text-destructive" : rt ? "text-muted-foreground" : ""
144
147
  )
145
148
  }
146
149
  )
147
150
  ] }),
148
151
  /* @__PURE__ */ f("div", { className: "flex items-center gap-1 shrink-0", children: [
149
- t?.from && !g && /* @__PURE__ */ f(j, { children: [
150
- /* @__PURE__ */ o(B, { asChild: !0, children: /* @__PURE__ */ o(
151
- dt,
152
+ t?.from && !x && /* @__PURE__ */ f(B, { children: [
153
+ /* @__PURE__ */ o(O, { asChild: !0, children: /* @__PURE__ */ o(
154
+ ct,
152
155
  {
153
156
  className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
154
157
  onClick: (e) => {
155
- e.stopPropagation(), V();
158
+ e.stopPropagation(), T();
156
159
  }
157
160
  }
158
161
  ) }),
159
- /* @__PURE__ */ o(O, { variant: "tertiary", side: "top", children: "Clear" })
162
+ /* @__PURE__ */ o($, { variant: "tertiary", side: "top", children: u("calendar.clear") })
160
163
  ] }),
161
- /* @__PURE__ */ f(j, { children: [
162
- /* @__PURE__ */ o(B, { asChild: !0, children: /* @__PURE__ */ o(st, { className: "h-4 w-4 text-secondary-foreground" }) }),
163
- /* @__PURE__ */ o(O, { variant: "tertiary", side: "top", children: "Pick a range" })
164
+ /* @__PURE__ */ f(B, { children: [
165
+ /* @__PURE__ */ o(O, { asChild: !0, children: /* @__PURE__ */ o(lt, { className: "h-4 w-4 text-secondary-foreground" }) }),
166
+ /* @__PURE__ */ o($, { variant: "tertiary", side: "top", children: u("datePicker.selectMonthRange") })
164
167
  ] })
165
168
  ] })
166
169
  ]
167
170
  }
168
171
  ) }),
169
172
  /* @__PURE__ */ o(
170
- lt,
173
+ ht,
171
174
  {
172
175
  className: "w-auto p-0",
173
176
  align: "start",
174
177
  onOpenAutoFocus: (e) => e.preventDefault(),
175
178
  children: /* @__PURE__ */ o(
176
- mt,
179
+ yt,
177
180
  {
178
181
  pickerType: "month",
179
182
  monthMode: "range",
180
- selectedMonths: k,
183
+ selectedMonths: E,
181
184
  onMonthSelect: U,
182
185
  month: Q,
183
- onMonthChange: R,
184
- disabled: { before: $, after: z },
185
- startMonth: H,
186
- endMonth: X,
186
+ onMonthChange: C,
187
+ disabled: { before: H, after: X },
188
+ startMonth: q,
189
+ endMonth: v,
187
190
  showFooter: p,
188
191
  onApply: W,
189
192
  onCancel: Z,
190
- onClear: V
193
+ onClear: T
191
194
  }
192
195
  )
193
196
  }
194
197
  )
195
198
  ] }),
196
- I && /* @__PURE__ */ f("div", { className: S("flex items-center gap-1", C && "text-destructive"), children: [
197
- !C && /* @__PURE__ */ o(at, { size: 10, className: "shrink-0 text-muted-foreground" }),
199
+ D && /* @__PURE__ */ f("div", { className: P("flex items-center gap-1", k && "text-destructive"), children: [
200
+ !k && /* @__PURE__ */ o(mt, { size: 10, className: "shrink-0 text-muted-foreground" }),
198
201
  /* @__PURE__ */ o(
199
202
  "p",
200
203
  {
201
- className: S(
204
+ className: P(
202
205
  "text-[10px] text-[#7a8294]",
203
- C && "text-destructive"
206
+ k && "text-destructive"
204
207
  ),
205
- children: I
208
+ children: D
206
209
  }
207
210
  )
208
211
  ] })
209
212
  ] });
210
213
  }
211
214
  );
212
- ft.displayName = "MonthRangePicker";
215
+ gt.displayName = "MonthRangePicker";
213
216
  export {
214
- ft as MonthRangePicker
217
+ gt as MonthRangePicker
215
218
  };