@react-fabric/form 1.0.0-beta.3 → 1.0.0-beta.30

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.
Files changed (66) hide show
  1. package/dist/cjs/form/Form.js +12 -5
  2. package/dist/cjs/input/ArrayInput.js +35 -23
  3. package/dist/cjs/input/ColorInput.js +68 -26
  4. package/dist/cjs/input/ColorPicker.js +0 -33
  5. package/dist/cjs/input/ColorPicker.module.css +1 -1
  6. package/dist/cjs/input/Field.js +3 -2
  7. package/dist/cjs/input/File.module.css +1 -1
  8. package/dist/cjs/input/Hidden.js +3 -1
  9. package/dist/cjs/input/RadioGroup.js +6 -3
  10. package/dist/cjs/input/Switch.js +25 -4
  11. package/dist/cjs/input/Textarea.js +6 -2
  12. package/dist/cjs/internal/FieldWrapper.js +3 -1
  13. package/dist/cjs/internal/InputWrapper.js +7 -10
  14. package/dist/cjs/select/List.js +41 -20
  15. package/dist/cjs/select/Options.js +2 -2
  16. package/dist/cjs/select/Select.js +10 -7
  17. package/dist/cjs/select/useSelect.js +12 -7
  18. package/dist/cjs/utils/getColor.js +6 -0
  19. package/dist/esm/form/Form.js +13 -6
  20. package/dist/esm/input/ArrayInput.js +37 -25
  21. package/dist/esm/input/ColorInput.js +70 -28
  22. package/dist/esm/input/ColorPicker.js +0 -33
  23. package/dist/esm/input/ColorPicker.module.css +1 -1
  24. package/dist/esm/input/Field.js +4 -3
  25. package/dist/esm/input/File.module.css +1 -1
  26. package/dist/esm/input/Hidden.js +3 -1
  27. package/dist/esm/input/RadioGroup.js +7 -4
  28. package/dist/esm/input/Switch.js +27 -6
  29. package/dist/esm/input/Textarea.js +6 -2
  30. package/dist/esm/internal/FieldWrapper.js +3 -1
  31. package/dist/esm/internal/InputWrapper.js +7 -10
  32. package/dist/esm/select/List.js +42 -21
  33. package/dist/esm/select/Options.js +2 -2
  34. package/dist/esm/select/Select.js +10 -7
  35. package/dist/esm/select/useSelect.js +13 -8
  36. package/dist/esm/utils/getColor.js +6 -1
  37. package/dist/types/input/ArrayInput.d.ts +20 -3
  38. package/dist/types/input/RadioGroup.d.ts +18 -2
  39. package/dist/types/input/Switch.d.ts +7 -3
  40. package/dist/types/input/Textarea.d.ts +5 -1
  41. package/dist/types/internal/InputWrapper.d.ts +1 -1
  42. package/dist/types/select/List.d.ts +1 -1
  43. package/dist/types/types/index.d.ts +2 -2
  44. package/package.json +7 -7
  45. package/src/form/Form.tsx +13 -5
  46. package/src/input/ArrayInput.tsx +78 -40
  47. package/src/input/ColorInput.tsx +96 -31
  48. package/src/input/ColorPicker.module.css +19 -5
  49. package/src/input/ColorPicker.tsx +0 -33
  50. package/src/input/Field.tsx +6 -8
  51. package/src/input/File.module.css +18 -4
  52. package/src/input/Hidden.tsx +3 -1
  53. package/src/input/Input.tsx +1 -1
  54. package/src/input/Number.tsx +1 -1
  55. package/src/input/Password.tsx +1 -1
  56. package/src/input/RadioGroup.tsx +27 -4
  57. package/src/input/Search.tsx +1 -1
  58. package/src/input/Switch.tsx +40 -6
  59. package/src/input/Textarea.tsx +10 -2
  60. package/src/internal/FieldWrapper.tsx +2 -1
  61. package/src/internal/InputWrapper.tsx +8 -11
  62. package/src/select/List.tsx +34 -7
  63. package/src/select/Options.tsx +1 -1
  64. package/src/select/Select.tsx +4 -1
  65. package/src/select/useSelect.tsx +27 -18
  66. package/src/types/index.ts +5 -2
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { type RefProp } from "@react-fabric/core/dist/types/types";
3
- export interface InputProps<V = string> {
2
+ import { type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
3
+ export interface InputProps<V = string> extends TestProps {
4
4
  /**
5
5
  * value
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/form",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.30",
4
4
  "description": "RUF: Form package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -37,10 +37,10 @@
37
37
  "@dnd-kit/modifiers": "^7.0.0",
38
38
  "@dnd-kit/sortable": "^8.0.0",
39
39
  "@dnd-kit/utilities": "^3.2.2",
40
- "@floating-ui/react": "0.26.24",
40
+ "@floating-ui/react": "^0.26.24",
41
41
  "@hookform/resolvers": "^3.9.0",
42
- "@react-fabric/core": "^1.0.0-beta.3",
43
- "@react-fabric/utilities": "^1.0.0-beta.1",
42
+ "@react-fabric/core": "^1.0.0-beta.30",
43
+ "@react-fabric/utilities": "^1.0.0-beta.30",
44
44
  "classnames": "^2.5.1",
45
45
  "color": "^4.2.3",
46
46
  "react-color": "^2.19.3",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "peerDependencies": {
50
50
  "i18next": "^23.15.1",
51
- "react": ">=18.0.0 <20.0.0",
52
- "react-dom": ">=18.0.0 <20.0.0",
51
+ "react": "^19.0.0",
52
+ "react-dom": "^19.0.0",
53
53
  "react-i18next": "^15.0.2"
54
54
  },
55
55
  "devDependencies": {
@@ -60,5 +60,5 @@
60
60
  "node": ">=18.12.0",
61
61
  "npm": ">=8.19.0"
62
62
  },
63
- "gitHead": "2ce2a968f48d6ffc338f5da3a0cf67232d0c6864"
63
+ "gitHead": "5b10298b7627c2e56bcccf18100b6d85a02c9b06"
64
64
  }
package/src/form/Form.tsx CHANGED
@@ -89,6 +89,10 @@ export const Form = <K extends KeyValue>({
89
89
  defaultValues: defaultValues as DefaultValues<K>,
90
90
  });
91
91
 
92
+ useEffect(() => {
93
+ form.reset();
94
+ }, []);
95
+
92
96
  const [, startTransition] = useTransition();
93
97
  const changeHandler = useDebounce(onChange, [onChange]);
94
98
  useEffect(() => {
@@ -118,12 +122,16 @@ export const Form = <K extends KeyValue>({
118
122
  submit: () => form.handleSubmit(onSubmit),
119
123
  validate: async () => await form.trigger(),
120
124
  getValues: () => form.getValues(),
121
- setValues: (v) => form.reset(v),
125
+ setValues: (v) => setTimeout(() => form.reset(v), 50),
122
126
  setValue: (k, v) =>
123
- form.setValue(k as AnyObject, v, {
124
- shouldDirty: false,
125
- shouldTouch: false,
126
- }),
127
+ setTimeout(
128
+ () =>
129
+ form.setValue(k as AnyObject, v, {
130
+ shouldDirty: false,
131
+ shouldTouch: false,
132
+ }),
133
+ 50,
134
+ ),
127
135
  }),
128
136
  [onSubmit, form, form.formState, defaultValues],
129
137
  );
@@ -23,18 +23,23 @@
23
23
 
24
24
  import { DndContext, type DragEndEvent } from "@dnd-kit/core";
25
25
  import { SortableContext, useSortable } from "@dnd-kit/sortable";
26
- import { Button, CoreIcons, Icon, Tooltip } from "@react-fabric/core";
26
+ import {
27
+ Button,
28
+ cloneChildren,
29
+ CoreIcons,
30
+ Icon,
31
+ Tooltip,
32
+ } from "@react-fabric/core";
27
33
  import { isString } from "@react-fabric/utilities";
28
34
  import classNames from "classnames";
29
35
  import {
30
- Children,
31
36
  cloneElement,
32
37
  useCallback,
33
38
  useImperativeHandle,
34
39
  useMemo,
35
40
  type PropsWithChildren,
36
41
  type ReactNode,
37
- type RefObject,
42
+ type Ref,
38
43
  } from "react";
39
44
  import { useFieldArray, useFormContext } from "react-hook-form";
40
45
  import { useTranslation } from "react-i18next";
@@ -77,6 +82,10 @@ export interface ArrayInputProps {
77
82
  * minimum required length
78
83
  */
79
84
  minItems?: number;
85
+ /**
86
+ * maximum length
87
+ */
88
+ maxItems?: number;
80
89
  /**
81
90
  * field name to focus on add
82
91
  */
@@ -92,11 +101,12 @@ export interface ArrayInputProps {
92
101
  * add item button label
93
102
  */
94
103
  addLabel?: string;
104
+ buttonPosition?: "top" | "bottom" | "both";
95
105
  /**
96
106
  * fixed length list
97
107
  */
98
108
  fixedList?: boolean;
99
- arrayRef?: RefObject<{
109
+ arrayRef?: Ref<{
100
110
  addItem: (item: AnyObject) => void;
101
111
  removeItem: (idx: number) => void;
102
112
  }>;
@@ -104,6 +114,19 @@ export interface ArrayInputProps {
104
114
  * Add item
105
115
  */
106
116
  onAdd?: () => AnyObject;
117
+
118
+ /**
119
+ * field width
120
+ */
121
+ width?: number | string;
122
+ /**
123
+ * inline label and input
124
+ */
125
+ inline?: boolean;
126
+ /**
127
+ * label width for inline
128
+ */
129
+ labelWidth?: string;
107
130
  }
108
131
 
109
132
  export const ArrayInput = ({
@@ -112,12 +135,14 @@ export const ArrayInput = ({
112
135
  addLabel,
113
136
  fixedList,
114
137
  focusName = "",
138
+ buttonPosition = "bottom",
115
139
  onAdd,
116
140
  arrayRef,
117
141
  enableSorting,
118
142
  disabled = false,
119
143
  readOnly = false,
120
144
  minItems = 0,
145
+ maxItems = Number.MAX_SAFE_INTEGER,
121
146
  ...rest
122
147
  }: ArrayInputProps) => {
123
148
  const { t } = useTranslation("form");
@@ -227,9 +252,55 @@ export const ArrayInput = ({
227
252
  // @ts-expect-error ignore
228
253
  SortableItem.displayName = "SortableItem";
229
254
 
255
+ const addButton = useMemo(
256
+ () => (
257
+ <div className="flex justify-end">
258
+ <Tooltip
259
+ color="danger"
260
+ content={
261
+ isString(error)
262
+ ? `${error}`
263
+ : (t(
264
+ error?.key,
265
+ error?.values
266
+ ? {
267
+ ...error?.values,
268
+ label: t(
269
+ error.values?.label ?? "form:badkey",
270
+ error.values?.path,
271
+ ),
272
+ }
273
+ : {},
274
+ ) as string)
275
+ }
276
+ >
277
+ <Button
278
+ size="sm"
279
+ aria-label="Add item"
280
+ icon={CoreIcons.insert}
281
+ onClick={() => handleAdd(onAdd?.())}
282
+ data-invalid={!!error}
283
+ disabled={!!disabled || readOnly || fields.length > maxItems}
284
+ className={classNames(classes.addButton, "me-10")}
285
+ >
286
+ {addLabel ?? t("addArray")}
287
+ </Button>
288
+ </Tooltip>
289
+ </div>
290
+ ),
291
+ [error, fields, handleAdd, disabled, readOnly, addLabel, maxItems],
292
+ );
293
+
230
294
  return (
231
295
  <div className={classes.arrayInput}>
232
- <FieldWrapper {...rest}>
296
+ <FieldWrapper
297
+ {...rest}
298
+ appendLabel={
299
+ <div className="-me-2">
300
+ {!fixedList && onAdd && buttonPosition !== "bottom" && addButton}
301
+ </div>
302
+ }
303
+ >
233
304
  <Wrapper>
234
305
  {fields.map((item, index) => (
235
306
  <SortableItem
@@ -242,7 +313,7 @@ export const ArrayInput = ({
242
313
  index,
243
314
  name: `${name}.${index}`,
244
315
  })
245
- : Children.map(children, (child: AnyObject) =>
316
+ : cloneChildren(children, (child: AnyObject) =>
246
317
  cloneElement(
247
318
  child,
248
319
  Object.assign(
@@ -279,40 +350,7 @@ export const ArrayInput = ({
279
350
  ))}
280
351
  </Wrapper>
281
352
  </FieldWrapper>
282
- {!fixedList && onAdd && (
283
- <div className="flex justify-end">
284
- <Tooltip
285
- color="danger"
286
- content={
287
- isString(error)
288
- ? `${error}`
289
- : (t(
290
- error?.key,
291
- error?.values
292
- ? {
293
- ...error?.values,
294
- label: t(
295
- error.values?.label ?? "form:badkey",
296
- error.values?.path,
297
- ),
298
- }
299
- : {},
300
- ) as string)
301
- }
302
- >
303
- <Button
304
- aria-label="Add item"
305
- icon={CoreIcons.insert}
306
- onClick={() => handleAdd(onAdd())}
307
- data-invalid={!!error}
308
- disabled={!!disabled || readOnly}
309
- className={classNames(classes.addButton, "me-10")}
310
- >
311
- {addLabel ?? t("addArray")}
312
- </Button>
313
- </Tooltip>
314
- </div>
315
- )}
353
+ {!fixedList && onAdd && buttonPosition !== "top" && addButton}
316
354
  </div>
317
355
  );
318
356
  };
@@ -21,7 +21,19 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { CoreIcons, Dropdown, Icon } from "@react-fabric/core";
24
+ import {
25
+ arrow,
26
+ autoUpdate,
27
+ flip,
28
+ FloatingArrow,
29
+ offset,
30
+ shift,
31
+ useClick,
32
+ useDismiss,
33
+ useFloating,
34
+ useInteractions,
35
+ } from "@floating-ui/react";
36
+ import { CoreIcons, Icon } from "@react-fabric/core";
25
37
  import { type RefProp } from "@react-fabric/core/dist/types/types";
26
38
  import { isString } from "@react-fabric/utilities";
27
39
  import classNames from "classnames";
@@ -30,6 +42,7 @@ import {
30
42
  useCallback,
31
43
  useDeferredValue,
32
44
  useEffect,
45
+ useRef,
33
46
  useState,
34
47
  } from "react";
35
48
  import { type InputProps } from "../types";
@@ -74,6 +87,38 @@ export const ColorInput = ({
74
87
  [onChange],
75
88
  );
76
89
 
90
+ const arrowRef = useRef(null);
91
+ const [isOpen, setIsOpen] = useState(false);
92
+ const { refs, floatingStyles, context } = useFloating({
93
+ open: isOpen,
94
+ onOpenChange: (open, _, reason) => {
95
+ if (reason === "reference-press") return;
96
+ setIsOpen(open);
97
+ },
98
+ strategy: "fixed",
99
+ placement: "bottom",
100
+ whileElementsMounted: autoUpdate,
101
+ middleware: [
102
+ shift({ padding: 8 }),
103
+ flip(),
104
+ offset(9),
105
+ arrow({
106
+ element: arrowRef,
107
+ }),
108
+ ],
109
+ });
110
+ const click = useClick(context, {
111
+ enabled: !disabled,
112
+ });
113
+ const dismiss = useDismiss(context, {
114
+ referencePress: true,
115
+ });
116
+
117
+ const { getReferenceProps, getFloatingProps } = useInteractions([
118
+ dismiss,
119
+ click,
120
+ ]);
121
+
77
122
  return (
78
123
  <div
79
124
  className={classNames(
@@ -92,36 +137,56 @@ export const ColorInput = ({
92
137
  {decorateStart}
93
138
  </div>
94
139
  )}
95
- <Dropdown showArrow disabled={disabled}>
96
- <button data-ref="button" className="flex-1 flex items-center">
97
- <div
98
- role="none"
99
- className="h-[1.5em] min-w-[1.5em] flex-1 flex items-center justify-center self-stretch cursor-pointer m-[0.25em] rounded outline outline-tint-100"
100
- style={{
101
- backgroundColor: actualValue,
102
- opacity: disabled ? 0.65 : 1,
103
- pointerEvents: disabled ? "none" : undefined,
104
- }}
105
- onClick={(e) =>
106
- (e.currentTarget.nextElementSibling as HTMLElement)?.focus()
107
- }
108
- >
109
- {!actualValue && (
110
- <Icon
111
- size="md"
112
- className="text-muted"
113
- icon={CoreIcons.colorSwatch}
114
- />
115
- )}
116
- </div>
117
- </button>
118
- <ColorPicker
119
- {...rest}
120
- onChange={handleChange}
121
- defaultColor={defaultColor}
122
- value={actualValue}
123
- />
124
- </Dropdown>
140
+ <button
141
+ data-ref="button"
142
+ className="flex-1 flex items-center"
143
+ ref={refs.setReference}
144
+ {...getReferenceProps()}
145
+ data-inner-clickable="true"
146
+ data-dropdown-open={isOpen ? true : undefined}
147
+ >
148
+ <div
149
+ role="none"
150
+ className="h-[1.5em] min-w-[1.5em] flex-1 flex items-center justify-center self-stretch cursor-pointer m-[0.25em] rounded outline outline-tint-100"
151
+ style={{
152
+ backgroundColor: actualValue,
153
+ opacity: disabled ? 0.65 : 1,
154
+ pointerEvents: disabled ? "none" : undefined,
155
+ }}
156
+ >
157
+ {!actualValue && (
158
+ <Icon
159
+ size="md"
160
+ className="text-muted"
161
+ icon={CoreIcons.colorSwatch}
162
+ />
163
+ )}
164
+ </div>
165
+ </button>
166
+ {isOpen && (
167
+ <div
168
+ ref={refs.setFloating}
169
+ style={{
170
+ zIndex: "var(--z-popover)",
171
+ ...floatingStyles,
172
+ }}
173
+ data-ref="dropdownBody"
174
+ {...getFloatingProps()}
175
+ >
176
+ <ColorPicker
177
+ {...rest}
178
+ onChange={handleChange}
179
+ defaultColor={defaultColor}
180
+ value={actualValue}
181
+ />
182
+ <FloatingArrow
183
+ ref={arrowRef}
184
+ context={context}
185
+ strokeWidth={0.5}
186
+ className="fill-base stroke-muted"
187
+ />
188
+ </div>
189
+ )}
125
190
  {!disabled && showPicker && (
126
191
  <Icon
127
192
  icon={CoreIcons.colorPicker}
@@ -26,26 +26,40 @@
26
26
  --color-shadow: theme(borderColor.base);
27
27
 
28
28
  & input {
29
- @apply bg-base text-base !border !border-solid !rounded-sm !border-base focus:!border-primary !shadow-none;
30
-
31
29
  padding: 0 4px !important;
30
+
32
31
  line-height: 2;
32
+ color: theme(textColor.base);
33
+
34
+ background-color: theme(backgroundColor.base);
35
+ border: 1px solid theme(borderColor.base);
36
+ border-radius: theme(borderRadius.sm);
37
+ box-shadow: none;
38
+
39
+ &:focus {
40
+ border-color: theme(borderColor.primary.DEFAULT);
41
+ }
33
42
  }
34
43
 
35
44
  & label {
36
- @apply !text-base;
45
+ color: theme(textColor.base);
37
46
  }
38
47
 
39
48
  & :global(.flexbox-fix) {
40
- @apply !border-t-muted justify-center;
49
+ justify-content: center;
50
+ border-color: theme(borderColor.muted);
41
51
 
42
52
  & > div > div {
43
- @apply text-center;
53
+ text-align: center;
44
54
  }
45
55
 
46
56
  & span > div {
47
57
  box-shadow: 0 0 1px 1px theme(borderColor.base) inset !important;
48
58
  }
49
59
  }
60
+
61
+ & :global(.saturation-black) ~ div {
62
+ pointer-events: none;
63
+ }
50
64
  }
51
65
  }
@@ -135,12 +135,9 @@ export const ColorPicker: FC<ColorProps> = memo(
135
135
  {
136
136
  default: {
137
137
  hue: {
138
- borderRadius: "99px",
139
138
  boxShadow: "0 0 1px 1px var(--color-shadow)",
140
139
  },
141
140
  alpha: {
142
- height: "1rem",
143
- borderRadius: "99px",
144
141
  backgroundColor: "var(--fabric-bg)",
145
142
  boxShadow: "0 0 1px 1px var(--color-shadow)",
146
143
  },
@@ -158,36 +155,6 @@ export const ColorPicker: FC<ColorProps> = memo(
158
155
  boxShadow:
159
156
  "0 0 0 1px var(--color-shadow), 0 0 8px var(--fabric-shadow)",
160
157
  },
161
- Alpha: {
162
- alpha: {
163
- paddingRight: "calc(1rem - 2px)",
164
- },
165
- slider: {
166
- width: "calc(1rem - 2px)",
167
- borderRadius: "99px",
168
- height: "calc(1rem - 2px)",
169
- transform: "none",
170
- },
171
- },
172
- Hue: {
173
- hue: {
174
- paddingRight: "calc(1rem - 2px)",
175
- },
176
- slider: {
177
- width: "calc(1rem - 2px)",
178
- borderRadius: "99px",
179
- height: "calc(1rem - 2px)",
180
- transform: "none",
181
- },
182
- },
183
- Saturation: {
184
- circle: {
185
- width: "0.5rem",
186
- borderRadius: "99px",
187
- height: "0.5rem",
188
- transform: "translate(-0.25rem, -0.25rem)",
189
- },
190
- },
191
158
  checkboard: {
192
159
  white: "transparent",
193
160
  black: "red",
@@ -21,12 +21,13 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
+ import { cloneChildren } from "@react-fabric/core";
24
25
  import {
25
26
  type ChildrenProp,
26
27
  type CssProp,
27
28
  } from "@react-fabric/core/dist/types/types";
28
29
  import classNames from "classnames";
29
- import { Children, cloneElement } from "react";
30
+ import { cloneElement } from "react";
30
31
  import classes from "../internal/Field.module.css";
31
32
  import { FieldWrapper } from "../internal/FieldWrapper";
32
33
 
@@ -90,13 +91,10 @@ export const Field = ({
90
91
  !vertical && "flex flex-nowrap",
91
92
  )}
92
93
  >
93
- {Children.map(
94
- children,
95
- (child) =>
96
- child &&
97
- cloneElement(child as AnyObject, {
98
- "data-inner": true,
99
- }),
94
+ {cloneChildren(children, (child: AnyObject) =>
95
+ cloneElement(child, {
96
+ "data-inner": true,
97
+ }),
100
98
  )}
101
99
  </div>
102
100
  </FieldWrapper>
@@ -24,19 +24,33 @@
24
24
  @layer comp {
25
25
  .fileInput {
26
26
  &::-webkit-file-upload-button {
27
- @apply bg-primary-500 opacity-80 hover:opacity-90 text-white rounded border-none py-0 cursor-pointer;
27
+ cursor: pointer;
28
+
29
+ padding-block: 0;
30
+
31
+ color: theme(textColor.white);
32
+
33
+ opacity: 0.8;
34
+ background-color: theme(backgroundColor.primary.500);
35
+ border: 0;
36
+ border-radius: theme(borderRadius.DEFAULT);
37
+
38
+ &:hover {
39
+ opacity: 0.9;
40
+ }
28
41
  }
29
42
 
30
43
  &[aria-invalid="true"]::-webkit-file-upload-button {
31
- @apply bg-danger-500;
44
+ background-color: theme(backgroundColor.danger.500);
32
45
  }
33
46
 
34
47
  &:disabled::-webkit-file-upload-button {
35
- @apply bg-muted pointer-events-none;
48
+ pointer-events: none;
49
+ background-color: theme(backgroundColor.muted);
36
50
  }
37
51
 
38
52
  &[readOnly] {
39
- @apply pointer-events-none;
53
+ pointer-events: none;
40
54
  }
41
55
  }
42
56
  }
@@ -54,7 +54,9 @@ export const HiddenInput = ({
54
54
  name,
55
55
  }: Props) => {
56
56
  useEffect(() => {
57
- onChange?.(hiddenValue);
57
+ setTimeout(() => {
58
+ onChange?.(hiddenValue);
59
+ }, 50);
58
60
  }, [hiddenValue]);
59
61
  return (
60
62
  <Fragment>
@@ -104,7 +104,7 @@ export const Input = ({
104
104
  type={type}
105
105
  ref={ref}
106
106
  autoComplete="off"
107
- {...{ autoFocus }}
107
+ autoFocus={autoFocus}
108
108
  value={actualValue}
109
109
  onChange={handleChange}
110
110
  onKeyDown={handleEnterPressed}
@@ -116,7 +116,7 @@ export const Number = ({
116
116
  step={step}
117
117
  ref={ref}
118
118
  autoComplete="off"
119
- {...{ autoFocus }}
119
+ autoFocus={autoFocus}
120
120
  value={actualValue}
121
121
  onChange={handleChange}
122
122
  onKeyDown={handleEnterPressed}
@@ -129,7 +129,7 @@ export const Password = ({
129
129
  type={show ? "text" : "password"}
130
130
  ref={ref}
131
131
  autoComplete="off"
132
- {...{ autoFocus }}
132
+ autoFocus={autoFocus}
133
133
  value={actualValue}
134
134
  onChange={handleChange}
135
135
  onKeyDown={handleEnterPressed}