"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Drawer = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const styled_components_1 = __importDefault(require("styled-components"));
const Box_1 = require("../Box");
const Overlay = (0, styled_components_1.default)(Box_1.Box)({
    margin: 0,
    padding: 0,
    position: 'fixed',
    top: 0,
    left: 0,
    width: '100vw',
    height: '100vh',
    overflow: 'hidden',
    backgroundColor: 'rgba(21, 41, 53, 0.3)',
});
const Component = (0, styled_components_1.default)(Box_1.Box)(({ theme, variant, position, radius, isOpen }) => {
    const isLeft = position === 'left';
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ top: 0, bottom: 0, overflowX: 'hidden', overflowY: 'auto' }, (theme.DRAWER[variant] || {})), { position: 'fixed' }), (isLeft ? { left: 0 } : { right: 0 })), { transform: `translate3d(${isOpen ? '0' : `${isLeft ? '-' : ''}110%`}, 0, 0)` }), (radius
        ? isLeft
            ? {
                borderRadius: 0,
                borderTopRightRadius: theme.RADIUS[radius],
                borderBottomRightRadius: theme.RADIUS[radius],
            }
            : {
                borderRadius: 0,
                borderTopLeftRadius: theme.RADIUS[radius],
                borderBottomLeftRadius: theme.RADIUS[radius],
            }
        : {}));
});
const Drawer = (_a) => {
    var { hasOverlay = true, isOpen } = _a, props = __rest(_a, ["hasOverlay", "isOpen"]);
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOpen && hasOverlay && (0, jsx_runtime_1.jsx)(Overlay, { variant: "raw" }, void 0), (0, jsx_runtime_1.jsx)(Component, Object.assign({ isOpen: isOpen }, props), void 0)] }, void 0));
};
exports.Drawer = Drawer;
//# sourceMappingURL=Drawer.js.map