@baseplate-dev/ui-components
Version:
Shared UI component library
25 lines • 1.56 kB
TypeScript
import type { Control, FieldPath, FieldValues } from 'react-hook-form';
import type { FormFieldProps } from '#src/types/form.js';
import { Calendar } from '../calendar/calendar.js';
export interface DatePickerFieldProps extends FormFieldProps {
className?: string;
wrapperClassName?: string;
disabled?: boolean;
placeholder?: string;
onChange?: (value: string | undefined) => void;
value?: string | undefined;
dateFormat?: string;
calendarProps?: Omit<React.ComponentProps<typeof Calendar>, 'mode' | 'selected' | 'onSelect'>;
ref?: React.Ref<HTMLButtonElement>;
}
/**
* Field with label and error states that wraps a Calendar component for single date selection.
*/
declare function DatePickerField({ className, wrapperClassName, disabled, placeholder, onChange, value, label, error, description, dateFormat, calendarProps, ref, }: DatePickerFieldProps): React.ReactElement;
export interface DatePickerFieldControllerProps<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<DatePickerFieldProps, 'value'> {
control: Control<TFieldValues>;
name: TFieldName;
}
declare function DatePickerFieldController<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, ref, ...rest }: DatePickerFieldControllerProps<TFieldValues, TFieldName>): React.ReactElement;
export { DatePickerField, DatePickerFieldController };
//# sourceMappingURL=date-picker-field.d.ts.map