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