UNPKG

@brightsoftware/date-np

Version:

Simple & minimal Nepali date picker that just works.

58 lines (57 loc) 2.02 kB
import { type ComponentProps } from "react"; import { type TimeFormat, type TimeValue } from "./hooks/useTimePicker"; import { TimePickerInput } from "./components/time-picker-input"; import { TimePickerBody } from "./components/time-picker-body"; import { type tdirectionAwareContainerProps } from "../Components/helpers/direction-aware-container"; type TimePickerWithoutInput = { inputProps?: never; shouldShowInput?: false; }; type TimePickerWithInput = { inputProps?: ComponentProps<typeof TimePickerInput>; shouldShowInput?: boolean; }; export type TimePickerProps = { format?: TimeFormat; defaultTime?: TimeValue; className?: string; /** * Control how and where you show the TimePicker container */ dAwareConProps?: tdirectionAwareContainerProps; /** * body props */ bodyProps?: ComponentProps<typeof TimePickerBody>; /** * label for the time picker */ label?: string; /** * Control the visibility of the picker popup externally. */ isVisible?: boolean; /** * Callback that gets fired when the user changes the time. */ onTimeChange?: (time: TimeValue) => void; /** * Callback that gets fired when the visiblity of the picker popup changes. */ onVisibilityChange?: (isVisible: boolean) => void; /** * Callback that gets fired when the default value of the picker gets set */ onDefaultTimeChange?: (time: TimeValue) => void; /** * onSave callback that gets fired when the user clicks the save button */ onSave?: (time: TimeValue) => void; /** * Reference to the input element if you want to control it externally * This is useful when you want to control the visibility of the TimePicker */ inputRef?: React.RefObject<HTMLDivElement | null>; } & (TimePickerWithoutInput | TimePickerWithInput); export declare const TimePicker: ({ format, ...props }: TimePickerProps) => import("react/jsx-runtime").JSX.Element; export {};