react-forminate
Version:
React.js + Typescript package that creates dynamic UI forms based on the JSON schema
47 lines (46 loc) • 1.52 kB
TypeScript
import { FieldDescriptionType, FieldTypeType } from '../../types';
import { default as React, ReactNode } from 'react';
interface FieldWrapperProps {
id: string;
label?: string;
required?: boolean;
error?: string;
className?: string;
children: ReactNode;
styles?: React.CSSProperties;
labelClassName?: string;
labelStyles?: React.CSSProperties;
type?: FieldTypeType;
description?: FieldDescriptionType;
ariaLabel?: string;
ariaLabelledby?: string;
ariaDescribedby?: string;
ariaInvalid?: boolean | "true" | "false" | "grammar" | "spelling";
ariaRequired?: boolean | "true" | "false";
ariaDisabled?: boolean | "true" | "false";
ariaHidden?: boolean | "true" | "false";
ariaLive?: "off" | "assertive" | "polite";
role?: string;
errorClassName?: string;
errorStyles?: React.CSSProperties;
descriptionClassName?: string;
descriptionStyles?: React.CSSProperties;
errorComponent?: React.ComponentType<{
error: string;
}>;
descriptionComponent?: React.ComponentType<{
description: FieldDescriptionType;
}>;
}
/**
* FieldWrapper component - Provides consistent styling, labeling, error handling,
* and accessibility features for form fields.
*
* Optimized with:
* - Memoized expensive computations
* - Reduced unnecessary re-renders
* - Efficient conditional rendering
* - CSS Modules for scoped styling
*/
declare const FieldWrapper: React.FC<FieldWrapperProps>;
export default FieldWrapper;