/* banner.tsx generated by @compiled/babel-plugin v0.38.1 */
"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Banner = Banner;
require("./banner.compiled.css");
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _runtime = require("@compiled/react/runtime");
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _skipLinksContext = require("../../context/skip-links/skip-links-context");
var _useIsFhsEnabled = require("../fhs-rollout/use-is-fhs-enabled");
var _constants = require("./constants");
var _hoistSlotSizesContext = require("./hoist-slot-sizes-context");
var _hoistUtils = require("./hoist-utils");
var _idUtils = require("./id-utils");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var styles = {
  root: "_nd5ldkfm _1reo15vq _18m915vq _4t3iutvi _152tidpf _kqsw1if8 _1pbyegat",
  fullHeightSidebarWithLayeringFixes: "_1pbycs5v"
};

/**
 * The banner layout area. It will always be displayed at the top of the screen.
 *
 * Should be used to render a `Banner` component from `@atlaskit/banner`.
 */
function Banner(_ref) {
  var children = _ref.children,
    xcss = _ref.xcss,
    _ref$height = _ref.height,
    height = _ref$height === void 0 ? 48 : _ref$height,
    _ref$skipLinkLabel = _ref.skipLinkLabel,
    skipLinkLabel = _ref$skipLinkLabel === void 0 ? 'Banner' : _ref$skipLinkLabel,
    testId = _ref.testId,
    providedId = _ref.id;
  var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
  var id = (0, _idUtils.useLayoutId)({
    providedId: providedId
  });
  var isFhsEnabled = (0, _useIsFhsEnabled.useIsFhsEnabled)();

  /**
   * Don't show the skip link if the slot has 0 height.
   */
  (0, _skipLinksContext.useSkipLinkInternal)({
    id: id,
    label: skipLinkLabel,
    isHidden: height === 0
  });
  return /*#__PURE__*/React.createElement("div", {
    id: id,
    "data-layout-slot": true,
    className: (0, _runtime.ax)([styles.root, isFhsEnabled && (0, _platformFeatureFlags.fg)('platform-dst-side-nav-layering-fixes') && styles.fullHeightSidebarWithLayeringFixes, xcss]),
    "data-testid": testId
  }, /*#__PURE__*/React.createElement(_hoistUtils.HoistCssVarToLocalGrid, {
    variableName: _constants.bannerMountedVar,
    value: height
  }), dangerouslyHoistSlotSizes &&
  /*#__PURE__*/
  // ------ START UNSAFE STYLES ------
  // These styles are only needed for the UNSAFE legacy use case for Jira + Confluence.
  // When they aren't needed anymore we can delete them wholesale.
  React.createElement(_hoistUtils.DangerouslyHoistCssVarToDocumentRoot, {
    variableName: _constants.UNSAFE_bannerVar,
    value: height
  })
  // ------ END UNSAFE STYLES ------
  , children);
}