"use client";
import { Elements } from "../../../components";
import Style from "./Tab.styled";
export default function Tab(props) {
    const scale = props?.scale || 1;
    const fit = props?.fit || false;
    const Icons = (icon) => {
        return typeof icon === "object" ? (<Elements.Icon {...icon} scale={scale}/>) : typeof icon === "string" ? (<Elements.Icon icon={icon} scale={scale}/>) : (<></>);
    };
    const handleClick = (e) => {
        if (props?.disabled)
            return;
        if (typeof props?.onClick === "function")
            props?.onClick(e);
    };
    const handleBlur = (e) => {
        if (props?.disabled)
            return;
        if (typeof props?.onBlur === "function")
            props?.onBlur(e);
    };
    return (<Style tabIndex={1} style={props?.style} onClick={(e) => handleClick(e)} onBlur={(e) => handleBlur(e)} title={props?.title} $scale={scale} $toggle={props?.toggle || false} $active={props?.active || false} $padding={props?.children && true} $fit={fit} $disabled={props?.disabled} data-show={props?.show} data-hide={props?.hide}>
            <div>
                {props?.iconLeft && (<>
                        {Icons(props?.iconLeft)}
                        {props?.children && <span>{props?.children}</span>}
                    </>)}
                {(!props?.iconLeft || props?.iconLeft === "") && (!props?.iconRight || props?.iconRight === "") && (<span>{props?.children}</span>)}
                {props?.iconRight && (<>
                        {props?.children && <span>{props?.children}</span>}
                        {Icons(props?.iconRight)}
                    </>)}
            </div>
        </Style>);
}
//# sourceMappingURL=Tab.jsx.map