var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
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 * as _ from "lodash";
import * as classnames from "classnames";
import * as React from "react";
import * as PropTypes from "prop-types";
import ItemAlign from "./ItemAlign";
import "../less/flex.less";
export var cssClass = {
    GROW: "flex--grow",
    alignSelf: function (value) { return "self--" + value; },
};
export default function FlexItem(_a) {
    var alignSelf = _a.alignSelf, children = _a.children, className = _a.className, _b = _a.component, Wrapper = _b === void 0 ? "div" : _b, _c = _a.grow, grow = _c === void 0 ? false : _c, additionalProps = __rest(_a, ["alignSelf", "children", "className", "component", "grow"]);
    return (React.createElement(Wrapper, __assign({ className: classnames(alignSelf && cssClass.alignSelf(alignSelf), grow && cssClass.GROW, className) }, additionalProps), children));
}
FlexItem.propTypes = {
    alignSelf: PropTypes.oneOf(_.values(ItemAlign)),
    children: PropTypes.node,
    className: PropTypes.string,
    component: PropTypes.any,
    grow: PropTypes.bool,
};
FlexItem.defaultProps = {
    component: "div",
};
