impact-nova 2.0.6 → 2.0.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,7 +1,7 @@
1
- import { jsxs as x, jsx as o } from "react/jsx-runtime";
2
- import * as c from "react";
1
+ import { jsxs as P, jsx as r } from "react/jsx-runtime";
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 b } from "date-fns";
4
+ import { format as h, isValid as I, parse as N } 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";
@@ -9,78 +9,78 @@ import { Calendar as ce } from "../calendar.js";
9
9
  import { Tooltip as S, TooltipTrigger as E, TooltipContent as T } from "../tooltip.js";
10
10
  import { getDateFnsLocale as ie } from "../../../i18n/getDateFnsLocale.js";
11
11
  import { useImpactNovaI18n as le } from "../../../i18n/ImpactNovaI18nContext.js";
12
- const ae = c.forwardRef(
12
+ const ae = o.forwardRef(
13
13
  ({
14
14
  value: t,
15
- onChange: d,
15
+ onChange: u,
16
16
  format: n = "MM/dd/yyyy",
17
17
  placeholder: j,
18
18
  minDate: L,
19
19
  maxDate: K,
20
20
  startMonth: z,
21
21
  endMonth: B,
22
- showFooter: u = !0,
23
- weekStartsOn: N,
24
- disabled: s,
22
+ showFooter: d = !0,
23
+ weekStartsOn: R,
24
+ disabled: a,
25
25
  className: O,
26
26
  ...H
27
27
  }, q) => {
28
- const { locale: R, t: m } = le(), i = c.useMemo(() => ie(R), [R]), G = j ?? m("datePicker.selectDate"), y = c.useRef(null), D = c.useRef(null);
29
- c.useImperativeHandle(q, () => y.current);
30
- const [r, l] = c.useState(!1), k = c.useRef(!1), [v, a] = c.useState(t), [p, f] = c.useState(t ? h(t, n, { locale: i }) : ""), [J, w] = c.useState(t || /* @__PURE__ */ new Date());
31
- c.useEffect(() => {
32
- y.current && D.current !== null && (y.current.setSelectionRange(D.current, D.current), D.current = null);
33
- }, [p]), c.useEffect(() => {
34
- r || (f(t ? h(t, n, { locale: i }) : ""), a(t));
35
- }, [t, n, r, i]), c.useEffect(() => {
36
- r && (a(t), w(t || /* @__PURE__ */ new Date()));
37
- }, [r, t]);
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);
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());
31
+ o.useEffect(() => {
32
+ g.current && D.current !== null && (g.current.setSelectionRange(D.current, D.current), D.current = null);
33
+ }, [p]), o.useEffect(() => {
34
+ c || (f(t ? h(t, n, { locale: i }) : ""), s(t));
35
+ }, [t, n, c, i]), o.useEffect(() => {
36
+ c && (s(t), w(t || /* @__PURE__ */ new Date()));
37
+ }, [c, t]);
38
38
  const Q = (e) => {
39
- a(e), e && f(h(e, n, { locale: i })), u || (d?.(e), l(!1));
39
+ s(e), e && f(h(e, n, { locale: i })), d || (u?.(e), l(!1));
40
40
  }, U = (e) => {
41
- d?.(e !== void 0 ? e : v), l(!1);
41
+ u?.(e !== void 0 ? e : v), l(!1);
42
42
  }, V = () => {
43
- a(t), f(t ? h(t, n, { locale: i }) : ""), l(!1);
43
+ s(t), f(t ? h(t, n, { locale: i }) : ""), l(!1);
44
44
  }, A = () => {
45
- a(void 0), f(""), d?.(void 0), u || l(!1);
45
+ s(void 0), f(""), u?.(void 0), d || l(!1);
46
46
  }, W = (e) => {
47
- const g = e.target.value, C = ee(g, n, p);
47
+ const y = e.target.value, C = ee(y, n, p);
48
48
  if (f(C), C === "") {
49
- a(void 0), u || d?.(void 0);
49
+ s(void 0), d || u?.(void 0);
50
50
  return;
51
51
  }
52
- const P = b(C, n, /* @__PURE__ */ new Date(), { locale: i });
53
- I(P) && C.length === n.length && (a(P), w(P), u || d?.(P));
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));
54
54
  }, X = () => {
55
- if (r) return;
56
- const e = F(p, n), g = b(e, n, /* @__PURE__ */ new Date(), { locale: i });
57
- !I(g) || e.length !== n.length ? (f(t ? h(t, n, { locale: i }) : ""), a(t)) : (f(e), u || d?.(g));
58
- }, M = (t ? h(t, n, { locale: i }) : "") !== p, Y = p.length === n.length && !I(b(p, n, /* @__PURE__ */ new Date(), { locale: i }));
59
- return /* @__PURE__ */ x(ne, { open: s ? !1 : r, onOpenChange: (e) => {
60
- s || l(e);
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);
61
61
  }, children: [
62
- /* @__PURE__ */ o(re, { asChild: !0, children: /* @__PURE__ */ o("div", { "data-component": "date-picker", "data-state": r ? "open" : "closed", "data-pending": M || void 0, children: /* @__PURE__ */ o(
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,
64
64
  {
65
- ref: y,
65
+ ref: g,
66
66
  value: p,
67
67
  onChange: W,
68
68
  onBlur: X,
69
- onClick: (e) => r && e.stopPropagation(),
69
+ onClick: () => !a && l(!0),
70
70
  onKeyDown: (e) => {
71
- (e.key === "Enter" || e.key === "ArrowDown") && !r && !s && (e.preventDefault(), k.current = !0, l(!0)), e.key === "Escape" && r && (e.preventDefault(), V());
71
+ (e.key === "Enter" || e.key === "ArrowDown") && !c && !a && (e.preventDefault(), k.current = !0, l(!0)), e.key === "Escape" && c && (e.preventDefault(), V());
72
72
  },
73
- placeholder: r ? n : G,
74
- disabled: s,
73
+ placeholder: c ? n : G,
74
+ disabled: a,
75
75
  "data-form-control": "input",
76
76
  className: $(
77
77
  "cursor-pointer",
78
78
  Y ? "text-destructive" : M ? "text-content-muted" : "",
79
79
  O
80
80
  ),
81
- suffix: /* @__PURE__ */ x("div", { className: "flex items-center gap-1", children: [
82
- t && !s && /* @__PURE__ */ x(S, { children: [
83
- /* @__PURE__ */ o(E, { asChild: !0, children: /* @__PURE__ */ o(
81
+ suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
82
+ t && !a && /* @__PURE__ */ P(S, { children: [
83
+ /* @__PURE__ */ r(E, { asChild: !0, children: /* @__PURE__ */ r(
84
84
  "button",
85
85
  {
86
86
  type: "button",
@@ -90,24 +90,24 @@ const ae = c.forwardRef(
90
90
  e.stopPropagation(), A();
91
91
  },
92
92
  className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
93
- children: /* @__PURE__ */ o(Z, { className: "size-3 hover:text-content" })
93
+ children: /* @__PURE__ */ r(Z, { className: "size-3 hover:text-content" })
94
94
  }
95
95
  ) }),
96
- /* @__PURE__ */ o(T, { variant: "tertiary", side: "top", children: m("calendar.clear") })
96
+ /* @__PURE__ */ r(T, { variant: "tertiary", side: "top", children: m("calendar.clear") })
97
97
  ] }),
98
- /* @__PURE__ */ x(S, { children: [
99
- /* @__PURE__ */ o(E, { asChild: !0, children: /* @__PURE__ */ o("button", { type: "button", tabIndex: 0, "aria-label": m("datePicker.selectDate"), onClick: (e) => {
100
- e.stopPropagation(), s || l(!r);
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);
101
101
  }, onKeyDown: (e) => {
102
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), s || (k.current = !0, l(!r)));
103
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ o(_, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
104
- /* @__PURE__ */ o(T, { variant: "tertiary", side: "top", children: m("datePicker.selectDate") })
102
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), a || (k.current = !0, l(!c)));
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") })
105
105
  ] })
106
106
  ] }),
107
107
  ...H
108
108
  }
109
109
  ) }) }),
110
- /* @__PURE__ */ o(
110
+ /* @__PURE__ */ r(
111
111
  oe,
112
112
  {
113
113
  className: "w-auto p-0",
@@ -115,7 +115,7 @@ const ae = c.forwardRef(
115
115
  onOpenAutoFocus: (e) => {
116
116
  k.current || e.preventDefault(), k.current = !1;
117
117
  },
118
- children: /* @__PURE__ */ o(
118
+ children: /* @__PURE__ */ r(
119
119
  ce,
120
120
  {
121
121
  mode: "single",
@@ -126,12 +126,12 @@ const ae = c.forwardRef(
126
126
  disabled: { before: L, after: K },
127
127
  startMonth: z,
128
128
  endMonth: B,
129
- showFooter: u,
129
+ showFooter: d,
130
130
  onApply: U,
131
131
  onCancel: V,
132
132
  onClear: A,
133
133
  captionLayout: "dropdown",
134
- ...N !== void 0 ? { weekStartsOn: N } : {}
134
+ ...R !== void 0 ? { weekStartsOn: R } : {}
135
135
  }
136
136
  )
137
137
  }
@@ -1,14 +1,14 @@
1
- import { jsxs as u, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as c } from "react/jsx-runtime";
2
2
  import * as d from "react";
3
3
  import { Cross as ye, CalendarMonth as be, Info as Q } from "impact-nova-icons";
4
- import { format as p, isValid as y, parse as b } from "date-fns";
5
- import { cn as x, padValidDateString as E, maskDate as U } from "../../../lib/utils.js";
4
+ import { format as m, isValid as b, parse as w } from "date-fns";
5
+ import { cn as h, padValidDateString as E, maskDate as U } from "../../../lib/utils.js";
6
6
  import { Popover as we, PopoverAnchor as De, PopoverContent as ke } from "../popover.js";
7
7
  import { Calendar as ve } from "../calendar.js";
8
8
  import { Tooltip as W, TooltipTrigger as X, TooltipContent as Y } from "../tooltip.js";
9
9
  import { getDateFnsLocale as Ne } from "../../../i18n/getDateFnsLocale.js";
10
10
  import { useImpactNovaI18n as Se } from "../../../i18n/ImpactNovaI18nContext.js";
11
- const Pe = d.forwardRef(
11
+ const Re = d.forwardRef(
12
12
  ({
13
13
  value: n,
14
14
  onChange: f,
@@ -19,109 +19,109 @@ const Pe = d.forwardRef(
19
19
  maxDate: F,
20
20
  startMonth: ee,
21
21
  endMonth: te,
22
- showFooter: h = !0,
22
+ showFooter: g = !0,
23
23
  weekStartsOn: L,
24
- disabled: m,
24
+ disabled: p,
25
25
  label: B,
26
26
  helperText: V,
27
27
  helperTextPosition: j = "absolute",
28
- prefix: Re,
28
+ prefix: Pe,
29
29
  prefixClick: Ie,
30
30
  isError: N,
31
31
  size: O,
32
32
  required: ne,
33
33
  className: oe,
34
34
  ...le
35
- }, se) => {
36
- const { locale: H, t: R } = Se(), o = d.useMemo(() => Ne(H), [H]), T = Z ?? R("datePicker.startDate"), q = $ ?? R("datePicker.endDate"), G = d.useRef(null), re = d.useRef(null);
37
- d.useRef(null), d.useRef(null), d.useImperativeHandle(se, () => G.current);
38
- const [i, w] = d.useState(!1), C = d.useRef(!1), [I, D] = d.useState(n), [k, S] = d.useState(n?.from ? p(n.from, t, { locale: o }) : ""), [v, P] = d.useState(n?.to ? p(n.to, t, { locale: o }) : ""), [ie, A] = d.useState(n?.from || /* @__PURE__ */ new Date());
35
+ }, re) => {
36
+ const { locale: H, t: P } = Se(), o = d.useMemo(() => Ne(H), [H]), T = Z ?? P("datePicker.startDate"), q = $ ?? P("datePicker.endDate"), G = d.useRef(null), se = d.useRef(null);
37
+ d.useRef(null), d.useRef(null), d.useImperativeHandle(re, () => G.current);
38
+ const [a, x] = d.useState(!1), C = d.useRef(!1), [I, D] = d.useState(n), [k, S] = d.useState(n?.from ? m(n.from, t, { locale: o }) : ""), [v, R] = d.useState(n?.to ? m(n.to, t, { locale: o }) : ""), [ie, A] = d.useState(n?.from || /* @__PURE__ */ new Date());
39
39
  d.useEffect(() => {
40
- i || (S(n?.from ? p(n.from, t, { locale: o }) : ""), P(n?.to ? p(n.to, t, { locale: o }) : ""), D(n));
41
- }, [n, t, i, o]), d.useEffect(() => {
42
- i && (D(n), S(n?.from ? p(n.from, t, { locale: o }) : ""), P(n?.to ? p(n.to, t, { locale: o }) : ""), A(n?.from || /* @__PURE__ */ new Date()));
43
- }, [i, n, t, o]);
40
+ a || (S(n?.from ? m(n.from, t, { locale: o }) : ""), R(n?.to ? m(n.to, t, { locale: o }) : ""), D(n));
41
+ }, [n, t, a, o]), d.useEffect(() => {
42
+ a && (D(n), S(n?.from ? m(n.from, t, { locale: o }) : ""), R(n?.to ? m(n.to, t, { locale: o }) : ""), A(n?.from || /* @__PURE__ */ new Date()));
43
+ }, [a, n, t, o]);
44
44
  const ce = (e) => {
45
- D(e), e?.from && S(p(e.from, t, { locale: o })), e?.to && P(p(e.to, t, { locale: o })), h || e?.from && e?.to && e.from.getTime() !== e.to.getTime() && (f?.(e), w(!1));
45
+ D(e), e?.from && S(m(e.from, t, { locale: o })), e?.to && R(m(e.to, t, { locale: o })), g || e?.from && e?.to && e.from.getTime() !== e.to.getTime() && (f?.(e), x(!1));
46
46
  }, ae = (e) => {
47
- let s = e !== void 0 ? e : I;
48
- s?.from && !s.to && (s = { from: s.from, to: s.from }), f?.(s), w(!1);
47
+ let r = e !== void 0 ? e : I;
48
+ r?.from && !r.to && (r = { from: r.from, to: r.from }), f?.(r), x(!1);
49
49
  }, z = () => {
50
- D(n), S(n?.from ? p(n.from, t, { locale: o }) : ""), P(n?.to ? p(n.to, t, { locale: o }) : ""), w(!1);
50
+ D(n), S(n?.from ? m(n.from, t, { locale: o }) : ""), R(n?.to ? m(n.to, t, { locale: o }) : ""), x(!1);
51
51
  }, K = () => {
52
- D(void 0), S(""), P(""), f?.(void 0), h || w(!1);
52
+ D(void 0), S(""), R(""), f?.(void 0), g || x(!1);
53
53
  }, fe = (e) => {
54
- const s = e.target.value, c = U(s, t, k);
55
- if (S(c), c === "") {
54
+ const r = e.target.value, i = U(r, t, k);
55
+ if (S(i), i === "") {
56
56
  const l = { from: void 0, to: I?.to };
57
- D(l), h || f?.(l);
57
+ D(l), g || f?.(l);
58
58
  return;
59
59
  }
60
- const r = b(c, t, /* @__PURE__ */ new Date(), { locale: o });
61
- if (y(r) && c.length === t.length) {
62
- const l = { from: r, to: I?.to };
63
- D(l), A(r), h || f?.(l);
60
+ const s = w(i, t, /* @__PURE__ */ new Date(), { locale: o });
61
+ if (b(s) && i.length === t.length) {
62
+ const l = { from: s, to: I?.to };
63
+ D(l), A(s), g || f?.(l);
64
64
  }
65
65
  }, de = (e) => {
66
- const s = e.target.value, c = U(s, t, v);
67
- if (P(c), c === "") {
66
+ const r = e.target.value, i = U(r, t, v);
67
+ if (R(i), i === "") {
68
68
  const l = { from: I?.from, to: void 0 };
69
- D(l), h || f?.(l);
69
+ D(l), g || f?.(l);
70
70
  return;
71
71
  }
72
- const r = b(c, t, /* @__PURE__ */ new Date(), { locale: o });
73
- if (y(r) && c.length === t.length) {
74
- const l = { from: I?.from, to: r };
75
- D(l), r && A(r), h || f?.(l);
72
+ const s = w(i, t, /* @__PURE__ */ new Date(), { locale: o });
73
+ if (b(s) && i.length === t.length) {
74
+ const l = { from: I?.from, to: s };
75
+ D(l), s && A(s), g || f?.(l);
76
76
  }
77
77
  }, J = () => {
78
- if (i) return;
79
- const e = E(k, t), s = E(v, t), c = b(e, t, /* @__PURE__ */ new Date(), { locale: o }), r = b(s, t, /* @__PURE__ */ new Date(), { locale: o }), l = y(c) && e.length === t.length, g = y(r) && s.length === t.length;
80
- k && !l ? S(n?.from ? p(n.from, t, { locale: o }) : "") : l && S(e), v && !g ? P(n?.to ? p(n.to, t, { locale: o }) : "") : g && P(s), l && g && !h ? f?.({ from: c, to: r }) : l && !h ? f?.({ from: c, to: n?.to }) : g && !h && f?.({ from: n?.from, to: r });
81
- }, pe = n?.from ? p(n.from, t, { locale: o }) : "", me = n?.to ? p(n.to, t, { locale: o }) : "", ue = k !== pe, xe = v !== me, he = k.length === t.length && !y(b(k, t, /* @__PURE__ */ new Date(), { locale: o })), ge = v.length === t.length && !y(b(v, t, /* @__PURE__ */ new Date(), { locale: o }));
82
- return /* @__PURE__ */ u("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "date-range-picker", "data-disabled": m || void 0, children: [
78
+ if (a) return;
79
+ const e = E(k, t), r = E(v, t), i = w(e, t, /* @__PURE__ */ new Date(), { locale: o }), s = w(r, t, /* @__PURE__ */ new Date(), { locale: o }), l = b(i) && e.length === t.length, y = b(s) && r.length === t.length;
80
+ k && !l ? S(n?.from ? m(n.from, t, { locale: o }) : "") : l && S(e), v && !y ? R(n?.to ? m(n.to, t, { locale: o }) : "") : y && R(r), l && y && !g ? f?.({ from: i, to: s }) : l && !g ? f?.({ from: i, to: n?.to }) : y && !g && f?.({ from: n?.from, to: s });
81
+ }, pe = n?.from ? m(n.from, t, { locale: o }) : "", me = n?.to ? m(n.to, t, { locale: o }) : "", ue = k !== pe, xe = v !== me, he = k.length === t.length && !b(w(k, t, /* @__PURE__ */ new Date(), { locale: o })), ge = v.length === t.length && !b(w(v, t, /* @__PURE__ */ new Date(), { locale: o }));
82
+ return /* @__PURE__ */ u("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "date-range-picker", "data-disabled": p || void 0, children: [
83
83
  /* @__PURE__ */ u("div", { className: "flex flex-col gap-[6px]", children: [
84
84
  B && /* @__PURE__ */ u(
85
85
  "label",
86
86
  {
87
- className: x(
87
+ className: h(
88
88
  "text-xs font-medium leading-[18px] text-content-tertiary",
89
- m && "opacity-70",
89
+ p && "opacity-70",
90
90
  N && "text-destructive"
91
91
  ),
92
92
  children: [
93
93
  B,
94
94
  " ",
95
- ne && /* @__PURE__ */ a("span", { className: "text-destructive", children: "*" })
95
+ ne && /* @__PURE__ */ c("span", { className: "text-destructive", children: "*" })
96
96
  ]
97
97
  }
98
98
  ),
99
99
  /* @__PURE__ */ u(
100
100
  "div",
101
101
  {
102
- className: x(
102
+ className: h(
103
103
  "w-full",
104
104
  V && j === "absolute" && "relative"
105
105
  ),
106
106
  children: [
107
- /* @__PURE__ */ u(we, { open: m ? !1 : i, onOpenChange: (e) => {
108
- m || w(e);
107
+ /* @__PURE__ */ u(we, { open: p ? !1 : a, onOpenChange: (e) => {
108
+ p || x(e);
109
109
  }, children: [
110
- /* @__PURE__ */ a(De, { asChild: !0, children: /* @__PURE__ */ u(
110
+ /* @__PURE__ */ c(De, { asChild: !0, children: /* @__PURE__ */ u(
111
111
  "div",
112
112
  {
113
- "data-state": i ? "open" : "closed",
114
- className: x(
113
+ "data-state": a ? "open" : "closed",
114
+ className: h(
115
115
  "flex w-full items-center justify-between gap-2 rounded-md border bg-canvas-elevated px-3 text-sm shadow-sm transition-colors hover:border-brand disabled:cursor-not-allowed disabled:bg-disabled-surface disabled:text-disabled-foreground disabled:border-stroke",
116
116
  N ? "border-destructive hover:border-destructive" : "border-field",
117
117
  O === "sm" ? "h-6" : O === "md" ? "h-[28px]" : "h-8",
118
- m && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
118
+ p && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
119
119
  "cursor-pointer",
120
120
  oe
121
121
  ),
122
122
  children: [
123
123
  /* @__PURE__ */ u("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
124
- /* @__PURE__ */ a(
124
+ /* @__PURE__ */ c(
125
125
  "input",
126
126
  {
127
127
  ref: G,
@@ -129,48 +129,48 @@ const Pe = d.forwardRef(
129
129
  value: k,
130
130
  onChange: fe,
131
131
  onBlur: J,
132
- onClick: (e) => i && e.stopPropagation(),
132
+ onClick: () => !p && x(!0),
133
133
  onKeyDown: (e) => {
134
- if (e.key === "Enter" && !i) {
134
+ if (e.key === "Enter" && !a) {
135
135
  e.preventDefault();
136
- const s = E(k, t), c = E(v, t), r = b(s, t, /* @__PURE__ */ new Date(), { locale: o }), l = b(c, t, /* @__PURE__ */ new Date(), { locale: o }), g = y(r) && s.length === t.length, M = y(l) && c.length === t.length;
137
- g && M ? f?.({ from: r, to: l }) : g ? f?.({ from: r, to: n?.to }) : M && f?.({ from: n?.from, to: l });
136
+ const r = E(k, t), i = E(v, t), s = w(r, t, /* @__PURE__ */ new Date(), { locale: o }), l = w(i, t, /* @__PURE__ */ new Date(), { locale: o }), y = b(s) && r.length === t.length, M = b(l) && i.length === t.length;
137
+ y && M ? f?.({ from: s, to: l }) : y ? f?.({ from: s, to: n?.to }) : M && f?.({ from: n?.from, to: l });
138
138
  }
139
- e.key === "ArrowDown" && !i && !m && (e.preventDefault(), C.current = !0, w(!0)), e.key === "Escape" && i && (e.preventDefault(), z());
139
+ e.key === "ArrowDown" && !a && !p && (e.preventDefault(), C.current = !0, x(!0)), e.key === "Escape" && a && (e.preventDefault(), z());
140
140
  },
141
- placeholder: i ? t : T,
142
- disabled: !!m,
141
+ placeholder: a ? t : T,
142
+ disabled: !!p,
143
143
  "aria-label": T,
144
144
  "data-field": "start",
145
- className: x(
145
+ className: h(
146
146
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
147
147
  he ? "text-destructive" : ue ? "text-content-muted" : ""
148
148
  ),
149
149
  ...le
150
150
  }
151
151
  ),
152
- /* @__PURE__ */ a(
152
+ /* @__PURE__ */ c(
153
153
  "input",
154
154
  {
155
- ref: re,
155
+ ref: se,
156
156
  type: "text",
157
157
  value: v,
158
158
  onChange: de,
159
159
  onBlur: J,
160
- onClick: (e) => i && e.stopPropagation(),
160
+ onClick: () => !p && x(!0),
161
161
  onKeyDown: (e) => {
162
- if (e.key === "Enter" && !i) {
162
+ if (e.key === "Enter" && !a) {
163
163
  e.preventDefault();
164
- const s = E(k, t), c = E(v, t), r = b(s, t, /* @__PURE__ */ new Date(), { locale: o }), l = b(c, t, /* @__PURE__ */ new Date(), { locale: o }), g = y(r) && s.length === t.length, M = y(l) && c.length === t.length;
165
- g && M ? f?.({ from: r, to: l }) : g ? f?.({ from: r, to: n?.to }) : M && f?.({ from: n?.from, to: l });
164
+ const r = E(k, t), i = E(v, t), s = w(r, t, /* @__PURE__ */ new Date(), { locale: o }), l = w(i, t, /* @__PURE__ */ new Date(), { locale: o }), y = b(s) && r.length === t.length, M = b(l) && i.length === t.length;
165
+ y && M ? f?.({ from: s, to: l }) : y ? f?.({ from: s, to: n?.to }) : M && f?.({ from: n?.from, to: l });
166
166
  }
167
- e.key === "ArrowDown" && !i && !m && (e.preventDefault(), C.current = !0, w(!0)), e.key === "Escape" && i && (e.preventDefault(), z());
167
+ e.key === "ArrowDown" && !a && !p && (e.preventDefault(), C.current = !0, x(!0)), e.key === "Escape" && a && (e.preventDefault(), z());
168
168
  },
169
- placeholder: i ? t : q,
170
- disabled: !!m,
169
+ placeholder: a ? t : q,
170
+ disabled: !!p,
171
171
  "aria-label": q,
172
172
  "data-field": "end",
173
- className: x(
173
+ className: h(
174
174
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
175
175
  ge ? "text-destructive" : xe ? "text-content-muted" : ""
176
176
  )
@@ -178,13 +178,13 @@ const Pe = d.forwardRef(
178
178
  )
179
179
  ] }),
180
180
  /* @__PURE__ */ u("div", { className: "flex items-center gap-1 shrink-0", children: [
181
- n?.from && !m && /* @__PURE__ */ u(W, { children: [
182
- /* @__PURE__ */ a(X, { asChild: !0, children: /* @__PURE__ */ a(
181
+ n?.from && !p && /* @__PURE__ */ u(W, { children: [
182
+ /* @__PURE__ */ c(X, { asChild: !0, children: /* @__PURE__ */ c(
183
183
  "button",
184
184
  {
185
185
  type: "button",
186
186
  tabIndex: 0,
187
- "aria-label": R("calendar.clear"),
187
+ "aria-label": P("calendar.clear"),
188
188
  onClick: (e) => {
189
189
  e.stopPropagation(), K();
190
190
  },
@@ -192,24 +192,24 @@ const Pe = d.forwardRef(
192
192
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), K());
193
193
  },
194
194
  className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
195
- children: /* @__PURE__ */ a(ye, { className: "size-3 hover:text-content text-content-muted" })
195
+ children: /* @__PURE__ */ c(ye, { className: "size-3 hover:text-content text-content-muted" })
196
196
  }
197
197
  ) }),
198
- /* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: R("calendar.clear") })
198
+ /* @__PURE__ */ c(Y, { variant: "tertiary", side: "top", children: P("calendar.clear") })
199
199
  ] }),
200
200
  /* @__PURE__ */ u(W, { children: [
201
- /* @__PURE__ */ a(X, { asChild: !0, children: /* @__PURE__ */ a("button", { type: "button", tabIndex: 0, "aria-label": R("datePicker.selectMonthRange"), onClick: (e) => {
202
- e.stopPropagation(), m || w(!i);
201
+ /* @__PURE__ */ c(X, { asChild: !0, children: /* @__PURE__ */ c("button", { type: "button", tabIndex: 0, "aria-label": P("datePicker.selectMonthRange"), onClick: (e) => {
202
+ e.stopPropagation(), p || x(!a);
203
203
  }, onKeyDown: (e) => {
204
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), m || (C.current = !0, w(!i)));
205
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ a(be, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
206
- /* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: R("datePicker.selectMonthRange") })
204
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (C.current = !0, x(!a)));
205
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ c(be, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
206
+ /* @__PURE__ */ c(Y, { variant: "tertiary", side: "top", children: P("datePicker.selectMonthRange") })
207
207
  ] })
208
208
  ] })
209
209
  ]
210
210
  }
211
211
  ) }),
212
- /* @__PURE__ */ a(
212
+ /* @__PURE__ */ c(
213
213
  ke,
214
214
  {
215
215
  className: "w-auto p-0",
@@ -217,7 +217,7 @@ const Pe = d.forwardRef(
217
217
  onOpenAutoFocus: (e) => {
218
218
  C.current || e.preventDefault(), C.current = !1;
219
219
  },
220
- children: /* @__PURE__ */ a(
220
+ children: /* @__PURE__ */ c(
221
221
  ve,
222
222
  {
223
223
  mode: "range",
@@ -228,7 +228,7 @@ const Pe = d.forwardRef(
228
228
  disabled: { before: _, after: F },
229
229
  startMonth: ee,
230
230
  endMonth: te,
231
- showFooter: h,
231
+ showFooter: g,
232
232
  onApply: ae,
233
233
  onCancel: z,
234
234
  onClear: K,
@@ -239,21 +239,21 @@ const Pe = d.forwardRef(
239
239
  }
240
240
  )
241
241
  ] }),
242
- V && j === "absolute" && /* @__PURE__ */ u("div", { className: x("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", N && "text-destructive"), children: [
243
- /* @__PURE__ */ a(
242
+ V && j === "absolute" && /* @__PURE__ */ u("div", { className: h("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", N && "text-destructive"), children: [
243
+ /* @__PURE__ */ c(
244
244
  Q,
245
245
  {
246
246
  size: "xs",
247
- className: x(
247
+ className: h(
248
248
  "shrink-0",
249
249
  N ? "text-destructive" : "text-content-muted"
250
250
  )
251
251
  }
252
252
  ),
253
- /* @__PURE__ */ a(
253
+ /* @__PURE__ */ c(
254
254
  "p",
255
255
  {
256
- className: x(
256
+ className: h(
257
257
  "min-w-0 text-[12px] font-medium leading-[18px] text-navigation-muted",
258
258
  N && "text-destructive"
259
259
  ),
@@ -265,21 +265,21 @@ const Pe = d.forwardRef(
265
265
  }
266
266
  )
267
267
  ] }),
268
- V && j === "flow" && /* @__PURE__ */ u("div", { className: x("flex items-center gap-[6px]", N && "text-destructive"), children: [
269
- /* @__PURE__ */ a(
268
+ V && j === "flow" && /* @__PURE__ */ u("div", { className: h("flex items-center gap-[6px]", N && "text-destructive"), children: [
269
+ /* @__PURE__ */ c(
270
270
  Q,
271
271
  {
272
272
  size: "xs",
273
- className: x(
273
+ className: h(
274
274
  "shrink-0",
275
275
  N ? "text-destructive" : "text-content-muted"
276
276
  )
277
277
  }
278
278
  ),
279
- /* @__PURE__ */ a(
279
+ /* @__PURE__ */ c(
280
280
  "p",
281
281
  {
282
- className: x(
282
+ className: h(
283
283
  "text-[12px] font-medium leading-[18px] text-navigation-muted",
284
284
  N && "text-destructive"
285
285
  ),
@@ -290,7 +290,7 @@ const Pe = d.forwardRef(
290
290
  ] });
291
291
  }
292
292
  );
293
- Pe.displayName = "DateRangePicker";
293
+ Re.displayName = "DateRangePicker";
294
294
  export {
295
- Pe as DateRangePicker
295
+ Re as DateRangePicker
296
296
  };