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