{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "rotary-knob",
  "title": "Rotary Knob",
  "description": "A hardware-style dial you turn by dragging, scrolling, or with the keyboard, with a tick and a haptic notch on every detent and a thunk at the end stops.",
  "dependencies": [
    "@rexa-developer/tiks",
    "motion",
    "web-haptics"
  ],
  "files": [
    {
      "path": "src/registry/components/rotary-knob/rotary-knob.tsx",
      "content": "\"use client\";\n\nimport { useTiks } from \"@rexa-developer/tiks/react\";\nimport {\n\ttype AnimationPlaybackControls,\n\tanimate,\n\tmotion,\n\tuseMotionValue,\n\tuseReducedMotion,\n\tuseTransform,\n} from \"motion/react\";\nimport {\n\ttype CSSProperties,\n\ttype KeyboardEvent,\n\ttype PointerEvent,\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport { useWebHaptics } from \"web-haptics/react\";\nimport { cn } from \"@/lib/utils\";\n\nconst detentSpring = { type: \"spring\", stiffness: 600, damping: 32 } as const;\n\n/** Pointer travel, in px, that turns the knob through its whole range. */\nconst DRAG_TRAVEL_PX = 200;\n/** Drag and trackpad speed while `Shift` is held. */\nconst FINE_FACTOR = 0.1;\n/** Pointer travel, in px, before a press becomes a drag. */\nconst DRAG_SLOP = 3;\n/** Extra travel, in detents, before the knob leaves its current detent. */\nconst HYSTERESIS = 0.08;\n/** Furthest the pointer rubber-bands past an end stop, in degrees. */\nconst MAX_BAND_DEG = 8;\n/** How far past an end stop a drag winds up, as a fraction of the range. */\nconst MAX_WINDUP = 0.25;\n/** Spin, in deg/s, the pointer gets when it bumps an end stop. */\nconst BUMP_VELOCITY = 240;\n/** Minimum ms between detent sounds and haptics. */\nconst CUE_THROTTLE_MS = 35;\n/** Ms of wheel quiet that starts a new wheel gesture. */\nconst WHEEL_IDLE_MS = 200;\n/** A wheel delta of at least this many px is one mouse notch. */\nconst WHEEL_NOTCH_PX = 50;\n/** Circular drags ignore the pointer this close to the center, in px. */\nconst CIRCULAR_DEAD_ZONE = 6;\n\n/** All lengths in px. `cap` and `arcInset` are measured in from the dial edge. */\nconst sizes = {\n\tsm: {\n\t\tdial: 72,\n\t\ttick: 5,\n\t\tarc: 3,\n\t\tarcInset: 9,\n\t\tcap: 16,\n\t\tlabelSpace: 18,\n\t\tmaxTicks: 24,\n\t\tlabel: \"text-[10px]\",\n\t\tvalue: \"text-xs\",\n\t},\n\tmd: {\n\t\tdial: 112,\n\t\ttick: 7,\n\t\tarc: 4,\n\t\tarcInset: 12,\n\t\tcap: 22,\n\t\tlabelSpace: 24,\n\t\tmaxTicks: 36,\n\t\tlabel: \"text-[11px]\",\n\t\tvalue: \"text-sm\",\n\t},\n\tlg: {\n\t\tdial: 152,\n\t\ttick: 9,\n\t\tarc: 5,\n\t\tarcInset: 16,\n\t\tcap: 30,\n\t\tlabelSpace: 28,\n\t\tmaxTicks: 48,\n\t\tlabel: \"text-xs\",\n\t\tvalue: \"text-base\",\n\t},\n} as const;\n\ntype Variant = \"default\" | \"minimal\" | \"tactile\";\ntype Direction = 1 | -1;\n\nexport interface RotaryKnobStop {\n\tvalue: number;\n\tlabel: string;\n}\n\nexport interface RotaryKnobProps {\n\t/** Controlled value. */\n\tvalue?: number;\n\t/** Initial value when uncontrolled; double-click resets to it. */\n\tdefaultValue?: number;\n\t/** Called every time the knob lands on a new detent. */\n\tonValueChange?: (value: number) => void;\n\t/** Called once a drag is released, or a key, wheel step, or reset lands. */\n\tonValueCommit?: (value: number) => void;\n\tmin?: number;\n\tmax?: number;\n\tstep?: number;\n\t/** Labelled detents drawn around the dial. Replaces `min`, `max`, and `step`. */\n\tstops?: RotaryKnobStop[];\n\t/** Degrees of travel, centered at the top. */\n\tangleRange?: number;\n\t/** `vertical` turns as you drag up and down; `circular` follows the pointer around the dial. */\n\tdragMode?: \"vertical\" | \"circular\";\n\tsize?: keyof typeof sizes;\n\t/** `minimal` is a ring and pointer; `tactile` is a raised, knurled cap. */\n\tvariant?: Variant;\n\t/** Show the value under the knob. */\n\tshowValue?: boolean;\n\t/** Formats the readout and `aria-valuetext`. Stop labels are used when `stops` is set. */\n\tformatValue?: (value: number) => string;\n\t/** Play a tick per detent and a lower thunk at the end stops. */\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\t\"aria-label\"?: string;\n\t\"aria-labelledby\"?: 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/** Pulls travel past an end stop back so it never exceeds `MAX_BAND_DEG`. */\nfunction rubberBand(overDegrees: number) {\n\tconst distance = Math.abs(overDegrees);\n\treturn (\n\t\t(Math.sign(overDegrees) * MAX_BAND_DEG * distance) /\n\t\t(distance + MAX_BAND_DEG)\n\t);\n}\n\n/** Wraps an angle difference into -180..180. */\nfunction wrapDegrees(degrees: number) {\n\treturn ((((degrees + 180) % 360) + 360) % 360) - 180;\n}\n\ninterface Detents {\n\t/** Index of the last detent; the first is 0. */\n\tcount: number;\n\tlower: number;\n\tupper: number;\n\tdecimals: number;\n\t/** Labelled stops: a fast spin passes through each one. */\n\tlabelled: boolean;\n\tvalueAt: (index: number) => number;\n\tlabelAt: (index: number) => string | undefined;\n\t/** Position of a detent along the travel, 0 to 1. */\n\tfractionAt: (index: number) => number;\n\t/** Nearest detent to a value, clamped to the range. */\n\tindexOf: (value: number) => number;\n\t/** Converts a 0 to 1 travel position to a fractional detent index. */\n\ttoIndexSpace: (fraction: number) => number;\n}\n\nfunction buildDetents(\n\tmin: number,\n\tmax: number,\n\tstep: number,\n\tstops?: RotaryKnobStop[],\n): Detents {\n\tconst sorted = (stops ?? [])\n\t\t.filter((stop) => Number.isFinite(stop.value))\n\t\t.sort((a, b) => a.value - b.value)\n\t\t.filter((stop, index, list) => stop.value !== list[index - 1]?.value);\n\n\tif (sorted.length) {\n\t\tconst first = sorted[0].value;\n\t\tconst span = (sorted[sorted.length - 1]?.value ?? first) - first;\n\t\t// Stops sit around the dial in proportion to their values.\n\t\tconst fractions = sorted.map((stop) =>\n\t\t\tspan > 0 ? (stop.value - first) / span : 0,\n\t\t);\n\t\tconst count = sorted.length - 1;\n\t\treturn {\n\t\t\tcount,\n\t\t\tlower: first,\n\t\t\tupper: first + span,\n\t\t\tdecimals: Math.max(...sorted.map((stop) => decimalsOf(stop.value))),\n\t\t\tlabelled: true,\n\t\t\tvalueAt: (index) => sorted[index]?.value ?? first,\n\t\t\tlabelAt: (index) => sorted[index]?.label,\n\t\t\tfractionAt: (index) => fractions[index] ?? 0,\n\t\t\tindexOf: (value) => {\n\t\t\t\tif (!Number.isFinite(value)) return 0;\n\t\t\t\tlet nearest = 0;\n\t\t\t\tfor (let index = 1; index <= count; index++) {\n\t\t\t\t\tconst distance = Math.abs((sorted[index]?.value ?? 0) - value);\n\t\t\t\t\tif (distance < Math.abs((sorted[nearest]?.value ?? 0) - value)) {\n\t\t\t\t\t\tnearest = index;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nearest;\n\t\t\t},\n\t\t\ttoIndexSpace: (fraction) => {\n\t\t\t\tfor (let index = 0; index < count; index++) {\n\t\t\t\t\tconst from = fractions[index] ?? 0;\n\t\t\t\t\tconst to = fractions[index + 1] ?? 1;\n\t\t\t\t\tif (fraction <= to) {\n\t\t\t\t\t\treturn index + (to > from ? (fraction - from) / (to - from) : 0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn count;\n\t\t\t},\n\t\t};\n\t}\n\n\tconst safeStep = Number.isFinite(step) && step > 0 ? step : 1;\n\tconst lower = Number.isFinite(min) ? min : 0;\n\tconst top = Number.isFinite(max) ? Math.max(max, lower) : lower;\n\t// Steps are anchored at `min`; the last detent is the last step within `max`.\n\tconst count = Math.floor(Number(((top - lower) / safeStep).toFixed(9)));\n\tconst decimals = Math.max(decimalsOf(safeStep), decimalsOf(lower));\n\t// Round to the step's precision so 0.1 + 0.2 lands on 0.3.\n\tconst valueAt = (index: number) =>\n\t\tNumber((lower + index * safeStep).toFixed(decimals));\n\treturn {\n\t\tcount,\n\t\tlower,\n\t\tupper: valueAt(count),\n\t\tdecimals,\n\t\tlabelled: false,\n\t\tvalueAt,\n\t\tlabelAt: () => undefined,\n\t\tfractionAt: (index) => (count > 0 ? index / count : 0),\n\t\tindexOf: (value) => {\n\t\t\tif (!Number.isFinite(value)) return 0;\n\t\t\t// The ratio is rounded first so 0.175 / 0.05 counts as 3.5, not 3.4999….\n\t\t\tconst steps = Number(((value - lower) / safeStep).toFixed(9));\n\t\t\treturn clamp(Math.round(steps), 0, count);\n\t\t},\n\t\ttoIndexSpace: (fraction) => fraction * count,\n\t};\n}\n\n/** Detents that get a tick mark: all of them, or an even 1-2-5 stride on long ranges. */\nfunction tickIndexes(detents: Detents, maxTicks: number, fullCircle: boolean) {\n\tconst { count } = detents;\n\tlet stride = 1;\n\tif (!detents.labelled) {\n\t\tfor (let k = 1; count / stride > maxTicks; k++) {\n\t\t\tstride = [1, 2, 5][k % 3] * 10 ** Math.floor(k / 3);\n\t\t}\n\t}\n\tconst indexes: number[] = [];\n\tfor (let index = 0; index <= count; index += stride) indexes.push(index);\n\tconst last = indexes[indexes.length - 1] ?? 0;\n\tif (last !== count) {\n\t\t// Keep the end stop marked without crowding the tick before it.\n\t\tif (count - last < stride / 2) indexes.pop();\n\t\tindexes.push(count);\n\t}\n\t// On a full turn the last tick would sit on top of the first.\n\tif (fullCircle && count > 0 && detents.fractionAt(count) >= 1) indexes.pop();\n\treturn indexes;\n}\n\n/** A ring `mask-image` that keeps the outer `width` px of a circle. */\nfunction ringMask(width: number): CSSProperties {\n\tconst mask = `radial-gradient(closest-side, transparent calc(100% - ${width + 0.5}px), #000 calc(100% - ${width}px), #000 calc(100% - 0.5px), transparent 100%)`;\n\treturn { maskImage: mask, WebkitMaskImage: mask };\n}\n\nexport function RotaryKnob({\n\tvalue: valueProp,\n\tdefaultValue,\n\tonValueChange,\n\tonValueCommit,\n\tmin = 0,\n\tmax = 100,\n\tstep = 1,\n\tstops,\n\tangleRange = 270,\n\tdragMode = \"vertical\",\n\tsize = \"md\",\n\tvariant = \"default\",\n\tshowValue,\n\tformatValue,\n\tsound = true,\n\thaptics = true,\n\tdisabled = false,\n\tname,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledBy,\n\tclassName,\n}: RotaryKnobProps) {\n\tconst sizeStyle = sizes[size];\n\tconst detents = buildDetents(min, max, step, stops);\n\tconst { count } = detents;\n\tconst range = clamp(Number.isFinite(angleRange) ? angleRange : 270, 0, 360);\n\tconst start = -range / 2;\n\tconst sweepAt = (index: number) => detents.fractionAt(index) * range;\n\n\tconst controlled = valueProp !== undefined;\n\tconst [internalIndex, setInternalIndex] = useState(() =>\n\t\tdetents.indexOf(valueProp ?? defaultValue ?? detents.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\tconst index = Math.min(\n\t\tcontrolled && !dragging ? detents.indexOf(valueProp) : internalIndex,\n\t\tcount,\n\t);\n\tconst value = detents.valueAt(index);\n\tconst stopLabel = detents.labelAt(index);\n\tconst valueText =\n\t\tstopLabel ??\n\t\t(formatValue ? formatValue(value) : value.toFixed(detents.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\n\tconst knobRef = useRef<HTMLDivElement>(null);\n\t// Degrees the pointer has turned from the start of its travel.\n\tconst sweep = useMotionValue(sweepAt(index));\n\tconst rangeRef = useRef(range);\n\tconst animationRef = useRef<AnimationPlaybackControls | null>(null);\n\tconst indexRef = useRef(index);\n\tconst bandRef = useRef(0);\n\tconst lastCueAtRef = useRef(Number.NEGATIVE_INFINITY);\n\tconst pressMovedRef = useRef(false);\n\tconst wheelRef = useRef({\n\t\traw: 0,\n\t\tat: Number.NEGATIVE_INFINITY,\n\t\tbumped: false,\n\t});\n\tconst dragRef = useRef<{\n\t\tpointerId: number;\n\t\tstartIndex: number;\n\t\traw: number;\n\t\toriginX: number;\n\t\toriginY: number;\n\t\tlastY: number;\n\t\tlastAngle: number | null;\n\t\tcenterX: number;\n\t\tcenterY: number;\n\t\tscale: number;\n\t\tmoved: boolean;\n\t} | null>(null);\n\n\tuseLayoutEffect(() => {\n\t\tindexRef.current = index;\n\t\trangeRef.current = range;\n\t});\n\n\t// The value arc is two half discs that rotate behind a ring mask, so it\n\t// fills with transforms alone. Ranges are read from a ref to stay current.\n\tconst firstHalf = useTransform(sweep, (s) =>\n\t\tclamp(Math.min(s, rangeRef.current), 0, 180),\n\t);\n\tconst secondHalf = useTransform(sweep, (s) =>\n\t\tclamp(Math.min(s, rangeRef.current) - 180, 0, 180),\n\t);\n\tconst arcEnd = useTransform(sweep, (s) => clamp(s, 0, rangeRef.current));\n\tconst arcOpacity = useTransform(sweep, (s) => (s > 0.5 ? 1 : 0));\n\n\tconst springTo = useCallback(\n\t\t(target: number, velocity?: number) => {\n\t\t\tanimationRef.current?.stop();\n\t\t\tanimationRef.current = null;\n\t\t\tif (shouldReduceMotion) {\n\t\t\t\tsweep.jump(target);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tvelocity === undefined &&\n\t\t\t\tsweep.get() === target &&\n\t\t\t\tsweep.getVelocity() === 0\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tanimationRef.current = animate(sweep, target, {\n\t\t\t\t...detentSpring,\n\t\t\t\t...(velocity === undefined ? null : { velocity }),\n\t\t\t\trestDelta: 0.01,\n\t\t\t});\n\t\t},\n\t\t[shouldReduceMotion, sweep],\n\t);\n\n\t// The pointer always heads for the current detent, plus any rubber band.\n\tconst targetSweep = sweepAt(index);\n\tuseEffect(() => {\n\t\tspringTo(targetSweep + bandRef.current);\n\t}, [targetSweep, springTo]);\n\n\tuseEffect(() => () => animationRef.current?.stop(), []);\n\n\tconst silent = () =>\n\t\ttypeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n\n\tconst thunk = () => {\n\t\tlastCueAtRef.current = performance.now();\n\t\tif (silent()) return;\n\t\tif (sound) playToggle(false);\n\t\tif (haptics) void haptic(\"medium\");\n\t};\n\n\t// Called only for user input, so first render and prop changes stay quiet.\n\tconst cue = (next: number) => {\n\t\t// End stops always sound so a fast spin still ends on the thunk.\n\t\tif (next === 0 || next === count) {\n\t\t\tthunk();\n\t\t\treturn;\n\t\t}\n\t\tconst now = performance.now();\n\t\tif (now - lastCueAtRef.current < CUE_THROTTLE_MS) return;\n\t\tlastCueAtRef.current = now;\n\t\tif (silent()) return;\n\t\tif (sound) playClick();\n\t\tif (haptics) void haptic(\"selection\");\n\t};\n\n\t// Pushing into an end stop: a thunk and a spring kick past the stop.\n\tconst bump = (direction: Direction) => {\n\t\tthunk();\n\t\tif (!shouldReduceMotion) {\n\t\t\tspringTo(sweepAt(indexRef.current), direction * BUMP_VELOCITY);\n\t\t}\n\t};\n\n\tconst moveTo = (target: number, commit: boolean) => {\n\t\tconst previous = indexRef.current;\n\t\tconst next = clamp(target, 0, count);\n\t\tif (next === previous) return false;\n\t\tindexRef.current = next;\n\t\tsetInternalIndex(next);\n\t\tif (onValueChange) {\n\t\t\tif (detents.labelled) {\n\t\t\t\t// Never skip a labelled stop, however far one event turns.\n\t\t\t\tconst direction = next > previous ? 1 : -1;\n\t\t\t\tfor (let i = previous + direction; i !== next; i += direction) {\n\t\t\t\t\tonValueChange(detents.valueAt(i));\n\t\t\t\t}\n\t\t\t}\n\t\t\tonValueChange(detents.valueAt(next));\n\t\t}\n\t\tcue(next);\n\t\tif (commit) onValueCommit?.(detents.valueAt(next));\n\t\treturn true;\n\t};\n\n\t/** The detent for a travel position, holding the current one until it's clearly left. */\n\tconst indexAt = (raw: number, current: number) => {\n\t\tconst position = detents.toIndexSpace(clamp(raw, 0, 1));\n\t\tif (Math.abs(position - current) < 0.5 + HYSTERESIS) return current;\n\t\treturn clamp(Math.round(position), 0, count);\n\t};\n\n\tconst pointerAngle = (\n\t\tevent: PointerEvent,\n\t\tdrag: { centerX: number; centerY: number; scale: number },\n\t) => {\n\t\tconst dx = event.clientX - drag.centerX;\n\t\tconst dy = event.clientY - drag.centerY;\n\t\tif (Math.hypot(dx, dy) / drag.scale < CIRCULAR_DEAD_ZONE) return null;\n\t\t// Clockwise from the top, like the pointer.\n\t\treturn (Math.atan2(dx, -dy) * 180) / Math.PI;\n\t};\n\n\tconst handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n\t\tif (disabled || event.button !== 0 || dragRef.current) return;\n\t\tconst knob = event.currentTarget;\n\t\tknob.setPointerCapture(event.pointerId);\n\t\tknob.focus({ preventScroll: true });\n\t\tconst rect = knob.getBoundingClientRect();\n\t\t// CSS zoom and transforms scale client coordinates; work in local px.\n\t\tconst scale = rect.width / (knob.offsetWidth || 1) || 1;\n\t\tconst drag = {\n\t\t\tpointerId: event.pointerId,\n\t\t\tstartIndex: indexRef.current,\n\t\t\traw: detents.fractionAt(indexRef.current),\n\t\t\toriginX: event.clientX,\n\t\t\toriginY: event.clientY,\n\t\t\tlastY: event.clientY,\n\t\t\tlastAngle: null as number | null,\n\t\t\tcenterX: rect.left + rect.width / 2,\n\t\t\tcenterY: rect.top + rect.height / 2,\n\t\t\tscale,\n\t\t\tmoved: false,\n\t\t};\n\t\tdrag.lastAngle = pointerAngle(event, drag);\n\t\tdragRef.current = drag;\n\t\tpressMovedRef.current = false;\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.moved) {\n\t\t\tconst travel = Math.hypot(\n\t\t\t\tevent.clientX - drag.originX,\n\t\t\t\tevent.clientY - drag.originY,\n\t\t\t);\n\t\t\tif (travel / drag.scale < DRAG_SLOP) return;\n\t\t\tdrag.moved = true;\n\t\t\tpressMovedRef.current = true;\n\t\t\tsetInternalIndex(indexRef.current);\n\t\t\tsetDragging(true);\n\t\t}\n\n\t\tlet delta = 0;\n\t\tif (dragMode === \"circular\") {\n\t\t\tconst angle = pointerAngle(event, drag);\n\t\t\tif (angle !== null && drag.lastAngle !== null) {\n\t\t\t\tdelta = wrapDegrees(angle - drag.lastAngle) / Math.max(range, 1);\n\t\t\t}\n\t\t\tdrag.lastAngle = angle;\n\t\t} else {\n\t\t\tdelta = (drag.lastY - event.clientY) / drag.scale / DRAG_TRAVEL_PX;\n\t\t}\n\t\tdrag.lastY = event.clientY;\n\t\tdrag.raw = clamp(\n\t\t\tdrag.raw + delta * (event.shiftKey ? FINE_FACTOR : 1),\n\t\t\t-MAX_WINDUP,\n\t\t\t1 + MAX_WINDUP,\n\t\t);\n\n\t\tconst over = drag.raw < 0 ? drag.raw : drag.raw > 1 ? drag.raw - 1 : 0;\n\t\tbandRef.current = shouldReduceMotion ? 0 : rubberBand(over * range);\n\t\t// A new detent moves the pointer through the effect; otherwise only the band moved.\n\t\tif (!moveTo(indexAt(drag.raw, indexRef.current), false)) {\n\t\t\tspringTo(sweepAt(indexRef.current) + bandRef.current);\n\t\t}\n\t};\n\n\tconst endDrag = (pointerId?: number) => {\n\t\tconst drag = dragRef.current;\n\t\tif (!drag || (pointerId !== undefined && drag.pointerId !== pointerId)) {\n\t\t\treturn;\n\t\t}\n\t\tdragRef.current = null;\n\t\tconst knob = knobRef.current;\n\t\tif (knob?.hasPointerCapture(drag.pointerId)) {\n\t\t\tknob.releasePointerCapture(drag.pointerId);\n\t\t}\n\t\tbandRef.current = 0;\n\t\tif (!drag.moved) return;\n\t\tsetDragging(false);\n\t\tspringTo(sweepAt(indexRef.current));\n\t\tif (indexRef.current !== drag.startIndex) {\n\t\t\tonValueCommit?.(detents.valueAt(indexRef.current));\n\t\t}\n\t};\n\n\tconst handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n\t\tif (disabled) return;\n\t\t// Left and right follow the reading direction, like a native range input.\n\t\tconst rtl = getComputedStyle(event.currentTarget).direction === \"rtl\";\n\t\tconst from = indexRef.current;\n\t\tlet target: number;\n\t\tswitch (event.key) {\n\t\t\tcase \"ArrowUp\":\n\t\t\t\ttarget = from + 1;\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowDown\":\n\t\t\t\ttarget = from - 1;\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowRight\":\n\t\t\t\ttarget = from + (rtl ? -1 : 1);\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowLeft\":\n\t\t\t\ttarget = from + (rtl ? 1 : -1);\n\t\t\t\tbreak;\n\t\t\tcase \"PageUp\":\n\t\t\t\ttarget = from + 10;\n\t\t\t\tbreak;\n\t\t\tcase \"PageDown\":\n\t\t\t\ttarget = from - 10;\n\t\t\t\tbreak;\n\t\t\tcase \"Home\":\n\t\t\t\ttarget = 0;\n\t\t\t\tbreak;\n\t\t\tcase \"End\":\n\t\t\t\ttarget = count;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t\tevent.preventDefault();\n\t\tconst direction: Direction = target > from || event.key === \"End\" ? 1 : -1;\n\t\tif (!moveTo(target, true) && !event.repeat) bump(direction);\n\t};\n\n\tconst handleDoubleClick = () => {\n\t\t// A press that turned the knob isn't half of a reset.\n\t\tif (disabled || pressMovedRef.current) return;\n\t\tmoveTo(detents.indexOf(defaultValue ?? detents.lower), true);\n\t};\n\n\t// Native listeners call through refs so they always see the latest props.\n\tconst wheelHandlerRef = useRef((event: WheelEvent) => {\n\t\tvoid event;\n\t});\n\tconst endDragRef = useRef(endDrag);\n\tuseLayoutEffect(() => {\n\t\tendDragRef.current = endDrag;\n\t\twheelHandlerRef.current = (event: WheelEvent) => {\n\t\t\t// Pinch zoom arrives as a ctrl wheel; leave it to the browser.\n\t\t\tif (event.ctrlKey || dragRef.current?.moved) return;\n\t\t\tconst delta =\n\t\t\t\tMath.abs(event.deltaY) >= Math.abs(event.deltaX)\n\t\t\t\t\t? event.deltaY\n\t\t\t\t\t: event.deltaX;\n\t\t\tif (delta === 0) return;\n\t\t\tevent.preventDefault();\n\t\t\tconst wheel = wheelRef.current;\n\t\t\tconst now = performance.now();\n\t\t\tconst from = indexRef.current;\n\t\t\tif (now - wheel.at > WHEEL_IDLE_MS) {\n\t\t\t\twheel.raw = detents.fractionAt(from);\n\t\t\t\twheel.bumped = false;\n\t\t\t}\n\t\t\twheel.at = now;\n\t\t\tconst direction: Direction = delta < 0 ? 1 : -1;\n\t\t\tif (from === (direction > 0 ? count : 0)) {\n\t\t\t\t// One thunk per wheel gesture, not one per event.\n\t\t\t\tif (!wheel.bumped) bump(direction);\n\t\t\t\twheel.bumped = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet target: number;\n\t\t\tif (event.deltaMode !== 0 || Math.abs(delta) >= WHEEL_NOTCH_PX) {\n\t\t\t\t// One notch, one detent.\n\t\t\t\ttarget = from + direction;\n\t\t\t\twheel.raw = detents.fractionAt(clamp(target, 0, count));\n\t\t\t} else {\n\t\t\t\tconst fine = event.shiftKey ? FINE_FACTOR : 1;\n\t\t\t\twheel.raw = clamp(wheel.raw - (delta / DRAG_TRAVEL_PX) * fine, 0, 1);\n\t\t\t\ttarget = indexAt(wheel.raw, from);\n\t\t\t}\n\t\t\tif (moveTo(target, true)) wheel.bumped = false;\n\t\t};\n\t});\n\n\t// Wheel needs a non-passive listener to keep the page from scrolling.\n\tuseEffect(() => {\n\t\tconst knob = knobRef.current;\n\t\tif (!knob || disabled) return;\n\t\tconst onWheel = (event: WheelEvent) => wheelHandlerRef.current(event);\n\t\tknob.addEventListener(\"wheel\", onWheel, { passive: false });\n\t\treturn () => knob.removeEventListener(\"wheel\", onWheel);\n\t}, [disabled]);\n\n\t// iOS can still scroll the page under a captured pointer; block it mid-turn.\n\tuseEffect(() => {\n\t\tconst knob = knobRef.current;\n\t\tif (!knob) return;\n\t\tconst onTouchMove = (event: TouchEvent) => {\n\t\t\tif (dragRef.current) event.preventDefault();\n\t\t};\n\t\tknob.addEventListener(\"touchmove\", onTouchMove, { passive: false });\n\t\treturn () => knob.removeEventListener(\"touchmove\", onTouchMove);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (disabled) endDragRef.current();\n\t}, [disabled]);\n\n\tconst showTicks = variant !== \"minimal\";\n\tconst ticks = showTicks\n\t\t? tickIndexes(detents, sizeStyle.maxTicks, range >= 360)\n\t\t: [];\n\tconst labelled = detents.labelled;\n\tconst startRotation: CSSProperties = { transform: `rotate(${start}deg)` };\n\t// Labels ring the dial; below it, reserve only as much room as the lowest label needs.\n\tconst labelRadius = (sizeStyle.dial + sizeStyle.labelSpace) / 2;\n\tconst lowestLabel = Math.max(\n\t\t...ticks.map(\n\t\t\t(tick) =>\n\t\t\t\t-labelRadius * Math.cos(((start + sweepAt(tick)) * Math.PI) / 180),\n\t\t),\n\t);\n\tconst framePadding = labelled\n\t\t? {\n\t\t\t\tpadding: sizeStyle.labelSpace,\n\t\t\t\tpaddingBottom: clamp(\n\t\t\t\t\tlowestLabel + sizeStyle.labelSpace / 2 - sizeStyle.dial / 2,\n\t\t\t\t\t0,\n\t\t\t\t\tsizeStyle.labelSpace,\n\t\t\t\t),\n\t\t\t}\n\t\t: undefined;\n\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"rotary-knob\"\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={index === 0 ? \"min\" : index === count ? \"max\" : undefined}\n\t\t\tdata-disabled={disabled || undefined}\n\t\t\tclassName={cn(\n\t\t\t\t\"group/knob inline-flex w-fit select-none flex-col items-center gap-2 [--rotary-knob-accent:var(--color-orange-500)] data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-slot=\"rotary-knob-frame\"\n\t\t\t\tclassName=\"relative\"\n\t\t\t\tstyle={framePadding}\n\t\t\t>\n\t\t\t\t{labelled ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\tdata-slot=\"rotary-knob-labels\"\n\t\t\t\t\t\t// Centered on the dial, which sits off-center when the bottom padding is trimmed.\n\t\t\t\t\t\tclassName=\"pointer-events-none absolute top-0 left-0\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\twidth: sizeStyle.dial + sizeStyle.labelSpace * 2,\n\t\t\t\t\t\t\theight: sizeStyle.dial + sizeStyle.labelSpace * 2,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ticks.map((tick) => {\n\t\t\t\t\t\t\tconst angle = start + sweepAt(tick);\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={tick}\n\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\t\t\t\tstyle={{ transform: `rotate(${angle}deg)` }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclassName=\"absolute top-0 left-1/2 flex -translate-x-1/2 items-center justify-center\"\n\t\t\t\t\t\t\t\t\t\tstyle={{ height: sizeStyle.labelSpace }}\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={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\"whitespace-nowrap font-medium text-foreground leading-none transition-opacity duration-150\",\n\t\t\t\t\t\t\t\t\t\t\t\tsizeStyle.label,\n\t\t\t\t\t\t\t\t\t\t\t\ttick === index ? \"opacity-100\" : \"opacity-45\",\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ transform: `rotate(${-angle}deg)` }}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{detents.labelAt(tick)}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t<div\n\t\t\t\t\tref={knobRef}\n\t\t\t\t\trole=\"slider\"\n\t\t\t\t\ttabIndex={disabled ? -1 : 0}\n\t\t\t\t\taria-label={ariaLabelledBy ? ariaLabel : (ariaLabel ?? \"Value\")}\n\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\taria-valuemin={detents.lower}\n\t\t\t\t\taria-valuemax={detents.upper}\n\t\t\t\t\taria-valuenow={value}\n\t\t\t\t\taria-valuetext={valueText}\n\t\t\t\t\taria-disabled={disabled || undefined}\n\t\t\t\t\tdata-slot=\"rotary-knob-dial\"\n\t\t\t\t\tonPointerDown={handlePointerDown}\n\t\t\t\t\tonPointerMove={handlePointerMove}\n\t\t\t\t\tonPointerUp={(event) => endDrag(event.pointerId)}\n\t\t\t\t\tonPointerCancel={(event) => endDrag(event.pointerId)}\n\t\t\t\t\tonLostPointerCapture={(event) => endDrag(event.pointerId)}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\tonDoubleClick={handleDoubleClick}\n\t\t\t\t\tonContextMenu={(event) => event.preventDefault()}\n\t\t\t\t\tclassName=\"relative cursor-grab touch-none rounded-full outline-none [-webkit-touch-callout:none] focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background group-data-disabled/knob:pointer-events-none group-data-[state=dragging]/knob:cursor-grabbing\"\n\t\t\t\t\tstyle={{ width: sizeStyle.dial, height: sizeStyle.dial }}\n\t\t\t\t>\n\t\t\t\t\t{showTicks ? (\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=\"rotary-knob-ticks\"\n\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-0\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ticks.map((tick) => {\n\t\t\t\t\t\t\t\tconst major = labelled || tick === 0 || tick === count;\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={tick}\n\t\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\ttransform: `rotate(${start + sweepAt(tick)}deg)`,\n\t\t\t\t\t\t\t\t\t\t}}\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={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\"absolute top-0 left-1/2 w-[1.5px] -translate-x-1/2 rounded-full bg-foreground transition-opacity duration-150\",\n\t\t\t\t\t\t\t\t\t\t\t\ttick <= index ? \"opacity-80\" : \"opacity-20\",\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\theight: major\n\t\t\t\t\t\t\t\t\t\t\t\t\t? sizeStyle.tick\n\t\t\t\t\t\t\t\t\t\t\t\t\t: Math.round(sizeStyle.tick * 0.65),\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</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\n\t\t\t\t\t{variant === \"minimal\" ? (\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=\"rotary-knob-ring\"\n\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-0.5 rounded-full border-2 border-foreground/15\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\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=\"rotary-knob-arc\"\n\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute\"\n\t\t\t\t\t\t\tstyle={{ inset: sizeStyle.arcInset }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"absolute inset-0 text-foreground/10\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t...ringMask(sizeStyle.arc),\n\t\t\t\t\t\t\t\t\tbackground: `conic-gradient(from ${start}deg, currentColor 0deg ${range}deg, transparent ${range}deg 360deg)`,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tclassName=\"absolute inset-0 rounded-full\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t...ringMask(sizeStyle.arc),\n\t\t\t\t\t\t\t\t\t...startRotation,\n\t\t\t\t\t\t\t\t\topacity: arcOpacity,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className=\"absolute inset-y-0 right-0 w-1/2 overflow-hidden\">\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"absolute top-0 -left-full h-full w-[200%]\"\n\t\t\t\t\t\t\t\t\t\tstyle={{ rotate: firstHalf }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<div className=\"absolute inset-y-0 left-0 w-1/2 bg-[var(--rotary-knob-accent)]\" />\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className=\"absolute inset-y-0 left-0 w-1/2 overflow-hidden\">\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"absolute top-0 left-0 h-full w-[200%]\"\n\t\t\t\t\t\t\t\t\t\tstyle={{ rotate: secondHalf }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<div className=\"absolute inset-y-0 right-0 w-1/2 bg-[var(--rotary-knob-accent)]\" />\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t{/* Round caps at both ends of the arc. */}\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\t\t\tstyle={{ ...startRotation, opacity: arcOpacity }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName=\"absolute top-0 left-1/2 -translate-x-1/2 rounded-full bg-[var(--rotary-knob-accent)]\"\n\t\t\t\t\t\t\t\t\tstyle={{ width: sizeStyle.arc, height: sizeStyle.arc }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t<div className=\"absolute inset-0\" style={startRotation}>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\t\t\t\tstyle={{ rotate: arcEnd, opacity: arcOpacity }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclassName=\"absolute top-0 left-1/2 -translate-x-1/2 rounded-full bg-[var(--rotary-knob-accent)]\"\n\t\t\t\t\t\t\t\t\t\tstyle={{ width: sizeStyle.arc, height: sizeStyle.arc }}\n\t\t\t\t\t\t\t\t\t/>\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</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{variant === \"tactile\" ? (\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=\"rotary-knob-cap\"\n\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute rounded-full shadow-[0_10px_18px_-8px_rgb(0_0_0/0.55),0_3px_6px_-2px_rgb(0_0_0/0.35)]\"\n\t\t\t\t\t\t\tstyle={{ inset: sizeStyle.cap }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* The knurled edge turns with the knob; the light stays put. */}\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tclassName=\"absolute inset-0 rounded-full bg-[repeating-conic-gradient(rgb(0_0_0/0.22)_0deg_2.5deg,rgb(255_255_255/0.18)_2.5deg_7.5deg)] bg-zinc-300 dark:bg-zinc-700\"\n\t\t\t\t\t\t\t\tstyle={{ rotate: sweep }}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<div className=\"absolute inset-0 rounded-full bg-[linear-gradient(to_bottom,rgb(255_255_255/0.45),transparent_45%,rgb(0_0_0/0.3))] dark:bg-[linear-gradient(to_bottom,rgb(255_255_255/0.2),transparent_45%,rgb(0_0_0/0.45))]\" />\n\t\t\t\t\t\t\t<div className=\"absolute inset-[14%] rounded-full bg-[radial-gradient(circle_at_35%_28%,var(--color-zinc-50),var(--color-zinc-200)_55%,var(--color-zinc-300))] shadow-[inset_0_1px_1px_rgb(255_255_255/0.7),0_1px_3px_rgb(0_0_0/0.35)] dark:bg-[radial-gradient(circle_at_35%_28%,var(--color-zinc-500),var(--color-zinc-700)_55%,var(--color-zinc-800))] dark:shadow-[inset_0_1px_1px_rgb(255_255_255/0.25),0_1px_3px_rgb(0_0_0/0.5)]\" />\n\t\t\t\t\t\t\t<div className=\"absolute inset-[14%]\" style={startRotation}>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tdata-slot=\"rotary-knob-pointer\"\n\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\t\t\t\tstyle={{ rotate: sweep }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"absolute top-[9%] left-1/2 h-[30%] w-[3px] -translate-x-1/2 rounded-full bg-[var(--rotary-knob-accent)] shadow-[0_0_6px_var(--rotary-knob-accent)]\" />\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</div>\n\t\t\t\t\t) : (\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=\"rotary-knob-cap\"\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"pointer-events-none absolute rounded-full\",\n\t\t\t\t\t\t\t\tvariant === \"default\" &&\n\t\t\t\t\t\t\t\t\t\"border border-border bg-background shadow-xs dark:border-input dark:bg-input/30\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tstyle={{ inset: variant === \"minimal\" ? 2 : sizeStyle.cap }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"absolute inset-0\" style={startRotation}>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tdata-slot=\"rotary-knob-pointer\"\n\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\t\t\t\tstyle={{ rotate: sweep }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\"absolute left-1/2 w-[3px] -translate-x-1/2 rounded-full bg-foreground\",\n\t\t\t\t\t\t\t\t\t\t\tvariant === \"minimal\"\n\t\t\t\t\t\t\t\t\t\t\t\t? \"top-[6%] h-[24%]\"\n\t\t\t\t\t\t\t\t\t\t\t\t: \"top-[10%] h-[30%]\",\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t/>\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</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{showValue ? (\n\t\t\t\t<span\n\t\t\t\t\taria-hidden\n\t\t\t\t\tdata-slot=\"rotary-knob-value\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"font-medium text-foreground tabular-nums leading-none\",\n\t\t\t\t\t\tsizeStyle.value,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{valueText}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t{name ? (\n\t\t\t\t<input type=\"hidden\" name={name} value={value} disabled={disabled} />\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nexport default RotaryKnob;\n",
      "type": "registry:component",
      "target": "@components/rotary-knob.tsx"
    }
  ],
  "meta": {
    "createdAt": "2026-10-28",
    "image": "https://cdn.tentui.com/images/components/rotary-knob?v=2",
    "video": "https://cdn.tentui.com/videos/components/rotary-knob?v=2"
  },
  "docs": "https://tentui.com/components/rotary-knob",
  "categories": [
    "inputs"
  ],
  "type": "registry:component"
}