{"version":3,"file":"select-trigger.cjs","sources":["../../../components/select/select-trigger.tsx"],"sourcesContent":["'use client';\n\nimport {\n  Combobox as ComboboxPrimitive,\n  Select as SelectPrimitive\n} from '@base-ui/react';\nimport { cva, VariantProps } from 'class-variance-authority';\nimport { ComponentProps, SVGAttributes } from 'react';\nimport { ChevronDownIcon } from '~/icons';\nimport { Flex } from '../flex';\nimport styles from './select.module.css';\nimport { useSelectContext } from './select-root';\n\nexport interface IconProps extends SVGAttributes<SVGElement> {\n  children?: never;\n  color?: string;\n}\n\nconst trigger = cva(styles.trigger, {\n  variants: {\n    size: {\n      small: styles['trigger-small'],\n      medium: styles['trigger-medium']\n    },\n    variant: {\n      outline: styles['trigger-outline'],\n      text: styles['trigger-text']\n    }\n  },\n  defaultVariants: {\n    size: 'medium',\n    variant: 'outline'\n  }\n});\n\nexport interface SelectTriggerProps\n  extends ComponentProps<'button'>,\n    VariantProps<typeof trigger> {\n  iconProps?: IconProps;\n  nativeButton?: boolean;\n}\n\nexport function SelectTrigger({\n  ref,\n  size,\n  variant,\n  className,\n  children,\n  iconProps = {},\n  'aria-label': ariaLabel,\n  ...props\n}: SelectTriggerProps) {\n  const { multiple, autocomplete } = useSelectContext();\n\n  const TriggerPrimitive = autocomplete\n    ? ComboboxPrimitive.Trigger\n    : SelectPrimitive.Trigger;\n\n  return (\n    <TriggerPrimitive\n      data-multiselectable={multiple ? true : undefined}\n      data-slot='select-trigger'\n      ref={ref}\n      className={trigger({ size, variant, className })}\n      aria-label={ariaLabel || 'Select option'}\n      {...props}\n    >\n      <Flex\n        className={styles.triggerContent}\n        align='center'\n        gap={2}\n        data-slot='select-trigger-content'\n      >\n        {children}\n      </Flex>\n      <ChevronDownIcon\n        className={styles.triggerIcon}\n        aria-hidden='true'\n        data-slot='select-trigger-icon'\n        {...iconProps}\n      />\n    </TriggerPrimitive>\n  );\n}\nSelectTrigger.displayName = 'Select.Trigger';\n"],"names":[],"mappings":";;;;;;;;;;;;AAkBA;AACE;AACE;AACE;AACA;AACD;AACD;AACE;AACA;AACD;AACF;AACD;AACE;AACA;AACD;AACF;AASK;;;;AAcF;AAEF;AAyBF;AACA;;"}