UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

186 lines (185 loc) 8.32 kB
/// <reference path="../../index.d.ts" /> import type { PublicLitElement as LitElement } from "@arcgis/lumina"; import type { MutableValidityState } from "../../utils/form.js"; import type { Alignment, Scale, Status } from "../interfaces.js"; import type { IconName } from "../calcite-icon/interfaces.js"; /** * @cssproperty [--calcite-input-action-background-color] - Specifies the background color of the component's `clearable` element. * @cssproperty [--calcite-input-action-background-color-hover] - Specifies the background color of the component's `clearable` element when hovered. * @cssproperty [--calcite-input-action-background-color-press] - Specifies the background color of the component's `clearable` element when pressed. * @cssproperty [--calcite-input-action-icon-color] - Specifies the icon color of the component's `clearable` element. * @cssproperty [--calcite-input-action-icon-color-hover] - Specifies the icon color of the component's `clearable` element when hovered. * @cssproperty [--calcite-input-action-icon-color-press] - Specifies the icon color of the component's `clearable` element when pressed. * @cssproperty [--calcite-input-loading-background-color] - When `loading`, specifies the background color of the component`s `loading` element. * @cssproperty [--calcite-input-loading-fill-color] - When `loading`, specifies the fill color of the component`s `loading` element. * @cssproperty [--calcite-input-prefix-size-x] - When `prefixText` is provided, specifies the width of the component's prefix element. * @cssproperty [--calcite-input-prefix-text-color] - When `prefixText` is provided, specifies the text color of the component's prefix element. * @cssproperty [--calcite-input-suffix-size-x] - When `suffixText` is provided, specifies the width of the component's suffix element. * @cssproperty [--calcite-input-suffix-text-color] - When `suffixText` is provided, specifies the color of the component's suffix element. * @cssproperty [--calcite-input-text-background-color] - Specifies the component's background color. * @cssproperty [--calcite-input-text-border-color] - Specifies the component's border color. * @cssproperty [--calcite-input-text-corner-radius] - Specifies the component's border radius. * @cssproperty [--calcite-input-text-icon-color] - Specifies the component's `icon` color. * @cssproperty [--calcite-input-text-placeholder-text-color] - Specifies the component's `placeholder` text color. * @cssproperty [--calcite-input-text-text-color] - Specifies the component's text color. * @cssproperty [--calcite-input-text-text-color-focus] - Specifies the component's text color when focused. * @slot [action] - A slot for positioning a `calcite-action` or other interactive content adjacent to the component. * @slot [label-content] - A slot for rendering content next to the component's `labelText`. */ export abstract class InputText extends LitElement { /** * Specifies the text alignment of the component's `value`. * * @default "start" */ accessor alignment: Alignment; /** * Specifies the type of content to autocomplete, for use in forms. * Read the native attribute's documentation on MDN for more info. * * @mdn [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) */ accessor autocomplete: AutoFill; /** * When `true` and the component has a `value`, a clear button is displayed. * * @default false */ accessor clearable: boolean; /** * When `true`, prevents interaction and decreases the component's opacity. * * @default false * @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled) */ accessor disabled: boolean; /** * Specifies the `id` of the component's associated form. * * When not set, the component is associated with its ancestor form element, if one exists. */ accessor form: string; /** * Specifies an icon to display. * * @futureBreaking Remove boolean type as it is not supported. */ accessor icon: IconName | boolean; /** * When `true` and the element direction is right-to-left (`"rtl"`), flips the component`s `icon`. * * @default false */ accessor iconFlipRtl: boolean; /** Specifies an accessible label for the component's button or hyperlink. */ accessor label: string; /** Specifies the component's label text. */ accessor labelText: string; /** * When `true`, a busy indicator is displayed. * * @default false */ accessor loading: boolean; /** * When the component resides in a form, * specifies the maximum length of text for the component's value. * * @mdn [maxlength](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength) */ accessor maxLength: number; /** Overrides individual strings used by the component. */ accessor messageOverrides: { clear?: string; loading?: string; required?: string; }; /** * When the component resides in a form, * specifies the minimum length of text for the component's value. * * @mdn [minlength](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength) */ accessor minLength: number; /** * Specifies the name of the component. * * Required to pass the component's `value` on form submission. * * @mdn [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name) */ accessor name: string; /** * When the component resides in a form, * specifies a regular expression (regex) pattern the component's `value` must match for validation. * Read the native attribute's documentation on MDN for more info. * * @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern) */ accessor pattern: string; /** * Specifies the component's placeholder text. * * @mdn [placeholder](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder) */ accessor placeholder: string; /** Specifies text to display at the start of the component. */ accessor prefixText: string; /** * When `true`, the component's `value` can be read, but cannot be modified. * * @default false * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly) */ accessor readOnly: boolean; /** * When `true` and the component resides in a form, * the component must have a `value` in order for the form to submit. * * @default false */ accessor required: boolean; /** * Specifies the size of the component. * * @default "m" */ accessor scale: Scale; /** * Specifies the input field's status, which determines message and icons. * * @default "idle" */ accessor status: Status; /** Specifies text to display at the end of the component. */ accessor suffixText: string; /** Specifies the validation icon to display under the component. */ accessor validationIcon: IconName | boolean; /** Specifies the validation message to display under the component. */ accessor validationMessage: string; /** * The component's current validation state. * * @mdn [ValidityState](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) */ get validity(): MutableValidityState; /** The component's value. */ accessor value: string; /** Selects the text of the component's `value`. */ selectText(): Promise<void>; /** * Sets focus on the component. * * @param options - When specified an optional object customizes the component's focusing process. When `preventScroll` is `true`, scrolling will not occur on the component. * @mdn [focus(options)](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options) */ setFocus(options?: FocusOptions): Promise<void>; /** Fires each time a new `value` is typed and committed. */ readonly calciteInputTextChange: import("@arcgis/lumina").TargetedEvent<this, void>; /** Fires each time a new `value` is typed. */ readonly calciteInputTextInput: import("@arcgis/lumina").TargetedEvent<this, void>; readonly "@eventTypes": { calciteInputTextChange: InputText["calciteInputTextChange"]["detail"]; calciteInputTextInput: InputText["calciteInputTextInput"]["detail"]; }; }