'use client' import type { CSSProperties } from 'react' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' import { cn } from '@/lib/utils' export type KriSelectItem = { value: string label: string } export type KriSelectProps = { items: T[] value: string onChange?: (value: string) => void onChangeOption?: (option: T) => void placeholder?: string className?: string heightClassName?: string triggerTextClassName?: string contentClassName?: string itemClassName?: string getValue?: (item: T) => string getLabel?: (item: T) => string useAll?: boolean disabled?: boolean } const HEIGHT_CLASS_VALUE: Record = { 'h-6': '1.5rem', 'h-7': '1.75rem', 'h-8': '2rem', 'h-9': '2.25rem', 'h-10': '2.5rem', } export function KriSelect({ items, value, onChange, onChangeOption, placeholder, className, heightClassName, triggerTextClassName, contentClassName, itemClassName, getValue, getLabel, useAll = true, disabled, }: KriSelectProps) { const extractValue = (item: T) => (getValue ? getValue(item) : String(item)) const extractLabel = (item: T) => (getLabel ? getLabel(item) : String(item)) const triggerStyle: CSSProperties | undefined = heightClassName ? { height: HEIGHT_CLASS_VALUE[heightClassName] ?? undefined } : undefined return ( ) }