"use client"; import {mergeProps} from "@base-ui/react/merge-props"; import {Select as BaseSelect} from "@base-ui/react/select"; import {useRender} from "@base-ui/react/use-render"; import {Check, ChevronDown, ChevronUp} from "lucide-react"; import * as React from "react"; import {cn} from "@/lib/utilities"; import styles from "./select.module.css"; interface SelectProps extends Omit, "onValueChange"> { /** Called when the selected value changes and resolves to a string. @default undefined */ onValueChange?: (value: string) => void; } interface SelectTriggerProps extends Omit, "className"> { /** Additional CSS classes merged with the select trigger styles. @default undefined */ className?: string; } interface SelectScrollUpButtonProps extends Omit, "className"> { /** Additional CSS classes merged with the scroll-up control styles. @default undefined */ className?: string; } interface SelectScrollDownButtonProps extends Omit, "className"> { /** Additional CSS classes merged with the scroll-down control styles. @default undefined */ className?: string; } interface SelectContentProps extends Omit, "className"> { /** Additional CSS classes merged with the select popup styles. @default undefined */ className?: string; /** The offset in pixels between the trigger and the popup. @default 4 */ sideOffset?: number; } interface SelectLabelProps extends Omit, "className"> { /** Additional CSS classes merged with the group label styles. @default undefined */ className?: string; } interface SelectItemProps extends Omit, "className"> { /** Additional CSS classes merged with the select item styles. @default undefined */ className?: string; } interface SelectSeparatorProps extends Omit, "className"> { /** Additional CSS classes merged with the separator styles. @default undefined */ className?: string; } /** * Coordinates select state, keyboard navigation, and value management. * * @remarks * - Renders no DOM element by default and coordinates descendant select parts * - Built on {@link https://base-ui.com/react/components/select | Base UI Select} * - Supports composition through descendant `render` props * - Styling via CSS Modules with `--ac-*` custom properties * * @example Basic usage * ```tsx * * ``` * * @see {@link https://base-ui.com/react/components/select | Base UI Documentation} */ function Select(props: Readonly): React.ReactElement { const {onValueChange, ...otherProps} = props; const handleChange = React.useCallback( (value: unknown) => { if (onValueChange && typeof value === "string") { onValueChange(value); } }, [onValueChange], ); return ( ["onValueChange"]} {...otherProps} /> ); } Select.displayName = "Select"; /** * Groups related select items into a shared logical section. * * @remarks * - Renders no DOM element by default beyond the underlying grouped option container * - Built on {@link https://base-ui.com/react/components/select | Base UI Select} * - Supports composition through descendant `render` props * - Styling via CSS Modules with `--ac-*` custom properties through descendant components * * @example Basic usage * ```tsx * * Team * One * * ``` * * @see {@link https://base-ui.com/react/components/select | Base UI Documentation} */ const SelectGroup = BaseSelect.Group; SelectGroup.displayName = "SelectGroup"; /** * Displays the currently selected option inside the trigger. * * @remarks * - Renders no DOM element by default beyond the underlying value slot * - Built on {@link https://base-ui.com/react/components/select | Base UI Select} * - Supports composition through surrounding select trigger rendering * - Styling via CSS Modules with `--ac-*` custom properties through descendant components * * @example Basic usage * ```tsx * * ``` * * @see {@link https://base-ui.com/react/components/select | Base UI Documentation} */ const SelectValue = BaseSelect.Value; SelectValue.displayName = "SelectValue"; /** * Opens the select popup and displays the current selected value. * * @remarks * - Renders a `