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, Tooltip } from "antd";
import classNames from "classnames";
import React, { useContext } from "react";
import { useStyle } from "./style";
export var IconButton = function(param) {
    var className = param.className, style = param.style, icon = param.icon, tooltip = param.tooltip, disabled = param.disabled, active = param.active, elevated = param.elevated, _param_size = param.size, size = _param_size === void 0 ? 'base' : _param_size, legacyLoading = param.loading, isLoading = param.isLoading, onClick = param.onClick;
    // 兼容旧属性
    var loading = isLoading !== null && isLoading !== void 0 ? isLoading : legacyLoading;
    var context = useContext(ConfigProvider.ConfigContext);
    var prefixCls = context === null || context === void 0 ? void 0 : context.getPrefixCls('icon-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: rootCls,
        style: style
    }, /*#__PURE__*/ React.createElement(Tooltip, {
        title: tooltip
    }, /*#__PURE__*/ React.createElement(Button, {
        icon: icon,
        disabled: disabled,
        loading: loading,
        onClick: onClick,
        className: classNames("".concat(prefixCls, "-button"), hashId, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-button-active"), active), _define_property(_obj, "".concat(prefixCls, "-button-loading"), loading), _define_property(_obj, "".concat(prefixCls, "-button-disabled"), disabled), _define_property(_obj, "".concat(prefixCls, "-button-elevated"), elevated), _define_property(_obj, "".concat(prefixCls, "-button-sm"), size === 'sm'), _define_property(_obj, "".concat(prefixCls, "-button-xs"), size === 'xs'), _obj))
    }))));
};
export default IconButton;
