mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 06:15:39 -04:00
- Delete lib/api/errors.ts and lib/api/auth-guard.ts, inline NextResponse.json() error responses directly in route handlers - Replace non-standard amber CSS variables with primary/primary-foreground - Regenerate shadcn UI components with biome-ignore comments - Add CLAUDE.md for repository guidance - Update dependencies and pnpm lockfile Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
import * as React from "react";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
function Slider({
|
|
className,
|
|
defaultValue,
|
|
value,
|
|
min = 0,
|
|
max = 100,
|
|
...props
|
|
}: SliderPrimitive.Root.Props) {
|
|
const _values = React.useMemo(
|
|
() =>
|
|
Array.isArray(value)
|
|
? value
|
|
: Array.isArray(defaultValue)
|
|
? defaultValue
|
|
: [min, max],
|
|
[value, defaultValue, min, max],
|
|
);
|
|
|
|
return (
|
|
<SliderPrimitive.Root
|
|
className={cn("data-horizontal:w-full data-vertical:h-full", className)}
|
|
data-slot="slider"
|
|
defaultValue={defaultValue}
|
|
value={value}
|
|
min={min}
|
|
max={max}
|
|
thumbAlignment="edge"
|
|
{...props}
|
|
>
|
|
<SliderPrimitive.Control className="relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col">
|
|
<SliderPrimitive.Track
|
|
data-slot="slider-track"
|
|
className="bg-muted relative grow overflow-hidden rounded-md select-none data-horizontal:h-3 data-horizontal:w-full data-vertical:h-full data-vertical:w-3"
|
|
>
|
|
<SliderPrimitive.Indicator
|
|
data-slot="slider-range"
|
|
className="bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
/>
|
|
</SliderPrimitive.Track>
|
|
{Array.from({ length: _values.length }, (_, index) => (
|
|
<SliderPrimitive.Thumb
|
|
data-slot="slider-thumb"
|
|
// biome-ignore lint/suspicious/noArrayIndexKey: shadcn generated
|
|
key={index}
|
|
className="border-primary ring-ring/30 block size-4 shrink-0 rounded-md border bg-white shadow-sm transition-colors select-none hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
/>
|
|
))}
|
|
</SliderPrimitive.Control>
|
|
</SliderPrimitive.Root>
|
|
);
|
|
}
|
|
|
|
export { Slider };
|