Liferay.Loader.define("data-engine-taglib@2.5.29/data_layout_builder/js/components/sidebar/Sidebar.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/layout', 'frontend-js-react-web$classnames', 'frontend-js-react-web$react', '../search-input/SearchInput.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = exports.SidebarTabContent = exports.SidebarTabs = exports.SidebarTab = exports.SidebarSearchInput = exports.SidebarHeader = exports.SidebarFooter = exports.SidebarBody = void 0;

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

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

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

    var _SearchInput = _interopRequireDefault(require("../search-input/SearchInput.es"));

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

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

    function _slicedToArray(arr, i) {
      return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
    }

    function _nonIterableRest() {
      throw new TypeError("Invalid attempt to destructure non-iterable instance");
    }

    function _iterableToArrayLimit(arr, i) {
      if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
        return;
      }var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
        for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
          _arr.push(_s.value);if (i && _arr.length === i) break;
        }
      } catch (err) {
        _d = true;_e = err;
      } finally {
        try {
          if (!_n && _i["return"] != null) _i["return"]();
        } finally {
          if (_d) throw _e;
        }
      }return _arr;
    }

    function _arrayWithHoles(arr) {
      if (Array.isArray(arr)) return arr;
    }

    var Sidebar = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
      var children = _ref.children,
          className = _ref.className;
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: (0, _classnames.default)(className, 'data-layout-builder-sidebar'),
          ref: ref
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "sidebar sidebar-light"
        }, children))
      );
    });

    var SidebarBody = function SidebarBody(_ref2) {
      var children = _ref2.children,
          className = _ref2.className;
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: (0, _classnames.default)(className, 'sidebar-body')
        }, children)
      );
    };

    exports.SidebarBody = SidebarBody;

    var SidebarFooter = function SidebarFooter(_ref3) {
      var children = _ref3.children;
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: "sidebar-footer"
        }, children)
      );
    };

    exports.SidebarFooter = SidebarFooter;

    var SidebarHeader = function SidebarHeader(_ref4) {
      var children = _ref4.children,
          className = _ref4.className;
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: (0, _classnames.default)(className, 'sidebar-header')
        }, children)
      );
    };

    exports.SidebarHeader = SidebarHeader;

    var SidebarSearchInput = function SidebarSearchInput(_ref5) {
      var children = _ref5.children,
          onSearch = _ref5.onSearch,
          searchText = _ref5.searchText;
      return (/*#__PURE__*/_react.default.createElement(_layout.default.ContentRow, {
          className: "sidebar-section"
        }, /*#__PURE__*/_react.default.createElement(_layout.default.ContentCol, {
          expand: true
        }, onSearch && /*#__PURE__*/_react.default.createElement(_SearchInput.default, {
          onChange: function onChange(searchText) {
            return onSearch(searchText);
          },
          searchText: searchText
        })), children)
      );
    };

    exports.SidebarSearchInput = SidebarSearchInput;

    var SidebarTabs = function SidebarTabs(_ref6) {
      var _ref6$initialSelected = _ref6.initialSelectedTab,
          initialSelectedTab = _ref6$initialSelected === void 0 ? 0 : _ref6$initialSelected,
          _ref6$setKeywords = _ref6.setKeywords,
          setKeywords = _ref6$setKeywords === void 0 ? function () {} : _ref6$setKeywords,
          tabs = _ref6.tabs;

      var _useState = (0, _react.useState)(initialSelectedTab),
          _useState2 = _slicedToArray(_useState, 2),
          selectedTab = _useState2[0],
          setSelectedTab = _useState2[1];

      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(SidebarTab, {
          onTabClick: function onTabClick(value) {
            setSelectedTab(value);
            setKeywords('');
          },
          selectedTab: selectedTab,
          tabs: tabs
        }), /*#__PURE__*/_react.default.createElement(SidebarTabContent, null, tabs[selectedTab].render()))
      );
    };

    exports.SidebarTabs = SidebarTabs;

    var SidebarTab = function SidebarTab(_ref7) {
      var onTabClick = _ref7.onTabClick,
          selectedTab = _ref7.selectedTab,
          tabs = _ref7.tabs;
      return (/*#__PURE__*/_react.default.createElement("nav", {
          className: "component-tbar tbar"
        }, /*#__PURE__*/_react.default.createElement(_layout.default.ContainerFluid, null, /*#__PURE__*/_react.default.createElement("ul", {
          className: "nav nav-underline",
          role: "tablist"
        }, tabs.map(function (_ref8, index) {
          var label = _ref8.label;
          return (/*#__PURE__*/_react.default.createElement("li", {
              className: "nav-item",
              key: index
            }, /*#__PURE__*/_react.default.createElement("button", {
              className: (0, _classnames.default)('btn btn-unstyled nav-link', {
                active: selectedTab === index
              }),
              "data-senna-off": true,
              onClick: function onClick(event) {
                event.preventDefault();
                onTabClick(index);
              },
              role: "tab"
            }, label))
          );
        }))))
      );
    };

    exports.SidebarTab = SidebarTab;

    var SidebarTabContent = function SidebarTabContent(_ref9) {
      var children = _ref9.children;
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: "tab-content"
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "active fade mt-3 show tab-pane",
          role: "tabpanel"
        }, children))
      );
    };

    exports.SidebarTabContent = SidebarTabContent;

    var SidebarTitle = function SidebarTitle(_ref10) {
      var title = _ref10.title;
      return (/*#__PURE__*/_react.default.createElement(_layout.default.ContentRow, {
          className: "mb-3 sidebar-section"
        }, /*#__PURE__*/_react.default.createElement(_layout.default.ContentCol, {
          expand: true
        }, /*#__PURE__*/_react.default.createElement("div", {
          className: "component-title"
        }, /*#__PURE__*/_react.default.createElement("span", {
          className: "text-truncate-inline"
        }, title))))
      );
    };

    Sidebar.Body = SidebarBody;
    Sidebar.Footer = SidebarFooter;
    Sidebar.Header = SidebarHeader;
    Sidebar.SearchInput = SidebarSearchInput;
    Sidebar.Tab = SidebarTab;
    Sidebar.Tabs = SidebarTabs;
    Sidebar.TabContent = SidebarTabContent;
    Sidebar.Title = SidebarTitle;
    var _default = Sidebar;
    exports.default = _default;
    //# sourceMappingURL=Sidebar.es.js.map
  }
});
//# sourceMappingURL=Sidebar.es.js.map