@saas-ui/forms 2.3.6 → 2.3.8
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +18 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -7
- package/dist/index.mjs.map +1 -1
- package/dist/yup/index.d.ts +11 -9
- package/dist/zod/index.d.ts +11 -9
- package/package.json +2 -2
- package/src/default-fields.tsx +20 -9
- package/src/form-context.tsx +5 -9
- package/src/index.ts +133 -68
- package/src/select/select.tsx +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# @saas-ui/forms
|
2
2
|
|
3
|
+
## 2.3.8
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- bc176848: Fixed issue where Select button and input would have the same id
|
8
|
+
- bc176848: Fixed issue where Form context would not be available
|
9
|
+
- 90ee13c3: Refactored exports
|
10
|
+
- Updated dependencies [90ee13c3]
|
11
|
+
- @saas-ui/core@2.3.3
|
12
|
+
|
13
|
+
## 2.3.7
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- Updated dependencies [bbd692d4]
|
18
|
+
- Updated dependencies [781a1c26]
|
19
|
+
- @saas-ui/core@2.3.2
|
20
|
+
|
3
21
|
## 2.3.6
|
4
22
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
@@ -154,15 +154,22 @@ interface NumberInputFieldProps extends NumberInputProps {
|
|
154
154
|
}
|
155
155
|
declare const NumberInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
156
156
|
declare const PasswordInputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
157
|
-
|
158
|
-
|
157
|
+
interface TextareaFieldProps extends TextareaProps {
|
158
|
+
}
|
159
|
+
declare const TextareaField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
160
|
+
interface SwitchFieldProps extends SwitchProps {
|
161
|
+
}
|
162
|
+
declare const SwitchField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
159
163
|
interface SelectFieldProps extends SelectProps {
|
160
164
|
buttonProps?: SelectButtonProps;
|
161
165
|
listProps?: SelectListProps;
|
162
166
|
}
|
163
167
|
declare const SelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
168
|
+
type CheckboxFieldProps = CheckboxProps;
|
164
169
|
declare const CheckboxField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
170
|
+
type RadioFieldProps = RadioInputProps;
|
165
171
|
declare const RadioField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
172
|
+
type NativeSelectFieldProps = NativeSelectProps;
|
166
173
|
declare const NativeSelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
167
174
|
interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
|
168
175
|
pinLength?: number;
|
@@ -177,8 +184,8 @@ declare const defaultFieldTypes: {
|
|
177
184
|
phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
178
185
|
number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
179
186
|
password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
180
|
-
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
181
|
-
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
187
|
+
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
188
|
+
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
182
189
|
select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
183
190
|
checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
184
191
|
radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
@@ -859,7 +866,6 @@ declare const createField: <TProps extends object>(component: React$1.FC<TProps>
|
|
859
866
|
* @see Docs https://saas-ui.dev/docs/components/forms/form
|
860
867
|
*/
|
861
868
|
declare const Form: FormType<unknown, object, object>;
|
862
|
-
|
863
869
|
/**
|
864
870
|
* Multi-step form component.
|
865
871
|
*
|
@@ -867,4 +873,4 @@ declare const Form: FormType<unknown, object, object>;
|
|
867
873
|
*/
|
868
874
|
declare const StepForm: StepFormType<unknown, object, object>;
|
869
875
|
|
870
|
-
export { ArrayField, ArrayFieldAddButton, ArrayFieldButtonProps, ArrayFieldContainer, ArrayFieldContainerProps, ArrayFieldOptions, ArrayFieldProps, ArrayFieldProvider, ArrayFieldRemoveButton, ArrayFieldRow, ArrayFieldRowContainer, ArrayFieldRowFields, ArrayFieldRowFieldsProps, ArrayFieldRowProvider, ArrayFieldRows, ArrayFieldRowsProps, AutoFields, BaseField, BaseFieldProps, Form$1 as BaseForm, CheckboxField, CreateFieldOptions, CreateFormProps, CreateStepFormProps, DefaultFieldOverrides, DefaultFields, DisplayField, DisplayFieldProps, DisplayIf, DisplayIfProps, Field, FieldOptions, FieldProps, FieldResolver, FieldRules, FieldsProps, FieldsProvider, Form, FormComponent, FormLayout, FormLayoutProps, FormLegend, FormProps, FormProvider, FormRenderContext, FormStep, FormStepOptions, FormStepProps, FormStepSubmitHandler, FormStepper, FormStepperProps, FormType, FormValue, GetFieldResolver, InputField, InputFieldProps, InputRightButton, InputRightButtonProps, NativeSelect, NativeSelectField, NativeSelectProps, NextButton, NextButtonProps, NumberInputField, NumberInputFieldProps, ObjectField, ObjectFieldProps, ObjectSchema, Option, PasswordInput, PasswordInputField, PasswordInputProps, PinField, PinFieldProps, PrevButton, RadioField, RadioInput, RadioInputProps, RadioOption, RadioOptions, Select, SelectButton, SelectButtonProps, SelectField, SelectFieldProps, SelectList, SelectListProps, SelectOption, SelectProps, StepForm, StepFormContext, StepFormProps, StepFormProvider, StepFormRenderContext, StepState, StepsOptions, SubmitButton, SubmitButtonProps, SwitchField, TextareaField, UseArrayFieldReturn, UseArrayFieldRowProps, UseArrayFieldRowReturn, UseFormStepProps, UseStepFormProps, UseStepFormReturn, WatchField, WatchFieldProps, WithFields, WithStepFields, createField, createForm, createStepForm, defaultFieldTypes, objectFieldResolver, useArrayField, useArrayFieldAddButton, useArrayFieldContext, useArrayFieldRemoveButton, useArrayFieldRow, useArrayFieldRowContext, useField, useFormContext, useFormStep, useStepForm, useStepFormContext };
|
876
|
+
export { ArrayField, ArrayFieldAddButton, ArrayFieldButtonProps, ArrayFieldContainer, ArrayFieldContainerProps, ArrayFieldOptions, ArrayFieldProps, ArrayFieldProvider, ArrayFieldRemoveButton, ArrayFieldRow, ArrayFieldRowContainer, ArrayFieldRowFields, ArrayFieldRowFieldsProps, ArrayFieldRowProvider, ArrayFieldRows, ArrayFieldRowsProps, AutoFields, BaseField, BaseFieldProps, Form$1 as BaseForm, CheckboxField, CheckboxFieldProps, CreateFieldOptions, CreateFormProps, CreateStepFormProps, DefaultFieldOverrides, DefaultFields, DisplayField, DisplayFieldProps, DisplayIf, DisplayIfProps, Field, FieldOptions, FieldProps, FieldResolver, FieldRules, FieldsProps, FieldsProvider, Form, FormComponent, FormLayout, FormLayoutProps, FormLegend, FormProps, FormProvider, FormRenderContext, FormStep, FormStepOptions, FormStepProps, FormStepSubmitHandler, FormStepper, FormStepperProps, FormType, FormValue, GetFieldResolver, InputField, InputFieldProps, InputRightButton, InputRightButtonProps, NativeSelect, NativeSelectField, NativeSelectFieldProps, NativeSelectProps, NextButton, NextButtonProps, NumberInputField, NumberInputFieldProps, ObjectField, ObjectFieldProps, ObjectSchema, Option, PasswordInput, PasswordInputField, PasswordInputProps, PinField, PinFieldProps, PrevButton, RadioField, RadioFieldProps, RadioInput, RadioInputProps, RadioOption, RadioOptions, Select, SelectButton, SelectButtonProps, SelectField, SelectFieldProps, SelectList, SelectListProps, SelectOption, SelectProps, StepForm, StepFormContext, StepFormProps, StepFormProvider, StepFormRenderContext, StepState, StepsOptions, SubmitButton, SubmitButtonProps, SwitchField, SwitchFieldProps, TextareaField, TextareaFieldProps, UseArrayFieldReturn, UseArrayFieldRowProps, UseArrayFieldRowReturn, UseFormStepProps, UseStepFormProps, UseStepFormReturn, WatchField, WatchFieldProps, WithFields, WithStepFields, createField, createForm, createStepForm, defaultFieldTypes, objectFieldResolver, useArrayField, useArrayFieldAddButton, useArrayFieldContext, useArrayFieldRemoveButton, useArrayFieldRow, useArrayFieldRowContext, useField, useFormContext, useFormStep, useStepForm, useStepFormContext };
|
package/dist/index.js
CHANGED
@@ -114,9 +114,6 @@ var FormContext = React.createContext(null);
|
|
114
114
|
var useFormContext = () => {
|
115
115
|
const context = React.useContext(FormContext);
|
116
116
|
const hookContext = (0, import_react_hook_form.useFormContext)();
|
117
|
-
if (!context) {
|
118
|
-
throw new Error("FormProvider must be used within a Form component");
|
119
|
-
}
|
120
117
|
return {
|
121
118
|
...hookContext,
|
122
119
|
...context
|
@@ -437,7 +434,6 @@ var SelectButton = (0, import_react9.forwardRef)(
|
|
437
434
|
{
|
438
435
|
...buttonProps,
|
439
436
|
sx: buttonStyles,
|
440
|
-
id: id || buttonProps.id,
|
441
437
|
...rest,
|
442
438
|
onFocus,
|
443
439
|
onBlur,
|
@@ -714,9 +710,12 @@ var CheckboxField = createField(
|
|
714
710
|
var RadioField = createField(RadioInput, {
|
715
711
|
isControlled: true
|
716
712
|
});
|
717
|
-
var NativeSelectField = createField(
|
718
|
-
|
719
|
-
|
713
|
+
var NativeSelectField = createField(
|
714
|
+
NativeSelect,
|
715
|
+
{
|
716
|
+
isControlled: true
|
717
|
+
}
|
718
|
+
);
|
720
719
|
var PinField = createField(
|
721
720
|
(0, import_react13.forwardRef)((props, ref) => {
|
722
721
|
const { pinLength = 4, pinType, spacing, ...inputProps } = props;
|