import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export interface RangeSliderChangeDetail { value: number; valueUpper: number; } export type ActiveHandle = "lower" | "upper"; export type PointerLikeEvent = MouseEvent | TouchEvent; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify the lower bound value of the slider. * @default 0 */ value?: number; /** * Specify the upper bound value of the slider. * @default 100 */ valueUpper?: number; /** * Set the maximum slider value * @default 100 */ max?: number; /** * Specify the label for the max value * @default "" */ maxLabel?: string; /** * Set the minimum slider value * @default 0 */ min?: number; /** * Specify the label for the min value * @default "" */ minLabel?: string; /** * Set the step value * @default 1 */ step?: number; /** * Set the step multiplier value * @default 4 */ stepMultiplier?: number; /** * Set to `true` to require a value * @default false */ required?: boolean; /** * Specify the input type * @default "number" */ inputType?: string; /** * Set to `true` to disable the slider * @default false */ disabled?: boolean; /** * Set to `true` to use the read-only variant * @default false */ readonly?: boolean; /** * Set to `true` to enable the light variant * @default false */ light?: boolean; /** * Set to `true` to hide the text inputs * @default false */ hideTextInput?: boolean; /** * Set to `true` for the slider to span * the full width of its containing element. * @default false */ fullWidth?: boolean; /** * Set an id for the slider div element * @default `ccs-${Math.random().toString(36)}` */ id?: string; /** * Set to `true` to indicate an invalid state * @default false */ invalid?: boolean; /** * Specify the invalid state text * @default "" */ invalidText?: string; /** * Set to `true` to indicate a warning state * @default false */ warn?: boolean; /** * Specify the warning state text * @default "" */ warnText?: string; /** * Specify the label text. * Alternatively, use the "labelChildren" slot. * @example * ```svelte * * Custom Label * * ``` * @default "" */ labelText?: string; /** * Set to `true` to visually hide the label text * @default false */ hideLabel?: boolean; /** * Set a name for the lower bound input element * @default "" */ name?: string; /** * Set a name for the upper bound input element * @default "" */ nameUpper?: string; /** * Specify the `aria-label` for the lower bound input and handle * @default "Lower bound" */ ariaLabelInput?: string; /** * Specify the `aria-label` for the upper bound input and handle * @default "Upper bound" */ ariaLabelInputUpper?: string; /** * Obtain a reference to the HTML element. * @default null */ ref?: null | HTMLDivElement; labelChildren?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type RangeSliderProps = Omit<$RestProps, keyof $Props> & $Props; export default class RangeSlider extends SvelteComponentTyped< RangeSliderProps, { change: CustomEvent<{ value: number; valueUpper: number }>; click: WindowEventMap["click"]; input: CustomEvent<{ value: number; valueUpper: number }>; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; }, { labelChildren: Record } > {}