@saas-ui/forms 2.5.1 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/dist/index.d.mts +26 -25
- package/dist/index.d.ts +26 -25
- package/dist/index.js +162 -160
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -82
- package/dist/index.mjs.map +1 -1
- package/dist/yup/index.d.mts +26 -26
- package/dist/yup/index.d.ts +26 -26
- package/dist/zod/index.d.mts +26 -26
- package/dist/zod/index.d.ts +26 -26
- package/package.json +2 -2
- package/src/base-field.tsx +1 -1
- package/src/create-field.tsx +1 -1
- package/src/create-form.tsx +7 -1
- package/src/create-step-form.tsx +10 -1
- package/src/default-fields.tsx +0 -2
- package/src/field.tsx +2 -1
- package/src/fields-context.tsx +8 -8
- package/src/form-context.tsx +1 -1
- package/src/types.ts +10 -10
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
@@ -9,6 +9,7 @@ import { NumberInputProps as NumberInputProps$1, NumberInputFieldProps as Number
|
|
9
9
|
import { UseStepperReturn, UseStepperProps, StepsProps, StepsItemProps } from '@saas-ui/core';
|
10
10
|
import { FocusableElement } from '@chakra-ui/utils';
|
11
11
|
import { MaybeRenderProp } from '@chakra-ui/react-utils';
|
12
|
+
import * as src from 'src';
|
12
13
|
|
13
14
|
interface NumberInputOptions {
|
14
15
|
/**
|
@@ -156,49 +157,49 @@ interface InputFieldProps extends InputProps {
|
|
156
157
|
leftAddon?: React$1.ReactNode;
|
157
158
|
rightAddon?: React$1.ReactNode;
|
158
159
|
}
|
159
|
-
declare const InputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
160
|
+
declare const InputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
160
161
|
interface NumberInputFieldProps extends NumberInputProps {
|
161
162
|
type: 'number';
|
162
163
|
}
|
163
|
-
declare const NumberInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
164
|
-
declare const PasswordInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
164
|
+
declare const NumberInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
165
|
+
declare const PasswordInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
165
166
|
interface TextareaFieldProps extends TextareaProps {
|
166
167
|
}
|
167
|
-
declare const TextareaField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
168
|
+
declare const TextareaField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
168
169
|
interface SwitchFieldProps extends SwitchProps {
|
169
170
|
}
|
170
|
-
declare const SwitchField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
171
|
+
declare const SwitchField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
171
172
|
interface SelectFieldProps extends SelectProps {
|
172
173
|
buttonProps?: SelectButtonProps;
|
173
174
|
listProps?: SelectListProps;
|
174
175
|
}
|
175
|
-
declare const SelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
176
|
+
declare const SelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
176
177
|
type CheckboxFieldProps = CheckboxProps;
|
177
|
-
declare const CheckboxField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
178
|
+
declare const CheckboxField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
178
179
|
type RadioFieldProps = RadioInputProps;
|
179
|
-
declare const RadioField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
180
|
+
declare const RadioField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
180
181
|
type NativeSelectFieldProps = NativeSelectProps;
|
181
|
-
declare const NativeSelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
182
|
+
declare const NativeSelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
182
183
|
interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
|
183
184
|
pinLength?: number;
|
184
185
|
pinType?: 'alphanumeric' | 'number';
|
185
186
|
spacing?: SystemProps['margin'];
|
186
187
|
}
|
187
|
-
declare const PinField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
188
|
+
declare const PinField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
188
189
|
declare const defaultFieldTypes: {
|
189
|
-
text: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
190
|
-
email: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
191
|
-
url: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
192
|
-
phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
193
|
-
number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
194
|
-
password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
195
|
-
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
196
|
-
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
197
|
-
select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
198
|
-
checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
199
|
-
radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
200
|
-
pin: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
201
|
-
'native-select': React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
190
|
+
text: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
191
|
+
email: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
192
|
+
url: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
193
|
+
phone: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
194
|
+
number: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
195
|
+
password: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
196
|
+
textarea: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
197
|
+
switch: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
198
|
+
select: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
199
|
+
checkbox: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
200
|
+
radio: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
201
|
+
pin: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
202
|
+
'native-select': React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
202
203
|
};
|
203
204
|
type DefaultFields = typeof defaultFieldTypes;
|
204
205
|
|
@@ -813,10 +814,10 @@ interface FieldsContextValue {
|
|
813
814
|
getBaseField?: GetBaseField<any>;
|
814
815
|
}
|
815
816
|
declare const FieldsProvider: React__default.FC<{
|
816
|
-
value:
|
817
|
+
value: FieldsContextValue;
|
817
818
|
children: React__default.ReactNode;
|
818
819
|
}>;
|
819
|
-
declare const useField: (type: string) => React__default.FC<any>;
|
820
|
+
declare const useField: (type: string, fallback: React__default.FC<any>) => React__default.FC<any>;
|
820
821
|
|
821
822
|
type FormProviderProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = FormProviderProps$1<TFieldValues, TContext> & {
|
822
823
|
fieldResolver?: FieldResolver;
|
package/dist/index.d.ts
CHANGED
@@ -9,6 +9,7 @@ import { NumberInputProps as NumberInputProps$1, NumberInputFieldProps as Number
|
|
9
9
|
import { UseStepperReturn, UseStepperProps, StepsProps, StepsItemProps } from '@saas-ui/core';
|
10
10
|
import { FocusableElement } from '@chakra-ui/utils';
|
11
11
|
import { MaybeRenderProp } from '@chakra-ui/react-utils';
|
12
|
+
import * as src from 'src';
|
12
13
|
|
13
14
|
interface NumberInputOptions {
|
14
15
|
/**
|
@@ -156,49 +157,49 @@ interface InputFieldProps extends InputProps {
|
|
156
157
|
leftAddon?: React$1.ReactNode;
|
157
158
|
rightAddon?: React$1.ReactNode;
|
158
159
|
}
|
159
|
-
declare const InputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
160
|
+
declare const InputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
160
161
|
interface NumberInputFieldProps extends NumberInputProps {
|
161
162
|
type: 'number';
|
162
163
|
}
|
163
|
-
declare const NumberInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
164
|
-
declare const PasswordInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
164
|
+
declare const NumberInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
165
|
+
declare const PasswordInputField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
165
166
|
interface TextareaFieldProps extends TextareaProps {
|
166
167
|
}
|
167
|
-
declare const TextareaField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
168
|
+
declare const TextareaField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
168
169
|
interface SwitchFieldProps extends SwitchProps {
|
169
170
|
}
|
170
|
-
declare const SwitchField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
171
|
+
declare const SwitchField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
171
172
|
interface SelectFieldProps extends SelectProps {
|
172
173
|
buttonProps?: SelectButtonProps;
|
173
174
|
listProps?: SelectListProps;
|
174
175
|
}
|
175
|
-
declare const SelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
176
|
+
declare const SelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
176
177
|
type CheckboxFieldProps = CheckboxProps;
|
177
|
-
declare const CheckboxField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
178
|
+
declare const CheckboxField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
178
179
|
type RadioFieldProps = RadioInputProps;
|
179
|
-
declare const RadioField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
180
|
+
declare const RadioField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
180
181
|
type NativeSelectFieldProps = NativeSelectProps;
|
181
|
-
declare const NativeSelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
182
|
+
declare const NativeSelectField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
182
183
|
interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
|
183
184
|
pinLength?: number;
|
184
185
|
pinType?: 'alphanumeric' | 'number';
|
185
186
|
spacing?: SystemProps['margin'];
|
186
187
|
}
|
187
|
-
declare const PinField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
188
|
+
declare const PinField: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
188
189
|
declare const defaultFieldTypes: {
|
189
|
-
text: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
190
|
-
email: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
191
|
-
url: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
192
|
-
phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
193
|
-
number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
194
|
-
password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
195
|
-
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
196
|
-
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
197
|
-
select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
198
|
-
checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
199
|
-
radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
200
|
-
pin: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
201
|
-
'native-select': React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
190
|
+
text: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
191
|
+
email: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
192
|
+
url: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
193
|
+
phone: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
194
|
+
number: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
195
|
+
password: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
196
|
+
textarea: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
197
|
+
switch: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
198
|
+
select: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
199
|
+
checkbox: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
200
|
+
radio: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
201
|
+
pin: React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
202
|
+
'native-select': React$1.FC<Omit<src.BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
202
203
|
};
|
203
204
|
type DefaultFields = typeof defaultFieldTypes;
|
204
205
|
|
@@ -813,10 +814,10 @@ interface FieldsContextValue {
|
|
813
814
|
getBaseField?: GetBaseField<any>;
|
814
815
|
}
|
815
816
|
declare const FieldsProvider: React__default.FC<{
|
816
|
-
value:
|
817
|
+
value: FieldsContextValue;
|
817
818
|
children: React__default.ReactNode;
|
818
819
|
}>;
|
819
|
-
declare const useField: (type: string) => React__default.FC<any>;
|
820
|
+
declare const useField: (type: string, fallback: React__default.FC<any>) => React__default.FC<any>;
|
820
821
|
|
821
822
|
type FormProviderProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = FormProviderProps$1<TFieldValues, TContext> & {
|
822
823
|
fieldResolver?: FieldResolver;
|