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

var styles = {"actionContainer":"wnyB0d1ZE70-","actionButton":"mljM3ouZmbM-","spinning":"uMfMpnitRs0-"};

function FilterPickerAction(props) {
    const { searchValue, handleClose } = useContext(FilterPickerContext);
    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 { FilterPickerAction as F };
