@saas-ui/forms 2.3.6 → 2.3.8
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.
- 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/dist/yup/index.d.ts
CHANGED
@@ -2,13 +2,11 @@ import * as _chakra_ui_button_dist_button from '@chakra-ui/button/dist/button';
|
|
2
2
|
import * as _saas_ui_modals from '@saas-ui/modals';
|
3
3
|
import { BaseModalProps } from '@saas-ui/modals';
|
4
4
|
import * as _chakra_ui_checkbox_dist_checkbox from '@chakra-ui/checkbox/dist/checkbox';
|
5
|
-
import * as _chakra_ui_switch_dist_switch from '@chakra-ui/switch/dist/switch';
|
6
|
-
import * as _chakra_ui_textarea_dist_textarea from '@chakra-ui/textarea/dist/textarea';
|
7
5
|
import * as react_hook_form from 'react-hook-form';
|
8
6
|
import { FieldValues, FieldPath, RegisterOptions, SubmitHandler, UseFieldArrayReturn, UseFormReturn, UseFormProps, WatchObserver, SubmitErrorHandler } from 'react-hook-form';
|
9
7
|
import * as React$1 from 'react';
|
10
8
|
import React$1__default from 'react';
|
11
|
-
import { InputProps, RadioGroupProps, SelectProps as SelectProps$1, UsePinInputProps, SystemProps, ButtonProps, ResponsiveValue, FormControlProps, HTMLChakraProps, NumberInputProps as NumberInputProps$1, StackDirection, MenuProps, ThemingProps, MenuListProps, NumberInputFieldProps as NumberInputFieldProps$1, MenuItemOptionProps, RadioProps,
|
9
|
+
import { InputProps, RadioGroupProps, SelectProps as SelectProps$1, TextareaProps, SwitchProps, UsePinInputProps, SystemProps, ButtonProps, ResponsiveValue, FormControlProps, HTMLChakraProps, NumberInputProps as NumberInputProps$1, StackDirection, MenuProps, ThemingProps, MenuListProps, NumberInputFieldProps as NumberInputFieldProps$1, MenuItemOptionProps, RadioProps, CheckboxProps } from '@chakra-ui/react';
|
12
10
|
import { UseStepperProps, UseStepperReturn } from '@saas-ui/core';
|
13
11
|
import { FocusableElement } from '@chakra-ui/utils';
|
14
12
|
import { MaybeRenderProp } from '@chakra-ui/react-utils';
|
@@ -139,6 +137,10 @@ interface InputFieldProps extends InputProps {
|
|
139
137
|
interface NumberInputFieldProps extends NumberInputProps {
|
140
138
|
type: 'number';
|
141
139
|
}
|
140
|
+
interface TextareaFieldProps extends TextareaProps {
|
141
|
+
}
|
142
|
+
interface SwitchFieldProps extends SwitchProps {
|
143
|
+
}
|
142
144
|
interface SelectFieldProps extends SelectProps {
|
143
145
|
buttonProps?: SelectButtonProps;
|
144
146
|
listProps?: SelectListProps;
|
@@ -155,8 +157,8 @@ declare const defaultFieldTypes: {
|
|
155
157
|
phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
156
158
|
number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
157
159
|
password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
158
|
-
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
159
|
-
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
160
|
+
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
161
|
+
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
160
162
|
select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
161
163
|
checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
162
164
|
radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
@@ -594,9 +596,9 @@ declare const StepForm: (<TSteps extends {
|
|
594
596
|
type?: "password" | undefined;
|
595
597
|
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
596
598
|
type?: "textarea" | undefined;
|
597
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
599
|
+
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
598
600
|
type?: "switch" | undefined;
|
599
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
601
|
+
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
600
602
|
type?: "select" | undefined;
|
601
603
|
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
602
604
|
type?: "checkbox" | undefined;
|
@@ -621,9 +623,9 @@ declare const StepForm: (<TSteps extends {
|
|
621
623
|
type?: "password" | undefined;
|
622
624
|
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
623
625
|
type?: "textarea" | undefined;
|
624
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
626
|
+
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
625
627
|
type?: "switch" | undefined;
|
626
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
628
|
+
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
627
629
|
type?: "select" | undefined;
|
628
630
|
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
629
631
|
type?: "checkbox" | undefined;
|
package/dist/zod/index.d.ts
CHANGED
@@ -2,13 +2,11 @@ import * as _chakra_ui_button_dist_button from '@chakra-ui/button/dist/button';
|
|
2
2
|
import * as _saas_ui_modals from '@saas-ui/modals';
|
3
3
|
import { BaseModalProps } from '@saas-ui/modals';
|
4
4
|
import * as _chakra_ui_checkbox_dist_checkbox from '@chakra-ui/checkbox/dist/checkbox';
|
5
|
-
import * as _chakra_ui_switch_dist_switch from '@chakra-ui/switch/dist/switch';
|
6
|
-
import * as _chakra_ui_textarea_dist_textarea from '@chakra-ui/textarea/dist/textarea';
|
7
5
|
import * as react_hook_form from 'react-hook-form';
|
8
6
|
import { FieldValues, FieldPath, RegisterOptions, SubmitHandler, UseFieldArrayReturn, UseFormReturn, UseFormProps, WatchObserver, SubmitErrorHandler } from 'react-hook-form';
|
9
7
|
import * as React$1 from 'react';
|
10
8
|
import React$1__default from 'react';
|
11
|
-
import { InputProps, RadioGroupProps, SelectProps as SelectProps$1, UsePinInputProps, SystemProps, ButtonProps, ResponsiveValue, FormControlProps, HTMLChakraProps, NumberInputProps as NumberInputProps$1, StackDirection, MenuProps, ThemingProps, MenuListProps, NumberInputFieldProps as NumberInputFieldProps$1, MenuItemOptionProps, RadioProps,
|
9
|
+
import { InputProps, RadioGroupProps, SelectProps as SelectProps$1, TextareaProps, SwitchProps, UsePinInputProps, SystemProps, ButtonProps, ResponsiveValue, FormControlProps, HTMLChakraProps, NumberInputProps as NumberInputProps$1, StackDirection, MenuProps, ThemingProps, MenuListProps, NumberInputFieldProps as NumberInputFieldProps$1, MenuItemOptionProps, RadioProps, CheckboxProps } from '@chakra-ui/react';
|
12
10
|
import { UseStepperProps, UseStepperReturn } from '@saas-ui/core';
|
13
11
|
import { FocusableElement } from '@chakra-ui/utils';
|
14
12
|
import { MaybeRenderProp } from '@chakra-ui/react-utils';
|
@@ -139,6 +137,10 @@ interface InputFieldProps extends InputProps {
|
|
139
137
|
interface NumberInputFieldProps extends NumberInputProps {
|
140
138
|
type: 'number';
|
141
139
|
}
|
140
|
+
interface TextareaFieldProps extends TextareaProps {
|
141
|
+
}
|
142
|
+
interface SwitchFieldProps extends SwitchProps {
|
143
|
+
}
|
142
144
|
interface SelectFieldProps extends SelectProps {
|
143
145
|
buttonProps?: SelectButtonProps;
|
144
146
|
listProps?: SelectListProps;
|
@@ -155,8 +157,8 @@ declare const defaultFieldTypes: {
|
|
155
157
|
phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
156
158
|
number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
157
159
|
password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
158
|
-
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
159
|
-
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
160
|
+
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
161
|
+
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
160
162
|
select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
161
163
|
checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
162
164
|
radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
@@ -618,9 +620,9 @@ declare const StepForm: (<TSteps extends {
|
|
618
620
|
type?: "password" | undefined;
|
619
621
|
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
620
622
|
type?: "textarea" | undefined;
|
621
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
623
|
+
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
622
624
|
type?: "switch" | undefined;
|
623
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
625
|
+
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
624
626
|
type?: "select" | undefined;
|
625
627
|
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
626
628
|
type?: "checkbox" | undefined;
|
@@ -645,9 +647,9 @@ declare const StepForm: (<TSteps extends {
|
|
645
647
|
type?: "password" | undefined;
|
646
648
|
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
647
649
|
type?: "textarea" | undefined;
|
648
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
650
|
+
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
649
651
|
type?: "switch" | undefined;
|
650
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
652
|
+
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
651
653
|
type?: "select" | undefined;
|
652
654
|
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
653
655
|
type?: "checkbox" | undefined;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@saas-ui/forms",
|
3
|
-
"version": "2.3.
|
3
|
+
"version": "2.3.8",
|
4
4
|
"description": "Fully functional forms for Chakra UI.",
|
5
5
|
"source": "src/index.ts",
|
6
6
|
"exports": {
|
@@ -104,7 +104,7 @@
|
|
104
104
|
"@chakra-ui/react-utils": "^2.0.12",
|
105
105
|
"@chakra-ui/utils": "^2.0.15",
|
106
106
|
"@hookform/resolvers": "^3.3.1",
|
107
|
-
"@saas-ui/core": "2.3.
|
107
|
+
"@saas-ui/core": "2.3.3",
|
108
108
|
"react-hook-form": "^7.46.1"
|
109
109
|
},
|
110
110
|
"peerDependencies": {
|
package/src/default-fields.tsx
CHANGED
@@ -34,8 +34,6 @@ import {
|
|
34
34
|
} from './select'
|
35
35
|
|
36
36
|
import { createField } from './create-field'
|
37
|
-
import { ObjectField } from './object-field'
|
38
|
-
import { ArrayField } from './array-field'
|
39
37
|
|
40
38
|
export interface InputFieldProps extends InputProps {
|
41
39
|
type?: string
|
@@ -74,9 +72,13 @@ export const PasswordInputField = createField<PasswordInputProps>(
|
|
74
72
|
forwardRef((props, ref) => <PasswordInput ref={ref} {...props} />)
|
75
73
|
)
|
76
74
|
|
77
|
-
export
|
75
|
+
export interface TextareaFieldProps extends TextareaProps {}
|
78
76
|
|
79
|
-
export const
|
77
|
+
export const TextareaField = createField<TextareaFieldProps>(Textarea)
|
78
|
+
|
79
|
+
export interface SwitchFieldProps extends SwitchProps {}
|
80
|
+
|
81
|
+
export const SwitchField = createField<SwitchFieldProps>(
|
80
82
|
forwardRef(({ type, value, ...rest }, ref) => {
|
81
83
|
return <Switch isChecked={!!value} {...rest} ref={ref} />
|
82
84
|
}),
|
@@ -105,7 +107,9 @@ export const SelectField = createField<SelectFieldProps>(
|
|
105
107
|
}
|
106
108
|
)
|
107
109
|
|
108
|
-
export
|
110
|
+
export type CheckboxFieldProps = CheckboxProps
|
111
|
+
|
112
|
+
export const CheckboxField = createField<CheckboxFieldProps>(
|
109
113
|
forwardRef(({ label, type, ...props }, ref) => {
|
110
114
|
return (
|
111
115
|
<Checkbox ref={ref} {...props}>
|
@@ -118,14 +122,21 @@ export const CheckboxField = createField<CheckboxProps>(
|
|
118
122
|
}
|
119
123
|
)
|
120
124
|
|
121
|
-
export
|
122
|
-
isControlled: true,
|
123
|
-
})
|
125
|
+
export type RadioFieldProps = RadioInputProps
|
124
126
|
|
125
|
-
export const
|
127
|
+
export const RadioField = createField<RadioFieldProps>(RadioInput, {
|
126
128
|
isControlled: true,
|
127
129
|
})
|
128
130
|
|
131
|
+
export type NativeSelectFieldProps = NativeSelectProps
|
132
|
+
|
133
|
+
export const NativeSelectField = createField<NativeSelectFieldProps>(
|
134
|
+
NativeSelect,
|
135
|
+
{
|
136
|
+
isControlled: true,
|
137
|
+
}
|
138
|
+
)
|
139
|
+
|
129
140
|
export interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
|
130
141
|
pinLength?: number
|
131
142
|
pinType?: 'alphanumeric' | 'number'
|
package/src/form-context.tsx
CHANGED
@@ -11,7 +11,7 @@ import { BaseFieldProps, FieldProps } from './types'
|
|
11
11
|
export type FormContextValue<
|
12
12
|
TFieldValues extends FieldValues = FieldValues,
|
13
13
|
TContext = any,
|
14
|
-
TSchema = any
|
14
|
+
TSchema = any,
|
15
15
|
> = {
|
16
16
|
fieldResolver?: FieldResolver
|
17
17
|
schema?: TSchema
|
@@ -23,7 +23,7 @@ export type FormContextValue<
|
|
23
23
|
export type FormProviderProps<
|
24
24
|
TFieldValues extends FieldValues = FieldValues,
|
25
25
|
TContext = any,
|
26
|
-
TSchema = any
|
26
|
+
TSchema = any,
|
27
27
|
> = HookFormProviderProps<TFieldValues, TContext> & {
|
28
28
|
fieldResolver?: FieldResolver
|
29
29
|
schema?: TSchema
|
@@ -37,15 +37,11 @@ const FormContext = React.createContext<FormContextValue | null>(null)
|
|
37
37
|
export const useFormContext = <
|
38
38
|
TFieldValues extends FieldValues = FieldValues,
|
39
39
|
TContext = any,
|
40
|
-
TSchema = any
|
40
|
+
TSchema = any,
|
41
41
|
>() => {
|
42
42
|
const context = React.useContext(FormContext)
|
43
43
|
const hookContext = useHookFormContext()
|
44
44
|
|
45
|
-
if (!context) {
|
46
|
-
throw new Error('FormProvider must be used within a Form component')
|
47
|
-
}
|
48
|
-
|
49
45
|
return {
|
50
46
|
...hookContext,
|
51
47
|
...context,
|
@@ -63,13 +59,13 @@ export const useFieldProps = <TFieldValues extends FieldValues = FieldValues>(
|
|
63
59
|
export type UseFormReturn<
|
64
60
|
TFieldValues extends FieldValues = FieldValues,
|
65
61
|
TContext = any,
|
66
|
-
TSchema = any
|
62
|
+
TSchema = any,
|
67
63
|
> = ReturnType<typeof useFormContext>
|
68
64
|
|
69
65
|
export const FormProvider = <
|
70
66
|
TFieldValues extends FieldValues = FieldValues,
|
71
67
|
TContext = any,
|
72
|
-
TSchema = any
|
68
|
+
TSchema = any,
|
73
69
|
>(
|
74
70
|
props: FormProviderProps<TFieldValues, TContext, TSchema>
|
75
71
|
) => {
|
package/src/index.ts
CHANGED
@@ -1,35 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
export {
|
1
|
+
// Exporting from './display-field'
|
2
|
+
export { DisplayField } from './display-field'
|
3
|
+
export type { DisplayFieldProps } from './display-field'
|
4
|
+
export { FormValue } from './display-field'
|
5
|
+
|
6
|
+
// Exporting from './field'
|
7
|
+
export { Field } from './field'
|
8
|
+
export type { FieldRules, Option } from './field'
|
9
|
+
|
10
|
+
// Exporting from './fields'
|
11
|
+
export { AutoFields } from './fields'
|
12
|
+
export type { FieldsProps } from './fields'
|
13
|
+
|
14
|
+
// Exporting from './fields-context'
|
8
15
|
export { FieldsProvider, useField } from './fields-context'
|
9
|
-
|
10
|
-
|
16
|
+
|
17
|
+
// Exporting from './layout'
|
18
|
+
export { FormLayout } from './layout'
|
19
|
+
export type { FormLayoutProps } from './layout'
|
20
|
+
|
21
|
+
// Exporting from './submit-button'
|
22
|
+
export { SubmitButton } from './submit-button'
|
23
|
+
export type { SubmitButtonProps } from './submit-button'
|
24
|
+
|
25
|
+
// Exporting from './array-field'
|
11
26
|
export {
|
12
27
|
ArrayField,
|
13
28
|
ArrayFieldAddButton,
|
14
|
-
type ArrayFieldButtonProps,
|
15
29
|
ArrayFieldContainer,
|
16
|
-
type ArrayFieldContainerProps,
|
17
|
-
type ArrayFieldProps,
|
18
30
|
ArrayFieldRemoveButton,
|
19
31
|
ArrayFieldRow,
|
20
32
|
ArrayFieldRowContainer,
|
21
33
|
ArrayFieldRowFields,
|
22
|
-
type ArrayFieldRowFieldsProps,
|
23
34
|
ArrayFieldRows,
|
24
|
-
type ArrayFieldRowsProps,
|
25
35
|
} from './array-field'
|
36
|
+
|
37
|
+
export type {
|
38
|
+
ArrayFieldButtonProps,
|
39
|
+
ArrayFieldContainerProps,
|
40
|
+
ArrayFieldProps,
|
41
|
+
ArrayFieldRowFieldsProps,
|
42
|
+
ArrayFieldRowsProps,
|
43
|
+
} from './array-field'
|
44
|
+
|
45
|
+
// Exporting from './use-array-field'
|
26
46
|
export {
|
27
|
-
type ArrayFieldOptions,
|
28
47
|
ArrayFieldProvider,
|
29
48
|
ArrayFieldRowProvider,
|
30
|
-
type UseArrayFieldReturn,
|
31
|
-
type UseArrayFieldRowProps,
|
32
|
-
type UseArrayFieldRowReturn,
|
33
49
|
useArrayField,
|
34
50
|
useArrayFieldAddButton,
|
35
51
|
useArrayFieldContext,
|
@@ -37,65 +53,96 @@ export {
|
|
37
53
|
useArrayFieldRow,
|
38
54
|
useArrayFieldRowContext,
|
39
55
|
} from './use-array-field'
|
40
|
-
|
41
|
-
export
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
56
|
+
|
57
|
+
export type {
|
58
|
+
ArrayFieldOptions,
|
59
|
+
UseArrayFieldReturn,
|
60
|
+
UseArrayFieldRowProps,
|
61
|
+
UseArrayFieldRowReturn,
|
62
|
+
} from './use-array-field'
|
63
|
+
|
64
|
+
// Exporting from './object-field'
|
65
|
+
export { FormLegend, ObjectField } from './object-field'
|
66
|
+
export type { ObjectFieldProps } from './object-field'
|
67
|
+
|
68
|
+
// Exporting from './display-if'
|
69
|
+
export { DisplayIf } from './display-if'
|
70
|
+
export type { DisplayIfProps } from './display-if'
|
71
|
+
|
72
|
+
// Exporting from './step-form'
|
73
|
+
export { FormStep, FormStepper, NextButton, PrevButton } from './step-form'
|
74
|
+
|
75
|
+
export type {
|
76
|
+
FormStepOptions,
|
77
|
+
FormStepProps,
|
78
|
+
FormStepperProps,
|
79
|
+
NextButtonProps,
|
80
|
+
StepFormProps,
|
81
|
+
StepsOptions,
|
53
82
|
} from './step-form'
|
83
|
+
|
84
|
+
// Exporting from './use-step-form'
|
54
85
|
export {
|
55
|
-
type FormStepSubmitHandler,
|
56
|
-
type StepFormContext,
|
57
86
|
StepFormProvider,
|
58
|
-
type StepFormRenderContext,
|
59
|
-
type StepState,
|
60
|
-
type UseFormStepProps,
|
61
|
-
type UseStepFormProps,
|
62
|
-
type UseStepFormReturn,
|
63
87
|
useFormStep,
|
64
88
|
useStepForm,
|
65
89
|
useStepFormContext,
|
66
90
|
} from './use-step-form'
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
91
|
+
|
92
|
+
export type {
|
93
|
+
FormStepSubmitHandler,
|
94
|
+
StepFormContext,
|
95
|
+
StepFormRenderContext,
|
96
|
+
StepState,
|
97
|
+
UseFormStepProps,
|
98
|
+
UseStepFormProps,
|
99
|
+
UseStepFormReturn,
|
100
|
+
} from './use-step-form'
|
101
|
+
|
102
|
+
// Exporting from './field-resolver'
|
103
|
+
export { objectFieldResolver } from './field-resolver'
|
104
|
+
export type {
|
105
|
+
FieldResolver,
|
106
|
+
GetFieldResolver,
|
107
|
+
ObjectSchema,
|
72
108
|
} from './field-resolver'
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
109
|
+
|
110
|
+
// Exporting from './watch-field'
|
111
|
+
export { WatchField } from './watch-field'
|
112
|
+
export type { WatchFieldProps } from './watch-field'
|
113
|
+
|
114
|
+
// Exporting from './input-right-button'
|
115
|
+
export { InputRightButton } from './input-right-button'
|
116
|
+
export type { InputRightButtonProps } from './input-right-button'
|
117
|
+
|
118
|
+
// Exporting from './select'
|
78
119
|
export {
|
79
120
|
NativeSelect,
|
80
|
-
type NativeSelectProps,
|
81
121
|
Select,
|
82
122
|
SelectButton,
|
83
|
-
type SelectButtonProps,
|
84
123
|
SelectList,
|
85
|
-
type SelectListProps,
|
86
124
|
SelectOption,
|
87
|
-
type SelectProps,
|
88
125
|
} from './select'
|
89
|
-
export { PasswordInput, type PasswordInputProps } from './password-input'
|
90
|
-
export {
|
91
|
-
RadioInput,
|
92
|
-
type RadioInputProps,
|
93
|
-
type RadioOption,
|
94
|
-
type RadioOptions,
|
95
|
-
} from './radio'
|
96
126
|
|
127
|
+
export type {
|
128
|
+
NativeSelectProps,
|
129
|
+
SelectButtonProps,
|
130
|
+
SelectListProps,
|
131
|
+
SelectProps,
|
132
|
+
} from './select'
|
133
|
+
|
134
|
+
// Exporting from './password-input'
|
135
|
+
export { PasswordInput } from './password-input'
|
136
|
+
export type { PasswordInputProps } from './password-input'
|
137
|
+
|
138
|
+
// Exporting from './radio'
|
139
|
+
export { RadioInput } from './radio'
|
140
|
+
export type { RadioInputProps, RadioOption, RadioOptions } from './radio'
|
141
|
+
|
142
|
+
// Exporting BaseField from './base-field'
|
97
143
|
export { BaseField } from './base-field'
|
98
144
|
|
145
|
+
// Exporting from './default-fields'
|
99
146
|
export {
|
100
147
|
CheckboxField,
|
101
148
|
InputField,
|
@@ -108,13 +155,22 @@ export {
|
|
108
155
|
SwitchField,
|
109
156
|
TextareaField,
|
110
157
|
defaultFieldTypes,
|
111
|
-
type DefaultFields,
|
112
|
-
type InputFieldProps,
|
113
|
-
type NumberInputFieldProps,
|
114
|
-
type PinFieldProps,
|
115
|
-
type SelectFieldProps,
|
116
158
|
} from './default-fields'
|
117
159
|
|
160
|
+
export type {
|
161
|
+
DefaultFields,
|
162
|
+
InputFieldProps,
|
163
|
+
NumberInputFieldProps,
|
164
|
+
PinFieldProps,
|
165
|
+
SelectFieldProps,
|
166
|
+
SwitchFieldProps,
|
167
|
+
TextareaFieldProps,
|
168
|
+
CheckboxFieldProps,
|
169
|
+
NativeSelectFieldProps,
|
170
|
+
RadioFieldProps,
|
171
|
+
} from './default-fields'
|
172
|
+
|
173
|
+
// Exporting types from './types'
|
118
174
|
export type {
|
119
175
|
FieldProps,
|
120
176
|
WithFields,
|
@@ -124,14 +180,25 @@ export type {
|
|
124
180
|
WithStepFields,
|
125
181
|
} from './types'
|
126
182
|
|
127
|
-
|
128
|
-
export {
|
183
|
+
// Exporting from './create-form'
|
184
|
+
export { createForm } from './create-form'
|
185
|
+
export type { CreateFormProps, FormType } from './create-form'
|
186
|
+
|
187
|
+
// Exporting from './create-field'
|
188
|
+
export { createField } from './create-field'
|
189
|
+
export type { CreateFieldOptions } from './create-field'
|
129
190
|
|
191
|
+
// Exporting from './form'
|
130
192
|
export { Form as BaseForm } from './form'
|
131
193
|
export type { FormProps, FormRenderContext, FormComponent } from './form'
|
132
194
|
|
195
|
+
// Exporting from './form-context'
|
133
196
|
export { FormProvider, useFormContext } from './form-context'
|
134
197
|
|
198
|
+
export { createStepForm } from './create-step-form'
|
199
|
+
export type { CreateStepFormProps } from './create-step-form'
|
200
|
+
|
201
|
+
// Import and export Form and StepForm
|
135
202
|
import { createForm } from './create-form'
|
136
203
|
import { createStepForm } from './create-step-form'
|
137
204
|
|
@@ -142,8 +209,6 @@ import { createStepForm } from './create-step-form'
|
|
142
209
|
*/
|
143
210
|
export const Form = createForm()
|
144
211
|
|
145
|
-
export { createStepForm, type CreateStepFormProps } from './create-step-form'
|
146
|
-
|
147
212
|
/**
|
148
213
|
* Multi-step form component.
|
149
214
|
*
|