function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
import { Button, ConfigProvider } from "antd";
import classNames from "classnames";
import React, { useContext } from "react";
import { useStyle } from "./style";
export var ToggleButton = function(param) {
    var className = param.className, style = param.style, icon = param.icon, triggerIcon = param.triggerIcon, disabled = param.disabled, active = param.active, onClick = param.onClick, children = param.children;
    var context = useContext(ConfigProvider.ConfigContext);
    var prefixCls = context === null || context === void 0 ? void 0 : context.getPrefixCls('toggle-button');
    var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
    var rootCls = classNames(prefixCls, className, hashId);
    var _obj;
    return wrapSSR(/*#__PURE__*/ React.createElement("div", {
        className: classNames(rootCls, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-active"), active), _define_property(_obj, "".concat(prefixCls, "-disabled"), disabled), _obj)),
        style: style
    }, /*#__PURE__*/ React.createElement(ConfigProvider, {
        wave: {
            disabled: true
        }
    }, /*#__PURE__*/ React.createElement(Button, {
        disabled: disabled,
        onClick: onClick,
        className: classNames("".concat(prefixCls, "-button"), hashId),
        style: {
            border: 'none',
            background: 'transparent',
            padding: 0,
            height: '100%',
            display: 'flex',
            alignItems: 'center',
            boxShadow: 'none'
        }
    }, icon && /*#__PURE__*/ React.createElement("span", {
        className: classNames("".concat(prefixCls, "-icon"), hashId)
    }, icon), children && /*#__PURE__*/ React.createElement("span", {
        className: classNames("".concat(prefixCls, "-text"), hashId)
    }, children), triggerIcon && /*#__PURE__*/ React.createElement("span", {
        className: classNames("".concat(prefixCls, "-trigger-icon"), hashId)
    }, triggerIcon)))));
};
