| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx } from "react/jsx-runtime"; |
| 3 |
import { createContext } from 'react'; |
| 4 |
import styles from '@patternfly/react-styles/css/components/Page/page.mjs'; |
| 5 |
import { css } from '@patternfly/react-styles'; |
| 6 |
import { PageContextConsumer } from './PageContext'; |
| 7 |
export const pageSidebarContextDefaults = { |
| 8 |
isSidebarOpen: true |
| 9 |
}; |
| 10 |
export const PageSidebarContext = createContext(pageSidebarContextDefaults); |
| 11 |
export const PageSidebar = (_a) => { |
| 12 |
var { className = '', children, isSidebarOpen = true, id = 'page-sidebar' } = _a, props = __rest(_a, ["className", "children", "isSidebarOpen", "id"]); |
| 13 |
return (_jsx(PageContextConsumer, { children: ({ isManagedSidebar, isSidebarOpen: managedIsNavOpen, isMobile }) => { |
| 14 |
const sidebarOpen = isManagedSidebar ? managedIsNavOpen : isSidebarOpen; |
| 15 |
return (_jsx("div", Object.assign({ id: id, className: css(styles.pageSidebar, sidebarOpen && isMobile && styles.modifiers.expanded, !sidebarOpen && styles.modifiers.collapsed, className), "aria-hidden": !sidebarOpen }, props, { children: _jsx(PageSidebarContext.Provider, { value: { isSidebarOpen: sidebarOpen }, children: _jsx("div", { className: css(styles.pageSidebarMain), children: children }) }) }))); |
| 16 |
} })); |
| 17 |
}; |
| 18 |
PageSidebar.displayName = 'PageSidebar'; |
| 19 |
//# sourceMappingURL=PageSidebar.js.map |