impact-nova 1.6.0 → 1.6.2
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/calendar.js +354 -350
- package/dist/components/ui/command-palette/command-palette.js +53 -50
- package/dist/components/ui/command-palette/shortcut-settings.js +130 -123
- package/dist/components/ui/date-picker/multi-week-picker.js +30 -30
- package/dist/components/ui/date-picker/week-picker.js +45 -45
- package/package.json +1 -1
|
@@ -1,192 +1,191 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as Y, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
3
|
import { ChevronLeftIcon as we, ChevronRightIcon as ye } from "lucide-react";
|
|
4
|
-
import { getDefaultClassNames as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Button as
|
|
7
|
-
import "./button-variants.js";
|
|
4
|
+
import { getDefaultClassNames as He, DayPicker as Be } from "react-day-picker";
|
|
5
|
+
import { cn as f } from "../../lib/utils.js";
|
|
6
|
+
import { Button as R } from "./button.js";
|
|
8
7
|
import ce from "./select/select.js";
|
|
9
|
-
import { FISCAL_PATTERNS as
|
|
10
|
-
import { getIntlLocale as
|
|
11
|
-
import { useImpactNovaI18n as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
8
|
+
import { FISCAL_PATTERNS as Fe, resolveWeekSelection as Te } from "../../lib/fiscal-calendar.js";
|
|
9
|
+
import { getIntlLocale as Ke, getDateFnsLocale as We } from "../../i18n/getDateFnsLocale.js";
|
|
10
|
+
import { useImpactNovaI18n as qe } from "../../i18n/ImpactNovaI18nContext.js";
|
|
11
|
+
const ue = d.createContext(0);
|
|
12
|
+
function at({
|
|
14
13
|
className: ae,
|
|
15
|
-
classNames:
|
|
16
|
-
showOutsideDays:
|
|
17
|
-
captionLayout:
|
|
18
|
-
buttonVariant:
|
|
14
|
+
classNames: G,
|
|
15
|
+
showOutsideDays: y = !1,
|
|
16
|
+
captionLayout: J = "dropdown",
|
|
17
|
+
buttonVariant: B = "ghost",
|
|
19
18
|
formatters: Q,
|
|
20
19
|
components: Ne,
|
|
21
20
|
showFooter: x = !0,
|
|
22
21
|
onApply: X,
|
|
23
|
-
onCancel:
|
|
24
|
-
onClear:
|
|
25
|
-
mode:
|
|
26
|
-
selected:
|
|
27
|
-
onSelect:
|
|
22
|
+
onCancel: fe,
|
|
23
|
+
onClear: de,
|
|
24
|
+
mode: F = "single",
|
|
25
|
+
selected: D,
|
|
26
|
+
onSelect: U,
|
|
28
27
|
// Week picker props
|
|
29
|
-
pickerType:
|
|
30
|
-
weekMode:
|
|
31
|
-
selectedWeeks:
|
|
32
|
-
onWeekSelect:
|
|
33
|
-
calendarType:
|
|
28
|
+
pickerType: m = "date",
|
|
29
|
+
weekMode: v = "single",
|
|
30
|
+
selectedWeeks: C,
|
|
31
|
+
onWeekSelect: A,
|
|
32
|
+
calendarType: L = "calendar",
|
|
34
33
|
fiscalMode: Z = "basic",
|
|
35
34
|
selectionMode: se = "week",
|
|
36
|
-
fiscalMonthPattern:
|
|
35
|
+
fiscalMonthPattern: le,
|
|
37
36
|
fiscalYearStartMonth: me = 1,
|
|
38
37
|
weekStartsOn: T = 1,
|
|
39
38
|
// Default Monday
|
|
40
39
|
// Month picker props
|
|
41
|
-
monthMode:
|
|
42
|
-
selectedMonths:
|
|
43
|
-
onMonthSelect:
|
|
44
|
-
month:
|
|
40
|
+
monthMode: w = "single",
|
|
41
|
+
selectedMonths: N,
|
|
42
|
+
onMonthSelect: _,
|
|
43
|
+
month: H,
|
|
45
44
|
defaultMonth: ge,
|
|
46
45
|
onMonthChange: Ce,
|
|
47
|
-
startMonth:
|
|
48
|
-
endMonth:
|
|
46
|
+
startMonth: Se,
|
|
47
|
+
endMonth: _e,
|
|
49
48
|
...he
|
|
50
49
|
}) {
|
|
51
|
-
const { locale: V, t:
|
|
50
|
+
const { locale: V, t: h } = qe(), K = d.useMemo(() => Ke(V), [V]), Ye = d.useMemo(() => We(V), [V]), xe = d.useMemo(
|
|
52
51
|
() => Array.from(
|
|
53
52
|
{ length: 12 },
|
|
54
|
-
(e, n) => new Date(2024, n, 1).toLocaleString(
|
|
53
|
+
(e, n) => new Date(2024, n, 1).toLocaleString(K, { month: "long" })
|
|
55
54
|
),
|
|
56
|
-
[
|
|
57
|
-
),
|
|
55
|
+
[K]
|
|
56
|
+
), Ae = d.useMemo(
|
|
58
57
|
() => Array.from(
|
|
59
58
|
{ length: 12 },
|
|
60
|
-
(e, n) => new Date(2024, n, 1).toLocaleString(
|
|
59
|
+
(e, n) => new Date(2024, n, 1).toLocaleString(K, { month: "short" })
|
|
61
60
|
),
|
|
62
|
-
[
|
|
63
|
-
), ee =
|
|
64
|
-
if (
|
|
65
|
-
if (
|
|
66
|
-
if (Z === "advanced") return
|
|
61
|
+
[K]
|
|
62
|
+
), ee = d.useMemo(() => {
|
|
63
|
+
if (L === "fiscal") {
|
|
64
|
+
if (le) return le;
|
|
65
|
+
if (Z === "advanced") return Fe["4-4-5"];
|
|
67
66
|
}
|
|
68
|
-
}, [
|
|
69
|
-
if (
|
|
67
|
+
}, [L, Z, le]), b = He(), je = d.useMemo(() => new Date(1900, 0, 1), []), Me = d.useMemo(() => new Date(2100, 11, 31), []), E = Se || je, P = _e || Me, [W, te] = d.useState(D), [j, be] = d.useState(() => {
|
|
68
|
+
if (H) return H;
|
|
70
69
|
if (ge) return ge;
|
|
71
|
-
if (
|
|
72
|
-
if (Array.isArray(
|
|
73
|
-
return
|
|
74
|
-
if (
|
|
75
|
-
return
|
|
76
|
-
if ("from" in
|
|
77
|
-
return
|
|
70
|
+
if (D) {
|
|
71
|
+
if (Array.isArray(D))
|
|
72
|
+
return D[0] || /* @__PURE__ */ new Date();
|
|
73
|
+
if (D instanceof Date)
|
|
74
|
+
return D;
|
|
75
|
+
if ("from" in D && D.from)
|
|
76
|
+
return D.from;
|
|
78
77
|
}
|
|
79
78
|
return /* @__PURE__ */ new Date();
|
|
80
79
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, [
|
|
84
|
-
const [
|
|
85
|
-
|
|
86
|
-
te(
|
|
87
|
-
}, [
|
|
88
|
-
const
|
|
80
|
+
d.useEffect(() => {
|
|
81
|
+
H && (be(H), ve(H.getFullYear()));
|
|
82
|
+
}, [H]);
|
|
83
|
+
const [$, ne] = d.useState(C), [M, re] = d.useState(N), [ke, ve] = d.useState(j.getFullYear());
|
|
84
|
+
d.useEffect(() => {
|
|
85
|
+
te(D), ne(C), re(N);
|
|
86
|
+
}, [D, C, N]);
|
|
87
|
+
const O = (e) => {
|
|
89
88
|
be(e), ve(e.getFullYear()), Ce?.(e);
|
|
90
|
-
},
|
|
89
|
+
}, oe = d.useCallback((e) => {
|
|
91
90
|
let n;
|
|
92
91
|
return e instanceof Date ? n = e : n = e.days.find((t) => !t.outside)?.date || e.days[0]?.date || /* @__PURE__ */ new Date(), Te(n, {
|
|
93
|
-
calendarType:
|
|
92
|
+
calendarType: L,
|
|
94
93
|
fiscalMode: Z,
|
|
95
94
|
selectionMode: se,
|
|
96
95
|
fiscalMonthPattern: ee,
|
|
97
96
|
fiscalYearStartMonth: me,
|
|
98
97
|
weekStartsOn: T
|
|
99
98
|
});
|
|
100
|
-
}, [
|
|
99
|
+
}, [L, Z, se, ee, me, T]), ie = d.useCallback((e) => {
|
|
101
100
|
const n = (t, r) => t.year === r.year && t.month === r.month && t.weekOfMonth === r.weekOfMonth;
|
|
102
101
|
if (x)
|
|
103
102
|
ne((t) => {
|
|
104
103
|
let r;
|
|
105
|
-
if (
|
|
104
|
+
if (v === "single")
|
|
106
105
|
r = e;
|
|
107
|
-
else if (
|
|
106
|
+
else if (v === "multiple") {
|
|
108
107
|
const a = t || [];
|
|
109
|
-
r = a.some((
|
|
110
|
-
} else if (
|
|
108
|
+
r = a.some((l) => n(l, e)) ? a.filter((l) => !n(l, e)) : [...a, e];
|
|
109
|
+
} else if (v === "range") {
|
|
111
110
|
const a = t;
|
|
112
111
|
if (!a?.from || a.to)
|
|
113
112
|
r = { from: e };
|
|
114
113
|
else {
|
|
115
|
-
const
|
|
116
|
-
e.startDate < a.from.startDate && (
|
|
114
|
+
const s = { from: a.from, to: e };
|
|
115
|
+
e.startDate < a.from.startDate && (s.from = e, s.to = a.from), r = s;
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
return
|
|
118
|
+
return A?.(r), r;
|
|
120
119
|
});
|
|
121
|
-
else if (
|
|
122
|
-
|
|
123
|
-
else if (
|
|
124
|
-
const t =
|
|
125
|
-
|
|
126
|
-
} else if (
|
|
127
|
-
const t =
|
|
120
|
+
else if (v === "single")
|
|
121
|
+
A?.(e);
|
|
122
|
+
else if (v === "multiple") {
|
|
123
|
+
const t = C || [], a = t.some((s) => n(s, e)) ? t.filter((s) => !n(s, e)) : [...t, e];
|
|
124
|
+
A?.(a.length > 0 ? a : void 0);
|
|
125
|
+
} else if (v === "range") {
|
|
126
|
+
const t = C;
|
|
128
127
|
if (!t?.from || t.to)
|
|
129
|
-
|
|
128
|
+
A?.({ from: e });
|
|
130
129
|
else {
|
|
131
130
|
const r = { from: t.from, to: e };
|
|
132
|
-
e.startDate < t.from.startDate && (r.from = e, r.to = t.from),
|
|
131
|
+
e.startDate < t.from.startDate && (r.from = e, r.to = t.from), A?.(r);
|
|
133
132
|
}
|
|
134
133
|
}
|
|
135
|
-
}, [
|
|
136
|
-
const t = { year: e, month: n }, r = (a,
|
|
134
|
+
}, [v, x, C, A]), ze = d.useCallback((e, n) => {
|
|
135
|
+
const t = { year: e, month: n }, r = (a, s) => a.year === s.year && a.month === s.month;
|
|
137
136
|
if (x)
|
|
138
137
|
re((a) => {
|
|
139
|
-
let
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
else if (
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} else if (
|
|
146
|
-
const
|
|
147
|
-
if (!
|
|
148
|
-
|
|
138
|
+
let s;
|
|
139
|
+
if (w === "single")
|
|
140
|
+
s = t;
|
|
141
|
+
else if (w === "multiple") {
|
|
142
|
+
const l = a || [];
|
|
143
|
+
s = l.some((u) => r(u, t)) ? l.filter((u) => !r(u, t)) : [...l, t];
|
|
144
|
+
} else if (w === "range") {
|
|
145
|
+
const l = a;
|
|
146
|
+
if (!l?.from || l.to)
|
|
147
|
+
s = { from: t };
|
|
149
148
|
else {
|
|
150
|
-
const
|
|
151
|
-
new Date(t.year, t.month, 1) <
|
|
149
|
+
const o = new Date(l.from.year, l.from.month, 1);
|
|
150
|
+
new Date(t.year, t.month, 1) < o ? s = { from: t, to: l.from } : s = { from: l.from, to: t };
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
|
-
return
|
|
153
|
+
return _?.(s), s;
|
|
155
154
|
});
|
|
156
|
-
else if (
|
|
157
|
-
|
|
158
|
-
else if (
|
|
159
|
-
const a =
|
|
160
|
-
|
|
161
|
-
} else if (
|
|
162
|
-
const a =
|
|
155
|
+
else if (w === "single")
|
|
156
|
+
_?.(t);
|
|
157
|
+
else if (w === "multiple") {
|
|
158
|
+
const a = N || [], l = a.some((o) => r(o, t)) ? a.filter((o) => !r(o, t)) : [...a, t];
|
|
159
|
+
_?.(l.length > 0 ? l : void 0);
|
|
160
|
+
} else if (w === "range") {
|
|
161
|
+
const a = N;
|
|
163
162
|
if (!a?.from || a.to)
|
|
164
|
-
|
|
163
|
+
_?.({ from: t });
|
|
165
164
|
else {
|
|
166
|
-
const
|
|
167
|
-
new Date(t.year, t.month, 1) <
|
|
165
|
+
const s = new Date(a.from.year, a.from.month, 1);
|
|
166
|
+
new Date(t.year, t.month, 1) < s ? _?.({ from: t, to: a.from }) : _?.({ from: a.from, to: t });
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
|
-
}, [
|
|
171
|
-
const e =
|
|
169
|
+
}, [w, x, N, _]), pe = d.useCallback(() => {
|
|
170
|
+
const e = E.getFullYear(), n = P.getFullYear(), t = [];
|
|
172
171
|
for (let r = e; r <= n; r++)
|
|
173
172
|
t.push({ label: r.toString(), value: r.toString() });
|
|
174
173
|
return t;
|
|
175
|
-
}, [
|
|
174
|
+
}, [E, P]), Ie = d.useCallback((e) => xe.map((t, r) => ({
|
|
176
175
|
label: t,
|
|
177
176
|
value: r.toString()
|
|
178
177
|
})).filter((t, r) => {
|
|
179
178
|
const a = new Date(e, r, 1);
|
|
180
|
-
return !(
|
|
181
|
-
}), [
|
|
182
|
-
if (
|
|
183
|
-
const e = x ?
|
|
179
|
+
return !(E && a < new Date(E.getFullYear(), E.getMonth(), 1) || P && a > new Date(P.getFullYear(), P.getMonth(), 1));
|
|
180
|
+
}), [E, P, xe]), q = d.useMemo(() => {
|
|
181
|
+
if (m !== "week") return;
|
|
182
|
+
const e = x ? $ : C;
|
|
184
183
|
if (!e) return;
|
|
185
184
|
const n = [], t = (r) => {
|
|
186
185
|
let a = new Date(r.startDate);
|
|
187
186
|
a.setHours(0, 0, 0, 0);
|
|
188
|
-
const
|
|
189
|
-
for (
|
|
187
|
+
const s = new Date(r.endDate);
|
|
188
|
+
for (s.setHours(0, 0, 0, 0); a <= s; )
|
|
190
189
|
n.push(new Date(a)), a.setDate(a.getDate() + 1);
|
|
191
190
|
};
|
|
192
191
|
if (Array.isArray(e))
|
|
@@ -205,77 +204,82 @@ function st({
|
|
|
205
204
|
} else
|
|
206
205
|
t(e);
|
|
207
206
|
return n;
|
|
208
|
-
}, [
|
|
209
|
-
if (
|
|
207
|
+
}, [m, x, $, C]), Re = d.useMemo(() => {
|
|
208
|
+
if (m !== "week" || !q || q.length === 0)
|
|
210
209
|
return { range_start: [], range_middle: [], range_end: [] };
|
|
211
|
-
const e = [...
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
210
|
+
const e = [...q].sort((i, g) => i.getTime() - g.getTime()), n = [], t = [], r = [], a = x ? $ : C, s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
211
|
+
v === "multiple" && Array.isArray(a) && a.forEach((i) => {
|
|
212
|
+
const g = i.startDate.toISOString().split("T")[0], p = i.endDate.toISOString().split("T")[0];
|
|
213
|
+
s.add(g), l.add(p);
|
|
214
|
+
});
|
|
215
|
+
const o = (i, g) => {
|
|
216
|
+
if (g === 0) return !1;
|
|
217
|
+
const p = e[g - 1];
|
|
218
|
+
return i.getTime() - p.getTime() <= 1440 * 60 * 1e3;
|
|
219
|
+
}, u = (i, g) => g === e.length - 1 ? !1 : e[g + 1].getTime() - i.getTime() <= 1440 * 60 * 1e3;
|
|
220
|
+
return e.forEach((i, g) => {
|
|
221
|
+
const p = i.toISOString().split("T")[0], k = s.has(p), S = l.has(p), z = o(i, g), I = u(i, g);
|
|
222
|
+
v === "multiple" ? k ? n.push(i) : S ? r.push(i) : t.push(i) : !z && !I ? (n.push(i), r.push(i)) : z ? I ? t.push(i) : r.push(i) : n.push(i);
|
|
219
223
|
}), {
|
|
220
224
|
range_start: n,
|
|
221
225
|
range_middle: t,
|
|
222
226
|
range_end: r
|
|
223
227
|
};
|
|
224
|
-
}, [
|
|
225
|
-
if (
|
|
228
|
+
}, [m, q, v, x, $, C]), Le = d.useCallback((e) => {
|
|
229
|
+
if (m === "week" && e) {
|
|
226
230
|
const n = Array.isArray(e) ? e[e.length - 1] : e instanceof Date ? e : void 0;
|
|
227
231
|
if (n) {
|
|
228
|
-
const t =
|
|
232
|
+
const t = oe(n);
|
|
229
233
|
ie(t);
|
|
230
234
|
return;
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
|
-
x && te(e),
|
|
234
|
-
}, [x,
|
|
235
|
-
|
|
236
|
-
}, [
|
|
237
|
-
|
|
238
|
-
}, [
|
|
239
|
-
|
|
240
|
-
}, [x,
|
|
241
|
-
const t = x ?
|
|
237
|
+
x && te(e), U?.(e);
|
|
238
|
+
}, [x, U, m, oe, ie]), Ee = d.useCallback(() => {
|
|
239
|
+
m === "week" ? (A?.($), X?.($)) : m === "month" ? (_?.(M), X?.(M)) : (U?.(W), X?.(W));
|
|
240
|
+
}, [W, $, M, U, A, _, X, m]), Pe = d.useCallback(() => {
|
|
241
|
+
m === "week" ? ne(C) : m === "month" ? re(N) : te(D), fe?.();
|
|
242
|
+
}, [D, C, N, fe, m]), $e = d.useCallback(() => {
|
|
243
|
+
m === "week" ? (ne(void 0), x || A?.(void 0)) : m === "month" ? (re(void 0), x || _?.(void 0)) : (te(void 0), x || U?.(void 0)), de?.();
|
|
244
|
+
}, [x, U, A, _, de, m]), Oe = d.useCallback((e, n) => {
|
|
245
|
+
const t = x ? M : N;
|
|
242
246
|
if (!t) return !1;
|
|
243
247
|
if (Array.isArray(t))
|
|
244
248
|
return t.some((r) => r.year === e && r.month === n);
|
|
245
249
|
if ("from" in t) {
|
|
246
|
-
const r = t, a = r.from,
|
|
247
|
-
if (!
|
|
248
|
-
const
|
|
249
|
-
return
|
|
250
|
+
const r = t, a = r.from, s = r.to, l = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
|
|
251
|
+
if (!s) return l === o;
|
|
252
|
+
const u = new Date(s.year, s.month, 1).getTime();
|
|
253
|
+
return l >= o && l <= u;
|
|
250
254
|
} else {
|
|
251
255
|
const r = t;
|
|
252
256
|
return r.year === e && r.month === n;
|
|
253
257
|
}
|
|
254
|
-
}, [x,
|
|
255
|
-
const t = x ?
|
|
258
|
+
}, [x, M, N]), Ue = d.useCallback((e, n) => {
|
|
259
|
+
const t = x ? M : N;
|
|
256
260
|
if (!t || !("from" in t)) return { isStart: !1, isEnd: !1, isMiddle: !1 };
|
|
257
|
-
const r = t, a = r.from,
|
|
258
|
-
if (!
|
|
259
|
-
const
|
|
261
|
+
const r = t, a = r.from, s = r.to, l = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
|
|
262
|
+
if (!s) return { isStart: l === o, isEnd: !1, isMiddle: !1 };
|
|
263
|
+
const u = new Date(s.year, s.month, 1).getTime();
|
|
260
264
|
return {
|
|
261
|
-
isStart:
|
|
262
|
-
isEnd:
|
|
263
|
-
isMiddle:
|
|
265
|
+
isStart: l === o,
|
|
266
|
+
isEnd: l === u,
|
|
267
|
+
isMiddle: l > o && l < u
|
|
264
268
|
};
|
|
265
|
-
}, [x,
|
|
269
|
+
}, [x, M, N]), De = ({ yearOffset: e = 0 }) => {
|
|
266
270
|
const n = ke + e;
|
|
267
|
-
return /* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ Y("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
|
|
272
|
+
/* @__PURE__ */ Y("div", { className: "flex items-center justify-between", children: [
|
|
269
273
|
e === 0 && /* @__PURE__ */ c(
|
|
270
|
-
|
|
274
|
+
R,
|
|
271
275
|
{
|
|
272
276
|
variant: "ghost",
|
|
273
277
|
size: "icon",
|
|
274
278
|
className: "h-7 w-7",
|
|
275
|
-
"aria-label":
|
|
276
|
-
title:
|
|
277
|
-
disabled: n <=
|
|
278
|
-
onClick: () =>
|
|
279
|
+
"aria-label": h("calendar.previousYear"),
|
|
280
|
+
title: h("calendar.previousYear"),
|
|
281
|
+
disabled: n <= E.getFullYear(),
|
|
282
|
+
onClick: () => O(new Date(n - 1, j.getMonth(), 1)),
|
|
279
283
|
children: /* @__PURE__ */ c(we, { className: "h-4 w-4" })
|
|
280
284
|
}
|
|
281
285
|
),
|
|
@@ -286,7 +290,7 @@ function st({
|
|
|
286
290
|
onChange: (t) => {
|
|
287
291
|
if (t && "value" in t) {
|
|
288
292
|
const r = parseInt(t.value) - e;
|
|
289
|
-
|
|
293
|
+
O(new Date(r, j.getMonth(), 1));
|
|
290
294
|
}
|
|
291
295
|
},
|
|
292
296
|
scrollToSelectedOnOpen: !0,
|
|
@@ -296,41 +300,41 @@ function st({
|
|
|
296
300
|
menuWidth: "140px"
|
|
297
301
|
}
|
|
298
302
|
) }),
|
|
299
|
-
(
|
|
300
|
-
|
|
303
|
+
(w === "single" || e === 1) && /* @__PURE__ */ c(
|
|
304
|
+
R,
|
|
301
305
|
{
|
|
302
306
|
variant: "ghost",
|
|
303
307
|
size: "icon",
|
|
304
308
|
className: "h-7 w-7",
|
|
305
|
-
"aria-label":
|
|
306
|
-
title:
|
|
307
|
-
disabled: n >=
|
|
308
|
-
onClick: () =>
|
|
309
|
+
"aria-label": h("calendar.nextYear"),
|
|
310
|
+
title: h("calendar.nextYear"),
|
|
311
|
+
disabled: n >= P.getFullYear(),
|
|
312
|
+
onClick: () => O(new Date(n + 1, j.getMonth(), 1)),
|
|
309
313
|
children: /* @__PURE__ */ c(ye, { className: "h-4 w-4" })
|
|
310
314
|
}
|
|
311
315
|
)
|
|
312
316
|
] }),
|
|
313
|
-
/* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children:
|
|
314
|
-
const a = Oe(n, r), { isStart:
|
|
315
|
-
return /* @__PURE__ */
|
|
316
|
-
|
|
317
|
+
/* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children: Ae.map((t, r) => {
|
|
318
|
+
const a = Oe(n, r), { isStart: s, isEnd: l, isMiddle: o } = Ue(n, r), u = w === "range", i = x ? M : N, g = i && "to" in i && !!i.to;
|
|
319
|
+
return /* @__PURE__ */ Y("div", { className: "relative flex items-center justify-center h-10 w-full group", children: [
|
|
320
|
+
u && g && (o || s || l) && /* @__PURE__ */ c("div", { className: f(
|
|
317
321
|
"absolute inset-y-0 inset-x-0 bg-accent",
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
+
s && "rounded-l-full left-1/2 -ml-5",
|
|
323
|
+
l && "rounded-r-full right-1/2 -mr-5",
|
|
324
|
+
o && "inset-x-0",
|
|
325
|
+
s && l && "rounded-full inset-x-2"
|
|
322
326
|
) }),
|
|
323
327
|
/* @__PURE__ */ c(
|
|
324
|
-
|
|
328
|
+
R,
|
|
325
329
|
{
|
|
326
330
|
variant: "ghost",
|
|
327
331
|
onClick: () => ze(n, r),
|
|
328
|
-
className:
|
|
332
|
+
className: f(
|
|
329
333
|
"relative z-10 w-10 h-10 p-0 text-sm font-normal rounded-lg transition-all",
|
|
330
|
-
a && !
|
|
331
|
-
|
|
334
|
+
a && !u && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground",
|
|
335
|
+
u && (s || l) && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground rounded-lg",
|
|
332
336
|
!a && "hover:bg-accent hover:text-accent-foreground border border-transparent hover:border-brand",
|
|
333
|
-
|
|
337
|
+
o && "text-accent-foreground"
|
|
334
338
|
),
|
|
335
339
|
children: t
|
|
336
340
|
}
|
|
@@ -339,10 +343,10 @@ function st({
|
|
|
339
343
|
}) })
|
|
340
344
|
] });
|
|
341
345
|
};
|
|
342
|
-
return /* @__PURE__ */
|
|
343
|
-
|
|
346
|
+
return /* @__PURE__ */ Y("div", { className: "flex flex-col ", "data-component": "calendar", children: [
|
|
347
|
+
m === "month" ? /* @__PURE__ */ Y("div", { className: "flex flex-col md:flex-row", children: [
|
|
344
348
|
/* @__PURE__ */ c(De, { yearOffset: 0 }),
|
|
345
|
-
(
|
|
349
|
+
(w === "range" || w === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row gap-0", children: [
|
|
346
350
|
/* @__PURE__ */ c("div", { className: "w-[1px] bg-stroke-hairline my-4" }),
|
|
347
351
|
/* @__PURE__ */ c(De, { yearOffset: 1 })
|
|
348
352
|
] })
|
|
@@ -350,114 +354,114 @@ function st({
|
|
|
350
354
|
// @ts-ignore: TS mismatch due to dynamic union types.
|
|
351
355
|
// FIX: Split rendering into separate `DayPicker` calls for 'single' | 'multiple' | 'range' to strictly match discriminated unions.
|
|
352
356
|
/* @__PURE__ */ c(
|
|
353
|
-
|
|
357
|
+
Be,
|
|
354
358
|
{
|
|
355
|
-
mode:
|
|
356
|
-
selected:
|
|
357
|
-
onSelect:
|
|
358
|
-
month:
|
|
359
|
-
onMonthChange:
|
|
360
|
-
showOutsideDays:
|
|
359
|
+
mode: m === "week" ? "multiple" : F,
|
|
360
|
+
selected: m === "week" ? q : x ? W : D,
|
|
361
|
+
onSelect: Le,
|
|
362
|
+
month: j,
|
|
363
|
+
onMonthChange: O,
|
|
364
|
+
showOutsideDays: L === "fiscal" ? !0 : y,
|
|
361
365
|
weekStartsOn: T,
|
|
362
|
-
modifiers:
|
|
366
|
+
modifiers: m === "week" ? Re : void 0,
|
|
363
367
|
locale: Ye,
|
|
364
|
-
className:
|
|
368
|
+
className: f(
|
|
365
369
|
"bg-canvas group/calendar p-2 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
366
370
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
367
371
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
368
372
|
ae
|
|
369
373
|
),
|
|
370
|
-
captionLayout:
|
|
371
|
-
startMonth:
|
|
372
|
-
endMonth:
|
|
374
|
+
captionLayout: J,
|
|
375
|
+
startMonth: E,
|
|
376
|
+
endMonth: P,
|
|
373
377
|
disabled: he.disabled,
|
|
374
|
-
numberOfMonths:
|
|
378
|
+
numberOfMonths: F === "range" || F === "multiple" || v === "range" || v === "multiple" ? 2 : 1,
|
|
375
379
|
showWeekNumber: !0,
|
|
376
380
|
formatters: {
|
|
377
|
-
formatMonthDropdown: (e) => e.toLocaleString(
|
|
378
|
-
formatWeekNumber: (e) =>
|
|
381
|
+
formatMonthDropdown: (e) => e.toLocaleString(K, { month: "short" }),
|
|
382
|
+
formatWeekNumber: (e) => h("calendar.weekNumber", { number: e }),
|
|
379
383
|
...Q
|
|
380
384
|
},
|
|
381
385
|
classNames: {
|
|
382
|
-
root:
|
|
383
|
-
months:
|
|
386
|
+
root: f("w-fit", b.root),
|
|
387
|
+
months: f(
|
|
384
388
|
"relative flex flex-col gap-2 md:flex-row",
|
|
385
|
-
|
|
389
|
+
b.months
|
|
386
390
|
),
|
|
387
|
-
month:
|
|
391
|
+
month: f(
|
|
388
392
|
"flex flex-1 min-w-[252px] flex-col gap-2 relative after:absolute after:top-[5.5rem] after:bottom-0 after:left-[30px] after:w-[1px] after:bg-stroke-hairline",
|
|
389
|
-
|
|
393
|
+
b.month
|
|
390
394
|
),
|
|
391
|
-
nav:
|
|
395
|
+
nav: f(
|
|
392
396
|
"absolute inset-x-0 top-[2px] h-[--cell-size] flex w-full items-center justify-between px-2 gap-1",
|
|
393
|
-
|
|
397
|
+
b.nav
|
|
394
398
|
),
|
|
395
|
-
button_previous:
|
|
399
|
+
button_previous: f(
|
|
396
400
|
"h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
|
|
397
|
-
|
|
401
|
+
b.button_previous
|
|
398
402
|
),
|
|
399
|
-
button_next:
|
|
403
|
+
button_next: f(
|
|
400
404
|
"h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
|
|
401
|
-
|
|
405
|
+
b.button_next
|
|
402
406
|
),
|
|
403
|
-
month_caption:
|
|
407
|
+
month_caption: f(
|
|
404
408
|
"flex h-[--cell-size] w-full items-center justify-center px-[--cell-size] relative ",
|
|
405
|
-
|
|
409
|
+
b.month_caption
|
|
406
410
|
),
|
|
407
|
-
dropdowns:
|
|
411
|
+
dropdowns: f(
|
|
408
412
|
"flex h-[--cell-size] gap-1 items-center justify-center text-sm font-medium relative ",
|
|
409
|
-
|
|
413
|
+
b.dropdowns
|
|
410
414
|
),
|
|
411
|
-
caption_label:
|
|
415
|
+
caption_label: f(
|
|
412
416
|
"select-none font-medium text-sm",
|
|
413
|
-
|
|
417
|
+
b.caption_label
|
|
414
418
|
),
|
|
415
419
|
table: "w-full border-collapse",
|
|
416
|
-
weekdays:
|
|
417
|
-
weekday:
|
|
420
|
+
weekdays: f("flex w-full relative after:absolute after:bottom-0 after:right-0 after:h-[1px] after:bg-stroke-hairline after:left-[30px]", b.weekdays),
|
|
421
|
+
weekday: f(
|
|
418
422
|
"flex-1 select-none rounded-md font-normal text-center",
|
|
419
423
|
"text-[11px] text-content-muted pb-2",
|
|
420
424
|
"[&:nth-child(2)]:pl-2",
|
|
421
|
-
|
|
425
|
+
b.weekday
|
|
422
426
|
),
|
|
423
|
-
week:
|
|
424
|
-
week_number_header:
|
|
427
|
+
week: f("mt-1 flex w-full items-stretch group/week", b.week),
|
|
428
|
+
week_number_header: f(
|
|
425
429
|
"select-none font-normal text-center h-[30px] flex items-center justify-center",
|
|
426
430
|
"text-[11px] text-content-muted w-[30px] flex-shrink-0",
|
|
427
|
-
|
|
431
|
+
b.week_number_header
|
|
428
432
|
),
|
|
429
|
-
week_number:
|
|
433
|
+
week_number: f(
|
|
430
434
|
"select-none flex items-center justify-center h-[30px]",
|
|
431
435
|
"text-[11px] text-content-muted w-[30px] flex-shrink-0 transition-colors",
|
|
432
|
-
|
|
433
|
-
|
|
436
|
+
m === "week" && "group-hover/week:bg-accent group-hover/week:rounded-l-lg",
|
|
437
|
+
b.week_number
|
|
434
438
|
),
|
|
435
|
-
day:
|
|
439
|
+
day: f(
|
|
436
440
|
"group/day relative select-none p-0 text-center flex-1 h-[30px] flex items-center justify-center [&:nth-child(2)]:pl-2 rdp-day",
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
441
|
+
m === "week" && "group-hover/week:bg-accent [&:nth-child(2)]:group-hover/week:rounded-l-full [&:nth-child(8)]:group-hover/week:rounded-r-full",
|
|
442
|
+
m === "week" && "[&.rdp-selected:nth-child(2)]:rounded-l-full [&.rdp-selected:nth-child(8)]:rounded-r-full",
|
|
443
|
+
G?.day
|
|
440
444
|
),
|
|
441
|
-
range_start:
|
|
445
|
+
range_start: f(
|
|
442
446
|
"bg-accent rounded-l-full",
|
|
443
|
-
|
|
447
|
+
b.range_start
|
|
444
448
|
),
|
|
445
|
-
range_middle:
|
|
446
|
-
range_end:
|
|
447
|
-
today:
|
|
449
|
+
range_middle: f("bg-accent rounded-none", b.range_middle),
|
|
450
|
+
range_end: f("bg-accent rounded-r-full", b.range_end),
|
|
451
|
+
today: f(
|
|
448
452
|
"text-brand",
|
|
449
|
-
|
|
453
|
+
b.today
|
|
450
454
|
),
|
|
451
|
-
outside:
|
|
452
|
-
|
|
453
|
-
|
|
455
|
+
outside: f(
|
|
456
|
+
L === "fiscal" || y ? "text-content-muted opacity-50" : "invisible",
|
|
457
|
+
b.outside
|
|
454
458
|
),
|
|
455
|
-
disabled:
|
|
459
|
+
disabled: f(
|
|
456
460
|
"text-content-muted opacity-50",
|
|
457
|
-
|
|
461
|
+
b.disabled
|
|
458
462
|
),
|
|
459
|
-
hidden:
|
|
460
|
-
...
|
|
463
|
+
hidden: f("invisible", b.hidden),
|
|
464
|
+
...G
|
|
461
465
|
},
|
|
462
466
|
components: {
|
|
463
467
|
Root: ({ className: e, rootRef: n, ...t }) => /* @__PURE__ */ c(
|
|
@@ -465,83 +469,83 @@ function st({
|
|
|
465
469
|
{
|
|
466
470
|
"data-slot": "calendar",
|
|
467
471
|
ref: n,
|
|
468
|
-
className:
|
|
472
|
+
className: f(e),
|
|
469
473
|
...t
|
|
470
474
|
}
|
|
471
475
|
),
|
|
472
|
-
Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(we, { className:
|
|
476
|
+
Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(we, { className: f("size-4 text-content", e), ...t }) : n === "right" ? /* @__PURE__ */ c(
|
|
473
477
|
ye,
|
|
474
478
|
{
|
|
475
|
-
className:
|
|
479
|
+
className: f("size-4 text-content", e),
|
|
476
480
|
...t
|
|
477
481
|
}
|
|
478
482
|
) : /* @__PURE__ */ c("span", {}),
|
|
479
483
|
PreviousMonthButton: (e) => /* @__PURE__ */ c(
|
|
480
|
-
|
|
484
|
+
R,
|
|
481
485
|
{
|
|
482
|
-
variant:
|
|
486
|
+
variant: B,
|
|
483
487
|
size: "icon",
|
|
484
488
|
className: "h-7 w-7",
|
|
485
|
-
"aria-label":
|
|
486
|
-
title:
|
|
489
|
+
"aria-label": h("calendar.previousMonth"),
|
|
490
|
+
title: h("calendar.previousMonth"),
|
|
487
491
|
...e
|
|
488
492
|
}
|
|
489
493
|
),
|
|
490
494
|
NextMonthButton: (e) => /* @__PURE__ */ c(
|
|
491
|
-
|
|
495
|
+
R,
|
|
492
496
|
{
|
|
493
|
-
variant:
|
|
497
|
+
variant: B,
|
|
494
498
|
size: "icon",
|
|
495
499
|
className: "h-7 w-7",
|
|
496
|
-
"aria-label":
|
|
497
|
-
title:
|
|
500
|
+
"aria-label": h("calendar.nextMonth"),
|
|
501
|
+
title: h("calendar.nextMonth"),
|
|
498
502
|
...e
|
|
499
503
|
}
|
|
500
504
|
),
|
|
501
|
-
MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(
|
|
505
|
+
MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(ue.Provider, { value: e, children: /* @__PURE__ */ c("div", { ...n }) }),
|
|
502
506
|
MonthsDropdown: ({ value: e }) => {
|
|
503
|
-
const n =
|
|
507
|
+
const n = d.useContext(ue), t = n > 0, a = new Date(j.getFullYear(), j.getMonth() + n, 1).getFullYear(), s = Ie(a);
|
|
504
508
|
return /* @__PURE__ */ c(
|
|
505
509
|
ce,
|
|
506
510
|
{
|
|
507
|
-
value:
|
|
508
|
-
onChange: (
|
|
509
|
-
if (
|
|
510
|
-
const
|
|
511
|
+
value: s.find((l) => l.value === e?.toString()),
|
|
512
|
+
onChange: (l) => {
|
|
513
|
+
if (l && "value" in l) {
|
|
514
|
+
const o = parseInt(l.value);
|
|
511
515
|
if (t) {
|
|
512
|
-
const
|
|
513
|
-
|
|
516
|
+
const u = new Date(a, o - 1, 1);
|
|
517
|
+
O(u);
|
|
514
518
|
} else {
|
|
515
|
-
const
|
|
516
|
-
|
|
519
|
+
const u = new Date(a, o, 1);
|
|
520
|
+
O(u);
|
|
517
521
|
}
|
|
518
522
|
}
|
|
519
523
|
},
|
|
520
524
|
scrollToSelectedOnOpen: !0,
|
|
521
|
-
options:
|
|
525
|
+
options: s,
|
|
522
526
|
className: "w-[95px]",
|
|
523
527
|
menuWidth: "140px",
|
|
524
528
|
isSearchable: !0,
|
|
525
529
|
isClearable: !1,
|
|
526
|
-
placeholder:
|
|
530
|
+
placeholder: h("calendar.monthPlaceholder")
|
|
527
531
|
}
|
|
528
532
|
);
|
|
529
533
|
},
|
|
530
534
|
YearsDropdown: ({ value: e }) => {
|
|
531
|
-
const t =
|
|
535
|
+
const t = d.useContext(ue) > 0, r = pe();
|
|
532
536
|
return /* @__PURE__ */ c(
|
|
533
537
|
ce,
|
|
534
538
|
{
|
|
535
539
|
value: r.find((a) => a.value === e?.toString()),
|
|
536
540
|
onChange: (a) => {
|
|
537
541
|
if (a && "value" in a) {
|
|
538
|
-
const
|
|
542
|
+
const s = parseInt(a.value);
|
|
539
543
|
if (t) {
|
|
540
|
-
const
|
|
541
|
-
|
|
544
|
+
const l = new Date(j.getFullYear(), j.getMonth() + 1, 1).getMonth(), o = new Date(s, l - 1, 1);
|
|
545
|
+
O(o);
|
|
542
546
|
} else {
|
|
543
|
-
const
|
|
544
|
-
|
|
547
|
+
const l = new Date(s, j.getMonth(), 1);
|
|
548
|
+
O(l);
|
|
545
549
|
}
|
|
546
550
|
}
|
|
547
551
|
},
|
|
@@ -551,54 +555,54 @@ function st({
|
|
|
551
555
|
menuWidth: "140px",
|
|
552
556
|
isSearchable: !0,
|
|
553
557
|
isClearable: !1,
|
|
554
|
-
placeholder:
|
|
558
|
+
placeholder: h("calendar.yearPlaceholder")
|
|
555
559
|
}
|
|
556
560
|
);
|
|
557
561
|
},
|
|
558
562
|
DayButton: (e) => /* @__PURE__ */ c(
|
|
559
|
-
|
|
563
|
+
Ge,
|
|
560
564
|
{
|
|
561
565
|
...e,
|
|
562
|
-
pickerType:
|
|
566
|
+
pickerType: m
|
|
563
567
|
}
|
|
564
568
|
),
|
|
565
569
|
WeekNumber: ({ week: e, ...n }) => {
|
|
566
|
-
const t = e.days.find((
|
|
570
|
+
const t = e.days.find((I) => !I.outside)?.date;
|
|
567
571
|
if (!t)
|
|
568
|
-
return /* @__PURE__ */ c("td", { ...n, className:
|
|
569
|
-
const r = t.getFullYear(), a = t.getMonth(),
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
return
|
|
572
|
+
return /* @__PURE__ */ c("td", { ...n, className: f("select-none flex items-center justify-center h-8 text-[11px] text-content-muted w-8 flex-shrink-0 rdp-week_number", n.className), children: /* @__PURE__ */ c("div", { className: "flex size-[--cell-size] items-center justify-center text-center" }) });
|
|
573
|
+
const r = t.getFullYear(), a = t.getMonth(), o = (new Date(r, a, 1).getDay() + 7 - T) % 7, u = new Date(r, a, 1 - o), i = new Date(t), p = (t.getDay() + 7 - T) % 7;
|
|
574
|
+
i.setDate(t.getDate() - p);
|
|
575
|
+
const S = Math.round((i.getTime() - u.getTime()) / (10080 * 60 * 1e3)) + 1, z = h("calendar.weekLabel", { number: S });
|
|
576
|
+
return m === "week" ? /* @__PURE__ */ c(
|
|
573
577
|
"td",
|
|
574
578
|
{
|
|
575
579
|
...n,
|
|
576
|
-
"aria-label":
|
|
577
|
-
"data-week-index":
|
|
578
|
-
"data-week-number":
|
|
579
|
-
className:
|
|
580
|
+
"aria-label": z,
|
|
581
|
+
"data-week-index": S,
|
|
582
|
+
"data-week-number": S,
|
|
583
|
+
className: f(
|
|
580
584
|
"select-none flex items-center justify-center h-[30px] w-[30px] flex-shrink-0 rdp-week_number cursor-pointer hover:bg-accent hover:text-accent-foreground group-hover/week:bg-accent group-hover/week:rounded-l-lg rounded-lg transition-colors",
|
|
581
585
|
n.className
|
|
582
586
|
),
|
|
583
587
|
scope: "row",
|
|
584
588
|
role: "rowheader",
|
|
585
|
-
onClick: (
|
|
586
|
-
|
|
589
|
+
onClick: (I) => {
|
|
590
|
+
I.preventDefault(), I.stopPropagation(), ie(oe(e));
|
|
587
591
|
},
|
|
588
|
-
children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-content-muted", children:
|
|
592
|
+
children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-content-muted", children: h("calendar.weekNumber", { number: S }) })
|
|
589
593
|
}
|
|
590
594
|
) : /* @__PURE__ */ c(
|
|
591
595
|
"td",
|
|
592
596
|
{
|
|
593
597
|
...n,
|
|
594
|
-
"aria-label":
|
|
595
|
-
className:
|
|
598
|
+
"aria-label": z,
|
|
599
|
+
className: f(
|
|
596
600
|
"select-none flex items-center justify-center h-[30px] text-[11px] text-content-muted w-[30px] flex-shrink-0 rdp-week_number",
|
|
597
601
|
n.className
|
|
598
602
|
),
|
|
599
603
|
scope: "row",
|
|
600
604
|
role: "rowheader",
|
|
601
|
-
children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center", children:
|
|
605
|
+
children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center", children: h("calendar.weekNumber", { number: S }) })
|
|
602
606
|
}
|
|
603
607
|
);
|
|
604
608
|
},
|
|
@@ -608,11 +612,11 @@ function st({
|
|
|
608
612
|
}
|
|
609
613
|
)
|
|
610
614
|
),
|
|
611
|
-
x && /* @__PURE__ */
|
|
612
|
-
|
|
615
|
+
x && /* @__PURE__ */ Y("div", { className: f("flex items-center gap-2 border-t pt-3 p-3", m === "month" && w !== "single" || F === "range" || v === "range" || v === "multiple" ? "justify-between" : "justify-end"), children: [
|
|
616
|
+
F === "range" && m === "date" && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
|
|
613
617
|
"Selected:",
|
|
614
618
|
/* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
|
|
615
|
-
const e =
|
|
619
|
+
const e = W;
|
|
616
620
|
if (e?.from && e?.to) {
|
|
617
621
|
const n = Math.abs(e.to.getTime() - e.from.getTime()), t = Math.ceil(n / (1e3 * 60 * 60 * 24)) + 1;
|
|
618
622
|
return `${t} day${t !== 1 ? "s" : ""}`;
|
|
@@ -620,123 +624,123 @@ function st({
|
|
|
620
624
|
return "0 days";
|
|
621
625
|
})() })
|
|
622
626
|
] }),
|
|
623
|
-
|
|
627
|
+
m === "week" && (v === "range" || v === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
|
|
624
628
|
"Selected:",
|
|
625
629
|
/* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
|
|
626
|
-
const e =
|
|
630
|
+
const e = $;
|
|
627
631
|
if (!e) return "0 weeks";
|
|
628
|
-
const n = (
|
|
629
|
-
const
|
|
630
|
-
return
|
|
631
|
-
}, r =
|
|
632
|
+
const n = (o) => Date.UTC(o.getFullYear(), o.getMonth(), o.getDate()), t = (o) => {
|
|
633
|
+
const u = Math.floor(o / 7), i = o % 7, g = [];
|
|
634
|
+
return u > 0 && g.push(`${u} week${u !== 1 ? "s" : ""}`), (i > 0 || u === 0) && g.push(`${i} day${i !== 1 ? "s" : ""}`), g.join(" ");
|
|
635
|
+
}, r = L === "fiscal" && se === "fiscalMonth", a = L === "fiscal", s = r ? "fiscal month" : a ? "fiscal week" : "week", l = r ? "fiscal months" : a ? "fiscal weeks" : "weeks";
|
|
632
636
|
if (Array.isArray(e))
|
|
633
637
|
if (a || r) {
|
|
634
|
-
const
|
|
635
|
-
return `${
|
|
638
|
+
const o = e.length;
|
|
639
|
+
return `${o} ${o !== 1 ? l : s}`;
|
|
636
640
|
} else {
|
|
637
|
-
let
|
|
638
|
-
return e.forEach((
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
}), t(
|
|
641
|
+
let o = 0;
|
|
642
|
+
return e.forEach((u) => {
|
|
643
|
+
const i = n(u.startDate), g = n(u.endDate);
|
|
644
|
+
o += Math.round((g - i) / (1e3 * 60 * 60 * 24)) + 1;
|
|
645
|
+
}), t(o);
|
|
642
646
|
}
|
|
643
647
|
else if ("from" in e) {
|
|
644
|
-
const { from:
|
|
648
|
+
const { from: o, to: u } = e;
|
|
645
649
|
if (r) {
|
|
646
|
-
if (!
|
|
647
|
-
const
|
|
648
|
-
return `${
|
|
650
|
+
if (!u) return `1 ${s}`;
|
|
651
|
+
const i = n(o.startDate), g = n(u.endDate), p = Math.round(Math.abs(g - i) / (1e3 * 60 * 60 * 24)) + 1, k = ee ? ee.reduce((z, I) => z + I, 0) / 12 : 4.33, S = Math.max(1, Math.round(p / (k * 7)));
|
|
652
|
+
return `${S} ${S !== 1 ? l : s}`;
|
|
649
653
|
} else if (a) {
|
|
650
|
-
if (!
|
|
651
|
-
const
|
|
652
|
-
return `${
|
|
654
|
+
if (!u) return `1 ${s}`;
|
|
655
|
+
const i = n(o.startDate), g = n(u.endDate), p = Math.round((g - i) / (10080 * 60 * 1e3)), k = p > 0 ? p : 1;
|
|
656
|
+
return `${k} ${k !== 1 ? l : s}`;
|
|
653
657
|
} else {
|
|
654
|
-
if (!
|
|
655
|
-
const
|
|
656
|
-
return t(
|
|
658
|
+
if (!u) {
|
|
659
|
+
const k = n(o.startDate), S = n(o.endDate), z = Math.round((S - k) / (1e3 * 60 * 60 * 24)) + 1;
|
|
660
|
+
return t(z);
|
|
657
661
|
}
|
|
658
|
-
const
|
|
659
|
-
return t(
|
|
662
|
+
const i = n(o.startDate), g = n(u.endDate), p = Math.round(Math.abs(g - i) / (1e3 * 60 * 60 * 24)) + 1;
|
|
663
|
+
return t(p);
|
|
660
664
|
}
|
|
661
665
|
} else
|
|
662
|
-
return `1 ${
|
|
666
|
+
return `1 ${s}`;
|
|
663
667
|
})() })
|
|
664
668
|
] }),
|
|
665
|
-
|
|
669
|
+
m === "month" && (w === "range" || w === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
|
|
666
670
|
"Selected:",
|
|
667
671
|
/* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
|
|
668
|
-
const e =
|
|
672
|
+
const e = M;
|
|
669
673
|
if (!e) return "0 months";
|
|
670
674
|
if (Array.isArray(e)) {
|
|
671
675
|
const n = e.length;
|
|
672
|
-
return n === 1 ?
|
|
676
|
+
return n === 1 ? h("calendar.monthRange") : h("calendar.monthRangePlural", { count: n });
|
|
673
677
|
} else if ("from" in e) {
|
|
674
678
|
const n = e;
|
|
675
|
-
if (!n.to) return
|
|
679
|
+
if (!n.to) return h("calendar.monthRange");
|
|
676
680
|
const t = new Date(n.from.year, n.from.month, 1), r = new Date(n.to.year, n.to.month, 1), a = (r.getFullYear() - t.getFullYear()) * 12 + (r.getMonth() - t.getMonth()) + 1;
|
|
677
|
-
return a === 1 ?
|
|
681
|
+
return a === 1 ? h("calendar.monthRange") : h("calendar.monthRangePlural", { count: a });
|
|
678
682
|
} else
|
|
679
|
-
return
|
|
683
|
+
return h("calendar.monthRange");
|
|
680
684
|
})() })
|
|
681
685
|
] }),
|
|
682
|
-
/* @__PURE__ */
|
|
686
|
+
/* @__PURE__ */ Y("div", { className: "flex items-center gap-2", children: [
|
|
683
687
|
/* @__PURE__ */ c(
|
|
684
|
-
|
|
688
|
+
R,
|
|
685
689
|
{
|
|
686
690
|
variant: "link",
|
|
687
691
|
size: "sm",
|
|
688
|
-
onClick:
|
|
689
|
-
children:
|
|
692
|
+
onClick: $e,
|
|
693
|
+
children: h("calendar.clear")
|
|
690
694
|
}
|
|
691
695
|
),
|
|
692
696
|
/* @__PURE__ */ c(
|
|
693
|
-
|
|
697
|
+
R,
|
|
694
698
|
{
|
|
695
699
|
variant: "outline",
|
|
696
700
|
size: "sm",
|
|
697
|
-
onClick:
|
|
698
|
-
children:
|
|
701
|
+
onClick: Pe,
|
|
702
|
+
children: h("calendar.cancel")
|
|
699
703
|
}
|
|
700
704
|
),
|
|
701
705
|
/* @__PURE__ */ c(
|
|
702
|
-
|
|
706
|
+
R,
|
|
703
707
|
{
|
|
704
708
|
variant: "default",
|
|
705
709
|
size: "sm",
|
|
706
|
-
onClick:
|
|
707
|
-
children:
|
|
710
|
+
onClick: Ee,
|
|
711
|
+
children: h("calendar.apply")
|
|
708
712
|
}
|
|
709
713
|
)
|
|
710
714
|
] })
|
|
711
715
|
] })
|
|
712
716
|
] });
|
|
713
717
|
}
|
|
714
|
-
function
|
|
718
|
+
function Ge({
|
|
715
719
|
className: ae,
|
|
716
|
-
day:
|
|
717
|
-
modifiers:
|
|
718
|
-
pickerType:
|
|
719
|
-
...
|
|
720
|
+
day: G,
|
|
721
|
+
modifiers: y,
|
|
722
|
+
pickerType: J,
|
|
723
|
+
...B
|
|
720
724
|
}) {
|
|
721
|
-
const Q =
|
|
722
|
-
return
|
|
723
|
-
|
|
724
|
-
}, [
|
|
725
|
-
|
|
725
|
+
const Q = d.useRef(null);
|
|
726
|
+
return d.useEffect(() => {
|
|
727
|
+
y.focused && Q.current?.focus();
|
|
728
|
+
}, [y.focused]), /* @__PURE__ */ c(
|
|
729
|
+
R,
|
|
726
730
|
{
|
|
727
731
|
ref: Q,
|
|
728
732
|
variant: "ghost",
|
|
729
733
|
size: "sm",
|
|
730
|
-
"data-day":
|
|
731
|
-
"data-selected-single":
|
|
732
|
-
"data-range-start":
|
|
733
|
-
"data-range-end":
|
|
734
|
-
"data-range-middle":
|
|
735
|
-
className:
|
|
734
|
+
"data-day": G.date.toLocaleDateString(),
|
|
735
|
+
"data-selected-single": y.selected && !y.range_start && !y.range_end && !y.range_middle,
|
|
736
|
+
"data-range-start": y.range_start,
|
|
737
|
+
"data-range-end": y.range_end,
|
|
738
|
+
"data-range-middle": y.range_middle,
|
|
739
|
+
className: f(
|
|
736
740
|
"gap-2 whitespace-nowrap focus-visible:ring-1 focus-visible:ring-focus-ring disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 px-3 rounded-lg flex items-center justify-center font-normal transition-colors w-5 h-5 border border-transparent focus-visible:outline-none text-sm rdp-day rdp-day_button",
|
|
737
741
|
// Hover styling
|
|
738
|
-
|
|
739
|
-
|
|
742
|
+
J !== "week" && "hover:bg-accent hover:text-accent-foreground hover:border-brand",
|
|
743
|
+
J === "week" && "hover:bg-transparent hover:text-inherit hover:border-transparent",
|
|
740
744
|
// Selection state
|
|
741
745
|
"data-[selected-single=true]:bg-brand data-[selected-single=true]:text-brand-foreground data-[selected-single=true]:rounded-lg data-[selected-single=true]:border-transparent",
|
|
742
746
|
"data-[range-start=true]:bg-brand data-[range-start=true]:text-brand-foreground data-[range-start=true]:rounded-lg data-[range-start=true]:border-transparent",
|
|
@@ -745,12 +749,12 @@ function Je({
|
|
|
745
749
|
ae
|
|
746
750
|
),
|
|
747
751
|
"data-component": "calendar-day",
|
|
748
|
-
...
|
|
749
|
-
disabled:
|
|
752
|
+
...B,
|
|
753
|
+
disabled: B.disabled || y.disabled
|
|
750
754
|
}
|
|
751
755
|
);
|
|
752
756
|
}
|
|
753
757
|
export {
|
|
754
|
-
|
|
755
|
-
|
|
758
|
+
at as Calendar,
|
|
759
|
+
Ge as CalendarDayButton
|
|
756
760
|
};
|