@internetarchive/modal-manager 2.0.5-webdev-8155.6 → 2.0.5-webdev-8155.9

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.
@@ -26,7 +26,7 @@ jobs:
26
26
  run: npm run test
27
27
 
28
28
  - name: Upload Codecov reports
29
- uses: codecov/codecov-action@main
29
+ uses: codecov/codecov-action@v5
30
30
  with:
31
31
  fail_ci_if_error: true
32
32
  token: ${{ secrets.CODECOV_TOKEN }}
@@ -35,6 +35,6 @@ jobs:
35
35
  - uses: actions/upload-artifact@v4
36
36
  if: ${{ !cancelled() }}
37
37
  with:
38
- name: playwright-report
38
+ name: coverage-report
39
39
  path: coverage/
40
40
  retention-days: 30
@@ -5,6 +5,7 @@
5
5
  "bierner.lit-html",
6
6
  "bashmish.es6-string-css",
7
7
  "runem.lit-plugin",
8
- "ryanluker.vscode-coverage-gutters"
8
+ "ryanluker.vscode-coverage-gutters",
9
+ "vitest.explorer"
9
10
  ]
10
11
  }
package/demo/app-root.ts CHANGED
@@ -111,20 +111,20 @@ export class AppRoot extends LitElement {
111
111
  `;
112
112
  }
113
113
 
114
- showModal() {
114
+ private showModal() {
115
115
  const config = new ModalConfig();
116
- config.headline = 'Success';
117
- config.message = 'Thank you for your support!';
116
+ config.headline = html`Success`;
117
+ config.message = html`Thank you for your support!`;
118
118
 
119
119
  this.modalManager.showModal({
120
120
  config,
121
121
  });
122
122
  }
123
123
 
124
- showErrorModal() {
124
+ private showErrorModal() {
125
125
  const config = new ModalConfig();
126
- config.headline = 'Error';
127
- config.message = 'An error occurred while processing your donation.';
126
+ config.headline = html`Error`;
127
+ config.message = html`An error occurred while processing your donation.`;
128
128
  config.headerColor = '#691916';
129
129
  config.bodyColor = '#fff';
130
130
 
@@ -133,15 +133,15 @@ export class AppRoot extends LitElement {
133
133
  });
134
134
  }
135
135
 
136
- showBillAlert() {
136
+ private showBillAlert() {
137
137
  alert('Bill <3 You');
138
138
  }
139
139
 
140
- buttonPress() {
140
+ private buttonPress() {
141
141
  alert('You pressed a button.');
142
142
  }
143
143
 
144
- showAllFeaturesModal() {
144
+ private showAllFeaturesModal() {
145
145
  const config = new ModalConfig();
146
146
  config.title = html`Donation Received`;
147
147
  config.subtitle = html`Thanks a bunch!`;
@@ -165,9 +165,9 @@ export class AppRoot extends LitElement {
165
165
  });
166
166
  }
167
167
 
168
- showCustomContentModal() {
168
+ private showCustomContentModal() {
169
169
  const config = new ModalConfig();
170
- config.title = 'Custom Content';
170
+ config.title = html`Custom Content`;
171
171
  config.headline = html`<span class="sr-only"
172
172
  >Also support screen-reader only</span
173
173
  >`;
@@ -195,9 +195,9 @@ export class AppRoot extends LitElement {
195
195
  });
196
196
  }
197
197
 
198
- showSlottedContentModal() {
198
+ private showSlottedContentModal() {
199
199
  const config = new ModalConfig();
200
- config.title = 'Slotted Content';
200
+ config.title = html`Slotted Content`;
201
201
 
202
202
  const someContent = html`
203
203
  Can slot content from the top-level:
@@ -210,7 +210,7 @@ export class AppRoot extends LitElement {
210
210
  });
211
211
  }
212
212
 
213
- showOverflowModal() {
213
+ private showOverflowModal() {
214
214
  const config = new ModalConfig();
215
215
 
216
216
  config.title = html`Lorem Ipsum`;
@@ -251,11 +251,11 @@ export class AppRoot extends LitElement {
251
251
  });
252
252
  }
253
253
 
254
- showModalWithoutLogo() {
254
+ private showModalWithoutLogo() {
255
255
  const config = new ModalConfig();
256
- config.headline = 'Success';
256
+ config.headline = html`Success`;
257
257
  config.title = html`Donation Received`;
258
- config.message = 'Thank you for your support!';
258
+ config.message = html`Thank you for your support!`;
259
259
  config.headerColor = '#194880';
260
260
  config.showHeaderLogo = false;
261
261
  this.modalManager.showModal({
@@ -263,7 +263,7 @@ export class AppRoot extends LitElement {
263
263
  });
264
264
  }
265
265
 
266
- showCompleteModal() {
266
+ private showCompleteModal() {
267
267
  const config = new ModalConfig();
268
268
  config.showProcessingIndicator = true;
269
269
  config.processingImageMode = 'complete';
@@ -272,7 +272,7 @@ export class AppRoot extends LitElement {
272
272
  });
273
273
  }
274
274
 
275
- showProcessingModal() {
275
+ private showProcessingModal() {
276
276
  const config = new ModalConfig();
277
277
  config.headerColor = '#497fbf';
278
278
  config.showProcessingIndicator = true;
@@ -286,25 +286,25 @@ export class AppRoot extends LitElement {
286
286
  setTimeout(this.showCompleteModal.bind(this), 1500);
287
287
  }
288
288
 
289
- showUserClosedModalCallbackModal() {
289
+ private showUserClosedModalCallbackModal() {
290
290
  const config = new ModalConfig();
291
- config.message = 'When you close this modal another will open.';
291
+ config.message = html`When you close this modal another will open.`;
292
292
 
293
293
  this.modalManager.showModal({
294
294
  config,
295
295
  userClosedModalCallback: () => {
296
296
  const config = new ModalConfig();
297
- config.message = "I'm another modal";
297
+ config.message = html`I'm another modal`;
298
298
  config.headerColor = '#497fbf';
299
299
  this.modalManager.showModal({ config });
300
300
  },
301
301
  });
302
302
  }
303
303
 
304
- showModalUserCannotClose() {
304
+ private showModalUserCannotClose() {
305
305
  const config = new ModalConfig();
306
- config.message =
307
- 'User cannot close this. Will close automatically in 2 seconds.';
306
+ config.message = html`User cannot close this. Will close automatically in 2
307
+ seconds.`;
308
308
  config.showCloseButton = false;
309
309
  config.closeOnBackdropClick = false;
310
310
  this.modalManager.showModal({
@@ -314,9 +314,9 @@ export class AppRoot extends LitElement {
314
314
  setTimeout(this.modalManager.closeModal.bind(this.modalManager), 2000);
315
315
  }
316
316
 
317
- showModalWithLeftNavButton() {
317
+ private showModalWithLeftNavButton() {
318
318
  const config = new ModalConfig();
319
- config.message = 'This modal has a left nav button.';
319
+ config.message = html`This modal has a left nav button.`;
320
320
  config.showLeftNavButton = true;
321
321
  config.leftNavButtonText = 'Back';
322
322
 
@@ -324,17 +324,17 @@ export class AppRoot extends LitElement {
324
324
  config,
325
325
  userPressedLeftNavButtonCallback: () => {
326
326
  const config = new ModalConfig();
327
- config.message =
328
- "I'm the previous modal (or anything else you want to do here)";
327
+ config.message = html`I'm the previous modal (or anything else you want
328
+ to do here)`;
329
329
  config.headerColor = '#497fbf';
330
330
  this.modalManager.showModal({ config });
331
331
  },
332
332
  });
333
333
  }
334
334
 
335
- showModalUserCannotClickBackdrop() {
335
+ private showModalUserCannotClickBackdrop() {
336
336
  const config = new ModalConfig();
337
- config.message = 'Clicking on the backdrop will not close this.';
337
+ config.message = html`Clicking on the backdrop will not close this.`;
338
338
  config.showCloseButton = true;
339
339
  config.closeOnBackdropClick = false;
340
340
  this.modalManager.showModal({
@@ -3,20 +3,20 @@ import '../src/modal-manager';
3
3
  export declare class AppRoot extends LitElement {
4
4
  private modalManager;
5
5
  protected render(): import("lit-html").TemplateResult<1>;
6
- showModal(): void;
7
- showErrorModal(): void;
8
- showBillAlert(): void;
9
- buttonPress(): void;
10
- showAllFeaturesModal(): void;
11
- showCustomContentModal(): void;
12
- showSlottedContentModal(): void;
13
- showOverflowModal(): void;
14
- showModalWithoutLogo(): void;
15
- showCompleteModal(): void;
16
- showProcessingModal(): void;
17
- showUserClosedModalCallbackModal(): void;
18
- showModalUserCannotClose(): void;
19
- showModalWithLeftNavButton(): void;
20
- showModalUserCannotClickBackdrop(): void;
6
+ private showModal;
7
+ private showErrorModal;
8
+ private showBillAlert;
9
+ private buttonPress;
10
+ private showAllFeaturesModal;
11
+ private showCustomContentModal;
12
+ private showSlottedContentModal;
13
+ private showOverflowModal;
14
+ private showModalWithoutLogo;
15
+ private showCompleteModal;
16
+ private showProcessingModal;
17
+ private showUserClosedModalCallbackModal;
18
+ private showModalUserCannotClose;
19
+ private showModalWithLeftNavButton;
20
+ private showModalUserCannotClickBackdrop;
21
21
  static get styles(): CSSResultGroup;
22
22
  }
@@ -107,16 +107,16 @@ let AppRoot = class AppRoot extends LitElement {
107
107
  }
108
108
  showModal() {
109
109
  const config = new ModalConfig();
110
- config.headline = 'Success';
111
- config.message = 'Thank you for your support!';
110
+ config.headline = html `Success`;
111
+ config.message = html `Thank you for your support!`;
112
112
  this.modalManager.showModal({
113
113
  config,
114
114
  });
115
115
  }
116
116
  showErrorModal() {
117
117
  const config = new ModalConfig();
118
- config.headline = 'Error';
119
- config.message = 'An error occurred while processing your donation.';
118
+ config.headline = html `Error`;
119
+ config.message = html `An error occurred while processing your donation.`;
120
120
  config.headerColor = '#691916';
121
121
  config.bodyColor = '#fff';
122
122
  this.modalManager.showModal({
@@ -152,7 +152,7 @@ let AppRoot = class AppRoot extends LitElement {
152
152
  }
153
153
  showCustomContentModal() {
154
154
  const config = new ModalConfig();
155
- config.title = 'Custom Content';
155
+ config.title = html `Custom Content`;
156
156
  config.headline = html `<span class="sr-only"
157
157
  >Also support screen-reader only</span
158
158
  >`;
@@ -179,7 +179,7 @@ let AppRoot = class AppRoot extends LitElement {
179
179
  }
180
180
  showSlottedContentModal() {
181
181
  const config = new ModalConfig();
182
- config.title = 'Slotted Content';
182
+ config.title = html `Slotted Content`;
183
183
  const someContent = html `
184
184
  Can slot content from the top-level:
185
185
  <slot name="slot-content-demo"></slot>
@@ -228,9 +228,9 @@ let AppRoot = class AppRoot extends LitElement {
228
228
  }
229
229
  showModalWithoutLogo() {
230
230
  const config = new ModalConfig();
231
- config.headline = 'Success';
231
+ config.headline = html `Success`;
232
232
  config.title = html `Donation Received`;
233
- config.message = 'Thank you for your support!';
233
+ config.message = html `Thank you for your support!`;
234
234
  config.headerColor = '#194880';
235
235
  config.showHeaderLogo = false;
236
236
  this.modalManager.showModal({
@@ -259,12 +259,12 @@ let AppRoot = class AppRoot extends LitElement {
259
259
  }
260
260
  showUserClosedModalCallbackModal() {
261
261
  const config = new ModalConfig();
262
- config.message = 'When you close this modal another will open.';
262
+ config.message = html `When you close this modal another will open.`;
263
263
  this.modalManager.showModal({
264
264
  config,
265
265
  userClosedModalCallback: () => {
266
266
  const config = new ModalConfig();
267
- config.message = "I'm another modal";
267
+ config.message = html `I'm another modal`;
268
268
  config.headerColor = '#497fbf';
269
269
  this.modalManager.showModal({ config });
270
270
  },
@@ -272,8 +272,8 @@ let AppRoot = class AppRoot extends LitElement {
272
272
  }
273
273
  showModalUserCannotClose() {
274
274
  const config = new ModalConfig();
275
- config.message =
276
- 'User cannot close this. Will close automatically in 2 seconds.';
275
+ config.message = html `User cannot close this. Will close automatically in 2
276
+ seconds.`;
277
277
  config.showCloseButton = false;
278
278
  config.closeOnBackdropClick = false;
279
279
  this.modalManager.showModal({
@@ -283,15 +283,15 @@ let AppRoot = class AppRoot extends LitElement {
283
283
  }
284
284
  showModalWithLeftNavButton() {
285
285
  const config = new ModalConfig();
286
- config.message = 'This modal has a left nav button.';
286
+ config.message = html `This modal has a left nav button.`;
287
287
  config.showLeftNavButton = true;
288
288
  config.leftNavButtonText = 'Back';
289
289
  this.modalManager.showModal({
290
290
  config,
291
291
  userPressedLeftNavButtonCallback: () => {
292
292
  const config = new ModalConfig();
293
- config.message =
294
- "I'm the previous modal (or anything else you want to do here)";
293
+ config.message = html `I'm the previous modal (or anything else you want
294
+ to do here)`;
295
295
  config.headerColor = '#497fbf';
296
296
  this.modalManager.showModal({ config });
297
297
  },
@@ -299,7 +299,7 @@ let AppRoot = class AppRoot extends LitElement {
299
299
  }
300
300
  showModalUserCannotClickBackdrop() {
301
301
  const config = new ModalConfig();
302
- config.message = 'Clicking on the backdrop will not close this.';
302
+ config.message = html `Clicking on the backdrop will not close this.`;
303
303
  config.showCloseButton = true;
304
304
  config.closeOnBackdropClick = false;
305
305
  this.modalManager.showModal({
@@ -1 +1 @@
1
- {"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../demo/app-root.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,sBAAsB,CAAC;AAGvB,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAI3B,MAAM;QACd,OAAO,IAAI,CAAA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AG,MAAM,CAAC;QAElC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;YAC1B,MAAM;YACN,gCAAgC,EAAE,GAAG,EAAE;gBACrC,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;gBACjC,MAAM,CAAC,OAAO;oBACZ,+DAA+D,CAAC;gBAClE,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC;gBAC/B,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAC1C,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,gCAAgC;QAC9B,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,CAAC,OAAO,GAAG,+CAA+C,CAAC;QACjE,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,MAAM,CAAC,oBAAoB,GAAG,KAAK,CAAC;QACpC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;YAC1B,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBT,CAAC;IACJ,CAAC;CACF,CAAA;AApWS;IADP,KAAK,CAAC,eAAe,CAAC;6CACa;AAFzB,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAsWnB","sourcesContent":["import { css, html, LitElement, type CSSResultGroup } from 'lit';\nimport { customElement, query } from 'lit/decorators.js';\nimport { ModalConfig } from '../src/modal-config';\nimport { ModalManager } from '../src/modal-manager';\nimport '../src/modal-manager';\n\n@customElement('app-root')\nexport class AppRoot extends LitElement {\n @query('modal-manager')\n private modalManager!: ModalManager;\n\n protected render() {\n return html`\n <modal-manager>\n <div slot=\"slot-content-demo\">\n <p>Slotted Content</p>\n </div>\n </modal-manager>\n\n <div class=\"actions\">\n <button @click=${this.showModal}>Modal</button>\n <button @click=${this.showAllFeaturesModal}>All Features</button>\n <button @click=${this.showErrorModal}>Error Modal</button>\n <button @click=${this.showCustomContentModal}>\n Custom Content Modal\n </button>\n <button @click=${this.showSlottedContentModal}>\n Slotted Content Modal\n </button>\n <button @click=${this.showProcessingModal}>Processing Modal</button>\n <button @click=${this.showCompleteModal}>\n Processing Complete Modal\n </button>\n <button @click=${this.showUserClosedModalCallbackModal}>\n Modal Closed Callback\n </button>\n <button @click=${this.showModalUserCannotClose}>\n Unclosable Modal\n </button>\n <button @click=${this.showModalUserCannotClickBackdrop}>\n Unclickable Backdrop\n </button>\n <button @click=${this.showOverflowModal}>Text-heavy Modal</button>\n <button @click=${this.showModalWithoutLogo}>Modal Without Logo</button>\n <button @click=${this.showModalWithLeftNavButton}>\n Modal With Left Nav Button\n </button>\n </div>\n\n <h3>Some Content</h3>\n\n <img src=\"./assets/images/200x200.jpg\" style=\"float:right\" />\n\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris posuere\n sollicitudin aliquam. Aenean vel felis arcu. Maecenas convallis dolor ac\n tortor tristique, congue scelerisque turpis congue. Vestibulum porttitor\n scelerisque quam, sit amet porta tortor consectetur non. Cras\n sollicitudin sit amet lacus ac egestas. Nam sollicitudin sem at sagittis\n laoreet. Donec nec nisl erat. Curabitur interdum in enim vehicula\n aliquam. Pellentesque habitant morbi tristique senectus et netus et\n malesuada fames ac turpis egestas. Fusce tempus sit amet tortor laoreet\n volutpat. Vivamus non vehicula felis, aliquet hendrerit odio.\n </p>\n\n <p>\n In laoreet scelerisque tortor, at convallis nisl efficitur vehicula.\n Donec eu erat a turpis fermentum blandit vitae ut erat. Mauris tincidunt\n erat sit amet ante suscipit porta. Fusce mollis metus sit amet erat\n condimentum, eu maximus lacus aliquam. Sed cursus lacus eget sem commodo\n feugiat. Praesent semper lorem eu sollicitudin blandit. Sed id risus in\n lacus fermentum tristique. In porttitor malesuada sapien non posuere.\n Phasellus mollis mauris ultrices est consectetur, id pulvinar magna\n suscipit. Integer sodales sapien in augue tincidunt, ac tempor ligula\n cursus. Mauris id justo et dui blandit luctus. Morbi mattis id metus id\n maximus. Suspendisse quis lobortis erat, sed dignissim neque. Etiam\n cursus posuere ultricies.\n </p>\n\n <p>\n Maecenas porta ac nulla sed vestibulum. Suspendisse aliquam fermentum\n mi, id luctus tortor aliquet gravida. Maecenas sed tincidunt quam.\n Mauris cursus ante sit amet enim egestas, vitae pellentesque metus\n hendrerit. Sed quis tortor id dui mollis blandit quis ac nunc.\n Suspendisse tincidunt nisl quis nunc tincidunt, et finibus ipsum\n elementum. Maecenas congue, neque eget volutpat pulvinar, augue nisl\n interdum elit, et porta mi augue ut sapien.\n </p>\n\n <p>\n Fusce vel imperdiet justo. Aenean sollicitudin blandit nunc. Cras vitae\n orci id lorem condimentum tempor. Aliquam ac lectus sed mi suscipit\n sollicitudin at convallis nisl. Sed semper elementum sagittis. Nam\n fermentum nulla velit, non tempor massa fermentum non. Duis id ante eget\n elit gravida semper ac quis ligula. Duis vel libero ligula. Curabitur\n tempor sed velit nec egestas. Vivamus sit amet volutpat purus. Integer\n imperdiet mattis erat, vitae dignissim odio accumsan quis. Fusce\n bibendum lectus quis est molestie, eget scelerisque elit interdum. Etiam\n imperdiet a leo vitae ultricies. Etiam pretium quam eget sem mollis,\n quis elementum libero vulputate. Praesent aliquet dictum augue a luctus.\n </p>\n\n <p>\n Maecenas vulputate iaculis mauris nec lobortis. Sed nibh ante, vehicula\n nec varius et, condimentum in massa. Curabitur a turpis porta, auctor\n magna in, iaculis ante. Suspendisse potenti. Donec massa orci,\n sollicitudin in nulla ut, fringilla dignissim elit. Suspendisse\n porttitor lorem nec sem volutpat ullamcorper. Curabitur blandit est\n tristique velit pharetra rhoncus. Aliquam vitae mauris ex.\n </p>\n `;\n }\n\n showModal() {\n const config = new ModalConfig();\n config.headline = 'Success';\n config.message = 'Thank you for your support!';\n\n this.modalManager.showModal({\n config,\n });\n }\n\n showErrorModal() {\n const config = new ModalConfig();\n config.headline = 'Error';\n config.message = 'An error occurred while processing your donation.';\n config.headerColor = '#691916';\n config.bodyColor = '#fff';\n\n this.modalManager.showModal({\n config,\n });\n }\n\n showBillAlert() {\n alert('Bill <3 You');\n }\n\n buttonPress() {\n alert('You pressed a button.');\n }\n\n showAllFeaturesModal() {\n const config = new ModalConfig();\n config.title = html`Donation Received`;\n config.subtitle = html`Thanks a bunch!`;\n config.headline = html`A Headline that catches attention and might spill\n over to multiple lines!`;\n config.message = html`A long informative message for your users that let\n them know about something`;\n config.headerColor = 'purple';\n config.showProcessingIndicator = true;\n config.processingImageMode = 'complete';\n\n const someContent = html`\n <div style=\"text-align: center; margin-top: 10px;\">\n <button @click=${this.buttonPress}>I'm A Button To Press</button>\n </div>\n `;\n\n this.modalManager.showModal({\n config,\n customModalContent: someContent,\n });\n }\n\n showCustomContentModal() {\n const config = new ModalConfig();\n config.title = 'Custom Content';\n config.headline = html`<span class=\"sr-only\"\n >Also support screen-reader only</span\n >`;\n\n const someContent = html`\n <style>\n a:focus {\n outline: 2px solid blue;\n }\n </style>\n Can contain any markup, including web components. Event listeners also\n work. Try clicking on the picture.\n <span class=\"sr-only\">Also support screen-reader only</span>\n <div style=\"text-align: center\">\n <a href=\"https://www.billmurraystory.com/\" style=\"display: block;\"\n >Bill Murray Stories</a\n >\n <img src=\"./assets/images/100x100.jpg\" @click=${this.showBillAlert} />\n </div>\n `;\n\n this.modalManager.showModal({\n config,\n customModalContent: someContent,\n });\n }\n\n showSlottedContentModal() {\n const config = new ModalConfig();\n config.title = 'Slotted Content';\n\n const someContent = html`\n Can slot content from the top-level:\n <slot name=\"slot-content-demo\"></slot>\n `;\n\n this.modalManager.showModal({\n config,\n customModalContent: someContent,\n });\n }\n\n showOverflowModal() {\n const config = new ModalConfig();\n\n config.title = html`Lorem Ipsum`;\n config.subtitle = html`Subtitle`;\n config.headline = html`Everything Important`;\n config.message = html`\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris posuere\n sollicitudin aliquam. Aenean vel felis arcu. Maecenas convallis dolor ac\n tortor tristique, congue scelerisque turpis congue. Vestibulum porttitor\n scelerisque quam, sit amet porta tortor consectetur non. Cras\n sollicitudin sit amet lacus ac egestas. Nam sollicitudin sem at sagittis\n laoreet. Donec nec nisl erat. Curabitur interdum in enim vehicula\n aliquam. Pellentesque habitant morbi tristique senectus et netus et\n malesuada fames ac turpis egestas. Fusce tempus sit amet tortor laoreet\n volutpat. Vivamus non vehicula felis, aliquet hendrerit odio.\n </p>\n\n <p>\n In laoreet scelerisque tortor, at convallis nisl efficitur vehicula.\n Donec eu erat a turpis fermentum blandit vitae ut erat. Mauris tincidunt\n erat sit amet ante suscipit porta. Fusce mollis metus sit amet erat\n condimentum, eu maximus lacus aliquam. Sed cursus lacus eget sem commodo\n feugiat. Praesent semper lorem eu sollicitudin blandit. Sed id risus in\n lacus fermentum tristique. In porttitor malesuada sapien non posuere.\n Phasellus mollis mauris ultrices est consectetur, id pulvinar magna\n suscipit. Integer sodales sapien in augue tincidunt, ac tempor ligula\n cursus. Mauris id justo et dui blandit luctus. Morbi mattis id metus id\n maximus. Suspendisse quis lobortis erat, sed dignissim neque. Etiam\n cursus posuere ultricies.\n </p>\n `;\n\n config.headerColor = '#36A483';\n\n this.modalManager.showModal({\n config,\n });\n }\n\n showModalWithoutLogo() {\n const config = new ModalConfig();\n config.headline = 'Success';\n config.title = html`Donation Received`;\n config.message = 'Thank you for your support!';\n config.headerColor = '#194880';\n config.showHeaderLogo = false;\n this.modalManager.showModal({\n config,\n });\n }\n\n showCompleteModal() {\n const config = new ModalConfig();\n config.showProcessingIndicator = true;\n config.processingImageMode = 'complete';\n this.modalManager.showModal({\n config,\n });\n }\n\n showProcessingModal() {\n const config = new ModalConfig();\n config.headerColor = '#497fbf';\n config.showProcessingIndicator = true;\n config.processingImageMode = 'processing';\n config.showCloseButton = false;\n config.closeOnBackdropClick = false;\n this.modalManager.showModal({\n config,\n });\n\n setTimeout(this.showCompleteModal.bind(this), 1500);\n }\n\n showUserClosedModalCallbackModal() {\n const config = new ModalConfig();\n config.message = 'When you close this modal another will open.';\n\n this.modalManager.showModal({\n config,\n userClosedModalCallback: () => {\n const config = new ModalConfig();\n config.message = \"I'm another modal\";\n config.headerColor = '#497fbf';\n this.modalManager.showModal({ config });\n },\n });\n }\n\n showModalUserCannotClose() {\n const config = new ModalConfig();\n config.message =\n 'User cannot close this. Will close automatically in 2 seconds.';\n config.showCloseButton = false;\n config.closeOnBackdropClick = false;\n this.modalManager.showModal({\n config,\n });\n\n setTimeout(this.modalManager.closeModal.bind(this.modalManager), 2000);\n }\n\n showModalWithLeftNavButton() {\n const config = new ModalConfig();\n config.message = 'This modal has a left nav button.';\n config.showLeftNavButton = true;\n config.leftNavButtonText = 'Back';\n\n this.modalManager.showModal({\n config,\n userPressedLeftNavButtonCallback: () => {\n const config = new ModalConfig();\n config.message =\n \"I'm the previous modal (or anything else you want to do here)\";\n config.headerColor = '#497fbf';\n this.modalManager.showModal({ config });\n },\n });\n }\n\n showModalUserCannotClickBackdrop() {\n const config = new ModalConfig();\n config.message = 'Clicking on the backdrop will not close this.';\n config.showCloseButton = true;\n config.closeOnBackdropClick = false;\n this.modalManager.showModal({\n config,\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n modal-manager {\n display: none;\n --modalTitleLineHeight: 4.5rem;\n }\n\n modal-manager[mode='open'] {\n display: block;\n }\n\n .actions {\n position: fixed;\n background-color: rgba(255, 255, 255, 0.9);\n border: 1px solid black;\n padding: 10px;\n top: 10px;\n left: 10px;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../demo/app-root.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,sBAAsB,CAAC;AAGvB,IAAM,OAAO,GAAb,MAAM,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,CAAC,CAAC;IACzE,CAAC;IAEO,0BAA0B;QAChC,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA,mCAAmC,CAAC;QACzD,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAChC,MAAM,CAAC,iBAAiB,GAAG,MAAM,CAAC;QAElC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;YAC1B,MAAM;YACN,gCAAgC,EAAE,GAAG,EAAE;gBACrC,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;gBACjC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;oBACT,CAAC;gBACb,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC;gBAC/B,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAC1C,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEO,gCAAgC;QACtC,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA,+CAA+C,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,MAAM,CAAC,oBAAoB,GAAG,KAAK,CAAC;QACpC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;YAC1B,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBT,CAAC;IACJ,CAAC;CACF,CAAA;AApWS;IADP,KAAK,CAAC,eAAe,CAAC;6CACa;AAFzB,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAsWnB","sourcesContent":["import { css, html, LitElement, type CSSResultGroup } from 'lit';\nimport { customElement, query } from 'lit/decorators.js';\nimport { ModalConfig } from '../src/modal-config';\nimport { ModalManager } from '../src/modal-manager';\nimport '../src/modal-manager';\n\n@customElement('app-root')\nexport class AppRoot extends LitElement {\n @query('modal-manager')\n private modalManager!: ModalManager;\n\n protected render() {\n return html`\n <modal-manager>\n <div slot=\"slot-content-demo\">\n <p>Slotted Content</p>\n </div>\n </modal-manager>\n\n <div class=\"actions\">\n <button @click=${this.showModal}>Modal</button>\n <button @click=${this.showAllFeaturesModal}>All Features</button>\n <button @click=${this.showErrorModal}>Error Modal</button>\n <button @click=${this.showCustomContentModal}>\n Custom Content Modal\n </button>\n <button @click=${this.showSlottedContentModal}>\n Slotted Content Modal\n </button>\n <button @click=${this.showProcessingModal}>Processing Modal</button>\n <button @click=${this.showCompleteModal}>\n Processing Complete Modal\n </button>\n <button @click=${this.showUserClosedModalCallbackModal}>\n Modal Closed Callback\n </button>\n <button @click=${this.showModalUserCannotClose}>\n Unclosable Modal\n </button>\n <button @click=${this.showModalUserCannotClickBackdrop}>\n Unclickable Backdrop\n </button>\n <button @click=${this.showOverflowModal}>Text-heavy Modal</button>\n <button @click=${this.showModalWithoutLogo}>Modal Without Logo</button>\n <button @click=${this.showModalWithLeftNavButton}>\n Modal With Left Nav Button\n </button>\n </div>\n\n <h3>Some Content</h3>\n\n <img src=\"./assets/images/200x200.jpg\" style=\"float:right\" />\n\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris posuere\n sollicitudin aliquam. Aenean vel felis arcu. Maecenas convallis dolor ac\n tortor tristique, congue scelerisque turpis congue. Vestibulum porttitor\n scelerisque quam, sit amet porta tortor consectetur non. Cras\n sollicitudin sit amet lacus ac egestas. Nam sollicitudin sem at sagittis\n laoreet. Donec nec nisl erat. Curabitur interdum in enim vehicula\n aliquam. Pellentesque habitant morbi tristique senectus et netus et\n malesuada fames ac turpis egestas. Fusce tempus sit amet tortor laoreet\n volutpat. Vivamus non vehicula felis, aliquet hendrerit odio.\n </p>\n\n <p>\n In laoreet scelerisque tortor, at convallis nisl efficitur vehicula.\n Donec eu erat a turpis fermentum blandit vitae ut erat. Mauris tincidunt\n erat sit amet ante suscipit porta. Fusce mollis metus sit amet erat\n condimentum, eu maximus lacus aliquam. Sed cursus lacus eget sem commodo\n feugiat. Praesent semper lorem eu sollicitudin blandit. Sed id risus in\n lacus fermentum tristique. In porttitor malesuada sapien non posuere.\n Phasellus mollis mauris ultrices est consectetur, id pulvinar magna\n suscipit. Integer sodales sapien in augue tincidunt, ac tempor ligula\n cursus. Mauris id justo et dui blandit luctus. Morbi mattis id metus id\n maximus. Suspendisse quis lobortis erat, sed dignissim neque. Etiam\n cursus posuere ultricies.\n </p>\n\n <p>\n Maecenas porta ac nulla sed vestibulum. Suspendisse aliquam fermentum\n mi, id luctus tortor aliquet gravida. Maecenas sed tincidunt quam.\n Mauris cursus ante sit amet enim egestas, vitae pellentesque metus\n hendrerit. Sed quis tortor id dui mollis blandit quis ac nunc.\n Suspendisse tincidunt nisl quis nunc tincidunt, et finibus ipsum\n elementum. Maecenas congue, neque eget volutpat pulvinar, augue nisl\n interdum elit, et porta mi augue ut sapien.\n </p>\n\n <p>\n Fusce vel imperdiet justo. Aenean sollicitudin blandit nunc. Cras vitae\n orci id lorem condimentum tempor. Aliquam ac lectus sed mi suscipit\n sollicitudin at convallis nisl. Sed semper elementum sagittis. Nam\n fermentum nulla velit, non tempor massa fermentum non. Duis id ante eget\n elit gravida semper ac quis ligula. Duis vel libero ligula. Curabitur\n tempor sed velit nec egestas. Vivamus sit amet volutpat purus. Integer\n imperdiet mattis erat, vitae dignissim odio accumsan quis. Fusce\n bibendum lectus quis est molestie, eget scelerisque elit interdum. Etiam\n imperdiet a leo vitae ultricies. Etiam pretium quam eget sem mollis,\n quis elementum libero vulputate. Praesent aliquet dictum augue a luctus.\n </p>\n\n <p>\n Maecenas vulputate iaculis mauris nec lobortis. Sed nibh ante, vehicula\n nec varius et, condimentum in massa. Curabitur a turpis porta, auctor\n magna in, iaculis ante. Suspendisse potenti. Donec massa orci,\n sollicitudin in nulla ut, fringilla dignissim elit. Suspendisse\n porttitor lorem nec sem volutpat ullamcorper. Curabitur blandit est\n tristique velit pharetra rhoncus. Aliquam vitae mauris ex.\n </p>\n `;\n }\n\n private showModal() {\n const config = new ModalConfig();\n config.headline = html`Success`;\n config.message = html`Thank you for your support!`;\n\n this.modalManager.showModal({\n config,\n });\n }\n\n private showErrorModal() {\n const config = new ModalConfig();\n config.headline = html`Error`;\n config.message = html`An error occurred while processing your donation.`;\n config.headerColor = '#691916';\n config.bodyColor = '#fff';\n\n this.modalManager.showModal({\n config,\n });\n }\n\n private showBillAlert() {\n alert('Bill <3 You');\n }\n\n private buttonPress() {\n alert('You pressed a button.');\n }\n\n private showAllFeaturesModal() {\n const config = new ModalConfig();\n config.title = html`Donation Received`;\n config.subtitle = html`Thanks a bunch!`;\n config.headline = html`A Headline that catches attention and might spill\n over to multiple lines!`;\n config.message = html`A long informative message for your users that let\n them know about something`;\n config.headerColor = 'purple';\n config.showProcessingIndicator = true;\n config.processingImageMode = 'complete';\n\n const someContent = html`\n <div style=\"text-align: center; margin-top: 10px;\">\n <button @click=${this.buttonPress}>I'm A Button To Press</button>\n </div>\n `;\n\n this.modalManager.showModal({\n config,\n customModalContent: someContent,\n });\n }\n\n private showCustomContentModal() {\n const config = new ModalConfig();\n config.title = html`Custom Content`;\n config.headline = html`<span class=\"sr-only\"\n >Also support screen-reader only</span\n >`;\n\n const someContent = html`\n <style>\n a:focus {\n outline: 2px solid blue;\n }\n </style>\n Can contain any markup, including web components. Event listeners also\n work. Try clicking on the picture.\n <span class=\"sr-only\">Also support screen-reader only</span>\n <div style=\"text-align: center\">\n <a href=\"https://www.billmurraystory.com/\" style=\"display: block;\"\n >Bill Murray Stories</a\n >\n <img src=\"./assets/images/100x100.jpg\" @click=${this.showBillAlert} />\n </div>\n `;\n\n this.modalManager.showModal({\n config,\n customModalContent: someContent,\n });\n }\n\n private showSlottedContentModal() {\n const config = new ModalConfig();\n config.title = html`Slotted Content`;\n\n const someContent = html`\n Can slot content from the top-level:\n <slot name=\"slot-content-demo\"></slot>\n `;\n\n this.modalManager.showModal({\n config,\n customModalContent: someContent,\n });\n }\n\n private showOverflowModal() {\n const config = new ModalConfig();\n\n config.title = html`Lorem Ipsum`;\n config.subtitle = html`Subtitle`;\n config.headline = html`Everything Important`;\n config.message = html`\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris posuere\n sollicitudin aliquam. Aenean vel felis arcu. Maecenas convallis dolor ac\n tortor tristique, congue scelerisque turpis congue. Vestibulum porttitor\n scelerisque quam, sit amet porta tortor consectetur non. Cras\n sollicitudin sit amet lacus ac egestas. Nam sollicitudin sem at sagittis\n laoreet. Donec nec nisl erat. Curabitur interdum in enim vehicula\n aliquam. Pellentesque habitant morbi tristique senectus et netus et\n malesuada fames ac turpis egestas. Fusce tempus sit amet tortor laoreet\n volutpat. Vivamus non vehicula felis, aliquet hendrerit odio.\n </p>\n\n <p>\n In laoreet scelerisque tortor, at convallis nisl efficitur vehicula.\n Donec eu erat a turpis fermentum blandit vitae ut erat. Mauris tincidunt\n erat sit amet ante suscipit porta. Fusce mollis metus sit amet erat\n condimentum, eu maximus lacus aliquam. Sed cursus lacus eget sem commodo\n feugiat. Praesent semper lorem eu sollicitudin blandit. Sed id risus in\n lacus fermentum tristique. In porttitor malesuada sapien non posuere.\n Phasellus mollis mauris ultrices est consectetur, id pulvinar magna\n suscipit. Integer sodales sapien in augue tincidunt, ac tempor ligula\n cursus. Mauris id justo et dui blandit luctus. Morbi mattis id metus id\n maximus. Suspendisse quis lobortis erat, sed dignissim neque. Etiam\n cursus posuere ultricies.\n </p>\n `;\n\n config.headerColor = '#36A483';\n\n this.modalManager.showModal({\n config,\n });\n }\n\n private showModalWithoutLogo() {\n const config = new ModalConfig();\n config.headline = html`Success`;\n config.title = html`Donation Received`;\n config.message = html`Thank you for your support!`;\n config.headerColor = '#194880';\n config.showHeaderLogo = false;\n this.modalManager.showModal({\n config,\n });\n }\n\n private showCompleteModal() {\n const config = new ModalConfig();\n config.showProcessingIndicator = true;\n config.processingImageMode = 'complete';\n this.modalManager.showModal({\n config,\n });\n }\n\n private showProcessingModal() {\n const config = new ModalConfig();\n config.headerColor = '#497fbf';\n config.showProcessingIndicator = true;\n config.processingImageMode = 'processing';\n config.showCloseButton = false;\n config.closeOnBackdropClick = false;\n this.modalManager.showModal({\n config,\n });\n\n setTimeout(this.showCompleteModal.bind(this), 1500);\n }\n\n private showUserClosedModalCallbackModal() {\n const config = new ModalConfig();\n config.message = html`When you close this modal another will open.`;\n\n this.modalManager.showModal({\n config,\n userClosedModalCallback: () => {\n const config = new ModalConfig();\n config.message = html`I'm another modal`;\n config.headerColor = '#497fbf';\n this.modalManager.showModal({ config });\n },\n });\n }\n\n private showModalUserCannotClose() {\n const config = new ModalConfig();\n config.message = html`User cannot close this. Will close automatically in 2\n seconds.`;\n config.showCloseButton = false;\n config.closeOnBackdropClick = false;\n this.modalManager.showModal({\n config,\n });\n\n setTimeout(this.modalManager.closeModal.bind(this.modalManager), 2000);\n }\n\n private showModalWithLeftNavButton() {\n const config = new ModalConfig();\n config.message = html`This modal has a left nav button.`;\n config.showLeftNavButton = true;\n config.leftNavButtonText = 'Back';\n\n this.modalManager.showModal({\n config,\n userPressedLeftNavButtonCallback: () => {\n const config = new ModalConfig();\n config.message = html`I'm the previous modal (or anything else you want\n to do here)`;\n config.headerColor = '#497fbf';\n this.modalManager.showModal({ config });\n },\n });\n }\n\n private showModalUserCannotClickBackdrop() {\n const config = new ModalConfig();\n config.message = html`Clicking on the backdrop will not close this.`;\n config.showCloseButton = true;\n config.closeOnBackdropClick = false;\n this.modalManager.showModal({\n config,\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n modal-manager {\n display: none;\n --modalTitleLineHeight: 4.5rem;\n }\n\n modal-manager[mode='open'] {\n display: block;\n }\n\n .actions {\n position: fixed;\n background-color: rgba(255, 255, 255, 0.9);\n border: 1px solid black;\n padding: 10px;\n top: 10px;\n left: 10px;\n }\n `;\n }\n}\n"]}
@@ -9,31 +9,31 @@ export declare class ModalConfig {
9
9
  /**
10
10
  * The title that shows in the header
11
11
  *
12
- * @type {(TemplateResult | string | undefined)}
12
+ * @type {(TemplateResult | undefined)}
13
13
  * @memberof ModalConfig
14
14
  */
15
- title?: TemplateResult | string;
15
+ title?: TemplateResult;
16
16
  /**
17
17
  * The subtitle shown in the header under the title
18
18
  *
19
- * @type {(TemplateResult | string | undefined)}
19
+ * @type {(TemplateResult | undefined)}
20
20
  * @memberof ModalConfig
21
21
  */
22
- subtitle?: TemplateResult | string;
22
+ subtitle?: TemplateResult;
23
23
  /**
24
24
  * The headline shown at the top of the content section
25
25
  *
26
- * @type {(TemplateResult | string | undefined)}
26
+ * @type {(TemplateResult | undefined)}
27
27
  * @memberof ModalConfig
28
28
  */
29
- headline?: TemplateResult | string;
29
+ headline?: TemplateResult;
30
30
  /**
31
31
  * The text shown below the headline in the content section
32
32
  *
33
- * @type {(TemplateResult | string | undefined)}
33
+ * @type {(TemplateResult | undefined)}
34
34
  * @memberof ModalConfig
35
35
  */
36
- message?: TemplateResult | string;
36
+ message?: TemplateResult;
37
37
  /**
38
38
  * The background color of the header
39
39
  *
@@ -87,10 +87,10 @@ export declare class ModalConfig {
87
87
  */
88
88
  closeOnBackdropClick: boolean;
89
89
  constructor(options?: {
90
- title?: TemplateResult | string;
91
- subtitle?: TemplateResult | string;
92
- headline?: TemplateResult | string;
93
- message?: TemplateResult | string;
90
+ title?: TemplateResult;
91
+ subtitle?: TemplateResult;
92
+ headline?: TemplateResult;
93
+ message?: TemplateResult;
94
94
  headerColor?: string;
95
95
  bodyColor?: string;
96
96
  showProcessingIndicator?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"modal-config.js","sourceRoot":"","sources":["../../src/modal-config.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IA8FtB,YAAY,OAcX;QACC,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;QAEhC,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,SAAS,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,SAAS,CAAC;QACjD,IAAI,CAAC,uBAAuB,GAAG,OAAO,EAAE,uBAAuB,IAAI,KAAK,CAAC;QACzE,IAAI,CAAC,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,IAAI,UAAU,CAAC;QACtE,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,eAAe,IAAI,IAAI,CAAC;QACxD,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,KAAK,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,EAAE,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;QACtD,IAAI,CAAC,oBAAoB,GAAG,OAAO,EAAE,oBAAoB,IAAI,IAAI,CAAC;IACpE,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit';\n\n/**\n * Configuration to show a modal\n *\n * @export\n * @class ModalConfig\n */\nexport class ModalConfig {\n /**\n * The title that shows in the header\n *\n * @type {(TemplateResult | string | undefined)}\n * @memberof ModalConfig\n */\n title?: TemplateResult | string;\n\n /**\n * The subtitle shown in the header under the title\n *\n * @type {(TemplateResult | string | undefined)}\n * @memberof ModalConfig\n */\n subtitle?: TemplateResult | string;\n\n /**\n * The headline shown at the top of the content section\n *\n * @type {(TemplateResult | string | undefined)}\n * @memberof ModalConfig\n */\n headline?: TemplateResult | string;\n\n /**\n * The text shown below the headline in the content section\n *\n * @type {(TemplateResult | string | undefined)}\n * @memberof ModalConfig\n */\n message?: TemplateResult | string;\n\n /**\n * The background color of the header\n *\n * @memberof ModalConfig\n */\n headerColor: string;\n\n /**\n * The background color of the body\n *\n * @memberof ModalConfig\n */\n bodyColor: string;\n\n /**\n * Show or hide the processing indicator\n *\n * @memberof ModalConfig\n */\n showProcessingIndicator: boolean;\n\n /**\n * Set the processing image mode\n *\n * @memberof ModalConfig\n */\n processingImageMode: 'processing' | 'complete';\n\n /**\n * Show the close button\n *\n * @memberof ModalConfig\n */\n showCloseButton: boolean;\n\n /**\n * Show the left nav button\n *\n * @memberof ModalConfig\n */\n showLeftNavButton: boolean;\n\n /**\n * Left nav button text\n */\n leftNavButtonText: string;\n\n /**\n * Show the close button\n *\n * @memberof ModalConfig\n */\n showHeaderLogo: boolean;\n\n /**\n * Close the modal if the user taps on the background\n *\n * @memberof ModalConfig\n */\n closeOnBackdropClick: boolean;\n\n constructor(options?: {\n title?: TemplateResult | string;\n subtitle?: TemplateResult | string;\n headline?: TemplateResult | string;\n message?: TemplateResult | string;\n headerColor?: string;\n bodyColor?: string;\n showProcessingIndicator?: boolean;\n processingImageMode?: 'processing' | 'complete';\n showCloseButton?: boolean;\n showLeftNavButton?: boolean;\n leftNavButtonText?: string;\n showHeaderLogo?: boolean;\n closeOnBackdropClick?: boolean;\n }) {\n this.title = options?.title;\n this.subtitle = options?.subtitle;\n this.headline = options?.headline;\n this.message = options?.message;\n\n this.headerColor = options?.headerColor ?? '#55A183';\n this.bodyColor = options?.bodyColor ?? '#fbfbfd';\n this.showProcessingIndicator = options?.showProcessingIndicator ?? false;\n this.processingImageMode = options?.processingImageMode ?? 'complete';\n this.showCloseButton = options?.showCloseButton ?? true;\n this.showLeftNavButton = options?.showLeftNavButton ?? false;\n this.leftNavButtonText = options?.leftNavButtonText ?? '';\n this.showHeaderLogo = options?.showHeaderLogo ?? true;\n this.closeOnBackdropClick = options?.closeOnBackdropClick ?? true;\n }\n}\n"]}
1
+ {"version":3,"file":"modal-config.js","sourceRoot":"","sources":["../../src/modal-config.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IA8FtB,YAAY,OAcX;QACC,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;QAEhC,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,SAAS,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,SAAS,CAAC;QACjD,IAAI,CAAC,uBAAuB,GAAG,OAAO,EAAE,uBAAuB,IAAI,KAAK,CAAC;QACzE,IAAI,CAAC,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,IAAI,UAAU,CAAC;QACtE,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,eAAe,IAAI,IAAI,CAAC;QACxD,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,KAAK,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,EAAE,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;QACtD,IAAI,CAAC,oBAAoB,GAAG,OAAO,EAAE,oBAAoB,IAAI,IAAI,CAAC;IACpE,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit';\n\n/**\n * Configuration to show a modal\n *\n * @export\n * @class ModalConfig\n */\nexport class ModalConfig {\n /**\n * The title that shows in the header\n *\n * @type {(TemplateResult | undefined)}\n * @memberof ModalConfig\n */\n title?: TemplateResult;\n\n /**\n * The subtitle shown in the header under the title\n *\n * @type {(TemplateResult | undefined)}\n * @memberof ModalConfig\n */\n subtitle?: TemplateResult;\n\n /**\n * The headline shown at the top of the content section\n *\n * @type {(TemplateResult | undefined)}\n * @memberof ModalConfig\n */\n headline?: TemplateResult;\n\n /**\n * The text shown below the headline in the content section\n *\n * @type {(TemplateResult | undefined)}\n * @memberof ModalConfig\n */\n message?: TemplateResult;\n\n /**\n * The background color of the header\n *\n * @memberof ModalConfig\n */\n headerColor: string;\n\n /**\n * The background color of the body\n *\n * @memberof ModalConfig\n */\n bodyColor: string;\n\n /**\n * Show or hide the processing indicator\n *\n * @memberof ModalConfig\n */\n showProcessingIndicator: boolean;\n\n /**\n * Set the processing image mode\n *\n * @memberof ModalConfig\n */\n processingImageMode: 'processing' | 'complete';\n\n /**\n * Show the close button\n *\n * @memberof ModalConfig\n */\n showCloseButton: boolean;\n\n /**\n * Show the left nav button\n *\n * @memberof ModalConfig\n */\n showLeftNavButton: boolean;\n\n /**\n * Left nav button text\n */\n leftNavButtonText: string;\n\n /**\n * Show the close button\n *\n * @memberof ModalConfig\n */\n showHeaderLogo: boolean;\n\n /**\n * Close the modal if the user taps on the background\n *\n * @memberof ModalConfig\n */\n closeOnBackdropClick: boolean;\n\n constructor(options?: {\n title?: TemplateResult;\n subtitle?: TemplateResult;\n headline?: TemplateResult;\n message?: TemplateResult;\n headerColor?: string;\n bodyColor?: string;\n showProcessingIndicator?: boolean;\n processingImageMode?: 'processing' | 'complete';\n showCloseButton?: boolean;\n showLeftNavButton?: boolean;\n leftNavButtonText?: string;\n showHeaderLogo?: boolean;\n closeOnBackdropClick?: boolean;\n }) {\n this.title = options?.title;\n this.subtitle = options?.subtitle;\n this.headline = options?.headline;\n this.message = options?.message;\n\n this.headerColor = options?.headerColor ?? '#55A183';\n this.bodyColor = options?.bodyColor ?? '#fbfbfd';\n this.showProcessingIndicator = options?.showProcessingIndicator ?? false;\n this.processingImageMode = options?.processingImageMode ?? 'complete';\n this.showCloseButton = options?.showCloseButton ?? true;\n this.showLeftNavButton = options?.showLeftNavButton ?? false;\n this.leftNavButtonText = options?.leftNavButtonText ?? '';\n this.showHeaderLogo = options?.showHeaderLogo ?? true;\n this.closeOnBackdropClick = options?.closeOnBackdropClick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AC,eAAe,CAAC;GAClB,YAAY,CA0RxB","sourcesContent":["import {\n LitElement,\n html,\n css,\n CSSResult,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { property, customElement, query } from 'lit/decorators.js';\n\nimport Modal from './shoelace/modal';\nimport { getDeepestActiveElement } from './shoelace/active-elements';\n\nimport './modal-template';\nimport { ModalTemplate } from './modal-template';\nimport { ModalConfig } from './modal-config';\nimport { ModalManagerHostBridge } from './modal-manager-host-bridge';\nimport { ModalManagerInterface } from './modal-manager-interface';\nimport { ModalManagerHostBridgeInterface } from './modal-manager-host-bridge-interface';\nimport { ModalManagerMode } from './modal-manager-mode';\n\n@customElement('modal-manager')\nexport class ModalManager extends LitElement implements ModalManagerInterface {\n /**\n * The current mode of the ModalManager\n *\n * Current options are `modal` or `closed`\n *\n * @type {ModalManagerMode}\n * @memberof ModalManager\n */\n @property({ type: String, reflect: true }) mode: ModalManagerMode =\n ModalManagerMode.Closed;\n\n /**\n * Custom content to display in the modal's content slot\n *\n * @type {(TemplateResult | undefined)}\n * @memberof ModalManager\n */\n @property({ type: Object }) customModalContent?: TemplateResult;\n\n /**\n * This hostBridge handles environmental-specific interactions such as adding classes\n * to the body tag or event listeners needed to support the modal manager in the host environment.\n *\n * There is a default `ModalManagerHostBridge`, but consumers can override it with a custom\n * `ModalManagerHostBridgeInterface`\n *\n * @type {ModalManagerHostBridgeInterface}\n * @memberof ModalManager\n */\n @property({ type: Object })\n hostBridge: ModalManagerHostBridgeInterface = new ModalManagerHostBridge(\n this,\n );\n\n /**\n * Reference to the ModalTemplate DOM element\n *\n * @private\n * @type {ModalTemplate}\n * @memberof ModalManager\n */\n @query('modal-template') private modalTemplate?: ModalTemplate;\n\n // Imported tab handling from shoelace\n public modal = new Modal(this);\n\n async firstUpdated(): Promise<void> {\n // Give the browser a chance to paint\n\n await new Promise((r) => setTimeout(r, 0));\n\n if (this.closeOnBackdropClick) {\n this.addEventListener('keydown', (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.backdropClicked();\n }\n });\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.modal.deactivate();\n }\n\n /** @inheritdoc */\n render(): TemplateResult {\n return html`\n <div class=\"container\">\n <div class=\"backdrop\" @click=${this.backdropClicked}></div>\n <modal-template\n @closeButtonPressed=${this.closeButtonPressed}\n @leftNavButtonPressed=${this.callUserPressedLeftNavButtonCallback}\n tabindex=\"-1\"\n >\n ${this.customModalContent}\n </modal-template>\n </div>\n `;\n }\n\n /** @inheritdoc */\n getMode(): ModalManagerMode {\n return this.mode;\n }\n\n /** @inheritdoc */\n closeModal(): void {\n this.mode = ModalManagerMode.Closed;\n this.customModalContent = undefined;\n if (this.modalTemplate) this.modalTemplate.config = new ModalConfig();\n this.modal.deactivate();\n\n // Return focus to the triggering element, if possible\n (this.triggeringElement as HTMLElement)?.focus?.();\n this.triggeringElement = undefined;\n }\n\n /**\n * Whether the modal should close if the user taps on the backdrop\n *\n * @private\n * @memberof ModalManager\n */\n private closeOnBackdropClick = true;\n\n /**\n * The element that had focus when the modal was opened, so that we can return focus\n * to it after the modal closes.\n */\n private triggeringElement?: Element;\n\n /**\n * A callback if the user closes the modal\n *\n * @private\n * @memberof ModalManager\n */\n private userClosedModalCallback?: () => void;\n\n /**\n * A callback if the user presses the left nav button\n *\n * @private\n * @memberof ModalManager\n */\n private userPressedLeftNavButtonCallback?: () => void;\n\n /**\n * Call the userClosedModalCallback and reset it if it exists\n *\n * @private\n * @memberof ModalManager\n */\n private callUserClosedModalCallback(): void {\n // we assign the callback to a temp var and undefine it before calling it\n // otherwise, we run into the potential for an infinite loop if the\n // callback triggers another `showModal()`, which would execute `userClosedModalCallback`\n const callback = this.userClosedModalCallback;\n this.userClosedModalCallback = undefined;\n if (callback) callback();\n }\n\n /**\n * Call the user pressed left nav button callback and reset it if it exists\n *\n * @private\n * @memberof ModalManager\n */\n private callUserPressedLeftNavButtonCallback(): void {\n // avoids an infinite showModal() loop, as above\n const callback = this.userPressedLeftNavButtonCallback;\n this.userPressedLeftNavButtonCallback = undefined;\n if (callback) callback();\n }\n\n /** @inheritdoc */\n async showModal(options: {\n config: ModalConfig;\n customModalContent?: TemplateResult;\n userClosedModalCallback?: () => void;\n userPressedLeftNavButtonCallback?: () => void;\n }): Promise<void> {\n // If the dialog is being opened, make note of what element was focused beforehand\n if (this.mode === ModalManagerMode.Closed) this.captureFocusedElement();\n\n this.closeOnBackdropClick = options.config.closeOnBackdropClick;\n this.userClosedModalCallback = options.userClosedModalCallback;\n this.userPressedLeftNavButtonCallback =\n options.userPressedLeftNavButtonCallback;\n this.customModalContent = options.customModalContent;\n this.mode = ModalManagerMode.Open;\n if (this.modalTemplate) {\n this.modalTemplate.config = options.config;\n await this.modalTemplate.updateComplete;\n this.modalTemplate.focus();\n }\n this.modal.activate();\n }\n\n /**\n * Sets the triggering element to the one that is currently focused, as deep\n * within Shadow DOM as possible.\n */\n private captureFocusedElement(): void {\n this.triggeringElement = getDeepestActiveElement();\n }\n\n /** @inheritdoc */\n updated(changed: PropertyValues): void {\n /* istanbul ignore else */\n if (changed.has('mode')) {\n this.handleModeChange();\n }\n }\n\n /**\n * Called when the backdrop is clicked\n *\n * @private\n * @memberof ModalManager\n */\n private backdropClicked(): void {\n if (this.closeOnBackdropClick) {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n }\n\n /**\n * Handle the mode change\n *\n * @private\n * @memberof ModalManager\n */\n private handleModeChange(): void {\n this.hostBridge.handleModeChange(this.mode);\n this.emitModeChangeEvent();\n }\n\n /**\n * Emit a modeChange event\n *\n * @private\n * @memberof ModalManager\n */\n private emitModeChangeEvent(): void {\n const event = new CustomEvent('modeChanged', {\n detail: { mode: this.mode },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * Called when the modal close button is pressed. Closes the modal.\n *\n * @private\n * @memberof ModalManager\n */\n private closeButtonPressed(): void {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n\n /** @inheritdoc */\n static get styles(): CSSResult {\n const modalBackdropColor = css`var(--modalBackdropColor, rgba(10, 10, 10, 0.9))`;\n const modalBackdropZindex = css`var(--modalBackdropZindex, 1000)`;\n\n const modalWidth = css`var(--modalWidth, 32rem)`;\n const modalMaxWidth = css`var(--modalMaxWidth, 95%)`;\n const modalZindex = css`var(--modalZindex, 2000)`;\n\n return css`\n .container {\n width: 100%;\n height: 100%;\n }\n\n .backdrop {\n position: fixed;\n top: 0;\n left: 0;\n background-color: ${modalBackdropColor};\n width: 100%;\n height: 100%;\n z-index: ${modalBackdropZindex};\n }\n\n modal-template {\n outline: 0;\n position: fixed;\n top: 0;\n left: 50%;\n transform: translate(-50%, 0);\n z-index: ${modalZindex};\n width: ${modalWidth};\n max-width: ${modalMaxWidth};\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"modal-manager.js","sourceRoot":"","sources":["../../src/modal-manager.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,GAAG,GAIJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGjD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QACL;;;;;;;WAOG;QACwC,SAAI,GAC7C,gBAAgB,CAAC,MAAM,CAAC;QAU1B;;;;;;;;;WASG;QAEH,eAAU,GAAoC,IAAI,sBAAsB,CACtE,IAAI,CACL,CAAC;QAWF,sCAAsC;QAC/B,UAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,C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;;4BAUc,kBAAkB;;;mBAG3B,mBAAmB;;;;;;;;;mBASnB,WAAW;iBACb,UAAU;qBACN,aAAa;;KAE7B,CAAC;IACJ,CAAC;CACF,CAAA;AAhR4C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAChB;AAQE;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAqC;AAahE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAGzB;AAS+B;IAAhC,KAAK,CAAC,gBAAgB,CAAC;mDAAuC;AA1CpD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAyRxB","sourcesContent":["import {\n LitElement,\n html,\n css,\n CSSResult,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { property, customElement, query } from 'lit/decorators.js';\n\nimport Modal from './shoelace/modal';\nimport { getDeepestActiveElement } from './shoelace/active-elements';\n\nimport './modal-template';\nimport { ModalTemplate } from './modal-template';\nimport { ModalConfig } from './modal-config';\nimport { ModalManagerHostBridge } from './modal-manager-host-bridge';\nimport { ModalManagerInterface } from './modal-manager-interface';\nimport { ModalManagerHostBridgeInterface } from './modal-manager-host-bridge-interface';\nimport { ModalManagerMode } from './modal-manager-mode';\n\n@customElement('modal-manager')\nexport class ModalManager extends LitElement implements ModalManagerInterface {\n /**\n * The current mode of the ModalManager\n *\n * Current options are `modal` or `closed`\n *\n * @type {ModalManagerMode}\n * @memberof ModalManager\n */\n @property({ type: String, reflect: true }) mode: ModalManagerMode =\n ModalManagerMode.Closed;\n\n /**\n * Custom content to display in the modal's content slot\n *\n * @type {(TemplateResult | undefined)}\n * @memberof ModalManager\n */\n @property({ type: Object }) customModalContent?: TemplateResult;\n\n /**\n * This hostBridge handles environmental-specific interactions such as adding classes\n * to the body tag or event listeners needed to support the modal manager in the host environment.\n *\n * There is a default `ModalManagerHostBridge`, but consumers can override it with a custom\n * `ModalManagerHostBridgeInterface`\n *\n * @type {ModalManagerHostBridgeInterface}\n * @memberof ModalManager\n */\n @property({ type: Object })\n hostBridge: ModalManagerHostBridgeInterface = new ModalManagerHostBridge(\n this,\n );\n\n /**\n * Reference to the ModalTemplate DOM element\n *\n * @private\n * @type {ModalTemplate}\n * @memberof ModalManager\n */\n @query('modal-template') private modalTemplate?: ModalTemplate;\n\n // Imported tab handling from shoelace\n public modal = new Modal(this);\n\n async firstUpdated(): Promise<void> {\n // Give the browser a chance to paint\n await new Promise((r) => setTimeout(r, 0));\n\n if (this.closeOnBackdropClick) {\n this.addEventListener('keydown', (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.backdropClicked();\n }\n });\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.modal.deactivate();\n }\n\n /** @inheritdoc */\n render(): TemplateResult {\n return html`\n <div class=\"container\">\n <div class=\"backdrop\" @click=${this.backdropClicked}></div>\n <modal-template\n @closeButtonPressed=${this.closeButtonPressed}\n @leftNavButtonPressed=${this.callUserPressedLeftNavButtonCallback}\n tabindex=\"-1\"\n >\n ${this.customModalContent}\n </modal-template>\n </div>\n `;\n }\n\n /** @inheritdoc */\n getMode(): ModalManagerMode {\n return this.mode;\n }\n\n /** @inheritdoc */\n closeModal(): void {\n this.mode = ModalManagerMode.Closed;\n this.customModalContent = undefined;\n if (this.modalTemplate) this.modalTemplate.config = new ModalConfig();\n this.modal.deactivate();\n\n // Return focus to the triggering element, if possible\n (this.triggeringElement as HTMLElement)?.focus?.();\n this.triggeringElement = undefined;\n }\n\n /**\n * Whether the modal should close if the user taps on the backdrop\n *\n * @private\n * @memberof ModalManager\n */\n private closeOnBackdropClick = true;\n\n /**\n * The element that had focus when the modal was opened, so that we can return focus\n * to it after the modal closes.\n */\n private triggeringElement?: Element;\n\n /**\n * A callback if the user closes the modal\n *\n * @private\n * @memberof ModalManager\n */\n private userClosedModalCallback?: () => void;\n\n /**\n * A callback if the user presses the left nav button\n *\n * @private\n * @memberof ModalManager\n */\n private userPressedLeftNavButtonCallback?: () => void;\n\n /**\n * Call the userClosedModalCallback and reset it if it exists\n *\n * @private\n * @memberof ModalManager\n */\n private callUserClosedModalCallback(): void {\n // we assign the callback to a temp var and undefine it before calling it\n // otherwise, we run into the potential for an infinite loop if the\n // callback triggers another `showModal()`, which would execute `userClosedModalCallback`\n const callback = this.userClosedModalCallback;\n this.userClosedModalCallback = undefined;\n if (callback) callback();\n }\n\n /**\n * Call the user pressed left nav button callback and reset it if it exists\n *\n * @private\n * @memberof ModalManager\n */\n private callUserPressedLeftNavButtonCallback(): void {\n // avoids an infinite showModal() loop, as above\n const callback = this.userPressedLeftNavButtonCallback;\n this.userPressedLeftNavButtonCallback = undefined;\n if (callback) callback();\n }\n\n /** @inheritdoc */\n async showModal(options: {\n config: ModalConfig;\n customModalContent?: TemplateResult;\n userClosedModalCallback?: () => void;\n userPressedLeftNavButtonCallback?: () => void;\n }): Promise<void> {\n // If the dialog is being opened, make note of what element was focused beforehand\n if (this.mode === ModalManagerMode.Closed) this.captureFocusedElement();\n\n this.closeOnBackdropClick = options.config.closeOnBackdropClick;\n this.userClosedModalCallback = options.userClosedModalCallback;\n this.userPressedLeftNavButtonCallback =\n options.userPressedLeftNavButtonCallback;\n this.customModalContent = options.customModalContent;\n this.mode = ModalManagerMode.Open;\n if (this.modalTemplate) {\n this.modalTemplate.config = options.config;\n await this.modalTemplate.updateComplete;\n this.modalTemplate.focus();\n }\n this.modal.activate();\n }\n\n /**\n * Sets the triggering element to the one that is currently focused, as deep\n * within Shadow DOM as possible.\n */\n private captureFocusedElement(): void {\n this.triggeringElement = getDeepestActiveElement();\n }\n\n /** @inheritdoc */\n updated(changed: PropertyValues): void {\n /* istanbul ignore else */\n if (changed.has('mode')) {\n this.handleModeChange();\n }\n }\n\n /**\n * Called when the backdrop is clicked\n *\n * @private\n * @memberof ModalManager\n */\n private backdropClicked(): void {\n if (this.closeOnBackdropClick) {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n }\n\n /**\n * Handle the mode change\n *\n * @private\n * @memberof ModalManager\n */\n private handleModeChange(): void {\n this.hostBridge.handleModeChange(this.mode);\n this.emitModeChangeEvent();\n }\n\n /**\n * Emit a modeChange event\n *\n * @private\n * @memberof ModalManager\n */\n private emitModeChangeEvent(): void {\n const event = new CustomEvent('modeChanged', {\n detail: { mode: this.mode },\n });\n this.dispatchEvent(event);\n }\n\n /**\n * Called when the modal close button is pressed. Closes the modal.\n *\n * @private\n * @memberof ModalManager\n */\n private closeButtonPressed(): void {\n this.closeModal();\n this.callUserClosedModalCallback();\n }\n\n /** @inheritdoc */\n static get styles(): CSSResult {\n const modalBackdropColor = css`var(--modalBackdropColor, rgba(10, 10, 10, 0.9))`;\n const modalBackdropZindex = css`var(--modalBackdropZindex, 1000)`;\n\n const modalWidth = css`var(--modalWidth, 32rem)`;\n const modalMaxWidth = css`var(--modalMaxWidth, 95%)`;\n const modalZindex = css`var(--modalZindex, 2000)`;\n\n return css`\n .container {\n width: 100%;\n height: 100%;\n }\n\n .backdrop {\n position: fixed;\n top: 0;\n left: 0;\n background-color: ${modalBackdropColor};\n width: 100%;\n height: 100%;\n z-index: ${modalBackdropZindex};\n }\n\n modal-template {\n outline: 0;\n position: fixed;\n top: 0;\n left: 50%;\n transform: translate(-50%, 0);\n z-index: ${modalZindex};\n width: ${modalWidth};\n max-width: ${modalMaxWidth};\n }\n `;\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { describe, test, expect } from 'vitest';
1
+ import { describe, it, expect } from 'vitest';
2
2
  import { html } from 'lit';
3
3
  import { ModalConfig } from '../src/modal-config';
4
4
  describe('Modal Config', () => {
5
- test('can be instantiated properly', async () => {
5
+ it('can be instantiated properly', async () => {
6
6
  const config = new ModalConfig();
7
7
  const title = html `Foo`;
8
8
  config.title = title;
@@ -10,7 +10,7 @@ describe('Modal Config', () => {
10
10
  expect(config.title).to.equal(title);
11
11
  expect(config.headerColor).to.equal('green');
12
12
  });
13
- test('can be instantiated properly with constructor', async () => {
13
+ it('can be instantiated properly with constructor', async () => {
14
14
  const title = html `Foo`;
15
15
  const subtitle = html `Bar`;
16
16
  const headline = html `Baz`;
@@ -50,7 +50,7 @@ describe('Modal Config', () => {
50
50
  expect(config.showHeaderLogo).to.equal(showHeaderLogo);
51
51
  expect(config.closeOnBackdropClick).to.equal(closeOnBackdropClick);
52
52
  });
53
- test('instantiates properly with defaults', async () => {
53
+ it('instantiates properly with defaults', async () => {
54
54
  const config = new ModalConfig();
55
55
  expect(config.title).to.equal(undefined);
56
56
  expect(config.subtitle).to.equal(undefined);