UNPKG

@jupyter/web-components

Version:

A component library for building extensions in Jupyter frontends.

190 lines (189 loc) 5.46 kB
import { StartEnd, StartEndOptions, DelegatesARIATextbox } from '@microsoft/fast-foundation'; import type { FoundationElementDefinition } from '@microsoft/fast-foundation'; import { FormAssociatedDateField } from './date-field.form-associated.js'; /** * Number field appearances * @public */ export type DateFieldAppearance = 'filled' | 'outline'; /** * Date field configuration options * @public */ export type DateFieldOptions = FoundationElementDefinition & StartEndOptions; /** * A Dext Field Custom HTML Element. * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date | <input type="date" /> element }. * * @public * @tagname jp-date-field * * @fires input - Fires a custom 'input' event when the value has changed * @fires change - Fires a custom 'change' event when the value has changed */ export declare class DateField extends FormAssociatedDateField { /** * The appearance of the element. * * @public * @remarks * HTML Attribute: appearance */ appearance: DateFieldAppearance; /** * When true, the control will be immutable by user interaction. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute} for more information. * @public * @remarks * HTML Attribute: readonly */ readOnly: boolean; private readOnlyChanged; /** * Indicates that this element should get focus after the page finishes loading. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautofocus | autofocus HTML attribute} for more information. * @public * @remarks * HTML Attribute: autofocus */ autofocus: boolean; private autofocusChanged; /** * Allows associating a {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist | datalist} to the element by {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/id}. * @public * @remarks * HTML Attribute: list */ list: string; private listChanged; /** * Amount to increment or decrement the value by * @public * @remarks * HTMLAttribute: step */ step: number; /** * The maximum the value can be * @public * @remarks * HTMLAttribute: max */ max: Date; /** * Ensures that the max is greater than the min and that the value * is less than the max * @param previous - the previous max value * @param next - updated max value * * @internal */ maxChanged(previous: Date, next: Date): void; /** * The minimum the value can be * @public * @remarks * HTMLAttribute: min */ min: Date; /** * Ensures that the min is less than the max and that the value * is greater than the min * @param previous - previous min value * @param next - updated min value * * @internal */ minChanged(previous: Date, next: Date): void; /** * @internal */ defaultSlottedNodes: Node[]; /** * A reference to the internal input element * @internal */ control: HTMLInputElement; /** * Flag to indicate that the value change is from the user input * @internal */ private isUserInput; /** * The value property, typed as a number. * * @public */ get valueAsNumber(): number; set valueAsNumber(next: number); /** * The value property, typed as a date. * * @public */ get valueAsDate(): Date; set valueAsDate(next: Date); /** * Validates that the value is a number between the min and max * @param previous - previous stored value * @param next - value being updated * @param updateControl - should the text field be updated with value, defaults to true * @internal */ valueChanged(previous: string, next: string): void; /** * Sets the internal value to a valid number between the min and max properties * @param value - user input * * @internal */ private getValidValue; /** * Increments the value using the step value * * @public */ stepUp(): void; /** * Decrements the value using the step value * * @public */ stepDown(): void; /** * @internal */ connectedCallback(): void; /** * Handles the internal control's `input` event * @internal */ handleTextInput(): void; /** * Change event handler for inner control. * @remarks * "Change" events are not `composable` so they will not * permeate the shadow DOM boundary. This fn effectively proxies * the change event, emitting a `change` event whenever the internal * control emits a `change` event * @internal */ handleChange(): void; /** * Handles the internal control's `keydown` event * @internal */ handleKeyDown(e: KeyboardEvent): boolean; /** * Handles populating the input field with a validated value when * leaving the input field. * @internal */ handleBlur(): void; } /** * Mark internal because exporting class and interface of the same name * confuses API documenter. * TODO: https://github.com/microsoft/fast/issues/3317 * @internal */ export interface DateField extends StartEnd, DelegatesARIATextbox { }