"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _classnames = _interopRequireDefault(require("classnames"));

var _constants = require("../../constants");

var _VerticalContext = _interopRequireDefault(require("../VerticalContext"));

// Copyright 1999-2020. Plesk International GmbH. All rights reserved.

/**
 * `SectionItem` component is used for showing parameters and its values in [Section](#!/Section).
 * @since 0.0.54
 */
const SectionItem = ({
  baseClassName,
  className,
  children,
  title,
  actions,
  vertical,
  ...props
}) => {
  const verticalContext = (0, _react.useContext)(_VerticalContext.default);
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
    className: (0, _classnames.default)(baseClassName, {
      ["".concat(baseClassName, "--actions")]: actions,
      ["".concat(baseClassName, "--vertical")]: vertical === undefined ? verticalContext : vertical
    }, className)
  }, props), title === undefined || title === null ? null : /*#__PURE__*/_react.default.createElement("div", {
    className: "".concat(baseClassName, "__title")
  }, title), /*#__PURE__*/_react.default.createElement("div", {
    className: "".concat(baseClassName, "__value")
  }, children));
};

SectionItem.propTypes = {
  /**
   * Content of the `SectionItem`.
   * @since 0.0.54
   */
  children: _propTypes.default.node,

  /**
   * @ignore
   */
  className: _propTypes.default.string,

  /**
   * @ignore
   */
  baseClassName: _propTypes.default.string,

  /**
   * Title of the section item.
   * @since 0.0.54
   */
  title: _propTypes.default.node,

  /**
   * Is this section item contains actions? If it so than there should be extra whitespaces.
   * @since 0.0.54
   */
  actions: _propTypes.default.bool,

  /**
   * @ignore
   */
  vertical: _propTypes.default.bool
};
SectionItem.defaultProps = {
  children: undefined,
  className: undefined,
  baseClassName: "".concat(_constants.CLS_PREFIX, "section-item"),
  title: undefined,
  actions: false,
  vertical: undefined
};
var _default = SectionItem;
exports.default = _default;