| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.DashboardWrapper = exports.DashboardBreadcrumb = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
const react_1 = require("react"); |
| 7 |
const components_1 = require("../components"); |
| 8 |
const DashboardHeader_1 = require("./DashboardHeader"); |
| 9 |
exports.DashboardBreadcrumb = ((0, jsx_runtime_1.jsxs)(components_1.Breadcrumb, { children: [(0, jsx_runtime_1.jsx)(components_1.BreadcrumbItem, { children: "Section home" }), (0, jsx_runtime_1.jsx)(components_1.BreadcrumbItem, { to: "#", children: "Section title" }), (0, jsx_runtime_1.jsx)(components_1.BreadcrumbItem, { to: "#", children: "Section title" }), (0, jsx_runtime_1.jsx)(components_1.BreadcrumbItem, { to: "#", isActive: true, children: "Section landing" })] })); |
| 10 |
const PageTemplateTitle = ((0, jsx_runtime_1.jsx)(components_1.PageSection, { children: (0, jsx_runtime_1.jsxs)(components_1.Content, { children: [(0, jsx_runtime_1.jsx)("h1", { children: "Main title" }), (0, jsx_runtime_1.jsx)("p", { children: "This is a full page demo." })] }) })); |
| 11 |
const DashboardWrapper = (_a) => { |
| 12 |
var { children, mainContainerId, banner, breadcrumb, masthead, sidebar, sidebarNavOpen, onPageResize, hasDefaultBreadcrumb, notificationDrawer, isNotificationDrawerExpanded, hasPageTemplateTitle } = _a, pageProps = tslib_1.__rest(_a, ["children", "mainContainerId", "banner", "breadcrumb", "masthead", "sidebar", "sidebarNavOpen", "onPageResize", "hasDefaultBreadcrumb", "notificationDrawer", "isNotificationDrawerExpanded", "hasPageTemplateTitle"]); |
| 13 |
const [activeItem, setActiveItem] = (0, react_1.useState)(1); |
| 14 |
const onNavSelect = (_event, result) => { |
| 15 |
setActiveItem(result.itemId); |
| 16 |
}; |
| 17 |
let renderedBreadcrumb; |
| 18 |
if (!hasDefaultBreadcrumb) { |
| 19 |
renderedBreadcrumb = breadcrumb !== null && breadcrumb !== void 0 ? breadcrumb : exports.DashboardBreadcrumb; |
| 20 |
} |
| 21 |
const PageNav = ((0, jsx_runtime_1.jsx)(components_1.Nav, { onSelect: onNavSelect, "aria-label": "Nav", children: (0, jsx_runtime_1.jsxs)(components_1.NavList, { children: [(0, jsx_runtime_1.jsx)(components_1.NavItem, { itemId: 0, isActive: activeItem === 0, to: "#system-panel", children: "System panel" }), (0, jsx_runtime_1.jsx)(components_1.NavItem, { itemId: 1, isActive: activeItem === 1, to: "#policy", children: "Policy" }), (0, jsx_runtime_1.jsx)(components_1.NavItem, { itemId: 2, isActive: activeItem === 2, to: "#auth", children: "Authentication" }), (0, jsx_runtime_1.jsx)(components_1.NavItem, { itemId: 3, isActive: activeItem === 3, to: "#network", children: "Network services" }), (0, jsx_runtime_1.jsx)(components_1.NavItem, { itemId: 4, isActive: activeItem === 4, to: "#server", children: "Server" })] }) })); |
| 22 |
const _sidebar = ((0, jsx_runtime_1.jsx)(components_1.PageSidebar, { isSidebarOpen: sidebarNavOpen || false, children: (0, jsx_runtime_1.jsx)(components_1.PageSidebarBody, { children: PageNav }) })); |
| 23 |
const defaultContainerId = 'main-content-page-layout-default-nav'; |
| 24 |
const handleClick = (event) => { |
| 25 |
event.preventDefault(); |
| 26 |
const mainContentElement = document.getElementById(mainContainerId !== null && mainContainerId !== void 0 ? mainContainerId : defaultContainerId); |
| 27 |
if (mainContentElement) { |
| 28 |
mainContentElement.focus(); |
| 29 |
} |
| 30 |
}; |
| 31 |
const PageSkipToContent = ((0, jsx_runtime_1.jsx)(components_1.SkipToContent, { onClick: handleClick, href: `#${mainContainerId !== null && mainContainerId !== void 0 ? mainContainerId : defaultContainerId}`, children: "Skip to content" })); |
| 32 |
return ((0, jsx_runtime_1.jsxs)(components_1.Page, Object.assign({ masthead: masthead !== null && masthead !== void 0 ? masthead : (0, jsx_runtime_1.jsx)(DashboardHeader_1.DashboardHeader, {}), sidebar: sidebar !== null && sidebar !== void 0 ? sidebar : _sidebar, isManagedSidebar: true, skipToContent: PageSkipToContent, banner: banner, breadcrumb: renderedBreadcrumb, mainContainerId: mainContainerId !== null && mainContainerId !== void 0 ? mainContainerId : defaultContainerId, notificationDrawer: notificationDrawer, isNotificationDrawerExpanded: isNotificationDrawerExpanded }, (typeof onPageResize === 'function' && { |
| 33 |
onPageResize: (event, resizeObject) => onPageResize(event, resizeObject) |
| 34 |
}), pageProps, { children: [hasPageTemplateTitle && PageTemplateTitle, children] }))); |
| 35 |
}; |
| 36 |
exports.DashboardWrapper = DashboardWrapper; |
| 37 |
exports.DashboardWrapper.displayName = 'DashboardWrapper'; |
| 38 |
//# sourceMappingURL=DashboardWrapper.js.map |