impact-nova 2.2.9 → 2.4.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/ag-grid-react/headers/utils/filter-utils.js +9 -9
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +69 -56
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +5 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +6 -0
- package/dist/components/data-display/calendar/calendar.types.d.ts +1 -1
- package/dist/components/forms/combobox/combobox.js +185 -160
- package/dist/components/forms/combobox/combobox.types.d.ts +2 -0
- 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/lib/primitives/use-field-chrome.js +16 -16
- 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,161 +1,170 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useId as
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { jsx as i, jsxs as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useId as Z, useMemo as z, useState as k, useCallback as c, useRef as T, useEffect as ke } from "react";
|
|
3
|
+
import * as E from "@radix-ui/react-popover";
|
|
4
|
+
import { Cross as Le } from "impact-nova-icons";
|
|
5
|
+
import { Tooltip as Ae, TooltipTrigger as Ne, TooltipContent as Se } from "../../feedback/tooltip/tooltip.js";
|
|
6
|
+
import { useImpactNovaI18n as Pe } from "../../../i18n/use-impact-nova-i18n.js";
|
|
7
|
+
import { createComponent as Te } from "../../../lib/primitives/create-component.js";
|
|
8
|
+
import { cn as O } from "../../../lib/utils.js";
|
|
9
|
+
import { useFieldChrome as Ee } from "../../../lib/primitives/use-field-chrome.js";
|
|
10
|
+
import { useOverlayNestedLayerDismiss as Oe, useOverlayPortalContainer as He } from "../../../lib/overlay/overlay-portal-context.js";
|
|
11
|
+
import { OVERLAY_NESTED_FLOATING_INSTANT_HIDE_CLASS as Re } from "../../../lib/overlay/overlay-host.constants.js";
|
|
12
|
+
import { comboboxSizeVariants as Ve } from "./combobox.variants.js";
|
|
13
|
+
function Me(l) {
|
|
11
14
|
if (l.options) return l.options;
|
|
12
|
-
const { min: u, max:
|
|
13
|
-
if (u == null ||
|
|
14
|
-
const
|
|
15
|
-
for (let
|
|
16
|
-
const
|
|
17
|
-
|
|
15
|
+
const { min: u, max: f, step: p } = l;
|
|
16
|
+
if (u == null || f == null || p == null || p <= 0 || u > f) return [];
|
|
17
|
+
const L = [];
|
|
18
|
+
for (let x = u; x <= f; x += p) {
|
|
19
|
+
const v = Math.round(x * 1e10) / 1e10;
|
|
20
|
+
L.push(String(v));
|
|
18
21
|
}
|
|
19
|
-
return
|
|
22
|
+
return L;
|
|
20
23
|
}
|
|
21
|
-
function
|
|
24
|
+
function je(l, u) {
|
|
22
25
|
if (!u) return l;
|
|
23
|
-
const
|
|
24
|
-
return l.filter((
|
|
26
|
+
const f = u.toLowerCase();
|
|
27
|
+
return l.filter((p) => p.toLowerCase().includes(f));
|
|
25
28
|
}
|
|
26
|
-
const
|
|
29
|
+
const Je = Te(
|
|
27
30
|
"Combobox",
|
|
28
31
|
({
|
|
29
32
|
options: l,
|
|
30
33
|
min: u,
|
|
31
|
-
max:
|
|
32
|
-
step:
|
|
33
|
-
defaultValue:
|
|
34
|
-
value:
|
|
35
|
-
onChange:
|
|
36
|
-
onBlur:
|
|
37
|
-
placeholder:
|
|
38
|
-
label:
|
|
39
|
-
helperText:
|
|
40
|
-
helperTextPosition:
|
|
41
|
-
error:
|
|
42
|
-
isError:
|
|
43
|
-
disabled:
|
|
34
|
+
max: f,
|
|
35
|
+
step: p,
|
|
36
|
+
defaultValue: L = "",
|
|
37
|
+
value: x,
|
|
38
|
+
onChange: v,
|
|
39
|
+
onBlur: B,
|
|
40
|
+
placeholder: K,
|
|
41
|
+
label: A,
|
|
42
|
+
helperText: ee,
|
|
43
|
+
helperTextPosition: te = "absolute",
|
|
44
|
+
error: oe,
|
|
45
|
+
isError: ne,
|
|
46
|
+
disabled: d,
|
|
44
47
|
isNumeric: H,
|
|
45
|
-
size:
|
|
46
|
-
className:
|
|
47
|
-
emptyMessage:
|
|
48
|
-
allowFreeText:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
size: re = "default",
|
|
49
|
+
className: se,
|
|
50
|
+
emptyMessage: ie = "No options found",
|
|
51
|
+
allowFreeText: N = !1,
|
|
52
|
+
clearable: ae = !1,
|
|
53
|
+
required: U,
|
|
54
|
+
labelOrientation: ce
|
|
55
|
+
}, w) => {
|
|
56
|
+
const le = Z(), S = Z(), { t: W } = Pe(), R = typeof A == "string" ? A : K ?? "Options", V = Ee({
|
|
57
|
+
label: A,
|
|
58
|
+
helperText: ee,
|
|
59
|
+
helperTextPosition: te,
|
|
60
|
+
labelOrientation: ce,
|
|
61
|
+
error: oe ?? ne,
|
|
62
|
+
required: U,
|
|
63
|
+
disabled: d,
|
|
64
|
+
id: le,
|
|
65
|
+
className: se
|
|
66
|
+
}), q = z(
|
|
67
|
+
() => Me({ options: l, min: u, max: f, step: p }),
|
|
68
|
+
[l, u, f, p]
|
|
69
|
+
), y = x !== void 0, [ue, G] = k(L), C = y ? x : ue, [de, M] = k(""), [o, h] = k(!1), fe = c((e) => {
|
|
70
|
+
h(e);
|
|
67
71
|
}, []);
|
|
68
|
-
|
|
69
|
-
const
|
|
72
|
+
Oe(o && !d, fe);
|
|
73
|
+
const pe = He(), n = o ? de : C, [j, m] = k(-1), Y = T(-1), [me, I] = k("keyboard"), _ = T(null), P = T(null), he = c(
|
|
70
74
|
(e) => {
|
|
71
|
-
|
|
75
|
+
_.current = e, typeof w == "function" ? w(e) : w && (w.current = e);
|
|
72
76
|
},
|
|
73
|
-
[
|
|
74
|
-
), r =
|
|
75
|
-
() =>
|
|
76
|
-
[
|
|
77
|
-
),
|
|
77
|
+
[w]
|
|
78
|
+
), r = z(
|
|
79
|
+
() => je(q, n),
|
|
80
|
+
[q, n]
|
|
81
|
+
), J = T(r), ge = z(() => {
|
|
78
82
|
if (!o || !n) return -1;
|
|
79
83
|
const e = r.findIndex(
|
|
80
84
|
(t) => t.toLowerCase() === n.toLowerCase()
|
|
81
85
|
);
|
|
82
86
|
return e >= 0 ? e : -1;
|
|
83
|
-
}, [o, n, r]),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
const
|
|
87
|
+
}, [o, n, r]), g = j >= 0 ? j : ge, Q = j >= 0 ? me : "mouse", be = o && g >= 0 ? `${S}-option-${g}` : void 0;
|
|
88
|
+
ke(() => {
|
|
89
|
+
Y.current = g, J.current = r, o && g >= 0 && P.current && P.current.querySelectorAll("[data-combobox-item]")[g]?.scrollIntoView({ block: "nearest" });
|
|
90
|
+
}, [g, o, r]);
|
|
91
|
+
const a = c(
|
|
88
92
|
(e) => {
|
|
89
|
-
|
|
93
|
+
y || G(e), v?.(e), h(!1), m(-1);
|
|
90
94
|
},
|
|
91
|
-
[
|
|
92
|
-
),
|
|
93
|
-
|
|
94
|
-
}, []),
|
|
95
|
+
[y, v]
|
|
96
|
+
), D = c(() => {
|
|
97
|
+
h(!1), m(-1);
|
|
98
|
+
}, []), xe = c(
|
|
99
|
+
(e) => {
|
|
100
|
+
e.preventDefault(), e.stopPropagation(), y || G(""), v?.(""), M(""), h(!1), m(-1), setTimeout(() => _.current?.focus(), 0);
|
|
101
|
+
},
|
|
102
|
+
[y, v]
|
|
103
|
+
), ve = ae && !d && C.length > 0, we = c(
|
|
95
104
|
(e) => {
|
|
96
105
|
const t = e.target.value;
|
|
97
|
-
|
|
106
|
+
M(t), m(-1), I("mouse"), o || h(!0);
|
|
98
107
|
},
|
|
99
108
|
[o]
|
|
100
|
-
),
|
|
101
|
-
|
|
102
|
-
}, [
|
|
109
|
+
), ye = c(() => {
|
|
110
|
+
d || (M(C), h(!0));
|
|
111
|
+
}, [d, C]), Ce = c(
|
|
103
112
|
(e) => {
|
|
104
113
|
const t = e.relatedTarget;
|
|
105
|
-
if (!
|
|
114
|
+
if (!P.current?.contains(t)) {
|
|
106
115
|
if (o) {
|
|
107
116
|
const s = r.find(
|
|
108
|
-
(
|
|
117
|
+
(b) => b.toLowerCase() === n.toLowerCase()
|
|
109
118
|
);
|
|
110
|
-
s ?
|
|
119
|
+
s ? a(s) : r.length === 1 ? a(r[0]) : N && n ? a(n) : D();
|
|
111
120
|
}
|
|
112
|
-
|
|
121
|
+
B?.(e);
|
|
113
122
|
}
|
|
114
123
|
},
|
|
115
|
-
[o, r, n,
|
|
116
|
-
),
|
|
124
|
+
[o, r, n, a, D, N, B]
|
|
125
|
+
), Ie = c(
|
|
117
126
|
(e) => {
|
|
118
127
|
if (!o) {
|
|
119
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(),
|
|
128
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), h(!0));
|
|
120
129
|
return;
|
|
121
130
|
}
|
|
122
131
|
if (e.key === "Escape") {
|
|
123
|
-
e.preventDefault(), e.stopPropagation(),
|
|
132
|
+
e.preventDefault(), e.stopPropagation(), D();
|
|
124
133
|
return;
|
|
125
134
|
}
|
|
126
135
|
if (e.key === "ArrowDown") {
|
|
127
|
-
e.preventDefault(),
|
|
136
|
+
e.preventDefault(), I("keyboard"), m(
|
|
128
137
|
(t) => t < r.length - 1 ? t + 1 : 0
|
|
129
138
|
);
|
|
130
139
|
return;
|
|
131
140
|
}
|
|
132
141
|
if (e.key === "ArrowUp") {
|
|
133
|
-
e.preventDefault(),
|
|
142
|
+
e.preventDefault(), I("keyboard"), m(
|
|
134
143
|
(t) => t > 0 ? t - 1 : r.length - 1
|
|
135
144
|
);
|
|
136
145
|
return;
|
|
137
146
|
}
|
|
138
147
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
139
148
|
e.preventDefault();
|
|
140
|
-
const t =
|
|
149
|
+
const t = Y.current, s = J.current;
|
|
141
150
|
if (t >= 0 && t < s.length)
|
|
142
|
-
|
|
151
|
+
a(s[t]);
|
|
143
152
|
else {
|
|
144
|
-
const
|
|
145
|
-
(
|
|
153
|
+
const b = s.find(
|
|
154
|
+
(F) => F.toLowerCase() === n.toLowerCase()
|
|
146
155
|
);
|
|
147
|
-
|
|
156
|
+
b ? a(b) : s.length === 1 ? a(s[0]) : N && n ? a(n) : D();
|
|
148
157
|
}
|
|
149
158
|
return;
|
|
150
159
|
}
|
|
151
160
|
},
|
|
152
|
-
[o, r, n,
|
|
153
|
-
),
|
|
161
|
+
[o, r, n, a, D, N]
|
|
162
|
+
), X = c(
|
|
154
163
|
(e) => {
|
|
155
|
-
|
|
164
|
+
a(e), setTimeout(() => _.current?.focus(), 0);
|
|
156
165
|
},
|
|
157
|
-
[
|
|
158
|
-
),
|
|
166
|
+
[a]
|
|
167
|
+
), De = c(
|
|
159
168
|
(e) => {
|
|
160
169
|
const t = e.target.closest(
|
|
161
170
|
"[data-combobox-item]"
|
|
@@ -164,66 +173,82 @@ const je = Ce(
|
|
|
164
173
|
if (e.button !== 0) return;
|
|
165
174
|
e.preventDefault();
|
|
166
175
|
const s = t.getAttribute("data-combobox-value");
|
|
167
|
-
s != null &&
|
|
176
|
+
s != null && X(s);
|
|
168
177
|
return;
|
|
169
178
|
}
|
|
170
179
|
e.preventDefault();
|
|
171
180
|
},
|
|
172
|
-
[
|
|
181
|
+
[X]
|
|
173
182
|
);
|
|
174
|
-
return /* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
183
|
+
return /* @__PURE__ */ i("div", { "data-component": "combobox", "data-numeric": H || void 0, children: V.wrapControl(
|
|
184
|
+
/* @__PURE__ */ $(E.Root, { open: o && !d, modal: !1, children: [
|
|
185
|
+
/* @__PURE__ */ i(E.Anchor, { asChild: !0, children: /* @__PURE__ */ $(
|
|
177
186
|
"div",
|
|
178
187
|
{
|
|
179
188
|
"data-component": "combobox-input-border",
|
|
180
189
|
tabIndex: -1,
|
|
181
|
-
className:
|
|
190
|
+
className: O(
|
|
182
191
|
"flex w-full items-center gap-1 rounded-md border bg-transparent px-3 text-sm transition-colors outline-none ring-0 focus:outline-none focus:ring-0",
|
|
183
192
|
"focus-within:outline-none focus-within:ring-0 focus-within:border-brand hover:border-brand",
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
193
|
+
V.hasError ? "border-destructive hover:border-destructive" : "border-field",
|
|
194
|
+
d && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
|
|
195
|
+
Ve({ size: re }),
|
|
187
196
|
"bg-canvas"
|
|
188
197
|
),
|
|
189
|
-
children:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ i(
|
|
200
|
+
"input",
|
|
201
|
+
{
|
|
202
|
+
ref: he,
|
|
203
|
+
type: "text",
|
|
204
|
+
value: n,
|
|
205
|
+
onChange: we,
|
|
206
|
+
onFocus: ye,
|
|
207
|
+
onBlur: Ce,
|
|
208
|
+
onKeyDown: Ie,
|
|
209
|
+
placeholder: K,
|
|
210
|
+
disabled: !!d,
|
|
211
|
+
className: O(
|
|
212
|
+
"flex h-full w-full bg-transparent p-0 text-sm font-medium",
|
|
213
|
+
"outline-none ring-0 shadow-none border-none",
|
|
214
|
+
"focus:outline-none focus:ring-0 focus:shadow-none focus:border-none",
|
|
215
|
+
"focus-visible:outline-none focus-visible:ring-0 focus-visible:shadow-none focus-visible:border-none",
|
|
216
|
+
"placeholder:font-medium placeholder:text-content-empty",
|
|
217
|
+
d && "opacity-100 text-disabled-foreground placeholder:text-disabled-foreground cursor-not-allowed",
|
|
218
|
+
H && "text-right"
|
|
219
|
+
),
|
|
220
|
+
style: { boxShadow: "none", outline: "none" },
|
|
221
|
+
autoComplete: "off",
|
|
222
|
+
role: "combobox",
|
|
223
|
+
"aria-expanded": o,
|
|
224
|
+
"aria-autocomplete": "list",
|
|
225
|
+
"aria-haspopup": "listbox",
|
|
226
|
+
"aria-controls": o ? S : void 0,
|
|
227
|
+
"aria-activedescendant": be,
|
|
228
|
+
"aria-required": U || void 0,
|
|
229
|
+
"aria-label": A ? void 0 : R,
|
|
230
|
+
...V.controlAria
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
ve ? /* @__PURE__ */ $(Ae, { children: [
|
|
234
|
+
/* @__PURE__ */ i(Ne, { asChild: !0, children: /* @__PURE__ */ i(
|
|
235
|
+
"button",
|
|
236
|
+
{
|
|
237
|
+
type: "button",
|
|
238
|
+
"data-clear-button": !0,
|
|
239
|
+
"aria-label": W("select.clear"),
|
|
240
|
+
className: "inline-flex shrink-0 cursor-pointer border-none bg-transparent p-0.5 text-content-icon hover:text-content-secondary",
|
|
241
|
+
onPointerDown: xe,
|
|
242
|
+
children: /* @__PURE__ */ i(Le, { size: "11px", className: "text-content-icon" })
|
|
243
|
+
}
|
|
244
|
+
) }),
|
|
245
|
+
/* @__PURE__ */ i(Se, { variant: "tertiary", side: "top", children: W("select.clear") })
|
|
246
|
+
] }) : null
|
|
247
|
+
]
|
|
223
248
|
}
|
|
224
249
|
) }),
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
|
|
250
|
+
/* @__PURE__ */ i(E.Portal, { container: pe, children: /* @__PURE__ */ i(
|
|
251
|
+
E.Content,
|
|
227
252
|
{
|
|
228
253
|
align: "start",
|
|
229
254
|
side: "bottom",
|
|
@@ -237,46 +262,46 @@ const je = Ce(
|
|
|
237
262
|
onInteractOutside: () => {
|
|
238
263
|
},
|
|
239
264
|
onWheel: (e) => e.stopPropagation(),
|
|
240
|
-
className:
|
|
265
|
+
className: O(
|
|
241
266
|
"z-[9999] overflow-hidden rounded-[12px] bg-canvas text-base shadow-elevation-select focus:outline-none sm:text-sm flex flex-col border-none w-[var(--radix-popover-trigger-width)]",
|
|
242
|
-
|
|
267
|
+
Re
|
|
243
268
|
),
|
|
244
269
|
style: {
|
|
245
270
|
maxHeight: "var(--radix-popover-content-available-height)"
|
|
246
271
|
},
|
|
247
|
-
children: /* @__PURE__ */
|
|
272
|
+
children: /* @__PURE__ */ i(
|
|
248
273
|
"div",
|
|
249
274
|
{
|
|
250
|
-
ref:
|
|
251
|
-
id:
|
|
275
|
+
ref: P,
|
|
276
|
+
id: S,
|
|
252
277
|
className: "flex-1 overflow-auto py-1 px-[6px]",
|
|
253
278
|
style: { maxHeight: 240, overscrollBehavior: "contain" },
|
|
254
279
|
role: "listbox",
|
|
255
280
|
"aria-label": R,
|
|
256
|
-
onPointerDown:
|
|
281
|
+
onPointerDown: De,
|
|
257
282
|
onWheel: (e) => e.stopPropagation(),
|
|
258
283
|
onMouseLeave: () => {
|
|
259
|
-
|
|
284
|
+
I("mouse"), m(-1);
|
|
260
285
|
},
|
|
261
|
-
children: r.length === 0 ? /* @__PURE__ */
|
|
262
|
-
const s = t ===
|
|
263
|
-
return /* @__PURE__ */
|
|
286
|
+
children: r.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center py-6 text-sm text-secondary-foreground", children: ie }) : r.map((e, t) => {
|
|
287
|
+
const s = t === g, b = e.toLowerCase() === C.toLowerCase(), F = `${S}-option-${t}`;
|
|
288
|
+
return /* @__PURE__ */ i("div", { className: "w-full pb-[2px]", children: /* @__PURE__ */ i(
|
|
264
289
|
"div",
|
|
265
290
|
{
|
|
266
291
|
"data-combobox-item": !0,
|
|
267
292
|
"data-combobox-value": e,
|
|
268
|
-
id:
|
|
293
|
+
id: F,
|
|
269
294
|
role: "option",
|
|
270
|
-
"aria-selected":
|
|
271
|
-
className:
|
|
295
|
+
"aria-selected": b,
|
|
296
|
+
className: O(
|
|
272
297
|
"cursor-default select-none py-[6px] px-3 flex items-center transition-colors rounded-md",
|
|
273
298
|
H ? "justify-end text-right" : "justify-between",
|
|
274
|
-
s &&
|
|
299
|
+
s && Q === "keyboard" ? "ring-2 ring-inset ring-primary bg-accent text-content" : s && Q === "mouse" ? "bg-canvas-muted text-content" : b ? "bg-accent text-content" : "text-content hover:bg-canvas-muted cursor-pointer"
|
|
275
300
|
),
|
|
276
301
|
onMouseEnter: () => {
|
|
277
|
-
|
|
302
|
+
I("mouse"), m(t);
|
|
278
303
|
},
|
|
279
|
-
children: /* @__PURE__ */
|
|
304
|
+
children: /* @__PURE__ */ i("span", { className: "text-sm", children: e })
|
|
280
305
|
}
|
|
281
306
|
) }, e);
|
|
282
307
|
})
|
|
@@ -289,5 +314,5 @@ const je = Ce(
|
|
|
289
314
|
}
|
|
290
315
|
);
|
|
291
316
|
export {
|
|
292
|
-
|
|
317
|
+
Je as Combobox
|
|
293
318
|
};
|
|
@@ -36,4 +36,6 @@ export interface ComboboxProps extends FieldControlProps {
|
|
|
36
36
|
emptyMessage?: string;
|
|
37
37
|
/** If true, typed text is committed even when it doesn't match any option */
|
|
38
38
|
allowFreeText?: boolean;
|
|
39
|
+
/** When true, shows a clear button to reset the committed value */
|
|
40
|
+
clearable?: boolean;
|
|
39
41
|
}
|
|
@@ -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[];
|