import '../tooltip/tooltip.js'; import { UiElement } from '../shared/element.js'; export type SliderFormatLabel = (value: number, label?: string) => string; /** * Carbon `Slider` (single handle): a 2px track with a 14px round thumb (`role=slider`), min / max * labels and a 64px number input that mirrors the value. Drag or click the track; Left / Down and * Right / Up move by `step` (× `step-multiplier` with Shift), Home / End jump to the ends. Typing * applies at once while the number is in range; on blur or Enter an out-of-range number is * clamped (announced politely) and text that is not a number marks the field invalid. * `hide-text-input` replaces the input with a value tooltip on the thumb. * * Form-associated: submits `value` under `name`. Fires `input` while dragging / stepping and * `change` when the value is committed (pointer released, key handled, input committed). * * Two thumbs (Carbon `unstable_valueUpper`): set `value-upper` and the slider picks a range — the lower and upper * thumbs (Carbon's handle icons, named "Lower bound" / "Upper bound") never pass each other, a click on the track * moves the nearer one, and each has its number box (lower before the track, upper after). The form gets both * values: under `name`, or the upper one under `name-upper`. * * State on the host for styling: `data-show-error` while the error shows, `data-show-warn` while the * warning shows. * * @cssstate show-error - While its error message shows (also `[data-show-error]`) * @cssstate show-warn - While its warning message shows (also `[data-show-warn]`) * @slot label - Rich label (overrides `label`) * @slot invalid-text - Rich error text * @slot warn-text - Rich warning text * @csspart label - The label * @csspart base - Row with labels, track and input * @csspart min-label - Minimum label * @csspart max-label - Maximum label * @csspart track - The 2px track * @csspart filled-track - The filled part * @csspart thumb - The handle (`role=slider`) * @csspart thumb-lower - With `value-upper`: the lower handle (also `thumb`) * @csspart thumb-upper - With `value-upper`: the upper handle (also `thumb`) * @csspart input - The number input * @csspart input-lower - With `value-upper`: the lower bound's input (also `input`) * @csspart input-upper - With `value-upper`: the upper bound's input (also `input`) * @csspart error-text - Error text below * @csspart invalid-text - Same line as `error-text` (named after the `invalid-text` attribute / slot) * @csspart warning-text - Warning text below * @csspart warn-text - Same line as `warning-text` (named after the `warn-text` attribute / slot) * @cssprop --ui-field-border / --ui-field-radius / --ui-field-background - The number box, as the other fields * @cssprop --ui-slider-fill - The thumb, the filled track and the range handles (default `--ui-layer-selected-inverse`; Kanok: `--ui-interactive`) * @cssprop --ui-slider-handle-hover - A range handle under the pointer (default `--ui-ink-muted`) * @cssprop --ui-slider-tick - `display` of the mark at the middle of the track (default inline-block; Kanok: none) * @cssprop --ui-slider-range-handle-width / --ui-slider-range-handle-height / --ui-slider-range-lower-offset / --ui-slider-range-upper-offset - A range's handle box and where it sits on its value (default 16 × 24px, beside the value: Carbon's flags) * @cssprop --ui-slider-range-thumb / --ui-slider-range-thumb-hover / --ui-slider-range-thumb-inset / --ui-slider-range-thumb-radius / --ui-slider-range-focus-ring - A range thumb drawn in the handle (default none: the flag icons only; Kanok: a round dot) * @cssprop --ui-slider-range-gap / --ui-slider-range-icon-opacity - The gap where a flag meets the track and the flags' opacity (default the page colour, 1) */ export declare class UiSlider extends UiElement { static hostStates: readonly string[]; static readonly formAssociated = true; static readonly styles: import("lit").CSSResult[]; label: string; private readonly localize; hideLabel: boolean; value: number; /** A second thumb: the slider picks the range `value`…`value-upper` (Carbon `unstable_valueUpper`). */ valueUpper: number | null; /** The name the upper value is submitted under (default: `name`, so the form gets both under one name). */ nameUpper: string; /** Accessible name of the upper number box (Carbon `unstable_ariaLabelInputUpper`; default "Upper bound"). */ upperInputLabel: string; min: number; max: number; step: number; /** Shift + arrow moves by `step × step-multiplier`. */ stepMultiplier: number; /** Appended to the min / max numbers, e.g. "%" (Carbon `minLabel` / `maxLabel`). */ minLabel: string; maxLabel: string; /** Formats min / max labels and the value tooltip (Carbon `formatLabel`). */ formatLabel: SliderFormatLabel; /** Accessible name of the number input (Carbon `ariaLabelInput`). */ inputLabel: string; hideTextInput: boolean; name: string; disabled: boolean; readonly: boolean; required: boolean; invalid: boolean; invalidText: string; warn: boolean; warnText: string; /** Announcement after an out-of-range number is clamped; `{value}` is the typed number (Carbon auto-correct message). */ correctedText: string; /** Text in the input while the user types (may be a partial number). */ private text; /** Text in the upper number box (a range slider). */ private textUpper; /** The input holds something that is not a number (Carbon `isValid = false`). */ private notANumber; private corrected; /** Disabled, reset defaults, validation on submit and the name given from outside (shared by the form fields). */ private readonly formControl; private readonly thumb; private readonly sliderEl; /** Message from `setCustomValidity()`; '' = none. */ private customValidityMessage; /** Like `.setCustomValidity()`: a non-empty message makes the field invalid (and is shown as its error once touched) until cleared with ''. */ setCustomValidity(message: string): void; private readonly slots; /** Too narrow for the row at the track's 200px (a phone): the row wraps instead of widening the page. */ private readonly rowWrap; private readonly ids; private defaultValue; private defaultValueUpper; private dragging; /** The thumb a pointer drag moves. */ private dragHandle; get validity(): ValidityState; get validationMessage(): string; get form(): HTMLFormElement | null; /** Whether the field takes part in constraint validation (not while disabled), as natively. */ get willValidate(): boolean; /** The `