@homecode/ui 4.27.12 → 4.27.14

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.
@@ -231,6 +231,7 @@ function Form(props) {
231
231
  setValue: setValueAPI,
232
232
  setValues: setValuesAPI,
233
233
  setDisabled: setDisabledAPI,
234
+ resetErrors: () => setErrors({}),
234
235
  reset,
235
236
  submit: onSubmitHandler,
236
237
  };
@@ -112,7 +112,10 @@ const Input = forwardRef((props, ref) => {
112
112
  }
113
113
  };
114
114
  const handleChange = (e) => {
115
- const val = getValue(e.target.value);
115
+ let val = getValue(e.target.value);
116
+ if (isTextArea && !val.trim()) {
117
+ val = '';
118
+ }
116
119
  onChangeValue(val, e);
117
120
  };
118
121
  const onChangeValue = (value, e) => {
@@ -22,13 +22,18 @@ export type ValidationState = {
22
22
  export type FormAPI = ValidationState & {
23
23
  isDirty: boolean;
24
24
  isLoading: boolean;
25
+ isEmpty: boolean;
25
26
  values: FormValues;
26
27
  touched: FieldsFlags;
27
28
  changed: FieldsFlags;
29
+ disabled: FieldsFlags;
30
+ submit: (e: React.FormEvent<HTMLFormElement>) => Promise<void>;
28
31
  setValue: (field: string, val: any) => void;
29
32
  setValues: (values: FormValues) => void;
33
+ setDisabled: (field: string, disabled: boolean) => void;
30
34
  reset: () => void;
31
35
  Field: (props: FormFieldProps) => ReactNode;
36
+ resetErrors: () => void;
32
37
  };
33
38
  export type FormValidationRule = {
34
39
  type?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.27.12",
3
+ "version": "4.27.14",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "tests": "jest",