'use strict';

var index = require('./index-BUvWX8u2.js');

const pdsModalCss = ".pds-modal__backdrop{-ms-flex-align:start;align-items:flex-start;background-color:rgba(0, 0, 0, 0.4);border:0;display:-ms-flexbox;display:flex;height:100%;inset:0;-ms-flex-pack:center;justify-content:center;margin:0;max-height:100%;max-width:100%;opacity:0;padding:0;position:fixed;-webkit-transition:opacity var(--pine-motion-duration-base) var(--pine-motion-easing-in), visibility var(--pine-motion-duration-base) var(--pine-motion-easing-in);transition:opacity var(--pine-motion-duration-base) var(--pine-motion-easing-in), visibility var(--pine-motion-duration-base) var(--pine-motion-easing-in);visibility:hidden;width:100%;z-index:var(--pine-z-index-modal)}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}}pds-modal .pds-modal__backdrop{z-index:var(--pine-z-index-priority)}.pds-modal__backdrop::-webkit-backdrop{background:transparent}.pds-modal__backdrop::-ms-backdrop{background:transparent}.pds-modal__backdrop::backdrop{background:transparent}.pds-modal__backdrop.open{opacity:1;-webkit-transition-timing-function:var(--pine-motion-easing-out);transition-timing-function:var(--pine-motion-easing-out);visibility:visible}.pds-modal{background:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow-400);box-shadow:var(--pine-box-shadow-400);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:var(--pine-dimension-md);max-height:none;width:100%}.pds-modal.pds-modal--scrollable{max-height:calc(100vh - (5vh + 96px))}@supports (height: 100dvh){.pds-modal.pds-modal--scrollable{max-height:calc(100dvh - (5dvh + 96px))}}@media (min-width: 992px){.pds-modal{-webkit-margin-before:6vh;margin-block-start:6vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:6dvh;margin-block-start:6dvh}}}@media (min-width: 1200px){.pds-modal{-webkit-margin-before:8vh;margin-block-start:8vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:8dvh;margin-block-start:8dvh}}}.pds-modal--sm{max-width:520px}.pds-modal--md{max-width:700px}.pds-modal--lg{max-width:900px}.pds-modal--fullscreen{border-radius:0;height:100%;margin:0;max-height:100vh;max-width:100%}@supports (height: 100dvh){.pds-modal--fullscreen{max-height:100dvh}}.pds-modal--fullscreen.pds-modal--scrollable{max-height:100vh}@supports (height: 100dvh){.pds-modal--fullscreen.pds-modal--scrollable{max-height:100dvh}}.pds-modal--fullscreen .pds-modal-content{-ms-flex:1;flex:1}.pds-modal--scrollable pds-modal-content{-webkit-border-after:1px solid transparent;border-block-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;overflow-y:auto}.pds-modal:not(.pds-modal--scrollable) pds-modal-content{overflow-y:visible}";

const MockPdsModal = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.pdsModalOpen = index.createEvent(this, "pdsModalOpen");
        this.pdsModalClose = index.createEvent(this, "pdsModalClose");
        this.pdsModalBackdropClick = index.createEvent(this, "pdsModalBackdropClick");
        /**
         * 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 (index.h("div", { key: '6e7f71b339764894e1f17d253fc3c8e0243e4f90', class: backdropClasses }, index.h("div", { key: '25b2f82c1af743156d152880631d4294dfec68b5', class: modalClasses, role: "dialog", "aria-modal": "true", "aria-labelledby": this.componentId ? `${this.componentId}-heading` : null, part: "modal" }, index.h("div", { key: '6bc97e805daee5e5dd547fa0b919a05cf1b6a6a1', class: "pds-modal__header" }, index.h("slot", { key: 'd9e7c248d983e3c055ed7e0aea5a4d5a15dfea12', name: "header" })), index.h("div", { key: '5608ee069b59cb34dc812bde22f83c6bce7e6904', class: "pds-modal-content" }, index.h("slot", { key: '6e3e790330598e1bde733350e5e216d269426e51' })), index.h("div", { key: '381f3c4e1c9c83b0687e1f1484b64334e388d669', class: "pds-modal__footer" }, index.h("slot", { key: '6e3a3cb64623de59a409072ab9c1bf65af8c2f6c', name: "footer" })))));
    }
    get el() { return index.getElement(this); }
};
MockPdsModal.style = pdsModalCss;

exports.mock_pds_modal = MockPdsModal;
//# sourceMappingURL=mock-pds-modal.entry.cjs.js.map
