/** * Grouped options structure for Timepicker UI v4.0.0 * * BREAKING CHANGE from v3.x: * Options are now organized into logical groups for better clarity and maintainability. */ /** A time of day passed to `clock.isTimeDisabled`. `hour` is always 0-23. */ interface TimeOfDay { hour: number; minutes: number; seconds: number; } /** * Clock behavior configuration */ interface ClockOptions { /** * @description Clock format. `auto` picks 12h or 24h from the browser locale when the picker is created or its options are set. * @default "12h" */ type?: '12h' | '24h' | 'auto'; /** * @description Step between selectable hours on the clock, the wheel and the hour field's arrow keys. Use a divisor of 12: 1, 2, 3, 4 or 6. * @default 1 */ incrementHours?: number; /** * @description Set increment for minutes (1, 5, 10, 15, etc.) * @default 1 */ incrementMinutes?: number; /** * @description Automatically switch to minutes after selecting hour * @default true */ autoSwitchToMinutes?: boolean; /** * @description Show a seconds field, wheel column and clock face (HH:MM:SS) * @default false */ showSeconds?: boolean; /** * @description Set increment for seconds: 1, 5, 10, 15, 20 or 30 * @default 1 */ incrementSeconds?: 1 | 5 | 10 | 15 | 20 | 30; /** * @description Automatically switch from minutes to seconds after a minute is picked on the clock. * Only used with `showSeconds`. * @default true */ autoSwitchToSeconds?: boolean; /** * @description Enable smooth hour snapping with animation * @default true * @deprecated Use `discreteHourJump`. Removed in 5.0. */ smoothHourSnap?: boolean; /** * @description Move the hour hand from hour to hour while dragging instead of following the pointer. * @default false */ discreteHourJump?: boolean; /** * @description Disable specific hours/minutes/seconds or time ranges * @remarks Arrow, Page Up/Down, Home and End keys skip disabled values, and a typed value moves to * the nearest enabled one when the field loses focus. Outside range mode, OK stays disabled while * the selected time is disabled. * @example * disabledTime: { * minutes: [1, 2, 4, 5, 55, 23, "22", "38"], * hours: [1, "3", "5", 8], * seconds: [0, 30] * } * // or time ranges instead: the hours, minutes and seconds lists are ignored when ranges is set * disabledTime: { * ranges: ["10:00 AM - 12:00 PM", "5:00:30 PM - 8:00 PM"] * } */ disabledTime?: { minutes?: Array; hours?: Array; /** * @description Seconds (0-59) disabled in every minute. Used with `showSeconds`. */ seconds?: Array; /** * @description Inclusive ranges. Edges: 'HH:MM' or 'HH:MM:SS' (24h), 'H:MM[:SS] AM|PM' (12h). * An edge without seconds covers its whole minute. * When set, the `hours`, `minutes` and `seconds` lists are ignored. */ ranges?: string | string[]; /** * @description Inclusive ranges. Edges: 'HH:MM' or 'HH:MM:SS' (24h), 'H:MM[:SS] AM|PM' (12h). * An edge without seconds covers its whole minute. * When set, the `hours`, `minutes` and `seconds` lists are ignored. * @deprecated Use `ranges`. Removed in 5.0. */ interval?: string | string[]; }; /** * @description Return `true` to disable a time. Combined with `disabledTime` as a union: a time is * disabled when either says so. `hour` is 0-23 in both clock types; `seconds` is 0 unless * `showSeconds` is on. An hour or minute is disabled when every time inside it is disabled. * Results are cached; call `refreshDisabledTime()` after the data behind the function changes. * If the function throws, that time counts as enabled and the error is rethrown asynchronously. * @example * isTimeDisabled: ({ hour }) => hour < 9 || hour >= 17 */ isTimeDisabled?: (time: TimeOfDay) => boolean; /** * @description Time the picker shows while the input is empty. `'now'` shows the current time and also writes it to the input when the picker is created, replacing a value that is already there. * Use the object form to choose: `time` is a `Date` or `'now'`, and `updateInput: true` writes it to the input the same way. * @example defaultTime: 'now' * @example defaultTime: { time: new Date(2026, 0, 1, 9, 30), updateInput: false } */ defaultTime?: 'now' | { time?: Date | 'now'; updateInput?: boolean }; /** * @description Set current time to the input and timepicker * @example * currentTime: { * time: new Date(), * updateInput: true, * preventClockType: false * } * @example currentTime: true * @deprecated Use `defaultTime`. Removed in 5.0. */ currentTime?: | { time?: Date; updateInput?: boolean; /** * @deprecated Has no effect since 4.5.0; the value is formatted by the library. Removed in 5.0. */ locales?: string | string[]; /** * @deprecated Use `clock.type: 'auto'`. Removed in 5.0. */ preventClockType?: boolean; } | boolean; } /** * UI appearance and behavior configuration */ interface UIOptions { /** * @description Picker mode: analog clock face, scroll wheel spinner, or compact wheel (no header) * @default "clock" */ mode?: 'clock' | 'wheel' | 'compact-wheel'; /** * @description Theme for the timepicker * @default "basic" */ theme?: | 'basic' | 'crane' | 'crane-straight' | 'm2' | 'm3-green' | 'dark' | 'glassmorphic' | 'pastel' | 'ai' | 'cyberpunk' | 'blueprint' | 'blueprint-dark'; /** * @description Enable/disable animations * @default true */ animation?: boolean; /** * @description Show backdrop when timepicker is open * @default true */ backdrop?: boolean; /** * @description View shown when the picker opens: the clock face or the keyboard fields. * @default "clock" */ initialView?: 'clock' | 'keyboard'; /** * @description Force mobile mode * @default false * @deprecated Use `initialView: 'keyboard'`. Removed in 5.0. */ mobile?: boolean; /** * @description Show the button that switches between the clock face and the keyboard fields. * @default false */ viewSwitch?: boolean; /** * @description Enable switch icon (mobile ↔ desktop) * @default false * @deprecated Use `viewSwitch`. Removed in 5.0. */ enableSwitchIcon?: boolean; /** * @description Allow editing hour/minutes directly * @default false */ editable?: boolean; /** * @description Let the page scroll while the picker is open. When false, page scroll is locked on `` * (and on `` when it is the scroll container), and `` gets `--tp-scrollbar-gap` set to the removed * scrollbar width for your own fixed or sticky elements, e.g. `header { padding-right: var(--tp-scrollbar-gap, 0px) }`. * @default false */ allowPageScroll?: boolean; /** * @description Enable scrollbar when timepicker is open. * When false, page scroll is locked on `` (and on `` when it is the scroll container), * and `` gets `--tp-scrollbar-gap` set to the removed scrollbar width for your own fixed or * sticky elements, e.g. `header { padding-right: var(--tp-scrollbar-gap, 0px) }`. * @default false * @deprecated Use `allowPageScroll`. Removed in 5.0. */ enableScrollbar?: boolean; /** * @description Additional CSS class for the wrapper * @example cssClass: "my-custom-timepicker" */ cssClass?: string; /** * @description Show the Clear button. The object form also sets what Clear does: `clearInput: false` keeps the input value. * @default false * @example clearButton: { clearInput: false } */ clearButton?: boolean | { clearInput?: boolean }; /** * @description Element, or selector of the element, the modal is appended to. * @default document.body */ appendTo?: string | HTMLElement; /** * @description Selector where to append modal (default: body) * @default "" * @deprecated Use `appendTo`. Removed in 5.0. */ appendModalSelector?: string; /** * @description HTML of the keyboard icon, shown on the clock face view. * @default Material Icons template */ keyboardIcon?: string; /** * @description Custom keyboard icon template (desktop → mobile) * @default Material Icons template * @deprecated Use `keyboardIcon`. Removed in 5.0. */ iconTemplate?: string; /** * @description HTML of the clock icon, shown on the keyboard view. * @default Material Icons template */ clockIcon?: string; /** * @description Custom schedule icon template (mobile → desktop) * @default Material Icons template * @deprecated Use `clockIcon`. Removed in 5.0. */ iconTemplateMobile?: string; /** * @description Inline mode configuration * @example * inline: { * enabled: true, * container: '#timepicker-container', * showButtons: false, * autoUpdate: true * } */ inline?: { enabled: boolean; /** * @description Element, or selector of the element, the inline picker renders into. Required when `enabled` is true. * @example container: '#timepicker-container' */ container?: string | HTMLElement; /** * @deprecated Use `container`. Removed in 5.0. */ containerId?: string; /** * @description Show the OK and Cancel buttons. OK writes the time to the input and Cancel brings back the time from the input; the picker stays visible either way. * @default false */ showButtons?: boolean; autoUpdate?: boolean; /** * @description Render the inline picker as part of a host component instead of a standalone card: * the root gets `role="group"` with an accessible name (no `role="dialog"`, no `aria-modal`), the card * has no shadow and no minimum height, focus is not trapped and the wrapper does not take focus on * mount. Use it when the picker sits inside your own dialog, popover or form. * Ignored unless `enabled` is true. * @default false */ embedded?: boolean; }; } /** * Text labels configuration */ interface LabelsOptions { /** * @description "AM" label text * @default "AM" */ am?: string; /** * @description "PM" label text * @default "PM" */ pm?: string; /** * @description "OK" button text * @default "OK" */ ok?: string; /** * @description "Cancel" button text * @default "Cancel" */ cancel?: string; /** * @description Heading of the clock face view * @default "Select time" */ clockTitle?: string; /** * @description Time label on desktop * @default "Select time" * @deprecated Use `clockTitle`. Removed in 5.0. */ time?: string; /** * @description Heading of the keyboard view * @default "Enter Time" */ keyboardTitle?: string; /** * @description Time label on mobile * @default "Enter Time" * @deprecated Use `keyboardTitle`. Removed in 5.0. */ mobileTime?: string; /** * @description Hour field caption, its accessible name, the dial name on the hours face, and the prefix of the hour announcement * @default "Hour" */ hour?: string; /** * @description Minute field caption, its accessible name, the dial name on the minutes face, and the prefix of the minute announcement. * Until 5.0 the minute announcement keeps its own default, `Minutes`, when neither `minute` nor `announceMinute` is set. * @default "Minute" */ minute?: string; /** * @description Second field caption, its accessible name, the dial name on the seconds face, and the prefix of the second announcement (requires `clock.showSeconds`) * @default "Second" */ second?: string; /** * @description Hour label on mobile * @default "Hour" * @deprecated Use `hour`. Removed in 5.0. */ mobileHour?: string; /** * @description Minute label on mobile * @default "Minute" * @deprecated Use `minute`. Removed in 5.0. */ mobileMinute?: string; /** * @description "Clear" button text * @default "Clear" */ clear?: string; /** * @description Accessible label for the hour spinbutton and the clock dial while it shows hours * @default "Hour" * @deprecated Use `hour`. Removed in 5.0. */ hourLabel?: string; /** * @description Accessible label for the minute spinbutton and the clock dial while it shows minutes * @default "Minute" * @deprecated Use `minute`. Removed in 5.0. */ minuteLabel?: string; /** * @description Accessible name of the group around the clock dial * @default "Clock" */ clock?: string; /** * @description Accessible label for the group that wraps the analog clock dial * @default "Clock" * @deprecated Use `clock`. Removed in 5.0. */ clockLabel?: string; /** * @description Accessible name of the AM/PM group * @default "Period" */ period?: string; /** * @description Accessible label for the AM/PM period group * @default "Period" * @deprecated Use `period`. Removed in 5.0. */ periodLabel?: string; /** * @description Accessible name of the group around the time fields * @default "Time" */ timeFields?: string; /** * @description Accessible label for the time wrapper group / tips * @default "Time" * @deprecated Use `timeFields`. Removed in 5.0. */ timeLabel?: string; /** * @description Accessible label for the 24-hour tips group * @default "24-hour" * @deprecated Has no effect. Removed in 5.0. */ format24Label?: string; /** * @description Accessible name of the range From/To tabs * @default "Range selection" */ range?: string; /** * @description Accessible label for the range selection tablist * @default "Range selection" * @deprecated Use `range`. Removed in 5.0. */ rangeSelectionLabel?: string; /** * @description Text of the range From tab * @default "From" */ rangeFrom?: string; /** * @description Text of the range To tab * @default "To" */ rangeTo?: string; /** * @description Label of the timezone selector * @default "Timezone" */ timezone?: string; /** * @description Accessible name of the view switch on the clock face view * @default "Switch to keyboard input" */ switchToKeyboard?: string; /** * @description Accessible label for the keyboard-input switch icon * @default "Switch to keyboard input" * @deprecated Use `switchToKeyboard`. Removed in 5.0. */ switchToKeyboardLabel?: string; /** * @description Accessible name of the view switch on the keyboard view * @default "Switch to clock" */ switchToClock?: string; /** * @description Accessible label for the clock-view switch icon * @default "Switch to clock" * @deprecated Use `switchToClock`. Removed in 5.0. */ switchToClockLabel?: string; /** * @description Accessible label for the generic view toggle button * @default "Toggle" * @deprecated Has no effect; the view switch button is labelled by `switchToKeyboard` / `switchToClock`. Removed in 5.0. */ toggleLabel?: string; /** * @description Accessible label for the timezone selector * @default "Timezone" * @deprecated Has no effect; use `labels.timezone`. Removed in 5.0. */ timezoneSelectorLabel?: string; /** * @description Screen-reader announcement prefix for the selected hour * @default "Hour" * @deprecated Use `hour`. Removed in 5.0. */ announceHour?: string; /** * @description Screen-reader announcement prefix for the selected minutes * @default "Minutes" * @deprecated Use `minute`. Removed in 5.0. */ announceMinute?: string; /** * @description Screen-reader announcement when AM is selected * @default "AM selected" */ announceAmSelected?: string; /** * @description Screen-reader announcement when PM is selected * @default "PM selected" */ announcePmSelected?: string; /** * @description Error/announcement text for an invalid time format * @default "Invalid time format" */ invalidTimeFormat?: string; /** * @description Screen-reader announcement after Clear * @default "Time cleared" */ announceCleared?: string; } /** * Behavior configuration */ interface BehaviorOptions { /** * @description Return focus to the input when the picker closes (WAI-ARIA dialog pattern). Setting it to `true` is recommended; 5.0 makes `true` the default. * @default false */ returnFocus?: boolean; /** * @description Focus input after closing modal. Old name of `returnFocus`. * @default false * @deprecated Use `returnFocus`. Removed in 5.0. */ focusInputAfterClose?: boolean; /** * @description Enable focus trap in modal * @default true */ focusTrap?: boolean; /** * @description Extra delay (ms) before the picker starts to close after OK, Cancel, Escape, a backdrop click or `close()` * @default 0 */ delayHandler?: number; /** * @description Custom ID for the timepicker instance * @example id: "my-timepicker-1" */ id?: string; } /** * Timezone configuration (opt-in, UI-only) * @description Optional timezone selector for B2B/global use cases. * This is a presentation layer only - no automatic time conversions. */ interface TimezoneOptions { /** * @description Enable timezone selector UI * @default false */ enabled?: boolean; /** * @description Default timezone ID (e.g., 'America/New_York') * Uses browser's local timezone if not specified. */ default?: string; /** * @description Timezone IDs shown in the selector, instead of the built-in list. * If not provided, uses a curated list of common timezones. * @example list: ['UTC', 'America/New_York', 'Europe/London'] */ list?: readonly string[]; /** * @description Whitelist of allowed timezone IDs. * If not provided, uses a curated list of common timezones. * @example whitelist: ['UTC', 'America/New_York', 'Europe/London'] * @deprecated Use `list`. Removed in 5.0. */ whitelist?: readonly string[]; /** * @description Label for timezone selector * @default "Timezone" * @deprecated Use `labels.timezone`. Removed in 5.0. */ label?: string; } /** * Wheel / compact-wheel mode configuration * @example * wheel: { * placement: 'auto', * hideFooter: true, * commitOnScroll: true * } */ interface WheelOptions { /** * @description Popover placement relative to input in compact-wheel mode. * When unset, compact-wheel opens as a modal. * Set 'auto' | 'top' | 'bottom' to show compact-wheel as a popover: * 'auto' opens below if space allows, otherwise above. 'top' / 'bottom' open on that side * while it has room for at least three wheel rows, otherwise on the other side. * In every placement the popover stays inside the viewport and scrolls when it is too tall. * @default undefined (modal) */ placement?: 'auto' | 'top' | 'bottom'; /** * @description When true, the footer (OK/Cancel/Clear buttons + switch icon) * is not rendered in the DOM at all. Only works in compact-wheel mode. * Useful when commitOnScroll is enabled and buttons are unnecessary. * @default false */ hideFooter?: boolean; /** * @description When enabled, the timepicker automatically commits the selected time * at the end of wheel scrolling, updating the input value and emitting a change event * without requiring the user to press OK. Only applies to wheel and compact-wheel modes. * @default false */ commitOnScroll?: boolean; /** * @description When true, disabled hours/minutes/seconds are completely removed from the wheel list * instead of being dimmed. Only applies to wheel and compact-wheel modes. * Useful when many values are disabled (e.g., business hours only). * @default false */ hideDisabled?: boolean; /** * @description When true, clicking outside the picker area does not close it. * Only applies to wheel and compact-wheel modes (popover and modal). * The user must explicitly press OK or Cancel to close the picker. * @default false */ ignoreOutsideClick?: boolean; } /** A time of one range end, as `getValue()` returns it. */ interface RangeTimeValue { hour: string; minutes: string; /** Present only with `clock.showSeconds`. */ seconds?: string; /** `AM` / `PM` in 12h mode. */ type?: string; } /** Both ends of a range. An end is `null` until it has a full time. */ interface RangeTimeState { from: RangeTimeValue | null; to: RangeTimeValue | null; } /** * Range mode configuration (opt-in) */ interface RangeOptions { /** * @description Enable range mode (from-to selection) * @default false */ enabled?: boolean; /** * @description Minimum duration in minutes */ minDuration?: number; /** * @description Maximum duration in minutes */ maxDuration?: number; /** * @description When false, From and To are independent: To times before From are not disabled, * the To tab is enabled from the start, and `minDuration` / `maxDuration` are not checked, so a * range may cross midnight. Use it when the host validates the range with dates. * `range:validation` still fires and reports `valid: true` once both ends are complete. * @default true */ linked?: boolean; /** * @description Label for "from" segment * @default "From" * @deprecated Use `labels.rangeFrom`. Removed in 5.0. */ fromLabel?: string; /** * @description Label for "to" segment * @default "To" * @deprecated Use `labels.rangeTo`. Removed in 5.0. */ toLabel?: string; } /** * Event callbacks configuration */ interface CallbacksOptions { /** * @description Triggered when timepicker opens */ onOpen?: TimepickerEventCallback; /** * @description Triggered when the user activates the input or a `data-open` element (click, Enter or Space) to open the picker, before it renders. `open()` does not trigger it. */ onShow?: TimepickerEventCallback; /** * @description Triggered when user cancels */ onCancel?: TimepickerEventCallback; /** * @description Triggered when user confirms time */ onConfirm?: TimepickerEventCallback; /** * @description Triggered during interaction (real-time) */ onUpdate?: TimepickerEventCallback; /** * @description Triggered when hour mode is selected */ onSelectHour?: TimepickerEventCallback; /** * @description Triggered when minute mode is selected */ onSelectMinute?: TimepickerEventCallback; /** * @description Triggered when second mode is selected (requires `clock.showSeconds`) */ onSelectSecond?: TimepickerEventCallback; /** * @description Triggered when AM or PM is selected, with `{ type }` */ onSelectPeriod?: TimepickerEventCallback; /** * @description Triggered when AM is selected * @deprecated Use `onSelectPeriod`. Removed in 5.0. */ onSelectAM?: TimepickerEventCallback; /** * @description Triggered when PM is selected * @deprecated Use `onSelectPeriod`. Removed in 5.0. */ onSelectPM?: TimepickerEventCallback; /** * @description Triggered when the switch icon toggles between the clock face and keyboard input (requires `ui.viewSwitch`) */ onSwitchView?: TimepickerEventCallback; /** * @description Triggered when the clock face switches between hours, minutes and seconds, with `{ face }` */ onSwitchFace?: TimepickerEventCallback; /** * @description Triggered on invalid time format */ onError?: TimepickerEventCallback; /** * @description Triggered when timezone is changed (opt-in feature) */ onTimezoneChange?: TimepickerEventCallback; /** * @description Triggered when range is confirmed (range mode only) */ onRangeConfirm?: TimepickerEventCallback; /** * @description Triggered when switching between from/to (range mode only) */ onRangeSwitch?: TimepickerEventCallback; /** * @description Triggered on range validation (range mode only) */ onRangeValidation?: TimepickerEventCallback; /** * @description Triggered when a wheel column starts scrolling (wheel and compact-wheel modes) */ onWheelScrollStart?: TimepickerEventCallback; /** * @description Triggered when a wheel column stops scrolling and snaps to a value (wheel and compact-wheel modes) */ onWheelScrollEnd?: TimepickerEventCallback; /** * @description Triggered when clear button is clicked */ onClear?: TimepickerEventCallback; } /** * Clear button behavior configuration */ interface ClearBehaviorOptions { /** * @description Whether clicking clear also empties the input field value * @default true * @deprecated Use `ui.clearButton: { clearInput }`. Removed in 5.0. */ clearInput?: boolean; } /** * Main options type with grouped structure (v4.0.0) */ interface TimepickerOptions { clock?: ClockOptions; ui?: UIOptions; labels?: LabelsOptions; behavior?: BehaviorOptions; callbacks?: CallbacksOptions; timezone?: TimezoneOptions; range?: RangeOptions; wheel?: WheelOptions; clearBehavior?: ClearBehaviorOptions; } type TimePredicate = ((secondOfDay: number) => boolean) & { clear(): void; }; interface CoreStateData { readonly degreesHours: number | null; readonly degreesMinutes: number | null; readonly degreesSeconds: number | null; readonly options: Required; readonly element: HTMLElement; readonly instanceId: string; readonly isMobileView: boolean; readonly isTouchMouseMove: boolean; readonly disabledTime: { value?: { isInterval?: boolean; intervals?: string[]; clockType?: string; hours?: string[]; minutes?: string[]; seconds?: string[]; predicate?: TimePredicate; }; } | null; readonly timePredicate: TimePredicate | null; readonly cloned: Node | null; readonly isModalRemove: boolean; readonly isOpen: boolean; readonly isInitialized: boolean; readonly customId?: string; readonly eventHandlersRegistered: boolean; readonly isDestroyed: boolean; } /** @remarks This API changes in 5.0.0; see the roadmap. */ declare class CoreState$1 { private _degreesHours; private _degreesMinutes; private _degreesSeconds; private _options; private _isMobileView; private _isTouchMouseMove; private _disabledTime; private _timePredicate; private _cloned; private _isModalRemove; private _isOpen; private _isInitialized; private _eventHandlersRegistered; private _isDestroyed; private _modalElement; readonly element: HTMLElement; readonly instanceId: string; readonly customId?: string; constructor(element: HTMLElement, options: Required, instanceId: string, customId?: string); get degreesHours(): number | null; get degreesMinutes(): number | null; get degreesSeconds(): number | null; get options(): Required; get isMobileView(): boolean; get isTouchMouseMove(): boolean; get disabledTime(): CoreStateData['disabledTime']; get timePredicate(): TimePredicate | null; get cloned(): Node | null; get isModalRemove(): boolean; get isOpen(): boolean; get isInitialized(): boolean; get eventHandlersRegistered(): boolean; get isDestroyed(): boolean; setDegreesHours(value: number | null): void; setDegreesMinutes(value: number | null): void; setDegreesSeconds(value: number | null): void; setOptions(options: Required): void; setIsMobileView(value: boolean): void; setIsTouchMouseMove(value: boolean): void; setDisabledTime(value: CoreStateData['disabledTime']): void; setTimePredicate(value: TimePredicate | null): void; setCloned(value: Node | null): void; setIsModalRemove(value: boolean): void; setIsOpen(value: boolean): void; setIsInitialized(value: boolean): void; setEventHandlersRegistered(value: boolean): void; setIsDestroyed(value: boolean): void; updateOptions(updates: Partial): void; reset(): void; private q; private qMobile; getModalElement(): HTMLDivElement | null; getInput(): HTMLInputElement | null; getClockFace(): HTMLDivElement | null; getClockHand(): HTMLDivElement | null; getCircle(): HTMLDivElement | null; getTipsWrapper(): HTMLDivElement | null; getTipsWrapperFor24h(): HTMLDivElement | null; getMinutes(): HTMLInputElement | null; getSeconds(): HTMLInputElement | null; getHour(): HTMLInputElement | null; getAM(): HTMLDivElement | null; getPM(): HTMLDivElement | null; getHourText(): HTMLDivElement | null; getMinutesText(): HTMLDivElement | null; getSecondsText(): HTMLDivElement | null; getHeader(): HTMLDivElement | null; getInputWrappers(): NodeListOf | null; getDots(): HTMLDivElement | null; getMinutesTips(): HTMLDivElement | null; getHourTips(): HTMLDivElement | null; getAllValueTips(): Array; getOpenElementData(): string[] | null; getOpenElement(): NodeListOf | ReadonlyArray; getCancelButton(): HTMLButtonElement | null; getOkButton(): HTMLButtonElement | null; getActiveTypeMode(): HTMLButtonElement | null; getActiveType(): 'AM' | 'PM' | undefined; getKeyboardClockIcon(): HTMLButtonElement | null; getFooter(): HTMLDivElement | null; getWrapper(): HTMLDivElement | null; } interface PluginSelection { hour: string; minutes: string; seconds?: string; type?: string; } /** @remarks This API changes in 5.0.0; see the roadmap. */ interface PluginManager { init(): void; destroy(): void; attachPopover?(): void; detachPopover?(): void; scrollToValue?(hour: string, minute: string, type?: string, second?: string): void; getSelection?(): PluginSelection | null; } /** @remarks This API changes in 5.0.0; see the roadmap. */ type PluginFactory = (core: CoreState$1, emitter: EventEmitter) => PluginManager; /** @remarks This API changes in 5.0.0; see the roadmap. */ type TemplateProvider = (options: Required, instanceId: string) => string; /** @remarks This API changes in 5.0.0; see the roadmap. */ type ClearHandler = (core: CoreState$1, emitter: EventEmitter) => void; /** @remarks This API changes in 5.0.0; see the roadmap. */ interface Plugin { name: string; factory: PluginFactory; optionsExtender?: (options: Record) => void; templateProvider?: TemplateProvider; clearHandler?: ClearHandler; } declare class PluginRegistryClass { private plugins; register(plugin: Plugin): void; getAll(): Plugin[]; has(name: string): boolean; get(name: string): Plugin | undefined; getTemplateProvider(name: string): TemplateProvider | undefined; getClearHandler(name: string): ClearHandler | undefined; } /** @remarks This API changes in 5.0.0; see the roadmap. */ declare const PluginRegistry: PluginRegistryClass; /** Payload when timepicker opens */ type OpenEventData = { hour: string; minutes: string; /** Present only with `clock.showSeconds` */ seconds?: string; type?: string; /** * @deprecated Internal clock-hand angle; use `hour` instead. Removed in 5.0. */ degreesHours: number | null; /** * @deprecated Internal clock-hand angle; use `minutes` instead. Removed in 5.0. */ degreesMinutes: number | null; }; /** Payload when user cancels */ type CancelEventData = Record; /** Payload when user confirms time */ type ConfirmEventData = { hour?: string; minutes?: string; /** Present only with `clock.showSeconds` */ seconds?: string; type?: string; /** When true, this confirm was triggered by commitOnScroll (auto-commit) */ autoCommit?: boolean; }; /** Payload when user clears time */ type ClearEventData = { previousValue: string | null; }; /** Payload when modal shows */ type ShowEventData = Record; /** * Payload of the `hide` event * @deprecated The `hide` event is never emitted. Removed in 5.0. */ type HideEventData = Record; /** Payload for real-time updates */ type UpdateEventData = { hour?: string; minutes?: string; /** Present only with `clock.showSeconds` */ seconds?: string; type?: string; }; /** Payload when hour mode activated */ type SelectHourEventData = { hour: string; }; /** Payload when minute mode activated */ type SelectMinuteEventData = { minutes: string; }; /** Payload when second mode activated (requires `clock.showSeconds`) */ type SelectSecondEventData = { seconds: string; }; /** * Payload when AM selected * @deprecated Use `SelectPeriodEventData`. Removed in 5.0. */ type SelectAMEventData = Record; /** * Payload when PM selected * @deprecated Use `SelectPeriodEventData`. Removed in 5.0. */ type SelectPMEventData = Record; /** Payload when switching view */ type SwitchViewEventData = Record; /** Payload when AM or PM is selected */ type SelectPeriodEventData = { type: 'AM' | 'PM'; }; /** Payload when the clock face switches between hours, minutes and seconds */ type SwitchFaceEventData = { face: 'hours' | 'minutes' | 'seconds'; }; /** Payload when timezone is changed */ type TimezoneChangeEventData = { timezone: string; }; type RangeConfirmEventData = { from: string; to: string; duration: number; /** Exact duration in seconds; present only with `clock.showSeconds` */ durationSeconds?: number; }; type RangeSwitchEventData = { active: 'from' | 'to'; disabledTime?: { hours: string[]; minutes: string[]; seconds?: string[]; fromType?: string; fromHour?: number; fromMinute?: number; } | null; }; type RangeValidationEventData = { valid: boolean; duration: number; /** Exact duration in seconds; present only with `clock.showSeconds` */ durationSeconds?: number; minDuration?: number; maxDuration?: number; }; type RangeMinuteCommitEventData = { hour: string; minutes: string; seconds?: string; type?: string; }; type RangeGetDisabledTimeEventData = Record; type RangeUpdateDisabledEventData = Record; /** Payload when wheel scroll starts on a column */ type WheelScrollStartEventData = { column: 'hours' | 'minutes' | 'seconds' | 'ampm'; }; /** Payload when wheel scroll ends and snaps to a value */ type WheelScrollEndEventData = { column: 'hours' | 'minutes' | 'seconds' | 'ampm'; value: string; previousValue: string | null; }; /** Payload when validation error occurs */ type ErrorEventData = { error: string; /** * @deprecated Always undefined. Removed in 5.0. */ rejectedHour?: string; /** * @deprecated Always undefined. Removed in 5.0. */ rejectedMinute?: string; inputHour?: string | number; inputMinute?: string | number; /** Present only with `clock.showSeconds` */ inputSecond?: string | number; inputType?: string; inputLength?: string | number; }; /** Callback function for timepicker events */ type TimepickerEventCallback = (eventData: T) => void; /** * @deprecated Use `TimepickerOptions` instead. Removed in 5.0. */ type OptionTypes = { /** Picker mode: clock, wheel, or compact-wheel @default "clock" */ mode?: 'clock' | 'wheel' | 'compact-wheel'; /** AM label text @default "AM" */ amLabel?: string; /** Enable animations @default true */ animation?: boolean; /** * @description Set default selector to append timepicker inside it. Timepicker default append to `body` * @default "" */ appendModalSelector?: string; /** Enable backdrop @default true */ backdrop?: boolean; /** Cancel button text @default "Cancel" */ cancelLabel?: string; /** Edit hour/minutes in web mode @default false */ editable?: boolean; /** Enable scroll when open @default false */ enableScrollbar?: boolean; /** Icon to switch desktop/mobile @default false */ enableSwitchIcon?: boolean; /** Mobile time label @default "Enter Time" */ mobileTimeLabel?: string; /** * @deprecated Old v3 name, has no effect. Use `behavior.returnFocus` in 4.x. Removed in 5.0, where focus returns to the input by default. */ focusInputAfterCloseModal?: boolean; /** Mobile hour label @default "Hour" */ hourMobileLabel?: string; /** Desktop icon template */ iconTemplate?: string; /** Mobile icon template */ iconTemplateMobile?: string; /** * @description Set increment hour by `1`, `2`, `3` hour * @default 1 */ incrementHours?: number; /** * @description Set increment minutes by `1`, `5`, `10`, `15` minutes * @default 1 */ incrementMinutes?: number; /** * @description set custom text to minute label on mobile version * @default "Minute" */ minuteMobileLabel?: string; /** * @description Turn on/off mobile version * @default false */ mobile?: boolean; /** * @description Set custom text to ok label * @default "OK" */ okLabel?: string; /** PM label @default "PM" */ pmLabel?: string; /** Time label (desktop) @default "Select time" */ timeLabel?: string; /** Auto-switch to minutes @default true */ autoSwitchToMinutes?: boolean; /** Theme @default "basic" */ theme?: | 'basic' | 'crane' | 'crane-straight' | 'm2' | 'm3-green' | 'dark' | 'glassmorphic' | 'pastel' | 'ai' | 'cyberpunk' | 'blueprint' | 'blueprint-dark'; /** Clock type: 12h or 24h @default "12h" */ clockType?: '12h' | '24h'; /** Disable specific times (hours/minutes/intervals) */ disabledTime?: { minutes?: Array; hours?: Array; interval?: string | string[]; }; /** Current time config */ currentTime?: | { time?: Date; updateInput?: boolean; /** * @deprecated Has no effect since 4.5.0; the value is formatted by the library. Removed in 5.0. */ locales?: string | string[]; preventClockType?: boolean; } | boolean; /** Focus trap on modal @default true */ focusTrap?: boolean; /** Extra delay (ms) before the picker starts to close after OK, Cancel, Escape, a backdrop click or `close()` @default 0 */ delayHandler?: number; /** Custom ID for instance */ id?: string; /** Inline mode config */ inline?: { enabled: boolean; containerId: string; /** @default false */ showButtons?: boolean; /** @default false */ autoUpdate?: boolean; /** @default false */ embedded?: boolean; }; /** Additional CSS class */ cssClass?: string; /** Callback when picker opens */ onOpen?: TimepickerEventCallback; /** Callback when user cancels */ onCancel?: TimepickerEventCallback; /** Callback when user confirms */ onConfirm?: TimepickerEventCallback; /** Callback during interaction */ onUpdate?: TimepickerEventCallback; /** Callback when hour mode activated */ onSelectHour?: TimepickerEventCallback; /** Callback when minute mode activated */ onSelectMinute?: TimepickerEventCallback; /** Callback when AM selected */ onSelectAM?: TimepickerEventCallback; /** Callback when PM selected */ onSelectPM?: TimepickerEventCallback; /** Callback on validation error */ onError?: TimepickerEventCallback; }; type EventHandler = (data: T) => void; interface TimepickerEventMap { open: OpenEventData; cancel: CancelEventData; confirm: ConfirmEventData; clear: ClearEventData; show: ShowEventData; /** * @internal Emitted right after `show` when the user activates an open element or presses Enter in the input; the picker mounts on it, so every `show` listener runs before render. Not bridged to a callback. */ 'open:request': Record; /** * @deprecated Never emitted. Removed in 5.0. */ hide: HideEventData; update: UpdateEventData; 'select:hour': SelectHourEventData; 'select:minute': SelectMinuteEventData; 'select:second': SelectSecondEventData; 'select:am': SelectAMEventData; 'select:pm': SelectPMEventData; 'select:period': SelectPeriodEventData; 'switch:view': SwitchViewEventData; 'switch:face': SwitchFaceEventData; 'timezone:change': TimezoneChangeEventData; 'range:confirm': RangeConfirmEventData; 'range:switch': RangeSwitchEventData; 'range:validation': RangeValidationEventData; 'range:minute:commit': RangeMinuteCommitEventData; /** * @deprecated Never emitted or read. Removed in 5.0. */ 'range:get-disabled-time': RangeGetDisabledTimeEventData; /** * @deprecated Never emitted or read. Removed in 5.0. */ 'range:update-disabled': RangeUpdateDisabledEventData; 'wheel:scroll:start': WheelScrollStartEventData; 'wheel:scroll:end': WheelScrollEndEventData; 'animation:clock': Record; 'animation:start': Record; 'animation:end': Record; error: ErrorEventData; [key: string]: unknown; } /** @remarks This API changes in 5.0.0; see the roadmap. */ declare class EventEmitter = TimepickerEventMap> { private events; /** * Subscribe to an event. * @returns A function that removes this handler. Calling it more than once is a no-op. */ on(event: K, handler: EventHandler): () => void; /** * Subscribe to an event for one call. * @returns A function that removes the handler before it runs. Calling it more than once is a no-op. */ once(event: K, handler: EventHandler): () => void; off(event: K, handler?: EventHandler): void; emit(event: K, data?: EventMap[K]): void; clear(): void; hasListeners(event: K): boolean; } type Callback = () => void; declare class TimepickerUI { private readonly core; private readonly managers; private readonly lifecycle; private readonly emitter; constructor(selectorOrElement: string | HTMLElement, options?: TimepickerOptions); private setupInternalEventListeners; private writeInputValue; private setInputText; /** * Create the timepicker instance and render it in the DOM. If inline mode is enabled, the timepicker will be mounted immediately. */ create(): void; /** * Open the timepicker, optionally executing a callback after opening. * @param callback - Optional callback to be executed after opening. */ open(callback?: Callback): void; /** * Close the timepicker. An inline picker is removed from its container until `open()` is called. * @param update - If true, the current selection is committed first, exactly like clicking OK: the input is updated and `confirm` is emitted (nothing is committed while OK is disabled). Otherwise the selection is discarded. * @param callback - Optional callback. With `update: true` it runs once the picker has closed; otherwise it runs immediately. */ close(update?: boolean, callback?: Callback): void; /** * Destroy the timepicker instance, removing all event listeners and DOM elements. * @param options - Optional parameters to control destruction behavior. * If a callback function is provided directly, it will be treated as the callback parameter. * If an options object is provided, it can include: * - keepInputValue: A boolean indicating whether to keep the input value after destruction (default: false). * - callback: An optional callback function to be executed after destruction. */ destroy(options?: { keepInputValue?: boolean; callback?: Callback; } | Callback): void; /** * Update the timepicker instance with new options. Options that fail validation (for example an invalid `clock.disabledTime`) are reported through the `error` event / `callbacks.onError`; the previous options stay in place and the callback is not run. When `clock.type` or `clock.showSeconds` changes, a valid time in the input, or both times of a range value (`from - to`), is rewritten in the new format (no `update` or `confirm` event); an empty or invalid input is left as it is. An open picker is re-rendered with the new options, and a selection that was not confirmed is reset to the input value. * @param value - The new options and optional create flag. * @param callback - Optional callback to be executed after update. * @deprecated Use `setOptions(options)`. Removed in 5.0. */ update(value: { options: TimepickerOptions; create?: boolean; }, callback?: Callback): void; /** * Set options at runtime. Options that fail validation (for example an invalid `clock.disabledTime`) are reported through the `error` event / `callbacks.onError` and the previous options stay in place. When `clock.type` or `clock.showSeconds` changes, a valid time in the input is rewritten in the new format. An open picker is re-rendered with the new options. * @param options - The options to change. Groups you leave out keep their values. */ setOptions(options: TimepickerOptions): void; /** * Get the current selected time value from the timepicker. While the picker is open this is the selection shown in it; otherwise, including while it is closing, it is the value in the input. * @returns An object containing the current hour, minutes, seconds (only with `clock.showSeconds`), type (if applicable), formatted time string, and degrees for hours and minutes. */ getValue(): { hour: string; minutes: string; /** * Present only with `clock.showSeconds`. */ seconds?: string; type?: string; time: string; /** * @deprecated Internal clock-hand angle; use `hour` instead. Removed in 5.0. */ degreesHours: number | null; /** * @deprecated Internal clock-hand angle; use `minutes` instead. Removed in 5.0. */ degreesMinutes: number | null; }; private readOpenValue; /** * Set the timepicker value programmatically. * @param time - The time string to set: "HH:MM" for 24h or "HH:MM AM/PM" for 12h. With `clock.showSeconds` also "HH:MM:SS" / "HH:MM:SS AM/PM"; a value without seconds means ":00". Without `clock.showSeconds` seconds in the string are accepted and dropped. A valid time in the other clock format is converted: "2:30 PM" sets 14:30 in a 24h picker, "00:15" sets 12:15 AM in a 12h picker. A string that is not a valid time in either format changes nothing and emits `error` (`callbacks.onError`); an empty string is ignored. * @param updateInput - If true, the input field will be updated with the new time value. Default is true. */ setValue(time: string, updateInput?: boolean): void; private resolveRangeApi; /** * Set both ends of the range. Each time uses the `setValue` format ("14:30" or "2:30 PM"). * Works open or closed. With `updateInput` the input shows "from - to". * Requires RangePlugin and `range.enabled`; otherwise emits `error` and does nothing. * Invalid times emit `error` and leave the range unchanged. * @param range - `{ from, to }` times. * @param updateInput - Write the range to the input. Default `true`. */ setRange(range: { from: string; to: string; }, updateInput?: boolean): void; /** * Read both ends of the range. * @returns `{ from, to }`, or `null` without RangePlugin / `range.enabled`. */ getRange(): RangeTimeState | null; /** * Switch the clock to the given end without moving focus. * Updates the tabs and emits `range:switch`. With `range.linked` (default), switching to "to" * is refused until From is complete. * @returns `true` when the active end changed or was already that end. */ setActivePart(part: 'from' | 'to'): boolean; /** * Re-apply `clock.disabledTime` and `clock.isTimeDisabled` without re-rendering: clears the * `isTimeDisabled` cache and updates disabled marks on the clock or wheel and the OK button. * Safe to call while closed (the next open uses fresh results). */ refreshDisabledTime(): void; /** * Get the root element of the timepicker instance. * @returns - The HTMLElement that serves as the root of the timepicker instance. */ getElement(): HTMLElement; /** * Get the unique instance ID of the timepicker. * @return - The unique instance ID as a string. */ get instanceId(): string; /** * Get the current options of the timepicker instance. * @returns - The current options of the timepicker instance. */ get options(): Required; /** * Check if the timepicker instance is currently initialized. * @returns - True if the instance is initialized, false otherwise. */ get isInitialized(): boolean; /** * Check if the timepicker instance has been destroyed. * @returns - True if the instance is destroyed, false otherwise. */ get isDestroyed(): boolean; /** * Get the hour input element of the timepicker instance. * @returns - The HTMLInputElement for the hour input, or null if not found. */ get hour(): HTMLInputElement | null; /** * Get the minutes input element of the timepicker instance. * @returns - The HTMLInputElement for the minutes input, or null if not found. */ get minutes(): HTMLInputElement | null; /** * Get the OK button element of the timepicker instance. * @returns - The HTMLButtonElement for the OK button, or null if not found. */ get okButton(): HTMLButtonElement | null; /** * Get the Cancel button element of the timepicker instance. * @returns - The HTMLButtonElement for the Cancel button, or null if not found. */ get cancelButton(): HTMLButtonElement | null; /** * Get the clock hand element of the timepicker instance. * @returns - The HTMLDivElement for the clock hand, or null if not found. */ get clockHand(): HTMLDivElement | null; /** * Subscribe to a timepicker event with a handler function. * @param event - The name of the event to subscribe to. * @param handler - The function to handle the event. * @returns A function that removes this handler. Calling it more than once is a no-op. */ on(event: K, handler: (data: TimepickerEventMap[K]) => void): () => void; /** * Subscribe to a timepicker event with a handler function that will be called only once. * @param event - The name of the event to subscribe to. * @param handler - The function to handle the event. * @returns A function that removes the handler before it runs. Calling it more than once is a no-op. */ once(event: K, handler: (data: TimepickerEventMap[K]) => void): () => void; /** * Unsubscribe from a timepicker event. If a handler is provided, only that handler will be removed. If no handler is provided, all handlers for the event will be removed. * @param event - The name of the event to unsubscribe from. * @param handler - The function to handle the event. * @returns - void */ off(event: K, handler?: (data: TimepickerEventMap[K]) => void): void; private resolveRootElement; /** * Get a timepicker instance by its unique ID. * @param id - The unique instance ID of the timepicker to retrieve. * @returns - The timepicker instance if found, otherwise undefined. */ static getById(id: string): TimepickerUI | undefined; /** * Get all existing timepicker instances. * @returns - An array of all timepicker instances. */ static getAllInstances(): TimepickerUI[]; /** * Check whether the given selector or element exists in the document. Always false outside a browser. It does not check that the element is, or contains, an input. * @param selectorOrElement - A CSS selector string or an HTMLElement to look up. * @returns - True if the selector matches an element in the document, or the element is attached to the document; false otherwise. */ static isAvailable(selectorOrElement: string | HTMLElement): boolean; /** * Destroy all existing timepicker instances. This method iterates through all registered instances, calls their destroy method, and clears the instance registry. */ static destroyAll(): void; } /** @remarks This API changes in 5.0.0; see the roadmap. */ type CoreState = CoreState$1; export { EventEmitter, PluginRegistry, TimepickerUI, TimepickerUI as default }; export type { BehaviorOptions, CallbacksOptions, CancelEventData, ClearBehaviorOptions, ClearEventData, ClearHandler, ClockOptions, ConfirmEventData, CoreState, ErrorEventData, HideEventData, LabelsOptions, OpenEventData, OptionTypes, Plugin, PluginFactory, PluginManager, RangeConfirmEventData, RangeOptions, RangeSwitchEventData, RangeTimeState, RangeTimeValue, RangeValidationEventData, SelectAMEventData, SelectHourEventData, SelectMinuteEventData, SelectPMEventData, SelectPeriodEventData, SelectSecondEventData, ShowEventData, SwitchFaceEventData, SwitchViewEventData, TemplateProvider, TimeOfDay, TimepickerEventMap, TimepickerOptions, TimezoneChangeEventData, TimezoneOptions, UIOptions, UpdateEventData, WheelOptions, WheelScrollEndEventData, WheelScrollStartEventData };