impact-nova 1.2.4 → 1.5.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 (123) 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.js +1 -1
  16. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
  17. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
  18. package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
  19. package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
  20. package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
  21. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
  22. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
  23. package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
  24. package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
  25. package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
  26. package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
  27. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
  28. package/dist/components/ui/alert.d.ts +1 -1
  29. package/dist/components/ui/alert.js +76 -60
  30. package/dist/components/ui/breadcrumb.js +81 -74
  31. package/dist/components/ui/calendar.js +355 -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 -85
  84. package/dist/components/ui/select/select.js +225 -229
  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/tabs.d.ts +11 -1
  90. package/dist/components/ui/tabs.js +79 -54
  91. package/dist/components/ui/tag.js +48 -44
  92. package/dist/components/ui/toast.js +46 -41
  93. package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
  94. package/dist/i18n/ImpactNovaI18nContext.js +76 -0
  95. package/dist/i18n/defaultMessages.d.ts +231 -0
  96. package/dist/i18n/defaultMessages.js +206 -0
  97. package/dist/i18n/getDateFnsLocale.d.ts +11 -0
  98. package/dist/i18n/getDateFnsLocale.js +21 -0
  99. package/dist/i18n/index.d.ts +5 -0
  100. package/dist/i18n/locales/de.d.ts +2 -0
  101. package/dist/i18n/locales/de.js +206 -0
  102. package/dist/i18n/locales/es.d.ts +2 -0
  103. package/dist/i18n/locales/es.js +206 -0
  104. package/dist/i18n/locales/hi.d.ts +2 -0
  105. package/dist/i18n/locales/hi.js +206 -0
  106. package/dist/i18n/locales/index.d.ts +4 -0
  107. package/dist/i18n/locales/kn.d.ts +2 -0
  108. package/dist/i18n/locales/kn.js +206 -0
  109. package/dist/icons/assets/boxAdd.svg.js +5 -0
  110. package/dist/icons/assets/boxed.svg.js +5 -0
  111. package/dist/icons/assets/trolley.svg.js +5 -0
  112. package/dist/icons/assets/unlocked.svg.js +5 -0
  113. package/dist/icons/assets/webp/delete-3d.webp.js +4 -0
  114. package/dist/icons/assets/webp/info-3d.webp.js +4 -0
  115. package/dist/icons/assets/webp/success-3d.webp.js +4 -0
  116. package/dist/icons/assets/webp/warning-3d.webp.js +4 -0
  117. package/dist/icons/index.d.ts +8 -0
  118. package/dist/icons/index.js +197 -181
  119. package/dist/impact-nova.css +1 -1
  120. package/dist/index.d.ts +4 -0
  121. package/dist/index.js +260 -199
  122. package/package.json +36 -4
  123. package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
@@ -1,118 +1,120 @@
1
- import { jsxs as y, jsx as r } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { X as J } from "lucide-react";
4
- import { CalendarMonth as K } from "../../../icons/index.js";
5
- import { format as f, isValid as P, parse as x } from "date-fns";
6
- import { cn as Q, padValidDateString as U, maskDate as W } from "../../../lib/utils.js";
7
- import { Input as Y } from "../input.js";
8
- import { Popover as Z, PopoverTrigger as _, PopoverContent as $ } from "../popover.js";
9
- import { Calendar as F } from "../calendar.js";
10
- import { Tooltip as T, TooltipTrigger as V, TooltipContent as I } from "../tooltip.js";
11
- const ee = i.forwardRef(
1
+ import { jsxs as C, jsx as r } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import { X as W } from "lucide-react";
4
+ import { CalendarMonth as Y } from "../../../icons/index.js";
5
+ import { format as f, isValid as k, parse as w } from "date-fns";
6
+ import { cn as Z, padValidDateString as _, maskDate as $ } from "../../../lib/utils.js";
7
+ import { Input as F } from "../input.js";
8
+ import { Popover as ee, PopoverTrigger as ne, PopoverContent as te } from "../popover.js";
9
+ import { Calendar as oe } from "../calendar.js";
10
+ import { Tooltip as T, TooltipTrigger as V, TooltipContent as A } from "../tooltip.js";
11
+ import { getDateFnsLocale as re } from "../../../i18n/getDateFnsLocale.js";
12
+ import { useImpactNovaI18n as le } from "../../../i18n/ImpactNovaI18nContext.js";
13
+ const ce = o.forwardRef(
12
14
  ({
13
15
  value: e,
14
16
  onChange: p,
15
17
  format: t = "MM/dd/yyyy",
16
- placeholder: M = "Select Date",
17
- minDate: N,
18
- maxDate: A,
19
- startMonth: v,
20
- endMonth: E,
21
- showFooter: a = !0,
22
- disabled: S,
23
- className: O,
24
- ...j
25
- }, B) => {
26
- const h = i.useRef(null), g = i.useRef(null);
27
- i.useImperativeHandle(B, () => h.current);
28
- const [o, d] = i.useState(!1), [w, s] = i.useState(e), [c, l] = i.useState(e ? f(e, t) : ""), [b, C] = i.useState(e || /* @__PURE__ */ new Date());
29
- i.useEffect(() => {
30
- h.current && g.current !== null && (h.current.setSelectionRange(g.current, g.current), g.current = null);
31
- }, [c]), i.useEffect(() => {
32
- o || (l(e ? f(e, t) : ""), s(e));
33
- }, [e, t, o]), i.useEffect(() => {
34
- o && (s(e), C(e || /* @__PURE__ */ new Date()));
35
- }, [o, e]);
36
- const H = (n) => {
37
- s(n), n && l(f(n, t)), a || (p?.(n), d(!1));
38
- }, L = (n) => {
39
- p?.(n !== void 0 ? n : w), d(!1);
40
- }, X = () => {
41
- s(e), l(e ? f(e, t) : ""), d(!1);
42
- }, k = () => {
43
- s(void 0), l(""), p?.(void 0), a || d(!1);
44
- }, q = (n) => {
45
- const u = n.target.value, m = W(u, t, c);
46
- if (l(m), m === "") {
47
- s(void 0), a || p?.(void 0);
18
+ placeholder: v,
19
+ minDate: L,
20
+ maxDate: E,
21
+ startMonth: O,
22
+ endMonth: j,
23
+ showFooter: d = !0,
24
+ disabled: I,
25
+ className: B,
26
+ ...b
27
+ }, H) => {
28
+ const { locale: S, t: P } = le(), l = o.useMemo(() => re(S), [S]), X = v ?? P("datePicker.selectDate"), m = o.useRef(null), g = o.useRef(null);
29
+ o.useImperativeHandle(H, () => m.current);
30
+ const [c, u] = o.useState(!1), [M, i] = o.useState(e), [s, a] = o.useState(e ? f(e, t, { locale: l }) : ""), [q, x] = o.useState(e || /* @__PURE__ */ new Date());
31
+ o.useEffect(() => {
32
+ m.current && g.current !== null && (m.current.setSelectionRange(g.current, g.current), g.current = null);
33
+ }, [s]), o.useEffect(() => {
34
+ c || (a(e ? f(e, t, { locale: l }) : ""), i(e));
35
+ }, [e, t, c, l]), o.useEffect(() => {
36
+ c && (i(e), x(e || /* @__PURE__ */ new Date()));
37
+ }, [c, e]);
38
+ const z = (n) => {
39
+ i(n), n && a(f(n, t, { locale: l })), d || (p?.(n), u(!1));
40
+ }, G = (n) => {
41
+ p?.(n !== void 0 ? n : M), u(!1);
42
+ }, J = () => {
43
+ i(e), a(e ? f(e, t, { locale: l }) : ""), u(!1);
44
+ }, N = () => {
45
+ i(void 0), a(""), p?.(void 0), d || u(!1);
46
+ }, K = (n) => {
47
+ const h = n.target.value, D = $(h, t, s);
48
+ if (a(D), D === "") {
49
+ i(void 0), d || p?.(void 0);
48
50
  return;
49
51
  }
50
- const D = x(m, t, /* @__PURE__ */ new Date());
51
- P(D) && m.length === t.length && (s(D), C(D), a || p?.(D));
52
- }, z = () => {
53
- if (o) return;
54
- const n = U(c, t), u = x(n, t, /* @__PURE__ */ new Date());
55
- !P(u) || n.length !== t.length ? (l(e ? f(e, t) : ""), s(e)) : (l(n), a || p?.(u));
56
- }, R = (e ? f(e, t) : "") !== c, G = c.length === t.length && !P(x(c, t, /* @__PURE__ */ new Date()));
57
- return /* @__PURE__ */ y(Z, { open: o, onOpenChange: d, children: [
58
- /* @__PURE__ */ r(_, { asChild: !0, children: /* @__PURE__ */ r("div", { "data-component": "date-picker", "data-state": o ? "open" : "closed", "data-pending": R || void 0, children: /* @__PURE__ */ r(
59
- Y,
52
+ const y = w(D, t, /* @__PURE__ */ new Date(), { locale: l });
53
+ k(y) && D.length === t.length && (i(y), x(y), d || p?.(y));
54
+ }, Q = () => {
55
+ if (c) return;
56
+ const n = _(s, t), h = w(n, t, /* @__PURE__ */ new Date(), { locale: l });
57
+ !k(h) || n.length !== t.length ? (a(e ? f(e, t, { locale: l }) : ""), i(e)) : (a(n), d || p?.(h));
58
+ }, R = (e ? f(e, t, { locale: l }) : "") !== s, U = s.length === t.length && !k(w(s, t, /* @__PURE__ */ new Date(), { locale: l }));
59
+ return /* @__PURE__ */ C(ee, { open: c, onOpenChange: u, children: [
60
+ /* @__PURE__ */ r(ne, { asChild: !0, children: /* @__PURE__ */ r("div", { "data-component": "date-picker", "data-state": c ? "open" : "closed", "data-pending": R || void 0, children: /* @__PURE__ */ r(
61
+ F,
60
62
  {
61
- ref: h,
62
- value: c,
63
- onChange: q,
64
- onBlur: z,
65
- onClick: (n) => o && n.stopPropagation(),
66
- placeholder: o ? t : M,
67
- disabled: S,
63
+ ref: m,
64
+ value: s,
65
+ onChange: K,
66
+ onBlur: Q,
67
+ onClick: (n) => c && n.stopPropagation(),
68
+ placeholder: c ? t : X,
69
+ disabled: I,
68
70
  "data-form-control": "input",
69
- className: Q(
71
+ className: Z(
70
72
  "cursor-pointer",
71
- G ? "text-destructive" : R ? "text-muted-foreground" : "",
72
- O
73
+ U ? "text-destructive" : R ? "text-muted-foreground" : "",
74
+ B
73
75
  ),
74
- suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
75
- e && !S && /* @__PURE__ */ y(T, { children: [
76
+ suffix: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
77
+ e && !I && /* @__PURE__ */ C(T, { children: [
76
78
  /* @__PURE__ */ r(V, { asChild: !0, children: /* @__PURE__ */ r(
77
- J,
79
+ W,
78
80
  {
79
81
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
80
82
  onClick: (n) => {
81
- n.stopPropagation(), k();
83
+ n.stopPropagation(), N();
82
84
  }
83
85
  }
84
86
  ) }),
85
- /* @__PURE__ */ r(I, { variant: "tertiary", side: "top", children: "Clear" })
87
+ /* @__PURE__ */ r(A, { variant: "tertiary", side: "top", children: P("calendar.clear") })
86
88
  ] }),
87
- /* @__PURE__ */ y(T, { children: [
88
- /* @__PURE__ */ r(V, { asChild: !0, children: /* @__PURE__ */ r(K, { className: "h-4 w-4 text-secondary-foreground" }) }),
89
- /* @__PURE__ */ r(I, { variant: "tertiary", side: "top", children: "Pick a date" })
89
+ /* @__PURE__ */ C(T, { children: [
90
+ /* @__PURE__ */ r(V, { asChild: !0, children: /* @__PURE__ */ r(Y, { className: "h-4 w-4 text-secondary-foreground" }) }),
91
+ /* @__PURE__ */ r(A, { variant: "tertiary", side: "top", children: P("datePicker.selectDate") })
90
92
  ] })
91
93
  ] }),
92
- ...j
94
+ ...b
93
95
  }
94
96
  ) }) }),
95
97
  /* @__PURE__ */ r(
96
- $,
98
+ te,
97
99
  {
98
100
  className: "w-auto p-0",
99
101
  align: "start",
100
102
  onOpenAutoFocus: (n) => n.preventDefault(),
101
103
  children: /* @__PURE__ */ r(
102
- F,
104
+ oe,
103
105
  {
104
106
  mode: "single",
105
- selected: w,
106
- onSelect: H,
107
- month: b,
108
- onMonthChange: C,
109
- disabled: { before: N, after: A },
110
- startMonth: v,
111
- endMonth: E,
112
- showFooter: a,
113
- onApply: L,
114
- onCancel: X,
115
- onClear: k,
107
+ selected: M,
108
+ onSelect: z,
109
+ month: q,
110
+ onMonthChange: x,
111
+ disabled: { before: L, after: E },
112
+ startMonth: O,
113
+ endMonth: j,
114
+ showFooter: d,
115
+ onApply: G,
116
+ onCancel: J,
117
+ onClear: N,
116
118
  captionLayout: "dropdown"
117
119
  }
118
120
  )
@@ -121,7 +123,7 @@ const ee = i.forwardRef(
121
123
  ] });
122
124
  }
123
125
  );
124
- ee.displayName = "DatePicker";
126
+ ce.displayName = "DatePicker";
125
127
  export {
126
- ee as DatePicker
128
+ ce as DatePicker
127
129
  };
@@ -1,215 +1,217 @@
1
- import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
- import * as d from "react";
3
- import { X as le } from "lucide-react";
4
- import { CalendarMonth as ce, Info as fe } from "../../../icons/index.js";
5
- import { format as i, isValid as C, parse as S } from "date-fns";
6
- import { cn as D, padValidDateString as M, maskDate as A } from "../../../lib/utils.js";
7
- import { Popover as ae, PopoverTrigger as pe, PopoverContent as me } from "../popover.js";
8
- import { Calendar as he } from "../calendar.js";
9
- import { Tooltip as j, TooltipTrigger as B, TooltipContent as O } from "../tooltip.js";
10
- const ue = d.forwardRef(
1
+ import { jsxs as m, jsx as l } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { X as me } from "lucide-react";
4
+ import { CalendarMonth as he, Info as ue } from "../../../icons/index.js";
5
+ import { format as i, isValid as C, parse as D } from "date-fns";
6
+ import { cn as N, padValidDateString as j, maskDate as B } from "../../../lib/utils.js";
7
+ import { Popover as ge, PopoverTrigger as xe, PopoverContent as be } from "../popover.js";
8
+ import { Calendar as we } from "../calendar.js";
9
+ import { Tooltip as O, TooltipTrigger as z, TooltipContent as H } from "../tooltip.js";
10
+ import { getDateFnsLocale as ye } from "../../../i18n/getDateFnsLocale.js";
11
+ import { useImpactNovaI18n as Pe } from "../../../i18n/ImpactNovaI18nContext.js";
12
+ const Ce = s.forwardRef(
11
13
  ({
12
14
  value: e,
13
- onChange: m,
15
+ onChange: h,
14
16
  format: t = "MM/dd/yyyy",
15
- startPlaceholder: z = "Start Date",
16
- endPlaceholder: H = "End Date",
17
- minDate: L,
18
- maxDate: X,
19
- startMonth: q,
20
- endMonth: G,
21
- showFooter: h = !0,
22
- disabled: x,
23
- label: P,
24
- helperText: k,
25
- prefix: ge,
26
- prefixClick: xe,
27
- isError: N,
28
- size: V,
29
- required: J,
30
- className: K,
31
- ...Q
32
- }, U) => {
33
- const E = d.useRef(null), W = d.useRef(null);
34
- d.useRef(null), d.useRef(null), d.useImperativeHandle(U, () => E.current);
35
- const [c, R] = d.useState(!1), [b, a] = d.useState(e), [w, u] = d.useState(e?.from ? i(e.from, t) : ""), [y, g] = d.useState(e?.to ? i(e.to, t) : ""), [Y, I] = d.useState(e?.from || /* @__PURE__ */ new Date());
36
- d.useEffect(() => {
37
- c || (u(e?.from ? i(e.from, t) : ""), g(e?.to ? i(e.to, t) : ""), a(e));
38
- }, [e, t, c]), d.useEffect(() => {
39
- c && (a(e), u(e?.from ? i(e.from, t) : ""), g(e?.to ? i(e.to, t) : ""), I(e?.from || /* @__PURE__ */ new Date()));
40
- }, [c, e]);
41
- const Z = (n) => {
42
- a(n), n?.from && u(i(n.from, t)), n?.to && g(i(n.to, t)), h || n?.from && n?.to && n.from.getTime() !== n.to.getTime() && (m?.(n), R(!1));
43
- }, $ = (n) => {
44
- let o = n !== void 0 ? n : b;
45
- o?.from && !o.to && (o = { from: o.from, to: o.from }), m?.(o), R(!1);
46
- }, _ = () => {
47
- a(e), u(e?.from ? i(e.from, t) : ""), g(e?.to ? i(e.to, t) : ""), R(!1);
48
- }, v = () => {
49
- a(void 0), u(""), g(""), m?.(void 0), h || R(!1);
50
- }, F = (n) => {
51
- const o = n.target.value, l = A(o, t, w);
52
- if (u(l), l === "") {
53
- const s = { from: void 0, to: b?.to };
54
- a(s), h || m?.(s);
17
+ startPlaceholder: X,
18
+ endPlaceholder: q,
19
+ minDate: G,
20
+ maxDate: J,
21
+ startMonth: K,
22
+ endMonth: Q,
23
+ showFooter: u = !0,
24
+ disabled: b,
25
+ label: V,
26
+ helperText: v,
27
+ prefix: De,
28
+ prefixClick: Ne,
29
+ isError: R,
30
+ size: M,
31
+ required: U,
32
+ className: W,
33
+ ...Y
34
+ }, Z) => {
35
+ const { locale: E, t: I } = Pe(), o = s.useMemo(() => ye(E), [E]), $ = X ?? I("datePicker.startDate"), _ = q ?? I("datePicker.endDate"), T = s.useRef(null), F = s.useRef(null);
36
+ s.useRef(null), s.useRef(null), s.useImperativeHandle(Z, () => T.current);
37
+ const [a, S] = s.useState(!1), [w, p] = s.useState(e), [y, g] = s.useState(e?.from ? i(e.from, t, { locale: o }) : ""), [P, x] = s.useState(e?.to ? i(e.to, t, { locale: o }) : ""), [ee, k] = s.useState(e?.from || /* @__PURE__ */ new Date());
38
+ s.useEffect(() => {
39
+ a || (g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), p(e));
40
+ }, [e, t, a, o]), s.useEffect(() => {
41
+ a && (p(e), g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), k(e?.from || /* @__PURE__ */ new Date()));
42
+ }, [a, e, t, o]);
43
+ const te = (n) => {
44
+ p(n), n?.from && g(i(n.from, t, { locale: o })), n?.to && x(i(n.to, t, { locale: o })), u || n?.from && n?.to && n.from.getTime() !== n.to.getTime() && (h?.(n), S(!1));
45
+ }, ne = (n) => {
46
+ let r = n !== void 0 ? n : w;
47
+ r?.from && !r.to && (r = { from: r.from, to: r.from }), h?.(r), S(!1);
48
+ }, oe = () => {
49
+ p(e), g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), S(!1);
50
+ }, A = () => {
51
+ p(void 0), g(""), x(""), h?.(void 0), u || S(!1);
52
+ }, re = (n) => {
53
+ const r = n.target.value, d = B(r, t, y);
54
+ if (g(d), d === "") {
55
+ const c = { from: void 0, to: w?.to };
56
+ p(c), u || h?.(c);
55
57
  return;
56
58
  }
57
- const f = S(l, t, /* @__PURE__ */ new Date());
58
- if (C(f) && l.length === t.length) {
59
- const s = { from: f, to: b?.to };
60
- a(s), I(f), h || m?.(s);
59
+ const f = D(d, t, /* @__PURE__ */ new Date(), { locale: o });
60
+ if (C(f) && d.length === t.length) {
61
+ const c = { from: f, to: w?.to };
62
+ p(c), k(f), u || h?.(c);
61
63
  }
62
- }, ee = (n) => {
63
- const o = n.target.value, l = A(o, t, y);
64
- if (g(l), l === "") {
65
- const s = { from: b?.from, to: void 0 };
66
- a(s), h || m?.(s);
64
+ }, le = (n) => {
65
+ const r = n.target.value, d = B(r, t, P);
66
+ if (x(d), d === "") {
67
+ const c = { from: w?.from, to: void 0 };
68
+ p(c), u || h?.(c);
67
69
  return;
68
70
  }
69
- const f = S(l, t, /* @__PURE__ */ new Date());
70
- if (C(f) && l.length === t.length) {
71
- const s = { from: b?.from, to: f };
72
- a(s), f && I(f), h || m?.(s);
71
+ const f = D(d, t, /* @__PURE__ */ new Date(), { locale: o });
72
+ if (C(f) && d.length === t.length) {
73
+ const c = { from: w?.from, to: f };
74
+ p(c), f && k(f), u || h?.(c);
73
75
  }
74
- }, T = () => {
75
- if (c) return;
76
- const n = M(w, t), o = M(y, t), l = S(n, t, /* @__PURE__ */ new Date()), f = S(o, t, /* @__PURE__ */ new Date()), s = C(l) && n.length === t.length, de = C(f) && o.length === t.length;
77
- !s || !de ? (u(e?.from ? i(e.from, t) : ""), g(e?.to ? i(e.to, t) : ""), a(e)) : (u(n), g(o), h || m?.({ from: l, to: f }));
78
- }, te = e?.from ? i(e.from, t) : "", ne = e?.to ? i(e.to, t) : "", oe = w !== te, re = y !== ne, ie = w.length === t.length && !C(S(w, t, /* @__PURE__ */ new Date())), se = y.length === t.length && !C(S(y, t, /* @__PURE__ */ new Date()));
79
- return /* @__PURE__ */ p("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "date-range-picker", "data-disabled": x || void 0, children: [
80
- P && /* @__PURE__ */ p(
76
+ }, L = () => {
77
+ if (a) return;
78
+ const n = j(y, t), r = j(P, t), d = D(n, t, /* @__PURE__ */ new Date(), { locale: o }), f = D(r, t, /* @__PURE__ */ new Date(), { locale: o }), c = C(d) && n.length === t.length, pe = C(f) && r.length === t.length;
79
+ !c || !pe ? (g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), p(e)) : (g(n), x(r), u || h?.({ from: d, to: f }));
80
+ }, se = e?.from ? i(e.from, t, { locale: o }) : "", ie = e?.to ? i(e.to, t, { locale: o }) : "", ce = y !== se, de = P !== ie, ae = y.length === t.length && !C(D(y, t, /* @__PURE__ */ new Date(), { locale: o })), fe = P.length === t.length && !C(D(P, t, /* @__PURE__ */ new Date(), { locale: o }));
81
+ return /* @__PURE__ */ m("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "date-range-picker", "data-disabled": b || void 0, children: [
82
+ V && /* @__PURE__ */ m(
81
83
  "label",
82
84
  {
83
- className: D(
85
+ className: N(
84
86
  "text-xs font-medium leading-[18px] text-[#60697d]",
85
- x && "opacity-70",
86
- N && "text-destructive"
87
+ b && "opacity-70",
88
+ R && "text-destructive"
87
89
  ),
88
90
  children: [
89
- P,
91
+ V,
90
92
  " ",
91
- J && /* @__PURE__ */ r("span", { className: "text-destructive", children: "*" })
93
+ U && /* @__PURE__ */ l("span", { className: "text-destructive", children: "*" })
92
94
  ]
93
95
  }
94
96
  ),
95
- /* @__PURE__ */ p(ae, { open: c, onOpenChange: R, children: [
96
- /* @__PURE__ */ r(pe, { asChild: !0, children: /* @__PURE__ */ p(
97
+ /* @__PURE__ */ m(ge, { open: a, onOpenChange: S, children: [
98
+ /* @__PURE__ */ l(xe, { asChild: !0, children: /* @__PURE__ */ m(
97
99
  "div",
98
100
  {
99
- "data-state": c ? "open" : "closed",
100
- className: D(
101
+ "data-state": a ? "open" : "closed",
102
+ className: N(
101
103
  "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
- N ? "border-destructive hover:border-destructive" : "border-input",
103
- V === "sm" ? "h-6" : V === "md" ? "h-[28px]" : "h-8",
104
- x && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
104
+ R ? "border-destructive hover:border-destructive" : "border-input",
105
+ M === "sm" ? "h-6" : M === "md" ? "h-[28px]" : "h-8",
106
+ b && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
105
107
  "cursor-pointer",
106
- K
108
+ W
107
109
  ),
108
110
  children: [
109
- /* @__PURE__ */ p("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
110
- /* @__PURE__ */ r(
111
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
112
+ /* @__PURE__ */ l(
111
113
  "input",
112
114
  {
113
- ref: E,
115
+ ref: T,
114
116
  type: "text",
115
- value: w,
116
- onChange: F,
117
- onBlur: T,
118
- onClick: (n) => c && n.stopPropagation(),
119
- placeholder: c ? t : z,
120
- disabled: !!x,
117
+ value: y,
118
+ onChange: re,
119
+ onBlur: L,
120
+ onClick: (n) => a && n.stopPropagation(),
121
+ placeholder: a ? t : $,
122
+ disabled: !!b,
121
123
  "data-field": "start",
122
- className: D(
124
+ className: N(
123
125
  "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
- ie ? "text-destructive" : oe ? "text-muted-foreground" : ""
126
+ ae ? "text-destructive" : ce ? "text-muted-foreground" : ""
125
127
  ),
126
- ...Q
128
+ ...Y
127
129
  }
128
130
  ),
129
- /* @__PURE__ */ r(
131
+ /* @__PURE__ */ l(
130
132
  "input",
131
133
  {
132
- ref: W,
134
+ ref: F,
133
135
  type: "text",
134
- value: y,
135
- onChange: ee,
136
- onBlur: T,
137
- onClick: (n) => c && n.stopPropagation(),
138
- placeholder: c ? t : H,
139
- disabled: !!x,
136
+ value: P,
137
+ onChange: le,
138
+ onBlur: L,
139
+ onClick: (n) => a && n.stopPropagation(),
140
+ placeholder: a ? t : _,
141
+ disabled: !!b,
140
142
  "data-field": "end",
141
- className: D(
143
+ className: N(
142
144
  "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
- se ? "text-destructive" : re ? "text-muted-foreground" : ""
145
+ fe ? "text-destructive" : de ? "text-muted-foreground" : ""
144
146
  )
145
147
  }
146
148
  )
147
149
  ] }),
148
- /* @__PURE__ */ p("div", { className: "flex items-center gap-1 shrink-0", children: [
149
- e?.from && !x && /* @__PURE__ */ p(j, { children: [
150
- /* @__PURE__ */ r(B, { asChild: !0, children: /* @__PURE__ */ r(
151
- le,
150
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-1 shrink-0", children: [
151
+ e?.from && !b && /* @__PURE__ */ m(O, { children: [
152
+ /* @__PURE__ */ l(z, { asChild: !0, children: /* @__PURE__ */ l(
153
+ me,
152
154
  {
153
155
  className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
154
156
  onClick: (n) => {
155
- n.stopPropagation(), v();
157
+ n.stopPropagation(), A();
156
158
  }
157
159
  }
158
160
  ) }),
159
- /* @__PURE__ */ r(O, { variant: "tertiary", side: "top", children: "Clear" })
161
+ /* @__PURE__ */ l(H, { variant: "tertiary", side: "top", children: I("calendar.clear") })
160
162
  ] }),
161
- /* @__PURE__ */ p(j, { children: [
162
- /* @__PURE__ */ r(B, { asChild: !0, children: /* @__PURE__ */ r(ce, { className: "h-4 w-4 text-secondary-foreground" }) }),
163
- /* @__PURE__ */ r(O, { variant: "tertiary", side: "top", children: "Pick a range" })
163
+ /* @__PURE__ */ m(O, { children: [
164
+ /* @__PURE__ */ l(z, { asChild: !0, children: /* @__PURE__ */ l(he, { className: "h-4 w-4 text-secondary-foreground" }) }),
165
+ /* @__PURE__ */ l(H, { variant: "tertiary", side: "top", children: I("datePicker.selectMonthRange") })
164
166
  ] })
165
167
  ] })
166
168
  ]
167
169
  }
168
170
  ) }),
169
- /* @__PURE__ */ r(
170
- me,
171
+ /* @__PURE__ */ l(
172
+ be,
171
173
  {
172
174
  className: "w-auto p-0",
173
175
  align: "start",
174
176
  onOpenAutoFocus: (n) => n.preventDefault(),
175
- children: /* @__PURE__ */ r(
176
- he,
177
+ children: /* @__PURE__ */ l(
178
+ we,
177
179
  {
178
180
  mode: "range",
179
- selected: b,
180
- onSelect: Z,
181
- month: Y,
182
- onMonthChange: I,
183
- disabled: { before: L, after: X },
184
- startMonth: q,
185
- endMonth: G,
186
- showFooter: h,
187
- onApply: $,
188
- onCancel: _,
189
- onClear: v,
181
+ selected: w,
182
+ onSelect: te,
183
+ month: ee,
184
+ onMonthChange: k,
185
+ disabled: { before: G, after: J },
186
+ startMonth: K,
187
+ endMonth: Q,
188
+ showFooter: u,
189
+ onApply: ne,
190
+ onCancel: oe,
191
+ onClear: A,
190
192
  captionLayout: "dropdown"
191
193
  }
192
194
  )
193
195
  }
194
196
  )
195
197
  ] }),
196
- k && /* @__PURE__ */ p("div", { className: D("flex items-center gap-1", N && "text-destructive"), children: [
197
- !N && /* @__PURE__ */ r(fe, { size: 10, className: "shrink-0 text-muted-foreground" }),
198
- /* @__PURE__ */ r(
198
+ v && /* @__PURE__ */ m("div", { className: N("flex items-center gap-1", R && "text-destructive"), children: [
199
+ !R && /* @__PURE__ */ l(ue, { size: 10, className: "shrink-0 text-muted-foreground" }),
200
+ /* @__PURE__ */ l(
199
201
  "p",
200
202
  {
201
- className: D(
203
+ className: N(
202
204
  "text-[10px] text-[#7a8294]",
203
- N && "text-destructive"
205
+ R && "text-destructive"
204
206
  ),
205
- children: k
207
+ children: v
206
208
  }
207
209
  )
208
210
  ] })
209
211
  ] });
210
212
  }
211
213
  );
212
- ue.displayName = "DateRangePicker";
214
+ Ce.displayName = "DateRangePicker";
213
215
  export {
214
- ue as DateRangePicker
216
+ Ce as DateRangePicker
215
217
  };