@universal-material/web 3.0.60 → 3.0.61

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.
Files changed (92) hide show
  1. package/button/button-base.d.ts.map +1 -1
  2. package/button/button-base.js +10 -3
  3. package/button/button-base.js.map +1 -1
  4. package/button/button.styles.d.ts.map +1 -1
  5. package/button/button.styles.js +0 -2
  6. package/button/button.styles.js.map +1 -1
  7. package/button/fab.styles.d.ts.map +1 -1
  8. package/button/fab.styles.js +0 -2
  9. package/button/fab.styles.js.map +1 -1
  10. package/button/icon-button.styles.d.ts.map +1 -1
  11. package/button/icon-button.styles.js +0 -2
  12. package/button/icon-button.styles.js.map +1 -1
  13. package/chip/chip.styles.d.ts.map +1 -1
  14. package/chip/chip.styles.js +0 -2
  15. package/chip/chip.styles.js.map +1 -1
  16. package/chip-field/chip-field.d.ts.map +1 -1
  17. package/chip-field/chip-field.js +12 -10
  18. package/chip-field/chip-field.js.map +1 -1
  19. package/config.d.ts +9 -2
  20. package/config.d.ts.map +1 -1
  21. package/config.js +17 -2
  22. package/config.js.map +1 -1
  23. package/custom-elements.json +5261 -4088
  24. package/dialog/confirm-dialog-builder.d.ts +12 -0
  25. package/dialog/confirm-dialog-builder.d.ts.map +1 -0
  26. package/dialog/confirm-dialog-builder.js +42 -0
  27. package/dialog/confirm-dialog-builder.js.map +1 -0
  28. package/dialog/dialog-builder.d.ts +15 -0
  29. package/dialog/dialog-builder.d.ts.map +1 -0
  30. package/dialog/dialog-builder.js +55 -0
  31. package/dialog/dialog-builder.js.map +1 -0
  32. package/dialog/dialog-button-def.d.ts +6 -0
  33. package/dialog/dialog-button-def.d.ts.map +1 -0
  34. package/dialog/dialog-button-def.js +2 -0
  35. package/dialog/dialog-button-def.js.map +1 -0
  36. package/dialog/dialog.d.ts +44 -0
  37. package/dialog/dialog.d.ts.map +1 -0
  38. package/dialog/dialog.js +235 -0
  39. package/dialog/dialog.js.map +1 -0
  40. package/dialog/dialog.styles.d.ts +2 -0
  41. package/dialog/dialog.styles.d.ts.map +1 -0
  42. package/dialog/dialog.styles.js +165 -0
  43. package/dialog/dialog.styles.js.map +1 -0
  44. package/dialog/message-dialog-builder.d.ts +10 -0
  45. package/dialog/message-dialog-builder.d.ts.map +1 -0
  46. package/dialog/message-dialog-builder.js +32 -0
  47. package/dialog/message-dialog-builder.js.map +1 -0
  48. package/field/field-base.d.ts.map +1 -1
  49. package/field/field-base.js +5 -3
  50. package/field/field-base.js.map +1 -1
  51. package/index.d.ts +8 -2
  52. package/index.d.ts.map +1 -1
  53. package/index.js +8 -2
  54. package/index.js.map +1 -1
  55. package/menu/menu-item.d.ts +1 -1
  56. package/menu/menu-item.d.ts.map +1 -1
  57. package/menu/menu-item.js +1 -5
  58. package/menu/menu-item.js.map +1 -1
  59. package/menu/menu-item.styles.d.ts.map +1 -1
  60. package/menu/menu-item.styles.js +5 -3
  61. package/menu/menu-item.styles.js.map +1 -1
  62. package/navigation/drawer-item.styles.d.ts.map +1 -1
  63. package/navigation/drawer-item.styles.js +0 -2
  64. package/navigation/drawer-item.styles.js.map +1 -1
  65. package/package.json +1 -1
  66. package/progress/circular-progress.d.ts +15 -0
  67. package/progress/circular-progress.d.ts.map +1 -0
  68. package/progress/circular-progress.js +96 -0
  69. package/progress/circular-progress.js.map +1 -0
  70. package/progress/circular-progress.styles.d.ts +2 -0
  71. package/progress/circular-progress.styles.d.ts.map +1 -0
  72. package/progress/circular-progress.styles.js +75 -0
  73. package/progress/circular-progress.styles.js.map +1 -0
  74. package/progress/progress-bar.d.ts +15 -0
  75. package/progress/progress-bar.d.ts.map +1 -0
  76. package/progress/progress-bar.js +62 -0
  77. package/progress/progress-bar.js.map +1 -0
  78. package/progress/progress-bar.styles.d.ts +2 -0
  79. package/progress/progress-bar.styles.d.ts.map +1 -0
  80. package/progress/progress-bar.styles.js +152 -0
  81. package/progress/progress-bar.styles.js.map +1 -0
  82. package/shared/base.styles.d.ts.map +1 -1
  83. package/shared/base.styles.js +0 -2
  84. package/shared/base.styles.js.map +1 -1
  85. package/shared/events/dispatch-event.d.ts +1 -0
  86. package/shared/events/dispatch-event.d.ts.map +1 -0
  87. package/shared/events/dispatch-event.js +2 -0
  88. package/shared/events/dispatch-event.js.map +1 -0
  89. package/shared/events/redispatch-event.d.ts +2 -0
  90. package/shared/events/redispatch-event.d.ts.map +1 -0
  91. package/shared/events/redispatch-event.js +14 -0
  92. package/shared/events/redispatch-event.js.map +1 -0
@@ -0,0 +1,12 @@
1
+ import { DialogBuilder } from './dialog-builder.js';
2
+ import { DialogButtonDef } from './dialog-button-def.js';
3
+ import { UmDialog } from './dialog.js';
4
+ export declare class ConfirmDialogBuilder extends DialogBuilder<ConfirmDialogBuilder, Promise<boolean>> {
5
+ #private;
6
+ static create(message: string): ConfirmDialogBuilder;
7
+ confirmButton(confirmButtonDef: DialogButtonDef): ConfirmDialogBuilder;
8
+ cancelButton(cancelButtonDef: DialogButtonDef): ConfirmDialogBuilder;
9
+ addButtons(dialog: UmDialog): void;
10
+ protected innerShow(dialog: UmDialog): Promise<boolean>;
11
+ }
12
+ //# sourceMappingURL=confirm-dialog-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm-dialog-builder.d.ts","sourceRoot":"","sources":["../../src/dialog/confirm-dialog-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;;IAC7F,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAOpD,aAAa,CAAC,gBAAgB,EAAE,eAAe,GAAG,oBAAoB;IAKtE,YAAY,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB;IAK3D,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI;cAaxB,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CAMjE"}
@@ -0,0 +1,42 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _ConfirmDialogBuilder_confirmButtonDef, _ConfirmDialogBuilder_cancelButtonDef;
13
+ import { config } from '../config.js';
14
+ import { DialogBuilder } from './dialog-builder.js';
15
+ export class ConfirmDialogBuilder extends DialogBuilder {
16
+ constructor() {
17
+ super(...arguments);
18
+ _ConfirmDialogBuilder_confirmButtonDef.set(this, void 0);
19
+ _ConfirmDialogBuilder_cancelButtonDef.set(this, void 0);
20
+ }
21
+ static create(message) {
22
+ return new ConfirmDialogBuilder(message);
23
+ }
24
+ confirmButton(confirmButtonDef) {
25
+ __classPrivateFieldSet(this, _ConfirmDialogBuilder_confirmButtonDef, confirmButtonDef, "f");
26
+ return this;
27
+ }
28
+ cancelButton(cancelButtonDef) {
29
+ __classPrivateFieldSet(this, _ConfirmDialogBuilder_cancelButtonDef, cancelButtonDef, "f");
30
+ return this;
31
+ }
32
+ addButtons(dialog) {
33
+ this.addButton(dialog, { ...config.dialog.confirmDefaults.confirmButton, ...__classPrivateFieldGet(this, _ConfirmDialogBuilder_confirmButtonDef, "f") }, () => dialog.close('ok'));
34
+ this.addButton(dialog, { ...config.dialog.confirmDefaults.cancelButton, ...__classPrivateFieldGet(this, _ConfirmDialogBuilder_cancelButtonDef, "f") }, () => dialog.close('cancel'));
35
+ }
36
+ innerShow(dialog) {
37
+ super.innerShow(dialog);
38
+ return new Promise(resolve => dialog.addEventListener('closed', () => resolve(dialog.returnValue === 'ok')));
39
+ }
40
+ }
41
+ _ConfirmDialogBuilder_confirmButtonDef = new WeakMap(), _ConfirmDialogBuilder_cancelButtonDef = new WeakMap();
42
+ //# sourceMappingURL=confirm-dialog-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm-dialog-builder.js","sourceRoot":"","sources":["../../src/dialog/confirm-dialog-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,OAAO,oBAAqB,SAAQ,aAAqD;IAA/F;;QAKE,yDAAoC;QACpC,wDAAmC;IA+BrC,CAAC;IApCC,MAAM,CAAC,MAAM,CAAC,OAAe;QAC3B,OAAO,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAKD,aAAa,CAAC,gBAAiC;QAC7C,uBAAA,IAAI,0CAAqB,gBAAgB,MAAA,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,eAAgC;QAC3C,uBAAA,IAAI,yCAAoB,eAAe,MAAA,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,UAAU,CAAC,MAAgB;QAElC,IAAI,CAAC,SAAS,CACZ,MAAM,EACN,EAAC,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,EAAE,GAAG,uBAAA,IAAI,8CAAkB,EAAC,EAC3E,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAE5B,IAAI,CAAC,SAAS,CACZ,MAAM,EACN,EAAC,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,YAAY,EAAE,GAAG,uBAAA,IAAI,6CAAiB,EAAC,EACzE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClC,CAAC;IAEkB,SAAS,CAAC,MAAgB;QAC3C,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAExB,OAAO,IAAI,OAAO,CAAU,OAAO,CAAC,EAAE,CACpC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,CAAA;IAClF,CAAC;CACF","sourcesContent":["import { config } from '../config.js';\nimport { DialogBuilder } from './dialog-builder.js';\nimport { DialogButtonDef } from './dialog-button-def.js';\nimport { UmDialog } from './dialog.js';\n\nexport class ConfirmDialogBuilder extends DialogBuilder<ConfirmDialogBuilder, Promise<boolean>> {\n static create(message: string): ConfirmDialogBuilder {\n return new ConfirmDialogBuilder(message);\n }\n\n #confirmButtonDef?: DialogButtonDef;\n #cancelButtonDef?: DialogButtonDef;\n\n confirmButton(confirmButtonDef: DialogButtonDef): ConfirmDialogBuilder {\n this.#confirmButtonDef = confirmButtonDef;\n return this;\n }\n\n cancelButton(cancelButtonDef: DialogButtonDef): ConfirmDialogBuilder {\n this.#cancelButtonDef = cancelButtonDef;\n return this;\n }\n\n override addButtons(dialog: UmDialog): void {\n\n this.addButton(\n dialog,\n {...config.dialog.confirmDefaults.confirmButton, ...this.#confirmButtonDef},\n () => dialog.close('ok'));\n\n this.addButton(\n dialog,\n {...config.dialog.confirmDefaults.cancelButton, ...this.#cancelButtonDef},\n () => dialog.close('cancel'));\n }\n\n protected override innerShow(dialog: UmDialog): Promise<boolean> {\n super.innerShow(dialog);\n\n return new Promise<boolean>(resolve =>\n dialog.addEventListener('closed', () => resolve(dialog.returnValue === 'ok')))\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { DialogButtonDef } from './dialog-button-def.js';
2
+ import { UmDialog } from './dialog.js';
3
+ import './dialog.js';
4
+ export declare abstract class DialogBuilder<TBuilder extends DialogBuilder<any, any>, TReturn> {
5
+ #private;
6
+ private readonly message;
7
+ constructor(message: string);
8
+ headline(headline: string): TBuilder;
9
+ show(): TReturn;
10
+ protected innerShow(dialog: UmDialog): TReturn | void;
11
+ protected abstract addButtons(dialog: UmDialog): void;
12
+ private addHeadline;
13
+ protected addButton(dialog: UmDialog, buttonDef: DialogButtonDef, click: () => void): void;
14
+ }
15
+ //# sourceMappingURL=dialog-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-builder.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,aAAa,CAAC;AAErB,8BAAsB,aAAa,CAAC,QAAQ,SAAS,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO;;IAGvE,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM;IAI5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ;IAKpC,IAAI,IAAI,OAAO;IAUf,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI;IAQrD,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI;IAErD,OAAO,CAAC,WAAW;IAWnB,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,IAAI;CAQpF"}
@@ -0,0 +1,55 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _DialogBuilder_headline;
13
+ import './dialog.js';
14
+ export class DialogBuilder {
15
+ constructor(message) {
16
+ this.message = message;
17
+ _DialogBuilder_headline.set(this, void 0);
18
+ }
19
+ headline(headline) {
20
+ __classPrivateFieldSet(this, _DialogBuilder_headline, headline, "f");
21
+ return this;
22
+ }
23
+ show() {
24
+ const dialog = document.createElement('u-dialog');
25
+ dialog.innerText = this.message;
26
+ this.addHeadline(dialog);
27
+ this.addButtons(dialog);
28
+ return this.innerShow(dialog);
29
+ }
30
+ innerShow(dialog) {
31
+ dialog.addEventListener('closed', () => dialog.remove());
32
+ document.body.appendChild(dialog);
33
+ dialog.show();
34
+ return;
35
+ }
36
+ addHeadline(dialog) {
37
+ if (!__classPrivateFieldGet(this, _DialogBuilder_headline, "f")) {
38
+ return;
39
+ }
40
+ const headlineElement = document.createElement('span');
41
+ headlineElement.slot = 'headline';
42
+ headlineElement.textContent = __classPrivateFieldGet(this, _DialogBuilder_headline, "f");
43
+ dialog.appendChild(headlineElement);
44
+ }
45
+ addButton(dialog, buttonDef, click) {
46
+ const button = document.createElement('u-button');
47
+ button.variant = buttonDef.variant;
48
+ button.textContent = buttonDef.label;
49
+ button.slot = 'actions';
50
+ button.addEventListener('click', click);
51
+ dialog.appendChild(button);
52
+ }
53
+ }
54
+ _DialogBuilder_headline = new WeakMap();
55
+ //# sourceMappingURL=dialog-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-builder.js","sourceRoot":"","sources":["../../src/dialog/dialog-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,OAAO,aAAa,CAAC;AAErB,MAAM,OAAgB,aAAa;IAGjC,YAA6B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAF5C,0CAAmB;IAInB,CAAC;IAED,QAAQ,CAAC,QAAgB;QACvB,uBAAA,IAAI,2BAAa,QAAQ,MAAA,CAAC;QAC1B,OAAO,IAA2B,CAAC;IACrC,CAAC;IAED,IAAI;QACF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;QAEhC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAExB,OAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAES,SAAS,CAAC,MAAgB;QAClC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACzD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,CAAC,IAAI,EAAE,CAAC;QAEd,OAAO;IACT,CAAC;IAIO,WAAW,CAAC,MAAmB;QACrC,IAAI,CAAC,uBAAA,IAAI,+BAAU,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACvD,eAAe,CAAC,IAAI,GAAG,UAAU,CAAC;QAClC,eAAe,CAAC,WAAW,GAAG,uBAAA,IAAI,+BAAU,CAAC;QAC7C,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACtC,CAAC;IAES,SAAS,CAAC,MAAgB,EAAE,SAA0B,EAAE,KAAiB;QACjF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,OAAQ,CAAC;QACpC,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,KAAM,CAAC;QACtC,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;QACxB,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACxC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import { DialogButtonDef } from './dialog-button-def.js';\nimport { UmDialog } from './dialog.js';\n\nimport './dialog.js';\n\nexport abstract class DialogBuilder<TBuilder extends DialogBuilder<any, any>, TReturn> {\n #headline?: string;\n\n constructor(private readonly message: string) {\n\n }\n\n headline(headline: string): TBuilder {\n this.#headline = headline;\n return this as unknown as TBuilder;\n }\n\n show(): TReturn {\n const dialog = document.createElement('u-dialog');\n dialog.innerText = this.message;\n\n this.addHeadline(dialog);\n this.addButtons(dialog);\n\n return <TReturn>this.innerShow(dialog);\n }\n\n protected innerShow(dialog: UmDialog): TReturn | void {\n dialog.addEventListener('closed', () => dialog.remove());\n document.body.appendChild(dialog);\n dialog.show();\n\n return;\n }\n\n protected abstract addButtons(dialog: UmDialog): void;\n\n private addHeadline(dialog: HTMLElement) {\n if (!this.#headline) {\n return;\n }\n\n const headlineElement = document.createElement('span');\n headlineElement.slot = 'headline';\n headlineElement.textContent = this.#headline;\n dialog.appendChild(headlineElement);\n }\n\n protected addButton(dialog: UmDialog, buttonDef: DialogButtonDef, click: () => void) {\n const button = document.createElement('u-button');\n button.variant = buttonDef.variant!;\n button.textContent = buttonDef.label!;\n button.slot = 'actions';\n button.addEventListener('click', click);\n dialog.appendChild(button);\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { UmButtonVariant } from '../button/button.js';
2
+ export interface DialogButtonDef {
3
+ variant?: UmButtonVariant;
4
+ label?: string;
5
+ }
6
+ //# sourceMappingURL=dialog-button-def.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-button-def.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog-button-def.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dialog-button-def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-button-def.js","sourceRoot":"","sources":["../../src/dialog/dialog-button-def.ts"],"names":[],"mappings":"","sourcesContent":["import { UmButtonVariant } from '../button/button.js';\n\nexport interface DialogButtonDef {\n variant?: UmButtonVariant;\n label?: string;\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import { PropertyValues } from '@lit/reactive-element';
2
+ import { HTMLTemplateResult, LitElement } from 'lit';
3
+ import { ConfirmDialogBuilder } from './confirm-dialog-builder.js';
4
+ import { MessageDialogBuilder } from './message-dialog-builder.js';
5
+ import '../elevation/elevation.js';
6
+ export declare class UmDialog extends LitElement {
7
+ #private;
8
+ static styles: import("lit").CSSResult[];
9
+ get open(): boolean;
10
+ set open(open: boolean);
11
+ get returnValue(): string;
12
+ /**
13
+ * Whether dialog has headline or not
14
+ *
15
+ * _Note:_ Readonly
16
+ */
17
+ hasHeadline: boolean;
18
+ /**
19
+ * Whether dialog has icon
20
+ *
21
+ * _Note:_ Readonly
22
+ */
23
+ hasIcon: boolean;
24
+ dialog: HTMLDialogElement;
25
+ scrim: HTMLElement;
26
+ content: HTMLElement;
27
+ container: HTMLElement;
28
+ private readonly assignedHeadlines;
29
+ private readonly assignedIcons;
30
+ static message(message: string): MessageDialogBuilder;
31
+ static confirm(message: string): ConfirmDialogBuilder;
32
+ render(): HTMLTemplateResult;
33
+ firstUpdated(changedProperties: PropertyValues): void;
34
+ connectedCallback(): void;
35
+ disconnectedCallback(): void;
36
+ show(): Promise<void>;
37
+ close(returnValue?: string): Promise<void>;
38
+ }
39
+ declare global {
40
+ interface HTMLElementTagNameMap {
41
+ 'u-dialog': UmDialog;
42
+ }
43
+ }
44
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAM3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,2BAA2B,CAAC;AAKnC,qBACa,QAAS,SAAQ,UAAU;;IACtC,OAAgB,MAAM,4BAAwB;IAK9C,IACI,IAAI,IAAI,OAAO,CAElB;IACD,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,EAWrB;IAED,IAAI,WAAW,WAEd;IAED;;;;OAIG;IACkE,WAAW,UAAS;IAEzF;;;;OAIG;IAC8D,OAAO,UAAS;IAEhE,MAAM,EAAG,iBAAiB,CAAC;IAC3B,KAAK,EAAG,WAAW,CAAC;IAClB,OAAO,EAAG,WAAW,CAAC;IACpB,SAAS,EAAG,WAAW,CAAC;IAG7C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;IAGnD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAE/C,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAIrD,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAI5C,MAAM,IAAI,kBAAkB;IA8B5B,YAAY,CAAC,iBAAiB,EAAE,cAAc;IAM9C,iBAAiB;IAUjB,oBAAoB;IAoEvB,IAAI;IAWJ,KAAK,CAAC,WAAW,GAAE,MAAyB;CA6CnD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,QAAQ,CAAC;KACtB;CACF"}
@@ -0,0 +1,235 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var _UmDialog_instances, _UmDialog_open, _UmDialog_contentResizeObserver, _UmDialog_handleSubmit, _UmDialog_handleCancel, _UmDialog_handleIconSlotChange, _UmDialog_handleHeadlineSlotChange, _UmDialog_handleScroll, _UmDialog_setScrollDividers, _UmDialog_setBottomScrollDivider, _UmDialog_setTopScrollDivider, _UmDialog_handleScrimClick;
19
+ import { html, LitElement } from 'lit';
20
+ import { customElement, property, query, queryAssignedElements } from 'lit/decorators.js';
21
+ import { styles as baseStyles } from '../shared/base.styles.js';
22
+ import { styles } from './dialog.styles.js';
23
+ import { ConfirmDialogBuilder } from './confirm-dialog-builder.js';
24
+ import { MessageDialogBuilder } from './message-dialog-builder.js';
25
+ import '../elevation/elevation.js';
26
+ const topDividerClass = 'top-divider';
27
+ const bottomDividerClass = 'bottom-divider';
28
+ let UmDialog = class UmDialog extends LitElement {
29
+ constructor() {
30
+ super(...arguments);
31
+ _UmDialog_instances.add(this);
32
+ _UmDialog_open.set(this, false);
33
+ _UmDialog_contentResizeObserver.set(this, void 0);
34
+ /**
35
+ * Whether dialog has headline or not
36
+ *
37
+ * _Note:_ Readonly
38
+ */
39
+ this.hasHeadline = false;
40
+ /**
41
+ * Whether dialog has icon
42
+ *
43
+ * _Note:_ Readonly
44
+ */
45
+ this.hasIcon = false;
46
+ _UmDialog_handleCancel.set(this, (e) => {
47
+ e.preventDefault();
48
+ const cancelPrevented = !this.dispatchEvent(new Event('cancel', { cancelable: true }));
49
+ if (cancelPrevented) {
50
+ return;
51
+ }
52
+ this.close();
53
+ });
54
+ }
55
+ get open() {
56
+ return __classPrivateFieldGet(this, _UmDialog_open, "f");
57
+ }
58
+ set open(open) {
59
+ if (__classPrivateFieldGet(this, _UmDialog_open, "f") === open) {
60
+ return;
61
+ }
62
+ if (!open) {
63
+ this.close();
64
+ return;
65
+ }
66
+ this.show();
67
+ }
68
+ get returnValue() {
69
+ return this.dialog.returnValue;
70
+ }
71
+ static message(message) {
72
+ return MessageDialogBuilder.create(message);
73
+ }
74
+ static confirm(message) {
75
+ return ConfirmDialogBuilder.create(message);
76
+ }
77
+ render() {
78
+ return html `
79
+ <dialog>
80
+ <div class="scrim" @click=${__classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_handleScrimClick)}></div>
81
+ <div class="container">
82
+ <u-elevation></u-elevation>
83
+ <div class="icon">
84
+ <slot
85
+ name="icon"
86
+ @slotchange=${__classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_handleIconSlotChange)}>
87
+ </slot>
88
+ </div>
89
+ <div class="headline">
90
+ <slot
91
+ name="headline"
92
+ @slotchange=${__classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_handleHeadlineSlotChange)}>
93
+ </slot>
94
+ </div>
95
+ <div
96
+ class="content"
97
+ @scroll=${__classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_handleScroll)}>
98
+ <slot></slot>
99
+ </div>
100
+ <div class="actions">
101
+ <slot name="actions"></slot>
102
+ </div>
103
+ </div>
104
+ </dialog>`;
105
+ }
106
+ firstUpdated(changedProperties) {
107
+ super.firstUpdated(changedProperties);
108
+ this.dialog.addEventListener('cancel', __classPrivateFieldGet(this, _UmDialog_handleCancel, "f"));
109
+ }
110
+ connectedCallback() {
111
+ super.connectedCallback();
112
+ this.addEventListener('submit', __classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_handleSubmit));
113
+ setTimeout(() => {
114
+ __classPrivateFieldSet(this, _UmDialog_contentResizeObserver, new ResizeObserver(() => __classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_setScrollDividers).call(this)), "f");
115
+ __classPrivateFieldGet(this, _UmDialog_contentResizeObserver, "f").observe(this.content);
116
+ });
117
+ }
118
+ disconnectedCallback() {
119
+ super.disconnectedCallback();
120
+ this.removeEventListener('submit', __classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_handleSubmit));
121
+ __classPrivateFieldGet(this, _UmDialog_contentResizeObserver, "f").disconnect();
122
+ __classPrivateFieldSet(this, _UmDialog_contentResizeObserver, null, "f");
123
+ }
124
+ async show() {
125
+ __classPrivateFieldSet(this, _UmDialog_open, true, "f");
126
+ this.setAttribute('open', '');
127
+ await this.updateComplete;
128
+ this.dialog.showModal();
129
+ const autoFocusElement = this.querySelector('[autofocus]');
130
+ autoFocusElement?.focus();
131
+ this.content.scrollTop = 0;
132
+ }
133
+ async close(returnValue = this.returnValue) {
134
+ __classPrivateFieldSet(this, _UmDialog_open, false, "f");
135
+ this.removeAttribute('open');
136
+ await this.updateComplete;
137
+ if (!this.dialog.open || this.open) {
138
+ return;
139
+ }
140
+ const preventClose = !this.dispatchEvent(new Event('close', { cancelable: true }));
141
+ if (preventClose) {
142
+ __classPrivateFieldSet(this, _UmDialog_open, true, "f");
143
+ return;
144
+ }
145
+ this.open = false;
146
+ const closed = new Promise(resolve => this.container.addEventListener('animationend', () => {
147
+ resolve();
148
+ this.classList.remove('closing');
149
+ this.dialog.close(returnValue);
150
+ this.dispatchEvent(new Event('closed'));
151
+ }, { capture: true, once: true }));
152
+ this.classList.add('closing');
153
+ await closed;
154
+ }
155
+ };
156
+ _UmDialog_open = new WeakMap();
157
+ _UmDialog_contentResizeObserver = new WeakMap();
158
+ _UmDialog_handleCancel = new WeakMap();
159
+ _UmDialog_instances = new WeakSet();
160
+ _UmDialog_handleSubmit = function _UmDialog_handleSubmit(event) {
161
+ const form = event.target;
162
+ const { submitter } = event;
163
+ if (form.method !== 'dialog' || !submitter) {
164
+ return;
165
+ }
166
+ this.close(submitter.getAttribute('value') ?? this.returnValue);
167
+ };
168
+ _UmDialog_handleIconSlotChange = function _UmDialog_handleIconSlotChange() {
169
+ this.hasIcon = this.assignedIcons.length > 0;
170
+ };
171
+ _UmDialog_handleHeadlineSlotChange = function _UmDialog_handleHeadlineSlotChange() {
172
+ this.hasHeadline = this.assignedHeadlines.length > 0;
173
+ };
174
+ _UmDialog_handleScroll = function _UmDialog_handleScroll() {
175
+ __classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_setScrollDividers).call(this);
176
+ };
177
+ _UmDialog_setScrollDividers = function _UmDialog_setScrollDividers() {
178
+ __classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_setTopScrollDivider).call(this);
179
+ __classPrivateFieldGet(this, _UmDialog_instances, "m", _UmDialog_setBottomScrollDivider).call(this);
180
+ };
181
+ _UmDialog_setBottomScrollDivider = function _UmDialog_setBottomScrollDivider() {
182
+ const scrollBottom = this.content.scrollTop + this.content.offsetHeight;
183
+ if (scrollBottom >= this.content.scrollHeight) {
184
+ this.content.classList.remove(bottomDividerClass);
185
+ return;
186
+ }
187
+ this.content.classList.add(bottomDividerClass);
188
+ };
189
+ _UmDialog_setTopScrollDivider = function _UmDialog_setTopScrollDivider() {
190
+ if (this.content.scrollTop) {
191
+ this.content.classList.add(topDividerClass);
192
+ return;
193
+ }
194
+ this.content.classList.remove(topDividerClass);
195
+ };
196
+ _UmDialog_handleScrimClick = function _UmDialog_handleScrimClick() {
197
+ const cancelPrevented = !this.dispatchEvent(new Event('cancel', { cancelable: true }));
198
+ if (cancelPrevented) {
199
+ return;
200
+ }
201
+ this.close();
202
+ };
203
+ UmDialog.styles = [baseStyles, styles];
204
+ __decorate([
205
+ property({ type: Boolean })
206
+ ], UmDialog.prototype, "open", null);
207
+ __decorate([
208
+ property({ type: Boolean, attribute: 'has-headline', reflect: true })
209
+ ], UmDialog.prototype, "hasHeadline", void 0);
210
+ __decorate([
211
+ property({ type: Boolean, attribute: 'has-icon', reflect: true })
212
+ ], UmDialog.prototype, "hasIcon", void 0);
213
+ __decorate([
214
+ query('dialog')
215
+ ], UmDialog.prototype, "dialog", void 0);
216
+ __decorate([
217
+ query('.scrim')
218
+ ], UmDialog.prototype, "scrim", void 0);
219
+ __decorate([
220
+ query('.content')
221
+ ], UmDialog.prototype, "content", void 0);
222
+ __decorate([
223
+ query('.container')
224
+ ], UmDialog.prototype, "container", void 0);
225
+ __decorate([
226
+ queryAssignedElements({ slot: 'headline', flatten: true })
227
+ ], UmDialog.prototype, "assignedHeadlines", void 0);
228
+ __decorate([
229
+ queryAssignedElements({ slot: 'icon', flatten: true })
230
+ ], UmDialog.prototype, "assignedIcons", void 0);
231
+ UmDialog = __decorate([
232
+ customElement('u-dialog')
233
+ ], UmDialog);
234
+ export { UmDialog };
235
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/dialog/dialog.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1F,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,2BAA2B,CAAC;AAEnC,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;;QAGL,yBAAQ,KAAK,EAAC;QACd,kDAA+C;QAuB/C;;;;WAIG;QACkE,gBAAW,GAAG,KAAK,CAAC;QAEzF;;;;WAIG;QAC8D,YAAO,GAAG,KAAK,CAAC;QAsFjF,iCAAgB,CAAC,CAAQ,EAAE,EAAE;YAC3B,CAAC,CAAC,cAAc,EAAE,CAAC;YAEnB,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAA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EAAC,CAAC;oCAGzB;AAuBoE;IAApE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CAAqB;AAOxB;IAAhE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;yCAAiB;AAEhE;IAAhB,KAAK,CAAC,QAAQ,CAAC;wCAA4B;AAC3B;IAAhB,KAAK,CAAC,QAAQ,CAAC;uCAAqB;AAClB;IAAlB,KAAK,CAAC,UAAU,CAAC;yCAAuB;AACpB;IAApB,KAAK,CAAC,YAAY,CAAC;2CAAyB;AAG5B;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;mDACN;AAGlC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;+CACN;AAlDpC,QAAQ;IADpB,aAAa,CAAC,UAAU,CAAC;GACb,QAAQ,CAsOpB","sourcesContent":["import { PropertyValues } from '@lit/reactive-element';\nimport { html, HTMLTemplateResult, LitElement } from 'lit';\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { styles } from './dialog.styles.js';\n\nimport { ConfirmDialogBuilder } from './confirm-dialog-builder.js';\nimport { MessageDialogBuilder } from './message-dialog-builder.js';\n\nimport '../elevation/elevation.js';\n\nconst topDividerClass = 'top-divider';\nconst bottomDividerClass = 'bottom-divider';\n\n@customElement('u-dialog')\nexport class UmDialog extends LitElement {\n static override styles = [baseStyles, styles];\n\n #open = false;\n #contentResizeObserver!: ResizeObserver | null;\n\n @property({type: Boolean})\n get open(): boolean {\n return this.#open;\n }\n set open(open: boolean) {\n if (this.#open === open) {\n return;\n }\n\n if (!open) {\n this.close();\n return;\n }\n\n this.show();\n }\n\n get returnValue() {\n return this.dialog.returnValue;\n }\n\n /**\n * Whether dialog has headline or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-headline', reflect: true}) hasHeadline = false;\n\n /**\n * Whether dialog has icon\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon = false;\n\n @query('dialog') dialog!: HTMLDialogElement;\n @query('.scrim') scrim!: HTMLElement;\n @query('.content') content!: HTMLElement;\n @query('.container') container!: HTMLElement;\n\n @queryAssignedElements({slot: 'headline', flatten: true})\n private readonly assignedHeadlines!: HTMLElement[];\n\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly assignedIcons!: HTMLElement[];\n\n static message(message: string): MessageDialogBuilder {\n return MessageDialogBuilder.create(message);\n }\n\n static confirm(message: string): ConfirmDialogBuilder {\n return ConfirmDialogBuilder.create(message);\n }\n\n override render(): HTMLTemplateResult {\n return html`\n <dialog>\n <div class=\"scrim\" @click=${this.#handleScrimClick}></div>\n <div class=\"container\">\n <u-elevation></u-elevation>\n <div class=\"icon\">\n <slot\n name=\"icon\"\n @slotchange=${this.#handleIconSlotChange}>\n </slot>\n </div>\n <div class=\"headline\">\n <slot\n name=\"headline\"\n @slotchange=${this.#handleHeadlineSlotChange}>\n </slot>\n </div>\n <div\n class=\"content\"\n @scroll=${this.#handleScroll}>\n <slot></slot>\n </div>\n <div class=\"actions\">\n <slot name=\"actions\"></slot>\n </div>\n </div>\n </dialog>`;\n }\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n\n this.dialog.addEventListener('cancel', this.#handleCancel)\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('submit', this.#handleSubmit);\n\n setTimeout(() => {\n this.#contentResizeObserver = new ResizeObserver(() => this.#setScrollDividers())\n this.#contentResizeObserver.observe(this.content);\n });\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('submit', this.#handleSubmit);\n\n this.#contentResizeObserver!.disconnect();\n this.#contentResizeObserver = null;\n }\n\n #handleSubmit(event: SubmitEvent) {\n const form = event.target as HTMLFormElement;\n const {submitter} = event;\n\n if (form.method !== 'dialog' || !submitter) {\n return;\n }\n\n this.close(submitter.getAttribute('value') ?? this.returnValue);\n }\n\n #handleCancel = (e: Event) => {\n e.preventDefault();\n\n const cancelPrevented = !this.dispatchEvent(new Event('cancel', {cancelable: true}));\n\n if (cancelPrevented) {\n return;\n }\n\n this.close();\n }\n\n #handleIconSlotChange() {\n this.hasIcon = this.assignedIcons.length > 0;\n }\n\n #handleHeadlineSlotChange() {\n this.hasHeadline = this.assignedHeadlines.length > 0;\n }\n\n #handleScroll() {\n this.#setScrollDividers();\n }\n\n #setScrollDividers() {\n this.#setTopScrollDivider();\n this.#setBottomScrollDivider();\n }\n\n #setBottomScrollDivider() {\n const scrollBottom = this.content.scrollTop + this.content.offsetHeight;\n\n if (scrollBottom >= this.content.scrollHeight) {\n this.content.classList.remove(bottomDividerClass);\n return;\n }\n \n this.content.classList.add(bottomDividerClass);\n }\n\n #setTopScrollDivider() {\n if (this.content.scrollTop) {\n this.content.classList.add(topDividerClass);\n return;\n }\n \n this.content.classList.remove(topDividerClass);\n }\n\n async show() {\n this.#open = true;\n this.setAttribute('open', '');\n\n await this.updateComplete;\n this.dialog.showModal();\n const autoFocusElement = this.querySelector<HTMLElement>('[autofocus]');\n autoFocusElement?.focus();\n this.content.scrollTop = 0;\n }\n\n async close(returnValue: string = this.returnValue) {\n this.#open = false;\n this.removeAttribute('open');\n\n await this.updateComplete;\n\n if (!this.dialog.open || this.open) {\n return;\n }\n\n const preventClose = !this.dispatchEvent(new Event('close', {cancelable: true}));\n\n if (preventClose) {\n this.#open = true;\n return;\n }\n\n this.open = false;\n\n const closed = new Promise<void>(resolve =>\n this.container.addEventListener(\n 'animationend',\n () => {\n resolve();\n this.classList.remove('closing');\n this.dialog.close(returnValue);\n this.dispatchEvent(new Event('closed'));\n },\n {capture: true, once: true},\n )\n );\n\n this.classList.add('closing');\n await closed;\n }\n\n #handleScrimClick() {\n const cancelPrevented = !this.dispatchEvent(new Event('cancel', {cancelable: true}));\n\n if (cancelPrevented) {\n return;\n }\n\n this.close();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-dialog': UmDialog;\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult;
2
+ //# sourceMappingURL=dialog.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.styles.d.ts","sourceRoot":"","sources":["../../src/dialog/dialog.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAkKlB,CAAC"}
@@ -0,0 +1,165 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ --u-elevation-level: var(--u-dialog-elevation, 3);
5
+ --_icon-size: var(--u-dialog-icon-size, 24px);
6
+ --_divider-color: var(--u-dialog-divider-color, var(--u-color-outline-variant, rgb(202, 196, 208)));
7
+ --_scrim-opacity: var(--u-dialog-scrim-opacity, .32);
8
+ --_padding: var(--u-dialog-padding, 24px);
9
+ }
10
+
11
+ :host(:not([has-headline])) .headline {
12
+ display: none;
13
+ }
14
+
15
+ :host([has-icon]) .icon {
16
+ display: flex;
17
+ }
18
+ :host([has-icon]) .headline {
19
+ padding-top: 0;
20
+ }
21
+ :host([has-icon]) .headline,
22
+ :host([has-icon]) .container {
23
+ text-align: center;
24
+ }
25
+
26
+ :host([has-headline]) .content.top-divider,
27
+ :host([has-icon]) .content.top-divider {
28
+ border-top: 1px solid var(--_divider-color);
29
+ margin-top: -1px;
30
+ }
31
+
32
+ .scrim {
33
+ position: fixed;
34
+ inset: 0;
35
+ background-color: var(--u-dialog-scrim-color, var(--u-color-scrim, rgb(0, 0, 0)));
36
+ animation: scrim-show-animation 300ms;
37
+ animation-fill-mode: forwards;
38
+ z-index: -1;
39
+ }
40
+
41
+ dialog {
42
+ align-items: center;
43
+ background: none;
44
+ border: none;
45
+ overflow: visible;
46
+ padding: var(--_padding);
47
+ max-width: none;
48
+ max-height: none;
49
+ width: 100%;
50
+ height: 100%;
51
+ }
52
+ dialog[open] {
53
+ display: flex;
54
+ }
55
+ dialog::backdrop {
56
+ background: none;
57
+ }
58
+
59
+ .container {
60
+ position: relative;
61
+ display: flex;
62
+ flex-direction: column;
63
+ margin-inline: auto;
64
+ background-color: var(--u-dialog-container-background-color, var(--u-color-surface-container-high, rgb(236, 230, 240)));
65
+ border-radius: var(--u-dialog-border-radius, var(--u-shape-corner-extra-large, 28px));
66
+ min-width: min(var(--u-dialog-min-width, 280px), 100%);
67
+ max-width: var(--u-dialog-max-width, 560px);
68
+ max-height: min(var(--u-dialog-max-height, 560px), 100%);
69
+ animation: show 250ms cubic-bezier(0.19, 1, 0.22, 1);
70
+ z-index: 1;
71
+ }
72
+
73
+ .headline,
74
+ .icon,
75
+ .content,
76
+ .actions {
77
+ padding: var(--_padding);
78
+ }
79
+
80
+ .headline {
81
+ font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"));
82
+ line-height: var(--u-dialog-headline-line-height, var(--u-headline-s-line-height, 2rem));
83
+ font-size: var(--u-dialog-headline-font-size, var(--u-headline-s-font-size, 1.5rem));
84
+ letter-spacing: var(--u-dialog-headline-letter-spacing, var(--u-headline-s-letter-spacing, 0rem));
85
+ font-weight: var(--u-dialog-headline-font-weight, var(--u-headline-s-font-weight, var(--u-font-weight-regular, 400)));
86
+ padding-bottom: var(--u-headline-padding, 16px);
87
+ }
88
+
89
+ .icon {
90
+ display: none;
91
+ justify-content: center;
92
+ align-items: center;
93
+ font-size: var(--_icon-size);
94
+ line-height: var(--_icon-size);
95
+ color: var(--u-dialog-icon-color, var(--u-color-secondary, rgb(98, 91, 113)));
96
+ padding-bottom: var(--u-icon-padding, 16px);
97
+ }
98
+
99
+ .content {
100
+ font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"));
101
+ line-height: var(--u-dialog-content-line-height, var(--u-body-m-line-height, 1.25rem));
102
+ font-size: var(--u-dialog-content-font-size, var(--u-body-m-font-size, 0.875rem));
103
+ letter-spacing: var(--u-dialog-content-letter-spacing, var(--u-body-m-letter-spacing, 0.0178571429rem));
104
+ font-weight: var(--u-dialog-content-font-weight, var(--u-body-m-font-weight, var(--u-font-weight-regular, 400)));
105
+ color: var(--u-dialog-content-text-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));
106
+ padding-block: 0;
107
+ overflow: auto;
108
+ }
109
+ .content.bottom-divider {
110
+ border-bottom: 1px solid var(--_divider-color);
111
+ margin-bottom: -1px;
112
+ }
113
+
114
+ :host(:not([has-headline]):not([has-icon])) .content {
115
+ padding-top: var(--_padding);
116
+ }
117
+
118
+ .actions {
119
+ display: flex;
120
+ flex-direction: row-reverse;
121
+ flex-wrap: wrap-reverse;
122
+ gap: var(--u-dialog-actions-gap, 8px);
123
+ }
124
+
125
+ :host(.closing) .container {
126
+ animation-name: close;
127
+ }
128
+ :host(.closing) .scrim {
129
+ animation-name: scrim-close-animation;
130
+ }
131
+
132
+ @keyframes scrim-show-animation {
133
+ from {
134
+ opacity: 0;
135
+ }
136
+ to {
137
+ opacity: var(--_scrim-opacity);
138
+ }
139
+ }
140
+ @keyframes scrim-close-animation {
141
+ from {
142
+ opacity: var(--_scrim-opacity);
143
+ }
144
+ to {
145
+ opacity: 0;
146
+ }
147
+ }
148
+ @keyframes show {
149
+ from {
150
+ transform: scale3d(0, 0, 1);
151
+ }
152
+ to {
153
+ transform: scale3d(1, 1, 1);
154
+ }
155
+ }
156
+ @keyframes close {
157
+ from {
158
+ transform: scale3d(1, 1, 1);
159
+ }
160
+ to {
161
+ transform: scale3d(0, 0, 1);
162
+ }
163
+ }
164
+ `;
165
+ //# sourceMappingURL=dialog.styles.js.map