var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import ConfigProvider from '../config-provider';
import React, { Component } from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { Button as NextButton } from '@alifd/next';
class Button extends Component {
    render() {
        const { size, warning, icon, className = '', prefix = 'next-' } = this.props;
        // 警告按钮就取默认type
        let type = this.props.type;
        if (warning) {
            type = undefined;
        }
        else if (icon) {
            if (this.props.type === 'primary') {
                type = 'secondary';
            }
        }
        // xl/xs 模式
        if (size === 'xl' || size === 'xs') {
            const _a = this.props, { size } = _a, otherProps = __rest(_a, ["size"]);
            return (React.createElement(NextButton, Object.assign({}, otherProps, { size: size, type: type })));
        }
        return (React.createElement(NextButton, Object.assign({}, this.props, { type: type, size: size, className: icon ? `${className ? className + ' ' : ''}${prefix}btn-type-icon ` : className })));
    }
}
Button.Group = NextButton.Group;
hoistNonReactStatics(Button, NextButton);
// export default Button;
export default ConfigProvider.config(Button);
