UNPKG

react-schema-form-wizard

Version:

A customizable React JSON Schema Form library with shadcn/ui components and multi-step support

111 lines (102 loc) 3.39 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { ThemeProps } from '@rjsf/core'; import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types'; import * as React from 'react'; import { VariantProps } from 'class-variance-authority'; import { ClassValue } from 'clsx'; interface FormField { id: string; name: string; type: string; label: string; required: boolean; description?: string; placeholder?: string; validation?: { maxLength?: number; minLength?: number; }; } interface FormStep { id: string; title: string; schema: { type: string; required: string[]; properties: Record<string, FormField>; }; } interface SimpleFormSchema { $id: string; type: string; title: string; required: string[]; properties: Record<string, { type: string; title: string; placeholder?: string; maxLength?: number; minLength?: number; enum?: string[]; enumNames?: string[]; }>; description?: string; } interface FormJsonStructure { id: number; documentId: string; title: string; description: string | null; isMultiStep: boolean; json_schema: SimpleFormSchema | { steps: FormStep[]; isMultiStep: boolean; }; createdAt: string; updatedAt: string; publishedAt: string; } interface FormResult { formInfo: { id: number; title: string; isMultiStep: boolean; submittedAt: string; }; fields: Record<string, { name: string; value: unknown; type: string; title: string; required: boolean; }>; } interface FormularioProps { formJson: FormJsonStructure; onSubmit?: (result: FormResult) => void; className?: string; customTheme?: any; } interface FormSchemaWizardProps extends FormularioProps { } declare function FormSchemaWizard({ formJson, onSubmit, className, customTheme: userCustomTheme }: FormSchemaWizardProps): react_jsx_runtime.JSX.Element; /** * Client Component wrapper for Next.js App Router * Use this component when you need to render the form in a Client Component context */ declare function FormSchemaWizardClient(props: FormSchemaWizardProps): react_jsx_runtime.JSX.Element; declare const rjsfShadcnTheme: Partial<ThemeProps>; declare const buttonVariants: (props?: ({ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined; size?: "default" | "sm" | "lg" | "icon" | null | undefined; } & class_variance_authority_dist_types.ClassProp) | undefined) => string; interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> { asChild?: boolean; } declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>; interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> { } declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>; declare function cn(...inputs: ClassValue[]): string; export { Button, FormSchemaWizard, FormSchemaWizardClient, Input, cn, rjsfShadcnTheme }; export type { FormField, FormJsonStructure, FormResult, FormSchemaWizardProps, FormStep, FormularioProps, SimpleFormSchema };