@povio/ui 2.3.0-rc.20 → 2.3.0-rc.21

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.
@@ -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, useWatch } from "react-hook-form";
14
+ import { Controller } from "react-hook-form";
14
15
  //#region src/components/inputs/Selection/Select/Select.tsx
15
- function _Select(props) {
16
- if ("formControl" in props && props.formControl) {
17
- const { formControl, ref, ...innerProps } = props;
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
- const { renderRealInput, replayStaticInputChange, replayStaticInputPress } = useStaticInputHandoff({
40
- inputRef: rootRef,
41
- renderInput,
42
- setRenderInput,
43
- getFocusTarget: (root) => root.querySelector("[data-type='select-trigger'], input, button, [tabindex]")
44
- });
45
- const currentValue = ("formControl" in props && props.formControl ? useWatch({
46
- control: props.formControl.control,
47
- name: props.formControl.name
48
- }) : props.value) ?? props.value;
49
- let isFormControlDisabled = false;
50
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
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
- return /* @__PURE__ */ jsx(_Select, {
148
- ...props,
149
- ref: mergeRefs(props.ref, rootRef)
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.3.0-rc.20",
3
+ "version": "2.3.0-rc.21",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",