impact-nova 2.5.7 → 2.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +2 -2
- package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +4 -2
- package/dist/components/data/ag-grid-react/headers/header-search-input.js +65 -65
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +55 -48
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +80 -61
- package/dist/components/data-display/calendar/calendar-config.d.ts +13 -5
- package/dist/components/data-display/calendar/calendar-config.js +31 -20
- package/dist/components/data-display/calendar/calendar-day-button.js +43 -35
- package/dist/components/data-display/calendar/calendar-day-hover.d.ts +8 -0
- package/dist/components/data-display/calendar/calendar-day-hover.js +20 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +8 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +40 -20
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +12 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +201 -108
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +136 -92
- package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +90 -0
- package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
- package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
- package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
- package/dist/components/data-display/calendar/calendar-footer.js +88 -66
- package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
- package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
- package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
- package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
- package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
- package/dist/components/data-display/calendar/calendar-selection.js +31 -0
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
- package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
- package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-week-utils.js +49 -42
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
- package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
- package/dist/components/data-display/calendar/calendar.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar.js +303 -181
- package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
- package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
- package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
- package/dist/components/data-display/calendar/index.d.ts +1 -1
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +31 -11
- package/dist/components/data-display/calendar/use-calendar-state.js +370 -163
- package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
- package/dist/components/data-display/calendar/use-fiscal-calendar.js +24 -0
- package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
- package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
- package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
- package/dist/components/forms/date-picker/date-picker.js +187 -167
- package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
- package/dist/components/forms/date-picker/date-range-picker.js +273 -224
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
- package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
- package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
- package/dist/components/forms/date-picker/index.d.ts +12 -0
- package/dist/components/forms/date-picker/index.js +19 -7
- package/dist/components/forms/date-picker/month-picker.js +225 -182
- package/dist/components/forms/date-picker/month-range-picker.js +134 -110
- package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
- package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
- package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
- package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
- package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
- package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-picker.js +176 -0
- package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
- package/dist/components/forms/date-picker/week-picker.js +148 -137
- package/dist/components/forms/date-picker/week-range-picker.js +216 -205
- package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-picker.js +176 -0
- package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-range-picker.js +179 -0
- package/dist/form-react/Fields/DateInputField.js +63 -58
- package/dist/form-react/Fields/DateRangeField.js +42 -37
- package/dist/form-react/Fields/MonthRangeField.js +50 -45
- package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
- package/dist/form-react/Fields/WeekRangePicker.js +44 -45
- package/dist/form-react/components/FieldRenderer.js +21 -23
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
- package/dist/form-react/registry/defaultFieldRegistrations.js +27 -36
- package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
- package/dist/form-react/registry/resolveFieldComponent.js +9 -133
- package/dist/form-react/types/fields.types.d.ts +19 -4
- package/dist/form-react/utils/date.utils.d.ts +1 -1
- package/dist/form-react/utils/date.utils.js +38 -38
- package/dist/i18n/defaultMessages.d.ts +19 -1
- package/dist/i18n/defaultMessages.js +37 -20
- package/dist/i18n/locales/de.js +18 -1
- package/dist/i18n/locales/es.js +18 -1
- package/dist/i18n/locales/hi.js +18 -1
- package/dist/i18n/locales/kn.js +18 -1
- package/dist/impact-nova-components.css +379 -3
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +528 -516
- package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
- package/dist/lib/fiscal-calendar/build-year.js +173 -0
- package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
- package/dist/lib/fiscal-calendar/civil-date.js +94 -0
- package/dist/lib/fiscal-calendar/index.d.ts +10 -0
- package/dist/lib/fiscal-calendar/index.js +40 -0
- package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
- package/dist/lib/fiscal-calendar/lookup.js +70 -0
- package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
- package/dist/lib/fiscal-calendar/presets.js +99 -0
- package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
- package/dist/lib/fiscal-calendar/selection.js +32 -0
- package/dist/lib/fiscal-calendar/types.d.ts +145 -0
- package/dist/lib/fiscal-calendar/types.js +10 -0
- package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
- package/dist/lib/fiscal-calendar/week-selection.js +107 -0
- package/package.json +5 -1
- package/dist/lib/fiscal-calendar.d.ts +0 -62
- package/dist/lib/fiscal-calendar.js +0 -99
|
@@ -1,109 +1,108 @@
|
|
|
1
1
|
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronRight as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Select as
|
|
6
|
-
import { isMonthRangeSelection as
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { ChevronRight as g } from "impact-nova-icons";
|
|
3
|
+
import { cn as A } from "../../../lib/utils.js";
|
|
4
|
+
import { Button as f } from "../../primitives/button/button.js";
|
|
5
|
+
import { Select as D } from "../../forms/select/select.js";
|
|
6
|
+
import { isMonthRangeSelection as F } from "../../forms/date-picker/calendar-selection-adapters.js";
|
|
7
|
+
import { CalendarPeriodCell as G } from "./calendar-period-cell.js";
|
|
8
|
+
function Z({
|
|
9
|
+
yearOffset: o = 0,
|
|
9
10
|
displayYear: e,
|
|
10
|
-
monthMode:
|
|
11
|
-
monthsShort:
|
|
11
|
+
monthMode: s,
|
|
12
|
+
monthsShort: u,
|
|
12
13
|
showFooter: p,
|
|
13
|
-
pendingMonthSelection:
|
|
14
|
-
selectedMonths:
|
|
15
|
-
resolvedStartYear:
|
|
16
|
-
resolvedEndYear:
|
|
17
|
-
yearOptions:
|
|
18
|
-
previousYearLabel:
|
|
19
|
-
nextYearLabel:
|
|
20
|
-
isMonthSelected:
|
|
21
|
-
getMonthRangeProps:
|
|
22
|
-
isMonthDisabled:
|
|
23
|
-
onPreviousYear:
|
|
24
|
-
onNextYear:
|
|
25
|
-
onYearSelect:
|
|
26
|
-
onMonthClick:
|
|
14
|
+
pendingMonthSelection: v,
|
|
15
|
+
selectedMonths: N,
|
|
16
|
+
resolvedStartYear: x,
|
|
17
|
+
resolvedEndYear: C,
|
|
18
|
+
yearOptions: l,
|
|
19
|
+
previousYearLabel: a,
|
|
20
|
+
nextYearLabel: r,
|
|
21
|
+
isMonthSelected: S,
|
|
22
|
+
getMonthRangeProps: k,
|
|
23
|
+
isMonthDisabled: w,
|
|
24
|
+
onPreviousYear: j,
|
|
25
|
+
onNextYear: z,
|
|
26
|
+
onYearSelect: b,
|
|
27
|
+
onMonthClick: R,
|
|
28
|
+
periodLabels: i
|
|
27
29
|
}) {
|
|
28
30
|
return /* @__PURE__ */ d("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
|
|
29
31
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
o === 0 ? /* @__PURE__ */ t(
|
|
33
|
+
f,
|
|
32
34
|
{
|
|
33
35
|
variant: "ghost",
|
|
34
36
|
size: "icon",
|
|
35
37
|
className: "h-7 w-7 shrink-0",
|
|
36
|
-
"aria-label":
|
|
37
|
-
title:
|
|
38
|
-
disabled: e <=
|
|
39
|
-
onClick: () =>
|
|
40
|
-
children: /* @__PURE__ */ t(
|
|
38
|
+
"aria-label": a,
|
|
39
|
+
title: a,
|
|
40
|
+
disabled: e <= x,
|
|
41
|
+
onClick: () => j(e),
|
|
42
|
+
children: /* @__PURE__ */ t(g, { size: 16, className: "rotate-180" })
|
|
41
43
|
}
|
|
42
44
|
) : /* @__PURE__ */ t("span", { className: "size-7 shrink-0", "aria-hidden": !0 }),
|
|
43
45
|
/* @__PURE__ */ t("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ t(
|
|
44
|
-
|
|
46
|
+
D,
|
|
45
47
|
{
|
|
46
|
-
value:
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
value: l.find((n) => n.value === e.toString()) ?? {
|
|
49
|
+
label: e.toString(),
|
|
50
|
+
value: e.toString()
|
|
51
|
+
},
|
|
52
|
+
onChange: (n) => {
|
|
53
|
+
n && "value" in n && b(parseInt(n.value), o);
|
|
49
54
|
},
|
|
50
55
|
scrollToSelectedOnOpen: !0,
|
|
51
|
-
options:
|
|
56
|
+
options: l,
|
|
52
57
|
parentClassName: "flex items-center justify-center",
|
|
53
58
|
className: "w-[200px]",
|
|
54
59
|
menuWidth: "140px"
|
|
55
60
|
}
|
|
56
61
|
) }),
|
|
57
|
-
(
|
|
58
|
-
|
|
62
|
+
(s === "single" || o === 1) && /* @__PURE__ */ t(
|
|
63
|
+
f,
|
|
59
64
|
{
|
|
60
65
|
variant: "ghost",
|
|
61
66
|
size: "icon",
|
|
62
67
|
className: "h-7 w-7",
|
|
63
|
-
"aria-label":
|
|
64
|
-
title:
|
|
65
|
-
disabled: e >=
|
|
66
|
-
onClick: () =>
|
|
67
|
-
children: /* @__PURE__ */ t(
|
|
68
|
+
"aria-label": r,
|
|
69
|
+
title: r,
|
|
70
|
+
disabled: e >= C,
|
|
71
|
+
onClick: () => z(e),
|
|
72
|
+
children: /* @__PURE__ */ t(g, { className: "h-4 w-4" })
|
|
68
73
|
}
|
|
69
74
|
)
|
|
70
75
|
] }),
|
|
71
|
-
/* @__PURE__ */ t(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
),
|
|
100
|
-
children: r
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
|
-
] }, r);
|
|
104
|
-
}) })
|
|
76
|
+
/* @__PURE__ */ t(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-period-grid": "",
|
|
80
|
+
className: A("grid gap-x-0 gap-y-4", i ? "grid-cols-3" : "grid-cols-4"),
|
|
81
|
+
children: (i ?? u.map((n) => ({ label: n }))).map((n, c) => {
|
|
82
|
+
const m = n.label, P = S(e, c), { isStart: E, isEnd: M, isMiddle: T } = k(e, c), B = s === "range", h = p ? v : N, I = F(h) && !!h.to, W = w(e, c), q = "caption" in n && typeof n.caption == "string" ? n.caption : void 0;
|
|
83
|
+
return /* @__PURE__ */ t(
|
|
84
|
+
G,
|
|
85
|
+
{
|
|
86
|
+
selected: P,
|
|
87
|
+
disabled: W,
|
|
88
|
+
isRange: B,
|
|
89
|
+
isStart: E,
|
|
90
|
+
isEnd: M,
|
|
91
|
+
isMiddle: T,
|
|
92
|
+
hasRangeEnd: I,
|
|
93
|
+
size: i ? "period" : "month",
|
|
94
|
+
columns: i ? 3 : 4,
|
|
95
|
+
onClick: () => R(e, c),
|
|
96
|
+
caption: q,
|
|
97
|
+
children: m
|
|
98
|
+
},
|
|
99
|
+
m
|
|
100
|
+
);
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
)
|
|
105
104
|
] });
|
|
106
105
|
}
|
|
107
106
|
export {
|
|
108
|
-
|
|
107
|
+
Z as CalendarMonthPickerPanel
|
|
109
108
|
};
|
|
@@ -8,6 +8,8 @@ export declare function getMonthRangeProps(year: number, month: number, currentS
|
|
|
8
8
|
isEnd: boolean;
|
|
9
9
|
isMiddle: boolean;
|
|
10
10
|
};
|
|
11
|
+
/** True when the interval lies completely outside `disabled.before` / `disabled.after`. */
|
|
12
|
+
export declare function isDateIntervalDisabled(start: Date, end: Date, disabled?: unknown): boolean;
|
|
11
13
|
export declare function isMonthDisabled(year: number, monthIndex: number, disabled?: unknown): boolean;
|
|
12
14
|
export declare function getAvailableYears(startMonth: Date, endMonth: Date): Option[];
|
|
13
15
|
export declare function getAvailableMonths(year: number, monthsFull: string[], startMonth: Date, endMonth: Date): Option[];
|
|
@@ -1,88 +1,97 @@
|
|
|
1
|
-
import { isMonthRangeSelection as
|
|
2
|
-
function l(
|
|
3
|
-
return
|
|
1
|
+
import { isMonthRangeSelection as d } from "../../forms/date-picker/calendar-selection-adapters.js";
|
|
2
|
+
function l(e, n) {
|
|
3
|
+
return e.fy != null && n.fy != null && e.period != null && n.period != null ? e.fy === n.fy && e.period === n.period : e.year === n.year && e.month === n.month;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
if (
|
|
8
|
-
const
|
|
9
|
-
return
|
|
5
|
+
function g(e, n, o) {
|
|
6
|
+
if (o === "single") return e;
|
|
7
|
+
if (o === "multiple") {
|
|
8
|
+
const a = n || [];
|
|
9
|
+
return a.some((f) => l(f, e)) ? a.filter((f) => !l(f, e)) : [...a, e];
|
|
10
10
|
}
|
|
11
|
-
const t =
|
|
12
|
-
if (!t?.from || t.to) return { from:
|
|
11
|
+
const t = n;
|
|
12
|
+
if (!t?.from || t.to) return { from: e };
|
|
13
13
|
const s = new Date(t.from.year, t.from.month, 1);
|
|
14
|
-
return new Date(
|
|
14
|
+
return new Date(e.year, e.month, 1) < s ? { from: e, to: t.from } : { from: t.from, to: e };
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
if (!
|
|
18
|
-
if (Array.isArray(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
25
|
-
const i = new Date(
|
|
26
|
-
if (!
|
|
27
|
-
const
|
|
28
|
-
|
|
16
|
+
function m(e, n, o) {
|
|
17
|
+
if (!o) return !1;
|
|
18
|
+
if (Array.isArray(o)) {
|
|
19
|
+
const s = { year: e, month: n, fy: e, period: n + 1 };
|
|
20
|
+
return o.some((r) => l(r, s) || r.year === e && r.month === n);
|
|
21
|
+
}
|
|
22
|
+
if (d(o)) {
|
|
23
|
+
const s = o, r = s.from, a = s.to;
|
|
24
|
+
if (!r && !a) return !1;
|
|
25
|
+
const i = new Date(e, n, 1).getTime();
|
|
26
|
+
if (!r) return a ? i === new Date(a.year, a.month, 1).getTime() : !1;
|
|
27
|
+
const f = new Date(r.year, r.month, 1).getTime();
|
|
28
|
+
if (!a) return i === f;
|
|
29
|
+
const u = new Date(a.year, a.month, 1).getTime();
|
|
30
|
+
return i >= f && i <= u;
|
|
29
31
|
}
|
|
30
|
-
const t =
|
|
31
|
-
return t.year ===
|
|
32
|
+
const t = o;
|
|
33
|
+
return t.fy != null && t.period != null ? t.fy === e && t.period === n + 1 : t.year === e && t.month === n;
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
if (!
|
|
35
|
+
function y(e, n, o) {
|
|
36
|
+
if (!o || !("from" in o))
|
|
35
37
|
return { isStart: !1, isEnd: !1, isMiddle: !1 };
|
|
36
|
-
const t =
|
|
37
|
-
if (!s && !
|
|
38
|
-
const
|
|
38
|
+
const t = o, s = t.from, r = t.to;
|
|
39
|
+
if (!s && !r) return { isStart: !1, isEnd: !1, isMiddle: !1 };
|
|
40
|
+
const a = new Date(e, n, 1).getTime();
|
|
39
41
|
if (!s)
|
|
40
42
|
return {
|
|
41
43
|
isStart: !1,
|
|
42
|
-
isEnd:
|
|
44
|
+
isEnd: r ? a === new Date(r.year, r.month, 1).getTime() : !1,
|
|
43
45
|
isMiddle: !1
|
|
44
46
|
};
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const
|
|
47
|
+
const i = new Date(s.year, s.month, 1).getTime();
|
|
48
|
+
if (!r) return { isStart: a === i, isEnd: !1, isMiddle: !1 };
|
|
49
|
+
const f = new Date(r.year, r.month, 1).getTime();
|
|
48
50
|
return {
|
|
49
|
-
isStart:
|
|
50
|
-
isEnd:
|
|
51
|
-
isMiddle:
|
|
51
|
+
isStart: a === i,
|
|
52
|
+
isEnd: a === f,
|
|
53
|
+
isMiddle: a > i && a < f
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
function
|
|
55
|
-
const t =
|
|
56
|
+
function D(e, n, o) {
|
|
57
|
+
const t = o;
|
|
56
58
|
if (!t || typeof t != "object" || !("before" in t) && !("after" in t)) return !1;
|
|
57
|
-
const s = new Date(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const s = new Date(e);
|
|
60
|
+
s.setHours(0, 0, 0, 0);
|
|
61
|
+
const r = new Date(n);
|
|
62
|
+
if (r.setHours(23, 59, 59, 999), t.before) {
|
|
63
|
+
const a = new Date(t.before);
|
|
64
|
+
if (a.setHours(0, 0, 0, 0), r < a) return !0;
|
|
61
65
|
}
|
|
62
66
|
if (t.after) {
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
67
|
+
const a = new Date(t.after);
|
|
68
|
+
if (a.setHours(23, 59, 59, 999), s > a) return !0;
|
|
65
69
|
}
|
|
66
70
|
return !1;
|
|
67
71
|
}
|
|
68
|
-
function w(
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
function w(e, n, o) {
|
|
73
|
+
const t = new Date(e, n, 1, 0, 0, 0, 0), s = new Date(e, n + 1, 0, 23, 59, 59, 999);
|
|
74
|
+
return D(t, s, o);
|
|
75
|
+
}
|
|
76
|
+
function h(e, n) {
|
|
77
|
+
const o = e.getFullYear(), t = n.getFullYear(), s = [];
|
|
78
|
+
for (let r = o; r <= t; r++)
|
|
79
|
+
s.push({ label: r.toString(), value: r.toString() });
|
|
72
80
|
return s;
|
|
73
81
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
76
|
-
const
|
|
77
|
-
return !(
|
|
82
|
+
function p(e, n, o, t) {
|
|
83
|
+
return n.map((s, r) => ({ label: s, value: r.toString() })).filter((s, r) => {
|
|
84
|
+
const a = new Date(e, r, 1);
|
|
85
|
+
return !(a < new Date(o.getFullYear(), o.getMonth(), 1) || a > new Date(t.getFullYear(), t.getMonth(), 1));
|
|
78
86
|
});
|
|
79
87
|
}
|
|
80
88
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
p as getAvailableMonths,
|
|
90
|
+
h as getAvailableYears,
|
|
91
|
+
y as getMonthRangeProps,
|
|
92
|
+
D as isDateIntervalDisabled,
|
|
93
|
+
w as isMonthDisabled,
|
|
94
|
+
m as isMonthSelected,
|
|
86
95
|
l as isSameMonth,
|
|
87
|
-
|
|
96
|
+
g as nextMonthSelection
|
|
88
97
|
};
|
|
@@ -3,3 +3,18 @@ export declare function isCalendarPaddingWeek(week: {
|
|
|
3
3
|
outside?: boolean;
|
|
4
4
|
}>;
|
|
5
5
|
}): boolean;
|
|
6
|
+
export declare function weekHasInMonthSelection(week: {
|
|
7
|
+
days: Array<{
|
|
8
|
+
date: Date;
|
|
9
|
+
outside?: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
}, isSelected?: (date: Date) => boolean): boolean;
|
|
12
|
+
export declare function weekIntervalContinues(week: {
|
|
13
|
+
days: Array<{
|
|
14
|
+
date: Date;
|
|
15
|
+
outside?: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
}, isSelected?: (date: Date) => boolean): {
|
|
18
|
+
prev: boolean;
|
|
19
|
+
next: boolean;
|
|
20
|
+
};
|
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function l(t) {
|
|
2
|
+
return t.days.length > 0 && t.days.every((n) => n.outside);
|
|
3
|
+
}
|
|
4
|
+
function d(t, n) {
|
|
5
|
+
return n ? t.days.some((e) => !e.outside && n(e.date)) : !1;
|
|
6
|
+
}
|
|
7
|
+
function i(t, n) {
|
|
8
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate() + n);
|
|
9
|
+
}
|
|
10
|
+
function u(t, n) {
|
|
11
|
+
return t.getFullYear() !== n.getFullYear() || t.getMonth() !== n.getMonth();
|
|
12
|
+
}
|
|
13
|
+
function g(t, n) {
|
|
14
|
+
if (!n) return { prev: !1, next: !1 };
|
|
15
|
+
const e = t.days.filter((f) => !f.outside), o = e[0]?.date, r = e.at(-1)?.date, a = o ? i(o, -1) : void 0, s = r ? i(r, 1) : void 0;
|
|
16
|
+
return {
|
|
17
|
+
prev: !!(a && o && u(a, o) && n(a)),
|
|
18
|
+
next: !!(s && r && u(s, r) && n(s))
|
|
19
|
+
};
|
|
3
20
|
}
|
|
4
21
|
export {
|
|
5
|
-
|
|
22
|
+
l as isCalendarPaddingWeek,
|
|
23
|
+
d as weekHasInMonthSelection,
|
|
24
|
+
g as weekIntervalContinues
|
|
6
25
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type PeriodCellSize = "month" | "period" | "quarter" | "year" | "year-caption";
|
|
3
|
+
export interface CalendarPeriodCellProps {
|
|
4
|
+
selected: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
isRange?: boolean;
|
|
7
|
+
isStart?: boolean;
|
|
8
|
+
isEnd?: boolean;
|
|
9
|
+
isMiddle?: boolean;
|
|
10
|
+
hasRangeEnd?: boolean;
|
|
11
|
+
size: PeriodCellSize;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
caption?: string;
|
|
16
|
+
columns?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function CalendarPeriodCell({ selected, disabled, isRange, isStart, isEnd, isMiddle, hasRangeEnd, size, onClick, onKeyDown, children, caption, columns, }: CalendarPeriodCellProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs as s, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as e } from "../../../lib/utils.js";
|
|
4
|
+
import { Button as N } from "../../primitives/button/button.js";
|
|
5
|
+
import { intervalCaptionClassName as v } from "./calendar-interval-caption.js";
|
|
6
|
+
import { SELECTION_RADIUS_END as g, SELECTION_RADIUS_START as T, SELECTION_RADIUS as I, periodRangeTrackClassName as j, periodTileAppearanceClassName as A } from "./calendar-selection-appearance.js";
|
|
7
|
+
import { periodCellKind as D } from "./calendar-selection.js";
|
|
8
|
+
import { handlePeriodGridKeyDown as S } from "./calendar-period-keyboard.js";
|
|
9
|
+
const _ = {
|
|
10
|
+
month: "h-10 w-10",
|
|
11
|
+
period: "min-h-16 h-auto w-full flex-col items-center justify-center px-1 py-1",
|
|
12
|
+
quarter: "h-16 min-h-16 max-h-16 w-full min-w-0 flex-col items-center justify-center overflow-hidden whitespace-normal p-2 leading-tight",
|
|
13
|
+
year: "h-10 min-h-10 max-h-10 w-full min-w-0 overflow-hidden",
|
|
14
|
+
"year-caption": "h-16 min-h-16 max-h-16 w-full min-w-0 flex-col items-center justify-center gap-0.5 overflow-hidden whitespace-normal p-2 text-xs leading-tight"
|
|
15
|
+
};
|
|
16
|
+
function P({
|
|
17
|
+
selected: u,
|
|
18
|
+
disabled: n = !1,
|
|
19
|
+
isRange: i = !1,
|
|
20
|
+
isStart: t = !1,
|
|
21
|
+
isEnd: r = !1,
|
|
22
|
+
isMiddle: o = !1,
|
|
23
|
+
hasRangeEnd: d = !1,
|
|
24
|
+
size: l,
|
|
25
|
+
onClick: w,
|
|
26
|
+
onKeyDown: x,
|
|
27
|
+
children: y,
|
|
28
|
+
caption: m,
|
|
29
|
+
columns: f
|
|
30
|
+
}) {
|
|
31
|
+
const a = D({ selected: u, isRange: i, isStart: t, isEnd: r, isMiddle: o }), C = i && d && (o || t || r) && !n, c = l === "month";
|
|
32
|
+
return /* @__PURE__ */ s(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: e(
|
|
36
|
+
"group relative flex w-full items-center justify-center",
|
|
37
|
+
l === "period" || l === "quarter" || l === "year-caption" ? "min-h-16" : "h-10"
|
|
38
|
+
),
|
|
39
|
+
children: [
|
|
40
|
+
C ? /* @__PURE__ */ p(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: e(
|
|
44
|
+
"absolute inset-y-0",
|
|
45
|
+
j,
|
|
46
|
+
t && r && e("inset-x-2", I),
|
|
47
|
+
t && !r && e("left-1/2 right-0", c && "-ml-5", T),
|
|
48
|
+
r && !t && e("right-1/2 left-0", c && "-mr-5", g),
|
|
49
|
+
o && "inset-x-0"
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
) : null,
|
|
53
|
+
/* @__PURE__ */ s(
|
|
54
|
+
N,
|
|
55
|
+
{
|
|
56
|
+
variant: "ghost",
|
|
57
|
+
onClick: w,
|
|
58
|
+
onKeyDown: (h) => {
|
|
59
|
+
f && S(h, f), x?.(h);
|
|
60
|
+
},
|
|
61
|
+
disabled: n,
|
|
62
|
+
"data-selection": a,
|
|
63
|
+
"data-period-tile": "",
|
|
64
|
+
className: e(
|
|
65
|
+
A({ kind: a, disabled: n }),
|
|
66
|
+
_[l]
|
|
67
|
+
),
|
|
68
|
+
children: [
|
|
69
|
+
y,
|
|
70
|
+
m ? /* @__PURE__ */ p(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
"data-slot": "interval-caption",
|
|
74
|
+
className: v(
|
|
75
|
+
a === "point" || a === "interval-start" || a === "interval-end"
|
|
76
|
+
),
|
|
77
|
+
children: m
|
|
78
|
+
}
|
|
79
|
+
) : null
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
P as CalendarPeriodCell
|
|
89
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function d(r, t, n, i) {
|
|
2
|
+
for (let o = t; i(o); o += n)
|
|
3
|
+
if (!r[o].disabled) return o;
|
|
4
|
+
}
|
|
5
|
+
function y(r, t) {
|
|
6
|
+
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(r.key))
|
|
7
|
+
return;
|
|
8
|
+
const n = r.currentTarget.closest("[data-period-grid]");
|
|
9
|
+
if (!n) return;
|
|
10
|
+
const i = Array.from(n.querySelectorAll("button")), o = i.indexOf(r.currentTarget);
|
|
11
|
+
if (o < 0) return;
|
|
12
|
+
const w = (f) => f >= 0 && f < i.length, a = Math.floor(o / t) * t, l = Math.min(i.length - 1, a + t - 1);
|
|
13
|
+
let e;
|
|
14
|
+
r.key === "ArrowRight" && (e = d(i, o + 1, 1, w)), r.key === "ArrowLeft" && (e = d(i, o - 1, -1, w)), r.key === "ArrowDown" && (e = d(i, o + t, t, w)), r.key === "ArrowUp" && (e = d(i, o - t, -t, w)), r.key === "Home" && (e = d(i, a, 1, (f) => f <= l)), r.key === "End" && (e = d(i, l, -1, (f) => f >= a)), e !== void 0 && e !== o && (r.preventDefault(), i[e]?.focus());
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
y as handlePeriodGridKeyDown
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FiscalPreset } from '../../../lib/fiscal-calendar';
|
|
2
|
+
export interface CalendarPresetStripProps {
|
|
3
|
+
presets: FiscalPreset[];
|
|
4
|
+
onPresetSelect: (preset: FiscalPreset) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function CalendarPresetStrip({ presets, onPresetSelect }: CalendarPresetStripProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Button as l } from "../../primitives/button/button.js";
|
|
3
|
+
function o({ presets: e, onPresetSelect: a }) {
|
|
4
|
+
return e.length === 0 ? null : /* @__PURE__ */ t(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
"data-slot": "preset-strip",
|
|
8
|
+
className: "flex max-w-[360px] flex-wrap gap-1 border-b border-border px-3 py-2",
|
|
9
|
+
"aria-label": "Presets",
|
|
10
|
+
children: e.map((r) => /* @__PURE__ */ t(
|
|
11
|
+
l,
|
|
12
|
+
{
|
|
13
|
+
type: "button",
|
|
14
|
+
variant: "outline",
|
|
15
|
+
size: "sm",
|
|
16
|
+
onClick: () => a(r),
|
|
17
|
+
children: r.label
|
|
18
|
+
},
|
|
19
|
+
r.id
|
|
20
|
+
))
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
o as CalendarPresetStrip
|
|
26
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Option } from '../../forms/select';
|
|
2
|
+
import { QuarterRange, QuarterSelection } from './calendar.types';
|
|
3
|
+
export interface CalendarQuarterPanesProps {
|
|
4
|
+
quarterMode: "single" | "multiple" | "range" | "multi-range";
|
|
5
|
+
pickerYear: number;
|
|
6
|
+
showFooter: boolean;
|
|
7
|
+
pendingQuarterSelection?: QuarterSelection | QuarterSelection[] | QuarterRange;
|
|
8
|
+
selectedQuarters?: QuarterSelection | QuarterSelection[] | QuarterRange;
|
|
9
|
+
resolvedStartYear: number;
|
|
10
|
+
resolvedEndYear: number;
|
|
11
|
+
yearOptions: Option[];
|
|
12
|
+
previousYearLabel: string;
|
|
13
|
+
nextYearLabel: string;
|
|
14
|
+
currentMonth: Date;
|
|
15
|
+
quarterLabelsForYear: (year: number) => Array<{
|
|
16
|
+
label: string;
|
|
17
|
+
caption?: string;
|
|
18
|
+
}>;
|
|
19
|
+
isQuarterSelected: (year: number, quarter: 1 | 2 | 3 | 4) => boolean;
|
|
20
|
+
isQuarterDisabled: (year: number, quarter: 1 | 2 | 3 | 4) => boolean;
|
|
21
|
+
onMonthChange: (month: Date) => void;
|
|
22
|
+
onQuarterClick: (year: number, quarter: 1 | 2 | 3 | 4) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function CalendarQuarterPanes({ quarterMode, pickerYear, showFooter, pendingQuarterSelection, selectedQuarters, resolvedStartYear, resolvedEndYear, yearOptions, previousYearLabel, nextYearLabel, currentMonth, quarterLabelsForYear, isQuarterSelected, isQuarterDisabled, onMonthChange, onQuarterClick, }: CalendarQuarterPanesProps): import("react/jsx-runtime").JSX.Element;
|