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