"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

require("./index.less");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var __extends = void 0 && (void 0).__extends || function () {
  var _extendStatics = function extendStatics(d, b) {
    _extendStatics = Object.setPrototypeOf || {
      __proto__: []
    } instanceof Array && function (d, b) {
      d.__proto__ = b;
    } || function (d, b) {
      for (var p in b) {
        if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
      }
    };

    return _extendStatics(d, b);
  };

  return function (d, b) {
    if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");

    _extendStatics(d, b);

    function __() {
      this.constructor = d;
    }

    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();

var layoutType = [{
  id: 1,
  value: 'right'
}, {
  id: 2,
  value: 'left'
}, {
  id: 3,
  value: 'bottom'
}, {
  id: 4,
  value: 'top'
}];

var ButtonIconLayout =
/** @class */
function (_super) {
  __extends(ButtonIconLayout, _super);

  function ButtonIconLayout() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  ButtonIconLayout.prototype.render = function () {
    var _a = this.props,
        onChange = _a.onChange,
        value = _a.value,
        icon = _a.icon;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "m-button-icon-layout"
    }, layoutType.map(function (item) {
      return /*#__PURE__*/_react["default"].createElement("div", {
        key: item.id,
        className: (0, _classnames["default"])('item-wrap', {
          vertical: item.value === 'top' || item.value === 'bottom',
          active: value === item.value
        }),
        onClick: function onClick() {
          onChange(item.value);
        }
      }, (item.value === 'right' || item.value === 'bottom') && /*#__PURE__*/_react["default"].createElement("span", {
        className: "text el"
      }, "Text"), icon && /*#__PURE__*/_react["default"].createElement("img", {
        alt: "",
        className: "el",
        src: icon
      }), (item.value === 'left' || item.value === 'top') && /*#__PURE__*/_react["default"].createElement("span", {
        className: "text"
      }, "Text"));
    }));
  };

  ButtonIconLayout.defaultProps = {
    value: 'right',
    onChange: function onChange() {},
    icon: ''
  };
  return ButtonIconLayout;
}(_react["default"].Component);

var _default = ButtonIconLayout;
exports["default"] = _default;