import React, { PureComponent } from 'react';
import Ellipsis from '../common/Ellipsis';
import { generateDataAttr } from '../utils/generateDataAttr';
import { classes, st } from './Button.st.css.js';
import { WixStyleReactDefaultsOverrideContext, } from '../WixStyleReactDefaultsOverrideProvider';
import deprecationLog from '../utils/deprecationLog';
import ButtonCore from './ButtonCore';
class Button extends PureComponent {
    constructor(props) {
        super(props);
        this.button = React.createRef();
        /**
         * Sets focus on the element
         */
        this.focus = (options) => {
            this.button.current && this.button.current.focus(options);
        };
        /**
         * Returns the size and position of the element
         */
        this.getBoundingClientRect = () => {
            return this.button.current?.getBoundingClientRect();
        };
        if (props.skin === 'inverted') {
            deprecationLog('<Button/> - skin="inverted" is deprecated and will be removed in next major version, please use skin="standard" and priority="secondary" instead');
        }
    }
    render() {
        const { button: buttonPropsDefaults } = this
            .context;
        const { skin = 'standard', priority = 'primary', size = buttonPropsDefaults.size, className, fullWidth, children, dataHook, ellipsis, showTooltip, internalDataHook, tooltipProps = {}, ...rest } = this.props;
        return (React.createElement(Ellipsis, { ellipsis: ellipsis, showTooltip: showTooltip, ...tooltipProps, render: ({ ref, ellipsisClasses }) => (React.createElement(ButtonCore, { ...rest, ...generateDataAttr({
                    ...this.props,
                    size,
                }, ['skin', 'size', 'priority']), ref: this.button, className: st(classes.root, {
                    fluid: !!fullWidth,
                    skin,
                    priority,
                    size,
                    ellipsis: !!ellipsis,
                }, className), "data-hook": dataHook, "data-hook-internal": internalDataHook, contentClassName: ellipsisClasses(), contentRef: ref }, children)) }));
    }
}
Button.contextType = WixStyleReactDefaultsOverrideContext;
Button.displayName = 'Button';
export default Button;
//# sourceMappingURL=Button.js.map