import React from 'react';
import { faMagnifyingGlassPlus } from '@fortawesome/free-solid-svg-icons/faMagnifyingGlassPlus';
import { faMagnifyingGlassMinus } from '@fortawesome/free-solid-svg-icons/faMagnifyingGlassMinus';
import { faArrowsRotate } from '@fortawesome/free-solid-svg-icons/faArrowsRotate';
import { FontAwesomeIcon } from '../font-awesome-icon';
import { Button, BUTTON_TYPES, ACCENT_TYPES } from '../button';
import { useTranslation } from '../hooks/use-translation';
import { MAX_ZOOM_FACTOR, MIN_ZOOM_FACTOR, INITIAL_ZOOM_FACTOR } from './constants';
import { TOOLTIP_PLACEMENT_TYPES } from '../tooltip';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/** Zoom is used on graphs if you need to increase or decrease data visualization
 *  @midnight-gray-supported
 *  @alpine-light-supported
 *  */
export default function ZoomControls({
  currentZoom,
  onZoomIn,
  onZoomOut,
  onZoomReset,
  className = '',
  minZoomFactor = MIN_ZOOM_FACTOR,
  maxZoomFactor = MAX_ZOOM_FACTOR,
  testId,
  hidden = false,
  zoomInText,
  zoomOutText,
  resetText,
  zoomInIcon = faMagnifyingGlassPlus,
  zoomOutIcon = faMagnifyingGlassMinus,
  resetIcon = faArrowsRotate
}) {
  const {
    t
  } = 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__*/_jsxs("div", {
    className: `zoom-controls ${className}`,
    "test-id": testId,
    children: [/*#__PURE__*/_jsx(Button, {
      className: "button command zoom-item",
      isDisabled: currentZoom >= maxZoomFactor,
      onClick: onZoomIn,
      testId: "zoom-in",
      type: BUTTON_TYPES.BUTTON,
      accentType: ACCENT_TYPES.ROUND_ICON,
      tooltipText: zoomInTextWithDefault,
      "aria-label": zoomInTextWithDefault,
      tooltipPlacement: TOOLTIP_PLACEMENT_TYPES.TOP,
      children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
        icon: zoomInIcon
      })
    }), /*#__PURE__*/_jsx(Button, {
      className: "button command zoom-item",
      isDisabled: currentZoom <= minZoomFactor,
      onClick: onZoomOut,
      testId: "zoom-out",
      accentType: ACCENT_TYPES.ROUND_ICON,
      type: BUTTON_TYPES.BUTTON,
      tooltipText: zoomOutTextWithDefault,
      "aria-label": zoomOutTextWithDefault,
      tooltipPlacement: TOOLTIP_PLACEMENT_TYPES.TOP,
      children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
        icon: zoomOutIcon
      })
    }), /*#__PURE__*/_jsx(Button, {
      className: "button command zoom-item",
      isDisabled: currentZoom === INITIAL_ZOOM_FACTOR,
      onClick: onZoomReset,
      testId: "zoom-reset",
      accentType: ACCENT_TYPES.ROUND_ICON,
      type: BUTTON_TYPES.BUTTON,
      tooltipText: resetTextWithDefault,
      "aria-label": resetTextWithDefault,
      tooltipPlacement: TOOLTIP_PLACEMENT_TYPES.TOP,
      children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
        icon: resetIcon
      })
    })]
  });
}