@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS
47 lines (44 loc) • 1.6 kB
TypeScript
import { HTMLAttributes, FocusEvent, ChangeEvent, KeyboardEvent } from 'react';
type DateFormat = {
day?: number | '';
month?: number | '';
year?: number | '';
};
type Placeholders = {
day?: string;
month?: string;
year?: string;
};
type Descriptions = {
day?: string;
month?: string;
year?: string;
};
type CombinedRefs = {
day: HTMLInputElement | null;
month: HTMLInputElement | null;
year: HTMLInputElement | null;
};
interface InputDateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'placeholder'> {
autoFocus?: boolean;
defaultValue?: DateFormat;
descriptions?: Descriptions;
disabled?: boolean;
error?: string;
id?: string;
label?: string;
maxYear?: number;
name?: string;
placeholders?: Placeholders;
readOnly?: boolean;
required?: boolean;
success?: string;
value?: DateFormat;
onBlur?: (event: FocusEvent<HTMLInputElement>, type: keyof DateFormat) => void;
onChange?: (event: ChangeEvent<HTMLInputElement>, newDate: DateFormat) => void;
onFieldChange?: (event: ChangeEvent<HTMLInputElement>, type: keyof DateFormat, newValue: number) => void;
onFocus?: (event: FocusEvent<HTMLInputElement>, type: keyof DateFormat) => void;
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>, type: keyof DateFormat) => void;
onKeyUp?: (event: KeyboardEvent<HTMLInputElement>, type: keyof DateFormat) => void;
}
export type { CombinedRefs, DateFormat, Descriptions, InputDateProps, Placeholders };