@smitch/fluid
Version:
A Next/React ui-component libray.
85 lines (84 loc) • 2.91 kB
TypeScript
/// <reference types="react" />
type BaseColorOption = 'dark' | 'light' | 'info' | 'success' | 'warning' | 'danger' | 'primary' | 'secondary';
type ColorOption = BaseColorOption | 'current';
type OutlineColorOption = ColorOption | 'accent';
type BackgroundOption = BaseColorOption | 'transparent';
type SpacingOption = '0' | '1' | '2' | '4' | '8';
type AlignOption = 'left' | 'center' | 'right';
type SizeOption = 'sm' | 'md' | 'lg' | 'xl';
interface CommonFormProps {
name?: string;
action?: string;
layout?: 'col' | 'row';
className?: string;
style?: React.CSSProperties;
onsubmit?: (formData: {
[key: string]: string;
}) => void;
onCancel?: () => void;
showCancel?: boolean;
actions?: boolean;
actionsLayout?: 'row' | 'row-reverse' | 'col' | 'col-reverse';
actionsSpacing?: SpacingOption;
separator?: boolean;
submitLabel?: string;
cancelLabel?: string;
submitBackground?: BackgroundOption;
submitColor?: ColorOption;
cancelBackground?: BackgroundOption;
cancelColor?: ColorOption;
submitOutline?: boolean;
submitOutlineColor?: OutlineColorOption;
cancelOutline?: boolean;
cancelOutlineColor?: ColorOption;
buttonTextcase?: 'uppercase' | 'lowercase' | 'capitalize' | 'normal-case';
buttonShape?: 'default' | 'rounded' | 'pill';
buttonIsBold?: boolean;
}
export interface FormProps extends React.HTMLAttributes<HTMLFormElement>, CommonFormProps {
method?: 'GET' | 'POST' | 'dialog' | string;
enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | string;
}
export interface FieldsetProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {
legendText?: string;
disabled?: boolean;
legendAlign?: AlignOption;
legendSize?: SizeOption;
hasBorder?: boolean;
isBold?: boolean;
spacing?: '4' | '8';
className?: string;
}
export interface LegendProps extends React.HTMLProps<HTMLLegendElement> {
text: string;
isBold?: boolean;
align?: AlignOption;
legendSize?: SizeOption;
}
export interface RegisterFormProps extends CommonFormProps {
legendText: string;
legendisBold?: boolean;
legendAlign?: AlignOption;
legendSize?: SizeOption;
spacing?: '4' | '8';
hasBorder?: boolean;
buttonOutline?: boolean;
userLabel: string;
userAutocomplete?: 'username' | 'email' | 'username email';
userPlaceholder?: string;
passwordLabel: string;
passwordPlaceholder?: string;
passwordPattern?: string;
passwordTitle?: string;
confirmLabel: string;
confirmPlaceholder?: string;
confirmTitle?: string;
inputsLayout?: 'col' | 'row';
inputsSize?: 'md' | 'lg' | 'xl';
inputsRounded?: 'none' | 'md' | 'lg' | 'full';
checkLabel: string;
checkLabelIsBold?: boolean;
checkRounded?: 'none' | 'full';
checkHint?: React.ReactNode;
}
export {};