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