chatui2
Version:
The React library for Chatbot UI
29 lines • 1.09 kB
JavaScript
import React from 'react';
export var AutoCompletes = function AutoCompletes(props) {
var _props$show = props.show,
show = _props$show === void 0 ? false : _props$show,
_props$list = props.list,
list = _props$list === void 0 ? [] : _props$list,
_props$onSelect = props.onSelect,
onSelect = _props$onSelect === void 0 ? function () {} : _props$onSelect,
renderAutoCompletes = props.renderAutoCompletes;
if (renderAutoCompletes) {
return renderAutoCompletes({
show: show,
list: list,
onSelect: onSelect
});
}
return /*#__PURE__*/React.createElement("ul", {
className: "AutoComplete ".concat(show ? 'show' : '')
}, list.map(function (item) {
return /*#__PURE__*/React.createElement("li", {
key: item === null || item === void 0 ? void 0 : item.id,
onClick: function onClick() {
return onSelect(item);
}
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
className: "RichText"
}, item === null || item === void 0 ? void 0 : item.title)));
}));
};