'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../../_virtual/_tslib.js');
var React = require('react');
var styles = require('./styles.js');
var index = require('../../utils/index.js');
var useClickOutside = require('../../hooks/useClickOutside.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

function SideSheet(_a) {
    var { id, isOpen, width, title, onShowSideSheet, backdrop = false, fixed = false, hideHeader = false, hideCloseButton = false, hideOnOutsideClick = false, orientation = 'right', children } = _a, props = _tslib.__rest(_a, ["id", "isOpen", "width", "title", "onShowSideSheet", "backdrop", "fixed", "hideHeader", "hideCloseButton", "hideOnOutsideClick", "orientation", "children"]);
    const handleClick = () => {
        onShowSideSheet();
    };
    const { containerRef } = useClickOutside.useOnClickOutside(handleClick);
    return (React__default['default'].createElement(React__default['default'].Fragment, null,
        React__default['default'].createElement(styles.SideSheetContainer, { ref: hideOnOutsideClick && isOpen ? containerRef : null, id: id, isOpen: isOpen, width: width, fixed: fixed, orientation: orientation, "data-testid": props['data-testid'], "data-trackid": props['data-trackid'] },
            React__default['default'].createElement(styles.SideSheetContentWrapper, { customContent: hideHeader },
                !hideHeader && (React__default['default'].createElement(styles.HeaderWrapper, null,
                    React__default['default'].createElement(styles.TitleWrapper, null, title),
                    !hideCloseButton && React__default['default'].createElement(styles.CloseButton, { onClick: handleClick }))),
                children)),
        backdrop && isOpen ? React__default['default'].createElement(styles.BackDrop, null) : index.unitJSX));
}

exports.SideSheet = SideSheet;
