'use client' import type { VariantProps } from 'class-variance-authority' import type { Placement } from '@/app/components/base/ui/placement' import { Select as BaseSelect } from '@base-ui/react/select' import { cva } from 'class-variance-authority' import * as React from 'react' import { parsePlacement } from '@/app/components/base/ui/placement' import { cn } from '@/utils/classnames' export const Select = BaseSelect.Root export const SelectValue = BaseSelect.Value /** @public */ export const SelectGroup = BaseSelect.Group /** @public */ export const SelectGroupLabel = BaseSelect.GroupLabel /** @public */ export const SelectSeparator = BaseSelect.Separator const selectTriggerVariants = cva( '', { variants: { size: { small: 'h-6 gap-px rounded-md px-[5px] py-0 system-xs-regular', regular: 'h-8 gap-0.5 rounded-lg px-2 py-1 system-sm-regular', large: 'h-9 gap-0.5 radius-lg px-2.5 py-1 system-md-regular', }, variant: { default: '', destructive: 'border border-components-input-border-destructive bg-components-input-bg-destructive shadow-xs hover:border-components-input-border-destructive hover:bg-components-input-bg-destructive', }, }, defaultVariants: { size: 'regular', variant: 'default', }, }, ) const contentPadding: Record = { small: 'px-[3px] py-1', regular: 'p-1', large: 'px-1.5 py-1', } type SelectTriggerProps = React.ComponentPropsWithoutRef & { clearable?: boolean onClear?: () => void loading?: boolean } & VariantProps export function SelectTrigger({ className, children, size = 'regular', variant = 'default', clearable = false, onClear, loading = false, ...props }: SelectTriggerProps) { const paddingClass = contentPadding[size ?? 'regular'] const isDestructive = variant === 'destructive' let trailingIcon: React.ReactNode = null if (loading) { trailingIcon = (