dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
43 lines • 2.44 kB
TypeScript
import { CalendarProps } from 'dgz-ui/calendar';
import { FormItemProps, InputProps } from 'dgz-ui/form';
import { FieldValues } from 'react-hook-form';
/**
* Props for the MyDatePicker component.
* @template TFieldValues - The type of the form values.
*/
export type MyDatePickerProps<TFieldValues extends FieldValues> = FormItemProps<TFieldValues> & Omit<CalendarProps, 'mode' | 'disabled' | 'required'> & {
/** Date format string for display. */
format?: string;
/** Props passed to the underlying Input component. */
inputProps?: Omit<InputProps, 'onSelect'>;
/** Placeholder text when no date is selected. */
placeholder?: string;
/** Whether the date picker is disabled. */
disabled?: boolean;
/** When true, shows a TimePicker below the calendar for time selection. */
showTime?: true;
required?: true;
};
/**
* MyDatePicker shows a calendar popover to pick a single date, integrated with react-hook-form.
* Can also be used standalone when no control/name are provided.
*
* @template TFieldValues - Form values type used by react-hook-form.
* @param control - The `react-hook-form` control object.
* @param name - The name of the field in `react-hook-form`.
* @param label - The label to display for the date picker.
* @param required - Whether the field is required.
* @param rules - The `react-hook-form` validation rules.
* @param format - The date format for display.
* @param placeholder - The placeholder text when no date selected.
* @param floatingError - Whether to show the error message in a floating container.
* @param register - The `react-hook-form` register function.
* @param disabled - Whether the date picker is disabled.
* @param className - Additional CSS classes.
* @param showTime - When true, shows a TimePicker below the calendar for time selection.
* @param inputProps - Props passed to the underlying Input component.
* @param props - Calendar, button and form item props.
* @returns {JSX.Element | null} A date picker component integrated with react-hook-form, or null if name/control are missing.
*/
export declare const MyDatePicker: <TFieldValues extends FieldValues>({ control, name, label, required, rules, format, floatingError, placeholder, disabled, register, className, showTime, inputProps, ...props }: MyDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element | null;
//# sourceMappingURL=MyDatePicker.d.ts.map