"use client"; import * as SelectPrimitive from "@radix-ui/react-select"; import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"; import { ComponentProps, type WheelEvent } from "react"; import { cn } from "@/lib/utils"; const stopWheelPropagation = (event: WheelEvent) => { event.stopPropagation(); }; const SELECT_TRIGGER_SIZES = { XS: "xs", SM: "sm", DEFAULT: "default", } as const; const SELECT_TRIGGER_ICON_SIZES = { SM: "sm", DEFAULT: "default", } as const; type SelectTriggerSize = (typeof SELECT_TRIGGER_SIZES)[keyof typeof SELECT_TRIGGER_SIZES]; type SelectTriggerIconSize = (typeof SELECT_TRIGGER_ICON_SIZES)[keyof typeof SELECT_TRIGGER_ICON_SIZES]; function Select({ allowDeselect = false, ...props }: ComponentProps & { allowDeselect?: boolean; }) { const handleValueChange = (nextValue: string) => { if (allowDeselect && props.value === nextValue) { // Single-select with deselect props.onValueChange?.(""); } else { // Single-select props.onValueChange?.(nextValue); } }; return ( ); } function SelectGroup({ ...props }: ComponentProps) { return ; } function SelectValue({ ...props }: ComponentProps) { return ; } function SelectTrigger({ className, size = SELECT_TRIGGER_SIZES.DEFAULT, iconSize = SELECT_TRIGGER_ICON_SIZES.DEFAULT, children, ...props }: ComponentProps & { size?: SelectTriggerSize; iconSize?: SelectTriggerIconSize; }) { return ( svg]:px-3 data-[size=default]:h-[52px] data-[size=sm]:h-10 data-[size=xs]:h-8 data-[size=xs]:gap-1.5 data-[size=xs]:px-3 data-[size=xs]:py-0 data-[size=xs]:text-xs *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:focus-visible:ring-slate-400 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-6", className, )} {...props} > {children} ); } function SelectContent({ className, children, position = "popper", align = "start", width = "default", style, ...props }: ComponentProps & { width?: "default" | "wide"; }) { const widthClasses = width === "wide" ? "w-[min(max(var(--radix-select-trigger-width),24rem),calc(100vw-2rem))] max-w-[32rem]" : undefined; return ( {children} ); } function SelectLabel({ className, ...props }: ComponentProps) { return ( ); } function SelectItem({ className, children, ...props }: ComponentProps) { return ( {children} ); } function SelectSeparator({ className, ...props }: ComponentProps) { return ( ); } function SelectScrollUpButton({ className, ...props }: ComponentProps) { return ( ); } function SelectScrollDownButton({ className, ...props }: ComponentProps) { return ( ); } export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };