@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
96 lines (95 loc) • 4 kB
TypeScript
/// <reference path="../../index.d.ts" />
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
import type { MutableValidityState } from "../../utils/form.js";
import type { Scale, Status, Width } from "../interfaces.js";
import type { IconName } from "../calcite-icon/interfaces.js";
import type { Option } from "../calcite-option/customElement.js";
/**
* @cssproperty [--calcite-select-font-size] - Specifies the font size of `calcite-option`s in the component.
* @cssproperty [--calcite-select-text-color] - Specifies the text color of `calcite-option`s in the component.
* @cssproperty [--calcite-select-border-color] - Specifies the component's border color.
* @cssproperty [--calcite-select-icon-color] - Specifies the component's icon color.
* @cssproperty [--calcite-select-icon-color-hover] - Specifies the component's icon color when hovered or active.
* @cssproperty [--calcite-select-background-color] - Specifies the component's background color.
* @cssproperty [--calcite-select-corner-radius] - Specifies the component's corner radius.
* @cssproperty [--calcite-select-shadow] - Specifies the component's shadow.
* @slot - A slot for adding `calcite-option`s.
* @slot [label-content] - A slot for rendering content next to the component's `labelText`.
*/
export abstract class Select extends LitElement {
/**
* When `true`, interaction is prevented and the component is displayed with lower opacity.
*
* @default false
*/
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 accessible label for the component.
*
* @required
*/
accessor label: string;
/** Specifies the component's label text. */
accessor labelText: string;
/** Overrides individual strings used by the component. */
accessor messageOverrides: { required?: string; };
/** Specifies the name of the component. Required to pass the component's `value` on form submission. */
accessor name: string;
/**
* 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;
/** The component's selected option `HTMLElement`. */
get selectedOption(): Option;
/**
* Specifies the status of the input field, which determines the message and icons.
*
* @default "idle"
*/
accessor status: Status;
/** 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 `selectedOption` value. */
accessor value: string;
/**
* Specifies the width of the component. [Deprecated] The `"half"` value is deprecated, use `"full"` instead.
*
* @default "auto"
*/
accessor width: Extract<Width, "auto" | "half" | "full">;
/**
* 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 when the `selectedOption` changes. */
readonly calciteSelectChange: import("@arcgis/lumina").TargetedEvent<this, void>;
readonly "@eventTypes": {
calciteSelectChange: Select["calciteSelectChange"]["detail"];
};
}