@saas-ui/forms 2.6.9 → 2.6.10
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +50 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/create-field.tsx +4 -1
- package/src/create-form.tsx +8 -5
package/dist/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/form-context.tsx","../src/display-field.tsx","../src/field.tsx","../src/fields-context.tsx","../src/default-fields.tsx","../src/number-input/number-input.tsx","../src/password-input/password-input.tsx","../src/input-right-button/input-right-button.tsx","../src/radio/radio-input.tsx","../src/utils.ts","../src/select/select.tsx","../src/select/select-context.tsx","../src/select/native-select.tsx","../src/create-field.tsx","../src/base-field.tsx","../src/fields.tsx","../src/layout.tsx","../src/array-field.tsx","../src/use-array-field.tsx","../src/object-field.tsx","../src/submit-button.tsx","../src/display-if.tsx","../src/step-form.tsx","../src/use-step-form.tsx","../src/field-resolver.ts","../src/watch-field.tsx","../src/create-form.tsx","../src/form.tsx","../src/create-step-form.tsx","../src/index.ts"],"sourcesContent":["import * as React from 'react'\nimport {\n FormProvider as HookFormProvider,\n FormProviderProps as HookFormProviderProps,\n useFormContext as useHookFormContext,\n FieldValues,\n} from 'react-hook-form'\nimport { FieldResolver } from './field-resolver'\nimport type { BaseFieldProps } from './types'\n\nexport type FormContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nexport type FormProviderProps<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = HookFormProviderProps<TFieldValues, TContext> & {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nconst FormContext = React.createContext<FormContextValue | null>(null)\n\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>() => {\n const context = React.useContext(FormContext)\n const hookContext = useHookFormContext<TFieldValues, TContext>()\n\n return {\n ...hookContext,\n ...context,\n }\n}\n\nexport const useFieldProps = <TFieldValues extends FieldValues = FieldValues>(\n name: string\n): BaseFieldProps<TFieldValues> | undefined => {\n const parsedName = name?.replace(/\\.[0-9]/g, '.$')\n const context = useFormContext()\n return (context?.fields?.[parsedName] as any) || {}\n}\n\nexport type UseFormReturn<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = ReturnType<typeof useFormContext<TFieldValues, TContext, TSchema>>\n\nexport const FormProvider = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>(\n props: FormProviderProps<TFieldValues, TContext, TSchema>\n) => {\n const { children, fieldResolver, schema, fields, ...rest } = props\n return (\n <HookFormProvider {...rest}>\n <FormContext.Provider value={{ fieldResolver, schema, fields }}>\n {children}\n </FormContext.Provider>\n </HookFormProvider>\n )\n}\n","import * as React from 'react'\nimport { useFormContext } from './form-context'\nimport {\n Text,\n FormControl,\n FormControlProps,\n FormLabel,\n} from '@chakra-ui/react'\n\nimport { FieldProps } from './types'\n\nexport interface DisplayFieldProps\n extends Omit<FormControlProps, 'onChange'>,\n Omit<FieldProps, 'type' | 'label' | 'onChange'> {}\n\n/**\n * Display a field value.\n *\n * @see Docs https://saas-ui.dev/\n */\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n placeholder,\n ...props\n}) => {\n return (\n <FormControl {...props}>\n {label ? <FormLabel htmlFor={name}>{label}</FormLabel> : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FormControl>\n )\n}\n\nDisplayField.displayName = 'DisplayField'\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n\nFormValue.displayName = 'FormValue'\n","import * as React from 'react'\nimport { RegisterOptions, FieldValues } from 'react-hook-form'\n\nimport { FocusableElement } from '@chakra-ui/utils'\nimport { useField } from './fields-context'\nimport { FieldProps } from './types'\nimport { useFieldProps } from './form-context'\nimport { InputField } from './default-fields'\n\nexport interface Option {\n value: string\n label?: string\n [key: string]: unknown\n}\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nconst defaultInputType = 'text'\n\n/**\n * Form field component.\n * \n * Build-in types:\n * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin\n *\n * Will default to a text field if there is no matching type.\n\n * @see Docs https://saas-ui.dev/docs/components/forms/field\n */\nexport const Field = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues>,\n ref: React.ForwardedRef<FocusableElement>\n ) => {\n const { type = defaultInputType, name } = props\n const overrides = useFieldProps(name)\n const InputComponent = useField(overrides?.type || type, InputField)\n\n return <InputComponent ref={ref} {...props} {...overrides} />\n }\n) as (<TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n ref?: React.ForwardedRef<FocusableElement>\n }\n) => React.ReactElement) & {\n displayName?: string\n}\n","import React from 'react'\nimport { defaultFieldTypes, InputField } from './default-fields'\nimport type { GetBaseField } from './types'\n\nexport interface FieldsContextValue {\n fields: Record<string, React.FC<any>>\n getBaseField?: GetBaseField<any>\n}\n\nconst FieldsContext = React.createContext<FieldsContextValue | null>(null)\n\nexport const FieldsProvider: React.FC<{\n value: FieldsContextValue\n children: React.ReactNode\n}> = (props) => {\n return (\n <FieldsContext.Provider value={props.value}>\n {props.children}\n </FieldsContext.Provider>\n )\n}\n\nexport const useFieldsContext = () => {\n return React.useContext(FieldsContext)\n}\n\nexport const useField = (\n type: string,\n fallback: React.FC<any>\n): React.FC<any> => {\n const context = React.useContext(FieldsContext)\n return context?.fields?.[type] || fallback\n}\n","import * as React from 'react'\n\nimport {\n forwardRef,\n Input,\n Textarea,\n Checkbox,\n Switch,\n InputGroup,\n InputProps,\n TextareaProps,\n SwitchProps,\n CheckboxProps,\n PinInputField,\n HStack,\n PinInput,\n UsePinInputProps,\n SystemProps,\n} from '@chakra-ui/react'\n\nimport { NumberInput, NumberInputProps } from './number-input'\nimport { PasswordInput, PasswordInputProps } from './password-input'\nimport { RadioInput, RadioInputProps } from './radio'\n\nimport {\n Select,\n SelectButton,\n SelectList,\n SelectProps,\n NativeSelect,\n NativeSelectProps,\n SelectButtonProps,\n SelectListProps,\n} from './select'\n\nimport { createField } from './create-field'\n\nexport interface InputFieldProps extends InputProps {\n type?: string\n leftAddon?: React.ReactNode\n rightAddon?: React.ReactNode\n}\n\nexport const InputField = createField<InputFieldProps>(\n forwardRef(({ type = 'text', leftAddon, rightAddon, size, ...rest }, ref) => {\n const input = <Input type={type} size={size} {...rest} ref={ref} />\n if (leftAddon || rightAddon) {\n return (\n <InputGroup size={size}>\n {leftAddon}\n {input}\n {rightAddon}\n </InputGroup>\n )\n }\n return input\n })\n)\n\nexport interface NumberInputFieldProps extends NumberInputProps {\n type: 'number'\n}\n\nexport const NumberInputField = createField<NumberInputFieldProps>(\n NumberInput,\n {\n isControlled: true,\n }\n)\n\nexport const PasswordInputField = createField<PasswordInputProps>(\n forwardRef((props, ref) => <PasswordInput ref={ref} {...props} />)\n)\n\nexport interface TextareaFieldProps extends TextareaProps {}\n\nexport const TextareaField = createField<TextareaFieldProps>(Textarea)\n\nexport interface SwitchFieldProps extends SwitchProps {}\n\nexport const SwitchField = createField<SwitchFieldProps>(\n forwardRef(({ type, value, ...rest }, ref) => {\n return <Switch isChecked={!!value} {...rest} ref={ref} />\n }),\n {\n isControlled: true,\n }\n)\n\nexport interface SelectFieldProps extends SelectProps<boolean> {\n buttonProps?: SelectButtonProps\n listProps?: SelectListProps\n}\n\nexport const SelectField = createField<SelectFieldProps>(\n forwardRef((props, ref) => {\n const { buttonProps, listProps, ...rest } = props\n\n return (\n <Select ref={ref} {...rest}>\n <SelectButton {...buttonProps} />\n <SelectList {...listProps} />\n </Select>\n )\n }),\n {\n isControlled: true,\n }\n)\n\nexport type CheckboxFieldProps = CheckboxProps\n\nexport const CheckboxField = createField<CheckboxFieldProps>(\n forwardRef(({ label, type, ...props }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n }),\n {\n hideLabel: true,\n }\n)\n\nexport type RadioFieldProps = RadioInputProps\n\nexport const RadioField = createField<RadioFieldProps>(RadioInput, {\n isControlled: true,\n})\n\nexport type NativeSelectFieldProps = NativeSelectProps\n\nexport const NativeSelectField = createField<NativeSelectFieldProps>(\n NativeSelect,\n {\n isControlled: true,\n }\n)\n\nexport interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {\n pinLength?: number\n pinType?: 'alphanumeric' | 'number'\n spacing?: SystemProps['margin']\n}\n\nexport const PinField = createField<PinFieldProps>(\n forwardRef((props, ref) => {\n const { pinLength = 4, pinType, spacing, ...inputProps } = props\n\n const inputs: React.ReactNode[] = []\n for (let i = 0; i < pinLength; i++) {\n inputs.push(<PinInputField key={i} ref={ref} />)\n }\n\n return (\n <HStack spacing={spacing}>\n <PinInput {...inputProps} type={pinType}>\n {inputs}\n </PinInput>\n </HStack>\n )\n }),\n {\n isControlled: true,\n }\n)\n\nexport const defaultFieldTypes = {\n text: InputField,\n email: InputField,\n url: InputField,\n phone: InputField,\n time: InputField,\n number: NumberInputField,\n password: PasswordInputField,\n textarea: TextareaField,\n switch: SwitchField,\n select: SelectField,\n checkbox: CheckboxField,\n radio: RadioField,\n pin: PinField,\n 'native-select': NativeSelectField,\n}\n\nexport type DefaultFields = typeof defaultFieldTypes\n","import * as React from 'react'\n\nimport {\n forwardRef,\n NumberInput as ChakraNumberInput,\n NumberInputField,\n NumberInputStepper,\n NumberIncrementStepper,\n NumberDecrementStepper,\n NumberInputProps as ChakraNumberInputProps,\n NumberInputFieldProps,\n InputGroup,\n InputLeftAddon,\n InputRightAddon,\n InputLeftElement,\n InputRightElement,\n} from '@chakra-ui/react'\n\nimport { ChevronDownIcon, ChevronUpIcon } from '@saas-ui/core'\n\ninterface NumberInputOptions {\n /**\n * Hide the stepper. This will be true when `rightAddon` is provided.\n */\n hideStepper?: boolean\n /**\n * Render a custom increment icon.\n */\n incrementIcon?: React.ReactNode\n /**\n * Render a custom decrement icon.\n */\n decrementIcon?: React.ReactNode\n /**\n * The placeholder text when no value is selected.\n */\n placeholder?: string\n /**\n * Props to pass to the NumberInputField component.\n */\n fieldProps?: NumberInputFieldProps\n /**\n * Either `InputLeftAddon` or `InputLeftElement`\n */\n leftAddon?: React.ReactNode\n /**\n * Either `InputRightAddon` or `InputRightElement`\n */\n rightAddon?: React.ReactNode\n}\n\nconst Input = forwardRef<NumberInputFieldProps, 'input'>((props, ref) => (\n <NumberInputField ref={ref} {...props} />\n))\nInput.displayName = 'NumberInputField'\nInput.id = 'Input'\n\nexport interface NumberInputProps\n extends ChakraNumberInputProps,\n NumberInputOptions {}\n\nexport const NumberInput = forwardRef<NumberInputProps, 'div'>((props, ref) => {\n const {\n hideStepper = false,\n incrementIcon = <ChevronUpIcon />,\n decrementIcon = <ChevronDownIcon />,\n leftAddon,\n rightAddon,\n placeholder,\n fieldProps: _fieldProps,\n ...rest\n } = props\n\n const fieldProps = { placeholder, ..._fieldProps }\n\n return (\n <ChakraNumberInput {...rest} ref={ref}>\n <InputGroup>\n {leftAddon}\n <Input {...fieldProps} />\n {rightAddon}\n </InputGroup>\n {!hideStepper && !rightAddon ? (\n <NumberInputStepper>\n <NumberIncrementStepper children={incrementIcon} />\n <NumberDecrementStepper children={decrementIcon} />\n </NumberInputStepper>\n ) : null}\n </ChakraNumberInput>\n )\n})\n\nNumberInput.displayName = 'NumberInput'\n","import React, { useState } from 'react'\n\nimport { forwardRef, InputGroup, Input, InputProps } from '@chakra-ui/react'\n\nimport { ViewIcon, ViewOffIcon } from '@saas-ui/core/icons'\n\nimport { InputRightButton } from '../input-right-button'\n\ninterface PasswordOptions {\n viewIcon?: React.ReactNode\n viewOffIcon?: React.ReactNode\n leftAddon?: React.ReactNode\n}\n\nexport interface PasswordInputProps extends InputProps, PasswordOptions {}\n\nexport const PasswordInput = forwardRef<PasswordInputProps, 'div'>(\n (props, ref) => {\n const {\n viewIcon,\n viewOffIcon,\n autoComplete,\n w,\n width,\n size,\n variant,\n leftAddon,\n ...inputProps\n } = props\n const [show, setShow] = useState(false)\n const handleClick = () => setShow(!show)\n\n const label = show ? 'Hide password' : 'Show password'\n\n let icon\n if (show) {\n icon = viewIcon || <ViewIcon />\n } else {\n icon = viewOffIcon || <ViewOffIcon />\n }\n\n const groupProps = {\n width: w || width,\n size,\n variant,\n }\n\n return (\n <InputGroup {...groupProps}>\n {leftAddon}\n <Input\n {...inputProps}\n ref={ref}\n type={show ? 'text' : 'password'}\n autoComplete={show ? 'off' : autoComplete}\n />\n <InputRightButton\n onClick={handleClick}\n aria-label={label}\n variant=\"ghost\"\n >\n {icon}\n </InputRightButton>\n </InputGroup>\n )\n }\n)\n\nPasswordInput.displayName = 'PasswordInput'\n","import * as React from 'react'\n\nimport {\n Button,\n ButtonProps,\n forwardRef,\n InputRightElement,\n} from '@chakra-ui/react'\n\nexport type InputRightButtonProps = ButtonProps\n\nexport const InputRightButton = forwardRef<InputRightButtonProps, 'div'>(\n (props, ref) => {\n return (\n <InputRightElement w=\"auto\" px=\"1\" py=\"1\" alignItems=\"stretch\">\n <Button ref={ref} height=\"auto\" {...props} />\n </InputRightElement>\n )\n }\n)\n\nInputRightButton.id = 'InputRightElement'\n\nInputRightButton.displayName = 'InputRightButton'\n","import * as React from 'react'\n\nimport {\n forwardRef,\n Stack,\n RadioGroup,\n RadioGroupProps,\n Radio,\n RadioProps,\n SystemProps,\n StackDirection,\n} from '@chakra-ui/react'\nimport { FieldOptions, FieldOption } from '../types'\nimport { mapOptions } from '../utils'\n\nexport interface RadioOption\n extends Omit<RadioProps, 'value' | 'label'>,\n FieldOption {}\n\nexport type RadioOptions = FieldOptions<RadioOption>\n\ninterface RadioInputOptions {\n options: RadioOptions\n spacing?: SystemProps['margin']\n direction?: StackDirection\n}\n\nexport interface RadioInputProps\n extends Omit<RadioGroupProps, 'children'>,\n RadioInputOptions {}\n\nexport const RadioInput = forwardRef<RadioInputProps, 'div'>(\n ({ options: optionsProp, spacing, direction, ...props }, ref) => {\n const { onBlur, onChange, ...groupProps } = props\n\n const options = mapOptions(optionsProp)\n\n return (\n <RadioGroup onChange={onChange} {...groupProps}>\n <Stack spacing={spacing} direction={direction}>\n {options.map(({ value, label, ...radioProps }, i) => {\n return (\n <Radio\n key={i}\n onBlur={onBlur}\n value={value}\n ref={ref}\n {...radioProps}\n >\n {label || value}\n </Radio>\n )\n })}\n </Stack>\n </RadioGroup>\n )\n }\n)\n\nRadioInput.displayName = 'RadioInput'\n","import * as React from 'react'\nimport { FieldOption, FieldOptions } from './types'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n let childName = child.props.name\n if (childName.includes('.')) {\n childName = childName.replace(/^.*\\.(.*)/, '$1')\n } else if (childName.includes('.$')) {\n childName = childName.replace(/^.*\\.\\$(.*)/, '$1')\n }\n\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${childName}`,\n })\n }\n return child\n })\n}\n\nexport const mapOptions = <TOption extends FieldOption = FieldOption>(\n options: FieldOptions<TOption>\n) => {\n return options.map((option) => {\n if (typeof option === 'string') {\n return {\n label: option,\n value: option,\n }\n }\n return option\n })\n}\n","import * as React from 'react'\n\nimport {\n chakra,\n forwardRef,\n Menu,\n MenuProps,\n MenuList,\n MenuListProps,\n MenuItemOption,\n MenuOptionGroup,\n Button,\n ButtonProps,\n omitThemingProps,\n useMultiStyleConfig,\n MenuItemOptionProps,\n useFormControlContext,\n ThemingProps,\n useMenuButton,\n} from '@chakra-ui/react'\nimport { cx, dataAttr } from '@chakra-ui/utils'\nimport { ChevronDownIcon } from '@saas-ui/core'\n\nimport { FieldOption } from '../types'\n\nimport {\n SelectOptions,\n SelectProvider,\n SelectStylesProvider,\n useSelect,\n useSelectContext,\n useSelectStyles,\n} from './select-context'\n\nexport interface SelectOption\n extends Omit<MenuItemOptionProps, 'value'>,\n FieldOption {}\n\nexport interface SelectProps<\n Multiple extends boolean = false,\n Value = Multiple extends true ? string[] : string,\n> extends Omit<MenuProps, 'children' | 'variant' | 'size'>,\n ThemingProps<'SuiSelect'>,\n SelectOptions<Multiple, Value> {\n children: React.ReactNode\n}\n\nexport interface SelectButtonProps\n extends Omit<ButtonProps, 'size' | 'variant'> {}\n\n/**\n * Button that opens the select menu and displays the selected value.\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const SelectButton = forwardRef<SelectButtonProps, 'button'>(\n (props, ref) => {\n const {\n displayValue,\n renderValue,\n placeholder,\n isDisabled: isSelectDisabled,\n } = useSelectContext()\n\n const context = useFormControlContext()\n\n const styles = useSelectStyles()\n\n const {\n isInvalid,\n isReadOnly,\n isDisabled,\n isFocused,\n isRequired,\n id,\n onBlur,\n onFocus,\n } = context || {}\n\n const { rightIcon = <ChevronDownIcon />, ...rest } = props\n\n /* @ts-ignore */\n const focusStyles = styles.field?._focusVisible\n /* @ts-ignore */\n const readOnlyStyles = styles.field?._readOnly\n /* @ts-ignore */\n const invalid = styles.field?._invalid\n\n const height = styles.field?.h || styles.field?.height\n\n const buttonStyles: any = {\n fontWeight: 'normal',\n textAlign: 'left',\n color: 'inherit',\n _active: {\n bg: 'transparent',\n },\n minH: height,\n _focus: focusStyles,\n _expanded: focusStyles,\n _readOnly: readOnlyStyles,\n _invalid: invalid,\n minW: 0,\n ...styles.field,\n h: 'auto',\n ...props.sx,\n }\n\n const buttonProps = useMenuButton(rest, ref)\n\n // Using a Button, so we can simply use leftIcon and rightIcon\n return (\n <Button\n {...buttonProps}\n sx={buttonStyles}\n {...rest}\n onFocus={onFocus}\n onBlur={onBlur}\n isDisabled={isDisabled || isSelectDisabled}\n data-invalid={dataAttr(isInvalid)}\n data-read-only={dataAttr(isReadOnly)}\n data-focus={dataAttr(isFocused)}\n data-required={dataAttr(isRequired)}\n rightIcon={rightIcon}\n >\n <chakra.span\n __css={{\n display: 'block',\n pointerEvents: 'none',\n flex: '1 1 auto',\n minW: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {renderValue(displayValue) || placeholder}\n </chakra.span>\n </Button>\n )\n }\n)\n\nSelectButton.displayName = 'SelectButton'\n\n/**\n * Allow users to select a value from a list of options.\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const Select = forwardRef((props, ref) => {\n const { name, children, isDisabled, multiple, ...rest } = props\n\n const styles = useMultiStyleConfig('SuiSelect', props)\n\n const menuProps = omitThemingProps(rest)\n\n const context = useSelect(props)\n\n const { value, controlProps } = context\n\n return (\n <SelectProvider value={context}>\n <SelectStylesProvider value={styles}>\n <Menu {...menuProps} closeOnSelect={!multiple}>\n <chakra.div className={cx('sui-select')}>\n {children}\n <chakra.input\n {...controlProps}\n ref={ref}\n name={name}\n type=\"hidden\"\n value={value || ''}\n className=\"saas-select__input\"\n />\n </chakra.div>\n </Menu>\n </SelectStylesProvider>\n </SelectProvider>\n )\n}) as (<Multiple extends boolean = false>(\n props: SelectProps<Multiple> & {\n ref?: React.ForwardedRef<HTMLFormElement>\n }\n) => React.ReactElement) & {\n displayName?: string\n}\n\nexport interface SelectListProps extends MenuListProps {}\n\n/**\n * The list of options to choose from.\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const SelectList: React.FC<SelectListProps> = (props) => {\n const { defaultValue, value, options, multiple, onChange } =\n useSelectContext()\n\n return (\n <MenuList maxH=\"100vh\" overflowY=\"auto\" {...props}>\n <MenuOptionGroup\n defaultValue={(defaultValue || value) as string | string[] | undefined}\n value={value}\n onChange={onChange}\n type={multiple ? 'checkbox' : 'radio'}\n >\n {options\n ? options.map(({ value, label, ...rest }, i) => (\n <SelectOption key={i} value={value} {...rest}>\n {label || value}\n </SelectOption>\n ))\n : props.children}\n </MenuOptionGroup>\n </MenuList>\n )\n}\n\nSelect.displayName = 'Select'\n\n/**\n * An option in a select list\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const SelectOption = forwardRef<MenuItemOptionProps, 'button'>(\n (props, ref) => {\n return <MenuItemOption ref={ref} {...props} />\n }\n)\nSelectOption.id = 'MenuItemOption'\nSelectOption.displayName = 'SelectOption'\n","import {\n HTMLChakraProps,\n createStylesContext,\n useControllableState,\n useFormControl,\n} from '@chakra-ui/react'\nimport { createContext } from '@chakra-ui/react-utils'\nimport React from 'react'\nimport { FieldOptions } from '../types'\nimport { mapOptions } from '../utils'\nimport { SelectOption } from './select'\n\nexport const [SelectStylesProvider, useSelectStyles] =\n createStylesContext('SuiSelect')\n\nexport const [SelectProvider, useSelectContext] = createContext<\n ReturnType<typeof useSelect>\n>({\n strict: true,\n})\n\nexport interface SelectOptions<\n Multiple extends boolean = false,\n Value = Multiple extends true ? string[] : string,\n> {\n /**\n * The name of the input field in a native form.\n */\n name: string\n /**\n * The value of the select field.\n */\n value?: Value\n /**\n * The initial value of the select field.\n */\n defaultValue?: Value\n /**\n * The callback invoked when the value of the select field changes.\n * @param value The value of the select field.\n */\n onChange?: (value: Value) => void\n /**\n * The placeholder text when there's no value.\n */\n placeholder?: string\n /**\n * If `true`, the select will be disabled.\n */\n isDisabled?: boolean\n /**\n * An array of options\n * If you leave this empty the children prop will be rendered.\n */\n options?: FieldOptions<SelectOption>\n /**\n * Enable multiple select.\n */\n multiple?: Multiple\n /**\n * The function used to render the value of the select field.\n * @param value The value of the select field.\n * @returns The rendered value.\n */\n renderValue?: (value: Value) => React.ReactNode\n}\n\nexport const useSelect = (props: SelectOptions<boolean>) => {\n const {\n name,\n value,\n defaultValue,\n onChange,\n multiple,\n placeholder,\n options: optionsProp,\n isDisabled,\n renderValue = (value) =>\n typeof value === 'string' ? value : value?.join(', '),\n } = props\n const [currentValue, setCurrentValue] = useControllableState({\n value,\n defaultValue,\n onChange,\n })\n\n const controlProps = useFormControl({ name } as HTMLChakraProps<'input'>)\n\n const options = React.useMemo(\n () => optionsProp && mapOptions(optionsProp),\n [optionsProp]\n )\n\n const handleChange = (value: string | string[]) => {\n setCurrentValue(value)\n }\n\n const getDisplayValue = React.useCallback(\n (value: string) => {\n if (!options) {\n return value\n }\n\n for (const option of options) {\n if (option.value === value) {\n return option.label || option.value\n }\n }\n\n return value\n },\n [options]\n )\n\n const displayValue = React.useMemo(\n () =>\n currentValue\n ? (Array.isArray(currentValue) ? currentValue : [currentValue]).map(\n getDisplayValue\n )\n : [],\n [currentValue, getDisplayValue]\n )\n\n return {\n defaultValue,\n value: currentValue,\n displayValue,\n renderValue,\n onChange: handleChange,\n options,\n multiple,\n controlProps,\n placeholder,\n isDisabled,\n }\n}\n","import * as React from 'react'\n\nimport {\n forwardRef,\n Select as ChakraSelect,\n SelectProps as ChakraSelectProps,\n} from '@chakra-ui/react'\n\ninterface Option {\n value: string\n label?: string\n}\n\ninterface NativeSelectOptions {\n options?: Option[]\n}\n\nexport interface NativeSelectProps\n extends ChakraSelectProps,\n NativeSelectOptions {}\n\nexport const NativeSelect = forwardRef<NativeSelectProps, 'select'>(\n ({ options, children, ...props }, ref) => {\n return (\n <ChakraSelect ref={ref} {...props}>\n {children ||\n options?.map(({ value, label }) => {\n return (\n <option key={value} value={value}>\n {label || value}\n </option>\n )\n })}\n </ChakraSelect>\n )\n }\n)\n\nNativeSelect.displayName = 'NativeSelect'\n","import * as React from 'react'\nimport { Controller } from 'react-hook-form'\n\nimport { forwardRef, useMergeRefs } from '@chakra-ui/react'\nimport { callAllHandlers } from '@chakra-ui/utils'\n\nimport { splitProps } from '@saas-ui/core'\n\nimport { BaseFieldProps, FieldProps, GetBaseField } from './types'\nimport { BaseField } from './base-field'\nimport { useFormContext } from './form-context'\nimport { useFieldsContext } from './fields-context'\n\ninterface CreateFieldProps<ExtraFieldProps extends object = object> {\n displayName: string\n hideLabel?: boolean\n getBaseField: GetBaseField<ExtraFieldProps>\n}\n\nconst _createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, getBaseField: getBaseFieldProp }: CreateFieldProps\n) => {\n const Field = forwardRef<any, 'div'>((props, ref) => {\n const { id, name, label, isRequired, rules } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n const fieldContext = useFieldsContext()\n\n const getBaseField = fieldContext?.getBaseField ?? getBaseFieldProp\n\n const { extraProps, BaseField } = getBaseField()\n\n const [, inputProps] = splitProps(\n props,\n [\n 'children',\n 'name',\n 'label',\n 'isRequired',\n 'isDisabled',\n 'isInvalid',\n 'isReadOnly',\n 'help',\n 'hideLabel',\n ].concat(extraProps)\n )\n\n return (\n <BaseField hideLabel={hideLabel} {...props}>\n <InputComponent\n ref={ref}\n id={id}\n name={name}\n label={hideLabel ? label : undefined} // Only pass down the label when it should be inline.\n {...inputProps}\n rules={inputRules}\n />\n </BaseField>\n )\n })\n\n Field.displayName = displayName\n\n return Field\n}\n\nconst withControlledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { control } = useFormContext()\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAllHandlers(onChange, field.onChange)}\n onBlur={callAllHandlers(inputProps.onBlur, field.onBlur)}\n ref={useMergeRefs(ref, _ref)}\n />\n )}\n />\n )\n }\n )\n}\n\nconst withUncontrolledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAllHandlers(onChange, field.onChange)}\n onBlur={callAllHandlers(inputProps.onBlur, field.onBlur)}\n ref={useMergeRefs(ref, _ref)}\n />\n )\n }\n )\n}\n\nexport interface CreateFieldOptions<TProps extends object> {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for the checkbox field.\n */\nexport const createField = <TProps extends object>(\n component: React.FC<TProps>,\n options?: CreateFieldOptions<TProps>\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(component)\n } else {\n InputComponent = withUncontrolledInput(component)\n }\n\n const Field = _createField(InputComponent, {\n displayName: `${component.displayName ?? 'Custom'}Field`,\n hideLabel: options?.hideLabel,\n getBaseField: () => ({\n extraProps: [],\n BaseField,\n }),\n }) as React.FC<Omit<BaseFieldProps, keyof TProps> & TProps>\n\n return Field\n}\n","import * as React from 'react'\nimport { FormState, get } from 'react-hook-form'\n\nimport {\n Box,\n FormControl,\n FormLabel,\n FormHelperText,\n FormErrorMessage,\n useBreakpointValue,\n} from '@chakra-ui/react'\n\nimport { splitProps } from '@saas-ui/core'\n\nimport { useFormContext } from './form-context'\n\nimport type { BaseFieldProps } from './types'\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const useBaseField = (props: BaseFieldProps) => {\n const [fieldProps] = splitProps(props, ['name', 'label', 'help', 'hideLabel'])\n\n const [controlProps] = splitProps(props, [\n 'id',\n 'direction',\n 'isDisabled',\n 'isInvalid',\n 'isReadOnly',\n 'isRequired',\n ])\n\n const { formState } = useFormContext()\n\n const error = getError(fieldProps.name, formState)\n const touched = isTouched(fieldProps.name, formState)\n\n return {\n ...fieldProps,\n controlProps,\n error,\n touched,\n }\n}\n\n/**\n * The default BaseField component\n * Composes the Chakra UI FormControl component, with FormLabel, FormHelperText and FormErrorMessage.\n */\nexport const BaseField: React.FC<BaseFieldProps> = (props) => {\n const { controlProps, label, help, hideLabel, error } = useBaseField(props)\n\n const isInvalid = !!error || controlProps.isInvalid\n\n const { direction, ...rest } = controlProps\n\n return (\n <FormControl\n {...rest}\n isInvalid={isInvalid}\n variant={direction === 'row' ? 'horizontal' : undefined}\n >\n {label && !hideLabel ? <FormLabel>{label}</FormLabel> : null}\n <Box>\n {props.children}\n {help && !error?.message ? (\n <FormHelperText>{help}</FormHelperText>\n ) : null}\n {error?.message && (\n <FormErrorMessage>{error?.message}</FormErrorMessage>\n )}\n </Box>\n </FormControl>\n )\n}\n\nBaseField.displayName = 'BaseField'\n","import * as React from 'react'\n\nimport { FormLayout } from './layout'\nimport { BaseFieldProps } from './types'\nimport { Field } from './field'\n\nimport { ArrayField } from './array-field'\nimport { ObjectField } from './object-field'\nimport { FieldResolver } from './field-resolver'\nimport { useFormContext } from './form-context'\n\nexport interface FieldsProps<TSchema = any> {\n schema?: TSchema\n fieldResolver?: FieldResolver\n focusFirstField?: boolean\n}\n\nconst mapNestedFields = (resolver: FieldResolver, name: string) => {\n return resolver\n .getNestedFields(name)\n ?.map(\n (\n { name, type, ...nestedFieldProps }: BaseFieldProps,\n i\n ): React.ReactNode => (\n <Field\n key={name || i}\n name={name}\n type={type as any}\n {...nestedFieldProps}\n />\n )\n )\n}\n\nexport const AutoFields: React.FC<FieldsProps> = ({\n schema: schemaProp,\n fieldResolver: fieldResolverProp,\n focusFirstField,\n ...props\n}) => {\n const context = useFormContext()\n const schema = schemaProp || context.schema\n const fieldResolver = fieldResolverProp || context.fieldResolver\n const resolver = React.useMemo(() => fieldResolver, [schema, fieldResolver])\n\n const fields = React.useMemo(() => resolver?.getFields(), [resolver])\n\n const form = useFormContext()\n\n React.useEffect(() => {\n if (focusFirstField && fields?.[0]?.name) {\n form.setFocus(fields[0].name)\n }\n }, [schema, fieldResolver, focusFirstField])\n\n if (!resolver) {\n return null\n }\n\n return (\n <FormLayout {...props}>\n {fields?.map(\n ({\n name,\n type,\n defaultValue,\n ...fieldProps\n }: BaseFieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ObjectField>\n )\n }\n\n return (\n <Field\n key={name}\n name={name}\n type={type as any}\n defaultValue={defaultValue}\n {...fieldProps}\n />\n )\n }\n )}\n </FormLayout>\n )\n}\n\nAutoFields.displayName = 'Fields'\n","import * as React from 'react'\n\nimport {\n chakra,\n omitThemingProps,\n SimpleGrid,\n SimpleGridProps,\n ThemingProps,\n useStyleConfig,\n useTheme,\n} from '@chakra-ui/react'\nimport { cx } from '@chakra-ui/utils'\n\nexport interface FormLayoutProps\n extends ThemingProps<'SuiFormLayout'>,\n SimpleGridProps {}\n\ninterface FormLayoutItemProps {\n children: React.ReactNode\n}\n\nconst FormLayoutItem: React.FC<FormLayoutItemProps> = ({ children }) => {\n return <chakra.div>{children}</chakra.div>\n}\n\nFormLayoutItem.displayName = 'FormLayoutItem'\n\n/**\n * Create consistent field spacing and positioning.\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n *\n * @see https://saas-ui.dev/docs/components/forms/form\n */\nexport const FormLayout = ({ children, ...props }: FormLayoutProps) => {\n const theme = useTheme()\n\n const defaultProps = theme.components?.SuiFormLayout?.defaultProps ?? {\n spacing: 4,\n }\n\n const styles = useStyleConfig('SuiFormLayout', props)\n\n const gridProps = omitThemingProps({\n ...defaultProps,\n ...props,\n })\n\n return (\n <SimpleGrid\n {...gridProps}\n className={cx('sui-form__layout', props.className)}\n sx={{\n ...styles,\n ...props.sx,\n }}\n >\n {children}\n </SimpleGrid>\n )\n}\n\nFormLayout.displayName = 'FormLayout'\n","import * as React from 'react'\n\nimport {\n chakra,\n ResponsiveValue,\n forwardRef,\n Button,\n ButtonProps,\n} from '@chakra-ui/react'\nimport { PlusIcon, MinusIcon } from '@saas-ui/core/icons'\n\nimport { FormLayout, FormLayoutProps } from './layout'\nimport { BaseField } from './base-field'\nimport { BaseFieldProps } from './types'\n\nimport { mapNestedFields } from './utils'\n\nimport {\n useArrayField,\n useArrayFieldRow,\n useArrayFieldContext,\n ArrayFieldProvider,\n ArrayFieldOptions,\n ArrayFieldRowProvider,\n useArrayFieldRowContext,\n useArrayFieldRemoveButton,\n useArrayFieldAddButton,\n UseArrayFieldReturn,\n} from './use-array-field'\nimport { FieldPath, FieldValues } from 'react-hook-form'\nimport { isFunction } from '@chakra-ui/utils'\nimport { MaybeRenderProp } from '@chakra-ui/react-utils'\nimport { useFieldProps } from './form-context'\n\nexport interface ArrayFieldButtonProps extends ButtonProps {}\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps extends FormLayoutProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The array index\n */\n index: number\n /**\n * The fields\n */\n children: React.ReactNode\n}\n/**\n * Render prop component, to get access to the internal fields state. Must be a child of ArrayFieldContainer.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rowFieldsProps\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields {...rowFieldsProps}>{children}</ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nArrayFieldRow.displayName = 'ArrayFieldRow'\n\nexport interface ArrayFieldRowFieldsProps extends FormLayoutProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The fields\n */\n children: React.ReactNode\n}\n/**\n * Add the name prefix to the fields and acts as a horizontal form layout by default.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout flex=\"1\" mr=\"2\" {...layoutProps}>\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nArrayFieldRowFields.displayName = 'ArrayFieldRowFields'\n\n/**\n * The row container component providers row context.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rest\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div {...rest} __css={styles}>\n {children}\n </chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nArrayFieldRowContainer.displayName = 'ArrayFieldRowContainer'\n\n/**\n * The default remove button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRemoveButton: React.FC<ArrayFieldButtonProps> = (\n props\n) => {\n return (\n <Button aria-label=\"Remove row\" {...useArrayFieldRemoveButton()} {...props}>\n {props.children || <MinusIcon />}\n </Button>\n )\n}\n\nArrayFieldRemoveButton.displayName = 'ArrayFieldRemoveButton'\n\n/**\n * The default add button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldAddButton: React.FC<ArrayFieldButtonProps> = (props) => {\n return (\n <Button\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n >\n {props.children || <PlusIcon />}\n </Button>\n )\n}\n\nArrayFieldAddButton.displayName = 'ArrayFieldAddButton'\n\nexport interface ArrayFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends ArrayFieldOptions<TFieldValues, TName>,\n Omit<\n BaseFieldProps<TFieldValues, TName>,\n 'name' | 'defaultValue' | 'children'\n > {\n children: MaybeRenderProp<ArrayField[]>\n}\n\n/**\n * The wrapper component that composes the default ArrayField functionality.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayField = forwardRef(\n (props: ArrayFieldProps, ref: React.ForwardedRef<UseArrayFieldReturn>) => {\n const { children, ...containerProps } = props\n\n const rowFn = isFunction(children)\n ? children\n : (fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n )) || null}\n </>\n )\n\n return (\n <ArrayFieldContainer ref={ref} {...containerProps}>\n <ArrayFieldRows>{rowFn as any}</ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n }\n) as ((\n props: ArrayFieldProps & {\n ref?: React.ForwardedRef<UseArrayFieldReturn>\n }\n) => React.ReactElement) & {\n displayName: string\n}\n\nArrayField.displayName = 'ArrayField'\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nArrayFieldRows.displayName = 'ArrayFieldRows'\n\nexport interface ArrayFieldContainerProps\n extends Omit<ArrayFieldProps, 'children'> {\n children: React.ReactNode\n}\n\n/**\n * The container component provides context and state management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldContainer = React.forwardRef(\n (\n {\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n }: ArrayFieldContainerProps,\n ref: React.ForwardedRef<UseArrayFieldReturn>\n ) => {\n const overrides = useFieldProps(name)\n\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min: min || (overrides as any)?.min,\n max: max || (overrides as any)?.max,\n })\n\n // This exposes the useArrayField api through the forwarded ref\n React.useImperativeHandle(ref, () => context, [ref, context])\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps} {...overrides}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n }\n)\n\nArrayFieldContainer.displayName = 'ArrayFieldContainer'\n","import * as React from 'react'\nimport {\n useFieldArray,\n UseFieldArrayReturn,\n FieldValues,\n FieldPath,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\n\nimport { createContext } from '@chakra-ui/react-utils'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n /**\n * The field name\n */\n name: TName\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses a different 'id' field\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\nimport {\n FormControl,\n FormLabel,\n FormLabelProps,\n ResponsiveValue,\n useStyleConfig,\n} from '@chakra-ui/react'\n\nimport { FormLayout } from './layout'\nimport { BaseFieldProps } from './types'\n\nimport { mapNestedFields } from './utils'\nimport { FieldPath, FieldValues } from 'react-hook-form'\nimport { useFieldProps } from './form-context'\n\nexport interface ObjectFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends BaseFieldProps {\n name: TName\n children: React.ReactNode\n columns?: ResponsiveValue<number>\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const FormLegend = (props: FormLabelProps) => {\n const styles = useStyleConfig('SuiFormLegend')\n return <FormLabel as=\"legend\" sx={styles} {...props} />\n}\n/**\n * The object field component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/object-field\n */\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const {\n name,\n label,\n hideLabel: hideLabelProp,\n children,\n columns: columnsProp,\n spacing: spacingProp,\n ...fieldProps\n } = props\n\n const { hideLabel, columns, spacing, ...overrides } = useFieldProps(\n name\n ) as Omit<ObjectFieldProps, 'name'>\n\n return (\n <FormControl name={name} as=\"fieldset\" {...fieldProps} {...overrides}>\n <FormLegend display={hideLabelProp || hideLabel ? 'none' : 'block'}>\n {label}\n </FormLegend>\n <FormLayout\n columns={columnsProp || columns}\n gridGap={spacingProp || spacing}\n >\n {mapNestedFields(name, children)}\n </FormLayout>\n </FormControl>\n )\n}\n\nObjectField.displayName = 'ObjectField'\n","import * as React from 'react'\n\nimport { useFormContext } from 'react-hook-form'\n\nimport { Button, ButtonProps, forwardRef } from '@chakra-ui/react'\nimport { useFieldProps } from './form-context'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n */\n disableIfInvalid?: boolean\n}\n/**\n * A button with type submit and default color scheme primary and isLoading state when the form is submitting.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const SubmitButton = forwardRef<SubmitButtonProps, 'button'>(\n (props, ref) => {\n const {\n variant = 'primary',\n children = 'Submit',\n disableIfUntouched: disableIfUntouchedProp = false,\n disableIfInvalid: disableIfInvalidProp = false,\n isDisabled: isDisabledProp,\n isLoading,\n ...rest\n } = props\n const { formState } = useFormContext()\n\n const field = useFieldProps('submit') as SubmitButtonProps\n\n const {\n disableIfUntouched: disableIfUntouchedOverride,\n disableIfInvalid: disableIfInvalidOverride,\n ...fieldProps\n } = field\n\n const disableIfUntouched =\n disableIfUntouchedOverride ?? disableIfUntouchedProp\n const disableIfInvalid = disableIfInvalidOverride ?? disableIfInvalidProp\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid) ||\n isDisabledProp\n\n return (\n <Button\n ref={ref}\n variant={variant}\n type=\"submit\"\n isLoading={formState.isSubmitting || isLoading}\n isDisabled={isDisabled}\n children={children}\n {...rest}\n {...fieldProps}\n />\n )\n }\n)\n\nSubmitButton.displayName = 'SubmitButton'\n","import * as React from 'react'\nimport {\n useWatch,\n FieldValues,\n UseFormReturn,\n FieldPath,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\n\nexport interface DisplayIfProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> {\n children: React.ReactElement\n name: TName\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n onToggle?: (\n conditionMatched: boolean,\n context: UseFormReturn<TFieldValues>\n ) => void\n}\n/**\n * Conditionally render parts of a form.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const DisplayIf = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n onToggle,\n}: DisplayIfProps<TFieldValues, TName>) => {\n const initializedRef = React.useRef(false)\n const matchesRef = React.useRef(false)\n\n const value = useWatch<TFieldValues>({\n name,\n defaultValue: defaultValue as any,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext() as any\n\n const matches = condition(value, context)\n\n React.useEffect(() => {\n if (!initializedRef.current) {\n initializedRef.current = true\n return\n }\n if (matchesRef.current === matches) return\n matchesRef.current = matches\n onToggle?.(matches, context)\n }, [value])\n\n return matches ? children : null\n}\n\nDisplayIf.displayName = 'DisplayIf'\n","import * as React from 'react'\n\nimport { FieldValues } from 'react-hook-form'\n\nimport {\n chakra,\n Button,\n ButtonProps,\n HTMLChakraProps,\n ThemingProps,\n} from '@chakra-ui/react'\n\nimport { callAllHandlers, cx } from '@chakra-ui/utils'\n\nimport {\n Steps,\n StepsItem,\n StepsItemProps,\n StepsProps,\n useStepperContext,\n} from '@saas-ui/core'\n\nimport { SubmitButton } from './submit-button'\n\nimport {\n useFormStep,\n UseStepFormProps,\n FormStepSubmitHandler,\n} from './use-step-form'\n\nexport type StepsOptions<TSchema, TName extends string = string> = {\n /**\n * The step name\n */\n name: TName\n /**\n * Schema\n */\n schema?: TSchema\n}[]\n\nexport interface StepFormProps<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object\n> extends UseStepFormProps<TSteps, TFieldValues, TContext> {}\n\nexport interface FormStepOptions<TName extends string = string> {\n /**\n * The step name\n */\n name: TName\n /**\n * Schema\n */\n schema?: any\n /**\n * Hook Form Resolver\n */\n resolver?: any\n}\n\nexport interface FormStepperProps extends StepsProps, ThemingProps<'Stepper'> {\n render?: StepsItemProps['render']\n}\n\n/**\n * Renders a stepper that displays progress above the form.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const FormStepper: React.FC<FormStepperProps> = (props) => {\n const { activeIndex, setIndex } = useStepperContext()\n\n const {\n children,\n orientation,\n variant,\n colorScheme,\n size,\n onChange: onChangeProp,\n render,\n ...rest\n } = props\n\n const elements = React.Children.map(children, (child) => {\n if (\n React.isValidElement<FormStepProps>(child) &&\n child?.type === FormStep\n ) {\n const { isCompleted } = useFormStep(child.props) // Register this step\n return (\n <StepsItem\n render={render}\n name={child.props.name}\n title={child.props.title}\n isCompleted={isCompleted}\n {...rest}\n >\n {child.props.children}\n </StepsItem>\n )\n }\n return child\n })\n\n const onChange = React.useCallback((i: number) => {\n setIndex(i)\n onChangeProp?.(i)\n }, [])\n\n return (\n <Steps\n orientation={orientation}\n step={activeIndex}\n variant={variant}\n colorScheme={colorScheme}\n size={size}\n onChange={onChange}\n >\n {elements}\n </Steps>\n )\n}\n\nexport interface FormStepProps<TName extends string = string>\n extends FormStepOptions<TName>,\n Omit<HTMLChakraProps<'div'>, 'onSubmit'> {\n onSubmit?: FormStepSubmitHandler\n}\n/**\n * The form step containing fields for a specific step.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const FormStep = <TName extends string = string>(\n props: FormStepProps<TName>\n) => {\n const { name, children, className, onSubmit, ...rest } = props\n const step = useFormStep({ name, onSubmit })\n\n const { isActive } = step\n\n return isActive ? (\n <chakra.div {...rest} className={cx('sui-form__step', className)}>\n {children}\n </chakra.div>\n ) : null\n}\n\nFormStep.displayName = 'FormStep'\n\n/**\n * A button that this opens the previous step when clicked. Disabled on the first step.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const PrevButton: React.FC<ButtonProps> = (props) => {\n const { isFirstStep, isCompleted, prevStep } = useStepperContext()\n\n return (\n <Button\n isDisabled={isFirstStep || isCompleted}\n children=\"Back\"\n {...props}\n className={cx('sui-form__prev-button', props.className)}\n onClick={callAllHandlers(props.onClick, prevStep)}\n />\n )\n}\n\nPrevButton.displayName = 'PrevButton'\n\nexport interface NextButtonProps extends Omit<ButtonProps, 'children'> {\n submitLabel?: string\n label?: string\n}\n\n/**\n * A button that submits the active step.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const NextButton: React.FC<NextButtonProps> = (props) => {\n const { label = 'Next', submitLabel = 'Complete', ...rest } = props\n const { isLastStep, isCompleted } = useStepperContext()\n\n return (\n <SubmitButton\n {...rest}\n isDisabled={isCompleted}\n className={cx('sui-form__next-button', props.className)}\n >\n {isLastStep || isCompleted ? submitLabel : label}\n </SubmitButton>\n )\n}\n\nNextButton.displayName = 'NextButton'\n","import * as React from 'react'\nimport { FieldValues, SubmitHandler } from 'react-hook-form'\nimport { createContext } from '@chakra-ui/react-utils'\nimport {\n useStepper,\n useStep,\n UseStepperProps,\n UseStepperReturn,\n} from '@saas-ui/core'\n\nexport interface StepState {\n name: string\n schema?: any\n resolver?: any\n isActive?: boolean\n isCompleted?: boolean\n onSubmit?: FormStepSubmitHandler\n}\n\nexport type FormStepSubmitHandler<\n TFieldValues extends FieldValues = FieldValues\n> = (data: TFieldValues, stepper: UseStepperReturn) => Promise<void>\n\nexport interface StepFormContext extends UseStepperReturn {\n updateStep(state: StepState): void\n steps: Record<string, StepState>\n}\n\nexport const [StepFormProvider, useStepFormContext] =\n createContext<StepFormContext>({\n name: 'StepFormContext',\n errorMessage:\n 'useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`',\n })\n\nimport { FocusableElement } from '@chakra-ui/utils'\nimport { FormProps } from './form'\nimport { FormStepProps, StepsOptions } from './step-form'\nimport { FieldProps, StepFormChildren } from './types'\nimport { DisplayIfProps } from './display-if'\nimport { ArrayFieldProps } from './array-field'\nimport { UseArrayFieldReturn } from './use-array-field'\nimport { ObjectFieldProps } from './object-field'\n\ntype StepName<T extends { [k: number]: { readonly name: string } }> =\n T[number]['name']\n\nexport interface StepFormRenderContext<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues>\n> extends UseStepFormReturn<TFieldValues> {\n Field: React.FC<TFieldTypes & React.RefAttributes<FocusableElement>>\n FormStep: React.FC<FormStepProps<StepName<TSteps>>>\n DisplayIf: React.FC<DisplayIfProps<TFieldValues>>\n ArrayField: React.FC<\n ArrayFieldProps<TFieldValues> & React.RefAttributes<UseArrayFieldReturn>\n >\n ObjectField: React.FC<ObjectFieldProps<TFieldValues>>\n}\n\nexport interface UseStepFormProps<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object\n> extends Omit<UseStepperProps, 'onChange'>,\n Omit<FormProps<any, TFieldValues, TContext>, 'children'> {\n steps?: TSteps\n children: StepFormChildren<any, TSteps, TFieldValues, TContext>\n}\n\nexport interface UseStepFormReturn<\n TFieldValues extends FieldValues = FieldValues\n> extends UseStepperReturn {\n getFormProps(): {\n onSubmit: SubmitHandler<TFieldValues>\n schema?: any\n resolver?: any\n }\n updateStep(step: any): void\n steps: Record<string, any>\n}\n\nexport function useStepForm<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object\n>(\n props: UseStepFormProps<TSteps, TFieldValues, TContext>\n): UseStepFormReturn<TFieldValues> {\n const {\n onChange,\n steps: stepsOptions,\n resolver,\n fieldResolver,\n ...rest\n } = props\n const stepper = useStepper(rest)\n\n const [options, setOptions] = React.useState<TSteps | undefined>(stepsOptions)\n\n const { activeStep, isLastStep, nextStep } = stepper\n\n const [steps, updateSteps] = React.useState<Record<string, StepState>>({})\n\n const mergedData = React.useRef<TFieldValues>({} as any)\n\n const onSubmitStep: SubmitHandler<TFieldValues> = React.useCallback(\n async (data) => {\n try {\n const step = steps[activeStep]\n\n mergedData.current = {\n ...mergedData.current,\n ...data,\n }\n\n if (isLastStep) {\n await props.onSubmit?.(mergedData.current)\n\n updateStep({\n ...step,\n isCompleted: true,\n })\n\n nextStep() // show completed step\n return\n }\n\n await step.onSubmit?.(data, stepper)\n\n nextStep()\n } catch (e) {\n // Step submission failed.\n }\n },\n [steps, activeStep, isLastStep, mergedData]\n )\n\n const getFormProps = React.useCallback(() => {\n const step = steps[activeStep]\n\n return {\n onSubmit: onSubmitStep,\n schema: step?.schema,\n resolver: step?.schema\n ? /* @todo fix resolver type */ (resolver as any)?.(step.schema)\n : undefined,\n fieldResolver: step?.schema\n ? (fieldResolver as any)?.(step.schema)\n : undefined,\n }\n }, [steps, onSubmitStep, activeStep, resolver, fieldResolver])\n\n const updateStep = React.useCallback(\n (step: StepState) => {\n const stepOptions = options?.find((s) => s.name === step.name)\n updateSteps((steps) => {\n return {\n ...steps,\n [step.name]: {\n ...step,\n schema: stepOptions?.schema,\n },\n }\n })\n },\n [steps, options]\n )\n\n return {\n getFormProps,\n updateStep,\n steps,\n ...stepper,\n }\n}\n\nexport interface UseFormStepProps {\n name: string\n schema?: any\n resolver?: any\n onSubmit?: FormStepSubmitHandler\n}\n\nexport function useFormStep(props: UseFormStepProps): StepState {\n const { name, schema, resolver, onSubmit } = props\n const step = useStep({ name })\n\n const { steps, updateStep } = useStepFormContext()\n\n React.useEffect(() => {\n updateStep({ name, schema, resolver, onSubmit })\n }, [name, schema])\n\n return {\n ...step,\n ...(steps[name] || { name, schema }),\n }\n}\n","import { BaseFieldProps, ValueOf } from './types'\n\nimport { get } from '@chakra-ui/utils'\nimport { ArrayFieldProps } from './array-field'\nimport { ObjectFieldProps } from './object-field'\nimport { DefaultFields } from './default-fields'\n\nexport type FieldResolver = {\n getFields(): BaseFieldProps[]\n getNestedFields(name: string): BaseFieldProps[]\n}\n\nexport type GetFieldResolver<TSchema = any> = (schema: TSchema) => FieldResolver\n\ntype FieldTypes<FieldDefs = DefaultFields> = ValueOf<{\n [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props>\n ? { type?: K } & Omit<Props, 'name'>\n : never\n}>\n\ntype SchemaField<FieldDefs = DefaultFields> =\n | FieldTypes<FieldDefs>\n | (Omit<ObjectFieldProps, 'name' | 'children'> & {\n type: 'object'\n properties?: Record<string, SchemaField<FieldDefs>>\n })\n | (Omit<ArrayFieldProps, 'name' | 'children'> & {\n type: 'array'\n items?: SchemaField<FieldDefs>\n })\n\nexport type ObjectSchema<FieldDefs = DefaultFields> = Record<\n string,\n SchemaField<FieldDefs>\n>\n\nconst mapFields = (schema: ObjectSchema): BaseFieldProps[] =>\n schema &&\n Object.entries(schema).map(([name, props]) => {\n const { items, label, title, ...field } = props as any\n return {\n ...field,\n name,\n label: label || title || name, // json schema compatibility\n }\n })\n\nexport const objectFieldResolver: GetFieldResolver<ObjectSchema> = (schema) => {\n const getFields = (): BaseFieldProps[] => {\n return mapFields(schema)\n }\n const getNestedFields = (name: string): BaseFieldProps[] => {\n const field = get(schema, name)\n\n if (!field) return []\n\n if (field.items?.type === 'object') {\n return mapFields(field.items.properties)\n } else if (field.type === 'object') {\n return mapFields(field.properties)\n }\n return [field.items]\n }\n\n return { getFields, getNestedFields }\n}\n","import { FieldValues, useWatch } from 'react-hook-form'\nimport { useFormContext, UseFormReturn } from './form-context'\n\nexport interface WatchFieldProps<\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n> {\n name: string\n defaultValue?: Value\n isDisabled?: boolean\n isExact?: boolean\n children: (\n value: Value,\n form: UseFormReturn<TFieldValues, TContext>\n ) => React.ReactElement | void\n}\n\nexport const WatchField = <\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WatchFieldProps<Value, TFieldValues, TContext>\n) => {\n const { name, defaultValue, isDisabled, isExact } = props\n const form = useFormContext<TFieldValues, TContext>()\n\n const field = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n\n return props.children(field, form) || null\n}\n","import React, { ForwardedRef } from 'react'\nimport { forwardRef } from '@chakra-ui/react'\n\nimport { FieldsProvider } from './fields-context'\nimport { Form, FieldValues, FormProps, GetResolver } from './form'\nimport { GetBaseField, WithFields } from './types'\nimport { objectFieldResolver } from './field-resolver'\nimport { GetFieldResolver } from './field-resolver'\nimport { defaultFieldTypes } from './default-fields'\n\nexport interface CreateFormProps<\n FieldDefs,\n TGetBaseField extends GetBaseField = GetBaseField,\n> {\n resolver?: GetResolver\n fieldResolver?: GetFieldResolver\n fields?: FieldDefs extends Record<string, React.FC<any>> ? FieldDefs : never\n getBaseField?: TGetBaseField\n}\n\nexport type FormType<\n FieldDefs,\n ExtraProps = object,\n ExtraFieldProps extends object = object,\n ExtraOverrides = object,\n> = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs,\n ExtraOverrides\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n } & ExtraProps\n) => React.ReactElement) & {\n displayName?: string\n id?: string\n}\n\nexport function createForm<\n FieldDefs,\n TGetBaseField extends GetBaseField<any> = GetBaseField<any>,\n>({\n resolver,\n fieldResolver = objectFieldResolver,\n fields,\n getBaseField,\n}: CreateFormProps<FieldDefs, TGetBaseField> = {}) {\n type ExtraFieldProps =\n TGetBaseField extends GetBaseField<infer ExtraFieldProps>\n ? ExtraFieldProps\n : object\n\n const DefaultForm = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n >(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs\n >,\n ref: ForwardedRef<HTMLFormElement>\n ) => {\n const {\n schema,\n resolver: resolverProp,\n fieldResolver: fieldResolverProp,\n ...rest\n } = props\n\n const fieldsContext = {\n fields: { ...defaultFieldTypes, ...fields },\n getBaseField,\n }\n\n return (\n <FieldsProvider value={fieldsContext}>\n <Form\n ref={ref}\n resolver={resolverProp ?? resolver?.(props.schema)}\n fieldResolver={fieldResolverProp ?? fieldResolver?.(schema)}\n {...rest}\n />\n </FieldsProvider>\n )\n }\n ) as FormType<FieldDefs, object, ExtraFieldProps>\n\n DefaultForm.displayName = 'Form'\n DefaultForm.id = 'Form'\n\n return DefaultForm\n}\n","import * as React from 'react'\n\nimport { chakra, HTMLChakraProps, forwardRef } from '@chakra-ui/react'\nimport { FocusableElement, cx, runIfFn } from '@chakra-ui/utils'\n\nimport {\n useForm,\n UseFormProps,\n UseFormReturn,\n FieldValues,\n SubmitHandler,\n SubmitErrorHandler,\n ResolverOptions,\n ResolverResult,\n WatchObserver,\n} from 'react-hook-form'\nimport { FormProvider } from './form-context'\nimport { FieldResolver } from './field-resolver'\nimport { MaybeRenderProp } from '@chakra-ui/react-utils'\n\nexport type { UseFormReturn, FieldValues, SubmitHandler }\n\nimport { FieldProps, DefaultFieldOverrides } from './types'\n\nimport { Field as DefaultField } from './field'\nimport { FormLayout } from './layout'\nimport { AutoFields } from './fields'\nimport { SubmitButton } from './submit-button'\nimport { DisplayIf, DisplayIfProps } from './display-if'\nimport { ArrayField, ArrayFieldProps } from './array-field'\nimport { ObjectField, ObjectFieldProps } from './object-field'\nimport { UseArrayFieldReturn } from './use-array-field'\n\nexport interface FormRenderContext<\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n> extends UseFormReturn<TFieldValues, TContext> {\n Field: React.FC<TFieldTypes & React.RefAttributes<FocusableElement>>\n DisplayIf: React.FC<DisplayIfProps<TFieldValues>>\n ArrayField: React.FC<\n ArrayFieldProps<TFieldValues> & React.RefAttributes<UseArrayFieldReturn>\n >\n ObjectField: React.FC<ObjectFieldProps<TFieldValues>>\n}\n\ninterface FormOptions<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> {\n /**\n * The form schema.\n */\n schema?: TSchema\n /**\n * Triggers when any of the field change.\n */\n onChange?: WatchObserver<TFieldValues>\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * The Hook Form state ref.\n */\n formRef?: React.Ref<UseFormReturn<TFieldValues, TContext>>\n /**\n * The form children, can be a render prop or a ReactNode.\n */\n children?: MaybeRenderProp<\n FormRenderContext<TFieldValues, TContext, TFieldTypes>\n >\n /**\n * The field resolver, used to resolve the fields from schemas.\n */\n fieldResolver?: FieldResolver\n /**\n * Field overrides\n */\n fields?: DefaultFieldOverrides\n}\n\nexport interface FormProps<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> extends UseFormProps<TFieldValues, TContext>,\n Omit<\n HTMLChakraProps<'form'>,\n 'children' | 'onChange' | 'onSubmit' | 'onError'\n >,\n FormOptions<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > {}\n\n/**\n * The wrapper component provides context, state, and focus management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n >(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n >,\n ref: React.ForwardedRef<HTMLFormElement>\n ) => {\n const {\n mode = 'all',\n resolver,\n fieldResolver,\n fields,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n values,\n context,\n resetOptions,\n onChange,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n values,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n context,\n resetOptions,\n }\n\n const methods = useForm<TFieldValues, TContext>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwarded ref\n React.useImperativeHandle(formRef, () => methods, [formRef, methods])\n\n React.useEffect(() => {\n let subscription: any\n if (onChange) {\n subscription = methods.watch(onChange)\n }\n return () => subscription?.unsubscribe()\n }, [methods, onChange])\n\n let _children = children\n if (!_children && fieldResolver) {\n _children = (\n <FormLayout>\n <AutoFields />\n <SubmitButton {...fields?.submit} />\n </FormLayout>\n )\n }\n\n return (\n <FormProvider\n {...methods}\n schema={schema}\n fieldResolver={fieldResolver}\n fields={fields}\n >\n <chakra.form\n ref={ref}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n className={cx('sui-form', props.className)}\n >\n {runIfFn(_children, {\n Field: DefaultField as any,\n DisplayIf: DisplayIf as any,\n ArrayField: ArrayField as any,\n ObjectField: ObjectField as any,\n ...methods,\n })}\n </chakra.form>\n </FormProvider>\n )\n }\n) as FormComponent\n\nexport type FormComponent = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n>(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n }\n) => React.ReactElement) & {\n displayName?: string\n}\n\nForm.displayName = 'Form'\n\nexport type GetResolver = <\n TFieldValues extends FieldValues,\n TContext extends object,\n>(\n schema: unknown\n) => (\n values: TFieldValues,\n context: TContext | undefined,\n options: ResolverOptions<TFieldValues>\n) => Promise<ResolverResult<TFieldValues>>\n","import React, { useMemo } from 'react'\nimport { forwardRef } from '@chakra-ui/react'\nimport {\n ArrayField,\n DisplayIf,\n FieldProps,\n FieldValues,\n FieldsProvider,\n GetFieldResolver,\n ObjectField,\n defaultFieldTypes,\n} from './'\nimport { Form } from './form'\nimport { Field } from './field'\nimport { FormStep, StepsOptions } from './step-form'\nimport {\n StepFormProvider,\n UseStepFormProps,\n useStepForm,\n} from './use-step-form'\nimport { StepperProvider } from '@saas-ui/core'\nimport { runIfFn } from '@chakra-ui/utils'\nimport { GetResolver } from './form'\nimport { GetBaseField, WithStepFields } from './types'\n\nexport type StepFormType<\n FieldDefs,\n ExtraProps = object,\n ExtraFieldProps extends object = object,\n ExtraOverrides = object,\n> = (<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues, ExtraFieldProps>,\n>(\n props: WithStepFields<\n UseStepFormProps<TSteps, TFieldValues, TContext>,\n FieldDefs,\n ExtraOverrides\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n } & ExtraProps\n) => React.ReactElement) & {\n displayName?: string\n id?: string\n}\n\nexport interface CreateStepFormProps<\n FieldDefs,\n TGetBaseField extends GetBaseField = GetBaseField,\n> {\n resolver?: GetResolver\n fieldResolver?: GetFieldResolver\n fields?: FieldDefs extends Record<string, React.FC<any>> ? FieldDefs : never\n getBaseField?: TGetBaseField\n}\n\nexport function createStepForm<\n FieldDefs,\n TGetBaseField extends GetBaseField<any> = GetBaseField<any>,\n>({\n fields,\n resolver,\n fieldResolver,\n getBaseField,\n}: CreateStepFormProps<FieldDefs, TGetBaseField> = {}) {\n type ExtraFieldProps =\n TGetBaseField extends GetBaseField<infer ExtraFieldProps>\n ? ExtraFieldProps\n : object\n\n const StepForm = forwardRef<any, 'div'>((props, ref) => {\n const { children, steps, ...rest } = props\n\n const stepper = useStepForm({\n resolver,\n fieldResolver,\n ...props,\n })\n\n const { getFormProps, ...ctx } = stepper\n\n const context = useMemo(() => ctx, [ctx])\n\n const fieldsContext = {\n fields: {\n ...defaultFieldTypes,\n ...fields,\n },\n getBaseField,\n }\n\n return (\n <StepperProvider value={context}>\n <StepFormProvider value={context}>\n <FieldsProvider value={fieldsContext}>\n <Form ref={ref} {...rest} {...getFormProps()}>\n {runIfFn(children, {\n ...stepper,\n Field: Field as any,\n FormStep: FormStep as any,\n DisplayIf: DisplayIf as any,\n ArrayField: ArrayField as any,\n ObjectField: ObjectField as any,\n })}\n </Form>\n </FieldsProvider>\n </StepFormProvider>\n </StepperProvider>\n )\n }) as StepFormType<FieldDefs, object, ExtraFieldProps>\n\n StepForm.displayName = `Step${Form.displayName || Form.name}`\n\n return StepForm\n}\n","// Exporting from './display-field'\nexport { DisplayField } from './display-field'\nexport type { DisplayFieldProps } from './display-field'\nexport { FormValue } from './display-field'\n\n// Exporting from './field'\nexport { Field } from './field'\nexport type { FieldRules, Option } from './field'\n\n// Exporting from './fields'\nexport { AutoFields } from './fields'\nexport type { FieldsProps } from './fields'\n\n// Exporting from './fields-context'\nexport { FieldsProvider, useField } from './fields-context'\n\n// Exporting from './layout'\nexport { FormLayout } from './layout'\nexport type { FormLayoutProps } from './layout'\n\n// Exporting from './submit-button'\nexport { SubmitButton } from './submit-button'\nexport type { SubmitButtonProps } from './submit-button'\n\n// Exporting from './array-field'\nexport {\n ArrayField,\n ArrayFieldAddButton,\n ArrayFieldContainer,\n ArrayFieldRemoveButton,\n ArrayFieldRow,\n ArrayFieldRowContainer,\n ArrayFieldRowFields,\n ArrayFieldRows,\n} from './array-field'\n\nexport type {\n ArrayFieldButtonProps,\n ArrayFieldContainerProps,\n ArrayFieldProps,\n ArrayFieldRowFieldsProps,\n ArrayFieldRowsProps,\n} from './array-field'\n\n// Exporting from './use-array-field'\nexport {\n ArrayFieldProvider,\n ArrayFieldRowProvider,\n useArrayField,\n useArrayFieldAddButton,\n useArrayFieldContext,\n useArrayFieldRemoveButton,\n useArrayFieldRow,\n useArrayFieldRowContext,\n} from './use-array-field'\n\nexport type {\n ArrayFieldOptions,\n UseArrayFieldReturn,\n UseArrayFieldRowProps,\n UseArrayFieldRowReturn,\n} from './use-array-field'\n\n// Exporting from './object-field'\nexport { FormLegend, ObjectField } from './object-field'\nexport type { ObjectFieldProps } from './object-field'\n\n// Exporting from './display-if'\nexport { DisplayIf } from './display-if'\nexport type { DisplayIfProps } from './display-if'\n\n// Exporting from './step-form'\nexport { FormStep, FormStepper, NextButton, PrevButton } from './step-form'\n\nexport type {\n FormStepOptions,\n FormStepProps,\n FormStepperProps,\n NextButtonProps,\n StepFormProps,\n StepsOptions,\n} from './step-form'\n\n// Exporting from './use-step-form'\nexport {\n StepFormProvider,\n useFormStep,\n useStepForm,\n useStepFormContext,\n} from './use-step-form'\n\nexport type {\n FormStepSubmitHandler,\n StepFormContext,\n StepFormRenderContext,\n StepState,\n UseFormStepProps,\n UseStepFormProps,\n UseStepFormReturn,\n} from './use-step-form'\n\n// Exporting from './field-resolver'\nexport { objectFieldResolver } from './field-resolver'\nexport type {\n FieldResolver,\n GetFieldResolver,\n ObjectSchema,\n} from './field-resolver'\n\n// Exporting from './watch-field'\nexport { WatchField } from './watch-field'\nexport type { WatchFieldProps } from './watch-field'\n\n// Exporting from './input-right-button'\nexport { InputRightButton } from './input-right-button'\nexport type { InputRightButtonProps } from './input-right-button'\n\n// Exporting from './select'\nexport {\n NativeSelect,\n Select,\n SelectButton,\n SelectList,\n SelectOption,\n} from './select'\n\nexport type {\n NativeSelectProps,\n SelectButtonProps,\n SelectListProps,\n SelectProps,\n} from './select'\n\n// Exporting from './password-input'\nexport { PasswordInput } from './password-input'\nexport type { PasswordInputProps } from './password-input'\n\n// Exporting from './radio'\nexport { RadioInput } from './radio'\nexport type { RadioInputProps, RadioOption, RadioOptions } from './radio'\n\n// Exporting BaseField from './base-field'\nexport { BaseField, useBaseField } from './base-field'\n\n// Exporting from './default-fields'\nexport {\n CheckboxField,\n InputField,\n NativeSelectField,\n NumberInputField,\n PasswordInputField,\n PinField,\n RadioField,\n SelectField,\n SwitchField,\n TextareaField,\n defaultFieldTypes,\n} from './default-fields'\n\nexport type {\n DefaultFields,\n InputFieldProps,\n NumberInputFieldProps,\n PinFieldProps,\n SelectFieldProps,\n SwitchFieldProps,\n TextareaFieldProps,\n CheckboxFieldProps,\n NativeSelectFieldProps,\n RadioFieldProps,\n} from './default-fields'\n\n// Exporting types from './types'\nexport type {\n FieldProps,\n WithFields,\n BaseFieldProps,\n FieldOptions,\n DefaultFieldOverrides,\n WithStepFields,\n GetBaseField,\n} from './types'\n\n// Exporting from './create-form'\nexport { createForm } from './create-form'\nexport type { CreateFormProps, FormType } from './create-form'\n\n// Exporting from './create-field'\nexport { createField } from './create-field'\nexport type { CreateFieldOptions } from './create-field'\n\n// Exporting from './form'\nexport { Form as BaseForm } from './form'\nexport type { FormProps, FormRenderContext, FormComponent } from './form'\n\n// Exporting from './form-context'\nexport { FormProvider, useFormContext } from './form-context'\n\nexport { createStepForm } from './create-step-form'\nexport type { CreateStepFormProps } from './create-step-form'\n\n// Import and export Form and StepForm\nimport { createForm } from './create-form'\nimport { createStepForm } from './create-step-form'\n\n/**\n * Form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = createForm()\n\n/**\n * Multi-step form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const StepForm = createStepForm()\n\nexport type {\n BatchFieldArrayUpdate,\n ChangeHandler,\n Control,\n ControllerFieldState,\n ControllerProps,\n ControllerRenderProps,\n CriteriaMode,\n CustomElement,\n DeepMap,\n DeepPartial,\n DeepPartialSkipArrayKey,\n DefaultValues,\n DelayCallback,\n EmptyObject,\n ErrorOption,\n EventType,\n Field as FieldDef,\n FieldArray,\n FieldArrayMethodProps,\n FieldArrayWithId,\n FieldElement,\n FieldError,\n FieldErrors,\n FieldName,\n FieldNamesMarkedBoolean,\n FieldRefs,\n FieldValue,\n FieldValues,\n FormProviderProps,\n FormState,\n FormStateProxy,\n FormStateSubjectRef,\n GetIsDirty,\n InternalFieldErrors,\n InternalFieldName,\n InternalNameSet,\n IsAny,\n IsFlatObject,\n KeepStateOptions,\n LiteralUnion,\n Message,\n Mode,\n MultipleFieldErrors,\n Names,\n NativeFieldValue,\n NestedValue,\n NonUndefined,\n Noop,\n Primitive,\n ReadFormState,\n Ref,\n RefCallBack,\n RegisterOptions,\n Resolver,\n ResolverError,\n ResolverOptions,\n ResolverResult,\n ResolverSuccess,\n SetFieldValue,\n SetValueConfig,\n Subjects,\n SubmitErrorHandler,\n SubmitHandler,\n TriggerConfig,\n UnpackNestedValue,\n UseControllerProps,\n UseControllerReturn,\n UseFieldArrayProps,\n UseFieldArrayReturn,\n UseFormClearErrors,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormProps,\n UseFormRegister,\n UseFormRegisterReturn,\n UseFormReset,\n UseFormResetField,\n UseFormReturn,\n UseFormSetError,\n UseFormSetFocus,\n UseFormSetValue,\n UseFormStateProps,\n UseFormStateReturn,\n UseFormTrigger,\n UseFormUnregister,\n UseFormWatch,\n UseWatchProps,\n Validate,\n ValidateResult,\n ValidationMode,\n ValidationRule,\n ValidationValue,\n ValidationValueMessage,\n WatchInternal,\n WatchObserver,\n} from 'react-hook-form'\n\nexport {\n appendErrors,\n useController,\n useFieldArray,\n use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;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,GACH,GACF,GACF,GACF;AAAA,EAEJ,CAAC;AAED,EAAAE,UAAS,cAAc,OAAO,KAAK,eAAe,KAAK,IAAI;AAE3D,SAAOA;AACT;;;ACyMA;AAAA,EACE;AAAA,EACA;AAAA,EACA,iBAAAG;AAAA,EACA,WAAAC;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,OACK;AAnHA,IAAMC,QAAO,WAAW;AAOxB,IAAM,WAAW,eAAe;","names":["jsx","React","React","jsx","forwardRef","Input","InputGroup","jsx","jsxs","forwardRef","InputGroup","Input","forwardRef","InputRightElement","jsx","jsx","jsxs","forwardRef","InputGroup","Input","forwardRef","React","jsx","forwardRef","forwardRef","Button","ChevronDownIcon","createContext","React","createContext","value","React","jsx","jsxs","forwardRef","ChevronDownIcon","Button","value","forwardRef","jsx","forwardRef","splitProps","FormControl","FormLabel","jsx","jsxs","FormControl","FormLabel","jsx","Field","forwardRef","BaseField","splitProps","jsx","jsxs","forwardRef","Input","InputGroup","NumberInputField","jsx","React","chakra","omitThemingProps","cx","jsx","React","chakra","forwardRef","Button","React","createContext","jsx","jsxs","chakra","Button","forwardRef","FormControl","FormLabel","useStyleConfig","jsx","jsxs","useStyleConfig","FormLabel","FormControl","jsx","mapNestedFields","name","useFormContext","Button","forwardRef","jsx","forwardRef","useFormContext","Button","React","React","chakra","Button","callAllHandlers","cx","React","createContext","steps","jsx","chakra","cx","Button","callAllHandlers","get","useWatch","useWatch","forwardRef","React","chakra","forwardRef","cx","jsx","jsxs","forwardRef","chakra","cx","jsx","forwardRef","useMemo","forwardRef","runIfFn","jsx","StepForm","forwardRef","useMemo","useFieldArray","useForm","useWatch","Controller","Form"]}
|
1
|
+
{"version":3,"sources":["../src/form-context.tsx","../src/display-field.tsx","../src/field.tsx","../src/fields-context.tsx","../src/default-fields.tsx","../src/number-input/number-input.tsx","../src/password-input/password-input.tsx","../src/input-right-button/input-right-button.tsx","../src/radio/radio-input.tsx","../src/utils.ts","../src/select/select.tsx","../src/select/select-context.tsx","../src/select/native-select.tsx","../src/create-field.tsx","../src/base-field.tsx","../src/fields.tsx","../src/layout.tsx","../src/array-field.tsx","../src/use-array-field.tsx","../src/object-field.tsx","../src/submit-button.tsx","../src/display-if.tsx","../src/step-form.tsx","../src/use-step-form.tsx","../src/field-resolver.ts","../src/watch-field.tsx","../src/create-form.tsx","../src/form.tsx","../src/create-step-form.tsx","../src/index.ts"],"sourcesContent":["import * as React from 'react'\nimport {\n FormProvider as HookFormProvider,\n FormProviderProps as HookFormProviderProps,\n useFormContext as useHookFormContext,\n FieldValues,\n} from 'react-hook-form'\nimport { FieldResolver } from './field-resolver'\nimport type { BaseFieldProps } from './types'\n\nexport type FormContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nexport type FormProviderProps<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = HookFormProviderProps<TFieldValues, TContext> & {\n fieldResolver?: FieldResolver\n schema?: TSchema\n fields?: {\n [key: string]: unknown\n }\n}\n\nconst FormContext = React.createContext<FormContextValue | null>(null)\n\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>() => {\n const context = React.useContext(FormContext)\n const hookContext = useHookFormContext<TFieldValues, TContext>()\n\n return {\n ...hookContext,\n ...context,\n }\n}\n\nexport const useFieldProps = <TFieldValues extends FieldValues = FieldValues>(\n name: string\n): BaseFieldProps<TFieldValues> | undefined => {\n const parsedName = name?.replace(/\\.[0-9]/g, '.$')\n const context = useFormContext()\n return (context?.fields?.[parsedName] as any) || {}\n}\n\nexport type UseFormReturn<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n> = ReturnType<typeof useFormContext<TFieldValues, TContext, TSchema>>\n\nexport const FormProvider = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TSchema = any,\n>(\n props: FormProviderProps<TFieldValues, TContext, TSchema>\n) => {\n const { children, fieldResolver, schema, fields, ...rest } = props\n return (\n <HookFormProvider {...rest}>\n <FormContext.Provider value={{ fieldResolver, schema, fields }}>\n {children}\n </FormContext.Provider>\n </HookFormProvider>\n )\n}\n","import * as React from 'react'\nimport { useFormContext } from './form-context'\nimport {\n Text,\n FormControl,\n FormControlProps,\n FormLabel,\n} from '@chakra-ui/react'\n\nimport { FieldProps } from './types'\n\nexport interface DisplayFieldProps\n extends Omit<FormControlProps, 'onChange'>,\n Omit<FieldProps, 'type' | 'label' | 'onChange'> {}\n\n/**\n * Display a field value.\n *\n * @see Docs https://saas-ui.dev/\n */\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n placeholder,\n ...props\n}) => {\n return (\n <FormControl {...props}>\n {label ? <FormLabel htmlFor={name}>{label}</FormLabel> : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FormControl>\n )\n}\n\nDisplayField.displayName = 'DisplayField'\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n\nFormValue.displayName = 'FormValue'\n","import * as React from 'react'\nimport { RegisterOptions, FieldValues } from 'react-hook-form'\n\nimport { FocusableElement } from '@chakra-ui/utils'\nimport { useField } from './fields-context'\nimport { FieldProps } from './types'\nimport { useFieldProps } from './form-context'\nimport { InputField } from './default-fields'\n\nexport interface Option {\n value: string\n label?: string\n [key: string]: unknown\n}\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nconst defaultInputType = 'text'\n\n/**\n * Form field component.\n * \n * Build-in types:\n * text, number, password, textarea, select, native-select, checkbox, radio, switch, pin\n *\n * Will default to a text field if there is no matching type.\n\n * @see Docs https://saas-ui.dev/docs/components/forms/field\n */\nexport const Field = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues>,\n ref: React.ForwardedRef<FocusableElement>\n ) => {\n const { type = defaultInputType, name } = props\n const overrides = useFieldProps(name)\n const InputComponent = useField(overrides?.type || type, InputField)\n\n return <InputComponent ref={ref} {...props} {...overrides} />\n }\n) as (<TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n ref?: React.ForwardedRef<FocusableElement>\n }\n) => React.ReactElement) & {\n displayName?: string\n}\n","import React from 'react'\nimport { defaultFieldTypes, InputField } from './default-fields'\nimport type { GetBaseField } from './types'\n\nexport interface FieldsContextValue {\n fields: Record<string, React.FC<any>>\n getBaseField?: GetBaseField<any>\n}\n\nconst FieldsContext = React.createContext<FieldsContextValue | null>(null)\n\nexport const FieldsProvider: React.FC<{\n value: FieldsContextValue\n children: React.ReactNode\n}> = (props) => {\n return (\n <FieldsContext.Provider value={props.value}>\n {props.children}\n </FieldsContext.Provider>\n )\n}\n\nexport const useFieldsContext = () => {\n return React.useContext(FieldsContext)\n}\n\nexport const useField = (\n type: string,\n fallback: React.FC<any>\n): React.FC<any> => {\n const context = React.useContext(FieldsContext)\n return context?.fields?.[type] || fallback\n}\n","import * as React from 'react'\n\nimport {\n forwardRef,\n Input,\n Textarea,\n Checkbox,\n Switch,\n InputGroup,\n InputProps,\n TextareaProps,\n SwitchProps,\n CheckboxProps,\n PinInputField,\n HStack,\n PinInput,\n UsePinInputProps,\n SystemProps,\n} from '@chakra-ui/react'\n\nimport { NumberInput, NumberInputProps } from './number-input'\nimport { PasswordInput, PasswordInputProps } from './password-input'\nimport { RadioInput, RadioInputProps } from './radio'\n\nimport {\n Select,\n SelectButton,\n SelectList,\n SelectProps,\n NativeSelect,\n NativeSelectProps,\n SelectButtonProps,\n SelectListProps,\n} from './select'\n\nimport { createField } from './create-field'\n\nexport interface InputFieldProps extends InputProps {\n type?: string\n leftAddon?: React.ReactNode\n rightAddon?: React.ReactNode\n}\n\nexport const InputField = createField<InputFieldProps>(\n forwardRef(({ type = 'text', leftAddon, rightAddon, size, ...rest }, ref) => {\n const input = <Input type={type} size={size} {...rest} ref={ref} />\n if (leftAddon || rightAddon) {\n return (\n <InputGroup size={size}>\n {leftAddon}\n {input}\n {rightAddon}\n </InputGroup>\n )\n }\n return input\n })\n)\n\nexport interface NumberInputFieldProps extends NumberInputProps {\n type: 'number'\n}\n\nexport const NumberInputField = createField<NumberInputFieldProps>(\n NumberInput,\n {\n isControlled: true,\n }\n)\n\nexport const PasswordInputField = createField<PasswordInputProps>(\n forwardRef((props, ref) => <PasswordInput ref={ref} {...props} />)\n)\n\nexport interface TextareaFieldProps extends TextareaProps {}\n\nexport const TextareaField = createField<TextareaFieldProps>(Textarea)\n\nexport interface SwitchFieldProps extends SwitchProps {}\n\nexport const SwitchField = createField<SwitchFieldProps>(\n forwardRef(({ type, value, ...rest }, ref) => {\n return <Switch isChecked={!!value} {...rest} ref={ref} />\n }),\n {\n isControlled: true,\n }\n)\n\nexport interface SelectFieldProps extends SelectProps<boolean> {\n buttonProps?: SelectButtonProps\n listProps?: SelectListProps\n}\n\nexport const SelectField = createField<SelectFieldProps>(\n forwardRef((props, ref) => {\n const { buttonProps, listProps, ...rest } = props\n\n return (\n <Select ref={ref} {...rest}>\n <SelectButton {...buttonProps} />\n <SelectList {...listProps} />\n </Select>\n )\n }),\n {\n isControlled: true,\n }\n)\n\nexport type CheckboxFieldProps = CheckboxProps\n\nexport const CheckboxField = createField<CheckboxFieldProps>(\n forwardRef(({ label, type, ...props }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n }),\n {\n hideLabel: true,\n }\n)\n\nexport type RadioFieldProps = RadioInputProps\n\nexport const RadioField = createField<RadioFieldProps>(RadioInput, {\n isControlled: true,\n})\n\nexport type NativeSelectFieldProps = NativeSelectProps\n\nexport const NativeSelectField = createField<NativeSelectFieldProps>(\n NativeSelect,\n {\n isControlled: true,\n }\n)\n\nexport interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {\n pinLength?: number\n pinType?: 'alphanumeric' | 'number'\n spacing?: SystemProps['margin']\n}\n\nexport const PinField = createField<PinFieldProps>(\n forwardRef((props, ref) => {\n const { pinLength = 4, pinType, spacing, ...inputProps } = props\n\n const inputs: React.ReactNode[] = []\n for (let i = 0; i < pinLength; i++) {\n inputs.push(<PinInputField key={i} ref={ref} />)\n }\n\n return (\n <HStack spacing={spacing}>\n <PinInput {...inputProps} type={pinType}>\n {inputs}\n </PinInput>\n </HStack>\n )\n }),\n {\n isControlled: true,\n }\n)\n\nexport const defaultFieldTypes = {\n text: InputField,\n email: InputField,\n url: InputField,\n phone: InputField,\n time: InputField,\n number: NumberInputField,\n password: PasswordInputField,\n textarea: TextareaField,\n switch: SwitchField,\n select: SelectField,\n checkbox: CheckboxField,\n radio: RadioField,\n pin: PinField,\n 'native-select': NativeSelectField,\n}\n\nexport type DefaultFields = typeof defaultFieldTypes\n","import * as React from 'react'\n\nimport {\n forwardRef,\n NumberInput as ChakraNumberInput,\n NumberInputField,\n NumberInputStepper,\n NumberIncrementStepper,\n NumberDecrementStepper,\n NumberInputProps as ChakraNumberInputProps,\n NumberInputFieldProps,\n InputGroup,\n InputLeftAddon,\n InputRightAddon,\n InputLeftElement,\n InputRightElement,\n} from '@chakra-ui/react'\n\nimport { ChevronDownIcon, ChevronUpIcon } from '@saas-ui/core'\n\ninterface NumberInputOptions {\n /**\n * Hide the stepper. This will be true when `rightAddon` is provided.\n */\n hideStepper?: boolean\n /**\n * Render a custom increment icon.\n */\n incrementIcon?: React.ReactNode\n /**\n * Render a custom decrement icon.\n */\n decrementIcon?: React.ReactNode\n /**\n * The placeholder text when no value is selected.\n */\n placeholder?: string\n /**\n * Props to pass to the NumberInputField component.\n */\n fieldProps?: NumberInputFieldProps\n /**\n * Either `InputLeftAddon` or `InputLeftElement`\n */\n leftAddon?: React.ReactNode\n /**\n * Either `InputRightAddon` or `InputRightElement`\n */\n rightAddon?: React.ReactNode\n}\n\nconst Input = forwardRef<NumberInputFieldProps, 'input'>((props, ref) => (\n <NumberInputField ref={ref} {...props} />\n))\nInput.displayName = 'NumberInputField'\nInput.id = 'Input'\n\nexport interface NumberInputProps\n extends ChakraNumberInputProps,\n NumberInputOptions {}\n\nexport const NumberInput = forwardRef<NumberInputProps, 'div'>((props, ref) => {\n const {\n hideStepper = false,\n incrementIcon = <ChevronUpIcon />,\n decrementIcon = <ChevronDownIcon />,\n leftAddon,\n rightAddon,\n placeholder,\n fieldProps: _fieldProps,\n ...rest\n } = props\n\n const fieldProps = { placeholder, ..._fieldProps }\n\n return (\n <ChakraNumberInput {...rest} ref={ref}>\n <InputGroup>\n {leftAddon}\n <Input {...fieldProps} />\n {rightAddon}\n </InputGroup>\n {!hideStepper && !rightAddon ? (\n <NumberInputStepper>\n <NumberIncrementStepper children={incrementIcon} />\n <NumberDecrementStepper children={decrementIcon} />\n </NumberInputStepper>\n ) : null}\n </ChakraNumberInput>\n )\n})\n\nNumberInput.displayName = 'NumberInput'\n","import React, { useState } from 'react'\n\nimport { forwardRef, InputGroup, Input, InputProps } from '@chakra-ui/react'\n\nimport { ViewIcon, ViewOffIcon } from '@saas-ui/core/icons'\n\nimport { InputRightButton } from '../input-right-button'\n\ninterface PasswordOptions {\n viewIcon?: React.ReactNode\n viewOffIcon?: React.ReactNode\n leftAddon?: React.ReactNode\n}\n\nexport interface PasswordInputProps extends InputProps, PasswordOptions {}\n\nexport const PasswordInput = forwardRef<PasswordInputProps, 'div'>(\n (props, ref) => {\n const {\n viewIcon,\n viewOffIcon,\n autoComplete,\n w,\n width,\n size,\n variant,\n leftAddon,\n ...inputProps\n } = props\n const [show, setShow] = useState(false)\n const handleClick = () => setShow(!show)\n\n const label = show ? 'Hide password' : 'Show password'\n\n let icon\n if (show) {\n icon = viewIcon || <ViewIcon />\n } else {\n icon = viewOffIcon || <ViewOffIcon />\n }\n\n const groupProps = {\n width: w || width,\n size,\n variant,\n }\n\n return (\n <InputGroup {...groupProps}>\n {leftAddon}\n <Input\n {...inputProps}\n ref={ref}\n type={show ? 'text' : 'password'}\n autoComplete={show ? 'off' : autoComplete}\n />\n <InputRightButton\n onClick={handleClick}\n aria-label={label}\n variant=\"ghost\"\n >\n {icon}\n </InputRightButton>\n </InputGroup>\n )\n }\n)\n\nPasswordInput.displayName = 'PasswordInput'\n","import * as React from 'react'\n\nimport {\n Button,\n ButtonProps,\n forwardRef,\n InputRightElement,\n} from '@chakra-ui/react'\n\nexport type InputRightButtonProps = ButtonProps\n\nexport const InputRightButton = forwardRef<InputRightButtonProps, 'div'>(\n (props, ref) => {\n return (\n <InputRightElement w=\"auto\" px=\"1\" py=\"1\" alignItems=\"stretch\">\n <Button ref={ref} height=\"auto\" {...props} />\n </InputRightElement>\n )\n }\n)\n\nInputRightButton.id = 'InputRightElement'\n\nInputRightButton.displayName = 'InputRightButton'\n","import * as React from 'react'\n\nimport {\n forwardRef,\n Stack,\n RadioGroup,\n RadioGroupProps,\n Radio,\n RadioProps,\n SystemProps,\n StackDirection,\n} from '@chakra-ui/react'\nimport { FieldOptions, FieldOption } from '../types'\nimport { mapOptions } from '../utils'\n\nexport interface RadioOption\n extends Omit<RadioProps, 'value' | 'label'>,\n FieldOption {}\n\nexport type RadioOptions = FieldOptions<RadioOption>\n\ninterface RadioInputOptions {\n options: RadioOptions\n spacing?: SystemProps['margin']\n direction?: StackDirection\n}\n\nexport interface RadioInputProps\n extends Omit<RadioGroupProps, 'children'>,\n RadioInputOptions {}\n\nexport const RadioInput = forwardRef<RadioInputProps, 'div'>(\n ({ options: optionsProp, spacing, direction, ...props }, ref) => {\n const { onBlur, onChange, ...groupProps } = props\n\n const options = mapOptions(optionsProp)\n\n return (\n <RadioGroup onChange={onChange} {...groupProps}>\n <Stack spacing={spacing} direction={direction}>\n {options.map(({ value, label, ...radioProps }, i) => {\n return (\n <Radio\n key={i}\n onBlur={onBlur}\n value={value}\n ref={ref}\n {...radioProps}\n >\n {label || value}\n </Radio>\n )\n })}\n </Stack>\n </RadioGroup>\n )\n }\n)\n\nRadioInput.displayName = 'RadioInput'\n","import * as React from 'react'\nimport { FieldOption, FieldOptions } from './types'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n let childName = child.props.name\n if (childName.includes('.')) {\n childName = childName.replace(/^.*\\.(.*)/, '$1')\n } else if (childName.includes('.$')) {\n childName = childName.replace(/^.*\\.\\$(.*)/, '$1')\n }\n\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${childName}`,\n })\n }\n return child\n })\n}\n\nexport const mapOptions = <TOption extends FieldOption = FieldOption>(\n options: FieldOptions<TOption>\n) => {\n return options.map((option) => {\n if (typeof option === 'string') {\n return {\n label: option,\n value: option,\n }\n }\n return option\n })\n}\n","import * as React from 'react'\n\nimport {\n chakra,\n forwardRef,\n Menu,\n MenuProps,\n MenuList,\n MenuListProps,\n MenuItemOption,\n MenuOptionGroup,\n Button,\n ButtonProps,\n omitThemingProps,\n useMultiStyleConfig,\n MenuItemOptionProps,\n useFormControlContext,\n ThemingProps,\n useMenuButton,\n} from '@chakra-ui/react'\nimport { cx, dataAttr } from '@chakra-ui/utils'\nimport { ChevronDownIcon } from '@saas-ui/core'\n\nimport { FieldOption } from '../types'\n\nimport {\n SelectOptions,\n SelectProvider,\n SelectStylesProvider,\n useSelect,\n useSelectContext,\n useSelectStyles,\n} from './select-context'\n\nexport interface SelectOption\n extends Omit<MenuItemOptionProps, 'value'>,\n FieldOption {}\n\nexport interface SelectProps<\n Multiple extends boolean = false,\n Value = Multiple extends true ? string[] : string,\n> extends Omit<MenuProps, 'children' | 'variant' | 'size'>,\n ThemingProps<'SuiSelect'>,\n SelectOptions<Multiple, Value> {\n children: React.ReactNode\n}\n\nexport interface SelectButtonProps\n extends Omit<ButtonProps, 'size' | 'variant'> {}\n\n/**\n * Button that opens the select menu and displays the selected value.\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const SelectButton = forwardRef<SelectButtonProps, 'button'>(\n (props, ref) => {\n const {\n displayValue,\n renderValue,\n placeholder,\n isDisabled: isSelectDisabled,\n } = useSelectContext()\n\n const context = useFormControlContext()\n\n const styles = useSelectStyles()\n\n const {\n isInvalid,\n isReadOnly,\n isDisabled,\n isFocused,\n isRequired,\n id,\n onBlur,\n onFocus,\n } = context || {}\n\n const { rightIcon = <ChevronDownIcon />, ...rest } = props\n\n /* @ts-ignore */\n const focusStyles = styles.field?._focusVisible\n /* @ts-ignore */\n const readOnlyStyles = styles.field?._readOnly\n /* @ts-ignore */\n const invalid = styles.field?._invalid\n\n const height = styles.field?.h || styles.field?.height\n\n const buttonStyles: any = {\n fontWeight: 'normal',\n textAlign: 'left',\n color: 'inherit',\n _active: {\n bg: 'transparent',\n },\n minH: height,\n _focus: focusStyles,\n _expanded: focusStyles,\n _readOnly: readOnlyStyles,\n _invalid: invalid,\n minW: 0,\n ...styles.field,\n h: 'auto',\n ...props.sx,\n }\n\n const buttonProps = useMenuButton(rest, ref)\n\n // Using a Button, so we can simply use leftIcon and rightIcon\n return (\n <Button\n {...buttonProps}\n sx={buttonStyles}\n {...rest}\n onFocus={onFocus}\n onBlur={onBlur}\n isDisabled={isDisabled || isSelectDisabled}\n data-invalid={dataAttr(isInvalid)}\n data-read-only={dataAttr(isReadOnly)}\n data-focus={dataAttr(isFocused)}\n data-required={dataAttr(isRequired)}\n rightIcon={rightIcon}\n >\n <chakra.span\n __css={{\n display: 'block',\n pointerEvents: 'none',\n flex: '1 1 auto',\n minW: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {renderValue(displayValue) || placeholder}\n </chakra.span>\n </Button>\n )\n }\n)\n\nSelectButton.displayName = 'SelectButton'\n\n/**\n * Allow users to select a value from a list of options.\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const Select = forwardRef((props, ref) => {\n const { name, children, isDisabled, multiple, ...rest } = props\n\n const styles = useMultiStyleConfig('SuiSelect', props)\n\n const menuProps = omitThemingProps(rest)\n\n const context = useSelect(props)\n\n const { value, controlProps } = context\n\n return (\n <SelectProvider value={context}>\n <SelectStylesProvider value={styles}>\n <Menu {...menuProps} closeOnSelect={!multiple}>\n <chakra.div className={cx('sui-select')}>\n {children}\n <chakra.input\n {...controlProps}\n ref={ref}\n name={name}\n type=\"hidden\"\n value={value || ''}\n className=\"saas-select__input\"\n />\n </chakra.div>\n </Menu>\n </SelectStylesProvider>\n </SelectProvider>\n )\n}) as (<Multiple extends boolean = false>(\n props: SelectProps<Multiple> & {\n ref?: React.ForwardedRef<HTMLFormElement>\n }\n) => React.ReactElement) & {\n displayName?: string\n}\n\nexport interface SelectListProps extends MenuListProps {}\n\n/**\n * The list of options to choose from.\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const SelectList: React.FC<SelectListProps> = (props) => {\n const { defaultValue, value, options, multiple, onChange } =\n useSelectContext()\n\n return (\n <MenuList maxH=\"100vh\" overflowY=\"auto\" {...props}>\n <MenuOptionGroup\n defaultValue={(defaultValue || value) as string | string[] | undefined}\n value={value}\n onChange={onChange}\n type={multiple ? 'checkbox' : 'radio'}\n >\n {options\n ? options.map(({ value, label, ...rest }, i) => (\n <SelectOption key={i} value={value} {...rest}>\n {label || value}\n </SelectOption>\n ))\n : props.children}\n </MenuOptionGroup>\n </MenuList>\n )\n}\n\nSelect.displayName = 'Select'\n\n/**\n * An option in a select list\n *\n * @see https://saas-ui.dev/docs/components/forms/select\n */\nexport const SelectOption = forwardRef<MenuItemOptionProps, 'button'>(\n (props, ref) => {\n return <MenuItemOption ref={ref} {...props} />\n }\n)\nSelectOption.id = 'MenuItemOption'\nSelectOption.displayName = 'SelectOption'\n","import {\n HTMLChakraProps,\n createStylesContext,\n useControllableState,\n useFormControl,\n} from '@chakra-ui/react'\nimport { createContext } from '@chakra-ui/react-utils'\nimport React from 'react'\nimport { FieldOptions } from '../types'\nimport { mapOptions } from '../utils'\nimport { SelectOption } from './select'\n\nexport const [SelectStylesProvider, useSelectStyles] =\n createStylesContext('SuiSelect')\n\nexport const [SelectProvider, useSelectContext] = createContext<\n ReturnType<typeof useSelect>\n>({\n strict: true,\n})\n\nexport interface SelectOptions<\n Multiple extends boolean = false,\n Value = Multiple extends true ? string[] : string,\n> {\n /**\n * The name of the input field in a native form.\n */\n name: string\n /**\n * The value of the select field.\n */\n value?: Value\n /**\n * The initial value of the select field.\n */\n defaultValue?: Value\n /**\n * The callback invoked when the value of the select field changes.\n * @param value The value of the select field.\n */\n onChange?: (value: Value) => void\n /**\n * The placeholder text when there's no value.\n */\n placeholder?: string\n /**\n * If `true`, the select will be disabled.\n */\n isDisabled?: boolean\n /**\n * An array of options\n * If you leave this empty the children prop will be rendered.\n */\n options?: FieldOptions<SelectOption>\n /**\n * Enable multiple select.\n */\n multiple?: Multiple\n /**\n * The function used to render the value of the select field.\n * @param value The value of the select field.\n * @returns The rendered value.\n */\n renderValue?: (value: Value) => React.ReactNode\n}\n\nexport const useSelect = (props: SelectOptions<boolean>) => {\n const {\n name,\n value,\n defaultValue,\n onChange,\n multiple,\n placeholder,\n options: optionsProp,\n isDisabled,\n renderValue = (value) =>\n typeof value === 'string' ? value : value?.join(', '),\n } = props\n const [currentValue, setCurrentValue] = useControllableState({\n value,\n defaultValue,\n onChange,\n })\n\n const controlProps = useFormControl({ name } as HTMLChakraProps<'input'>)\n\n const options = React.useMemo(\n () => optionsProp && mapOptions(optionsProp),\n [optionsProp]\n )\n\n const handleChange = (value: string | string[]) => {\n setCurrentValue(value)\n }\n\n const getDisplayValue = React.useCallback(\n (value: string) => {\n if (!options) {\n return value\n }\n\n for (const option of options) {\n if (option.value === value) {\n return option.label || option.value\n }\n }\n\n return value\n },\n [options]\n )\n\n const displayValue = React.useMemo(\n () =>\n currentValue\n ? (Array.isArray(currentValue) ? currentValue : [currentValue]).map(\n getDisplayValue\n )\n : [],\n [currentValue, getDisplayValue]\n )\n\n return {\n defaultValue,\n value: currentValue,\n displayValue,\n renderValue,\n onChange: handleChange,\n options,\n multiple,\n controlProps,\n placeholder,\n isDisabled,\n }\n}\n","import * as React from 'react'\n\nimport {\n forwardRef,\n Select as ChakraSelect,\n SelectProps as ChakraSelectProps,\n} from '@chakra-ui/react'\n\ninterface Option {\n value: string\n label?: string\n}\n\ninterface NativeSelectOptions {\n options?: Option[]\n}\n\nexport interface NativeSelectProps\n extends ChakraSelectProps,\n NativeSelectOptions {}\n\nexport const NativeSelect = forwardRef<NativeSelectProps, 'select'>(\n ({ options, children, ...props }, ref) => {\n return (\n <ChakraSelect ref={ref} {...props}>\n {children ||\n options?.map(({ value, label }) => {\n return (\n <option key={value} value={value}>\n {label || value}\n </option>\n )\n })}\n </ChakraSelect>\n )\n }\n)\n\nNativeSelect.displayName = 'NativeSelect'\n","import * as React from 'react'\nimport { Controller } from 'react-hook-form'\n\nimport { forwardRef, useMergeRefs } from '@chakra-ui/react'\nimport { callAllHandlers } from '@chakra-ui/utils'\n\nimport { splitProps } from '@saas-ui/core'\n\nimport { BaseFieldProps, FieldProps, GetBaseField } from './types'\nimport { BaseField } from './base-field'\nimport { useFormContext } from './form-context'\nimport { useFieldsContext } from './fields-context'\n\ninterface CreateFieldProps<ExtraFieldProps extends object = object> {\n displayName: string\n hideLabel?: boolean\n getBaseField: GetBaseField<ExtraFieldProps>\n}\n\nconst _createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, getBaseField: getBaseFieldProp }: CreateFieldProps\n) => {\n const Field = forwardRef<any, 'div'>((props, ref) => {\n const { id, name, label, isRequired, rules } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n const fieldContext = useFieldsContext()\n\n const getBaseField = fieldContext?.getBaseField ?? getBaseFieldProp\n\n const { extraProps, BaseField } = React.useMemo(\n () => getBaseField(),\n [getBaseField]\n )\n\n const [, inputProps] = splitProps(\n props,\n [\n 'children',\n 'name',\n 'label',\n 'isRequired',\n 'isDisabled',\n 'isInvalid',\n 'isReadOnly',\n 'help',\n 'hideLabel',\n ].concat(extraProps)\n )\n\n return (\n <BaseField hideLabel={hideLabel} {...props}>\n <InputComponent\n ref={ref}\n id={id}\n name={name}\n label={hideLabel ? label : undefined} // Only pass down the label when it should be inline.\n {...inputProps}\n rules={inputRules}\n />\n </BaseField>\n )\n })\n\n Field.displayName = displayName\n\n return Field\n}\n\nconst withControlledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { control } = useFormContext()\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAllHandlers(onChange, field.onChange)}\n onBlur={callAllHandlers(inputProps.onBlur, field.onBlur)}\n ref={useMergeRefs(ref, _ref)}\n />\n )}\n />\n )\n }\n )\n}\n\nconst withUncontrolledInput = (InputComponent: React.FC<any>) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n const onChange = inputProps.onChange as (...event: any[]) => void\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n onChange={callAllHandlers(onChange, field.onChange)}\n onBlur={callAllHandlers(inputProps.onBlur, field.onBlur)}\n ref={useMergeRefs(ref, _ref)}\n />\n )\n }\n )\n}\n\nexport interface CreateFieldOptions<TProps extends object> {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for the checkbox field.\n */\nexport const createField = <TProps extends object>(\n component: React.FC<TProps>,\n options?: CreateFieldOptions<TProps>\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(component)\n } else {\n InputComponent = withUncontrolledInput(component)\n }\n\n const Field = _createField(InputComponent, {\n displayName: `${component.displayName ?? 'Custom'}Field`,\n hideLabel: options?.hideLabel,\n getBaseField: () => ({\n extraProps: [],\n BaseField,\n }),\n }) as React.FC<Omit<BaseFieldProps, keyof TProps> & TProps>\n\n return Field\n}\n","import * as React from 'react'\nimport { FormState, get } from 'react-hook-form'\n\nimport {\n Box,\n FormControl,\n FormLabel,\n FormHelperText,\n FormErrorMessage,\n useBreakpointValue,\n} from '@chakra-ui/react'\n\nimport { splitProps } from '@saas-ui/core'\n\nimport { useFormContext } from './form-context'\n\nimport type { BaseFieldProps } from './types'\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const useBaseField = (props: BaseFieldProps) => {\n const [fieldProps] = splitProps(props, ['name', 'label', 'help', 'hideLabel'])\n\n const [controlProps] = splitProps(props, [\n 'id',\n 'direction',\n 'isDisabled',\n 'isInvalid',\n 'isReadOnly',\n 'isRequired',\n ])\n\n const { formState } = useFormContext()\n\n const error = getError(fieldProps.name, formState)\n const touched = isTouched(fieldProps.name, formState)\n\n return {\n ...fieldProps,\n controlProps,\n error,\n touched,\n }\n}\n\n/**\n * The default BaseField component\n * Composes the Chakra UI FormControl component, with FormLabel, FormHelperText and FormErrorMessage.\n */\nexport const BaseField: React.FC<BaseFieldProps> = (props) => {\n const { controlProps, label, help, hideLabel, error } = useBaseField(props)\n\n const isInvalid = !!error || controlProps.isInvalid\n\n const { direction, ...rest } = controlProps\n\n return (\n <FormControl\n {...rest}\n isInvalid={isInvalid}\n variant={direction === 'row' ? 'horizontal' : undefined}\n >\n {label && !hideLabel ? <FormLabel>{label}</FormLabel> : null}\n <Box>\n {props.children}\n {help && !error?.message ? (\n <FormHelperText>{help}</FormHelperText>\n ) : null}\n {error?.message && (\n <FormErrorMessage>{error?.message}</FormErrorMessage>\n )}\n </Box>\n </FormControl>\n )\n}\n\nBaseField.displayName = 'BaseField'\n","import * as React from 'react'\n\nimport { FormLayout } from './layout'\nimport { BaseFieldProps } from './types'\nimport { Field } from './field'\n\nimport { ArrayField } from './array-field'\nimport { ObjectField } from './object-field'\nimport { FieldResolver } from './field-resolver'\nimport { useFormContext } from './form-context'\n\nexport interface FieldsProps<TSchema = any> {\n schema?: TSchema\n fieldResolver?: FieldResolver\n focusFirstField?: boolean\n}\n\nconst mapNestedFields = (resolver: FieldResolver, name: string) => {\n return resolver\n .getNestedFields(name)\n ?.map(\n (\n { name, type, ...nestedFieldProps }: BaseFieldProps,\n i\n ): React.ReactNode => (\n <Field\n key={name || i}\n name={name}\n type={type as any}\n {...nestedFieldProps}\n />\n )\n )\n}\n\nexport const AutoFields: React.FC<FieldsProps> = ({\n schema: schemaProp,\n fieldResolver: fieldResolverProp,\n focusFirstField,\n ...props\n}) => {\n const context = useFormContext()\n const schema = schemaProp || context.schema\n const fieldResolver = fieldResolverProp || context.fieldResolver\n const resolver = React.useMemo(() => fieldResolver, [schema, fieldResolver])\n\n const fields = React.useMemo(() => resolver?.getFields(), [resolver])\n\n const form = useFormContext()\n\n React.useEffect(() => {\n if (focusFirstField && fields?.[0]?.name) {\n form.setFocus(fields[0].name)\n }\n }, [schema, fieldResolver, focusFirstField])\n\n if (!resolver) {\n return null\n }\n\n return (\n <FormLayout {...props}>\n {fields?.map(\n ({\n name,\n type,\n defaultValue,\n ...fieldProps\n }: BaseFieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ObjectField>\n )\n }\n\n return (\n <Field\n key={name}\n name={name}\n type={type as any}\n defaultValue={defaultValue}\n {...fieldProps}\n />\n )\n }\n )}\n </FormLayout>\n )\n}\n\nAutoFields.displayName = 'Fields'\n","import * as React from 'react'\n\nimport {\n chakra,\n omitThemingProps,\n SimpleGrid,\n SimpleGridProps,\n ThemingProps,\n useStyleConfig,\n useTheme,\n} from '@chakra-ui/react'\nimport { cx } from '@chakra-ui/utils'\n\nexport interface FormLayoutProps\n extends ThemingProps<'SuiFormLayout'>,\n SimpleGridProps {}\n\ninterface FormLayoutItemProps {\n children: React.ReactNode\n}\n\nconst FormLayoutItem: React.FC<FormLayoutItemProps> = ({ children }) => {\n return <chakra.div>{children}</chakra.div>\n}\n\nFormLayoutItem.displayName = 'FormLayoutItem'\n\n/**\n * Create consistent field spacing and positioning.\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n *\n * @see https://saas-ui.dev/docs/components/forms/form\n */\nexport const FormLayout = ({ children, ...props }: FormLayoutProps) => {\n const theme = useTheme()\n\n const defaultProps = theme.components?.SuiFormLayout?.defaultProps ?? {\n spacing: 4,\n }\n\n const styles = useStyleConfig('SuiFormLayout', props)\n\n const gridProps = omitThemingProps({\n ...defaultProps,\n ...props,\n })\n\n return (\n <SimpleGrid\n {...gridProps}\n className={cx('sui-form__layout', props.className)}\n sx={{\n ...styles,\n ...props.sx,\n }}\n >\n {children}\n </SimpleGrid>\n )\n}\n\nFormLayout.displayName = 'FormLayout'\n","import * as React from 'react'\n\nimport {\n chakra,\n ResponsiveValue,\n forwardRef,\n Button,\n ButtonProps,\n} from '@chakra-ui/react'\nimport { PlusIcon, MinusIcon } from '@saas-ui/core/icons'\n\nimport { FormLayout, FormLayoutProps } from './layout'\nimport { BaseField } from './base-field'\nimport { BaseFieldProps } from './types'\n\nimport { mapNestedFields } from './utils'\n\nimport {\n useArrayField,\n useArrayFieldRow,\n useArrayFieldContext,\n ArrayFieldProvider,\n ArrayFieldOptions,\n ArrayFieldRowProvider,\n useArrayFieldRowContext,\n useArrayFieldRemoveButton,\n useArrayFieldAddButton,\n UseArrayFieldReturn,\n} from './use-array-field'\nimport { FieldPath, FieldValues } from 'react-hook-form'\nimport { isFunction } from '@chakra-ui/utils'\nimport { MaybeRenderProp } from '@chakra-ui/react-utils'\nimport { useFieldProps } from './form-context'\n\nexport interface ArrayFieldButtonProps extends ButtonProps {}\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps extends FormLayoutProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The array index\n */\n index: number\n /**\n * The fields\n */\n children: React.ReactNode\n}\n/**\n * Render prop component, to get access to the internal fields state. Must be a child of ArrayFieldContainer.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rowFieldsProps\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields {...rowFieldsProps}>{children}</ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nArrayFieldRow.displayName = 'ArrayFieldRow'\n\nexport interface ArrayFieldRowFieldsProps extends FormLayoutProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The fields\n */\n children: React.ReactNode\n}\n/**\n * Add the name prefix to the fields and acts as a horizontal form layout by default.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout flex=\"1\" mr=\"2\" {...layoutProps}>\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nArrayFieldRowFields.displayName = 'ArrayFieldRowFields'\n\n/**\n * The row container component providers row context.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n ...rest\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div {...rest} __css={styles}>\n {children}\n </chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nArrayFieldRowContainer.displayName = 'ArrayFieldRowContainer'\n\n/**\n * The default remove button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldRemoveButton: React.FC<ArrayFieldButtonProps> = (\n props\n) => {\n return (\n <Button aria-label=\"Remove row\" {...useArrayFieldRemoveButton()} {...props}>\n {props.children || <MinusIcon />}\n </Button>\n )\n}\n\nArrayFieldRemoveButton.displayName = 'ArrayFieldRemoveButton'\n\n/**\n * The default add button.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldAddButton: React.FC<ArrayFieldButtonProps> = (props) => {\n return (\n <Button\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n >\n {props.children || <PlusIcon />}\n </Button>\n )\n}\n\nArrayFieldAddButton.displayName = 'ArrayFieldAddButton'\n\nexport interface ArrayFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends ArrayFieldOptions<TFieldValues, TName>,\n Omit<\n BaseFieldProps<TFieldValues, TName>,\n 'name' | 'defaultValue' | 'children'\n > {\n children: MaybeRenderProp<ArrayField[]>\n}\n\n/**\n * The wrapper component that composes the default ArrayField functionality.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayField = forwardRef(\n (props: ArrayFieldProps, ref: React.ForwardedRef<UseArrayFieldReturn>) => {\n const { children, ...containerProps } = props\n\n const rowFn = isFunction(children)\n ? children\n : (fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n )) || null}\n </>\n )\n\n return (\n <ArrayFieldContainer ref={ref} {...containerProps}>\n <ArrayFieldRows>{rowFn as any}</ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n }\n) as ((\n props: ArrayFieldProps & {\n ref?: React.ForwardedRef<UseArrayFieldReturn>\n }\n) => React.ReactElement) & {\n displayName: string\n}\n\nArrayField.displayName = 'ArrayField'\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nArrayFieldRows.displayName = 'ArrayFieldRows'\n\nexport interface ArrayFieldContainerProps\n extends Omit<ArrayFieldProps, 'children'> {\n children: React.ReactNode\n}\n\n/**\n * The container component provides context and state management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/array-field\n */\nexport const ArrayFieldContainer = React.forwardRef(\n (\n {\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n }: ArrayFieldContainerProps,\n ref: React.ForwardedRef<UseArrayFieldReturn>\n ) => {\n const overrides = useFieldProps(name)\n\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min: min || (overrides as any)?.min,\n max: max || (overrides as any)?.max,\n })\n\n // This exposes the useArrayField api through the forwarded ref\n React.useImperativeHandle(ref, () => context, [ref, context])\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps} {...overrides}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n }\n)\n\nArrayFieldContainer.displayName = 'ArrayFieldContainer'\n","import * as React from 'react'\nimport {\n useFieldArray,\n UseFieldArrayReturn,\n FieldValues,\n FieldPath,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\n\nimport { createContext } from '@chakra-ui/react-utils'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n /**\n * The field name\n */\n name: TName\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses a different 'id' field\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\nimport {\n FormControl,\n FormLabel,\n FormLabelProps,\n ResponsiveValue,\n useStyleConfig,\n} from '@chakra-ui/react'\n\nimport { FormLayout } from './layout'\nimport { BaseFieldProps } from './types'\n\nimport { mapNestedFields } from './utils'\nimport { FieldPath, FieldValues } from 'react-hook-form'\nimport { useFieldProps } from './form-context'\n\nexport interface ObjectFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends BaseFieldProps {\n name: TName\n children: React.ReactNode\n columns?: ResponsiveValue<number>\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const FormLegend = (props: FormLabelProps) => {\n const styles = useStyleConfig('SuiFormLegend')\n return <FormLabel as=\"legend\" sx={styles} {...props} />\n}\n/**\n * The object field component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/object-field\n */\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const {\n name,\n label,\n hideLabel: hideLabelProp,\n children,\n columns: columnsProp,\n spacing: spacingProp,\n ...fieldProps\n } = props\n\n const { hideLabel, columns, spacing, ...overrides } = useFieldProps(\n name\n ) as Omit<ObjectFieldProps, 'name'>\n\n return (\n <FormControl name={name} as=\"fieldset\" {...fieldProps} {...overrides}>\n <FormLegend display={hideLabelProp || hideLabel ? 'none' : 'block'}>\n {label}\n </FormLegend>\n <FormLayout\n columns={columnsProp || columns}\n gridGap={spacingProp || spacing}\n >\n {mapNestedFields(name, children)}\n </FormLayout>\n </FormControl>\n )\n}\n\nObjectField.displayName = 'ObjectField'\n","import * as React from 'react'\n\nimport { useFormContext } from 'react-hook-form'\n\nimport { Button, ButtonProps, forwardRef } from '@chakra-ui/react'\nimport { useFieldProps } from './form-context'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n */\n disableIfInvalid?: boolean\n}\n/**\n * A button with type submit and default color scheme primary and isLoading state when the form is submitting.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const SubmitButton = forwardRef<SubmitButtonProps, 'button'>(\n (props, ref) => {\n const {\n variant = 'primary',\n children = 'Submit',\n disableIfUntouched: disableIfUntouchedProp = false,\n disableIfInvalid: disableIfInvalidProp = false,\n isDisabled: isDisabledProp,\n isLoading,\n ...rest\n } = props\n const { formState } = useFormContext()\n\n const field = useFieldProps('submit') as SubmitButtonProps\n\n const {\n disableIfUntouched: disableIfUntouchedOverride,\n disableIfInvalid: disableIfInvalidOverride,\n ...fieldProps\n } = field\n\n const disableIfUntouched =\n disableIfUntouchedOverride ?? disableIfUntouchedProp\n const disableIfInvalid = disableIfInvalidOverride ?? disableIfInvalidProp\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid) ||\n isDisabledProp\n\n return (\n <Button\n ref={ref}\n variant={variant}\n type=\"submit\"\n isLoading={formState.isSubmitting || isLoading}\n isDisabled={isDisabled}\n children={children}\n {...rest}\n {...fieldProps}\n />\n )\n }\n)\n\nSubmitButton.displayName = 'SubmitButton'\n","import * as React from 'react'\nimport {\n useWatch,\n FieldValues,\n UseFormReturn,\n FieldPath,\n} from 'react-hook-form'\n\nimport { useFormContext } from './form-context'\n\nexport interface DisplayIfProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> {\n children: React.ReactElement\n name: TName\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n onToggle?: (\n conditionMatched: boolean,\n context: UseFormReturn<TFieldValues>\n ) => void\n}\n/**\n * Conditionally render parts of a form.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const DisplayIf = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n onToggle,\n}: DisplayIfProps<TFieldValues, TName>) => {\n const initializedRef = React.useRef(false)\n const matchesRef = React.useRef(false)\n\n const value = useWatch<TFieldValues>({\n name,\n defaultValue: defaultValue as any,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext() as any\n\n const matches = condition(value, context)\n\n React.useEffect(() => {\n if (!initializedRef.current) {\n initializedRef.current = true\n return\n }\n if (matchesRef.current === matches) return\n matchesRef.current = matches\n onToggle?.(matches, context)\n }, [value])\n\n return matches ? children : null\n}\n\nDisplayIf.displayName = 'DisplayIf'\n","import * as React from 'react'\n\nimport { FieldValues } from 'react-hook-form'\n\nimport {\n chakra,\n Button,\n ButtonProps,\n HTMLChakraProps,\n ThemingProps,\n} from '@chakra-ui/react'\n\nimport { callAllHandlers, cx } from '@chakra-ui/utils'\n\nimport {\n Steps,\n StepsItem,\n StepsItemProps,\n StepsProps,\n useStepperContext,\n} from '@saas-ui/core'\n\nimport { SubmitButton } from './submit-button'\n\nimport {\n useFormStep,\n UseStepFormProps,\n FormStepSubmitHandler,\n} from './use-step-form'\n\nexport type StepsOptions<TSchema, TName extends string = string> = {\n /**\n * The step name\n */\n name: TName\n /**\n * Schema\n */\n schema?: TSchema\n}[]\n\nexport interface StepFormProps<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object\n> extends UseStepFormProps<TSteps, TFieldValues, TContext> {}\n\nexport interface FormStepOptions<TName extends string = string> {\n /**\n * The step name\n */\n name: TName\n /**\n * Schema\n */\n schema?: any\n /**\n * Hook Form Resolver\n */\n resolver?: any\n}\n\nexport interface FormStepperProps extends StepsProps, ThemingProps<'Stepper'> {\n render?: StepsItemProps['render']\n}\n\n/**\n * Renders a stepper that displays progress above the form.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const FormStepper: React.FC<FormStepperProps> = (props) => {\n const { activeIndex, setIndex } = useStepperContext()\n\n const {\n children,\n orientation,\n variant,\n colorScheme,\n size,\n onChange: onChangeProp,\n render,\n ...rest\n } = props\n\n const elements = React.Children.map(children, (child) => {\n if (\n React.isValidElement<FormStepProps>(child) &&\n child?.type === FormStep\n ) {\n const { isCompleted } = useFormStep(child.props) // Register this step\n return (\n <StepsItem\n render={render}\n name={child.props.name}\n title={child.props.title}\n isCompleted={isCompleted}\n {...rest}\n >\n {child.props.children}\n </StepsItem>\n )\n }\n return child\n })\n\n const onChange = React.useCallback((i: number) => {\n setIndex(i)\n onChangeProp?.(i)\n }, [])\n\n return (\n <Steps\n orientation={orientation}\n step={activeIndex}\n variant={variant}\n colorScheme={colorScheme}\n size={size}\n onChange={onChange}\n >\n {elements}\n </Steps>\n )\n}\n\nexport interface FormStepProps<TName extends string = string>\n extends FormStepOptions<TName>,\n Omit<HTMLChakraProps<'div'>, 'onSubmit'> {\n onSubmit?: FormStepSubmitHandler\n}\n/**\n * The form step containing fields for a specific step.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const FormStep = <TName extends string = string>(\n props: FormStepProps<TName>\n) => {\n const { name, children, className, onSubmit, ...rest } = props\n const step = useFormStep({ name, onSubmit })\n\n const { isActive } = step\n\n return isActive ? (\n <chakra.div {...rest} className={cx('sui-form__step', className)}>\n {children}\n </chakra.div>\n ) : null\n}\n\nFormStep.displayName = 'FormStep'\n\n/**\n * A button that this opens the previous step when clicked. Disabled on the first step.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const PrevButton: React.FC<ButtonProps> = (props) => {\n const { isFirstStep, isCompleted, prevStep } = useStepperContext()\n\n return (\n <Button\n isDisabled={isFirstStep || isCompleted}\n children=\"Back\"\n {...props}\n className={cx('sui-form__prev-button', props.className)}\n onClick={callAllHandlers(props.onClick, prevStep)}\n />\n )\n}\n\nPrevButton.displayName = 'PrevButton'\n\nexport interface NextButtonProps extends Omit<ButtonProps, 'children'> {\n submitLabel?: string\n label?: string\n}\n\n/**\n * A button that submits the active step.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const NextButton: React.FC<NextButtonProps> = (props) => {\n const { label = 'Next', submitLabel = 'Complete', ...rest } = props\n const { isLastStep, isCompleted } = useStepperContext()\n\n return (\n <SubmitButton\n {...rest}\n isDisabled={isCompleted}\n className={cx('sui-form__next-button', props.className)}\n >\n {isLastStep || isCompleted ? submitLabel : label}\n </SubmitButton>\n )\n}\n\nNextButton.displayName = 'NextButton'\n","import * as React from 'react'\nimport { FieldValues, SubmitHandler } from 'react-hook-form'\nimport { createContext } from '@chakra-ui/react-utils'\nimport {\n useStepper,\n useStep,\n UseStepperProps,\n UseStepperReturn,\n} from '@saas-ui/core'\n\nexport interface StepState {\n name: string\n schema?: any\n resolver?: any\n isActive?: boolean\n isCompleted?: boolean\n onSubmit?: FormStepSubmitHandler\n}\n\nexport type FormStepSubmitHandler<\n TFieldValues extends FieldValues = FieldValues\n> = (data: TFieldValues, stepper: UseStepperReturn) => Promise<void>\n\nexport interface StepFormContext extends UseStepperReturn {\n updateStep(state: StepState): void\n steps: Record<string, StepState>\n}\n\nexport const [StepFormProvider, useStepFormContext] =\n createContext<StepFormContext>({\n name: 'StepFormContext',\n errorMessage:\n 'useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`',\n })\n\nimport { FocusableElement } from '@chakra-ui/utils'\nimport { FormProps } from './form'\nimport { FormStepProps, StepsOptions } from './step-form'\nimport { FieldProps, StepFormChildren } from './types'\nimport { DisplayIfProps } from './display-if'\nimport { ArrayFieldProps } from './array-field'\nimport { UseArrayFieldReturn } from './use-array-field'\nimport { ObjectFieldProps } from './object-field'\n\ntype StepName<T extends { [k: number]: { readonly name: string } }> =\n T[number]['name']\n\nexport interface StepFormRenderContext<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues>\n> extends UseStepFormReturn<TFieldValues> {\n Field: React.FC<TFieldTypes & React.RefAttributes<FocusableElement>>\n FormStep: React.FC<FormStepProps<StepName<TSteps>>>\n DisplayIf: React.FC<DisplayIfProps<TFieldValues>>\n ArrayField: React.FC<\n ArrayFieldProps<TFieldValues> & React.RefAttributes<UseArrayFieldReturn>\n >\n ObjectField: React.FC<ObjectFieldProps<TFieldValues>>\n}\n\nexport interface UseStepFormProps<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object\n> extends Omit<UseStepperProps, 'onChange'>,\n Omit<FormProps<any, TFieldValues, TContext>, 'children'> {\n steps?: TSteps\n children: StepFormChildren<any, TSteps, TFieldValues, TContext>\n}\n\nexport interface UseStepFormReturn<\n TFieldValues extends FieldValues = FieldValues\n> extends UseStepperReturn {\n getFormProps(): {\n onSubmit: SubmitHandler<TFieldValues>\n schema?: any\n resolver?: any\n }\n updateStep(step: any): void\n steps: Record<string, any>\n}\n\nexport function useStepForm<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object\n>(\n props: UseStepFormProps<TSteps, TFieldValues, TContext>\n): UseStepFormReturn<TFieldValues> {\n const {\n onChange,\n steps: stepsOptions,\n resolver,\n fieldResolver,\n ...rest\n } = props\n const stepper = useStepper(rest)\n\n const [options, setOptions] = React.useState<TSteps | undefined>(stepsOptions)\n\n const { activeStep, isLastStep, nextStep } = stepper\n\n const [steps, updateSteps] = React.useState<Record<string, StepState>>({})\n\n const mergedData = React.useRef<TFieldValues>({} as any)\n\n const onSubmitStep: SubmitHandler<TFieldValues> = React.useCallback(\n async (data) => {\n try {\n const step = steps[activeStep]\n\n mergedData.current = {\n ...mergedData.current,\n ...data,\n }\n\n if (isLastStep) {\n await props.onSubmit?.(mergedData.current)\n\n updateStep({\n ...step,\n isCompleted: true,\n })\n\n nextStep() // show completed step\n return\n }\n\n await step.onSubmit?.(data, stepper)\n\n nextStep()\n } catch (e) {\n // Step submission failed.\n }\n },\n [steps, activeStep, isLastStep, mergedData]\n )\n\n const getFormProps = React.useCallback(() => {\n const step = steps[activeStep]\n\n return {\n onSubmit: onSubmitStep,\n schema: step?.schema,\n resolver: step?.schema\n ? /* @todo fix resolver type */ (resolver as any)?.(step.schema)\n : undefined,\n fieldResolver: step?.schema\n ? (fieldResolver as any)?.(step.schema)\n : undefined,\n }\n }, [steps, onSubmitStep, activeStep, resolver, fieldResolver])\n\n const updateStep = React.useCallback(\n (step: StepState) => {\n const stepOptions = options?.find((s) => s.name === step.name)\n updateSteps((steps) => {\n return {\n ...steps,\n [step.name]: {\n ...step,\n schema: stepOptions?.schema,\n },\n }\n })\n },\n [steps, options]\n )\n\n return {\n getFormProps,\n updateStep,\n steps,\n ...stepper,\n }\n}\n\nexport interface UseFormStepProps {\n name: string\n schema?: any\n resolver?: any\n onSubmit?: FormStepSubmitHandler\n}\n\nexport function useFormStep(props: UseFormStepProps): StepState {\n const { name, schema, resolver, onSubmit } = props\n const step = useStep({ name })\n\n const { steps, updateStep } = useStepFormContext()\n\n React.useEffect(() => {\n updateStep({ name, schema, resolver, onSubmit })\n }, [name, schema])\n\n return {\n ...step,\n ...(steps[name] || { name, schema }),\n }\n}\n","import { BaseFieldProps, ValueOf } from './types'\n\nimport { get } from '@chakra-ui/utils'\nimport { ArrayFieldProps } from './array-field'\nimport { ObjectFieldProps } from './object-field'\nimport { DefaultFields } from './default-fields'\n\nexport type FieldResolver = {\n getFields(): BaseFieldProps[]\n getNestedFields(name: string): BaseFieldProps[]\n}\n\nexport type GetFieldResolver<TSchema = any> = (schema: TSchema) => FieldResolver\n\ntype FieldTypes<FieldDefs = DefaultFields> = ValueOf<{\n [K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props>\n ? { type?: K } & Omit<Props, 'name'>\n : never\n}>\n\ntype SchemaField<FieldDefs = DefaultFields> =\n | FieldTypes<FieldDefs>\n | (Omit<ObjectFieldProps, 'name' | 'children'> & {\n type: 'object'\n properties?: Record<string, SchemaField<FieldDefs>>\n })\n | (Omit<ArrayFieldProps, 'name' | 'children'> & {\n type: 'array'\n items?: SchemaField<FieldDefs>\n })\n\nexport type ObjectSchema<FieldDefs = DefaultFields> = Record<\n string,\n SchemaField<FieldDefs>\n>\n\nconst mapFields = (schema: ObjectSchema): BaseFieldProps[] =>\n schema &&\n Object.entries(schema).map(([name, props]) => {\n const { items, label, title, ...field } = props as any\n return {\n ...field,\n name,\n label: label || title || name, // json schema compatibility\n }\n })\n\nexport const objectFieldResolver: GetFieldResolver<ObjectSchema> = (schema) => {\n const getFields = (): BaseFieldProps[] => {\n return mapFields(schema)\n }\n const getNestedFields = (name: string): BaseFieldProps[] => {\n const field = get(schema, name)\n\n if (!field) return []\n\n if (field.items?.type === 'object') {\n return mapFields(field.items.properties)\n } else if (field.type === 'object') {\n return mapFields(field.properties)\n }\n return [field.items]\n }\n\n return { getFields, getNestedFields }\n}\n","import { FieldValues, useWatch } from 'react-hook-form'\nimport { useFormContext, UseFormReturn } from './form-context'\n\nexport interface WatchFieldProps<\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n> {\n name: string\n defaultValue?: Value\n isDisabled?: boolean\n isExact?: boolean\n children: (\n value: Value,\n form: UseFormReturn<TFieldValues, TContext>\n ) => React.ReactElement | void\n}\n\nexport const WatchField = <\n Value = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WatchFieldProps<Value, TFieldValues, TContext>\n) => {\n const { name, defaultValue, isDisabled, isExact } = props\n const form = useFormContext<TFieldValues, TContext>()\n\n const field = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n\n return props.children(field, form) || null\n}\n","import React, { ForwardedRef, useMemo } from 'react'\nimport { forwardRef } from '@chakra-ui/react'\n\nimport { FieldsProvider } from './fields-context'\nimport { Form, FieldValues, FormProps, GetResolver } from './form'\nimport { GetBaseField, WithFields } from './types'\nimport { objectFieldResolver } from './field-resolver'\nimport { GetFieldResolver } from './field-resolver'\nimport { defaultFieldTypes } from './default-fields'\n\nexport interface CreateFormProps<\n FieldDefs,\n TGetBaseField extends GetBaseField = GetBaseField,\n> {\n resolver?: GetResolver\n fieldResolver?: GetFieldResolver\n fields?: FieldDefs extends Record<string, React.FC<any>> ? FieldDefs : never\n getBaseField?: TGetBaseField\n}\n\nexport type FormType<\n FieldDefs,\n ExtraProps = object,\n ExtraFieldProps extends object = object,\n ExtraOverrides = object,\n> = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs,\n ExtraOverrides\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n } & ExtraProps\n) => React.ReactElement) & {\n displayName?: string\n id?: string\n}\n\nexport function createForm<\n FieldDefs,\n TGetBaseField extends GetBaseField<any> = GetBaseField<any>,\n>({\n resolver,\n fieldResolver = objectFieldResolver,\n fields,\n getBaseField,\n}: CreateFormProps<FieldDefs, TGetBaseField> = {}) {\n type ExtraFieldProps =\n TGetBaseField extends GetBaseField<infer ExtraFieldProps>\n ? ExtraFieldProps\n : object\n\n const DefaultForm = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n >(\n props: WithFields<\n FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>,\n FieldDefs\n >,\n ref: ForwardedRef<HTMLFormElement>\n ) => {\n const {\n schema,\n resolver: resolverProp,\n fieldResolver: fieldResolverProp,\n ...rest\n } = props\n\n const fieldsContext = useMemo(\n () => ({\n fields: { ...defaultFieldTypes, ...fields },\n getBaseField,\n }),\n [fields, getBaseField]\n )\n\n return (\n <FieldsProvider value={fieldsContext}>\n <Form\n ref={ref}\n resolver={resolverProp ?? resolver?.(props.schema)}\n fieldResolver={fieldResolverProp ?? fieldResolver?.(schema)}\n {...rest}\n />\n </FieldsProvider>\n )\n }\n ) as FormType<FieldDefs, object, ExtraFieldProps>\n\n DefaultForm.displayName = 'Form'\n DefaultForm.id = 'Form'\n\n return DefaultForm\n}\n","import * as React from 'react'\n\nimport { chakra, HTMLChakraProps, forwardRef } from '@chakra-ui/react'\nimport { FocusableElement, cx, runIfFn } from '@chakra-ui/utils'\n\nimport {\n useForm,\n UseFormProps,\n UseFormReturn,\n FieldValues,\n SubmitHandler,\n SubmitErrorHandler,\n ResolverOptions,\n ResolverResult,\n WatchObserver,\n} from 'react-hook-form'\nimport { FormProvider } from './form-context'\nimport { FieldResolver } from './field-resolver'\nimport { MaybeRenderProp } from '@chakra-ui/react-utils'\n\nexport type { UseFormReturn, FieldValues, SubmitHandler }\n\nimport { FieldProps, DefaultFieldOverrides } from './types'\n\nimport { Field as DefaultField } from './field'\nimport { FormLayout } from './layout'\nimport { AutoFields } from './fields'\nimport { SubmitButton } from './submit-button'\nimport { DisplayIf, DisplayIfProps } from './display-if'\nimport { ArrayField, ArrayFieldProps } from './array-field'\nimport { ObjectField, ObjectFieldProps } from './object-field'\nimport { UseArrayFieldReturn } from './use-array-field'\n\nexport interface FormRenderContext<\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n> extends UseFormReturn<TFieldValues, TContext> {\n Field: React.FC<TFieldTypes & React.RefAttributes<FocusableElement>>\n DisplayIf: React.FC<DisplayIfProps<TFieldValues>>\n ArrayField: React.FC<\n ArrayFieldProps<TFieldValues> & React.RefAttributes<UseArrayFieldReturn>\n >\n ObjectField: React.FC<ObjectFieldProps<TFieldValues>>\n}\n\ninterface FormOptions<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> {\n /**\n * The form schema.\n */\n schema?: TSchema\n /**\n * Triggers when any of the field change.\n */\n onChange?: WatchObserver<TFieldValues>\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * The Hook Form state ref.\n */\n formRef?: React.Ref<UseFormReturn<TFieldValues, TContext>>\n /**\n * The form children, can be a render prop or a ReactNode.\n */\n children?: MaybeRenderProp<\n FormRenderContext<TFieldValues, TContext, TFieldTypes>\n >\n /**\n * The field resolver, used to resolve the fields from schemas.\n */\n fieldResolver?: FieldResolver\n /**\n * Field overrides\n */\n fields?: DefaultFieldOverrides\n}\n\nexport interface FormProps<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues, TExtraFieldProps>,\n> extends UseFormProps<TFieldValues, TContext>,\n Omit<\n HTMLChakraProps<'form'>,\n 'children' | 'onChange' | 'onSubmit' | 'onError'\n >,\n FormOptions<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > {}\n\n/**\n * The wrapper component provides context, state, and focus management.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = forwardRef(\n <\n TSchema = any,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n >(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n >,\n ref: React.ForwardedRef<HTMLFormElement>\n ) => {\n const {\n mode = 'all',\n resolver,\n fieldResolver,\n fields,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n values,\n context,\n resetOptions,\n onChange,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n values,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n context,\n resetOptions,\n }\n\n const methods = useForm<TFieldValues, TContext>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwarded ref\n React.useImperativeHandle(formRef, () => methods, [formRef, methods])\n\n React.useEffect(() => {\n let subscription: any\n if (onChange) {\n subscription = methods.watch(onChange)\n }\n return () => subscription?.unsubscribe()\n }, [methods, onChange])\n\n let _children = children\n if (!_children && fieldResolver) {\n _children = (\n <FormLayout>\n <AutoFields />\n <SubmitButton {...fields?.submit} />\n </FormLayout>\n )\n }\n\n return (\n <FormProvider\n {...methods}\n schema={schema}\n fieldResolver={fieldResolver}\n fields={fields}\n >\n <chakra.form\n ref={ref}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n className={cx('sui-form', props.className)}\n >\n {runIfFn(_children, {\n Field: DefaultField as any,\n DisplayIf: DisplayIf as any,\n ArrayField: ArrayField as any,\n ObjectField: ObjectField as any,\n ...methods,\n })}\n </chakra.form>\n </FormProvider>\n )\n }\n) as FormComponent\n\nexport type FormComponent = (<\n TSchema = unknown,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TExtraFieldProps extends object = object,\n TFieldTypes = FieldProps<TFieldValues>,\n>(\n props: FormProps<\n TSchema,\n TFieldValues,\n TContext,\n TExtraFieldProps,\n TFieldTypes\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n }\n) => React.ReactElement) & {\n displayName?: string\n}\n\nForm.displayName = 'Form'\n\nexport type GetResolver = <\n TFieldValues extends FieldValues,\n TContext extends object,\n>(\n schema: unknown\n) => (\n values: TFieldValues,\n context: TContext | undefined,\n options: ResolverOptions<TFieldValues>\n) => Promise<ResolverResult<TFieldValues>>\n","import React, { useMemo } from 'react'\nimport { forwardRef } from '@chakra-ui/react'\nimport {\n ArrayField,\n DisplayIf,\n FieldProps,\n FieldValues,\n FieldsProvider,\n GetFieldResolver,\n ObjectField,\n defaultFieldTypes,\n} from './'\nimport { Form } from './form'\nimport { Field } from './field'\nimport { FormStep, StepsOptions } from './step-form'\nimport {\n StepFormProvider,\n UseStepFormProps,\n useStepForm,\n} from './use-step-form'\nimport { StepperProvider } from '@saas-ui/core'\nimport { runIfFn } from '@chakra-ui/utils'\nimport { GetResolver } from './form'\nimport { GetBaseField, WithStepFields } from './types'\n\nexport type StepFormType<\n FieldDefs,\n ExtraProps = object,\n ExtraFieldProps extends object = object,\n ExtraOverrides = object,\n> = (<\n TSteps extends StepsOptions<any> = StepsOptions<any>,\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n TFieldTypes = FieldProps<TFieldValues, ExtraFieldProps>,\n>(\n props: WithStepFields<\n UseStepFormProps<TSteps, TFieldValues, TContext>,\n FieldDefs,\n ExtraOverrides\n > & {\n ref?: React.ForwardedRef<HTMLFormElement>\n } & ExtraProps\n) => React.ReactElement) & {\n displayName?: string\n id?: string\n}\n\nexport interface CreateStepFormProps<\n FieldDefs,\n TGetBaseField extends GetBaseField = GetBaseField,\n> {\n resolver?: GetResolver\n fieldResolver?: GetFieldResolver\n fields?: FieldDefs extends Record<string, React.FC<any>> ? FieldDefs : never\n getBaseField?: TGetBaseField\n}\n\nexport function createStepForm<\n FieldDefs,\n TGetBaseField extends GetBaseField<any> = GetBaseField<any>,\n>({\n fields,\n resolver,\n fieldResolver,\n getBaseField,\n}: CreateStepFormProps<FieldDefs, TGetBaseField> = {}) {\n type ExtraFieldProps =\n TGetBaseField extends GetBaseField<infer ExtraFieldProps>\n ? ExtraFieldProps\n : object\n\n const StepForm = forwardRef<any, 'div'>((props, ref) => {\n const { children, steps, ...rest } = props\n\n const stepper = useStepForm({\n resolver,\n fieldResolver,\n ...props,\n })\n\n const { getFormProps, ...ctx } = stepper\n\n const context = useMemo(() => ctx, [ctx])\n\n const fieldsContext = {\n fields: {\n ...defaultFieldTypes,\n ...fields,\n },\n getBaseField,\n }\n\n return (\n <StepperProvider value={context}>\n <StepFormProvider value={context}>\n <FieldsProvider value={fieldsContext}>\n <Form ref={ref} {...rest} {...getFormProps()}>\n {runIfFn(children, {\n ...stepper,\n Field: Field as any,\n FormStep: FormStep as any,\n DisplayIf: DisplayIf as any,\n ArrayField: ArrayField as any,\n ObjectField: ObjectField as any,\n })}\n </Form>\n </FieldsProvider>\n </StepFormProvider>\n </StepperProvider>\n )\n }) as StepFormType<FieldDefs, object, ExtraFieldProps>\n\n StepForm.displayName = `Step${Form.displayName || Form.name}`\n\n return StepForm\n}\n","// Exporting from './display-field'\nexport { DisplayField } from './display-field'\nexport type { DisplayFieldProps } from './display-field'\nexport { FormValue } from './display-field'\n\n// Exporting from './field'\nexport { Field } from './field'\nexport type { FieldRules, Option } from './field'\n\n// Exporting from './fields'\nexport { AutoFields } from './fields'\nexport type { FieldsProps } from './fields'\n\n// Exporting from './fields-context'\nexport { FieldsProvider, useField } from './fields-context'\n\n// Exporting from './layout'\nexport { FormLayout } from './layout'\nexport type { FormLayoutProps } from './layout'\n\n// Exporting from './submit-button'\nexport { SubmitButton } from './submit-button'\nexport type { SubmitButtonProps } from './submit-button'\n\n// Exporting from './array-field'\nexport {\n ArrayField,\n ArrayFieldAddButton,\n ArrayFieldContainer,\n ArrayFieldRemoveButton,\n ArrayFieldRow,\n ArrayFieldRowContainer,\n ArrayFieldRowFields,\n ArrayFieldRows,\n} from './array-field'\n\nexport type {\n ArrayFieldButtonProps,\n ArrayFieldContainerProps,\n ArrayFieldProps,\n ArrayFieldRowFieldsProps,\n ArrayFieldRowsProps,\n} from './array-field'\n\n// Exporting from './use-array-field'\nexport {\n ArrayFieldProvider,\n ArrayFieldRowProvider,\n useArrayField,\n useArrayFieldAddButton,\n useArrayFieldContext,\n useArrayFieldRemoveButton,\n useArrayFieldRow,\n useArrayFieldRowContext,\n} from './use-array-field'\n\nexport type {\n ArrayFieldOptions,\n UseArrayFieldReturn,\n UseArrayFieldRowProps,\n UseArrayFieldRowReturn,\n} from './use-array-field'\n\n// Exporting from './object-field'\nexport { FormLegend, ObjectField } from './object-field'\nexport type { ObjectFieldProps } from './object-field'\n\n// Exporting from './display-if'\nexport { DisplayIf } from './display-if'\nexport type { DisplayIfProps } from './display-if'\n\n// Exporting from './step-form'\nexport { FormStep, FormStepper, NextButton, PrevButton } from './step-form'\n\nexport type {\n FormStepOptions,\n FormStepProps,\n FormStepperProps,\n NextButtonProps,\n StepFormProps,\n StepsOptions,\n} from './step-form'\n\n// Exporting from './use-step-form'\nexport {\n StepFormProvider,\n useFormStep,\n useStepForm,\n useStepFormContext,\n} from './use-step-form'\n\nexport type {\n FormStepSubmitHandler,\n StepFormContext,\n StepFormRenderContext,\n StepState,\n UseFormStepProps,\n UseStepFormProps,\n UseStepFormReturn,\n} from './use-step-form'\n\n// Exporting from './field-resolver'\nexport { objectFieldResolver } from './field-resolver'\nexport type {\n FieldResolver,\n GetFieldResolver,\n ObjectSchema,\n} from './field-resolver'\n\n// Exporting from './watch-field'\nexport { WatchField } from './watch-field'\nexport type { WatchFieldProps } from './watch-field'\n\n// Exporting from './input-right-button'\nexport { InputRightButton } from './input-right-button'\nexport type { InputRightButtonProps } from './input-right-button'\n\n// Exporting from './select'\nexport {\n NativeSelect,\n Select,\n SelectButton,\n SelectList,\n SelectOption,\n} from './select'\n\nexport type {\n NativeSelectProps,\n SelectButtonProps,\n SelectListProps,\n SelectProps,\n} from './select'\n\n// Exporting from './password-input'\nexport { PasswordInput } from './password-input'\nexport type { PasswordInputProps } from './password-input'\n\n// Exporting from './radio'\nexport { RadioInput } from './radio'\nexport type { RadioInputProps, RadioOption, RadioOptions } from './radio'\n\n// Exporting BaseField from './base-field'\nexport { BaseField, useBaseField } from './base-field'\n\n// Exporting from './default-fields'\nexport {\n CheckboxField,\n InputField,\n NativeSelectField,\n NumberInputField,\n PasswordInputField,\n PinField,\n RadioField,\n SelectField,\n SwitchField,\n TextareaField,\n defaultFieldTypes,\n} from './default-fields'\n\nexport type {\n DefaultFields,\n InputFieldProps,\n NumberInputFieldProps,\n PinFieldProps,\n SelectFieldProps,\n SwitchFieldProps,\n TextareaFieldProps,\n CheckboxFieldProps,\n NativeSelectFieldProps,\n RadioFieldProps,\n} from './default-fields'\n\n// Exporting types from './types'\nexport type {\n FieldProps,\n WithFields,\n BaseFieldProps,\n FieldOptions,\n DefaultFieldOverrides,\n WithStepFields,\n GetBaseField,\n} from './types'\n\n// Exporting from './create-form'\nexport { createForm } from './create-form'\nexport type { CreateFormProps, FormType } from './create-form'\n\n// Exporting from './create-field'\nexport { createField } from './create-field'\nexport type { CreateFieldOptions } from './create-field'\n\n// Exporting from './form'\nexport { Form as BaseForm } from './form'\nexport type { FormProps, FormRenderContext, FormComponent } from './form'\n\n// Exporting from './form-context'\nexport { FormProvider, useFormContext } from './form-context'\n\nexport { createStepForm } from './create-step-form'\nexport type { CreateStepFormProps } from './create-step-form'\n\n// Import and export Form and StepForm\nimport { createForm } from './create-form'\nimport { createStepForm } from './create-step-form'\n\n/**\n * Form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/form\n */\nexport const Form = createForm()\n\n/**\n * Multi-step form component.\n *\n * @see Docs https://saas-ui.dev/docs/components/forms/step-form\n */\nexport const StepForm = createStepForm()\n\nexport type {\n BatchFieldArrayUpdate,\n ChangeHandler,\n Control,\n ControllerFieldState,\n ControllerProps,\n ControllerRenderProps,\n CriteriaMode,\n CustomElement,\n DeepMap,\n DeepPartial,\n DeepPartialSkipArrayKey,\n DefaultValues,\n DelayCallback,\n EmptyObject,\n ErrorOption,\n EventType,\n Field as FieldDef,\n FieldArray,\n FieldArrayMethodProps,\n FieldArrayWithId,\n FieldElement,\n FieldError,\n FieldErrors,\n FieldName,\n FieldNamesMarkedBoolean,\n FieldRefs,\n FieldValue,\n FieldValues,\n FormProviderProps,\n FormState,\n FormStateProxy,\n FormStateSubjectRef,\n GetIsDirty,\n InternalFieldErrors,\n InternalFieldName,\n InternalNameSet,\n IsAny,\n IsFlatObject,\n KeepStateOptions,\n LiteralUnion,\n Message,\n Mode,\n MultipleFieldErrors,\n Names,\n NativeFieldValue,\n NestedValue,\n NonUndefined,\n Noop,\n Primitive,\n ReadFormState,\n Ref,\n RefCallBack,\n RegisterOptions,\n Resolver,\n ResolverError,\n ResolverOptions,\n ResolverResult,\n ResolverSuccess,\n SetFieldValue,\n SetValueConfig,\n Subjects,\n SubmitErrorHandler,\n SubmitHandler,\n TriggerConfig,\n UnpackNestedValue,\n UseControllerProps,\n UseControllerReturn,\n UseFieldArrayProps,\n UseFieldArrayReturn,\n UseFormClearErrors,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormProps,\n UseFormRegister,\n UseFormRegisterReturn,\n UseFormReset,\n UseFormResetField,\n UseFormReturn,\n UseFormSetError,\n UseFormSetFocus,\n UseFormSetValue,\n UseFormStateProps,\n UseFormStateReturn,\n UseFormTrigger,\n UseFormUnregister,\n UseFormWatch,\n UseWatchProps,\n Validate,\n ValidateResult,\n ValidationMode,\n ValidationRule,\n ValidationValue,\n ValidationValueMessage,\n WatchInternal,\n WatchObserver,\n} from 'react-hook-form'\n\nexport {\n appendErrors,\n useController,\n useFieldArray,\n useForm,\n useFormState,\n useWatch,\n Controller,\n} from 'react-hook-form'\n"],"mappings":";;;AAAA,YAAY,WAAW;AACvB;AAAA,EACE,gBAAgB;AAAA,EAEhB,kBAAkB;AAAA,OAEb;AAoED;AAxCN,IAAM,cAAoB,oBAAuC,IAAI;AAE9D,IAAM,iBAAiB,MAIvB;AACL,QAAM,UAAgB,iBAAW,WAAW;AAC5C,QAAM,cAAc,mBAA2C;AAE/D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GA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K,eAAe,KAAK,IAAI;AAE3D,SAAOA;AACT;;;ACyMA;AAAA,EACE;AAAA,EACA;AAAA,EACA,iBAAAG;AAAA,EACA,WAAAC;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,OACK;AAnHA,IAAMC,QAAO,WAAW;AAOxB,IAAM,WAAW,eAAe;","names":["jsx","React","React","jsx","forwardRef","Input","InputGroup","jsx","jsxs","forwardRef","InputGroup","Input","forwardRef","InputRightElement","jsx","jsx","jsxs","forwardRef","InputGroup","Input","forwardRef","React","jsx","forwardRef","forwardRef","Button","ChevronDownIcon","createContext","React","createContext","value","React","jsx","jsxs","forwardRef","ChevronDownIcon","Button","value","forwardRef","jsx","React","forwardRef","splitProps","FormControl","FormLabel","jsx","jsxs","FormControl","FormLabel","jsx","Field","forwardRef","BaseField","splitProps","jsx","jsxs","forwardRef","Input","InputGroup","NumberInputField","jsx","React","chakra","omitThemingProps","cx","jsx","React","chakra","forwardRef","Button","React","createContext","jsx","jsxs","chakra","Button","forwardRef","FormControl","FormLabel","useStyleConfig","jsx","jsxs","useStyleConfig","FormLabel","FormControl","jsx","mapNestedFields","name","useFormContext","Button","forwardRef","jsx","forwardRef","useFormContext","Button","React","React","chakra","Button","callAllHandlers","cx","React","createContext","steps","jsx","chakra","cx","Button","callAllHandlers","get","useWatch","useWatch","useMemo","forwardRef","React","chakra","forwardRef","cx","jsx","jsxs","forwardRef","chakra","cx","jsx","forwardRef","useMemo","useMemo","forwardRef","runIfFn","jsx","StepForm","forwardRef","useMemo","useFieldArray","useForm","useWatch","Controller","Form"]}
|