import { Database, Globe } from 'lucide-react'; import { FormikErrors, useFormikContext } from 'formik'; import { PropsWithChildren } from 'react'; import { Button } from '@@/buttons'; import { SimpleForm } from './SimpleForm'; import { Values } from './types'; import { AdvancedForm } from './AdvancedForm'; import { RateLimits } from './RateLimits'; export function ImageConfigFieldset({ checkRateLimits, children, autoComplete, setValidity, fieldNamespace, values, errors, }: PropsWithChildren<{ values: Values; errors?: FormikErrors; fieldNamespace?: string; checkRateLimits?: boolean; autoComplete?: boolean; setValidity: (error?: string) => void; }>) { const { setFieldValue } = useFormikContext(); const Component = values.useRegistry ? SimpleForm : AdvancedForm; return (
{values.useRegistry ? ( ) : ( )}
{children} {checkRateLimits && values.useRegistry && ( )}
); function namespaced(field: string) { return fieldNamespace ? `${fieldNamespace}.${field}` : field; } }