impact-nova 2.5.13 → 2.5.15
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/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/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/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 +58 -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 +58 -0
- package/dist/form-react/Fields/YearRangePickerField.d.ts +8 -0
- package/dist/form-react/Fields/YearRangePickerField.js +58 -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 +72 -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,18 +1,18 @@
|
|
|
1
1
|
import { jsx as r, jsxs as y } from "react/jsx-runtime";
|
|
2
2
|
import * as t from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Calendar as
|
|
3
|
+
import { Cross as _, CalendarMonth as $ } from "impact-nova-icons";
|
|
4
|
+
import { cn as ee } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as re } from "../input/input.js";
|
|
6
|
+
import { Calendar as te } from "../../data-display/calendar/calendar.js";
|
|
7
7
|
import { Tooltip as x, TooltipTrigger as R, TooltipContent as D } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { buildDateBoundsMatcher as
|
|
10
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
-
import { DatePickerShell as
|
|
12
|
-
import { usePickerDismissActionsRef as
|
|
13
|
-
import { formatYearInput as
|
|
14
|
-
import { viewMonthFromYear as
|
|
15
|
-
const
|
|
8
|
+
import { useImpactNovaI18n as ne } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as oe } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as ae } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as ie } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as ce, usePickerFooterDismissNudge as se, handleReadonlyPickerKeyDown as le, handlePickerSurfacePointerDown as pe } from "./date-input-behavior.js";
|
|
13
|
+
import { formatYearInput as fe } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
+
import { viewMonthFromYear as de } from "../../data-display/calendar/calendar-year-utils.js";
|
|
15
|
+
const me = t.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
value: n,
|
|
18
18
|
onChange: d,
|
|
@@ -30,30 +30,34 @@ const fe = t.forwardRef(
|
|
|
30
30
|
fiscalMonthPattern: M,
|
|
31
31
|
fiscalYearStartMonth: K,
|
|
32
32
|
fiscalConfig: k,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
33
|
+
weekStartsOn: j,
|
|
34
|
+
showPresets: F,
|
|
35
|
+
showPeriodBoundaries: L,
|
|
36
|
+
autoNavigateToAvailable: z,
|
|
37
|
+
showIntervalCaption: E = !1,
|
|
38
|
+
...H
|
|
39
|
+
}, V) => {
|
|
40
|
+
const { t: a } = ne(), B = Y ?? a("datePicker.selectYear"), m = t.useRef(null), P = t.useRef(null);
|
|
41
|
+
t.useImperativeHandle(V, () => m.current);
|
|
42
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), g = ce(), { footerFlashKey: q, footerFlashTarget: G, popoverHandlers: J } = se(s, i, g, P), [C, l] = t.useState(n), [Q, U] = t.useState(de(n));
|
|
41
43
|
t.useEffect(() => {
|
|
42
44
|
i || l(n);
|
|
43
45
|
}, [i, n]);
|
|
44
|
-
const p = t.useCallback(() => c(!1), []),
|
|
46
|
+
const p = t.useCallback(() => c(!1), []), W = ae({
|
|
45
47
|
calendarKind: O,
|
|
46
48
|
fiscalMode: T,
|
|
47
49
|
granularity: w,
|
|
48
50
|
fiscalMonthPattern: M,
|
|
49
51
|
fiscalYearStartMonth: K,
|
|
50
52
|
fiscalConfig: k,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
weekStartsOn: j,
|
|
54
|
+
showPresets: F,
|
|
55
|
+
showPeriodBoundaries: L,
|
|
56
|
+
autoNavigateToAvailable: z
|
|
57
|
+
}), X = (e) => {
|
|
54
58
|
const f = e && !Array.isArray(e) && !("from" in e) && !("to" in e) ? e : void 0;
|
|
55
59
|
l(f), s || (d?.(f), p());
|
|
56
|
-
},
|
|
60
|
+
}, Z = () => {
|
|
57
61
|
d?.(C), p();
|
|
58
62
|
}, h = () => {
|
|
59
63
|
l(n), p();
|
|
@@ -63,7 +67,7 @@ const fe = t.forwardRef(
|
|
|
63
67
|
return t.useLayoutEffect(() => {
|
|
64
68
|
g.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
65
69
|
}), /* @__PURE__ */ r(
|
|
66
|
-
|
|
70
|
+
ie,
|
|
67
71
|
{
|
|
68
72
|
open: i,
|
|
69
73
|
disabled: o,
|
|
@@ -74,26 +78,26 @@ const fe = t.forwardRef(
|
|
|
74
78
|
onOpenAutoFocus: (e) => {
|
|
75
79
|
u.current || e.preventDefault(), u.current = !1;
|
|
76
80
|
},
|
|
77
|
-
popoverHandlers:
|
|
81
|
+
popoverHandlers: J,
|
|
78
82
|
trigger: /* @__PURE__ */ r(
|
|
79
83
|
"div",
|
|
80
84
|
{
|
|
81
85
|
ref: P,
|
|
82
86
|
"data-component": "year-picker",
|
|
83
87
|
"data-state": i ? "open" : "closed",
|
|
84
|
-
onPointerDown: (e) =>
|
|
88
|
+
onPointerDown: (e) => pe({
|
|
85
89
|
disabled: o,
|
|
86
90
|
event: e,
|
|
87
91
|
onOpen: () => c(!0),
|
|
88
92
|
focusField: () => m.current?.focus()
|
|
89
93
|
}),
|
|
90
94
|
children: /* @__PURE__ */ r(
|
|
91
|
-
|
|
95
|
+
re,
|
|
92
96
|
{
|
|
93
97
|
ref: m,
|
|
94
|
-
value: n ?
|
|
98
|
+
value: n ? fe(n, k?.fyLabel ?? "fy-long") : "",
|
|
95
99
|
readOnly: !0,
|
|
96
|
-
onKeyDown: (e) =>
|
|
100
|
+
onKeyDown: (e) => le(e, {
|
|
97
101
|
disabled: o,
|
|
98
102
|
open: i,
|
|
99
103
|
onOpen: () => c(!0),
|
|
@@ -103,10 +107,10 @@ const fe = t.forwardRef(
|
|
|
103
107
|
}
|
|
104
108
|
}),
|
|
105
109
|
onClick: () => !o && c(!0),
|
|
106
|
-
placeholder:
|
|
110
|
+
placeholder: B,
|
|
107
111
|
disabled: o,
|
|
108
112
|
"data-form-control": "input",
|
|
109
|
-
className:
|
|
113
|
+
className: ee("cursor-pointer", I),
|
|
110
114
|
suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
|
|
111
115
|
n && !o ? /* @__PURE__ */ y(x, { children: [
|
|
112
116
|
/* @__PURE__ */ r(R, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -119,7 +123,7 @@ const fe = t.forwardRef(
|
|
|
119
123
|
e.stopPropagation(), b();
|
|
120
124
|
},
|
|
121
125
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
122
|
-
children: /* @__PURE__ */ r(
|
|
126
|
+
children: /* @__PURE__ */ r(_, { className: "size-3 hover:text-content" })
|
|
123
127
|
}
|
|
124
128
|
) }),
|
|
125
129
|
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
@@ -136,43 +140,43 @@ const fe = t.forwardRef(
|
|
|
136
140
|
e.stopPropagation(), o || c((f) => !f);
|
|
137
141
|
},
|
|
138
142
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
139
|
-
children: /* @__PURE__ */ r(
|
|
143
|
+
children: /* @__PURE__ */ r($, { className: "h-4 w-4 text-secondary-foreground" })
|
|
140
144
|
}
|
|
141
145
|
) }),
|
|
142
146
|
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("datePicker.selectYear") })
|
|
143
147
|
] })
|
|
144
148
|
] }),
|
|
145
|
-
...
|
|
149
|
+
...H
|
|
146
150
|
}
|
|
147
151
|
)
|
|
148
152
|
}
|
|
149
153
|
),
|
|
150
154
|
children: /* @__PURE__ */ r(
|
|
151
|
-
|
|
155
|
+
te,
|
|
152
156
|
{
|
|
153
157
|
pickerType: "year",
|
|
154
158
|
selectedYear: C,
|
|
155
|
-
footerFlashKey:
|
|
156
|
-
footerFlashTarget:
|
|
157
|
-
onYearSelect:
|
|
158
|
-
month:
|
|
159
|
-
onMonthChange:
|
|
160
|
-
disabled:
|
|
159
|
+
footerFlashKey: q,
|
|
160
|
+
footerFlashTarget: G,
|
|
161
|
+
onYearSelect: X,
|
|
162
|
+
month: Q,
|
|
163
|
+
onMonthChange: U,
|
|
164
|
+
disabled: oe(v, N),
|
|
161
165
|
startMonth: S,
|
|
162
166
|
endMonth: A,
|
|
163
167
|
showFooter: s,
|
|
164
|
-
onApply:
|
|
168
|
+
onApply: Z,
|
|
165
169
|
onCancel: h,
|
|
166
170
|
onClear: b,
|
|
167
|
-
showIntervalCaption:
|
|
168
|
-
...
|
|
171
|
+
showIntervalCaption: E,
|
|
172
|
+
...W
|
|
169
173
|
}
|
|
170
174
|
)
|
|
171
175
|
}
|
|
172
176
|
);
|
|
173
177
|
}
|
|
174
178
|
);
|
|
175
|
-
|
|
179
|
+
me.displayName = "YearPicker";
|
|
176
180
|
export {
|
|
177
|
-
|
|
181
|
+
me as YearPicker
|
|
178
182
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as r, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import * as t from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Calendar as
|
|
3
|
+
import { Cross as re, CalendarMonth as te } from "impact-nova-icons";
|
|
4
|
+
import { cn as ne } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as oe } from "../input/input.js";
|
|
6
|
+
import { Calendar as ae } from "../../data-display/calendar/calendar.js";
|
|
7
7
|
import { Tooltip as x, TooltipTrigger as D, TooltipContent as Y } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { buildDateBoundsMatcher as
|
|
10
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
-
import { DatePickerShell as
|
|
12
|
-
import { usePickerDismissActionsRef as
|
|
8
|
+
import { useImpactNovaI18n as ie } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as ce } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as se } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as le } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as fe, usePickerFooterDismissNudge as pe, handleReadonlyPickerKeyDown as de, handlePickerSurfacePointerDown as me } from "./date-input-behavior.js";
|
|
13
13
|
import { formatYearInput as N } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
-
import { viewMonthFromYear as
|
|
15
|
-
const
|
|
14
|
+
import { viewMonthFromYear as ue } from "../../data-display/calendar/calendar-year-utils.js";
|
|
15
|
+
const he = t.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
value: n,
|
|
18
18
|
onChange: d,
|
|
@@ -30,30 +30,34 @@ const me = t.forwardRef(
|
|
|
30
30
|
fiscalMonthPattern: j,
|
|
31
31
|
fiscalYearStartMonth: F,
|
|
32
32
|
fiscalConfig: y,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
33
|
+
weekStartsOn: L,
|
|
34
|
+
showPresets: $,
|
|
35
|
+
showPeriodBoundaries: z,
|
|
36
|
+
autoNavigateToAvailable: E,
|
|
37
|
+
showIntervalCaption: H = !1,
|
|
38
|
+
...V
|
|
39
|
+
}, B) => {
|
|
40
|
+
const { t: a } = ie(), q = S ?? a("datePicker.selectYearRange"), k = y?.fyLabel ?? "fy-long", m = t.useRef(null), P = t.useRef(null);
|
|
41
|
+
t.useImperativeHandle(B, () => m.current);
|
|
42
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), R = fe(), { footerFlashKey: G, footerFlashTarget: J, popoverHandlers: Q } = pe(l, i, R, P), [C, f] = t.useState(n), [U, W] = t.useState(ue(n?.from));
|
|
41
43
|
t.useEffect(() => {
|
|
42
44
|
i || f(n);
|
|
43
45
|
}, [i, n]);
|
|
44
|
-
const p = t.useCallback(() => c(!1), []),
|
|
46
|
+
const p = t.useCallback(() => c(!1), []), X = se({
|
|
45
47
|
calendarKind: T,
|
|
46
48
|
fiscalMode: w,
|
|
47
49
|
granularity: K,
|
|
48
50
|
fiscalMonthPattern: j,
|
|
49
51
|
fiscalYearStartMonth: F,
|
|
50
52
|
fiscalConfig: y,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
weekStartsOn: L,
|
|
54
|
+
showPresets: $,
|
|
55
|
+
showPeriodBoundaries: z,
|
|
56
|
+
autoNavigateToAvailable: E
|
|
57
|
+
}), Z = (e) => {
|
|
54
58
|
const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
|
|
55
59
|
f(s), l || (d?.(s), s?.to && p());
|
|
56
|
-
},
|
|
60
|
+
}, _ = () => {
|
|
57
61
|
d?.(C), p();
|
|
58
62
|
}, h = () => {
|
|
59
63
|
f(n), p();
|
|
@@ -63,9 +67,9 @@ const me = t.forwardRef(
|
|
|
63
67
|
t.useLayoutEffect(() => {
|
|
64
68
|
R.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
65
69
|
});
|
|
66
|
-
const
|
|
70
|
+
const ee = n?.from ? `${N(n.from, k)}${n.to ? ` – ${N(n.to, k)}` : ""}` : "";
|
|
67
71
|
return /* @__PURE__ */ r(
|
|
68
|
-
|
|
72
|
+
le,
|
|
69
73
|
{
|
|
70
74
|
open: i,
|
|
71
75
|
disabled: o,
|
|
@@ -76,26 +80,26 @@ const me = t.forwardRef(
|
|
|
76
80
|
onOpenAutoFocus: (e) => {
|
|
77
81
|
u.current || e.preventDefault(), u.current = !1;
|
|
78
82
|
},
|
|
79
|
-
popoverHandlers:
|
|
83
|
+
popoverHandlers: Q,
|
|
80
84
|
trigger: /* @__PURE__ */ r(
|
|
81
85
|
"div",
|
|
82
86
|
{
|
|
83
87
|
ref: P,
|
|
84
88
|
"data-component": "year-range-picker",
|
|
85
89
|
"data-state": i ? "open" : "closed",
|
|
86
|
-
onPointerDown: (e) =>
|
|
90
|
+
onPointerDown: (e) => me({
|
|
87
91
|
disabled: o,
|
|
88
92
|
event: e,
|
|
89
93
|
onOpen: () => c(!0),
|
|
90
94
|
focusField: () => m.current?.focus()
|
|
91
95
|
}),
|
|
92
96
|
children: /* @__PURE__ */ r(
|
|
93
|
-
|
|
97
|
+
oe,
|
|
94
98
|
{
|
|
95
99
|
ref: m,
|
|
96
|
-
value:
|
|
100
|
+
value: ee,
|
|
97
101
|
readOnly: !0,
|
|
98
|
-
onKeyDown: (e) =>
|
|
102
|
+
onKeyDown: (e) => de(e, {
|
|
99
103
|
disabled: o,
|
|
100
104
|
open: i,
|
|
101
105
|
onOpen: () => c(!0),
|
|
@@ -105,10 +109,10 @@ const me = t.forwardRef(
|
|
|
105
109
|
}
|
|
106
110
|
}),
|
|
107
111
|
onClick: () => !o && c(!0),
|
|
108
|
-
placeholder:
|
|
112
|
+
placeholder: q,
|
|
109
113
|
disabled: o,
|
|
110
114
|
"data-form-control": "input",
|
|
111
|
-
className:
|
|
115
|
+
className: ne("cursor-pointer", O),
|
|
112
116
|
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
113
117
|
n?.from && !o ? /* @__PURE__ */ g(x, { children: [
|
|
114
118
|
/* @__PURE__ */ r(D, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -121,7 +125,7 @@ const me = t.forwardRef(
|
|
|
121
125
|
e.stopPropagation(), b();
|
|
122
126
|
},
|
|
123
127
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
124
|
-
children: /* @__PURE__ */ r(
|
|
128
|
+
children: /* @__PURE__ */ r(re, { className: "size-3 hover:text-content" })
|
|
125
129
|
}
|
|
126
130
|
) }),
|
|
127
131
|
/* @__PURE__ */ r(Y, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
@@ -138,44 +142,44 @@ const me = t.forwardRef(
|
|
|
138
142
|
e.stopPropagation(), o || c((s) => !s);
|
|
139
143
|
},
|
|
140
144
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
141
|
-
children: /* @__PURE__ */ r(
|
|
145
|
+
children: /* @__PURE__ */ r(te, { className: "h-4 w-4 text-secondary-foreground" })
|
|
142
146
|
}
|
|
143
147
|
) }),
|
|
144
148
|
/* @__PURE__ */ r(Y, { variant: "tertiary", side: "top", children: a("datePicker.selectYearRange") })
|
|
145
149
|
] })
|
|
146
150
|
] }),
|
|
147
|
-
...
|
|
151
|
+
...V
|
|
148
152
|
}
|
|
149
153
|
)
|
|
150
154
|
}
|
|
151
155
|
),
|
|
152
156
|
children: /* @__PURE__ */ r(
|
|
153
|
-
|
|
157
|
+
ae,
|
|
154
158
|
{
|
|
155
159
|
pickerType: "year",
|
|
156
160
|
yearMode: "range",
|
|
157
161
|
selectedYear: C,
|
|
158
|
-
footerFlashKey:
|
|
159
|
-
footerFlashTarget:
|
|
160
|
-
onYearSelect:
|
|
161
|
-
month:
|
|
162
|
-
onMonthChange:
|
|
163
|
-
disabled:
|
|
162
|
+
footerFlashKey: G,
|
|
163
|
+
footerFlashTarget: J,
|
|
164
|
+
onYearSelect: Z,
|
|
165
|
+
month: U,
|
|
166
|
+
onMonthChange: W,
|
|
167
|
+
disabled: ce(v, A),
|
|
164
168
|
startMonth: I,
|
|
165
169
|
endMonth: M,
|
|
166
170
|
showFooter: l,
|
|
167
|
-
onApply:
|
|
171
|
+
onApply: _,
|
|
168
172
|
onCancel: h,
|
|
169
173
|
onClear: b,
|
|
170
|
-
showIntervalCaption:
|
|
171
|
-
...
|
|
174
|
+
showIntervalCaption: H,
|
|
175
|
+
...X
|
|
172
176
|
}
|
|
173
177
|
)
|
|
174
178
|
}
|
|
175
179
|
);
|
|
176
180
|
}
|
|
177
181
|
);
|
|
178
|
-
|
|
182
|
+
he.displayName = "YearRangePicker";
|
|
179
183
|
export {
|
|
180
|
-
|
|
184
|
+
he as YearRangePicker
|
|
181
185
|
};
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useWatch as
|
|
1
|
+
import { jsx as x, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as F, useRef as K, useEffect as Y } from "react";
|
|
3
|
+
import { useWatch as S, Controller as k } from "react-hook-form";
|
|
4
4
|
import { DatePicker as q } from "../../components/forms/date-picker/date-picker.js";
|
|
5
5
|
import { getEffectiveMinOffsetDaysFromToday as O } from "../utils/formDate.utils.js";
|
|
6
|
-
import { startOfDayDate as
|
|
6
|
+
import { startOfDayDate as I, addDaysDate as A, handleDateFnsFormat as L } from "../utils/date.utils.js";
|
|
7
7
|
import { parseYmdString as f, formatYmd as $ } from "../utils/calendar-boundary.js";
|
|
8
|
-
const
|
|
8
|
+
const M = "__dateInputPairedSentinel__", H = ({
|
|
9
9
|
field: n,
|
|
10
|
-
validationRules:
|
|
10
|
+
validationRules: W,
|
|
11
11
|
isDisabled: u,
|
|
12
12
|
formHelpers: h
|
|
13
13
|
}) => {
|
|
14
|
-
const m = n.fieldType === "date", e = m ? n : null, g = h.form.control,
|
|
14
|
+
const m = n.fieldType === "date", e = m ? n : null, g = h.form.control, y = h.form.trigger, T = h.getValues, i = F(() => e?.dateAfterFieldId ? Array.isArray(e.dateAfterFieldId) ? e.dateAfterFieldId : [e.dateAfterFieldId] : [], [e]), s = F(() => e?.dateBeforeFieldId ? Array.isArray(e.dateBeforeFieldId) ? e.dateBeforeFieldId : [e.dateBeforeFieldId] : [], [e]), B = i.length > 0 ? i : [M], p = S({
|
|
15
15
|
control: g,
|
|
16
16
|
name: B,
|
|
17
|
-
disabled: !m ||
|
|
18
|
-
}), E =
|
|
17
|
+
disabled: !m || i.length === 0
|
|
18
|
+
}), E = s.length > 0 ? s : [M], D = S({
|
|
19
19
|
control: g,
|
|
20
20
|
name: E,
|
|
21
|
-
disabled: !m ||
|
|
22
|
-
}),
|
|
21
|
+
disabled: !m || s.length === 0
|
|
22
|
+
}), P = i.length > 0 || s.length > 0, b = K(!0), _ = i.length > 0 ? p.join("|") : "", C = s.length > 0 ? D.join("|") : "";
|
|
23
23
|
Y(() => {
|
|
24
|
-
if (!e || !
|
|
25
|
-
if (
|
|
26
|
-
|
|
24
|
+
if (!e || !P) return;
|
|
25
|
+
if (b.current) {
|
|
26
|
+
b.current = !1;
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const a = T()[e.id];
|
|
30
|
+
a != null && String(a).trim() !== "" && y(e.id);
|
|
31
31
|
}, [
|
|
32
32
|
_,
|
|
33
33
|
C,
|
|
34
34
|
e,
|
|
35
|
-
P,
|
|
36
35
|
T,
|
|
37
|
-
|
|
36
|
+
P,
|
|
37
|
+
y
|
|
38
38
|
]);
|
|
39
|
-
const { minDate: R, maxDate: V } =
|
|
39
|
+
const { minDate: R, maxDate: V } = F(() => {
|
|
40
40
|
if (!e)
|
|
41
41
|
return {
|
|
42
42
|
minDate: void 0,
|
|
43
43
|
maxDate: void 0
|
|
44
44
|
};
|
|
45
|
-
const
|
|
46
|
-
if (l != null && l >= 0 &&
|
|
45
|
+
const a = [], l = O(e);
|
|
46
|
+
if (l != null && l >= 0 && a.push(I(A(/* @__PURE__ */ new Date(), l))), e.minDate) {
|
|
47
47
|
const t = f(e.minDate);
|
|
48
|
-
t &&
|
|
48
|
+
t && a.push(t);
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
51
|
-
const t =
|
|
52
|
-
for (const
|
|
53
|
-
if (!
|
|
54
|
-
const c = f(String(
|
|
50
|
+
if (i.length > 0) {
|
|
51
|
+
const t = i.length > 0 ? p : [];
|
|
52
|
+
for (const r of t) {
|
|
53
|
+
if (!r) continue;
|
|
54
|
+
const c = f(String(r));
|
|
55
55
|
if (c) {
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const v = e.dateAfterFieldIdInclusive ? 0 : 1;
|
|
57
|
+
a.push(I(A(c, v)));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
let d;
|
|
62
|
-
|
|
63
|
-
(t,
|
|
62
|
+
a.length > 0 && (d = a.reduce(
|
|
63
|
+
(t, r) => t.getTime() >= r.getTime() ? t : r
|
|
64
64
|
));
|
|
65
65
|
let o;
|
|
66
66
|
if (e.maxDate) {
|
|
67
67
|
const t = f(e.maxDate);
|
|
68
68
|
t && (o = t);
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
71
|
-
const t =
|
|
72
|
-
for (const
|
|
73
|
-
if (!
|
|
74
|
-
const c = f(String(
|
|
70
|
+
if (s.length > 0) {
|
|
71
|
+
const t = s.length > 0 ? D : [];
|
|
72
|
+
for (const r of t) {
|
|
73
|
+
if (!r) continue;
|
|
74
|
+
const c = f(String(r));
|
|
75
75
|
if (c) {
|
|
76
|
-
const
|
|
77
|
-
o = o == null ||
|
|
76
|
+
const v = e.dateBeforeFieldIdInclusive ? 0 : -1, w = I(A(c, v));
|
|
77
|
+
o = o == null || w.getTime() < o.getTime() ? w : o;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return { minDate: d, maxDate: o };
|
|
82
|
-
}, [e,
|
|
82
|
+
}, [e, i, s, p, D]);
|
|
83
83
|
if (!m || !e) return null;
|
|
84
84
|
const j = L(e.dateFormat);
|
|
85
|
-
return /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ x(
|
|
86
86
|
k,
|
|
87
87
|
{
|
|
88
88
|
name: n.id,
|
|
89
89
|
control: g,
|
|
90
90
|
disabled: u,
|
|
91
|
-
rules:
|
|
92
|
-
render: ({ field:
|
|
93
|
-
const d = !!l.error, o =
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
91
|
+
rules: W,
|
|
92
|
+
render: ({ field: a, fieldState: l }) => {
|
|
93
|
+
const d = !!l.error, o = a.value, t = o ? f(String(o)) : void 0;
|
|
94
|
+
return /* @__PURE__ */ N("div", { className: "flex w-full min-w-0 flex-col gap-[6px]", children: [
|
|
95
|
+
/* @__PURE__ */ N(
|
|
96
96
|
"label",
|
|
97
97
|
{
|
|
98
98
|
htmlFor: n.id,
|
|
@@ -100,11 +100,11 @@ const b = "__dateInputPairedSentinel__", H = ({
|
|
|
100
100
|
children: [
|
|
101
101
|
n.label,
|
|
102
102
|
" ",
|
|
103
|
-
n.isRequired ? /* @__PURE__ */
|
|
103
|
+
n.isRequired ? /* @__PURE__ */ x("span", { className: "text-[red]", children: "*" }) : null
|
|
104
104
|
]
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ x(
|
|
108
108
|
q,
|
|
109
109
|
{
|
|
110
110
|
id: n.id,
|
|
@@ -113,8 +113,8 @@ const b = "__dateInputPairedSentinel__", H = ({
|
|
|
113
113
|
minDate: R,
|
|
114
114
|
maxDate: V,
|
|
115
115
|
value: t,
|
|
116
|
-
onChange: (
|
|
117
|
-
|
|
116
|
+
onChange: (r) => {
|
|
117
|
+
a.onChange(r ? $(r) : "");
|
|
118
118
|
},
|
|
119
119
|
placeholder: n.placeholder,
|
|
120
120
|
required: n.isRequired,
|
|
@@ -126,7 +126,8 @@ const b = "__dateInputPairedSentinel__", H = ({
|
|
|
126
126
|
fiscalMode: e.fiscalMode,
|
|
127
127
|
fiscalYearStartMonth: e.fiscalYearStartMonth,
|
|
128
128
|
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
129
|
-
showPresets: e.showPresets
|
|
129
|
+
showPresets: e.showPresets,
|
|
130
|
+
autoNavigateToAvailable: e.autoNavigateToAvailable
|
|
130
131
|
}
|
|
131
132
|
)
|
|
132
133
|
] });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Controller as
|
|
4
|
-
import { DateRangePicker as
|
|
3
|
+
import { Controller as g } from "react-hook-form";
|
|
4
|
+
import { DateRangePicker as v } from "../../components/forms/date-picker/date-range-picker.js";
|
|
5
5
|
import { toLocalDate as a } from "../utils/calendar-boundary.js";
|
|
6
|
-
import { handleMinMaxProp as
|
|
7
|
-
const
|
|
6
|
+
import { handleMinMaxProp as S } from "../utils/date.utils.js";
|
|
7
|
+
const T = ({
|
|
8
8
|
field: r,
|
|
9
9
|
validationRules: h,
|
|
10
10
|
isDisabled: l,
|
|
@@ -12,18 +12,18 @@ const Y = ({
|
|
|
12
12
|
}) => {
|
|
13
13
|
const t = r.fieldType === "date_range" ? r : null;
|
|
14
14
|
if (!t) return null;
|
|
15
|
-
const c = s.form.control, { minDate: m, maxDate: u } =
|
|
15
|
+
const c = s.form.control, { minDate: m, maxDate: u } = S(t);
|
|
16
16
|
return /* @__PURE__ */ n(
|
|
17
|
-
|
|
17
|
+
g,
|
|
18
18
|
{
|
|
19
19
|
name: r.id,
|
|
20
20
|
control: c,
|
|
21
21
|
disabled: l,
|
|
22
22
|
rules: h,
|
|
23
|
-
render: ({ field: p, fieldState:
|
|
24
|
-
const
|
|
23
|
+
render: ({ field: p, fieldState: i }) => {
|
|
24
|
+
const d = !!i.error, e = p.value;
|
|
25
25
|
return /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
|
|
26
|
-
|
|
26
|
+
v,
|
|
27
27
|
{
|
|
28
28
|
label: r.label,
|
|
29
29
|
minDate: m,
|
|
@@ -43,14 +43,15 @@ const Y = ({
|
|
|
43
43
|
placeholder: r.placeholder,
|
|
44
44
|
required: r.isRequired,
|
|
45
45
|
disabled: l,
|
|
46
|
-
error:
|
|
47
|
-
helperText:
|
|
46
|
+
error: d,
|
|
47
|
+
helperText: d ? i.error?.message : r.helpText,
|
|
48
48
|
showFooter: !0,
|
|
49
49
|
calendarKind: t.calendarKind,
|
|
50
50
|
fiscalMode: t.fiscalMode,
|
|
51
51
|
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
52
52
|
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
53
|
-
showPresets: t.showPresets
|
|
53
|
+
showPresets: t.showPresets,
|
|
54
|
+
autoNavigateToAvailable: t.autoNavigateToAvailable
|
|
54
55
|
}
|
|
55
56
|
) });
|
|
56
57
|
}
|
|
@@ -58,5 +59,5 @@ const Y = ({
|
|
|
58
59
|
);
|
|
59
60
|
};
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
T as DateRangeField
|
|
62
63
|
};
|