import { h } from "@stencil/core";
/**
 * Mock PdsModal component for testing purposes
 * This component mimics the real PdsModal but without using the Popover API
 */
export class MockPdsModal {
    constructor() {
        /**
         * The size of the modal
         */
        this.size = 'md';
        /**
         * Whether the modal content should be scrollable
         * @default true
         */
        this.scrollable = true;
        /**
         * Whether the modal can be dismissed by clicking the backdrop or pressing Escape
         */
        this.backdropDismiss = true;
        /**
         * Whether the modal is open
         */
        this.open = false;
    }
    /**
     * Shows the modal
     */
    async showModal() {
        this.open = true;
        this.pdsModalOpen.emit();
    }
    /**
     * Hides the modal
     */
    async hideModal() {
        this.open = false;
        this.pdsModalClose.emit();
    }
    /**
     * Listen for click events on the backdrop
     */
    // Using direct method instead of @Listen to avoid ESLint warning
    handleBackdropClick(event) {
        const backdrop = this.el.querySelector('.pds-modal__backdrop');
        // Check if the click was directly on the backdrop (not on a child element)
        if (event.target === backdrop && this.backdropDismiss === true) {
            this.pdsModalBackdropClick.emit();
            this.hideModal();
        }
    }
    /**
     * Listen for keydown events to handle Escape key
     * Should only close on Escape if backdropDismiss is enabled
     */
    // Using direct method instead of @Listen to avoid ESLint warning
    handleKeyDown(event) {
        if (event.key === 'Escape' && this.open === true) {
            // Always prevent default to mirror native dialog behavior blocking
            event.preventDefault();
            // Only close if backdropDismiss is enabled
            if (this.backdropDismiss === true) {
                this.hideModal();
            }
        }
    }
    componentDidLoad() {
        // No need to do anything in componentDidLoad for the mock
    }
    render() {
        const modalClasses = {
            'pds-modal': true,
            [`pds-modal--${this.size}`]: true,
            'pds-modal--scrollable': this.scrollable
        };
        const backdropClasses = {
            'pds-modal__backdrop': true,
            'open': this.open,
        };
        return (h("div", { key: '6e7f71b339764894e1f17d253fc3c8e0243e4f90', class: backdropClasses }, h("div", { key: '25b2f82c1af743156d152880631d4294dfec68b5', class: modalClasses, role: "dialog", "aria-modal": "true", "aria-labelledby": this.componentId ? `${this.componentId}-heading` : null, part: "modal" }, h("div", { key: '6bc97e805daee5e5dd547fa0b919a05cf1b6a6a1', class: "pds-modal__header" }, h("slot", { key: 'd9e7c248d983e3c055ed7e0aea5a4d5a15dfea12', name: "header" })), h("div", { key: '5608ee069b59cb34dc812bde22f83c6bce7e6904', class: "pds-modal-content" }, h("slot", { key: '6e3e790330598e1bde733350e5e216d269426e51' })), h("div", { key: '381f3c4e1c9c83b0687e1f1484b64334e388d669', class: "pds-modal__footer" }, h("slot", { key: '6e3a3cb64623de59a409072ab9c1bf65af8c2f6c', name: "footer" })))));
    }
    static get is() { return "mock-pds-modal"; }
    static get originalStyleUrls() {
        return {
            "$": ["../pds-modal.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["../pds-modal.css"]
        };
    }
    static get properties() {
        return {
            "componentId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The ID of the modal component"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "component-id"
            },
            "size": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'sm' | 'md' | 'lg' | 'fullscreen'",
                    "resolved": "\"fullscreen\" | \"lg\" | \"md\" | \"sm\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The size of the modal"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "size",
                "defaultValue": "'md'"
            },
            "scrollable": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "default",
                            "text": "true"
                        }],
                    "text": "Whether the modal content should be scrollable"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "scrollable",
                "defaultValue": "true"
            },
            "backdropDismiss": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Whether the modal can be dismissed by clicking the backdrop or pressing Escape"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "backdrop-dismiss",
                "defaultValue": "true"
            },
            "open": {
                "type": "boolean",
                "mutable": true,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Whether the modal is open"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "open",
                "defaultValue": "false"
            }
        };
    }
    static get events() {
        return [{
                "method": "pdsModalOpen",
                "name": "pdsModalOpen",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event emitted when the modal is opened"
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }, {
                "method": "pdsModalClose",
                "name": "pdsModalClose",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event emitted when the modal is closed"
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }, {
                "method": "pdsModalBackdropClick",
                "name": "pdsModalBackdropClick",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event emitted when the backdrop is clicked"
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }];
    }
    static get methods() {
        return {
            "showModal": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Shows the modal",
                    "tags": []
                }
            },
            "hideModal": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Hides the modal",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "el"; }
}
//# sourceMappingURL=mock-pds-modal.js.map
