"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.SECTION_ITEM_BASE_CLASS_NAME = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _react = require("react");
var _constants = require("../../constants");
var _VerticalContext = _interopRequireDefault(require("../VerticalContext"));
var _jsxRuntime = require("react/jsx-runtime");
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

const SECTION_ITEM_BASE_CLASS_NAME = exports.SECTION_ITEM_BASE_CLASS_NAME = `${_constants.CLS_PREFIX}section-item`;

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