import { __assign, __rest } from "tslib";
import React, { useContext } from 'react';
import classNames from 'classnames';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
var ScreenTypes = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
var Col = function (props) {
    var _a;
    var _b = props.span, span = _b === void 0 ? 24 : _b, _c = props.offset, offset = _c === void 0 ? 0 : _c, _d = props.order, order = _d === void 0 ? 0 : _d, customisedCls = props.prefixCls, className = props.className, style = props.style, children = props.children, otherProps = __rest(props, ["span", "offset", "order", "prefixCls", "className", "style", "children"]);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('col', configContext.prefixCls, customisedCls);
    var sizeClassObj = {};
    ScreenTypes.forEach(function (size) {
        var _a;
        var sizeProps = {};
        var propSize = props[size];
        if (typeof propSize === 'number') {
            sizeProps.span = propSize;
        }
        else if (typeof propSize === 'object') {
            sizeProps = propSize || {};
        }
        sizeClassObj = __assign(__assign({}, sizeClassObj), (_a = {}, _a[prefixCls + "-" + size + "-" + sizeProps.span] = sizeProps.span !== undefined, _a[prefixCls + "-" + size + "-order-" + sizeProps.order] = sizeProps.order || sizeProps.order === 0, _a[prefixCls + "-" + size + "-offset-" + sizeProps.offset] = sizeProps.offset || sizeProps.offset === 0, _a));
    });
    var cls = classNames(prefixCls, className, (_a = {},
        _a[prefixCls + "-" + span] = span,
        _a[prefixCls + "-offset-" + offset] = offset,
        _a[prefixCls + "-order-" + order] = order,
        _a), sizeClassObj);
    return (React.createElement("div", __assign({}, otherProps, { className: cls, style: style }), children));
};
Col.displayName = 'Col';
export default Col;
//# sourceMappingURL=col.js.map