"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ZoomControls;
var _react = _interopRequireDefault(require("react"));
var _faMagnifyingGlassPlus = require("@fortawesome/free-solid-svg-icons/faMagnifyingGlassPlus");
var _faMagnifyingGlassMinus = require("@fortawesome/free-solid-svg-icons/faMagnifyingGlassMinus");
var _faArrowsRotate = require("@fortawesome/free-solid-svg-icons/faArrowsRotate");
var _fontAwesomeIcon = require("../font-awesome-icon");
var _button = require("../button");
var _useTranslation = require("../hooks/use-translation");
var _constants = require("./constants");
var _tooltip = require("../tooltip");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/** Zoom is used on graphs if you need to increase or decrease data visualization
 *  @midnight-gray-supported
 *  @alpine-light-supported
 *  */
function ZoomControls({
  currentZoom,
  onZoomIn,
  onZoomOut,
  onZoomReset,
  className = '',
  minZoomFactor = _constants.MIN_ZOOM_FACTOR,
  maxZoomFactor = _constants.MAX_ZOOM_FACTOR,
  testId,
  hidden = false,
  zoomInText,
  zoomOutText,
  resetText,
  zoomInIcon = _faMagnifyingGlassPlus.faMagnifyingGlassPlus,
  zoomOutIcon = _faMagnifyingGlassMinus.faMagnifyingGlassMinus,
  resetIcon = _faArrowsRotate.faArrowsRotate
}) {
  const {
    t
  } = (0, _useTranslation.useTranslation)();
  const zoomInTextWithDefault = zoomInText ?? t('Zoom in');
  const zoomOutTextWithDefault = zoomOutText ?? t('Zoom out');
  const resetTextWithDefault = resetText ?? t('Reset zoom');
  if (hidden) {
    return null;
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
    className: `zoom-controls ${className}`,
    "test-id": testId,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
      className: "button command zoom-item",
      isDisabled: currentZoom >= maxZoomFactor,
      onClick: onZoomIn,
      testId: "zoom-in",
      type: _button.BUTTON_TYPES.BUTTON,
      accentType: _button.ACCENT_TYPES.ROUND_ICON,
      tooltipText: zoomInTextWithDefault,
      "aria-label": zoomInTextWithDefault,
      tooltipPlacement: _tooltip.TOOLTIP_PLACEMENT_TYPES.TOP,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
        icon: zoomInIcon
      })
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
      className: "button command zoom-item",
      isDisabled: currentZoom <= minZoomFactor,
      onClick: onZoomOut,
      testId: "zoom-out",
      accentType: _button.ACCENT_TYPES.ROUND_ICON,
      type: _button.BUTTON_TYPES.BUTTON,
      tooltipText: zoomOutTextWithDefault,
      "aria-label": zoomOutTextWithDefault,
      tooltipPlacement: _tooltip.TOOLTIP_PLACEMENT_TYPES.TOP,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
        icon: zoomOutIcon
      })
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
      className: "button command zoom-item",
      isDisabled: currentZoom === _constants.INITIAL_ZOOM_FACTOR,
      onClick: onZoomReset,
      testId: "zoom-reset",
      accentType: _button.ACCENT_TYPES.ROUND_ICON,
      type: _button.BUTTON_TYPES.BUTTON,
      tooltipText: resetTextWithDefault,
      "aria-label": resetTextWithDefault,
      tooltipPlacement: _tooltip.TOOLTIP_PLACEMENT_TYPES.TOP,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
        icon: resetIcon
      })
    })]
  });
}