import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["active", "additional", "button", "children", "className", "href", "subContent", "image", "hint", "noImage", "showAdditionalIcon", "title", "kind", "wrapper"];
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { settings } from '../../globals/js';
var prefix = settings.prefix;
import { ChevronRight16 } from '@wfp/icons-react';
/** The item component to show entries inside a list, like a sidebar or an overview page. */

export var Item = function Item(_ref) {
  var _classnames;

  var active = _ref.active,
      additional = _ref.additional,
      button = _ref.button,
      children = _ref.children,
      className = _ref.className,
      href = _ref.href,
      subContent = _ref.subContent,
      image = _ref.image,
      hint = _ref.hint,
      noImage = _ref.noImage,
      showAdditionalIcon = _ref.showAdditionalIcon,
      title = _ref.title,
      _ref$kind = _ref.kind,
      kind = _ref$kind === void 0 ? 'large' : _ref$kind,
      _ref$wrapper = _ref.wrapper,
      wrapper = _ref$wrapper === void 0 ? 'none' : _ref$wrapper,
      other = _objectWithoutProperties(_ref, _excluded);

  var classNames = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(prefix, "--item"), true), _defineProperty(_classnames, "".concat(prefix, "--item--").concat(kind), kind), _defineProperty(_classnames, "".concat(prefix, "--item--").concat(wrapper), wrapper), _defineProperty(_classnames, "".concat(prefix, "--item--active"), active), _classnames), className);
  return /*#__PURE__*/React.createElement("div", _extends({
    className: classNames
  }, other), image ? /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__image")
  }, image) : noImage ? /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__image ").concat(prefix, "--item__image-empty")
  }) : null, /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__content")
  }, title && /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__title-wrapper")
  }, /*#__PURE__*/React.createElement("h2", {
    className: "".concat(prefix, "--item__title")
  }, title), additional && /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__additional")
  }, additional, showAdditionalIcon && /*#__PURE__*/React.createElement(ChevronRight16, {
    className: "".concat(prefix, "--item__additional-icon")
  }))), /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__text-wrapper")
  }, /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__text-wrapper__inner")
  }, children && /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__text")
  }, children), subContent && /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__sub-content")
  }, subContent)), /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__right")
  }, hint && /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefix, "--item__hint")
  }, hint)))));
};
Item.propTypes = {
  /**
   * Provide the description for the item content
   */
  children: PropTypes.node,

  /**
   * Provide the title for the item contet
   */
  title: PropTypes.node,

  /**
   * Provide the icon for the item content
   */
  icon: PropTypes.node,

  /**
   * Provide one or multiple buttons
   */
  button: PropTypes.node,

  /**
   * Provide a custom className to be applied to the containing <a> node
   */
  className: PropTypes.string,

  /**
   * Provide a kind to use different appearances.
   */
  kind: PropTypes.oneOf(['undefined', 'horizontal', 'large']),

  /**
   * Provide a wrap to use different borders.
   */
  wrapper: PropTypes.oneOf(['undefined', 'sidebar', 'repeater'])
};
export default Item;