UNPKG

@ebay/ebayui-core

Version:

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

58 lines (57 loc) 1.96 kB
import { DropdownUtil } from "../../common/dropdown"; import { type DayISO } from "../../common/dates/date-utils"; import type { WithNormalizedProps } from "../../global"; import type { TextboxEvent, Input as TextboxInput } from "../ebay-textbox/component-browser"; import type { Input as CalendarInput } from "../ebay-calendar/component"; export interface InvalidDateEvent { value: string; index: number; } interface DateTextboxInput extends Omit<CalendarInput, `on${string}`> { value?: Date | number | string; rangeEnd?: Date | number | string; textbox?: Marko.AttrTag<TextboxInput>; disabled?: boolean; /** @deprecated use `@textbox-input` instead */ "input-placeholder-text"?: string | [string, string]; "collapse-on-select"?: boolean; "a11y-open-popover-text"?: Marko.HTMLAttributes["aria-label"]; "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;