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 { IconButton, Tooltip, makeStyles } from '@material-ui/core';
import { FluentIcon } from '../../../utilities/iconLibrary/FluentIcon';
const useStyles = makeStyles(() => ({
    // Enables pointer events on disabled elements
    root: {
        '&.Mui-disabled': {
            pointerEvents: 'auto'
        }
    }
}));
// IconButtonWithTooltip allows you to set a tooltip on a disabled IconButton without ruining ButtonGroup layout
export const IconButtonWithTooltip = (_a) => {
    var { icon, title, disabled, onClick, className, fluentIconClassName, id, udprecordid } = _a, other = __rest(_a, ["icon", "title", "disabled", "onClick", "className", "fluentIconClassName", "id", "udprecordid"]);
    const adjustedButtonProps = {
        disabled: disabled,
        component: disabled ? 'div' : undefined,
        onClick: disabled ? undefined : onClick
    };
    const classes = useStyles();
    return (React.createElement(Tooltip, { title: title }, React.createElement(IconButton, Object.assign({ id: id, udprecordid: udprecordid, className: `${className} ${classes.root}` }, other, adjustedButtonProps), React.createElement(FluentIcon, { className: fluentIconClassName, component: icon }))));
};
//# sourceMappingURL=IconButtonWithToolTip.js.map