'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
require('react');
var classnames = require('classnames');
var ramda = require('ramda');
var Button = require('./Button.js');
var Tooltip = require('./Tooltip.js');
var Typography = require('./Typography.js');
var jsxRuntime = require('react/jsx-runtime');
require('react-router-dom');
require('./Spinner.js');
require('@babel/runtime/helpers/slicedToArray');
require('@tippyjs/react');
require('tippy.js');
require('@bigbinary/neeto-hotkeys');
require('./overlayManager.js');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('@bigbinary/neeto-cist');
require('qs');
require('./index-BgzkP01c.js');
require('@babel/runtime/helpers/toConsumableArray');
require('dayjs');
require('dayjs/plugin/localeData');
require('dayjs/plugin/utc');
require('dayjs/plugin/weekday');
require('dayjs/plugin/weekOfYear');
require('i18next');
require('./usePrefersReducedMotion-D2Ck84HM.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);
var classnames__default = /*#__PURE__*/_interopDefault(classnames);

var renderImage = function renderImage(image) {
  return typeof image === "string" ? /*#__PURE__*/jsxRuntime.jsx("img", {
    "data-testid": "no-data-image",
    src: image
  }) : image;
};

var _excluded = ["image", "title", "description", "helpText", "className", "primaryButtonProps", "secondaryButtonProps", "buttonSeparatorText", "showTooltipWhenButtonDisabled"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var NoData = function NoData(_ref) {
  var _ref$image = _ref.image,
    image = _ref$image === void 0 ? null : _ref$image,
    _ref$title = _ref.title,
    title = _ref$title === void 0 ? "" : _ref$title,
    _ref$description = _ref.description,
    description = _ref$description === void 0 ? "" : _ref$description,
    _ref$helpText = _ref.helpText,
    helpText = _ref$helpText === void 0 ? null : _ref$helpText,
    _ref$className = _ref.className,
    className = _ref$className === void 0 ? "" : _ref$className,
    _ref$primaryButtonPro = _ref.primaryButtonProps,
    primaryButtonProps = _ref$primaryButtonPro === void 0 ? {} : _ref$primaryButtonPro,
    _ref$secondaryButtonP = _ref.secondaryButtonProps,
    secondaryButtonProps = _ref$secondaryButtonP === void 0 ? {} : _ref$secondaryButtonP,
    _ref$buttonSeparatorT = _ref.buttonSeparatorText,
    buttonSeparatorText = _ref$buttonSeparatorT === void 0 ? "" : _ref$buttonSeparatorT,
    _ref$showTooltipWhenB = _ref.showTooltipWhenButtonDisabled,
    showTooltipWhenButtonDisabled = _ref$showTooltipWhenB === void 0 ? false : _ref$showTooltipWhenB,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded);
  var hasPrimaryButtonProps = !ramda.isEmpty(primaryButtonProps);
  var hasSecondaryButtonProps = !ramda.isEmpty(secondaryButtonProps);
  var hasButtonSeparatorText = !ramda.isEmpty(buttonSeparatorText);
  var showButtonSeparator = hasButtonSeparatorText && hasPrimaryButtonProps && hasSecondaryButtonProps;
  return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
    className: classnames__default.default("neeto-ui-no-data", [className]),
    "data-testid": "no-data-container"
  }, otherProps), {}, {
    children: [image ? /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "neeto-ui-no-data__image",
      children: renderImage(image)
    }) : null, title && /*#__PURE__*/jsxRuntime.jsx(Typography, {
      className: "neeto-ui-text-center",
      "data-testid": "no-data-title",
      lineHeight: "none",
      style: "h3",
      children: title
    }), description && /*#__PURE__*/jsxRuntime.jsx(Typography, {
      className: "neeto-ui-text-center neeto-ui-no-data__description",
      "data-testid": "no-data-description",
      lineHeight: "normal",
      style: "body2",
      children: description
    }), helpText && /*#__PURE__*/jsxRuntime.jsx(Typography, {
      className: "neeto-ui-text-center neeto-ui-no-data__help-text",
      "data-testid": "no-data-help-text",
      lineHeight: "normal",
      style: "body2",
      children: helpText
    }), (hasPrimaryButtonProps || hasSecondaryButtonProps) && /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: "neeto-ui-no-data__action-block",
      children: [hasPrimaryButtonProps && /*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread(_objectSpread({}, primaryButtonProps === null || primaryButtonProps === void 0 ? void 0 : primaryButtonProps.tooltipProps), {}, {
        disabled: ramda.isNil(primaryButtonProps === null || primaryButtonProps === void 0 ? void 0 : primaryButtonProps.tooltipProps) || !showTooltipWhenButtonDisabled && (primaryButtonProps === null || primaryButtonProps === void 0 ? void 0 : primaryButtonProps.disabled),
        children: /*#__PURE__*/jsxRuntime.jsx("div", {
          children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({
            "data-testid": "no-data-primary-button"
          }, ramda.omit(["tooltipProps"], primaryButtonProps)))
        })
      })), showButtonSeparator && /*#__PURE__*/jsxRuntime.jsx(Typography, {
        lineHeight: "normal",
        style: "body2",
        children: buttonSeparatorText
      }), hasSecondaryButtonProps && /*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread(_objectSpread({}, secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.tooltipProps), {}, {
        disabled: ramda.isNil(secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.tooltipProps) || !showTooltipWhenButtonDisabled && (secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.disabled),
        children: /*#__PURE__*/jsxRuntime.jsx("div", {
          children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({
            "data-testid": "no-data-secondary-button",
            style: "secondary"
          }, ramda.omit(["tooltipProps"], secondaryButtonProps)))
        })
      }))]
    })]
  }));
};

module.exports = NoData;
//# sourceMappingURL=NoData.js.map
