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.
- package/dist/components/ui/date-picker/date-picker.js +53 -53
- package/dist/components/ui/date-picker/date-range-picker.js +93 -93
- package/dist/components/ui/date-picker/month-picker.js +38 -38
- package/dist/components/ui/date-picker/month-range-picker.js +104 -104
- package/dist/components/ui/date-picker/multi-date-picker.js +31 -28
- package/dist/components/ui/date-picker/multi-month-picker.js +37 -34
- package/dist/components/ui/date-picker/multi-week-picker.js +35 -32
- package/dist/components/ui/date-picker/week-picker.js +62 -62
- package/dist/components/ui/date-picker/week-range-picker.js +62 -62
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/troubleshooting.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
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
|
|
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 =
|
|
12
|
+
const ae = o.forwardRef(
|
|
13
13
|
({
|
|
14
14
|
value: t,
|
|
15
|
-
onChange:
|
|
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:
|
|
23
|
-
weekStartsOn:
|
|
24
|
-
disabled:
|
|
22
|
+
showFooter: d = !0,
|
|
23
|
+
weekStartsOn: R,
|
|
24
|
+
disabled: a,
|
|
25
25
|
className: O,
|
|
26
26
|
...H
|
|
27
27
|
}, q) => {
|
|
28
|
-
const { locale:
|
|
29
|
-
|
|
30
|
-
const [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [p]),
|
|
34
|
-
|
|
35
|
-
}, [t, n,
|
|
36
|
-
|
|
37
|
-
}, [
|
|
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
|
-
|
|
39
|
+
s(e), e && f(h(e, n, { locale: i })), d || (u?.(e), l(!1));
|
|
40
40
|
}, U = (e) => {
|
|
41
|
-
|
|
41
|
+
u?.(e !== void 0 ? e : v), l(!1);
|
|
42
42
|
}, V = () => {
|
|
43
|
-
|
|
43
|
+
s(t), f(t ? h(t, n, { locale: i }) : ""), l(!1);
|
|
44
44
|
}, A = () => {
|
|
45
|
-
|
|
45
|
+
s(void 0), f(""), u?.(void 0), d || l(!1);
|
|
46
46
|
}, W = (e) => {
|
|
47
|
-
const
|
|
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
|
|
53
|
-
I(
|
|
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 (
|
|
56
|
-
const e = F(p, n),
|
|
57
|
-
!I(
|
|
58
|
-
}, M = (t ? h(t, n, { locale: i }) : "") !== p, Y = p.length === n.length && !I(
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
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__ */
|
|
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:
|
|
65
|
+
ref: g,
|
|
66
66
|
value: p,
|
|
67
67
|
onChange: W,
|
|
68
68
|
onBlur: X,
|
|
69
|
-
onClick: (
|
|
69
|
+
onClick: () => !a && l(!0),
|
|
70
70
|
onKeyDown: (e) => {
|
|
71
|
-
(e.key === "Enter" || e.key === "ArrowDown") && !
|
|
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:
|
|
74
|
-
disabled:
|
|
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__ */
|
|
82
|
-
t && !
|
|
83
|
-
/* @__PURE__ */
|
|
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__ */
|
|
93
|
+
children: /* @__PURE__ */ r(Z, { className: "size-3 hover:text-content" })
|
|
94
94
|
}
|
|
95
95
|
) }),
|
|
96
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ r(T, { variant: "tertiary", side: "top", children: m("calendar.clear") })
|
|
97
97
|
] }),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
e.stopPropagation(),
|
|
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(),
|
|
103
|
-
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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:
|
|
129
|
+
showFooter: d,
|
|
130
130
|
onApply: U,
|
|
131
131
|
onCancel: V,
|
|
132
132
|
onClear: A,
|
|
133
133
|
captionLayout: "dropdown",
|
|
134
|
-
...
|
|
134
|
+
...R !== void 0 ? { weekStartsOn: R } : {}
|
|
135
135
|
}
|
|
136
136
|
)
|
|
137
137
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as u, jsx as
|
|
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
|
|
5
|
-
import { cn as
|
|
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
|
|
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:
|
|
22
|
+
showFooter: g = !0,
|
|
23
23
|
weekStartsOn: L,
|
|
24
|
-
disabled:
|
|
24
|
+
disabled: p,
|
|
25
25
|
label: B,
|
|
26
26
|
helperText: V,
|
|
27
27
|
helperTextPosition: j = "absolute",
|
|
28
|
-
prefix:
|
|
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
|
-
},
|
|
36
|
-
const { locale: H, t:
|
|
37
|
-
d.useRef(null), d.useRef(null), d.useImperativeHandle(
|
|
38
|
-
const [
|
|
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
|
-
|
|
41
|
-
}, [n, t,
|
|
42
|
-
|
|
43
|
-
}, [
|
|
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(
|
|
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
|
|
48
|
-
|
|
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 ?
|
|
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(""),
|
|
52
|
+
D(void 0), S(""), R(""), f?.(void 0), g || x(!1);
|
|
53
53
|
}, fe = (e) => {
|
|
54
|
-
const
|
|
55
|
-
if (S(
|
|
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),
|
|
57
|
+
D(l), g || f?.(l);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const l = { from:
|
|
63
|
-
D(l), A(
|
|
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
|
|
67
|
-
if (
|
|
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),
|
|
69
|
+
D(l), g || f?.(l);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
const l = { from: I?.from, to:
|
|
75
|
-
D(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 (
|
|
79
|
-
const e = E(k, t),
|
|
80
|
-
k && !l ? S(n?.from ?
|
|
81
|
-
}, pe = n?.from ?
|
|
82
|
-
return /* @__PURE__ */ u("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "date-range-picker", "data-disabled":
|
|
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:
|
|
87
|
+
className: h(
|
|
88
88
|
"text-xs font-medium leading-[18px] text-content-tertiary",
|
|
89
|
-
|
|
89
|
+
p && "opacity-70",
|
|
90
90
|
N && "text-destructive"
|
|
91
91
|
),
|
|
92
92
|
children: [
|
|
93
93
|
B,
|
|
94
94
|
" ",
|
|
95
|
-
ne && /* @__PURE__ */
|
|
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:
|
|
102
|
+
className: h(
|
|
103
103
|
"w-full",
|
|
104
104
|
V && j === "absolute" && "relative"
|
|
105
105
|
),
|
|
106
106
|
children: [
|
|
107
|
-
/* @__PURE__ */ u(we, { open:
|
|
108
|
-
|
|
107
|
+
/* @__PURE__ */ u(we, { open: p ? !1 : a, onOpenChange: (e) => {
|
|
108
|
+
p || x(e);
|
|
109
109
|
}, children: [
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ c(De, { asChild: !0, children: /* @__PURE__ */ u(
|
|
111
111
|
"div",
|
|
112
112
|
{
|
|
113
|
-
"data-state":
|
|
114
|
-
className:
|
|
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
|
-
|
|
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__ */
|
|
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: (
|
|
132
|
+
onClick: () => !p && x(!0),
|
|
133
133
|
onKeyDown: (e) => {
|
|
134
|
-
if (e.key === "Enter" && !
|
|
134
|
+
if (e.key === "Enter" && !a) {
|
|
135
135
|
e.preventDefault();
|
|
136
|
-
const
|
|
137
|
-
|
|
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" && !
|
|
139
|
+
e.key === "ArrowDown" && !a && !p && (e.preventDefault(), C.current = !0, x(!0)), e.key === "Escape" && a && (e.preventDefault(), z());
|
|
140
140
|
},
|
|
141
|
-
placeholder:
|
|
142
|
-
disabled: !!
|
|
141
|
+
placeholder: a ? t : T,
|
|
142
|
+
disabled: !!p,
|
|
143
143
|
"aria-label": T,
|
|
144
144
|
"data-field": "start",
|
|
145
|
-
className:
|
|
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__ */
|
|
152
|
+
/* @__PURE__ */ c(
|
|
153
153
|
"input",
|
|
154
154
|
{
|
|
155
|
-
ref:
|
|
155
|
+
ref: se,
|
|
156
156
|
type: "text",
|
|
157
157
|
value: v,
|
|
158
158
|
onChange: de,
|
|
159
159
|
onBlur: J,
|
|
160
|
-
onClick: (
|
|
160
|
+
onClick: () => !p && x(!0),
|
|
161
161
|
onKeyDown: (e) => {
|
|
162
|
-
if (e.key === "Enter" && !
|
|
162
|
+
if (e.key === "Enter" && !a) {
|
|
163
163
|
e.preventDefault();
|
|
164
|
-
const
|
|
165
|
-
|
|
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" && !
|
|
167
|
+
e.key === "ArrowDown" && !a && !p && (e.preventDefault(), C.current = !0, x(!0)), e.key === "Escape" && a && (e.preventDefault(), z());
|
|
168
168
|
},
|
|
169
|
-
placeholder:
|
|
170
|
-
disabled: !!
|
|
169
|
+
placeholder: a ? t : q,
|
|
170
|
+
disabled: !!p,
|
|
171
171
|
"aria-label": q,
|
|
172
172
|
"data-field": "end",
|
|
173
|
-
className:
|
|
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 && !
|
|
182
|
-
/* @__PURE__ */
|
|
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":
|
|
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__ */
|
|
195
|
+
children: /* @__PURE__ */ c(ye, { className: "size-3 hover:text-content text-content-muted" })
|
|
196
196
|
}
|
|
197
197
|
) }),
|
|
198
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ c(Y, { variant: "tertiary", side: "top", children: P("calendar.clear") })
|
|
199
199
|
] }),
|
|
200
200
|
/* @__PURE__ */ u(W, { children: [
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
e.stopPropagation(),
|
|
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(),
|
|
205
|
-
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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:
|
|
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:
|
|
243
|
-
/* @__PURE__ */
|
|
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:
|
|
247
|
+
className: h(
|
|
248
248
|
"shrink-0",
|
|
249
249
|
N ? "text-destructive" : "text-content-muted"
|
|
250
250
|
)
|
|
251
251
|
}
|
|
252
252
|
),
|
|
253
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ c(
|
|
254
254
|
"p",
|
|
255
255
|
{
|
|
256
|
-
className:
|
|
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:
|
|
269
|
-
/* @__PURE__ */
|
|
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:
|
|
273
|
+
className: h(
|
|
274
274
|
"shrink-0",
|
|
275
275
|
N ? "text-destructive" : "text-content-muted"
|
|
276
276
|
)
|
|
277
277
|
}
|
|
278
278
|
),
|
|
279
|
-
/* @__PURE__ */
|
|
279
|
+
/* @__PURE__ */ c(
|
|
280
280
|
"p",
|
|
281
281
|
{
|
|
282
|
-
className:
|
|
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
|
-
|
|
293
|
+
Re.displayName = "DateRangePicker";
|
|
294
294
|
export {
|
|
295
|
-
|
|
295
|
+
Re as DateRangePicker
|
|
296
296
|
};
|