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.
- package/dist/components/ui/date-picker/date-picker.js +33 -32
- package/dist/components/ui/date-picker/date-range-picker.js +1 -0
- package/dist/components/ui/date-picker/month-picker.js +48 -47
- package/dist/components/ui/date-picker/month-range-picker.js +32 -31
- package/dist/components/ui/date-picker/multi-date-picker.js +20 -19
- package/dist/components/ui/date-picker/multi-month-picker.js +80 -61
- package/dist/components/ui/date-picker/multi-week-picker.js +100 -81
- package/dist/components/ui/date-picker/week-picker.js +26 -25
- package/dist/components/ui/date-picker/week-range-picker.js +24 -23
- package/package.json +1 -1
|
@@ -1,100 +1,119 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { Cross as j, CalendarMonth as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { Calendar as
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { useImpactNovaI18n as
|
|
10
|
-
const
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import { Cross as j, CalendarMonth as w } from "impact-nova-icons";
|
|
4
|
+
import { cn as D } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as R } from "../input.js";
|
|
6
|
+
import { Popover as z, PopoverAnchor as E, PopoverContent as K } from "../popover.js";
|
|
7
|
+
import { Calendar as V } from "../calendar.js";
|
|
8
|
+
import { Tooltip as y, TooltipTrigger as g, TooltipContent as M } from "../tooltip.js";
|
|
9
|
+
import { useImpactNovaI18n as $ } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
10
|
+
const L = l.forwardRef(
|
|
11
11
|
({
|
|
12
|
-
value:
|
|
13
|
-
onChange:
|
|
14
|
-
placeholder:
|
|
15
|
-
minDate:
|
|
16
|
-
maxDate:
|
|
17
|
-
startMonth:
|
|
12
|
+
value: n,
|
|
13
|
+
onChange: p,
|
|
14
|
+
placeholder: C,
|
|
15
|
+
minDate: f,
|
|
16
|
+
maxDate: P,
|
|
17
|
+
startMonth: k,
|
|
18
18
|
endMonth: x,
|
|
19
|
-
showFooter:
|
|
20
|
-
disabled:
|
|
21
|
-
className:
|
|
19
|
+
showFooter: d = !0,
|
|
20
|
+
disabled: r,
|
|
21
|
+
className: b,
|
|
22
22
|
...N
|
|
23
23
|
}, T) => {
|
|
24
|
-
const { t: o } =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
const O = (
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
24
|
+
const { t: o } = $(), A = C ?? o("datePicker.selectMultipleMonths"), [i, a] = l.useState(!1), h = l.useRef(!1), [m, c] = l.useState(n);
|
|
25
|
+
l.useEffect(() => {
|
|
26
|
+
c(n);
|
|
27
|
+
}, [i, n]);
|
|
28
|
+
const O = (e) => {
|
|
29
|
+
c(e), d || p?.(e);
|
|
30
|
+
}, v = (e) => {
|
|
31
|
+
p?.(e !== void 0 ? e : m), a(!1);
|
|
32
|
+
}, I = () => {
|
|
33
|
+
c(n), a(!1);
|
|
34
|
+
}, u = () => {
|
|
35
|
+
c(void 0), p?.(void 0), d || a(!1);
|
|
36
|
+
}, S = n && n.length > 0 ? n.length === 1 ? `${n[0].month + 1}/${n[0].year}` : o("datePicker.monthsSelected", { count: n.length }) : "";
|
|
37
|
+
return /* @__PURE__ */ s(z, { open: r ? !1 : i, onOpenChange: (e) => {
|
|
38
|
+
r || a(e);
|
|
39
39
|
}, children: [
|
|
40
|
-
/* @__PURE__ */ t(
|
|
41
|
-
|
|
40
|
+
/* @__PURE__ */ t(E, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
41
|
+
R,
|
|
42
42
|
{
|
|
43
43
|
ref: T,
|
|
44
|
-
value:
|
|
44
|
+
value: S,
|
|
45
45
|
placeholder: A,
|
|
46
46
|
readOnly: !0,
|
|
47
|
-
disabled:
|
|
47
|
+
disabled: r,
|
|
48
48
|
onClick: () => {
|
|
49
|
-
!
|
|
49
|
+
!r && !i && a(!0);
|
|
50
50
|
},
|
|
51
|
-
className:
|
|
52
|
-
suffix: /* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
/* @__PURE__ */ t(
|
|
51
|
+
className: D("cursor-pointer", b),
|
|
52
|
+
suffix: /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
53
|
+
n && n.length > 0 && !r && /* @__PURE__ */ s(y, { children: [
|
|
54
|
+
/* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(
|
|
55
55
|
"button",
|
|
56
56
|
{
|
|
57
57
|
type: "button",
|
|
58
58
|
tabIndex: 0,
|
|
59
59
|
"aria-label": o("calendar.clear"),
|
|
60
|
-
onClick: (
|
|
61
|
-
|
|
60
|
+
onClick: (e) => {
|
|
61
|
+
e.stopPropagation(), u();
|
|
62
62
|
},
|
|
63
63
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
64
64
|
children: /* @__PURE__ */ t(j, { className: "size-3 hover:text-content" })
|
|
65
65
|
}
|
|
66
66
|
) }),
|
|
67
|
-
/* @__PURE__ */ t(
|
|
67
|
+
/* @__PURE__ */ t(M, { variant: "tertiary", side: "top", children: o("calendar.clear") })
|
|
68
68
|
] }),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */ t(
|
|
71
|
-
|
|
69
|
+
/* @__PURE__ */ s(y, { children: [
|
|
70
|
+
/* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(
|
|
71
|
+
"button",
|
|
72
|
+
{
|
|
73
|
+
type: "button",
|
|
74
|
+
tabIndex: 0,
|
|
75
|
+
"data-component": "calendar-trigger",
|
|
76
|
+
"aria-label": o("datePicker.selectMultipleMonths"),
|
|
77
|
+
onPointerDown: (e) => {
|
|
78
|
+
e.preventDefault(), e.stopPropagation(), r || a(!i);
|
|
79
|
+
},
|
|
80
|
+
onKeyDown: (e) => {
|
|
81
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), r || (h.current = !0, a(!i)));
|
|
82
|
+
},
|
|
83
|
+
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
84
|
+
children: /* @__PURE__ */ t(w, { className: "h-4 w-4 text-secondary-foreground" })
|
|
85
|
+
}
|
|
86
|
+
) }),
|
|
87
|
+
/* @__PURE__ */ t(M, { variant: "tertiary", side: "top", children: o("datePicker.selectMultipleMonths") })
|
|
72
88
|
] })
|
|
73
89
|
] }),
|
|
74
90
|
...N
|
|
75
91
|
}
|
|
76
92
|
) }) }),
|
|
77
93
|
/* @__PURE__ */ t(
|
|
78
|
-
|
|
94
|
+
K,
|
|
79
95
|
{
|
|
80
96
|
className: "w-auto p-0",
|
|
81
97
|
align: "start",
|
|
82
|
-
|
|
98
|
+
"aria-label": o("datePicker.selectMultipleMonths"),
|
|
99
|
+
onOpenAutoFocus: (e) => {
|
|
100
|
+
h.current || e.preventDefault(), h.current = !1;
|
|
101
|
+
},
|
|
83
102
|
children: /* @__PURE__ */ t(
|
|
84
|
-
|
|
103
|
+
V,
|
|
85
104
|
{
|
|
86
105
|
pickerType: "month",
|
|
87
106
|
monthMode: "multiple",
|
|
88
107
|
selectedMonths: m,
|
|
89
108
|
onMonthSelect: O,
|
|
90
|
-
disabled: { before:
|
|
91
|
-
startMonth:
|
|
109
|
+
disabled: { before: f, after: P },
|
|
110
|
+
startMonth: k,
|
|
92
111
|
endMonth: x,
|
|
93
|
-
defaultMonth:
|
|
94
|
-
showFooter:
|
|
95
|
-
onApply:
|
|
96
|
-
onCancel:
|
|
97
|
-
onClear:
|
|
112
|
+
defaultMonth: f,
|
|
113
|
+
showFooter: d,
|
|
114
|
+
onApply: v,
|
|
115
|
+
onCancel: I,
|
|
116
|
+
onClear: u,
|
|
98
117
|
captionLayout: "dropdown"
|
|
99
118
|
}
|
|
100
119
|
)
|
|
@@ -103,7 +122,7 @@ const q = c.forwardRef(
|
|
|
103
122
|
] });
|
|
104
123
|
}
|
|
105
124
|
);
|
|
106
|
-
|
|
125
|
+
L.displayName = "MultiMonthPicker";
|
|
107
126
|
export {
|
|
108
|
-
|
|
127
|
+
L as MultiMonthPicker
|
|
109
128
|
};
|
|
@@ -1,117 +1,136 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
3
|
import { Cross as V, CalendarMonth as q } from "impact-nova-icons";
|
|
4
|
-
import { format as
|
|
4
|
+
import { format as C } from "date-fns";
|
|
5
5
|
import { cn as B } from "../../../lib/utils.js";
|
|
6
6
|
import { Input as F } from "../input.js";
|
|
7
7
|
import { Popover as G, PopoverAnchor as H, PopoverContent as J } from "../popover.js";
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
import { getDateFnsLocale as
|
|
11
|
-
import { useImpactNovaI18n as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
return `${
|
|
15
|
-
},
|
|
8
|
+
import { Calendar as Q } from "../calendar.js";
|
|
9
|
+
import { Tooltip as P, TooltipTrigger as b, TooltipContent as x } from "../tooltip.js";
|
|
10
|
+
import { getDateFnsLocale as U } from "../../../i18n/getDateFnsLocale.js";
|
|
11
|
+
import { useImpactNovaI18n as X } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
12
|
+
const Y = (t, a = "MM/dd/yyyy", s) => {
|
|
13
|
+
const f = C(t.startDate, a, s ? { locale: s } : {}), m = C(t.endDate, a, s ? { locale: s } : {});
|
|
14
|
+
return `${f} - ${m}`;
|
|
15
|
+
}, Z = c.forwardRef(
|
|
16
16
|
({
|
|
17
|
-
value:
|
|
18
|
-
onChange:
|
|
19
|
-
format:
|
|
20
|
-
placeholder:
|
|
17
|
+
value: t,
|
|
18
|
+
onChange: a,
|
|
19
|
+
format: s = "MM/dd/yyyy",
|
|
20
|
+
placeholder: f,
|
|
21
21
|
minDate: m,
|
|
22
|
-
maxDate:
|
|
23
|
-
startMonth:
|
|
24
|
-
endMonth:
|
|
25
|
-
showFooter:
|
|
26
|
-
calendarType:
|
|
27
|
-
fiscalMode:
|
|
28
|
-
selectionMode:
|
|
29
|
-
fiscalMonthPattern:
|
|
30
|
-
fiscalYearStartMonth:
|
|
31
|
-
weekStartsOn:
|
|
32
|
-
disabled:
|
|
33
|
-
className:
|
|
34
|
-
...
|
|
35
|
-
},
|
|
36
|
-
const { locale:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
const $ = (
|
|
41
|
-
|
|
42
|
-
}, z = (
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
22
|
+
maxDate: W,
|
|
23
|
+
startMonth: M,
|
|
24
|
+
endMonth: N,
|
|
25
|
+
showFooter: u = !0,
|
|
26
|
+
calendarType: w = "calendar",
|
|
27
|
+
fiscalMode: D = "basic",
|
|
28
|
+
selectionMode: T = "week",
|
|
29
|
+
fiscalMonthPattern: v,
|
|
30
|
+
fiscalYearStartMonth: A = 1,
|
|
31
|
+
weekStartsOn: O = 1,
|
|
32
|
+
disabled: n,
|
|
33
|
+
className: S,
|
|
34
|
+
...I
|
|
35
|
+
}, j) => {
|
|
36
|
+
const { locale: y, t: i } = X(), L = c.useMemo(() => U(y), [y]), R = f ?? i("datePicker.selectWeeks"), [l, o] = c.useState(!1), h = c.useRef(!1), [k, p] = c.useState(t);
|
|
37
|
+
c.useEffect(() => {
|
|
38
|
+
p(t);
|
|
39
|
+
}, [l, t]);
|
|
40
|
+
const $ = (e) => {
|
|
41
|
+
p(e), u || a?.(e);
|
|
42
|
+
}, z = (e) => {
|
|
43
|
+
a?.(e !== void 0 ? e : k), o(!1);
|
|
44
|
+
}, E = () => {
|
|
45
|
+
p(t), o(!1);
|
|
46
|
+
}, g = () => {
|
|
47
|
+
p(void 0), a?.(void 0), u || o(!1);
|
|
48
|
+
}, K = t && t.length > 0 ? t.length === 1 ? Y(t[0], s, L) : `${t.length} weeks selected` : "";
|
|
49
|
+
return /* @__PURE__ */ d(G, { open: n ? !1 : l, onOpenChange: (e) => {
|
|
50
|
+
n || o(e);
|
|
51
51
|
}, children: [
|
|
52
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ r(H, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
53
53
|
F,
|
|
54
54
|
{
|
|
55
|
-
ref:
|
|
56
|
-
value:
|
|
57
|
-
placeholder:
|
|
55
|
+
ref: j,
|
|
56
|
+
value: K,
|
|
57
|
+
placeholder: R,
|
|
58
58
|
readOnly: !0,
|
|
59
|
-
disabled:
|
|
59
|
+
disabled: n,
|
|
60
60
|
onClick: () => {
|
|
61
|
-
!
|
|
61
|
+
!n && !l && o(!0);
|
|
62
62
|
},
|
|
63
|
-
className: B("cursor-pointer",
|
|
64
|
-
suffix: /* @__PURE__ */
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
63
|
+
className: B("cursor-pointer", S),
|
|
64
|
+
suffix: /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
|
|
65
|
+
t && t.length > 0 && !n && /* @__PURE__ */ d(P, { children: [
|
|
66
|
+
/* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(
|
|
67
67
|
"button",
|
|
68
68
|
{
|
|
69
69
|
type: "button",
|
|
70
70
|
tabIndex: 0,
|
|
71
71
|
"aria-label": i("calendar.clear"),
|
|
72
|
-
onClick: (
|
|
73
|
-
|
|
72
|
+
onClick: (e) => {
|
|
73
|
+
e.stopPropagation(), g();
|
|
74
74
|
},
|
|
75
75
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
76
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ r(V, { className: "size-3 hover:text-content" })
|
|
77
77
|
}
|
|
78
78
|
) }),
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ r(x, { variant: "tertiary", side: "top", children: i("calendar.clear") })
|
|
80
80
|
] }),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
81
|
+
/* @__PURE__ */ d(P, { children: [
|
|
82
|
+
/* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
tabIndex: 0,
|
|
87
|
+
"data-component": "calendar-trigger",
|
|
88
|
+
"aria-label": i("datePicker.selectWeeks"),
|
|
89
|
+
onPointerDown: (e) => {
|
|
90
|
+
e.preventDefault(), e.stopPropagation(), n || o(!l);
|
|
91
|
+
},
|
|
92
|
+
onKeyDown: (e) => {
|
|
93
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), n || (h.current = !0, o(!l)));
|
|
94
|
+
},
|
|
95
|
+
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
96
|
+
children: /* @__PURE__ */ r(q, { className: "h-4 w-4 text-secondary-foreground" })
|
|
97
|
+
}
|
|
98
|
+
) }),
|
|
99
|
+
/* @__PURE__ */ r(x, { variant: "tertiary", side: "top", children: i("datePicker.selectWeeks") })
|
|
84
100
|
] })
|
|
85
101
|
] }),
|
|
86
|
-
...
|
|
102
|
+
...I
|
|
87
103
|
}
|
|
88
104
|
) }) }),
|
|
89
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ r(
|
|
90
106
|
J,
|
|
91
107
|
{
|
|
92
108
|
className: "w-auto p-0",
|
|
93
109
|
align: "start",
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
110
|
+
"aria-label": i("datePicker.selectWeeks"),
|
|
111
|
+
onOpenAutoFocus: (e) => {
|
|
112
|
+
h.current || e.preventDefault(), h.current = !1;
|
|
113
|
+
},
|
|
114
|
+
children: /* @__PURE__ */ r(
|
|
115
|
+
Q,
|
|
97
116
|
{
|
|
98
117
|
pickerType: "week",
|
|
99
118
|
weekMode: "multiple",
|
|
100
|
-
selectedWeeks:
|
|
119
|
+
selectedWeeks: k,
|
|
101
120
|
onWeekSelect: $,
|
|
102
|
-
disabled: { before: m, after:
|
|
103
|
-
startMonth:
|
|
104
|
-
endMonth:
|
|
105
|
-
showFooter:
|
|
106
|
-
calendarType:
|
|
107
|
-
fiscalMode:
|
|
108
|
-
selectionMode:
|
|
109
|
-
fiscalMonthPattern:
|
|
110
|
-
fiscalYearStartMonth:
|
|
111
|
-
weekStartsOn:
|
|
121
|
+
disabled: { before: m, after: W },
|
|
122
|
+
startMonth: M,
|
|
123
|
+
endMonth: N,
|
|
124
|
+
showFooter: u,
|
|
125
|
+
calendarType: w,
|
|
126
|
+
fiscalMode: D,
|
|
127
|
+
selectionMode: T,
|
|
128
|
+
fiscalMonthPattern: v,
|
|
129
|
+
fiscalYearStartMonth: A,
|
|
130
|
+
weekStartsOn: O,
|
|
112
131
|
onApply: z,
|
|
113
|
-
onCancel:
|
|
114
|
-
onClear:
|
|
132
|
+
onCancel: E,
|
|
133
|
+
onClear: g,
|
|
115
134
|
captionLayout: "dropdown"
|
|
116
135
|
}
|
|
117
136
|
)
|
|
@@ -120,7 +139,7 @@ const X = (e, n = "MM/dd/yyyy", o) => {
|
|
|
120
139
|
] });
|
|
121
140
|
}
|
|
122
141
|
);
|
|
123
|
-
|
|
142
|
+
Z.displayName = "MultiWeekPicker";
|
|
124
143
|
export {
|
|
125
|
-
|
|
144
|
+
Z as MultiWeekPicker
|
|
126
145
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as y, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import { Cross as te, CalendarMonth as re } from "impact-nova-icons";
|
|
4
|
-
import { isValid as w, parse as
|
|
4
|
+
import { isValid as w, parse as P, format as B } from "date-fns";
|
|
5
5
|
import { cn as oe, padValidDateString as se, maskDate as ce } from "../../../lib/utils.js";
|
|
6
6
|
import { Input as ie } from "../input.js";
|
|
7
7
|
import { Popover as le, PopoverAnchor as ae, PopoverContent as pe } from "../popover.js";
|
|
@@ -24,17 +24,17 @@ const p = (e, c = "MM/dd/yyyy", n) => {
|
|
|
24
24
|
startMonth: q,
|
|
25
25
|
endMonth: G,
|
|
26
26
|
showFooter: d = !0,
|
|
27
|
-
calendarType:
|
|
27
|
+
calendarType: I = "calendar",
|
|
28
28
|
fiscalMode: S = "basic",
|
|
29
29
|
selectionMode: N = "week",
|
|
30
|
-
fiscalMonthPattern:
|
|
31
|
-
fiscalYearStartMonth:
|
|
30
|
+
fiscalMonthPattern: b,
|
|
31
|
+
fiscalYearStartMonth: V = 1,
|
|
32
32
|
weekStartsOn: A = 1,
|
|
33
|
-
disabled:
|
|
33
|
+
disabled: g,
|
|
34
34
|
className: J,
|
|
35
35
|
...K
|
|
36
36
|
}, Q) => {
|
|
37
|
-
const { locale: M, t:
|
|
37
|
+
const { locale: M, t: m } = he(), r = s.useMemo(() => ue(M), [M]), U = C ?? m("datePicker.selectWeek"), T = s.useRef(null);
|
|
38
38
|
s.useRef(null), s.useImperativeHandle(Q, () => T.current);
|
|
39
39
|
const [i, f] = s.useState(!1), [L, l] = s.useState(e), [u, a] = s.useState(e ? p(e, n, r) : ""), [X, W] = s.useState(e?.startDate || /* @__PURE__ */ new Date());
|
|
40
40
|
s.useEffect(() => {
|
|
@@ -51,34 +51,34 @@ const p = (e, c = "MM/dd/yyyy", n) => {
|
|
|
51
51
|
}, R = () => {
|
|
52
52
|
l(void 0), a(""), c?.(void 0), d || f(!1);
|
|
53
53
|
}, j = (t) => fe(t, {
|
|
54
|
-
calendarType:
|
|
54
|
+
calendarType: I,
|
|
55
55
|
fiscalMode: S,
|
|
56
56
|
selectionMode: N,
|
|
57
|
-
fiscalMonthPattern:
|
|
58
|
-
fiscalYearStartMonth:
|
|
57
|
+
fiscalMonthPattern: b,
|
|
58
|
+
fiscalYearStartMonth: V,
|
|
59
59
|
weekStartsOn: A
|
|
60
60
|
}), F = (t) => {
|
|
61
|
-
const
|
|
61
|
+
const k = t.target.value, h = ce(k, n, u);
|
|
62
62
|
if (a(h), h === "") {
|
|
63
63
|
l(void 0), d || c?.(void 0);
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
const x =
|
|
66
|
+
const x = P(h, n, /* @__PURE__ */ new Date(), { locale: r });
|
|
67
67
|
if (w(x) && h.length === n.length) {
|
|
68
68
|
const z = j(x);
|
|
69
69
|
l(z), W(x), d || c?.(z);
|
|
70
70
|
}
|
|
71
71
|
}, ee = () => {
|
|
72
72
|
if (i) return;
|
|
73
|
-
const t = se(u, n),
|
|
74
|
-
if (!w(
|
|
73
|
+
const t = se(u, n), k = P(t, n, /* @__PURE__ */ new Date(), { locale: r });
|
|
74
|
+
if (!w(k) || t.length !== n.length)
|
|
75
75
|
a(e ? p(e, n, r) : ""), l(e);
|
|
76
76
|
else if (a(t), !d) {
|
|
77
|
-
const h = j(
|
|
77
|
+
const h = j(k);
|
|
78
78
|
c?.(h);
|
|
79
79
|
}
|
|
80
|
-
}, v = (e ? p(e, n, r) : "") !== u, ne = u.length === n.length && !w(
|
|
81
|
-
return /* @__PURE__ */ y(le, { open: i, onOpenChange: (t) => !
|
|
80
|
+
}, v = (e ? p(e, n, r) : "") !== u, ne = u.length === n.length && !w(P(u, n, /* @__PURE__ */ new Date(), { locale: r }));
|
|
81
|
+
return /* @__PURE__ */ y(le, { open: i, onOpenChange: (t) => !g && f(t), children: [
|
|
82
82
|
/* @__PURE__ */ o(ae, { asChild: !0, children: /* @__PURE__ */ o("div", { "data-component": "week-picker", "data-state": i ? "open" : "closed", "data-pending": v || void 0, children: /* @__PURE__ */ o(
|
|
83
83
|
ie,
|
|
84
84
|
{
|
|
@@ -86,9 +86,9 @@ const p = (e, c = "MM/dd/yyyy", n) => {
|
|
|
86
86
|
value: u,
|
|
87
87
|
onChange: F,
|
|
88
88
|
onBlur: ee,
|
|
89
|
-
onClick: () => !
|
|
89
|
+
onClick: () => !g && f(!0),
|
|
90
90
|
placeholder: i ? n : U,
|
|
91
|
-
disabled:
|
|
91
|
+
disabled: g,
|
|
92
92
|
"data-form-control": "input",
|
|
93
93
|
className: oe(
|
|
94
94
|
"cursor-pointer",
|
|
@@ -96,13 +96,13 @@ const p = (e, c = "MM/dd/yyyy", n) => {
|
|
|
96
96
|
J
|
|
97
97
|
),
|
|
98
98
|
suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
|
|
99
|
-
e && !
|
|
99
|
+
e && !g && /* @__PURE__ */ y(E, { children: [
|
|
100
100
|
/* @__PURE__ */ o(O, { asChild: !0, children: /* @__PURE__ */ o(
|
|
101
101
|
"button",
|
|
102
102
|
{
|
|
103
103
|
type: "button",
|
|
104
104
|
tabIndex: 0,
|
|
105
|
-
"aria-label":
|
|
105
|
+
"aria-label": m("calendar.clear"),
|
|
106
106
|
onClick: (t) => {
|
|
107
107
|
t.stopPropagation(), R();
|
|
108
108
|
},
|
|
@@ -110,11 +110,11 @@ const p = (e, c = "MM/dd/yyyy", n) => {
|
|
|
110
110
|
children: /* @__PURE__ */ o(te, { className: "size-3 hover:text-content" })
|
|
111
111
|
}
|
|
112
112
|
) }),
|
|
113
|
-
/* @__PURE__ */ o($, { variant: "tertiary", side: "top", children:
|
|
113
|
+
/* @__PURE__ */ o($, { variant: "tertiary", side: "top", children: m("calendar.clear") })
|
|
114
114
|
] }),
|
|
115
115
|
/* @__PURE__ */ y(E, { children: [
|
|
116
116
|
/* @__PURE__ */ o(O, { asChild: !0, children: /* @__PURE__ */ o(re, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
117
|
-
/* @__PURE__ */ o($, { variant: "tertiary", side: "top", children:
|
|
117
|
+
/* @__PURE__ */ o($, { variant: "tertiary", side: "top", children: m("datePicker.selectWeek") })
|
|
118
118
|
] })
|
|
119
119
|
] }),
|
|
120
120
|
...K
|
|
@@ -125,6 +125,7 @@ const p = (e, c = "MM/dd/yyyy", n) => {
|
|
|
125
125
|
{
|
|
126
126
|
className: "w-auto p-0",
|
|
127
127
|
align: "start",
|
|
128
|
+
"aria-label": m("datePicker.selectWeek"),
|
|
128
129
|
onOpenAutoFocus: (t) => t.preventDefault(),
|
|
129
130
|
children: /* @__PURE__ */ o(
|
|
130
131
|
de,
|
|
@@ -139,11 +140,11 @@ const p = (e, c = "MM/dd/yyyy", n) => {
|
|
|
139
140
|
startMonth: q,
|
|
140
141
|
endMonth: G,
|
|
141
142
|
showFooter: d,
|
|
142
|
-
calendarType:
|
|
143
|
+
calendarType: I,
|
|
143
144
|
fiscalMode: S,
|
|
144
145
|
selectionMode: N,
|
|
145
|
-
fiscalMonthPattern:
|
|
146
|
-
fiscalYearStartMonth:
|
|
146
|
+
fiscalMonthPattern: b,
|
|
147
|
+
fiscalYearStartMonth: V,
|
|
147
148
|
weekStartsOn: A,
|
|
148
149
|
onApply: _,
|
|
149
150
|
onCancel: Y,
|