import ShoelaceElement from '../../internal/shoelace-element.js'; import type { CSSResultGroup } from 'lit'; import type { ShoelaceFormControl } from '../../internal/shoelace-element.js'; /** * @summary Ranges allow the user to select a single value within a given range using a slider. * @documentation https://shoelace.style/components/range * @status stable * @since 2.0 * * @slot label - The range's label. Alternatively, you can use the `label` attribute. * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute. * * @event sl-blur - Emitted when the control loses focus. * @event sl-change - Emitted when an alteration to the control's value is committed by the user. * @event sl-focus - Emitted when the control gains focus. * @event sl-input - Emitted when the control receives input. * @event sl-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. * * @csspart form-control - The form control that wraps the label, input, and help text. * @csspart form-control-label - The label's wrapper. * @csspart form-control-input - The range's wrapper. * @csspart form-control-help-text - The help text's wrapper. * @csspart base - The component's base wrapper. * @csspart input - The internal `` element. * @csspart tooltip - The range's tooltip. * * @cssproperty --thumb-size - The size of the thumb. * @cssproperty --tooltip-offset - The vertical distance the tooltip is offset from the track. * @cssproperty --track-color-active - The color of the portion of the track that represents the current value. * @cssproperty --track-color-inactive - The of the portion of the track that represents the remaining value. * @cssproperty --track-height - The height of the track. * @cssproperty --track-active-offset - The point of origin of the active track. */ export default class SlRange extends ShoelaceElement implements ShoelaceFormControl { static styles: CSSResultGroup; private readonly formControlController; private readonly hasSlotController; private readonly localize; private resizeObserver; input: HTMLInputElement; output: HTMLOutputElement | null; private hasFocus; private hasTooltip; title: string; /** The name of the range, submitted as a name/value pair with form data. */ name: string; /** The current value of the range, submitted as a name/value pair with form data. */ value: number; /** The range's label. If you need to display HTML, use the `label` slot instead. */ label: string; /** The range's help text. If you need to display HTML, use the help-text slot instead. */ helpText: string; /** Disables the range. */ disabled: boolean; /** The minimum acceptable value of the range. */ min: number; /** The maximum acceptable value of the range. */ max: number; /** The interval at which the range will increase and decrease. */ step: number; /** The preferred placement of the range's tooltip. */ tooltip: 'top' | 'bottom' | 'none'; /** * A function used to format the tooltip's value. The range's value is passed as the first and only argument. The * function should return a string to display in the tooltip. */ tooltipFormatter: (value: number) => string; /** * By default, form controls are associated with the nearest containing `