aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
139 lines • 3.1 kB
TypeScript
import React from "react";
export interface FormField {
id: string;
type: "text" | "email" | "password" | "number" | "tel" | "url" | "textarea" | "select" | "checkbox" | "radio" | "date" | "file";
label: string;
placeholder?: string;
description?: string;
required?: boolean;
disabled?: boolean;
options?: {
value: string;
label: string;
}[];
validation?: {
min?: number;
max?: number;
minLength?: number;
maxLength?: number;
pattern?: string;
custom?: (value: any) => string | null;
};
defaultValue?: any;
conditional?: {
field: string;
operator: "equals" | "not_equals" | "contains" | "greater_than" | "less_than";
value: any;
};
layout?: {
width?: "full" | "half" | "third" | "quarter";
order?: number;
};
}
export interface FormSection {
id: string;
title: string;
description?: string;
fields: FormField[];
collapsible?: boolean;
defaultExpanded?: boolean;
}
export interface FormValue {
[fieldId: string]: any;
}
export interface FormError {
[fieldId: string]: string;
}
export interface GlassFormBuilderProps {
/**
* Form schema
*/
schema?: FormSection[];
/**
* Form values
*/
values?: FormValue;
/**
* Form errors
*/
errors?: FormError;
/**
* Value change handler
*/
onChange?: (values: FormValue) => void;
/**
* Form submit handler
*/
onSubmit?: (values: FormValue) => void;
/**
* Validation handler
*/
onValidate?: (values: FormValue) => FormError;
/**
* Form variant
*/
variant?: "default" | "compact" | "wizard" | "inline";
/**
* Form size
*/
size?: "sm" | "md" | "lg";
/**
* Whether form is loading
*/
loading?: boolean;
/**
* Whether form is disabled
*/
disabled?: boolean;
/**
* Form title
*/
title?: string;
/**
* Form description
*/
description?: string;
/**
* Submit button text
*/
submitText?: string;
/**
* Cancel button text
*/
cancelText?: string;
/**
* Show cancel button
*/
showCancel?: boolean;
/**
* Cancel handler
*/
onCancel?: () => void;
/**
* Auto-save functionality
*/
autoSave?: boolean;
/**
* Auto-save delay in ms
*/
autoSaveDelay?: number;
/**
* Show field count
*/
showProgress?: boolean;
/**
* Validate on change
*/
validateOnChange?: boolean;
/**
* Custom field renderer
*/
renderField?: (field: FormField, value: any, onChange: (value: any) => void, error?: string) => React.ReactNode;
className?: string;
}
/**
* GlassFormBuilder component
* Dynamic form generator with glassmorphism styling
*/
export declare const GlassFormBuilder: React.ForwardRefExoticComponent<GlassFormBuilderProps & React.RefAttributes<HTMLFormElement>>;
//# sourceMappingURL=GlassFormBuilder.d.ts.map