@m3e/dialog 1.0.0-rc.1 → 1.0.0-rc.2
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/README.md +2 -0
- package/dist/custom-elements.json +2725 -12
- package/dist/html-custom-data.json +9 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +41 -41
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/cem.config.mjs +0 -16
- package/demo/index.html +0 -60
- package/dist/src/DialogActionElement.d.ts +0 -31
- package/dist/src/DialogActionElement.d.ts.map +0 -1
- package/dist/src/DialogElement.d.ts +0 -141
- package/dist/src/DialogElement.d.ts.map +0 -1
- package/dist/src/DialogTriggerElement.d.ts +0 -24
- package/dist/src/DialogTriggerElement.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.d.ts.map +0 -1
- package/eslint.config.mjs +0 -13
- package/rollup.config.js +0 -32
- package/src/DialogActionElement.ts +0 -56
- package/src/DialogElement.ts +0 -472
- package/src/DialogTriggerElement.ts +0 -50
- package/src/index.ts +0 -3
- package/tsconfig.json +0 -9
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { CSSResultGroup, LitElement } from "lit";
|
|
2
|
-
declare const M3eDialogElement_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor & typeof LitElement;
|
|
3
|
-
/**
|
|
4
|
-
* @summary
|
|
5
|
-
* A dialog that provides important prompts in a user flow.
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* The `m3e-dialog` component presents important prompts, alerts, and actions in user flows.
|
|
9
|
-
* Designed according to Material 3 principles, it supports custom header, content, and
|
|
10
|
-
* close icon slots, ARIA accessibility, focus management, and theming via CSS custom properties.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```html
|
|
14
|
-
* <m3e-button variant="filled">
|
|
15
|
-
* <m3e-dialog-trigger for="dlg">Open Dialog</m3e-dialog-trigger>
|
|
16
|
-
* </m3e-button>
|
|
17
|
-
* <m3e-dialog id="dlg" dismissible onclosed="console.log(this.returnValue)">
|
|
18
|
-
* <span slot="header">Dialog Title</span>
|
|
19
|
-
* Dialog content goes here.
|
|
20
|
-
* <div slot="actions" end>
|
|
21
|
-
* <m3e-button autofocus><m3e-dialog-action return-value="ok">Close</m3e-dialog-action></m3e-button>
|
|
22
|
-
* </div>
|
|
23
|
-
* </m3e-dialog>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @tag m3e-dialog
|
|
27
|
-
*
|
|
28
|
-
* @slot - Renders the content of the dialog.
|
|
29
|
-
* @slot header - Renders the header of the dialog.
|
|
30
|
-
* @slot close-icon - Renders the icon of the button used to close the dialog.
|
|
31
|
-
*
|
|
32
|
-
* @attr alert - Whether the dialog is an alert.
|
|
33
|
-
* @attr close-label - The accessible label given to the button used to dismiss the dialog.
|
|
34
|
-
* @attr disable-close -Whether users cannot click the backdrop or press escape to dismiss the dialog.
|
|
35
|
-
* @attr dismissible - Whether a button is presented that can be used to close the dialog.
|
|
36
|
-
* @attr no-focus-trap - Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.
|
|
37
|
-
* @attr open - Whether the dialog is open.
|
|
38
|
-
*
|
|
39
|
-
* @fires opening - Emitted when the dialog begins to open.
|
|
40
|
-
* @fires opened - Emitted when the dialog has opened.
|
|
41
|
-
* @fires cancel - Emitted when the dialog is cancelled.
|
|
42
|
-
* @fires closing - Emitted when the dialog begins to close.
|
|
43
|
-
* @fires closed - Emitted when the dialog has closed.
|
|
44
|
-
*
|
|
45
|
-
* @cssprop --m3e-dialog-shape - Border radius of the dialog container.
|
|
46
|
-
* @cssprop --m3e-dialog-min-width - Minimum width of the dialog.
|
|
47
|
-
* @cssprop --m3e-dialog-max-width - Maximum width of the dialog.
|
|
48
|
-
* @cssprop --m3e-dialog-color - Foreground color of the dialog.
|
|
49
|
-
* @cssprop --m3e-dialog-container-color - Background color of the dialog container.
|
|
50
|
-
* @cssprop --m3e-dialog-scrim-color - Color of the scrim (backdrop overlay).
|
|
51
|
-
* @cssprop --m3e-dialog-scrim-opacity - Opacity of the scrim when open.
|
|
52
|
-
* @cssprop --m3e-dialog-header-container-color - Background color of the dialog header.
|
|
53
|
-
* @cssprop --m3e-dialog-header-color - Foreground color of the dialog header.
|
|
54
|
-
* @cssprop --m3e-dialog-header-font-size - Font size for the dialog header.
|
|
55
|
-
* @cssprop --m3e-dialog-header-font-weight - Font weight for the dialog header.
|
|
56
|
-
* @cssprop --m3e-dialog-header-line-height - Line height for the dialog header.
|
|
57
|
-
* @cssprop --m3e-dialog-header-tracking - Letter spacing for the dialog header.
|
|
58
|
-
* @cssprop --m3e-dialog-content-color - Foreground color of the dialog content.
|
|
59
|
-
* @cssprop --m3e-dialog-content-font-size - Font size for the dialog content.
|
|
60
|
-
* @cssprop --m3e-dialog-content-font-weight - Font weight for the dialog content.
|
|
61
|
-
* @cssprop --m3e-dialog-content-line-height - Line height for the dialog content.
|
|
62
|
-
* @cssprop --m3e-dialog-content-tracking - Letter spacing for the dialog content.
|
|
63
|
-
*/
|
|
64
|
-
export declare class M3eDialogElement extends M3eDialogElement_base {
|
|
65
|
-
#private;
|
|
66
|
-
/** The styles of the element. */
|
|
67
|
-
static styles: CSSResultGroup;
|
|
68
|
-
/** @private */ private static __nextId;
|
|
69
|
-
/** @private */ private _hasActions;
|
|
70
|
-
/** @private */ private readonly _base;
|
|
71
|
-
/** @private */ private readonly _content;
|
|
72
|
-
/**
|
|
73
|
-
* Whether the dialog is an alert.
|
|
74
|
-
* @default false
|
|
75
|
-
*/
|
|
76
|
-
alert: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Whether the dialog is open.
|
|
79
|
-
* @default false
|
|
80
|
-
*/
|
|
81
|
-
get open(): boolean;
|
|
82
|
-
set open(value: boolean);
|
|
83
|
-
/**
|
|
84
|
-
* Whether a button is presented that can be used to close the dialog.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
dismissible: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Whether users cannot click the backdrop or press ESC to dismiss the dialog.
|
|
90
|
-
* @default false
|
|
91
|
-
*/
|
|
92
|
-
disableClose: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.
|
|
95
|
-
* @default false
|
|
96
|
-
*/
|
|
97
|
-
noFocusTrap: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* The accessible label given to the button used to dismiss the dialog.
|
|
100
|
-
* @default "Close"
|
|
101
|
-
*/
|
|
102
|
-
closeLabel: string;
|
|
103
|
-
/**
|
|
104
|
-
* The return value of the dialog.
|
|
105
|
-
* @default ""
|
|
106
|
-
*/
|
|
107
|
-
returnValue: string;
|
|
108
|
-
/**
|
|
109
|
-
* Asynchronously opens the dialog.
|
|
110
|
-
* @returns {Promise<void>} A `Promise` that resolves when the dialog is open.
|
|
111
|
-
*/
|
|
112
|
-
show(): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Asynchronously closes the dialog.
|
|
115
|
-
* @param {string} returnValue The value to return.
|
|
116
|
-
* @returns {Promise<void>} A `Promise` that resolves when the dialog is closed.
|
|
117
|
-
*/
|
|
118
|
-
hide(returnValue?: string): Promise<void>;
|
|
119
|
-
/** @inheritdoc */
|
|
120
|
-
protected render(): unknown;
|
|
121
|
-
}
|
|
122
|
-
interface M3eDialogElementEventMap extends HTMLElementEventMap {
|
|
123
|
-
opening: Event;
|
|
124
|
-
opened: Event;
|
|
125
|
-
closing: Event;
|
|
126
|
-
closed: Event;
|
|
127
|
-
cancel: Event;
|
|
128
|
-
}
|
|
129
|
-
export interface M3eDialogElement {
|
|
130
|
-
addEventListener<K extends keyof M3eDialogElementEventMap>(type: K, listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
131
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
132
|
-
removeEventListener<K extends keyof M3eDialogElementEventMap>(type: K, listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
133
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
134
|
-
}
|
|
135
|
-
declare global {
|
|
136
|
-
interface HTMLElementTagNameMap {
|
|
137
|
-
"m3e-dialog": M3eDialogElement;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
export {};
|
|
141
|
-
//# sourceMappingURL=DialogElement.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogElement.d.ts","sourceRoot":"","sources":["../../src/DialogElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAsB,MAAM,KAAK,CAAC;;AAOhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,qBACa,gBAAiB,SAAQ,qBAOrC;;IACC,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CA8IpC;IAEF,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAK;IAK5C,eAAe,CAAU,OAAO,CAAC,WAAW,CAAS;IACrD,eAAe,CAAiB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3E,eAAe,CAAoB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAEjF;;;OAGG;IAC0B,KAAK,UAAS;IAE3C;;;OAGG;IACH,IAAgD,IAAI,IAGpC,OAAO,CADtB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,EAQtB;IAED;;;OAGG;IAC0B,WAAW,UAAS;IAEjD;;;OAGG;IACsD,YAAY,UAAS;IAE9E;;;OAGG;IACsD,WAAW,UAAS;IAE7E;;;OAGG;IACqC,UAAU,SAAW;IA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E,gBAAgB,CAAC;KAChC;CACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { CSSResultGroup, LitElement } from "lit";
|
|
2
|
-
declare const M3eDialogTriggerElement_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").HtmlForMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").AttachInternalsMixin> & typeof LitElement;
|
|
3
|
-
/**
|
|
4
|
-
* An element, nested within a clickable element, used to open a dialog.
|
|
5
|
-
* @tag m3e-dialog-trigger
|
|
6
|
-
*/
|
|
7
|
-
export declare class M3eDialogTriggerElement extends M3eDialogTriggerElement_base {
|
|
8
|
-
#private;
|
|
9
|
-
/** The styles of the element. */
|
|
10
|
-
static styles: CSSResultGroup;
|
|
11
|
-
/** @inheritdoc */
|
|
12
|
-
connectedCallback(): void;
|
|
13
|
-
/** @inheritdoc */
|
|
14
|
-
disconnectedCallback(): void;
|
|
15
|
-
/** @inheritdoc */
|
|
16
|
-
protected render(): unknown;
|
|
17
|
-
}
|
|
18
|
-
declare global {
|
|
19
|
-
interface HTMLElementTagNameMap {
|
|
20
|
-
"m3e-dialog-trigger": M3eDialogTriggerElement;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=DialogTriggerElement.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogTriggerElement.d.ts","sourceRoot":"","sources":["../../src/DialogTriggerElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;;AAO5D;;;GAGG;AACH,qBACa,uBAAwB,SAAQ,4BAAoC;;IAC/E,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CAIpC;IASF,kBAAkB;IACT,iBAAiB,IAAI,IAAI;IAKlC,kBAAkB;IACT,oBAAoB,IAAI,IAAI;IAKrC,kBAAkB;cACC,MAAM,IAAI,OAAO;CAGrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,uBAAuB,CAAC;KAC/C;CACF"}
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
package/eslint.config.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import eslint from "@eslint/js";
|
|
2
|
-
import tseslint from "typescript-eslint";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { dirname } from "path";
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended, {
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parserOptions: {
|
|
9
|
-
project: true,
|
|
10
|
-
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
package/rollup.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import terser from "@rollup/plugin-terser";
|
|
3
|
-
import typescript from "@rollup/plugin-typescript";
|
|
4
|
-
|
|
5
|
-
const banner = `/**
|
|
6
|
-
* @license MIT
|
|
7
|
-
* Copyright (c) 2025 matraic
|
|
8
|
-
* See LICENSE file in the project root for full license text.
|
|
9
|
-
*/`;
|
|
10
|
-
|
|
11
|
-
export default [
|
|
12
|
-
{
|
|
13
|
-
input: "src/index.ts",
|
|
14
|
-
output: [
|
|
15
|
-
{
|
|
16
|
-
file: "dist/index.js",
|
|
17
|
-
format: "esm",
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
banner: banner,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
file: "dist/index.min.js",
|
|
23
|
-
format: "esm",
|
|
24
|
-
sourcemap: true,
|
|
25
|
-
banner: banner,
|
|
26
|
-
plugins: [terser({ mangle: true })],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
external: ["@m3e/core", "@m3e/core/a11y", "@m3e/icon-button", "lit"],
|
|
30
|
-
plugins: [resolve(), typescript()],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement } from "lit";
|
|
2
|
-
import { customElement, property } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { AttachInternals, Role } from "@m3e/core";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* An element, nested within a clickable element, used to close a parenting dialog.
|
|
8
|
-
* @tag m3e-dialog-action
|
|
9
|
-
*
|
|
10
|
-
* @attr return-value - The value to return from the dialog.
|
|
11
|
-
*/
|
|
12
|
-
@customElement("m3e-dialog-action")
|
|
13
|
-
export class M3eDialogActionElement extends AttachInternals(Role(LitElement, "none")) {
|
|
14
|
-
/** The styles of the element. */
|
|
15
|
-
static override styles: CSSResultGroup = css`
|
|
16
|
-
:host {
|
|
17
|
-
display: contents;
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The value to return from the dialog.
|
|
23
|
-
* @default ""
|
|
24
|
-
*/
|
|
25
|
-
@property({ attribute: "return-value" }) returnValue = "";
|
|
26
|
-
|
|
27
|
-
/** @private */
|
|
28
|
-
readonly #clickHandler = (e: Event) => {
|
|
29
|
-
if (!e.defaultPrevented) {
|
|
30
|
-
this.closest("m3e-dialog")?.hide(this.returnValue);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** @inheritdoc */
|
|
35
|
-
override connectedCallback(): void {
|
|
36
|
-
super.connectedCallback();
|
|
37
|
-
this.parentElement?.addEventListener("click", this.#clickHandler);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** @inheritdoc */
|
|
41
|
-
override disconnectedCallback(): void {
|
|
42
|
-
super.disconnectedCallback();
|
|
43
|
-
this.parentElement?.removeEventListener("click", this.#clickHandler);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** @inheritdoc */
|
|
47
|
-
protected override render(): unknown {
|
|
48
|
-
return html`<slot></slot>`;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
declare global {
|
|
53
|
-
interface HTMLElementTagNameMap {
|
|
54
|
-
"m3e-dialog-action": M3eDialogActionElement;
|
|
55
|
-
}
|
|
56
|
-
}
|