UNPKG

@ebay/ebayui-core

Version:

Collection of core eBay components; considered to be the building blocks for all composite structures, pages & apps.

71 lines (70 loc) 2.38 kB
import { DropdownUtil } from "../../common/dropdown"; import { type DayISO } from "../../common/dates/date-utils"; import type { WithNormalizedProps } from "../../global"; import type { AttrString } from "marko/tags-html"; import type { TextboxEvent, Input as TextboxInput } from "../ebay-textbox/component-browser"; export interface InvalidDateEvent { value: string; index: number; } interface DateTextboxInput { value?: Date | number | string; rangeEnd?: Date | number | string; locale?: string; range?: boolean; textbox?: Marko.AttrTag<TextboxInput>; todayISO?: Date | number | string; disabled?: boolean; "disable-before"?: Date | number | string; "disable-after"?: Date | number | string; "disable-weekdays"?: number[]; "disable-list"?: (Date | number | string)[]; /** @deprecated use `@textbox-input` instead */ "input-placeholder-text"?: string | [string, string]; "collapse-on-select"?: boolean; "get-a11y-show-month-text"?: (monthName: string) => string; "a11y-open-popover-text"?: AttrString; "a11y-selected-text"?: AttrString; "a11y-range-start-text"?: AttrString; "a11y-in-range-text"?: AttrString; "a11y-range-end-text"?: AttrString; "a11y-separator"?: string; "on-change"?: (event: { selected: DayISO | null; } | { rangeStart: DayISO | null; rangeEnd: DayISO | null; }) => void; "on-invalid-date"?: (event: InvalidDateEvent) => void; } export interface Input extends WithNormalizedProps<DateTextboxInput> { } interface State { numMonths: number; firstSelected: DayISO | null; secondSelected: DayISO | null; popover: boolean; } declare class DateTextbox extends Marko.Component<Input, State> { expander: any; dropdownUtil: DropdownUtil; onCreate(): void; onMount(): void; onDestroy(): void; onInput(input: Input): void; calculateNumMonths(): void; handleInputChange(index: number, { value }: { value: string; }): void; openPopover(): void; closePopover(): void; onPopoverSelect({ iso }: { iso: DayISO; }): void; /** * If the cursor is at the end of the input and it makes sense to add a d/m/y separator, add it. */ onInputKeyup({ originalEvent: event }: TextboxEvent): void; emitSelectedChange(): void; } export default DateTextbox;