define(["require", "exports", "react", "@fluentui/react/lib/Button", "@fluentui/react/lib/Panel", "@fluentui/react-hooks"], function (require, exports, React, Button_1, Panel_1, react_hooks_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.PanelHandleDismissTargetExample = void 0;
    var explanation = 'This example demonstrates detecting whether a panel was dismissed using the close button ' +
        'or using "light dismiss" (a click outside the panel area).';
    var PanelHandleDismissTargetExample = function () {
        var _a = react_hooks_1.useBoolean(false), isOpen = _a[0], _b = _a[1], openPanel = _b.setTrue, dismissPanel = _b.setFalse;
        var onDismiss = React.useCallback(function (ev) {
            if (!ev) {
                console.log('Panel dismissed.');
                return;
            }
            // Demonstrates how to do different things depending on how which element dismissed the panel
            console.log('Close button clicked or light dismissed.');
            // eslint-disable-next-line deprecation/deprecation
            var srcElement = ev.nativeEvent.srcElement;
            if (srcElement && srcElement.className.indexOf('ms-Button-icon') !== -1) {
                console.log('Close button clicked.');
            }
            if (srcElement && srcElement.className.indexOf('ms-Overlay') !== -1) {
                console.log('Light dismissed.');
            }
            dismissPanel();
        }, [dismissPanel]);
        return (React.createElement("div", null,
            explanation,
            React.createElement("br", null),
            React.createElement("br", null),
            React.createElement(Button_1.DefaultButton, { text: "Open panel", onClick: openPanel }),
            React.createElement(Panel_1.Panel, { isOpen: isOpen, onDismiss: onDismiss, headerText: "Panel - Handle close button clicks or light dismissal", closeButtonAriaLabel: "Close", isLightDismiss: true },
                React.createElement("div", null,
                    React.createElement("p", null, explanation),
                    React.createElement("p", null, "(Check the debug console for results after dismissing the panel.)")))));
    };
    exports.PanelHandleDismissTargetExample = PanelHandleDismissTargetExample;
});
//# sourceMappingURL=Panel.HandleDismissTarget.Example.js.map