impact-nova 2.3.0 → 2.5.0
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/data-table-column-list.js +16 -16
- package/dist/components/data/data-table/data-table-sheet-layout.d.ts +26 -0
- package/dist/components/data/data-table/data-table-sheet-layout.js +71 -0
- package/dist/components/data/data-table/data-table-sheet.d.ts +2 -0
- package/dist/components/data/data-table/index.d.ts +1 -0
- package/dist/components/data/data-table/index.js +40 -34
- package/dist/components/data/nested-list/hooks/useNestedListHandlers.d.ts +3 -2
- package/dist/components/data/nested-list/hooks/useNestedListHandlers.js +129 -130
- package/dist/components/data/nested-list/hooks/useNestedListState.d.ts +2 -3
- package/dist/components/data/nested-list/hooks/useNestedListState.js +118 -117
- package/dist/components/data/nested-list/nested-list.js +219 -221
- package/dist/components/flows/accordion-nested-list/accordion-nested-list.js +80 -65
- package/dist/components/forms/date-picker/month-picker.js +136 -109
- package/dist/filter-shell/index.d.ts +12 -0
- package/dist/filter-shell/index.js +9 -0
- package/dist/filter-shell/utils/buildFilterFieldValidationRules.d.ts +1 -0
- package/dist/filter-shell/utils/validateVisibleRequiredFilterFields.d.ts +1 -0
- package/dist/filter-shell/utils/validationNavigation.utils.d.ts +26 -0
- package/dist/filter-shell/utils/validationNavigation.utils.js +38 -0
- package/dist/form-engine/field-dependency-graph.d.ts +17 -0
- package/dist/form-engine/field-dependency-graph.js +90 -0
- package/dist/form-engine/index.d.ts +9 -0
- package/dist/form-engine/index.js +16 -0
- package/dist/form-engine/is-empty-value.d.ts +1 -0
- package/dist/form-engine/is-empty-value.js +8 -0
- package/dist/form-engine/types.d.ts +17 -0
- package/dist/form-react/Fields/ButtonsGroupField.d.ts +3 -0
- package/dist/form-react/Fields/ButtonsGroupField.js +52 -0
- package/dist/form-react/Fields/CheckboxField.d.ts +3 -0
- package/dist/form-react/Fields/CheckboxField.js +46 -0
- package/dist/form-react/Fields/ChipsField.d.ts +3 -0
- package/dist/form-react/Fields/ChipsField.js +146 -0
- package/dist/form-react/Fields/DateInputField.d.ts +8 -0
- package/dist/form-react/Fields/DateInputField.js +134 -0
- package/dist/form-react/Fields/DateRangeField.d.ts +8 -0
- package/dist/form-react/Fields/DateRangeField.js +57 -0
- package/dist/form-react/Fields/DividerField.d.ts +3 -0
- package/dist/form-react/Fields/DividerField.js +9 -0
- package/dist/form-react/Fields/DividerWithLabelField.d.ts +3 -0
- package/dist/form-react/Fields/DividerWithLabelField.js +31 -0
- package/dist/form-react/Fields/FileUploadField.d.ts +3 -0
- package/dist/form-react/Fields/FileUploadField.js +42 -0
- package/dist/form-react/Fields/FillFormByFileUploadField.d.ts +3 -0
- package/dist/form-react/Fields/FillFormByFileUploadField.js +65 -0
- package/dist/form-react/Fields/FillFormByPasteField.d.ts +3 -0
- package/dist/form-react/Fields/FillFormByPasteField.js +106 -0
- package/dist/form-react/Fields/LabelField.d.ts +3 -0
- package/dist/form-react/Fields/LabelField.js +14 -0
- package/dist/form-react/Fields/MonthRangeField.d.ts +8 -0
- package/dist/form-react/Fields/MonthRangeField.js +72 -0
- package/dist/form-react/Fields/MultiMonthPickerField.d.ts +8 -0
- package/dist/form-react/Fields/MultiMonthPickerField.js +46 -0
- package/dist/form-react/Fields/MultiWeekPickerField.d.ts +8 -0
- package/dist/form-react/Fields/MultiWeekPickerField.js +47 -0
- package/dist/form-react/Fields/NumericComboboxField.d.ts +18 -0
- package/dist/form-react/Fields/NumericComboboxField.js +51 -0
- package/dist/form-react/Fields/RadioField.d.ts +3 -0
- package/dist/form-react/Fields/RadioField.js +68 -0
- package/dist/form-react/Fields/SelectField.d.ts +3 -0
- package/dist/form-react/Fields/SelectField.js +76 -0
- package/dist/form-react/Fields/SwitchField.d.ts +3 -0
- package/dist/form-react/Fields/SwitchField.js +47 -0
- package/dist/form-react/Fields/TextAreaField.d.ts +3 -0
- package/dist/form-react/Fields/TextAreaField.js +41 -0
- package/dist/form-react/Fields/TextField.d.ts +3 -0
- package/dist/form-react/Fields/TextField.js +75 -0
- package/dist/form-react/Fields/TextFieldWithBackendValidation.d.ts +3 -0
- package/dist/form-react/Fields/TextFieldWithBackendValidation.js +117 -0
- package/dist/form-react/Fields/WeekRangePicker.d.ts +8 -0
- package/dist/form-react/Fields/WeekRangePicker.js +71 -0
- package/dist/form-react/ReactHooksForm.d.ts +3 -0
- package/dist/form-react/ReactHooksForm.js +132 -0
- package/dist/form-react/components/ArrayFieldRenderer.d.ts +13 -0
- package/dist/form-react/components/ArrayFieldRenderer.js +90 -0
- package/dist/form-react/components/FieldRenderer.d.ts +16 -0
- package/dist/form-react/components/FieldRenderer.js +68 -0
- package/dist/form-react/components/FormFieldRow.d.ts +13 -0
- package/dist/form-react/components/FormFieldRow.js +47 -0
- package/dist/form-react/components/FormFileUploadWrapper.d.ts +22 -0
- package/dist/form-react/components/FormFileUploadWrapper.js +88 -0
- package/dist/form-react/components/ObjectFieldRenderer.d.ts +13 -0
- package/dist/form-react/components/ObjectFieldRenderer.js +46 -0
- package/dist/form-react/components/SetToEmptyWrapper.d.ts +16 -0
- package/dist/form-react/components/SetToEmptyWrapper.js +49 -0
- package/dist/form-react/fields.d.ts +23 -0
- package/dist/form-react/fields.js +40 -0
- package/dist/form-react/hooks/useCascadingForm.d.ts +17 -0
- package/dist/form-react/hooks/useCascadingForm.js +122 -0
- package/dist/form-react/hooks/useFieldVisibility.d.ts +14 -0
- package/dist/form-react/hooks/useFieldVisibility.js +60 -0
- package/dist/form-react/hooks/useFillFormByFileUpload.d.ts +33 -0
- package/dist/form-react/hooks/useFillFormByFileUpload.js +199 -0
- package/dist/form-react/hooks/useFillFormByPaste.d.ts +33 -0
- package/dist/form-react/hooks/useFillFormByPaste.js +104 -0
- package/dist/form-react/hooks/useFormFieldChangeSubscription.d.ts +13 -0
- package/dist/form-react/hooks/useFormFieldChangeSubscription.js +42 -0
- package/dist/form-react/hooks/useReactHookForm.d.ts +3 -0
- package/dist/form-react/hooks/useReactHookForm.js +161 -0
- package/dist/form-react/hooks/useSelectOptions.d.ts +8 -0
- package/dist/form-react/hooks/useSelectOptions.js +116 -0
- package/dist/form-react/index.d.ts +62 -0
- package/dist/form-react/index.js +97 -0
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +2 -0
- package/dist/form-react/registry/defaultFieldRegistrations.js +30 -0
- package/dist/form-react/registry/fieldRegistry.d.ts +14 -0
- package/dist/form-react/registry/fieldRegistry.js +19 -0
- package/dist/form-react/registry/resolveFieldComponent.d.ts +10 -0
- package/dist/form-react/registry/resolveFieldComponent.js +137 -0
- package/dist/form-react/types/fields.types.d.ts +402 -0
- package/dist/form-react/types/fieldsOutput.types.d.ts +73 -0
- package/dist/form-react/types/reactHookForm.types.d.ts +196 -0
- package/dist/form-react/utils/batchFormFieldUpdates.d.ts +14 -0
- package/dist/form-react/utils/batchFormFieldUpdates.js +13 -0
- package/dist/form-react/utils/buildFieldValidationRules.d.ts +6 -0
- package/dist/form-react/utils/buildFieldValidationRules.js +13 -0
- package/dist/form-react/utils/buildSelectRemountKey.d.ts +14 -0
- package/dist/form-react/utils/buildSelectRemountKey.js +14 -0
- package/dist/form-react/utils/calendar-boundary.d.ts +3 -0
- package/dist/form-react/utils/calendar-boundary.js +33 -0
- package/dist/form-react/utils/date.utils.d.ts +31 -0
- package/dist/form-react/utils/date.utils.js +86 -0
- package/dist/form-react/utils/evaluateFieldValidation.d.ts +19 -0
- package/dist/form-react/utils/evaluateFieldValidation.js +53 -0
- package/dist/form-react/utils/fieldDefaults.utils.d.ts +6 -0
- package/dist/form-react/utils/fieldDefaults.utils.js +25 -0
- package/dist/form-react/utils/fieldPath.utils.d.ts +23 -0
- package/dist/form-react/utils/fieldPath.utils.js +26 -0
- package/dist/form-react/utils/fieldRangeValidation.utils.d.ts +3 -0
- package/dist/form-react/utils/fieldRangeValidation.utils.js +24 -0
- package/dist/form-react/utils/fieldRendererUtils.d.ts +10 -0
- package/dist/form-react/utils/fieldRendererUtils.js +47 -0
- package/dist/form-react/utils/fieldTestIds.d.ts +3 -0
- package/dist/form-react/utils/fieldTestIds.js +13 -0
- package/dist/form-react/utils/formDate.utils.d.ts +13 -0
- package/dist/form-react/utils/formDate.utils.js +9 -0
- package/dist/form-react/utils/formValidationFeedback.utils.d.ts +32 -0
- package/dist/form-react/utils/formValidationFeedback.utils.js +153 -0
- package/dist/form-react/utils/icons.d.ts +5 -0
- package/dist/form-react/utils/icons.js +10 -0
- package/dist/form-react/utils/optionFlag.d.ts +11 -0
- package/dist/form-react/utils/optionFlag.js +17 -0
- package/dist/form-react/utils/pastedValues.d.ts +1 -0
- package/dist/form-react/utils/resolveFormSubmittable.d.ts +18 -0
- package/dist/form-react/utils/resolveFormSubmittable.js +32 -0
- package/dist/form-react/utils/select-option-filter-values.d.ts +5 -0
- package/dist/form-react/utils/select-option-filter-values.js +30 -0
- package/dist/form-react/utils/serializeFormStateForQueryKey.d.ts +1 -0
- package/dist/form-react/utils/serializeFormStateForQueryKey.js +21 -0
- package/dist/form-react/utils/stableSerialize.d.ts +5 -0
- package/dist/form-react/utils/stableSerialize.js +11 -0
- package/dist/form-react/utils/validateVisibleRequiredFormFields.d.ts +21 -0
- package/dist/form-react/utils/validateVisibleRequiredFormFields.js +64 -0
- package/dist/form-react/utils/validationUtils.d.ts +3 -0
- package/dist/form-react/utils/validationUtils.js +77 -0
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +170 -164
- package/dist/lib/primitives/use-field-chrome.js +16 -16
- package/dist/llms/rules/ag-grid.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 +21 -2
|
@@ -1,103 +1,118 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
2
|
-
import { useState as H, useCallback as
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as H, useCallback as f, useMemo as J } from "react";
|
|
3
3
|
import { AccordionItem as K, AccordionTrigger as Q, AccordionContent as R, Accordion as N } from "../../primitives/accordion/accordion.js";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as y } from "../../primitives/button/button.js";
|
|
5
5
|
import { NestedList as U } from "../../data/nested-list/nested-list.js";
|
|
6
6
|
import { useAccordionNestedListState as X } from "./hooks/useAccordionNestedListState.js";
|
|
7
7
|
import { SelectionMode as Y } from "../../data/nested-list/nested-list.types.js";
|
|
8
8
|
import { cn as Z } from "../../../lib/utils.js";
|
|
9
9
|
import { useImpactNovaI18n as $ } from "../../../i18n/use-impact-nova-i18n.js";
|
|
10
|
-
const
|
|
10
|
+
const ce = ({
|
|
11
11
|
sections: l,
|
|
12
12
|
onChange: m,
|
|
13
13
|
onSubmit: h,
|
|
14
|
-
onCancel:
|
|
14
|
+
onCancel: u,
|
|
15
15
|
enableApplyDiscard: C = !0,
|
|
16
|
-
submitButtonLabel:
|
|
17
|
-
cancelButtonLabel:
|
|
18
|
-
className:
|
|
19
|
-
enableSearch:
|
|
20
|
-
enableDragDrop:
|
|
21
|
-
enableSelectAll:
|
|
22
|
-
selectionMode:
|
|
23
|
-
searchPlaceholder:
|
|
24
|
-
value:
|
|
25
|
-
onValueChange:
|
|
26
|
-
isMultiExpanded:
|
|
27
|
-
defaultCollapseAll:
|
|
28
|
-
validateApply:
|
|
16
|
+
submitButtonLabel: g,
|
|
17
|
+
cancelButtonLabel: L,
|
|
18
|
+
className: S = "",
|
|
19
|
+
enableSearch: k = !0,
|
|
20
|
+
enableDragDrop: w = !0,
|
|
21
|
+
enableSelectAll: B = !0,
|
|
22
|
+
selectionMode: D = Y.CASCADE_DOWN,
|
|
23
|
+
searchPlaceholder: I,
|
|
24
|
+
value: V,
|
|
25
|
+
onValueChange: j,
|
|
26
|
+
isMultiExpanded: r = !0,
|
|
27
|
+
defaultCollapseAll: P = !1,
|
|
28
|
+
validateApply: c
|
|
29
29
|
}) => {
|
|
30
|
-
const { t: i } = $(), M =
|
|
31
|
-
currentSections:
|
|
32
|
-
hasChanges:
|
|
30
|
+
const { t: i } = $(), M = g ?? i("nestedList.apply"), O = L ?? i("nestedList.reset"), T = I ?? i("nestedList.searchPlaceholder"), {
|
|
31
|
+
currentSections: n,
|
|
32
|
+
hasChanges: o,
|
|
33
33
|
setCurrentSection: p,
|
|
34
|
-
saveAllSections:
|
|
35
|
-
discardAllSections:
|
|
36
|
-
} = X({ sections: l }), [W, _] = H(() =>
|
|
37
|
-
(e,
|
|
38
|
-
p(e,
|
|
34
|
+
saveAllSections: x,
|
|
35
|
+
discardAllSections: v
|
|
36
|
+
} = X({ sections: l }), [W, _] = H(() => P ? r ? [] : "" : l.length > 0 ? r ? [l[0].id] : l[0].id : r ? [] : ""), a = V ?? W, b = j ?? _, q = f(
|
|
37
|
+
(e, s) => {
|
|
38
|
+
p(e, s), m?.(e, s);
|
|
39
39
|
},
|
|
40
40
|
[m, p]
|
|
41
|
-
), z =
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
), z = f(() => {
|
|
42
|
+
x(), h?.(n);
|
|
43
|
+
}, [n, h, x]), F = f(() => {
|
|
44
|
+
v(), u?.();
|
|
45
|
+
}, [v, u]), G = J(() => o ? c ? c(n) : !0 : !1, [o, c, n]), A = l.map((e) => /* @__PURE__ */ d(
|
|
46
|
+
K,
|
|
47
|
+
{
|
|
48
|
+
value: e.id,
|
|
49
|
+
className: "flex flex-col border-b-0 data-[state=open]:flex-1 data-[state=open]:min-h-0",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ t(Q, { className: "shrink-0", children: e.label }),
|
|
52
|
+
/* @__PURE__ */ t(
|
|
53
|
+
R,
|
|
54
|
+
{
|
|
55
|
+
className: "flex min-h-0 flex-1 flex-col px-0 pb-2 pt-0",
|
|
56
|
+
surfaceClassName: "overflow-hidden data-[state=open]:flex data-[state=open]:flex-1 data-[state=open]:min-h-0 data-[state=open]:flex-col data-[state=open]:overflow-hidden data-[state=open]:h-full data-[state=open]:animate-none",
|
|
57
|
+
children: /* @__PURE__ */ t(
|
|
58
|
+
U,
|
|
59
|
+
{
|
|
60
|
+
items: n[e.id] || [],
|
|
61
|
+
onChange: (s) => q(e.id, s),
|
|
62
|
+
enableApplyDiscard: !1,
|
|
63
|
+
enableSearch: k,
|
|
64
|
+
enableDragDrop: w,
|
|
65
|
+
enableSelectAll: B,
|
|
66
|
+
selectionMode: e.selectionMode ?? D,
|
|
67
|
+
searchPlaceholder: T,
|
|
68
|
+
className: "flex-1 min-h-0"
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
e.id
|
|
76
|
+
));
|
|
62
77
|
return /* @__PURE__ */ d(
|
|
63
78
|
"div",
|
|
64
79
|
{
|
|
65
|
-
className: Z("flex flex-col
|
|
80
|
+
className: Z("flex min-h-0 flex-col", S),
|
|
66
81
|
"data-component": "accordion-nested-list",
|
|
67
|
-
"data-has-changes":
|
|
82
|
+
"data-has-changes": o ? "" : void 0,
|
|
68
83
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ t("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", children: r ? /* @__PURE__ */ t(
|
|
70
85
|
N,
|
|
71
86
|
{
|
|
72
87
|
type: "multiple",
|
|
73
|
-
value: Array.isArray(
|
|
74
|
-
onValueChange:
|
|
75
|
-
className: "space-y-4",
|
|
76
|
-
children:
|
|
88
|
+
value: Array.isArray(a) ? a : a ? [a] : [],
|
|
89
|
+
onValueChange: b,
|
|
90
|
+
className: "flex min-h-0 flex-1 flex-col overflow-hidden space-y-4",
|
|
91
|
+
children: A
|
|
77
92
|
}
|
|
78
|
-
) : /* @__PURE__ */
|
|
93
|
+
) : /* @__PURE__ */ t(
|
|
79
94
|
N,
|
|
80
95
|
{
|
|
81
96
|
type: "single",
|
|
82
97
|
collapsible: !0,
|
|
83
|
-
value: Array.isArray(
|
|
84
|
-
onValueChange:
|
|
85
|
-
className: "space-y-4",
|
|
86
|
-
children:
|
|
98
|
+
value: Array.isArray(a) ? a[0] ?? "" : a,
|
|
99
|
+
onValueChange: b,
|
|
100
|
+
className: "flex min-h-0 flex-1 flex-col overflow-hidden space-y-4",
|
|
101
|
+
children: A
|
|
87
102
|
}
|
|
88
103
|
) }),
|
|
89
104
|
C && /* @__PURE__ */ d("div", { className: "flex-shrink-0 flex justify-end gap-2 pt-4 border-t mt-4", children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
105
|
+
/* @__PURE__ */ t(
|
|
106
|
+
y,
|
|
92
107
|
{
|
|
93
108
|
variant: "tertiary",
|
|
94
109
|
onClick: F,
|
|
95
|
-
disabled: !
|
|
110
|
+
disabled: !o,
|
|
96
111
|
children: O
|
|
97
112
|
}
|
|
98
113
|
),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
|
|
114
|
+
/* @__PURE__ */ t(
|
|
115
|
+
y,
|
|
101
116
|
{
|
|
102
117
|
variant: "default",
|
|
103
118
|
onClick: z,
|
|
@@ -111,5 +126,5 @@ const se = ({
|
|
|
111
126
|
);
|
|
112
127
|
};
|
|
113
128
|
export {
|
|
114
|
-
|
|
129
|
+
ce as AccordionNestedList
|
|
115
130
|
};
|
|
@@ -1,189 +1,216 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as P, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { usePickerDismissActionsRef as
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
import { useImpactNovaI18n as
|
|
11
|
-
import { coerceSingleMonthApply as
|
|
12
|
-
import { buildDateBoundsMatcher as
|
|
13
|
-
const
|
|
3
|
+
import { Cross as ne, CalendarMonth as re } from "impact-nova-icons";
|
|
4
|
+
import { cn as oe } from "../../../lib/utils.js";
|
|
5
|
+
import { usePickerDismissActionsRef as se, usePickerFooterDismissNudge as ie, isDateInputInvalid as ae, resolveSingleValueDismissFlash as ce, compareMonthSelection as le, handlePickerSurfacePointerDown as pe, maskDateInput as fe, parseDateInput as ue, resolveDateInputOnEnter as de, resolveDateInputOnBlur as me } from "./date-input-behavior.js";
|
|
6
|
+
import { Input as he } from "../input/input.js";
|
|
7
|
+
import { Popover as ye, PopoverAnchor as ge, PopoverContent as Me } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as De } from "../../data-display/calendar/calendar.js";
|
|
9
|
+
import { Tooltip as T, TooltipTrigger as O, TooltipContent as V } from "../../feedback/tooltip/tooltip.js";
|
|
10
|
+
import { useImpactNovaI18n as ke } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { coerceSingleMonthApply as Pe, coerceSingleMonth as Ie } from "./calendar-selection-adapters.js";
|
|
12
|
+
import { buildDateBoundsMatcher as Ce } from "../../../lib/date-bounds-matcher.js";
|
|
13
|
+
const h = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, Se = o.forwardRef(
|
|
14
14
|
({
|
|
15
15
|
value: t,
|
|
16
16
|
onChange: p,
|
|
17
|
-
placeholder:
|
|
18
|
-
minDate:
|
|
19
|
-
maxDate:
|
|
20
|
-
startMonth:
|
|
21
|
-
endMonth:
|
|
22
|
-
showFooter:
|
|
23
|
-
disabled:
|
|
17
|
+
placeholder: B,
|
|
18
|
+
minDate: F,
|
|
19
|
+
maxDate: j,
|
|
20
|
+
startMonth: v,
|
|
21
|
+
endMonth: K,
|
|
22
|
+
showFooter: c = !0,
|
|
23
|
+
disabled: i,
|
|
24
24
|
className: Y,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
onBlur: z,
|
|
26
|
+
...H
|
|
27
|
+
}, $) => {
|
|
28
|
+
const { t: u } = ke(), L = B ?? u("datePicker.selectMonth"), I = o.useRef(null), x = o.useRef(null);
|
|
29
|
+
o.useImperativeHandle($, () => I.current);
|
|
30
|
+
const [r, R] = o.useState(!1), f = o.useCallback(() => {
|
|
31
|
+
R(!1);
|
|
32
|
+
}, []), d = (e) => {
|
|
33
|
+
if (!i) {
|
|
34
|
+
if (e) {
|
|
35
|
+
R(!0);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
f();
|
|
39
|
+
}
|
|
40
|
+
}, b = se(), { footerFlashKey: q, footerFlashTarget: G, popoverHandlers: J } = ie(c, r, b, x), [M, a] = o.useState(t), [m, l] = o.useState(t ? h(t) : ""), [Q, C] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
|
|
30
41
|
o.useEffect(() => {
|
|
31
|
-
r || (l(t ?
|
|
42
|
+
r || (l(t ? h(t) : ""), a(t));
|
|
32
43
|
}, [r, t]), o.useEffect(() => {
|
|
33
|
-
r && (
|
|
44
|
+
r && (a(t), C(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), l(t ? h(t) : ""));
|
|
34
45
|
}, [r, t]);
|
|
35
|
-
const
|
|
36
|
-
const n =
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
const n =
|
|
40
|
-
p?.(n),
|
|
46
|
+
const U = (e) => {
|
|
47
|
+
const n = Ie(e);
|
|
48
|
+
a(n), n && l(h(n)), c || (p?.(n), f());
|
|
49
|
+
}, w = (e) => {
|
|
50
|
+
const n = Pe(e, M);
|
|
51
|
+
p?.(n), f();
|
|
41
52
|
}, S = () => {
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
const n =
|
|
53
|
+
a(t), l(t ? h(t) : ""), f();
|
|
54
|
+
}, N = () => {
|
|
55
|
+
a(void 0), l(""), p?.(void 0), c || f();
|
|
56
|
+
}, y = "MM/yyyy", D = t ? h(t) : "", g = o.useRef(!1), W = (e) => {
|
|
57
|
+
const n = fe(e.target.value, y, m);
|
|
47
58
|
if (l(n), n === "") {
|
|
48
|
-
|
|
59
|
+
a(void 0), c || p?.(void 0);
|
|
49
60
|
return;
|
|
50
61
|
}
|
|
51
|
-
const { parsed:
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
62
|
+
const { parsed: k, isValid: te } = ue(n, y);
|
|
63
|
+
if (te && k) {
|
|
64
|
+
const E = { month: k.getMonth(), year: k.getFullYear() };
|
|
65
|
+
a(E), C(k), c || p?.(E);
|
|
55
66
|
}
|
|
56
|
-
},
|
|
67
|
+
}, X = () => {
|
|
57
68
|
if (r) return;
|
|
58
|
-
const e =
|
|
69
|
+
const e = me(m, y, D);
|
|
59
70
|
if (e.resetToCommitted) {
|
|
60
|
-
l(
|
|
71
|
+
l(D), a(t);
|
|
61
72
|
return;
|
|
62
73
|
}
|
|
63
74
|
if (e.parsed) {
|
|
64
75
|
const n = { month: e.parsed.getMonth(), year: e.parsed.getFullYear() };
|
|
65
|
-
l(e.display),
|
|
76
|
+
l(e.display), a(n), c || p?.(n);
|
|
66
77
|
return;
|
|
67
78
|
}
|
|
68
|
-
l(
|
|
69
|
-
},
|
|
70
|
-
if (r &&
|
|
71
|
-
|
|
79
|
+
l(D), a(t);
|
|
80
|
+
}, Z = () => {
|
|
81
|
+
if (r && c) {
|
|
82
|
+
w();
|
|
72
83
|
return;
|
|
73
84
|
}
|
|
74
|
-
const e =
|
|
85
|
+
const e = de(m, y);
|
|
75
86
|
if (e.parsed) {
|
|
76
87
|
const n = {
|
|
77
88
|
month: e.parsed.getMonth(),
|
|
78
89
|
year: e.parsed.getFullYear()
|
|
79
90
|
};
|
|
80
|
-
|
|
91
|
+
c && (p?.(n), f());
|
|
81
92
|
return;
|
|
82
93
|
}
|
|
83
|
-
r || (
|
|
84
|
-
},
|
|
85
|
-
() =>
|
|
86
|
-
|
|
94
|
+
r || (g.current = !0, d(!0));
|
|
95
|
+
}, A = D !== m, _ = ae(m, y), ee = o.useCallback(
|
|
96
|
+
() => ce(
|
|
97
|
+
M,
|
|
87
98
|
t,
|
|
88
|
-
(e, n) =>
|
|
99
|
+
(e, n) => le(e, n) === 0
|
|
89
100
|
),
|
|
90
|
-
[
|
|
101
|
+
[M, t]
|
|
91
102
|
);
|
|
92
103
|
return o.useLayoutEffect(() => {
|
|
93
|
-
|
|
104
|
+
b.current = {
|
|
94
105
|
onDismiss: S,
|
|
95
|
-
resolveFlash:
|
|
106
|
+
resolveFlash: ee
|
|
96
107
|
};
|
|
97
|
-
}), /* @__PURE__ */
|
|
98
|
-
|
|
99
|
-
}, children: [
|
|
100
|
-
/* @__PURE__ */ s(me, { asChild: !0, children: /* @__PURE__ */ s(
|
|
108
|
+
}), /* @__PURE__ */ P(ye, { open: i ? !1 : r, onOpenChange: d, children: [
|
|
109
|
+
/* @__PURE__ */ s(ge, { asChild: !0, children: /* @__PURE__ */ s(
|
|
101
110
|
"div",
|
|
102
111
|
{
|
|
103
|
-
ref:
|
|
112
|
+
ref: x,
|
|
104
113
|
"data-component": "month-picker",
|
|
105
114
|
"data-state": r ? "open" : "closed",
|
|
106
|
-
"data-pending":
|
|
107
|
-
onPointerDown: (e) =>
|
|
108
|
-
disabled:
|
|
115
|
+
"data-pending": A || void 0,
|
|
116
|
+
onPointerDown: (e) => pe({
|
|
117
|
+
disabled: i,
|
|
109
118
|
event: e,
|
|
110
|
-
onOpen: () =>
|
|
119
|
+
onOpen: () => d(!0),
|
|
111
120
|
focusField: () => I.current?.focus()
|
|
112
121
|
}),
|
|
113
122
|
children: /* @__PURE__ */ s(
|
|
114
|
-
|
|
123
|
+
he,
|
|
115
124
|
{
|
|
116
125
|
ref: I,
|
|
117
|
-
value:
|
|
118
|
-
onChange:
|
|
119
|
-
onBlur:
|
|
120
|
-
|
|
126
|
+
value: m,
|
|
127
|
+
onChange: W,
|
|
128
|
+
onBlur: (e) => {
|
|
129
|
+
X(), z?.(e);
|
|
130
|
+
},
|
|
131
|
+
onClick: () => !i && d(!0),
|
|
121
132
|
onKeyDown: (e) => {
|
|
122
|
-
e.key === "Enter" && !
|
|
133
|
+
e.key === "Enter" && !i && (e.preventDefault(), Z()), e.key === "ArrowDown" && !r && !i && (e.preventDefault(), g.current = !0, d(!0)), e.key === "Escape" && r && (e.preventDefault(), S());
|
|
123
134
|
},
|
|
124
|
-
placeholder: r ?
|
|
125
|
-
disabled:
|
|
135
|
+
placeholder: r ? u("datePicker.monthYearFormat") : L,
|
|
136
|
+
disabled: i,
|
|
126
137
|
"data-form-control": "input",
|
|
127
|
-
className:
|
|
138
|
+
className: oe(
|
|
128
139
|
"cursor-pointer",
|
|
129
|
-
|
|
140
|
+
_ ? "text-destructive" : A ? "text-content-placeholder" : "",
|
|
130
141
|
Y
|
|
131
142
|
),
|
|
132
|
-
suffix: /* @__PURE__ */
|
|
133
|
-
t && !
|
|
134
|
-
/* @__PURE__ */ s(
|
|
143
|
+
suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
|
|
144
|
+
t && !i && /* @__PURE__ */ P(T, { children: [
|
|
145
|
+
/* @__PURE__ */ s(O, { asChild: !0, children: /* @__PURE__ */ s(
|
|
135
146
|
"button",
|
|
136
147
|
{
|
|
137
148
|
type: "button",
|
|
138
149
|
tabIndex: 0,
|
|
139
|
-
"aria-label":
|
|
150
|
+
"aria-label": u("calendar.clear"),
|
|
140
151
|
onClick: (e) => {
|
|
141
|
-
e.stopPropagation(),
|
|
152
|
+
e.stopPropagation(), N();
|
|
142
153
|
},
|
|
143
154
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
144
|
-
children: /* @__PURE__ */ s(
|
|
155
|
+
children: /* @__PURE__ */ s(ne, { className: "size-3 hover:text-content" })
|
|
145
156
|
}
|
|
146
157
|
) }),
|
|
147
|
-
/* @__PURE__ */ s(V, { variant: "tertiary", side: "top", children:
|
|
158
|
+
/* @__PURE__ */ s(V, { variant: "tertiary", side: "top", children: u("calendar.clear") })
|
|
148
159
|
] }),
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
-
/* @__PURE__ */ s(
|
|
151
|
-
|
|
160
|
+
/* @__PURE__ */ P(T, { children: [
|
|
161
|
+
/* @__PURE__ */ s(O, { asChild: !0, children: /* @__PURE__ */ s(
|
|
162
|
+
"button",
|
|
163
|
+
{
|
|
164
|
+
type: "button",
|
|
165
|
+
tabIndex: 0,
|
|
166
|
+
"data-component": "calendar-trigger",
|
|
167
|
+
"aria-label": u("datePicker.selectMonth"),
|
|
168
|
+
onClick: (e) => {
|
|
169
|
+
e.stopPropagation(), i || (r ? f() : d(!0));
|
|
170
|
+
},
|
|
171
|
+
onKeyDown: (e) => {
|
|
172
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), i || (g.current = !0, r ? f() : d(!0)));
|
|
173
|
+
},
|
|
174
|
+
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
175
|
+
children: /* @__PURE__ */ s(re, { className: "h-4 w-4 text-secondary-foreground" })
|
|
176
|
+
}
|
|
177
|
+
) }),
|
|
178
|
+
/* @__PURE__ */ s(V, { variant: "tertiary", side: "top", children: u("datePicker.selectMonth") })
|
|
152
179
|
] })
|
|
153
180
|
] }),
|
|
154
|
-
...
|
|
181
|
+
...H
|
|
155
182
|
}
|
|
156
183
|
)
|
|
157
184
|
}
|
|
158
185
|
) }),
|
|
159
186
|
/* @__PURE__ */ s(
|
|
160
|
-
|
|
187
|
+
Me,
|
|
161
188
|
{
|
|
162
189
|
className: "w-auto p-0",
|
|
163
190
|
align: "start",
|
|
164
|
-
"aria-label":
|
|
191
|
+
"aria-label": u("datePicker.selectMonth"),
|
|
165
192
|
onOpenAutoFocus: (e) => {
|
|
166
|
-
|
|
193
|
+
g.current || e.preventDefault(), g.current = !1;
|
|
167
194
|
},
|
|
168
|
-
...
|
|
195
|
+
...J,
|
|
169
196
|
children: /* @__PURE__ */ s(
|
|
170
|
-
|
|
197
|
+
De,
|
|
171
198
|
{
|
|
172
199
|
pickerType: "month",
|
|
173
200
|
monthMode: "single",
|
|
174
|
-
selectedMonths:
|
|
175
|
-
footerFlashKey:
|
|
176
|
-
footerFlashTarget:
|
|
177
|
-
onMonthSelect:
|
|
178
|
-
month:
|
|
179
|
-
onMonthChange:
|
|
180
|
-
disabled:
|
|
181
|
-
startMonth:
|
|
182
|
-
endMonth:
|
|
183
|
-
showFooter:
|
|
184
|
-
onApply:
|
|
201
|
+
selectedMonths: M,
|
|
202
|
+
footerFlashKey: q,
|
|
203
|
+
footerFlashTarget: G,
|
|
204
|
+
onMonthSelect: U,
|
|
205
|
+
month: Q,
|
|
206
|
+
onMonthChange: C,
|
|
207
|
+
disabled: Ce(F, j),
|
|
208
|
+
startMonth: v,
|
|
209
|
+
endMonth: K,
|
|
210
|
+
showFooter: c,
|
|
211
|
+
onApply: w,
|
|
185
212
|
onCancel: S,
|
|
186
|
-
onClear:
|
|
213
|
+
onClear: N
|
|
187
214
|
}
|
|
188
215
|
)
|
|
189
216
|
}
|
|
@@ -191,7 +218,7 @@ const m = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, Ie =
|
|
|
191
218
|
] });
|
|
192
219
|
}
|
|
193
220
|
);
|
|
194
|
-
|
|
221
|
+
Se.displayName = "MonthPicker";
|
|
195
222
|
export {
|
|
196
|
-
|
|
223
|
+
Se as MonthPicker
|
|
197
224
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional headless validation helpers for filter-panel UIs.
|
|
3
|
+
* Does not include filter orchestration, saved filters, or network I/O.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
export { buildFilterFieldValidationRules, isFilterFieldValueValid, } from './utils/buildFilterFieldValidationRules';
|
|
8
|
+
export type { FilterFieldValidationShape } from './utils/buildFilterFieldValidationRules';
|
|
9
|
+
export { validateVisibleRequiredFilterFields, } from './utils/validateVisibleRequiredFilterFields';
|
|
10
|
+
export type { FilterFormValues, ValidateVisibleRequiredFilterFieldsResult, } from './utils/validateVisibleRequiredFilterFields';
|
|
11
|
+
export { navigateToFirstFilterValidationError } from './utils/validationNavigation.utils';
|
|
12
|
+
export type { FilterValidationNavigationConfig, FilterValidationNavigationOptions, } from './utils/validationNavigation.utils';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { navigateToFirstFilterValidationError as l } from "./utils/validationNavigation.utils.js";
|
|
2
|
+
import { buildFieldValidationRules as d, isFieldValueValid as r } from "../form-react/utils/buildFieldValidationRules.js";
|
|
3
|
+
import { validateVisibleRequiredFormFields as o } from "../form-react/utils/validateVisibleRequiredFormFields.js";
|
|
4
|
+
export {
|
|
5
|
+
d as buildFilterFieldValidationRules,
|
|
6
|
+
r as isFilterFieldValueValid,
|
|
7
|
+
l as navigateToFirstFilterValidationError,
|
|
8
|
+
o as validateVisibleRequiredFilterFields
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildFieldValidationRules as buildFilterFieldValidationRules, isFieldValueValid as isFilterFieldValueValid, type FieldValidationShape as FilterFieldValidationShape, } from '../../form-react/utils/buildFieldValidationRules';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { validateVisibleRequiredFormFields as validateVisibleRequiredFilterFields, type ValidateVisibleRequiredFormFieldsResult as ValidateVisibleRequiredFilterFieldsResult, type FormValidationValues as FilterFormValues, } from '../../form-react/utils/validateVisibleRequiredFormFields';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FilterValidationNavigationConfig {
|
|
2
|
+
dimensions: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
sections: Array<{
|
|
6
|
+
id: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
fields: Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface FilterValidationNavigationOptions {
|
|
16
|
+
filterConfig: FilterValidationNavigationConfig;
|
|
17
|
+
errorFieldIds: string[];
|
|
18
|
+
getFieldTestId: (fieldId: string) => string;
|
|
19
|
+
onNavigateToDimension?: (dimensionId: string) => void;
|
|
20
|
+
buildValidationToastMessage?: (params: {
|
|
21
|
+
errorFieldLabels: string[];
|
|
22
|
+
dimensionLabel?: string;
|
|
23
|
+
}) => string;
|
|
24
|
+
showToast?: (message: string) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function navigateToFirstFilterValidationError({ filterConfig, errorFieldIds, getFieldTestId, onNavigateToDimension, buildValidationToastMessage, showToast, }: FilterValidationNavigationOptions): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function b({
|
|
2
|
+
filterConfig: f,
|
|
3
|
+
errorFieldIds: i,
|
|
4
|
+
getFieldTestId: s,
|
|
5
|
+
onNavigateToDimension: d,
|
|
6
|
+
buildValidationToastMessage: t,
|
|
7
|
+
showToast: o
|
|
8
|
+
}) {
|
|
9
|
+
if (i.length === 0)
|
|
10
|
+
return;
|
|
11
|
+
const r = i[0];
|
|
12
|
+
for (const n of f.dimensions)
|
|
13
|
+
for (const l of n.sections)
|
|
14
|
+
if (l.fields.find(
|
|
15
|
+
(e) => e.id === r
|
|
16
|
+
)) {
|
|
17
|
+
if (d?.(n.id), t && o) {
|
|
18
|
+
const e = i.map((c) => l.fields.find(
|
|
19
|
+
(a) => a.id === c
|
|
20
|
+
)?.label || c).filter(Boolean);
|
|
21
|
+
o(
|
|
22
|
+
t({
|
|
23
|
+
errorFieldLabels: e,
|
|
24
|
+
dimensionLabel: n.label
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
requestAnimationFrame(() => {
|
|
29
|
+
document.querySelector(
|
|
30
|
+
`[data-testid="${s(r)}"]`
|
|
31
|
+
)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
b as navigateToFirstFilterValidationError
|
|
38
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FieldDependency, FieldVisibilityBase, FormValuesSnapshot } from './types';
|
|
2
|
+
export declare function collectFieldDependencyIds(field: FieldVisibilityBase): string[];
|
|
3
|
+
export declare function computeIsFieldVisible(field: FieldVisibilityBase, formValues: FormValuesSnapshot): boolean;
|
|
4
|
+
export declare function computeIsFieldDisabled(field: FieldVisibilityBase, formValues: FormValuesSnapshot, options?: {
|
|
5
|
+
isCascadingDisabled?: (field: FieldVisibilityBase) => boolean;
|
|
6
|
+
}): boolean;
|
|
7
|
+
export declare function computeIsCascadingDisabled(field: FieldVisibilityBase, formValues: FormValuesSnapshot, isCascadingEnabled: boolean): boolean;
|
|
8
|
+
export declare function getDependentFieldIds(allFields: FieldVisibilityBase[], changedFieldName: string): string[];
|
|
9
|
+
export declare function buildCascadeParentFormState(cascadingDependency: FieldDependency[] | undefined, formValues: FormValuesSnapshot): Record<string, unknown> | null;
|
|
10
|
+
export declare function collectFormWatchFieldIds(fields: FieldVisibilityBase[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use {@link collectFormWatchFieldIds}. Kept for backwards compatibility.
|
|
13
|
+
*/
|
|
14
|
+
export declare function collectFilterSidebarWatchFieldIds(fields: FieldVisibilityBase[]): string[];
|
|
15
|
+
export declare function collectSectionWatchFieldIds(fields: FieldVisibilityBase[]): string[];
|
|
16
|
+
export declare function hasVisibleFieldErrors(fields: FieldVisibilityBase[], formErrors: Record<string, unknown>, formValues: FormValuesSnapshot): boolean;
|
|
17
|
+
export declare function collectVisibleFieldIds(fields: FieldVisibilityBase[], formValues: FormValuesSnapshot): string[];
|