"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SlidingPanelDropdown = exports.SlidingPanelSection = exports.SlidingPanelHeader = exports.SlidingPanel = exports.ToggleIcon = void 0;

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

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

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

require("./SlidingPanel.css");

var _FilterVariantIcon = _interopRequireDefault(require("mdi-react/FilterVariantIcon"));

var _ArrowRightIcon = _interopRequireDefault(require("mdi-react/ArrowRightIcon"));

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 ToggleIcon = function ToggleIcon(_ref) {
  var onClick = _ref.onClick,
      hoverText = _ref.hoverText,
      toggleIconState = _ref.toggleIconState,
      className = _ref.className,
      restProps = _objectWithoutProperties(_ref, ["onClick", "hoverText", "toggleIconState", "className"]);

  var Icon = toggleIconState ? _ArrowRightIcon.default : _FilterVariantIcon.default;
  return _react.default.createElement("a", _extends({
    className: "vs-sliding-panel-toggle-icon ".concat(className),
    onClick: onClick,
    title: hoverText
  }, restProps), _react.default.createElement("div", {
    className: "vs-sliding-panel-section-icon-btn"
  }, _react.default.createElement(Icon, {
    className: "vs-sliding-panel-section-icon"
  })));
};

exports.ToggleIcon = ToggleIcon;
ToggleIcon.propTypes = {
  onClick: _propTypes.default.func.isRequired,
  toggleIconState: _propTypes.default.bool,
  hoverText: _propTypes.default.string,
  label: _propTypes.default.string
};

var SlidingPanel = function SlidingPanel(_ref2) {
  var children = _ref2.children,
      active = _ref2.active;
  return _react.default.createElement("div", {
    className: (0, _classnames.default)('vs-sliding-panel', {
      'vs-active': active
    })
  }, _react.default.createElement("ul", {
    className: "vs-force-sliding-panel-width"
  }, children));
};

exports.SlidingPanel = SlidingPanel;
SlidingPanel.propTypes = {
  children: _propTypes.default.any,
  active: _propTypes.default.bool
};

var SlidingPanelHeader = function SlidingPanelHeader(_ref3) {
  var _ref3$className = _ref3.className,
      className = _ref3$className === void 0 ? '' : _ref3$className,
      children = _ref3.children;
  return _react.default.createElement("li", {
    className: "".concat(className, " vs-sliding-panel-header")
  }, children);
};

exports.SlidingPanelHeader = SlidingPanelHeader;
SlidingPanelHeader.propTypes = {
  children: _propTypes.default.any,
  className: _propTypes.default.string
};

var SlidingPanelSection = function SlidingPanelSection(_ref4) {
  var children = _ref4.children;
  return _react.default.createElement("li", {
    className: "vs-sliding-panel-section"
  }, children);
};

exports.SlidingPanelSection = SlidingPanelSection;
SlidingPanelSection.propTypes = {
  children: _propTypes.default.any
};

var SlidingPanelDropdown = function SlidingPanelDropdown(_ref5) {
  var label = _ref5.label,
      children = _ref5.children,
      onClick = _ref5.onClick,
      expanded = _ref5.expanded,
      _ref5$id = _ref5.id,
      id = _ref5$id === void 0 ? "" : _ref5$id;
  var containerClasses = (0, _classnames.default)('vs-sliding-panel-section-container', {
    'vs-expanded': expanded
  });
  var optionsClasses = (0, _classnames.default)('vs-sliding-panel-section-options', {
    'vs-expanded': expanded
  });
  return _react.default.createElement("ul", {
    className: containerClasses,
    id: id
  }, _react.default.createElement("a", {
    className: "vs-sliding-panel-section-container-label",
    onClick: onClick
  }, _react.default.createElement("div", null, label), _react.default.createElement("i", {
    className: "fa fa-chevron-right"
  })), _react.default.createElement("ul", null, _react.default.createElement("div", {
    className: optionsClasses
  }, children)));
};

exports.SlidingPanelDropdown = SlidingPanelDropdown;
SlidingPanelDropdown.propTypes = {
  id: _propTypes.default.string,
  children: _propTypes.default.any,
  label: _propTypes.default.any,
  onClick: _propTypes.default.func,
  expanded: _propTypes.default.bool
};