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