@internetarchive/modal-manager 2.0.4-alpha-webdev7960.0 → 2.0.4-alpha-webdev7960.1

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 (42) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/src/assets/arrow-left-icon.js +12 -12
  3. package/dist/src/assets/arrow-left-icon.js.map +1 -1
  4. package/dist/src/assets/ia-logo-icon.js +27 -27
  5. package/dist/src/assets/ia-logo-icon.js.map +1 -1
  6. package/dist/src/modal-config.js.map +1 -1
  7. package/dist/src/modal-manager-host-bridge-interface.js.map +1 -1
  8. package/dist/src/modal-manager-host-bridge.js.map +1 -1
  9. package/dist/src/modal-manager-interface.js.map +1 -1
  10. package/dist/src/modal-manager-mode.js.map +1 -1
  11. package/dist/src/modal-manager.d.ts +1 -1
  12. package/dist/src/modal-manager.js +41 -39
  13. package/dist/src/modal-manager.js.map +1 -1
  14. package/dist/src/modal-template.js +220 -220
  15. package/dist/src/modal-template.js.map +1 -1
  16. package/dist/src/shoelace/active-elements.js.map +1 -1
  17. package/dist/src/shoelace/modal.js.map +1 -1
  18. package/dist/src/shoelace/tabbable.js.map +1 -1
  19. package/dist/test/modal-config.test.js.map +1 -1
  20. package/dist/test/modal-manager.test.js +75 -40
  21. package/dist/test/modal-manager.test.js.map +1 -1
  22. package/dist/test/modal-template.test.js +22 -22
  23. package/dist/test/modal-template.test.js.map +1 -1
  24. package/dist/vite.config.js.map +1 -1
  25. package/index.ts +7 -7
  26. package/package.json +1 -1
  27. package/src/assets/arrow-left-icon.ts +15 -15
  28. package/src/assets/ia-logo-icon.ts +30 -30
  29. package/src/modal-config.ts +133 -133
  30. package/src/modal-manager-host-bridge-interface.ts +13 -13
  31. package/src/modal-manager-host-bridge.ts +82 -82
  32. package/src/modal-manager-interface.ts +30 -30
  33. package/src/modal-manager-mode.ts +10 -10
  34. package/src/modal-manager.ts +305 -303
  35. package/src/modal-template.ts +343 -343
  36. package/src/shoelace/active-elements.ts +33 -33
  37. package/src/shoelace/modal.ts +166 -166
  38. package/src/shoelace/tabbable.ts +223 -223
  39. package/test/modal-config.test.ts +77 -77
  40. package/test/modal-manager.test.ts +393 -347
  41. package/test/modal-template.test.ts +206 -206
  42. package/vite.config.ts +23 -23
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { ModalConfig } from './src/modal-config';\r\nexport { ModalManager } from './src/modal-manager';\r\nexport { ModalManagerMode } from './src/modal-manager-mode';\r\nexport { ModalManagerInterface } from './src/modal-manager-interface';\r\nexport { ModalManagerHostBridge } from './src/modal-manager-host-bridge';\r\nexport { ModalManagerHostBridgeInterface } from './src/modal-manager-host-bridge-interface';\r\nexport { ModalTemplate } from './src/modal-template';\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { ModalConfig } from './src/modal-config';\nexport { ModalManager } from './src/modal-manager';\nexport { ModalManagerMode } from './src/modal-manager-mode';\nexport { ModalManagerInterface } from './src/modal-manager-interface';\nexport { ModalManagerHostBridge } from './src/modal-manager-host-bridge';\nexport { ModalManagerHostBridgeInterface } from './src/modal-manager-host-bridge-interface';\nexport { ModalTemplate } from './src/modal-template';\n"]}
@@ -1,15 +1,15 @@
1
1
  import { html } from 'lit';
2
- export default html `
3
- <svg
4
- viewBox="0 0 100 100"
5
- xmlns="http://www.w3.org/2000/svg"
6
- fill="#fff"
7
- title="Left arrow icon"
8
- alt="Left arrow icon"
9
- >
10
- <path
11
- d="m20.1116715 50.0035012-.1116715-.1085359 43.1159942-46.61088155c2.401537-2.18938917 4.6902018-3.28408375 6.8659943-3.28408375s4.1642651.63837733 5.9654178 1.91513199c1.8011528 1.27675467 3.1520173 2.97248092 4.0525937 5.08717877l-39.4020173 42.99768924 39.4020173 42.9976892c-.9005764 2.1146979-2.2514409 3.8104241-4.0525937 5.0871788-1.8011527 1.2767547-3.7896253 1.915132-5.9654178 1.915132-2.1013449 0-4.3900096-1.0573489-6.8659943-3.1720468l-43.1159942-46.7194174z"
12
- />
13
- </svg>
2
+ export default html `
3
+ <svg
4
+ viewBox="0 0 100 100"
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ fill="#fff"
7
+ title="Left arrow icon"
8
+ alt="Left arrow icon"
9
+ >
10
+ <path
11
+ d="m20.1116715 50.0035012-.1116715-.1085359 43.1159942-46.61088155c2.401537-2.18938917 4.6902018-3.28408375 6.8659943-3.28408375s4.1642651.63837733 5.9654178 1.91513199c1.8011528 1.27675467 3.1520173 2.97248092 4.0525937 5.08717877l-39.4020173 42.99768924 39.4020173 42.9976892c-.9005764 2.1146979-2.2514409 3.8104241-4.0525937 5.0871788-1.8011527 1.2767547-3.7896253 1.915132-5.9654178 1.915132-2.1013449 0-4.3900096-1.0573489-6.8659943-3.1720468l-43.1159942-46.7194174z"
12
+ />
13
+ </svg>
14
14
  `;
15
15
  //# sourceMappingURL=arrow-left-icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-left-icon.js","sourceRoot":"","sources":["../../../src/assets/arrow-left-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;CAYlB,CAAC","sourcesContent":["import { html } from 'lit';\r\n\r\nexport default html`\r\n <svg\r\n viewBox=\"0 0 100 100\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n fill=\"#fff\"\r\n title=\"Left arrow icon\"\r\n alt=\"Left arrow icon\"\r\n >\r\n <path\r\n d=\"m20.1116715 50.0035012-.1116715-.1085359 43.1159942-46.61088155c2.401537-2.18938917 4.6902018-3.28408375 6.8659943-3.28408375s4.1642651.63837733 5.9654178 1.91513199c1.8011528 1.27675467 3.1520173 2.97248092 4.0525937 5.08717877l-39.4020173 42.99768924 39.4020173 42.9976892c-.9005764 2.1146979-2.2514409 3.8104241-4.0525937 5.0871788-1.8011527 1.2767547-3.7896253 1.915132-5.9654178 1.915132-2.1013449 0-4.3900096-1.0573489-6.8659943-3.1720468l-43.1159942-46.7194174z\"\r\n />\r\n </svg>\r\n`;\r\n"]}
1
+ {"version":3,"file":"arrow-left-icon.js","sourceRoot":"","sources":["../../../src/assets/arrow-left-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;CAYlB,CAAC","sourcesContent":["import { html } from 'lit';\n\nexport default html`\n <svg\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"#fff\"\n title=\"Left arrow icon\"\n alt=\"Left arrow icon\"\n >\n <path\n d=\"m20.1116715 50.0035012-.1116715-.1085359 43.1159942-46.61088155c2.401537-2.18938917 4.6902018-3.28408375 6.8659943-3.28408375s4.1642651.63837733 5.9654178 1.91513199c1.8011528 1.27675467 3.1520173 2.97248092 4.0525937 5.08717877l-39.4020173 42.99768924 39.4020173 42.9976892c-.9005764 2.1146979-2.2514409 3.8104241-4.0525937 5.0871788-1.8011527 1.2767547-3.7896253 1.915132-5.9654178 1.915132-2.1013449 0-4.3900096-1.0573489-6.8659943-3.1720468l-43.1159942-46.7194174z\"\n />\n </svg>\n`;\n"]}
@@ -1,30 +1,30 @@
1
1
  import { html } from 'lit';
2
- export default html `
3
- <svg
4
- class="ia-logo"
5
- viewBox="0 0 27 30"
6
- xmlns="http://www.w3.org/2000/svg"
7
- aria-labelledby="logoTitleID logoDescID"
8
- >
9
- <title id="logoTitleID">Internet Archive logo</title>
10
- <desc id="logoDescID">
11
- A line drawing of the Internet Archive headquarters building façade.
12
- </desc>
13
- <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
14
- <mask id="mask-2" class="fill-color">
15
- <path
16
- d="M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z"
17
- id="path-1"
18
- ></path>
19
- </mask>
20
- <use class="fill-color" xlink:href="#path-1"></use>
21
- <g mask="url(#mask-2)" class="fill-color">
22
- <path
23
- d="M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z"
24
- id="swatch"
25
- ></path>
26
- </g>
27
- </g>
28
- </svg>
2
+ export default html `
3
+ <svg
4
+ class="ia-logo"
5
+ viewBox="0 0 27 30"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ aria-labelledby="logoTitleID logoDescID"
8
+ >
9
+ <title id="logoTitleID">Internet Archive logo</title>
10
+ <desc id="logoDescID">
11
+ A line drawing of the Internet Archive headquarters building façade.
12
+ </desc>
13
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
14
+ <mask id="mask-2" class="fill-color">
15
+ <path
16
+ d="M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z"
17
+ id="path-1"
18
+ ></path>
19
+ </mask>
20
+ <use class="fill-color" xlink:href="#path-1"></use>
21
+ <g mask="url(#mask-2)" class="fill-color">
22
+ <path
23
+ d="M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z"
24
+ id="swatch"
25
+ ></path>
26
+ </g>
27
+ </g>
28
+ </svg>
29
29
  `;
30
30
  //# sourceMappingURL=ia-logo-icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ia-logo-icon.js","sourceRoot":"","sources":["../../../src/assets/ia-logo-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BlB,CAAC","sourcesContent":["import { html } from 'lit';\r\n\r\nexport default html`\r\n <svg\r\n class=\"ia-logo\"\r\n viewBox=\"0 0 27 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n aria-labelledby=\"logoTitleID logoDescID\"\r\n >\r\n <title id=\"logoTitleID\">Internet Archive logo</title>\r\n <desc id=\"logoDescID\">\r\n A line drawing of the Internet Archive headquarters building façade.\r\n </desc>\r\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\r\n <mask id=\"mask-2\" class=\"fill-color\">\r\n <path\r\n d=\"M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z\"\r\n id=\"path-1\"\r\n ></path>\r\n </mask>\r\n <use class=\"fill-color\" xlink:href=\"#path-1\"></use>\r\n <g mask=\"url(#mask-2)\" class=\"fill-color\">\r\n <path\r\n d=\"M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z\"\r\n id=\"swatch\"\r\n ></path>\r\n </g>\r\n </g>\r\n </svg>\r\n`;\r\n"]}
1
+ {"version":3,"file":"ia-logo-icon.js","sourceRoot":"","sources":["../../../src/assets/ia-logo-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BlB,CAAC","sourcesContent":["import { html } from 'lit';\n\nexport default html`\n <svg\n class=\"ia-logo\"\n viewBox=\"0 0 27 30\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"logoTitleID logoDescID\"\n >\n <title id=\"logoTitleID\">Internet Archive logo</title>\n <desc id=\"logoDescID\">\n A line drawing of the Internet Archive headquarters building façade.\n </desc>\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <mask id=\"mask-2\" class=\"fill-color\">\n <path\n d=\"M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z\"\n id=\"path-1\"\n ></path>\n </mask>\n <use class=\"fill-color\" xlink:href=\"#path-1\"></use>\n <g mask=\"url(#mask-2)\" class=\"fill-color\">\n <path\n d=\"M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z\"\n id=\"swatch\"\n ></path>\n </g>\n </g>\n </svg>\n`;\n"]}
@@ -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,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;QAEhC,IAAI,CAAC,WAAW,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,SAAS,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,SAAS,CAAC;QACjD,IAAI,CAAC,uBAAuB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,uBAAuB,mCAAI,KAAK,CAAC;QACzE,IAAI,CAAC,mBAAmB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,mCAAI,UAAU,CAAC;QACtE,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,mCAAI,IAAI,CAAC;QACxD,IAAI,CAAC,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,mCAAI,KAAK,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,mCAAI,EAAE,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,mCAAI,IAAI,CAAC;QACtD,IAAI,CAAC,oBAAoB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB,mCAAI,IAAI,CAAC;IACpE,CAAC;CACF","sourcesContent":["import { TemplateResult } from 'lit';\r\n\r\n/**\r\n * Configuration to show a modal\r\n *\r\n * @export\r\n * @class ModalConfig\r\n */\r\nexport class ModalConfig {\r\n /**\r\n * The title that shows in the header\r\n *\r\n * @type {(TemplateResult | undefined)}\r\n * @memberof ModalConfig\r\n */\r\n title?: TemplateResult;\r\n\r\n /**\r\n * The subtitle shown in the header under the title\r\n *\r\n * @type {(TemplateResult | undefined)}\r\n * @memberof ModalConfig\r\n */\r\n subtitle?: TemplateResult;\r\n\r\n /**\r\n * The headline shown at the top of the content section\r\n *\r\n * @type {(TemplateResult | undefined)}\r\n * @memberof ModalConfig\r\n */\r\n headline?: TemplateResult;\r\n\r\n /**\r\n * The text shown below the headline in the content section\r\n *\r\n * @type {(TemplateResult | undefined)}\r\n * @memberof ModalConfig\r\n */\r\n message?: TemplateResult;\r\n\r\n /**\r\n * The background color of the header\r\n *\r\n * @memberof ModalConfig\r\n */\r\n headerColor: string;\r\n\r\n /**\r\n * The background color of the body\r\n *\r\n * @memberof ModalConfig\r\n */\r\n bodyColor: string;\r\n\r\n /**\r\n * Show or hide the processing indicator\r\n *\r\n * @memberof ModalConfig\r\n */\r\n showProcessingIndicator: boolean;\r\n\r\n /**\r\n * Set the processing image mode, currently `processing` or `complete`\r\n *\r\n * @memberof ModalConfig\r\n */\r\n processingImageMode: 'processing' | 'complete';\r\n\r\n /**\r\n * Show the close button\r\n *\r\n * @memberof ModalConfig\r\n */\r\n showCloseButton: boolean;\r\n\r\n /**\r\n * Show the left nav button\r\n *\r\n * @memberof ModalConfig\r\n */\r\n showLeftNavButton: boolean;\r\n\r\n /**\r\n * Left nav button text\r\n */\r\n leftNavButtonText: string;\r\n\r\n /**\r\n * Show the close button\r\n *\r\n * @memberof ModalConfig\r\n */\r\n showHeaderLogo: boolean;\r\n\r\n /**\r\n * Close the modal if the user taps on the background\r\n *\r\n * @memberof ModalConfig\r\n */\r\n closeOnBackdropClick: boolean;\r\n\r\n constructor(options?: {\r\n title?: TemplateResult;\r\n subtitle?: TemplateResult;\r\n headline?: TemplateResult;\r\n message?: TemplateResult;\r\n headerColor?: string;\r\n bodyColor?: string;\r\n showProcessingIndicator?: boolean;\r\n processingImageMode?: 'processing' | 'complete';\r\n showCloseButton?: boolean;\r\n showLeftNavButton?: boolean;\r\n leftNavButtonText?: string;\r\n showHeaderLogo?: boolean;\r\n closeOnBackdropClick?: boolean;\r\n }) {\r\n this.title = options?.title;\r\n this.subtitle = options?.subtitle;\r\n this.headline = options?.headline;\r\n this.message = options?.message;\r\n\r\n this.headerColor = options?.headerColor ?? '#55A183';\r\n this.bodyColor = options?.bodyColor ?? '#fbfbfd';\r\n this.showProcessingIndicator = options?.showProcessingIndicator ?? false;\r\n this.processingImageMode = options?.processingImageMode ?? 'complete';\r\n this.showCloseButton = options?.showCloseButton ?? true;\r\n this.showLeftNavButton = options?.showLeftNavButton ?? false;\r\n this.leftNavButtonText = options?.leftNavButtonText ?? '';\r\n this.showHeaderLogo = options?.showHeaderLogo ?? true;\r\n this.closeOnBackdropClick = options?.closeOnBackdropClick ?? true;\r\n }\r\n}\r\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,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;QAEhC,IAAI,CAAC,WAAW,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,SAAS,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,SAAS,CAAC;QACjD,IAAI,CAAC,uBAAuB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,uBAAuB,mCAAI,KAAK,CAAC;QACzE,IAAI,CAAC,mBAAmB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,mCAAI,UAAU,CAAC;QACtE,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,mCAAI,IAAI,CAAC;QACxD,IAAI,CAAC,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,mCAAI,KAAK,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,mCAAI,EAAE,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,mCAAI,IAAI,CAAC;QACtD,IAAI,CAAC,oBAAoB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB,mCAAI,IAAI,CAAC;IACpE,CAAC;CACF","sourcesContent":["import { 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, currently `processing` or `complete`\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 ?? true;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"modal-manager-host-bridge-interface.js","sourceRoot":"","sources":["../../src/modal-manager-host-bridge-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { ModalManagerMode } from './modal-manager-mode';\r\n\r\n/**\r\n * The ModalManagerHostBridgeInterface is a delegate interface for\r\n * the host to implement environment-specific changes when the modal\r\n * is open or closed.\r\n *\r\n * A default implementation is provided, but can be overridden if\r\n * it does not work for the environment.\r\n */\r\nexport interface ModalManagerHostBridgeInterface {\r\n handleModeChange(mode: ModalManagerMode): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"modal-manager-host-bridge-interface.js","sourceRoot":"","sources":["../../src/modal-manager-host-bridge-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { ModalManagerMode } from './modal-manager-mode';\n\n/**\n * The ModalManagerHostBridgeInterface is a delegate interface for\n * the host to implement environment-specific changes when the modal\n * is open or closed.\n *\n * A default implementation is provided, but can be overridden if\n * it does not work for the environment.\n */\nexport interface ModalManagerHostBridgeInterface {\n handleModeChange(mode: ModalManagerMode): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"modal-manager-host-bridge.js","sourceRoot":"","sources":["../../src/modal-manager-host-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,sBAAsB;IAGjC,YAAY,YAAmC;QAuBvC,0BAAqB,GAAyB,QAAQ,CAC5D,GAAG,EACH,IAAI,CAAC,0BAA0B,EAC/B,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CACxC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QA1BX,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,IAAsB;QACrC,QAAQ,IAAI,EAAE;YACZ,KAAK,gBAAgB,CAAC,IAAI;gBACxB,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAC3B,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC1B,MAAM;YACR,KAAK,gBAAgB,CAAC,MAAM;gBAC1B,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC1B,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC5B,MAAM;SACT;IACH,CAAC;IAQD,yFAAyF;IACzF,mGAAmG;IACnG,mGAAmG;IACnG,kBAAkB;IAClB,0FAA0F;IAC1F,qFAAqF;IACrF,yCAAyC;IACjC,0BAA0B;QAChC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CACjC,mBAAmB,EACnB,GAAG,MAAM,CAAC,WAAW,IAAI,CAC1B,CAAC;IACJ,CAAC;IAEO,kBAAkB;QACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACpD,CAAC;IAEO,oBAAoB;QAC1B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACvD,CAAC;IAEO,mBAAmB;QACzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAChE,CAAC;IAEO,kBAAkB;QACxB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { throttle } from 'throttle-debounce';\r\n\r\nimport { ModalManagerHostBridgeInterface } from './modal-manager-host-bridge-interface';\r\nimport { ModalManagerInterface } from './modal-manager-interface';\r\nimport { ModalManagerMode } from './modal-manager-mode';\r\n\r\n/**\r\n * The `ModalManagerHostBridge` is a bridge between the `ModalManager` and the\r\n * host that sets up environment-specific changes when the modal opens and closes.\r\n *\r\n * For instance, when the modal opens, this adds a class to the `<body>` tag for styling\r\n * and adds a `resize` listener to fix a Safari shadow root issue.\r\n *\r\n * Consumers can create their own `ModalManagerHostBridgeInterface` classes and pass\r\n * them into the `ModalManager` if this one does not work for their environment.\r\n *\r\n * @export\r\n * @class ModalManagerHostBridge\r\n * @implements {ModalManagerHostBridgeInterface}\r\n */\r\nexport class ModalManagerHostBridge implements ModalManagerHostBridgeInterface {\r\n private modalManager: ModalManagerInterface;\r\n\r\n constructor(modalManager: ModalManagerInterface) {\r\n this.modalManager = modalManager;\r\n }\r\n\r\n /**\r\n * Handle the mode change\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n handleModeChange(mode: ModalManagerMode): void {\r\n switch (mode) {\r\n case ModalManagerMode.Open:\r\n this.startResizeListener();\r\n this.stopDocumentScroll();\r\n break;\r\n case ModalManagerMode.Closed:\r\n this.stopResizeListener();\r\n this.resumeDocumentScroll();\r\n break;\r\n }\r\n }\r\n\r\n private windowResizeThrottler: throttle<() => void> = throttle(\r\n 100,\r\n this.updateModalContainerHeight,\r\n { noLeading: false, noTrailing: false }\r\n ).bind(this);\r\n\r\n // This is a workaround for Safari. Safari does not update shadowRoot elements calculated\r\n // based on the viewport size (ie. `calc(100vh - 10px)`). It does an initial calculation correctly,\r\n // but resizing the window does not cause the calculation to update. Firefox and Chrome both handle\r\n // this correctly.\r\n // It doesn't matter what css variable you set, it is just forcing Safari to do an update.\r\n // Also note that the value has to change on each update for Safari to do the update,\r\n // ie. you can't just set a static value.\r\n private updateModalContainerHeight(): void {\r\n this.modalManager.style.setProperty(\r\n '--containerHeight',\r\n `${window.innerHeight}px`\r\n );\r\n }\r\n\r\n private stopDocumentScroll(): void {\r\n document.body.classList.add('modal-manager-open');\r\n }\r\n\r\n private resumeDocumentScroll(): void {\r\n document.body.classList.remove('modal-manager-open');\r\n }\r\n\r\n private startResizeListener(): void {\r\n window.addEventListener('resize', this.windowResizeThrottler);\r\n }\r\n\r\n private stopResizeListener(): void {\r\n window.removeEventListener('resize', this.windowResizeThrottler);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"modal-manager-host-bridge.js","sourceRoot":"","sources":["../../src/modal-manager-host-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;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AQ,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { throttle } from 'throttle-debounce';\n\nimport { ModalManagerHostBridgeInterface } from './modal-manager-host-bridge-interface';\nimport { ModalManagerInterface } from './modal-manager-interface';\nimport { ModalManagerMode } from './modal-manager-mode';\n\n/**\n * The `ModalManagerHostBridge` is a bridge between the `ModalManager` and the\n * host that sets up environment-specific changes when the modal opens and closes.\n *\n * For instance, when the modal opens, this adds a class to the `<body>` tag for styling\n * and adds a `resize` listener to fix a Safari shadow root issue.\n *\n * Consumers can create their own `ModalManagerHostBridgeInterface` classes and pass\n * them into the `ModalManager` if this one does not work for their environment.\n *\n * @export\n * @class ModalManagerHostBridge\n * @implements {ModalManagerHostBridgeInterface}\n */\nexport class ModalManagerHostBridge implements ModalManagerHostBridgeInterface {\n private modalManager: ModalManagerInterface;\n\n constructor(modalManager: ModalManagerInterface) {\n this.modalManager = modalManager;\n }\n\n /**\n * Handle the mode change\n *\n * @private\n * @memberof ModalManager\n */\n handleModeChange(mode: ModalManagerMode): void {\n switch (mode) {\n case ModalManagerMode.Open:\n this.startResizeListener();\n this.stopDocumentScroll();\n break;\n case ModalManagerMode.Closed:\n this.stopResizeListener();\n this.resumeDocumentScroll();\n break;\n }\n }\n\n private windowResizeThrottler: throttle<() => void> = throttle(\n 100,\n this.updateModalContainerHeight,\n { noLeading: false, noTrailing: false }\n ).bind(this);\n\n // This is a workaround for Safari. Safari does not update shadowRoot elements calculated\n // based on the viewport size (ie. `calc(100vh - 10px)`). It does an initial calculation correctly,\n // but resizing the window does not cause the calculation to update. Firefox and Chrome both handle\n // this correctly.\n // It doesn't matter what css variable you set, it is just forcing Safari to do an update.\n // Also note that the value has to change on each update for Safari to do the update,\n // ie. you can't just set a static value.\n private updateModalContainerHeight(): void {\n this.modalManager.style.setProperty(\n '--containerHeight',\n `${window.innerHeight}px`\n );\n }\n\n private stopDocumentScroll(): void {\n document.body.classList.add('modal-manager-open');\n }\n\n private resumeDocumentScroll(): void {\n document.body.classList.remove('modal-manager-open');\n }\n\n private startResizeListener(): void {\n window.addEventListener('resize', this.windowResizeThrottler);\n }\n\n private stopResizeListener(): void {\n window.removeEventListener('resize', this.windowResizeThrottler);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"modal-manager-interface.js","sourceRoot":"","sources":["../../src/modal-manager-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement, TemplateResult } from 'lit';\r\nimport { ModalConfig } from './modal-config';\r\nimport { ModalManagerMode } from './modal-manager-mode';\r\n\r\nexport interface ModalManagerInterface extends LitElement {\r\n /**\r\n * Get the current modal mode.\r\n */\r\n getMode(): ModalManagerMode;\r\n\r\n /**\r\n * Show a modal from a given ModalConfig\r\n *\r\n * @param config ModalConfig\r\n * @param customModalContent TemplateResult | undefined\r\n * @param userClosedModalCallback () => void | undefined an optional callback when the modal is closed\r\n * @param userPressedLeftNavButtonCallback () => void | undefined an optional callback when the left nav button is pressed\r\n */\r\n showModal(options: {\r\n config: ModalConfig;\r\n customModalContent?: TemplateResult;\r\n userClosedModalCallback?: () => void;\r\n userPressedLeftNavButtonCallback?: () => void;\r\n }): Promise<void>;\r\n\r\n /**\r\n * Close the currently open modal\r\n */\r\n closeModal(): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"modal-manager-interface.js","sourceRoot":"","sources":["../../src/modal-manager-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement, TemplateResult } from 'lit';\nimport { ModalConfig } from './modal-config';\nimport { ModalManagerMode } from './modal-manager-mode';\n\nexport interface ModalManagerInterface extends LitElement {\n /**\n * Get the current modal mode.\n */\n getMode(): ModalManagerMode;\n\n /**\n * Show a modal from a given ModalConfig\n *\n * @param config ModalConfig\n * @param customModalContent TemplateResult | undefined\n * @param userClosedModalCallback () => void | undefined an optional callback when the modal is closed\n * @param userPressedLeftNavButtonCallback () => void | undefined an optional callback when the left nav button is pressed\n */\n showModal(options: {\n config: ModalConfig;\n customModalContent?: TemplateResult;\n userClosedModalCallback?: () => void;\n userPressedLeftNavButtonCallback?: () => void;\n }): Promise<void>;\n\n /**\n * Close the currently open modal\n */\n closeModal(): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"modal-manager-mode.js","sourceRoot":"","sources":["../../src/modal-manager-mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,qCAAiB,CAAA;AACnB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["/**\r\n * Various modes the modal can be in\r\n *\r\n * @export\r\n * @enum {number}\r\n */\r\nexport enum ModalManagerMode {\r\n Open = 'open',\r\n Closed = 'closed',\r\n}\r\n"]}
1
+ {"version":3,"file":"modal-manager-mode.js","sourceRoot":"","sources":["../../src/modal-manager-mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,qCAAiB,CAAA;AACnB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["/**\n * Various modes the modal can be in\n *\n * @export\n * @enum {number}\n */\nexport enum ModalManagerMode {\n Open = 'open',\n Closed = 'closed',\n}\n"]}
@@ -101,7 +101,7 @@ export declare class ModalManager extends LitElement implements ModalManagerInte
101
101
  * Sets the triggering element to the one that is currently focused, as deep
102
102
  * within Shadow DOM as possible.
103
103
  */
104
- private captureTriggeringElement;
104
+ private captureFocusedElement;
105
105
  /** @inheritdoc */
106
106
  updated(changed: PropertyValues): void;
107
107
  /**
@@ -60,17 +60,17 @@ let ModalManager = class ModalManager extends LitElement {
60
60
  }
61
61
  /** @inheritdoc */
62
62
  render() {
63
- return html `
64
- <div class="container">
65
- <div class="backdrop" @click=${this.backdropClicked}></div>
66
- <modal-template
67
- @closeButtonPressed=${this.closeButtonPressed}
68
- @leftNavButtonPressed=${this.callUserPressedLeftNavButtonCallback}
69
- tabindex="-1"
70
- >
71
- ${this.customModalContent}
72
- </modal-template>
73
- </div>
63
+ return html `
64
+ <div class="container">
65
+ <div class="backdrop" @click=${this.backdropClicked}></div>
66
+ <modal-template
67
+ @closeButtonPressed=${this.closeButtonPressed}
68
+ @leftNavButtonPressed=${this.callUserPressedLeftNavButtonCallback}
69
+ tabindex="-1"
70
+ >
71
+ ${this.customModalContent}
72
+ </modal-template>
73
+ </div>
74
74
  `;
75
75
  }
76
76
  /** @inheritdoc */
@@ -120,7 +120,9 @@ let ModalManager = class ModalManager extends LitElement {
120
120
  /** @inheritdoc */
121
121
  showModal(options) {
122
122
  return __awaiter(this, void 0, void 0, function* () {
123
- this.captureTriggeringElement();
123
+ // If the dialog is being opened, make note of what element was focused beforehand
124
+ if (this.mode === ModalManagerMode.Closed)
125
+ this.captureFocusedElement();
124
126
  this.closeOnBackdropClick = options.config.closeOnBackdropClick;
125
127
  this.userClosedModalCallback = options.userClosedModalCallback;
126
128
  this.userPressedLeftNavButtonCallback =
@@ -139,7 +141,7 @@ let ModalManager = class ModalManager extends LitElement {
139
141
  * Sets the triggering element to the one that is currently focused, as deep
140
142
  * within Shadow DOM as possible.
141
143
  */
142
- captureTriggeringElement() {
144
+ captureFocusedElement() {
143
145
  this.triggeringElement = getDeepestActiveElement();
144
146
  }
145
147
  /** @inheritdoc */
@@ -200,32 +202,32 @@ let ModalManager = class ModalManager extends LitElement {
200
202
  const modalWidth = css `var(--modalWidth, 32rem)`;
201
203
  const modalMaxWidth = css `var(--modalMaxWidth, 95%)`;
202
204
  const modalZindex = css `var(--modalZindex, 2000)`;
203
- return css `
204
- .container {
205
- width: 100%;
206
- height: 100%;
207
- }
208
-
209
- .backdrop {
210
- position: fixed;
211
- top: 0;
212
- left: 0;
213
- background-color: ${modalBackdropColor};
214
- width: 100%;
215
- height: 100%;
216
- z-index: ${modalBackdropZindex};
217
- }
218
-
219
- modal-template {
220
- outline: 0;
221
- position: fixed;
222
- top: 0;
223
- left: 50%;
224
- transform: translate(-50%, 0);
225
- z-index: ${modalZindex};
226
- width: ${modalWidth};
227
- max-width: ${modalMaxWidth};
228
- }
205
+ return css `
206
+ .container {
207
+ width: 100%;
208
+ height: 100%;
209
+ }
210
+
211
+ .backdrop {
212
+ position: fixed;
213
+ top: 0;
214
+ left: 0;
215
+ background-color: ${modalBackdropColor};
216
+ width: 100%;
217
+ height: 100%;
218
+ z-index: ${modalBackdropZindex};
219
+ }
220
+
221
+ modal-template {
222
+ outline: 0;
223
+ position: fixed;
224
+ top: 0;
225
+ left: 50%;
226
+ transform: translate(-50%, 0);
227
+ z-index: ${modalZindex};
228
+ width: ${modalWidth};
229
+ max-width: ${modalMaxWidth};
230
+ }
229
231
  `;
230
232
  }
231
233
  };
@@ -1 +1 @@
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;Q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UAAU;qBACN,aAAa;;KAE7B,CAAC;IACJ,CAAC;CACF,CAAA;AA/Q4C;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;AASuB;IAAxB,KAAK,CAAC,gBAAgB,CAAC;mDAAuC;AA1CpD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAwRxB;SAxRY,YAAY","sourcesContent":["import {\r\n LitElement,\r\n html,\r\n css,\r\n CSSResult,\r\n TemplateResult,\r\n PropertyValues,\r\n} from 'lit';\r\nimport { property, customElement, query } from 'lit/decorators.js';\r\n\r\nimport Modal from './shoelace/modal';\r\nimport { getDeepestActiveElement } from './shoelace/active-elements';\r\n\r\nimport './modal-template';\r\nimport { ModalTemplate } from './modal-template';\r\nimport { ModalConfig } from './modal-config';\r\nimport { ModalManagerHostBridge } from './modal-manager-host-bridge';\r\nimport { ModalManagerInterface } from './modal-manager-interface';\r\nimport { ModalManagerHostBridgeInterface } from './modal-manager-host-bridge-interface';\r\nimport { ModalManagerMode } from './modal-manager-mode';\r\n\r\n@customElement('modal-manager')\r\nexport class ModalManager extends LitElement implements ModalManagerInterface {\r\n /**\r\n * The current mode of the ModalManager\r\n *\r\n * Current options are `modal` or `closed`\r\n *\r\n * @type {ModalManagerMode}\r\n * @memberof ModalManager\r\n */\r\n @property({ type: String, reflect: true }) mode: ModalManagerMode =\r\n ModalManagerMode.Closed;\r\n\r\n /**\r\n * Custom content to display in the modal's content slot\r\n *\r\n * @type {(TemplateResult | undefined)}\r\n * @memberof ModalManager\r\n */\r\n @property({ type: Object }) customModalContent?: TemplateResult;\r\n\r\n /**\r\n * This hostBridge handles environmental-specific interactions such as adding classes\r\n * to the body tag or event listeners needed to support the modal manager in the host environment.\r\n *\r\n * There is a default `ModalManagerHostBridge`, but consumers can override it with a custom\r\n * `ModalManagerHostBridgeInterface`\r\n *\r\n * @type {ModalManagerHostBridgeInterface}\r\n * @memberof ModalManager\r\n */\r\n @property({ type: Object })\r\n hostBridge: ModalManagerHostBridgeInterface = new ModalManagerHostBridge(\r\n this\r\n );\r\n\r\n /**\r\n * Reference to the ModalTemplate DOM element\r\n *\r\n * @private\r\n * @type {ModalTemplate}\r\n * @memberof ModalManager\r\n */\r\n @query('modal-template') private modalTemplate?: ModalTemplate;\r\n\r\n // Imported tab handling from shoelace\r\n public modal = new Modal(this);\r\n\r\n async firstUpdated(): Promise<void> {\r\n // Give the browser a chance to paint\r\n // eslint-disable-next-line no-promise-executor-return\r\n await new Promise(r => setTimeout(r, 0));\r\n\r\n if (this.closeOnBackdropClick) {\r\n this.addEventListener('keydown', (e: KeyboardEvent) => {\r\n if (e.key === 'Escape') {\r\n this.backdropClicked();\r\n }\r\n });\r\n }\r\n }\r\n\r\n disconnectedCallback() {\r\n super.disconnectedCallback();\r\n this.modal.deactivate();\r\n }\r\n\r\n /** @inheritdoc */\r\n render(): TemplateResult {\r\n return html`\r\n <div class=\"container\">\r\n <div class=\"backdrop\" @click=${this.backdropClicked}></div>\r\n <modal-template\r\n @closeButtonPressed=${this.closeButtonPressed}\r\n @leftNavButtonPressed=${this.callUserPressedLeftNavButtonCallback}\r\n tabindex=\"-1\"\r\n >\r\n ${this.customModalContent}\r\n </modal-template>\r\n </div>\r\n `;\r\n }\r\n\r\n /** @inheritdoc */\r\n getMode(): ModalManagerMode {\r\n return this.mode;\r\n }\r\n\r\n /** @inheritdoc */\r\n closeModal(): void {\r\n this.mode = ModalManagerMode.Closed;\r\n this.customModalContent = undefined;\r\n if (this.modalTemplate) this.modalTemplate.config = new ModalConfig();\r\n this.modal.deactivate();\r\n \r\n // Return focus to the triggering element, if possible\r\n (this.triggeringElement as HTMLElement)?.focus?.();\r\n this.triggeringElement = undefined;\r\n }\r\n\r\n /**\r\n * Whether the modal should close if the user taps on the backdrop\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private closeOnBackdropClick = true;\r\n\r\n /**\r\n * The element that had focus when the modal was opened, so that we can return focus\r\n * to it after the modal closes.\r\n */\r\n private triggeringElement?: Element;\r\n\r\n /**\r\n * A callback if the user closes the modal\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private userClosedModalCallback?: () => void;\r\n\r\n /**\r\n * A callback if the user presses the left nav button\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private userPressedLeftNavButtonCallback?: () => void;\r\n\r\n /**\r\n * Call the userClosedModalCallback and reset it if it exists\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private callUserClosedModalCallback(): void {\r\n // we assign the callback to a temp var and undefine it before calling it\r\n // otherwise, we run into the potential for an infinite loop if the\r\n // callback triggers another `showModal()`, which would execute `userClosedModalCallback`\r\n const callback = this.userClosedModalCallback;\r\n this.userClosedModalCallback = undefined;\r\n if (callback) callback();\r\n }\r\n\r\n /**\r\n * Call the user pressed left nav button callback and reset it if it exists\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private callUserPressedLeftNavButtonCallback(): void {\r\n // avoids an infinite showModal() loop, as above\r\n const callback = this.userPressedLeftNavButtonCallback;\r\n this.userPressedLeftNavButtonCallback = undefined;\r\n if (callback) callback();\r\n }\r\n\r\n /** @inheritdoc */\r\n async showModal(options: {\r\n config: ModalConfig;\r\n customModalContent?: TemplateResult;\r\n userClosedModalCallback?: () => void;\r\n userPressedLeftNavButtonCallback?: () => void;\r\n }): Promise<void> {\r\n this.captureTriggeringElement();\r\n this.closeOnBackdropClick = options.config.closeOnBackdropClick;\r\n this.userClosedModalCallback = options.userClosedModalCallback;\r\n this.userPressedLeftNavButtonCallback =\r\n options.userPressedLeftNavButtonCallback;\r\n this.customModalContent = options.customModalContent;\r\n this.mode = ModalManagerMode.Open;\r\n if (this.modalTemplate) {\r\n this.modalTemplate.config = options.config;\r\n await this.modalTemplate.updateComplete;\r\n this.modalTemplate.focus();\r\n }\r\n this.modal.activate();\r\n }\r\n\r\n /**\r\n * Sets the triggering element to the one that is currently focused, as deep\r\n * within Shadow DOM as possible.\r\n */\r\n private captureTriggeringElement(): void {\r\n this.triggeringElement = getDeepestActiveElement();\r\n }\r\n\r\n /** @inheritdoc */\r\n updated(changed: PropertyValues): void {\r\n /* istanbul ignore else */\r\n if (changed.has('mode')) {\r\n this.handleModeChange();\r\n }\r\n }\r\n\r\n /**\r\n * Called when the backdrop is clicked\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private backdropClicked(): void {\r\n if (this.closeOnBackdropClick) {\r\n this.closeModal();\r\n this.callUserClosedModalCallback();\r\n }\r\n }\r\n\r\n /**\r\n * Handle the mode change\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private handleModeChange(): void {\r\n this.hostBridge.handleModeChange(this.mode);\r\n this.emitModeChangeEvent();\r\n }\r\n\r\n /**\r\n * Emit a modeChange event\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private emitModeChangeEvent(): void {\r\n const event = new CustomEvent('modeChanged', {\r\n detail: { mode: this.mode },\r\n });\r\n this.dispatchEvent(event);\r\n }\r\n\r\n /**\r\n * Called when the modal close button is pressed. Closes the modal.\r\n *\r\n * @private\r\n * @memberof ModalManager\r\n */\r\n private closeButtonPressed(): void {\r\n this.closeModal();\r\n this.callUserClosedModalCallback();\r\n }\r\n\r\n /** @inheritdoc */\r\n static get styles(): CSSResult {\r\n const modalBackdropColor = css`var(--modalBackdropColor, rgba(10, 10, 10, 0.9))`;\r\n const modalBackdropZindex = css`var(--modalBackdropZindex, 1000)`;\r\n\r\n const modalWidth = css`var(--modalWidth, 32rem)`;\r\n const modalMaxWidth = css`var(--modalMaxWidth, 95%)`;\r\n const modalZindex = css`var(--modalZindex, 2000)`;\r\n\r\n return css`\r\n .container {\r\n width: 100%;\r\n height: 100%;\r\n }\r\n\r\n .backdrop {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n background-color: ${modalBackdropColor};\r\n width: 100%;\r\n height: 100%;\r\n z-index: ${modalBackdropZindex};\r\n }\r\n\r\n modal-template {\r\n outline: 0;\r\n position: fixed;\r\n top: 0;\r\n left: 50%;\r\n transform: translate(-50%, 0);\r\n z-index: ${modalZindex};\r\n width: ${modalWidth};\r\n max-width: ${modalMaxWidth};\r\n }\r\n `;\r\n }\r\n}\r\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,CAAC;QAsD/B;;;;;WAKG;QACK,yBAAoB,GAAG,IAAI,CAAC;IAiLtC,CAAC;IA3OO,YAAY;;YAChB,qCAAqC;YACrC,sDAAsD;YACtD,MAAM,IAAI,OAAO,CAAC,CAAC,CAA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I,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;AASuB;IAAxB,KAAK,CAAC,gBAAgB,CAAC;mDAAuC;AA1CpD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA0RxB;SA1RY,YAAY","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 // eslint-disable-next-line no-promise-executor-return\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"]}