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;
};
import React from 'react';
import { makeStyles, Drawer, LinearProgress, CardContent } from '@material-ui/core';
import { SideSheetHeader } from '../dataDisplay/typography/SideSheetHeader';
import PropTypes from 'prop-types';
const useStyles = makeStyles((theme) => {
    var _a;
    return ({
        paper: {
            // width: (props) => props.width || 320,
            width: '100%',
            [theme.breakpoints.up('sm')]: {
                width: (props) => props.width || 320
            },
            background: ((_a = theme === null || theme === void 0 ? void 0 : theme.getThemeData()) === null || _a === void 0 ? void 0 : _a.mode) === 'dark'
                ? theme.palette.grey[700]
                : '#f4f4f4'
        },
        container: {
            height: (props) => (props.contentHeight ? props.contentHeight : ''),
            overflowY: (props) => (props.contentHeight ? 'auto' : ''),
            padding: (props) => (props.noPadding ? 0 : '')
        }
    });
});
/**
 * Base right hand side sheet with no contents
 */
export const BaseSideSheet = (props) => {
    const classes = useStyles(props);
    const { anchor = 'right', width, children, onClose, noBackdrop, buttonLabel } = props, drawerProps = __rest(props, ["anchor", "width", "children", "onClose", "noBackdrop", "buttonLabel"]);
    return (React.createElement(Drawer, Object.assign({ classes: { paper: classes.paper }, variant: "temporary", anchor: anchor, onClose: onClose }, drawerProps, { BackdropProps: { invisible: noBackdrop } }), children));
};
/**
 * A right hand material side sheet
 */
export const SideSheet = (props) => {
    const classes = useStyles(props);
    const { children, title, progress, progressColor = 'secondary', buttonLabel, noPadding, onSubmit, variant = 'determinate', buttonTwoLabel, buttonTwoIcon, buttonTwoAction, buttonTwoProgress, buttonOneDisabled, buttonTwoDisabled, id, udprecordid, anchor = 'right' } = props, otherProps = __rest(props, ["children", "title", "progress", "progressColor", "buttonLabel", "noPadding", "onSubmit", "variant", "buttonTwoLabel", "buttonTwoIcon", "buttonTwoAction", "buttonTwoProgress", "buttonOneDisabled", "buttonTwoDisabled", "id", "udprecordid", "anchor"]);
    const { onClose } = props;
    return (React.createElement(BaseSideSheet, Object.assign({ anchor: anchor }, otherProps), React.createElement(SideSheetHeader, Object.assign({ id: id, udprecordid: udprecordid, onClose: onClose, title: title, buttonLabel: buttonLabel, onSubmit: onSubmit, buttonTwoLabel: buttonTwoLabel, buttonTwoIcon: buttonTwoIcon, buttonTwoAction: buttonTwoAction, buttonTwoProgress: buttonTwoProgress, isSticky: true, buttonOneDisabled: buttonOneDisabled, buttonTwoDisabled: buttonTwoDisabled }, otherProps)), progress && (React.createElement(LinearProgress, { variant: variant, color: progressColor, value: progress })), React.createElement(CardContent, { classes: { root: classes.container } }, children)));
};
SideSheet.propTypes = {
    /**
     * Main content for the modal view
     */
    children: PropTypes.oneOfType([
        PropTypes.arrayOf(PropTypes.node),
        PropTypes.node
    ]),
    /**
     * SideSheet title
     */
    title: PropTypes.string.isRequired,
    /**
     * Function to close SideSheet
     */
    onClose: PropTypes.func,
    /**
     * Determins the open or closed state of the SideSheet
     */
    open: PropTypes.bool,
    /**
     * Value for progress loading
     */
    progress: PropTypes.any, // ToDo: add fix for hiding 0 progress
    /**
     * Progress loading color
     */
    progressColor: PropTypes.string,
    /**
     * Width of the SideSheet
     */
    width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    /**
     * Anchor orgin of card (right, left, top, bottom)
     */
    anchor: PropTypes.string,
    /**
     * Label for top action button (global only)
     */
    buttonLabel: PropTypes.string,
    /**
     * Option to override container padding
     */
    noPadding: PropTypes.string,
    /**
     * Progress loading color
     */
    contentHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};
//# sourceMappingURL=SideSheet.js.map