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