var __assign = this && this.__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

var __rest = this && this.__rest || function (s, e) {
  var t = {};

  for (var p in s) {
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  }

  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  }
  return t;
};

import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { useCallback, useMemo } from 'react';
import Icon from "../../icon";
import classNames from 'classnames';
import { LayoutDirection } from "../index";
import { prefixCls } from "../index";
var ZoomControl = /*#__PURE__*/React.memo(function (_a) {
  var zoom = _a.zoom,
      displayDirection = _a.displayDirection,
      reverseLayout = _a.reverseLayout,
      onValueClick = _a.onValueClick,
      onZoomIn = _a.onZoomIn,
      onZoomOut = _a.onZoomOut,
      restProps = __rest(_a, ["zoom", "displayDirection", "reverseLayout", "onValueClick", "onZoomIn", "onZoomOut"]);

  var handleZoomIn = useCallback(function () {
    onZoomIn === null || onZoomIn === void 0 ? void 0 : onZoomIn();
  }, [onZoomIn]);
  var handleZoomOut = useCallback(function () {
    onZoomOut === null || onZoomOut === void 0 ? void 0 : onZoomOut();
  }, [onZoomOut]);
  var style = useMemo(function () {
    return {
      flexDirection: reverseLayout ? displayDirection === LayoutDirection.row ? 'row-reverse' : 'column-reverse' : displayDirection === LayoutDirection.row ? 'row' : 'column'
    };
  }, [displayDirection, reverseLayout]);
  return _jsxs("div", __assign({}, restProps, {
    className: classNames(prefixCls + "-zoom", {
      row: displayDirection === LayoutDirection.row,
      column: displayDirection === LayoutDirection.column
    }),
    style: style
  }, {
    children: [_jsx("div", __assign({
      className: prefixCls + "-zoom-icon",
      onClick: handleZoomIn
    }, {
      children: _jsx(Icon, {
        icon: "add",
        size: 16
      }, void 0)
    }), void 0), _jsx("div", {
      className: prefixCls + "-zoom-line"
    }, void 0), _jsx("div", __assign({
      className: prefixCls + "-zoom-control"
    }, {
      children: _jsx("div", __assign({
        className: prefixCls + "-zoom-control-text",
        onClick: onValueClick
      }, {
        children: zoom
      }), void 0)
    }), void 0), _jsx("div", {
      className: prefixCls + "-zoom-line"
    }, void 0), _jsx("div", __assign({
      className: prefixCls + "-zoom-icon",
      onClick: handleZoomOut
    }, {
      children: _jsx(Icon, {
        icon: "remove",
        size: 16
      }, void 0)
    }), void 0)]
  }), void 0);
});
export default ZoomControl;

