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