import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import * as React from 'react';
import { createBEM } from '@zarm-design/bem';
import { ConfigContext } from '../config-provider';
var ListItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var className = props.className,
      prefix = props.prefix,
      suffix = props.suffix,
      title = props.title,
      description = props.description,
      children = props.children,
      onClick = props.onClick,
      hasArrow = props.hasArrow,
      restProps = _objectWithoutProperties(props, ["className", "prefix", "suffix", "title", "description", "children", "onClick", "hasArrow"]);

  var _React$useContext = React.useContext(ConfigContext),
      prefixCls = _React$useContext.prefixCls;

  var bem = createBEM('list-item', {
    prefixCls: prefixCls
  });
  var cls = bem([{
    link: !!onClick,
    inline: !!children,
    arrow: !!onClick && hasArrow
  }, className]);
  var prefixRender = prefix && /*#__PURE__*/React.createElement("div", {
    className: bem('prefix')
  }, prefix);
  var suffixRender = suffix && /*#__PURE__*/React.createElement("div", {
    className: bem('suffix')
  }, suffix);
  var titleRender = title && /*#__PURE__*/React.createElement("div", {
    className: bem('title')
  }, title);
  var contentRender = children && /*#__PURE__*/React.createElement("div", {
    className: bem('content')
  }, children);
  var descriptionRender = description && /*#__PURE__*/React.createElement("div", {
    className: bem('description')
  }, description);
  var arrowRender = !!onClick && hasArrow && /*#__PURE__*/React.createElement("div", {
    className: bem('arrow')
  });
  return /*#__PURE__*/React.createElement("li", _extends({
    ref: ref,
    className: cls,
    onClick: onClick,
    onTouchStart: function onTouchStart() {}
  }, restProps), prefixRender, /*#__PURE__*/React.createElement("div", {
    className: bem('wrapper')
  }, /*#__PURE__*/React.createElement("div", {
    className: bem('inner')
  }, titleRender, contentRender, suffixRender, arrowRender), descriptionRender));
});
ListItem.displayName = 'ListItem';
ListItem.defaultProps = {
  hasArrow: true
};
export default ListItem;