impact-nova 2.0.8 → 2.0.9

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,14 +1,14 @@
1
- import { jsxs as P, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as x, jsx as r } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
3
  import { Cross as Z, CalendarMonth as _ } from "impact-nova-icons";
4
- import { format as h, isValid as I, parse as N } from "date-fns";
4
+ import { format as m, isValid as I, parse as b } from "date-fns";
5
5
  import { cn as $, padValidDateString as F, maskDate as ee } from "../../../lib/utils.js";
6
6
  import { Input as te } from "../input.js";
7
7
  import { Popover as ne, PopoverAnchor as re, PopoverContent as oe } from "../popover.js";
8
8
  import { Calendar as ce } from "../calendar.js";
9
9
  import { Tooltip as S, TooltipTrigger as E, TooltipContent as T } from "../tooltip.js";
10
- import { getDateFnsLocale as ie } from "../../../i18n/getDateFnsLocale.js";
11
- import { useImpactNovaI18n as le } from "../../../i18n/ImpactNovaI18nContext.js";
10
+ import { getDateFnsLocale as le } from "../../../i18n/getDateFnsLocale.js";
11
+ import { useImpactNovaI18n as ie } from "../../../i18n/ImpactNovaI18nContext.js";
12
12
  const ae = o.forwardRef(
13
13
  ({
14
14
  value: t,
@@ -20,44 +20,44 @@ const ae = o.forwardRef(
20
20
  startMonth: z,
21
21
  endMonth: B,
22
22
  showFooter: d = !0,
23
- weekStartsOn: R,
23
+ weekStartsOn: N,
24
24
  disabled: a,
25
25
  className: O,
26
26
  ...H
27
27
  }, q) => {
28
- const { locale: b, t: m } = le(), i = o.useMemo(() => ie(b), [b]), G = j ?? m("datePicker.selectDate"), g = o.useRef(null), D = o.useRef(null);
28
+ const { locale: R, t: h } = ie(), l = o.useMemo(() => le(R), [R]), G = j ?? h("datePicker.selectDate"), g = o.useRef(null), D = o.useRef(null);
29
29
  o.useImperativeHandle(q, () => g.current);
30
- const [c, l] = o.useState(!1), k = o.useRef(!1), [v, s] = o.useState(t), [p, f] = o.useState(t ? h(t, n, { locale: i }) : ""), [J, w] = o.useState(t || /* @__PURE__ */ new Date());
30
+ const [c, i] = o.useState(!1), k = o.useRef(!1), [v, s] = o.useState(t), [p, f] = o.useState(t ? m(t, n, { locale: l }) : ""), [J, w] = o.useState(t || /* @__PURE__ */ new Date());
31
31
  o.useEffect(() => {
32
32
  g.current && D.current !== null && (g.current.setSelectionRange(D.current, D.current), D.current = null);
33
33
  }, [p]), o.useEffect(() => {
34
- c || (f(t ? h(t, n, { locale: i }) : ""), s(t));
35
- }, [t, n, c, i]), o.useEffect(() => {
34
+ c || (f(t ? m(t, n, { locale: l }) : ""), s(t));
35
+ }, [t, n, c, l]), o.useEffect(() => {
36
36
  c && (s(t), w(t || /* @__PURE__ */ new Date()));
37
37
  }, [c, t]);
38
38
  const Q = (e) => {
39
- s(e), e && f(h(e, n, { locale: i })), d || (u?.(e), l(!1));
39
+ s(e), e && f(m(e, n, { locale: l })), d || (u?.(e), i(!1));
40
40
  }, U = (e) => {
41
- u?.(e !== void 0 ? e : v), l(!1);
41
+ u?.(e !== void 0 ? e : v), i(!1);
42
42
  }, V = () => {
43
- s(t), f(t ? h(t, n, { locale: i }) : ""), l(!1);
43
+ s(t), f(t ? m(t, n, { locale: l }) : ""), i(!1);
44
44
  }, A = () => {
45
- s(void 0), f(""), u?.(void 0), d || l(!1);
45
+ s(void 0), f(""), u?.(void 0), d || i(!1);
46
46
  }, W = (e) => {
47
47
  const y = e.target.value, C = ee(y, n, p);
48
48
  if (f(C), C === "") {
49
49
  s(void 0), d || u?.(void 0);
50
50
  return;
51
51
  }
52
- const x = N(C, n, /* @__PURE__ */ new Date(), { locale: i });
53
- I(x) && C.length === n.length && (s(x), w(x), d || u?.(x));
52
+ const P = b(C, n, /* @__PURE__ */ new Date(), { locale: l });
53
+ I(P) && C.length === n.length && (s(P), w(P), d || u?.(P));
54
54
  }, X = () => {
55
55
  if (c) return;
56
- const e = F(p, n), y = N(e, n, /* @__PURE__ */ new Date(), { locale: i });
57
- !I(y) || e.length !== n.length ? (f(t ? h(t, n, { locale: i }) : ""), s(t)) : (f(e), d || u?.(y));
58
- }, M = (t ? h(t, n, { locale: i }) : "") !== p, Y = p.length === n.length && !I(N(p, n, /* @__PURE__ */ new Date(), { locale: i }));
59
- return /* @__PURE__ */ P(ne, { open: a ? !1 : c, onOpenChange: (e) => {
60
- a || l(e);
56
+ const e = F(p, n), y = b(e, n, /* @__PURE__ */ new Date(), { locale: l });
57
+ !I(y) || e.length !== n.length ? (f(t ? m(t, n, { locale: l }) : ""), s(t)) : (f(e), d || u?.(y));
58
+ }, M = (t ? m(t, n, { locale: l }) : "") !== p, Y = p.length === n.length && !I(b(p, n, /* @__PURE__ */ new Date(), { locale: l }));
59
+ return /* @__PURE__ */ x(ne, { open: a ? !1 : c, onOpenChange: (e) => {
60
+ a || i(e);
61
61
  }, children: [
62
62
  /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r("div", { "data-component": "date-picker", "data-state": c ? "open" : "closed", "data-pending": M || void 0, children: /* @__PURE__ */ r(
63
63
  te,
@@ -66,9 +66,9 @@ const ae = o.forwardRef(
66
66
  value: p,
67
67
  onChange: W,
68
68
  onBlur: X,
69
- onClick: () => !a && l(!0),
69
+ onClick: () => !a && i(!0),
70
70
  onKeyDown: (e) => {
71
- (e.key === "Enter" || e.key === "ArrowDown") && !c && !a && (e.preventDefault(), k.current = !0, l(!0)), e.key === "Escape" && c && (e.preventDefault(), V());
71
+ (e.key === "Enter" || e.key === "ArrowDown") && !c && !a && (e.preventDefault(), k.current = !0, i(!0)), e.key === "Escape" && c && (e.preventDefault(), V());
72
72
  },
73
73
  placeholder: c ? n : G,
74
74
  disabled: a,
@@ -78,14 +78,14 @@ const ae = o.forwardRef(
78
78
  Y ? "text-destructive" : M ? "text-content-muted" : "",
79
79
  O
80
80
  ),
81
- suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
82
- t && !a && /* @__PURE__ */ P(S, { children: [
81
+ suffix: /* @__PURE__ */ x("div", { className: "flex items-center gap-1", children: [
82
+ t && !a && /* @__PURE__ */ x(S, { children: [
83
83
  /* @__PURE__ */ r(E, { asChild: !0, children: /* @__PURE__ */ r(
84
84
  "button",
85
85
  {
86
86
  type: "button",
87
87
  tabIndex: 0,
88
- "aria-label": m("calendar.clear"),
88
+ "aria-label": h("calendar.clear"),
89
89
  onClick: (e) => {
90
90
  e.stopPropagation(), A();
91
91
  },
@@ -93,15 +93,15 @@ const ae = o.forwardRef(
93
93
  children: /* @__PURE__ */ r(Z, { className: "size-3 hover:text-content" })
94
94
  }
95
95
  ) }),
96
- /* @__PURE__ */ r(T, { variant: "tertiary", side: "top", children: m("calendar.clear") })
96
+ /* @__PURE__ */ r(T, { variant: "tertiary", side: "top", children: h("calendar.clear") })
97
97
  ] }),
98
- /* @__PURE__ */ P(S, { children: [
99
- /* @__PURE__ */ r(E, { asChild: !0, children: /* @__PURE__ */ r("button", { type: "button", tabIndex: 0, "aria-label": m("datePicker.selectDate"), onClick: (e) => {
100
- e.stopPropagation(), a || l(!c);
98
+ /* @__PURE__ */ x(S, { children: [
99
+ /* @__PURE__ */ r(E, { asChild: !0, children: /* @__PURE__ */ r("button", { type: "button", tabIndex: 0, "aria-label": h("datePicker.selectDate"), onClick: (e) => {
100
+ e.stopPropagation(), a || i(!c);
101
101
  }, onKeyDown: (e) => {
102
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), a || (k.current = !0, l(!c)));
102
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), a || (k.current = !0, i(!c)));
103
103
  }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ r(_, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
104
- /* @__PURE__ */ r(T, { variant: "tertiary", side: "top", children: m("datePicker.selectDate") })
104
+ /* @__PURE__ */ r(T, { variant: "tertiary", side: "top", children: h("datePicker.selectDate") })
105
105
  ] })
106
106
  ] }),
107
107
  ...H
@@ -112,6 +112,7 @@ const ae = o.forwardRef(
112
112
  {
113
113
  className: "w-auto p-0",
114
114
  align: "start",
115
+ "aria-label": h("datePicker.selectDate"),
115
116
  onOpenAutoFocus: (e) => {
116
117
  k.current || e.preventDefault(), k.current = !1;
117
118
  },
@@ -131,7 +132,7 @@ const ae = o.forwardRef(
131
132
  onCancel: V,
132
133
  onClear: A,
133
134
  captionLayout: "dropdown",
134
- ...R !== void 0 ? { weekStartsOn: R } : {}
135
+ ...N !== void 0 ? { weekStartsOn: N } : {}
135
136
  }
136
137
  )
137
138
  }
@@ -214,6 +214,7 @@ const Re = d.forwardRef(
214
214
  {
215
215
  className: "w-auto p-0",
216
216
  align: "start",
217
+ "aria-label": P("datePicker.selectDateRange"),
217
218
  onOpenAutoFocus: (e) => {
218
219
  C.current || e.preventDefault(), C.current = !1;
219
220
  },
@@ -1,103 +1,103 @@
1
- import { jsxs as M, jsx as n } from "react/jsx-runtime";
2
- import * as o from "react";
1
+ import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
+ import * as r from "react";
3
3
  import { Cross as L, CalendarMonth as Q } from "impact-nova-icons";
4
- import { isValid as C, parse as x } from "date-fns";
4
+ import { isValid as C, parse as P } from "date-fns";
5
5
  import { cn as U, padValidDateString as W, maskDate as X } from "../../../lib/utils.js";
6
6
  import { Input as Z } from "../input.js";
7
7
  import { Popover as _, PopoverAnchor as F, PopoverContent as v } from "../popover.js";
8
8
  import { Calendar as tt } from "../calendar.js";
9
9
  import { Tooltip as I, TooltipTrigger as N, TooltipContent as T } from "../tooltip.js";
10
10
  import { useImpactNovaI18n as et } from "../../../i18n/ImpactNovaI18nContext.js";
11
- const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt = o.forwardRef(
11
+ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt = r.forwardRef(
12
12
  ({
13
13
  value: t,
14
14
  onChange: s,
15
15
  placeholder: V,
16
16
  minDate: A,
17
- maxDate: R,
18
- startMonth: b,
17
+ maxDate: b,
18
+ startMonth: R,
19
19
  endMonth: j,
20
20
  showFooter: l = !0,
21
- disabled: m,
21
+ disabled: y,
22
22
  className: O,
23
23
  ...Y
24
24
  }, z) => {
25
- const { t: y } = et(), B = V ?? y("datePicker.selectMonth"), P = o.useRef(null);
26
- o.useRef(null), o.useImperativeHandle(z, () => P.current);
27
- const [r, p] = o.useState(!1), [S, a] = o.useState(t), [d, i] = o.useState(t ? c(t) : ""), [E, g] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
28
- o.useEffect(() => {
29
- r || (i(t ? c(t) : ""), a(t));
30
- }, [r, t]), o.useEffect(() => {
31
- r && (a(t), g(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), i(t ? c(t) : ""));
32
- }, [r, t]);
25
+ const { t: d } = et(), B = V ?? d("datePicker.selectMonth"), k = r.useRef(null);
26
+ r.useRef(null), r.useImperativeHandle(z, () => k.current);
27
+ const [o, p] = r.useState(!1), [x, a] = r.useState(t), [h, i] = r.useState(t ? c(t) : ""), [E, g] = r.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
28
+ r.useEffect(() => {
29
+ o || (i(t ? c(t) : ""), a(t));
30
+ }, [o, t]), r.useEffect(() => {
31
+ o && (a(t), g(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), i(t ? c(t) : ""));
32
+ }, [o, t]);
33
33
  const $ = (e) => {
34
34
  a(e), e && i(c(e)), l || (s?.(e), p(!1));
35
35
  }, H = (e) => {
36
- s?.(e !== void 0 ? e : S), p(!1);
36
+ s?.(e !== void 0 ? e : x), p(!1);
37
37
  }, q = () => {
38
38
  a(t), i(t ? c(t) : ""), p(!1);
39
- }, k = () => {
39
+ }, S = () => {
40
40
  a(void 0), i(""), s?.(void 0), l || p(!1);
41
41
  }, G = (e) => {
42
- const f = e.target.value, h = X(f, "MM/yyyy", d);
43
- if (i(h), h === "") {
42
+ const f = e.target.value, m = X(f, "MM/yyyy", h);
43
+ if (i(m), m === "") {
44
44
  a(void 0), l || s?.(void 0);
45
45
  return;
46
46
  }
47
- const u = x(h, "MM/yyyy", /* @__PURE__ */ new Date());
48
- if (C(u) && h.length === 7) {
49
- const D = { month: u.getMonth(), year: u.getFullYear() };
50
- a(D), g(u), l || s?.(D);
47
+ const M = P(m, "MM/yyyy", /* @__PURE__ */ new Date());
48
+ if (C(M) && m.length === 7) {
49
+ const D = { month: M.getMonth(), year: M.getFullYear() };
50
+ a(D), g(M), l || s?.(D);
51
51
  }
52
52
  }, J = () => {
53
- if (r) return;
54
- const e = W(d, "MM/yyyy"), f = x(e, "MM/yyyy", /* @__PURE__ */ new Date());
53
+ if (o) return;
54
+ const e = W(h, "MM/yyyy"), f = P(e, "MM/yyyy", /* @__PURE__ */ new Date());
55
55
  if (!C(f) || e.length !== 7)
56
56
  i(t ? c(t) : ""), a(t);
57
57
  else if (i(e), !l) {
58
- const h = { month: f.getMonth(), year: f.getFullYear() };
59
- s?.(h);
58
+ const m = { month: f.getMonth(), year: f.getFullYear() };
59
+ s?.(m);
60
60
  }
61
- }, w = (t ? c(t) : "") !== d, K = d.length === 7 && !C(x(d, "MM/yyyy", /* @__PURE__ */ new Date()));
62
- return /* @__PURE__ */ M(_, { open: m ? !1 : r, onOpenChange: (e) => {
63
- m || p(e);
61
+ }, w = (t ? c(t) : "") !== h, K = h.length === 7 && !C(P(h, "MM/yyyy", /* @__PURE__ */ new Date()));
62
+ return /* @__PURE__ */ u(_, { open: y ? !1 : o, onOpenChange: (e) => {
63
+ y || p(e);
64
64
  }, children: [
65
- /* @__PURE__ */ n(F, { asChild: !0, children: /* @__PURE__ */ n("div", { "data-component": "month-picker", "data-state": r ? "open" : "closed", "data-pending": w || void 0, children: /* @__PURE__ */ n(
65
+ /* @__PURE__ */ n(F, { asChild: !0, children: /* @__PURE__ */ n("div", { "data-component": "month-picker", "data-state": o ? "open" : "closed", "data-pending": w || void 0, children: /* @__PURE__ */ n(
66
66
  Z,
67
67
  {
68
- ref: P,
69
- value: d,
68
+ ref: k,
69
+ value: h,
70
70
  onChange: G,
71
71
  onBlur: J,
72
- onClick: () => !m && p(!0),
73
- placeholder: r ? y("datePicker.monthYearFormat") : B,
74
- disabled: m,
72
+ onClick: () => !y && p(!0),
73
+ placeholder: o ? d("datePicker.monthYearFormat") : B,
74
+ disabled: y,
75
75
  "data-form-control": "input",
76
76
  className: U(
77
77
  "cursor-pointer",
78
78
  K ? "text-destructive" : w ? "text-content-muted" : "",
79
79
  O
80
80
  ),
81
- suffix: /* @__PURE__ */ M("div", { className: "flex items-center gap-1", children: [
82
- t && !m && /* @__PURE__ */ M(I, { children: [
81
+ suffix: /* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
82
+ t && !y && /* @__PURE__ */ u(I, { children: [
83
83
  /* @__PURE__ */ n(N, { asChild: !0, children: /* @__PURE__ */ n(
84
84
  "button",
85
85
  {
86
86
  type: "button",
87
87
  tabIndex: 0,
88
- "aria-label": y("calendar.clear"),
88
+ "aria-label": d("calendar.clear"),
89
89
  onClick: (e) => {
90
- e.stopPropagation(), k();
90
+ e.stopPropagation(), S();
91
91
  },
92
92
  className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
93
93
  children: /* @__PURE__ */ n(L, { className: "size-3 hover:text-content" })
94
94
  }
95
95
  ) }),
96
- /* @__PURE__ */ n(T, { variant: "tertiary", side: "top", children: y("calendar.clear") })
96
+ /* @__PURE__ */ n(T, { variant: "tertiary", side: "top", children: d("calendar.clear") })
97
97
  ] }),
98
- /* @__PURE__ */ M(I, { children: [
98
+ /* @__PURE__ */ u(I, { children: [
99
99
  /* @__PURE__ */ n(N, { asChild: !0, children: /* @__PURE__ */ n(Q, { className: "h-4 w-4 text-secondary-foreground" }) }),
100
- /* @__PURE__ */ n(T, { variant: "tertiary", side: "top", children: y("datePicker.selectMonth") })
100
+ /* @__PURE__ */ n(T, { variant: "tertiary", side: "top", children: d("datePicker.selectMonth") })
101
101
  ] })
102
102
  ] }),
103
103
  ...Y
@@ -108,23 +108,24 @@ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt =
108
108
  {
109
109
  className: "w-auto p-0",
110
110
  align: "start",
111
+ "aria-label": d("datePicker.selectMonth"),
111
112
  onOpenAutoFocus: (e) => e.preventDefault(),
112
113
  children: /* @__PURE__ */ n(
113
114
  tt,
114
115
  {
115
116
  pickerType: "month",
116
117
  monthMode: "single",
117
- selectedMonths: S,
118
+ selectedMonths: x,
118
119
  onMonthSelect: $,
119
120
  month: E,
120
121
  onMonthChange: g,
121
- disabled: { before: A, after: R },
122
- startMonth: b,
122
+ disabled: { before: A, after: b },
123
+ startMonth: R,
123
124
  endMonth: j,
124
125
  showFooter: l,
125
126
  onApply: H,
126
127
  onCancel: q,
127
- onClear: k
128
+ onClear: S
128
129
  }
129
130
  )
130
131
  }
@@ -1,7 +1,7 @@
1
1
  import { jsxs as h, jsx as i } from "react/jsx-runtime";
2
2
  import * as u from "react";
3
3
  import { Cross as ht, CalendarMonth as gt, Info as J } from "impact-nova-icons";
4
- import { isValid as Y, parse as y } from "date-fns";
4
+ import { isValid as y, parse as w } from "date-fns";
5
5
  import { cn as x, padValidDateString as R, maskDate as L } from "../../../lib/utils.js";
6
6
  import { Popover as xt, PopoverAnchor as Mt, PopoverContent as Yt } from "../popover.js";
7
7
  import { Calendar as yt } from "../calendar.js";
@@ -33,55 +33,55 @@ const p = (e, s = "MM/YYYY") => {
33
33
  displayFormat: a = "MM/YYYY",
34
34
  ...et
35
35
  }, nt) => {
36
- const { t: w } = wt();
37
- A ?? w("datePicker.selectMonthRange");
36
+ const { t: Y } = wt();
37
+ A ?? Y("datePicker.selectMonthRange");
38
38
  const H = u.useRef(null), ot = u.useRef(null), c = u.useMemo(
39
39
  () => a === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
40
40
  [a]
41
41
  );
42
42
  u.useImperativeHandle(nt, () => H.current);
43
- const [l, g] = u.useState(!1), V = u.useRef(!1), [P, b] = u.useState(e), [k, N] = u.useState(e?.from ? p(e.from, a) : ""), [D, v] = u.useState(e?.to ? p(e.to, a) : ""), [rt, j] = u.useState(() => e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date());
43
+ const [l, g] = u.useState(!1), V = u.useRef(!1), [v, b] = u.useState(e), [k, N] = u.useState(e?.from ? p(e.from, a) : ""), [D, P] = u.useState(e?.to ? p(e.to, a) : ""), [rt, j] = u.useState(() => e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date());
44
44
  u.useEffect(() => {
45
- l || (N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), b(e));
45
+ l || (N(e?.from ? p(e.from, a) : ""), P(e?.to ? p(e.to, a) : ""), b(e));
46
46
  }, [l, e, a]), u.useEffect(() => {
47
- l && (b(e), N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), j(e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date()));
47
+ l && (b(e), N(e?.from ? p(e.from, a) : ""), P(e?.to ? p(e.to, a) : ""), j(e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date()));
48
48
  }, [l, e, a, I]);
49
49
  const at = (t) => {
50
- b(t), t?.from && N(p(t.from, a)), t?.to && v(p(t.to, a)), !M && t?.from && t?.to && (t.from.month !== t.to.month || t.from.year !== t.to.year) && (s?.(t), g(!1));
50
+ b(t), t?.from && N(p(t.from, a)), t?.to && P(p(t.to, a)), !M && t?.from && t?.to && (t.from.month !== t.to.month || t.from.year !== t.to.year) && (s?.(t), g(!1));
51
51
  }, st = (t) => {
52
- s?.(t !== void 0 ? t : P), g(!1);
52
+ s?.(t !== void 0 ? t : v), g(!1);
53
53
  }, K = () => {
54
- b(e), N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), g(!1);
54
+ b(e), N(e?.from ? p(e.from, a) : ""), P(e?.to ? p(e.to, a) : ""), g(!1);
55
55
  }, $ = () => {
56
- b(void 0), N(""), v(""), s?.(void 0), M || g(!1);
56
+ b(void 0), N(""), P(""), s?.(void 0), M || g(!1);
57
57
  }, ct = (t) => {
58
58
  const f = t.target.value, r = L(f, c, k);
59
59
  if (N(r), r === "") {
60
- const o = { from: void 0, to: P?.to };
60
+ const o = { from: void 0, to: v?.to };
61
61
  b(o), M || s?.(o);
62
62
  return;
63
63
  }
64
- const n = y(r, c, /* @__PURE__ */ new Date());
65
- if (Y(n) && r.length === 7) {
66
- const d = { from: { month: n.getMonth(), year: n.getFullYear() }, to: P?.to };
64
+ const n = w(r, c, /* @__PURE__ */ new Date());
65
+ if (y(n) && r.length === 7) {
66
+ const d = { from: { month: n.getMonth(), year: n.getFullYear() }, to: v?.to };
67
67
  b(d), j(n), M || s?.(d);
68
68
  }
69
69
  }, it = (t) => {
70
70
  const f = t.target.value, r = L(f, c, D);
71
- if (v(r), r === "") {
72
- const o = { from: P?.from, to: void 0 };
71
+ if (P(r), r === "") {
72
+ const o = { from: v?.from, to: void 0 };
73
73
  b(o), M || s?.(o);
74
74
  return;
75
75
  }
76
- const n = y(r, c, /* @__PURE__ */ new Date());
77
- if (Y(n) && r.length === 7) {
78
- const o = { month: n.getMonth(), year: n.getFullYear() }, d = { from: P?.from, to: o };
76
+ const n = w(r, c, /* @__PURE__ */ new Date());
77
+ if (y(n) && r.length === 7) {
78
+ const o = { month: n.getMonth(), year: n.getFullYear() }, d = { from: v?.from, to: o };
79
79
  b(d), j(n), M || s?.(d);
80
80
  }
81
81
  }, T = () => {
82
82
  if (l) return;
83
- const t = R(k, c), f = R(D, c), r = y(t, c, /* @__PURE__ */ new Date()), n = y(f, c, /* @__PURE__ */ new Date()), o = Y(r) && t.length === 7, d = Y(n) && f.length === 7;
84
- k && !o ? N(e?.from ? p(e.from, a) : "") : o && N(t), D && !d ? v(e?.to ? p(e.to, a) : "") : d && v(f), o && d && !M ? s?.({
83
+ const t = R(k, c), f = R(D, c), r = w(t, c, /* @__PURE__ */ new Date()), n = w(f, c, /* @__PURE__ */ new Date()), o = y(r) && t.length === 7, d = y(n) && f.length === 7;
84
+ k && !o ? N(e?.from ? p(e.from, a) : "") : o && N(t), D && !d ? P(e?.to ? p(e.to, a) : "") : d && P(f), o && d && !M ? s?.({
85
85
  from: { month: r.getMonth(), year: r.getFullYear() },
86
86
  to: { month: n.getMonth(), year: n.getFullYear() }
87
87
  }) : o && !M ? s?.({
@@ -91,7 +91,7 @@ const p = (e, s = "MM/YYYY") => {
91
91
  from: e?.from,
92
92
  to: { month: n.getMonth(), year: n.getFullYear() }
93
93
  });
94
- }, lt = e?.from ? p(e.from, a) : "", dt = e?.to ? p(e.to, a) : "", ft = k !== lt, mt = D !== dt, pt = k.length === 7 && !Y(y(k, c, /* @__PURE__ */ new Date())), ut = D.length === 7 && !Y(y(D, c, /* @__PURE__ */ new Date())), q = w("datePicker.startMonth"), G = w("datePicker.endMonth");
94
+ }, lt = e?.from ? p(e.from, a) : "", dt = e?.to ? p(e.to, a) : "", ft = k !== lt, mt = D !== dt, pt = k.length === 7 && !y(w(k, c, /* @__PURE__ */ new Date())), ut = D.length === 7 && !y(w(D, c, /* @__PURE__ */ new Date())), q = Y("datePicker.startMonth"), G = Y("datePicker.endMonth");
95
95
  return /* @__PURE__ */ h("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "month-range-picker", "data-disabled": m || void 0, children: [
96
96
  /* @__PURE__ */ h("div", { className: "flex flex-col gap-[6px]", children: [
97
97
  O && /* @__PURE__ */ h(
@@ -146,7 +146,7 @@ const p = (e, s = "MM/YYYY") => {
146
146
  onKeyDown: (t) => {
147
147
  if (t.key === "Enter" && !l) {
148
148
  t.preventDefault();
149
- const f = R(k, c), r = R(D, c), n = y(f, c, /* @__PURE__ */ new Date()), o = y(r, c, /* @__PURE__ */ new Date()), d = Y(n) && f.length === 7, C = Y(o) && r.length === 7;
149
+ const f = R(k, c), r = R(D, c), n = w(f, c, /* @__PURE__ */ new Date()), o = w(r, c, /* @__PURE__ */ new Date()), d = y(n) && f.length === 7, C = y(o) && r.length === 7;
150
150
  d && C ? s?.({
151
151
  from: { month: n.getMonth(), year: n.getFullYear() },
152
152
  to: { month: o.getMonth(), year: o.getFullYear() }
@@ -160,7 +160,7 @@ const p = (e, s = "MM/YYYY") => {
160
160
  }
161
161
  t.key === "ArrowDown" && !l && !m && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && l && (t.preventDefault(), K());
162
162
  },
163
- placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : w("datePicker.monthYearFormat") : q,
163
+ placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : Y("datePicker.monthYearFormat") : q,
164
164
  disabled: !!m,
165
165
  "aria-label": q,
166
166
  "data-field": "start",
@@ -183,7 +183,7 @@ const p = (e, s = "MM/YYYY") => {
183
183
  onKeyDown: (t) => {
184
184
  if (t.key === "Enter" && !l) {
185
185
  t.preventDefault();
186
- const f = R(k, c), r = R(D, c), n = y(f, c, /* @__PURE__ */ new Date()), o = y(r, c, /* @__PURE__ */ new Date()), d = Y(n) && f.length === 7, C = Y(o) && r.length === 7;
186
+ const f = R(k, c), r = R(D, c), n = w(f, c, /* @__PURE__ */ new Date()), o = w(r, c, /* @__PURE__ */ new Date()), d = y(n) && f.length === 7, C = y(o) && r.length === 7;
187
187
  d && C ? s?.({
188
188
  from: { month: n.getMonth(), year: n.getFullYear() },
189
189
  to: { month: o.getMonth(), year: o.getFullYear() }
@@ -197,7 +197,7 @@ const p = (e, s = "MM/YYYY") => {
197
197
  }
198
198
  t.key === "ArrowDown" && !l && !m && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && l && (t.preventDefault(), K());
199
199
  },
200
- placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : w("datePicker.monthYearFormat") : G,
200
+ placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : Y("datePicker.monthYearFormat") : G,
201
201
  disabled: !!m,
202
202
  "aria-label": G,
203
203
  "data-field": "end",
@@ -215,7 +215,7 @@ const p = (e, s = "MM/YYYY") => {
215
215
  {
216
216
  type: "button",
217
217
  tabIndex: 0,
218
- "aria-label": w("calendar.clear"),
218
+ "aria-label": Y("calendar.clear"),
219
219
  onClick: (t) => {
220
220
  t.stopPropagation(), $();
221
221
  },
@@ -226,15 +226,15 @@ const p = (e, s = "MM/YYYY") => {
226
226
  children: /* @__PURE__ */ i(ht, { className: "size-3 hover:text-content text-content-muted" })
227
227
  }
228
228
  ) }),
229
- /* @__PURE__ */ i(W, { variant: "tertiary", side: "top", children: w("calendar.clear") })
229
+ /* @__PURE__ */ i(W, { variant: "tertiary", side: "top", children: Y("calendar.clear") })
230
230
  ] }),
231
231
  /* @__PURE__ */ h(Q, { children: [
232
- /* @__PURE__ */ i(U, { asChild: !0, children: /* @__PURE__ */ i("button", { type: "button", tabIndex: 0, "aria-label": w("datePicker.selectMonthRange"), onClick: (t) => {
232
+ /* @__PURE__ */ i(U, { asChild: !0, children: /* @__PURE__ */ i("button", { type: "button", tabIndex: 0, "aria-label": Y("datePicker.selectMonthRange"), onClick: (t) => {
233
233
  t.stopPropagation(), m || g(!l);
234
234
  }, onKeyDown: (t) => {
235
235
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), m || (V.current = !0, g(!l)));
236
236
  }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ i(gt, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
237
- /* @__PURE__ */ i(W, { variant: "tertiary", side: "top", children: w("datePicker.selectMonthRange") })
237
+ /* @__PURE__ */ i(W, { variant: "tertiary", side: "top", children: Y("datePicker.selectMonthRange") })
238
238
  ] })
239
239
  ] })
240
240
  ]
@@ -245,6 +245,7 @@ const p = (e, s = "MM/YYYY") => {
245
245
  {
246
246
  className: "w-auto p-0",
247
247
  align: "start",
248
+ "aria-label": Y("datePicker.selectMonthRange"),
248
249
  onOpenAutoFocus: (t) => {
249
250
  V.current || t.preventDefault(), V.current = !1;
250
251
  },
@@ -253,7 +254,7 @@ const p = (e, s = "MM/YYYY") => {
253
254
  {
254
255
  pickerType: "month",
255
256
  monthMode: "range",
256
- selectedMonths: P,
257
+ selectedMonths: v,
257
258
  onMonthSelect: at,
258
259
  month: rt,
259
260
  onMonthChange: j,
@@ -1,5 +1,5 @@
1
1
  import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import * as a from "react";
2
+ import * as l from "react";
3
3
  import { Cross as j, CalendarMonth as w } from "impact-nova-icons";
4
4
  import { format as z } from "date-fns";
5
5
  import { cn as R } from "../../../lib/utils.js";
@@ -9,36 +9,36 @@ import { Calendar as q } from "../calendar.js";
9
9
  import { Tooltip as u, TooltipTrigger as y, TooltipContent as g } from "../tooltip.js";
10
10
  import { getDateFnsLocale as B } from "../../../i18n/getDateFnsLocale.js";
11
11
  import { useImpactNovaI18n as G } from "../../../i18n/ImpactNovaI18nContext.js";
12
- const H = a.forwardRef(
12
+ const H = l.forwardRef(
13
13
  ({
14
14
  value: t,
15
15
  onChange: s,
16
16
  format: C = "MM/dd/yyyy",
17
- placeholder: x,
18
- minDate: P,
17
+ placeholder: P,
18
+ minDate: x,
19
19
  maxDate: M,
20
- startMonth: N,
21
- endMonth: D,
20
+ startMonth: D,
21
+ endMonth: N,
22
22
  showFooter: p = !0,
23
23
  disabled: o,
24
24
  className: k,
25
25
  ...A
26
26
  }, T) => {
27
- const { locale: m, t: l } = G(), b = a.useMemo(() => B(m), [m]), v = x ?? l("datePicker.selectMultipleDates"), [d, n] = a.useState(!1), [f, i] = a.useState(t);
28
- a.useEffect(() => {
27
+ const { locale: m, t: n } = G(), b = l.useMemo(() => B(m), [m]), v = P ?? n("datePicker.selectMultipleDates"), [d, a] = l.useState(!1), [f, i] = l.useState(t);
28
+ l.useEffect(() => {
29
29
  i(t);
30
30
  }, [d, t]);
31
31
  const I = (r) => {
32
32
  i(r), p || s?.(r);
33
33
  }, L = (r) => {
34
- s?.(r !== void 0 ? r : f), n(!1);
34
+ s?.(r !== void 0 ? r : f), a(!1);
35
35
  }, O = () => {
36
- i(t), n(!1);
36
+ i(t), a(!1);
37
37
  }, h = () => {
38
- i(void 0), s?.(void 0), p || n(!1);
38
+ i(void 0), s?.(void 0), p || a(!1);
39
39
  }, S = t && t.length > 0 ? t.length === 1 ? z(t[0], C, { locale: b }) : `${t.length} dates selected` : "";
40
40
  return /* @__PURE__ */ c(F, { open: o ? !1 : d, onOpenChange: (r) => {
41
- o || n(r);
41
+ o || a(r);
42
42
  }, children: [
43
43
  /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
44
44
  E,
@@ -49,7 +49,7 @@ const H = a.forwardRef(
49
49
  readOnly: !0,
50
50
  disabled: o,
51
51
  onClick: () => {
52
- !o && !d && n(!0);
52
+ !o && !d && a(!0);
53
53
  },
54
54
  className: R("cursor-pointer", k),
55
55
  suffix: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
@@ -59,7 +59,7 @@ const H = a.forwardRef(
59
59
  {
60
60
  type: "button",
61
61
  tabIndex: 0,
62
- "aria-label": l("calendar.clear"),
62
+ "aria-label": n("calendar.clear"),
63
63
  onClick: (r) => {
64
64
  r.stopPropagation(), h();
65
65
  },
@@ -67,11 +67,11 @@ const H = a.forwardRef(
67
67
  children: /* @__PURE__ */ e(j, { className: "size-3 hover:text-content" })
68
68
  }
69
69
  ) }),
70
- /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: l("calendar.clear") })
70
+ /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: n("calendar.clear") })
71
71
  ] }),
72
72
  /* @__PURE__ */ c(u, { children: [
73
73
  /* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(w, { className: "h-4 w-4 text-secondary-foreground" }) }),
74
- /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: l("datePicker.selectMultipleDates") })
74
+ /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: n("datePicker.selectMultipleDates") })
75
75
  ] })
76
76
  ] }),
77
77
  ...A
@@ -82,6 +82,7 @@ const H = a.forwardRef(
82
82
  {
83
83
  className: "w-auto p-0",
84
84
  align: "start",
85
+ "aria-label": n("datePicker.selectMultipleDates"),
85
86
  onOpenAutoFocus: (r) => r.preventDefault(),
86
87
  children: /* @__PURE__ */ e(
87
88
  q,
@@ -89,9 +90,9 @@ const H = a.forwardRef(
89
90
  mode: "multiple",
90
91
  selected: f,
91
92
  onSelect: I,
92
- disabled: { before: P, after: M },
93
- startMonth: N,
94
- endMonth: D,
93
+ disabled: { before: x, after: M },
94
+ startMonth: D,
95
+ endMonth: N,
95
96
  showFooter: p,
96
97
  onApply: L,
97
98
  onCancel: O,