@ebay/ebayui-core
Version:
Collection of core eBay components; considered to be the building blocks for all composite structures, pages & apps.
73 lines (72 loc) • 2.65 kB
TypeScript
import type { WithNormalizedProps } from "../../global";
import { type DayISO } from "../../common/dates/date-utils";
interface CalendarInput {
navigable?: boolean;
interactive?: boolean;
"num-months"?: number;
locale?: string;
range?: boolean;
selected?: DayISO | [DayISO, DayISO];
todayISO?: Date | number | string;
"disable-before"?: Date | number | string;
"disable-after"?: Date | number | string;
"disable-weekdays"?: number[];
"disable-list"?: (Date | number | string)[];
"link-builder"?: (iso: string) => string | false | null | undefined;
"get-a11y-show-month-text"?: (monthName: string) => string;
"a11y-selected-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-range-start-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-in-range-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-range-end-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-today-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-disabled-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-separator"?: string;
"on-select"?: (event: {
iso: DayISO;
}) => void;
"on-focus"?: (event: {
iso: DayISO;
}) => void;
"on-month-change"?: (event: {
iso: DayISO;
}) => void;
}
export interface Input extends WithNormalizedProps<CalendarInput> {
}
interface State {
todayISO?: DayISO;
tabindexISO: DayISO;
offset: number;
firstDayOfWeek: number;
weekdayLabels: string[];
focusISO: DayISO | null;
rangeStart: DayISO | null;
rangeEnd: DayISO | null;
baseISO: DayISO;
disableBefore: DayISO | null;
disableAfter: DayISO | null;
disableWeekdays: number[];
disableList: DayISO[];
}
declare class Calendar extends Marko.Component<Input, State> {
locale?: string;
onCreate(input: Input): void;
onInput(input: Input): void;
isDisabled(iso: DayISO): boolean;
onDaySelect(day: DayISO): void;
onDayFocus(day: DayISO): void;
onDayBlur(): void;
onKeyDown(event: KeyboardEvent): void;
getMonthDate(offset: number): Date;
getFirstVisibleISO(): `${number}-${number}-${number}`;
getLastVisibleISO(input?: Input): `${number}-${number}-${number}`;
getFirstActiveISO(input?: Input): `${number}-${number}-${number}` | null;
getLastActiveISO(input?: Input): `${number}-${number}-${number}` | null;
monthTitle(date: Date): string;
prevMonth(focus?: boolean): boolean;
nextMonth(focus?: boolean): boolean;
setTabindexAndFocus(iso: DayISO): void;
calculateRangeDisplay(input?: Input): void;
isInRange(iso: DayISO): boolean;
}
export default Calendar;