import type { DatePickerProps } from '../DatePicker'; import type { GlobalProps } from '../../shared/global'; import { AnyAutocompleteField, AutocompleteProps } from '../../shared/autocomplete'; import { BaseTextFieldProps } from '../../shared/input'; import { ExtractStrict } from '../../shared/utils'; export interface DateFieldProps extends GlobalProps, BaseTextFieldProps, Pick, AutocompleteProps { /** * Callback when the field has an invalid date. * This callback will be called, if the date typed is invalid or disabled. * * Dates that don’t exist or have formatting errors are considered invalid. Some examples of invalid dates are: * - 2021-02-31: February doesn’t have 31 days * - 2021-02-00: The day can’t be 00 * * Disallowed dates are considered invalid. * * It’s important to note that this callback will be called only when the user **finishes editing** the date, * and it’s called right after the `onChange` callback. * The field is **not** validated on every change to the input. Once the buyer has signalled that * they have finished editing the field (typically, by blurring the field), the field gets validated and the callback is run if the value is invalid. */ onInvalid?: () => void; } export type DateAutocompleteField = ExtractStrict;