jb-date-input-react
Version:
jalali date input react component
55 lines (54 loc) • 2.26 kB
TypeScript
import React, { MutableRefObject, RefObject, ReactNode, DetailedHTMLProps, HTMLAttributes } from 'react';
import 'jb-date-input';
import { JBDateInputWebComponent, type ValidationValue, type JBDateInputValueObject, type InputType } from 'jb-date-input';
import { type ValidationItem } from 'jb-validation';
export { type JBDateInputValueObject, type ValidationItem, type ValidationValue, InputType };
declare global {
namespace JSX {
interface IntrinsicElements {
'jb-date-input': JBDateInputType;
}
interface JBDateInputType extends DetailedHTMLProps<HTMLAttributes<JBDateInputWebComponent>, JBDateInputWebComponent> {
class?: string;
label?: string;
name?: string;
"value-type"?: string;
"input-type"?: string;
}
}
}
export type JBDateInputEventType<T> = T & {
target: JBDateInputWebComponent;
};
export type JBDateInputProps = {
label?: string;
style?: string;
name?: string;
min?: string | null | undefined | Date;
max?: string | null | undefined | Date;
message?: string | null | undefined;
format?: string;
className?: string;
onKeyup?: (e: JBDateInputEventType<KeyboardEvent>) => void;
onChange?: (e: JBDateInputEventType<Event>) => void;
onSelect?: (e: JBDateInputEventType<CustomEvent>) => void;
valueType?: 'GREGORIAN' | 'JALALI' | 'TIME_STAMP';
inputType?: 'GREGORIAN' | 'JALALI';
direction?: 'ltr' | 'rtl';
value?: string | Date | null | undefined;
validationList?: ValidationItem<ValidationValue>[];
required?: boolean;
calendarDefaultDateView?: {
year: number;
month: number;
dateType?: InputType;
};
showPersianNumber?: boolean;
placeholder?: string | null | undefined;
jalaliMonthList?: string[] | null | undefined;
gregorianMonthList?: string[] | null | undefined;
overflowHandler?: "NONE" | "SLIDE";
overflowRef?: RefObject<HTMLElement> | null | MutableRefObject<HTMLElement | undefined>;
children?: ReactNode | ReactNode[];
};
export declare const JBDateInput: React.ForwardRefExoticComponent<JBDateInputProps & React.RefAttributes<unknown>>;