import { Component, Event, h, Host, Listen, Prop } from '@stencil/core';
export class DvnDialog {
  constructor() {
    this.shown = true;
    this.raw = false;
    this.separateFooter = false;
    this.separateHeader = false;
    this.clip = true;
  }
  handleKeyDown(ev) {
    // close modal on escape key
    if (ev.key === 'Escape') {
      this.dismiss.emit();
    }
  }
  render() {
    if (this.raw) {
      return (h(Host, { class: { hidden: !this.shown } },
        h("div", { class: "background-layer", onClick: () => this.dismiss.emit() }),
        h("dvn-card", { clip: this.clip, bodyLeaned: true, overrideStyle: {
            minHeight: this.minHeight || '80px',
            width: this.width || '640px',
            maxHeight: this.maxHeight || '96vh',
          } },
          h("slot", null))));
    }
    return (h(Host, { class: { hidden: !this.shown } },
      h("div", { class: "background-layer", onClick: () => this.dismiss.emit() }),
      h("dvn-card", { clip: this.clip, elevation: 0, overrideStyle: {
          minHeight: this.minHeight || '80px',
          width: this.width || '640px',
          maxHeight: this.maxHeight || '96vh',
        } },
        h("dvn-card-header", { title: this.title, slot: "header", separated: this.separateHeader }),
        h("slot", null),
        h("dvn-card-footer", { slot: "footer", alignRight: true, separated: this.separateFooter },
          h("slot", { name: "actions" })))));
  }
  static get is() { return "dvn-dialog"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-dialog.css"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-dialog.css"]
  }; }
  static get properties() { return {
    "title": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "title",
      "reflect": false
    },
    "shown": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "shown",
      "reflect": false,
      "defaultValue": "true"
    },
    "raw": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "raw",
      "reflect": false,
      "defaultValue": "false"
    },
    "separateFooter": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "separate-footer",
      "reflect": false,
      "defaultValue": "false"
    },
    "separateHeader": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "separate-header",
      "reflect": false,
      "defaultValue": "false"
    },
    "minHeight": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "min-height",
      "reflect": false
    },
    "maxHeight": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "max-height",
      "reflect": false
    },
    "width": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "width",
      "reflect": false
    },
    "clip": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "clip",
      "reflect": false,
      "defaultValue": "true"
    }
  }; }
  static get events() { return [{
      "method": "dismiss",
      "name": "dismiss",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }]; }
  static get listeners() { return [{
      "name": "keydown",
      "method": "handleKeyDown",
      "target": "document",
      "capture": false,
      "passive": false
    }]; }
}
