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