"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LoadableContainer = LoadableContainer;
var _react = _interopRequireDefault(require("react"));
var _loadingIcon = require("../loading-icon");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/** Wraps loadable content and shows loader when it is not ready. Note: it requires parent with height
 * [CAPITALIZATION] Use sentence case
 */
function LoadableContainer({
  isLoading,
  children,
  message = '',
  className = '',
  shouldKeepWrapper = true
}) {
  const content = isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_loadingIcon.LoadingIcon, {
    className: "loadable-container-icon",
    testId: "loadable-container-icon",
    message: message
  }) : children;
  return shouldKeepWrapper ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
    className: `loadable-container ${className}`,
    children: content
  }) : content;
}