import { jsx as _jsx } from "react/jsx-runtime";
import { Button } from "@vertesia/ui/core";
import { useUserPermissions } from "./UserPermissionsProvider";
export function SecureButton({ permission, isDisabled, title, children, ...others }) {
    const perms = useUserPermissions();
    const hasPermission = perms.hasPermission(permission);
    if (!hasPermission) {
        isDisabled = true;
        title = 'You do not have permission to perform this action';
    }
    return (_jsx(Button, { isDisabled: isDisabled, title: title, ...others, children: children }));
}
//# sourceMappingURL=SecureButton.js.map