import * as React from "react"; import { cn } from "@/lib/utils"; import { Slider as SliderPrimitive } from "radix-ui"; function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }: React.ComponentProps) { const thumbs = React.useMemo( () => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]), [value, defaultValue, min, max], ); // radix 的可访问 slider 角色在 Thumb 上,aria-label 提到 Root 传不进去——改下沉到每个 Thumb。 const { "aria-label": ariaLabel, ...rootProps } = props; return ( {thumbs.map((_, i) => ( ))} ); } export { Slider };