@wix/design-system
Version:
@wix/design-system
40 lines • 1.67 kB
TypeScript
import { ReactNode, ReactElement, KeyboardEvent } from 'react';
import { InputProps } from '../../Input';
import { TooltipCommonProps } from '../../common';
import type { SupportedWixLocales } from 'wix-design-systems-locale-utils';
import { DateStyle } from '../index';
export interface DateInputProps extends Omit<InputProps, 'value' | 'onKeyDown' | 'onChange' | 'onBlur'> {
dataHook?: string;
/** The selected date. */
value?: Date | string;
/** Instance locale */
locale?: SupportedWixLocales;
/** Sets date format of locale. */
dateStyle?: DateStyle;
/** Specifies whether to validate the input. */
validate?: boolean;
/** Defines a callback function which is called on cases when date is validated. */
onValidate?({ format, validationType, value, }: {
format?: string;
validationType: 'outOfBoundsError' | 'formatError' | 'valid';
value: string;
}): void;
/** When provided, hover will display a tooltip over clear button. */
clearButtonTooltipContent?: ReactNode;
/** Tooltip props for clear buttons. */
clearButtonTooltipProps?: TooltipCommonProps;
/** Specifies whether focus input after clear click. */
focusOnClearClick?: boolean;
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>, date: Date | null) => void;
onChange?: (arg: {
dateVal: Date;
}) => void;
onBlur?: (arg?: undefined) => void;
/**
* Specifies whether past dates should show validation error. Validate prop
* must be true to use this feature.
*/
excludePastDates?: boolean;
customInput?: ReactElement;
}
//# sourceMappingURL=DateInput.types.d.ts.map