import { useEffect, useState } from 'react' import { Slider as SliderPrimitive } from '@base-ui/react/slider' import { cn } from '@/client/lib/cn' function Slider({ children, className, defaultValue, value, min = 0, max = 100, ...props }: SliderPrimitive.Root.Props) { const [animationReady, setAnimationReady] = useState(false) const _values = Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max] // Let Base UI measure the initial positions before transitions are enabled. useEffect(() => { const frame = requestAnimationFrame(() => setAnimationReady(true)) return () => cancelAnimationFrame(frame) }, []) return ( {children} {Array.from({ length: _values.length }, (_, index) => ( ))} ) } export { Slider }