@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 { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
4
5
|
import { inputBaseDefinition, inputSizeDefinition } from "../../shared/input.cva.js";
|
|
5
6
|
import { IntlUtils } from "../../../../utils/intl.utils.js";
|
|
@@ -14,7 +15,6 @@ import { clsx } from "clsx";
|
|
|
14
15
|
import { useRef, useState } from "react";
|
|
15
16
|
import { useLocale } from "react-aria-components";
|
|
16
17
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
17
|
-
import { Controller } from "react-hook-form";
|
|
18
18
|
//#region src/components/inputs/Input/NumberRangeInput/NumberRangeInput.tsx
|
|
19
19
|
var EMPTY_RANGE = {
|
|
20
20
|
min: null,
|
|
@@ -28,337 +28,99 @@ var normalizeRangeValue = (value, minValue, maxValue) => {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
var NumberRangeInputBase = (props) => {
|
|
31
|
-
const $ = c(114);
|
|
32
31
|
const ui = UIConfig.useConfig();
|
|
33
32
|
const inputBaseCva = UIOverrides.useCva("input.baseCva", inputBaseDefinition);
|
|
34
33
|
const inputSizeCva = UIOverrides.useCva("input.sizeCva", inputSizeDefinition);
|
|
35
|
-
|
|
36
|
-
let autoFocusOnMount;
|
|
37
|
-
let className;
|
|
38
|
-
let error;
|
|
39
|
-
let errorClassName;
|
|
40
|
-
let headerClassName;
|
|
41
|
-
let helperText;
|
|
42
|
-
let hideLabelProps;
|
|
43
|
-
let inputClassName;
|
|
44
|
-
let isClearableProps;
|
|
45
|
-
let isDirty;
|
|
46
|
-
let isDisabled;
|
|
47
|
-
let isHeaderHidden;
|
|
48
|
-
let isRequired;
|
|
49
|
-
let label;
|
|
50
|
-
let maxInputClassName;
|
|
51
|
-
let maxValue;
|
|
52
|
-
let minInputClassName;
|
|
53
|
-
let minValue;
|
|
54
|
-
let onBlur;
|
|
55
|
-
let onChange;
|
|
56
|
-
let onMaxChange;
|
|
57
|
-
let onMinChange;
|
|
58
|
-
let ref;
|
|
59
|
-
let rest;
|
|
60
|
-
let rightContent;
|
|
61
|
-
let sizeProps;
|
|
62
|
-
let t0;
|
|
63
|
-
let t1;
|
|
64
|
-
let t2;
|
|
65
|
-
let t3;
|
|
66
|
-
let t4;
|
|
67
|
-
let t5;
|
|
68
|
-
let tooltipText;
|
|
69
|
-
let value;
|
|
70
|
-
let variantProps;
|
|
71
|
-
if ($[0] !== props) {
|
|
72
|
-
({ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, inputClassName, minInputClassName, maxInputClassName, value, minValue, maxValue, minPlaceholder: t0, maxPlaceholder: t1, minLabel: t2, maxLabel: t3, invalidRangeError: t4, hideInnerLabels: t5, isDirty, autoFocusOnMount, onChange, onMinChange, onMaxChange, onBlur, isClearable: isClearableProps, as: asProp, variant: variantProps, size: sizeProps, hideLabel: hideLabelProps, ...rest} = props);
|
|
73
|
-
$[0] = props;
|
|
74
|
-
$[1] = asProp;
|
|
75
|
-
$[2] = autoFocusOnMount;
|
|
76
|
-
$[3] = className;
|
|
77
|
-
$[4] = error;
|
|
78
|
-
$[5] = errorClassName;
|
|
79
|
-
$[6] = headerClassName;
|
|
80
|
-
$[7] = helperText;
|
|
81
|
-
$[8] = hideLabelProps;
|
|
82
|
-
$[9] = inputClassName;
|
|
83
|
-
$[10] = isClearableProps;
|
|
84
|
-
$[11] = isDirty;
|
|
85
|
-
$[12] = isDisabled;
|
|
86
|
-
$[13] = isHeaderHidden;
|
|
87
|
-
$[14] = isRequired;
|
|
88
|
-
$[15] = label;
|
|
89
|
-
$[16] = maxInputClassName;
|
|
90
|
-
$[17] = maxValue;
|
|
91
|
-
$[18] = minInputClassName;
|
|
92
|
-
$[19] = minValue;
|
|
93
|
-
$[20] = onBlur;
|
|
94
|
-
$[21] = onChange;
|
|
95
|
-
$[22] = onMaxChange;
|
|
96
|
-
$[23] = onMinChange;
|
|
97
|
-
$[24] = ref;
|
|
98
|
-
$[25] = rest;
|
|
99
|
-
$[26] = rightContent;
|
|
100
|
-
$[27] = sizeProps;
|
|
101
|
-
$[28] = t0;
|
|
102
|
-
$[29] = t1;
|
|
103
|
-
$[30] = t2;
|
|
104
|
-
$[31] = t3;
|
|
105
|
-
$[32] = t4;
|
|
106
|
-
$[33] = t5;
|
|
107
|
-
$[34] = tooltipText;
|
|
108
|
-
$[35] = value;
|
|
109
|
-
$[36] = variantProps;
|
|
110
|
-
} else {
|
|
111
|
-
asProp = $[1];
|
|
112
|
-
autoFocusOnMount = $[2];
|
|
113
|
-
className = $[3];
|
|
114
|
-
error = $[4];
|
|
115
|
-
errorClassName = $[5];
|
|
116
|
-
headerClassName = $[6];
|
|
117
|
-
helperText = $[7];
|
|
118
|
-
hideLabelProps = $[8];
|
|
119
|
-
inputClassName = $[9];
|
|
120
|
-
isClearableProps = $[10];
|
|
121
|
-
isDirty = $[11];
|
|
122
|
-
isDisabled = $[12];
|
|
123
|
-
isHeaderHidden = $[13];
|
|
124
|
-
isRequired = $[14];
|
|
125
|
-
label = $[15];
|
|
126
|
-
maxInputClassName = $[16];
|
|
127
|
-
maxValue = $[17];
|
|
128
|
-
minInputClassName = $[18];
|
|
129
|
-
minValue = $[19];
|
|
130
|
-
onBlur = $[20];
|
|
131
|
-
onChange = $[21];
|
|
132
|
-
onMaxChange = $[22];
|
|
133
|
-
onMinChange = $[23];
|
|
134
|
-
ref = $[24];
|
|
135
|
-
rest = $[25];
|
|
136
|
-
rightContent = $[26];
|
|
137
|
-
sizeProps = $[27];
|
|
138
|
-
t0 = $[28];
|
|
139
|
-
t1 = $[29];
|
|
140
|
-
t2 = $[30];
|
|
141
|
-
t3 = $[31];
|
|
142
|
-
t4 = $[32];
|
|
143
|
-
t5 = $[33];
|
|
144
|
-
tooltipText = $[34];
|
|
145
|
-
value = $[35];
|
|
146
|
-
variantProps = $[36];
|
|
147
|
-
}
|
|
148
|
-
const minPlaceholder = t0 === void 0 ? "Min" : t0;
|
|
149
|
-
const maxPlaceholder = t1 === void 0 ? "Max" : t1;
|
|
150
|
-
const minLabel = t2 === void 0 ? "Minimum" : t2;
|
|
151
|
-
const maxLabel = t3 === void 0 ? "Maximum" : t3;
|
|
152
|
-
const invalidRangeError = t4 === void 0 ? "Minimum cannot be greater than maximum" : t4;
|
|
153
|
-
const hideInnerLabels = t5 === void 0 ? true : t5;
|
|
34
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, inputClassName, minInputClassName, maxInputClassName, value, minValue, maxValue, minPlaceholder = "Min", maxPlaceholder = "Max", minLabel = "Minimum", maxLabel = "Maximum", invalidRangeError = "Minimum cannot be greater than maximum", hideInnerLabels = true, isDirty, autoFocusOnMount, onChange, onMinChange, onMaxChange, onBlur, isClearable: isClearableProps, as: asProp, variant: variantProps, size: sizeProps, hideLabel: hideLabelProps, ...rest } = props;
|
|
154
35
|
const isClearable = isClearableProps ?? ui.input.isClearable;
|
|
155
36
|
const as = asProp ?? ui.input.as;
|
|
156
37
|
const variant = variantProps ?? ui.input.variant;
|
|
157
38
|
const size = sizeProps ?? ui.input.size;
|
|
158
39
|
const hideLabel = hideLabelProps ?? ui.input.hideLabel;
|
|
159
|
-
|
|
160
|
-
if ($[37] !== maxValue || $[38] !== minValue || $[39] !== value) {
|
|
161
|
-
t6 = normalizeRangeValue(value, minValue, maxValue);
|
|
162
|
-
$[37] = maxValue;
|
|
163
|
-
$[38] = minValue;
|
|
164
|
-
$[39] = value;
|
|
165
|
-
$[40] = t6;
|
|
166
|
-
} else t6 = $[40];
|
|
167
|
-
const rangeValue = t6;
|
|
40
|
+
const rangeValue = normalizeRangeValue(value, minValue, maxValue);
|
|
168
41
|
const isEmpty = rangeValue.min === null && rangeValue.max === null;
|
|
169
42
|
const rangeError = rangeValue.min !== null && rangeValue.max !== null && rangeValue.min > rangeValue.max ? invalidRangeError : void 0;
|
|
170
43
|
const effectiveError = error || rangeError;
|
|
171
|
-
|
|
172
|
-
if ($[41] !== isDisabled) {
|
|
173
|
-
t7 = { isDisabled };
|
|
174
|
-
$[41] = isDisabled;
|
|
175
|
-
$[42] = t7;
|
|
176
|
-
} else t7 = $[42];
|
|
177
|
-
const { hoverProps, isHovered } = useHover(t7);
|
|
44
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
178
45
|
const { isFocusVisible } = useFocusVisible();
|
|
179
46
|
const [isFocused, setIsFocused] = useState(false);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
$[50] = isRequired;
|
|
209
|
-
$[51] = label;
|
|
210
|
-
$[52] = rightContent;
|
|
211
|
-
$[53] = t9;
|
|
212
|
-
$[54] = tooltipText;
|
|
213
|
-
$[55] = t10;
|
|
214
|
-
} else t10 = $[55];
|
|
215
|
-
const formFieldProps = t10;
|
|
216
|
-
const t11 = hideLabel || isHeaderHidden;
|
|
217
|
-
let t12;
|
|
218
|
-
if ($[56] !== headerClassName || $[57] !== helperText || $[58] !== isDisabled || $[59] !== isRequired || $[60] !== label || $[61] !== rightContent || $[62] !== t11 || $[63] !== tooltipText) {
|
|
219
|
-
t12 = {
|
|
220
|
-
label,
|
|
221
|
-
tooltipText,
|
|
222
|
-
helperText,
|
|
223
|
-
isRequired,
|
|
224
|
-
rightContent,
|
|
225
|
-
isHeaderHidden: t11,
|
|
226
|
-
isDisabled,
|
|
227
|
-
className: headerClassName
|
|
228
|
-
};
|
|
229
|
-
$[56] = headerClassName;
|
|
230
|
-
$[57] = helperText;
|
|
231
|
-
$[58] = isDisabled;
|
|
232
|
-
$[59] = isRequired;
|
|
233
|
-
$[60] = label;
|
|
234
|
-
$[61] = rightContent;
|
|
235
|
-
$[62] = t11;
|
|
236
|
-
$[63] = tooltipText;
|
|
237
|
-
$[64] = t12;
|
|
238
|
-
} else t12 = $[64];
|
|
239
|
-
const headerProps = t12;
|
|
240
|
-
let t13;
|
|
241
|
-
if ($[65] !== onChange || $[66] !== onMaxChange || $[67] !== onMinChange || $[68] !== rangeValue) {
|
|
242
|
-
t13 = (side, nextValue) => {
|
|
243
|
-
const nextRange = {
|
|
244
|
-
...rangeValue,
|
|
245
|
-
[side]: nextValue
|
|
246
|
-
};
|
|
247
|
-
onChange?.(nextRange);
|
|
248
|
-
if (side === "min") onMinChange?.(nextValue);
|
|
249
|
-
else onMaxChange?.(nextValue);
|
|
250
|
-
};
|
|
251
|
-
$[65] = onChange;
|
|
252
|
-
$[66] = onMaxChange;
|
|
253
|
-
$[67] = onMinChange;
|
|
254
|
-
$[68] = rangeValue;
|
|
255
|
-
$[69] = t13;
|
|
256
|
-
} else t13 = $[69];
|
|
257
|
-
const updateRange = t13;
|
|
258
|
-
let t14;
|
|
259
|
-
if ($[70] !== onBlur || $[71] !== updateRange) {
|
|
260
|
-
t14 = (side_0) => {
|
|
261
|
-
updateRange(side_0, null);
|
|
262
|
-
onBlur?.({ target: { value: "" } });
|
|
47
|
+
const { focusWithinProps } = useFocusWithin({ onFocusWithinChange: setIsFocused });
|
|
48
|
+
const formFieldProps = {
|
|
49
|
+
error: effectiveError,
|
|
50
|
+
label,
|
|
51
|
+
tooltipText,
|
|
52
|
+
helperText,
|
|
53
|
+
isRequired,
|
|
54
|
+
rightContent,
|
|
55
|
+
isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
|
|
56
|
+
hideLabel,
|
|
57
|
+
isDisabled,
|
|
58
|
+
headerClassName,
|
|
59
|
+
errorClassName
|
|
60
|
+
};
|
|
61
|
+
const headerProps = {
|
|
62
|
+
label,
|
|
63
|
+
tooltipText,
|
|
64
|
+
helperText,
|
|
65
|
+
isRequired,
|
|
66
|
+
rightContent,
|
|
67
|
+
isHeaderHidden: hideLabel || isHeaderHidden,
|
|
68
|
+
isDisabled,
|
|
69
|
+
className: headerClassName
|
|
70
|
+
};
|
|
71
|
+
const updateRange = (side, nextValue) => {
|
|
72
|
+
const nextRange = {
|
|
73
|
+
...rangeValue,
|
|
74
|
+
[side]: nextValue
|
|
263
75
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
const clearRangeSide =
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
76
|
+
onChange?.(nextRange);
|
|
77
|
+
if (side === "min") onMinChange?.(nextValue);
|
|
78
|
+
else onMaxChange?.(nextValue);
|
|
79
|
+
};
|
|
80
|
+
const clearRangeSide = (side_0) => {
|
|
81
|
+
updateRange(side_0, null);
|
|
82
|
+
onBlur?.({ target: { value: "" } });
|
|
83
|
+
};
|
|
84
|
+
return /* @__PURE__ */ jsx(NumberRangeField, {
|
|
85
|
+
...rest,
|
|
86
|
+
ref,
|
|
87
|
+
as,
|
|
88
|
+
className,
|
|
89
|
+
inputClassName,
|
|
90
|
+
minInputClassName,
|
|
91
|
+
maxInputClassName,
|
|
92
|
+
inputBaseClassName: inputBaseCva({
|
|
272
93
|
variant,
|
|
273
94
|
as
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
$[74] = inputBaseCva;
|
|
277
|
-
$[75] = variant;
|
|
278
|
-
$[76] = t15;
|
|
279
|
-
} else t15 = $[76];
|
|
280
|
-
let t16;
|
|
281
|
-
if ($[77] !== as || $[78] !== inputSizeCva || $[79] !== size) {
|
|
282
|
-
t16 = inputSizeCva({
|
|
95
|
+
}),
|
|
96
|
+
inputSizeClassName: inputSizeCva({
|
|
283
97
|
size,
|
|
284
98
|
as
|
|
285
|
-
})
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
maxLabel,
|
|
311
|
-
hideInnerLabels,
|
|
312
|
-
isDirty,
|
|
313
|
-
isClearable,
|
|
314
|
-
autoFocusOnMount,
|
|
315
|
-
isDisabled,
|
|
316
|
-
isRequired,
|
|
317
|
-
isEmpty,
|
|
318
|
-
isHovered,
|
|
319
|
-
isFocused,
|
|
320
|
-
isFocusVisible,
|
|
321
|
-
focusWithinProps,
|
|
322
|
-
hoverProps,
|
|
323
|
-
onRangeSideChange: updateRange,
|
|
324
|
-
onRangeSideClear: clearRangeSide,
|
|
325
|
-
onBlur
|
|
326
|
-
});
|
|
327
|
-
$[81] = as;
|
|
328
|
-
$[82] = autoFocusOnMount;
|
|
329
|
-
$[83] = className;
|
|
330
|
-
$[84] = clearRangeSide;
|
|
331
|
-
$[85] = effectiveError;
|
|
332
|
-
$[86] = focusWithinProps;
|
|
333
|
-
$[87] = formFieldProps;
|
|
334
|
-
$[88] = headerProps;
|
|
335
|
-
$[89] = hideInnerLabels;
|
|
336
|
-
$[90] = hoverProps;
|
|
337
|
-
$[91] = inputClassName;
|
|
338
|
-
$[92] = isClearable;
|
|
339
|
-
$[93] = isDirty;
|
|
340
|
-
$[94] = isDisabled;
|
|
341
|
-
$[95] = isEmpty;
|
|
342
|
-
$[96] = isFocusVisible;
|
|
343
|
-
$[97] = isFocused;
|
|
344
|
-
$[98] = isHovered;
|
|
345
|
-
$[99] = isRequired;
|
|
346
|
-
$[100] = maxInputClassName;
|
|
347
|
-
$[101] = maxLabel;
|
|
348
|
-
$[102] = maxPlaceholder;
|
|
349
|
-
$[103] = minInputClassName;
|
|
350
|
-
$[104] = minLabel;
|
|
351
|
-
$[105] = minPlaceholder;
|
|
352
|
-
$[106] = onBlur;
|
|
353
|
-
$[107] = rangeValue;
|
|
354
|
-
$[108] = ref;
|
|
355
|
-
$[109] = rest;
|
|
356
|
-
$[110] = t15;
|
|
357
|
-
$[111] = t16;
|
|
358
|
-
$[112] = updateRange;
|
|
359
|
-
$[113] = t17;
|
|
360
|
-
} else t17 = $[113];
|
|
361
|
-
return t17;
|
|
99
|
+
}),
|
|
100
|
+
formFieldProps,
|
|
101
|
+
headerProps,
|
|
102
|
+
rangeValue,
|
|
103
|
+
effectiveError,
|
|
104
|
+
minPlaceholder,
|
|
105
|
+
maxPlaceholder,
|
|
106
|
+
minLabel,
|
|
107
|
+
maxLabel,
|
|
108
|
+
hideInnerLabels,
|
|
109
|
+
isDirty,
|
|
110
|
+
isClearable,
|
|
111
|
+
autoFocusOnMount,
|
|
112
|
+
isDisabled,
|
|
113
|
+
isRequired,
|
|
114
|
+
isEmpty,
|
|
115
|
+
isHovered,
|
|
116
|
+
isFocused,
|
|
117
|
+
isFocusVisible,
|
|
118
|
+
focusWithinProps,
|
|
119
|
+
hoverProps,
|
|
120
|
+
onRangeSideChange: updateRange,
|
|
121
|
+
onRangeSideClear: clearRangeSide,
|
|
122
|
+
onBlur
|
|
123
|
+
});
|
|
362
124
|
};
|
|
363
125
|
var NumberRangeInputInner = (t0) => {
|
|
364
126
|
const $ = c(5);
|
|
@@ -507,30 +269,30 @@ var NumberRangeInput = (t0) => {
|
|
|
507
269
|
props = $[1];
|
|
508
270
|
renderStaticInput = $[2];
|
|
509
271
|
}
|
|
510
|
-
if ("
|
|
511
|
-
let
|
|
272
|
+
if ("field" in props && props.field) {
|
|
273
|
+
let field;
|
|
512
274
|
let innerProps;
|
|
513
275
|
if ($[3] !== props) {
|
|
514
|
-
({
|
|
276
|
+
({field, ...innerProps} = props);
|
|
515
277
|
$[3] = props;
|
|
516
|
-
$[4] =
|
|
278
|
+
$[4] = field;
|
|
517
279
|
$[5] = innerProps;
|
|
518
280
|
} else {
|
|
519
|
-
|
|
281
|
+
field = $[4];
|
|
520
282
|
innerProps = $[5];
|
|
521
283
|
}
|
|
522
|
-
const controlWithOptions =
|
|
284
|
+
const controlWithOptions = field.form;
|
|
523
285
|
let t1;
|
|
524
286
|
if ($[6] !== controlWithOptions._options?.disabled || $[7] !== innerProps || $[8] !== props.error || $[9] !== props.isDisabled || $[10] !== renderStaticInput) {
|
|
525
287
|
t1 = (t2) => {
|
|
526
|
-
const { field, fieldState: t3 } = t2;
|
|
288
|
+
const { field: field_0, fieldState: t3 } = t2;
|
|
527
289
|
const { error } = t3;
|
|
528
290
|
return /* @__PURE__ */ jsx(NumberRangeInputInner, {
|
|
529
291
|
...innerProps,
|
|
530
|
-
value:
|
|
531
|
-
onChange:
|
|
532
|
-
onBlur:
|
|
533
|
-
isDisabled:
|
|
292
|
+
value: field_0.value ?? EMPTY_RANGE,
|
|
293
|
+
onChange: field_0.onChange,
|
|
294
|
+
onBlur: field_0.onBlur,
|
|
295
|
+
isDisabled: field_0.disabled || !!controlWithOptions._options?.disabled || props.isDisabled,
|
|
534
296
|
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
535
297
|
error: props.error ?? error?.message,
|
|
536
298
|
renderStaticInput
|
|
@@ -544,14 +306,14 @@ var NumberRangeInput = (t0) => {
|
|
|
544
306
|
$[11] = t1;
|
|
545
307
|
} else t1 = $[11];
|
|
546
308
|
let t2;
|
|
547
|
-
if ($[12] !==
|
|
548
|
-
t2 = /* @__PURE__ */ jsx(
|
|
549
|
-
control:
|
|
550
|
-
name:
|
|
309
|
+
if ($[12] !== field.form || $[13] !== field.name || $[14] !== t1) {
|
|
310
|
+
t2 = /* @__PURE__ */ jsx(FieldController, {
|
|
311
|
+
control: field.form,
|
|
312
|
+
name: field.name,
|
|
551
313
|
render: t1
|
|
552
314
|
});
|
|
553
|
-
$[12] =
|
|
554
|
-
$[13] =
|
|
315
|
+
$[12] = field.form;
|
|
316
|
+
$[13] = field.name;
|
|
555
317
|
$[14] = t1;
|
|
556
318
|
$[15] = t2;
|
|
557
319
|
} else t2 = $[15];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldValues } from '
|
|
1
|
+
import { FieldValues } from '../../shared/form.binding';
|
|
2
2
|
import { TextInputProps } from '../TextInput/TextInput';
|
|
3
3
|
import { ControlProps } from '../../shared/form.types';
|
|
4
4
|
export interface PasswordInputProps extends Omit<TextInputProps, "type" | "action" | "trailingIcon" | "unit"> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { AriaTextFieldProps } from 'react-aria';
|
|
3
3
|
import { TextAreaProps as AriaTextAreaProps } from 'react-aria-components';
|
|
4
|
-
import { FieldValues } from '
|
|
4
|
+
import { FieldValues } from '../../shared/form.binding';
|
|
5
5
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
6
6
|
import { ControlProps } from '../../shared/form.types';
|
|
7
7
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
@@ -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 { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
4
5
|
import { FormField } from "../../FormField/FormField.js";
|
|
5
6
|
import { inputSideDefinition, inputSizeDefinition, useInputCva } from "../../shared/input.cva.js";
|
|
@@ -13,7 +14,6 @@ import { useRef } from "react";
|
|
|
13
14
|
import { TextArea } from "react-aria-components";
|
|
14
15
|
import { useTextField } from "react-aria";
|
|
15
16
|
import { mergeRefs } from "@react-aria/utils";
|
|
16
|
-
import { Controller } from "react-hook-form";
|
|
17
17
|
//#region src/components/inputs/Input/TextArea/TextArea.tsx
|
|
18
18
|
var TextAreaBase = (props) => {
|
|
19
19
|
const $ = c(83);
|
|
@@ -282,34 +282,34 @@ var TextAreaBase = (props) => {
|
|
|
282
282
|
};
|
|
283
283
|
var TextArea$1 = (props) => {
|
|
284
284
|
const $ = c(15);
|
|
285
|
-
if ("
|
|
286
|
-
let
|
|
285
|
+
if ("field" in props && props.field) {
|
|
286
|
+
let field;
|
|
287
287
|
let innerProps;
|
|
288
288
|
let ref;
|
|
289
289
|
if ($[0] !== props) {
|
|
290
|
-
({
|
|
290
|
+
({field, ref, ...innerProps} = props);
|
|
291
291
|
$[0] = props;
|
|
292
|
-
$[1] =
|
|
292
|
+
$[1] = field;
|
|
293
293
|
$[2] = innerProps;
|
|
294
294
|
$[3] = ref;
|
|
295
295
|
} else {
|
|
296
|
-
|
|
296
|
+
field = $[1];
|
|
297
297
|
innerProps = $[2];
|
|
298
298
|
ref = $[3];
|
|
299
299
|
}
|
|
300
300
|
let t0;
|
|
301
301
|
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
302
302
|
t0 = (t1) => {
|
|
303
|
-
const { field, fieldState: t2 } = t1;
|
|
303
|
+
const { field: field_0, fieldState: t2 } = t1;
|
|
304
304
|
const { error, isDirty } = t2;
|
|
305
305
|
return /* @__PURE__ */ jsx(TextAreaBase, {
|
|
306
306
|
...innerProps,
|
|
307
|
-
ref: mergeRefs(ref,
|
|
308
|
-
value:
|
|
309
|
-
onChange:
|
|
310
|
-
onBlur:
|
|
307
|
+
ref: mergeRefs(ref, field_0.ref),
|
|
308
|
+
value: field_0.value ?? "",
|
|
309
|
+
onChange: field_0.onChange,
|
|
310
|
+
onBlur: field_0.onBlur,
|
|
311
311
|
isDirty,
|
|
312
|
-
isDisabled:
|
|
312
|
+
isDisabled: field_0.disabled || props.isDisabled,
|
|
313
313
|
error: props.error ?? error?.message
|
|
314
314
|
});
|
|
315
315
|
};
|
|
@@ -320,14 +320,14 @@ var TextArea$1 = (props) => {
|
|
|
320
320
|
$[8] = t0;
|
|
321
321
|
} else t0 = $[8];
|
|
322
322
|
let t1;
|
|
323
|
-
if ($[9] !==
|
|
324
|
-
t1 = /* @__PURE__ */ jsx(
|
|
325
|
-
control:
|
|
326
|
-
name:
|
|
323
|
+
if ($[9] !== field.form || $[10] !== field.name || $[11] !== t0) {
|
|
324
|
+
t1 = /* @__PURE__ */ jsx(FieldController, {
|
|
325
|
+
control: field.form,
|
|
326
|
+
name: field.name,
|
|
327
327
|
render: t0
|
|
328
328
|
});
|
|
329
|
-
$[9] =
|
|
330
|
-
$[10] =
|
|
329
|
+
$[9] = field.form;
|
|
330
|
+
$[10] = field.name;
|
|
331
331
|
$[11] = t0;
|
|
332
332
|
$[12] = t1;
|
|
333
333
|
} else t1 = $[12];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { AriaTextFieldProps } from 'react-aria';
|
|
3
3
|
import { InputProps as AriaInputProps } from 'react-aria-components';
|
|
4
|
-
import { FieldValues } from 'react-hook-form';
|
|
5
4
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
6
5
|
import { InputContentProps } from '../shared/InputContent';
|
|
6
|
+
import { FieldValues } from '../../shared/form.binding';
|
|
7
7
|
import { ControlProps } from '../../shared/form.types';
|
|
8
8
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
9
9
|
type AllowedHTMLInputTypeAttribute = "email" | "hidden" | "tel" | "text" | "url";
|
|
@@ -18,6 +18,6 @@ interface TextInputBaseProps extends FormFieldProps, InputVariantProps, Omit<Inp
|
|
|
18
18
|
export interface TextInputProps extends TextInputBaseProps {
|
|
19
19
|
renderStaticInput?: boolean;
|
|
20
20
|
}
|
|
21
|
-
export type ControlledTextInputProps<TFieldValues extends
|
|
21
|
+
export type ControlledTextInputProps<TFieldValues extends Record<string, unknown>> = ControlProps<TextInputProps, TFieldValues>;
|
|
22
22
|
export declare const TextInput: <TFieldValues extends FieldValues>({ renderStaticInput, ...props }: ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export {};
|