'use strict';

var React = require('react');
var classnames = require('classnames');
var Heading = require('./Heading-cjs.js');
var ButtonDismiss = require('./ButtonDismiss-cjs.js');

var styles$1 = {"container":"LNIwHwCs8gQ-","drawer":"iDSQR4mxUvM-","open":"y9lAhWPltyg-","header":"s830oNhRdZE-","heading":"MZuJ7od4r-o-","contentScroll":"I4XEGwkvw74-","content":"jZzp04L7Gao-","spinning":"dzsdJUdmmt8-"};

function Drawer({ title, children, open = true, onRequestClose, id, }) {
    const drawerClassNames = classnames(styles$1.container, open && styles$1.open);
    return (React.createElement("aside", { className: drawerClassNames, "data-testid": "drawer-container", "aria-label": title, "aria-hidden": !open, id: id },
        React.createElement("div", { className: styles$1.drawer },
            React.createElement(Header, { title: title, onRequestClose: onRequestClose }),
            React.createElement("div", { className: styles$1.contentScroll },
                React.createElement("div", { className: styles$1.content }, children)))));
}
function Header({ title, onRequestClose }) {
    return (React.createElement("div", { className: styles$1.header, "data-testid": "drawer-header" },
        React.createElement("div", { className: styles$1.heading },
            React.createElement(Heading.Heading, { level: 2 }, title)),
        React.createElement(ButtonDismiss.ButtonDismiss, { onClick: onRequestClose, ariaLabel: `Close ${title || "drawer"}` })));
}

var styles = {"drawerGrid":"_50Jq09W07gg-","spinning":"GqOdr2k9PX8-"};

function DrawerGrid({ children }) {
    return React.createElement("div", { className: styles.drawerGrid }, children);
}

exports.Drawer = Drawer;
exports.DrawerGrid = DrawerGrid;
