content: import cx from 'classnames'
  import _ from 'lodash'
  import PropTypes from 'prop-types'
  import React from 'react'
  
  import {
    customPropTypes,
    getElementType,
    getUnhandledProps,
    META,
    SUI,
    useVerticalAlignProp,
  } from '../../lib'
  import ItemHeader from './ItemHeader'
  import ItemDescription from './ItemDescription'
  import ItemExtra from './ItemExtra'
  import ItemMeta from './ItemMeta'
  
  /**
   * An item can contain content.
   */
  function ItemContent(props) {
    const {
      children,
      className,
      content,
      description,
      extra,
      header,
      meta,
      verticalAlign,
    } = props
  
    const classes = cx(
      useVerticalAlignProp(verticalAlign),
      'content',
      className,
    )
    const rest = getUnhandledProps(ItemContent, props)
    const ElementType = getElementType(ItemContent, props)
  
    if (!_.isNil(children)) {
      return <ElementType {...rest} className={classes}>{children}</ElementType>
    }
  
    return (
      <ElementType {...rest} className={classes}>
        {ItemHeader.create(header)}
        {ItemMeta.create(meta)}
        {ItemDescription.create(description)}
        {ItemExtra.create(extra)}
        {content}
      </ElementType>
    )
  }
  
  ItemContent._meta = {
    name: 'ItemContent',
    parent: 'Item',
    type: META.TYPES.VIEW,
  }
  
  ItemContent.propTypes = {
    /** An element type to render as (string or function). */
    as: customPropTypes.as,
  
    /** Primary content. */
    children: PropTypes.node,
  
    /** Additional classes. */
    className: PropTypes.string,
  
    /** Shorthand for primary content. */
    content: customPropTypes.contentShorthand,
  
    /** Shorthand for ItemDescription component. */
    description: customPropTypes.itemShorthand,
  
    /** Shorthand for ItemExtra component. */
    extra: customPropTypes.itemShorthand,
  
    /** Shorthand for ItemHeader component. */
    header: customPropTypes.itemShorthand,
  
    /** Shorthand for ItemMeta component. */
    meta: customPropTypes.itemShorthand,
  
    /** Content can specify its vertical alignment. */
    verticalAlign: PropTypes.oneOf(SUI.VERTICAL_ALIGNMENTS),
  }
  
  export default ItemContent
  