import * as React from "react";
import * as SliderPrimitive from "@radix-ui/react-slider";

import { cn } from "../lib/utils";

const Slider = React.forwardRef<
  React.ElementRef<typeof SliderPrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
>(({ className, ...props }, ref) => (
  <SliderPrimitive.Root
    ref={ref}
    className={cn(
      "tw-figr-relative tw-figr-flex tw-figr-w-full tw-figr-touch-none tw-figr-select-none tw-figr-items-center",
      className
    )}
    {...props}
  >
    <SliderPrimitive.Track className="tw-figr-relative tw-figr-h-2 tw-figr-w-full tw-figr-grow tw-figr-overflow-hidden tw-figr-rounded-full tw-figr-bg-secondary">
      <SliderPrimitive.Range className="tw-figr-absolute tw-figr-h-full tw-figr-bg-primary" />
    </SliderPrimitive.Track>
    <SliderPrimitive.Thumb className="tw-figr-block tw-figr-h-5 tw-figr-w-5 tw-figr-rounded-full tw-figr-border-2 tw-figr-border-primary tw-figr-bg-background tw-figr-ring-offset-background tw-figr-transition-colors focus-visible:tw-figr-outline-none focus-visible:tw-figr-ring-2 focus-visible:tw-figr-ring-primary focus-visible:tw-figr-ring-offset-2 disabled:tw-figr-pointer-events-none disabled:tw-figr-opacity-50" />
  </SliderPrimitive.Root>
));
Slider.displayName = SliderPrimitive.Root.displayName;

export { Slider };
