impact-nova 2.5.7 → 2.5.9
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 +196 -102
- 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-fiscal-period-nav.d.ts +16 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +41 -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 +25 -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/components/forms/smart-input/smart-input.js +106 -85
- package/dist/components/forms/smart-input/smart-input.types.d.ts +5 -0
- package/dist/components/forms/textarea/textarea.js +29 -28
- package/dist/components/forms/textarea/textarea.types.d.ts +1 -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/TextField.js +25 -24
- 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 +25 -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/dist/llms/rules/best-practices.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- 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,153 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import "react";
|
|
3
|
-
import { DayPicker as
|
|
4
|
-
import { cn as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import * as S from "react";
|
|
3
|
+
import { DayPicker as lr } from "react-day-picker";
|
|
4
|
+
import { cn as mr } from "../../../lib/utils.js";
|
|
5
|
+
import { formatPeriodOption as pr } from "./calendar-fiscal-labels.js";
|
|
6
|
+
import { CalendarDayHoverProvider as dr } from "./calendar-day-hover.js";
|
|
7
|
+
import { previewModifierClassNames as ur } from "./calendar-day-picker-classnames.js";
|
|
8
|
+
import { isPreviewCap as p, dayKey as m, isPreviewMiddle as br } from "./calendar-selection.js";
|
|
9
|
+
import { useCalendarDayPickerConfig as gr } from "./use-calendar-day-picker-config.js";
|
|
10
|
+
function Sr({
|
|
11
|
+
className: j,
|
|
12
|
+
pickerType: s,
|
|
13
|
+
mode: n,
|
|
14
|
+
weekMode: c,
|
|
15
|
+
calendarKind: l,
|
|
16
|
+
granularity: k,
|
|
17
|
+
showOutsideDays: d,
|
|
18
|
+
fixedWeeks: u,
|
|
19
|
+
captionLayout: B,
|
|
20
|
+
buttonVariant: H,
|
|
21
|
+
weekStartsOn: b,
|
|
22
|
+
formatters: E,
|
|
23
|
+
classNames: F,
|
|
24
|
+
components: L,
|
|
25
|
+
selected: g,
|
|
21
26
|
showFooter: v,
|
|
22
|
-
pendingSelection:
|
|
23
|
-
selectedDaysFromWeeks:
|
|
24
|
-
currentMonth:
|
|
25
|
-
monthsFull:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
pendingSelection: _,
|
|
28
|
+
selectedDaysFromWeeks: O,
|
|
29
|
+
currentMonth: P,
|
|
30
|
+
monthsFull: V,
|
|
31
|
+
monthsShort: Y,
|
|
32
|
+
weekNumberHeader: R,
|
|
33
|
+
resolvedStartMonth: w,
|
|
34
|
+
resolvedEndMonth: y,
|
|
35
|
+
availableYears: W,
|
|
36
|
+
fiscalPeriods: D,
|
|
37
|
+
fiscalConfig: $,
|
|
38
|
+
dateFnsLocale: q,
|
|
39
|
+
intlLocale: z,
|
|
40
|
+
weekRangeModifiers: A,
|
|
41
|
+
onSelect: G,
|
|
42
|
+
onMonthChange: h,
|
|
43
|
+
onWeekSelect: I,
|
|
44
|
+
previousMonthLabel: J,
|
|
45
|
+
nextMonthLabel: M,
|
|
46
|
+
monthPlaceholder: Q,
|
|
47
|
+
yearPlaceholder: U,
|
|
48
|
+
weekNumberLabel: x,
|
|
49
|
+
weekLabel: X,
|
|
50
|
+
fiscalWeekAriaLabel: Z,
|
|
51
|
+
getCellMeta: i,
|
|
52
|
+
formatWeekNumber: K,
|
|
53
|
+
disabled: T,
|
|
54
|
+
...rr
|
|
44
55
|
}) {
|
|
45
|
-
const { dayPickerClassNames:
|
|
46
|
-
buttonVariant:
|
|
47
|
-
pickerType:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
const { dayPickerClassNames: er, dayPickerComponents: tr } = gr({
|
|
57
|
+
buttonVariant: H,
|
|
58
|
+
pickerType: s,
|
|
59
|
+
calendarKind: l,
|
|
60
|
+
granularity: k,
|
|
61
|
+
showOutsideDays: d,
|
|
62
|
+
classNames: F,
|
|
63
|
+
currentMonth: P,
|
|
64
|
+
monthsFull: V,
|
|
65
|
+
monthsShort: Y,
|
|
66
|
+
weekNumberHeader: R,
|
|
67
|
+
resolvedStartMonth: w,
|
|
68
|
+
resolvedEndMonth: y,
|
|
69
|
+
availableYears: W,
|
|
70
|
+
fiscalPeriods: D,
|
|
71
|
+
fiscalConfig: $,
|
|
72
|
+
weekStartsOn: b,
|
|
73
|
+
previousMonthLabel: J,
|
|
74
|
+
nextMonthLabel: M,
|
|
75
|
+
monthPlaceholder: Q,
|
|
76
|
+
yearPlaceholder: U,
|
|
77
|
+
weekNumberLabel: x,
|
|
78
|
+
weekLabel: X,
|
|
79
|
+
fiscalWeekNumberLabel: x,
|
|
80
|
+
fiscalWeekAriaLabel: Z,
|
|
81
|
+
getCellMeta: i,
|
|
82
|
+
onMonthChange: h,
|
|
83
|
+
onWeekSelect: I,
|
|
84
|
+
weekMode: c,
|
|
85
|
+
components: L
|
|
86
|
+
}), or = n === "range" || n === "multiple" || n === "multi-range" || c === "range" || c === "multiple" || c === "multi-range" ? 2 : 1, ar = s === "week" || n === "multi-range" ? "multiple" : n, nr = u || l === "fiscal" || d, N = i ? {
|
|
87
|
+
fiscal_period_start: (r) => !!i(r)?.isPeriodStart,
|
|
88
|
+
fiscal_period_end: (r) => !!i(r)?.isPeriodEnd
|
|
89
|
+
} : void 0, [t, ir] = S.useState(), sr = S.useCallback((r) => {
|
|
90
|
+
ir((e) => !e && !r || e && r && e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate() ? e : r);
|
|
91
|
+
}, []), o = v ? _ : g, a = n === "range" && o && typeof o == "object" && "from" in o ? o.from : void 0, fr = n === "range" && o && typeof o == "object" && "to" in o ? o.to : void 0;
|
|
92
|
+
return /* @__PURE__ */ C(dr, { onDayHover: sr, children: /* @__PURE__ */ C(
|
|
93
|
+
lr,
|
|
69
94
|
{
|
|
70
|
-
mode:
|
|
71
|
-
selected:
|
|
95
|
+
mode: ar,
|
|
96
|
+
selected: s === "week" ? O : v ? _ : g,
|
|
72
97
|
onSelect: (...r) => {
|
|
73
|
-
const [
|
|
74
|
-
|
|
98
|
+
const [e, f] = r;
|
|
99
|
+
G(e, f instanceof Date ? f : void 0);
|
|
75
100
|
},
|
|
76
|
-
month:
|
|
77
|
-
onMonthChange:
|
|
78
|
-
fixedWeeks:
|
|
79
|
-
showOutsideDays:
|
|
80
|
-
weekStartsOn:
|
|
81
|
-
modifiers:
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
month: P,
|
|
102
|
+
onMonthChange: h,
|
|
103
|
+
fixedWeeks: u,
|
|
104
|
+
showOutsideDays: nr,
|
|
105
|
+
weekStartsOn: b,
|
|
106
|
+
modifiers: s === "week" ? { ...A, ...N } : { ...N, ...s === "date" && !!(a && !fr && t) && a && t ? {
|
|
107
|
+
preview: (r) => br(r, a, t),
|
|
108
|
+
preview_cap: (r) => p(r, a, t),
|
|
109
|
+
preview_cap_start: (r) => p(r, a, t) && m(t) < m(a),
|
|
110
|
+
preview_cap_end: (r) => p(r, a, t) && m(t) > m(a)
|
|
111
|
+
} : void 0 },
|
|
112
|
+
modifiersClassNames: {
|
|
113
|
+
...l === "fiscal" ? {
|
|
114
|
+
fiscal_period_start: "before:pointer-events-none before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:content-['('] before:text-sm before:font-normal before:text-brand",
|
|
115
|
+
fiscal_period_end: "after:pointer-events-none after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:content-[')'] after:text-sm after:font-normal after:text-brand"
|
|
116
|
+
} : void 0,
|
|
117
|
+
...ur
|
|
118
|
+
},
|
|
119
|
+
locale: q,
|
|
120
|
+
className: mr(
|
|
84
121
|
"bg-canvas group/calendar p-2 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
85
122
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
86
123
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
87
|
-
|
|
124
|
+
j
|
|
88
125
|
),
|
|
89
|
-
captionLayout:
|
|
126
|
+
captionLayout: B,
|
|
90
127
|
navLayout: "around",
|
|
91
|
-
startMonth:
|
|
92
|
-
endMonth:
|
|
93
|
-
disabled:
|
|
94
|
-
numberOfMonths:
|
|
128
|
+
startMonth: w,
|
|
129
|
+
endMonth: y,
|
|
130
|
+
disabled: T,
|
|
131
|
+
numberOfMonths: or,
|
|
95
132
|
showWeekNumber: !0,
|
|
96
133
|
formatters: {
|
|
97
|
-
formatMonthDropdown: (r) =>
|
|
98
|
-
|
|
99
|
-
|
|
134
|
+
formatMonthDropdown: (r) => {
|
|
135
|
+
if (l === "fiscal" && i) {
|
|
136
|
+
const e = i(r), f = D?.find((cr) => cr.period === e?.fiscalPeriod);
|
|
137
|
+
if (f) return pr(f);
|
|
138
|
+
if (e?.fiscalPeriod != null) return `P${e.fiscalPeriod}`;
|
|
139
|
+
}
|
|
140
|
+
return r.toLocaleString(z, { month: "short" });
|
|
141
|
+
},
|
|
142
|
+
formatWeekNumber: K,
|
|
143
|
+
...E
|
|
100
144
|
},
|
|
101
|
-
classNames:
|
|
102
|
-
components:
|
|
103
|
-
...
|
|
145
|
+
classNames: er,
|
|
146
|
+
components: tr,
|
|
147
|
+
...rr
|
|
104
148
|
}
|
|
105
|
-
);
|
|
149
|
+
) });
|
|
106
150
|
}
|
|
107
151
|
export {
|
|
108
|
-
|
|
152
|
+
Sr as CalendarDayPickerView
|
|
109
153
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CivilDate, FiscalCalendarConfig, FyLabelStyle } from '../../../lib/fiscal-calendar';
|
|
2
|
+
import { QuarterSelection, YearSelection } from './calendar.types';
|
|
3
|
+
export declare function formatFiscalYearLabel(fy: number, style?: FyLabelStyle): string;
|
|
4
|
+
export declare function formatYearIntervalCaption(year: number, fiscalConfig?: FiscalCalendarConfig): string;
|
|
5
|
+
export declare function formatPeriodTooltip(period: {
|
|
6
|
+
period: number;
|
|
7
|
+
start: CivilDate;
|
|
8
|
+
end: CivilDate;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function formatPeriodCell(period: {
|
|
11
|
+
period: number;
|
|
12
|
+
start: CivilDate;
|
|
13
|
+
end: CivilDate;
|
|
14
|
+
}): {
|
|
15
|
+
label: string;
|
|
16
|
+
caption: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function formatPeriodOption(period: {
|
|
19
|
+
period: number;
|
|
20
|
+
start: CivilDate;
|
|
21
|
+
end: CivilDate;
|
|
22
|
+
}): string;
|
|
23
|
+
export declare function formatQuarterCell(quarter: {
|
|
24
|
+
quarter: number;
|
|
25
|
+
start: CivilDate;
|
|
26
|
+
end: CivilDate;
|
|
27
|
+
}): {
|
|
28
|
+
label: string;
|
|
29
|
+
caption: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function formatFiscalPeriodInput(period: number, fy: number): string;
|
|
32
|
+
export declare function formatFiscalQuarterInput(quarter: number, fy: number): string;
|
|
33
|
+
export declare function formatQuarterInput(quarter: Pick<QuarterSelection, "year" | "quarter" | "fy">): string;
|
|
34
|
+
export declare function formatYearInput(year: Pick<YearSelection, "year" | "fy">, fyLabel?: FyLabelStyle): string;
|
|
35
|
+
export declare function formatQuarterLabelsForYear(year: number, fiscalConfig?: FiscalCalendarConfig): Array<{
|
|
36
|
+
label: string;
|
|
37
|
+
caption?: string;
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { formatCivilRange as o, parseCivilDate as l } from "../../../lib/fiscal-calendar/civil-date.js";
|
|
2
|
+
import { formatFyLabel as c, buildFiscalYear as f } from "../../../lib/fiscal-calendar/build-year.js";
|
|
3
|
+
const a = [
|
|
4
|
+
"January",
|
|
5
|
+
"February",
|
|
6
|
+
"March",
|
|
7
|
+
"April",
|
|
8
|
+
"May",
|
|
9
|
+
"June",
|
|
10
|
+
"July",
|
|
11
|
+
"August",
|
|
12
|
+
"September",
|
|
13
|
+
"October",
|
|
14
|
+
"November",
|
|
15
|
+
"December"
|
|
16
|
+
];
|
|
17
|
+
function u(r, t = "fy-short") {
|
|
18
|
+
return c(r, t);
|
|
19
|
+
}
|
|
20
|
+
function d(r, t) {
|
|
21
|
+
if (t)
|
|
22
|
+
try {
|
|
23
|
+
const n = f(t, r);
|
|
24
|
+
return `(${o(n.start, n.end)})`;
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
return `(${o(`${r}-01-01`, `${r}-12-31`)})`;
|
|
28
|
+
}
|
|
29
|
+
function $(r, t) {
|
|
30
|
+
const n = l(r), e = l(t);
|
|
31
|
+
return n.y === e.y ? `${a[n.m - 1]} ${n.d} – ${a[e.m - 1]} ${e.d}` : `${a[n.m - 1]} ${n.d} ${n.y} – ${a[e.m - 1]} ${e.d} ${e.y}`;
|
|
32
|
+
}
|
|
33
|
+
function Q(r) {
|
|
34
|
+
return `Period ${r.period} (${$(r.start, r.end)})`;
|
|
35
|
+
}
|
|
36
|
+
function m(r) {
|
|
37
|
+
return {
|
|
38
|
+
label: `P${r.period}`,
|
|
39
|
+
caption: `(${o(r.start, r.end)})`
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function F(r) {
|
|
43
|
+
const t = m(r);
|
|
44
|
+
return `${t.label} ${t.caption}`;
|
|
45
|
+
}
|
|
46
|
+
function s(r) {
|
|
47
|
+
return {
|
|
48
|
+
label: `Q${r.quarter}`,
|
|
49
|
+
caption: `(${o(r.start, r.end)})`
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function L(r, t) {
|
|
53
|
+
return `P${r} ${u(t)}`;
|
|
54
|
+
}
|
|
55
|
+
function b(r, t) {
|
|
56
|
+
return `Q${r} ${u(t)}`;
|
|
57
|
+
}
|
|
58
|
+
function P(r) {
|
|
59
|
+
return r.fy != null ? b(r.quarter, r.fy) : `Q${r.quarter} ${r.year}`;
|
|
60
|
+
}
|
|
61
|
+
function I(r, t = "fy-long") {
|
|
62
|
+
return r.fy != null ? u(r.fy, t) : String(r.year);
|
|
63
|
+
}
|
|
64
|
+
const i = [
|
|
65
|
+
{ label: "Q1" },
|
|
66
|
+
{ label: "Q2" },
|
|
67
|
+
{ label: "Q3" },
|
|
68
|
+
{ label: "Q4" }
|
|
69
|
+
];
|
|
70
|
+
function R(r, t) {
|
|
71
|
+
if (!t) return i;
|
|
72
|
+
try {
|
|
73
|
+
return f(t, r).quarters.map(s);
|
|
74
|
+
} catch {
|
|
75
|
+
return i;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
L as formatFiscalPeriodInput,
|
|
80
|
+
b as formatFiscalQuarterInput,
|
|
81
|
+
u as formatFiscalYearLabel,
|
|
82
|
+
m as formatPeriodCell,
|
|
83
|
+
F as formatPeriodOption,
|
|
84
|
+
Q as formatPeriodTooltip,
|
|
85
|
+
s as formatQuarterCell,
|
|
86
|
+
P as formatQuarterInput,
|
|
87
|
+
R as formatQuarterLabelsForYear,
|
|
88
|
+
I as formatYearInput,
|
|
89
|
+
d as formatYearIntervalCaption
|
|
90
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FiscalPeriod } from '../../../lib/fiscal-calendar';
|
|
2
|
+
/** Local midnight on the 15th. FY can change on the 1st of a civil month. */
|
|
3
|
+
export declare function midMonthDate(month: Date): Date;
|
|
4
|
+
export declare function civilMonthAtOffset(month: Date, offset: number): Date;
|
|
5
|
+
/** Civil month (0-indexed) where `period` has the most days. */
|
|
6
|
+
export declare function dominantCivilMonthForPeriod(period: FiscalPeriod): {
|
|
7
|
+
year: number;
|
|
8
|
+
monthIndex: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Month the week/date grid should show after picking a fiscal period.
|
|
12
|
+
* Dual-month range pickers pass `isRightPanel` so the period lands on the right pane.
|
|
13
|
+
*/
|
|
14
|
+
export declare function visibleMonthForPeriod(period: FiscalPeriod, isRightPanel: boolean): Date;
|
|
15
|
+
/** Period that occupies the most days of a civil month (caption selected value). */
|
|
16
|
+
export declare function periodForCivilMonth(periods: readonly FiscalPeriod[], year: number, monthIndex: number): FiscalPeriod | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { setDate as m, startOfMonth as s, addMonths as h } from "date-fns";
|
|
2
|
+
import { parseCivilDate as d, toCivilDate as l, lastDayOfMonth as y, compareCivil as u, diffDays as v, minCivil as M, maxCivil as p } from "../../../lib/fiscal-calendar/civil-date.js";
|
|
3
|
+
function x(t) {
|
|
4
|
+
return m(s(t), 15);
|
|
5
|
+
}
|
|
6
|
+
function b(t, n) {
|
|
7
|
+
return s(h(t, n));
|
|
8
|
+
}
|
|
9
|
+
function c(t, n, o, e) {
|
|
10
|
+
const r = l(o, e + 1, 1), a = y(o, e + 1), i = p(t, r), f = M(n, a);
|
|
11
|
+
return u(i, f) > 0 ? 0 : v(f, i) + 1;
|
|
12
|
+
}
|
|
13
|
+
function C(t) {
|
|
14
|
+
const n = d(t.start);
|
|
15
|
+
let o = { year: n.y, monthIndex: n.m - 1, days: 0 };
|
|
16
|
+
const e = t.gregorianMonthSpan.length > 0 ? t.gregorianMonthSpan : [{ year: n.y, month: n.m - 1 }];
|
|
17
|
+
for (const { year: r, month: a } of e) {
|
|
18
|
+
const i = c(t.start, t.end, r, a);
|
|
19
|
+
i > o.days && (o = { year: r, monthIndex: a, days: i });
|
|
20
|
+
}
|
|
21
|
+
return { year: o.year, monthIndex: o.monthIndex };
|
|
22
|
+
}
|
|
23
|
+
function I(t, n) {
|
|
24
|
+
const { year: o, monthIndex: e } = C(t), r = s(new Date(o, e, 1));
|
|
25
|
+
return n ? h(r, -1) : r;
|
|
26
|
+
}
|
|
27
|
+
function O(t, n, o) {
|
|
28
|
+
let e, r = 0;
|
|
29
|
+
for (const a of t) {
|
|
30
|
+
const i = c(a.start, a.end, n, o);
|
|
31
|
+
i > r && (e = a, r = i);
|
|
32
|
+
}
|
|
33
|
+
return e;
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
b as civilMonthAtOffset,
|
|
37
|
+
C as dominantCivilMonthForPeriod,
|
|
38
|
+
x as midMonthDate,
|
|
39
|
+
O as periodForCivilMonth,
|
|
40
|
+
I as visibleMonthForPeriod
|
|
41
|
+
};
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { DateRange } from 'react-day-picker';
|
|
2
|
-
import { FiscalMonthPattern } from '../../../lib/fiscal-calendar';
|
|
3
|
-
import { MonthRange, MonthSelection, WeekRange, WeekSelection } from './calendar.types';
|
|
2
|
+
import { FiscalCalendarConfig, FiscalMonthPattern, CalendarKind, Granularity } from '../../../lib/fiscal-calendar';
|
|
3
|
+
import { MonthRange, MonthSelection, QuarterRange, QuarterSelection, WeekRange, WeekSelection, YearRange, YearSelection } from './calendar.types';
|
|
4
4
|
export declare function formatDateRangeFooterSummary(selection: DateRange | undefined): string;
|
|
5
5
|
export declare function formatWeekFooterSummary(params: {
|
|
6
6
|
selection: WeekSelection | WeekSelection[] | WeekRange | undefined;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
calendarKind: CalendarKind;
|
|
8
|
+
granularity?: Granularity;
|
|
9
9
|
resolvedFiscalPattern?: FiscalMonthPattern;
|
|
10
|
+
fiscalConfig?: FiscalCalendarConfig;
|
|
10
11
|
}): string;
|
|
11
12
|
export declare function formatMonthFooterSummary(selection: MonthSelection | MonthSelection[] | MonthRange | undefined, labels: {
|
|
12
13
|
single: string;
|
|
13
14
|
plural: (count: number) => string;
|
|
14
15
|
}): string;
|
|
16
|
+
export declare function formatQuarterFooterSummary(selection: QuarterSelection | QuarterSelection[] | QuarterRange | undefined, labels: {
|
|
17
|
+
single: string;
|
|
18
|
+
plural: (count: number) => string;
|
|
19
|
+
}): string;
|
|
20
|
+
export declare function formatYearFooterSummary(selection: YearSelection | YearSelection[] | YearRange | undefined, labels: {
|
|
21
|
+
single: string;
|
|
22
|
+
plural: (count: number) => string;
|
|
23
|
+
}): string;
|
|
@@ -1,69 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { civilFromLocalDate as D } from "../../../lib/fiscal-calendar/civil-date.js";
|
|
2
|
+
import { buildFiscalYear as S } from "../../../lib/fiscal-calendar/build-year.js";
|
|
3
|
+
import { getCellMeta as $ } from "../../../lib/fiscal-calendar/lookup.js";
|
|
4
|
+
import { quarterRank as k } from "./calendar-quarter-utils.js";
|
|
5
|
+
import { yearKey as w } from "./calendar-year-utils.js";
|
|
6
|
+
function O(r) {
|
|
7
|
+
if (r?.from && r?.to) {
|
|
8
|
+
const n = Math.abs(r.to.getTime() - r.from.getTime()), t = Math.ceil(n / (1e3 * 60 * 60 * 24)) + 1;
|
|
9
|
+
return `${t} day${t !== 1 ? "s" : ""}`;
|
|
5
10
|
}
|
|
6
11
|
return "0 days";
|
|
7
12
|
}
|
|
8
|
-
function
|
|
9
|
-
return Date.UTC(
|
|
13
|
+
function c(r) {
|
|
14
|
+
return Date.UTC(r.getFullYear(), r.getMonth(), r.getDate());
|
|
10
15
|
}
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
return
|
|
16
|
+
function g(r) {
|
|
17
|
+
const n = Math.floor(r / 7), t = r % 7, o = [];
|
|
18
|
+
return n > 0 && o.push(`${n} week${n !== 1 ? "s" : ""}`), (t > 0 || n === 0) && o.push(`${t} day${t !== 1 ? "s" : ""}`), o.join(" ");
|
|
14
19
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
function A(r, n, t) {
|
|
21
|
+
if (!t)
|
|
22
|
+
return Math.max(1, Math.abs(n.weekOfMonth - r.weekOfMonth) + 1);
|
|
23
|
+
const o = $(t, D(r.startDate)), e = $(t, D(n.endDate));
|
|
24
|
+
if (o?.fy == null || e?.fy == null || o.fiscalPeriod == null || e.fiscalPeriod == null)
|
|
25
|
+
return Math.max(1, Math.abs(n.weekOfMonth - r.weekOfMonth) + 1);
|
|
26
|
+
let a = 0;
|
|
27
|
+
for (let i = o.fy; i <= e.fy; i++) {
|
|
28
|
+
const u = S(t, i);
|
|
29
|
+
for (const m of u.periods)
|
|
30
|
+
i === o.fy && m.period < o.fiscalPeriod || i === e.fy && m.period > e.fiscalPeriod || (a += 1);
|
|
31
|
+
}
|
|
32
|
+
return Math.max(1, a);
|
|
33
|
+
}
|
|
34
|
+
function j(r) {
|
|
35
|
+
const { selection: n, calendarKind: t, granularity: o, fiscalConfig: e } = r;
|
|
36
|
+
if (!n) return "0 weeks";
|
|
37
|
+
const a = t === "fiscal" && o === "period", i = t === "fiscal", u = a ? "fiscal month" : i ? "fiscal week" : "week", m = a ? "fiscal months" : i ? "fiscal weeks" : "weeks";
|
|
38
|
+
if (Array.isArray(n)) {
|
|
39
|
+
if (i || a) {
|
|
40
|
+
const f = n.length;
|
|
41
|
+
return `${f} ${f !== 1 ? m : u}`;
|
|
23
42
|
}
|
|
24
43
|
let s = 0;
|
|
25
|
-
return
|
|
26
|
-
const
|
|
27
|
-
s += Math.round((
|
|
28
|
-
}),
|
|
44
|
+
return n.forEach((f) => {
|
|
45
|
+
const y = c(f.startDate), l = c(f.endDate);
|
|
46
|
+
s += Math.round((l - y) / (1e3 * 60 * 60 * 24)) + 1;
|
|
47
|
+
}), g(s);
|
|
29
48
|
}
|
|
30
|
-
if ("from" in
|
|
31
|
-
const { from: s, to:
|
|
32
|
-
if (
|
|
33
|
-
if (!
|
|
34
|
-
const h =
|
|
35
|
-
return `${
|
|
49
|
+
if ("from" in n) {
|
|
50
|
+
const { from: s, to: f } = n;
|
|
51
|
+
if (a) {
|
|
52
|
+
if (!f) return `1 ${u}`;
|
|
53
|
+
const h = A(s, f, e);
|
|
54
|
+
return `${h} ${h !== 1 ? m : u}`;
|
|
36
55
|
}
|
|
37
|
-
if (
|
|
38
|
-
if (!
|
|
39
|
-
const h =
|
|
40
|
-
return `${
|
|
56
|
+
if (i) {
|
|
57
|
+
if (!f) return `1 ${u}`;
|
|
58
|
+
const h = c(s.startDate), M = c(f.endDate), d = Math.round((M - h) / (10080 * 60 * 1e3)), p = d > 0 ? d : 1;
|
|
59
|
+
return `${p} ${p !== 1 ? m : u}`;
|
|
41
60
|
}
|
|
42
|
-
if (!
|
|
43
|
-
const h =
|
|
44
|
-
return
|
|
61
|
+
if (!f) {
|
|
62
|
+
const h = c(s.startDate), M = c(s.endDate), d = Math.round((M - h) / (1e3 * 60 * 60 * 24)) + 1;
|
|
63
|
+
return g(d);
|
|
45
64
|
}
|
|
46
|
-
const
|
|
47
|
-
return
|
|
65
|
+
const y = c(s.startDate), l = c(f.endDate), T = Math.round(Math.abs(l - y) / (1e3 * 60 * 60 * 24)) + 1;
|
|
66
|
+
return g(T);
|
|
48
67
|
}
|
|
49
|
-
return `1 ${
|
|
68
|
+
return `1 ${u}`;
|
|
50
69
|
}
|
|
51
|
-
function
|
|
52
|
-
if (!
|
|
53
|
-
if (Array.isArray(
|
|
54
|
-
const
|
|
55
|
-
return
|
|
70
|
+
function K(r, n) {
|
|
71
|
+
if (!r) return "0 months";
|
|
72
|
+
if (Array.isArray(r)) {
|
|
73
|
+
const t = r.length;
|
|
74
|
+
return t === 1 ? n.single : n.plural(t);
|
|
56
75
|
}
|
|
57
|
-
if ("from" in
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
return
|
|
76
|
+
if ("from" in r) {
|
|
77
|
+
const t = r;
|
|
78
|
+
if (!t.from || !t.to) return n.single;
|
|
79
|
+
const o = new Date(t.from.year, t.from.month, 1), e = new Date(t.to.year, t.to.month, 1), a = (e.getFullYear() - o.getFullYear()) * 12 + (e.getMonth() - o.getMonth()) + 1;
|
|
80
|
+
return a === 1 ? n.single : n.plural(a);
|
|
81
|
+
}
|
|
82
|
+
return n.single;
|
|
83
|
+
}
|
|
84
|
+
function F(r, n, t, o) {
|
|
85
|
+
if (!r) return o;
|
|
86
|
+
if (Array.isArray(r)) {
|
|
87
|
+
const e = r.length;
|
|
88
|
+
return e === 1 ? t.single : t.plural(e);
|
|
89
|
+
}
|
|
90
|
+
if (typeof r == "object" && "from" in r) {
|
|
91
|
+
const e = r;
|
|
92
|
+
if (!e.from || !e.to) return t.single;
|
|
93
|
+
const a = n(e.from, e.to);
|
|
94
|
+
return a === 1 ? t.single : t.plural(a);
|
|
62
95
|
}
|
|
63
96
|
return t.single;
|
|
64
97
|
}
|
|
98
|
+
function R(r, n) {
|
|
99
|
+
return F(
|
|
100
|
+
r,
|
|
101
|
+
(t, o) => Math.abs(k(o) - k(t)) + 1,
|
|
102
|
+
n,
|
|
103
|
+
n.plural(0)
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function q(r, n) {
|
|
107
|
+
return F(
|
|
108
|
+
r,
|
|
109
|
+
(t, o) => Math.abs(w(o) - w(t)) + 1,
|
|
110
|
+
n,
|
|
111
|
+
n.plural(0)
|
|
112
|
+
);
|
|
113
|
+
}
|
|
65
114
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
115
|
+
O as formatDateRangeFooterSummary,
|
|
116
|
+
K as formatMonthFooterSummary,
|
|
117
|
+
R as formatQuarterFooterSummary,
|
|
118
|
+
j as formatWeekFooterSummary,
|
|
119
|
+
q as formatYearFooterSummary
|
|
69
120
|
};
|