"use strict";

Liferay.Loader.define("@frontend-taglib-clay$clayui/drop-down@3.58.0/lib/drilldown/Menu", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/button', '@frontend-taglib-clay$clayui/icon', '@frontend-taglib-clay$clayui/shared', 'frontend-taglib-clay$classnames', 'frontend-js-react-web$react', 'frontend-taglib-clay$react-transition-group', '../Divider'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _button = require("@frontend-taglib-clay$clayui/button");

    var _icon = _interopRequireDefault(require("@frontend-taglib-clay$clayui/icon"));

    var _shared = require("@frontend-taglib-clay$clayui/shared");

    var _classnames = _interopRequireDefault(require("frontend-taglib-clay$classnames"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _reactTransitionGroup = require("frontend-taglib-clay$react-transition-group");

    var _Divider = _interopRequireDefault(require("../Divider"));

    var _excluded = ["child", "className", "onClick", "symbol", "title", "type"];

    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 DrilldownMenu = function DrilldownMenu(_ref) {
      var active = _ref.active,
          direction = _ref.direction,
          header = _ref.header,
          items = _ref.items,
          onBack = _ref.onBack,
          onForward = _ref.onForward,
          spritemap = _ref.spritemap;
      var initialClasses = (0, _classnames.default)('transitioning', {
        'drilldown-prev-initial': direction === 'prev'
      });
      return (/*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
          className: (0, _classnames.default)('drilldown-item', {
            'drilldown-current': active
          }),
          classNames: {
            enter: initialClasses,
            enterActive: "drilldown-transition drilldown-".concat(direction, "-active"),
            exit: initialClasses,
            exitActive: "drilldown-transition drilldown-".concat(direction, "-active")
          },
          in: active,
          timeout: 250
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "drilldown-item-inner"
        }, header && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
          className: "dropdown-header",
          onClick: onBack
        }, /*#__PURE__*/_react.default.createElement(_button.ClayButtonWithIcon, {
          className: "component-action dropdown-item-indicator-start",
          onClick: onBack,
          spritemap: spritemap,
          symbol: "angle-left"
        }), /*#__PURE__*/_react.default.createElement("span", {
          className: "dropdown-item-indicator-text-start"
        }, header)), /*#__PURE__*/_react.default.createElement("div", {
          className: "dropdown-divider"
        })), items && /*#__PURE__*/_react.default.createElement("ul", {
          className: "inline-scroller"
        }, items.map(function (_ref2, j) {
          var child = _ref2.child,
              className = _ref2.className,
              _onClick = _ref2.onClick,
              symbol = _ref2.symbol,
              title = _ref2.title,
              type = _ref2.type,
              other = _objectWithoutProperties(_ref2, _excluded);

          return type === 'divider' ? /*#__PURE__*/_react.default.createElement(_Divider.default, {
            key: "".concat(j, "-divider")
          }) : /*#__PURE__*/_react.default.createElement("li", {
            key: "".concat(j, "-").concat(title)
          }, /*#__PURE__*/_react.default.createElement(_shared.LinkOrButton, _extends({}, other, {
            buttonDisplayType: "unstyled",
            className: (0, _classnames.default)('dropdown-item', className),
            onClick: function onClick(event) {
              if (_onClick) {
                _onClick(event);
              }

              if (title && child) {
                onForward(title, child);
              }
            }
          }), symbol && /*#__PURE__*/_react.default.createElement("span", {
            className: "dropdown-item-indicator-start"
          }, /*#__PURE__*/_react.default.createElement(_icon.default, {
            spritemap: spritemap,
            symbol: symbol
          })), /*#__PURE__*/_react.default.createElement("span", {
            className: "dropdown-item-indicator-text-end"
          }, title), child && /*#__PURE__*/_react.default.createElement("span", {
            className: "dropdown-item-indicator-end"
          }, /*#__PURE__*/_react.default.createElement(_icon.default, {
            spritemap: spritemap,
            symbol: "angle-right"
          }))));
        }))))
      );
    };

    var _default = DrilldownMenu;
    exports.default = _default;
  }
});
//# sourceMappingURL=Menu.js.map