import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify the value of the slider. * Kept when the owning form resets. * @default 0 */ value?: number; /** * Set the size of the number input. * Inherits `"xs"` from a parent `Form`. */ size?: "xs" | undefined; /** * 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; /** * Format displayed values for range labels and `aria-valuetext`. * Does not change the numeric model; the text input stays numeric. */ formatValue?: undefined | ((value: number) => string); /** * Set the step value * @default 1 */ step?: number; /** * Show tick marks along the track. * Set to `true` to place a tick at every `step`, or pass an array of * `{ value, label? }` for specific stops with optional labels below the track. * A label is also announced in `aria-valuetext` while the value sits on its mark. * Snapping follows `step` unless `snapToMarks` is set. * @default false */ marks?: boolean | ReadonlyArray<{ value: number; label?: string }>; /** * Set to `true` to snap drag, click, and arrow key navigation to the configured `marks` * instead of `step`. Has no effect when `marks` is not set. * @default false */ snapToMarks?: boolean; /** * Snap drags and clicks to a mark when the pointer comes within this many pixels * of it, so meaningful values are easy to hit while other values stay reachable * by `step`. Keyboard navigation is unaffected. Set to `0` to disable. * Has no effect when `marks` is not set or `snapToMarks` is set. * @default 0 */ markSnapDistance?: 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; /** * Specify the assistive text announced to screen readers when read-only. * Exposed because VoiceOver does not announce `aria-readonly`. * @default "Read-only" */ readonlyText?: string; /** * Set to `true` to hide the text input * @default false */ hideTextInput?: boolean; /** * Set to `true` to hide the min and max labels beside the track, * as when a readout elsewhere already shows the range. * @default false */ hideRangeLabels?: boolean; /** * Set to `true` for the slider to span * the full width of its containing element. * @default false */ fullWidth?: boolean; /** * Set to "vertical" to lay out the slider along the vertical axis * @default "horizontal" */ orientation?: "horizontal" | "vertical"; /** * Set an id for the slider div element * @default uniqueId() */ 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 helper text * @default "" */ helperText?: 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 slider element * @default "" */ name?: string; /** * Specify the id of a form element outside the component to associate * the value input with. */ form?: string | undefined; /** * Obtain a reference to the HTML element. * @default null */ ref?: null | HTMLDivElement; /** * Set to `true` to select the number input's text when it receives focus * @default false */ selectTextOnFocus?: boolean; labelChildren?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type SliderProps = Omit<$RestProps, keyof $Props> & $Props; export default class Slider extends SvelteComponentTyped< SliderProps, { blur: WindowEventMap["blur"]; change: CustomEvent; click: WindowEventMap["click"]; focus: WindowEventMap["focus"]; input: CustomEvent; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; }, { labelChildren: Record } > {}