'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React from 'react';
import './index.scss';
const baseClass = 'popup-button';
export const PopupTrigger = (props)=>{
    const { active, button, buttonType, className, disabled, noBackground, setActive, size } = props;
    const classes = [
        baseClass,
        className,
        `${baseClass}--${buttonType}`,
        !noBackground && `${baseClass}--background`,
        size && `${baseClass}--size-${size}`,
        disabled && `${baseClass}--disabled`
    ].filter(Boolean).join(' ');
    const handleClick = ()=>{
        setActive(!active, false);
    };
    const handleKeyDown = (e)=>{
        if (e.key === 'Enter' || e.key === ' ') {
            e.preventDefault();
            setActive(!active, true);
        }
    };
    if (buttonType === 'none') {
        return null;
    }
    if (buttonType === 'custom') {
        return /*#__PURE__*/ _jsxDEV("div", {
            className: classes,
            onClick: handleClick,
            onKeyDown: handleKeyDown,
            role: "button",
            tabIndex: 0,
            children: button
        }, void 0, false, {
            fileName: "src/elements/Popup/PopupTrigger/index.tsx",
            lineNumber: 50,
            columnNumber: 7
        }, this);
    }
    return /*#__PURE__*/ _jsxDEV("button", {
        className: classes,
        disabled: disabled,
        onClick: handleClick,
        onKeyDown: handleKeyDown,
        tabIndex: 0,
        type: "button",
        children: button
    }, void 0, false, {
        fileName: "src/elements/Popup/PopupTrigger/index.tsx",
        lineNumber: 63,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map