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, { useState } from 'react';
import SpeedDial from '@material-ui/lab/SpeedDial';
import SpeedDialIcon from '@material-ui/lab/SpeedDialIcon';
import SpeedDialAction from '@material-ui/lab/SpeedDialAction';
import AddIcon from '@material-ui/icons/esm/Add';
import { makeStyles } from '@material-ui/core/styles';
import { UnityFluentIcon } from '../utilities/iconLibrary/UnityFluentIcon';
import { getIconFromName } from '../utilities/tree/TreeUtilities';
import { getUnityIconFromName } from '../utilities/iconLibrary/UnityIconLibrary';
const useStyles = makeStyles((theme) => {
    return {
        wrapper: {
            position: 'fixed',
            right: theme.spacing(0),
            bottom: theme.spacing(0),
            zIndex: 1200
        },
        speedDial: {
            position: 'absolute',
            '&.MuiSpeedDial-directionUp, &.MuiSpeedDial-directionLeft': {
                bottom: theme.spacing(2),
                right: theme.spacing(2)
            }
        },
        speedDialFab: {
            backgroundColor: 'black',
            borderRadius: 1,
            margin: 0,
            opacity: 0.75,
            '&:hover': {
                backgroundColor: 'black'
            },
            '&:focus': {
                backgroundColor: 'black'
            }
        },
        speadDialFabExpanded: {
            backgroundColor: 'black',
            borderRadius: 1,
            margin: 0,
            '&:hover': {
                backgroundColor: 'black'
            },
            '&:focus': {
                backgroundColor: 'black'
            }
        },
        speedDialActions: {
            '&.MuiSpeedDial-directionUp, &.MuiSpeedDial-actions': {
                paddingBottom: 0,
                marginBottom: 0,
                opacity: 0.75
            },
            '&:hover': {
                opacity: 1
            },
            '&:focus': {
                opacity: 1
            }
        },
        speedDialActionFab: {
            backgroundColor: 'black',
            borderRadius: 1,
            margin: 0,
            color: 'white',
            width: 56,
            height: 56
        }
    };
});
export const ActionSpeedDial = (props) => {
    const [expanded, setExpanded] = useState(false);
    const classes = useStyles(expanded);
    // @ts-ignore
    const { open, ariaLabel, actions } = props, otherProps = __rest(props, ["open", "ariaLabel", "actions"]);
    if (!actions.length)
        return null;
    return (React.createElement("div", { className: classes.wrapper }, React.createElement(SpeedDial, Object.assign({ id: 'udpRecord-ActionSpeedDial', 
        // @ts-ignore
        udprecordid: 'udpRecord-ActionSpeedDial', className: classes.speedDial, ariaLabel: "Fluent Speed Dial", classes: {
            fab: expanded ? classes.speadDialFabExpanded : classes.speedDialFab,
            actions: classes.speedDialActions
        }, icon: React.createElement(SpeedDialIcon, { icon: React.createElement(AddIcon, null) }), onClose: () => setExpanded(false), onOpen: () => setExpanded(true), open: expanded }, otherProps), actions.map((action) => (React.createElement(SpeedDialAction, { id: 'udpRecord-ActionSpeedDial-' + action.name, 
        // @ts-ignore
        udprecordid: 'udpRecord-ActionSpeedDial-' + action.name, key: action.name, icon: 
        /*<UnityFluentIcon component={Icons[action.icon.name]} {...action.icon}/>*/
        React.createElement(UnityFluentIcon, { type: action.icon.type, icon: action.icon.type === 'unity'
                ? getUnityIconFromName(action.icon.name)
                : getIconFromName(action.icon.name) }), open: false, onClick: e => action.onClick(e), classes: {
            fab: classes.speedDialActionFab
        }, tooltipTitle: action.name }))))));
};
//# sourceMappingURL=ActionSpeedDial.js.map