impact-nova 1.6.5 → 1.6.7

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