"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.Footer = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _FooterSt = require("./Footer.st.css.js");
var _Button = _interopRequireDefault(require("../../../Button"));
var _constants = require("../../constants");
var _Divider = _interopRequireDefault(require("../../../Divider"));
var _BaseModalLayoutContext = require("../../BaseModalLayoutContext");
var _Tooltip = _interopRequireDefault(require("../../../Tooltip"));
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/BaseModalLayout/LayoutBlocks/Footer/Footer.tsx";
var Footer = _ref => {
  var {
    dataHook,
    className,
    showFooterDivider = false
  } = _ref;
  var {
    footerClassName,
    skin,
    actionsSize,
    sideActions,
    secondaryButtonText,
    secondaryButtonOnClick,
    secondaryButtonProps,
    primaryButtonText,
    primaryButtonOnClick,
    primaryButtonProps,
    primaryButtonTooltipProps
  } = (0, _BaseModalLayoutContext.useBaseModalLayoutContext)();
  var hasPrimaryButton = primaryButtonText || primaryButtonOnClick || primaryButtonProps;
  var hasSecondaryButton = secondaryButtonText || secondaryButtonOnClick || secondaryButtonProps;
  var hasFooter = hasPrimaryButton || hasSecondaryButton || sideActions;
  return hasFooter && /*#__PURE__*/_react.default.createElement("div", {
    "data-hook": dataHook,
    "data-divider": showFooterDivider,
    className: (0, _FooterSt.st)(_FooterSt.classes.root, {
      showDivider: showFooterDivider
    }, footerClassName, className),
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 36,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_Divider.default, {
    className: _FooterSt.classes.divider,
    dataHook: _constants.dataHooks.footerDivider,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 46,
      columnNumber: 9
    }
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: _FooterSt.classes.innerContent,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 50,
      columnNumber: 9
    }
  }, sideActions && /*#__PURE__*/_react.default.createElement("div", {
    "data-hook": _constants.dataHooks.footerSideActions,
    className: _FooterSt.classes.sideActions,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 52,
      columnNumber: 13
    }
  }, sideActions), (hasPrimaryButton || hasSecondaryButton) && /*#__PURE__*/_react.default.createElement("div", {
    className: _FooterSt.classes.actions,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 60,
      columnNumber: 13
    }
  }, hasSecondaryButton && /*#__PURE__*/_react.default.createElement(_Button.default, (0, _extends2.default)({
    skin: skin,
    size: actionsSize,
    onClick: secondaryButtonOnClick,
    priority: "secondary",
    dataHook: _constants.dataHooks.footerSecondaryButton
  }, secondaryButtonProps, {
    internalDataHook: _constants.dataHooks.footerSecondaryButton,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 62,
      columnNumber: 17
    }
  }), secondaryButtonText || secondaryButtonProps && secondaryButtonProps.children), hasPrimaryButton && /*#__PURE__*/_react.default.createElement(_Tooltip.default, (0, _extends2.default)({
    dataHook: _constants.dataHooks.primaryButtonTooltip,
    disabled: !(primaryButtonTooltipProps != null && primaryButtonTooltipProps.content)
  }, primaryButtonTooltipProps, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 76,
      columnNumber: 17
    }
  }), /*#__PURE__*/_react.default.createElement(_Button.default, (0, _extends2.default)({
    skin: skin,
    size: actionsSize,
    onClick: primaryButtonOnClick,
    dataHook: _constants.dataHooks.footerPrimaryButton
  }, primaryButtonProps, {
    internalDataHook: _constants.dataHooks.footerPrimaryButton,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 81,
      columnNumber: 19
    }
  }), primaryButtonText || (primaryButtonProps == null ? void 0 : primaryButtonProps.children)))))) || null;
};
exports.Footer = Footer;
Footer.displayName = 'BaseModalLayout.Footer';
//# sourceMappingURL=Footer.js.map