"use strict";

var _icon = _interopRequireDefault(require("../../icon"));

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

var _reactDom = _interopRequireDefault(require("react-dom"));

var _ = _interopRequireDefault(require(".."));

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

var dataSource = [{
  value: '#FF0000',
  label: 'red',
  title: 'red'
}, {
  value: '#00AA00',
  label: 'green',
  title: 'green'
}, {
  value: '#B482DB',
  label: 'purple',
  title: 'purple'
}, {
  value: '#F17334',
  label: 'orange',
  title: 'orange'
}, {
  value: '#66CCFF',
  label: 'blue',
  title: 'blue'
}];

var itemRender = function itemRender(item) {
  return /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "account",
    size: "xs",
    style: {
      color: item.value
    }
  }), /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "account",
    size: "xs",
    style: {
      color: item.value
    }
  }), /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "account",
    size: "xs",
    style: {
      color: item.value
    }
  }), /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "account",
    size: "xs",
    style: {
      color: item.value
    }
  }), /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "account",
    size: "xs",
    style: {
      color: item.value
    }
  }));
};

var valueRender = function valueRender(item) {
  return /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "account",
    size: "xs",
    style: {
      color: item.value
    }
  }), ' ', item.label);
};

var dataSource2 = ['Lorem ipsum dolor sit amet', 'consectetur adipisicing elit', 'sed do eiusmod tempor incididunt', 'ut labore et dolore magna aliqua.', 'Ut enim ad minim veniam', 'quis nostrud exercitation', 'ullamco laboris nisi ut', 'aliquip ex ea commodo consequat', 'Duis aute irure dolor in', 'reprehenderit in voluptate', 'velit esse cillum dolore eu', 'Fugiat nulla pariatur excepteur sint', 'occaecat cupidatat non proident', 'sunt in culpa qui officia', 'deserunt mollit anim id est laborum']; // highlight keywords

var itemRender2 = function itemRender2(item, searchKey) {
  var label = item.label;

  if (searchKey && searchKey.length) {
    var key = searchKey.replace(/[-/\^$*+?.()|[]{}]/g, '$&');
    var reg = new RegExp("(".concat(key, ")"), 'ig');
    label = label.replace(reg, function (x) {
      return "<span class=\"next-select-highlight\">".concat(x, "</span>");
    });
  }

  return /*#__PURE__*/_react["default"].createElement("span", {
    dangerouslySetInnerHTML: {
      __html: label
    }
  });
};

_reactDom["default"].render( /*#__PURE__*/_react["default"].createElement("div", {
  className: "demo-container"
}, /*#__PURE__*/_react["default"].createElement(_["default"], {
  dataSource: dataSource,
  itemRender: itemRender,
  valueRender: valueRender,
  placeholder: "pick your color",
  theme: "grey"
}), /*#__PURE__*/_react["default"].createElement(_["default"], {
  showSearch: true,
  dataSource: dataSource2,
  itemRender: itemRender2,
  placeholder: "highlight keywords",
  style: {
    minWidth: 200
  },
  theme: "grey"
})), document.getElementById('select-demo-10'));