"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
var _react = _interopRequireDefault(require("react"));
class Option extends _react.default.Component {
  constructor() {
    super(...arguments);
    (0, _defineProperty2.default)(this, "onClick", event => {
      event.stopPropagation();
      event.nativeEvent.stopImmediatePropagation();
      const {
        option
      } = this.props;
      this.props.onOptionChanged(option);
    });
  }
  render() {
    const {
      option,
      isActive,
      optionClass
    } = this.props;
    const className = `option-item ${optionClass || ''} ${isActive ? 'active' : ''}`;
    return /*#__PURE__*/_react.default.createElement("span", {
      className: className,
      onClick: this.onClick
    }, option.iconClass && /*#__PURE__*/_react.default.createElement("span", {
      className: `item-icon ${option.iconClass}`
    }), /*#__PURE__*/_react.default.createElement("span", {
      className: "label"
    }, option.label));
  }
}
var _default = exports.default = Option;