import React__default, { useContext } from 'react';
import { T as Typography } from './Typography-es.js';
import { a as ComboboxContext } from './ComboboxProvider-es.js';

var styles = {"actionContainer":"NWf8JR3TBoo-","actionButton":"PoMXFVYVY5A-","spinning":"lP2oDQm9j88-"};

function ComboboxAction(props) {
    const { searchValue, handleClose } = useContext(ComboboxContext);
    if (props.visible !== undefined) {
        const isVisible = typeof props.visible === "function"
            ? props.visible({ searchValue })
            : props.visible;
        if (!isVisible) {
            return null;
        }
    }
    const options = { searchValue };
    const computedLabel = typeof props.label === "string" ? props.label : props.label(options);
    const handleClick = (e) => {
        if (!props.keepOpenOnClick) {
            handleClose();
        }
        props.onClick(e, options);
    };
    return (React__default.createElement("div", { className: styles.actionContainer },
        React__default.createElement("button", { className: styles.actionButton, onClick: handleClick, type: "button" },
            React__default.createElement(Typography, { element: "span", size: "base", textColor: "interactive", fontWeight: "semiBold" }, computedLabel))));
}

export { ComboboxAction as C };
