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,31 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { civilFromLocalDate as m } from "../../../lib/fiscal-calendar/civil-date.js";
|
|
2
|
+
import { resolveWeekSelection as T } from "../../../lib/fiscal-calendar/week-selection.js";
|
|
3
|
+
function A(t, n) {
|
|
4
|
+
const o = t.days.find((e) => !e.outside)?.date ?? t.days[0]?.date;
|
|
5
|
+
if (o)
|
|
6
|
+
return n?.(o)?.fiscalPeriod;
|
|
4
7
|
}
|
|
5
|
-
function
|
|
8
|
+
function d(t, n) {
|
|
9
|
+
return t.year === n.year && t.month === n.month && t.weekOfMonth === n.weekOfMonth;
|
|
10
|
+
}
|
|
11
|
+
function _(t, n) {
|
|
6
12
|
const o = t instanceof Date ? t : t.days.find((e) => !e.outside)?.date ?? t.days[0]?.date ?? /* @__PURE__ */ new Date();
|
|
7
|
-
return T(o,
|
|
13
|
+
return T(o, n);
|
|
8
14
|
}
|
|
9
|
-
function
|
|
15
|
+
function E(t, n, o) {
|
|
10
16
|
if (o === "single") return t;
|
|
11
17
|
if (o === "multiple") {
|
|
12
|
-
const
|
|
13
|
-
return
|
|
18
|
+
const a = n || [];
|
|
19
|
+
return a.some((f) => d(f, t)) ? a.filter((f) => !d(f, t)) : [...a, t];
|
|
14
20
|
}
|
|
15
|
-
const e =
|
|
21
|
+
const e = n;
|
|
16
22
|
if (!e?.from || e.to) return { from: t };
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
return t.startDate < e.from.startDate && (
|
|
23
|
+
if (d(t, e.from)) return e;
|
|
24
|
+
const s = { from: e.from, to: t };
|
|
25
|
+
return t.startDate < e.from.startDate && (s.from = t, s.to = e.from), s;
|
|
20
26
|
}
|
|
21
|
-
function
|
|
27
|
+
function x(t) {
|
|
22
28
|
if (!t) return;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
for (
|
|
28
|
-
|
|
29
|
+
const n = [], o = (e) => {
|
|
30
|
+
const s = new Date(e.startDate);
|
|
31
|
+
s.setHours(0, 0, 0, 0);
|
|
32
|
+
const a = new Date(e.endDate);
|
|
33
|
+
for (a.setHours(0, 0, 0, 0); s <= a; )
|
|
34
|
+
n.push(new Date(s)), s.setDate(s.getDate() + 1);
|
|
29
35
|
};
|
|
30
36
|
if (Array.isArray(t))
|
|
31
37
|
t.forEach(o);
|
|
@@ -36,39 +42,40 @@ function _(t) {
|
|
|
36
42
|
else {
|
|
37
43
|
const e = new Date(t.from.startDate);
|
|
38
44
|
e.setHours(0, 0, 0, 0);
|
|
39
|
-
const
|
|
40
|
-
for (
|
|
41
|
-
|
|
45
|
+
const s = new Date(t.to.endDate);
|
|
46
|
+
for (s.setHours(0, 0, 0, 0); e <= s; )
|
|
47
|
+
n.push(new Date(e)), e.setDate(e.getDate() + 1);
|
|
42
48
|
}
|
|
43
49
|
} else
|
|
44
50
|
o(t);
|
|
45
|
-
return
|
|
51
|
+
return n;
|
|
46
52
|
}
|
|
47
|
-
function
|
|
53
|
+
function H(t, n, o) {
|
|
48
54
|
if (!t || t.length === 0)
|
|
49
55
|
return { range_start: [], range_middle: [], range_end: [] };
|
|
50
|
-
const e = [...t].sort((r,
|
|
51
|
-
|
|
52
|
-
f.add(r.startDate
|
|
56
|
+
const e = [...t].sort((r, i) => r.getTime() - i.getTime()), s = [], a = [], u = [], f = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
57
|
+
n === "multiple" && Array.isArray(o) && o.forEach((r) => {
|
|
58
|
+
f.add(m(r.startDate)), l.add(m(r.endDate));
|
|
53
59
|
});
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const c = e[
|
|
60
|
+
const p = (r, i) => {
|
|
61
|
+
if (i === 0) return !1;
|
|
62
|
+
const c = e[i - 1];
|
|
57
63
|
return r.getTime() - c.getTime() <= 1440 * 60 * 1e3;
|
|
58
|
-
},
|
|
59
|
-
return e.forEach((r,
|
|
60
|
-
const c = r
|
|
61
|
-
if (
|
|
62
|
-
|
|
64
|
+
}, D = (r, i) => i === e.length - 1 ? !1 : e[i + 1].getTime() - r.getTime() <= 1440 * 60 * 1e3;
|
|
65
|
+
return e.forEach((r, i) => {
|
|
66
|
+
const c = m(r), y = f.has(c), S = l.has(c), h = p(r, i), g = D(r, i);
|
|
67
|
+
if (n === "multiple") {
|
|
68
|
+
y ? s.push(r) : S ? u.push(r) : a.push(r);
|
|
63
69
|
return;
|
|
64
70
|
}
|
|
65
|
-
!
|
|
66
|
-
}), { range_start:
|
|
71
|
+
!h && !g ? (s.push(r), u.push(r)) : h ? g ? a.push(r) : u.push(r) : s.push(r);
|
|
72
|
+
}), { range_start: s, range_middle: a, range_end: u };
|
|
67
73
|
}
|
|
68
74
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
_ as calculateWeekSelection,
|
|
76
|
+
H as computeWeekRangeModifiers,
|
|
77
|
+
A as fiscalPeriodForWeek,
|
|
78
|
+
d as isSameWeek,
|
|
79
|
+
E as nextWeekSelection,
|
|
80
|
+
x as weekSelectionsToDates
|
|
74
81
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { YearRange, YearSelection } from './calendar.types';
|
|
2
|
+
export interface CalendarYearPanesProps {
|
|
3
|
+
pickerYear: number;
|
|
4
|
+
resolvedStartYear: number;
|
|
5
|
+
resolvedEndYear: number;
|
|
6
|
+
previousYearLabel: string;
|
|
7
|
+
nextYearLabel: string;
|
|
8
|
+
yearLabels?: (year: number) => string;
|
|
9
|
+
yearCaptions?: (year: number) => string | undefined;
|
|
10
|
+
showFooter?: boolean;
|
|
11
|
+
pendingYearSelection?: YearSelection | YearSelection[] | YearRange;
|
|
12
|
+
selectedYear?: YearSelection | YearSelection[] | YearRange;
|
|
13
|
+
isYearSelected: (year: number) => boolean;
|
|
14
|
+
isYearDisabled: (year: number) => boolean;
|
|
15
|
+
onYearPageChange: (year: number) => void;
|
|
16
|
+
onYearClick: (year: number) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function CalendarYearPanes({ pickerYear, resolvedStartYear, resolvedEndYear, previousYearLabel, nextYearLabel, yearLabels, yearCaptions, showFooter, pendingYearSelection, selectedYear, isYearSelected, isYearDisabled, onYearPageChange, onYearClick, }: CalendarYearPanesProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRight as v } from "impact-nova-icons";
|
|
3
|
+
import { cn as M } from "../../../lib/utils.js";
|
|
4
|
+
import { Button as w } from "../../primitives/button/button.js";
|
|
5
|
+
import { CalendarPeriodCell as Y } from "./calendar-period-cell.js";
|
|
6
|
+
import { getYearRangeProps as Z, isYearRangeSelection as O } from "./calendar-year-utils.js";
|
|
7
|
+
const T = 12, q = 6;
|
|
8
|
+
function U({
|
|
9
|
+
pickerYear: E,
|
|
10
|
+
resolvedStartYear: d,
|
|
11
|
+
resolvedEndYear: m,
|
|
12
|
+
previousYearLabel: N,
|
|
13
|
+
nextYearLabel: S,
|
|
14
|
+
yearLabels: a,
|
|
15
|
+
yearCaptions: p,
|
|
16
|
+
showFooter: R = !0,
|
|
17
|
+
pendingYearSelection: b,
|
|
18
|
+
selectedYear: A,
|
|
19
|
+
isYearSelected: C,
|
|
20
|
+
isYearDisabled: _,
|
|
21
|
+
onYearPageChange: g,
|
|
22
|
+
onYearClick: z
|
|
23
|
+
}) {
|
|
24
|
+
const o = !!p, t = o ? q : T, i = Math.floor(E / t) * t, h = i + t - 1, s = Array.from({ length: t }, (n, l) => i + l).filter(
|
|
25
|
+
(n) => n >= d && n <= m
|
|
26
|
+
), f = s[0] ?? i, x = s[s.length - 1] ?? h, c = R ? b : A, u = O(c) ? c : void 0;
|
|
27
|
+
return /* @__PURE__ */ r(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "year-panes",
|
|
31
|
+
className: "flex w-[280px] min-w-[280px] max-w-[280px] flex-col gap-4 overflow-hidden p-3",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
w,
|
|
36
|
+
{
|
|
37
|
+
variant: "ghost",
|
|
38
|
+
size: "icon",
|
|
39
|
+
className: "h-7 w-7 shrink-0",
|
|
40
|
+
"aria-label": N,
|
|
41
|
+
disabled: i <= d,
|
|
42
|
+
onClick: () => g(i - t),
|
|
43
|
+
children: /* @__PURE__ */ e(v, { size: 16, className: "rotate-180" })
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ r("div", { className: "text-sm font-medium text-content", children: [
|
|
47
|
+
a?.(f) ?? f,
|
|
48
|
+
" – ",
|
|
49
|
+
a?.(x) ?? x
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ e(
|
|
52
|
+
w,
|
|
53
|
+
{
|
|
54
|
+
variant: "ghost",
|
|
55
|
+
size: "icon",
|
|
56
|
+
className: "h-7 w-7",
|
|
57
|
+
"aria-label": S,
|
|
58
|
+
disabled: h >= m,
|
|
59
|
+
onClick: () => g(i + t),
|
|
60
|
+
children: /* @__PURE__ */ e(v, { className: "h-4 w-4" })
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
"data-period-grid": "",
|
|
68
|
+
className: M("grid min-w-0 gap-2", o ? "grid-cols-2" : "grid-cols-3"),
|
|
69
|
+
children: s.map((n) => {
|
|
70
|
+
const l = C(n), P = _(n), k = !!u, { isStart: B, isEnd: j, isMiddle: I } = Z(n, c), G = p?.(n);
|
|
71
|
+
return /* @__PURE__ */ e(
|
|
72
|
+
Y,
|
|
73
|
+
{
|
|
74
|
+
selected: l,
|
|
75
|
+
disabled: P,
|
|
76
|
+
isRange: k,
|
|
77
|
+
isStart: B,
|
|
78
|
+
isEnd: j,
|
|
79
|
+
isMiddle: I,
|
|
80
|
+
hasRangeEnd: !!u?.to,
|
|
81
|
+
size: o ? "year-caption" : "year",
|
|
82
|
+
columns: o ? 2 : 3,
|
|
83
|
+
onClick: () => z(n),
|
|
84
|
+
caption: G,
|
|
85
|
+
children: a?.(n) ?? String(n)
|
|
86
|
+
},
|
|
87
|
+
n
|
|
88
|
+
);
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
U as CalendarYearPanes
|
|
98
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FiscalCalendarConfig } from '../../../lib/fiscal-calendar';
|
|
2
|
+
import { YearRange, YearSelection } from './calendar.types';
|
|
3
|
+
export declare function viewMonthFromYear(item?: Pick<YearSelection, "year" | "fy">): Date;
|
|
4
|
+
export declare function yearKey(item: YearSelection): number;
|
|
5
|
+
export declare function isSameYear(left: YearSelection, right: YearSelection): boolean;
|
|
6
|
+
export declare function isYearRangeSelection(value: YearSelection | YearSelection[] | YearRange | undefined): value is YearRange;
|
|
7
|
+
export declare function getYearRangeProps(year: number, currentSelection: YearSelection | YearSelection[] | YearRange | undefined): {
|
|
8
|
+
isStart: boolean;
|
|
9
|
+
isEnd: boolean;
|
|
10
|
+
isMiddle: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function nextYearSelection(selection: YearSelection, prev: YearSelection | YearSelection[] | YearRange | undefined, yearMode: "single" | "multiple" | "range" | "multi-range"): YearSelection | YearSelection[] | YearRange | undefined;
|
|
13
|
+
export declare function isYearSelectedForSelection(year: number, currentSelection: YearSelection | YearSelection[] | YearRange | undefined): boolean;
|
|
14
|
+
export declare function isYearDisabledForBounds(year: number, disabled?: unknown, options?: {
|
|
15
|
+
calendarKind?: "gregorian" | "fiscal";
|
|
16
|
+
fiscalConfig?: FiscalCalendarConfig;
|
|
17
|
+
}): boolean;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { localDateFromCivil as d } from "../../../lib/fiscal-calendar/civil-date.js";
|
|
2
|
+
import { buildFiscalYear as m } from "../../../lib/fiscal-calendar/build-year.js";
|
|
3
|
+
import { isDateIntervalDisabled as u } from "./calendar-month-utils.js";
|
|
4
|
+
function g(r) {
|
|
5
|
+
return r ? new Date(r.fy ?? r.year, 0, 1) : /* @__PURE__ */ new Date();
|
|
6
|
+
}
|
|
7
|
+
function n(r) {
|
|
8
|
+
return r.fy ?? r.year;
|
|
9
|
+
}
|
|
10
|
+
function e(r, f) {
|
|
11
|
+
return n(r) === n(f);
|
|
12
|
+
}
|
|
13
|
+
function l(r) {
|
|
14
|
+
return !!(r && !Array.isArray(r) && ("from" in r || "to" in r));
|
|
15
|
+
}
|
|
16
|
+
function w(r, f) {
|
|
17
|
+
if (!l(f))
|
|
18
|
+
return { isStart: !1, isEnd: !1, isMiddle: !1 };
|
|
19
|
+
const i = f.from, t = f.to;
|
|
20
|
+
if (!i && !t) return { isStart: !1, isEnd: !1, isMiddle: !1 };
|
|
21
|
+
if (!i)
|
|
22
|
+
return { isStart: !1, isEnd: t ? n(t) === r : !1, isMiddle: !1 };
|
|
23
|
+
const s = n(i);
|
|
24
|
+
if (!t) return { isStart: r === s, isEnd: !1, isMiddle: !1 };
|
|
25
|
+
const o = n(t);
|
|
26
|
+
return {
|
|
27
|
+
isStart: r === s,
|
|
28
|
+
isEnd: r === o,
|
|
29
|
+
isMiddle: r > s && r < o
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function E(r, f, i) {
|
|
33
|
+
if (i === "single") return r;
|
|
34
|
+
if (i === "multiple") {
|
|
35
|
+
const s = f || [];
|
|
36
|
+
return s.some((a) => e(a, r)) ? s.filter((a) => !e(a, r)) : [...s, r];
|
|
37
|
+
}
|
|
38
|
+
const t = f;
|
|
39
|
+
return !t?.from || t.to ? { from: r } : e(r, t.from) ? t : n(r) < n(t.from) ? { from: r, to: t.from } : { from: t.from, to: r };
|
|
40
|
+
}
|
|
41
|
+
function F(r, f) {
|
|
42
|
+
if (!f) return !1;
|
|
43
|
+
const i = { year: r, fy: r };
|
|
44
|
+
if (Array.isArray(f))
|
|
45
|
+
return f.some((t) => n(t) === r);
|
|
46
|
+
if (l(f)) {
|
|
47
|
+
const t = f.from, s = f.to;
|
|
48
|
+
if (!t) return s ? n(s) === r : !1;
|
|
49
|
+
const o = n(t);
|
|
50
|
+
if (!s) return r === o;
|
|
51
|
+
const a = n(s);
|
|
52
|
+
return r >= o && r <= a;
|
|
53
|
+
}
|
|
54
|
+
return e(f, i) || f.year === r;
|
|
55
|
+
}
|
|
56
|
+
function M(r, f, i) {
|
|
57
|
+
let t = new Date(r, 0, 1), s = new Date(r, 11, 31, 23, 59, 59, 999);
|
|
58
|
+
if (i?.calendarKind === "fiscal" && i.fiscalConfig)
|
|
59
|
+
try {
|
|
60
|
+
const o = m(i.fiscalConfig, r);
|
|
61
|
+
t = d(o.start), s = d(o.end);
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
return u(t, s, f);
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
w as getYearRangeProps,
|
|
68
|
+
e as isSameYear,
|
|
69
|
+
M as isYearDisabledForBounds,
|
|
70
|
+
l as isYearRangeSelection,
|
|
71
|
+
F as isYearSelectedForSelection,
|
|
72
|
+
E as nextYearSelection,
|
|
73
|
+
g as viewMonthFromYear,
|
|
74
|
+
n as yearKey
|
|
75
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CalendarProps } from './calendar.types';
|
|
2
|
-
export type { CalendarApplyValue, CalendarProps, MonthRange, MonthSelection, WeekRange, WeekRangeDraft, WeekSelection, } from './calendar.types';
|
|
2
|
+
export type { CalendarApplyValue, CalendarProps, MonthRange, MonthSelection, QuarterRange, QuarterSelection, WeekRange, WeekRangeDraft, WeekSelection, YearRange, YearSelection, YoYComparison, } from './calendar.types';
|
|
3
3
|
declare const Calendar: import('react').ForwardRefExoticComponent<CalendarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export { Calendar };
|