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,69 +1,79 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as s, jsxs as S } from "react/jsx-runtime";
|
|
2
2
|
import * as r from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { format as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { usePickerDismissActionsRef as
|
|
7
|
-
import { Input as
|
|
8
|
-
import {
|
|
9
|
-
import { Calendar as Ie } from "../../data-display/calendar/calendar.js";
|
|
3
|
+
import { Cross as he, CalendarMonth as De } from "impact-nova-icons";
|
|
4
|
+
import { format as b } from "date-fns";
|
|
5
|
+
import { cn as ge } from "../../../lib/utils.js";
|
|
6
|
+
import { usePickerDismissActionsRef as ye, usePickerFooterDismissNudge as ke, isDateInputInvalid as ve, resolveSingleValueDismissFlash as Ie, handlePickerSurfacePointerDown as Ce, maskDateInput as Pe, parseDateInput as Me, resolveDateInputOnBlur as xe, resolveDateInputOnEnter as Re } from "./date-input-behavior.js";
|
|
7
|
+
import { Input as Se } from "../input/input.js";
|
|
8
|
+
import { Calendar as be } from "../../data-display/calendar/calendar.js";
|
|
10
9
|
import { Tooltip as j, TooltipTrigger as B, TooltipContent as K } from "../../feedback/tooltip/tooltip.js";
|
|
11
|
-
import { useImpactNovaI18n as
|
|
12
|
-
import { getDateFnsLocale as
|
|
13
|
-
import { createComponent as
|
|
14
|
-
import { coerceSingleDateApply as
|
|
15
|
-
import { buildDateBoundsMatcher as
|
|
16
|
-
|
|
10
|
+
import { useImpactNovaI18n as we } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { getDateFnsLocale as Te } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { createComponent as Ee } from "../../../lib/primitives/create-component.js";
|
|
13
|
+
import { coerceSingleDateApply as Ae, coerceSingleDate as Ne } from "./calendar-selection-adapters.js";
|
|
14
|
+
import { buildDateBoundsMatcher as Le } from "../../../lib/date-bounds-matcher.js";
|
|
15
|
+
import { fiscalCalendarPassThrough as Oe } from "./fiscal-pass-through.js";
|
|
16
|
+
import { DatePickerShell as Ve } from "./date-picker-shell.js";
|
|
17
|
+
const $e = Ee(
|
|
17
18
|
"DatePicker",
|
|
18
19
|
({
|
|
19
20
|
value: n,
|
|
20
|
-
onChange:
|
|
21
|
-
format:
|
|
21
|
+
onChange: p,
|
|
22
|
+
format: l = "MM/dd/yyyy",
|
|
22
23
|
placeholder: z,
|
|
23
24
|
minDate: H,
|
|
24
25
|
maxDate: q,
|
|
25
26
|
startMonth: G,
|
|
26
27
|
endMonth: J,
|
|
27
28
|
showFooter: a = !0,
|
|
28
|
-
weekStartsOn:
|
|
29
|
-
disabled:
|
|
29
|
+
weekStartsOn: w,
|
|
30
|
+
disabled: c,
|
|
30
31
|
className: Q,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
calendarKind: U,
|
|
33
|
+
fiscalMode: W,
|
|
34
|
+
granularity: X,
|
|
35
|
+
fiscalMonthPattern: Y,
|
|
36
|
+
fiscalYearStartMonth: Z,
|
|
37
|
+
fiscalConfig: _,
|
|
38
|
+
showPresets: $,
|
|
39
|
+
comparison: F,
|
|
40
|
+
onComparisonChange: ee,
|
|
41
|
+
...te
|
|
42
|
+
}, ne) => {
|
|
43
|
+
const { locale: T, t: h } = we(), f = r.useMemo(() => Te(T), [T]), re = z ?? h("datePicker.selectDate"), g = r.useRef(null), E = r.useRef(null), C = r.useRef(null);
|
|
44
|
+
r.useImperativeHandle(ne, () => g.current);
|
|
45
|
+
const [i, A] = r.useState(!1), N = ye(), { footerFlashKey: ie, footerFlashTarget: oe, popoverHandlers: se } = ke(a, i, N, E), y = r.useRef(!1), [x, o] = r.useState(null), k = n ? b(n, l, { locale: f }) : "", d = x?.input ?? k, P = i ? x?.pending ?? n : n, ce = x?.viewMonth ?? n ?? /* @__PURE__ */ new Date(), u = r.useCallback(() => {
|
|
46
|
+
o(null), A(!1);
|
|
37
47
|
}, []), m = (e) => {
|
|
38
|
-
if (!
|
|
48
|
+
if (!c) {
|
|
39
49
|
if (e) {
|
|
40
|
-
|
|
50
|
+
o({
|
|
41
51
|
input: k,
|
|
42
52
|
pending: n,
|
|
43
53
|
viewMonth: n ?? /* @__PURE__ */ new Date()
|
|
44
|
-
}),
|
|
54
|
+
}), A(!0);
|
|
45
55
|
return;
|
|
46
56
|
}
|
|
47
|
-
|
|
57
|
+
u();
|
|
48
58
|
}
|
|
49
59
|
};
|
|
50
60
|
r.useEffect(() => {
|
|
51
|
-
g.current &&
|
|
61
|
+
g.current && C.current !== null && (g.current.setSelectionRange(C.current, C.current), C.current = null);
|
|
52
62
|
}, [d]);
|
|
53
|
-
const
|
|
54
|
-
const t =
|
|
55
|
-
|
|
63
|
+
const le = (e) => {
|
|
64
|
+
const t = Ne(e), D = t ? b(t, l, { locale: f }) : "";
|
|
65
|
+
o(
|
|
56
66
|
(v) => v ? { ...v, pending: t, input: D, viewMonth: t ?? v.viewMonth } : null
|
|
57
|
-
), t && !a && (
|
|
58
|
-
},
|
|
59
|
-
const t =
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
67
|
+
), t && !a && (p?.(t), u());
|
|
68
|
+
}, L = (e) => {
|
|
69
|
+
const t = Ae(e, P);
|
|
70
|
+
p?.(t), u();
|
|
71
|
+
}, R = () => {
|
|
72
|
+
u();
|
|
73
|
+
}, O = () => {
|
|
74
|
+
p?.(void 0), a ? o(
|
|
65
75
|
(e) => e ? { ...e, pending: void 0, input: "" } : null
|
|
66
|
-
) :
|
|
76
|
+
) : u();
|
|
67
77
|
}, M = r.useCallback(
|
|
68
78
|
() => ({
|
|
69
79
|
input: k,
|
|
@@ -71,59 +81,59 @@ const Ge = xe(
|
|
|
71
81
|
viewMonth: n ?? /* @__PURE__ */ new Date()
|
|
72
82
|
}),
|
|
73
83
|
[k, n]
|
|
74
|
-
),
|
|
75
|
-
const t =
|
|
76
|
-
if (
|
|
77
|
-
|
|
84
|
+
), ae = (e) => {
|
|
85
|
+
const t = Pe(e.target.value, l, d);
|
|
86
|
+
if (o((I) => ({ ...I ?? M(), input: t })), t === "") {
|
|
87
|
+
o((I) => ({ ...I ?? M(), input: "", pending: void 0 })), a || p?.(void 0);
|
|
78
88
|
return;
|
|
79
89
|
}
|
|
80
|
-
const { parsed: D, isValid: v } =
|
|
81
|
-
v && D && (
|
|
82
|
-
...
|
|
90
|
+
const { parsed: D, isValid: v } = Me(t, l, f);
|
|
91
|
+
v && D && (o((I) => ({
|
|
92
|
+
...I ?? M(),
|
|
83
93
|
input: t,
|
|
84
94
|
pending: D,
|
|
85
95
|
viewMonth: D
|
|
86
|
-
})), a ||
|
|
87
|
-
},
|
|
96
|
+
})), a || p?.(D));
|
|
97
|
+
}, ue = r.useCallback(
|
|
88
98
|
(e) => {
|
|
89
|
-
|
|
99
|
+
p?.(e), u();
|
|
90
100
|
},
|
|
91
|
-
[
|
|
92
|
-
),
|
|
101
|
+
[p, u]
|
|
102
|
+
), pe = () => {
|
|
93
103
|
if (i) return;
|
|
94
|
-
const e =
|
|
104
|
+
const e = xe(
|
|
95
105
|
d,
|
|
96
|
-
|
|
106
|
+
l,
|
|
97
107
|
k,
|
|
98
108
|
f
|
|
99
109
|
);
|
|
100
110
|
if (e.resetToCommitted) {
|
|
101
|
-
|
|
111
|
+
o(null);
|
|
102
112
|
return;
|
|
103
113
|
}
|
|
104
114
|
if (e.parsed) {
|
|
105
|
-
|
|
115
|
+
o((t) => ({
|
|
106
116
|
...t ?? M(),
|
|
107
117
|
input: e.display,
|
|
108
118
|
pending: e.parsed,
|
|
109
119
|
viewMonth: e.parsed
|
|
110
|
-
})), a || (
|
|
120
|
+
})), a || (p?.(e.parsed), o(null));
|
|
111
121
|
return;
|
|
112
122
|
}
|
|
113
|
-
|
|
114
|
-
},
|
|
123
|
+
o(null);
|
|
124
|
+
}, fe = () => {
|
|
115
125
|
if (i && a) {
|
|
116
|
-
|
|
126
|
+
L();
|
|
117
127
|
return;
|
|
118
128
|
}
|
|
119
|
-
const e =
|
|
129
|
+
const e = Re(d, l, f);
|
|
120
130
|
if (e.parsed) {
|
|
121
|
-
a &&
|
|
131
|
+
a && ue(e.parsed);
|
|
122
132
|
return;
|
|
123
133
|
}
|
|
124
134
|
i || (y.current = !0, m(!0));
|
|
125
|
-
},
|
|
126
|
-
() =>
|
|
135
|
+
}, V = (n ? b(n, l, { locale: f }) : "") !== d, de = ve(d, l, f), me = r.useCallback(
|
|
136
|
+
() => Ie(
|
|
127
137
|
P,
|
|
128
138
|
n,
|
|
129
139
|
(e, t) => e.getTime() === t.getTime()
|
|
@@ -132,111 +142,121 @@ const Ge = xe(
|
|
|
132
142
|
);
|
|
133
143
|
return r.useLayoutEffect(() => {
|
|
134
144
|
N.current = {
|
|
135
|
-
onDismiss:
|
|
136
|
-
resolveFlash:
|
|
145
|
+
onDismiss: R,
|
|
146
|
+
resolveFlash: me
|
|
137
147
|
};
|
|
138
|
-
}), /* @__PURE__ */
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
148
|
+
}), /* @__PURE__ */ s(
|
|
149
|
+
Ve,
|
|
150
|
+
{
|
|
151
|
+
open: i,
|
|
152
|
+
disabled: c,
|
|
153
|
+
ariaLabel: h("datePicker.selectDate"),
|
|
154
|
+
onOpenChange: m,
|
|
155
|
+
onOpenAutoFocus: (e) => {
|
|
156
|
+
y.current || e.preventDefault(), y.current = !1;
|
|
157
|
+
},
|
|
158
|
+
popoverHandlers: se,
|
|
159
|
+
trigger: /* @__PURE__ */ s(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
ref: E,
|
|
163
|
+
"data-component": "date-picker",
|
|
164
|
+
"data-state": i ? "open" : "closed",
|
|
165
|
+
"data-pending": V || void 0,
|
|
166
|
+
onPointerDown: (e) => Ce({
|
|
167
|
+
disabled: c,
|
|
168
|
+
event: e,
|
|
169
|
+
onOpen: () => m(!0),
|
|
170
|
+
focusField: () => g.current?.focus()
|
|
171
|
+
}),
|
|
172
|
+
children: /* @__PURE__ */ s(
|
|
173
|
+
Se,
|
|
174
|
+
{
|
|
175
|
+
ref: g,
|
|
176
|
+
value: d,
|
|
177
|
+
onChange: ae,
|
|
178
|
+
onBlur: pe,
|
|
179
|
+
onClick: () => !c && m(!0),
|
|
180
|
+
onKeyDown: (e) => {
|
|
181
|
+
e.key === "Enter" && !c && (e.preventDefault(), fe()), e.key === "ArrowDown" && !i && !c && (e.preventDefault(), y.current = !0, m(!0)), e.key === "Escape" && i && (e.preventDefault(), R());
|
|
182
|
+
},
|
|
183
|
+
placeholder: i ? l : re,
|
|
184
|
+
disabled: c,
|
|
185
|
+
"data-form-control": "input",
|
|
186
|
+
className: ge(
|
|
187
|
+
"cursor-pointer",
|
|
188
|
+
de ? "text-destructive" : V ? "text-content-placeholder" : "",
|
|
189
|
+
Q
|
|
190
|
+
),
|
|
191
|
+
suffix: /* @__PURE__ */ S("div", { className: "flex items-center gap-1", children: [
|
|
192
|
+
n && !c && /* @__PURE__ */ S(j, { children: [
|
|
193
|
+
/* @__PURE__ */ s(B, { asChild: !0, children: /* @__PURE__ */ s(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
tabIndex: 0,
|
|
198
|
+
"aria-label": h("calendar.clear"),
|
|
199
|
+
onClick: (e) => {
|
|
200
|
+
e.stopPropagation(), O();
|
|
201
|
+
},
|
|
202
|
+
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
203
|
+
children: /* @__PURE__ */ s(he, { className: "size-3 hover:text-content" })
|
|
204
|
+
}
|
|
205
|
+
) }),
|
|
206
|
+
/* @__PURE__ */ s(K, { variant: "tertiary", side: "top", children: h("calendar.clear") })
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ S(j, { children: [
|
|
209
|
+
/* @__PURE__ */ s(B, { asChild: !0, children: /* @__PURE__ */ s("button", { type: "button", tabIndex: 0, "aria-label": h("datePicker.selectDate"), onClick: (e) => {
|
|
210
|
+
e.stopPropagation(), c || (i ? u() : m(!0));
|
|
211
|
+
}, onKeyDown: (e) => {
|
|
212
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), c || (y.current = !0, i ? u() : m(!0)));
|
|
213
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ s(De, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
214
|
+
/* @__PURE__ */ s(K, { variant: "tertiary", side: "top", children: h("datePicker.selectDate") })
|
|
215
|
+
] })
|
|
187
216
|
] }),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
onCancel: b,
|
|
230
|
-
onClear: V,
|
|
231
|
-
captionLayout: "dropdown",
|
|
232
|
-
...S !== void 0 ? { weekStartsOn: S } : {}
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
}
|
|
236
|
-
)
|
|
237
|
-
] });
|
|
217
|
+
...te
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
children: /* @__PURE__ */ s(
|
|
223
|
+
be,
|
|
224
|
+
{
|
|
225
|
+
mode: "single",
|
|
226
|
+
selected: P,
|
|
227
|
+
footerFlashKey: ie,
|
|
228
|
+
footerFlashTarget: oe,
|
|
229
|
+
onSelect: le,
|
|
230
|
+
month: ce,
|
|
231
|
+
onMonthChange: (e) => o(
|
|
232
|
+
(t) => t ? { ...t, viewMonth: e } : null
|
|
233
|
+
),
|
|
234
|
+
disabled: Le(H, q),
|
|
235
|
+
startMonth: G,
|
|
236
|
+
endMonth: J,
|
|
237
|
+
showFooter: a,
|
|
238
|
+
onApply: L,
|
|
239
|
+
onCancel: R,
|
|
240
|
+
onClear: O,
|
|
241
|
+
captionLayout: "dropdown",
|
|
242
|
+
...w !== void 0 ? { weekStartsOn: w } : {},
|
|
243
|
+
...Oe({
|
|
244
|
+
calendarKind: U,
|
|
245
|
+
fiscalMode: W,
|
|
246
|
+
granularity: X,
|
|
247
|
+
fiscalMonthPattern: Y,
|
|
248
|
+
fiscalYearStartMonth: Z,
|
|
249
|
+
fiscalConfig: _,
|
|
250
|
+
showPresets: $,
|
|
251
|
+
comparison: F,
|
|
252
|
+
onComparisonChange: ee
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
);
|
|
238
258
|
}
|
|
239
259
|
);
|
|
240
260
|
export {
|
|
241
|
-
|
|
261
|
+
$e as DatePicker
|
|
242
262
|
};
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { InputProps } from '../input/input.types';
|
|
2
|
-
import { MonthSelection,
|
|
2
|
+
import { MonthRange, MonthSelection, QuarterRange, QuarterSelection, WeekRange, WeekSelection, YearRange, YearSelection, YoYComparison } from '../../data-display/calendar';
|
|
3
3
|
import { DateRange } from 'react-day-picker';
|
|
4
|
-
|
|
4
|
+
import { FiscalCalendarConfig, Granularity } from '../../../lib/fiscal-calendar';
|
|
5
|
+
export interface FiscalPickerProps {
|
|
6
|
+
calendarKind?: "gregorian" | "fiscal";
|
|
7
|
+
fiscalMode?: "basic" | "advanced" | "custom";
|
|
8
|
+
granularity?: Granularity;
|
|
9
|
+
fiscalMonthPattern?: number[];
|
|
10
|
+
fiscalYearStartMonth?: number;
|
|
11
|
+
fiscalConfig?: FiscalCalendarConfig;
|
|
12
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
|
+
showPresets?: boolean;
|
|
14
|
+
comparison?: "prior-fy";
|
|
15
|
+
onComparisonChange?: (value: YoYComparison | undefined) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface DatePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
5
18
|
value?: Date;
|
|
6
19
|
onChange?: (date: Date | undefined) => void;
|
|
7
20
|
format?: string;
|
|
@@ -14,7 +27,7 @@ export interface DatePickerProps extends Omit<InputProps, 'value' | 'onChange' |
|
|
|
14
27
|
/** Which day the week starts on. 0 = Sunday, 1 = Monday, etc. */
|
|
15
28
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
16
29
|
}
|
|
17
|
-
export interface DateRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
30
|
+
export interface DateRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
18
31
|
value?: DateRange;
|
|
19
32
|
onChange?: (range: DateRange | undefined) => void;
|
|
20
33
|
format?: string;
|
|
@@ -25,10 +38,13 @@ export interface DateRangePickerProps extends Omit<InputProps, 'value' | 'onChan
|
|
|
25
38
|
startMonth?: Date;
|
|
26
39
|
endMonth?: Date;
|
|
27
40
|
showFooter?: boolean;
|
|
41
|
+
/** Date selection mode. Default: "range". */
|
|
42
|
+
mode?: "range" | "multi-range";
|
|
43
|
+
onRangesChange?: (ranges: DateRange[] | undefined) => void;
|
|
28
44
|
/** Which day the week starts on. 0 = Sunday, 1 = Monday, etc. */
|
|
29
45
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
30
46
|
}
|
|
31
|
-
export interface MonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
47
|
+
export interface MonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
32
48
|
value?: MonthSelection;
|
|
33
49
|
onChange?: (month: MonthSelection | undefined) => void;
|
|
34
50
|
placeholder?: string;
|
|
@@ -38,7 +54,7 @@ export interface MonthPickerProps extends Omit<InputProps, 'value' | 'onChange'
|
|
|
38
54
|
endMonth?: Date;
|
|
39
55
|
showFooter?: boolean;
|
|
40
56
|
}
|
|
41
|
-
export interface MonthRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
57
|
+
export interface MonthRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
42
58
|
value?: MonthRange;
|
|
43
59
|
onChange?: (range: MonthRange | undefined) => void;
|
|
44
60
|
placeholder?: string;
|
|
@@ -49,7 +65,7 @@ export interface MonthRangePickerProps extends Omit<InputProps, 'value' | 'onCha
|
|
|
49
65
|
showFooter?: boolean;
|
|
50
66
|
displayFormat?: "MM/YYYY" | "YYYY/MM";
|
|
51
67
|
}
|
|
52
|
-
export interface WeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
68
|
+
export interface WeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
53
69
|
value?: WeekSelection;
|
|
54
70
|
onChange?: (week: WeekSelection | undefined) => void;
|
|
55
71
|
format?: string;
|
|
@@ -59,19 +75,8 @@ export interface WeekPickerProps extends Omit<InputProps, 'value' | 'onChange' |
|
|
|
59
75
|
startMonth?: Date;
|
|
60
76
|
endMonth?: Date;
|
|
61
77
|
showFooter?: boolean;
|
|
62
|
-
/** Whether to use standard calendar weeks or fiscal weeks. Default: "calendar" */
|
|
63
|
-
calendarType?: "calendar" | "fiscal";
|
|
64
|
-
/** Only relevant when calendarType="fiscal". Default: "basic" */
|
|
65
|
-
fiscalMode?: "basic" | "advanced" | "custom";
|
|
66
|
-
/** What a click selects. "fiscalMonth" only applies with fiscalMode="advanced"|"custom". Default: "week" */
|
|
67
|
-
selectionMode?: "week" | "fiscalMonth";
|
|
68
|
-
/** Array of 12 week-counts per fiscal month, e.g. [4,4,5,4,4,5,4,4,5,4,4,5]. Required for fiscalMode="custom", optional for "advanced" (defaults to 4-4-5). */
|
|
69
|
-
fiscalMonthPattern?: number[];
|
|
70
|
-
/** 1-based month where the fiscal year starts. Default: 1 (January) */
|
|
71
|
-
fiscalYearStartMonth?: number;
|
|
72
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
73
78
|
}
|
|
74
|
-
export interface WeekRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
79
|
+
export interface WeekRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
75
80
|
value?: WeekRange;
|
|
76
81
|
onChange?: (range: WeekRange | undefined) => void;
|
|
77
82
|
format?: string;
|
|
@@ -81,19 +86,8 @@ export interface WeekRangePickerProps extends Omit<InputProps, 'value' | 'onChan
|
|
|
81
86
|
startMonth?: Date;
|
|
82
87
|
endMonth?: Date;
|
|
83
88
|
showFooter?: boolean;
|
|
84
|
-
/** Whether to use standard calendar weeks or fiscal weeks. Default: "calendar" */
|
|
85
|
-
calendarType?: "calendar" | "fiscal";
|
|
86
|
-
/** Only relevant when calendarType="fiscal". Default: "basic" */
|
|
87
|
-
fiscalMode?: "basic" | "advanced" | "custom";
|
|
88
|
-
/** What a click selects. "fiscalMonth" only applies with fiscalMode="advanced"|"custom". Default: "week" */
|
|
89
|
-
selectionMode?: "week" | "fiscalMonth";
|
|
90
|
-
/** Array of 12 week-counts per fiscal month, e.g. [4,4,5,4,4,5,4,4,5,4,4,5]. Required for fiscalMode="custom", optional for "advanced" (defaults to 4-4-5). */
|
|
91
|
-
fiscalMonthPattern?: number[];
|
|
92
|
-
/** 1-based month where the fiscal year starts. Default: 1 (January) */
|
|
93
|
-
fiscalYearStartMonth?: number;
|
|
94
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
95
89
|
}
|
|
96
|
-
export interface MultiDatePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
90
|
+
export interface MultiDatePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
97
91
|
value?: Date[];
|
|
98
92
|
onChange?: (dates: Date[] | undefined) => void;
|
|
99
93
|
format?: string;
|
|
@@ -104,7 +98,7 @@ export interface MultiDatePickerProps extends Omit<InputProps, 'value' | 'onChan
|
|
|
104
98
|
endMonth?: Date;
|
|
105
99
|
showFooter?: boolean;
|
|
106
100
|
}
|
|
107
|
-
export interface MultiMonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
101
|
+
export interface MultiMonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
108
102
|
value?: MonthSelection[];
|
|
109
103
|
onChange?: (months: MonthSelection[] | undefined) => void;
|
|
110
104
|
placeholder?: string;
|
|
@@ -114,7 +108,7 @@ export interface MultiMonthPickerProps extends Omit<InputProps, 'value' | 'onCha
|
|
|
114
108
|
endMonth?: Date;
|
|
115
109
|
showFooter?: boolean;
|
|
116
110
|
}
|
|
117
|
-
export interface MultiWeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'
|
|
111
|
+
export interface MultiWeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
118
112
|
value?: WeekSelection[];
|
|
119
113
|
onChange?: (weeks: WeekSelection[] | undefined) => void;
|
|
120
114
|
format?: string;
|
|
@@ -124,15 +118,68 @@ export interface MultiWeekPickerProps extends Omit<InputProps, 'value' | 'onChan
|
|
|
124
118
|
startMonth?: Date;
|
|
125
119
|
endMonth?: Date;
|
|
126
120
|
showFooter?: boolean;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
}
|
|
122
|
+
export interface QuarterPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
123
|
+
value?: QuarterSelection;
|
|
124
|
+
onChange?: (quarter: QuarterSelection | undefined) => void;
|
|
125
|
+
placeholder?: string;
|
|
126
|
+
minDate?: Date;
|
|
127
|
+
maxDate?: Date;
|
|
128
|
+
startMonth?: Date;
|
|
129
|
+
endMonth?: Date;
|
|
130
|
+
showFooter?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface QuarterRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
133
|
+
value?: QuarterRange;
|
|
134
|
+
onChange?: (range: QuarterRange | undefined) => void;
|
|
135
|
+
placeholder?: string;
|
|
136
|
+
minDate?: Date;
|
|
137
|
+
maxDate?: Date;
|
|
138
|
+
startMonth?: Date;
|
|
139
|
+
endMonth?: Date;
|
|
140
|
+
showFooter?: boolean;
|
|
141
|
+
}
|
|
142
|
+
export interface YearPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
143
|
+
value?: YearSelection;
|
|
144
|
+
onChange?: (year: YearSelection | undefined) => void;
|
|
145
|
+
placeholder?: string;
|
|
146
|
+
minDate?: Date;
|
|
147
|
+
maxDate?: Date;
|
|
148
|
+
startMonth?: Date;
|
|
149
|
+
endMonth?: Date;
|
|
150
|
+
showFooter?: boolean;
|
|
151
|
+
/** Show civil/FY start–end under year cells. Default false. */
|
|
152
|
+
showIntervalCaption?: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface YearRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
155
|
+
value?: YearRange;
|
|
156
|
+
onChange?: (range: YearRange | undefined) => void;
|
|
157
|
+
placeholder?: string;
|
|
158
|
+
minDate?: Date;
|
|
159
|
+
maxDate?: Date;
|
|
160
|
+
startMonth?: Date;
|
|
161
|
+
endMonth?: Date;
|
|
162
|
+
showFooter?: boolean;
|
|
163
|
+
showIntervalCaption?: boolean;
|
|
164
|
+
}
|
|
165
|
+
export interface MultiQuarterPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
166
|
+
value?: QuarterSelection[];
|
|
167
|
+
onChange?: (quarters: QuarterSelection[] | undefined) => void;
|
|
168
|
+
placeholder?: string;
|
|
169
|
+
minDate?: Date;
|
|
170
|
+
maxDate?: Date;
|
|
171
|
+
startMonth?: Date;
|
|
172
|
+
endMonth?: Date;
|
|
173
|
+
showFooter?: boolean;
|
|
174
|
+
}
|
|
175
|
+
export interface MultiYearPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
|
|
176
|
+
value?: YearSelection[];
|
|
177
|
+
onChange?: (years: YearSelection[] | undefined) => void;
|
|
178
|
+
placeholder?: string;
|
|
179
|
+
minDate?: Date;
|
|
180
|
+
maxDate?: Date;
|
|
181
|
+
startMonth?: Date;
|
|
182
|
+
endMonth?: Date;
|
|
183
|
+
showFooter?: boolean;
|
|
184
|
+
showIntervalCaption?: boolean;
|
|
138
185
|
}
|