/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import { Host, h } from "@stencil/core";
import { getIonTheme } from "../../global/ionic-global";
/**
 * @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
 * @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
 */
export class Backdrop {
    constructor() {
        /**
         * If `true`, the backdrop will be visible.
         */
        this.visible = true;
        /**
         * If `true`, the backdrop will can be clicked and will emit the `ionBackdropTap` event.
         */
        this.tappable = true;
        /**
         * If `true`, the backdrop will stop propagation on tap.
         */
        this.stopPropagation = true;
    }
    onMouseDown(ev) {
        this.emitTap(ev);
    }
    emitTap(ev) {
        if (this.stopPropagation) {
            ev.preventDefault();
            ev.stopPropagation();
        }
        if (this.tappable) {
            this.ionBackdropTap.emit();
        }
    }
    render() {
        const theme = getIonTheme(this);
        return (h(Host, { key: '730d0808e1043510fda404686d9883d83c0f31a4', "aria-hidden": "true", class: {
                [theme]: true,
                'backdrop-hide': !this.visible,
                'backdrop-no-tappable': !this.tappable,
            } }));
    }
    static get is() { return "ion-backdrop"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "ios": ["backdrop.ios.scss"],
            "md": ["backdrop.md.scss"],
            "ionic": ["backdrop.ionic.scss"]
        };
    }
    static get styleUrls() {
        return {
            "ios": ["backdrop.ios.css"],
            "md": ["backdrop.md.css"],
            "ionic": ["backdrop.ionic.css"]
        };
    }
    static get properties() {
        return {
            "visible": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the backdrop will be visible."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "visible",
                "defaultValue": "true"
            },
            "tappable": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the backdrop will can be clicked and will emit the `ionBackdropTap` event."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "tappable",
                "defaultValue": "true"
            },
            "stopPropagation": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the backdrop will stop propagation on tap."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "stop-propagation",
                "defaultValue": "true"
            }
        };
    }
    static get events() {
        return [{
                "method": "ionBackdropTap",
                "name": "ionBackdropTap",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the backdrop is tapped."
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }];
    }
    static get listeners() {
        return [{
                "name": "click",
                "method": "onMouseDown",
                "target": undefined,
                "capture": true,
                "passive": false
            }];
    }
}
