import React from 'react';
import { DrawerBody } from '@chakra-ui/react';
import Grid from '../../../grid/index.js';
import DrawerOverlay from '../../../drawer/DrawerOverlay.js';
import DrawerContent from '../../../drawer/DrawerContent.js';
import Drawer from '../../../drawer/index.js';
import { DrawerNode } from '../config/DrawerNodeItems.js';
import DrawerUserInfo from './userInfo/index.js';
import { DrawerMenu } from './DrawerMenu.js';
import DrawerLoginToggle from './DrawerLoginToggle.js';

var NavigationDrawer = function (_a) {
    var drawer = _a.drawer, isOpen = _a.isOpen, onClose = _a.onClose, menuHeight = _a.menuHeight, user = _a.user, onLogin = _a.onLogin, onLogout = _a.onLogout, selectTenant = _a.selectTenant, showTenantSelection = _a.showTenantSelection;
    return (React.createElement(Drawer, { isOpen: isOpen, placement: "top", onClose: onClose },
        React.createElement(DrawerOverlay, null),
        React.createElement(DrawerContent, { overflowY: "scroll", maxH: "calc(100vh - ".concat(menuHeight, ")"), maxW: "100vw", 
            // This is due to safari scrolling the page up when an input is focused
            // Using margin results in a gap between the header and the drawer after the scroll
            // Chakra overrides the `top` position with the inline style, hence the !important
            top: "".concat(menuHeight, " !important") },
            React.createElement(DrawerBody, { "data-testid": "drawer-body", py: "lg", px: { md: 'xs' }, maxWidth: "container.2xl", width: "full", margin: "auto" },
                React.createElement(Grid, { height: "full", width: "full", templateColumns: {
                        '2xs': 'minmax(0, 1fr)',
                        md: 'repeat(5, 1fr)',
                    }, gridGap: { md: '3xl' } },
                    [DrawerNode.User, DrawerNode.Combined].includes(drawer === null || drawer === void 0 ? void 0 : drawer.current) ? (React.createElement(DrawerUserInfo, { user: user, selectTenant: selectTenant, showTenantSelection: showTenantSelection })) : null, drawer === null || drawer === void 0 ? void 0 :
                    drawer.nodes.map(function (node, index) { return (React.createElement(DrawerMenu, { key: "node-".concat(index), node: node })); }),
                    (drawer === null || drawer === void 0 ? void 0 : drawer.current) === DrawerNode.Combined ? (React.createElement(DrawerLoginToggle, { user: user, onLogin: onLogin, onLogout: onLogout })) : null)))));
};

export { NavigationDrawer };
//# sourceMappingURL=index.js.map
