import { defineComponent } from 'vue' import { type SelectContentEmits, SelectContent as SelectContentPrimitive, type SelectContentProps, SelectGroup as SelectGroupPrimitive, SelectIcon, SelectItemIndicator, SelectItem as SelectItemPrimitive, type SelectItemProps, SelectItemText, SelectLabel as SelectLabelPrimitive, type SelectLabelProps, SelectPortal, SelectRoot, SelectSeparator as SelectSeparatorPrimitive, type SelectSeparatorProps, SelectTrigger as SelectTriggerPrimitive, type SelectTriggerProps, SelectValue as SelectValuePrimitive, SelectViewport, } from 'radix-vue' import { Check, ChevronDown } from 'lucide-vue-next' import type { ParseEmits } from '@/utils' import { cn, convertToComponent, useEmitAsProps } from '@/utils' export const Select = SelectRoot export const SelectGroup = SelectGroupPrimitive export const SelectValue = SelectValuePrimitive // Convert Functional component to valid VNode to be use in JSX const IChevrondown = convertToComponent(ChevronDown) const ICheck = convertToComponent(Check) export const SelectTrigger = defineComponent( (props, { attrs, slots }) => { return () => ( { slots.default?.() } ) }, { name: 'SelectTrigger', }, ) export const SelectContent = defineComponent>( (props, { emit, attrs, slots }) => { const position = props.position ?? 'popper' const emitsAsProps = useEmitAsProps(emit) return () => ( { slots.default?.()} ) }, { name: 'SelectContent', emits: SelectContentPrimitive.emits }, ) export const SelectLabel = defineComponent( (props, { attrs, slots }) => { return () => ( { slots.default?.() } ) }, { name: 'SelectLabel' }, ) export const SelectItem = defineComponent( (props, { attrs, slots }) => { return () => ( { slots.default?.() } ) }, { name: 'SelectItem' }, ) export const SelectSeparator = defineComponent( (props, { attrs, slots }) => { return () => ( { slots.default?.() } ) }, { name: 'SelectSeparator' }, )