import { Idl } from "./entry.js"; import { StartOfWeek } from "./format.js"; export type Connect = (datepicker: UwcDatepickerElement, opts: { disconnect: AbortController; }) => void; /** * a view implements a given [Intl.DateTimeFormatPartTypes type](MDN LINK) */ export type View = { /** * add one unit to a given date * * I.e. for a days view this would return the start of the next day. */ addOneUnit: (date: Date) => Date; /** * implement this to integrate your view with the datepicker instance */ connect: Connect; }; export declare class UwcDatepickerElement extends HTMLElement { #private; private static defaults; /** * configure various aspects of the datepicker application wide */ static config: { /** * the views, keyed by {@link Intl#DateTimeFormatPartTypes}. * * @note you can extend the default views by "extending" (merging) the existing `Intl.DateTimeFormatPartRegistry` interface, like this: * * @example * * ```ts * declare global { * namespace UwcDatepickerElement { * interface ViewTypesRegistry { * quarter: any; * } * } * } * ``` */ views: { day?: View | undefined; dayPeriod?: View | undefined; era?: View | undefined; hour?: View | undefined; literal?: View | undefined; minute?: View | undefined; month?: View | undefined; second?: View | undefined; timeZoneName?: View | undefined; weekday?: View | undefined; year?: View | undefined; unknown?: View | undefined; fractionalSecond?: View | undefined; }; /** * the default order of views, see {@link UwcDatepickerElement.order | `[order]`} * for more info */ order: string; startOfWeek: StartOfWeek; yearsPerPage: number; }; /** * set the value in form of an ISO string or Date object */ "selected-date"?: Idl; /** * The date this datepicker should be anchored to. * * If left empty (or invalid) it will default to the current date. * * @see UwcDatepickerElement.anchorDate */ "anchor-date"?: Idl; /** * set a minimum boundary in form of an iso string or Date. It won't be * possible to select values on any resolution smaller than this */ min?: Idl; /** * set a maximum boundary in form of an iso string or Date. It won't be * possible to select values on any resolution larger than this */ max?: Idl; /** * The order in which the given views appear. * * Should be a white-space separated list of Intl.DateTimeFormatPartTypes. * * WARNING: this is an experimental feature and currently it relies on the order of views being in ascending order of resolution. It is therefor not possible to mimic e.g. the US american order as the lowest view would drop the day part. * * @default "day month year" */ order: string; view: Intl.DateTimeFormatPartTypes; "start-of-week": StartOfWeek; "years-per-page": number; get locale(): string | undefined; /** * the date this datepicker is currently anchored to */ get anchorDate(): Date; set anchorDate(next: Date); get views(): View[]; get currentView(): View; connectedCallback(): void; disconnectedCallback(): void; } declare global { const UwcDatepickerElement: typeof import("./uwc-datepicker.ts").UwcDatepickerElement; type UwcDatepickerElement = import("./uwc-datepicker.ts").UwcDatepickerElement; interface HTMLElementTagNameMap { "uwc-datepicker": UwcDatepickerElement; } namespace UwcDatepickerElement { interface ViewTypesRegistry extends Intl.DateTimeFormatPartTypesRegistry { } } }