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