UNPKG

@chatui/core

Version:

The React library for Chatbot UI

30 lines 1.16 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["className", "as", "content", "ellipsis", "rightIcon", "children", "onClick"]; import React from 'react'; import clsx from 'clsx'; import { Icon } from '../Icon'; import { Text } from '../Text'; export var ListItem = /*#__PURE__*/React.forwardRef(function (props, ref) { var className = props.className, _props$as = props.as, Element = _props$as === void 0 ? 'div' : _props$as, content = props.content, ellipsis = props.ellipsis, rightIcon = props.rightIcon, children = props.children, onClick = props.onClick, other = _objectWithoutProperties(props, _excluded); return /*#__PURE__*/React.createElement(Element, _extends({ className: clsx('ListItem', className), onClick: onClick, role: "listitem" }, other, { ref: ref }), /*#__PURE__*/React.createElement(Text, { className: "ListItem-content", truncate: ellipsis }, content || children), rightIcon && /*#__PURE__*/React.createElement(Icon, { type: rightIcon })); });