import * as React from 'react';
import clsx from 'classnames';
import ActionButton from '../action-button';
import { ActionButtonContext } from '../../context';
import StopLoadingIcon from './StopLoading';
// Icon component
const StopLoadingIconWrapper = () => {
    const context = React.useContext(ActionButtonContext);
    const prefixCls = context === null || context === void 0 ? void 0 : context.prefixCls;
    return (React.createElement("div", { className: `${prefixCls}-loading-icon` },
        React.createElement(StopLoadingIcon, null)));
};
function LoadingButton(props, ref) {
    const { className, style, disabled, ...restProps } = props;
    const context = React.useContext(ActionButtonContext);
    const prefixCls = context === null || context === void 0 ? void 0 : context.prefixCls;
    return (React.createElement(ActionButton, { icon: React.createElement(StopLoadingIconWrapper, null), type: "button", shape: "circle", ...restProps, action: "onCancel", ref: ref, disabled: disabled, className: clsx(`${prefixCls}-loading-button`, className), style: style }));
}
export default React.forwardRef(LoadingButton);
