@povio/ui 3.3.0-rc.4 → 3.4.0-rc.1
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/README.md +15 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
- package/dist/components/buttons/shared/ButtonContent.js +22 -80
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +93 -100
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +1 -2
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +109 -113
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +97 -238
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +88 -214
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +64 -143
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +275 -294
- package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
- package/dist/components/inputs/DateTime/shared/DateField.js +135 -306
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -343
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +43 -46
- package/dist/components/inputs/File/FileUpload.d.ts +1 -1
- package/dist/components/inputs/File/FileUpload.js +18 -18
- package/dist/components/inputs/File/InputUpload.d.ts +1 -1
- package/dist/components/inputs/File/InputUpload.js +82 -278
- package/dist/components/inputs/File/fileUpload.types.d.ts +1 -1
- package/dist/components/inputs/File/inputUpload.types.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
- package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
- package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
- package/dist/components/inputs/FormField/FormField.js +34 -47
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +19 -19
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +93 -331
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.js +18 -18
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -2
- package/dist/components/inputs/Input/TextInput/TextInput.js +36 -38
- package/dist/components/inputs/Inputs/Form.d.ts +4 -4
- package/dist/components/inputs/Inputs/InputItem.d.ts +22 -22
- package/dist/components/inputs/Inputs/InputItem.js +35 -36
- package/dist/components/inputs/Inputs/Inputs.d.ts +2 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.js +107 -111
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +26 -86
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +19 -19
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.js +49 -115
- package/dist/components/inputs/Selection/Select/Select.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/Select.js +22 -22
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +34 -37
- package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
- package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +4 -8
- package/dist/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/useSelectItems.js +48 -108
- package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
- package/dist/components/inputs/Slider/Slider.d.ts +1 -1
- package/dist/components/inputs/Slider/Slider.js +18 -18
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +105 -407
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -2
- package/dist/components/inputs/Toggle/Toggle.js +59 -63
- package/dist/components/inputs/shared/InputClear.js +24 -40
- package/dist/components/inputs/shared/form.binding.d.ts +27 -0
- package/dist/components/inputs/shared/form.binding.js +57 -0
- package/dist/components/inputs/shared/form.types.d.ts +9 -8
- package/dist/components/inputs/shared/form.types.js +8 -0
- package/dist/components/navigation/Accordion/Accordion.js +22 -69
- package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
- package/dist/components/navigation/Stepper/Stepper.js +22 -67
- package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
- package/dist/components/segment/Segment.d.ts +1 -1
- package/dist/components/segment/Segment.js +17 -17
- package/dist/components/segment/segment.types.d.ts +1 -1
- package/dist/components/shared/pagination/Pagination.js +22 -108
- package/dist/components/status/Alert/Alert.js +30 -97
- package/dist/components/table/InfiniteTable.js +16 -67
- package/dist/components/table/Table.d.ts +2 -8
- package/dist/components/table/Table.js +33 -55
- package/dist/components/text/Typography/Typography.js +8 -23
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/theme.context.js +45 -98
- package/dist/config/uiConfig.context.d.ts +5 -5
- package/dist/config/uiConfig.context.js +11 -51
- package/dist/config/uiOverrides.context.d.ts +0 -1
- package/dist/helpers/dynamicColumns.d.ts +1 -1
- package/dist/helpers/dynamicInputs.d.ts +7 -7
- package/dist/hooks/useAutosave.d.ts +4 -4
- package/dist/hooks/useAutosave.js +64 -49
- package/dist/hooks/useDebounceCallback.js +17 -51
- package/dist/hooks/useForm.d.ts +39 -15
- package/dist/hooks/useForm.js +96 -43
- package/dist/hooks/useFormAutosave.d.ts +8 -9
- package/dist/hooks/useFormAutosave.js +49 -122
- package/dist/hooks/useLongPressRepeat.js +20 -55
- package/dist/index.d.ts +2 -3
- package/dist/index.js +3 -4
- package/package.json +3 -4
- package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
- package/dist/components/inputs/FormField/formField.cva.js +0 -16
- package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
- package/dist/components/table/TableColumnFilterInput.js +0 -108
- package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
- package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
- package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
- package/dist/components/table/TableColumnFilterRow.js +0 -68
- package/dist/hooks/useAutosave.spec.d.ts +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
2
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
|
+
import { FieldController } from "../shared/form.binding.js";
|
|
3
4
|
import { FormFieldError } from "../FormField/FormFieldError.js";
|
|
4
5
|
import { CheckContent } from "../shared/CheckContent.js";
|
|
5
6
|
import { toggleContentClassName, toggleDefinition, toggleTypography } from "./toggle.cva.js";
|
|
@@ -8,10 +9,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
9
|
import { clsx } from "clsx";
|
|
9
10
|
import { Switch } from "react-aria-components";
|
|
10
11
|
import { mergeRefs } from "@react-aria/utils";
|
|
11
|
-
import { Controller } from "react-hook-form";
|
|
12
12
|
//#region src/components/inputs/Toggle/Toggle.tsx
|
|
13
13
|
var ToggleBase = (props) => {
|
|
14
|
-
const $ = c(
|
|
14
|
+
const $ = c(48);
|
|
15
15
|
const ui = UIConfig.useConfig();
|
|
16
16
|
const toggleCva = UIOverrides.useCva("toggle.cva", toggleDefinition);
|
|
17
17
|
const toggleTypographyMap = UIOverrides.useMapper("toggle.typography", toggleTypography);
|
|
@@ -31,10 +31,9 @@ var ToggleBase = (props) => {
|
|
|
31
31
|
let t8;
|
|
32
32
|
let t9;
|
|
33
33
|
if ($[0] !== props || $[1] !== toggleContentClassNameMap || $[2] !== toggleCva || $[3] !== toggleTypographyMap || $[4] !== ui) {
|
|
34
|
-
const { className, children: t10, isDisabled, error, variant: variantProp,
|
|
34
|
+
const { className, children: t10, isDisabled, error, variant: variantProp, onChange, onBlur, ...rest } = props;
|
|
35
35
|
children = t10;
|
|
36
36
|
const variant = variantProp ?? ui.toggle.variant;
|
|
37
|
-
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.toggle.fireBlurOnChange;
|
|
38
37
|
let t11;
|
|
39
38
|
if ($[19] !== error || $[20] !== isDisabled) {
|
|
40
39
|
t11 = {
|
|
@@ -47,16 +46,13 @@ var ToggleBase = (props) => {
|
|
|
47
46
|
} else t11 = $[21];
|
|
48
47
|
formFieldErrorProps = t11;
|
|
49
48
|
let t12;
|
|
50
|
-
if ($[22] !==
|
|
49
|
+
if ($[22] !== onChange) {
|
|
51
50
|
t12 = (isSelected) => {
|
|
52
51
|
onChange?.(isSelected);
|
|
53
|
-
if (fireBlurOnChange) onBlur?.({});
|
|
54
52
|
};
|
|
55
|
-
$[22] =
|
|
56
|
-
$[23] =
|
|
57
|
-
|
|
58
|
-
$[25] = t12;
|
|
59
|
-
} else t12 = $[25];
|
|
53
|
+
$[22] = onChange;
|
|
54
|
+
$[23] = t12;
|
|
55
|
+
} else t12 = $[23];
|
|
60
56
|
const handleChange = t12;
|
|
61
57
|
T1 = Switch;
|
|
62
58
|
t2 = rest;
|
|
@@ -66,12 +62,12 @@ var ToggleBase = (props) => {
|
|
|
66
62
|
t6 = handleChange;
|
|
67
63
|
t7 = onBlur;
|
|
68
64
|
const t13 = !isDisabled && "cursor-pointer";
|
|
69
|
-
if ($[
|
|
65
|
+
if ($[24] !== className || $[25] !== t13) {
|
|
70
66
|
t8 = clsx("group flex items-center gap-2", t13, className);
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
} else t8 = $[
|
|
67
|
+
$[24] = className;
|
|
68
|
+
$[25] = t13;
|
|
69
|
+
$[26] = t8;
|
|
70
|
+
} else t8 = $[26];
|
|
75
71
|
t9 = /* @__PURE__ */ jsx("div", { className: toggleCva({
|
|
76
72
|
variant,
|
|
77
73
|
...rest
|
|
@@ -121,20 +117,20 @@ var ToggleBase = (props) => {
|
|
|
121
117
|
t9 = $[18];
|
|
122
118
|
}
|
|
123
119
|
let t10;
|
|
124
|
-
if ($[
|
|
120
|
+
if ($[27] !== T0 || $[28] !== children || $[29] !== t0 || $[30] !== t1) {
|
|
125
121
|
t10 = /* @__PURE__ */ jsx(T0, {
|
|
126
122
|
typography: t0,
|
|
127
123
|
contentClassName: t1,
|
|
128
124
|
children
|
|
129
125
|
});
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
} else t10 = $[
|
|
126
|
+
$[27] = T0;
|
|
127
|
+
$[28] = children;
|
|
128
|
+
$[29] = t0;
|
|
129
|
+
$[30] = t1;
|
|
130
|
+
$[31] = t10;
|
|
131
|
+
} else t10 = $[31];
|
|
136
132
|
let t11;
|
|
137
|
-
if ($[
|
|
133
|
+
if ($[32] !== T1 || $[33] !== t10 || $[34] !== t2 || $[35] !== t3 || $[36] !== t4 || $[37] !== t5 || $[38] !== t6 || $[39] !== t7 || $[40] !== t8 || $[41] !== t9) {
|
|
138
134
|
t11 = /* @__PURE__ */ jsxs(T1, {
|
|
139
135
|
...t2,
|
|
140
136
|
"data-is-dirty": t3,
|
|
@@ -145,64 +141,64 @@ var ToggleBase = (props) => {
|
|
|
145
141
|
className: t8,
|
|
146
142
|
children: [t9, t10]
|
|
147
143
|
});
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
} else t11 = $[
|
|
144
|
+
$[32] = T1;
|
|
145
|
+
$[33] = t10;
|
|
146
|
+
$[34] = t2;
|
|
147
|
+
$[35] = t3;
|
|
148
|
+
$[36] = t4;
|
|
149
|
+
$[37] = t5;
|
|
150
|
+
$[38] = t6;
|
|
151
|
+
$[39] = t7;
|
|
152
|
+
$[40] = t8;
|
|
153
|
+
$[41] = t9;
|
|
154
|
+
$[42] = t11;
|
|
155
|
+
} else t11 = $[42];
|
|
160
156
|
let t12;
|
|
161
|
-
if ($[
|
|
157
|
+
if ($[43] !== formFieldErrorProps) {
|
|
162
158
|
t12 = /* @__PURE__ */ jsx(FormFieldError, { ...formFieldErrorProps });
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
} else t12 = $[
|
|
159
|
+
$[43] = formFieldErrorProps;
|
|
160
|
+
$[44] = t12;
|
|
161
|
+
} else t12 = $[44];
|
|
166
162
|
let t13;
|
|
167
|
-
if ($[
|
|
163
|
+
if ($[45] !== t11 || $[46] !== t12) {
|
|
168
164
|
t13 = /* @__PURE__ */ jsxs(Fragment, { children: [t11, t12] });
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
} else t13 = $[
|
|
165
|
+
$[45] = t11;
|
|
166
|
+
$[46] = t12;
|
|
167
|
+
$[47] = t13;
|
|
168
|
+
} else t13 = $[47];
|
|
173
169
|
return t13;
|
|
174
170
|
};
|
|
175
171
|
var Toggle = (props) => {
|
|
176
172
|
const $ = c(15);
|
|
177
|
-
if ("
|
|
178
|
-
let
|
|
173
|
+
if ("field" in props && props.field) {
|
|
174
|
+
let field;
|
|
179
175
|
let innerProps;
|
|
180
176
|
let ref;
|
|
181
177
|
if ($[0] !== props) {
|
|
182
|
-
({
|
|
178
|
+
({field, ref, ...innerProps} = props);
|
|
183
179
|
$[0] = props;
|
|
184
|
-
$[1] =
|
|
180
|
+
$[1] = field;
|
|
185
181
|
$[2] = innerProps;
|
|
186
182
|
$[3] = ref;
|
|
187
183
|
} else {
|
|
188
|
-
|
|
184
|
+
field = $[1];
|
|
189
185
|
innerProps = $[2];
|
|
190
186
|
ref = $[3];
|
|
191
187
|
}
|
|
192
188
|
let t0;
|
|
193
189
|
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
194
190
|
t0 = (t1) => {
|
|
195
|
-
const { field, fieldState: t2 } = t1;
|
|
191
|
+
const { field: field_0, fieldState: t2 } = t1;
|
|
196
192
|
const { error, isDirty } = t2;
|
|
197
193
|
return /* @__PURE__ */ jsx(ToggleBase, {
|
|
198
194
|
...innerProps,
|
|
199
|
-
ref: mergeRefs(ref,
|
|
200
|
-
isSelected:
|
|
201
|
-
onChange:
|
|
202
|
-
onBlur:
|
|
203
|
-
name:
|
|
195
|
+
ref: mergeRefs(ref, field_0.ref),
|
|
196
|
+
isSelected: field_0.value,
|
|
197
|
+
onChange: field_0.onChange,
|
|
198
|
+
onBlur: field_0.onBlur,
|
|
199
|
+
name: field_0.name,
|
|
204
200
|
isDirty,
|
|
205
|
-
isDisabled:
|
|
201
|
+
isDisabled: field_0.disabled || props.isDisabled,
|
|
206
202
|
error: props.error ?? error?.message
|
|
207
203
|
});
|
|
208
204
|
};
|
|
@@ -213,14 +209,14 @@ var Toggle = (props) => {
|
|
|
213
209
|
$[8] = t0;
|
|
214
210
|
} else t0 = $[8];
|
|
215
211
|
let t1;
|
|
216
|
-
if ($[9] !==
|
|
217
|
-
t1 = /* @__PURE__ */ jsx(
|
|
218
|
-
control:
|
|
219
|
-
name:
|
|
212
|
+
if ($[9] !== field.form || $[10] !== field.name || $[11] !== t0) {
|
|
213
|
+
t1 = /* @__PURE__ */ jsx(FieldController, {
|
|
214
|
+
control: field.form,
|
|
215
|
+
name: field.name,
|
|
220
216
|
render: t0
|
|
221
217
|
});
|
|
222
|
-
$[9] =
|
|
223
|
-
$[10] =
|
|
218
|
+
$[9] = field.form;
|
|
219
|
+
$[10] = field.name;
|
|
224
220
|
$[11] = t0;
|
|
225
221
|
$[12] = t1;
|
|
226
222
|
} else t1 = $[12];
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { CloseIcon } from "../../../assets/icons/Close.js";
|
|
2
|
-
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
3
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
4
|
-
import { buttonIconSizeDefinition } from "../../buttons/Button/button.cva.js";
|
|
5
3
|
import { InlineIconButton } from "../../buttons/InlineIconButton/InlineIconButton.js";
|
|
6
4
|
import "../../../config/i18n.js";
|
|
7
5
|
import { c } from "react/compiler-runtime";
|
|
@@ -10,70 +8,56 @@ import { clsx } from "clsx";
|
|
|
10
8
|
import { useTranslation } from "react-i18next";
|
|
11
9
|
//#region src/components/inputs/shared/InputClear.tsx
|
|
12
10
|
var InputClear = (t0) => {
|
|
13
|
-
const $ = c(
|
|
11
|
+
const $ = c(12);
|
|
14
12
|
const { onClear, className, style, show, renderStatic } = t0;
|
|
15
|
-
const
|
|
16
|
-
const buttonIconSizeCva = UIOverrides.useCva("button.iconSize", buttonIconSizeDefinition);
|
|
17
|
-
const alwaysShowClear = ui.input.alwaysShowClear;
|
|
13
|
+
const alwaysShowClear = UIConfig.useConfig().input.alwaysShowClear;
|
|
18
14
|
let clearClassName;
|
|
19
15
|
let t1;
|
|
20
|
-
if ($[0] !== alwaysShowClear || $[1] !==
|
|
16
|
+
if ($[0] !== alwaysShowClear || $[1] !== className || $[2] !== renderStatic || $[3] !== show || $[4] !== style) {
|
|
21
17
|
t1 = Symbol.for("react.early_return_sentinel");
|
|
22
18
|
bb0: {
|
|
23
19
|
clearClassName = clsx("relative z-raised flex items-center", !alwaysShowClear && "md:invisible group-focus-within:visible group-hover/date-picker-content:visible group-hover/select-content:visible group-hover/text-area:visible group-hover:visible", "border-0!", !show && "invisible!", className);
|
|
24
20
|
if (renderStatic) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
className: "shrink-0"
|
|
31
|
-
});
|
|
32
|
-
$[8] = buttonIconSizeCva;
|
|
33
|
-
$[9] = t3;
|
|
34
|
-
} else t3 = $[9];
|
|
35
|
-
let t4;
|
|
36
|
-
if ($[10] !== t3) {
|
|
37
|
-
t4 = /* @__PURE__ */ jsx(CloseIcon, { className: t3 });
|
|
38
|
-
$[10] = t3;
|
|
39
|
-
$[11] = t4;
|
|
40
|
-
} else t4 = $[11];
|
|
21
|
+
let t2;
|
|
22
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
|
+
t2 = /* @__PURE__ */ jsx(CloseIcon, { className: "h-6 w-6 shrink-0" });
|
|
24
|
+
$[7] = t2;
|
|
25
|
+
} else t2 = $[7];
|
|
41
26
|
t1 = /* @__PURE__ */ jsx("button", {
|
|
42
27
|
type: "button",
|
|
43
28
|
"aria-hidden": "true",
|
|
44
29
|
tabIndex: -1,
|
|
45
|
-
className:
|
|
30
|
+
className: clsx("group inline-flex items-center justify-center border border-solid border-support-transparent-outline", "rounded-button-rounding-s p-0 text-interactive-text-secondary-idle", clearClassName),
|
|
46
31
|
style,
|
|
47
|
-
children:
|
|
32
|
+
children: t2
|
|
48
33
|
});
|
|
49
34
|
break bb0;
|
|
50
35
|
}
|
|
51
36
|
}
|
|
52
37
|
$[0] = alwaysShowClear;
|
|
53
|
-
$[1] =
|
|
54
|
-
$[2] =
|
|
55
|
-
$[3] =
|
|
56
|
-
$[4] =
|
|
57
|
-
$[5] =
|
|
58
|
-
$[6] =
|
|
59
|
-
$[7] = t1;
|
|
38
|
+
$[1] = className;
|
|
39
|
+
$[2] = renderStatic;
|
|
40
|
+
$[3] = show;
|
|
41
|
+
$[4] = style;
|
|
42
|
+
$[5] = clearClassName;
|
|
43
|
+
$[6] = t1;
|
|
60
44
|
} else {
|
|
61
|
-
clearClassName = $[
|
|
62
|
-
t1 = $[
|
|
45
|
+
clearClassName = $[5];
|
|
46
|
+
t1 = $[6];
|
|
63
47
|
}
|
|
64
48
|
if (t1 !== Symbol.for("react.early_return_sentinel")) return t1;
|
|
65
49
|
let t2;
|
|
66
|
-
if ($[
|
|
50
|
+
if ($[8] !== clearClassName || $[9] !== onClear || $[10] !== style) {
|
|
67
51
|
t2 = /* @__PURE__ */ jsx(InputClearButton, {
|
|
68
52
|
onClear,
|
|
69
53
|
className: clearClassName,
|
|
70
54
|
style
|
|
71
55
|
});
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
} else t2 = $[
|
|
56
|
+
$[8] = clearClassName;
|
|
57
|
+
$[9] = onClear;
|
|
58
|
+
$[10] = style;
|
|
59
|
+
$[11] = t2;
|
|
60
|
+
} else t2 = $[11];
|
|
77
61
|
return t2;
|
|
78
62
|
};
|
|
79
63
|
var InputClearButton = (t0) => {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DeepKeys, DeepValue, UIForm } from '../../../hooks/useForm';
|
|
2
|
+
export type FieldValues = Record<string, any>;
|
|
3
|
+
export type FieldPath<TFieldValues extends FieldValues> = DeepKeys<TFieldValues>;
|
|
4
|
+
export type FieldPathValue<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = DeepValue<TFieldValues, TName>;
|
|
5
|
+
export type FormInstance<TFieldValues extends FieldValues> = UIForm<TFieldValues>;
|
|
6
|
+
interface FieldControllerProps<TFieldValues extends FieldValues> {
|
|
7
|
+
control: UIForm<TFieldValues>;
|
|
8
|
+
name: DeepKeys<TFieldValues>;
|
|
9
|
+
render: (props: {
|
|
10
|
+
field: {
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
name: string;
|
|
13
|
+
onBlur: () => void;
|
|
14
|
+
onChange: (value: any) => void;
|
|
15
|
+
ref: () => void;
|
|
16
|
+
value: any;
|
|
17
|
+
};
|
|
18
|
+
fieldState: {
|
|
19
|
+
error?: {
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
isDirty: boolean;
|
|
23
|
+
};
|
|
24
|
+
}) => React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export declare function FieldController<TFieldValues extends FieldValues>({ control: form, name, render, }: FieldControllerProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getFieldError } from "./form.types.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/inputs/shared/form.binding.tsx
|
|
5
|
+
function FieldController(t0) {
|
|
6
|
+
const $ = c(12);
|
|
7
|
+
const { control: form, name, render } = t0;
|
|
8
|
+
const T0 = form.Field;
|
|
9
|
+
let t1;
|
|
10
|
+
if ($[0] !== form || $[1] !== name) {
|
|
11
|
+
t1 = form.getFieldValidators(name);
|
|
12
|
+
$[0] = form;
|
|
13
|
+
$[1] = name;
|
|
14
|
+
$[2] = t1;
|
|
15
|
+
} else t1 = $[2];
|
|
16
|
+
let t2;
|
|
17
|
+
if ($[3] !== form || $[4] !== name || $[5] !== render) {
|
|
18
|
+
t2 = (field) => render({
|
|
19
|
+
field: {
|
|
20
|
+
disabled: form.disabled,
|
|
21
|
+
name: field.name,
|
|
22
|
+
onBlur: () => {
|
|
23
|
+
field.handleBlur();
|
|
24
|
+
form.notifyBlur(name);
|
|
25
|
+
},
|
|
26
|
+
onChange: field.handleChange,
|
|
27
|
+
ref: _temp,
|
|
28
|
+
value: field.state.value
|
|
29
|
+
},
|
|
30
|
+
fieldState: {
|
|
31
|
+
error: getFieldError(field.state.meta.errors) ? { message: getFieldError(field.state.meta.errors) } : void 0,
|
|
32
|
+
isDirty: field.state.meta.isDirty
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
$[3] = form;
|
|
36
|
+
$[4] = name;
|
|
37
|
+
$[5] = render;
|
|
38
|
+
$[6] = t2;
|
|
39
|
+
} else t2 = $[6];
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[7] !== form.Field || $[8] !== name || $[9] !== t1 || $[10] !== t2) {
|
|
42
|
+
t3 = /* @__PURE__ */ jsx(T0, {
|
|
43
|
+
name,
|
|
44
|
+
validators: t1,
|
|
45
|
+
children: t2
|
|
46
|
+
});
|
|
47
|
+
$[7] = form.Field;
|
|
48
|
+
$[8] = name;
|
|
49
|
+
$[9] = t1;
|
|
50
|
+
$[10] = t2;
|
|
51
|
+
$[11] = t3;
|
|
52
|
+
} else t3 = $[11];
|
|
53
|
+
return t3;
|
|
54
|
+
}
|
|
55
|
+
function _temp() {}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { FieldController };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeepKeys, DeepValue, UIForm } from '../../../hooks/useForm';
|
|
2
2
|
export type ControlKeys<TProps, TValueProp extends keyof TProps = "value" extends keyof TProps ? "value" : never> = TValueProp | "onChange" | "onBlur";
|
|
3
|
-
export interface FormControl<TFieldValues extends
|
|
4
|
-
|
|
3
|
+
export interface FormControl<TFieldValues extends Record<string, unknown>, TType> {
|
|
4
|
+
form: UIForm<TFieldValues>;
|
|
5
5
|
name: {
|
|
6
|
-
[K in
|
|
7
|
-
}[
|
|
6
|
+
[K in DeepKeys<TFieldValues>]: DeepValue<TFieldValues, K> extends TType ? K : never;
|
|
7
|
+
}[DeepKeys<TFieldValues>];
|
|
8
8
|
}
|
|
9
|
-
export type FormControlProps<TProps, TFieldValues extends
|
|
10
|
-
|
|
9
|
+
export type FormControlProps<TProps, TFieldValues extends Record<string, unknown>, TValueProp extends keyof TProps = "value" extends keyof TProps ? "value" : never> = {
|
|
10
|
+
field: FormControl<TFieldValues, TProps[TValueProp] | null>;
|
|
11
11
|
} & Omit<TProps, ControlKeys<TProps, TValueProp>> & Partial<Record<ControlKeys<TProps, TValueProp>, never>>;
|
|
12
|
-
export type ControlProps<TProps, TFieldValues extends
|
|
12
|
+
export type ControlProps<TProps, TFieldValues extends Record<string, unknown>, TValueProp extends keyof TProps = "value" extends keyof TProps ? "value" : never> = FormControlProps<TProps, TFieldValues, TValueProp> | TProps;
|
|
13
|
+
export declare const getFieldError: (errors: unknown[]) => string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/components/inputs/shared/form.types.ts
|
|
2
|
+
var getFieldError = (errors) => errors.flatMap((error) => {
|
|
3
|
+
if (typeof error === "string") return [error];
|
|
4
|
+
if (error && typeof error === "object" && "message" in error) return [String(error.message)];
|
|
5
|
+
return [];
|
|
6
|
+
}).at(0);
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getFieldError };
|
|
@@ -1,81 +1,34 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
2
2
|
import { accordionDefinition } from "./accordion.cva.js";
|
|
3
3
|
import { AccordionItem } from "./AccordionItem.js";
|
|
4
|
-
import { c } from "react/compiler-runtime";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
6
5
|
import { clsx } from "clsx";
|
|
7
6
|
import { DisclosureGroup } from "react-aria-components";
|
|
8
7
|
//#region src/components/navigation/Accordion/Accordion.tsx
|
|
9
|
-
var Accordion = (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const t4 = items.length === 1;
|
|
17
|
-
let t5;
|
|
18
|
-
if ($[0] !== accordionCva || $[1] !== className || $[2] !== t4 || $[3] !== variant) {
|
|
19
|
-
t5 = clsx(accordionCva({
|
|
8
|
+
var Accordion = ({ items, variant = "filled", actionPosition = "right", allowsMultipleExpanded = false, expandedKeys, defaultExpandedKeys, onExpandedChange, className, disabled }) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(DisclosureGroup, {
|
|
10
|
+
allowsMultipleExpanded,
|
|
11
|
+
expandedKeys,
|
|
12
|
+
defaultExpandedKeys,
|
|
13
|
+
onExpandedChange,
|
|
14
|
+
className: clsx(UIOverrides.useCva("accordion.cva", accordionDefinition)({
|
|
20
15
|
className,
|
|
21
16
|
variant,
|
|
22
|
-
singleItem:
|
|
23
|
-
}))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
subheading: item.subheading,
|
|
38
|
-
icon: item.icon,
|
|
39
|
-
variant,
|
|
40
|
-
actionPosition,
|
|
41
|
-
disabled: item.disabled || disabled,
|
|
42
|
-
isSingle: items.length === 1,
|
|
43
|
-
children: item.children
|
|
44
|
-
}, item.id);
|
|
45
|
-
$[10] = actionPosition;
|
|
46
|
-
$[11] = disabled;
|
|
47
|
-
$[12] = items.length;
|
|
48
|
-
$[13] = variant;
|
|
49
|
-
$[14] = t7;
|
|
50
|
-
} else t7 = $[14];
|
|
51
|
-
t6 = items.map(t7);
|
|
52
|
-
$[5] = actionPosition;
|
|
53
|
-
$[6] = disabled;
|
|
54
|
-
$[7] = items;
|
|
55
|
-
$[8] = variant;
|
|
56
|
-
$[9] = t6;
|
|
57
|
-
} else t6 = $[9];
|
|
58
|
-
let t7;
|
|
59
|
-
if ($[15] !== allowsMultipleExpanded || $[16] !== defaultExpandedKeys || $[17] !== disabled || $[18] !== expandedKeys || $[19] !== onExpandedChange || $[20] !== t5 || $[21] !== t6) {
|
|
60
|
-
t7 = /* @__PURE__ */ jsx(DisclosureGroup, {
|
|
61
|
-
allowsMultipleExpanded,
|
|
62
|
-
expandedKeys,
|
|
63
|
-
defaultExpandedKeys,
|
|
64
|
-
onExpandedChange,
|
|
65
|
-
className: t5,
|
|
66
|
-
isDisabled: disabled,
|
|
67
|
-
children: t6
|
|
68
|
-
});
|
|
69
|
-
$[15] = allowsMultipleExpanded;
|
|
70
|
-
$[16] = defaultExpandedKeys;
|
|
71
|
-
$[17] = disabled;
|
|
72
|
-
$[18] = expandedKeys;
|
|
73
|
-
$[19] = onExpandedChange;
|
|
74
|
-
$[20] = t5;
|
|
75
|
-
$[21] = t6;
|
|
76
|
-
$[22] = t7;
|
|
77
|
-
} else t7 = $[22];
|
|
78
|
-
return t7;
|
|
17
|
+
singleItem: items.length === 1
|
|
18
|
+
})),
|
|
19
|
+
isDisabled: disabled,
|
|
20
|
+
children: items.map((item) => /* @__PURE__ */ jsx(AccordionItem, {
|
|
21
|
+
id: item.id,
|
|
22
|
+
heading: item.heading,
|
|
23
|
+
subheading: item.subheading,
|
|
24
|
+
icon: item.icon,
|
|
25
|
+
variant,
|
|
26
|
+
actionPosition,
|
|
27
|
+
disabled: item.disabled || disabled,
|
|
28
|
+
isSingle: items.length === 1,
|
|
29
|
+
children: item.children
|
|
30
|
+
}, item.id))
|
|
31
|
+
});
|
|
79
32
|
};
|
|
80
33
|
//#endregion
|
|
81
34
|
export { Accordion };
|