@saas-ui/forms 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,908 @@
1
+ import * as React$1 from 'react';
2
+ import React__default from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import * as react_hook_form from 'react-hook-form';
5
+ import { FieldValues, FieldPath, UseFieldArrayReturn, RegisterOptions, UseFormReturn as UseFormReturn$1, UseFormProps, WatchObserver, SubmitHandler, SubmitErrorHandler, ResolverOptions, ResolverResult, FormProviderProps as FormProviderProps$1 } from 'react-hook-form';
6
+ export { BatchFieldArrayUpdate, ChangeHandler, Control, Controller, ControllerFieldState, ControllerProps, ControllerRenderProps, CriteriaMode, CustomElement, DeepMap, DeepPartial, DeepPartialSkipArrayKey, DefaultValues, DelayCallback, EmptyObject, ErrorOption, EventType, FieldArray, FieldArrayMethodProps, FieldArrayWithId, Field as FieldDef, FieldElement, FieldError, FieldErrors, FieldName, FieldNamesMarkedBoolean, FieldRefs, FieldValue, FieldValues, FormProviderProps, FormState, FormStateProxy, FormStateSubjectRef, GetIsDirty, InternalFieldErrors, InternalFieldName, InternalNameSet, IsAny, IsFlatObject, KeepStateOptions, LiteralUnion, Message, Mode, MultipleFieldErrors, Names, NativeFieldValue, NestedValue, NonUndefined, Noop, Primitive, ReadFormState, Ref, RefCallBack, RegisterOptions, Resolver, ResolverError, ResolverOptions, ResolverResult, ResolverSuccess, SetFieldValue, SetValueConfig, Subjects, SubmitErrorHandler, SubmitHandler, TriggerConfig, UnpackNestedValue, UseControllerProps, UseControllerReturn, UseFieldArrayProps, UseFieldArrayReturn, UseFormClearErrors, UseFormGetValues, UseFormHandleSubmit, UseFormProps, UseFormRegister, UseFormRegisterReturn, UseFormReset, UseFormResetField, UseFormReturn, UseFormSetError, UseFormSetFocus, UseFormSetValue, UseFormStateProps, UseFormStateReturn, UseFormTrigger, UseFormUnregister, UseFormWatch, UseWatchProps, Validate, ValidateResult, ValidationMode, ValidationRule, ValidationValue, ValidationValueMessage, WatchInternal, WatchObserver, appendErrors, useController, useFieldArray, useForm, useFormState, useWatch } from 'react-hook-form';
7
+ import * as _chakra_ui_react from '@chakra-ui/react';
8
+ import { NumberInputProps as NumberInputProps$1, NumberInputFieldProps as NumberInputFieldProps$1, InputProps, RadioProps, RadioGroupProps, SystemProps, StackDirection, MenuProps, ThemingProps, ButtonProps, MenuListProps, MenuItemOptionProps, SelectProps as SelectProps$1, TextareaProps, SwitchProps, CheckboxProps, UsePinInputProps, ResponsiveValue, FormLabelProps, SimpleGridProps, FormControlProps, HTMLChakraProps } from '@chakra-ui/react';
9
+ import { UseStepperReturn, UseStepperProps, StepsProps, StepsItemProps } from '@saas-ui/core';
10
+ import { FocusableElement } from '@chakra-ui/utils';
11
+ import { MaybeRenderProp } from '@chakra-ui/react-utils';
12
+
13
+ interface NumberInputOptions {
14
+ /**
15
+ * Hide the stepper. This will be true when `rightAddon` is provided.
16
+ */
17
+ hideStepper?: boolean;
18
+ /**
19
+ * Render a custom increment icon.
20
+ */
21
+ incrementIcon?: React$1.ReactNode;
22
+ /**
23
+ * Render a custom decrement icon.
24
+ */
25
+ decrementIcon?: React$1.ReactNode;
26
+ /**
27
+ * The placeholder text when no value is selected.
28
+ */
29
+ placeholder?: string;
30
+ /**
31
+ * Props to pass to the NumberInputField component.
32
+ */
33
+ fieldProps?: NumberInputFieldProps$1;
34
+ /**
35
+ * Either `InputLeftAddon` or `InputLeftElement`
36
+ */
37
+ leftAddon?: React$1.ReactNode;
38
+ /**
39
+ * Either `InputRightAddon` or `InputRightElement`
40
+ */
41
+ rightAddon?: React$1.ReactNode;
42
+ }
43
+ interface NumberInputProps extends NumberInputProps$1, NumberInputOptions {
44
+ }
45
+
46
+ interface PasswordOptions {
47
+ viewIcon?: React__default.ReactNode;
48
+ viewOffIcon?: React__default.ReactNode;
49
+ leftAddon?: React__default.ReactNode;
50
+ }
51
+ interface PasswordInputProps extends InputProps, PasswordOptions {
52
+ }
53
+ declare const PasswordInput: _chakra_ui_react.ComponentWithAs<"div", PasswordInputProps>;
54
+
55
+ interface RadioOption extends Omit<RadioProps, 'value' | 'label'>, FieldOption {
56
+ }
57
+ type RadioOptions = FieldOptions<RadioOption>;
58
+ interface RadioInputOptions {
59
+ options: RadioOptions;
60
+ spacing?: SystemProps['margin'];
61
+ direction?: StackDirection;
62
+ }
63
+ interface RadioInputProps extends Omit<RadioGroupProps, 'children'>, RadioInputOptions {
64
+ }
65
+ declare const RadioInput: _chakra_ui_react.ComponentWithAs<"div", RadioInputProps>;
66
+
67
+ interface SelectOptions {
68
+ /**
69
+ * The name of the input field in a native form.
70
+ */
71
+ name: string;
72
+ /**
73
+ * The value of the select field.
74
+ */
75
+ value?: string | string[];
76
+ /**
77
+ * The initial value of the select field.
78
+ */
79
+ defaultValue?: string | string[];
80
+ /**
81
+ * The callback invoked when the value of the select field changes.
82
+ * @param value The value of the select field.
83
+ */
84
+ onChange?: (value: string | string[]) => void;
85
+ /**
86
+ * The placeholder text when there's no value.
87
+ */
88
+ placeholder?: string;
89
+ /**
90
+ * If `true`, the select will be disabled.
91
+ */
92
+ isDisabled?: boolean;
93
+ /**
94
+ * An array of options
95
+ * If you leave this empty the children prop will be rendered.
96
+ */
97
+ options?: FieldOptions<SelectOption>;
98
+ /**
99
+ * Enable multiple select.
100
+ */
101
+ multiple?: boolean;
102
+ /**
103
+ * The function used to render the value of the select field.
104
+ * @param value The value of the select field.
105
+ * @returns The rendered value.
106
+ */
107
+ renderValue?: (value: string | string[]) => React__default.ReactNode;
108
+ }
109
+
110
+ interface SelectProps extends Omit<MenuProps, 'children' | 'variant' | 'size'>, ThemingProps<'SuiSelect'>, SelectOptions {
111
+ }
112
+ interface SelectButtonProps extends Omit<ButtonProps, 'size' | 'variant'> {
113
+ }
114
+ /**
115
+ * Button that opens the select menu and displays the selected value.
116
+ *
117
+ * @see https://saas-ui.dev/docs/components/forms/select
118
+ */
119
+ declare const SelectButton: _chakra_ui_react.ComponentWithAs<"button", SelectButtonProps>;
120
+ /**
121
+ * Allow users to select a value from a list of options.
122
+ *
123
+ * @see https://saas-ui.dev/docs/components/forms/select
124
+ */
125
+ declare const Select: _chakra_ui_react.ComponentWithAs<"select", SelectProps>;
126
+ interface SelectListProps extends MenuListProps {
127
+ }
128
+ /**
129
+ * The list of options to choose from.
130
+ *
131
+ * @see https://saas-ui.dev/docs/components/forms/select
132
+ */
133
+ declare const SelectList: React$1.FC<SelectListProps>;
134
+ interface SelectOption extends Omit<MenuItemOptionProps, 'value'>, FieldOption {
135
+ }
136
+ /**
137
+ * An option in a select list
138
+ *
139
+ * @see https://saas-ui.dev/docs/components/forms/select
140
+ */
141
+ declare const SelectOption: _chakra_ui_react.ComponentWithAs<"button", MenuItemOptionProps>;
142
+
143
+ interface Option$1 {
144
+ value: string;
145
+ label?: string;
146
+ }
147
+ interface NativeSelectOptions {
148
+ options?: Option$1[];
149
+ }
150
+ interface NativeSelectProps extends SelectProps$1, NativeSelectOptions {
151
+ }
152
+ declare const NativeSelect: _chakra_ui_react.ComponentWithAs<"select", NativeSelectProps>;
153
+
154
+ interface InputFieldProps extends InputProps {
155
+ type?: string;
156
+ leftAddon?: React$1.ReactNode;
157
+ rightAddon?: React$1.ReactNode;
158
+ }
159
+ declare const InputField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
160
+ interface NumberInputFieldProps extends NumberInputProps {
161
+ type: 'number';
162
+ }
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>;
165
+ interface TextareaFieldProps extends TextareaProps {
166
+ }
167
+ declare const TextareaField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
168
+ interface SwitchFieldProps extends SwitchProps {
169
+ }
170
+ declare const SwitchField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
171
+ interface SelectFieldProps extends SelectProps {
172
+ buttonProps?: SelectButtonProps;
173
+ listProps?: SelectListProps;
174
+ }
175
+ declare const SelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
176
+ type CheckboxFieldProps = CheckboxProps;
177
+ declare const CheckboxField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
178
+ type RadioFieldProps = RadioInputProps;
179
+ declare const RadioField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
180
+ type NativeSelectFieldProps = NativeSelectProps;
181
+ declare const NativeSelectField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
182
+ interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
183
+ pinLength?: number;
184
+ pinType?: 'alphanumeric' | 'number';
185
+ spacing?: SystemProps['margin'];
186
+ }
187
+ declare const PinField: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
188
+ 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>;
202
+ };
203
+ type DefaultFields = typeof defaultFieldTypes;
204
+
205
+ interface SubmitButtonProps extends ButtonProps {
206
+ /**
207
+ * Disable the submit button if the form is untouched.
208
+ */
209
+ disableIfUntouched?: boolean;
210
+ /**
211
+ * Disable the submit button if the form is invalid.
212
+ */
213
+ disableIfInvalid?: boolean;
214
+ }
215
+ /**
216
+ * A button with type submit and default color scheme primary and isLoading state when the form is submitting.
217
+ *
218
+ * @see Docs https://saas-ui.dev/docs/components/forms/form
219
+ */
220
+ declare const SubmitButton: _chakra_ui_react.ComponentWithAs<"button", SubmitButtonProps>;
221
+
222
+ interface ObjectFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends BaseFieldProps {
223
+ name: TName;
224
+ children: React$1.ReactNode;
225
+ columns?: ResponsiveValue<number>;
226
+ spacing?: ResponsiveValue<string | number>;
227
+ }
228
+ declare const FormLegend: (props: FormLabelProps) => react_jsx_runtime.JSX.Element;
229
+ /**
230
+ * The object field component.
231
+ *
232
+ * @see Docs https://saas-ui.dev/docs/components/forms/object-field
233
+ */
234
+ declare const ObjectField: React$1.FC<ObjectFieldProps>;
235
+
236
+ interface FormLayoutProps extends SimpleGridProps {
237
+ }
238
+ /**
239
+ * Create consistent field spacing and positioning.
240
+ *
241
+ *
242
+ * Renders form items in a `SimpleGrid`
243
+ * @see https://chakra-ui.com/docs/layout/simple-grid
244
+ *
245
+ * @see https://saas-ui.dev/docs/components/forms/form
246
+ */
247
+ declare const FormLayout: {
248
+ ({ children, ...props }: FormLayoutProps): react_jsx_runtime.JSX.Element;
249
+ displayName: string;
250
+ };
251
+
252
+ interface UseArrayFieldReturn extends UseFieldArrayReturn {
253
+ /**
254
+ * The array field name
255
+ */
256
+ name: string;
257
+ /**
258
+ * The default value for new items
259
+ */
260
+ defaultValue: Record<string, any>;
261
+ /**
262
+ * Min amount of items
263
+ */
264
+ min?: number;
265
+ /**
266
+ * Max amount of items
267
+ */
268
+ max?: number;
269
+ }
270
+ declare const ArrayFieldProvider: React$1.Provider<UseArrayFieldReturn>;
271
+ declare const useArrayFieldContext: () => UseArrayFieldReturn;
272
+ interface UseArrayFieldRowReturn {
273
+ /**
274
+ * Name of the array field including the index, eg 'field.0'
275
+ */
276
+ name: string;
277
+ /**
278
+ * The field index
279
+ */
280
+ index: number;
281
+ /**
282
+ * Remove this array item
283
+ */
284
+ remove: () => void;
285
+ /**
286
+ * True if this is the first item
287
+ */
288
+ isFirst: boolean;
289
+ /**
290
+ * True if this is the last item
291
+ */
292
+ isLast: boolean;
293
+ }
294
+ declare const ArrayFieldRowProvider: React$1.Provider<UseArrayFieldRowReturn>;
295
+ declare const useArrayFieldRowContext: () => UseArrayFieldRowReturn;
296
+ interface ArrayFieldOptions<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
297
+ /**
298
+ * The field name
299
+ */
300
+ name: TName;
301
+ /**
302
+ * Default value for new values in the array
303
+ */
304
+ defaultValue?: Record<string, any>;
305
+ /**
306
+ * Default key name for rows, change this if your data uses a different 'id' field
307
+ * @default "id"
308
+ */
309
+ keyName?: string;
310
+ min?: number;
311
+ max?: number;
312
+ }
313
+ declare const useArrayField: ({ name, defaultValue, keyName, min, max, }: ArrayFieldOptions) => {
314
+ name: string;
315
+ defaultValue: Record<string, any>;
316
+ min: number | undefined;
317
+ max: number | undefined;
318
+ swap: react_hook_form.UseFieldArraySwap;
319
+ move: react_hook_form.UseFieldArrayMove;
320
+ prepend: react_hook_form.UseFieldArrayPrepend<FieldValues, string>;
321
+ append: react_hook_form.UseFieldArrayAppend<FieldValues, string>;
322
+ remove: react_hook_form.UseFieldArrayRemove;
323
+ insert: react_hook_form.UseFieldArrayInsert<FieldValues, string>;
324
+ update: react_hook_form.UseFieldArrayUpdate<FieldValues, string>;
325
+ replace: react_hook_form.UseFieldArrayReplace<FieldValues, string>;
326
+ fields: Record<string, string>[];
327
+ };
328
+ interface UseArrayFieldRowProps {
329
+ index: number;
330
+ }
331
+ declare const useArrayFieldRow: ({ index }: UseArrayFieldRowProps) => {
332
+ index: number;
333
+ isFirst: boolean;
334
+ isLast: boolean;
335
+ name: string;
336
+ remove: () => void;
337
+ };
338
+ declare const useArrayFieldRemoveButton: () => {
339
+ onClick: () => void;
340
+ isDisabled: boolean;
341
+ };
342
+ declare const useArrayFieldAddButton: () => {
343
+ onClick: () => void;
344
+ isDisabled: boolean;
345
+ };
346
+
347
+ interface ArrayFieldButtonProps extends ButtonProps {
348
+ }
349
+ interface ArrayFieldRowProps extends FormLayoutProps {
350
+ /**
351
+ * Amount of field columns
352
+ */
353
+ columns?: ResponsiveValue<number>;
354
+ /**
355
+ * Spacing between fields
356
+ */
357
+ spacing?: ResponsiveValue<string | number>;
358
+ /**
359
+ * The array index
360
+ */
361
+ index: number;
362
+ /**
363
+ * The fields
364
+ */
365
+ children: React$1.ReactNode;
366
+ }
367
+ /**
368
+ * Render prop component, to get access to the internal fields state. Must be a child of ArrayFieldContainer.
369
+ *
370
+ * @see Docs https://saas-ui.dev/docs/components/forms/array-field
371
+ */
372
+ declare const ArrayFieldRow: React$1.FC<ArrayFieldRowProps>;
373
+ interface ArrayFieldRowFieldsProps extends FormLayoutProps {
374
+ /**
375
+ * Amount of field columns
376
+ */
377
+ columns?: ResponsiveValue<number>;
378
+ /**
379
+ * Spacing between fields
380
+ */
381
+ spacing?: ResponsiveValue<string | number>;
382
+ /**
383
+ * The fields
384
+ */
385
+ children: React$1.ReactNode;
386
+ }
387
+ /**
388
+ * Add the name prefix to the fields and acts as a horizontal form layout by default.
389
+ *
390
+ * @see Docs https://saas-ui.dev/docs/components/forms/array-field
391
+ */
392
+ declare const ArrayFieldRowFields: React$1.FC<ArrayFieldRowFieldsProps>;
393
+ /**
394
+ * The row container component providers row context.
395
+ *
396
+ * @see Docs https://saas-ui.dev/docs/components/forms/array-field
397
+ */
398
+ declare const ArrayFieldRowContainer: React$1.FC<ArrayFieldRowProps>;
399
+ /**
400
+ * The default remove button.
401
+ *
402
+ * @see Docs https://saas-ui.dev/docs/components/forms/array-field
403
+ */
404
+ declare const ArrayFieldRemoveButton: React$1.FC<ArrayFieldButtonProps>;
405
+ /**
406
+ * The default add button.
407
+ *
408
+ * @see Docs https://saas-ui.dev/docs/components/forms/array-field
409
+ */
410
+ declare const ArrayFieldAddButton: React$1.FC<ArrayFieldButtonProps>;
411
+ interface ArrayFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends ArrayFieldOptions<TFieldValues, TName>, Omit<BaseFieldProps<TFieldValues, TName>, 'name' | 'defaultValue' | 'children'> {
412
+ children: MaybeRenderProp<ArrayField[]>;
413
+ }
414
+ interface ArrayField {
415
+ id: string;
416
+ [key: string]: unknown;
417
+ }
418
+ /**
419
+ * The wrapper component that composes the default ArrayField functionality.
420
+ *
421
+ * @see Docs https://saas-ui.dev/docs/components/forms/array-field
422
+ */
423
+ declare const ArrayField: ((props: ArrayFieldProps & {
424
+ ref?: React$1.ForwardedRef<UseArrayFieldReturn>;
425
+ }) => React$1.ReactElement) & {
426
+ displayName: string;
427
+ };
428
+ interface ArrayFieldRowsProps {
429
+ children: (fields: ArrayField[]) => React$1.ReactElement | null;
430
+ }
431
+ declare const ArrayFieldRows: {
432
+ ({ children, }: ArrayFieldRowsProps): React$1.ReactElement | null;
433
+ displayName: string;
434
+ };
435
+ interface ArrayFieldContainerProps extends Omit<ArrayFieldProps, 'children'> {
436
+ children: React$1.ReactNode;
437
+ }
438
+ /**
439
+ * The container component provides context and state management.
440
+ *
441
+ * @see Docs https://saas-ui.dev/docs/components/forms/array-field
442
+ */
443
+ declare const ArrayFieldContainer: React$1.ForwardRefExoticComponent<ArrayFieldContainerProps & React$1.RefAttributes<UseArrayFieldReturn>>;
444
+
445
+ type FieldOption = {
446
+ label?: string;
447
+ value: string;
448
+ };
449
+ type FieldOptions<TOption extends FieldOption = FieldOption> = Array<string> | Array<TOption>;
450
+ type ValueOf<T> = T[keyof T];
451
+ type ShallowMerge<A, B> = Omit<A, keyof B> & B;
452
+ type Split<S extends string, D extends string> = string extends S ? string[] : S extends '' ? [] : S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] : [S];
453
+ type MapPath<T extends string[]> = T extends [infer U, ...infer R] ? U extends string ? `${U extends `${number}` ? '$' : U}${R[0] extends string ? '.' : ''}${R extends string[] ? MapPath<R> : ''}` : '' : '';
454
+ type TransformPath<T extends string> = MapPath<Split<T, '.'>>;
455
+ type ArrayFieldPath<Name extends string> = Name extends string ? TransformPath<Name> : never;
456
+ interface BaseFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<FormControlProps, 'label' | 'type' | 'onChange'> {
457
+ /**
458
+ * The field name
459
+ */
460
+ name: TName | ArrayFieldPath<TName>;
461
+ /**
462
+ * The field label
463
+ */
464
+ label?: string;
465
+ /**
466
+ * Hide the field label
467
+ */
468
+ hideLabel?: boolean;
469
+ /**
470
+ * Field help text
471
+ */
472
+ help?: string;
473
+ /**
474
+ * React hook form rules
475
+ */
476
+ rules?: Omit<RegisterOptions<TFieldValues, TName>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
477
+ /**
478
+ * Build-in types:
479
+ * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin
480
+ *
481
+ * Will default to a text field if there is no matching type.
482
+ */
483
+ type?: string;
484
+ /**
485
+ * The input placeholder
486
+ */
487
+ placeholder?: string;
488
+ }
489
+ type GetBaseField<TProps extends object = object> = () => {
490
+ extraProps: string[];
491
+ BaseField: React.FC<Omit<BaseFieldProps, 'name'> & {
492
+ name: string;
493
+ children: React.ReactNode;
494
+ } & TProps>;
495
+ };
496
+ type FieldPathWithArray<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = TName | ArrayFieldPath<TName>;
497
+ type MergeFieldProps<FieldDefs, TFieldValues extends FieldValues = FieldValues, TExtraFieldProps extends object = object, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ValueOf<{
498
+ [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props> ? {
499
+ type?: K;
500
+ } & ShallowMerge<Props, BaseFieldProps<TFieldValues, TName>> & TExtraFieldProps : never;
501
+ }>;
502
+ type FieldProps<TFieldValues extends FieldValues = FieldValues, TExtraFieldProps extends object = object> = MergeFieldProps<DefaultFields, TFieldValues, TExtraFieldProps>;
503
+ type FormChildren<FieldDefs, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TExtraFieldProps extends object = object> = MaybeRenderProp<FormRenderContext<TFieldValues, TContext, MergeFieldProps<FieldDefs extends never ? DefaultFields : ShallowMerge<DefaultFields, FieldDefs>, TFieldValues, TExtraFieldProps>>>;
504
+ type DefaultFieldOverrides = {
505
+ submit?: SubmitButtonProps;
506
+ [key: string]: any;
507
+ };
508
+ type MergeOverrideFieldProps<FieldDefs, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ValueOf<{
509
+ [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props> ? {
510
+ type?: K;
511
+ } & Omit<ShallowMerge<Props, BaseFieldProps<TFieldValues, TName>>, 'name'> : never;
512
+ }>;
513
+ type FieldOverrides<FieldDefs, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
514
+ [K in FieldPathWithArray<TFieldValues, TName>]?: MergeOverrideFieldProps<FieldDefs extends never ? DefaultFields : ShallowMerge<DefaultFields, FieldDefs>, TFieldValues> | ({
515
+ type?: 'object';
516
+ } & Omit<ObjectFieldProps<TFieldValues>, 'name' | 'children'>) | ({
517
+ type?: 'array';
518
+ } & Omit<ArrayFieldProps<TFieldValues>, 'name' | 'children'>);
519
+ };
520
+ type WithFields<TFormProps extends FormProps<any, any, any, any, any>, FieldDefs, ExtraOverrides = object> = TFormProps extends FormProps<infer TSchema, infer TFieldValues, infer TContext, infer TExtraFieldProps> ? Omit<TFormProps, 'children' | 'fields'> & {
521
+ children?: FormChildren<FieldDefs, TFieldValues, TContext, TExtraFieldProps>;
522
+ fields?: FieldOverrides<FieldDefs, TFieldValues> & {
523
+ submit?: SubmitButtonProps;
524
+ } & ExtraOverrides;
525
+ } : never;
526
+ type StepFormChildren<FieldDefs, TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object> = MaybeRenderProp<StepFormRenderContext<TSteps, TFieldValues, TContext, MergeFieldProps<FieldDefs extends never ? DefaultFields : ShallowMerge<DefaultFields, FieldDefs>, TFieldValues>>>;
527
+ type WithStepFields<TStepFormProps extends UseStepFormProps<any, any, any>, FieldDefs, ExtraOverrides = object> = TStepFormProps extends UseStepFormProps<infer TSteps, infer TFieldValues, infer TContext> ? Omit<TStepFormProps, 'children' | 'fields'> & {
528
+ children?: StepFormChildren<FieldDefs, TSteps, TFieldValues, TContext>;
529
+ fields?: FieldOverrides<FieldDefs, TFieldValues> & {
530
+ submit?: SubmitButtonProps;
531
+ } & ExtraOverrides;
532
+ } : never;
533
+
534
+ type FieldResolver = {
535
+ getFields(): BaseFieldProps[];
536
+ getNestedFields(name: string): BaseFieldProps[];
537
+ };
538
+ type GetFieldResolver<TSchema = any> = (schema: TSchema) => FieldResolver;
539
+ type FieldTypes<FieldDefs = DefaultFields> = ValueOf<{
540
+ [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props> ? {
541
+ type?: K;
542
+ } & Omit<Props, 'name'> : never;
543
+ }>;
544
+ type SchemaField<FieldDefs = DefaultFields> = FieldTypes<FieldDefs> | (Omit<ObjectFieldProps, 'name' | 'children'> & {
545
+ type: 'object';
546
+ properties?: Record<string, SchemaField<FieldDefs>>;
547
+ }) | (Omit<ArrayFieldProps, 'name' | 'children'> & {
548
+ type: 'array';
549
+ items?: SchemaField<FieldDefs>;
550
+ });
551
+ type ObjectSchema<FieldDefs = DefaultFields> = Record<string, SchemaField<FieldDefs>>;
552
+ declare const objectFieldResolver: GetFieldResolver<ObjectSchema>;
553
+
554
+ interface DisplayIfProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
555
+ children: React$1.ReactElement;
556
+ name: TName;
557
+ defaultValue?: unknown;
558
+ isDisabled?: boolean;
559
+ isExact?: boolean;
560
+ condition?: (value: unknown, context: UseFormReturn$1<TFieldValues>) => boolean;
561
+ onToggle?: (conditionMatched: boolean, context: UseFormReturn$1<TFieldValues>) => void;
562
+ }
563
+ /**
564
+ * Conditionally render parts of a form.
565
+ *
566
+ * @see Docs https://saas-ui.dev/docs/components/forms/form
567
+ */
568
+ declare const DisplayIf: {
569
+ <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ children, name, defaultValue, isDisabled, isExact, condition, onToggle, }: DisplayIfProps<TFieldValues, TName>): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
570
+ displayName: string;
571
+ };
572
+
573
+ interface FormRenderContext<TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseFormReturn$1<TFieldValues, TContext> {
574
+ Field: React$1.FC<TFieldTypes & React$1.RefAttributes<FocusableElement>>;
575
+ DisplayIf: React$1.FC<DisplayIfProps<TFieldValues>>;
576
+ ArrayField: React$1.FC<ArrayFieldProps<TFieldValues> & React$1.RefAttributes<UseArrayFieldReturn>>;
577
+ ObjectField: React$1.FC<ObjectFieldProps<TFieldValues>>;
578
+ }
579
+ interface FormOptions<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TExtraFieldProps extends object = object, TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>> {
580
+ /**
581
+ * The form schema.
582
+ */
583
+ schema?: TSchema;
584
+ /**
585
+ * Triggers when any of the field change.
586
+ */
587
+ onChange?: WatchObserver<TFieldValues>;
588
+ /**
589
+ * The submit handler.
590
+ */
591
+ onSubmit: SubmitHandler<TFieldValues>;
592
+ /**
593
+ * Triggers when there are validation errors.
594
+ */
595
+ onError?: SubmitErrorHandler<TFieldValues>;
596
+ /**
597
+ * The Hook Form state ref.
598
+ */
599
+ formRef?: React$1.RefObject<UseFormReturn$1<TFieldValues, TContext>>;
600
+ /**
601
+ * The form children, can be a render prop or a ReactNode.
602
+ */
603
+ children?: MaybeRenderProp<FormRenderContext<TFieldValues, TContext, TFieldTypes>>;
604
+ /**
605
+ * The field resolver, used to resolve the fields from schemas.
606
+ */
607
+ fieldResolver?: FieldResolver;
608
+ /**
609
+ * Field overrides
610
+ */
611
+ fields?: DefaultFieldOverrides;
612
+ }
613
+ interface FormProps<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TExtraFieldProps extends object = object, TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>> extends UseFormProps<TFieldValues, TContext>, Omit<HTMLChakraProps<'form'>, 'children' | 'onChange' | 'onSubmit' | 'onError'>, FormOptions<TSchema, TFieldValues, TContext, TExtraFieldProps, TFieldTypes> {
614
+ }
615
+ /**
616
+ * The wrapper component provides context, state, and focus management.
617
+ *
618
+ * @see Docs https://saas-ui.dev/docs/components/forms/form
619
+ */
620
+ declare const Form$1: FormComponent;
621
+ type FormComponent = (<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TExtraFieldProps extends object = object, TFieldTypes = FieldProps<TFieldValues>>(props: FormProps<TSchema, TFieldValues, TContext, TExtraFieldProps, TFieldTypes> & {
622
+ ref?: React$1.ForwardedRef<HTMLFormElement>;
623
+ }) => React$1.ReactElement) & {
624
+ displayName?: string;
625
+ };
626
+ type GetResolver = <TFieldValues extends FieldValues, TContext extends object>(schema: unknown) => (values: TFieldValues, context: TContext | undefined, options: ResolverOptions<TFieldValues>) => Promise<ResolverResult<TFieldValues>>;
627
+
628
+ interface StepState {
629
+ name: string;
630
+ schema?: any;
631
+ resolver?: any;
632
+ isActive?: boolean;
633
+ isCompleted?: boolean;
634
+ onSubmit?: FormStepSubmitHandler;
635
+ }
636
+ type FormStepSubmitHandler<TFieldValues extends FieldValues = FieldValues> = (data: TFieldValues, stepper: UseStepperReturn) => Promise<void>;
637
+ interface StepFormContext extends UseStepperReturn {
638
+ updateStep(state: StepState): void;
639
+ steps: Record<string, StepState>;
640
+ }
641
+ declare const StepFormProvider: React$1.Provider<StepFormContext>;
642
+ declare const useStepFormContext: () => StepFormContext;
643
+
644
+ type StepName<T extends {
645
+ [k: number]: {
646
+ readonly name: string;
647
+ };
648
+ }> = T[number]['name'];
649
+ interface StepFormRenderContext<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseStepFormReturn<TFieldValues> {
650
+ Field: React$1.FC<TFieldTypes & React$1.RefAttributes<FocusableElement>>;
651
+ FormStep: React$1.FC<FormStepProps<StepName<TSteps>>>;
652
+ DisplayIf: React$1.FC<DisplayIfProps<TFieldValues>>;
653
+ ArrayField: React$1.FC<ArrayFieldProps<TFieldValues> & React$1.RefAttributes<UseArrayFieldReturn>>;
654
+ ObjectField: React$1.FC<ObjectFieldProps<TFieldValues>>;
655
+ }
656
+ interface UseStepFormProps<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object> extends Omit<UseStepperProps, 'onChange'>, Omit<FormProps<any, TFieldValues, TContext>, 'children'> {
657
+ steps?: TSteps;
658
+ children: StepFormChildren<any, TSteps, TFieldValues, TContext>;
659
+ }
660
+ interface UseStepFormReturn<TFieldValues extends FieldValues = FieldValues> extends UseStepperReturn {
661
+ getFormProps(): {
662
+ onSubmit: SubmitHandler<TFieldValues>;
663
+ schema?: any;
664
+ resolver?: any;
665
+ };
666
+ updateStep(step: any): void;
667
+ steps: Record<string, any>;
668
+ }
669
+ declare function useStepForm<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object>(props: UseStepFormProps<TSteps, TFieldValues, TContext>): UseStepFormReturn<TFieldValues>;
670
+ interface UseFormStepProps {
671
+ name: string;
672
+ schema?: any;
673
+ resolver?: any;
674
+ onSubmit?: FormStepSubmitHandler;
675
+ }
676
+ declare function useFormStep(props: UseFormStepProps): StepState;
677
+
678
+ type StepsOptions<TSchema, TName extends string = string> = {
679
+ /**
680
+ * The step name
681
+ */
682
+ name: TName;
683
+ /**
684
+ * Schema
685
+ */
686
+ schema?: TSchema;
687
+ }[];
688
+ interface StepFormProps<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object> extends UseStepFormProps<TSteps, TFieldValues, TContext> {
689
+ }
690
+ interface FormStepOptions<TName extends string = string> {
691
+ /**
692
+ * The step name
693
+ */
694
+ name: TName;
695
+ /**
696
+ * Schema
697
+ */
698
+ schema?: any;
699
+ /**
700
+ * Hook Form Resolver
701
+ */
702
+ resolver?: any;
703
+ }
704
+ interface FormStepperProps extends StepsProps, ThemingProps<'Stepper'> {
705
+ render?: StepsItemProps['render'];
706
+ }
707
+ /**
708
+ * Renders a stepper that displays progress above the form.
709
+ *
710
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
711
+ */
712
+ declare const FormStepper: React$1.FC<FormStepperProps>;
713
+ interface FormStepProps<TName extends string = string> extends FormStepOptions<TName>, Omit<HTMLChakraProps<'div'>, 'onSubmit'> {
714
+ onSubmit?: FormStepSubmitHandler;
715
+ }
716
+ /**
717
+ * The form step containing fields for a specific step.
718
+ *
719
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
720
+ */
721
+ declare const FormStep: {
722
+ <TName extends string = string>(props: FormStepProps<TName>): react_jsx_runtime.JSX.Element | null;
723
+ displayName: string;
724
+ };
725
+ /**
726
+ * A button that this opens the previous step when clicked. Disabled on the first step.
727
+ *
728
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
729
+ */
730
+ declare const PrevButton: React$1.FC<ButtonProps>;
731
+ interface NextButtonProps extends Omit<ButtonProps, 'children'> {
732
+ submitLabel?: string;
733
+ label?: string;
734
+ }
735
+ /**
736
+ * A button that submits the active step.
737
+ *
738
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
739
+ */
740
+ declare const NextButton: React$1.FC<NextButtonProps>;
741
+
742
+ type StepFormType<FieldDefs, ExtraProps = object, ExtraFieldProps extends object = object, ExtraOverrides = object> = (<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues, ExtraFieldProps>>(props: WithStepFields<UseStepFormProps<TSteps, TFieldValues, TContext>, FieldDefs, ExtraOverrides> & {
743
+ ref?: React__default.ForwardedRef<HTMLFormElement>;
744
+ } & ExtraProps) => React__default.ReactElement) & {
745
+ displayName?: string;
746
+ id?: string;
747
+ };
748
+ interface CreateStepFormProps<FieldDefs, TGetBaseField extends GetBaseField = GetBaseField> {
749
+ resolver?: GetResolver;
750
+ fieldResolver?: GetFieldResolver;
751
+ fields?: FieldDefs extends Record<string, React__default.FC<any>> ? FieldDefs : never;
752
+ getBaseField?: TGetBaseField;
753
+ }
754
+ declare function createStepForm<FieldDefs, TGetBaseField extends GetBaseField<any> = GetBaseField<any>>({ fields, resolver, fieldResolver, getBaseField, }?: CreateStepFormProps<FieldDefs, TGetBaseField>): StepFormType<FieldDefs, object, TGetBaseField extends GetBaseField<infer ExtraFieldProps extends object> ? ExtraFieldProps : object, object>;
755
+
756
+ interface CreateFormProps<FieldDefs, TGetBaseField extends GetBaseField = GetBaseField> {
757
+ resolver?: GetResolver;
758
+ fieldResolver?: GetFieldResolver;
759
+ fields?: FieldDefs extends Record<string, React__default.FC<any>> ? FieldDefs : never;
760
+ getBaseField?: TGetBaseField;
761
+ }
762
+ type FormType<FieldDefs, ExtraProps = object, ExtraFieldProps extends object = object, ExtraOverrides = object> = (<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object>(props: WithFields<FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>, FieldDefs, ExtraOverrides> & {
763
+ ref?: React__default.ForwardedRef<HTMLFormElement>;
764
+ } & ExtraProps) => React__default.ReactElement) & {
765
+ displayName?: string;
766
+ id?: string;
767
+ };
768
+ declare function createForm<FieldDefs, TGetBaseField extends GetBaseField<any> = GetBaseField<any>>({ resolver, fieldResolver, fields, getBaseField, }?: CreateFormProps<FieldDefs, TGetBaseField>): FormType<FieldDefs, object, TGetBaseField extends GetBaseField<infer ExtraFieldProps extends object> ? ExtraFieldProps : object, object>;
769
+
770
+ interface DisplayFieldProps extends Omit<FormControlProps, 'onChange'>, Omit<FieldProps, 'type' | 'label' | 'onChange'> {
771
+ }
772
+ /**
773
+ * Display a field value.
774
+ *
775
+ * @see Docs https://saas-ui.dev/
776
+ */
777
+ declare const DisplayField: React$1.FC<DisplayFieldProps>;
778
+ declare const FormValue: React$1.FC<{
779
+ name: string;
780
+ }>;
781
+
782
+ interface Option {
783
+ value: string;
784
+ label?: string;
785
+ [key: string]: unknown;
786
+ }
787
+ type FieldRules = Pick<RegisterOptions, 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'>;
788
+ /**
789
+ * Form field component.
790
+ *
791
+ * Build-in types:
792
+ * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin
793
+ *
794
+ * Will default to a text field if there is no matching type.
795
+
796
+ * @see Docs https://saas-ui.dev/docs/components/forms/field
797
+ */
798
+ declare const Field: (<TFieldValues extends FieldValues>(props: FieldProps<TFieldValues> & {
799
+ ref?: React$1.ForwardedRef<FocusableElement>;
800
+ }) => React$1.ReactElement) & {
801
+ displayName?: string | undefined;
802
+ };
803
+
804
+ interface FieldsProps<TSchema = any> {
805
+ schema?: TSchema;
806
+ fieldResolver?: FieldResolver;
807
+ focusFirstField?: boolean;
808
+ }
809
+ declare const AutoFields: React$1.FC<FieldsProps>;
810
+
811
+ interface FieldsContextValue {
812
+ fields: Record<string, React__default.FC<any>>;
813
+ getBaseField?: GetBaseField<any>;
814
+ }
815
+ declare const FieldsProvider: React__default.FC<{
816
+ value: Partial<FieldsContextValue>;
817
+ children: React__default.ReactNode;
818
+ }>;
819
+ declare const useField: (type: string) => React__default.FC<any>;
820
+
821
+ type FormProviderProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = FormProviderProps$1<TFieldValues, TContext> & {
822
+ fieldResolver?: FieldResolver;
823
+ schema?: TSchema;
824
+ fields?: {
825
+ [key: string]: unknown;
826
+ };
827
+ };
828
+ declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any>() => {
829
+ fieldResolver?: FieldResolver | undefined;
830
+ schema?: any;
831
+ fields?: {
832
+ [key: string]: unknown;
833
+ } | undefined;
834
+ watch: react_hook_form.UseFormWatch<FieldValues>;
835
+ getValues: react_hook_form.UseFormGetValues<FieldValues>;
836
+ getFieldState: react_hook_form.UseFormGetFieldState<FieldValues>;
837
+ setError: react_hook_form.UseFormSetError<FieldValues>;
838
+ clearErrors: react_hook_form.UseFormClearErrors<FieldValues>;
839
+ setValue: react_hook_form.UseFormSetValue<FieldValues>;
840
+ trigger: react_hook_form.UseFormTrigger<FieldValues>;
841
+ formState: react_hook_form.FormState<FieldValues>;
842
+ resetField: react_hook_form.UseFormResetField<FieldValues>;
843
+ reset: react_hook_form.UseFormReset<FieldValues>;
844
+ handleSubmit: react_hook_form.UseFormHandleSubmit<FieldValues, FieldValues>;
845
+ unregister: react_hook_form.UseFormUnregister<FieldValues>;
846
+ control: react_hook_form.Control<FieldValues, any, FieldValues>;
847
+ register: react_hook_form.UseFormRegister<FieldValues>;
848
+ setFocus: react_hook_form.UseFormSetFocus<FieldValues>;
849
+ };
850
+ type UseFormReturn<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = ReturnType<typeof useFormContext>;
851
+ declare const FormProvider: <TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any>(props: FormProviderProps<TFieldValues, TContext, TSchema>) => react_jsx_runtime.JSX.Element;
852
+
853
+ interface WatchFieldProps<Value = unknown, TFieldValues extends FieldValues = FieldValues> {
854
+ name: string;
855
+ defaultValue?: Value;
856
+ isDisabled?: boolean;
857
+ isExact?: boolean;
858
+ children: (value: Value, form: UseFormReturn<TFieldValues>) => React.ReactElement | void;
859
+ }
860
+ declare const WatchField: <Value = unknown, TFieldValues extends FieldValues = FieldValues>(props: WatchFieldProps<Value, TFieldValues>) => React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
861
+
862
+ type InputRightButtonProps = ButtonProps;
863
+ declare const InputRightButton: _chakra_ui_react.ComponentWithAs<"div", ButtonProps>;
864
+
865
+ declare const useBaseField: (props: BaseFieldProps) => {
866
+ controlProps: Pick<BaseFieldProps<react_hook_form.FieldValues, string>, "id" | "isRequired" | "isDisabled" | "isInvalid" | "isReadOnly">;
867
+ error: any;
868
+ touched: any;
869
+ name: string;
870
+ label?: string | undefined;
871
+ hideLabel?: boolean | undefined;
872
+ help?: string | undefined;
873
+ };
874
+ /**
875
+ * The default BaseField component
876
+ * Composes the Chakra UI FormControl component, with FormLabel, FormHelperText and FormErrorMessage.
877
+ */
878
+ declare const BaseField: React$1.FC<BaseFieldProps>;
879
+
880
+ interface CreateFieldOptions<TProps extends object> {
881
+ isControlled?: boolean;
882
+ hideLabel?: boolean;
883
+ BaseField?: React$1.FC<any>;
884
+ }
885
+ /**
886
+ * Register a new field type
887
+ * @param type The name for this field in kebab-case, eg `email` or `array-field`
888
+ * @param component The React component
889
+ * @param options
890
+ * @param options.isControlled Set this to true if this is a controlled field.
891
+ * @param options.hideLabel Hide the field label, for example for the checkbox field.
892
+ */
893
+ declare const createField: <TProps extends object>(component: React$1.FC<TProps>, options?: CreateFieldOptions<TProps>) => React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TProps> & TProps>;
894
+
895
+ /**
896
+ * Form component.
897
+ *
898
+ * @see Docs https://saas-ui.dev/docs/components/forms/form
899
+ */
900
+ declare const Form: FormType<unknown, object, any, object>;
901
+ /**
902
+ * Multi-step form component.
903
+ *
904
+ * @see Docs https://saas-ui.dev/docs/components/forms/step-form
905
+ */
906
+ declare const StepForm: StepFormType<unknown, object, any, object>;
907
+
908
+ export { ArrayField, ArrayFieldAddButton, type ArrayFieldButtonProps, ArrayFieldContainer, type ArrayFieldContainerProps, type ArrayFieldOptions, type ArrayFieldProps, ArrayFieldProvider, ArrayFieldRemoveButton, ArrayFieldRow, ArrayFieldRowContainer, ArrayFieldRowFields, type ArrayFieldRowFieldsProps, ArrayFieldRowProvider, ArrayFieldRows, type ArrayFieldRowsProps, AutoFields, BaseField, type BaseFieldProps, Form$1 as BaseForm, CheckboxField, type CheckboxFieldProps, type CreateFieldOptions, type CreateFormProps, type CreateStepFormProps, type DefaultFieldOverrides, type DefaultFields, DisplayField, type DisplayFieldProps, DisplayIf, type DisplayIfProps, Field, type FieldOptions, type FieldProps, type FieldResolver, type FieldRules, type FieldsProps, FieldsProvider, Form, type FormComponent, FormLayout, type FormLayoutProps, FormLegend, type FormProps, FormProvider, type FormRenderContext, FormStep, type FormStepOptions, type FormStepProps, type FormStepSubmitHandler, FormStepper, type FormStepperProps, type FormType, FormValue, type GetBaseField, type GetFieldResolver, InputField, type InputFieldProps, InputRightButton, type InputRightButtonProps, NativeSelect, NativeSelectField, type NativeSelectFieldProps, type NativeSelectProps, NextButton, type NextButtonProps, NumberInputField, type NumberInputFieldProps, ObjectField, type ObjectFieldProps, type ObjectSchema, type Option, PasswordInput, PasswordInputField, type PasswordInputProps, PinField, type PinFieldProps, PrevButton, RadioField, type RadioFieldProps, RadioInput, type RadioInputProps, type RadioOption, type RadioOptions, Select, SelectButton, type SelectButtonProps, SelectField, type SelectFieldProps, SelectList, type SelectListProps, SelectOption, type SelectProps, StepForm, type StepFormContext, type StepFormProps, StepFormProvider, type StepFormRenderContext, type StepState, type StepsOptions, SubmitButton, type SubmitButtonProps, SwitchField, type SwitchFieldProps, TextareaField, type TextareaFieldProps, type UseArrayFieldReturn, type UseArrayFieldRowProps, type UseArrayFieldRowReturn, type UseFormStepProps, type UseStepFormProps, type UseStepFormReturn, WatchField, type WatchFieldProps, type WithFields, type WithStepFields, createField, createForm, createStepForm, defaultFieldTypes, objectFieldResolver, useArrayField, useArrayFieldAddButton, useArrayFieldContext, useArrayFieldRemoveButton, useArrayFieldRow, useArrayFieldRowContext, useBaseField, useField, useFormContext, useFormStep, useStepForm, useStepFormContext };