@brightsoftware/date-np
Version:
Simple & minimal Nepali date picker that just works.
81 lines (80 loc) • 2.23 kB
TypeScript
import { type ComponentProps } from "react";
import PickerBody from "./Components/picker-body";
import PickerHeader from "./Components/picker-header";
import PickerInput from "./Components/picker-input";
import { type tdirectionAwareContainerProps } from "./Components/helpers/direction-aware-container";
import "./index.css";
type tpickerWithoutInput = {
/**
* Note:
* You should have `shouldShowInput` set to true inorder to
* give input props
*/
inputProps?: never;
shouldShowInput?: false;
};
type tpickerWithInput = {
/**
* customize input with input specific props.
* visit: #docs for more information on this.
*/
inputProps?: ComponentProps<typeof PickerInput>;
/**
* Specify whethere to show the picker input or not
* @defaults to true
*/
shouldShowInput?: boolean;
};
export type tpickerProps = {
/**
* visibility of the picker
* @default false
*/
isVisible?: boolean;
/**
* min date for the picker
*/
minDate?: Date | import("./NepaliDate").NepaliDate;
/**
* max date for the picker
*/
maxDate?: Date | import("./NepaliDate").NepaliDate;
/**
* className for styling the main picker
*/
className?: string;
/**
* Provide individual styling to different components.
*/
bodyProps?: ComponentProps<typeof PickerBody>;
/**
* Header class names
*/
headerProps?: ComponentProps<typeof PickerHeader>;
/**
* onSelect callback function called when date selection is complete
*/
onSelect?: (selectedDate: Date | import("./NepaliDate").NepaliDate) => void;
/**
* Control how and where you show the Picker containerp
*/
dAwareConProps?: tdirectionAwareContainerProps;
/**
* label for the picker
*/
label?: string;
/**
* description for the picker
*/
description?: string;
/**
* required prop for the picker
*/
required?: boolean;
/**
* onInputClick
*/
onInputClick?: () => void;
} & (tpickerWithInput | tpickerWithoutInput);
declare const Picker: (props: tpickerProps) => import("react/jsx-runtime").JSX.Element;
export default Picker;