impact-nova 2.5.7 → 2.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +2 -2
- package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +4 -2
- package/dist/components/data/ag-grid-react/headers/header-search-input.js +65 -65
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +55 -48
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +80 -61
- package/dist/components/data-display/calendar/calendar-config.d.ts +13 -5
- package/dist/components/data-display/calendar/calendar-config.js +31 -20
- package/dist/components/data-display/calendar/calendar-day-button.js +43 -35
- package/dist/components/data-display/calendar/calendar-day-hover.d.ts +8 -0
- package/dist/components/data-display/calendar/calendar-day-hover.js +20 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +8 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +40 -20
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +12 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +196 -102
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +136 -92
- package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +90 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +16 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +41 -0
- package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
- package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
- package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
- package/dist/components/data-display/calendar/calendar-footer.js +88 -66
- package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
- package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
- package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
- package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
- package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
- package/dist/components/data-display/calendar/calendar-selection.js +31 -0
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
- package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
- package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-week-utils.js +49 -42
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
- package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
- package/dist/components/data-display/calendar/calendar.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar.js +303 -181
- package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
- package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
- package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
- package/dist/components/data-display/calendar/index.d.ts +1 -1
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +31 -11
- package/dist/components/data-display/calendar/use-calendar-state.js +370 -163
- package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
- package/dist/components/data-display/calendar/use-fiscal-calendar.js +25 -0
- package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
- package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
- package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
- package/dist/components/forms/date-picker/date-picker.js +187 -167
- package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
- package/dist/components/forms/date-picker/date-range-picker.js +273 -224
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
- package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
- package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
- package/dist/components/forms/date-picker/index.d.ts +12 -0
- package/dist/components/forms/date-picker/index.js +19 -7
- package/dist/components/forms/date-picker/month-picker.js +225 -182
- package/dist/components/forms/date-picker/month-range-picker.js +134 -110
- package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
- package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
- package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
- package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
- package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
- package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-picker.js +176 -0
- package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
- package/dist/components/forms/date-picker/week-picker.js +148 -137
- package/dist/components/forms/date-picker/week-range-picker.js +216 -205
- package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-picker.js +176 -0
- package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-range-picker.js +179 -0
- package/dist/components/forms/smart-input/smart-input.js +106 -85
- package/dist/components/forms/smart-input/smart-input.types.d.ts +5 -0
- package/dist/components/forms/textarea/textarea.js +29 -28
- package/dist/components/forms/textarea/textarea.types.d.ts +1 -0
- package/dist/form-react/Fields/DateInputField.js +63 -58
- package/dist/form-react/Fields/DateRangeField.js +42 -37
- package/dist/form-react/Fields/MonthRangeField.js +50 -45
- package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
- package/dist/form-react/Fields/TextField.js +25 -24
- package/dist/form-react/Fields/WeekRangePicker.js +44 -45
- package/dist/form-react/components/FieldRenderer.js +21 -23
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
- package/dist/form-react/registry/defaultFieldRegistrations.js +27 -36
- package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
- package/dist/form-react/registry/resolveFieldComponent.js +9 -133
- package/dist/form-react/types/fields.types.d.ts +25 -4
- package/dist/form-react/utils/date.utils.d.ts +1 -1
- package/dist/form-react/utils/date.utils.js +38 -38
- package/dist/i18n/defaultMessages.d.ts +19 -1
- package/dist/i18n/defaultMessages.js +37 -20
- package/dist/i18n/locales/de.js +18 -1
- package/dist/i18n/locales/es.js +18 -1
- package/dist/i18n/locales/hi.js +18 -1
- package/dist/i18n/locales/kn.js +18 -1
- package/dist/impact-nova-components.css +379 -3
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +528 -516
- package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
- package/dist/lib/fiscal-calendar/build-year.js +173 -0
- package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
- package/dist/lib/fiscal-calendar/civil-date.js +94 -0
- package/dist/lib/fiscal-calendar/index.d.ts +10 -0
- package/dist/lib/fiscal-calendar/index.js +40 -0
- package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
- package/dist/lib/fiscal-calendar/lookup.js +70 -0
- package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
- package/dist/lib/fiscal-calendar/presets.js +99 -0
- package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
- package/dist/lib/fiscal-calendar/selection.js +32 -0
- package/dist/lib/fiscal-calendar/types.d.ts +145 -0
- package/dist/lib/fiscal-calendar/types.js +10 -0
- package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
- package/dist/lib/fiscal-calendar/week-selection.js +107 -0
- package/dist/llms/rules/best-practices.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +5 -1
- package/dist/lib/fiscal-calendar.d.ts +0 -62
- package/dist/lib/fiscal-calendar.js +0 -99
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import * as U from "react";
|
|
3
3
|
import { createComponent as k } from "../../../lib/primitives/create-component.js";
|
|
4
4
|
import { useFieldChrome as z } from "../../../lib/primitives/use-field-chrome.js";
|
|
@@ -8,11 +8,11 @@ const V = k(
|
|
|
8
8
|
"Textarea",
|
|
9
9
|
({
|
|
10
10
|
className: g,
|
|
11
|
-
label:
|
|
12
|
-
helperText:
|
|
11
|
+
label: i,
|
|
12
|
+
helperText: a,
|
|
13
13
|
helperTextPosition: d = "absolute",
|
|
14
14
|
labelOrientation: u,
|
|
15
|
-
characterLimit:
|
|
15
|
+
characterLimit: o,
|
|
16
16
|
required: b,
|
|
17
17
|
isRequired: p,
|
|
18
18
|
error: C,
|
|
@@ -20,28 +20,28 @@ const V = k(
|
|
|
20
20
|
size: N,
|
|
21
21
|
disabled: w,
|
|
22
22
|
isDisabled: j,
|
|
23
|
-
value:
|
|
23
|
+
value: s,
|
|
24
24
|
onChange: y,
|
|
25
25
|
defaultValue: l,
|
|
26
26
|
id: B,
|
|
27
27
|
...S
|
|
28
28
|
}, q) => {
|
|
29
|
-
const A = b ?? p, t = C ?? h,
|
|
29
|
+
const A = b ?? p, t = C ?? h, e = w ?? j, R = !!(i || a || t || o), c = s !== void 0, [D, E] = U.useState(
|
|
30
30
|
() => String(l ?? "").length
|
|
31
|
-
), F = c ? String(
|
|
31
|
+
), F = c ? String(s ?? "").length : D, I = (f) => {
|
|
32
32
|
c || E(f.target.value.length), y?.(f);
|
|
33
|
-
},
|
|
34
|
-
label:
|
|
35
|
-
helperText:
|
|
33
|
+
}, n = z({
|
|
34
|
+
label: i,
|
|
35
|
+
helperText: a,
|
|
36
36
|
helperTextPosition: d,
|
|
37
37
|
labelOrientation: u,
|
|
38
38
|
error: t,
|
|
39
39
|
required: A,
|
|
40
|
-
disabled:
|
|
40
|
+
disabled: e,
|
|
41
41
|
id: B,
|
|
42
|
-
footer:
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
42
|
+
footer: a && d === "flow" || o ? /* @__PURE__ */ v("div", { className: "flex items-center justify-between gap-[6px]", children: [
|
|
43
|
+
/* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1" }),
|
|
44
|
+
o ? /* @__PURE__ */ v(
|
|
45
45
|
"div",
|
|
46
46
|
{
|
|
47
47
|
className: "text-[12px] font-medium leading-[18px] text-navigation-muted text-right",
|
|
@@ -49,48 +49,49 @@ const V = k(
|
|
|
49
49
|
children: [
|
|
50
50
|
F,
|
|
51
51
|
"/",
|
|
52
|
-
|
|
52
|
+
o
|
|
53
53
|
]
|
|
54
54
|
}
|
|
55
55
|
) : null
|
|
56
56
|
] }) : void 0,
|
|
57
57
|
rootClassName: "min-w-[240px]"
|
|
58
|
-
}), m = /* @__PURE__ */
|
|
58
|
+
}), m = /* @__PURE__ */ r(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
className: x(
|
|
62
|
-
|
|
62
|
+
a && d === "absolute" && "relative"
|
|
63
63
|
),
|
|
64
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ r(
|
|
65
65
|
"textarea",
|
|
66
66
|
{
|
|
67
67
|
className: x(
|
|
68
68
|
G({
|
|
69
69
|
error: !!t,
|
|
70
70
|
size: N,
|
|
71
|
-
disabled: !!
|
|
71
|
+
disabled: !!e,
|
|
72
72
|
className: g
|
|
73
73
|
}),
|
|
74
74
|
"bg-canvas",
|
|
75
|
-
|
|
75
|
+
e && "bg-disabled-surface"
|
|
76
76
|
),
|
|
77
77
|
ref: q,
|
|
78
|
-
disabled: !!
|
|
79
|
-
value:
|
|
78
|
+
disabled: !!e,
|
|
79
|
+
value: s,
|
|
80
80
|
defaultValue: l,
|
|
81
81
|
onChange: I,
|
|
82
|
-
id:
|
|
82
|
+
id: n.controlId,
|
|
83
83
|
"data-component": "textarea",
|
|
84
84
|
"data-invalid": t || void 0,
|
|
85
|
-
"data-disabled":
|
|
86
|
-
"aria-invalid":
|
|
87
|
-
"aria-describedby":
|
|
88
|
-
...S
|
|
85
|
+
"data-disabled": e || void 0,
|
|
86
|
+
"aria-invalid": n.controlAria["aria-invalid"],
|
|
87
|
+
"aria-describedby": n.controlAria["aria-describedby"],
|
|
88
|
+
...S,
|
|
89
|
+
maxLength: o
|
|
89
90
|
}
|
|
90
91
|
)
|
|
91
92
|
}
|
|
92
93
|
);
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ r("div", { className: "flex w-full flex-col gap-[6px]", children: R ? n.wrapControl(m) : m });
|
|
94
95
|
}
|
|
95
96
|
);
|
|
96
97
|
export {
|
|
@@ -4,6 +4,7 @@ export interface TextareaProps extends FieldControlProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
7
|
+
/** Caps input length and shows a live `n/{characterLimit}` counter. */
|
|
7
8
|
characterLimit?: number;
|
|
8
9
|
/** @deprecated Use `required` */
|
|
9
10
|
isRequired?: boolean;
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { jsx as F, jsxs as
|
|
2
|
-
import { useMemo as I, useRef as
|
|
3
|
-
import { useWatch as
|
|
4
|
-
import { DatePicker as
|
|
5
|
-
import { getEffectiveMinOffsetDaysFromToday as
|
|
1
|
+
import { jsx as F, jsxs as M } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as I, useRef as K, useEffect as Y } from "react";
|
|
3
|
+
import { useWatch as W, Controller as k } from "react-hook-form";
|
|
4
|
+
import { DatePicker as q } from "../../components/forms/date-picker/date-picker.js";
|
|
5
|
+
import { getEffectiveMinOffsetDaysFromToday as O } from "../utils/formDate.utils.js";
|
|
6
6
|
import { startOfDayDate as v, addDaysDate as y, handleDateFnsFormat as L } from "../utils/date.utils.js";
|
|
7
7
|
import { parseYmdString as f, formatYmd as $ } from "../utils/calendar-boundary.js";
|
|
8
|
-
const
|
|
9
|
-
field:
|
|
10
|
-
validationRules:
|
|
8
|
+
const b = "__dateInputPairedSentinel__", H = ({
|
|
9
|
+
field: n,
|
|
10
|
+
validationRules: N,
|
|
11
11
|
isDisabled: u,
|
|
12
12
|
formHelpers: h
|
|
13
13
|
}) => {
|
|
14
|
-
const m =
|
|
14
|
+
const m = n.fieldType === "date", e = m ? n : null, g = h.form.control, A = h.form.trigger, P = h.getValues, s = I(() => e?.dateAfterFieldId ? Array.isArray(e.dateAfterFieldId) ? e.dateAfterFieldId : [e.dateAfterFieldId] : [], [e]), i = I(() => e?.dateBeforeFieldId ? Array.isArray(e.dateBeforeFieldId) ? e.dateBeforeFieldId : [e.dateBeforeFieldId] : [], [e]), B = s.length > 0 ? s : [b], p = W({
|
|
15
15
|
control: g,
|
|
16
|
-
name:
|
|
17
|
-
disabled: !m || i.length === 0
|
|
18
|
-
}), _ = s.length > 0 ? s : [B], D = S({
|
|
19
|
-
control: g,
|
|
20
|
-
name: _,
|
|
16
|
+
name: B,
|
|
21
17
|
disabled: !m || s.length === 0
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
}), E = i.length > 0 ? i : [b], D = W({
|
|
19
|
+
control: g,
|
|
20
|
+
name: E,
|
|
21
|
+
disabled: !m || i.length === 0
|
|
22
|
+
}), T = s.length > 0 || i.length > 0, w = K(!0), _ = s.length > 0 ? p.join("|") : "", C = i.length > 0 ? D.join("|") : "";
|
|
23
|
+
Y(() => {
|
|
24
|
+
if (!e || !T) return;
|
|
25
|
+
if (w.current) {
|
|
26
|
+
w.current = !1;
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
const r =
|
|
29
|
+
const r = P()[e.id];
|
|
30
30
|
r != null && String(r).trim() !== "" && A(e.id);
|
|
31
31
|
}, [
|
|
32
|
+
_,
|
|
32
33
|
C,
|
|
33
|
-
R,
|
|
34
34
|
e,
|
|
35
|
+
P,
|
|
35
36
|
T,
|
|
36
|
-
W,
|
|
37
37
|
A
|
|
38
38
|
]);
|
|
39
|
-
const { minDate:
|
|
39
|
+
const { minDate: R, maxDate: V } = I(() => {
|
|
40
40
|
if (!e)
|
|
41
41
|
return {
|
|
42
42
|
minDate: void 0,
|
|
43
43
|
maxDate: void 0
|
|
44
44
|
};
|
|
45
|
-
const r = [], l =
|
|
45
|
+
const r = [], l = O(e);
|
|
46
46
|
if (l != null && l >= 0 && r.push(v(y(/* @__PURE__ */ new Date(), l))), e.minDate) {
|
|
47
47
|
const t = f(e.minDate);
|
|
48
48
|
t && r.push(t);
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
51
|
-
const t =
|
|
52
|
-
for (const
|
|
53
|
-
if (!
|
|
54
|
-
const c = f(String(
|
|
50
|
+
if (s.length > 0) {
|
|
51
|
+
const t = s.length > 0 ? p : [];
|
|
52
|
+
for (const a of t) {
|
|
53
|
+
if (!a) continue;
|
|
54
|
+
const c = f(String(a));
|
|
55
55
|
if (c) {
|
|
56
56
|
const x = e.dateAfterFieldIdInclusive ? 0 : 1;
|
|
57
57
|
r.push(v(y(c, x)));
|
|
@@ -60,68 +60,73 @@ const B = "__dateInputPairedSentinel__", H = ({
|
|
|
60
60
|
}
|
|
61
61
|
let d;
|
|
62
62
|
r.length > 0 && (d = r.reduce(
|
|
63
|
-
(t,
|
|
63
|
+
(t, a) => t.getTime() >= a.getTime() ? t : a
|
|
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 (i.length > 0) {
|
|
71
|
+
const t = i.length > 0 ? D : [];
|
|
72
|
+
for (const a of t) {
|
|
73
|
+
if (!a) continue;
|
|
74
|
+
const c = f(String(a));
|
|
75
75
|
if (c) {
|
|
76
|
-
const x = e.dateBeforeFieldIdInclusive ? 0 : -1,
|
|
77
|
-
o = o == null ||
|
|
76
|
+
const x = e.dateBeforeFieldIdInclusive ? 0 : -1, S = v(y(c, x));
|
|
77
|
+
o = o == null || S.getTime() < o.getTime() ? S : o;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return { minDate: d, maxDate: o };
|
|
82
|
-
}, [e,
|
|
82
|
+
}, [e, s, i, p, D]);
|
|
83
83
|
if (!m || !e) return null;
|
|
84
|
-
const
|
|
84
|
+
const j = L(e.dateFormat);
|
|
85
85
|
return /* @__PURE__ */ F(
|
|
86
|
-
|
|
86
|
+
k,
|
|
87
87
|
{
|
|
88
|
-
name:
|
|
88
|
+
name: n.id,
|
|
89
89
|
control: g,
|
|
90
90
|
disabled: u,
|
|
91
|
-
rules:
|
|
91
|
+
rules: N,
|
|
92
92
|
render: ({ field: r, fieldState: l }) => {
|
|
93
93
|
const d = !!l.error, o = r.value, t = o ? f(String(o)) : void 0;
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ M("div", { className: "flex w-full min-w-0 flex-col gap-[6px]", children: [
|
|
95
|
+
/* @__PURE__ */ M(
|
|
96
96
|
"label",
|
|
97
97
|
{
|
|
98
|
-
htmlFor:
|
|
98
|
+
htmlFor: n.id,
|
|
99
99
|
className: `text-[12px] font-medium leading-[18px] text-[#60697d]${u ? " opacity-70" : ""}`,
|
|
100
100
|
children: [
|
|
101
|
-
|
|
101
|
+
n.label,
|
|
102
102
|
" ",
|
|
103
|
-
|
|
103
|
+
n.isRequired ? /* @__PURE__ */ F("span", { className: "text-[red]", children: "*" }) : null
|
|
104
104
|
]
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
107
|
/* @__PURE__ */ F(
|
|
108
|
-
|
|
108
|
+
q,
|
|
109
109
|
{
|
|
110
|
-
id:
|
|
110
|
+
id: n.id,
|
|
111
111
|
label: void 0,
|
|
112
|
-
format:
|
|
113
|
-
minDate:
|
|
114
|
-
maxDate:
|
|
112
|
+
format: j,
|
|
113
|
+
minDate: R,
|
|
114
|
+
maxDate: V,
|
|
115
115
|
value: t,
|
|
116
|
-
onChange: (
|
|
117
|
-
r.onChange(
|
|
116
|
+
onChange: (a) => {
|
|
117
|
+
r.onChange(a ? $(a) : "");
|
|
118
118
|
},
|
|
119
|
-
placeholder:
|
|
120
|
-
required:
|
|
119
|
+
placeholder: n.placeholder,
|
|
120
|
+
required: n.isRequired,
|
|
121
121
|
disabled: u,
|
|
122
122
|
error: d,
|
|
123
|
-
helperText: d ? l.error?.message :
|
|
124
|
-
showFooter: e.showFooter
|
|
123
|
+
helperText: d ? l.error?.message : n.helpText,
|
|
124
|
+
showFooter: e.showFooter,
|
|
125
|
+
calendarKind: e.calendarKind,
|
|
126
|
+
fiscalMode: e.fiscalMode,
|
|
127
|
+
fiscalYearStartMonth: e.fiscalYearStartMonth,
|
|
128
|
+
fiscalMonthPattern: e.fiscalMonthPattern,
|
|
129
|
+
showPresets: e.showPresets
|
|
125
130
|
}
|
|
126
131
|
)
|
|
127
132
|
] });
|
|
@@ -1,51 +1,56 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Controller as
|
|
4
|
-
import { DateRangePicker as
|
|
5
|
-
import { toLocalDate as
|
|
6
|
-
import { handleMinMaxProp as
|
|
7
|
-
const
|
|
8
|
-
field:
|
|
9
|
-
validationRules:
|
|
3
|
+
import { Controller as S } from "react-hook-form";
|
|
4
|
+
import { DateRangePicker as g } from "../../components/forms/date-picker/date-range-picker.js";
|
|
5
|
+
import { toLocalDate as a } from "../utils/calendar-boundary.js";
|
|
6
|
+
import { handleMinMaxProp as D } from "../utils/date.utils.js";
|
|
7
|
+
const Y = ({
|
|
8
|
+
field: r,
|
|
9
|
+
validationRules: h,
|
|
10
10
|
isDisabled: l,
|
|
11
|
-
formHelpers:
|
|
11
|
+
formHelpers: s
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
13
|
+
const t = r.fieldType === "date_range" ? r : null;
|
|
14
|
+
if (!t) return null;
|
|
15
|
+
const c = s.form.control, { minDate: m, maxDate: u } = D(t);
|
|
16
|
+
return /* @__PURE__ */ n(
|
|
17
|
+
S,
|
|
18
18
|
{
|
|
19
|
-
name:
|
|
20
|
-
control:
|
|
19
|
+
name: r.id,
|
|
20
|
+
control: c,
|
|
21
21
|
disabled: l,
|
|
22
|
-
rules:
|
|
23
|
-
render: ({ field: p, fieldState:
|
|
24
|
-
const
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
22
|
+
rules: h,
|
|
23
|
+
render: ({ field: p, fieldState: d }) => {
|
|
24
|
+
const i = !!d.error, e = p.value;
|
|
25
|
+
return /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
|
|
26
|
+
g,
|
|
27
27
|
{
|
|
28
|
-
label:
|
|
29
|
-
minDate:
|
|
28
|
+
label: r.label,
|
|
29
|
+
minDate: m,
|
|
30
30
|
maxDate: u,
|
|
31
|
-
startMonth:
|
|
32
|
-
endMonth:
|
|
31
|
+
startMonth: t.startMonth ? a(t.startMonth) : void 0,
|
|
32
|
+
endMonth: t.endMonth ? a(t.endMonth) : void 0,
|
|
33
33
|
value: {
|
|
34
|
-
from: e?.start ?
|
|
35
|
-
to: e?.end ?
|
|
34
|
+
from: e?.start ? a(e.start) : void 0,
|
|
35
|
+
to: e?.end ? a(e.end) : void 0
|
|
36
36
|
},
|
|
37
37
|
onChange: (o) => {
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const M = o?.from ? `${o.from.getFullYear()}-${String(o.from.getMonth() + 1).padStart(2, "0")}-${String(o.from.getDate()).padStart(2, "0")}` : null, f = o?.to ? `${o.to.getFullYear()}-${String(o.to.getMonth() + 1).padStart(2, "0")}-${String(o.to.getDate()).padStart(2, "0")}` : null;
|
|
39
|
+
s.setValue(r.id, { start: M, end: f });
|
|
40
40
|
},
|
|
41
|
-
startPlaceholder:
|
|
42
|
-
endPlaceholder:
|
|
43
|
-
placeholder:
|
|
44
|
-
required:
|
|
41
|
+
startPlaceholder: t.startPlaceholder || "Start Date",
|
|
42
|
+
endPlaceholder: t.endPlaceholder || "End Date",
|
|
43
|
+
placeholder: r.placeholder,
|
|
44
|
+
required: r.isRequired,
|
|
45
45
|
disabled: l,
|
|
46
|
-
error:
|
|
47
|
-
helperText:
|
|
48
|
-
showFooter: !0
|
|
46
|
+
error: i,
|
|
47
|
+
helperText: i ? d.error?.message : r.helpText,
|
|
48
|
+
showFooter: !0,
|
|
49
|
+
calendarKind: t.calendarKind,
|
|
50
|
+
fiscalMode: t.fiscalMode,
|
|
51
|
+
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
52
|
+
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
53
|
+
showPresets: t.showPresets
|
|
49
54
|
}
|
|
50
55
|
) });
|
|
51
56
|
}
|
|
@@ -53,5 +58,5 @@ const T = ({
|
|
|
53
58
|
);
|
|
54
59
|
};
|
|
55
60
|
export {
|
|
56
|
-
|
|
61
|
+
Y as DateRangeField
|
|
57
62
|
};
|
|
@@ -1,66 +1,71 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { MonthRangePicker as
|
|
4
|
-
import { getFieldTestId as
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { Controller as F } from "react-hook-form";
|
|
3
|
+
import { MonthRangePicker as v } from "../../components/forms/date-picker/month-range-picker.js";
|
|
4
|
+
import { getFieldTestId as P } from "../utils/fieldTestIds.js";
|
|
5
5
|
import { toLocalDate as o } from "../utils/calendar-boundary.js";
|
|
6
|
-
const w = (
|
|
7
|
-
if (
|
|
8
|
-
const [
|
|
9
|
-
return { year: parseInt(
|
|
6
|
+
const w = (r) => {
|
|
7
|
+
if (r.includes("/")) {
|
|
8
|
+
const [a, d] = r.split("/");
|
|
9
|
+
return { year: parseInt(d, 10), month: parseInt(a, 10) - 1 };
|
|
10
10
|
}
|
|
11
|
-
const [s, l] =
|
|
11
|
+
const [s, l] = r.split("-");
|
|
12
12
|
return { year: parseInt(s, 10), month: parseInt(l, 10) - 1 };
|
|
13
|
-
},
|
|
14
|
-
field:
|
|
13
|
+
}, O = ({
|
|
14
|
+
field: r,
|
|
15
15
|
validationRules: s,
|
|
16
16
|
isDisabled: l,
|
|
17
|
-
formHelpers:
|
|
17
|
+
formHelpers: a
|
|
18
18
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
const y =
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
19
|
+
const d = a.form.control, t = r.fieldType === "month_range" ? r : null;
|
|
20
|
+
if (!t) return null;
|
|
21
|
+
const y = t.displayFormat || "MM/YYYY", c = t.minMonthsOffset != null ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - t.minMonthsOffset, 1) : t.disablePastMonths ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1) : o(t.minDate), h = t.maxMonthsOffset != null ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + t.maxMonthsOffset, 1) : o(t.maxDate);
|
|
22
|
+
return /* @__PURE__ */ u(
|
|
23
|
+
F,
|
|
24
24
|
{
|
|
25
|
-
name:
|
|
26
|
-
control:
|
|
27
|
-
defaultValue:
|
|
25
|
+
name: r.id,
|
|
26
|
+
control: d,
|
|
27
|
+
defaultValue: t.defaultRange ? { start: t.defaultRange.start || null, end: t.defaultRange.end || null } : void 0,
|
|
28
28
|
rules: s,
|
|
29
|
-
render: ({ field:
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
29
|
+
render: ({ field: i, fieldState: M }) => {
|
|
30
|
+
const f = !!M.error, n = i.value, p = n?.start ? w(n.start) : null, m = n?.end ? w(n.end) : null, Y = p && m;
|
|
31
|
+
return /* @__PURE__ */ u("div", { "data-testid": P(r.id), children: /* @__PURE__ */ u(
|
|
32
|
+
v,
|
|
33
33
|
{
|
|
34
|
-
label:
|
|
34
|
+
label: r.label,
|
|
35
35
|
displayFormat: y,
|
|
36
|
-
...
|
|
36
|
+
...Y && {
|
|
37
37
|
value: {
|
|
38
38
|
from: p,
|
|
39
|
-
to:
|
|
39
|
+
to: m
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
onChange: (
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
|
|
42
|
+
onChange: (e) => {
|
|
43
|
+
if (!e?.from || !e?.to) {
|
|
44
|
+
const g = { start: null, end: null };
|
|
45
|
+
i.onChange(g), a.setValue(r.id, g);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
start:
|
|
50
|
-
end:
|
|
48
|
+
const $ = e.from.start ? `${e.from.start.getFullYear()}-${String(e.from.start.getMonth() + 1).padStart(2, "0")}-${String(e.from.start.getDate()).padStart(2, "0")}` : `${e.from.year}-${String(e.from.month + 1).padStart(2, "0")}-01`, D = e.to.end ? e.to.end.getDate() : new Date(e.to.year, e.to.month + 1, 0).getDate(), x = e.to.end ? `${e.to.end.getFullYear()}-${String(e.to.end.getMonth() + 1).padStart(2, "0")}-${String(D).padStart(2, "0")}` : `${e.to.year}-${String(e.to.month + 1).padStart(2, "0")}-${String(D).padStart(2, "0")}`, S = {
|
|
49
|
+
start: $,
|
|
50
|
+
end: x
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
i.onChange(S), a.setValue(r.id, S);
|
|
53
53
|
},
|
|
54
|
-
placeholder:
|
|
55
|
-
minDate:
|
|
56
|
-
maxDate:
|
|
57
|
-
startMonth:
|
|
58
|
-
endMonth:
|
|
59
|
-
required:
|
|
54
|
+
placeholder: r.placeholder,
|
|
55
|
+
minDate: c,
|
|
56
|
+
maxDate: h,
|
|
57
|
+
startMonth: c || o(t.startMonth),
|
|
58
|
+
endMonth: h || o(t.endMonth),
|
|
59
|
+
required: r.isRequired,
|
|
60
60
|
disabled: l,
|
|
61
|
-
error:
|
|
62
|
-
helperText:
|
|
63
|
-
showFooter: !0
|
|
61
|
+
error: f,
|
|
62
|
+
helperText: f ? M.error?.message : r.helpText,
|
|
63
|
+
showFooter: !0,
|
|
64
|
+
calendarKind: t.calendarKind,
|
|
65
|
+
fiscalMode: t.fiscalMode,
|
|
66
|
+
fiscalYearStartMonth: t.fiscalYearStartMonth,
|
|
67
|
+
fiscalMonthPattern: t.fiscalMonthPattern,
|
|
68
|
+
showPresets: t.showPresets
|
|
64
69
|
}
|
|
65
70
|
) });
|
|
66
71
|
}
|
|
@@ -68,5 +73,5 @@ const w = (t) => {
|
|
|
68
73
|
);
|
|
69
74
|
};
|
|
70
75
|
export {
|
|
71
|
-
|
|
76
|
+
O as MonthRangeField
|
|
72
77
|
};
|
|
@@ -3,18 +3,18 @@ import { Controller as p } from "react-hook-form";
|
|
|
3
3
|
import { MultiWeekPicker as h } from "../../components/forms/date-picker/multi-week-picker.js";
|
|
4
4
|
import { getFieldTestId as k } from "../utils/fieldTestIds.js";
|
|
5
5
|
import { toLocalDate as i } from "../utils/calendar-boundary.js";
|
|
6
|
-
const
|
|
6
|
+
const M = ({
|
|
7
7
|
field: e,
|
|
8
8
|
validationRules: m,
|
|
9
9
|
isDisabled: s,
|
|
10
10
|
formHelpers: c
|
|
11
11
|
}) => {
|
|
12
|
-
const
|
|
12
|
+
const d = c.form.control, r = e.fieldType === "multi_week_picker" ? e : null;
|
|
13
13
|
return r ? /* @__PURE__ */ o(
|
|
14
14
|
p,
|
|
15
15
|
{
|
|
16
16
|
name: e.id,
|
|
17
|
-
control:
|
|
17
|
+
control: d,
|
|
18
18
|
rules: m,
|
|
19
19
|
render: ({ field: t, fieldState: a }) => {
|
|
20
20
|
const l = !!a.error, n = t.value;
|
|
@@ -23,15 +23,15 @@ const v = ({
|
|
|
23
23
|
{
|
|
24
24
|
label: e.label,
|
|
25
25
|
value: Array.isArray(n) ? n : void 0,
|
|
26
|
-
onChange: (
|
|
27
|
-
t.onChange(
|
|
26
|
+
onChange: (u) => {
|
|
27
|
+
t.onChange(u ?? []);
|
|
28
28
|
},
|
|
29
29
|
placeholder: e.placeholder,
|
|
30
30
|
required: e.isRequired,
|
|
31
31
|
disabled: s,
|
|
32
32
|
error: l,
|
|
33
33
|
helperText: l ? a.error?.message : e.helpText,
|
|
34
|
-
|
|
34
|
+
calendarKind: r.calendarKind,
|
|
35
35
|
fiscalMode: r.fiscalMode,
|
|
36
36
|
weekStartsOn: r.weekStartsOn,
|
|
37
37
|
minDate: i(r.minDate),
|
|
@@ -43,5 +43,5 @@ const v = ({
|
|
|
43
43
|
) : null;
|
|
44
44
|
};
|
|
45
45
|
export {
|
|
46
|
-
|
|
46
|
+
M as MultiWeekPickerField
|
|
47
47
|
};
|