UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

103 lines (102 loc) 3.94 kB
/// <reference path="../../index.d.ts" /> import type { PublicLitElement as LitElement } from "@arcgis/lumina"; import type { Appearance, Kind, Scale } from "../interfaces.js"; import type { IconName } from "../calcite-icon/interfaces.js"; /** * @cssproperty [--calcite-chip-background-color] - Specifies the component's background color. * @cssproperty [--calcite-chip-border-color] - Specifies the component's border color. * @cssproperty [--calcite-chip-close-icon-color] - Specifies the component's close element icon color. * @cssproperty [--calcite-chip-corner-radius] - Specifies the component's corner radius. * @cssproperty [--calcite-chip-icon-color] - Specifies the component's icon color. * @cssproperty [--calcite-chip-select-icon-color-press] - Specifies the component's selection element icon color when active. * @cssproperty [--calcite-chip-select-icon-color-pressed] - [Deprecated] Use `--calcite-chip-select-icon-color-press`. Specifies the component's selection element icon color when active. * @cssproperty [--calcite-chip-select-icon-color] - Specifies the component's selection element icon color. * @cssproperty [--calcite-chip-text-color] - Specifies the component's text color. * @slot - A slot for adding text. * @slot [image] - A slot for adding an image. */ export abstract class Chip extends LitElement { /** * Specifies the appearance style of the component. * * @default "solid" */ accessor appearance: Extract<"outline" | "outline-fill" | "solid", Appearance>; /** * When `true`, displays a close button in the component. * * @default false */ accessor closable: boolean; /** * When `true`, hides the component. * * @default false */ accessor closed: boolean; /** * When `true`, the component closes when the Delete or Backspace key is pressed while focused. * * @default false */ accessor closeOnDelete: boolean; /** * When `true`, interaction is prevented and the component is displayed with lower opacity. * * @default false */ accessor disabled: boolean; /** Specifies an icon to display. */ accessor icon: IconName; /** * When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). * * @default false */ accessor iconFlipRtl: boolean; /** * Specifies the kind of the component, which will apply to border and background if applicable. * * @default "neutral" */ accessor kind: Extract<"brand" | "inverse" | "neutral", Kind>; /** * Specifies an accessible label for the component. * * @required */ accessor label: string; /** Overrides individual strings used by the component. */ accessor messageOverrides: { dismissLabel?: string; }; /** * Specifies the size of the component. * * When contained in a parent `calcite-chip-group`, inherits the parent's `scale` value. * * @default "m" */ accessor scale: Scale; /** * When `true`, the component is selected. * * @default false */ accessor selected: boolean; /** The component's value. */ accessor value: any; /** * 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 component's close button is selected. */ readonly calciteChipClose: import("@arcgis/lumina").TargetedEvent<this, void>; /** Fires when the selected state of the component changes. */ readonly calciteChipSelect: import("@arcgis/lumina").TargetedEvent<this, void>; readonly "@eventTypes": { calciteChipClose: Chip["calciteChipClose"]["detail"]; calciteChipSelect: Chip["calciteChipSelect"]["detail"]; }; }