@povio/ui 2.3.0-rc.20 → 2.3.0-rc.22
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/inputs/DateTime/DatePicker/DatePicker.js +218 -62
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +214 -70
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +134 -43
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +123 -40
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +125 -39
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +142 -69
- package/dist/components/inputs/Input/TextInput/TextInput.js +125 -39
- package/dist/components/inputs/Inputs/InputItem.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +135 -47
- package/dist/components/inputs/Selection/Select/Select.js +116 -38
- package/package.json +1 -1
|
@@ -6,48 +6,32 @@ import { selectInputTagsContentWrapperCva } from "../shared/selectInput.cva.js";
|
|
|
6
6
|
import { SelectBase } from "../shared/SelectBase.js";
|
|
7
7
|
import { StaticSelectTrailingContent } from "../shared/StaticSelectTrailingContent.js";
|
|
8
8
|
import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
|
|
9
|
+
import { c } from "react/compiler-runtime";
|
|
9
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { clsx } from "clsx";
|
|
11
12
|
import { useRef, useState } from "react";
|
|
12
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import { Controller
|
|
14
|
+
import { Controller } from "react-hook-form";
|
|
14
15
|
//#region src/components/inputs/Selection/Select/Select.tsx
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return /* @__PURE__ */ jsx(Controller, {
|
|
19
|
-
control: formControl.control,
|
|
20
|
-
name: formControl.name,
|
|
21
|
-
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(SelectBase, {
|
|
22
|
-
...innerProps,
|
|
23
|
-
ref: mergeRefs(ref, field.ref),
|
|
24
|
-
value: field.value,
|
|
25
|
-
onChange: field.onChange,
|
|
26
|
-
onBlur: field.onBlur,
|
|
27
|
-
isDirty,
|
|
28
|
-
isDisabled: field.disabled || props.isDisabled,
|
|
29
|
-
error: props.error ?? error?.message
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return /* @__PURE__ */ jsx(SelectBase, { ...props });
|
|
34
|
-
}
|
|
35
|
-
function Select({ renderStaticInput, ...props }) {
|
|
16
|
+
function SelectInner(t0) {
|
|
17
|
+
const $ = c(6);
|
|
18
|
+
const { renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
36
19
|
const ui = UIConfig.useConfig();
|
|
37
20
|
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
38
21
|
const rootRef = useRef(null);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
22
|
+
let t1;
|
|
23
|
+
if ($[0] !== renderInput) {
|
|
24
|
+
t1 = {
|
|
25
|
+
inputRef: rootRef,
|
|
26
|
+
renderInput,
|
|
27
|
+
setRenderInput,
|
|
28
|
+
getFocusTarget: _temp
|
|
29
|
+
};
|
|
30
|
+
$[0] = renderInput;
|
|
31
|
+
$[1] = t1;
|
|
32
|
+
} else t1 = $[1];
|
|
33
|
+
const { renderRealInput, replayStaticInputChange, replayStaticInputPress } = useStaticInputHandoff(t1);
|
|
34
|
+
const currentValue = props.value;
|
|
51
35
|
if (!renderInput && props.selectionMode !== "multiple" && !!props.showSelectionContent && currentValue != null) setRenderInput(true);
|
|
52
36
|
if (!renderInput && !!props.customTrigger) setRenderInput(true);
|
|
53
37
|
if (!renderInput) {
|
|
@@ -144,10 +128,104 @@ function Select({ renderStaticInput, ...props }) {
|
|
|
144
128
|
})] })
|
|
145
129
|
});
|
|
146
130
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
131
|
+
const T0 = SelectBase;
|
|
132
|
+
const t2 = mergeRefs(props.ref, rootRef);
|
|
133
|
+
let t3;
|
|
134
|
+
if ($[2] !== T0 || $[3] !== props || $[4] !== t2) {
|
|
135
|
+
t3 = /* @__PURE__ */ jsx(T0, {
|
|
136
|
+
...props,
|
|
137
|
+
ref: t2
|
|
138
|
+
});
|
|
139
|
+
$[2] = T0;
|
|
140
|
+
$[3] = props;
|
|
141
|
+
$[4] = t2;
|
|
142
|
+
$[5] = t3;
|
|
143
|
+
} else t3 = $[5];
|
|
144
|
+
return t3;
|
|
145
|
+
}
|
|
146
|
+
function _temp(root) {
|
|
147
|
+
return root.querySelector("[data-type='select-trigger'], input, button, [tabindex]");
|
|
148
|
+
}
|
|
149
|
+
function Select(t0) {
|
|
150
|
+
const $ = c(21);
|
|
151
|
+
let props;
|
|
152
|
+
let renderStaticInput;
|
|
153
|
+
if ($[0] !== t0) {
|
|
154
|
+
({renderStaticInput, ...props} = t0);
|
|
155
|
+
$[0] = t0;
|
|
156
|
+
$[1] = props;
|
|
157
|
+
$[2] = renderStaticInput;
|
|
158
|
+
} else {
|
|
159
|
+
props = $[1];
|
|
160
|
+
renderStaticInput = $[2];
|
|
161
|
+
}
|
|
162
|
+
if ("formControl" in props && props.formControl) {
|
|
163
|
+
let formControl;
|
|
164
|
+
let innerProps;
|
|
165
|
+
let ref;
|
|
166
|
+
if ($[3] !== props) {
|
|
167
|
+
({formControl, ref, ...innerProps} = props);
|
|
168
|
+
$[3] = props;
|
|
169
|
+
$[4] = formControl;
|
|
170
|
+
$[5] = innerProps;
|
|
171
|
+
$[6] = ref;
|
|
172
|
+
} else {
|
|
173
|
+
formControl = $[4];
|
|
174
|
+
innerProps = $[5];
|
|
175
|
+
ref = $[6];
|
|
176
|
+
}
|
|
177
|
+
const controlWithOptions = formControl.control;
|
|
178
|
+
let t1;
|
|
179
|
+
if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
|
|
180
|
+
t1 = (t2) => {
|
|
181
|
+
const { field, fieldState: t3 } = t2;
|
|
182
|
+
const { error, isDirty } = t3;
|
|
183
|
+
return /* @__PURE__ */ jsx(SelectInner, {
|
|
184
|
+
...innerProps,
|
|
185
|
+
ref: mergeRefs(ref, field.ref),
|
|
186
|
+
value: field.value,
|
|
187
|
+
onChange: field.onChange,
|
|
188
|
+
onBlur: field.onBlur,
|
|
189
|
+
isDirty,
|
|
190
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
191
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
192
|
+
error: props.error ?? error?.message,
|
|
193
|
+
renderStaticInput
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
$[7] = controlWithOptions._options?.disabled;
|
|
197
|
+
$[8] = innerProps;
|
|
198
|
+
$[9] = props.error;
|
|
199
|
+
$[10] = props.isDisabled;
|
|
200
|
+
$[11] = ref;
|
|
201
|
+
$[12] = renderStaticInput;
|
|
202
|
+
$[13] = t1;
|
|
203
|
+
} else t1 = $[13];
|
|
204
|
+
let t2;
|
|
205
|
+
if ($[14] !== formControl.control || $[15] !== formControl.name || $[16] !== t1) {
|
|
206
|
+
t2 = /* @__PURE__ */ jsx(Controller, {
|
|
207
|
+
control: formControl.control,
|
|
208
|
+
name: formControl.name,
|
|
209
|
+
render: t1
|
|
210
|
+
});
|
|
211
|
+
$[14] = formControl.control;
|
|
212
|
+
$[15] = formControl.name;
|
|
213
|
+
$[16] = t1;
|
|
214
|
+
$[17] = t2;
|
|
215
|
+
} else t2 = $[17];
|
|
216
|
+
return t2;
|
|
217
|
+
}
|
|
218
|
+
let t1;
|
|
219
|
+
if ($[18] !== props || $[19] !== renderStaticInput) {
|
|
220
|
+
t1 = /* @__PURE__ */ jsx(SelectInner, {
|
|
221
|
+
...props,
|
|
222
|
+
renderStaticInput
|
|
223
|
+
});
|
|
224
|
+
$[18] = props;
|
|
225
|
+
$[19] = renderStaticInput;
|
|
226
|
+
$[20] = t1;
|
|
227
|
+
} else t1 = $[20];
|
|
228
|
+
return t1;
|
|
151
229
|
}
|
|
152
230
|
//#endregion
|
|
153
231
|
export { Select };
|