UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

92 lines (91 loc) 3.78 kB
/// <reference path="../../index.d.ts" /> import type { PublicLitElement as LitElement } from "@arcgis/lumina"; import type { MutableValidityState } from "../../utils/form.js"; import type { Scale, Status } from "../interfaces.js"; import type { IconName } from "../calcite-icon/interfaces.js"; /** * @cssproperty [--calcite-rating-spacing] - Specifies the amount of left and right margin spacing between each item. * @cssproperty [--calcite-rating-color-hover] - Specifies the component's item color when hovered. * @cssproperty [--calcite-rating-color-press] - Specifies the component's item color when active. * @cssproperty [--calcite-rating-color] - Specifies the component's item color. * @cssproperty [--calcite-rating-average-color] - When `average` is set, specifies the component's item color. * @cssproperty [--calcite-rating-average-text-color] - When `average` is set, specifies the component's `average` text color. * @cssproperty [--calcite-rating-count-text-color] - Specifies the component's text color for `count`. * @slot [label-content] - A slot for rendering content next to the component's `labelText`. */ export abstract class Rating extends LitElement { /** Specifies a cumulative average from previous ratings to display. */ accessor average: number; /** Specifies the number of previous ratings to display. */ accessor count: number; /** * 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 the component's label text. */ accessor labelText: string; /** Overrides individual strings used by the component. */ accessor messageOverrides: { rating?: string; required?: string; stars?: string; }; /** Specifies the name of the component. Required to pass the component's `value` on form submission. */ accessor name: string; /** * When `true`, the component's value can be read, but cannot be modified. * * @default false */ accessor readOnly: boolean; /** * Specifies the size of the component. * * @default "m" */ accessor scale: Scale; /** * When `true`, and if available, displays the `average` and/or `count` data summary in a `calcite-chip`. * * @default false */ accessor showChip: boolean; /** * Specifies the status of the input field, which determines 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 value. */ accessor value: number; /** * 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 value changes. */ readonly calciteRatingChange: import("@arcgis/lumina").TargetedEvent<this, void>; readonly "@eventTypes": { calciteRatingChange: Rating["calciteRatingChange"]["detail"]; }; }