import React from "react"; import type { UseControllerProps } from "react-hook-form"; import type { XOR } from "ts-xor"; import type { Clearable } from "@jobber/hooks"; import type { InputFieldWrapperProps } from "../InputFieldWrapper"; import type { InputPressableProps } from "../InputPressable/InputPressable"; interface BaseInputDateProps extends Pick, Pick { /** * Defaulted to "always" so user can clear the dates whenever there's a value. */ readonly clearable?: Extract; /** * This label is shown to the user when there's no selected date. */ readonly emptyValueLabel?: string; /** * Maximum date the user can set. */ readonly maxDate?: Date; /** * Minimum date the user can set */ readonly minDate?: Date; /** * VoiceOver will read this string when a user selects the element */ readonly accessibilityLabel?: string; /** * Helps users understand what will happen when they perform an action */ readonly accessibilityHint?: string; } interface FormControlledInputDate extends BaseInputDateProps { /** * Adding a `name` would make this component "Form controlled" and must be * nested within a `
` component. * * Cannot be declared if `value` prop is used. */ readonly name: string; /** * Shows an error message below the field and highlights it red when the * value is invalid. Only applies when nested within a `` component. * * You can see **most** of the rules you can pass in * [React-hook-form Documentation](https://react-hook-form.com/api/useform/register#options). */ readonly validations?: UseControllerProps["rules"]; /** * The initial value for the input. */ readonly defaultValue?: Date; /** * The callback that fires whenever a date gets selected. */ readonly onChange?: (value?: Date | null) => void; } interface DevControlledInputDate extends BaseInputDateProps { /** * The value shown on the field. This gets automatically formatted to the * account's date format. * * Cannot be declared if `name` prop is used. */ readonly value: Date | string | undefined; /** * The callback that fires whenever a date gets selected. */ readonly onChange: (value?: Date) => void; } export type InputDateProps = XOR; /** * Allow users to select a date using the device date picker. */ export declare function InputDate(props: InputDateProps): React.JSX.Element; export {};