@zener/nepali-datepicker-react
Version:
Nepali Datepicker React is a lightweight, highly customizable, and feature-rich datepicker component, specifically designed for handling Nepali dates in React.js applications. It offers seamless integration, intuitive user experience, and extensive config
141 lines (136 loc) • 4.5 kB
text/typescript
import NepaliDate from '@zener/nepali-date';
export { default as NepaliDate } from '@zener/nepali-date';
import * as react_jsx_runtime from 'react/jsx-runtime';
import { AnimationProps } from 'framer-motion';
import { ReactNode } from 'react';
type ISuffixRender = (props: {
onClear: () => void;
isOpen: boolean;
showclear: boolean;
}) => ReactNode;
type IDatePickerType = 'BS' | 'AD';
type ILang = 'np' | 'en';
type DateTypeMap = {
BS: NepaliDate;
AD: Date;
};
type IComponents = {
footer?: (props: {
onTodayClick: () => void;
todayText: string;
}) => ReactNode;
header?: (props: {
prevClick: () => void;
nextClick: () => void;
onMonthSelectClicked: () => void;
onYearSelectClicked: () => void;
prevDisabled: boolean;
nextDisabled: boolean;
selectionMode: 'day' | 'year' | 'month';
monthText: string;
monthNumber: number;
yearNumber: number;
yearText: string;
yearRange: {
start: number;
end: number;
};
yearRangeText: string;
}) => ReactNode;
date?: (props: {
onClick: () => void;
dateMonthType: 'current' | 'prev' | 'next';
month: number;
year: number;
isToday: boolean;
isSelected: boolean;
dateText: string | number;
date: number;
isDisabled: boolean;
weekDay: number;
}) => ReactNode;
year?: (props: {
onClick: () => void;
yearText: string | number;
yearNumber: number;
isDisabled: boolean;
}) => ReactNode;
month?: (props: {
onClick: () => void;
monthText: string | number;
monthNumber: number;
year: number;
isDisabled: boolean;
}) => ReactNode;
week?: (props: {
weekText: string;
weekNumber: number;
}) => ReactNode;
};
interface IBaseType<T extends keyof DateTypeMap | undefined = 'BS'> {
lang?: ILang;
type?: T;
onChange?: (date: (T extends 'BS' ? NepaliDate : Date) | null) => void;
portalClassName?: string;
menuContainerClassName?: string;
calendarClassName?: string;
converterMode?: boolean;
components?: IComponents;
min?: T extends 'BS' ? NepaliDate : Date;
max?: T extends 'BS' ? NepaliDate : Date;
animation?: null | AnimationProps;
}
interface INepaliDatePicker<T extends keyof DateTypeMap | undefined = 'BS'> extends IBaseType<T> {
open?: boolean;
disabled?: boolean;
placeholder?: string;
prefix?: ReactNode;
suffix?: ISuffixRender;
showclear?: boolean;
value?: NepaliDate | Date | string | null;
className?: string | (() => {
focus?: string;
disabled?: string;
default?: string;
});
format?: string;
}
declare const NepaliDatePicker: <T extends keyof DateTypeMap | undefined = "BS">({ type, open, disabled, placeholder, onChange, className, value, lang, menuContainerClassName, calendarClassName, portalClassName, components, prefix, suffix, showclear, converterMode, animation, format, max, min, }: INepaliDatePicker<T>) => react_jsx_runtime.JSX.Element;
declare const AD_MONTH: string[];
declare const AD_MONTH_FULL: string[];
declare const AD_MONTH_NEPALI: string[];
declare const ENGLISH_NEPALI_MONTH: string[];
declare const ENGLISH_WEEK: string[];
declare const ENGLISH_WEEK_FULL: string[];
declare const lowerADDate: number;
declare const NEPALI_DIGITS: {
'0': string;
'1': string;
'2': string;
'3': string;
'4': string;
'5': string;
'6': string;
'7': string;
'8': string;
'9': string;
};
declare const NEPALI_MONTH: string[];
declare const NEPALI_TODAY: string;
declare const NEPALI_WEEK: string[];
declare const NEPALI_WEEK_FULL: string[];
declare const startDateBS: number;
declare const toAD: (date: string) => {
toString: () => string;
year: number;
month: number;
date: number;
};
declare const toBS: (date: string) => {
toString: () => string;
year: number;
month: number;
date: number;
};
declare const yearMonthDays: number[][];
export { AD_MONTH, AD_MONTH_FULL, AD_MONTH_NEPALI, ENGLISH_NEPALI_MONTH, ENGLISH_WEEK, ENGLISH_WEEK_FULL, type IComponents, type IDatePickerType, type ILang, type INepaliDatePicker, type ISuffixRender, NEPALI_DIGITS, NEPALI_MONTH, NEPALI_TODAY, NEPALI_WEEK, NEPALI_WEEK_FULL, NepaliDatePicker as default, lowerADDate, startDateBS, toAD, toBS, yearMonthDays };