@c2n/modal 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Nguyen Thai Vinh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @c2n/modal
2
+
3
+ Modal dialog built on the native `<dialog>` element, with Lit.
4
+
5
+ ```bash
6
+ npm install @c2n/modal
7
+ ```
8
+
9
+ ```html
10
+ <script type="module">
11
+ import '@c2n/modal'
12
+ </script>
13
+
14
+ <button onclick="invite.show()">Invite</button>
15
+
16
+ <c2-modal id="invite">
17
+ <h2 slot="title">Invite your team</h2>
18
+ <p>Share the link with your teammates.</p>
19
+ <c2-button slot="footer" onclick="invite.close('cancel')">Cancel</c2-button>
20
+ <c2-button slot="footer" onclick="invite.close('ok')">Copy link</c2-button>
21
+ </c2-modal>
22
+ ```
23
+
24
+ - **Native first**: `showModal()` traps and restores focus, makes the page inert and draws a backdrop; Escape closes through the cancelable `cancel` event.
25
+ - **Open / close**: the `open` attribute or `show()`; `close(returnValue)`, the × button, a backdrop click or Escape. `no-backdrop-close`, `no-escape` and `hide-close` turn each of those off. `close` fires with `detail.returnValue`, `open` after showing.
26
+ - **Layout**: `title` slot (labels the dialog; use `label` when there is none), body in the default slot (scrolls past `--c2-modal--max-height`), `footer` slot as an actions row. The page does not scroll while a modal is open (`no-scroll-lock` opts out).
27
+ - **Looks**: everything is a token: size and margins (`--c2-modal--margin-top: 24px` pins it to the top, `margin-bottom: 0` + full width makes a bottom sheet), radius, shadow, the header/body/footer paddings and dividers, the close button, the backdrop colour and blur, and the enter animation (`--c2-modal--enter-transform`).
28
+
29
+ The full token list is in `custom-elements.json` and on the docs site.
package/dist/modal.js ADDED
@@ -0,0 +1,166 @@
1
+ import { LitElement, html, nothing, unsafeCSS } from "lit";
2
+ import { isServer } from "lit-html/is-server.js";
3
+ import { customElement, property, query, state } from "lit/decorators.js";
4
+ import { classMap } from "lit/directives/class-map.js";
5
+ import { redispatchEvent } from "@c2n/core/dom-helper.js";
6
+ //#region src/modal.scss?inline
7
+ var modal_default = "/* ex : var((width: 24px), width, c2-checkbox) returns var(--c2-checkbox-width, 24px) */\n:host {\n display: contents;\n}\n\n.c2-modal {\n box-sizing: border-box;\n width: var(--c2-modal--width,min(480px, calc(100vw - 32px)));\n max-width: 100vw;\n max-height: var(--c2-modal--max-height,calc(100vh - 64px));\n margin-top: var(--c2-modal--margin-top,auto);\n margin-bottom: var(--c2-modal--margin-bottom,auto);\n margin-left: auto;\n margin-right: auto;\n padding: 0;\n border: var(--c2-modal--border,none);\n border-top-left-radius: var(--c2-modal--border-top-left-radius,14px);\n border-top-right-radius: var(--c2-modal--border-top-right-radius,14px);\n border-bottom-left-radius: var(--c2-modal--border-bottom-left-radius,14px);\n border-bottom-right-radius: var(--c2-modal--border-bottom-right-radius,14px);\n background: var(--c2-modal--background,#ffffff);\n color: var(--c2-modal--color,#18181b);\n box-shadow: var(--c2-modal--box-shadow,0 24px 60px rgba(0, 0, 0, 0.25));\n overflow: hidden;\n opacity: 0;\n transform: var(--c2-modal--enter-transform,translateY(12px) scale(0.98));\n transition: opacity var(--c2-modal--transition-duration,200ms) cubic-bezier(0.2, 0, 0, 1), transform var(--c2-modal--transition-duration,200ms) cubic-bezier(0.2, 0, 0, 1), display var(--c2-modal--transition-duration,200ms) allow-discrete, overlay var(--c2-modal--transition-duration,200ms) allow-discrete;\n}\n.c2-modal[open] {\n opacity: 1;\n transform: none;\n}\n.c2-modal::backdrop {\n background: var(--c2-modal__backdrop--background,rgba(9, 9, 11, 0.45));\n backdrop-filter: var(--c2-modal__backdrop--backdrop-filter);\n opacity: 0;\n transition: opacity var(--c2-modal--transition-duration,200ms) cubic-bezier(0.2, 0, 0, 1), display var(--c2-modal--transition-duration,200ms) allow-discrete, overlay var(--c2-modal--transition-duration,200ms) allow-discrete;\n}\n.c2-modal[open]::backdrop {\n opacity: 1;\n}\n\n@starting-style {\n .c2-modal[open] {\n opacity: 0;\n transform: var(--c2-modal--enter-transform,translateY(12px) scale(0.98));\n }\n .c2-modal[open]::backdrop {\n opacity: 0;\n }\n}\n.c2-modal__panel {\n display: flex;\n flex-direction: column;\n max-height: var(--c2-modal--max-height,calc(100vh - 64px));\n min-height: 0;\n}\n\n.c2-modal__header {\n display: flex;\n align-items: flex-start;\n gap: 12px;\n flex: none;\n padding-top: var(--c2-modal__header--padding-top,20px);\n padding-right: var(--c2-modal__header--padding-right,20px);\n padding-bottom: var(--c2-modal__header--padding-bottom,0px);\n padding-left: var(--c2-modal__header--padding-left,24px);\n border-bottom: var(--c2-modal__header--border-bottom);\n}\n.c2-modal__header[hidden] {\n display: none;\n}\n\n.c2-modal__title {\n flex: 1;\n min-width: 0;\n font-size: var(--c2-modal__header--font-size,17px);\n font-weight: var(--c2-modal__header--font-weight,600);\n line-height: var(--c2-modal__header--line-height,1.35);\n min-height: var(--c2-modal__close--size,32px);\n display: flex;\n align-items: center;\n}\n.c2-modal__title ::slotted(*) {\n margin: 0;\n font: inherit;\n}\n\n.c2-modal__close {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n box-sizing: border-box;\n width: var(--c2-modal__close--size,32px);\n height: var(--c2-modal__close--size,32px);\n margin: 0;\n padding: 0;\n border: none;\n border-radius: var(--c2-modal__close--border-radius,8px);\n background: transparent;\n color: var(--c2-modal__close--color,#71717a);\n cursor: pointer;\n transition: background 250ms cubic-bezier(0.2, 0, 0, 1), color 250ms cubic-bezier(0.2, 0, 0, 1);\n}\n.c2-modal__close svg,\n.c2-modal__close ::slotted(*) {\n width: var(--c2-modal__close--icon-size,18px);\n height: var(--c2-modal__close--icon-size,18px);\n}\n.c2-modal__close:hover {\n background: var(--c2-modal__close__hover--background,#f4f4f5);\n color: var(--c2-modal__close__hover--color,#18181b);\n}\n.c2-modal__close:focus-visible {\n outline: var(--c2-modal__close__focus--outline,2px solid rgba(2, 101, 220, 0.4));\n outline-offset: 1px;\n}\n\n.c2-modal__body {\n flex: 1;\n min-height: 0;\n overflow: auto;\n padding-top: var(--c2-modal__body--padding-top,12px);\n padding-right: var(--c2-modal__body--padding-right,24px);\n padding-bottom: var(--c2-modal__body--padding-bottom,20px);\n padding-left: var(--c2-modal__body--padding-left,24px);\n font-size: var(--c2-modal__body--font-size,14px);\n line-height: var(--c2-modal__body--line-height,1.6);\n color: var(--c2-modal__body--color);\n}\n\n.c2-modal__footer {\n display: flex;\n align-items: center;\n flex: none;\n gap: var(--c2-modal__footer--gap,8px);\n justify-content: var(--c2-modal__footer--justify-content,flex-end);\n padding-top: var(--c2-modal__footer--padding-top,0px);\n padding-right: var(--c2-modal__footer--padding-right,24px);\n padding-bottom: var(--c2-modal__footer--padding-bottom,20px);\n padding-left: var(--c2-modal__footer--padding-left,24px);\n border-top: var(--c2-modal__footer--border-top);\n}\n.c2-modal__footer[hidden] {\n display: none;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .c2-modal,\n .c2-modal::backdrop {\n transition: none;\n }\n}";
8
+ //#endregion
9
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/decorate.js
10
+ function __decorate(decorators, target, key, desc) {
11
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
15
+ }
16
+ //#endregion
17
+ //#region src/modal.ts
18
+ var scrollLocks = 0;
19
+ var previousOverflow = "";
20
+ var Modal = class Modal extends LitElement {
21
+ constructor(..._args) {
22
+ super(..._args);
23
+ this.open = false;
24
+ this.label = void 0;
25
+ this.noBackdropClose = false;
26
+ this.noEscape = false;
27
+ this.hideClose = false;
28
+ this.noScrollLock = false;
29
+ this.returnValue = "";
30
+ this.hasTitle = false;
31
+ this.hasFooter = false;
32
+ this.locked = false;
33
+ this.handleDialogClose = () => {
34
+ this.returnValue = this.dialog.returnValue;
35
+ this.unlockScroll();
36
+ this.open = false;
37
+ this.dispatchEvent(new CustomEvent("close", {
38
+ detail: { returnValue: this.returnValue },
39
+ bubbles: true,
40
+ composed: true
41
+ }));
42
+ };
43
+ this.handleDialogCancel = (event) => {
44
+ if (this.noEscape) {
45
+ event.preventDefault();
46
+ return;
47
+ }
48
+ if (!redispatchEvent(this, event)) event.preventDefault();
49
+ };
50
+ this.handleDialogClick = (event) => {
51
+ if (event.target === this.dialog && !this.noBackdropClose) this.close();
52
+ };
53
+ }
54
+ static {
55
+ this.styles = unsafeCSS(modal_default);
56
+ }
57
+ disconnectedCallback() {
58
+ super.disconnectedCallback();
59
+ this.unlockScroll();
60
+ }
61
+ /** Opens the dialog (modal). */
62
+ show() {
63
+ this.open = true;
64
+ }
65
+ /** Closes the dialog with an optional `returnValue`. */
66
+ close(returnValue = "") {
67
+ this.returnValue = returnValue;
68
+ if (this.dialog?.open) this.dialog.close(returnValue);
69
+ else this.open = false;
70
+ }
71
+ lockScroll() {
72
+ if (this.noScrollLock || this.locked || isServer) return;
73
+ if (scrollLocks++ === 0) {
74
+ previousOverflow = document.documentElement.style.overflow;
75
+ document.documentElement.style.overflow = "hidden";
76
+ }
77
+ this.locked = true;
78
+ }
79
+ unlockScroll() {
80
+ if (!this.locked) return;
81
+ this.locked = false;
82
+ if (--scrollLocks === 0) document.documentElement.style.overflow = previousOverflow;
83
+ }
84
+ handleSlotChange(event) {
85
+ this.updateSlot(event.target);
86
+ }
87
+ updateSlot(slot) {
88
+ const filled = slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent ?? "").trim() !== "");
89
+ if (slot.name === "title") this.hasTitle = filled;
90
+ else if (slot.name === "footer") this.hasFooter = filled;
91
+ }
92
+ firstUpdated() {
93
+ for (const slot of this.renderRoot.querySelectorAll("slot")) this.updateSlot(slot);
94
+ }
95
+ updated(changed) {
96
+ if (changed.has("open") && !isServer && this.dialog) {
97
+ if (this.open && !this.dialog.open) {
98
+ this.dialog.showModal();
99
+ this.lockScroll();
100
+ this.dispatchEvent(new Event("open", {
101
+ bubbles: true,
102
+ composed: true
103
+ }));
104
+ } else if (!this.open && this.dialog.open) this.dialog.close(this.returnValue);
105
+ }
106
+ }
107
+ render() {
108
+ return html`
109
+ <dialog
110
+ class="c2-modal"
111
+ aria-labelledby=${this.hasTitle ? "title" : nothing}
112
+ aria-label=${!this.hasTitle && this.label ? this.label : nothing}
113
+ @close=${this.handleDialogClose}
114
+ @cancel=${this.handleDialogCancel}
115
+ @click=${this.handleDialogClick}
116
+ >
117
+ <div class=${classMap({
118
+ "c2-modal__panel": true,
119
+ "has-title": this.hasTitle,
120
+ "has-footer": this.hasFooter
121
+ })}>
122
+ <header class="c2-modal__header" ?hidden=${!this.hasTitle && this.hideClose}>
123
+ <div class="c2-modal__title" id="title"><slot name="title" @slotchange=${this.handleSlotChange}></slot></div>
124
+ ${this.hideClose ? nothing : html`<button class="c2-modal__close" type="button" aria-label="Close" @click=${() => this.close()}>
125
+ <slot name="close-icon">
126
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
127
+ <path d="M18 6 6 18M6 6l12 12"></path>
128
+ </svg>
129
+ </slot>
130
+ </button>`}
131
+ </header>
132
+ <div class="c2-modal__body"><slot></slot></div>
133
+ <footer class="c2-modal__footer" ?hidden=${!this.hasFooter}><slot name="footer" @slotchange=${this.handleSlotChange}></slot></footer>
134
+ </div>
135
+ </dialog>
136
+ `;
137
+ }
138
+ };
139
+ __decorate([property({
140
+ type: Boolean,
141
+ reflect: true
142
+ })], Modal.prototype, "open", void 0);
143
+ __decorate([property()], Modal.prototype, "label", void 0);
144
+ __decorate([property({
145
+ type: Boolean,
146
+ attribute: "no-backdrop-close"
147
+ })], Modal.prototype, "noBackdropClose", void 0);
148
+ __decorate([property({
149
+ type: Boolean,
150
+ attribute: "no-escape"
151
+ })], Modal.prototype, "noEscape", void 0);
152
+ __decorate([property({
153
+ type: Boolean,
154
+ reflect: true,
155
+ attribute: "hide-close"
156
+ })], Modal.prototype, "hideClose", void 0);
157
+ __decorate([property({
158
+ type: Boolean,
159
+ attribute: "no-scroll-lock"
160
+ })], Modal.prototype, "noScrollLock", void 0);
161
+ __decorate([state()], Modal.prototype, "hasTitle", void 0);
162
+ __decorate([state()], Modal.prototype, "hasFooter", void 0);
163
+ __decorate([query("dialog")], Modal.prototype, "dialog", void 0);
164
+ Modal = __decorate([customElement("c2-modal")], Modal);
165
+ //#endregion
166
+ export { Modal };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@c2n/modal",
3
+ "version": "0.0.6",
4
+ "type": "module",
5
+ "main": "dist/modal.js",
6
+ "exports": {
7
+ ".": {
8
+ "default": "./dist/modal.js",
9
+ "types": "./types/src/modal.d.ts"
10
+ },
11
+ "./custom-elements.json": "./custom-elements.json"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "types"
16
+ ],
17
+ "keywords": [
18
+ "modal",
19
+ "web component",
20
+ "lit"
21
+ ],
22
+ "license": "MIT",
23
+ "author": "code2nguyen@gmail.com",
24
+ "publishConfig": {
25
+ "registry": "https://registry.npmjs.org",
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/code2nguyen/web-components.git"
31
+ },
32
+ "scripts": {
33
+ "dev": "vite",
34
+ "build": "wireit",
35
+ "build:only": "vite build",
36
+ "type-check": "wireit"
37
+ },
38
+ "wireit": {
39
+ "type-check": {
40
+ "dependencies": [
41
+ "../../core:build"
42
+ ],
43
+ "command": "tsc -p tsconfig.lib.json --composite false"
44
+ },
45
+ "build": {
46
+ "dependencies": [
47
+ "type-check"
48
+ ],
49
+ "command": "vite build"
50
+ }
51
+ },
52
+ "dependencies": {
53
+ "@c2n/core": "0.0.6",
54
+ "lit": "3.3.3"
55
+ },
56
+ "devDependencies": {
57
+ "@c2n/config": "*"
58
+ },
59
+ "customElements": "custom-elements.json",
60
+ "gitHead": "2921054bc75299da66dad11c1e374246ff88a51e"
61
+ }
@@ -0,0 +1,112 @@
1
+ import { LitElement, type PropertyValues } from 'lit';
2
+ /**
3
+ * Modal dialog built on the native `<dialog>` element: focus is trapped and restored, Escape closes, the page behind
4
+ * is inert and covered by a backdrop. Open it with the `open` attribute or `show()`, close it with `close(returnValue)`,
5
+ * the built-in close button, a click on the backdrop or Escape (each can be turned off). Content is split into a
6
+ * `title` slot, the body (default slot) and a `footer` slot for actions; the body scrolls when the content is taller
7
+ * than `--c2-modal--max-height`. While a modal is open the page does not scroll (`no-scroll-lock` opts out).
8
+ *
9
+ * @tag c2-modal
10
+ *
11
+ * @slot - Body content.
12
+ * @slot title - Heading shown in the header; the dialog is labelled by it.
13
+ * @slot footer - Actions row (a flex row, see the `footer--*` tokens).
14
+ * @slot close-icon - Replaces the default × icon of the close button.
15
+ *
16
+ * @event {Event} open - Fired after the dialog has been shown.
17
+ * @event {CustomEvent<{ returnValue: string }>} close - Fired after the dialog has closed; `detail.returnValue` is what `close()` received (`''` for Escape / backdrop / the × button).
18
+ * @event {Event} cancel - Native, cancelable: fired on Escape before closing.
19
+ *
20
+ * @cssproperty {pixel} [--c2-modal--width=min(480px, calc(100vw - 32px))]
21
+ * @cssproperty {pixel} [--c2-modal--max-height=calc(100vh - 64px)]
22
+ * @cssproperty {margin} [--c2-modal--margin-top=auto] - `auto` centres vertically; a length pins the dialog to the top.
23
+ * @cssproperty {margin} [--c2-modal--margin-bottom=auto]
24
+ * @cssproperty {background} [--c2-modal--background=#ffffff]
25
+ * @cssproperty {color} [--c2-modal--color=#18181b]
26
+ * @cssproperty {border} [--c2-modal--border=none]
27
+ * @cssproperty {border-radius} [--c2-modal--border-top-left-radius=14px]
28
+ * @cssproperty {border-radius} [--c2-modal--border-top-right-radius=14px]
29
+ * @cssproperty {border-radius} [--c2-modal--border-bottom-left-radius=14px]
30
+ * @cssproperty {border-radius} [--c2-modal--border-bottom-right-radius=14px]
31
+ * @cssproperty {box-shadow} [--c2-modal--box-shadow=0 24px 60px rgba(0, 0, 0, 0.25)]
32
+ * @cssproperty {time} [--c2-modal--transition-duration=200ms] - Open/close animation; `0ms` disables it.
33
+ * @cssproperty {transform} [--c2-modal--enter-transform=translateY(12px) scale(0.98)] - Where the dialog animates from and to.
34
+ *
35
+ * @cssproperty {padding} [--c2-modal__header--padding-top=20px]
36
+ * @cssproperty {padding} [--c2-modal__header--padding-right=20px]
37
+ * @cssproperty {padding} [--c2-modal__header--padding-bottom=0px]
38
+ * @cssproperty {padding} [--c2-modal__header--padding-left=24px]
39
+ * @cssproperty {font-size} [--c2-modal__header--font-size=17px]
40
+ * @cssproperty {font-weight} [--c2-modal__header--font-weight=600]
41
+ * @cssproperty {line-height} [--c2-modal__header--line-height=1.35]
42
+ * @cssproperty {border} --c2-modal__header--border-bottom - Divider under the header; raise `header--padding-bottom` with it.
43
+ *
44
+ * @cssproperty {padding} [--c2-modal__body--padding-top=12px]
45
+ * @cssproperty {padding} [--c2-modal__body--padding-right=24px]
46
+ * @cssproperty {padding} [--c2-modal__body--padding-bottom=20px]
47
+ * @cssproperty {padding} [--c2-modal__body--padding-left=24px]
48
+ * @cssproperty {font-size} [--c2-modal__body--font-size=14px]
49
+ * @cssproperty {line-height} [--c2-modal__body--line-height=1.6]
50
+ * @cssproperty {color} --c2-modal__body--color - Defaults to the dialog colour.
51
+ *
52
+ * @cssproperty {padding} [--c2-modal__footer--padding-top=0px]
53
+ * @cssproperty {padding} [--c2-modal__footer--padding-right=24px]
54
+ * @cssproperty {padding} [--c2-modal__footer--padding-bottom=20px]
55
+ * @cssproperty {padding} [--c2-modal__footer--padding-left=24px]
56
+ * @cssproperty {pixel} [--c2-modal__footer--gap=8px]
57
+ * @cssproperty {justify-content} [--c2-modal__footer--justify-content=flex-end]
58
+ * @cssproperty {border} --c2-modal__footer--border-top - Divider above the footer; raise `footer--padding-top` with it.
59
+ *
60
+ * @cssproperty {pixel} [--c2-modal__close--size=32px]
61
+ * @cssproperty {pixel} [--c2-modal__close--icon-size=18px]
62
+ * @cssproperty {border-radius} [--c2-modal__close--border-radius=8px]
63
+ * @cssproperty {color} [--c2-modal__close--color=#71717a]
64
+ * @cssproperty {background} [--c2-modal__close__hover--background=#f4f4f5]
65
+ * @cssproperty {color} [--c2-modal__close__hover--color=#18181b]
66
+ * @cssproperty {outline} [--c2-modal__close__focus--outline=2px solid rgba(2, 101, 220, 0.4)]
67
+ *
68
+ * @cssproperty {background} [--c2-modal__backdrop--background=rgba(9, 9, 11, 0.45)]
69
+ * @cssproperty {backdrop-filter} --c2-modal__backdrop--backdrop-filter - e.g. `blur(4px)`.
70
+ */
71
+ export declare class Modal extends LitElement {
72
+ static styles: import("lit").CSSResult;
73
+ /** Open state. Setting it shows or closes the dialog. */
74
+ open: boolean;
75
+ /** Accessible name when there is no `title` slot. */
76
+ label: string | undefined;
77
+ /** Keep the dialog open when the backdrop is clicked. */
78
+ noBackdropClose: boolean;
79
+ /** Ignore Escape. */
80
+ noEscape: boolean;
81
+ /** Hide the built-in × button. */
82
+ hideClose: boolean;
83
+ /** Leave the page scrollable while the dialog is open. */
84
+ noScrollLock: boolean;
85
+ /** Value passed to the last `close()` call, mirrors `HTMLDialogElement.returnValue`. */
86
+ returnValue: string;
87
+ private hasTitle;
88
+ private hasFooter;
89
+ private dialog;
90
+ private locked;
91
+ disconnectedCallback(): void;
92
+ /** Opens the dialog (modal). */
93
+ show(): void;
94
+ /** Closes the dialog with an optional `returnValue`. */
95
+ close(returnValue?: string): void;
96
+ private lockScroll;
97
+ private unlockScroll;
98
+ private handleDialogClose;
99
+ private handleDialogCancel;
100
+ private handleDialogClick;
101
+ private handleSlotChange;
102
+ private updateSlot;
103
+ firstUpdated(): void;
104
+ updated(changed: PropertyValues<this>): void;
105
+ render(): import("lit-html").TemplateResult<1>;
106
+ }
107
+ declare global {
108
+ interface HTMLElementTagNameMap {
109
+ 'c2-modal': Modal;
110
+ }
111
+ }
112
+ //# sourceMappingURL=modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;AAU/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBACa,KAAM,SAAQ,UAAU;IACnC,OAAgB,MAAM,0BAAoB;IAE1C,yDAAyD;IACb,IAAI,UAAQ;IAExD,qDAAqD;IACzC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAY;IAEjD,yDAAyD;IACI,eAAe,UAAQ;IAEpF,qBAAqB;IACgC,QAAQ,UAAQ;IAErE,kCAAkC;IACmC,SAAS,UAAQ;IAEtF,0DAA0D;IACA,YAAY,UAAQ;IAE9E,wFAAwF;IACxF,WAAW,SAAK;IAEP,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,SAAS,CAAQ;IAEjB,OAAO,CAAC,MAAM,CAAoB;IAEnD,OAAO,CAAC,MAAM,CAAQ;IAEb,oBAAoB;IAK7B,gCAAgC;IAChC,IAAI;IAIJ,wDAAwD;IACxD,KAAK,CAAC,WAAW,SAAK;IAMtB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,iBAAiB,CAKxB;IAED,OAAO,CAAC,kBAAkB,CAMzB;IAED,OAAO,CAAC,iBAAiB,CAGxB;IAED,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,UAAU;IAMT,YAAY;IAIZ,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC;IAYrC,MAAM;CA+BhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAA;KAClB;CACF"}