text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
  
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  
  var _createClass2 = require('babel-runtime/helpers/createClass');
  
  var _createClass3 = _interopRequireDefault(_createClass2);
  
  var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
  
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  
  var _inherits2 = require('babel-runtime/helpers/inherits');
  
  var _inherits3 = _interopRequireDefault(_inherits2);
  
  var _react = require('react');
  
  var _react2 = _interopRequireDefault(_react);
  
  var _reactDom = require('react-dom');
  
  var _reactDom2 = _interopRequireDefault(_reactDom);
  
  var _popper = require('popper.js');
  
  var _popper2 = _interopRequireDefault(_popper);
  
  var _libs = require('../../libs');
  
  var _scrollbar = require('../scrollbar');
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  (function () {
    var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
    enterModule && enterModule(module);
  })();
  
  var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
    return a;
  };
  
  var Suggestions = function (_Component) {
    (0, _inherits3.default)(Suggestions, _Component);
  
    function Suggestions(props) {
      (0, _classCallCheck3.default)(this, Suggestions);
  
      var _this = (0, _possibleConstructorReturn3.default)(this, (Suggestions.__proto__ || Object.getPrototypeOf(Suggestions)).call(this, props));
  
      _this.state = {
        showPopper: false,
        dropdownWidth: ''
      };
      return _this;
    }
  
    (0, _createClass3.default)(Suggestions, [{
      key: 'onVisibleChange',
      value: function onVisibleChange(visible, inputWidth) {
        this.setState({
          dropdownWidth: inputWidth,
          showPopper: visible
        });
      }
    }, {
      key: 'parent',
      value: function parent() {
        return this.context.component;
      }
    }, {
      key: 'onSelect',
      value: function onSelect(item) {
        this.parent().select(item);
      }
    }, {
      key: 'onEnter',
      value: function onEnter() {
        var reference = _reactDom2.default.findDOMNode(this.parent().inputNode);
  
        this.popperJS = new _popper2.default(reference, this.refs.popper, {
          modifiers: {
            computeStyle: {
              gpuAcceleration: false
            }
          }
        });
      }
    }, {
      key: 'onAfterLeave',
      value: function onAfterLeave() {
        this.popperJS.destroy();
      }
    }, {
      key: 'render',
      value: function render() {
        var _this2 = this;
  
        var customItem = this.parent().props.customItem;
        var _parent$state = this.parent().state,
            loading = _parent$state.loading,
            highlightedIndex = _parent$state.highlightedIndex;
        var suggestions = this.props.suggestions;
        var _state = this.state,
            showPopper = _state.showPopper,
            dropdownWidth = _state.dropdownWidth;
  
  
        return _react2.default.createElement(
          _libs.Transition,
          { name: 'r-el-zoom-in-top', onEnter: this.onEnter.bind(this), onAfterLeave: this.onAfterLeave.bind(this) },
          _react2.default.createElement(
            _libs.View,
            { show: showPopper },
            _react2.default.createElement(
              'div',
              {
                ref: 'popper',
                className: this.classNames('r-el-autocomplete-suggestion', 'r-el-popper', {
                  'is-loading': loading
                }),
                style: {
                  width: dropdownWidth,
                  zIndex: 1
                }
              },
              _react2.default.createElement(
                _scrollbar.Scrollbar,
                {
                  viewComponent: 'ul',
                  wrapClass: 'r-el-autocomplete-suggestion__wrap',
                  viewClass: 'r-el-autocomplete-suggestion__list'
                },
                loading ? _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement('i', { className: 'r-el-icon-loading' })
                ) : suggestions.map(function (item, index) {
                  return _react2.default.createElement(
                    'li',
                    {
                      key: index,
                      className: _this2.classNames({ 'highlighted': highlightedIndex === index }),
                      onClick: _this2.onSelect.bind(_this2, item) },
                    !customItem ? item.value : _react2.default.createElement(customItem, {
                      index: index,
                      item: item
                    })
                  );
                })
              )
            )
          )
        );
      }
    }, {
      key: '__reactstandin__regenerateByEval',
      // @ts-ignore
      value: function __reactstandin__regenerateByEval(key, code) {
        // @ts-ignore
        this[key] = eval(code);
      }
    }]);
    return Suggestions;
  }(_libs.Component);
  
  var _default = Suggestions;
  exports.default = _default;
  
  
  Suggestions.contextTypes = {
    component: _libs.PropTypes.any
  };
  ;
  
  (function () {
    var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  
    if (!reactHotLoader) {
      return;
    }
  
    reactHotLoader.register(Suggestions, 'Suggestions', 'src/auto-complete/Suggestions.jsx');
    reactHotLoader.register(_default, 'default', 'src/auto-complete/Suggestions.jsx');
  })();
  
  ;
  
  (function () {
    var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
    leaveModule && leaveModule(module);
  })();