chayns-components
Version:
A set of beautiful React components for developing chayns® applications.
34 lines (33 loc) • 983 B
JavaScript
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
const ComboBoxItem = _ref => {
let {
id,
value,
onSelect,
setShowOverlay,
shouldStopPropagation = false
} = _ref;
const handleClick = useCallback(ev => {
onSelect(id);
setShowOverlay(false);
if (shouldStopPropagation) {
ev.stopPropagation();
}
}, [id, onSelect, setShowOverlay, shouldStopPropagation]);
return /*#__PURE__*/React.createElement("div", {
key: id,
id: id,
className: "cc__combo-box__overlay__item ellipsis",
onClick: handleClick
}, value);
};
ComboBoxItem.propTypes = {
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
onSelect: PropTypes.func.isRequired,
setShowOverlay: PropTypes.func.isRequired,
shouldStopPropagation: PropTypes.bool
};
export default ComboBoxItem;
//# sourceMappingURL=ComboBoxItem.js.map