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,190 +1,192 @@
1
- import { jsxs as w, jsx as c } from "react/jsx-runtime";
2
- import * as d from "react";
3
- import { ChevronLeftIcon as pe, ChevronRightIcon as be } from "lucide-react";
4
- import { getDefaultClassNames as Ee, DayPicker as Ie } from "react-day-picker";
1
+ import { jsxs as C, jsx as c } from "react/jsx-runtime";
2
+ import * as u from "react";
3
+ import { ChevronLeftIcon as we, ChevronRightIcon as ye } from "lucide-react";
4
+ import { getDefaultClassNames as Fe, DayPicker as He } from "react-day-picker";
5
5
  import { cn as f } from "../../lib/utils.js";
6
- import { Button as M } from "./button.js";
7
- import oe from "./select/select.js";
8
- import { FISCAL_PATTERNS as Re, resolveWeekSelection as Oe } from "../../lib/fiscal-calendar.js";
9
- const le = d.createContext(0), Ue = [
10
- "January",
11
- "February",
12
- "March",
13
- "April",
14
- "May",
15
- "June",
16
- "July",
17
- "August",
18
- "September",
19
- "October",
20
- "November",
21
- "December"
22
- ], He = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
23
- function Ke({
24
- className: te,
25
- classNames: T,
26
- showOutsideDays: v = !1,
27
- captionLayout: q = "dropdown",
28
- buttonVariant: L = "ghost",
29
- formatters: G,
30
- components: ve,
31
- showFooter: h = !0,
32
- onApply: K,
33
- onCancel: ie,
34
- onClear: ce,
35
- mode: F = "single",
36
- selected: x,
37
- onSelect: E,
6
+ import { Button as A } from "./button.js";
7
+ import "./button-variants.js";
8
+ import ce from "./select/select.js";
9
+ import { FISCAL_PATTERNS as Be, resolveWeekSelection as Te } from "../../lib/fiscal-calendar.js";
10
+ import { getIntlLocale as We, getDateFnsLocale as qe } from "../../i18n/getDateFnsLocale.js";
11
+ import { useImpactNovaI18n as Ge } from "../../i18n/ImpactNovaI18nContext.js";
12
+ const fe = u.createContext(0);
13
+ function st({
14
+ className: ae,
15
+ classNames: J,
16
+ showOutsideDays: D = !1,
17
+ captionLayout: K = "dropdown",
18
+ buttonVariant: H = "ghost",
19
+ formatters: Q,
20
+ components: Ne,
21
+ showFooter: x = !0,
22
+ onApply: X,
23
+ onCancel: ue,
24
+ onClear: de,
25
+ mode: B = "single",
26
+ selected: p,
27
+ onSelect: P,
38
28
  // Week picker props
39
- pickerType: u = "date",
40
- weekMode: D = "single",
41
- selectedWeeks: C,
42
- onWeekSelect: _,
43
- calendarType: j = "calendar",
44
- fiscalMode: Q = "basic",
45
- selectionMode: ne = "week",
46
- fiscalMonthPattern: re,
47
- fiscalYearStartMonth: fe = 1,
48
- weekStartsOn: J = 1,
29
+ pickerType: d = "date",
30
+ weekMode: w = "single",
31
+ selectedWeeks: _,
32
+ onWeekSelect: S,
33
+ calendarType: k = "calendar",
34
+ fiscalMode: Z = "basic",
35
+ selectionMode: se = "week",
36
+ fiscalMonthPattern: le,
37
+ fiscalYearStartMonth: me = 1,
38
+ weekStartsOn: T = 1,
49
39
  // Default Monday
50
40
  // Month picker props
51
- monthMode: p = "single",
41
+ monthMode: b = "single",
52
42
  selectedMonths: y,
53
43
  onMonthSelect: N,
54
- month: R,
55
- defaultMonth: ue,
56
- onMonthChange: De,
57
- startMonth: ye,
58
- endMonth: we,
59
- ...de
44
+ month: E,
45
+ defaultMonth: ge,
46
+ onMonthChange: Ce,
47
+ startMonth: _e,
48
+ endMonth: Se,
49
+ ...he
60
50
  }) {
61
- const X = d.useMemo(() => {
62
- if (j === "fiscal") {
63
- if (re) return re;
64
- if (Q === "advanced") return Re["4-4-5"];
51
+ const { locale: V, t: m } = Ge(), W = u.useMemo(() => We(V), [V]), Ye = u.useMemo(() => qe(V), [V]), xe = u.useMemo(
52
+ () => Array.from(
53
+ { length: 12 },
54
+ (e, n) => new Date(2024, n, 1).toLocaleString(W, { month: "long" })
55
+ ),
56
+ [W]
57
+ ), Me = u.useMemo(
58
+ () => Array.from(
59
+ { length: 12 },
60
+ (e, n) => new Date(2024, n, 1).toLocaleString(W, { month: "short" })
61
+ ),
62
+ [W]
63
+ ), ee = u.useMemo(() => {
64
+ if (k === "fiscal") {
65
+ if (le) return le;
66
+ if (Z === "advanced") return Be["4-4-5"];
65
67
  }
66
- }, [j, Q, re]), m = Ee(), Ne = d.useMemo(() => new Date(1900, 0, 1), []), Ce = d.useMemo(() => new Date(2100, 11, 31), []), z = ye || Ne, $ = we || Ce, [B, Z] = d.useState(x), [S, me] = d.useState(() => {
67
- if (R) return R;
68
- if (ue) return ue;
69
- if (x) {
70
- if (Array.isArray(x))
71
- return x[0] || /* @__PURE__ */ new Date();
72
- if (x instanceof Date)
73
- return x;
74
- if ("from" in x && x.from)
75
- return x.from;
68
+ }, [k, Z, le]), g = Fe(), je = u.useMemo(() => new Date(1900, 0, 1), []), Ae = u.useMemo(() => new Date(2100, 11, 31), []), z = _e || je, R = Se || Ae, [q, te] = u.useState(p), [Y, pe] = u.useState(() => {
69
+ if (E) return E;
70
+ if (ge) return ge;
71
+ if (p) {
72
+ if (Array.isArray(p))
73
+ return p[0] || /* @__PURE__ */ new Date();
74
+ if (p instanceof Date)
75
+ return p;
76
+ if ("from" in p && p.from)
77
+ return p.from;
76
78
  }
77
79
  return /* @__PURE__ */ new Date();
78
80
  });
79
- d.useEffect(() => {
80
- R && (me(R), ge(R.getFullYear()));
81
- }, [R]);
82
- const [O, V] = d.useState(C), [A, ee] = d.useState(y), [_e, ge] = d.useState(S.getFullYear());
83
- d.useEffect(() => {
84
- Z(x), V(C), ee(y);
85
- }, [x, C, y]);
86
- const k = (e) => {
87
- me(e), ge(e.getFullYear()), De?.(e);
88
- }, ae = d.useCallback((e) => {
81
+ u.useEffect(() => {
82
+ E && (pe(E), be(E.getFullYear()));
83
+ }, [E]);
84
+ const [O, ne] = u.useState(_), [j, re] = u.useState(y), [ke, be] = u.useState(Y.getFullYear());
85
+ u.useEffect(() => {
86
+ te(p), ne(_), re(y);
87
+ }, [p, _, y]);
88
+ const L = (e) => {
89
+ pe(e), be(e.getFullYear()), Ce?.(e);
90
+ }, oe = u.useCallback((e) => {
89
91
  let n;
90
- return e instanceof Date ? n = e : n = e.days.find((t) => !t.outside)?.date || e.days[0]?.date || /* @__PURE__ */ new Date(), Oe(n, {
91
- calendarType: j,
92
- fiscalMode: Q,
93
- selectionMode: ne,
94
- fiscalMonthPattern: X,
95
- fiscalYearStartMonth: fe,
96
- weekStartsOn: J
92
+ return e instanceof Date ? n = e : n = e.days.find((t) => !t.outside)?.date || e.days[0]?.date || /* @__PURE__ */ new Date(), Te(n, {
93
+ calendarType: k,
94
+ fiscalMode: Z,
95
+ selectionMode: se,
96
+ fiscalMonthPattern: ee,
97
+ fiscalYearStartMonth: me,
98
+ weekStartsOn: T
97
99
  });
98
- }, [j, Q, ne, X, fe, J]), se = d.useCallback((e) => {
100
+ }, [k, Z, se, ee, me, T]), ie = u.useCallback((e) => {
99
101
  const n = (t, r) => t.year === r.year && t.month === r.month && t.weekOfMonth === r.weekOfMonth;
100
- if (h)
101
- V((t) => {
102
+ if (x)
103
+ ne((t) => {
102
104
  let r;
103
- if (D === "single")
105
+ if (w === "single")
104
106
  r = e;
105
- else if (D === "multiple") {
107
+ else if (w === "multiple") {
106
108
  const a = t || [];
107
109
  r = a.some((s) => n(s, e)) ? a.filter((s) => !n(s, e)) : [...a, e];
108
- } else if (D === "range") {
110
+ } else if (w === "range") {
109
111
  const a = t;
110
112
  if (!a?.from || a.to)
111
113
  r = { from: e };
112
114
  else {
113
- const o = { from: a.from, to: e };
114
- e.startDate < a.from.startDate && (o.from = e, o.to = a.from), r = o;
115
+ const l = { from: a.from, to: e };
116
+ e.startDate < a.from.startDate && (l.from = e, l.to = a.from), r = l;
115
117
  }
116
118
  }
117
- return _?.(r), r;
119
+ return S?.(r), r;
118
120
  });
119
- else if (D === "single")
120
- _?.(e);
121
- else if (D === "multiple") {
122
- const t = C || [], a = t.some((o) => n(o, e)) ? t.filter((o) => !n(o, e)) : [...t, e];
123
- _?.(a.length > 0 ? a : void 0);
124
- } else if (D === "range") {
125
- const t = C;
121
+ else if (w === "single")
122
+ S?.(e);
123
+ else if (w === "multiple") {
124
+ const t = _ || [], a = t.some((l) => n(l, e)) ? t.filter((l) => !n(l, e)) : [...t, e];
125
+ S?.(a.length > 0 ? a : void 0);
126
+ } else if (w === "range") {
127
+ const t = _;
126
128
  if (!t?.from || t.to)
127
- _?.({ from: e });
129
+ S?.({ from: e });
128
130
  else {
129
131
  const r = { from: t.from, to: e };
130
- e.startDate < t.from.startDate && (r.from = e, r.to = t.from), _?.(r);
132
+ e.startDate < t.from.startDate && (r.from = e, r.to = t.from), S?.(r);
131
133
  }
132
134
  }
133
- }, [D, h, C, _]), Se = d.useCallback((e, n) => {
134
- const t = { year: e, month: n }, r = (a, o) => a.year === o.year && a.month === o.month;
135
- if (h)
136
- ee((a) => {
137
- let o;
138
- if (p === "single")
139
- o = t;
140
- else if (p === "multiple") {
135
+ }, [w, x, _, S]), ze = u.useCallback((e, n) => {
136
+ const t = { year: e, month: n }, r = (a, l) => a.year === l.year && a.month === l.month;
137
+ if (x)
138
+ re((a) => {
139
+ let l;
140
+ if (b === "single")
141
+ l = t;
142
+ else if (b === "multiple") {
141
143
  const s = a || [];
142
- o = s.some((i) => r(i, t)) ? s.filter((i) => !r(i, t)) : [...s, t];
143
- } else if (p === "range") {
144
+ l = s.some((i) => r(i, t)) ? s.filter((i) => !r(i, t)) : [...s, t];
145
+ } else if (b === "range") {
144
146
  const s = a;
145
147
  if (!s?.from || s.to)
146
- o = { from: t };
148
+ l = { from: t };
147
149
  else {
148
- const l = new Date(s.from.year, s.from.month, 1);
149
- new Date(t.year, t.month, 1) < l ? o = { from: t, to: s.from } : o = { from: s.from, to: t };
150
+ const o = new Date(s.from.year, s.from.month, 1);
151
+ new Date(t.year, t.month, 1) < o ? l = { from: t, to: s.from } : l = { from: s.from, to: t };
150
152
  }
151
153
  }
152
- return N?.(o), o;
154
+ return N?.(l), l;
153
155
  });
154
- else if (p === "single")
156
+ else if (b === "single")
155
157
  N?.(t);
156
- else if (p === "multiple") {
157
- const a = y || [], s = a.some((l) => r(l, t)) ? a.filter((l) => !r(l, t)) : [...a, t];
158
+ else if (b === "multiple") {
159
+ const a = y || [], s = a.some((o) => r(o, t)) ? a.filter((o) => !r(o, t)) : [...a, t];
158
160
  N?.(s.length > 0 ? s : void 0);
159
- } else if (p === "range") {
161
+ } else if (b === "range") {
160
162
  const a = y;
161
163
  if (!a?.from || a.to)
162
164
  N?.({ from: t });
163
165
  else {
164
- const o = new Date(a.from.year, a.from.month, 1);
165
- new Date(t.year, t.month, 1) < o ? N?.({ from: t, to: a.from }) : N?.({ from: a.from, to: t });
166
+ const l = new Date(a.from.year, a.from.month, 1);
167
+ new Date(t.year, t.month, 1) < l ? N?.({ from: t, to: a.from }) : N?.({ from: a.from, to: t });
166
168
  }
167
169
  }
168
- }, [p, h, y, N]), he = d.useCallback(() => {
169
- const e = z.getFullYear(), n = $.getFullYear(), t = [];
170
+ }, [b, x, y, N]), ve = u.useCallback(() => {
171
+ const e = z.getFullYear(), n = R.getFullYear(), t = [];
170
172
  for (let r = e; r <= n; r++)
171
173
  t.push({ label: r.toString(), value: r.toString() });
172
174
  return t;
173
- }, [z, $]), Ye = d.useCallback((e) => Ue.map((t, r) => ({
175
+ }, [z, R]), Re = u.useCallback((e) => xe.map((t, r) => ({
174
176
  label: t,
175
177
  value: r.toString()
176
178
  })).filter((t, r) => {
177
179
  const a = new Date(e, r, 1);
178
- return !(z && a < new Date(z.getFullYear(), z.getMonth(), 1) || $ && a > new Date($.getFullYear(), $.getMonth(), 1));
179
- }), [z, $]), W = d.useMemo(() => {
180
- if (u !== "week") return;
181
- const e = h ? O : C;
180
+ return !(z && a < new Date(z.getFullYear(), z.getMonth(), 1) || R && a > new Date(R.getFullYear(), R.getMonth(), 1));
181
+ }), [z, R, xe]), G = u.useMemo(() => {
182
+ if (d !== "week") return;
183
+ const e = x ? O : _;
182
184
  if (!e) return;
183
185
  const n = [], t = (r) => {
184
186
  let a = new Date(r.startDate);
185
187
  a.setHours(0, 0, 0, 0);
186
- const o = new Date(r.endDate);
187
- for (o.setHours(0, 0, 0, 0); a <= o; )
188
+ const l = new Date(r.endDate);
189
+ for (l.setHours(0, 0, 0, 0); a <= l; )
188
190
  n.push(new Date(a)), a.setDate(a.getDate() + 1);
189
191
  };
190
192
  if (Array.isArray(e))
@@ -203,130 +205,132 @@ function Ke({
203
205
  } else
204
206
  t(e);
205
207
  return n;
206
- }, [u, h, O, C]), Ae = d.useMemo(() => {
207
- if (u !== "week" || !W || W.length === 0)
208
+ }, [d, x, O, _]), Le = u.useMemo(() => {
209
+ if (d !== "week" || !G || G.length === 0)
208
210
  return { range_start: [], range_middle: [], range_end: [] };
209
- const e = [...W].sort((s, l) => s.getTime() - l.getTime()), n = [], t = [], r = [], a = (s, l) => {
210
- if (l === 0) return !1;
211
- const i = e[l - 1];
211
+ const e = [...G].sort((s, o) => s.getTime() - o.getTime()), n = [], t = [], r = [], a = (s, o) => {
212
+ if (o === 0) return !1;
213
+ const i = e[o - 1];
212
214
  return s.getTime() - i.getTime() <= 1440 * 60 * 1e3;
213
- }, o = (s, l) => l === e.length - 1 ? !1 : e[l + 1].getTime() - s.getTime() <= 1440 * 60 * 1e3;
214
- return e.forEach((s, l) => {
215
- const i = a(s, l), g = o(s, l);
216
- !i && !g ? (n.push(s), r.push(s)) : i ? g ? t.push(s) : r.push(s) : n.push(s);
215
+ }, l = (s, o) => o === e.length - 1 ? !1 : e[o + 1].getTime() - s.getTime() <= 1440 * 60 * 1e3;
216
+ return e.forEach((s, o) => {
217
+ const i = a(s, o), h = l(s, o);
218
+ !i && !h ? (n.push(s), r.push(s)) : i ? h ? t.push(s) : r.push(s) : n.push(s);
217
219
  }), {
218
220
  range_start: n,
219
221
  range_middle: t,
220
222
  range_end: r
221
223
  };
222
- }, [u, W]), Me = d.useCallback((e) => {
223
- if (u === "week" && e) {
224
+ }, [d, G]), Ie = u.useCallback((e) => {
225
+ if (d === "week" && e) {
224
226
  const n = Array.isArray(e) ? e[e.length - 1] : e instanceof Date ? e : void 0;
225
227
  if (n) {
226
- const t = ae(n);
227
- se(t);
228
+ const t = oe(n);
229
+ ie(t);
228
230
  return;
229
231
  }
230
232
  }
231
- h && Z(e), E?.(e);
232
- }, [h, E, u, ae, se]), je = d.useCallback(() => {
233
- u === "week" ? (_?.(O), K?.(O)) : u === "month" ? (N?.(A), K?.(A)) : (E?.(B), K?.(B));
234
- }, [B, O, A, E, _, N, K, u]), ze = d.useCallback(() => {
235
- u === "week" ? V(C) : u === "month" ? ee(y) : Z(x), ie?.();
236
- }, [x, C, y, ie, u]), $e = d.useCallback(() => {
237
- u === "week" ? (V(void 0), h || _?.(void 0)) : u === "month" ? (ee(void 0), h || N?.(void 0)) : (Z(void 0), h || E?.(void 0)), ce?.();
238
- }, [h, E, _, N, ce, u]), ke = d.useCallback((e, n) => {
239
- const t = h ? A : y;
233
+ x && te(e), P?.(e);
234
+ }, [x, P, d, oe, ie]), Pe = u.useCallback(() => {
235
+ d === "week" ? (S?.(O), X?.(O)) : d === "month" ? (N?.(j), X?.(j)) : (P?.(q), X?.(q));
236
+ }, [q, O, j, P, S, N, X, d]), $e = u.useCallback(() => {
237
+ d === "week" ? ne(_) : d === "month" ? re(y) : te(p), ue?.();
238
+ }, [p, _, y, ue, d]), Ee = u.useCallback(() => {
239
+ d === "week" ? (ne(void 0), x || S?.(void 0)) : d === "month" ? (re(void 0), x || N?.(void 0)) : (te(void 0), x || P?.(void 0)), de?.();
240
+ }, [x, P, S, N, de, d]), Oe = u.useCallback((e, n) => {
241
+ const t = x ? j : y;
240
242
  if (!t) return !1;
241
243
  if (Array.isArray(t))
242
244
  return t.some((r) => r.year === e && r.month === n);
243
245
  if ("from" in t) {
244
- const r = t, a = r.from, o = r.to, s = new Date(e, n, 1).getTime(), l = new Date(a.year, a.month, 1).getTime();
245
- if (!o) return s === l;
246
- const i = new Date(o.year, o.month, 1).getTime();
247
- return s >= l && s <= i;
246
+ const r = t, a = r.from, l = r.to, s = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
247
+ if (!l) return s === o;
248
+ const i = new Date(l.year, l.month, 1).getTime();
249
+ return s >= o && s <= i;
248
250
  } else {
249
251
  const r = t;
250
252
  return r.year === e && r.month === n;
251
253
  }
252
- }, [h, A, y]), Pe = d.useCallback((e, n) => {
253
- const t = h ? A : y;
254
+ }, [x, j, y]), Ue = u.useCallback((e, n) => {
255
+ const t = x ? j : y;
254
256
  if (!t || !("from" in t)) return { isStart: !1, isEnd: !1, isMiddle: !1 };
255
- const r = t, a = r.from, o = r.to, s = new Date(e, n, 1).getTime(), l = new Date(a.year, a.month, 1).getTime();
256
- if (!o) return { isStart: s === l, isEnd: !1, isMiddle: !1 };
257
- const i = new Date(o.year, o.month, 1).getTime();
257
+ const r = t, a = r.from, l = r.to, s = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
258
+ if (!l) return { isStart: s === o, isEnd: !1, isMiddle: !1 };
259
+ const i = new Date(l.year, l.month, 1).getTime();
258
260
  return {
259
- isStart: s === l,
261
+ isStart: s === o,
260
262
  isEnd: s === i,
261
- isMiddle: s > l && s < i
263
+ isMiddle: s > o && s < i
262
264
  };
263
- }, [h, A, y]), xe = ({ yearOffset: e = 0 }) => {
264
- const n = _e + e;
265
- return /* @__PURE__ */ w("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
266
- /* @__PURE__ */ w("div", { className: "flex items-center justify-between", children: [
265
+ }, [x, j, y]), De = ({ yearOffset: e = 0 }) => {
266
+ const n = ke + e;
267
+ return /* @__PURE__ */ C("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
268
+ /* @__PURE__ */ C("div", { className: "flex items-center justify-between", children: [
267
269
  e === 0 && /* @__PURE__ */ c(
268
- M,
270
+ A,
269
271
  {
270
272
  variant: "ghost",
271
273
  size: "icon",
272
274
  className: "h-7 w-7",
273
- "aria-label": "Previous Year",
275
+ "aria-label": m("calendar.previousYear"),
276
+ title: m("calendar.previousYear"),
274
277
  disabled: n <= z.getFullYear(),
275
- onClick: () => k(new Date(n - 1, S.getMonth(), 1)),
276
- children: /* @__PURE__ */ c(pe, { className: "h-4 w-4" })
278
+ onClick: () => L(new Date(n - 1, Y.getMonth(), 1)),
279
+ children: /* @__PURE__ */ c(we, { className: "h-4 w-4" })
277
280
  }
278
281
  ),
279
282
  /* @__PURE__ */ c("div", { className: "flex-1 flex justify-center items-center", children: /* @__PURE__ */ c(
280
- oe,
283
+ ce,
281
284
  {
282
285
  value: { label: n.toString(), value: n.toString() },
283
286
  onChange: (t) => {
284
287
  if (t && "value" in t) {
285
288
  const r = parseInt(t.value) - e;
286
- k(new Date(r, S.getMonth(), 1));
289
+ L(new Date(r, Y.getMonth(), 1));
287
290
  }
288
291
  },
289
292
  scrollToSelectedOnOpen: !0,
290
- options: he(),
293
+ options: ve(),
291
294
  parentClassName: "flex justify-center items-center",
292
295
  className: "w-[200px]",
293
296
  menuWidth: "140px"
294
297
  }
295
298
  ) }),
296
- (p === "single" || e === 1) && /* @__PURE__ */ c(
297
- M,
299
+ (b === "single" || e === 1) && /* @__PURE__ */ c(
300
+ A,
298
301
  {
299
302
  variant: "ghost",
300
303
  size: "icon",
301
304
  className: "h-7 w-7",
302
- "aria-label": "Next Year",
303
- disabled: n >= $.getFullYear(),
304
- onClick: () => k(new Date(n + 1, S.getMonth(), 1)),
305
- children: /* @__PURE__ */ c(be, { className: "h-4 w-4" })
305
+ "aria-label": m("calendar.nextYear"),
306
+ title: m("calendar.nextYear"),
307
+ disabled: n >= R.getFullYear(),
308
+ onClick: () => L(new Date(n + 1, Y.getMonth(), 1)),
309
+ children: /* @__PURE__ */ c(ye, { className: "h-4 w-4" })
306
310
  }
307
311
  )
308
312
  ] }),
309
- /* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children: He.map((t, r) => {
310
- const a = ke(n, r), { isStart: o, isEnd: s, isMiddle: l } = Pe(n, r), i = p === "range", g = h ? A : y, b = g && "to" in g && !!g.to;
311
- return /* @__PURE__ */ w("div", { className: "relative flex items-center justify-center h-10 w-full group", children: [
312
- i && b && (l || o || s) && /* @__PURE__ */ c("div", { className: f(
313
+ /* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children: Me.map((t, r) => {
314
+ const a = Oe(n, r), { isStart: l, isEnd: s, isMiddle: o } = Ue(n, r), i = b === "range", h = x ? j : y, v = h && "to" in h && !!h.to;
315
+ return /* @__PURE__ */ C("div", { className: "relative flex items-center justify-center h-10 w-full group", children: [
316
+ i && v && (o || l || s) && /* @__PURE__ */ c("div", { className: f(
313
317
  "absolute inset-y-0 inset-x-0 bg-accent",
314
- o && "rounded-l-full left-1/2 -ml-5",
318
+ l && "rounded-l-full left-1/2 -ml-5",
315
319
  s && "rounded-r-full right-1/2 -mr-5",
316
- l && "inset-x-0",
317
- o && s && "rounded-full inset-x-2"
320
+ o && "inset-x-0",
321
+ l && s && "rounded-full inset-x-2"
318
322
  ) }),
319
323
  /* @__PURE__ */ c(
320
- M,
324
+ A,
321
325
  {
322
326
  variant: "ghost",
323
- onClick: () => Se(n, r),
327
+ onClick: () => ze(n, r),
324
328
  className: f(
325
329
  "relative z-10 w-10 h-10 p-0 text-sm font-normal rounded-lg transition-all",
326
330
  a && !i && "bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground",
327
- i && (o || s) && "bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground rounded-lg",
331
+ i && (l || s) && "bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground rounded-lg",
328
332
  !a && "hover:bg-accent hover:text-accent-foreground border border-transparent hover:border-primary",
329
- l && "text-accent-foreground"
333
+ o && "text-accent-foreground"
330
334
  ),
331
335
  children: t
332
336
  }
@@ -335,124 +339,125 @@ function Ke({
335
339
  }) })
336
340
  ] });
337
341
  };
338
- return /* @__PURE__ */ w("div", { className: "flex flex-col ", "data-component": "calendar", children: [
339
- u === "month" ? /* @__PURE__ */ w("div", { className: "flex flex-col md:flex-row", children: [
340
- /* @__PURE__ */ c(xe, { yearOffset: 0 }),
341
- (p === "range" || p === "multiple") && /* @__PURE__ */ w("div", { className: "flex flex-row gap-0", children: [
342
+ return /* @__PURE__ */ C("div", { className: "flex flex-col ", "data-component": "calendar", children: [
343
+ d === "month" ? /* @__PURE__ */ C("div", { className: "flex flex-col md:flex-row", children: [
344
+ /* @__PURE__ */ c(De, { yearOffset: 0 }),
345
+ (b === "range" || b === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row gap-0", children: [
342
346
  /* @__PURE__ */ c("div", { className: "w-[1px] bg-gray-200 my-4" }),
343
- /* @__PURE__ */ c(xe, { yearOffset: 1 })
347
+ /* @__PURE__ */ c(De, { yearOffset: 1 })
344
348
  ] })
345
349
  ] }) : (
346
350
  // @ts-ignore: TS mismatch due to dynamic union types.
347
351
  // FIX: Split rendering into separate `DayPicker` calls for 'single' | 'multiple' | 'range' to strictly match discriminated unions.
348
352
  /* @__PURE__ */ c(
349
- Ie,
353
+ He,
350
354
  {
351
- mode: u === "week" ? "multiple" : F,
352
- selected: u === "week" ? W : h ? B : x,
353
- onSelect: Me,
354
- month: S,
355
- onMonthChange: k,
356
- showOutsideDays: j === "fiscal" ? !0 : v,
357
- weekStartsOn: J,
358
- modifiers: u === "week" ? Ae : void 0,
355
+ mode: d === "week" ? "multiple" : B,
356
+ selected: d === "week" ? G : x ? q : p,
357
+ onSelect: Ie,
358
+ month: Y,
359
+ onMonthChange: L,
360
+ showOutsideDays: k === "fiscal" ? !0 : D,
361
+ weekStartsOn: T,
362
+ modifiers: d === "week" ? Le : void 0,
363
+ locale: Ye,
359
364
  className: f(
360
365
  "bg-background group/calendar p-2 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
361
366
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
362
367
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
363
- te
368
+ ae
364
369
  ),
365
- captionLayout: q,
370
+ captionLayout: K,
366
371
  startMonth: z,
367
- endMonth: $,
368
- disabled: de.disabled,
369
- numberOfMonths: F === "range" || F === "multiple" || D === "range" || D === "multiple" ? 2 : 1,
372
+ endMonth: R,
373
+ disabled: he.disabled,
374
+ numberOfMonths: B === "range" || B === "multiple" || w === "range" || w === "multiple" ? 2 : 1,
370
375
  showWeekNumber: !0,
371
376
  formatters: {
372
- formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
373
- formatWeekNumber: (e) => `W${e}`,
374
- ...G
377
+ formatMonthDropdown: (e) => e.toLocaleString(W, { month: "short" }),
378
+ formatWeekNumber: (e) => m("calendar.weekNumber", { number: e }),
379
+ ...Q
375
380
  },
376
381
  classNames: {
377
- root: f("w-fit", m.root),
382
+ root: f("w-fit", g.root),
378
383
  months: f(
379
384
  "relative flex flex-col gap-2 md:flex-row",
380
- m.months
385
+ g.months
381
386
  ),
382
387
  month: f(
383
388
  "flex flex-1 min-w-[252px] flex-col gap-2 relative after:absolute after:top-[5.5rem] after:bottom-0 after:left-[30px] after:w-[1px] after:bg-gray-200",
384
- m.month
389
+ g.month
385
390
  ),
386
391
  nav: f(
387
392
  "absolute inset-x-0 top-[2px] h-[--cell-size] flex w-full items-center justify-between px-2 gap-1",
388
- m.nav
393
+ g.nav
389
394
  ),
390
395
  button_previous: f(
391
396
  "h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
392
- m.button_previous
397
+ g.button_previous
393
398
  ),
394
399
  button_next: f(
395
400
  "h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
396
- m.button_next
401
+ g.button_next
397
402
  ),
398
403
  month_caption: f(
399
404
  "flex h-[--cell-size] w-full items-center justify-center px-[--cell-size] relative ",
400
- m.month_caption
405
+ g.month_caption
401
406
  ),
402
407
  dropdowns: f(
403
408
  "flex h-[--cell-size] gap-1 items-center justify-center text-sm font-medium relative ",
404
- m.dropdowns
409
+ g.dropdowns
405
410
  ),
406
411
  caption_label: f(
407
412
  "select-none font-medium text-sm",
408
- m.caption_label
413
+ g.caption_label
409
414
  ),
410
415
  table: "w-full border-collapse",
411
- weekdays: f("flex w-full relative after:absolute after:bottom-0 after:right-0 after:h-[1px] after:bg-gray-200 after:left-[30px]", m.weekdays),
416
+ weekdays: f("flex w-full relative after:absolute after:bottom-0 after:right-0 after:h-[1px] after:bg-gray-200 after:left-[30px]", g.weekdays),
412
417
  weekday: f(
413
418
  "flex-1 select-none rounded-md font-normal text-center",
414
419
  "text-[11px] text-[#757575] pb-2",
415
420
  "[&:nth-child(2)]:pl-2",
416
- m.weekday
421
+ g.weekday
417
422
  ),
418
- week: f("mt-1 flex w-full items-stretch group/week", m.week),
423
+ week: f("mt-1 flex w-full items-stretch group/week", g.week),
419
424
  week_number_header: f(
420
425
  "select-none font-normal text-center h-[30px] flex items-center justify-center",
421
426
  "text-[11px] text-[#757575] w-[30px] flex-shrink-0",
422
- m.week_number_header
427
+ g.week_number_header
423
428
  ),
424
429
  week_number: f(
425
430
  "select-none flex items-center justify-center h-[30px]",
426
431
  "text-[11px] text-[#757575] w-[30px] flex-shrink-0 transition-colors",
427
- u === "week" && "group-hover/week:bg-accent group-hover/week:rounded-l-lg",
428
- m.week_number
432
+ d === "week" && "group-hover/week:bg-accent group-hover/week:rounded-l-lg",
433
+ g.week_number
429
434
  ),
430
435
  day: f(
431
436
  "group/day relative select-none p-0 text-center flex-1 h-[30px] flex items-center justify-center [&:nth-child(2)]:pl-2 rdp-day",
432
- u === "week" && "group-hover/week:bg-accent [&:nth-child(2)]:group-hover/week:rounded-l-full [&:nth-child(8)]:group-hover/week:rounded-r-full",
433
- u === "week" && "[&.rdp-selected:nth-child(2)]:rounded-l-full [&.rdp-selected:nth-child(8)]:rounded-r-full",
434
- T?.day
437
+ d === "week" && "group-hover/week:bg-accent [&:nth-child(2)]:group-hover/week:rounded-l-full [&:nth-child(8)]:group-hover/week:rounded-r-full",
438
+ d === "week" && "[&.rdp-selected:nth-child(2)]:rounded-l-full [&.rdp-selected:nth-child(8)]:rounded-r-full",
439
+ J?.day
435
440
  ),
436
441
  range_start: f(
437
442
  "bg-accent rounded-l-full",
438
- m.range_start
443
+ g.range_start
439
444
  ),
440
- range_middle: f("bg-accent rounded-none", m.range_middle),
441
- range_end: f("bg-accent rounded-r-full", m.range_end),
445
+ range_middle: f("bg-accent rounded-none", g.range_middle),
446
+ range_end: f("bg-accent rounded-r-full", g.range_end),
442
447
  today: f(
443
448
  "text-primary",
444
- m.today
449
+ g.today
445
450
  ),
446
451
  outside: f(
447
- j === "fiscal" || v ? "text-muted-foreground opacity-50" : "invisible",
448
- m.outside
452
+ k === "fiscal" || D ? "text-muted-foreground opacity-50" : "invisible",
453
+ g.outside
449
454
  ),
450
455
  disabled: f(
451
456
  "text-muted-foreground opacity-50",
452
- m.disabled
457
+ g.disabled
453
458
  ),
454
- hidden: f("invisible", m.hidden),
455
- ...T
459
+ hidden: f("invisible", g.hidden),
460
+ ...J
456
461
  },
457
462
  components: {
458
463
  Root: ({ className: e, rootRef: n, ...t }) => /* @__PURE__ */ c(
@@ -464,77 +469,79 @@ function Ke({
464
469
  ...t
465
470
  }
466
471
  ),
467
- Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(pe, { className: f("size-4 text-foreground", e), ...t }) : n === "right" ? /* @__PURE__ */ c(
468
- be,
472
+ Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(we, { className: f("size-4 text-foreground", e), ...t }) : n === "right" ? /* @__PURE__ */ c(
473
+ ye,
469
474
  {
470
475
  className: f("size-4 text-foreground", e),
471
476
  ...t
472
477
  }
473
478
  ) : /* @__PURE__ */ c("span", {}),
474
479
  PreviousMonthButton: (e) => /* @__PURE__ */ c(
475
- M,
480
+ A,
476
481
  {
477
- variant: L,
482
+ variant: H,
478
483
  size: "icon",
479
484
  className: "h-7 w-7",
480
- "aria-label": "Previous Month",
485
+ "aria-label": m("calendar.previousMonth"),
486
+ title: m("calendar.previousMonth"),
481
487
  ...e
482
488
  }
483
489
  ),
484
490
  NextMonthButton: (e) => /* @__PURE__ */ c(
485
- M,
491
+ A,
486
492
  {
487
- variant: L,
493
+ variant: H,
488
494
  size: "icon",
489
495
  className: "h-7 w-7",
490
- "aria-label": "Next Month",
496
+ "aria-label": m("calendar.nextMonth"),
497
+ title: m("calendar.nextMonth"),
491
498
  ...e
492
499
  }
493
500
  ),
494
- MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(le.Provider, { value: e, children: /* @__PURE__ */ c("div", { ...n }) }),
501
+ MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(fe.Provider, { value: e, children: /* @__PURE__ */ c("div", { ...n }) }),
495
502
  MonthsDropdown: ({ value: e }) => {
496
- const n = d.useContext(le), t = n > 0, a = new Date(S.getFullYear(), S.getMonth() + n, 1).getFullYear(), o = Ye(a);
503
+ const n = u.useContext(fe), t = n > 0, a = new Date(Y.getFullYear(), Y.getMonth() + n, 1).getFullYear(), l = Re(a);
497
504
  return /* @__PURE__ */ c(
498
- oe,
505
+ ce,
499
506
  {
500
- value: o.find((s) => s.value === e?.toString()),
507
+ value: l.find((s) => s.value === e?.toString()),
501
508
  onChange: (s) => {
502
509
  if (s && "value" in s) {
503
- const l = parseInt(s.value);
510
+ const o = parseInt(s.value);
504
511
  if (t) {
505
- const i = new Date(a, l - 1, 1);
506
- k(i);
512
+ const i = new Date(a, o - 1, 1);
513
+ L(i);
507
514
  } else {
508
- const i = new Date(a, l, 1);
509
- k(i);
515
+ const i = new Date(a, o, 1);
516
+ L(i);
510
517
  }
511
518
  }
512
519
  },
513
520
  scrollToSelectedOnOpen: !0,
514
- options: o,
521
+ options: l,
515
522
  className: "w-[95px]",
516
523
  menuWidth: "140px",
517
524
  isSearchable: !0,
518
525
  isClearable: !1,
519
- placeholder: "Month"
526
+ placeholder: m("calendar.monthPlaceholder")
520
527
  }
521
528
  );
522
529
  },
523
530
  YearsDropdown: ({ value: e }) => {
524
- const t = d.useContext(le) > 0, r = he();
531
+ const t = u.useContext(fe) > 0, r = ve();
525
532
  return /* @__PURE__ */ c(
526
- oe,
533
+ ce,
527
534
  {
528
535
  value: r.find((a) => a.value === e?.toString()),
529
536
  onChange: (a) => {
530
537
  if (a && "value" in a) {
531
- const o = parseInt(a.value);
538
+ const l = parseInt(a.value);
532
539
  if (t) {
533
- const s = new Date(S.getFullYear(), S.getMonth() + 1, 1).getMonth(), l = new Date(o, s - 1, 1);
534
- k(l);
540
+ const s = new Date(Y.getFullYear(), Y.getMonth() + 1, 1).getMonth(), o = new Date(l, s - 1, 1);
541
+ L(o);
535
542
  } else {
536
- const s = new Date(o, S.getMonth(), 1);
537
- k(s);
543
+ const s = new Date(l, Y.getMonth(), 1);
544
+ L(s);
538
545
  }
539
546
  }
540
547
  },
@@ -544,44 +551,41 @@ function Ke({
544
551
  menuWidth: "140px",
545
552
  isSearchable: !0,
546
553
  isClearable: !1,
547
- placeholder: "Year"
554
+ placeholder: m("calendar.yearPlaceholder")
548
555
  }
549
556
  );
550
557
  },
551
558
  DayButton: (e) => /* @__PURE__ */ c(
552
- Le,
559
+ Je,
553
560
  {
554
561
  ...e,
555
- pickerType: u
562
+ pickerType: d
556
563
  }
557
564
  ),
558
565
  WeekNumber: ({ week: e, ...n }) => {
559
- const t = e.days.find((H) => !H.outside)?.date;
566
+ const t = e.days.find((F) => !F.outside)?.date;
560
567
  if (!t)
561
568
  return /* @__PURE__ */ c("td", { ...n, className: f("select-none flex items-center justify-center h-8 text-[11px] text-[#757575] w-8 flex-shrink-0 rdp-week_number", n.className), children: /* @__PURE__ */ c("div", { className: "flex size-[--cell-size] items-center justify-center text-center" }) });
562
- const r = t.getFullYear(), a = t.getMonth(), l = (new Date(r, a, 1).getDay() + 7 - J) % 7, i = new Date(r, a, 1 - l), g = new Date(t), P = (t.getDay() + 7 - J) % 7;
563
- g.setDate(t.getDate() - P);
564
- const Y = Math.round((g.getTime() - i.getTime()) / (10080 * 60 * 1e3)) + 1, U = `Week ${Y}`;
565
- return u === "week" ? /* @__PURE__ */ c(
569
+ const r = t.getFullYear(), a = t.getMonth(), o = (new Date(r, a, 1).getDay() + 7 - T) % 7, i = new Date(r, a, 1 - o), h = new Date(t), I = (t.getDay() + 7 - T) % 7;
570
+ h.setDate(t.getDate() - I);
571
+ const M = Math.round((h.getTime() - i.getTime()) / (10080 * 60 * 1e3)) + 1, U = m("calendar.weekLabel", { number: M });
572
+ return d === "week" ? /* @__PURE__ */ c(
566
573
  "td",
567
574
  {
568
575
  ...n,
569
576
  "aria-label": U,
570
- "data-week-index": Y,
571
- "data-week-number": Y,
577
+ "data-week-index": M,
578
+ "data-week-number": M,
572
579
  className: f(
573
580
  "select-none flex items-center justify-center h-[30px] w-[30px] flex-shrink-0 rdp-week_number cursor-pointer hover:bg-accent hover:text-accent-foreground group-hover/week:bg-accent group-hover/week:rounded-l-lg rounded-lg transition-colors",
574
581
  n.className
575
582
  ),
576
583
  scope: "row",
577
584
  role: "rowheader",
578
- onClick: (H) => {
579
- H.preventDefault(), H.stopPropagation(), se(ae(e));
585
+ onClick: (F) => {
586
+ F.preventDefault(), F.stopPropagation(), ie(oe(e));
580
587
  },
581
- children: /* @__PURE__ */ w("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-[#757575]", children: [
582
- "W",
583
- Y
584
- ] })
588
+ children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-[#757575]", children: m("calendar.weekNumber", { number: M }) })
585
589
  }
586
590
  ) : /* @__PURE__ */ c(
587
591
  "td",
@@ -594,24 +598,21 @@ function Ke({
594
598
  ),
595
599
  scope: "row",
596
600
  role: "rowheader",
597
- children: /* @__PURE__ */ w("div", { className: "flex h-8 w-full items-center justify-center text-center", children: [
598
- "W",
599
- Y
600
- ] })
601
+ children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center", children: m("calendar.weekNumber", { number: M }) })
601
602
  }
602
603
  );
603
604
  },
604
- ...ve
605
+ ...Ne
605
606
  },
606
- ...de
607
+ ...he
607
608
  }
608
609
  )
609
610
  ),
610
- h && /* @__PURE__ */ w("div", { className: f("flex items-center gap-2 border-t pt-3 p-3", u === "month" && p !== "single" || F === "range" || D === "range" || D === "multiple" ? "justify-between" : "justify-end"), children: [
611
- F === "range" && u === "date" && /* @__PURE__ */ w("div", { className: "flex flex-row items-center gap-1 text-[#60697d] text-xs leading-[18px] font-medium", children: [
611
+ x && /* @__PURE__ */ C("div", { className: f("flex items-center gap-2 border-t pt-3 p-3", d === "month" && b !== "single" || B === "range" || w === "range" || w === "multiple" ? "justify-between" : "justify-end"), children: [
612
+ B === "range" && d === "date" && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-[#60697d] text-xs leading-[18px] font-medium", children: [
612
613
  "Selected:",
613
614
  /* @__PURE__ */ c("span", { className: "text-[#0d152c] font-semibold", children: (() => {
614
- const e = B;
615
+ const e = q;
615
616
  if (e?.from && e?.to) {
616
617
  const n = Math.abs(e.to.getTime() - e.from.getTime()), t = Math.ceil(n / (1e3 * 60 * 60 * 24)) + 1;
617
618
  return `${t} day${t !== 1 ? "s" : ""}`;
@@ -619,137 +620,137 @@ function Ke({
619
620
  return "0 days";
620
621
  })() })
621
622
  ] }),
622
- u === "week" && (D === "range" || D === "multiple") && /* @__PURE__ */ w("div", { className: "flex flex-row items-center gap-1 text-[#60697d] text-xs leading-[18px] font-medium", children: [
623
+ d === "week" && (w === "range" || w === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-[#60697d] text-xs leading-[18px] font-medium", children: [
623
624
  "Selected:",
624
625
  /* @__PURE__ */ c("span", { className: "text-[#0d152c] font-semibold", children: (() => {
625
626
  const e = O;
626
627
  if (!e) return "0 weeks";
627
- const n = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate()), t = (l) => {
628
- const i = Math.floor(l / 7), g = l % 7, b = [];
629
- return i > 0 && b.push(`${i} week${i !== 1 ? "s" : ""}`), (g > 0 || i === 0) && b.push(`${g} day${g !== 1 ? "s" : ""}`), b.join(" ");
630
- }, r = j === "fiscal" && ne === "fiscalMonth", a = j === "fiscal", o = r ? "fiscal month" : a ? "fiscal week" : "week", s = r ? "fiscal months" : a ? "fiscal weeks" : "weeks";
628
+ const n = (o) => Date.UTC(o.getFullYear(), o.getMonth(), o.getDate()), t = (o) => {
629
+ const i = Math.floor(o / 7), h = o % 7, v = [];
630
+ return i > 0 && v.push(`${i} week${i !== 1 ? "s" : ""}`), (h > 0 || i === 0) && v.push(`${h} day${h !== 1 ? "s" : ""}`), v.join(" ");
631
+ }, r = k === "fiscal" && se === "fiscalMonth", a = k === "fiscal", l = r ? "fiscal month" : a ? "fiscal week" : "week", s = r ? "fiscal months" : a ? "fiscal weeks" : "weeks";
631
632
  if (Array.isArray(e))
632
633
  if (a || r) {
633
- const l = e.length;
634
- return `${l} ${l !== 1 ? s : o}`;
634
+ const o = e.length;
635
+ return `${o} ${o !== 1 ? s : l}`;
635
636
  } else {
636
- let l = 0;
637
+ let o = 0;
637
638
  return e.forEach((i) => {
638
- const g = n(i.startDate), b = n(i.endDate);
639
- l += Math.round((b - g) / (1e3 * 60 * 60 * 24)) + 1;
640
- }), t(l);
639
+ const h = n(i.startDate), v = n(i.endDate);
640
+ o += Math.round((v - h) / (1e3 * 60 * 60 * 24)) + 1;
641
+ }), t(o);
641
642
  }
642
643
  else if ("from" in e) {
643
- const { from: l, to: i } = e;
644
+ const { from: o, to: i } = e;
644
645
  if (r) {
645
- if (!i) return `1 ${o}`;
646
- const g = n(l.startDate), b = n(i.endDate), P = Math.round(Math.abs(b - g) / (1e3 * 60 * 60 * 24)) + 1, I = X ? X.reduce((U, H) => U + H, 0) / 12 : 4.33, Y = Math.max(1, Math.round(P / (I * 7)));
647
- return `${Y} ${Y !== 1 ? s : o}`;
646
+ if (!i) return `1 ${l}`;
647
+ const h = n(o.startDate), v = n(i.endDate), I = Math.round(Math.abs(v - h) / (1e3 * 60 * 60 * 24)) + 1, $ = ee ? ee.reduce((U, F) => U + F, 0) / 12 : 4.33, M = Math.max(1, Math.round(I / ($ * 7)));
648
+ return `${M} ${M !== 1 ? s : l}`;
648
649
  } else if (a) {
649
- if (!i) return `1 ${o}`;
650
- const g = n(l.startDate), b = n(i.endDate), P = Math.round((b - g) / (10080 * 60 * 1e3)), I = P > 0 ? P : 1;
651
- return `${I} ${I !== 1 ? s : o}`;
650
+ if (!i) return `1 ${l}`;
651
+ const h = n(o.startDate), v = n(i.endDate), I = Math.round((v - h) / (10080 * 60 * 1e3)), $ = I > 0 ? I : 1;
652
+ return `${$} ${$ !== 1 ? s : l}`;
652
653
  } else {
653
654
  if (!i) {
654
- const I = n(l.startDate), Y = n(l.endDate), U = Math.round((Y - I) / (1e3 * 60 * 60 * 24)) + 1;
655
+ const $ = n(o.startDate), M = n(o.endDate), U = Math.round((M - $) / (1e3 * 60 * 60 * 24)) + 1;
655
656
  return t(U);
656
657
  }
657
- const g = n(l.startDate), b = n(i.endDate), P = Math.round(Math.abs(b - g) / (1e3 * 60 * 60 * 24)) + 1;
658
- return t(P);
658
+ const h = n(o.startDate), v = n(i.endDate), I = Math.round(Math.abs(v - h) / (1e3 * 60 * 60 * 24)) + 1;
659
+ return t(I);
659
660
  }
660
661
  } else
661
- return `1 ${o}`;
662
+ return `1 ${l}`;
662
663
  })() })
663
664
  ] }),
664
- u === "month" && (p === "range" || p === "multiple") && /* @__PURE__ */ w("div", { className: "flex flex-row items-center gap-1 text-[#60697d] text-xs leading-[18px] font-medium", children: [
665
+ d === "month" && (b === "range" || b === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-[#60697d] text-xs leading-[18px] font-medium", children: [
665
666
  "Selected:",
666
667
  /* @__PURE__ */ c("span", { className: "text-[#0d152c] font-semibold", children: (() => {
667
- const e = A;
668
+ const e = j;
668
669
  if (!e) return "0 months";
669
670
  if (Array.isArray(e)) {
670
671
  const n = e.length;
671
- return `${n} month${n !== 1 ? "s" : ""}`;
672
+ return n === 1 ? m("calendar.monthRange") : m("calendar.monthRangePlural", { count: n });
672
673
  } else if ("from" in e) {
673
674
  const n = e;
674
- if (!n.to) return "1 month";
675
+ if (!n.to) return m("calendar.monthRange");
675
676
  const t = new Date(n.from.year, n.from.month, 1), r = new Date(n.to.year, n.to.month, 1), a = (r.getFullYear() - t.getFullYear()) * 12 + (r.getMonth() - t.getMonth()) + 1;
676
- return `${a} month${a !== 1 ? "s" : ""}`;
677
+ return a === 1 ? m("calendar.monthRange") : m("calendar.monthRangePlural", { count: a });
677
678
  } else
678
- return "1 month";
679
+ return m("calendar.monthRange");
679
680
  })() })
680
681
  ] }),
681
- /* @__PURE__ */ w("div", { className: "flex items-center gap-2", children: [
682
+ /* @__PURE__ */ C("div", { className: "flex items-center gap-2", children: [
682
683
  /* @__PURE__ */ c(
683
- M,
684
+ A,
684
685
  {
685
686
  variant: "link",
686
687
  size: "sm",
687
- onClick: $e,
688
- children: "Clear"
688
+ onClick: Ee,
689
+ children: m("calendar.clear")
689
690
  }
690
691
  ),
691
692
  /* @__PURE__ */ c(
692
- M,
693
+ A,
693
694
  {
694
695
  variant: "outline",
695
696
  size: "sm",
696
- onClick: ze,
697
- children: "Cancel"
697
+ onClick: $e,
698
+ children: m("calendar.cancel")
698
699
  }
699
700
  ),
700
701
  /* @__PURE__ */ c(
701
- M,
702
+ A,
702
703
  {
703
704
  variant: "default",
704
705
  size: "sm",
705
- onClick: je,
706
- children: "Apply"
706
+ onClick: Pe,
707
+ children: m("calendar.apply")
707
708
  }
708
709
  )
709
710
  ] })
710
711
  ] })
711
712
  ] });
712
713
  }
713
- function Le({
714
- className: te,
715
- day: T,
716
- modifiers: v,
717
- pickerType: q,
718
- ...L
714
+ function Je({
715
+ className: ae,
716
+ day: J,
717
+ modifiers: D,
718
+ pickerType: K,
719
+ ...H
719
720
  }) {
720
- const G = d.useRef(null);
721
- return d.useEffect(() => {
722
- v.focused && G.current?.focus();
723
- }, [v.focused]), /* @__PURE__ */ c(
724
- M,
721
+ const Q = u.useRef(null);
722
+ return u.useEffect(() => {
723
+ D.focused && Q.current?.focus();
724
+ }, [D.focused]), /* @__PURE__ */ c(
725
+ A,
725
726
  {
726
- ref: G,
727
+ ref: Q,
727
728
  variant: "ghost",
728
729
  size: "sm",
729
- "data-day": T.date.toLocaleDateString(),
730
- "data-selected-single": v.selected && !v.range_start && !v.range_end && !v.range_middle,
731
- "data-range-start": v.range_start,
732
- "data-range-end": v.range_end,
733
- "data-range-middle": v.range_middle,
730
+ "data-day": J.date.toLocaleDateString(),
731
+ "data-selected-single": D.selected && !D.range_start && !D.range_end && !D.range_middle,
732
+ "data-range-start": D.range_start,
733
+ "data-range-end": D.range_end,
734
+ "data-range-middle": D.range_middle,
734
735
  className: f(
735
736
  "gap-2 whitespace-nowrap focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 px-3 rounded-lg flex items-center justify-center font-normal transition-colors w-5 h-5 border border-transparent focus-visible:outline-none text-sm rdp-day rdp-day_button",
736
737
  // Hover styling
737
- q !== "week" && "hover:bg-accent hover:text-accent-foreground hover:border-primary",
738
- q === "week" && "hover:bg-transparent hover:text-inherit hover:border-transparent",
738
+ K !== "week" && "hover:bg-accent hover:text-accent-foreground hover:border-primary",
739
+ K === "week" && "hover:bg-transparent hover:text-inherit hover:border-transparent",
739
740
  // Selection state
740
741
  "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[selected-single=true]:rounded-lg data-[selected-single=true]:border-transparent",
741
742
  "data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-start=true]:rounded-lg data-[range-start=true]:border-transparent",
742
743
  "data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-end=true]:rounded-lg data-[range-end=true]:border-transparent",
743
744
  "data-[range-middle=true]:text-accent-foreground data-[range-middle=true]:rounded-none",
744
- te
745
+ ae
745
746
  ),
746
747
  "data-component": "calendar-day",
747
- ...L,
748
- disabled: L.disabled || v.disabled
748
+ ...H,
749
+ disabled: H.disabled || D.disabled
749
750
  }
750
751
  );
751
752
  }
752
753
  export {
753
- Ke as Calendar,
754
- Le as CalendarDayButton
754
+ st as Calendar,
755
+ Je as CalendarDayButton
755
756
  };