import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
import { forwardRef, useEffect } from 'react';
import { Item, ItemText } from '../../node_modules/.pnpm/@radix-ui_react-select@2.1.1_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-select/dist/index.js';
import { cx } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
import styles from './select.module.css.js';
import { Text } from '../text/text.js';
import { useSelectContext } from './select-root.js';

const SelectItem = forwardRef(({ className, textProps = {}, children, value, leadingIcon, ...props }, ref) => {
    const { registerIcon, unregisterIcon } = useSelectContext();
    useEffect(() => {
        if (!leadingIcon)
            return;
        registerIcon(value, leadingIcon);
        return () => {
            unregisterIcon(value);
        };
    }, [value, leadingIcon]);
    return (jsxRuntimeExports.jsxs(Item, { ref: ref, value: value, className: cx(styles.menuitem, className), ...props, children: [leadingIcon && jsxRuntimeExports.jsx("div", { className: styles.itemIcon, children: leadingIcon }), jsxRuntimeExports.jsx(ItemText, { children: jsxRuntimeExports.jsx(Text, { ...textProps, children: children }) })] }));
});
SelectItem.displayName = Item.displayName;

export { SelectItem };
//# sourceMappingURL=select-item.js.map
