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,34 +1,38 @@
|
|
|
1
1
|
import { jsx as u, jsxs as D } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { Cross as
|
|
3
|
+
import { Cross as qe, CalendarMonth as Le } from "impact-nova-icons";
|
|
4
4
|
import { cn as z } from "../../../lib/utils.js";
|
|
5
|
-
import { usePickerDismissActionsRef as
|
|
6
|
-
import { useFieldChrome as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
5
|
+
import { usePickerDismissActionsRef as Ge, usePickerFooterDismissNudge as Je, createRangePickerOpenChangeHandler as Qe, parseDateInput as H, normalizeOrderedRange as ee, compareMonthSelection as V, flashRangeReorder as te, isDateInputInvalid as re, resolveRangeFieldBlur as A, resolveRangePickerDismissFlash as Ue, handlePickerSurfacePointerDown as We, deferRangeInputBlur as Xe, maskDateInput as oe, resolveDateInputOnBlur as O } from "./date-input-behavior.js";
|
|
6
|
+
import { useFieldChrome as Ze } from "../../../lib/primitives/use-field-chrome.js";
|
|
7
|
+
import { Popover as _e, PopoverAnchor as Fe, PopoverContent as et } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as tt } from "../../data-display/calendar/calendar.js";
|
|
9
9
|
import { Tooltip as ne, TooltipTrigger as se, TooltipContent as ie } from "../../feedback/tooltip/tooltip.js";
|
|
10
|
-
import { useImpactNovaI18n as
|
|
11
|
-
import { coerceMonthRangeApply as
|
|
12
|
-
import { buildDateBoundsMatcher as
|
|
10
|
+
import { useImpactNovaI18n as rt } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { coerceMonthRangeApply as ot, isMonthRangeSelection as nt } from "./calendar-selection-adapters.js";
|
|
12
|
+
import { buildDateBoundsMatcher as st } from "../../../lib/date-bounds-matcher.js";
|
|
13
|
+
import { fiscalCalendarPassThrough as it } from "./fiscal-pass-through.js";
|
|
14
|
+
import { formatFiscalPeriod as at } from "./fiscal-period-format.js";
|
|
13
15
|
const h = (t, n = "MM/YYYY") => {
|
|
14
|
-
const E = (t
|
|
15
|
-
|
|
16
|
+
const E = at(t);
|
|
17
|
+
if (E) return E;
|
|
18
|
+
const k = (t.month + 1).toString().padStart(2, "0");
|
|
19
|
+
return n === "YYYY/MM" ? `${t.year}/${k}` : `${k}/${t.year}`;
|
|
16
20
|
};
|
|
17
|
-
function
|
|
21
|
+
function ct(t, n) {
|
|
18
22
|
if (!t && !n) return !0;
|
|
19
23
|
if (!t || !n) return !1;
|
|
20
|
-
const E = t.from === void 0 && n.from === void 0 || t.from !== void 0 && n.from !== void 0 && V(t.from, n.from) === 0,
|
|
21
|
-
return E &&
|
|
24
|
+
const E = t.from === void 0 && n.from === void 0 || t.from !== void 0 && n.from !== void 0 && V(t.from, n.from) === 0, k = t.to === void 0 && n.to === void 0 || t.to !== void 0 && n.to !== void 0 && V(t.to, n.to) === 0;
|
|
25
|
+
return E && k;
|
|
22
26
|
}
|
|
23
|
-
function
|
|
27
|
+
function b(t) {
|
|
24
28
|
return { month: t.getMonth(), year: t.getFullYear() };
|
|
25
29
|
}
|
|
26
|
-
const
|
|
30
|
+
const ft = s.forwardRef(
|
|
27
31
|
({
|
|
28
32
|
value: t,
|
|
29
33
|
onChange: n,
|
|
30
34
|
placeholder: E,
|
|
31
|
-
minDate:
|
|
35
|
+
minDate: k,
|
|
32
36
|
maxDate: ae,
|
|
33
37
|
startMonth: ce,
|
|
34
38
|
endMonth: fe,
|
|
@@ -36,36 +40,45 @@ const _e = s.forwardRef(
|
|
|
36
40
|
disabled: c,
|
|
37
41
|
className: de,
|
|
38
42
|
error: le,
|
|
39
|
-
isError:
|
|
43
|
+
isError: me,
|
|
40
44
|
size: q,
|
|
41
|
-
label:
|
|
45
|
+
label: pe,
|
|
42
46
|
helperText: ue,
|
|
43
47
|
helperTextPosition: he = "absolute",
|
|
44
48
|
required: ge,
|
|
45
|
-
prefix:
|
|
46
|
-
prefixClick:
|
|
49
|
+
prefix: dt,
|
|
50
|
+
prefixClick: lt,
|
|
47
51
|
displayFormat: i = "MM/YYYY",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
calendarKind: Me,
|
|
53
|
+
fiscalMode: Re,
|
|
54
|
+
granularity: ye,
|
|
55
|
+
fiscalMonthPattern: ke,
|
|
56
|
+
fiscalYearStartMonth: ve,
|
|
57
|
+
fiscalConfig: xe,
|
|
58
|
+
showPresets: Ye,
|
|
59
|
+
comparison: Ce,
|
|
60
|
+
onComparisonChange: Pe,
|
|
61
|
+
...be
|
|
62
|
+
}, we) => {
|
|
63
|
+
const L = le ?? me, Ie = Ze({
|
|
64
|
+
label: pe,
|
|
52
65
|
helperText: ue,
|
|
53
66
|
helperTextPosition: he,
|
|
54
67
|
error: L,
|
|
55
68
|
required: ge,
|
|
56
69
|
disabled: c ?? void 0,
|
|
57
70
|
rootClassName: "w-full min-w-[240px]"
|
|
58
|
-
}), { t:
|
|
71
|
+
}), { t: Y } = rt(), K = s.useRef(null), G = s.useRef(null), J = s.useRef(null), S = s.useRef(null), j = s.useRef(null), d = s.useMemo(
|
|
59
72
|
() => i === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
|
|
60
73
|
[i]
|
|
61
74
|
);
|
|
62
|
-
s.useImperativeHandle(
|
|
63
|
-
const [
|
|
75
|
+
s.useImperativeHandle(we, () => K.current);
|
|
76
|
+
const [m, M] = s.useState(!1), Q = Ge(), { footerFlashKey: De, footerFlashTarget: Ee, popoverHandlers: Se } = Je(g, m, Q, J), I = s.useRef(!1), [f, R] = s.useState(t), [p, v] = s.useState(t?.from ? h(t.from, i) : ""), [y, x] = s.useState(t?.to ? h(t.to, i) : ""), [Te, w] = s.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : k || /* @__PURE__ */ new Date());
|
|
64
77
|
s.useEffect(() => {
|
|
65
|
-
|
|
78
|
+
v(t?.from ? h(t.from, i) : ""), x(t?.to ? h(t.to, i) : ""), R(t);
|
|
66
79
|
}, [t, i]);
|
|
67
|
-
const
|
|
68
|
-
(e) =>
|
|
80
|
+
const Be = s.useCallback(
|
|
81
|
+
(e) => Qe({
|
|
69
82
|
disabled: c ?? void 0,
|
|
70
83
|
showFooter: g,
|
|
71
84
|
containerRef: S,
|
|
@@ -75,104 +88,104 @@ const _e = s.forwardRef(
|
|
|
75
88
|
[c, g]
|
|
76
89
|
), U = s.useRef(!1);
|
|
77
90
|
s.useEffect(() => {
|
|
78
|
-
if (
|
|
79
|
-
const e = H(
|
|
80
|
-
e.parsed ? w(e.parsed) : f?.from ? w(new Date(f.from.year, f.from.month, 1)) : t?.from ? w(new Date(t.from.year, t.from.month, 1)) :
|
|
91
|
+
if (m && !U.current) {
|
|
92
|
+
const e = H(p, d);
|
|
93
|
+
e.parsed ? w(e.parsed) : f?.from ? w(new Date(f.from.year, f.from.month, 1)) : t?.from ? w(new Date(t.from.year, t.from.month, 1)) : k && w(k);
|
|
81
94
|
}
|
|
82
|
-
U.current =
|
|
83
|
-
}, [
|
|
84
|
-
const
|
|
85
|
-
const r =
|
|
86
|
-
R(r), r?.from &&
|
|
95
|
+
U.current = m;
|
|
96
|
+
}, [m, p, d, f?.from, t?.from, k]);
|
|
97
|
+
const Ne = (e) => {
|
|
98
|
+
const r = nt(e) ? e : void 0;
|
|
99
|
+
R(r), r?.from && v(h(r.from, i)), r?.to && x(h(r.to, i)), !g && r?.from && r?.to && (r.from.month !== r.to.month || r.from.year !== r.to.year) && (n?.(r), M(!1));
|
|
87
100
|
}, W = (e) => {
|
|
88
|
-
const r =
|
|
89
|
-
o.swapped && (o.from &&
|
|
101
|
+
const r = ot(e, f), o = ee(r?.from, r?.to, V);
|
|
102
|
+
o.swapped && (o.from && v(h(o.from, i)), o.to && x(h(o.to, i)), R({ from: o.from, to: o.to }), te(S.current)), n?.({ from: o.from, to: o.to }), M(!1);
|
|
90
103
|
}, B = () => {
|
|
91
|
-
R(t),
|
|
104
|
+
R(t), v(t?.from ? h(t.from, i) : ""), x(t?.to ? h(t.to, i) : ""), M(!1);
|
|
92
105
|
}, $ = () => {
|
|
93
|
-
R(void 0),
|
|
94
|
-
},
|
|
95
|
-
const r = oe(e.target.value, d,
|
|
96
|
-
if (
|
|
106
|
+
R(void 0), v(""), x(""), n?.(void 0), g || M(!1);
|
|
107
|
+
}, Ae = (e) => {
|
|
108
|
+
const r = oe(e.target.value, d, p);
|
|
109
|
+
if (v(r), r === "") {
|
|
97
110
|
const l = { from: void 0, to: f?.to };
|
|
98
111
|
R(l), g || n?.(l);
|
|
99
112
|
return;
|
|
100
113
|
}
|
|
101
114
|
const { parsed: o, isValid: a } = H(r, d);
|
|
102
115
|
if (a && o) {
|
|
103
|
-
const T = { from:
|
|
116
|
+
const T = { from: b(o), to: f?.to };
|
|
104
117
|
R(T), w(o), g || n?.(T);
|
|
105
118
|
}
|
|
106
|
-
},
|
|
119
|
+
}, Oe = (e) => {
|
|
107
120
|
const r = oe(e.target.value, d, y);
|
|
108
|
-
if (
|
|
121
|
+
if (x(r), r === "") {
|
|
109
122
|
const l = { from: f?.from, to: void 0 };
|
|
110
123
|
R(l), g || n?.(l);
|
|
111
124
|
return;
|
|
112
125
|
}
|
|
113
126
|
const { parsed: o, isValid: a } = H(r, d);
|
|
114
127
|
if (a && o) {
|
|
115
|
-
const l =
|
|
128
|
+
const l = b(o), T = { from: f?.from, to: l };
|
|
116
129
|
R(T), w(o), g || n?.(T);
|
|
117
130
|
}
|
|
118
131
|
}, N = s.useCallback((e, r) => {
|
|
119
132
|
const o = ee(e, r, V);
|
|
120
|
-
return o.swapped && (o.from &&
|
|
121
|
-
}, [i]),
|
|
122
|
-
const e = O(
|
|
123
|
-
e.resetToCommitted ?
|
|
124
|
-
let o = e.parsed ?
|
|
133
|
+
return o.swapped && (o.from && v(h(o.from, i)), o.to && x(h(o.to, i)), te(S.current)), { from: o.from, to: o.to };
|
|
134
|
+
}, [i]), Ve = () => {
|
|
135
|
+
const e = O(p, d, C), r = O(y, d, P);
|
|
136
|
+
e.resetToCommitted ? v(C) : e.parsed && v(e.display), r.resetToCommitted ? x(P) : r.parsed && x(r.display);
|
|
137
|
+
let o = e.parsed ? b(e.parsed) : f?.from, a = r.parsed ? b(r.parsed) : f?.to;
|
|
125
138
|
if ({ from: o, to: a } = N(o, a), o || a) {
|
|
126
139
|
const l = { from: o, to: a };
|
|
127
140
|
R(l), n?.(l);
|
|
128
|
-
} else !
|
|
141
|
+
} else !p && !y && (R(void 0), n?.(void 0));
|
|
129
142
|
}, X = () => {
|
|
130
|
-
|
|
143
|
+
Xe(
|
|
131
144
|
S,
|
|
132
145
|
j,
|
|
133
146
|
() => {
|
|
134
|
-
const e = A(
|
|
135
|
-
e.resetToCommitted ?
|
|
136
|
-
let o = e.parsed ?
|
|
147
|
+
const e = A(p, d, C), r = A(y, d, P);
|
|
148
|
+
e.resetToCommitted ? v(C) : e.parsed && v(e.display), r.resetToCommitted ? x(P) : r.parsed && x(r.display);
|
|
149
|
+
let o = e.parsed ? b(e.parsed) : e.resetToCommitted ? t?.from : f?.from, a = r.parsed ? b(r.parsed) : r.resetToCommitted ? t?.to : f?.to;
|
|
137
150
|
o && a && ({ from: o, to: a } = N(o, a));
|
|
138
151
|
const l = o || a ? { from: o, to: a } : void 0;
|
|
139
|
-
R(l), g || (l ? n?.(l) : !
|
|
152
|
+
R(l), g || (l ? n?.(l) : !p && !y && n?.(void 0));
|
|
140
153
|
}
|
|
141
154
|
);
|
|
142
155
|
}, Z = () => {
|
|
143
|
-
if (
|
|
156
|
+
if (m && g) {
|
|
144
157
|
W();
|
|
145
158
|
return;
|
|
146
159
|
}
|
|
147
|
-
if (!
|
|
160
|
+
if (!m) {
|
|
148
161
|
if (g) {
|
|
149
|
-
|
|
162
|
+
Ve();
|
|
150
163
|
return;
|
|
151
164
|
}
|
|
152
|
-
const e = O(
|
|
165
|
+
const e = O(p, d, C), r = O(y, d, P);
|
|
153
166
|
if (e.parsed || r.parsed) return;
|
|
154
167
|
I.current = !0, M(!0);
|
|
155
168
|
}
|
|
156
|
-
},
|
|
157
|
-
const e = A(
|
|
158
|
-
let o = e.parsed ?
|
|
169
|
+
}, C = t?.from ? h(t.from, i) : "", P = t?.to ? h(t.to, i) : "", Ke = p !== C, je = y !== P, $e = re(p, d), ze = re(y, d), _ = Y("datePicker.startMonth"), F = Y("datePicker.endMonth"), He = s.useCallback(() => {
|
|
170
|
+
const e = A(p, d, C), r = A(y, d, P);
|
|
171
|
+
let o = e.parsed ? b(e.parsed) : e.resetToCommitted ? t?.from : f?.from, a = r.parsed ? b(r.parsed) : r.resetToCommitted ? t?.to : f?.to;
|
|
159
172
|
o && a && ({ from: o, to: a } = N(o, a));
|
|
160
173
|
const l = o || a ? { from: o, to: a } : void 0;
|
|
161
|
-
return
|
|
162
|
-
startInput:
|
|
174
|
+
return Ue({
|
|
175
|
+
startInput: p,
|
|
163
176
|
endInput: y,
|
|
164
|
-
committedStart:
|
|
165
|
-
committedEnd:
|
|
177
|
+
committedStart: C,
|
|
178
|
+
committedEnd: P,
|
|
166
179
|
committedRange: t,
|
|
167
180
|
pendingRange: f,
|
|
168
181
|
computeEffectiveRange: () => l,
|
|
169
|
-
rangesEqual:
|
|
182
|
+
rangesEqual: ct
|
|
170
183
|
});
|
|
171
184
|
}, [
|
|
172
|
-
|
|
185
|
+
p,
|
|
173
186
|
y,
|
|
174
|
-
Y,
|
|
175
187
|
C,
|
|
188
|
+
P,
|
|
176
189
|
t,
|
|
177
190
|
f,
|
|
178
191
|
d,
|
|
@@ -181,7 +194,7 @@ const _e = s.forwardRef(
|
|
|
181
194
|
return s.useLayoutEffect(() => {
|
|
182
195
|
Q.current = {
|
|
183
196
|
onDismiss: B,
|
|
184
|
-
resolveFlash:
|
|
197
|
+
resolveFlash: He
|
|
185
198
|
};
|
|
186
199
|
}), /* @__PURE__ */ u(
|
|
187
200
|
"div",
|
|
@@ -189,14 +202,14 @@ const _e = s.forwardRef(
|
|
|
189
202
|
ref: J,
|
|
190
203
|
"data-component": "month-range-picker",
|
|
191
204
|
"data-disabled": c || void 0,
|
|
192
|
-
children:
|
|
193
|
-
/* @__PURE__ */ D(
|
|
194
|
-
/* @__PURE__ */ u(
|
|
205
|
+
children: Ie.wrapControl(
|
|
206
|
+
/* @__PURE__ */ D(_e, { open: c ? !1 : m, onOpenChange: Be, children: [
|
|
207
|
+
/* @__PURE__ */ u(Fe, { asChild: !0, children: /* @__PURE__ */ D(
|
|
195
208
|
"div",
|
|
196
209
|
{
|
|
197
210
|
ref: S,
|
|
198
|
-
"data-state":
|
|
199
|
-
onPointerDown: (e) =>
|
|
211
|
+
"data-state": m ? "open" : "closed",
|
|
212
|
+
onPointerDown: (e) => We({
|
|
200
213
|
disabled: c,
|
|
201
214
|
event: e,
|
|
202
215
|
onOpen: () => M(!0),
|
|
@@ -219,22 +232,22 @@ const _e = s.forwardRef(
|
|
|
219
232
|
{
|
|
220
233
|
ref: K,
|
|
221
234
|
type: "text",
|
|
222
|
-
value:
|
|
223
|
-
onChange:
|
|
235
|
+
value: p,
|
|
236
|
+
onChange: Ae,
|
|
224
237
|
onBlur: X,
|
|
225
238
|
onClick: () => !c && M(!0),
|
|
226
239
|
onKeyDown: (e) => {
|
|
227
|
-
e.key === "Enter" && !c && (e.preventDefault(), Z()), e.key === "ArrowDown" && !
|
|
240
|
+
e.key === "Enter" && !c && (e.preventDefault(), Z()), e.key === "ArrowDown" && !m && !c && (e.preventDefault(), I.current = !0, M(!0)), e.key === "Escape" && m && (e.preventDefault(), B());
|
|
228
241
|
},
|
|
229
|
-
placeholder:
|
|
242
|
+
placeholder: m ? i === "YYYY/MM" ? "YYYY/MM" : Y("datePicker.monthYearFormat") : _,
|
|
230
243
|
disabled: !!c,
|
|
231
244
|
"aria-label": _,
|
|
232
245
|
"data-field": "start",
|
|
233
246
|
className: z(
|
|
234
247
|
"flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
|
|
235
|
-
|
|
248
|
+
$e ? "text-destructive" : Ke ? "text-content-placeholder" : ""
|
|
236
249
|
),
|
|
237
|
-
...
|
|
250
|
+
...be
|
|
238
251
|
}
|
|
239
252
|
),
|
|
240
253
|
/* @__PURE__ */ u(
|
|
@@ -243,19 +256,19 @@ const _e = s.forwardRef(
|
|
|
243
256
|
ref: G,
|
|
244
257
|
type: "text",
|
|
245
258
|
value: y,
|
|
246
|
-
onChange:
|
|
259
|
+
onChange: Oe,
|
|
247
260
|
onBlur: X,
|
|
248
261
|
onClick: () => !c && M(!0),
|
|
249
262
|
onKeyDown: (e) => {
|
|
250
|
-
e.key === "Enter" && !c && (e.preventDefault(), Z()), e.key === "ArrowDown" && !
|
|
263
|
+
e.key === "Enter" && !c && (e.preventDefault(), Z()), e.key === "ArrowDown" && !m && !c && (e.preventDefault(), I.current = !0, M(!0)), e.key === "Escape" && m && (e.preventDefault(), B());
|
|
251
264
|
},
|
|
252
|
-
placeholder:
|
|
265
|
+
placeholder: m ? i === "YYYY/MM" ? "YYYY/MM" : Y("datePicker.monthYearFormat") : F,
|
|
253
266
|
disabled: !!c,
|
|
254
267
|
"aria-label": F,
|
|
255
268
|
"data-field": "end",
|
|
256
269
|
className: z(
|
|
257
270
|
"flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
|
|
258
|
-
|
|
271
|
+
ze ? "text-destructive" : je ? "text-content-placeholder" : ""
|
|
259
272
|
)
|
|
260
273
|
}
|
|
261
274
|
)
|
|
@@ -267,7 +280,7 @@ const _e = s.forwardRef(
|
|
|
267
280
|
{
|
|
268
281
|
type: "button",
|
|
269
282
|
tabIndex: 0,
|
|
270
|
-
"aria-label":
|
|
283
|
+
"aria-label": Y("calendar.clear"),
|
|
271
284
|
onClick: (e) => {
|
|
272
285
|
e.stopPropagation(), $();
|
|
273
286
|
},
|
|
@@ -275,52 +288,63 @@ const _e = s.forwardRef(
|
|
|
275
288
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), $());
|
|
276
289
|
},
|
|
277
290
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
278
|
-
children: /* @__PURE__ */ u(
|
|
291
|
+
children: /* @__PURE__ */ u(qe, { className: "size-3 hover:text-content text-content-icon" })
|
|
279
292
|
}
|
|
280
293
|
) }),
|
|
281
|
-
/* @__PURE__ */ u(ie, { variant: "tertiary", side: "top", children:
|
|
294
|
+
/* @__PURE__ */ u(ie, { variant: "tertiary", side: "top", children: Y("calendar.clear") })
|
|
282
295
|
] }),
|
|
283
296
|
/* @__PURE__ */ D(ne, { children: [
|
|
284
|
-
/* @__PURE__ */ u(se, { asChild: !0, children: /* @__PURE__ */ u("button", { type: "button", tabIndex: 0, "aria-label":
|
|
285
|
-
e.stopPropagation(), c || M(!
|
|
297
|
+
/* @__PURE__ */ u(se, { asChild: !0, children: /* @__PURE__ */ u("button", { type: "button", tabIndex: 0, "aria-label": Y("datePicker.selectMonthRange"), onClick: (e) => {
|
|
298
|
+
e.stopPropagation(), c || M(!m);
|
|
286
299
|
}, onKeyDown: (e) => {
|
|
287
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), c || (I.current = !0, M(!
|
|
288
|
-
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(
|
|
289
|
-
/* @__PURE__ */ u(ie, { variant: "tertiary", side: "top", children:
|
|
300
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), c || (I.current = !0, M(!m)));
|
|
301
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(Le, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
302
|
+
/* @__PURE__ */ u(ie, { variant: "tertiary", side: "top", children: Y("datePicker.selectMonthRange") })
|
|
290
303
|
] })
|
|
291
304
|
] })
|
|
292
305
|
]
|
|
293
306
|
}
|
|
294
307
|
) }),
|
|
295
308
|
/* @__PURE__ */ u(
|
|
296
|
-
|
|
309
|
+
et,
|
|
297
310
|
{
|
|
298
311
|
ref: j,
|
|
299
312
|
className: "w-auto p-0",
|
|
300
313
|
align: "start",
|
|
301
|
-
"aria-label":
|
|
314
|
+
"aria-label": Y("datePicker.selectMonthRange"),
|
|
302
315
|
onOpenAutoFocus: (e) => {
|
|
303
316
|
I.current || e.preventDefault(), I.current = !1;
|
|
304
317
|
},
|
|
305
|
-
...
|
|
318
|
+
...Se,
|
|
306
319
|
children: /* @__PURE__ */ u(
|
|
307
|
-
|
|
320
|
+
tt,
|
|
308
321
|
{
|
|
309
322
|
pickerType: "month",
|
|
310
323
|
monthMode: "range",
|
|
311
324
|
selectedMonths: f,
|
|
312
|
-
footerFlashKey:
|
|
313
|
-
footerFlashTarget:
|
|
314
|
-
onMonthSelect:
|
|
315
|
-
month:
|
|
325
|
+
footerFlashKey: De,
|
|
326
|
+
footerFlashTarget: Ee,
|
|
327
|
+
onMonthSelect: Ne,
|
|
328
|
+
month: Te,
|
|
316
329
|
onMonthChange: w,
|
|
317
|
-
disabled:
|
|
330
|
+
disabled: st(k, ae),
|
|
318
331
|
startMonth: ce,
|
|
319
332
|
endMonth: fe,
|
|
320
333
|
showFooter: g,
|
|
321
334
|
onApply: W,
|
|
322
335
|
onCancel: B,
|
|
323
|
-
onClear:
|
|
336
|
+
onClear: $,
|
|
337
|
+
...it({
|
|
338
|
+
calendarKind: Me,
|
|
339
|
+
fiscalMode: Re,
|
|
340
|
+
granularity: ye,
|
|
341
|
+
fiscalMonthPattern: ke,
|
|
342
|
+
fiscalYearStartMonth: ve,
|
|
343
|
+
fiscalConfig: xe,
|
|
344
|
+
showPresets: Ye,
|
|
345
|
+
comparison: Ce,
|
|
346
|
+
onComparisonChange: Pe
|
|
347
|
+
})
|
|
324
348
|
}
|
|
325
349
|
)
|
|
326
350
|
}
|
|
@@ -331,7 +355,7 @@ const _e = s.forwardRef(
|
|
|
331
355
|
);
|
|
332
356
|
}
|
|
333
357
|
);
|
|
334
|
-
|
|
358
|
+
ft.displayName = "MonthRangePicker";
|
|
335
359
|
export {
|
|
336
|
-
|
|
360
|
+
ft as MonthRangePicker
|
|
337
361
|
};
|