@ptcwebops/ptcw-design 6.4.4 → 6.4.5

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 (138) hide show
  1. package/dist/cjs/blog-detail-content_2.cjs.entry.js +1 -1
  2. package/dist/cjs/blog-detail-layout.cjs.entry.js +1 -1
  3. package/dist/cjs/blogs-search-section.cjs.entry.js +1 -1
  4. package/dist/cjs/homepage-jumbotron.cjs.entry.js +1 -1
  5. package/dist/cjs/homepage-toggled-content.cjs.entry.js +1 -1
  6. package/dist/cjs/innovator-toggle-container.cjs.entry.js +39 -3
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/most-popular-news.cjs.entry.js +1 -1
  9. package/dist/cjs/my-component.cjs.entry.js +1 -1
  10. package/dist/cjs/ptc-accordion-item.cjs.entry.js +1 -1
  11. package/dist/cjs/ptc-background-video.cjs.entry.js +99 -28
  12. package/dist/cjs/ptc-button_5.cjs.entry.js +597 -0
  13. package/dist/cjs/ptc-card_2.cjs.entry.js +1 -1
  14. package/dist/cjs/ptc-collapse-list.cjs.entry.js +1 -1
  15. package/dist/cjs/ptc-form-checkbox_2.cjs.entry.js +1 -1
  16. package/dist/cjs/ptc-homepage-image-feature.cjs.entry.js +1 -1
  17. package/dist/cjs/ptc-homepage-video-background.cjs.entry.js +1 -1
  18. package/dist/cjs/ptc-icon-card.cjs.entry.js +1 -1
  19. package/dist/cjs/ptc-jumbotron.cjs.entry.js +1 -1
  20. package/dist/cjs/ptc-link.cjs.entry.js +1 -1
  21. package/dist/cjs/ptc-media-card.cjs.entry.js +74 -6
  22. package/dist/cjs/ptc-multi-select_2.cjs.entry.js +1 -1
  23. package/dist/cjs/ptc-pricing-packaging-table.cjs.entry.js +1 -1
  24. package/dist/cjs/ptc-pricing-tabs.cjs.entry.js +1 -1
  25. package/dist/cjs/ptc-skeleton.cjs.entry.js +1 -1
  26. package/dist/cjs/ptc-social-icons-footer.cjs.entry.js +1 -1
  27. package/dist/cjs/ptc-subnav-v2.cjs.entry.js +430 -0
  28. package/dist/cjs/ptc-text-copy-with-background.cjs.entry.js +1 -1
  29. package/dist/cjs/ptcw-design.cjs.js +1 -1
  30. package/dist/cjs/{utils-b63aef52.js → utils-0ff09a53.js} +13 -0
  31. package/dist/collection/collection-manifest.json +1 -0
  32. package/dist/collection/components/innovator-toggle-container/innovator-toggle-container.js +39 -3
  33. package/dist/collection/components/ptc-background-video/ptc-background-video.css +21 -0
  34. package/dist/collection/components/ptc-background-video/ptc-background-video.js +110 -43
  35. package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +5 -0
  36. package/dist/collection/components/ptc-media-card/ptc-media-card.js +78 -7
  37. package/dist/collection/components/ptc-preloader-section/ptc-preloader-section.css +16 -0
  38. package/dist/collection/components/ptc-seo-title/ptc-seo-title.js +3 -3
  39. package/dist/collection/components/ptc-skeleton/ptc-skeleton.css +6 -0
  40. package/dist/collection/components/ptc-subnav-v2/ptc-subnav-v2.css +394 -0
  41. package/dist/collection/components/ptc-subnav-v2/ptc-subnav-v2.js +483 -0
  42. package/dist/collection/components/ptc-text-copy-with-background/ptc-text-copy-with-background.css +19 -0
  43. package/dist/collection/stories/organisms/ptc/Subnav New/preview.stories.js +360 -0
  44. package/dist/collection/utils/utils.js +11 -0
  45. package/dist/custom-elements/index.d.ts +6 -0
  46. package/dist/custom-elements/index.js +654 -42
  47. package/dist/esm/blog-detail-content_2.entry.js +1 -1
  48. package/dist/esm/blog-detail-layout.entry.js +1 -1
  49. package/dist/esm/blogs-search-section.entry.js +1 -1
  50. package/dist/esm/homepage-jumbotron.entry.js +1 -1
  51. package/dist/esm/homepage-toggled-content.entry.js +1 -1
  52. package/dist/esm/innovator-toggle-container.entry.js +39 -3
  53. package/dist/esm/{interfaces-4caedd26.js → interfaces-7c0243be.js} +1 -1
  54. package/dist/esm/loader.js +1 -1
  55. package/dist/esm/most-popular-news.entry.js +1 -1
  56. package/dist/esm/my-component.entry.js +1 -1
  57. package/dist/esm/ptc-accordion-item.entry.js +1 -1
  58. package/dist/esm/ptc-background-video.entry.js +99 -28
  59. package/dist/esm/ptc-button_5.entry.js +589 -0
  60. package/dist/esm/ptc-card_2.entry.js +1 -1
  61. package/dist/esm/ptc-collapse-list.entry.js +1 -1
  62. package/dist/esm/ptc-form-checkbox_2.entry.js +1 -1
  63. package/dist/esm/ptc-homepage-image-feature.entry.js +1 -1
  64. package/dist/esm/ptc-homepage-video-background.entry.js +1 -1
  65. package/dist/esm/ptc-icon-card.entry.js +1 -1
  66. package/dist/esm/ptc-img.entry.js +1 -1
  67. package/dist/esm/ptc-jumbotron.entry.js +1 -1
  68. package/dist/esm/ptc-link.entry.js +1 -1
  69. package/dist/esm/ptc-media-card.entry.js +74 -6
  70. package/dist/esm/ptc-multi-select_2.entry.js +1 -1
  71. package/dist/esm/ptc-pricing-packaging-table.entry.js +1 -1
  72. package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
  73. package/dist/esm/ptc-skeleton.entry.js +1 -1
  74. package/dist/esm/ptc-social-icons-footer.entry.js +1 -1
  75. package/dist/esm/ptc-subnav-v2.entry.js +426 -0
  76. package/dist/esm/ptc-text-copy-with-background.entry.js +1 -1
  77. package/dist/esm/ptcw-design.js +1 -1
  78. package/dist/esm/{utils-2f12c081.js → utils-a64ba942.js} +12 -1
  79. package/dist/ptcw-design/{p-9dbcfcee.entry.js → p-01497d7a.entry.js} +1 -1
  80. package/dist/ptcw-design/p-043be054.entry.js +1 -0
  81. package/dist/ptcw-design/{p-257267e3.entry.js → p-0df868d2.entry.js} +1 -1
  82. package/dist/ptcw-design/{p-fe8392c4.entry.js → p-1489b374.entry.js} +1 -1
  83. package/dist/ptcw-design/p-1c569057.entry.js +1 -0
  84. package/dist/ptcw-design/p-22cf00e7.js +1 -0
  85. package/dist/ptcw-design/p-28113014.entry.js +1 -0
  86. package/dist/ptcw-design/{p-d0fb9bfb.entry.js → p-2f21b69b.entry.js} +1 -1
  87. package/dist/ptcw-design/{p-45b1f3fc.entry.js → p-456c5cbb.entry.js} +1 -1
  88. package/dist/ptcw-design/{p-c3022c48.entry.js → p-54b589a6.entry.js} +1 -1
  89. package/dist/ptcw-design/{p-9b0df204.entry.js → p-5877f093.entry.js} +1 -1
  90. package/dist/ptcw-design/{p-78370e3d.entry.js → p-5a8e7557.entry.js} +1 -1
  91. package/dist/ptcw-design/{p-3ed4a7ed.entry.js → p-5ca42138.entry.js} +1 -1
  92. package/dist/ptcw-design/{p-901c31b3.entry.js → p-5cf5b9f8.entry.js} +1 -1
  93. package/dist/ptcw-design/{p-4fff8cc8.entry.js → p-6a1d9c7d.entry.js} +1 -1
  94. package/dist/ptcw-design/{p-a5fc048f.entry.js → p-82f766d2.entry.js} +1 -1
  95. package/dist/ptcw-design/{p-76dab076.entry.js → p-8aca7181.entry.js} +1 -1
  96. package/dist/ptcw-design/{p-52e17d34.entry.js → p-92ad78c5.entry.js} +1 -1
  97. package/dist/ptcw-design/p-9c8b739c.entry.js +1 -0
  98. package/dist/ptcw-design/{p-4098e953.entry.js → p-9f4ad29d.entry.js} +1 -1
  99. package/dist/ptcw-design/p-a8bfef4d.entry.js +1 -0
  100. package/dist/ptcw-design/{p-abadbe5b.entry.js → p-bd9d995b.entry.js} +1 -1
  101. package/dist/ptcw-design/{p-8c121480.entry.js → p-c160bda4.entry.js} +1 -1
  102. package/dist/ptcw-design/p-c555a45c.entry.js +1 -0
  103. package/dist/ptcw-design/{p-96163196.entry.js → p-d0ebcace.entry.js} +1 -1
  104. package/dist/ptcw-design/{p-81e5fa38.entry.js → p-d2998707.entry.js} +1 -1
  105. package/dist/ptcw-design/{p-19a407ff.entry.js → p-de650865.entry.js} +1 -1
  106. package/dist/ptcw-design/{p-54f5a5be.entry.js → p-e23bc4a1.entry.js} +1 -1
  107. package/dist/ptcw-design/{p-711bcdad.js → p-ee1183b2.js} +1 -1
  108. package/dist/ptcw-design/{p-9f01419b.entry.js → p-f2675bb0.entry.js} +1 -1
  109. package/dist/ptcw-design/ptcw-design.css +1 -1
  110. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  111. package/dist/types/components/innovator-toggle-container/innovator-toggle-container.d.ts +3 -0
  112. package/dist/types/components/ptc-background-video/ptc-background-video.d.ts +31 -47
  113. package/dist/types/components/ptc-media-card/ptc-media-card.d.ts +8 -2
  114. package/dist/types/components/ptc-subnav-v2/ptc-subnav-v2.d.ts +55 -0
  115. package/dist/types/components.d.ts +105 -88
  116. package/dist/types/utils/utils.d.ts +2 -0
  117. package/package.json +98 -98
  118. package/readme.md +19 -19
  119. package/dist/cjs/ptc-button.cjs.entry.js +0 -117
  120. package/dist/cjs/ptc-para.cjs.entry.js +0 -139
  121. package/dist/cjs/ptc-picture.cjs.entry.js +0 -168
  122. package/dist/cjs/ptc-spacer.cjs.entry.js +0 -38
  123. package/dist/cjs/ptc-title.cjs.entry.js +0 -161
  124. package/dist/esm/ptc-button.entry.js +0 -113
  125. package/dist/esm/ptc-para.entry.js +0 -135
  126. package/dist/esm/ptc-picture.entry.js +0 -164
  127. package/dist/esm/ptc-spacer.entry.js +0 -34
  128. package/dist/esm/ptc-title.entry.js +0 -157
  129. package/dist/ptcw-design/p-0c69ea52.entry.js +0 -1
  130. package/dist/ptcw-design/p-24776ca2.entry.js +0 -1
  131. package/dist/ptcw-design/p-605b13a2.entry.js +0 -1
  132. package/dist/ptcw-design/p-80122e26.js +0 -1
  133. package/dist/ptcw-design/p-8cea8943.entry.js +0 -1
  134. package/dist/ptcw-design/p-a8872ce3.entry.js +0 -1
  135. package/dist/ptcw-design/p-c6431ebc.entry.js +0 -1
  136. package/dist/ptcw-design/p-d51438de.entry.js +0 -1
  137. package/dist/ptcw-design/p-d875f96d.entry.js +0 -1
  138. package/dist/ptcw-design/p-e4eb925f.entry.js +0 -1
@@ -1,11 +1,37 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-c83db688.js';
2
- import { n as nextUserInteractionEvent } from './utils-2f12c081.js';
2
+ import { i as isReducedMotion, n as nextUserInteractionEvent, o as onReducedMotionChange } from './utils-a64ba942.js';
3
3
 
4
- const ptcBackgroundVideoCss = "h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{word-break:break-word;hyphens:manual;-webkit-hyphens:manual;-moz-hyphens:manual;-ms-hyphens:manual}@supports (hyphenate-limit-chars: 12 3 3){h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;hyphenate-limit-chars:12 3 3;hyphenate-limit-lines:2;hyphenate-limit-last:always;hyphenate-limit-zone:6%;-webkit-hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;-webkit-hyphenate-limit-chars:12 3 3;-webkit-hyphenate-limit-lines:2;-moz-hyphens:auto;-moz-hyphenate-limit-chars:12 3 3;-moz-hyphenate-limit-lines:2;-ms-hyphens:auto;-ms-hyphenate-limit-chars:12 3 3;-ms-hyphenate-limit-lines:2}}:host{display:block;position:relative}:host video{position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden;pointer-events:none;z-index:-100;object-fit:cover}:host .video-overlay{z-index:1;display:block;position:absolute;width:100%;height:100%;top:0;left:0;opacity:0.8;background-image:linear-gradient(270deg, rgba(30, 38, 38, 0) 26%, #1e2626)}:host .video-overlay.dark{background-color:rgba(0, 0, 0, 0.6)}:host(.legacy){display:block;position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden;pointer-events:none;z-index:-100}:host(.legacy) video{object-fit:cover;position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden}:host .iframe-wrapper{position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden;pointer-events:none;z-index:-100}:host .iframe-wrapper .background-video-embed{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:100%;height:100%}:host .iframe-wrapper .player .vp-video-wrapper .vp-telecine-cover video{object-fit:cover}:host .play-button{position:absolute;top:1.5rem;right:1.5rem;width:34px;height:34px;z-index:99}@media (min-width: 768px){:host .play-button.top-right{top:2rem;right:2rem}}:host .play-button.top-left{right:unset;top:1.5rem;left:1.5rem}@media (min-width: 768px){:host .play-button.top-left{bottom:3.75rem;left:2rem}}@media (min-width: 768px){:host .play-button.bottom-left{top:unset;right:unset;bottom:3.75rem;left:2rem}}@media (min-width: 768px){:host .play-button.bottom-right{top:unset;bottom:3.75rem;right:2rem}}:host .play-button.allbp-bottom-right{top:unset;bottom:4.75rem;right:2rem}:host .play-button button{display:inline-block;padding:5px;position:relative;top:-5px;left:-5px;cursor:pointer}@media only screen and (min-width: 768px){:host .play-button button{top:auto;left:auto}}@media only screen and (min-width: 992px){:host .play-button button{padding:0}}:host .play-button button.bg-svg-play,:host .play-button button.bg-svg-pause{background-repeat:no-repeat;background-size:18px 18px;background-position:center;background-color:var(--color-white);width:34px;height:34px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.24);border-radius:4px;border:2px solid var(--color-gray-10)}:host .play-button button.bg-svg-play:hover,:host .play-button button.bg-svg-pause:hover{background-color:var(--color-gray-02)}:host .play-button button.bg-svg-play:active,:host .play-button button.bg-svg-pause:active{transition:none;background-color:var(--color-gray-03)}:host .play-button button.bg-svg-play.active:hover,:host .play-button button.bg-svg-pause.active:hover{background-color:var(--color-gray-05)}:host .play-button button.bg-svg-play.active:active,:host .play-button button.bg-svg-pause.active:active{transition:none;background-color:var(--color-gray-03)}:host .play-button button.bg-svg-play:focus,:host .play-button button.bg-svg-pause:focus{border-radius:var(--ptc-border-radius-standard);border:2px solid white;outline:5px solid var(--keyboard-nav-outline)}:host .play-button button.bg-svg-play{background-image:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 18\" id=\"play\"><path d=\"M11.9625 9L0.0374756 0V18L11.9625 9Z\"></path></svg>')}:host .play-button button.bg-svg-pause{background-image:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 14 18\" id=\"pause\"><path id=\"rect28\" d=\"M 0,0 H 4 V 18 H 0 Z\"></path><path id=\"rect30\" d=\"m 10,0 h 4 v 18 h -4 z\"></path></svg>')}";
4
+ const ptcBackgroundVideoCss = "h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{word-break:break-word;hyphens:manual;-webkit-hyphens:manual;-moz-hyphens:manual;-ms-hyphens:manual}@supports (hyphenate-limit-chars: 12 3 3){h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;hyphenate-limit-chars:12 3 3;hyphenate-limit-lines:2;hyphenate-limit-last:always;hyphenate-limit-zone:6%;-webkit-hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;-webkit-hyphenate-limit-chars:12 3 3;-webkit-hyphenate-limit-lines:2;-moz-hyphens:auto;-moz-hyphenate-limit-chars:12 3 3;-moz-hyphenate-limit-lines:2;-ms-hyphens:auto;-ms-hyphenate-limit-chars:12 3 3;-ms-hyphenate-limit-lines:2}}:host{display:block;position:relative}:host video{position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden;pointer-events:none;z-index:-100;object-fit:cover}:host .video-overlay{z-index:1;display:block;position:absolute;width:100%;height:100%;top:0;left:0;opacity:0.8;background-image:linear-gradient(270deg, rgba(30, 38, 38, 0) 26%, #1e2626)}:host .video-overlay.dark{background-color:rgba(0, 0, 0, 0.6)}:host(.legacy){display:block;position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden;pointer-events:none;z-index:-100}:host(.legacy) video{object-fit:cover;position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden}:host .iframe-wrapper{position:absolute;top:0px;left:0px;right:0;width:100%;height:100%;overflow:hidden;pointer-events:none;z-index:-100}:host .iframe-wrapper .background-video-embed{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:100%;height:100%}:host .iframe-wrapper .player .vp-video-wrapper .vp-telecine-cover video{object-fit:cover}:host .play-button{position:absolute;top:1.5rem;right:1.5rem;width:34px;height:34px;z-index:99}@media (min-width: 768px){:host .play-button.top-right{top:2rem;right:2rem}}:host .play-button.top-left{right:unset;top:1.5rem;left:1.5rem}@media (min-width: 768px){:host .play-button.top-left{bottom:3.75rem;left:2rem}}@media (min-width: 768px){:host .play-button.bottom-left{top:unset;right:unset;bottom:3.75rem;left:2rem}}@media (min-width: 768px){:host .play-button.bottom-right{top:unset;bottom:3.75rem;right:2rem}}:host .play-button.allbp-bottom-right{top:unset;bottom:4.75rem;right:2rem}:host .play-button button{display:inline-block;padding:5px;position:relative;top:-5px;left:-5px;cursor:pointer}@media only screen and (min-width: 768px){:host .play-button button{top:auto;left:auto}}@media only screen and (min-width: 992px){:host .play-button button{padding:0}}:host .play-button button.bg-svg-play,:host .play-button button.bg-svg-pause{background-repeat:no-repeat;background-size:18px 18px;background-position:center;background-color:var(--color-white);width:34px;height:34px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.24);border-radius:4px;border:2px solid var(--color-gray-10)}:host .play-button button.bg-svg-play:hover,:host .play-button button.bg-svg-pause:hover{background-color:var(--color-gray-02)}:host .play-button button.bg-svg-play:active,:host .play-button button.bg-svg-pause:active{transition:none;background-color:var(--color-gray-03)}:host .play-button button.bg-svg-play.active:hover,:host .play-button button.bg-svg-pause.active:hover{background-color:var(--color-gray-05)}:host .play-button button.bg-svg-play.active:active,:host .play-button button.bg-svg-pause.active:active{transition:none;background-color:var(--color-gray-03)}:host .play-button button.bg-svg-play:focus,:host .play-button button.bg-svg-pause:focus{border-radius:var(--ptc-border-radius-standard);border:2px solid white;outline:5px solid var(--keyboard-nav-outline)}:host .play-button button.bg-svg-play{background-image:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 18\" id=\"play\"><path d=\"M11.9625 9L0.0374756 0V18L11.9625 9Z\"></path></svg>')}:host .play-button button.bg-svg-pause{background-image:url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 14 18\" id=\"pause\"><path id=\"rect28\" d=\"M 0,0 H 4 V 18 H 0 Z\"></path><path id=\"rect30\" d=\"m 10,0 h 4 v 18 h -4 z\"></path></svg>')}:host{display:block;position:relative}:host .media{position:absolute;inset:0;overflow:hidden}:host .background-video,:host .bg-fallback{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}:host .bg-fallback{display:block}";
5
5
 
6
6
  const PtcBackgroundVideo = class {
7
7
  constructor(hostRef) {
8
8
  registerInstance(this, hostRef);
9
+ /** Ensure the first frame is painted and paused. */
10
+ this.showFirstFrame = (v) => {
11
+ v.preload = "auto";
12
+ v.removeAttribute("autoplay");
13
+ v.loop = false;
14
+ const paint = () => {
15
+ try {
16
+ //v.currentTime = 0;
17
+ // If a browser still paints black, try this tiny nudge:
18
+ v.currentTime = 0.1;
19
+ }
20
+ catch (_a) { }
21
+ v.pause();
22
+ };
23
+ if (v.readyState >= 2 /* HAVE_CURRENT_DATA, have enough data */) {
24
+ paint();
25
+ }
26
+ else {
27
+ const onLoaded = () => {
28
+ v.removeEventListener("loadeddata", onLoaded);
29
+ paint();
30
+ };
31
+ v.addEventListener("loadeddata", onLoaded, { once: true });
32
+ v.load();
33
+ }
34
+ };
9
35
  this.videoSrc = undefined;
10
36
  this.posterSrc = undefined;
11
37
  this.overlay = true;
@@ -14,60 +40,105 @@ const PtcBackgroundVideo = class {
14
40
  this.pauseButtonTitle = undefined;
15
41
  this.buttonLocation = "bottom-right";
16
42
  this.buttonTabIndex = 0;
17
- this.paused = undefined;
18
43
  this.trackerId = undefined;
19
44
  this.defer = undefined;
20
45
  this.type = "default";
21
46
  this.isIframe = false;
47
+ this.paused = undefined;
22
48
  this.loadedTrue = false;
49
+ this.reducedMotion = false;
50
+ }
51
+ componentWillLoad() {
52
+ this.paused = false;
53
+ this.reducedMotion = isReducedMotion();
23
54
  }
24
55
  componentDidLoad() {
56
+ const afterMount = () => {
57
+ this.loadedTrue = true;
58
+ this.syncPlaybackWithPreference();
59
+ };
25
60
  if (this.defer) {
26
- nextUserInteractionEvent(this).then(() => {
27
- this.loadedTrue = true;
28
- });
61
+ nextUserInteractionEvent(this).then(afterMount);
29
62
  }
30
63
  else {
31
- this.loadedTrue = true;
64
+ afterMount();
32
65
  }
66
+ this.offMotionListener = onReducedMotionChange((reduced) => {
67
+ this.reducedMotion = reduced;
68
+ // Wait a tick for render to reflect state, then sync playback.
69
+ setTimeout(() => this.syncPlaybackWithPreference(), 0);
70
+ });
33
71
  }
34
- componentWillLoad() {
35
- this.paused = false;
72
+ disconnectedCallback() {
73
+ var _a;
74
+ (_a = this.offMotionListener) === null || _a === void 0 ? void 0 : _a.call(this);
75
+ }
76
+ syncPlaybackWithPreference() {
77
+ if (this.isIframe) {
78
+ return;
79
+ }
80
+ const v = this.videoEl;
81
+ if (!v)
82
+ return;
83
+ if (this.reducedMotion) {
84
+ // Animations OFF, freeze first frame
85
+ this.showFirstFrame(v);
86
+ this.paused = true; //sync icon state
87
+ }
88
+ else {
89
+ // Animations ON, autoplay unless user paused
90
+ v.preload = "auto";
91
+ v.loop = true;
92
+ if (!this.paused) {
93
+ v.setAttribute("autoplay", "");
94
+ v.play().catch(() => { });
95
+ this.paused = false; //sync icon state
96
+ }
97
+ else {
98
+ v.pause();
99
+ this.paused = true; //sync icon state
100
+ }
101
+ }
36
102
  }
103
+ // ------------ Render ------------
37
104
  render() {
38
- const videoContent = this.isIframe ? (h("div", { class: "iframe-wrapper" }, h("iframe", { id: "jumbotron-iframe", src: this.videoSrc, frameborder: 0, allow: "autoplay", allowFullScreen: true, class: "background-video-embed" }))) : (h("video", { src: this.videoSrc, poster: this.posterSrc, autoplay: true, loop: true, muted: true, playsinline: true }));
39
- const placeholderContent = (h("video", { poster: this.posterSrc, autoplay: true, loop: true, muted: true, playsinline: true }));
40
- return (h(Host, { class: this.type }, this.loadedTrue ? videoContent : placeholderContent, !!this.videoSrc && this.playButtonTitle && (h("div", { class: `play-button ${this.buttonLocation}` }, this.paused && (h("ptc-tooltip", { class: "play-btn", mode: "wrapper", description: this.playButtonTitle, position: this.buttonLocation === "allbp-bottom-right"
105
+ const canMountMedia = this.loadedTrue;
106
+ const videoNode = !this.isIframe && canMountMedia && (h("video", { class: "background-video", src: this.videoSrc, muted: true, playsinline: true, autoplay: !this.reducedMotion && !this.paused, loop: !this.reducedMotion, preload: "auto", "aria-hidden": "true", tabindex: "-1", ref: (el) => (this.videoEl = el) }));
107
+ const iframeNode = this.isIframe && canMountMedia && (h("div", { class: "iframe-wrapper" }, h("iframe", { id: "jumbotron-iframe", src: this.videoSrc, frameborder: 0, allow: "autoplay", allowFullScreen: true, class: "background-video-embed", "aria-hidden": "true", tabindex: "-1" })));
108
+ return (h(Host, { class: this.type }, h("div", { class: "media" }, videoNode, iframeNode), !!this.videoSrc && this.playButtonTitle && (h("div", { class: `play-button ${this.buttonLocation}` }, this.paused && (h("ptc-tooltip", { class: "play-btn", mode: "wrapper", description: this.playButtonTitle, position: this.buttonLocation === "allbp-bottom-right"
41
109
  ? "side-left"
42
110
  : "bottom-right", styles: ".wrapper-content.sc-ptc-tooltip .tooltip.sc-ptc-tooltip{min-width:unset!important; white-space: nowrap}" }, h("div", { id: this.trackerId, class: "tracker-div mf-listen" }, h("button", { class: "bg-svg-play", type: "button", tabindex: this.buttonTabIndex, onClick: (e) => this.toggleVideoPlay(e), "aria-label": "Video Play button" })))), !this.paused && !!this.pauseButtonTitle && (h("ptc-tooltip", { class: "pause-btn", mode: "wrapper", description: this.pauseButtonTitle, position: this.buttonLocation === "allbp-bottom-right"
43
111
  ? "side-left"
44
- : "bottom-right", styles: ".wrapper-content.sc-ptc-tooltip .tooltip.sc-ptc-tooltip{min-width:unset!important; white-space: nowrap}" }, h("div", { id: this.trackerId, class: "tracker-div mf-listen" }, h("button", { class: "bg-svg-pause", tabindex: this.buttonTabIndex, type: "button", onClick: (e) => this.toggleVideoPlay(e), "aria-label": "Video Pause button" })))))), this.overlay ? (h("div", { class: `video-overlay ${this.overlayType}` })) : (""), this.type == "default" ? h("slot", null) : ""));
112
+ : "bottom-right", styles: ".wrapper-content.sc-ptc-tooltip .tooltip.sc-ptc-tooltip{min-width:unset!important; white-space: nowrap}" }, h("div", { id: this.trackerId, class: "tracker-div mf-listen" }, h("button", { class: "bg-svg-pause", tabindex: this.buttonTabIndex, type: "button", onClick: (e) => this.toggleVideoPlay(e), "aria-label": "Video Pause button" })))))), this.overlay ? h("div", { class: `video-overlay ${this.overlayType}` }) : "", this.type === "default" ? h("slot", null) : ""));
45
113
  }
46
114
  toggleVideoPlay(e) {
47
115
  e.preventDefault();
48
116
  this.paused = !this.paused;
49
- let video = this.el.shadowRoot.querySelector("video");
50
- if (video) {
51
- if (this.paused) {
52
- video.pause();
53
- }
54
- else {
55
- video.play().catch((z) => console.error(z));
56
- }
117
+ const v = this.videoEl;
118
+ if (!v)
119
+ return;
120
+ if (this.paused) {
121
+ v.pause();
122
+ }
123
+ else {
124
+ v.loop = true;
125
+ if (!this.reducedMotion)
126
+ v.setAttribute("autoplay", "");
127
+ v.play().catch((z) => console.error(z));
57
128
  }
58
129
  }
59
130
  async pauseVideo() {
131
+ var _a;
60
132
  this.paused = true;
61
- let video = this.el.shadowRoot.querySelector("video");
62
- if (video) {
63
- video.pause();
64
- }
133
+ (_a = this.videoEl) === null || _a === void 0 ? void 0 : _a.pause();
65
134
  }
66
135
  async playVideo() {
67
136
  this.paused = false;
68
- let video = this.el.shadowRoot.querySelector("video");
69
- if (video) {
70
- video.play().catch((z) => console.error(z));
137
+ if (this.videoEl) {
138
+ this.videoEl.loop = true;
139
+ if (!this.reducedMotion)
140
+ this.videoEl.setAttribute("autoplay", "");
141
+ this.videoEl.play().catch((z) => console.error(z));
71
142
  }
72
143
  }
73
144
  get el() { return getElement(this); }