import PropTypes from 'prop-types'; import React, { Component, ReactElement } from 'react'; import { MarginProps, WidthProps } from 'styled-system'; import { CalendarLabels } from '../Calendar/Calendar'; import { CalendarDate, InitialFocus } from '../Calendar/Grid'; import { PartialDate } from '../helpers/dates'; import { CactusEventTarget } from '../helpers/events'; import { Status } from '../helpers/status'; interface DateInputPhrasesType extends Partial { inputKeyboardDirections: string; yearLabel: string; monthLabel: string; dayLabel: string; hoursLabel: string; minutesLabel: string; periodLabel: string; pickerLabel: string; showCalendar: string; ariaDisabledDate?: (date: string) => string; } declare type Target = CactusEventTarget; export interface DateInputProps extends MarginProps, WidthProps, Omit, 'disabled' | 'width' | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'onFocus'> { name: string; id: string; className?: string; /** When */ value?: string | Date | null | number; defaultValue?: string | Date | null; initialFocus?: InitialFocus; /** * Required when value is a string, then when events are called with the value they will be * this format. Date will always be displayed based on locale preferences. * */ format?: string; locale?: string; status?: Status; /** * Indicates which fields to display for the user */ type?: 'date' | 'datetime' | 'time'; /** !important */ disabled?: boolean; onChange?: React.ChangeEventHandler; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; /** * Phrases to use for translations. * For caching purposes, these will only update for a given * instance when the locale changes. */ phrases?: Partial; /** * function to determine whether a specific date should render as disabled. */ isValidDate?: (date: Date) => boolean; /** * Handler called when the value switches from valid * to invalid or vice versa. * This function is called on blur events. */ onInvalidDate?: (isDateInvalid: boolean) => void; } interface DateInputState { value: PartialDate; valueProp: DateInputProps['value']; focusMonth: number; focusYear: number; isOpen: boolean; invalidDate: boolean; } declare class DateInputBase extends Component { constructor(props: DateInputProps); private _shouldFocusNext; private _lastInputKeyed; private _isFocused; private _inputWrapper; private _button; private _portal; private _setPortal; private eventTarget; static propTypes: { name: PropTypes.Validator; id: PropTypes.Validator; status: PropTypes.Requireable<"error" | "success" | "warning">; value: PropTypes.Requireable; initialFocus: PropTypes.Requireable; month: PropTypes.Requireable; day: PropTypes.Requireable; }>>; format: (props: any) => Error | null; type: PropTypes.Requireable; locale: PropTypes.Requireable; disabled: PropTypes.Requireable; onChange: PropTypes.Requireable<(...args: any[]) => any>; onFocus: PropTypes.Requireable<(...args: any[]) => any>; onBlur: PropTypes.Requireable<(...args: any[]) => any>; onInvalidDate: PropTypes.Requireable<(...args: any[]) => any>; phrases: PropTypes.Requireable; }; static defaultProps: { locale: string; type: string; phrases: {}; }; static getDerivedStateFromProps(props: Readonly, state: Readonly): Partial | null; componentDidMount(): void; componentDidUpdate(): void; componentWillUnmount(): void; private handleKeydownCapture; private handleFocus; private handleBlur; private handleClick; private handleButtonClick; private handlePortalKeydown; private handleUpArrowClick; private handleDownArrowClick; private handleCalendarChange; private handleMonthYearChange; private handleTimeChange; private handleFormat; /** helpers */ private handleKeyInput; private handleUpdate; private raiseChange; private _close; private static PHRASES; private getPhrases; render(): ReactElement; } export declare const DateInput: import("styled-components").StyledComponent; export default DateInput;