import * as React from 'react';
import { DefaultButton, PrimaryButton } from '@fluentui/react/lib/Button';
import { Dialog, DialogFooter, DialogType } from '@fluentui/react/lib/Dialog';
import { Panel } from '@fluentui/react/lib/Panel';
import { useBoolean } from '@fluentui/react-hooks';
var explanation = 'If this panel is closed using light dismiss (clicking outside the panel), a confirmation dialog will appear.';
var dialogContentProps = {
    type: DialogType.normal,
    title: 'Are you sure you want to close the panel?',
};
var dialogModalProps = {
    isBlocking: true,
    styles: { main: { maxWidth: 450 } },
};
export var PanelLightDismissCustomExample = function () {
    var _a = useBoolean(false), isPanelOpen = _a[0], _b = _a[1], openPanel = _b.setTrue, dismissPanel = _b.setFalse;
    var _c = useBoolean(false), isDialogVisible = _c[0], _d = _c[1], showDialog = _d.setTrue, hideDialog = _d.setFalse;
    var onHideDialog = React.useCallback(function (ev) {
        ev.preventDefault();
        hideDialog();
    }, [hideDialog]);
    var onHideDialogAndPanel = React.useCallback(function () {
        dismissPanel();
        hideDialog();
    }, [dismissPanel, hideDialog]);
    return (React.createElement("div", null,
        explanation,
        React.createElement("br", null),
        React.createElement("br", null),
        React.createElement(DefaultButton, { text: "Open panel", onClick: openPanel }),
        React.createElement(Panel, { isOpen: isPanelOpen, isLightDismiss: true, 
            // Use this prop to do special handling *only* for light dismiss.
            // If you provide this, the normal onDismiss won't be called for light dismiss.
            onLightDismissClick: showDialog, onDismiss: dismissPanel, headerText: "Panel with custom light dismiss behavior", closeButtonAriaLabel: "Close" },
            React.createElement("p", null, explanation)),
        React.createElement(Dialog, { hidden: !isDialogVisible, onDismiss: onHideDialog, dialogContentProps: dialogContentProps, modalProps: dialogModalProps },
            React.createElement(DialogFooter, null,
                React.createElement(PrimaryButton, { onClick: onHideDialogAndPanel, text: "Yes" }),
                React.createElement(DefaultButton, { onClick: onHideDialog, text: "No" })))));
};
//# sourceMappingURL=Panel.LightDismissCustom.Example.js.map