@povio/ui 2.3.0-rc.23 → 2.3.0-rc.24
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.
|
@@ -18,9 +18,10 @@ import { Controller } from "react-hook-form";
|
|
|
18
18
|
import { useNumberFieldState } from "react-stately";
|
|
19
19
|
//#region src/components/inputs/Input/NumberInput/NumberInput.tsx
|
|
20
20
|
var NumberInputBase = (props) => {
|
|
21
|
-
const $ = c(
|
|
21
|
+
const $ = c(89);
|
|
22
22
|
const ui = UIConfig.useConfig();
|
|
23
23
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
24
|
+
const hasControlledValue = "value" in props;
|
|
24
25
|
const inputRef = useRef(null);
|
|
25
26
|
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, formatOptions: formatOptionsProp, variant: variantProp, as: asProp, size: sizeProp, hideLabel: hideLabelProp, isClearable: isClearableProp, autoFocusOnMount, ...rest } = props;
|
|
26
27
|
const formatOptions = formatOptionsProp ?? ui.numberInput.formatOptions;
|
|
@@ -33,90 +34,96 @@ var NumberInputBase = (props) => {
|
|
|
33
34
|
const { isFocusVisible } = useFocusVisible();
|
|
34
35
|
const { locale } = useLocale();
|
|
35
36
|
let t0;
|
|
36
|
-
if ($[0] !==
|
|
37
|
-
t0 = (
|
|
38
|
-
$[0] =
|
|
37
|
+
if ($[0] !== onChange) {
|
|
38
|
+
t0 = (nextValue) => onChange?.(Number.isNaN(nextValue) ? null : nextValue);
|
|
39
|
+
$[0] = onChange;
|
|
39
40
|
$[1] = t0;
|
|
40
41
|
} else t0 = $[1];
|
|
42
|
+
let t1;
|
|
43
|
+
if ($[2] !== onBlur) {
|
|
44
|
+
t1 = (e) => onBlur?.({ target: e.target });
|
|
45
|
+
$[2] = onBlur;
|
|
46
|
+
$[3] = t1;
|
|
47
|
+
} else t1 = $[3];
|
|
41
48
|
const numberProps = {
|
|
42
49
|
...rest,
|
|
43
|
-
value: value ?? void 0,
|
|
50
|
+
value: hasControlledValue ? value ?? NaN : void 0,
|
|
44
51
|
label,
|
|
45
52
|
isDisabled,
|
|
46
53
|
isInvalid: !!error,
|
|
47
54
|
isRequired,
|
|
48
|
-
onChange,
|
|
49
|
-
onBlur:
|
|
55
|
+
onChange: t0,
|
|
56
|
+
onBlur: t1,
|
|
50
57
|
locale,
|
|
51
58
|
formatOptions
|
|
52
59
|
};
|
|
53
60
|
const { labelProps, inputProps } = useNumberField(numberProps, useNumberFieldState(numberProps), numberFieldRef);
|
|
54
|
-
let t1;
|
|
55
61
|
let t2;
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
let t3;
|
|
63
|
+
if ($[4] !== autoFocusOnMount || $[5] !== isDisabled) {
|
|
64
|
+
t2 = () => {
|
|
58
65
|
if (!autoFocusOnMount || isDisabled) return;
|
|
59
66
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
60
67
|
};
|
|
61
|
-
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
68
|
+
t3 = [autoFocusOnMount, isDisabled];
|
|
69
|
+
$[4] = autoFocusOnMount;
|
|
70
|
+
$[5] = isDisabled;
|
|
71
|
+
$[6] = t2;
|
|
72
|
+
$[7] = t3;
|
|
66
73
|
} else {
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
t2 = $[6];
|
|
75
|
+
t3 = $[7];
|
|
69
76
|
}
|
|
70
|
-
useEffect(
|
|
71
|
-
const
|
|
72
|
-
let
|
|
73
|
-
if ($[
|
|
74
|
-
|
|
77
|
+
useEffect(t2, t3);
|
|
78
|
+
const t4 = isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
79
|
+
let t5;
|
|
80
|
+
if ($[8] !== error || $[9] !== errorClassName || $[10] !== headerClassName || $[11] !== helperText || $[12] !== hideLabel || $[13] !== isDisabled || $[14] !== isRequired || $[15] !== label || $[16] !== rightContent || $[17] !== t4 || $[18] !== tooltipText) {
|
|
81
|
+
t5 = {
|
|
75
82
|
error,
|
|
76
83
|
label,
|
|
77
84
|
tooltipText,
|
|
78
85
|
helperText,
|
|
79
86
|
isRequired,
|
|
80
87
|
rightContent,
|
|
81
|
-
isHeaderHidden:
|
|
88
|
+
isHeaderHidden: t4,
|
|
82
89
|
hideLabel,
|
|
83
90
|
isDisabled,
|
|
84
91
|
headerClassName,
|
|
85
92
|
errorClassName
|
|
86
93
|
};
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[15] = t3;
|
|
97
|
-
$[16] = tooltipText;
|
|
94
|
+
$[8] = error;
|
|
95
|
+
$[9] = errorClassName;
|
|
96
|
+
$[10] = headerClassName;
|
|
97
|
+
$[11] = helperText;
|
|
98
|
+
$[12] = hideLabel;
|
|
99
|
+
$[13] = isDisabled;
|
|
100
|
+
$[14] = isRequired;
|
|
101
|
+
$[15] = label;
|
|
102
|
+
$[16] = rightContent;
|
|
98
103
|
$[17] = t4;
|
|
99
|
-
|
|
100
|
-
const formFieldProps = t4;
|
|
101
|
-
let t5;
|
|
102
|
-
if ($[18] !== onBlur) {
|
|
103
|
-
t5 = (e_0) => {
|
|
104
|
-
const target = numberFieldRef.current ?? e_0?.target;
|
|
105
|
-
onBlur?.({ target });
|
|
106
|
-
};
|
|
107
|
-
$[18] = onBlur;
|
|
104
|
+
$[18] = tooltipText;
|
|
108
105
|
$[19] = t5;
|
|
109
106
|
} else t5 = $[19];
|
|
110
|
-
const
|
|
107
|
+
const formFieldProps = t5;
|
|
111
108
|
let t6;
|
|
112
|
-
if ($[20] !==
|
|
113
|
-
t6 = (
|
|
114
|
-
|
|
109
|
+
if ($[20] !== onBlur) {
|
|
110
|
+
t6 = (e_0) => {
|
|
111
|
+
const target = numberFieldRef.current ?? e_0?.target;
|
|
112
|
+
onBlur?.({ target });
|
|
113
|
+
};
|
|
114
|
+
$[20] = onBlur;
|
|
115
115
|
$[21] = t6;
|
|
116
116
|
} else t6 = $[21];
|
|
117
|
+
const handleInputBlur = t6;
|
|
117
118
|
let t7;
|
|
118
|
-
if ($[22] !==
|
|
119
|
-
t7 =
|
|
119
|
+
if ($[22] !== onChange) {
|
|
120
|
+
t7 = (val) => onChange?.(val === "" ? null : Number(val));
|
|
121
|
+
$[22] = onChange;
|
|
122
|
+
$[23] = t7;
|
|
123
|
+
} else t7 = $[23];
|
|
124
|
+
let t8;
|
|
125
|
+
if ($[24] !== action || $[25] !== handleInputBlur || $[26] !== isClearable || $[27] !== isDisabled || $[28] !== isLoading || $[29] !== leadingIcon || $[30] !== t7 || $[31] !== trailingIcon || $[32] !== unit || $[33] !== value) {
|
|
126
|
+
t8 = {
|
|
120
127
|
unit,
|
|
121
128
|
isLoading,
|
|
122
129
|
isDisabled,
|
|
@@ -125,185 +132,185 @@ var NumberInputBase = (props) => {
|
|
|
125
132
|
trailingIcon,
|
|
126
133
|
isClearable,
|
|
127
134
|
value,
|
|
128
|
-
onChange:
|
|
135
|
+
onChange: t7,
|
|
129
136
|
onBlur: handleInputBlur
|
|
130
137
|
};
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
} else
|
|
143
|
-
const inputContentProps =
|
|
144
|
-
const
|
|
145
|
-
let
|
|
146
|
-
if ($[
|
|
147
|
-
|
|
138
|
+
$[24] = action;
|
|
139
|
+
$[25] = handleInputBlur;
|
|
140
|
+
$[26] = isClearable;
|
|
141
|
+
$[27] = isDisabled;
|
|
142
|
+
$[28] = isLoading;
|
|
143
|
+
$[29] = leadingIcon;
|
|
144
|
+
$[30] = t7;
|
|
145
|
+
$[31] = trailingIcon;
|
|
146
|
+
$[32] = unit;
|
|
147
|
+
$[33] = value;
|
|
148
|
+
$[34] = t8;
|
|
149
|
+
} else t8 = $[34];
|
|
150
|
+
const inputContentProps = t8;
|
|
151
|
+
const t9 = hideLabel || isHeaderHidden;
|
|
152
|
+
let t10;
|
|
153
|
+
if ($[35] !== headerClassName || $[36] !== helperText || $[37] !== isDisabled || $[38] !== isRequired || $[39] !== label || $[40] !== labelProps || $[41] !== rightContent || $[42] !== t9 || $[43] !== tooltipText) {
|
|
154
|
+
t10 = {
|
|
148
155
|
label,
|
|
149
156
|
tooltipText,
|
|
150
157
|
helperText,
|
|
151
158
|
isRequired,
|
|
152
159
|
rightContent,
|
|
153
|
-
isHeaderHidden:
|
|
160
|
+
isHeaderHidden: t9,
|
|
154
161
|
isDisabled,
|
|
155
162
|
className: headerClassName,
|
|
156
163
|
labelProps
|
|
157
164
|
};
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[40] = t8;
|
|
166
|
-
$[41] = tooltipText;
|
|
165
|
+
$[35] = headerClassName;
|
|
166
|
+
$[36] = helperText;
|
|
167
|
+
$[37] = isDisabled;
|
|
168
|
+
$[38] = isRequired;
|
|
169
|
+
$[39] = label;
|
|
170
|
+
$[40] = labelProps;
|
|
171
|
+
$[41] = rightContent;
|
|
167
172
|
$[42] = t9;
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
$[43] = tooltipText;
|
|
174
|
+
$[44] = t10;
|
|
175
|
+
} else t10 = $[44];
|
|
176
|
+
const headerProps = t10;
|
|
170
177
|
const dataIsDisabled = isDisabled || void 0;
|
|
171
178
|
const T0 = TooltipWrapper;
|
|
172
|
-
const
|
|
179
|
+
const t11 = as === "inline" ? -1 : void 0;
|
|
173
180
|
const T1 = FormField;
|
|
174
|
-
let
|
|
175
|
-
if ($[
|
|
176
|
-
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
} else
|
|
180
|
-
const
|
|
181
|
-
const
|
|
181
|
+
let t12;
|
|
182
|
+
if ($[45] !== className) {
|
|
183
|
+
t12 = clsx("group w-full", className);
|
|
184
|
+
$[45] = className;
|
|
185
|
+
$[46] = t12;
|
|
186
|
+
} else t12 = $[46];
|
|
187
|
+
const t13 = as === "inline" ? -1 : void 0;
|
|
188
|
+
const t14 = clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
|
|
182
189
|
variant,
|
|
183
190
|
as,
|
|
184
191
|
...rest
|
|
185
192
|
}), inputClassName);
|
|
186
|
-
let
|
|
187
|
-
if ($[
|
|
188
|
-
|
|
189
|
-
$[
|
|
190
|
-
} else
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
let
|
|
194
|
-
if ($[
|
|
195
|
-
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
} else
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
const
|
|
204
|
-
let
|
|
205
|
-
if ($[
|
|
206
|
-
|
|
193
|
+
let t15;
|
|
194
|
+
if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
|
|
195
|
+
t15 = () => inputRef.current?.focus();
|
|
196
|
+
$[47] = t15;
|
|
197
|
+
} else t15 = $[47];
|
|
198
|
+
const t16 = value === null || value === void 0 || void 0;
|
|
199
|
+
const t17 = isRequired || void 0;
|
|
200
|
+
let t18;
|
|
201
|
+
if ($[48] !== ref) {
|
|
202
|
+
t18 = mergeRefs(ref, inputRef);
|
|
203
|
+
$[48] = ref;
|
|
204
|
+
$[49] = t18;
|
|
205
|
+
} else t18 = $[49];
|
|
206
|
+
const t19 = isDirty || void 0;
|
|
207
|
+
const t20 = isRequired || void 0;
|
|
208
|
+
const t21 = value === null || value === void 0 || void 0;
|
|
209
|
+
const t22 = !("" + value === "" || value === null || value === void 0) || void 0;
|
|
210
|
+
const t23 = as === "floating" ? "\xA0" : inputProps.placeholder;
|
|
211
|
+
let t24;
|
|
212
|
+
if ($[50] !== inputProps || $[51] !== isFocusVisible) {
|
|
213
|
+
t24 = (e_1) => {
|
|
207
214
|
inputProps.onFocus?.(e_1);
|
|
208
215
|
if (isFocusVisible) e_1.target.select();
|
|
209
216
|
};
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
} else
|
|
214
|
-
let
|
|
215
|
-
if ($[
|
|
216
|
-
|
|
217
|
+
$[50] = inputProps;
|
|
218
|
+
$[51] = isFocusVisible;
|
|
219
|
+
$[52] = t24;
|
|
220
|
+
} else t24 = $[52];
|
|
221
|
+
let t25;
|
|
222
|
+
if ($[53] !== dataIsDisabled || $[54] !== inputProps || $[55] !== t18 || $[56] !== t19 || $[57] !== t20 || $[58] !== t21 || $[59] !== t22 || $[60] !== t23 || $[61] !== t24) {
|
|
223
|
+
t25 = /* @__PURE__ */ jsx(Input, {
|
|
217
224
|
...inputProps,
|
|
218
|
-
ref:
|
|
219
|
-
"data-is-dirty":
|
|
220
|
-
"data-is-required":
|
|
221
|
-
"data-is-empty":
|
|
222
|
-
"data-is-filled":
|
|
225
|
+
ref: t18,
|
|
226
|
+
"data-is-dirty": t19,
|
|
227
|
+
"data-is-required": t20,
|
|
228
|
+
"data-is-empty": t21,
|
|
229
|
+
"data-is-filled": t22,
|
|
223
230
|
"data-is-disabled": dataIsDisabled,
|
|
224
|
-
placeholder:
|
|
231
|
+
placeholder: t23,
|
|
225
232
|
className: "w-full bg-transparent outline-none",
|
|
226
|
-
onFocus:
|
|
233
|
+
onFocus: t24
|
|
227
234
|
});
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
} else
|
|
239
|
-
let
|
|
240
|
-
if ($[
|
|
241
|
-
|
|
235
|
+
$[53] = dataIsDisabled;
|
|
236
|
+
$[54] = inputProps;
|
|
237
|
+
$[55] = t18;
|
|
238
|
+
$[56] = t19;
|
|
239
|
+
$[57] = t20;
|
|
240
|
+
$[58] = t21;
|
|
241
|
+
$[59] = t22;
|
|
242
|
+
$[60] = t23;
|
|
243
|
+
$[61] = t24;
|
|
244
|
+
$[62] = t25;
|
|
245
|
+
} else t25 = $[62];
|
|
246
|
+
let t26;
|
|
247
|
+
if ($[63] !== as || $[64] !== headerProps || $[65] !== inputContentProps || $[66] !== size || $[67] !== t25) {
|
|
248
|
+
t26 = /* @__PURE__ */ jsx(InputContent, {
|
|
242
249
|
...inputContentProps,
|
|
243
250
|
headerProps,
|
|
244
251
|
as,
|
|
245
252
|
size,
|
|
246
|
-
children: t24
|
|
247
|
-
});
|
|
248
|
-
$[61] = as;
|
|
249
|
-
$[62] = headerProps;
|
|
250
|
-
$[63] = inputContentProps;
|
|
251
|
-
$[64] = size;
|
|
252
|
-
$[65] = t24;
|
|
253
|
-
$[66] = t25;
|
|
254
|
-
} else t25 = $[66];
|
|
255
|
-
let t26;
|
|
256
|
-
if ($[67] !== dataIsDisabled || $[68] !== t13 || $[69] !== t15 || $[70] !== t16 || $[71] !== t25) {
|
|
257
|
-
t26 = /* @__PURE__ */ jsx("div", {
|
|
258
|
-
className: t13,
|
|
259
|
-
onClick: t14,
|
|
260
|
-
"data-is-empty": t15,
|
|
261
|
-
"data-is-required": t16,
|
|
262
|
-
"data-is-disabled": dataIsDisabled,
|
|
263
253
|
children: t25
|
|
264
254
|
});
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
} else t26 = $[
|
|
255
|
+
$[63] = as;
|
|
256
|
+
$[64] = headerProps;
|
|
257
|
+
$[65] = inputContentProps;
|
|
258
|
+
$[66] = size;
|
|
259
|
+
$[67] = t25;
|
|
260
|
+
$[68] = t26;
|
|
261
|
+
} else t26 = $[68];
|
|
272
262
|
let t27;
|
|
273
|
-
if ($[
|
|
274
|
-
t27 = /* @__PURE__ */ jsx(
|
|
263
|
+
if ($[69] !== dataIsDisabled || $[70] !== t14 || $[71] !== t16 || $[72] !== t17 || $[73] !== t26) {
|
|
264
|
+
t27 = /* @__PURE__ */ jsx("div", {
|
|
265
|
+
className: t14,
|
|
266
|
+
onClick: t15,
|
|
267
|
+
"data-is-empty": t16,
|
|
268
|
+
"data-is-required": t17,
|
|
269
|
+
"data-is-disabled": dataIsDisabled,
|
|
270
|
+
children: t26
|
|
271
|
+
});
|
|
272
|
+
$[69] = dataIsDisabled;
|
|
273
|
+
$[70] = t14;
|
|
274
|
+
$[71] = t16;
|
|
275
|
+
$[72] = t17;
|
|
276
|
+
$[73] = t26;
|
|
277
|
+
$[74] = t27;
|
|
278
|
+
} else t27 = $[74];
|
|
279
|
+
let t28;
|
|
280
|
+
if ($[75] !== T1 || $[76] !== as || $[77] !== formFieldProps || $[78] !== labelProps || $[79] !== t12 || $[80] !== t13 || $[81] !== t27) {
|
|
281
|
+
t28 = /* @__PURE__ */ jsx(T1, {
|
|
275
282
|
...formFieldProps,
|
|
276
283
|
as,
|
|
277
284
|
labelProps,
|
|
278
|
-
className:
|
|
279
|
-
tabIndex:
|
|
280
|
-
children:
|
|
285
|
+
className: t12,
|
|
286
|
+
tabIndex: t13,
|
|
287
|
+
children: t27
|
|
281
288
|
});
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
} else
|
|
291
|
-
let
|
|
292
|
-
if ($[
|
|
293
|
-
|
|
289
|
+
$[75] = T1;
|
|
290
|
+
$[76] = as;
|
|
291
|
+
$[77] = formFieldProps;
|
|
292
|
+
$[78] = labelProps;
|
|
293
|
+
$[79] = t12;
|
|
294
|
+
$[80] = t13;
|
|
295
|
+
$[81] = t27;
|
|
296
|
+
$[82] = t28;
|
|
297
|
+
} else t28 = $[82];
|
|
298
|
+
let t29;
|
|
299
|
+
if ($[83] !== T0 || $[84] !== as || $[85] !== error || $[86] !== t11 || $[87] !== t28) {
|
|
300
|
+
t29 = /* @__PURE__ */ jsx(T0, {
|
|
294
301
|
as,
|
|
295
302
|
error,
|
|
296
|
-
triggerTabIndex:
|
|
297
|
-
children:
|
|
303
|
+
triggerTabIndex: t11,
|
|
304
|
+
children: t28
|
|
298
305
|
});
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
} else
|
|
306
|
-
return
|
|
306
|
+
$[83] = T0;
|
|
307
|
+
$[84] = as;
|
|
308
|
+
$[85] = error;
|
|
309
|
+
$[86] = t11;
|
|
310
|
+
$[87] = t28;
|
|
311
|
+
$[88] = t29;
|
|
312
|
+
} else t29 = $[88];
|
|
313
|
+
return t29;
|
|
307
314
|
};
|
|
308
315
|
var NumberInputInner = (t0) => {
|
|
309
316
|
const $ = c(9);
|