jb-date-input
Version:
jalali date input web component
78 lines • 2.58 kB
TypeScript
import { type JBCalendarWebComponent } from 'jb-calendar';
import { type JBInputWebComponent } from 'jb-input';
import { type JBPopoverWebComponent } from 'jb-popover';
import type { EventTypeWithTarget } from 'jb-core';
import { JBDateInputWebComponent } from './jb-date-input';
export type ElementsObject = {
input: JBInputWebComponent;
calendarTriggerButton: HTMLDivElement;
calendar: JBCalendarWebComponent;
popover: JBPopoverWebComponent;
};
export type DateRestrictions = {
min: Date | null;
max: Date | null;
};
export type DateInObject = {
year: number | null;
month: number | null;
day: number | null;
};
export type JBDateInputValueObject = {
gregorian: DateInObject;
jalali: DateInObject;
timeStamp: number | null;
time: {
hour: number | null;
minute: number | null;
second: number | null;
millisecond: number | null;
};
};
export declare enum InputTypes {
jalali = "JALALI",
gregorian = "GREGORIAN"
}
export type InputType = 'JALALI' | 'GREGORIAN';
export type ValueType = 'JALALI' | 'GREGORIAN' | 'TIME_STAMP';
export declare enum ValueTypes {
jalali = "JALALI",
gregorian = "GREGORIAN",
timeStamp = "TIME_STAMP"
}
type DateValidationResultErrors = "INVALID_YEAR" | "INVALID_MONTH" | "INVALID_DAY" | "INVALID_MIN_MONTH_NUMBER" | "INVALID_MIN_DAY_NUMBER" | "INVALID_MAX_MONTH_NUMBER" | "INVALID_MAX_DAY_NUMBER" | "INVALID_MIN_YEAR_NUMBER" | "INVALID_MAX_YEAR_NUMBER" | "INVALID_DAY_IN_MONTH" | "INVALID_DAY_FOR_LEAP";
export type DateValidResult = {
isValid: boolean;
error: DateValidationResultErrors | null;
};
/**
* @description when user type some value in input we just dived and separate string in 3 section (there is no date calculation behind it) and it mostly used in
*/
export type InputtedValueInObject = {
year: string;
month: string;
day: string;
hour: string;
minute: string;
second: string;
millisecond: string;
};
export type ValidationValue = {
text: string;
inputObject: InputtedValueInObject;
valueObject: JBDateInputValueObject;
valueText: string;
};
export type JBCalendarValue = {
day: number | null;
month: number | null;
year: number | null;
};
declare global {
interface ElementInternals {
setFormValue(value: string): void;
}
}
export type JBDateInputEventType<TEvent> = EventTypeWithTarget<TEvent, JBDateInputWebComponent>;
export {};
//# sourceMappingURL=types.d.ts.map