{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "elastic-slider",
  "title": "Elastic Slider",
  "description": "A slider that thickens under your finger and stretches like rubber past either end, with a soft tick at every detent and a dull thunk at the limits.",
  "dependencies": [
    "@number-flow/react",
    "@rexa-developer/tiks",
    "motion",
    "web-haptics"
  ],
  "files": [
    {
      "path": "src/registry/components/elastic-slider/elastic-slider.tsx",
      "content": "\"use client\";\n\nimport NumberFlow from \"@number-flow/react\";\nimport { useTiks } from \"@rexa-developer/tiks/react\";\nimport {\n\ttype AnimationPlaybackControls,\n\tanimate,\n\ttype MotionValue,\n\tmotion,\n\tuseMotionValue,\n\tuseMotionValueEvent,\n\tuseReducedMotion,\n\tuseTransform,\n} from \"motion/react\";\nimport {\n\ttype ComponentProps,\n\ttype KeyboardEvent,\n\ttype PointerEvent,\n\ttype ReactNode,\n\ttype Ref,\n\tuseCallback,\n\tuseEffect,\n\tuseId,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport { useWebHaptics } from \"web-haptics/react\";\nimport { cn } from \"@/lib/utils\";\n\n/** Stretch, thickness, icon nudge, and jumps all share this soft spring. */\nconst softSpring = {\n\ttype: \"spring\",\n\tbounce: 0.2,\n\tvisualDuration: 0.35,\n} as const;\n/** Follows the pointer between coarse steps and onto marks while dragging. */\nconst dragSpring = { type: \"spring\", bounce: 0, visualDuration: 0.12 } as const;\nconst digitTiming = {\n\tduration: 450,\n\teasing: \"cubic-bezier(.2,.8,.2,1)\",\n} as const;\n\n/** Minimum ms between ticks, so a fast drag never buzzes. */\nconst CUE_THROTTLE_MS = 35;\n/** Above this many steps, ticks fall on every 10% instead of every step. */\nconst MAX_TICKED_STEPS = 40;\n/** A dragged value sticks to a mark while the pointer is this close, in px. */\nconst MARK_STICK_PX = 6;\n/** Touch travel, in px, before a press on the track becomes a drag. */\nconst TOUCH_SLOP = 4;\n/** Overdrag, in px, that counts as pulling past an end. */\nconst OVERDRAG_THUNK_PX = 1;\n/** The track's hit area is never shorter than this, in px. */\nconst MIN_HIT_PX = 44;\n/** How far a key press at a limit stretches the track, as a fraction of `maxStretch`. */\nconst BUMP_STRETCH = 0.35;\n/** Distance, in px, over which inline text fades back in beside the fill's edge. */\nconst TEXT_FADE_PX = 8;\n/** Extra scale an end icon reaches at full stretch. */\nconst ICON_SCALE = 0.15;\n\n/** Track heights in px; `inline` holds the label and value inside the track. */\nconst sizes = {\n\tsm: {\n\t\tthin: 4,\n\t\tthick: 8,\n\t\tinlineThin: 32,\n\t\tinlineThick: 36,\n\t\tpadding: 12,\n\t\ttext: \"text-xs\",\n\t\ticon: \"[&_svg]:size-3.5\",\n\t\tgap: \"gap-2.5\",\n\t},\n\tmd: {\n\t\tthin: 6,\n\t\tthick: 12,\n\t\tinlineThin: 40,\n\t\tinlineThick: 46,\n\t\tpadding: 16,\n\t\ttext: \"text-sm\",\n\t\ticon: \"[&_svg]:size-4\",\n\t\tgap: \"gap-3\",\n\t},\n\tlg: {\n\t\tthin: 8,\n\t\tthick: 16,\n\t\tinlineThin: 48,\n\t\tinlineThick: 54,\n\t\tpadding: 18,\n\t\ttext: \"text-base\",\n\t\ticon: \"[&_svg]:size-5\",\n\t\tgap: \"gap-3.5\",\n\t},\n} as const;\n\ntype Direction = 1 | -1;\n\nexport interface ElasticSliderMark {\n\tvalue: number;\n\t/** Shown under the track; clicking it moves the slider there. */\n\tlabel?: string;\n}\n\nexport interface ElasticSliderProps\n\textends Omit<ComponentProps<\"div\">, \"children\" | \"defaultValue\" | \"ref\"> {\n\t/** Visible label, also the slider's accessible name. */\n\tlabel: string;\n\t/** Keeps the label for assistive technology only. */\n\thideLabel?: boolean;\n\t/** Controlled value. */\n\tvalue?: number;\n\t/** Initial value when uncontrolled. Defaults to `min`. */\n\tdefaultValue?: number;\n\t/** Called on every change while dragging, clicking, or pressing keys. */\n\tonValueChange?: (value: number) => void;\n\t/** Called once a drag is released, or a click, key press, or mark lands. */\n\tonValueCommit?: (value: number) => void;\n\tmin?: number;\n\tmax?: number;\n\tstep?: number;\n\t/** Moved by `Shift`+arrows and `PageUp`/`PageDown`. Defaults to a tenth of the range. */\n\tlargeStep?: number;\n\t/** Detents a drag sticks to. Labelled marks render under the track. */\n\tmarks?: Array<number | ElasticSliderMark>;\n\t/** Formats the readout and `aria-valuetext`. */\n\tformat?: (value: number) => string;\n\t/** Shown before the track, nudged outward when it stretches past `min`. */\n\tstartIcon?: ReactNode;\n\t/** Shown after the track, nudged outward when it stretches past `max`. */\n\tendIcon?: ReactNode;\n\t/** `inline` puts the label and value inside the track; `stacked` puts them above a thin track. */\n\tvariant?: \"inline\" | \"stacked\";\n\tsize?: keyof typeof sizes;\n\t/** Furthest the track stretches past either end, in px. */\n\tmaxStretch?: number;\n\t/** Play a tick per step or mark and a thunk at the limits. */\n\tsound?: boolean;\n\t/** Trigger haptics on supported devices. */\n\thaptics?: boolean;\n\tdisabled?: boolean;\n\t/** Submits the value with a native form through a hidden input. */\n\tname?: string;\n\tclassName?: string;\n}\n\nfunction decimalsOf(value: number) {\n\tif (!Number.isFinite(value)) return 0;\n\tconst text = String(value);\n\tif (text.includes(\"e-\")) return Number(text.split(\"e-\")[1]);\n\treturn text.split(\".\")[1]?.length ?? 0;\n}\n\nfunction clamp(value: number, min: number, max: number) {\n\treturn Math.min(Math.max(value, min), max);\n}\n\n/**\n * Square-root resistance: follows the pointer 1:1 at first, then eases towards\n * `max` px and never passes it.\n */\nfunction resist(over: number, max: number) {\n\tif (over <= 0 || max <= 0) return 0;\n\treturn max * (1 - Math.exp(1 - Math.sqrt(1 + (2 * over) / max)));\n}\n\n/** Labels at the ends align to the edge, so they never overflow the track. */\nfunction labelShift(fraction: number) {\n\tif (fraction < 0.1) return fraction * 5;\n\tif (fraction > 0.9) return 0.5 + (fraction - 0.9) * 5;\n\treturn 0.5;\n}\n\ninterface Scale {\n\tlower: number;\n\tupper: number;\n\tstep: number;\n\tdecimals: number;\n\t/** Values that tick; `null` ticks on every step. */\n\tticks: number[] | null;\n\tmarks: ElasticSliderMark[];\n\tround: (value: number) => number;\n\t/** Nearest valid value; `max` counts even when the steps don't reach it. */\n\tsnap: (value: number) => number;\n\t/** The next valid value above or below. */\n\tstepFrom: (value: number, direction: Direction) => number;\n\tfractionOf: (value: number) => number;\n}\n\nfunction buildScale(\n\tmin: number,\n\tmax: number,\n\tstep: number,\n\tmarks?: Array<number | ElasticSliderMark>,\n): Scale {\n\tconst lower = Number.isFinite(min) ? min : 0;\n\tconst upper = Number.isFinite(max) ? Math.max(max, lower) : lower;\n\tconst safeStep = Number.isFinite(step) && step > 0 ? step : 1;\n\tconst decimals = Math.max(decimalsOf(safeStep), decimalsOf(lower));\n\tconst span = upper - lower;\n\t// Round to the step's precision so 0.1 + 0.2 lands on 0.3.\n\tconst round = (value: number) => Number(value.toFixed(decimals));\n\n\tconst snap = (value: number) => {\n\t\tif (!(value > lower)) return lower;\n\t\tif (value >= upper) return upper;\n\t\t// The ratio is rounded first so 0.175 / 0.05 counts as 3.5, not 3.4999….\n\t\tconst steps = Number(((value - lower) / safeStep).toFixed(9));\n\t\tconst snapped = round(lower + Math.round(steps) * safeStep);\n\t\t// A step that doesn't divide the range still lets the end reach `max`.\n\t\tif (snapped > upper || upper - value < Math.abs(snapped - value)) {\n\t\t\treturn upper;\n\t\t}\n\t\treturn snapped;\n\t};\n\n\tconst stepFrom = (value: number, direction: Direction) => {\n\t\tconst steps = (value - lower) / safeStep;\n\t\tconst index =\n\t\t\tdirection > 0\n\t\t\t\t? Math.floor(steps + 1e-9) + 1\n\t\t\t\t: Math.ceil(steps - 1e-9) - 1;\n\t\treturn clamp(round(lower + index * safeStep), lower, upper);\n\t};\n\n\tconst normalizedMarks = (marks ?? [])\n\t\t.map((mark) => (typeof mark === \"number\" ? { value: mark } : mark))\n\t\t.filter(\n\t\t\t(mark) =>\n\t\t\t\tNumber.isFinite(mark.value) &&\n\t\t\t\tmark.value >= lower &&\n\t\t\t\tmark.value <= upper,\n\t\t)\n\t\t.map((mark) => ({ ...mark, value: round(mark.value) }))\n\t\t.sort((a, b) => a.value - b.value)\n\t\t.filter((mark, index, list) => mark.value !== list[index - 1]?.value);\n\n\tlet ticks: number[] | null;\n\tif (normalizedMarks.length) {\n\t\tticks = normalizedMarks.map((mark) => mark.value);\n\t} else if (span / safeStep <= MAX_TICKED_STEPS) {\n\t\tticks = null;\n\t} else {\n\t\t// Long ranges tick on every 10% instead of every step.\n\t\tticks = Array.from({ length: 9 }, (_, index) =>\n\t\t\tsnap(lower + ((index + 1) * span) / 10),\n\t\t);\n\t}\n\n\treturn {\n\t\tlower,\n\t\tupper,\n\t\tstep: safeStep,\n\t\tdecimals,\n\t\tticks,\n\t\tmarks: normalizedMarks,\n\t\tround,\n\t\tsnap,\n\t\tstepFrom,\n\t\tfractionOf: (value) => (span > 0 ? clamp((value - lower) / span, 0, 1) : 0),\n\t};\n}\n\nfunction Readout({\n\tvalue,\n\ttext,\n\tformatted,\n\tdecimals,\n\tanimated,\n}: {\n\tvalue: number;\n\ttext: string;\n\tformatted: boolean;\n\tdecimals: number;\n\tanimated: boolean;\n}) {\n\t// A custom `format` returns a string, which can't roll digit by digit.\n\tif (formatted) return <span>{text}</span>;\n\treturn (\n\t\t<NumberFlow\n\t\t\tvalue={value}\n\t\t\tlocales=\"en-US\"\n\t\t\tformat={{\n\t\t\t\tminimumFractionDigits: decimals,\n\t\t\t\tmaximumFractionDigits: decimals,\n\t\t\t\tuseGrouping: false,\n\t\t\t}}\n\t\t\tanimated={animated}\n\t\t\trespectMotionPreference={false}\n\t\t\ttransformTiming={digitTiming}\n\t\t\tspinTiming={digitTiming}\n\t\t/>\n\t);\n}\n\nexport function ElasticSlider({\n\tlabel,\n\thideLabel = false,\n\tvalue: valueProp,\n\tdefaultValue,\n\tonValueChange,\n\tonValueCommit,\n\tmin = 0,\n\tmax = 100,\n\tstep = 1,\n\tlargeStep,\n\tmarks,\n\tformat,\n\tstartIcon,\n\tendIcon,\n\tvariant = \"inline\",\n\tsize = \"md\",\n\tmaxStretch = 10,\n\tsound = true,\n\thaptics = true,\n\tdisabled = false,\n\tname,\n\tclassName,\n\t...props\n}: ElasticSliderProps) {\n\tconst sizeStyle = sizes[size];\n\tconst inline = variant === \"inline\";\n\tconst thin = inline ? sizeStyle.inlineThin : sizeStyle.thin;\n\tconst thick = inline ? sizeStyle.inlineThick : sizeStyle.thick;\n\tconst scale = buildScale(min, max, step, marks);\n\tconst { lower, upper } = scale;\n\tconst inactive = disabled || upper <= lower;\n\tconst stretchLimit = Math.max(\n\t\t0,\n\t\tNumber.isFinite(maxStretch) ? maxStretch : 0,\n\t);\n\tconst bigStep =\n\t\tlargeStep !== undefined && Number.isFinite(largeStep) && largeStep > 0\n\t\t\t? largeStep\n\t\t\t: Math.max(\n\t\t\t\t\tscale.step,\n\t\t\t\t\tMath.round((upper - lower) / 10 / scale.step) * scale.step,\n\t\t\t\t);\n\n\tconst controlled = valueProp !== undefined;\n\tconst [internalValue, setInternalValue] = useState(() =>\n\t\tscale.snap(valueProp ?? defaultValue ?? lower),\n\t);\n\tconst [dragging, setDragging] = useState(false);\n\t// A drag in progress wins over the `value` prop; it syncs on release.\n\t// Out-of-range values are clamped for display without calling `onValueChange`.\n\tconst value = scale.snap(controlled && !dragging ? valueProp : internalValue);\n\tconst valueText = format ? format(value) : value.toFixed(scale.decimals);\n\n\tconst shouldReduceMotion = useReducedMotion() ?? false;\n\tconst { trigger: haptic } = useWebHaptics();\n\tconst { click: playClick, toggle: playToggle } = useTiks({\n\t\t// Sound stays on under reduced motion; only movement is reduced.\n\t\trespectReducedMotion: false,\n\t});\n\t// The crisp theme's click is a touch brighter: it marks `min` and `max`.\n\tconst { click: playBrightClick } = useTiks({\n\t\ttheme: \"crisp\",\n\t\trespectReducedMotion: false,\n\t});\n\n\tconst labelId = useId();\n\tconst rootRef = useRef<HTMLDivElement>(null);\n\tconst rowRef = useRef<HTMLDivElement>(null);\n\tconst labelRef = useRef<HTMLSpanElement>(null);\n\tconst readoutRef = useRef<HTMLSpanElement>(null);\n\n\t// Position of the value along the track, 0 to 1.\n\tconst fraction = useMotionValue(scale.fractionOf(value));\n\t// Px the track is stretched past an end: negative past `min`, positive past `max`.\n\tconst stretch = useMotionValue(0);\n\tconst thickness = useMotionValue<number>(thin);\n\tconst trackWidth = useMotionValue(0);\n\t// 1 in left-to-right layouts, -1 in right-to-left ones.\n\tconst direction = useMotionValue<number>(1);\n\tconst [rtl, setRtl] = useState(false);\n\tconst labelOpacity = useMotionValue(1);\n\tconst readoutOpacity = useMotionValue(1);\n\n\tconst fractionAnimationRef = useRef<AnimationPlaybackControls | null>(null);\n\tconst stretchAnimationRef = useRef<AnimationPlaybackControls | null>(null);\n\tconst valueRef = useRef(value);\n\tconst lastCueAtRef = useRef(Number.NEGATIVE_INFINITY);\n\tconst lastHapticAtRef = useRef(Number.NEGATIVE_INFINITY);\n\tconst textBoxesRef = useRef({ label: 0, readout: 0 });\n\tconst dragRef = useRef<{\n\t\tpointerId: number;\n\t\tactive: boolean;\n\t\toriginX: number;\n\t\toriginY: number;\n\t\tstartValue: number;\n\t\toverdragged: boolean;\n\t} | null>(null);\n\n\tuseLayoutEffect(() => {\n\t\tvalueRef.current = value;\n\t});\n\n\t// The track grows past whichever end is stretched; the fill follows it.\n\tconst trackStart = useTransform(stretch, (s) => `${Math.min(s, 0)}px`);\n\tconst trackEnd = useTransform(stretch, (s) => `${-Math.max(s, 0)}px`);\n\tconst trackHeight = useTransform(thickness, (h) => `${h}px`);\n\tconst fillRatio = (f: number, s: number, width: number) =>\n\t\twidth > 0 ? (f * width + Math.max(s, 0)) / (width + Math.abs(s)) : f;\n\t// The fill is a full-width layer slid along the track, so it moves with transforms only.\n\tconst fillX = useTransform(\n\t\t() =>\n\t\t\t`${direction.get() * (fillRatio(fraction.get(), stretch.get(), trackWidth.get()) - 1) * 100}%`,\n\t);\n\tconst fillContentX = useTransform(\n\t\t() =>\n\t\t\t`${direction.get() * (1 - fillRatio(fraction.get(), stretch.get(), trackWidth.get())) * 100}%`,\n\t);\n\tconst startIconX = useTransform(\n\t\t() => direction.get() * Math.min(stretch.get(), 0),\n\t);\n\tconst endIconX = useTransform(\n\t\t() => direction.get() * Math.max(stretch.get(), 0),\n\t);\n\tconst startIconScale = useTransform(stretch, (s) =>\n\t\tstretchLimit > 0 ? 1 + (ICON_SCALE * Math.max(-s, 0)) / stretchLimit : 1,\n\t);\n\tconst endIconScale = useTransform(stretch, (s) =>\n\t\tstretchLimit > 0 ? 1 + (ICON_SCALE * Math.max(s, 0)) / stretchLimit : 1,\n\t);\n\n\t/** Inline text fades out while the fill's edge passes through it. */\n\tconst updateTextFade = useCallback(() => {\n\t\tif (!inline) return;\n\t\tconst width = trackWidth.get();\n\t\tif (width <= 0) return;\n\t\tconst s = stretch.get();\n\t\tconst edge = fraction.get() * width + Math.max(s, 0);\n\t\tconst total = width + Math.abs(s);\n\t\tconst { padding } = sizeStyle;\n\t\tconst fade = (from: number, to: number) => {\n\t\t\tif (to <= from) return 1;\n\t\t\tconst distance = Math.max(from - edge, edge - to, 0);\n\t\t\treturn clamp(distance / TEXT_FADE_PX, 0, 1);\n\t\t};\n\t\tconst { label: labelWidth, readout: readoutWidth } = textBoxesRef.current;\n\t\tlabelOpacity.set(fade(padding - 4, padding + labelWidth + 4));\n\t\treadoutOpacity.set(\n\t\t\tfade(total - padding - readoutWidth - 4, total - padding + 4),\n\t\t);\n\t}, [\n\t\tinline,\n\t\tsizeStyle,\n\t\ttrackWidth,\n\t\tstretch,\n\t\tfraction,\n\t\tlabelOpacity,\n\t\treadoutOpacity,\n\t]);\n\n\tuseMotionValueEvent(fraction, \"change\", updateTextFade);\n\tuseMotionValueEvent(stretch, \"change\", updateTextFade);\n\tuseMotionValueEvent(trackWidth, \"change\", updateTextFade);\n\n\t// One observer measures the track and the inline text, so a resize mid-drag stays in step.\n\tuseLayoutEffect(() => {\n\t\tconst row = rowRef.current;\n\t\tconst root = rootRef.current;\n\t\tif (!row || !root) return;\n\t\tconst measure = () => {\n\t\t\tconst isRtl = getComputedStyle(root).direction === \"rtl\";\n\t\t\tdirection.set(isRtl ? -1 : 1);\n\t\t\tsetRtl(isRtl);\n\t\t\ttextBoxesRef.current = {\n\t\t\t\tlabel: labelRef.current?.offsetWidth ?? 0,\n\t\t\t\treadout: readoutRef.current?.offsetWidth ?? 0,\n\t\t\t};\n\t\t\ttrackWidth.set(row.offsetWidth);\n\t\t\tupdateTextFade();\n\t\t};\n\t\tmeasure();\n\t\tconst observer = new ResizeObserver(measure);\n\t\tobserver.observe(row);\n\t\tif (labelRef.current) observer.observe(labelRef.current);\n\t\tif (readoutRef.current) observer.observe(readoutRef.current);\n\t\treturn () => observer.disconnect();\n\t}, [direction, trackWidth, updateTextFade]);\n\n\tconst moveFraction = useCallback(\n\t\t(target: number, transition: \"jump\" | \"drag\" | \"soft\") => {\n\t\t\tfractionAnimationRef.current?.stop();\n\t\t\tfractionAnimationRef.current = null;\n\t\t\tif (shouldReduceMotion || transition === \"jump\") {\n\t\t\t\tfraction.jump(target);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (fraction.get() === target) return;\n\t\t\tfractionAnimationRef.current = animate(\n\t\t\t\tfraction,\n\t\t\t\ttarget,\n\t\t\t\ttransition === \"drag\" ? dragSpring : softSpring,\n\t\t\t);\n\t\t},\n\t\t[fraction, shouldReduceMotion],\n\t);\n\n\tconst releaseStretch = useCallback(() => {\n\t\tstretchAnimationRef.current?.stop();\n\t\tstretchAnimationRef.current = null;\n\t\tif (shouldReduceMotion) {\n\t\t\tstretch.jump(0);\n\t\t\treturn;\n\t\t}\n\t\tif (stretch.get() === 0) return;\n\t\t// Springs carry the stretch's current velocity, so a release keeps its momentum.\n\t\tstretchAnimationRef.current = animate(stretch, 0, softSpring);\n\t}, [shouldReduceMotion, stretch]);\n\n\tconst setThick = useCallback(\n\t\t(active: boolean) => {\n\t\t\tconst target = active ? thick : thin;\n\t\t\tif (shouldReduceMotion) thickness.jump(target);\n\t\t\telse animate(thickness, target, softSpring);\n\t\t},\n\t\t[shouldReduceMotion, thick, thin, thickness],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!dragRef.current?.active) setThick(false);\n\t}, [setThick]);\n\n\t// The fill follows the value; drags move it themselves.\n\tconst targetFraction = scale.fractionOf(value);\n\tuseEffect(() => {\n\t\tif (dragRef.current?.active) return;\n\t\tmoveFraction(targetFraction, \"soft\");\n\t}, [targetFraction, moveFraction]);\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tfractionAnimationRef.current?.stop();\n\t\t\tstretchAnimationRef.current?.stop();\n\t\t},\n\t\t[],\n\t);\n\n\tuseEffect(() => {\n\t\tif (shouldReduceMotion) stretch.jump(0);\n\t}, [shouldReduceMotion, stretch]);\n\n\tconst silent = () =>\n\t\ttypeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n\n\tconst vibrate = (pattern: \"selection\" | \"rigid\" | \"light\") => {\n\t\tif (!haptics) return;\n\t\tlastHapticAtRef.current = performance.now();\n\t\tvoid haptic(pattern);\n\t};\n\n\tconst thunk = () => {\n\t\tif (silent()) return;\n\t\tif (sound) playToggle(false);\n\t\tvibrate(\"rigid\");\n\t};\n\n\t// Called only for user input, so first render and prop changes stay quiet.\n\tconst cue = (previous: number, next: number) => {\n\t\tif (previous === next || silent()) return;\n\t\tconst now = performance.now();\n\t\t// The ends always sound, a little brighter, so a fast drag still lands on them.\n\t\tif (next === lower || next === upper) {\n\t\t\tlastCueAtRef.current = now;\n\t\t\tif (sound) playBrightClick();\n\t\t\tvibrate(\"selection\");\n\t\t\treturn;\n\t\t}\n\t\tconst { ticks } = scale;\n\t\tconst crossed =\n\t\t\tticks === null ||\n\t\t\tticks.some((tick) =>\n\t\t\t\tnext > previous\n\t\t\t\t\t? tick > previous && tick <= next\n\t\t\t\t\t: tick < previous && tick >= next,\n\t\t\t);\n\t\tif (!crossed || now - lastCueAtRef.current < CUE_THROTTLE_MS) return;\n\t\tlastCueAtRef.current = now;\n\t\tif (sound) playClick();\n\t\tvibrate(\"selection\");\n\t};\n\n\tconst commit = (next: number) => {\n\t\tonValueCommit?.(next);\n\t\t// A tick's haptic already confirmed this change; don't double up.\n\t\tif (performance.now() - lastHapticAtRef.current > CUE_THROTTLE_MS) {\n\t\t\tif (!silent()) vibrate(\"light\");\n\t\t}\n\t};\n\n\tconst setValue = (next: number) => {\n\t\tconst previous = valueRef.current;\n\t\tif (next === previous) return false;\n\t\tvalueRef.current = next;\n\t\tsetInternalValue(next);\n\t\tonValueChange?.(next);\n\t\tcue(previous, next);\n\t\treturn true;\n\t};\n\n\t/** A tiny one-shot stretch past an end, for keys pressed at a limit. */\n\tconst bump = (towards: Direction) => {\n\t\tthunk();\n\t\tif (shouldReduceMotion || stretchLimit <= 0) return;\n\t\tstretchAnimationRef.current?.stop();\n\t\tconst controls = animate(stretch, towards * stretchLimit * BUMP_STRETCH, {\n\t\t\tduration: 0.08,\n\t\t\tease: \"easeOut\",\n\t\t});\n\t\tstretchAnimationRef.current = controls;\n\t\tvoid controls.then(() => {\n\t\t\tif (stretchAnimationRef.current === controls) releaseStretch();\n\t\t});\n\t};\n\n\tconst isRtl = () => {\n\t\tconst root = rootRef.current;\n\t\tconst next = root ? getComputedStyle(root).direction === \"rtl\" : false;\n\t\tdirection.set(next ? -1 : 1);\n\t\tsetRtl(next);\n\t\treturn next;\n\t};\n\n\t/** The pointer's position along the track, in local px from the start edge. */\n\tconst pointerOffset = (clientX: number) => {\n\t\tconst row = rowRef.current;\n\t\tif (!row) return { offset: 0, width: 0 };\n\t\tconst rect = row.getBoundingClientRect();\n\t\tconst width = row.offsetWidth;\n\t\t// CSS zoom and transforms scale client coordinates; work in local px.\n\t\tconst ratio = rect.width / (width || 1) || 1;\n\t\tconst fromLeft = (clientX - rect.left) / ratio;\n\t\treturn {\n\t\t\toffset: direction.get() < 0 ? width - fromLeft : fromLeft,\n\t\t\twidth,\n\t\t};\n\t};\n\n\tconst valueAtOffset = (offset: number, width: number) => {\n\t\tconst f = width > 0 ? clamp(offset / width, 0, 1) : 0;\n\t\tconst raw = lower + f * (upper - lower);\n\t\t// Within a few px of a mark, the value sticks to it.\n\t\tfor (const mark of scale.marks) {\n\t\t\tif (\n\t\t\t\tMath.abs(scale.fractionOf(mark.value) * width - f * width) <=\n\t\t\t\tMARK_STICK_PX\n\t\t\t) {\n\t\t\t\treturn mark.value;\n\t\t\t}\n\t\t}\n\t\treturn scale.snap(raw);\n\t};\n\n\tconst stepPx = () =>\n\t\t(trackWidth.get() * scale.step) / Math.max(upper - lower, scale.step);\n\n\t/** Moves to the pointer: sets the value, the fill, and any stretch past the ends. */\n\tconst followPointer = (clientX: number, jumped: boolean) => {\n\t\tconst drag = dragRef.current;\n\t\tconst { offset, width } = pointerOffset(clientX);\n\t\tconst next = valueAtOffset(offset, width);\n\t\tsetValue(next);\n\t\tconst onMark = scale.marks.some((mark) => mark.value === next);\n\t\tconst transition = jumped\n\t\t\t? \"soft\"\n\t\t\t: onMark || stepPx() > 3\n\t\t\t\t? \"drag\"\n\t\t\t\t: \"jump\";\n\t\tmoveFraction(scale.fractionOf(next), transition);\n\n\t\tconst over = offset < 0 ? offset : offset > width ? offset - width : 0;\n\t\tif (drag) {\n\t\t\tif (Math.abs(over) >= OVERDRAG_THUNK_PX) {\n\t\t\t\t// One thunk per pull past an end, not one per move.\n\t\t\t\tif (!drag.overdragged) thunk();\n\t\t\t\tdrag.overdragged = true;\n\t\t\t} else if (over === 0) {\n\t\t\t\tdrag.overdragged = false;\n\t\t\t}\n\t\t}\n\t\tif (shouldReduceMotion) return;\n\t\tstretchAnimationRef.current?.stop();\n\t\tstretchAnimationRef.current = null;\n\t\tstretch.set(Math.sign(over) * resist(Math.abs(over), stretchLimit));\n\t};\n\n\tconst activate = (clientX: number) => {\n\t\tconst drag = dragRef.current;\n\t\tif (!drag || drag.active) return;\n\t\tdrag.active = true;\n\t\tsetDragging(true);\n\t\tsetThick(true);\n\t\tfollowPointer(clientX, true);\n\t};\n\n\tconst handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n\t\t// Ignore second fingers and non-primary buttons.\n\t\tif (inactive || !event.isPrimary || event.button !== 0 || dragRef.current) {\n\t\t\treturn;\n\t\t}\n\t\tisRtl();\n\t\tevent.currentTarget.setPointerCapture(event.pointerId);\n\t\tdragRef.current = {\n\t\t\tpointerId: event.pointerId,\n\t\t\tactive: false,\n\t\t\toriginX: event.clientX,\n\t\t\toriginY: event.clientY,\n\t\t\tstartValue: valueRef.current,\n\t\t\toverdragged: false,\n\t\t};\n\t\t// A touch might be the start of a vertical page scroll; wait until it moves sideways or lifts.\n\t\tif (event.pointerType !== \"touch\") activate(event.clientX);\n\t};\n\n\tconst handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n\t\tconst drag = dragRef.current;\n\t\tif (!drag || drag.pointerId !== event.pointerId) return;\n\t\tif (!drag.active) {\n\t\t\tconst dx = Math.abs(event.clientX - drag.originX);\n\t\t\tconst dy = Math.abs(event.clientY - drag.originY);\n\t\t\tif (dx < TOUCH_SLOP || dx < dy) return;\n\t\t\tactivate(event.clientX);\n\t\t\treturn;\n\t\t}\n\t\tfollowPointer(event.clientX, false);\n\t};\n\n\tconst endDrag = (\n\t\tevent: PointerEvent<HTMLDivElement>,\n\t\treason: \"up\" | \"cancel\",\n\t) => {\n\t\tconst drag = dragRef.current;\n\t\tif (!drag || drag.pointerId !== event.pointerId) return;\n\t\t// A lifted tap counts as a click; a cancelled touch was a page scroll.\n\t\tif (!drag.active && reason === \"up\") activate(event.clientX);\n\t\tdragRef.current = null;\n\t\tconst row = rowRef.current;\n\t\tif (row?.hasPointerCapture(drag.pointerId)) {\n\t\t\trow.releasePointerCapture(drag.pointerId);\n\t\t}\n\t\tif (!drag.active) return;\n\t\tsetDragging(false);\n\t\tsetThick(false);\n\t\treleaseStretch();\n\t\tmoveFraction(scale.fractionOf(valueRef.current), \"soft\");\n\t\tif (valueRef.current !== drag.startValue) commit(valueRef.current);\n\t};\n\n\tconst handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n\t\tif (inactive) return;\n\t\t// Left and right follow the reading direction, like a native range input.\n\t\tconst forward: Direction = isRtl() ? -1 : 1;\n\t\tconst from = valueRef.current;\n\t\tconst by = (towards: Direction): [number, Direction] => [\n\t\t\tevent.shiftKey\n\t\t\t\t? scale.snap(from + towards * bigStep)\n\t\t\t\t: scale.stepFrom(from, towards),\n\t\t\ttowards,\n\t\t];\n\t\tconst moves: Record<string, () => [number, Direction]> = {\n\t\t\tArrowUp: () => by(1),\n\t\t\tArrowDown: () => by(-1),\n\t\t\tArrowRight: () => by(forward),\n\t\t\tArrowLeft: () => by(-forward as Direction),\n\t\t\tPageUp: () => [scale.snap(from + bigStep), 1],\n\t\t\tPageDown: () => [scale.snap(from - bigStep), -1],\n\t\t\tHome: () => [lower, -1],\n\t\t\tEnd: () => [upper, 1],\n\t\t};\n\t\tconst move = moves[event.key];\n\t\tif (!move) return;\n\t\tevent.preventDefault();\n\t\tconst [target, towards] = move();\n\t\tconst next = clamp(target, lower, upper);\n\t\tif (setValue(next)) commit(next);\n\t\telse if (!event.repeat) bump(towards);\n\t};\n\n\tconst selectMark = (markValue: number) => {\n\t\tif (inactive) return;\n\t\tif (setValue(markValue)) commit(markValue);\n\t\trowRef.current?.focus({ preventScroll: true });\n\t};\n\n\t// iOS can still scroll the page under a captured pointer; block it mid-drag.\n\tuseEffect(() => {\n\t\tconst row = rowRef.current;\n\t\tif (!row) return;\n\t\tconst onTouchMove = (event: TouchEvent) => {\n\t\t\tif (dragRef.current?.active) event.preventDefault();\n\t\t};\n\t\trow.addEventListener(\"touchmove\", onTouchMove, { passive: false });\n\t\treturn () => row.removeEventListener(\"touchmove\", onTouchMove);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!inactive) return;\n\t\tdragRef.current = null;\n\t\tsetDragging(false);\n\t\tsetThick(false);\n\t\treleaseStretch();\n\t}, [inactive, setThick, releaseStretch]);\n\n\t// Re-measure the readout after its text changes width.\n\tuseLayoutEffect(() => {\n\t\tif (!inline) return;\n\t\tconst readoutWidth = readoutRef.current?.offsetWidth ?? 0;\n\t\tif (readoutWidth === textBoxesRef.current.readout) return;\n\t\ttextBoxesRef.current.readout = readoutWidth;\n\t\tupdateTextFade();\n\t});\n\n\tconst readout = (\n\t\t<Readout\n\t\t\tvalue={value}\n\t\t\ttext={valueText}\n\t\t\tformatted={Boolean(format)}\n\t\t\tdecimals={scale.decimals}\n\t\t\tanimated={!shouldReduceMotion}\n\t\t/>\n\t);\n\tconst labelledMarks = scale.marks.some((mark) => mark.label);\n\tconst hitInset = Math.max(0, (MIN_HIT_PX - thick) / 2);\n\n\treturn (\n\t\t<div\n\t\t\tref={rootRef}\n\t\t\tdata-slot=\"elastic-slider\"\n\t\t\tdata-variant={variant}\n\t\t\tdata-size={size}\n\t\t\tdata-state={dragging ? \"dragging\" : \"idle\"}\n\t\t\tdata-bound={value === lower ? \"min\" : value === upper ? \"max\" : undefined}\n\t\t\tdata-disabled={inactive || undefined}\n\t\t\tclassName={cn(\n\t\t\t\t\"group/elastic-slider flex w-full min-w-0 touch-pan-y select-none flex-col [-webkit-tap-highlight-color:transparent] data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n\t\t\t\tsizeStyle.text,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{inline ? (\n\t\t\t\thideLabel ? (\n\t\t\t\t\t<span id={labelId} className=\"sr-only\">\n\t\t\t\t\t\t{label}\n\t\t\t\t\t</span>\n\t\t\t\t) : null\n\t\t\t) : (\n\t\t\t\t<div\n\t\t\t\t\tdata-slot=\"elastic-slider-header\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"mb-2 flex items-baseline justify-between gap-3\",\n\t\t\t\t\t\thideLabel && \"justify-end\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={labelId}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"truncate font-medium text-foreground\",\n\t\t\t\t\t\t\thideLabel && \"sr-only\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{label}\n\t\t\t\t\t</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\tdata-slot=\"elastic-slider-value\"\n\t\t\t\t\t\tclassName=\"shrink-0 text-muted-foreground tabular-nums\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{readout}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t<div className={cn(\"flex items-start\", sizeStyle.gap)}>\n\t\t\t\t{startIcon ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\tclassName=\"flex shrink-0 items-center\"\n\t\t\t\t\t\tstyle={{ height: thick }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\tdata-slot=\"elastic-slider-start-icon\"\n\t\t\t\t\t\t\tclassName={cn(\"flex text-muted-foreground\", sizeStyle.icon)}\n\t\t\t\t\t\t\tstyle={{ x: startIconX, scale: startIconScale }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{startIcon}\n\t\t\t\t\t\t</motion.span>\n\t\t\t\t\t</span>\n\t\t\t\t) : null}\n\n\t\t\t\t<div className=\"min-w-0 flex-1\">\n\t\t\t\t\t{/* The whole hit area is the slider, so a click focuses it natively and never shows a focus ring. */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={rowRef}\n\t\t\t\t\t\trole=\"slider\"\n\t\t\t\t\t\ttabIndex={inactive ? -1 : 0}\n\t\t\t\t\t\taria-labelledby={labelId}\n\t\t\t\t\t\taria-valuemin={lower}\n\t\t\t\t\t\taria-valuemax={upper}\n\t\t\t\t\t\taria-valuenow={value}\n\t\t\t\t\t\taria-valuetext={valueText}\n\t\t\t\t\t\taria-orientation=\"horizontal\"\n\t\t\t\t\t\taria-disabled={inactive || undefined}\n\t\t\t\t\t\tdata-slot=\"elastic-slider-thumb\"\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\tonPointerDown={handlePointerDown}\n\t\t\t\t\t\tonPointerMove={handlePointerMove}\n\t\t\t\t\t\tonPointerUp={(event) => endDrag(event, \"up\")}\n\t\t\t\t\t\tonPointerCancel={(event) => endDrag(event, \"cancel\")}\n\t\t\t\t\t\tonLostPointerCapture={(event) => endDrag(event, \"cancel\")}\n\t\t\t\t\t\tonContextMenu={(event) => {\n\t\t\t\t\t\t\tif (dragRef.current) event.preventDefault();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tclassName=\"group/elastic-slider-thumb relative cursor-pointer outline-none [-webkit-touch-callout:none] group-data-disabled/elastic-slider:pointer-events-none\"\n\t\t\t\t\t\tstyle={{ height: thick }}\n\t\t\t\t\t>\n\t\t\t\t\t\t{/* Keeps the hit target at least 44px tall while the track is thin. */}\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\tclassName=\"absolute inset-x-0\"\n\t\t\t\t\t\t\tstyle={{ top: -hitInset, bottom: -hitInset }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tdata-slot=\"elastic-slider-track\"\n\t\t\t\t\t\t\tclassName=\"absolute inset-y-0 my-auto rounded-full group-focus-visible/elastic-slider-thumb:ring-3 group-focus-visible/elastic-slider-thumb:ring-ring/50 group-focus-visible/elastic-slider-thumb:ring-offset-2 group-focus-visible/elastic-slider-thumb:ring-offset-background\"\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tinsetInlineStart: trackStart,\n\t\t\t\t\t\t\t\tinsetInlineEnd: trackEnd,\n\t\t\t\t\t\t\t\theight: trackHeight,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"absolute inset-0 isolate overflow-hidden rounded-full bg-muted\">\n\t\t\t\t\t\t\t\t{inline ? (\n\t\t\t\t\t\t\t\t\t<InlineText\n\t\t\t\t\t\t\t\t\t\tlabelRef={labelRef}\n\t\t\t\t\t\t\t\t\t\treadoutRef={readoutRef}\n\t\t\t\t\t\t\t\t\t\tlabelId={labelId}\n\t\t\t\t\t\t\t\t\t\tlabel={hideLabel ? null : label}\n\t\t\t\t\t\t\t\t\t\treadout={readout}\n\t\t\t\t\t\t\t\t\t\tpadding={sizeStyle.padding}\n\t\t\t\t\t\t\t\t\t\tlabelOpacity={labelOpacity}\n\t\t\t\t\t\t\t\t\t\treadoutOpacity={readoutOpacity}\n\t\t\t\t\t\t\t\t\t\tclassName=\"text-foreground\"\n\t\t\t\t\t\t\t\t\t\treadoutClassName=\"text-muted-foreground\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tdata-slot=\"elastic-slider-fill\"\n\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0 overflow-hidden bg-foreground\"\n\t\t\t\t\t\t\t\t\tstyle={{ x: fillX }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{inline ? (\n\t\t\t\t\t\t\t\t\t\t// The same text in the background color, pinned to the track as the fill slides.\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ x: fillContentX }}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<InlineText\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={hideLabel ? null : label}\n\t\t\t\t\t\t\t\t\t\t\t\treadout={readout}\n\t\t\t\t\t\t\t\t\t\t\t\tpadding={sizeStyle.padding}\n\t\t\t\t\t\t\t\t\t\t\t\tlabelOpacity={labelOpacity}\n\t\t\t\t\t\t\t\t\t\t\t\treadoutOpacity={readoutOpacity}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"text-background\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{scale.marks.length ? (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\tdata-slot=\"elastic-slider-marks\"\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"pointer-events-none relative mt-1.5\",\n\t\t\t\t\t\t\t\tlabelledMarks ? \"h-6\" : \"h-1\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{scale.marks.map((mark) => {\n\t\t\t\t\t\t\t\tconst f = scale.fractionOf(mark.value);\n\t\t\t\t\t\t\t\tconst shift = (rtl ? 100 : -100) * labelShift(f);\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tkey={mark.value}\n\t\t\t\t\t\t\t\t\t\tclassName=\"absolute top-0\"\n\t\t\t\t\t\t\t\t\t\tstyle={{ insetInlineStart: `${f * 100}%` }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"absolute top-0 h-1 w-px bg-foreground/20\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\tinsetInlineStart: 0,\n\t\t\t\t\t\t\t\t\t\t\t\ttranslate: `${rtl ? 50 : -50}% 0`,\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{mark.label ? (\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\t\t\t\tdisabled={inactive}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => selectMark(mark.value)}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"pointer-events-auto absolute top-1.5 cursor-pointer whitespace-nowrap px-0.5 text-xs tabular-nums leading-4 transition-colors duration-150 disabled:cursor-not-allowed\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tmark.value === value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? \"text-foreground\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: \"text-muted-foreground hover:text-foreground\",\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\tinsetInlineStart: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttranslate: `${shift}% 0`,\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{mark.label}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\n\t\t\t\t{endIcon ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\tclassName=\"flex shrink-0 items-center\"\n\t\t\t\t\t\tstyle={{ height: thick }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\tdata-slot=\"elastic-slider-end-icon\"\n\t\t\t\t\t\t\tclassName={cn(\"flex text-muted-foreground\", sizeStyle.icon)}\n\t\t\t\t\t\t\tstyle={{ x: endIconX, scale: endIconScale }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{endIcon}\n\t\t\t\t\t\t</motion.span>\n\t\t\t\t\t</span>\n\t\t\t\t) : null}\n\t\t\t</div>\n\n\t\t\t{name ? (\n\t\t\t\t<input type=\"hidden\" name={name} value={value} disabled={inactive} />\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nfunction InlineText({\n\tlabelRef,\n\treadoutRef,\n\tlabelId,\n\tlabel,\n\treadout,\n\tpadding,\n\tlabelOpacity,\n\treadoutOpacity,\n\tclassName,\n\treadoutClassName,\n}: {\n\tlabelRef?: Ref<HTMLSpanElement>;\n\treadoutRef?: Ref<HTMLSpanElement>;\n\tlabelId?: string;\n\tlabel: string | null;\n\treadout: ReactNode;\n\tpadding: number;\n\tlabelOpacity: MotionValue<number>;\n\treadoutOpacity: MotionValue<number>;\n\tclassName?: string;\n\treadoutClassName?: string;\n}) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"pointer-events-none absolute inset-0 flex items-center justify-between gap-3 font-medium\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={{ paddingInline: padding }}\n\t\t>\n\t\t\t{label !== null ? (\n\t\t\t\t<motion.span\n\t\t\t\t\tref={labelRef}\n\t\t\t\t\tid={labelId}\n\t\t\t\t\tclassName=\"truncate\"\n\t\t\t\t\tstyle={{ opacity: labelOpacity }}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</motion.span>\n\t\t\t) : (\n\t\t\t\t<span />\n\t\t\t)}\n\t\t\t<motion.span\n\t\t\t\tref={readoutRef}\n\t\t\t\taria-hidden\n\t\t\t\tdata-slot=\"elastic-slider-value\"\n\t\t\t\tclassName={cn(\"shrink-0 tabular-nums\", readoutClassName)}\n\t\t\t\tstyle={{ opacity: readoutOpacity }}\n\t\t\t>\n\t\t\t\t{readout}\n\t\t\t</motion.span>\n\t\t</div>\n\t);\n}\n\nexport default ElasticSlider;\n",
      "type": "registry:component",
      "target": "@components/elastic-slider.tsx"
    }
  ],
  "meta": {
    "createdAt": "2026-11-02",
    "image": "https://cdn.tentui.com/images/components/elastic-slider",
    "video": "https://cdn.tentui.com/videos/components/elastic-slider"
  },
  "docs": "https://tentui.com/components/elastic-slider",
  "categories": [
    "inputs"
  ],
  "type": "registry:component"
}