"use strict";

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

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

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

var _Iconfont = _interopRequireDefault(require("../Iconfont"));

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 textAlignMenu = [{
  id: 1,
  name: 'left',
  icon: 'icon-align-left'
}, {
  id: 2,
  name: 'center',
  icon: 'icon-align-center'
}, {
  id: 3,
  name: 'right',
  icon: 'icon-align-right'
}];
var alignItemMap = {
  left: 'flex-start',
  center: 'center',
  right: 'flex-end'
};
exports.alignItemMap = alignItemMap;

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

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

  AlignSelector.prototype.render = function () {
    var _a = this.props,
        onChange = _a.onChange,
        value = _a.value;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "m-align-selector"
    }, textAlignMenu.map(function (m) {
      return /*#__PURE__*/_react["default"].createElement("span", {
        key: m.id,
        className: (0, _classnames["default"])('item-icon', {
          active: value === m.name
        }),
        onClick: function onClick() {
          return onChange(m.name);
        }
      }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
        color: "#000",
        size: 20,
        type: m.icon
      }));
    }));
  };

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

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