"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
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;
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar(require("react"));
var styled_components_1 = __importDefault(require("styled-components"));
var styled_system_1 = require("styled-system");
var Heading_1 = require("../Text/Heading");
var MenuGroup_hooks_1 = require("./MenuGroup.hooks");
exports.MenuGroupLabel = function (_a) {
    var labelContent = _a.labelContent, labelStyles = _a.labelStyles, props = __rest(_a, ["labelContent", "labelStyles"]);
    var labelShimRef = react_1.useRef();
    var isLabelShimVisible = MenuGroup_hooks_1.useElementVisibility(labelShimRef);
    return (react_1.default.createElement(MenuGroupLabelWrapper, { renderBoxShadow: !isLabelShimVisible },
        react_1.default.createElement("div", { ref: labelShimRef, style: { height: '0' } }),
        react_1.default.createElement(Heading_1.Heading, __assign({ fontSize: "small", as: "h2", px: "medium", py: "xsmall", fontWeight: "semiBold", style: labelStyles }, props), labelContent)));
};
var MenuGroupLabelWrapper = styled_components_1.default.div.withConfig({ displayName: "MenuGroupLabelWrapper", componentId: "sc-1jfel5q" })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  ", "\n  box-shadow: ", ";\n  position: sticky;\n  top: -1px;\n  margin-bottom: ", ";\n"], ["\n  ", "\n  box-shadow: ",
    ";\n  position: sticky;\n  top: -1px;\n  margin-bottom: ", ";\n"])), styled_system_1.color, function (_a) {
    var renderBoxShadow = _a.renderBoxShadow, theme = _a.theme;
    return renderBoxShadow
        ? "0 4px 8px -2px " + theme.colors.palette.charcoal200
        : 'none';
}, function (_a) {
    var theme = _a.theme;
    return theme.space.xxsmall;
});
exports.MenuGroupLabel.defaultProps = {
    backgroundColor: 'palette.white',
};
var templateObject_1;
//# sourceMappingURL=MenuGroupLabel.js.map