"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _radio = _interopRequireDefault(require("../../radio"));
var _row = _interopRequireDefault(require("../../row"));
var _col = _interopRequireDefault(require("../../col"));
var _labelInput = _interopRequireDefault(require("./label-input"));
var _jsxRuntime = require("react/jsx-runtime");
const cropperRatio = [{
  label: '16:9',
  value: 16 / 9
}, {
  label: '4:3',
  value: 4 / 3
}, {
  label: '1:1',
  value: 1
}, {
  label: '自定义',
  value: 0
}];
const CropperToolbar = ({
  onHeightChange,
  onRatioChange,
  onWidthChange,
  width,
  height,
  ratio,
  extra
}) => {
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_row.default, {
    className: "wii-cropper-toolbar",
    gutter: 16,
    wrap: false,
    justify: "space-between",
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_col.default, {
      flex: 1,
      children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_row.default, {
        gutter: 16,
        wrap: false,
        children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_col.default, {
          children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_radio.default.Group, {
            optionType: "button",
            options: cropperRatio,
            value: ratio,
            onChange: e => {
              onRatioChange(e.target.value);
            },
            buttonStyle: "solid"
          })
        }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_col.default, {
          children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_row.default, {
            gutter: 8,
            wrap: false,
            children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_col.default, {
              span: 12,
              children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_labelInput.default, {
                label: "\u5BBD\u5EA6",
                id: "width",
                value: width,
                onChange: val => {
                  onWidthChange(val);
                }
              })
            }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_col.default, {
              span: 12,
              children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_labelInput.default, {
                label: "\u9AD8\u5EA6",
                id: "height",
                value: height,
                onChange: val => {
                  onHeightChange(val);
                }
              })
            })]
          })
        })]
      })
    }), extra ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_col.default, {
      className: "wii-cropper-toolbar-extra",
      children: extra
    }) : null]
  });
};
var _default = CropperToolbar;
exports.default = _default;