"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tab = void 0;
const tslib_1 = require("tslib");
const components_1 = require("@bluebase/components");
const Tab_1 = tslib_1.__importDefault(require("@material-ui/core/Tab"));
const react_1 = tslib_1.__importDefault(require("react"));
const styles_1 = require("@material-ui/core/styles");
Tab_1.default.displayName = 'Tab';
function getTabUI(props) {
    return react_1.default.createElement(Tab_1.default, Object.assign({}, props));
}
exports.Tab = (props) => {
    const { icon } = props, rest = tslib_1.__rest(props, ["icon"]);
    const Wrapper = getTabUI;
    const Styled = styles_1.withStyles(props.styles || {})(Wrapper);
    let iconNode;
    if (react_1.default.isValidElement(icon)) {
        iconNode = icon;
    }
    else if (!!icon) {
        iconNode = (react_1.default.createElement(components_1.DynamicIcon, Object.assign({ size: icon.size || 24, style: Object.assign({ lineHeight: icon.size || 24 }, icon.style) }, icon)));
    }
    return react_1.default.createElement(Styled, Object.assign({}, rest, { icon: iconNode }));
};
