/** * @license * Copyright (c) 2018 - 2026 Vaadin Ltd. * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ */ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; import { TimePickerMixin } from './vaadin-time-picker-mixin.js'; export type { TimePickerTime } from './vaadin-time-picker-helper.js'; export type { TimePickerI18n } from './vaadin-time-picker-mixin.js'; /** * Fired when the user commits a value change. */ export type TimePickerChangeEvent = Event & { target: TimePicker; }; /** * Fired when the `invalid` property changes. */ export type TimePickerInvalidChangedEvent = CustomEvent<{ value: boolean }>; /** * Fired when the `opened` property changes. */ export type TimePickerOpenedChangedEvent = CustomEvent<{ value: boolean }>; /** * Fired when the `value` property changes. */ export type TimePickerValueChangedEvent = CustomEvent<{ value: string }>; /** * Fired whenever the field is validated. */ export type TimePickerValidatedEvent = CustomEvent<{ valid: boolean }>; /** * Fired when the user commits an unparsable value change and there is no change event. */ export type TimePickerUnparsableChangeEvent = CustomEvent; export interface TimePickerCustomEventMap { 'invalid-changed': TimePickerInvalidChangedEvent; 'opened-changed': TimePickerOpenedChangedEvent; 'value-changed': TimePickerValueChangedEvent; 'unparsable-change': TimePickerUnparsableChangeEvent; validated: TimePickerValidatedEvent; } export interface TimePickerEventMap extends HTMLElementEventMap, TimePickerCustomEventMap { change: TimePickerChangeEvent; } /** * `` is a Web Component providing a time-selection field. * * ```html * * ``` * ```js * timePicker.value = '14:30'; * ``` * * When the selected `value` is changed, a `value-changed` event is triggered. * * ### Styling * * The following custom properties are available for styling: * * Custom property | Description | Default * -----------------------------------------|----------------------------|--------- * `--vaadin-field-default-width` | Default width of the field | `12em` * `--vaadin-time-picker-overlay-width` | Width of the overlay | `auto` * `--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh` * * The following shadow DOM parts are available for styling: * * Part name | Description * ---------------------|---------------- * `label` | The label element * `input-field` | The element that wraps prefix, value and buttons * `field-button` | Set on both clear and toggle buttons * `clear-button` | The clear button * `error-message` | The error message element * `helper-text` | The helper text element wrapper * `required-indicator` | The `required` state indicator element * `toggle-button` | The toggle button * `overlay` | The overlay container * `content` | The overlay content * * The following state attributes are available for styling: * * Attribute | Description * ---------------------|--------------------------------- * `disabled` | Set when the element is disabled * `has-value` | Set when the element has a value * `has-label` | Set when the element has a label * `has-helper` | Set when the element has helper text or slot * `has-error-message` | Set when the element has an error message * `has-tooltip` | Set when the element has a slotted tooltip * `invalid` | Set when the element is invalid * `focused` | Set when the element is focused * `focus-ring` | Set when the element is keyboard focused * `readonly` | Set when the element is readonly * `opened` | Set when the overlay is opened * * ### Internal components * * In addition to `` itself, the following internal * components are themable: * * - `` - has the same API as [``](#/elements/vaadin-item). * * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation. * * ### Change events * * Depending on the nature of the value change that the user attempts to commit e.g. by pressing Enter, * the component can fire either a `change` event or an `unparsable-change` event: * * Value change | Event * :------------------------|:------------------ * empty => parsable | change * empty => unparsable | unparsable-change * parsable => empty | change * parsable => parsable | change * parsable => unparsable | change * unparsable => empty | unparsable-change * unparsable => parsable | change * unparsable => unparsable | unparsable-change * * @fires {Event} change - Fired when the user commits a value change. * @fires {Event} unparsable-change - Fired when the user commits an unparsable value change and there is no change event. * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes. * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes. * @fires {CustomEvent} value-changed - Fired when the `value` property changes. * @fires {CustomEvent} validated - Fired whenever the field is validated. */ declare class TimePicker extends TimePickerMixin(ThemableMixin(ElementMixin(HTMLElement))) { addEventListener( type: K, listener: (this: TimePicker, ev: TimePickerEventMap[K]) => void, options?: AddEventListenerOptions | boolean, ): void; removeEventListener( type: K, listener: (this: TimePicker, ev: TimePickerEventMap[K]) => void, options?: EventListenerOptions | boolean, ): void; } declare global { interface HTMLElementTagNameMap { 'vaadin-time-picker': TimePicker; } } export { TimePicker };