import { __assign, __rest } from "tslib";
import React, { useContext } from 'react';
import classNames from 'classnames';
import Indicator from './indicator';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
var Loader = function (props) {
    var _a, _b, _c;
    var _d = props.size, size = _d === void 0 ? 'md' : _d, _e = props.loading, loading = _e === void 0 ? true : _e, _f = props.vertical, vertical = _f === void 0 ? false : _f, _g = props.blurred, blurred = _g === void 0 ? true : _g, indicator = props.indicator, tip = props.tip, className = props.className, children = props.children, customisedCls = props.prefixCls, otherProps = __rest(props, ["size", "loading", "vertical", "blurred", "indicator", "tip", "className", "children", "prefixCls"]);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('loader', configContext.prefixCls, customisedCls);
    var cls = classNames(prefixCls, className, prefixCls + "_" + size, (_a = {},
        _a[prefixCls + "_spinning"] = loading,
        _a));
    var indicatorCls = classNames(prefixCls + "__loader-container", (_b = {},
        _b[prefixCls + "__loader-container_vertical"] = vertical,
        _b));
    var containerCls = classNames(prefixCls + "__container", (_c = {},
        _c[prefixCls + "__container_loading"] = loading,
        _c[prefixCls + "__container_blurred"] = loading && blurred,
        _c));
    return (React.createElement("div", __assign({}, otherProps, { className: cls }),
        loading && (React.createElement("div", { className: indicatorCls },
            indicator ? indicator : React.createElement(Indicator, { className: prefixCls + "__indicator", size: size }),
            tip && React.createElement("span", { className: prefixCls + "__label" }, tip))),
        children && React.createElement("div", { className: containerCls }, children)));
};
Loader.displayName = 'Loader';
export default Loader;
//# sourceMappingURL=index.js.map