import { TemplateResult } from "lit-element"; import { AriaRole } from "../../util/aria"; import { FormElement, FormElementBehavior, IFormElementBehaviorProperties } from "../form-element/form-element-behavior"; /** * Events the input can dispatch. */ export declare enum InputBehaviorEvent { SUBMIT = "submit", INVALID = "invalid" } /** * Properties of the input. */ export interface IInputBehaviorProperties extends IFormElementBehaviorProperties { outlined: boolean; role: AriaRole; filled: boolean; autocomplete?: "on" | "off"; label?: string; } /** * Provides input behavior that interacts with forms. * @event submit - Dispatched when the enter key is hit while pressing ctrl or the meta-key. * @event invalid - Dispatched when the input becomes invalid. * @event input - Dispatches from the native input event each time the input changes. * @slot before - Content before the input. * @slot after - Content after the input. * @cssprop --input-state-color-inactive - Inactive state color * @cssprop --input-state-color-active - Active state color * @cssprop --input-state-color-hover - Hover state color * @cssprop --input-state-color-invalid - Invalid state color * @cssprop --input-state-color-disabled - Disabled state color * @cssprop --input-color - Default color * @cssprop --input-bg - Default background * @cssprop --input-color-disabled - Color when disabled * @cssprop --input-bg-filled - Background when filled * @cssprop --input-bg-filled-hover - Background when filled and hover * @cssprop --input-transition - Transition * @cssprop --input-border-width - Border width * @cssprop --input-border-style - Border style * @cssprop --input-border-style-disabled - Border style when disabled * @cssprop --input-before-after-color - Color of the before and after slots * @cssprop --input-font-size - Font size * @cssprop --input-padding-left-right - Left and right padding * @cssprop --input-padding-top-bottom - Top and bottom padding * @cssprop --input-padding-left-right-outlined - Left and right padding when outlined * @cssprop --input-border-radius-filled - Border radius when filled * @cssprop --input-border-radius-outlined - Border radius when outlined * @cssprop --input-font-family - Font family * @cssprop --input-label-color - Color of the label * @cssprop --input-label-color-disabled - Color of the label when disabled * @cssprop --input-label-font-size - Font size of the label * @cssprop --input-label-transition - Transition of the label * @cssprop --input-label-space - Space between label and input */ export declare abstract class InputBehavior extends FormElementBehavior implements IInputBehaviorProperties { static styles: import("lit-element").CSSResult[]; /** * Whether autocomplete is on or off. * @attr */ autocomplete?: "on" | "off"; /** * Makes the input outlined. * @attr */ outlined: boolean; /** * Fills the input with a solid color. * @attr */ filled: boolean; /** * Role of the input. * @attr */ role: AriaRole; /** * Label text. * @attr */ label?: string; /** * Value of the form element. * @attr * @param value */ set value(value: string); get value(): string; /** * Value of the slider. * @attr * @param value */ set valueAsNumber(value: number); get valueAsNumber(): number; /** * Returns the main slot element. */ get $slot(): HTMLSlotElement; /** * The element that the user interacts with. * This will most likely be the form element. */ protected get $interactiveElement(): FormElement; /** * Returns whether the component is pristine or has been touched. */ private _pristine; get pristine(): boolean; /** * Returns whether the nativeInput is dirty or not. */ get dirty(): boolean; /** * Hooks up the element. * @param props */ protected firstUpdated(props: Map): void; /** * Reacts when properties are updated. * @param props */ protected updated(props: Map): void; /** * Creates a root that delegates the focus. * As of now the delegating of focus only works in Chrome. * We will have to come up with another solution for other browsers since they * currently have to tab twice to reach the interactive element. */ protected createRenderRoot(): ShadowRoot; /** * Focuses the form element. */ focus(): void; /** * Sets the value of the form element. * @param value */ protected setValue(value: string): void; /** * Handles the input event. * @param e */ protected onInput(e: Event): void; /** * Dispatches an invalid event. * We have to "redispatch" it because the native one doesn't bubble. * @param e */ protected onInvalid(e: Event): void; /** * Handles the on blur event. */ protected onBlur(): void; /** * Refreshes the attributes. */ protected refreshAttributes(): void; /** * Handles the key up event. * @param e */ protected onKeyDown(e: KeyboardEvent): void; /** * Dispatches an input behavior event. * @param e */ protected dispatchInputEvent(e: InputBehaviorEvent): void; /** * Returns the form element template. */ protected abstract renderFormElement(): TemplateResult; /** * Returns the template for the element. */ protected render(): TemplateResult; }