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
|
|
1
|
+
import { jsxs as M, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
3
|
import { Cross as L, CalendarMonth as Q } from "impact-nova-icons";
|
|
4
|
-
import { isValid as C, parse as
|
|
4
|
+
import { isValid as C, parse as x } 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";
|
|
@@ -14,78 +14,78 @@ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt =
|
|
|
14
14
|
onChange: s,
|
|
15
15
|
placeholder: V,
|
|
16
16
|
minDate: A,
|
|
17
|
-
maxDate:
|
|
18
|
-
startMonth:
|
|
17
|
+
maxDate: R,
|
|
18
|
+
startMonth: b,
|
|
19
19
|
endMonth: j,
|
|
20
20
|
showFooter: l = !0,
|
|
21
|
-
disabled:
|
|
21
|
+
disabled: m,
|
|
22
22
|
className: O,
|
|
23
23
|
...Y
|
|
24
24
|
}, z) => {
|
|
25
|
-
const { t:
|
|
26
|
-
o.useRef(null), o.useImperativeHandle(z, () =>
|
|
27
|
-
const [r,
|
|
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
28
|
o.useEffect(() => {
|
|
29
29
|
r || (i(t ? c(t) : ""), a(t));
|
|
30
30
|
}, [r, t]), o.useEffect(() => {
|
|
31
31
|
r && (a(t), g(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), i(t ? c(t) : ""));
|
|
32
32
|
}, [r, t]);
|
|
33
33
|
const $ = (e) => {
|
|
34
|
-
a(e), e && i(c(e)), l || (s?.(e),
|
|
34
|
+
a(e), e && i(c(e)), l || (s?.(e), p(!1));
|
|
35
35
|
}, H = (e) => {
|
|
36
|
-
s?.(e !== void 0 ? e : S),
|
|
36
|
+
s?.(e !== void 0 ? e : S), p(!1);
|
|
37
37
|
}, q = () => {
|
|
38
|
-
a(t), i(t ? c(t) : ""),
|
|
38
|
+
a(t), i(t ? c(t) : ""), p(!1);
|
|
39
39
|
}, k = () => {
|
|
40
|
-
a(void 0), i(""), s?.(void 0), l ||
|
|
40
|
+
a(void 0), i(""), s?.(void 0), l || p(!1);
|
|
41
41
|
}, G = (e) => {
|
|
42
|
-
const
|
|
43
|
-
if (i(
|
|
42
|
+
const f = e.target.value, h = X(f, "MM/yyyy", d);
|
|
43
|
+
if (i(h), h === "") {
|
|
44
44
|
a(void 0), l || s?.(void 0);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
if (C(
|
|
49
|
-
const D = { month:
|
|
50
|
-
a(D), g(
|
|
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);
|
|
51
51
|
}
|
|
52
52
|
}, J = () => {
|
|
53
53
|
if (r) return;
|
|
54
|
-
const e = W(
|
|
55
|
-
if (!C(
|
|
54
|
+
const e = W(d, "MM/yyyy"), f = x(e, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
55
|
+
if (!C(f) || e.length !== 7)
|
|
56
56
|
i(t ? c(t) : ""), a(t);
|
|
57
57
|
else if (i(e), !l) {
|
|
58
|
-
const
|
|
59
|
-
s?.(
|
|
58
|
+
const h = { month: f.getMonth(), year: f.getFullYear() };
|
|
59
|
+
s?.(h);
|
|
60
60
|
}
|
|
61
|
-
}, w = (t ? c(t) : "") !==
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
|
|
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);
|
|
64
64
|
}, children: [
|
|
65
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(
|
|
66
66
|
Z,
|
|
67
67
|
{
|
|
68
|
-
ref:
|
|
69
|
-
value:
|
|
68
|
+
ref: P,
|
|
69
|
+
value: d,
|
|
70
70
|
onChange: G,
|
|
71
71
|
onBlur: J,
|
|
72
|
-
onClick: (
|
|
73
|
-
placeholder: r ?
|
|
74
|
-
disabled:
|
|
72
|
+
onClick: () => !m && p(!0),
|
|
73
|
+
placeholder: r ? y("datePicker.monthYearFormat") : B,
|
|
74
|
+
disabled: m,
|
|
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__ */
|
|
82
|
-
t && !
|
|
81
|
+
suffix: /* @__PURE__ */ M("div", { className: "flex items-center gap-1", children: [
|
|
82
|
+
t && !m && /* @__PURE__ */ M(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":
|
|
88
|
+
"aria-label": y("calendar.clear"),
|
|
89
89
|
onClick: (e) => {
|
|
90
90
|
e.stopPropagation(), k();
|
|
91
91
|
},
|
|
@@ -93,11 +93,11 @@ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt =
|
|
|
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:
|
|
96
|
+
/* @__PURE__ */ n(T, { variant: "tertiary", side: "top", children: y("calendar.clear") })
|
|
97
97
|
] }),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ M(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:
|
|
100
|
+
/* @__PURE__ */ n(T, { variant: "tertiary", side: "top", children: y("datePicker.selectMonth") })
|
|
101
101
|
] })
|
|
102
102
|
] }),
|
|
103
103
|
...Y
|
|
@@ -118,8 +118,8 @@ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt =
|
|
|
118
118
|
onMonthSelect: $,
|
|
119
119
|
month: E,
|
|
120
120
|
onMonthChange: g,
|
|
121
|
-
disabled: { before: A, after:
|
|
122
|
-
startMonth:
|
|
121
|
+
disabled: { before: A, after: R },
|
|
122
|
+
startMonth: b,
|
|
123
123
|
endMonth: j,
|
|
124
124
|
showFooter: l,
|
|
125
125
|
onApply: H,
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsxs as h, jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as h, jsx as i } from "react/jsx-runtime";
|
|
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
|
|
5
|
-
import { cn as
|
|
4
|
+
import { isValid as Y, parse as y } from "date-fns";
|
|
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";
|
|
8
8
|
import { Tooltip as Q, TooltipTrigger as U, TooltipContent as W } from "../tooltip.js";
|
|
9
9
|
import { useImpactNovaI18n as wt } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
10
|
-
const
|
|
10
|
+
const p = (e, s = "MM/YYYY") => {
|
|
11
11
|
const A = (e.month + 1).toString().padStart(2, "0");
|
|
12
|
-
return
|
|
13
|
-
}, bt =
|
|
12
|
+
return s === "YYYY/MM" ? `${e.year}/${A}` : `${A}/${e.year}`;
|
|
13
|
+
}, bt = u.forwardRef(
|
|
14
14
|
({
|
|
15
15
|
value: e,
|
|
16
|
-
onChange:
|
|
16
|
+
onChange: s,
|
|
17
17
|
placeholder: A,
|
|
18
18
|
minDate: I,
|
|
19
19
|
maxDate: X,
|
|
20
20
|
startMonth: Z,
|
|
21
21
|
endMonth: _,
|
|
22
|
-
showFooter:
|
|
23
|
-
disabled:
|
|
22
|
+
showFooter: M = !0,
|
|
23
|
+
disabled: m,
|
|
24
24
|
className: F,
|
|
25
25
|
isError: S,
|
|
26
26
|
size: B,
|
|
@@ -33,175 +33,175 @@ const m = (e, i = "MM/YYYY") => {
|
|
|
33
33
|
displayFormat: a = "MM/YYYY",
|
|
34
34
|
...et
|
|
35
35
|
}, nt) => {
|
|
36
|
-
const { t:
|
|
37
|
-
A ??
|
|
38
|
-
const H =
|
|
36
|
+
const { t: w } = wt();
|
|
37
|
+
A ?? w("datePicker.selectMonthRange");
|
|
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
|
-
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
}, [
|
|
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());
|
|
44
|
+
u.useEffect(() => {
|
|
45
|
+
l || (N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), b(e));
|
|
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()));
|
|
48
|
+
}, [l, e, a, I]);
|
|
49
49
|
const at = (t) => {
|
|
50
|
-
b(t), t?.from && N(
|
|
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));
|
|
51
51
|
}, st = (t) => {
|
|
52
|
-
|
|
52
|
+
s?.(t !== void 0 ? t : P), g(!1);
|
|
53
53
|
}, K = () => {
|
|
54
|
-
b(e), N(e?.from ?
|
|
54
|
+
b(e), N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), g(!1);
|
|
55
55
|
}, $ = () => {
|
|
56
|
-
b(void 0), N(""),
|
|
57
|
-
},
|
|
56
|
+
b(void 0), N(""), v(""), s?.(void 0), M || g(!1);
|
|
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:
|
|
61
|
-
b(o),
|
|
60
|
+
const o = { from: void 0, to: P?.to };
|
|
61
|
+
b(o), M || s?.(o);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
const n =
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
b(
|
|
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 };
|
|
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 (
|
|
72
|
-
const o = { from:
|
|
73
|
-
b(o),
|
|
71
|
+
if (v(r), r === "") {
|
|
72
|
+
const o = { from: P?.from, to: void 0 };
|
|
73
|
+
b(o), M || s?.(o);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const n =
|
|
77
|
-
if (
|
|
78
|
-
const o = { month: n.getMonth(), year: n.getFullYear() },
|
|
79
|
-
b(
|
|
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 };
|
|
79
|
+
b(d), j(n), M || s?.(d);
|
|
80
80
|
}
|
|
81
81
|
}, T = () => {
|
|
82
|
-
if (
|
|
83
|
-
const t = R(k, c), f = R(D, c), r =
|
|
84
|
-
k && !o ? N(e?.from ?
|
|
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?.({
|
|
85
85
|
from: { month: r.getMonth(), year: r.getFullYear() },
|
|
86
86
|
to: { month: n.getMonth(), year: n.getFullYear() }
|
|
87
|
-
}) : o && !
|
|
87
|
+
}) : o && !M ? s?.({
|
|
88
88
|
from: { month: r.getMonth(), year: r.getFullYear() },
|
|
89
89
|
to: e?.to
|
|
90
|
-
}) :
|
|
90
|
+
}) : d && !M && s?.({
|
|
91
91
|
from: e?.from,
|
|
92
92
|
to: { month: n.getMonth(), year: n.getFullYear() }
|
|
93
93
|
});
|
|
94
|
-
},
|
|
95
|
-
return /* @__PURE__ */ h("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "month-range-picker", "data-disabled":
|
|
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");
|
|
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(
|
|
98
98
|
"label",
|
|
99
99
|
{
|
|
100
|
-
className:
|
|
100
|
+
className: x(
|
|
101
101
|
"text-xs font-medium leading-[18px] text-content-tertiary",
|
|
102
|
-
|
|
102
|
+
m && "opacity-70",
|
|
103
103
|
S && "text-destructive"
|
|
104
104
|
),
|
|
105
105
|
children: [
|
|
106
106
|
O,
|
|
107
107
|
" ",
|
|
108
|
-
tt && /* @__PURE__ */
|
|
108
|
+
tt && /* @__PURE__ */ i("span", { className: "text-destructive", children: "*" })
|
|
109
109
|
]
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
112
|
/* @__PURE__ */ h(
|
|
113
113
|
"div",
|
|
114
114
|
{
|
|
115
|
-
className:
|
|
115
|
+
className: x(
|
|
116
116
|
"w-full",
|
|
117
117
|
E && z === "absolute" && "relative"
|
|
118
118
|
),
|
|
119
119
|
children: [
|
|
120
|
-
/* @__PURE__ */ h(xt, { open:
|
|
121
|
-
|
|
120
|
+
/* @__PURE__ */ h(xt, { open: m ? !1 : l, onOpenChange: (t) => {
|
|
121
|
+
m || g(t);
|
|
122
122
|
}, children: [
|
|
123
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ i(Mt, { asChild: !0, children: /* @__PURE__ */ h(
|
|
124
124
|
"div",
|
|
125
125
|
{
|
|
126
|
-
"data-state":
|
|
127
|
-
className:
|
|
126
|
+
"data-state": l ? "open" : "closed",
|
|
127
|
+
className: x(
|
|
128
128
|
"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",
|
|
129
129
|
S ? "border-destructive hover:border-destructive" : "border-field",
|
|
130
130
|
B === "sm" ? "h-6" : B === "md" ? "h-[28px]" : "h-8",
|
|
131
|
-
|
|
131
|
+
m && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
|
|
132
132
|
"cursor-pointer",
|
|
133
133
|
F
|
|
134
134
|
),
|
|
135
135
|
children: [
|
|
136
136
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
137
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ i(
|
|
138
138
|
"input",
|
|
139
139
|
{
|
|
140
140
|
ref: H,
|
|
141
141
|
type: "text",
|
|
142
142
|
value: k,
|
|
143
|
-
onChange:
|
|
143
|
+
onChange: ct,
|
|
144
144
|
onBlur: T,
|
|
145
|
-
onClick: (
|
|
145
|
+
onClick: () => !m && g(!0),
|
|
146
146
|
onKeyDown: (t) => {
|
|
147
|
-
if (t.key === "Enter" && !
|
|
147
|
+
if (t.key === "Enter" && !l) {
|
|
148
148
|
t.preventDefault();
|
|
149
|
-
const f = R(k, c), r = R(D, c), n =
|
|
150
|
-
|
|
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;
|
|
150
|
+
d && C ? s?.({
|
|
151
151
|
from: { month: n.getMonth(), year: n.getFullYear() },
|
|
152
152
|
to: { month: o.getMonth(), year: o.getFullYear() }
|
|
153
|
-
}) :
|
|
153
|
+
}) : d ? s?.({
|
|
154
154
|
from: { month: n.getMonth(), year: n.getFullYear() },
|
|
155
155
|
to: e?.to
|
|
156
|
-
}) : C &&
|
|
156
|
+
}) : C && s?.({
|
|
157
157
|
from: e?.from,
|
|
158
158
|
to: { month: o.getMonth(), year: o.getFullYear() }
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
t.key === "ArrowDown" && !
|
|
161
|
+
t.key === "ArrowDown" && !l && !m && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && l && (t.preventDefault(), K());
|
|
162
162
|
},
|
|
163
|
-
placeholder:
|
|
164
|
-
disabled: !!
|
|
163
|
+
placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : w("datePicker.monthYearFormat") : q,
|
|
164
|
+
disabled: !!m,
|
|
165
165
|
"aria-label": q,
|
|
166
166
|
"data-field": "start",
|
|
167
|
-
className:
|
|
167
|
+
className: x(
|
|
168
168
|
"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",
|
|
169
169
|
pt ? "text-destructive" : ft ? "text-content-muted" : ""
|
|
170
170
|
),
|
|
171
171
|
...et
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ i(
|
|
175
175
|
"input",
|
|
176
176
|
{
|
|
177
177
|
ref: ot,
|
|
178
178
|
type: "text",
|
|
179
179
|
value: D,
|
|
180
|
-
onChange:
|
|
180
|
+
onChange: it,
|
|
181
181
|
onBlur: T,
|
|
182
|
-
onClick: (
|
|
182
|
+
onClick: () => !m && g(!0),
|
|
183
183
|
onKeyDown: (t) => {
|
|
184
|
-
if (t.key === "Enter" && !
|
|
184
|
+
if (t.key === "Enter" && !l) {
|
|
185
185
|
t.preventDefault();
|
|
186
|
-
const f = R(k, c), r = R(D, c), n =
|
|
187
|
-
|
|
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;
|
|
187
|
+
d && C ? s?.({
|
|
188
188
|
from: { month: n.getMonth(), year: n.getFullYear() },
|
|
189
189
|
to: { month: o.getMonth(), year: o.getFullYear() }
|
|
190
|
-
}) :
|
|
190
|
+
}) : d ? s?.({
|
|
191
191
|
from: { month: n.getMonth(), year: n.getFullYear() },
|
|
192
192
|
to: e?.to
|
|
193
|
-
}) : C &&
|
|
193
|
+
}) : C && s?.({
|
|
194
194
|
from: e?.from,
|
|
195
195
|
to: { month: o.getMonth(), year: o.getFullYear() }
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
t.key === "ArrowDown" && !
|
|
198
|
+
t.key === "ArrowDown" && !l && !m && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && l && (t.preventDefault(), K());
|
|
199
199
|
},
|
|
200
|
-
placeholder:
|
|
201
|
-
disabled: !!
|
|
200
|
+
placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : w("datePicker.monthYearFormat") : G,
|
|
201
|
+
disabled: !!m,
|
|
202
202
|
"aria-label": G,
|
|
203
203
|
"data-field": "end",
|
|
204
|
-
className:
|
|
204
|
+
className: x(
|
|
205
205
|
"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",
|
|
206
206
|
ut ? "text-destructive" : mt ? "text-content-muted" : ""
|
|
207
207
|
)
|
|
@@ -209,13 +209,13 @@ const m = (e, i = "MM/YYYY") => {
|
|
|
209
209
|
)
|
|
210
210
|
] }),
|
|
211
211
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
212
|
-
e?.from && !
|
|
213
|
-
/* @__PURE__ */
|
|
212
|
+
e?.from && !m && /* @__PURE__ */ h(Q, { children: [
|
|
213
|
+
/* @__PURE__ */ i(U, { asChild: !0, children: /* @__PURE__ */ i(
|
|
214
214
|
"button",
|
|
215
215
|
{
|
|
216
216
|
type: "button",
|
|
217
217
|
tabIndex: 0,
|
|
218
|
-
"aria-label":
|
|
218
|
+
"aria-label": w("calendar.clear"),
|
|
219
219
|
onClick: (t) => {
|
|
220
220
|
t.stopPropagation(), $();
|
|
221
221
|
},
|
|
@@ -223,24 +223,24 @@ const m = (e, i = "MM/YYYY") => {
|
|
|
223
223
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), $());
|
|
224
224
|
},
|
|
225
225
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
226
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ i(ht, { className: "size-3 hover:text-content text-content-muted" })
|
|
227
227
|
}
|
|
228
228
|
) }),
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ i(W, { variant: "tertiary", side: "top", children: w("calendar.clear") })
|
|
230
230
|
] }),
|
|
231
231
|
/* @__PURE__ */ h(Q, { children: [
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
t.stopPropagation(),
|
|
232
|
+
/* @__PURE__ */ i(U, { asChild: !0, children: /* @__PURE__ */ i("button", { type: "button", tabIndex: 0, "aria-label": w("datePicker.selectMonthRange"), onClick: (t) => {
|
|
233
|
+
t.stopPropagation(), m || g(!l);
|
|
234
234
|
}, onKeyDown: (t) => {
|
|
235
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(),
|
|
236
|
-
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */
|
|
237
|
-
/* @__PURE__ */
|
|
235
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), m || (V.current = !0, g(!l)));
|
|
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") })
|
|
238
238
|
] })
|
|
239
239
|
] })
|
|
240
240
|
]
|
|
241
241
|
}
|
|
242
242
|
) }),
|
|
243
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ i(
|
|
244
244
|
Yt,
|
|
245
245
|
{
|
|
246
246
|
className: "w-auto p-0",
|
|
@@ -248,19 +248,19 @@ const m = (e, i = "MM/YYYY") => {
|
|
|
248
248
|
onOpenAutoFocus: (t) => {
|
|
249
249
|
V.current || t.preventDefault(), V.current = !1;
|
|
250
250
|
},
|
|
251
|
-
children: /* @__PURE__ */
|
|
251
|
+
children: /* @__PURE__ */ i(
|
|
252
252
|
yt,
|
|
253
253
|
{
|
|
254
254
|
pickerType: "month",
|
|
255
255
|
monthMode: "range",
|
|
256
|
-
selectedMonths:
|
|
256
|
+
selectedMonths: P,
|
|
257
257
|
onMonthSelect: at,
|
|
258
258
|
month: rt,
|
|
259
259
|
onMonthChange: j,
|
|
260
260
|
disabled: { before: I, after: X },
|
|
261
261
|
startMonth: Z,
|
|
262
262
|
endMonth: _,
|
|
263
|
-
showFooter:
|
|
263
|
+
showFooter: M,
|
|
264
264
|
onApply: st,
|
|
265
265
|
onCancel: K,
|
|
266
266
|
onClear: $
|
|
@@ -269,21 +269,21 @@ const m = (e, i = "MM/YYYY") => {
|
|
|
269
269
|
}
|
|
270
270
|
)
|
|
271
271
|
] }),
|
|
272
|
-
E && z === "absolute" && /* @__PURE__ */ h("div", { className:
|
|
273
|
-
/* @__PURE__ */
|
|
272
|
+
E && z === "absolute" && /* @__PURE__ */ h("div", { className: x("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", S && "text-destructive"), children: [
|
|
273
|
+
/* @__PURE__ */ i(
|
|
274
274
|
J,
|
|
275
275
|
{
|
|
276
276
|
size: "xs",
|
|
277
|
-
className:
|
|
277
|
+
className: x(
|
|
278
278
|
"shrink-0",
|
|
279
279
|
S ? "text-destructive" : "text-content-muted"
|
|
280
280
|
)
|
|
281
281
|
}
|
|
282
282
|
),
|
|
283
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ i(
|
|
284
284
|
"p",
|
|
285
285
|
{
|
|
286
|
-
className:
|
|
286
|
+
className: x(
|
|
287
287
|
"min-w-0 text-[12px] font-medium leading-[18px] text-navigation-muted",
|
|
288
288
|
S && "text-destructive"
|
|
289
289
|
),
|
|
@@ -295,21 +295,21 @@ const m = (e, i = "MM/YYYY") => {
|
|
|
295
295
|
}
|
|
296
296
|
)
|
|
297
297
|
] }),
|
|
298
|
-
E && z === "flow" && /* @__PURE__ */ h("div", { className:
|
|
299
|
-
/* @__PURE__ */
|
|
298
|
+
E && z === "flow" && /* @__PURE__ */ h("div", { className: x("flex items-center gap-[6px]", S && "text-destructive"), children: [
|
|
299
|
+
/* @__PURE__ */ i(
|
|
300
300
|
J,
|
|
301
301
|
{
|
|
302
302
|
size: "xs",
|
|
303
|
-
className:
|
|
303
|
+
className: x(
|
|
304
304
|
"shrink-0",
|
|
305
305
|
S ? "text-destructive" : "text-content-muted"
|
|
306
306
|
)
|
|
307
307
|
}
|
|
308
308
|
),
|
|
309
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ i(
|
|
310
310
|
"p",
|
|
311
311
|
{
|
|
312
|
-
className:
|
|
312
|
+
className: x(
|
|
313
313
|
"text-[12px] font-medium leading-[18px] text-navigation-muted",
|
|
314
314
|
S && "text-destructive"
|
|
315
315
|
),
|