impact-nova 2.5.17 → 2.5.19
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 +1 -0
- package/dist/components/data/data-table/build-column-tree-from-grid.js +55 -50
- package/dist/components/data/data-table/column-picker-authority.d.ts +34 -0
- package/dist/components/data/data-table/column-picker-authority.js +116 -0
- package/dist/components/data/data-table/column-picker-drop-validation.d.ts +7 -0
- package/dist/components/data/data-table/column-picker-drop-validation.js +37 -0
- package/dist/components/data/data-table/data-table-column-apply.d.ts +2 -0
- package/dist/components/data/data-table/data-table-column-apply.js +84 -73
- package/dist/components/data/data-table/data-table-column-list-tree-apply.d.ts +10 -0
- package/dist/components/data/data-table/data-table-column-list-tree-apply.js +79 -0
- package/dist/components/data/data-table/data-table-column-list.js +94 -64
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +12 -6
- package/dist/components/data/data-table/data-table-column-tree-cache.js +250 -131
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.d.ts +26 -0
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.js +195 -0
- package/dist/components/data/data-table/data-table-picker-column-eligibility.d.ts +1 -0
- package/dist/components/data/data-table/data-table-picker-column-eligibility.js +7 -0
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.d.ts +5 -0
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.js +28 -11
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.d.ts +12 -0
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.js +12 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +10 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +250 -196
- package/dist/components/data/nested-list/components/NestedListContent.d.ts +10 -2
- package/dist/components/data/nested-list/components/NestedListContent.js +253 -138
- package/dist/components/data/nested-list/components/SortableItem.d.ts +2 -1
- package/dist/components/data/nested-list/components/SortableItem.js +62 -60
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.d.ts +10 -20
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.js +44 -233
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.d.ts +24 -0
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.js +128 -0
- package/dist/components/data/nested-list/nested-list-constants.d.ts +4 -1
- package/dist/components/data/nested-list/nested-list-constants.js +10 -4
- package/dist/components/data/nested-list/nested-list-display-utils.d.ts +11 -0
- package/dist/components/data/nested-list/nested-list-display-utils.js +74 -0
- package/dist/components/data/nested-list/nested-list-drop-engine.d.ts +31 -0
- package/dist/components/data/nested-list/nested-list-drop-engine.js +209 -0
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.d.ts +26 -0
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.js +67 -0
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.d.ts +4 -0
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.js +43 -0
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.d.ts +3 -0
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.js +34 -0
- package/dist/components/data/nested-list/nested-list-row-estimates.d.ts +9 -0
- package/dist/components/data/nested-list/nested-list-row-estimates.js +14 -0
- package/dist/components/data/nested-list/nested-list-scroll-anchor.d.ts +36 -0
- package/dist/components/data/nested-list/nested-list-scroll-anchor.js +47 -0
- package/dist/components/data/nested-list/nested-list-virtual-drop.d.ts +59 -0
- package/dist/components/data/nested-list/nested-list-virtual-drop.js +341 -0
- package/dist/components/data/nested-list/nested-list.js +322 -336
- package/dist/components/data/nested-list/nested-list.types.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +12 -12
- package/dist/components/data-display/calendar/calendar-year-utils.js +9 -9
- package/dist/components/forms/date-picker/multi-quarter-picker.js +87 -87
- package/dist/components/forms/date-picker/multi-year-picker.js +81 -81
- package/dist/components/forms/date-picker/quarter-range-picker.js +84 -84
- package/dist/components/forms/date-picker/year-range-picker.js +79 -79
- package/dist/form-react/Fields/ChipsField.js +49 -48
- package/dist/form-react/Fields/DateRangeField.js +25 -25
- package/dist/form-react/Fields/MonthRangeField.js +57 -57
- package/dist/form-react/Fields/MultiMonthPickerField.js +28 -26
- package/dist/form-react/Fields/MultiWeekPickerField.js +43 -41
- package/dist/form-react/Fields/MultiYearPickerField.js +45 -45
- package/dist/form-react/Fields/SelectField.js +24 -26
- package/dist/form-react/Fields/WeekRangePicker.js +16 -16
- package/dist/form-react/Fields/YearPickerField.js +27 -27
- package/dist/form-react/Fields/YearRangePickerField.js +29 -29
- package/dist/form-react/types/fields.types.d.ts +30 -0
- package/dist/form-react/utils/date.utils.d.ts +51 -2
- package/dist/form-react/utils/date.utils.js +195 -63
- package/dist/impact-nova.css +1 -1
- package/dist/lib/hash/fnv1a128.d.ts +16 -0
- package/dist/lib/hash/fnv1a128.js +21 -0
- 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
|
@@ -1,63 +1,63 @@
|
|
|
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
|
|
7
|
-
import { Tooltip as x, TooltipTrigger as
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { buildDateBoundsMatcher as
|
|
10
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
-
import { DatePickerShell as
|
|
12
|
-
import { usePickerDismissActionsRef as
|
|
3
|
+
import { Cross as te, CalendarMonth as ne } from "impact-nova-icons";
|
|
4
|
+
import { cn as oe } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as ae } from "../input/input.js";
|
|
6
|
+
import { Calendar as ie } from "../../data-display/calendar/calendar.js";
|
|
7
|
+
import { Tooltip as x, TooltipTrigger as Y, TooltipContent as D } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
+
import { useImpactNovaI18n as ce } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as se } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as le } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as fe } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as pe, usePickerFooterDismissNudge as de, handleReadonlyPickerKeyDown as me, handlePickerSurfacePointerDown as ue } 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 he, isYearRangeSelection as ge } from "../../data-display/calendar/calendar-year-utils.js";
|
|
15
|
+
const ye = t.forwardRef(
|
|
16
16
|
({
|
|
17
|
-
value:
|
|
17
|
+
value: y,
|
|
18
18
|
onChange: d,
|
|
19
19
|
placeholder: S,
|
|
20
|
-
minDate:
|
|
21
|
-
maxDate:
|
|
22
|
-
startMonth:
|
|
23
|
-
endMonth:
|
|
20
|
+
minDate: A,
|
|
21
|
+
maxDate: I,
|
|
22
|
+
startMonth: M,
|
|
23
|
+
endMonth: O,
|
|
24
24
|
showFooter: l = !0,
|
|
25
25
|
disabled: o,
|
|
26
|
-
className:
|
|
27
|
-
calendarKind:
|
|
28
|
-
fiscalMode:
|
|
29
|
-
granularity:
|
|
30
|
-
fiscalMonthPattern:
|
|
31
|
-
fiscalYearStartMonth:
|
|
32
|
-
fiscalConfig:
|
|
33
|
-
weekStartsOn:
|
|
34
|
-
showPresets:
|
|
35
|
-
showPeriodBoundaries:
|
|
36
|
-
autoNavigateToAvailable:
|
|
37
|
-
showIntervalCaption:
|
|
38
|
-
...
|
|
39
|
-
},
|
|
40
|
-
const { t: a } =
|
|
41
|
-
t.useImperativeHandle(
|
|
42
|
-
const [i, c] = t.useState(!1), u = t.useRef(!1),
|
|
26
|
+
className: T,
|
|
27
|
+
calendarKind: w,
|
|
28
|
+
fiscalMode: K,
|
|
29
|
+
granularity: j,
|
|
30
|
+
fiscalMonthPattern: F,
|
|
31
|
+
fiscalYearStartMonth: L,
|
|
32
|
+
fiscalConfig: k,
|
|
33
|
+
weekStartsOn: $,
|
|
34
|
+
showPresets: z,
|
|
35
|
+
showPeriodBoundaries: E,
|
|
36
|
+
autoNavigateToAvailable: H,
|
|
37
|
+
showIntervalCaption: V = !1,
|
|
38
|
+
...B
|
|
39
|
+
}, q) => {
|
|
40
|
+
const { t: a } = ce(), G = S ?? a("datePicker.selectYearRange"), P = k?.fyLabel ?? "fy-long", m = t.useRef(null), R = t.useRef(null);
|
|
41
|
+
t.useImperativeHandle(q, () => m.current);
|
|
42
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), v = pe(), { footerFlashKey: J, footerFlashTarget: Q, popoverHandlers: U } = de(l, i, v, R), n = ge(y) ? y : void 0, [C, f] = t.useState(n), [W, X] = t.useState(he(n?.from));
|
|
43
43
|
t.useEffect(() => {
|
|
44
44
|
i || f(n);
|
|
45
45
|
}, [i, n]);
|
|
46
|
-
const p = t.useCallback(() => c(!1), []),
|
|
47
|
-
calendarKind:
|
|
48
|
-
fiscalMode:
|
|
49
|
-
granularity:
|
|
50
|
-
fiscalMonthPattern:
|
|
51
|
-
fiscalYearStartMonth:
|
|
52
|
-
fiscalConfig:
|
|
53
|
-
weekStartsOn:
|
|
54
|
-
showPresets:
|
|
55
|
-
showPeriodBoundaries:
|
|
56
|
-
autoNavigateToAvailable:
|
|
57
|
-
}),
|
|
46
|
+
const p = t.useCallback(() => c(!1), []), Z = le({
|
|
47
|
+
calendarKind: w,
|
|
48
|
+
fiscalMode: K,
|
|
49
|
+
granularity: j,
|
|
50
|
+
fiscalMonthPattern: F,
|
|
51
|
+
fiscalYearStartMonth: L,
|
|
52
|
+
fiscalConfig: k,
|
|
53
|
+
weekStartsOn: $,
|
|
54
|
+
showPresets: z,
|
|
55
|
+
showPeriodBoundaries: E,
|
|
56
|
+
autoNavigateToAvailable: H
|
|
57
|
+
}), _ = (e) => {
|
|
58
58
|
const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
|
|
59
59
|
f(s), l || (d?.(s), s?.to && p());
|
|
60
|
-
},
|
|
60
|
+
}, ee = () => {
|
|
61
61
|
d?.(C), p();
|
|
62
62
|
}, h = () => {
|
|
63
63
|
f(n), p();
|
|
@@ -65,11 +65,11 @@ const he = t.forwardRef(
|
|
|
65
65
|
f(void 0), d?.(void 0), l || p();
|
|
66
66
|
};
|
|
67
67
|
t.useLayoutEffect(() => {
|
|
68
|
-
|
|
68
|
+
v.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
69
69
|
});
|
|
70
|
-
const
|
|
70
|
+
const re = n?.from ? `${N(n.from, P)}${n.to ? ` – ${N(n.to, P)}` : ""}` : "";
|
|
71
71
|
return /* @__PURE__ */ r(
|
|
72
|
-
|
|
72
|
+
fe,
|
|
73
73
|
{
|
|
74
74
|
open: i,
|
|
75
75
|
disabled: o,
|
|
@@ -80,26 +80,26 @@ const he = t.forwardRef(
|
|
|
80
80
|
onOpenAutoFocus: (e) => {
|
|
81
81
|
u.current || e.preventDefault(), u.current = !1;
|
|
82
82
|
},
|
|
83
|
-
popoverHandlers:
|
|
83
|
+
popoverHandlers: U,
|
|
84
84
|
trigger: /* @__PURE__ */ r(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
ref:
|
|
87
|
+
ref: R,
|
|
88
88
|
"data-component": "year-range-picker",
|
|
89
89
|
"data-state": i ? "open" : "closed",
|
|
90
|
-
onPointerDown: (e) =>
|
|
90
|
+
onPointerDown: (e) => ue({
|
|
91
91
|
disabled: o,
|
|
92
92
|
event: e,
|
|
93
93
|
onOpen: () => c(!0),
|
|
94
94
|
focusField: () => m.current?.focus()
|
|
95
95
|
}),
|
|
96
96
|
children: /* @__PURE__ */ r(
|
|
97
|
-
|
|
97
|
+
ae,
|
|
98
98
|
{
|
|
99
99
|
ref: m,
|
|
100
|
-
value:
|
|
100
|
+
value: re,
|
|
101
101
|
readOnly: !0,
|
|
102
|
-
onKeyDown: (e) =>
|
|
102
|
+
onKeyDown: (e) => me(e, {
|
|
103
103
|
disabled: o,
|
|
104
104
|
open: i,
|
|
105
105
|
onOpen: () => c(!0),
|
|
@@ -109,13 +109,13 @@ const he = t.forwardRef(
|
|
|
109
109
|
}
|
|
110
110
|
}),
|
|
111
111
|
onClick: () => !o && c(!0),
|
|
112
|
-
placeholder:
|
|
112
|
+
placeholder: G,
|
|
113
113
|
disabled: o,
|
|
114
114
|
"data-form-control": "input",
|
|
115
|
-
className:
|
|
115
|
+
className: oe("cursor-pointer", T),
|
|
116
116
|
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
117
117
|
n?.from && !o ? /* @__PURE__ */ g(x, { children: [
|
|
118
|
-
/* @__PURE__ */ r(
|
|
118
|
+
/* @__PURE__ */ r(Y, { asChild: !0, children: /* @__PURE__ */ r(
|
|
119
119
|
"button",
|
|
120
120
|
{
|
|
121
121
|
type: "button",
|
|
@@ -125,13 +125,13 @@ const he = t.forwardRef(
|
|
|
125
125
|
e.stopPropagation(), b();
|
|
126
126
|
},
|
|
127
127
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
128
|
-
children: /* @__PURE__ */ r(
|
|
128
|
+
children: /* @__PURE__ */ r(te, { className: "size-3 hover:text-content" })
|
|
129
129
|
}
|
|
130
130
|
) }),
|
|
131
|
-
/* @__PURE__ */ r(
|
|
131
|
+
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
132
132
|
] }) : null,
|
|
133
133
|
/* @__PURE__ */ g(x, { children: [
|
|
134
|
-
/* @__PURE__ */ r(
|
|
134
|
+
/* @__PURE__ */ r(Y, { asChild: !0, children: /* @__PURE__ */ r(
|
|
135
135
|
"button",
|
|
136
136
|
{
|
|
137
137
|
type: "button",
|
|
@@ -142,44 +142,44 @@ const he = t.forwardRef(
|
|
|
142
142
|
e.stopPropagation(), o || c((s) => !s);
|
|
143
143
|
},
|
|
144
144
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
145
|
-
children: /* @__PURE__ */ r(
|
|
145
|
+
children: /* @__PURE__ */ r(ne, { className: "h-4 w-4 text-secondary-foreground" })
|
|
146
146
|
}
|
|
147
147
|
) }),
|
|
148
|
-
/* @__PURE__ */ r(
|
|
148
|
+
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("datePicker.selectYearRange") })
|
|
149
149
|
] })
|
|
150
150
|
] }),
|
|
151
|
-
...
|
|
151
|
+
...B
|
|
152
152
|
}
|
|
153
153
|
)
|
|
154
154
|
}
|
|
155
155
|
),
|
|
156
156
|
children: /* @__PURE__ */ r(
|
|
157
|
-
|
|
157
|
+
ie,
|
|
158
158
|
{
|
|
159
159
|
pickerType: "year",
|
|
160
160
|
yearMode: "range",
|
|
161
161
|
selectedYear: C,
|
|
162
|
-
footerFlashKey:
|
|
163
|
-
footerFlashTarget:
|
|
164
|
-
onYearSelect:
|
|
165
|
-
month:
|
|
166
|
-
onMonthChange:
|
|
167
|
-
disabled:
|
|
168
|
-
startMonth:
|
|
169
|
-
endMonth:
|
|
162
|
+
footerFlashKey: J,
|
|
163
|
+
footerFlashTarget: Q,
|
|
164
|
+
onYearSelect: _,
|
|
165
|
+
month: W,
|
|
166
|
+
onMonthChange: X,
|
|
167
|
+
disabled: se(A, I),
|
|
168
|
+
startMonth: M,
|
|
169
|
+
endMonth: O,
|
|
170
170
|
showFooter: l,
|
|
171
|
-
onApply:
|
|
171
|
+
onApply: ee,
|
|
172
172
|
onCancel: h,
|
|
173
173
|
onClear: b,
|
|
174
|
-
showIntervalCaption:
|
|
175
|
-
...
|
|
174
|
+
showIntervalCaption: V,
|
|
175
|
+
...Z
|
|
176
176
|
}
|
|
177
177
|
)
|
|
178
178
|
}
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
);
|
|
182
|
-
|
|
182
|
+
ye.displayName = "YearRangePicker";
|
|
183
183
|
export {
|
|
184
|
-
|
|
184
|
+
ye as YearRangePicker
|
|
185
185
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Controller as
|
|
4
|
-
import { Info as
|
|
3
|
+
import { Controller as V } from "react-hook-form";
|
|
4
|
+
import { Info as w } from "impact-nova-icons";
|
|
5
5
|
import { Chip as f } from "../../components/primitives/chips/chips.js";
|
|
6
|
-
import { Checkbox as
|
|
6
|
+
import { Checkbox as T } from "../../components/forms/checkbox/checkbox.js";
|
|
7
7
|
import { cn as i } from "../../lib/utils.js";
|
|
8
|
-
import { getFieldTestId as
|
|
9
|
-
const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertiary",
|
|
10
|
-
field:
|
|
8
|
+
import { getFieldTestId as z } from "../utils/fieldTestIds.js";
|
|
9
|
+
const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertiary", R = ({
|
|
10
|
+
field: l,
|
|
11
11
|
validationRules: h,
|
|
12
|
-
isDisabled:
|
|
13
|
-
formHelpers:
|
|
12
|
+
isDisabled: a,
|
|
13
|
+
formHelpers: n
|
|
14
14
|
}) => {
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
15
|
+
if (l.fieldType !== "chips") return null;
|
|
16
|
+
const d = l, p = d.options ?? [], g = d.chipsType ?? "single", b = d.allowDeselect === !0, N = n.form.control, c = l.id;
|
|
17
17
|
return /* @__PURE__ */ t(
|
|
18
|
-
|
|
18
|
+
V,
|
|
19
19
|
{
|
|
20
|
-
name:
|
|
21
|
-
control:
|
|
22
|
-
disabled:
|
|
20
|
+
name: c,
|
|
21
|
+
control: N,
|
|
22
|
+
disabled: a,
|
|
23
23
|
rules: h,
|
|
24
|
-
render: ({ field:
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
24
|
+
render: ({ field: C, fieldState: x }) => {
|
|
25
|
+
const o = C.value, k = typeof o == "string" ? o : "", m = Array.isArray(o) ? o : [], r = !!x.error, v = r ? x.error?.message : l.helpText;
|
|
26
|
+
return /* @__PURE__ */ u("div", { "data-testid": z(l.id), children: [
|
|
27
|
+
l.label ? /* @__PURE__ */ u(
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
30
|
className: i(
|
|
31
31
|
j,
|
|
32
|
-
|
|
32
|
+
r && "text-destructive"
|
|
33
33
|
),
|
|
34
34
|
children: [
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
l.label,
|
|
36
|
+
l.isRequired ? /* @__PURE__ */ t("span", { className: "ml-1 text-destructive", children: "*" }) : null
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
) : null,
|
|
@@ -41,11 +41,11 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
|
|
|
41
41
|
"div",
|
|
42
42
|
{
|
|
43
43
|
role: "radiogroup",
|
|
44
|
-
"aria-label":
|
|
45
|
-
"aria-invalid":
|
|
44
|
+
"aria-label": l.label,
|
|
45
|
+
"aria-invalid": r,
|
|
46
46
|
className: "mb-2 flex w-full flex-wrap items-center gap-3",
|
|
47
|
-
children:
|
|
48
|
-
const
|
|
47
|
+
children: p.map((e) => {
|
|
48
|
+
const s = k === e.value;
|
|
49
49
|
return /* @__PURE__ */ t(
|
|
50
50
|
f,
|
|
51
51
|
{
|
|
@@ -53,19 +53,19 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
|
|
|
53
53
|
shape: "rounded",
|
|
54
54
|
size: "lg",
|
|
55
55
|
selectionMode: "single",
|
|
56
|
-
selected:
|
|
57
|
-
disabled:
|
|
56
|
+
selected: s,
|
|
57
|
+
disabled: a,
|
|
58
58
|
className: i(
|
|
59
59
|
"cursor-pointer gap-2 focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
60
|
-
|
|
60
|
+
r && !s && "!border-destructive !text-destructive"
|
|
61
61
|
),
|
|
62
62
|
onClick: () => {
|
|
63
|
-
if (!
|
|
64
|
-
if (
|
|
65
|
-
|
|
63
|
+
if (!a) {
|
|
64
|
+
if (s && b) {
|
|
65
|
+
n.setValue(c, "");
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
s || n.setValue(c, e.value);
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
children: /* @__PURE__ */ t("span", { className: "text-sm", children: e.label })
|
|
@@ -74,52 +74,53 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
|
|
|
74
74
|
);
|
|
75
75
|
})
|
|
76
76
|
}
|
|
77
|
-
) : /* @__PURE__ */ t("div", { className: "mb-2 flex w-full flex-wrap gap-3", children:
|
|
78
|
-
const
|
|
79
|
-
return /* @__PURE__ */
|
|
77
|
+
) : /* @__PURE__ */ t("div", { className: "mb-2 flex w-full flex-wrap gap-3", children: p.map((e) => {
|
|
78
|
+
const s = m.includes(e.value);
|
|
79
|
+
return /* @__PURE__ */ u(
|
|
80
80
|
f,
|
|
81
81
|
{
|
|
82
82
|
variant: "outline",
|
|
83
83
|
shape: "rounded",
|
|
84
84
|
size: "lg",
|
|
85
|
-
selected:
|
|
85
|
+
selected: s,
|
|
86
86
|
className: i(
|
|
87
87
|
"cursor-pointer gap-2 focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
88
|
-
|
|
88
|
+
r && !s && "!border-destructive !text-destructive"
|
|
89
89
|
),
|
|
90
90
|
onClick: () => {
|
|
91
|
-
|
|
91
|
+
a || (s ? n.setValue(
|
|
92
|
+
c,
|
|
92
93
|
m.filter(
|
|
93
94
|
(y) => y !== e.value
|
|
94
95
|
)
|
|
95
|
-
) :
|
|
96
|
+
) : n.setValue(c, [
|
|
96
97
|
...m,
|
|
97
98
|
e.value
|
|
98
99
|
]));
|
|
99
100
|
},
|
|
100
101
|
children: [
|
|
101
|
-
/* @__PURE__ */ t(
|
|
102
|
+
/* @__PURE__ */ t(T, { checked: s, disabled: a }),
|
|
102
103
|
/* @__PURE__ */ t("span", { className: "text-sm", children: e.label })
|
|
103
104
|
]
|
|
104
105
|
},
|
|
105
106
|
e.value
|
|
106
107
|
);
|
|
107
108
|
}) }),
|
|
108
|
-
|
|
109
|
+
v ? /* @__PURE__ */ u(
|
|
109
110
|
"div",
|
|
110
111
|
{
|
|
111
112
|
className: i(
|
|
112
113
|
"mt-1 flex items-center gap-1",
|
|
113
|
-
|
|
114
|
+
r && "text-destructive"
|
|
114
115
|
),
|
|
115
116
|
children: [
|
|
116
117
|
/* @__PURE__ */ t(
|
|
117
|
-
|
|
118
|
+
w,
|
|
118
119
|
{
|
|
119
120
|
size: "xs",
|
|
120
121
|
className: i(
|
|
121
122
|
"shrink-0",
|
|
122
|
-
|
|
123
|
+
r ? "text-destructive" : "text-content-icon"
|
|
123
124
|
)
|
|
124
125
|
}
|
|
125
126
|
),
|
|
@@ -128,9 +129,9 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
|
|
|
128
129
|
{
|
|
129
130
|
className: i(
|
|
130
131
|
"text-[12px] font-medium leading-[18px] text-navigation-muted",
|
|
131
|
-
|
|
132
|
+
r && "text-destructive"
|
|
132
133
|
),
|
|
133
|
-
children:
|
|
134
|
+
children: v
|
|
134
135
|
}
|
|
135
136
|
)
|
|
136
137
|
]
|
|
@@ -142,5 +143,5 @@ const j = "mb-[6px] block text-xs font-medium leading-[18px] text-content-tertia
|
|
|
142
143
|
);
|
|
143
144
|
};
|
|
144
145
|
export {
|
|
145
|
-
|
|
146
|
+
R as ChipsField
|
|
146
147
|
};
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Controller as
|
|
3
|
+
import { Controller as S } from "react-hook-form";
|
|
4
4
|
import { DateRangePicker as v } from "../../components/forms/date-picker/date-range-picker.js";
|
|
5
|
-
import { toLocalDate as
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
5
|
+
import { toLocalDate as c } from "../utils/calendar-boundary.js";
|
|
6
|
+
import { resolveDateRangeMinMax as P } from "../utils/date.utils.js";
|
|
7
|
+
const Y = ({
|
|
8
8
|
field: r,
|
|
9
|
-
validationRules:
|
|
9
|
+
validationRules: d,
|
|
10
10
|
isDisabled: l,
|
|
11
|
-
formHelpers:
|
|
11
|
+
formHelpers: n
|
|
12
12
|
}) => {
|
|
13
13
|
const t = r.fieldType === "date_range" ? r : null;
|
|
14
14
|
if (!t) return null;
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
15
|
+
const h = n.form.control, { minDate: m, maxDate: u, startMonth: p, endMonth: g } = P(t);
|
|
16
|
+
return /* @__PURE__ */ a(
|
|
17
|
+
S,
|
|
18
18
|
{
|
|
19
19
|
name: r.id,
|
|
20
|
-
control:
|
|
20
|
+
control: h,
|
|
21
21
|
disabled: l,
|
|
22
|
-
rules:
|
|
23
|
-
render: ({ field:
|
|
24
|
-
const
|
|
25
|
-
return /* @__PURE__ */
|
|
22
|
+
rules: d,
|
|
23
|
+
render: ({ field: f, fieldState: s }) => {
|
|
24
|
+
const i = !!s.error, o = f.value;
|
|
25
|
+
return /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
26
26
|
v,
|
|
27
27
|
{
|
|
28
28
|
label: r.label,
|
|
29
29
|
minDate: m,
|
|
30
30
|
maxDate: u,
|
|
31
|
-
startMonth:
|
|
32
|
-
endMonth:
|
|
31
|
+
startMonth: p,
|
|
32
|
+
endMonth: g,
|
|
33
33
|
value: {
|
|
34
|
-
from:
|
|
35
|
-
to:
|
|
34
|
+
from: o?.start ? c(o.start) : void 0,
|
|
35
|
+
to: o?.end ? c(o.end) : void 0
|
|
36
36
|
},
|
|
37
|
-
onChange: (
|
|
38
|
-
const M =
|
|
39
|
-
|
|
37
|
+
onChange: (e) => {
|
|
38
|
+
const M = e?.from ? `${e.from.getFullYear()}-${String(e.from.getMonth() + 1).padStart(2, "0")}-${String(e.from.getDate()).padStart(2, "0")}` : null, D = e?.to ? `${e.to.getFullYear()}-${String(e.to.getMonth() + 1).padStart(2, "0")}-${String(e.to.getDate()).padStart(2, "0")}` : null;
|
|
39
|
+
n.setValue(r.id, { start: M, end: D });
|
|
40
40
|
},
|
|
41
41
|
startPlaceholder: t.startPlaceholder || "Start Date",
|
|
42
42
|
endPlaceholder: t.endPlaceholder || "End Date",
|
|
43
43
|
placeholder: r.placeholder,
|
|
44
44
|
required: r.isRequired,
|
|
45
45
|
disabled: l,
|
|
46
|
-
error:
|
|
47
|
-
helperText:
|
|
46
|
+
error: i,
|
|
47
|
+
helperText: i ? s.error?.message : r.helpText,
|
|
48
48
|
showFooter: !0,
|
|
49
49
|
calendarKind: t.calendarKind,
|
|
50
50
|
fiscalMode: t.fiscalMode,
|
|
@@ -59,5 +59,5 @@ const T = ({
|
|
|
59
59
|
);
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
Y as DateRangeField
|
|
63
63
|
};
|