'use strict';

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

var _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; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

require('./SlidingPanel.css');

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

var _FilterVariantIcon2 = _interopRequireDefault(_FilterVariantIcon);

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

var _ArrowRightIcon2 = _interopRequireDefault(_ArrowRightIcon);

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

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } 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 ? _ArrowRightIcon2.default : _FilterVariantIcon2.default;

  return _react2.default.createElement(
    'a',
    _extends({ className: 'vs-sliding-panel-toggle-icon ' + className, onClick: onClick, title: hoverText }, restProps),
    _react2.default.createElement(
      'div',
      { className: 'vs-sliding-panel-section-icon-btn' },
      _react2.default.createElement(Icon, { className: 'vs-sliding-panel-section-icon' })
    )
  );
};
exports.ToggleIcon = ToggleIcon;
ToggleIcon.propTypes = {
  onClick: _propTypes2.default.func.isRequired,
  toggleIconState: _propTypes2.default.bool,
  hoverText: _propTypes2.default.string,
  label: _propTypes2.default.string
};

var SlidingPanel = exports.SlidingPanel = function SlidingPanel(_ref2) {
  var children = _ref2.children,
      active = _ref2.active;

  return _react2.default.createElement(
    'div',
    { className: (0, _classnames2.default)('vs-sliding-panel', { 'vs-active': active }) },
    _react2.default.createElement(
      'ul',
      { className: 'vs-force-sliding-panel-width' },
      children
    )
  );
};
SlidingPanel.propTypes = {
  children: _propTypes2.default.any,
  active: _propTypes2.default.bool
};

var SlidingPanelHeader = exports.SlidingPanelHeader = function SlidingPanelHeader(_ref3) {
  var _ref3$className = _ref3.className,
      className = _ref3$className === undefined ? '' : _ref3$className,
      children = _ref3.children;

  return _react2.default.createElement(
    'li',
    { className: className + ' vs-sliding-panel-header' },
    children
  );
};
SlidingPanelHeader.propTypes = {
  children: _propTypes2.default.any,
  className: _propTypes2.default.string
};

var SlidingPanelSection = exports.SlidingPanelSection = function SlidingPanelSection(_ref4) {
  var children = _ref4.children;

  return _react2.default.createElement(
    'li',
    { className: 'vs-sliding-panel-section' },
    children
  );
};
SlidingPanelSection.propTypes = {
  children: _propTypes2.default.any
};

var SlidingPanelDropdown = exports.SlidingPanelDropdown = function SlidingPanelDropdown(_ref5) {
  var label = _ref5.label,
      children = _ref5.children,
      onClick = _ref5.onClick,
      expanded = _ref5.expanded;

  var containerClasses = (0, _classnames2.default)('vs-sliding-panel-section-container', { 'vs-expanded': expanded });
  var optionsClasses = (0, _classnames2.default)('vs-sliding-panel-section-options', { 'vs-expanded': expanded });
  return _react2.default.createElement(
    'ul',
    { className: containerClasses },
    _react2.default.createElement(
      'a',
      { className: 'vs-sliding-panel-section-container-label', onClick: onClick },
      _react2.default.createElement(
        'div',
        null,
        label
      ),
      _react2.default.createElement('i', { className: 'fa fa-chevron-right' })
    ),
    _react2.default.createElement(
      'ul',
      null,
      _react2.default.createElement(
        'div',
        { className: optionsClasses },
        children
      )
    )
  );
};
SlidingPanelDropdown.propTypes = {
  children: _propTypes2.default.any,
  label: _propTypes2.default.any,
  onClick: _propTypes2.default.func,
  expanded: _propTypes2.default.bool
};