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