@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and TailwindCSS
49 lines (48 loc) • 1.72 kB
TypeScript
import { ChangeEvent, FocusEvent, HTMLAttributes, KeyboardEvent, ReactNode } from "react";
//#region src/components/InputDate/InputDate.types.d.ts
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?: Error | ReactNode;
id?: string;
label?: ReactNode;
labelElement?: keyof HTMLElementTagNameMap;
maxYear?: number;
name?: string;
placeholders?: Placeholders;
readOnly?: boolean;
required?: boolean;
success?: ReactNode;
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;
}
//#endregion
export { CombinedRefs, DateFormat, Descriptions, InputDateProps, Placeholders };
//# sourceMappingURL=InputDate.types.d.ts.map