UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

47 lines (46 loc) 2.1 kB
import React, { RefObject } from "react"; import { DayPickerProps, Modifiers } from "react-day-picker"; export interface PickerProps extends Omit<DayPickerProps, "mode" | "modifiers"> { modifiers?: Partial<Modifiers>; } export interface DatePickerProps { /** * [Legacy] Boolean to toggle where DatePicker is rendered in relation to the Date Input * @deprecated */ disablePortal?: boolean; /** Minimum possible date YYYY-MM-DD */ minDate?: string; /** Maximum possible date YYYY-MM-DD */ maxDate?: string; /** * Pass any props that match the DayPickerProps interface to override default behaviors * See [DayPickerProps](https://daypicker.dev/api/type-aliases/DayPickerProps) for a full list of available props * */ pickerProps?: PickerProps; /** Element that the DatePicker will be displayed under */ inputElement: RefObject<HTMLElement>; /** Currently selected date */ selectedDays?: Date | undefined; /** Callback to handle mousedown event on picker container */ pickerMouseDown?: () => void; /** Sets whether the picker should be displayed */ open?: boolean; /** Callback triggered when a Day is clicked */ onDayClick?: (date: Date, ev: React.MouseEvent<HTMLDivElement>) => void; /** Sets the picker open state */ setOpen: (isOpen: boolean) => void; /** Id passed to tab guard element */ pickerTabGuardId?: string; /** Callback triggered when the picker is closed */ onPickerClose?: () => void; /** Prop to specify the aria-label attribute of the date picker */ ariaLabel?: string; /** Prop to specify the aria-labelledby attribute of the date picker */ ariaLabelledBy?: string; } export declare const DatePicker: { ({ inputElement, minDate, maxDate, selectedDays, disablePortal, onDayClick, pickerMouseDown, pickerProps, open, setOpen, pickerTabGuardId, onPickerClose, ariaLabel: datePickerAriaLabel, ariaLabelledBy: datePickerAriaLabelledBy, }: DatePickerProps): React.JSX.Element | null; displayName: string; }; export default DatePicker;