UNPKG

@navinc/base-react-components

Version:
22 lines (21 loc) 803 B
import { ChangeEventHandler } from 'react'; import { TargetValue } from '../base-input/shared.js'; export type DatePickerElement = TargetValue<HTMLInputElement, Date>; type SegmentProps = { value: string; onChange: ChangeEventHandler<HTMLInputElement>; }; export declare const useDatePickerInput: <Y extends boolean = true, M extends boolean = true, D extends boolean = true>(incomingValue: Date | undefined, { name, onChange, withYear, withMonth, withDay, }?: { name?: string; onChange?: ChangeEventHandler<DatePickerElement>; withYear?: Y; withMonth?: M; withDay?: D; }) => (Y extends true ? { yearProps: SegmentProps; } : object) & (M extends true ? { monthProps: SegmentProps; } : object) & (D extends true ? { dayProps: SegmentProps; } : object); export {};