impact-nova 2.5.12 → 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/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-display/calendar/calendar-week-utils.d.ts +2 -1
- package/dist/components/data-display/calendar/use-calendar-state.js +159 -157
- 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/week-picker.js +81 -79
- package/dist/components/forms/date-picker/week-range-picker.js +89 -87
- 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/MultiYearPickerField.d.ts +8 -0
- package/dist/form-react/Fields/MultiYearPickerField.js +57 -0
- 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 +55 -1
- package/dist/form-react/types/fieldsOutput.types.d.ts +8 -2
- package/dist/form-react/utils/fieldDefaults.utils.js +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 +51 -78
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { jsx as u, jsxs as W } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import { Cross as et, CalendarMonth as tt } from "impact-nova-icons";
|
|
4
|
-
import { format as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { usePickerDismissActionsRef as rt, usePickerFooterDismissNudge as ot, createRangePickerOpenChangeHandler as nt, parseDateInput as
|
|
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
7
|
import { useFieldChrome as dt } from "../../../lib/primitives/use-field-chrome.js";
|
|
8
8
|
import { Popover as pt, PopoverAnchor as mt, PopoverContent as ut } from "../../feedback/popover/popover.js";
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { buildDateBoundsMatcher as
|
|
11
|
-
import { Tooltip as
|
|
9
|
+
import { Calendar as kt } from "../../data-display/calendar/calendar.js";
|
|
10
|
+
import { buildDateBoundsMatcher as gt } from "../../../lib/date-bounds-matcher.js";
|
|
11
|
+
import { Tooltip as de, TooltipTrigger as pe, TooltipContent as me } from "../../feedback/tooltip/tooltip.js";
|
|
12
12
|
import { resolveWeekSelection as Rt } from "../../../lib/fiscal-calendar/week-selection.js";
|
|
13
13
|
import { useImpactNovaI18n as ht } from "../../../i18n/use-impact-nova-i18n.js";
|
|
14
14
|
import { getDateFnsLocale as Dt } from "../../../i18n/getDateFnsLocale.js";
|
|
15
15
|
import { coerceWeekRangeApply as yt, isWeekRangeSelection as vt } from "./calendar-selection-adapters.js";
|
|
16
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
21
|
function Ct(t, l) {
|
|
22
|
-
return !t && !l ? !0 : !t || !l ? !1 :
|
|
22
|
+
return !t && !l ? !0 : !t || !l ? !1 : ue(t.from, l.from) && ue(t.to, l.to);
|
|
23
23
|
}
|
|
24
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
44
|
autoNavigateToAvailable: xe,
|
|
@@ -48,7 +48,7 @@ const bt = c.forwardRef(
|
|
|
48
48
|
className: we,
|
|
49
49
|
error: Ie,
|
|
50
50
|
isError: Te,
|
|
51
|
-
size:
|
|
51
|
+
size: Z,
|
|
52
52
|
label: Ee,
|
|
53
53
|
helperText: Pe,
|
|
54
54
|
helperTextPosition: We = "absolute",
|
|
@@ -57,43 +57,43 @@ const bt = c.forwardRef(
|
|
|
57
57
|
prefixClick: It,
|
|
58
58
|
...Be
|
|
59
59
|
}, Ne) => {
|
|
60
|
-
const
|
|
60
|
+
const _ = Ie ?? Te, Ve = dt({
|
|
61
61
|
label: Ee,
|
|
62
62
|
helperText: Pe,
|
|
63
63
|
helperTextPosition: We,
|
|
64
|
-
error:
|
|
64
|
+
error: _,
|
|
65
65
|
required: Se,
|
|
66
66
|
disabled: d ?? void 0,
|
|
67
67
|
rootClassName: "w-full min-w-[240px]"
|
|
68
|
-
}), { locale:
|
|
69
|
-
c.useImperativeHandle(Ne, () =>
|
|
70
|
-
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);
|
|
71
71
|
c.useEffect(() => {
|
|
72
|
-
|
|
72
|
+
re.current = t;
|
|
73
73
|
}), c.useEffect(() => {
|
|
74
|
-
const e =
|
|
75
|
-
D(e?.from ?
|
|
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
76
|
}, [qe, ze, n, s]);
|
|
77
77
|
const He = c.useCallback(
|
|
78
78
|
(e) => nt({
|
|
79
79
|
disabled: d ?? void 0,
|
|
80
|
-
showFooter:
|
|
80
|
+
showFooter: g,
|
|
81
81
|
containerRef: A,
|
|
82
|
-
popoverContentRef:
|
|
82
|
+
popoverContentRef: Q,
|
|
83
83
|
setOpen: R
|
|
84
84
|
})(e),
|
|
85
|
-
[d,
|
|
86
|
-
),
|
|
85
|
+
[d, g]
|
|
86
|
+
), oe = c.useRef(!1);
|
|
87
87
|
c.useEffect(() => {
|
|
88
|
-
if (p && !
|
|
89
|
-
const e =
|
|
88
|
+
if (p && !oe.current && !V) {
|
|
89
|
+
const e = X(m, n, s);
|
|
90
90
|
e.parsed ? P(e.parsed) : a?.from ? P(a.from.startDate) : t?.from && P(t.from.startDate);
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
oe.current = p;
|
|
93
93
|
}, [p, m, n, s, a?.from, t?.from, V]);
|
|
94
94
|
const Ke = (e) => {
|
|
95
95
|
const r = vt(e) ? e : void 0;
|
|
96
|
-
h(r), r?.from ? (D(
|
|
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));
|
|
97
97
|
}, C = c.useCallback(
|
|
98
98
|
(e) => Rt(e, {
|
|
99
99
|
calendarKind: N,
|
|
@@ -101,7 +101,8 @@ const bt = c.forwardRef(
|
|
|
101
101
|
granularity: z,
|
|
102
102
|
fiscalMonthPattern: H,
|
|
103
103
|
fiscalYearStartMonth: K,
|
|
104
|
-
weekStartsOn:
|
|
104
|
+
weekStartsOn: G,
|
|
105
|
+
fiscalConfig: M
|
|
105
106
|
}),
|
|
106
107
|
[
|
|
107
108
|
N,
|
|
@@ -109,6 +110,7 @@ const bt = c.forwardRef(
|
|
|
109
110
|
z,
|
|
110
111
|
H,
|
|
111
112
|
K,
|
|
113
|
+
G,
|
|
112
114
|
M
|
|
113
115
|
]
|
|
114
116
|
), B = c.useCallback((e, r) => {
|
|
@@ -117,37 +119,37 @@ const bt = c.forwardRef(
|
|
|
117
119
|
r,
|
|
118
120
|
(i, f) => it(i.startDate, f.startDate)
|
|
119
121
|
);
|
|
120
|
-
return o.swapped && (o.from && D(
|
|
121
|
-
}, [n, s]),
|
|
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) => {
|
|
122
124
|
const r = yt(e, S(a)), o = B(r?.from, r?.to), i = o.from ? { from: o.from, to: o.to } : void 0;
|
|
123
125
|
h(i), l?.(i), R(!1);
|
|
124
126
|
}, O = () => {
|
|
125
|
-
h(t), D(t?.from ?
|
|
126
|
-
},
|
|
127
|
-
h(void 0), D(""), v(""), l?.(void 0),
|
|
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);
|
|
128
130
|
}, Me = (e) => {
|
|
129
|
-
const r =
|
|
131
|
+
const r = fe(e.target.value, n, m);
|
|
130
132
|
if (D(r), r === "") {
|
|
131
133
|
const f = { to: a?.to };
|
|
132
|
-
h(f),
|
|
134
|
+
h(f), g || l?.(void 0);
|
|
133
135
|
return;
|
|
134
136
|
}
|
|
135
|
-
const { parsed: o, isValid: i } =
|
|
137
|
+
const { parsed: o, isValid: i } = X(r, n, s);
|
|
136
138
|
if (i && o) {
|
|
137
139
|
const I = { from: C(o), to: a?.to };
|
|
138
|
-
h(I), a?.to && v(
|
|
140
|
+
h(I), a?.to && v(k(x(I), n, { locale: s })), V || P(o), g || l?.(S(I));
|
|
139
141
|
}
|
|
140
142
|
}, Ge = (e) => {
|
|
141
|
-
const r =
|
|
143
|
+
const r = fe(e.target.value, n, y);
|
|
142
144
|
if (v(r), r === "") {
|
|
143
145
|
const f = { from: a?.from };
|
|
144
|
-
h(f),
|
|
146
|
+
h(f), g || l?.(S(f));
|
|
145
147
|
return;
|
|
146
148
|
}
|
|
147
|
-
const { parsed: o, isValid: i } =
|
|
149
|
+
const { parsed: o, isValid: i } = X(r, n, s);
|
|
148
150
|
if (i && o) {
|
|
149
151
|
const f = C(o), I = { from: a?.from, to: f };
|
|
150
|
-
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));
|
|
151
153
|
}
|
|
152
154
|
}, Je = () => {
|
|
153
155
|
const e = j(m, n, b, s), r = j(y, n, w, s);
|
|
@@ -156,26 +158,26 @@ const bt = c.forwardRef(
|
|
|
156
158
|
o && i && ({ from: o, to: i } = B(o, i));
|
|
157
159
|
const f = o ? { from: o, to: i } : void 0;
|
|
158
160
|
f ? (h(f), l?.(f)) : !m && !y && (h(void 0), l?.(void 0));
|
|
159
|
-
},
|
|
161
|
+
}, ie = () => {
|
|
160
162
|
ft(
|
|
161
163
|
A,
|
|
162
|
-
|
|
164
|
+
Q,
|
|
163
165
|
() => {
|
|
164
166
|
const e = L(m, n, b, s), r = L(y, n, w, s);
|
|
165
167
|
e.resetToCommitted ? D(b) : e.parsed && D(e.display), r.resetToCommitted ? v(w) : r.parsed && v(r.display);
|
|
166
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;
|
|
167
169
|
o && i && ({ from: o, to: i } = B(o, i));
|
|
168
170
|
const f = o || i ? { from: o, to: i } : void 0;
|
|
169
|
-
h(f),
|
|
171
|
+
h(f), g || (f ? l?.(f) : !m && !y && l?.(void 0));
|
|
170
172
|
}
|
|
171
173
|
);
|
|
172
|
-
},
|
|
173
|
-
if (p &&
|
|
174
|
-
|
|
174
|
+
}, ce = () => {
|
|
175
|
+
if (p && g) {
|
|
176
|
+
ne();
|
|
175
177
|
return;
|
|
176
178
|
}
|
|
177
179
|
if (!p) {
|
|
178
|
-
if (
|
|
180
|
+
if (g) {
|
|
179
181
|
Je();
|
|
180
182
|
return;
|
|
181
183
|
}
|
|
@@ -183,7 +185,7 @@ const bt = c.forwardRef(
|
|
|
183
185
|
if (e.parsed || r.parsed) return;
|
|
184
186
|
E.current = !0, R(!0);
|
|
185
187
|
}
|
|
186
|
-
}, 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(() => {
|
|
187
189
|
const e = L(m, n, b, s), r = L(y, n, w, s);
|
|
188
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;
|
|
189
191
|
o && i && ({ from: o, to: i } = B(o, i));
|
|
@@ -211,14 +213,14 @@ const bt = c.forwardRef(
|
|
|
211
213
|
C
|
|
212
214
|
]);
|
|
213
215
|
return c.useLayoutEffect(() => {
|
|
214
|
-
|
|
216
|
+
te.current = {
|
|
215
217
|
onDismiss: O,
|
|
216
218
|
resolveFlash: Ye
|
|
217
219
|
};
|
|
218
220
|
}), /* @__PURE__ */ u(
|
|
219
221
|
"div",
|
|
220
222
|
{
|
|
221
|
-
ref:
|
|
223
|
+
ref: ee,
|
|
222
224
|
"data-component": "week-range-picker",
|
|
223
225
|
"data-disabled": d || void 0,
|
|
224
226
|
children: Ve.wrapControl(
|
|
@@ -233,13 +235,13 @@ const bt = c.forwardRef(
|
|
|
233
235
|
event: e,
|
|
234
236
|
onOpen: () => R(!0),
|
|
235
237
|
focusField: (r) => {
|
|
236
|
-
r === "end" ?
|
|
238
|
+
r === "end" ? F.current?.focus() : J.current?.focus();
|
|
237
239
|
}
|
|
238
240
|
}),
|
|
239
|
-
className:
|
|
241
|
+
className: U(
|
|
240
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",
|
|
241
|
-
|
|
242
|
-
|
|
243
|
+
_ ? "border-destructive hover:border-destructive" : "border-field",
|
|
244
|
+
Z === "sm" ? "h-6" : Z === "md" ? "h-[28px]" : "h-8",
|
|
243
245
|
d && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
|
|
244
246
|
"cursor-pointer",
|
|
245
247
|
we
|
|
@@ -249,20 +251,20 @@ const bt = c.forwardRef(
|
|
|
249
251
|
/* @__PURE__ */ u(
|
|
250
252
|
"input",
|
|
251
253
|
{
|
|
252
|
-
ref:
|
|
254
|
+
ref: J,
|
|
253
255
|
type: "text",
|
|
254
256
|
value: m,
|
|
255
257
|
onChange: Me,
|
|
256
|
-
onBlur:
|
|
258
|
+
onBlur: ie,
|
|
257
259
|
onClick: () => !d && R(!0),
|
|
258
260
|
onKeyDown: (e) => {
|
|
259
|
-
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 });
|
|
260
262
|
},
|
|
261
|
-
placeholder: p ? n :
|
|
263
|
+
placeholder: p ? n : Y,
|
|
262
264
|
disabled: !!d,
|
|
263
265
|
"aria-label": _e,
|
|
264
266
|
"data-field": "start",
|
|
265
|
-
className:
|
|
267
|
+
className: U(
|
|
266
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",
|
|
267
269
|
Xe ? "text-destructive" : Qe ? "text-content-placeholder" : ""
|
|
268
270
|
),
|
|
@@ -272,20 +274,20 @@ const bt = c.forwardRef(
|
|
|
272
274
|
/* @__PURE__ */ u(
|
|
273
275
|
"input",
|
|
274
276
|
{
|
|
275
|
-
ref:
|
|
277
|
+
ref: F,
|
|
276
278
|
type: "text",
|
|
277
279
|
value: y,
|
|
278
280
|
onChange: Ge,
|
|
279
|
-
onBlur:
|
|
281
|
+
onBlur: ie,
|
|
280
282
|
onClick: () => !d && R(!0),
|
|
281
283
|
onKeyDown: (e) => {
|
|
282
|
-
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 });
|
|
283
285
|
},
|
|
284
|
-
placeholder: p ? n :
|
|
286
|
+
placeholder: p ? n : Y,
|
|
285
287
|
disabled: !!d,
|
|
286
288
|
"aria-label": $e,
|
|
287
289
|
"data-field": "end",
|
|
288
|
-
className:
|
|
290
|
+
className: U(
|
|
289
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",
|
|
290
292
|
Ze ? "text-destructive" : Ue ? "text-content-placeholder" : ""
|
|
291
293
|
)
|
|
@@ -293,29 +295,29 @@ const bt = c.forwardRef(
|
|
|
293
295
|
)
|
|
294
296
|
] }),
|
|
295
297
|
/* @__PURE__ */ W("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
296
|
-
t?.from && !d && /* @__PURE__ */ W(
|
|
297
|
-
/* @__PURE__ */ u(
|
|
298
|
+
t?.from && !d && /* @__PURE__ */ W(de, { children: [
|
|
299
|
+
/* @__PURE__ */ u(pe, { asChild: !0, children: /* @__PURE__ */ u(
|
|
298
300
|
"button",
|
|
299
301
|
{
|
|
300
302
|
type: "button",
|
|
301
303
|
tabIndex: 0,
|
|
302
304
|
"aria-label": T("calendar.clear"),
|
|
303
305
|
onClick: (e) => {
|
|
304
|
-
e.stopPropagation(),
|
|
306
|
+
e.stopPropagation(), se();
|
|
305
307
|
},
|
|
306
308
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
307
309
|
children: /* @__PURE__ */ u(et, { className: "size-3 hover:text-content text-content-icon" })
|
|
308
310
|
}
|
|
309
311
|
) }),
|
|
310
|
-
/* @__PURE__ */ u(
|
|
312
|
+
/* @__PURE__ */ u(me, { variant: "tertiary", side: "top", children: T("calendar.clear") })
|
|
311
313
|
] }),
|
|
312
|
-
/* @__PURE__ */ W(
|
|
313
|
-
/* @__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) => {
|
|
314
316
|
e.stopPropagation(), d || R(!p);
|
|
315
317
|
}, onKeyDown: (e) => {
|
|
316
318
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), d || (E.current = !0, R(!p)));
|
|
317
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" }) }) }),
|
|
318
|
-
/* @__PURE__ */ u(
|
|
320
|
+
/* @__PURE__ */ u(me, { variant: "tertiary", side: "top", children: T("datePicker.selectWeekRange") })
|
|
319
321
|
] })
|
|
320
322
|
] })
|
|
321
323
|
]
|
|
@@ -324,7 +326,7 @@ const bt = c.forwardRef(
|
|
|
324
326
|
/* @__PURE__ */ u(
|
|
325
327
|
ut,
|
|
326
328
|
{
|
|
327
|
-
ref:
|
|
329
|
+
ref: Q,
|
|
328
330
|
className: "w-auto p-0",
|
|
329
331
|
align: "start",
|
|
330
332
|
"aria-label": T("datePicker.selectWeekRange"),
|
|
@@ -333,7 +335,7 @@ const bt = c.forwardRef(
|
|
|
333
335
|
},
|
|
334
336
|
...Le,
|
|
335
337
|
children: /* @__PURE__ */ u(
|
|
336
|
-
|
|
338
|
+
kt,
|
|
337
339
|
{
|
|
338
340
|
pickerType: "week",
|
|
339
341
|
weekMode: "range",
|
|
@@ -343,27 +345,27 @@ const bt = c.forwardRef(
|
|
|
343
345
|
onWeekSelect: Ke,
|
|
344
346
|
month: je,
|
|
345
347
|
onMonthChange: P,
|
|
346
|
-
disabled:
|
|
347
|
-
startMonth:
|
|
348
|
-
endMonth:
|
|
349
|
-
showFooter:
|
|
348
|
+
disabled: gt(ge, Re),
|
|
349
|
+
startMonth: he,
|
|
350
|
+
endMonth: De,
|
|
351
|
+
showFooter: g,
|
|
350
352
|
...xt({
|
|
351
353
|
calendarKind: N,
|
|
352
354
|
fiscalMode: q,
|
|
353
355
|
granularity: z,
|
|
354
356
|
fiscalMonthPattern: H,
|
|
355
357
|
fiscalYearStartMonth: K,
|
|
356
|
-
fiscalConfig:
|
|
357
|
-
weekStartsOn:
|
|
358
|
+
fiscalConfig: M,
|
|
359
|
+
weekStartsOn: G,
|
|
358
360
|
showPresets: ye,
|
|
359
361
|
showPeriodBoundaries: ve,
|
|
360
362
|
autoNavigateToAvailable: xe,
|
|
361
363
|
comparison: Ce,
|
|
362
364
|
onComparisonChange: be
|
|
363
365
|
}),
|
|
364
|
-
onApply:
|
|
366
|
+
onApply: ne,
|
|
365
367
|
onCancel: O,
|
|
366
|
-
onClear:
|
|
368
|
+
onClear: se,
|
|
367
369
|
captionLayout: "dropdown"
|
|
368
370
|
}
|
|
369
371
|
)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { cn as x } from "../../../../lib/utils.js";
|
|
3
|
+
import "react";
|
|
3
4
|
import { OverflowTooltip as m } from "../../../feedback/tooltip/overflow-tooltip.js";
|
|
4
5
|
import { isInvertedSelection as h, isOptionArray as d } from "../utils/select.js";
|
|
5
|
-
function
|
|
6
|
+
function C({
|
|
6
7
|
isMulti: u,
|
|
7
8
|
isDisabled: p,
|
|
8
9
|
internalValue: o,
|
|
@@ -52,5 +53,5 @@ function w({
|
|
|
52
53
|
);
|
|
53
54
|
}
|
|
54
55
|
export {
|
|
55
|
-
|
|
56
|
+
C as SelectTriggerValue
|
|
56
57
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "@radix-ui/react-popover";
|
|
3
3
|
import { Checkbox as P } from "../../checkbox/checkbox.js";
|
|
4
|
+
import "react";
|
|
4
5
|
import { OverflowTooltip as y } from "../../../feedback/tooltip/overflow-tooltip.js";
|
|
5
6
|
import { ChevronRight as A, Checkmark as O } from "impact-nova-icons";
|
|
6
7
|
import { cn as v } from "../../../../lib/utils.js";
|
|
7
8
|
import { useOverlayPortalContainer as T } from "../../../../lib/overlay/overlay-portal-context.js";
|
|
8
9
|
import { OVERLAY_NESTED_FLOATING_INSTANT_HIDE_CLASS as _ } from "../../../../lib/overlay/overlay-host.constants.js";
|
|
9
10
|
import { useSuppressOptionClickForTextSelection as E } from "../hooks/useSuppressOptionClickForTextSelection.js";
|
|
10
|
-
const
|
|
11
|
+
const R = ({
|
|
11
12
|
parentOption: n,
|
|
12
13
|
isMulti: u,
|
|
13
14
|
isReadOnly: l,
|
|
@@ -105,5 +106,5 @@ const G = ({
|
|
|
105
106
|
] });
|
|
106
107
|
};
|
|
107
108
|
export {
|
|
108
|
-
|
|
109
|
+
R as Submenu
|
|
109
110
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormFieldProps } from '../types/reactHookForm.types';
|
|
3
|
+
import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
|
|
4
|
+
interface MultiYearPickerFieldProps extends FormFieldProps {
|
|
5
|
+
formHelpers: UseReactHookFormReturn;
|
|
6
|
+
}
|
|
7
|
+
export declare const MultiYearPickerField: FC<MultiYearPickerFieldProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Controller as p } from "react-hook-form";
|
|
3
|
+
import { MultiYearPicker as M } from "../../components/forms/date-picker/multi-year-picker.js";
|
|
4
|
+
import { getFieldTestId as f } from "../utils/fieldTestIds.js";
|
|
5
|
+
import { toLocalDate as o } from "../utils/calendar-boundary.js";
|
|
6
|
+
const g = ({
|
|
7
|
+
field: r,
|
|
8
|
+
validationRules: h,
|
|
9
|
+
isDisabled: u,
|
|
10
|
+
formHelpers: n
|
|
11
|
+
}) => {
|
|
12
|
+
const e = r.fieldType === "multi_year_picker" ? r : null;
|
|
13
|
+
if (!e) return null;
|
|
14
|
+
const c = n.form.control, d = e.defaultValue?.map((t) => ({ year: t }));
|
|
15
|
+
return /* @__PURE__ */ a(
|
|
16
|
+
p,
|
|
17
|
+
{
|
|
18
|
+
name: r.id,
|
|
19
|
+
control: c,
|
|
20
|
+
defaultValue: d,
|
|
21
|
+
rules: h,
|
|
22
|
+
render: ({ field: t, fieldState: l }) => {
|
|
23
|
+
const s = !!l.error, m = t.value;
|
|
24
|
+
return /* @__PURE__ */ a("div", { "data-testid": f(r.id), children: /* @__PURE__ */ a(
|
|
25
|
+
M,
|
|
26
|
+
{
|
|
27
|
+
label: r.label,
|
|
28
|
+
value: m ?? void 0,
|
|
29
|
+
onChange: (i) => {
|
|
30
|
+
t.onChange(i ?? null), n.setValue(r.id, i ?? null);
|
|
31
|
+
},
|
|
32
|
+
placeholder: r.placeholder,
|
|
33
|
+
minDate: o(e.minDate),
|
|
34
|
+
maxDate: o(e.maxDate),
|
|
35
|
+
startMonth: o(e.startMonth),
|
|
36
|
+
endMonth: o(e.endMonth),
|
|
37
|
+
required: r.isRequired,
|
|
38
|
+
disabled: u,
|
|
39
|
+
error: s,
|
|
40
|
+
helperText: s ? l.error?.message : r.helpText,
|
|
41
|
+
showFooter: e.showFooter,
|
|
42
|
+
showIntervalCaption: e.showIntervalCaption,
|
|
43
|
+
calendarKind: e.calendarKind,
|
|
44
|
+
fiscalMode: e.fiscalMode,
|
|
45
|
+
fiscalYearStartMonth: e.fiscalYearStartMonth,
|
|
46
|
+
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
47
|
+
showPresets: e.showPresets,
|
|
48
|
+
...e.componentProps
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
g as MultiYearPickerField
|
|
57
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormFieldProps } from '../types/reactHookForm.types';
|
|
3
|
+
import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
|
|
4
|
+
interface YearPickerFieldProps extends FormFieldProps {
|
|
5
|
+
formHelpers: UseReactHookFormReturn;
|
|
6
|
+
}
|
|
7
|
+
export declare const YearPickerField: FC<YearPickerFieldProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Controller as m } from "react-hook-form";
|
|
3
|
+
import { YearPicker as p } from "../../components/forms/date-picker/year-picker.js";
|
|
4
|
+
import { getFieldTestId as M } from "../utils/fieldTestIds.js";
|
|
5
|
+
import { toLocalDate as o } from "../utils/calendar-boundary.js";
|
|
6
|
+
const C = ({
|
|
7
|
+
field: r,
|
|
8
|
+
validationRules: d,
|
|
9
|
+
isDisabled: h,
|
|
10
|
+
formHelpers: a
|
|
11
|
+
}) => {
|
|
12
|
+
const e = r.fieldType === "year_picker" ? r : null;
|
|
13
|
+
if (!e) return null;
|
|
14
|
+
const c = a.form.control;
|
|
15
|
+
return /* @__PURE__ */ t(
|
|
16
|
+
m,
|
|
17
|
+
{
|
|
18
|
+
name: r.id,
|
|
19
|
+
control: c,
|
|
20
|
+
defaultValue: e.defaultValue != null ? { year: e.defaultValue } : void 0,
|
|
21
|
+
rules: d,
|
|
22
|
+
render: ({ field: n, fieldState: l }) => {
|
|
23
|
+
const s = !!l.error, u = n.value;
|
|
24
|
+
return /* @__PURE__ */ t("div", { "data-testid": M(r.id), children: /* @__PURE__ */ t(
|
|
25
|
+
p,
|
|
26
|
+
{
|
|
27
|
+
label: r.label,
|
|
28
|
+
value: u ?? void 0,
|
|
29
|
+
onChange: (i) => {
|
|
30
|
+
n.onChange(i ?? null), a.setValue(r.id, i ?? null);
|
|
31
|
+
},
|
|
32
|
+
placeholder: r.placeholder,
|
|
33
|
+
minDate: o(e.minDate),
|
|
34
|
+
maxDate: o(e.maxDate),
|
|
35
|
+
startMonth: o(e.startMonth),
|
|
36
|
+
endMonth: o(e.endMonth),
|
|
37
|
+
required: r.isRequired,
|
|
38
|
+
disabled: h,
|
|
39
|
+
error: s,
|
|
40
|
+
helperText: s ? l.error?.message : r.helpText,
|
|
41
|
+
showFooter: e.showFooter,
|
|
42
|
+
showIntervalCaption: e.showIntervalCaption,
|
|
43
|
+
calendarKind: e.calendarKind,
|
|
44
|
+
fiscalMode: e.fiscalMode,
|
|
45
|
+
fiscalYearStartMonth: e.fiscalYearStartMonth,
|
|
46
|
+
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
47
|
+
showPresets: e.showPresets,
|
|
48
|
+
...e.componentProps
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
C as YearPickerField
|
|
57
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormFieldProps } from '../types/reactHookForm.types';
|
|
3
|
+
import { UseReactHookFormReturn } from '../hooks/useReactHookForm';
|
|
4
|
+
interface YearRangePickerFieldProps extends FormFieldProps {
|
|
5
|
+
formHelpers: UseReactHookFormReturn;
|
|
6
|
+
}
|
|
7
|
+
export declare const YearRangePickerField: FC<YearRangePickerFieldProps>;
|
|
8
|
+
export {};
|