"use strict";

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

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

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

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

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var NavList = function NavList(_ref) {
  var children = _ref.children,
      className = _ref.className,
      label = _ref.label,
      popover = _ref.popover,
      rightLabel = _ref.rightLabel,
      testSection = _ref.testSection,
      props = _objectWithoutProperties(_ref, ["children", "className", "label", "popover", "rightLabel", "testSection"]);

  return _react["default"].createElement("nav", _extends({
    className: (0, _classnames["default"])("sidenav__section", className),
    "data-test-section": testSection
  }, props), (label || rightLabel) && _react["default"].createElement("div", {
    className: "sidenav__section__title muted"
  }, _react["default"].createElement("h5", null, label), rightLabel && _react["default"].createElement("h6", null, rightLabel), popover), _react["default"].createElement("ul", {
    className: "nav-list"
  }, children));
};

NavList.propTypes = {
  /** Content to render within the list */
  children: _propTypes["default"].node,

  /** CSS class names. */
  className: _propTypes["default"].string,

  /** Label to use for this section */
  label: _propTypes["default"].string,

  /** Popover to display next to the label */
  popover: _propTypes["default"].bool,

  /** Optional text to display to the right of the label */
  rightLabel: _propTypes["default"].bool,

  /** Value used for testing via data-test-section attribute */
  testSection: _propTypes["default"].bool
};
var _default = NavList;
exports["default"] = _default;