import _extends from '@babel/runtime/helpers/extends';
import React__default from 'react';
import PropTypes from 'prop-types';
import Button from '../Button/Button.js';
import { settings } from '../../constants/Settings.js';
import { ZoomIn, ZoomOut } from '@carbon/icons-react';

var iotPrefix = settings.iotPrefix;
var propTypes = {
  i18n: PropTypes.shape({
    zoomIn: PropTypes.string,
    zoomOut: PropTypes.string
  }),
  /** callback to handle zoom in */
  onZoomIn: PropTypes.func.isRequired,
  /** callback to handle zoom out */
  onZoomOut: PropTypes.func.isRequired,
  /** set true to use button size 'small' instead of size 'field' */
  smallButtons: PropTypes.bool,
  testId: PropTypes.string,
  /** position of the control buttons tooltip */
  tooltipPosition: PropTypes.oneOf(['left', 'top', 'bottom', 'right']).isRequired
};
var defaultProps = {
  i18n: {
    zoomIn: 'Zoom In',
    zoomOut: 'Zoom out'
  },
  smallButtons: false,
  testId: 'map-zoom-control'
};
var Zoom = function Zoom(_ref) {
  var onZoomIn = _ref.onZoomIn,
    onZoomOut = _ref.onZoomOut,
    i18n = _ref.i18n,
    testId = _ref.testId,
    tooltipPosition = _ref.tooltipPosition,
    smallButtons = _ref.smallButtons;
  var buttonSize = smallButtons ? 'sm' : 'md';
  return /*#__PURE__*/React__default.createElement("div", {
    className: "".concat(iotPrefix, "--map-zoom"),
    "data-testid": testId
  }, /*#__PURE__*/React__default.createElement(Button, {
    renderIcon: function renderIcon(props) {
      return /*#__PURE__*/React__default.createElement(ZoomIn, _extends({
        size: 16
      }, props));
    },
    hasIconOnly: true,
    kind: "ghost",
    size: buttonSize,
    onClick: onZoomIn,
    tooltipPosition: tooltipPosition,
    iconDescription: i18n.zoomIn,
    testId: "".concat(testId, "-zoom-in")
  }), /*#__PURE__*/React__default.createElement(Button, {
    renderIcon: function renderIcon(props) {
      return /*#__PURE__*/React__default.createElement(ZoomOut, _extends({
        size: 16
      }, props));
    },
    hasIconOnly: true,
    kind: "ghost",
    size: buttonSize,
    onClick: onZoomOut,
    tooltipPosition: tooltipPosition,
    iconDescription: i18n.zoomOut,
    testId: "".concat(testId, "-zoom-out")
  }));
};
Zoom.defaultProps = defaultProps;
Zoom.propTypes = propTypes;
Zoom.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "Zoom",
  "props": {
    "i18n": {
      "defaultValue": {
        "value": "{\n  zoomIn: 'Zoom In',\n  zoomOut: 'Zoom out',\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "zoomIn": {
            "name": "string",
            "required": false
          },
          "zoomOut": {
            "name": "string",
            "required": false
          }
        }
      },
      "required": false
    },
    "smallButtons": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "set true to use button size 'small' instead of size 'field'",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "testId": {
      "defaultValue": {
        "value": "'map-zoom-control'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "onZoomIn": {
      "description": "callback to handle zoom in",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "onZoomOut": {
      "description": "callback to handle zoom out",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "tooltipPosition": {
      "description": "position of the control buttons tooltip",
      "type": {
        "name": "enum",
        "value": [{
          "value": "'left'",
          "computed": false
        }, {
          "value": "'top'",
          "computed": false
        }, {
          "value": "'bottom'",
          "computed": false
        }, {
          "value": "'right'",
          "computed": false
        }]
      },
      "required": true
    }
  }
};
var ZoomControl = Zoom;

export { ZoomControl as default };
