UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

273 lines (272 loc) 9.96 kB
/*! * KoliBri - The accessible HTML-Standard */ import { h } from "@stencil/core"; import { KolDialogWcTag } from "../../core/component-names"; export class KolDialog { constructor() { this.catchRef = (ref) => { this.dialogRef = ref; }; this._level = 0; this._width = '100%'; this._variant = 'blank'; } openModal() { return this.showModal(); } showModal() { var _a, _b; return (_b = (_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.showModal()) !== null && _b !== void 0 ? _b : Promise.resolve(); } show(modal = false) { var _a, _b; return (_b = (_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.show(modal)) !== null && _b !== void 0 ? _b : Promise.resolve(); } close() { var _a, _b; return (_b = (_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.close()) !== null && _b !== void 0 ? _b : Promise.resolve(); } closeModal() { return this.close(); } render() { return (h(KolDialogWcTag, { key: 'a17abd1f58ac28397c5645822518998209c455e9', ref: this.catchRef, _label: this._label, _level: this._level, _on: this._on, _variant: this._variant, _width: this._width }, h("slot", { key: 'bc9895ef49e81444df9ce3d2634ae950bfc0f115' }))); } static get is() { return "kol-dialog"; } static get encapsulation() { return "shadow"; } static get originalStyleUrls() { return { "default": ["./style.scss"] }; } static get styleUrls() { return { "default": ["style.css"] }; } static get properties() { return { "_label": { "type": "string", "mutable": false, "complexType": { "original": "LabelPropType", "resolved": "string", "references": { "LabelPropType": { "location": "import", "path": "../../schema", "id": "src/schema/index.ts::LabelPropType" } } }, "required": true, "optional": false, "docs": { "tags": [], "text": "Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.)." }, "getter": false, "setter": false, "reflect": false, "attribute": "_label" }, "_level": { "type": "number", "mutable": false, "complexType": { "original": "HeadingLevel", "resolved": "0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined", "references": { "HeadingLevel": { "location": "import", "path": "../../schema", "id": "src/schema/index.ts::HeadingLevel" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "Defines which H-level from 1-6 the heading has. 0 specifies no heading and is shown as bold text." }, "getter": false, "setter": false, "reflect": false, "attribute": "_level", "defaultValue": "0" }, "_on": { "type": "unknown", "mutable": false, "complexType": { "original": "KoliBriDialogEventCallbacks", "resolved": "undefined | ({ onCancel?: ((event: Event) => void) | undefined; onClose?: (() => void) | undefined; onToggle?: ((open: boolean) => void) | undefined; })", "references": { "KoliBriDialogEventCallbacks": { "location": "import", "path": "../../schema", "id": "src/schema/index.ts::KoliBriDialogEventCallbacks" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "Defines the modal callback functions." }, "getter": false, "setter": false }, "_width": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string | undefined", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Defines the width of the modal. (max-width: 100%)" }, "getter": false, "setter": false, "reflect": false, "attribute": "_width", "defaultValue": "'100%'" }, "_variant": { "type": "string", "mutable": false, "complexType": { "original": "ModalVariantPropType", "resolved": "\"blank\" | \"card\" | undefined", "references": { "ModalVariantPropType": { "location": "import", "path": "../../schema/props/variant/modal", "id": "src/schema/props/variant/modal.ts::ModalVariantPropType" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "Defines the variant of the modal." }, "getter": false, "setter": false, "reflect": false, "attribute": "_variant", "defaultValue": "'blank'" } }; } static get methods() { return { "openModal": { "complexType": { "signature": "() => Promise<void>", "parameters": [], "references": { "Promise": { "location": "global", "id": "global::Promise" } }, "return": "Promise<void>" }, "docs": { "text": "Opens the dialog.", "tags": [{ "name": "deprecated", "text": "Use showModal() instead." }] } }, "showModal": { "complexType": { "signature": "() => Promise<void>", "parameters": [], "references": { "Promise": { "location": "global", "id": "global::Promise" } }, "return": "Promise<void>" }, "docs": { "text": "Opens the dialog as a modal.", "tags": [] } }, "show": { "complexType": { "signature": "(modal?: boolean) => Promise<void>", "parameters": [{ "name": "modal", "type": "boolean", "docs": "" }], "references": { "Promise": { "location": "global", "id": "global::Promise" } }, "return": "Promise<void>" }, "docs": { "text": "Opens the dialog. Pass true to open as a modal dialog.", "tags": [] } }, "close": { "complexType": { "signature": "() => Promise<void>", "parameters": [], "references": { "Promise": { "location": "global", "id": "global::Promise" } }, "return": "Promise<void>" }, "docs": { "text": "Closes the dialog.", "tags": [] } }, "closeModal": { "complexType": { "signature": "() => Promise<void>", "parameters": [], "references": { "Promise": { "location": "global", "id": "global::Promise" } }, "return": "Promise<void>" }, "docs": { "text": "Closes the dialog.", "tags": [{ "name": "deprecated", "text": "Use close() instead." }] } } }; } } //# sourceMappingURL=shadow.js.map