@ptcwebops/ptcw-design 6.4.10 → 6.4.11-beta

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 (215) hide show
  1. package/dist/cjs/blogs-search-section.cjs.entry.js +4 -1
  2. package/dist/cjs/buying-option-cards-slider.cjs.entry.js +1 -1
  3. package/dist/cjs/{component-35540bfb.js → component-6a178a16.js} +2643 -832
  4. package/dist/cjs/dynamic-box-bundle.cjs.entry.js +3 -1
  5. package/dist/cjs/featured-list.cjs.entry.js +1 -1
  6. package/dist/cjs/homepage-toggled-content.cjs.entry.js +3 -1
  7. package/dist/cjs/innovator-toggle-container.cjs.entry.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/modal-form-example.cjs.entry.js +109 -0
  10. package/dist/cjs/ptc-announcement.cjs.entry.js +2 -1
  11. package/dist/cjs/ptc-bio-card.cjs.entry.js +1 -1
  12. package/dist/cjs/ptc-button.cjs.entry.js +1 -1
  13. package/dist/cjs/ptc-card-bottom_2.cjs.entry.js +3 -1
  14. package/dist/cjs/ptc-card-content.cjs.entry.js +1 -1
  15. package/dist/cjs/ptc-card_2.cjs.entry.js +5 -4
  16. package/dist/cjs/ptc-case-studies-slider.cjs.entry.js +1 -1
  17. package/dist/cjs/ptc-close-icon_2.cjs.entry.js +24 -24
  18. package/dist/cjs/ptc-data-lookup.cjs.entry.js +1 -2
  19. package/dist/cjs/ptc-featured-list.cjs.entry.js +1 -1
  20. package/dist/cjs/ptc-filter-level-theater.cjs.entry.js +1 -1
  21. package/dist/cjs/{ptc-form-checkbox_2.cjs.entry.js → ptc-form-checkbox_4.cjs.entry.js} +723 -5
  22. package/dist/cjs/ptc-img.cjs.entry.js +87 -7
  23. package/dist/cjs/ptc-jumbotron.cjs.entry.js +11 -5
  24. package/dist/cjs/ptc-modal-quiz.cjs.entry.js +4 -1
  25. package/dist/cjs/ptc-para.cjs.entry.js +1 -1
  26. package/dist/cjs/ptc-picture.cjs.entry.js +0 -17
  27. package/dist/cjs/ptc-podcast-card.cjs.entry.js +1 -1
  28. package/dist/cjs/ptc-preloader.cjs.entry.js +1 -1
  29. package/dist/cjs/ptc-previous-url.cjs.entry.js +11 -2
  30. package/dist/cjs/ptc-pricing-packaging-table.cjs.entry.js +25 -9
  31. package/dist/cjs/ptc-pricing-tabs.cjs.entry.js +1 -1
  32. package/dist/cjs/ptc-product-card.cjs.entry.js +1 -1
  33. package/dist/cjs/ptc-product-category.cjs.entry.js +1 -1
  34. package/dist/cjs/ptc-product-highlight-card.cjs.entry.js +1 -1
  35. package/dist/cjs/ptc-readmore-char.cjs.entry.js +1 -1
  36. package/dist/cjs/ptc-readmore-v3.cjs.entry.js +1 -1
  37. package/dist/cjs/ptc-tooltip-v2.cjs.entry.js +1 -1
  38. package/dist/cjs/ptc-value-led-speed-bump.cjs.entry.js +1 -1
  39. package/dist/cjs/ptc-white-paper.cjs.entry.js +19 -9
  40. package/dist/cjs/ptcw-design.cjs.js +1 -1
  41. package/dist/collection/collection-manifest.json +1 -1
  42. package/dist/collection/components/buying-option-cards-slider/buying-option-cards-slider.css +0 -9
  43. package/dist/collection/components/dynamic-box-bundle/dynamic-box-bundle.js +3 -1
  44. package/dist/collection/components/icon-asset/media/designer-v6.0.7.svg +30 -2
  45. package/dist/collection/components/innovator-toggle-container/innovator-toggle-container.css +24 -0
  46. package/dist/collection/components/organism-bundles/blogs-search-section/blogs-search-section.js +4 -1
  47. package/dist/collection/components/organism-bundles/bundle-featured-list/featured-list.css +24 -0
  48. package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.css +26 -0
  49. package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.js +114 -0
  50. package/dist/collection/components/organism-bundles/homepage-toggled-content/homepage-toggled-content.js +3 -1
  51. package/dist/collection/components/ptc-announcement/ptc-announcement.js +2 -1
  52. package/dist/collection/components/ptc-bio-card/ptc-bio-card.css +24 -0
  53. package/dist/collection/components/ptc-button/ptc-button.css +0 -2
  54. package/dist/collection/components/ptc-card-content/ptc-card-content.css +3 -21
  55. package/dist/collection/components/ptc-card-content/ptc-card-content.js +2 -2
  56. package/dist/collection/components/ptc-card-wrapper/ptc-card-wrapper.js +3 -1
  57. package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.css +24 -0
  58. package/dist/collection/components/ptc-featured-list/ptc-featured-list.css +24 -0
  59. package/dist/collection/components/ptc-filter-level-theater/ptc-filter-level-theater.css +24 -0
  60. package/dist/collection/components/ptc-img/ptc-img.css +76 -0
  61. package/dist/collection/components/ptc-img/ptc-img.js +132 -7
  62. package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +24 -6
  63. package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.js +28 -4
  64. package/dist/collection/components/ptc-modal/ptc-modal.css +5 -0
  65. package/dist/collection/components/ptc-modal/ptc-modal.js +25 -25
  66. package/dist/collection/components/ptc-modal-quiz/ptc-modal-quiz.js +4 -1
  67. package/dist/collection/components/ptc-para/ptc-para.css +3 -0
  68. package/dist/collection/components/ptc-para/ptc-para.js +2 -2
  69. package/dist/collection/components/ptc-picture/ptc-picture.js +0 -40
  70. package/dist/collection/components/ptc-podcast-card/ptc-podcast-card.css +24 -0
  71. package/dist/collection/components/ptc-preloader/ptc-preloader.css +147 -111
  72. package/dist/collection/components/ptc-preloader/ptc-preloader.js +1 -1
  73. package/dist/collection/components/ptc-preloader-section/ptc-preloader-section.css +1 -2
  74. package/dist/collection/components/ptc-preloader-section/ptc-preloader-section.js +4 -3
  75. package/dist/collection/components/ptc-previous-url/ptc-previous-url.css +16 -0
  76. package/dist/collection/components/ptc-previous-url/ptc-previous-url.js +28 -1
  77. package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.js +25 -9
  78. package/dist/collection/components/ptc-pricing-tabs/ptc-pricing-tabs.js +1 -1
  79. package/dist/collection/components/ptc-product-card/ptc-product-card.css +24 -0
  80. package/dist/collection/components/ptc-product-category/ptc-product-category.css +24 -0
  81. package/dist/collection/components/ptc-product-highlight-card/ptc-product-highlight-card.css +24 -0
  82. package/dist/collection/components/ptc-readmore-char/ptc-readmore-char.css +24 -0
  83. package/dist/collection/components/ptc-readmore-v3/ptc-readmore-v3.css +24 -0
  84. package/dist/collection/components/ptc-textfield/ptc-textfield.js +3 -5
  85. package/dist/collection/components/ptc-tooltip-v2/ptc-tooltip-v2.css +24 -0
  86. package/dist/collection/components/ptc-value-led-speed-bump/ptc-value-led-speed-bump.css +24 -0
  87. package/dist/collection/components/ptc-white-paper/ptc-white-paper.css +27 -3
  88. package/dist/collection/components/ptc-white-paper/ptc-white-paper.js +18 -8
  89. package/dist/collection/stories/organisms/eSupport/CaseTracker/preview.stories.js +45 -0
  90. package/dist/collection/stories/organisms/eSupport/SupportArticle/preview.stories.js +47 -0
  91. package/dist/collection/stories/organisms/eSupport/SupportPage/preview.stories.js +157 -0
  92. package/dist/custom-elements/index.d.ts +6 -6
  93. package/dist/custom-elements/index.js +333 -642
  94. package/dist/esm/blogs-search-section.entry.js +4 -1
  95. package/dist/esm/buying-option-cards-slider.entry.js +1 -1
  96. package/dist/esm/{component-8c53e377.js → component-80f298b4.js} +2592 -793
  97. package/dist/esm/dynamic-box-bundle.entry.js +3 -1
  98. package/dist/esm/featured-list.entry.js +1 -1
  99. package/dist/esm/homepage-toggled-content.entry.js +3 -1
  100. package/dist/esm/innovator-toggle-container.entry.js +1 -1
  101. package/dist/esm/loader.js +1 -1
  102. package/dist/esm/modal-form-example.entry.js +105 -0
  103. package/dist/esm/ptc-announcement.entry.js +2 -1
  104. package/dist/esm/ptc-bio-card.entry.js +1 -1
  105. package/dist/esm/ptc-button.entry.js +1 -1
  106. package/dist/esm/ptc-card-bottom_2.entry.js +3 -1
  107. package/dist/esm/ptc-card-content.entry.js +1 -1
  108. package/dist/esm/ptc-card_2.entry.js +5 -4
  109. package/dist/esm/ptc-case-studies-slider.entry.js +1 -1
  110. package/dist/esm/ptc-close-icon_2.entry.js +24 -24
  111. package/dist/esm/ptc-data-lookup.entry.js +1 -2
  112. package/dist/esm/ptc-featured-list.entry.js +1 -1
  113. package/dist/esm/ptc-filter-level-theater.entry.js +1 -1
  114. package/dist/esm/{ptc-form-checkbox_2.entry.js → ptc-form-checkbox_4.entry.js} +722 -6
  115. package/dist/esm/ptc-img.entry.js +87 -7
  116. package/dist/esm/ptc-jumbotron.entry.js +11 -5
  117. package/dist/esm/ptc-modal-quiz.entry.js +4 -1
  118. package/dist/esm/ptc-para.entry.js +1 -1
  119. package/dist/esm/ptc-picture.entry.js +0 -17
  120. package/dist/esm/ptc-podcast-card.entry.js +1 -1
  121. package/dist/esm/ptc-preloader.entry.js +1 -1
  122. package/dist/esm/ptc-previous-url.entry.js +11 -2
  123. package/dist/esm/ptc-pricing-packaging-table.entry.js +25 -9
  124. package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
  125. package/dist/esm/ptc-product-card.entry.js +1 -1
  126. package/dist/esm/ptc-product-category.entry.js +1 -1
  127. package/dist/esm/ptc-product-highlight-card.entry.js +1 -1
  128. package/dist/esm/ptc-readmore-char.entry.js +1 -1
  129. package/dist/esm/ptc-readmore-v3.entry.js +1 -1
  130. package/dist/esm/ptc-tooltip-v2.entry.js +1 -1
  131. package/dist/esm/ptc-value-led-speed-bump.entry.js +1 -1
  132. package/dist/esm/ptc-white-paper.entry.js +19 -9
  133. package/dist/esm/ptcw-design.js +1 -1
  134. package/dist/ptcw-design/media/designer-v6.0.7.svg +30 -2
  135. package/dist/ptcw-design/{p-614b66d8.entry.js → p-0451b768.entry.js} +1 -1
  136. package/dist/ptcw-design/p-04891836.entry.js +1 -0
  137. package/dist/ptcw-design/p-17b8281a.entry.js +1 -0
  138. package/dist/ptcw-design/p-187ef77b.entry.js +1 -0
  139. package/dist/ptcw-design/p-2670ac97.entry.js +1 -0
  140. package/dist/ptcw-design/{p-4b41fe4e.entry.js → p-312c41b8.entry.js} +1 -1
  141. package/dist/ptcw-design/{p-1d789cd7.entry.js → p-32bec5ef.entry.js} +1 -1
  142. package/dist/ptcw-design/p-349f43d5.entry.js +1 -0
  143. package/dist/ptcw-design/p-390c0dee.entry.js +1 -0
  144. package/dist/ptcw-design/p-3b40bfbf.entry.js +68 -0
  145. package/dist/ptcw-design/p-502f534b.entry.js +1 -0
  146. package/dist/ptcw-design/p-5aaf4e15.entry.js +1 -0
  147. package/dist/ptcw-design/p-672a349f.js +336 -0
  148. package/dist/ptcw-design/p-6f9f55b3.entry.js +1 -0
  149. package/dist/ptcw-design/{p-365646b8.entry.js → p-7218fe2c.entry.js} +1 -1
  150. package/dist/ptcw-design/{p-2a3c8a30.entry.js → p-7235425a.entry.js} +1 -1
  151. package/dist/ptcw-design/p-74097f89.entry.js +1 -0
  152. package/dist/ptcw-design/p-799afee5.entry.js +1 -0
  153. package/dist/ptcw-design/p-7fe4d383.entry.js +1 -0
  154. package/dist/ptcw-design/p-8fb48953.entry.js +1 -0
  155. package/dist/ptcw-design/p-96f346c4.entry.js +1 -0
  156. package/dist/ptcw-design/{p-db882e62.entry.js → p-9da57f76.entry.js} +1 -1
  157. package/dist/ptcw-design/{p-121a9ef6.entry.js → p-b0a16f1a.entry.js} +1 -1
  158. package/dist/ptcw-design/p-b684ca9d.entry.js +1 -0
  159. package/dist/ptcw-design/p-c09a8288.entry.js +1 -0
  160. package/dist/ptcw-design/p-cb0e3ec2.entry.js +1 -0
  161. package/dist/ptcw-design/p-de960790.entry.js +1 -0
  162. package/dist/ptcw-design/p-e3a6ed56.entry.js +1 -0
  163. package/dist/ptcw-design/p-ef870202.entry.js +1 -0
  164. package/dist/ptcw-design/{p-f0958536.entry.js → p-f010c07f.entry.js} +1 -1
  165. package/dist/ptcw-design/p-f6b70f68.entry.js +1 -0
  166. package/dist/ptcw-design/ptcw-design.css +4 -3
  167. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  168. package/dist/types/components/organism-bundles/form/modal-from-example/modal-form-example.d.ts +25 -0
  169. package/dist/types/components/ptc-card-content/ptc-card-content.d.ts +1 -1
  170. package/dist/types/components/ptc-img/ptc-img.d.ts +29 -1
  171. package/dist/types/components/ptc-jumbotron/ptc-jumbotron.d.ts +4 -0
  172. package/dist/types/components/ptc-mobile-select/mobile-select/dist/mobile-select.d.ts +209 -0
  173. package/dist/types/components/ptc-modal/ptc-modal.d.ts +1 -1
  174. package/dist/types/components/ptc-para/ptc-para.d.ts +1 -1
  175. package/dist/types/components/ptc-picture/ptc-picture.d.ts +0 -2
  176. package/dist/types/components/ptc-previous-url/ptc-previous-url.d.ts +2 -0
  177. package/dist/types/components.d.ts +53 -26
  178. package/dist/types/utils/eloqua.d.ts +9 -0
  179. package/package.json +1 -1
  180. package/readme.md +5 -1
  181. package/dist/cjs/component-1b8ad4d2.js +0 -1819
  182. package/dist/cjs/ptc-multi-select_2.cjs.entry.js +0 -730
  183. package/dist/cjs/ptc-subnav-v2.cjs.entry.js +0 -533
  184. package/dist/collection/components/ptc-subnav-v2/ptc-subnav-v2.css +0 -411
  185. package/dist/collection/components/ptc-subnav-v2/ptc-subnav-v2.js +0 -585
  186. package/dist/collection/stories/organisms/ptc/Subnav New/preview.stories.js +0 -360
  187. package/dist/esm/component-9beac35b.js +0 -1802
  188. package/dist/esm/ptc-multi-select_2.entry.js +0 -725
  189. package/dist/esm/ptc-subnav-v2.entry.js +0 -529
  190. package/dist/ptcw-design/p-009fbf1f.entry.js +0 -1
  191. package/dist/ptcw-design/p-00e21489.entry.js +0 -1
  192. package/dist/ptcw-design/p-1a853854.entry.js +0 -1
  193. package/dist/ptcw-design/p-1f15239e.entry.js +0 -1
  194. package/dist/ptcw-design/p-2bfd8371.entry.js +0 -1
  195. package/dist/ptcw-design/p-2e6e2a9d.entry.js +0 -1
  196. package/dist/ptcw-design/p-3ed4a7ed.entry.js +0 -1
  197. package/dist/ptcw-design/p-56a73429.entry.js +0 -1
  198. package/dist/ptcw-design/p-80ee97a2.entry.js +0 -1
  199. package/dist/ptcw-design/p-850a6205.entry.js +0 -1
  200. package/dist/ptcw-design/p-8aeb229a.entry.js +0 -1
  201. package/dist/ptcw-design/p-8ef0e26e.entry.js +0 -68
  202. package/dist/ptcw-design/p-9027d2d9.entry.js +0 -1
  203. package/dist/ptcw-design/p-9493dfa0.entry.js +0 -1
  204. package/dist/ptcw-design/p-95efe7ee.entry.js +0 -1
  205. package/dist/ptcw-design/p-98426799.js +0 -203
  206. package/dist/ptcw-design/p-98844b50.js +0 -134
  207. package/dist/ptcw-design/p-b44f4fb1.entry.js +0 -1
  208. package/dist/ptcw-design/p-b5e849da.entry.js +0 -1
  209. package/dist/ptcw-design/p-b89136c6.entry.js +0 -1
  210. package/dist/ptcw-design/p-c42e9110.entry.js +0 -1
  211. package/dist/ptcw-design/p-cad4b517.entry.js +0 -1
  212. package/dist/ptcw-design/p-e976a798.entry.js +0 -1
  213. package/dist/ptcw-design/p-f13c7959.entry.js +0 -1
  214. package/dist/ptcw-design/p-f3d3c161.entry.js +0 -1
  215. package/dist/types/components/ptc-subnav-v2/ptc-subnav-v2.d.ts +0 -66
@@ -1,585 +0,0 @@
1
- import { Host, h } from "@stencil/core";
2
- export class PtcSubnavV2 {
3
- constructor() {
4
- this.cachedNavItems = null;
5
- this.isSticky = false;
6
- this.originalTop = 0;
7
- this.placeholderElement = null;
8
- this.measurementElement = null;
9
- this.handleClickOutside = (event) => {
10
- if (!this.el.contains(event.target)) {
11
- this.showOverflowMenu = false;
12
- }
13
- };
14
- this.handleKeyDown = (event) => {
15
- var _a;
16
- if (event.key === "Escape" && this.showOverflowMenu) {
17
- this.showOverflowMenu = false;
18
- (_a = this.overflowButton) === null || _a === void 0 ? void 0 : _a.focus();
19
- }
20
- };
21
- this.handleScroll = () => {
22
- // Throttle scroll events for better performance
23
- if (this.scrollThrottleTimeout) {
24
- return;
25
- }
26
- this.scrollThrottleTimeout = window.setTimeout(() => {
27
- // Don't update active state if user just manually navigated
28
- if (this.isManualNavigation) {
29
- this.scrollThrottleTimeout = null;
30
- return;
31
- }
32
- // Fallback scroll handler to ensure active state is updated
33
- const navItems = this.getNavItems();
34
- const subnavHeight = this.el.offsetHeight;
35
- const scrollPosition = window.scrollY + subnavHeight + 100; // Offset for better detection
36
- // Find the section that should be active based on scroll position
37
- let activeSection = navItems[0].id; // Default to first section
38
- for (let i = navItems.length - 1; i >= 0; i--) {
39
- const section = document.getElementById(navItems[i].id);
40
- if (section && section.offsetTop <= scrollPosition) {
41
- activeSection = navItems[i].id;
42
- break;
43
- }
44
- }
45
- // Only update if different from current active
46
- if (activeSection !== this.currentActive) {
47
- this.currentActive = activeSection;
48
- }
49
- this.scrollThrottleTimeout = null;
50
- }, 16); // ~60fps throttling
51
- };
52
- this.initializeStickyPosition = () => {
53
- // Store the original position of the subnav
54
- const rect = this.el.getBoundingClientRect();
55
- this.originalTop = rect.top + window.scrollY;
56
- };
57
- this.handleStickyScroll = () => {
58
- // Throttle sticky scroll events for better performance
59
- if (this.stickyScrollTimeout) {
60
- return;
61
- }
62
- this.stickyScrollTimeout = window.setTimeout(() => {
63
- var _a;
64
- const scrollY = window.scrollY;
65
- // Check if we should make the subnav sticky
66
- const shouldBeSticky = scrollY >= this.originalTop;
67
- if (shouldBeSticky && !this.isSticky) {
68
- // Store the original height before making it fixed
69
- const originalHeight = this.el.offsetHeight;
70
- // Create placeholder element to maintain space
71
- this.placeholderElement = document.createElement("div");
72
- this.placeholderElement.style.height = `${originalHeight}px`;
73
- this.placeholderElement.style.width = "100%";
74
- this.placeholderElement.style.pointerEvents = "none";
75
- // Insert placeholder before the subnav
76
- (_a = this.el.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(this.placeholderElement, this.el);
77
- // Add transition class for smooth animation
78
- this.el.classList.add("sticky-transition");
79
- // Apply fixed positioning with smooth transition
80
- this.el.style.position = "fixed";
81
- this.el.style.top = "0";
82
- this.el.style.left = "0";
83
- this.el.style.right = "0";
84
- this.el.style.width = "100%";
85
- this.el.style.zIndex = "105";
86
- this.el.style.transform = "translateY(0)";
87
- this.isSticky = true;
88
- }
89
- else if (!shouldBeSticky && this.isSticky) {
90
- // Remove transition class and reset transform
91
- this.el.classList.remove("sticky-transition");
92
- this.el.style.transform = "";
93
- // Remove fixed positioning and restore original position
94
- this.el.style.position = "";
95
- this.el.style.top = "";
96
- this.el.style.left = "";
97
- this.el.style.right = "";
98
- this.el.style.width = "";
99
- this.el.style.zIndex = "";
100
- this.isSticky = false;
101
- // Remove placeholder element
102
- if (this.placeholderElement) {
103
- this.placeholderElement.remove();
104
- this.placeholderElement = null;
105
- }
106
- }
107
- this.stickyScrollTimeout = null;
108
- }, 16); // ~60fps throttling
109
- };
110
- this.handleResize = () => {
111
- this.navContainer && setTimeout(() => this.calculateVisibleItems(), 10);
112
- // Recalculate original position on resize
113
- if (!this.isSticky) {
114
- this.initializeStickyPosition();
115
- }
116
- else if (this.placeholderElement) {
117
- // Update placeholder height if sticky and resized
118
- const currentHeight = this.el.offsetHeight;
119
- this.placeholderElement.style.height = `${currentHeight}px`;
120
- // Update originalTop based on placeholder position (layout may have changed)
121
- const placeholderRect = this.placeholderElement.getBoundingClientRect();
122
- this.originalTop = placeholderRect.top + window.scrollY;
123
- }
124
- };
125
- this.setupIntersectionObserver = () => {
126
- // Get all sections that correspond to our navigation items
127
- const navItems = this.getNavItems();
128
- // Create intersection observer
129
- this.intersectionObserver = new IntersectionObserver((entries) => {
130
- // Clear any existing timeout
131
- if (this.scrollTimeout) {
132
- clearTimeout(this.scrollTimeout);
133
- }
134
- // Debounce the intersection changes
135
- this.scrollTimeout = window.setTimeout(() => {
136
- // Don't update active state if user just manually navigated
137
- if (this.isManualNavigation) {
138
- return;
139
- }
140
- // Find all intersecting sections
141
- const intersectingSections = entries.filter((entry) => entry.isIntersecting);
142
- if (intersectingSections.length > 0) {
143
- // Sort by intersection ratio (how much of the section is visible)
144
- // and then by position (top to bottom)
145
- intersectingSections.sort((a, b) => {
146
- // First sort by intersection ratio (higher = more visible)
147
- if (b.intersectionRatio !== a.intersectionRatio) {
148
- return (b.intersectionRatio - a.intersectionRatio);
149
- }
150
- // If intersection ratios are equal, sort by position
151
- return (a.boundingClientRect.top -
152
- b.boundingClientRect.top);
153
- });
154
- // Get the most visible section
155
- const mostVisibleSection = intersectingSections[0];
156
- const sectionId = mostVisibleSection.target.id;
157
- if (sectionId && sectionId !== this.currentActive) {
158
- this.currentActive = sectionId;
159
- }
160
- }
161
- }, 100); // Increased debounce time for better performance
162
- }, {
163
- root: null,
164
- rootMargin: "-20% 0px -60% 0px",
165
- threshold: [0, 0.1, 0.25, 0.5, 0.75, 1.0], // Multiple thresholds for better detection
166
- });
167
- // Observe all sections
168
- navItems.forEach((item) => {
169
- const section = document.getElementById(item.id);
170
- if (section) {
171
- this.intersectionObserver.observe(section);
172
- }
173
- });
174
- };
175
- this.setupResizeObserver = () => {
176
- // Observe the parent element for layout changes
177
- this.resizeObserver = new ResizeObserver(() => {
178
- // Recalculate sticky position when parent layout changes
179
- if (!this.isSticky) {
180
- this.initializeStickyPosition();
181
- }
182
- else if (this.placeholderElement) {
183
- // If sticky, update originalTop based on placeholder position
184
- const placeholderRect = this.placeholderElement.getBoundingClientRect();
185
- this.originalTop = placeholderRect.top + window.scrollY;
186
- }
187
- });
188
- // Observe the element's parent or the element itself
189
- if (this.el.parentElement) {
190
- this.resizeObserver.observe(this.el.parentElement);
191
- }
192
- };
193
- this.extractNavItemsFromSlots = () => {
194
- const slotElement = this.el.querySelector('[slot="nav-items"]');
195
- if (!slotElement)
196
- return null;
197
- const links = slotElement.querySelectorAll("a");
198
- const items = Array.from(links)
199
- .map((link) => {
200
- var _a, _b;
201
- return ({
202
- id: ((_a = link.getAttribute("href")) === null || _a === void 0 ? void 0 : _a.substring(1)) || "",
203
- label: ((_b = link.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || "",
204
- title: link.getAttribute("title") || undefined,
205
- trackerId: link.getAttribute("tracker-id") || undefined,
206
- });
207
- })
208
- .filter((item) => Boolean(item.id && item.label));
209
- return items.length > 0 ? items : null;
210
- };
211
- this.getNavItems = () => {
212
- // Return cached items if available
213
- if (this.cachedNavItems) {
214
- return this.cachedNavItems;
215
- }
216
- // Extract navigation items from slots (SEO-friendly approach)
217
- const slotItems = this.extractNavItemsFromSlots();
218
- if (slotItems) {
219
- this.cachedNavItems = slotItems;
220
- return slotItems;
221
- }
222
- // If navItems prop is provided, parse and use it (fallback)
223
- const propItems = this.parsePropNavItems();
224
- if (propItems) {
225
- this.cachedNavItems = propItems;
226
- return propItems;
227
- }
228
- // Return empty array if no navigation items found
229
- console.warn("No navigation items found in slots or props for ptc-subnav-v2");
230
- return [];
231
- };
232
- this.hasActiveOverflowItem = () => {
233
- return this.overflowItems.some((item) => item.id === this.currentActive);
234
- };
235
- this.hasSubnavMenuRightContent = () => {
236
- const slotElement = this.el.querySelector('[slot="subnav-menu-right"]');
237
- return Boolean(slotElement === null || slotElement === void 0 ? void 0 : slotElement.children.length);
238
- };
239
- this.calculateVisibleItems = () => {
240
- const navItems = this.getNavItems();
241
- // Handle case where no navigation items are found
242
- if (navItems.length === 0) {
243
- this.visibleItems = [];
244
- this.overflowItems = [];
245
- return;
246
- }
247
- // Check if we're in mobile mode (below 767px)
248
- const wasMobile = this.isMobile;
249
- this.isMobile = window.innerWidth <= 767;
250
- // Force re-render if mobile state changed
251
- if (wasMobile !== this.isMobile) {
252
- this.showOverflowMenu = false; // Close any open menus when switching modes
253
- }
254
- if (this.isMobile) {
255
- // On mobile, show only the current active item
256
- const activeItem = navItems.find((item) => item.id === this.currentActive) ||
257
- navItems[0];
258
- this.visibleItems = [activeItem];
259
- this.overflowItems = navItems.filter((item) => item.id !== activeItem.id);
260
- }
261
- else {
262
- // Desktop behavior - calculate based on available width
263
- const containerWidth = this.navContainer
264
- ? this.navContainer.offsetWidth
265
- : 0;
266
- const buttonWidth = this.overflowButton
267
- ? this.overflowButton.offsetWidth + 32
268
- : 0; // 32px for gap
269
- const availableWidth = containerWidth - buttonWidth - 48; // 48px for right margin
270
- // Fallback if container width is not available yet
271
- if (containerWidth === 0) {
272
- this.visibleItems = navItems;
273
- this.overflowItems = [];
274
- return;
275
- }
276
- let visibleCount = 0;
277
- let totalWidth = 0;
278
- // Create or reuse measurement element
279
- if (!this.measurementElement) {
280
- this.measurementElement = document.createElement("div");
281
- this.measurementElement.style.position = "absolute";
282
- this.measurementElement.style.visibility = "hidden";
283
- this.measurementElement.style.whiteSpace = "nowrap";
284
- this.measurementElement.style.fontSize = "14px";
285
- this.measurementElement.style.fontWeight = "700";
286
- this.measurementElement.style.padding = "20px 0 20px 0";
287
- document.body.appendChild(this.measurementElement);
288
- }
289
- for (let i = 0; i < navItems.length; i++) {
290
- const item = navItems[i];
291
- this.measurementElement.textContent = item.label;
292
- const itemWidth = this.measurementElement.offsetWidth + 32; // 32px for gap
293
- if (totalWidth + itemWidth <= availableWidth) {
294
- totalWidth += itemWidth;
295
- visibleCount++;
296
- }
297
- else {
298
- break;
299
- }
300
- }
301
- this.visibleItems = navItems.slice(0, visibleCount);
302
- this.overflowItems = navItems.slice(visibleCount);
303
- }
304
- // Don't automatically show overflow menu - it should be closed by default
305
- // this.showOverflowMenu = this.overflowItems.length > 0;
306
- };
307
- this.toggleOverflowMenu = () => {
308
- this.showOverflowMenu = !this.showOverflowMenu;
309
- // After opening, measure and decide alignment to avoid viewport overflow
310
- if (!this.showOverflowMenu) {
311
- return;
312
- }
313
- requestAnimationFrame(() => {
314
- const container = this.overflowMenuContainer;
315
- const dropdown = this.overflowDropdownEl;
316
- if (!container || !dropdown)
317
- return;
318
- const containerRect = container.getBoundingClientRect();
319
- // Default positioning is right: -2px inside container
320
- const dropdownWidth = dropdown.offsetWidth || 0;
321
- const rightEdge = containerRect.right + 2;
322
- const leftEdge = rightEdge - dropdownWidth;
323
- // If left edge would be off the viewport, flip to left aligned
324
- this.overflowDropdownAlignLeft = leftEdge < 8; // keep a small gutter
325
- });
326
- };
327
- this.handleNavClick = (event, section) => {
328
- event.preventDefault();
329
- this.currentActive = section;
330
- // Set manual navigation flag to prevent intersection observer from overriding
331
- this.isManualNavigation = true;
332
- // Clear any existing manual navigation timeout
333
- if (this.manualNavigationTimeout) {
334
- clearTimeout(this.manualNavigationTimeout);
335
- }
336
- // Reset manual navigation flag after scroll animation completes
337
- this.manualNavigationTimeout = window.setTimeout(() => {
338
- this.isManualNavigation = false;
339
- }, 1500); // Give enough time for smooth scroll to complete
340
- // Emit custom event for parent components
341
- const customEvent = new CustomEvent("sectionChange", {
342
- detail: { section },
343
- bubbles: true,
344
- composed: true,
345
- });
346
- this.el.dispatchEvent(customEvent);
347
- // Smooth scroll to section if it exists, accounting for sticky nav height
348
- const targetElement = document.querySelector(`#${section}`);
349
- if (targetElement) {
350
- // Get the sticky nav height
351
- const navHeight = this.el.offsetHeight;
352
- // Calculate the target position with offset
353
- const targetPosition = targetElement.getBoundingClientRect().top +
354
- window.scrollY -
355
- navHeight;
356
- // Smooth scroll to the adjusted position
357
- window.scrollTo({
358
- top: targetPosition,
359
- behavior: "smooth",
360
- });
361
- }
362
- };
363
- this.activeSection = "overview";
364
- this.navItems = "";
365
- this.currentActive = "overview";
366
- this.visibleItems = [];
367
- this.overflowItems = [];
368
- this.showOverflowMenu = false;
369
- this.overflowDropdownAlignLeft = false;
370
- this.isMobile = false;
371
- this.isManualNavigation = false;
372
- }
373
- componentWillLoad() {
374
- this.currentActive = this.activeSection;
375
- }
376
- componentDidLoad() {
377
- this.bindEventHandlers();
378
- this.handleResize();
379
- this.addEventListeners();
380
- this.setupIntersectionObserver();
381
- this.setupResizeObserver();
382
- this.initializeStickyPosition();
383
- }
384
- bindEventHandlers() {
385
- this.boundHandleResize = this.handleResize.bind(this);
386
- this.boundHandleClickOutside = this.handleClickOutside.bind(this);
387
- this.boundHandleScroll = this.handleScroll.bind(this);
388
- this.boundHandleKeyDown = this.handleKeyDown.bind(this);
389
- this.boundHandleStickyScroll = this.handleStickyScroll.bind(this);
390
- }
391
- addEventListeners() {
392
- window.addEventListener("resize", this.boundHandleResize);
393
- document.addEventListener("click", this.boundHandleClickOutside);
394
- document.addEventListener("keydown", this.boundHandleKeyDown);
395
- window.addEventListener("scroll", this.boundHandleScroll, {
396
- passive: true,
397
- });
398
- window.addEventListener("scroll", this.boundHandleStickyScroll, {
399
- passive: true,
400
- });
401
- }
402
- disconnectedCallback() {
403
- this.removeEventListeners();
404
- this.cleanupTimeouts();
405
- this.cleanupIntersectionObserver();
406
- this.cleanupResizeObserver();
407
- this.cleanupElements();
408
- }
409
- removeEventListeners() {
410
- window.removeEventListener("resize", this.boundHandleResize);
411
- document.removeEventListener("click", this.boundHandleClickOutside);
412
- document.removeEventListener("keydown", this.boundHandleKeyDown);
413
- window.removeEventListener("scroll", this.boundHandleScroll);
414
- window.removeEventListener("scroll", this.boundHandleStickyScroll);
415
- }
416
- cleanupTimeouts() {
417
- if (this.scrollTimeout)
418
- clearTimeout(this.scrollTimeout);
419
- if (this.scrollThrottleTimeout)
420
- clearTimeout(this.scrollThrottleTimeout);
421
- if (this.manualNavigationTimeout)
422
- clearTimeout(this.manualNavigationTimeout);
423
- if (this.stickyScrollTimeout)
424
- clearTimeout(this.stickyScrollTimeout);
425
- }
426
- cleanupIntersectionObserver() {
427
- if (this.intersectionObserver) {
428
- this.intersectionObserver.disconnect();
429
- }
430
- }
431
- cleanupResizeObserver() {
432
- if (this.resizeObserver) {
433
- this.resizeObserver.disconnect();
434
- }
435
- }
436
- cleanupElements() {
437
- if (this.placeholderElement) {
438
- this.placeholderElement.remove();
439
- this.placeholderElement = null;
440
- }
441
- if (this.measurementElement) {
442
- this.measurementElement.remove();
443
- this.measurementElement = null;
444
- }
445
- }
446
- parsePropNavItems() {
447
- var _a;
448
- if (!((_a = this.navItems) === null || _a === void 0 ? void 0 : _a.trim()))
449
- return null;
450
- try {
451
- const parsedItems = JSON.parse(this.navItems);
452
- if (Array.isArray(parsedItems) && parsedItems.length > 0) {
453
- const validItems = parsedItems.filter((item) => Boolean(item &&
454
- typeof item.id === "string" &&
455
- typeof item.label === "string"));
456
- return validItems.length > 0 ? validItems : null;
457
- }
458
- }
459
- catch (error) {
460
- console.warn("Invalid navItems JSON provided to ptc-subnav-v2:", error);
461
- }
462
- return null;
463
- }
464
- render() {
465
- const navItems = this.getNavItems();
466
- const hasRightContent = this.hasSubnavMenuRightContent();
467
- const selectedMobileItem = this.isMobile
468
- ? navItems.find((item) => item.id === this.currentActive) ||
469
- navItems[0]
470
- : null;
471
- // If no navigation items, don't render the navigation
472
- if (navItems.length === 0) {
473
- return (h(Host, null, h("div", { class: `subnav-container ${!hasRightContent ? "full-width" : ""}` }, hasRightContent && (h("div", { class: "subnav-menu-right" }, h("slot", { name: "subnav-menu-right" }))))));
474
- }
475
- return (h(Host, null, h("div", { class: `subnav-container ${!hasRightContent ? "full-width" : ""}` }, h("nav", { class: `subnav-menu-left ${!hasRightContent ? "full-width" : ""}`, role: "navigation", "aria-label": "Sub navigation", ref: (el) => (this.navContainer = el) }, this.isMobile ? (
476
- // Mobile layout - dropdown with arrows
477
- h("div", { class: "mobile-dropdown-container" }, h("button", { class: "mobile-dropdown-button", onClick: this.toggleOverflowMenu, onKeyDown: (e) => {
478
- if (e.key === "Enter" ||
479
- e.key === " ") {
480
- e.preventDefault();
481
- this.toggleOverflowMenu();
482
- }
483
- }, "aria-expanded": this.showOverflowMenu, "aria-haspopup": "true", "aria-label": `${(selectedMobileItem === null || selectedMobileItem === void 0 ? void 0 : selectedMobileItem.label) || "Select Section"} - Choose navigation section`, "tracker-id": "mobile-dropdown-button", ref: (el) => (this.overflowButton = el) }, h("span", { class: "mobile-selected-item" }, (selectedMobileItem === null || selectedMobileItem === void 0 ? void 0 : selectedMobileItem.label) ||
484
- "Select Section"), h("span", { class: `mobile-arrow ${this.showOverflowMenu ? "rotated" : ""}`, "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", "aria-hidden": "true" }, h("path", { d: "M1 1.5L5.94975 6.44975L10.8995 1.5", stroke: "#00890B", "stroke-width": "2", "stroke-linecap": "round" })))), this.showOverflowMenu && (h("ul", { class: "mobile-dropdown", role: "menu", "aria-label": "Navigation sections" }, navItems.map((item) => (h("li", { key: item.id, class: "mf-listen", id: item.trackerId ||
485
- `mobile-nav-${item.id}` }, h("a", { href: `#${item.id}`, class: `mobile-dropdown-item ${this.currentActive ===
486
- item.id
487
- ? "active"
488
- : ""}`, role: "menuitem", "aria-current": this.currentActive ===
489
- item.id
490
- ? "page"
491
- : undefined, title: item.title || "", onClick: (e) => {
492
- this.handleNavClick(e, item.id);
493
- this.showOverflowMenu = false;
494
- } }, item.label)))))))) : (
495
- // Desktop layout - original behavior
496
- h("ul", { class: "desktop-menu" }, this.visibleItems.map((item) => (h("li", { key: item.id, class: "mf-listen", id: item.trackerId || `nav-${item.id}` }, h("a", { href: `#${item.id}`, class: this.currentActive === item.id
497
- ? "active"
498
- : "", title: item.title || "", onClick: (e) => this.handleNavClick(e, item.id), "aria-current": this.currentActive === item.id
499
- ? "page"
500
- : undefined }, item.label)))), this.overflowItems.length > 0 && (h("li", { class: "overflow-menu-container mf-listen", id: "overflow-menu", ref: (el) => (this.overflowMenuContainer = el) }, h("button", { class: `overflow-button ${this.hasActiveOverflowItem() ? "selected-active" : ""}`, onClick: this.toggleOverflowMenu, onKeyDown: (e) => {
501
- if (e.key === "Enter" ||
502
- e.key === " ") {
503
- e.preventDefault();
504
- this.toggleOverflowMenu();
505
- }
506
- }, "aria-expanded": this.showOverflowMenu, "aria-haspopup": "true", "aria-label": "Show more navigation items", "tracker-id": "overflow-button", ref: (el) => (this.overflowButton = el) }, h("span", { class: "overflow-dots", "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", "aria-hidden": "true" }, h("circle", { cx: "1.25", cy: "5", r: "1.25", fill: "#617480" }), h("circle", { cx: "5", cy: "5", r: "1.25", fill: "#617480" }), h("circle", { cx: "8.75", cy: "5", r: "1.25", fill: "#617480" })))), this.showOverflowMenu && (h("div", { class: `overflow-dropdown ${this.overflowDropdownAlignLeft ? "align-left" : "align-right"}`, role: "menu", "aria-label": "Additional navigation sections", ref: (el) => (this.overflowDropdownEl =
507
- el) }, this.overflowItems.map((item) => (h("a", { key: item.id, href: `#${item.id}`, class: `mf-listen ${this
508
- .currentActive ===
509
- item.id
510
- ? "active"
511
- : ""}`, title: item.title || "", "tracker-id": item.trackerId ||
512
- `overflow-link-${item.id}`, role: "menuitem", onClick: (e) => {
513
- this.handleNavClick(e, item.id);
514
- this.showOverflowMenu = false;
515
- }, "aria-current": this
516
- .currentActive ===
517
- item.id
518
- ? "page"
519
- : undefined }, item.label)))))))))), hasRightContent && (h("div", { class: "subnav-menu-right" }, h("slot", { name: "subnav-menu-right" }))))));
520
- }
521
- static get is() { return "ptc-subnav-v2"; }
522
- static get encapsulation() { return "shadow"; }
523
- static get originalStyleUrls() {
524
- return {
525
- "$": ["ptc-subnav-v2.scss"]
526
- };
527
- }
528
- static get styleUrls() {
529
- return {
530
- "$": ["ptc-subnav-v2.css"]
531
- };
532
- }
533
- static get properties() {
534
- return {
535
- "activeSection": {
536
- "type": "string",
537
- "mutable": false,
538
- "complexType": {
539
- "original": "string",
540
- "resolved": "string",
541
- "references": {}
542
- },
543
- "required": false,
544
- "optional": false,
545
- "docs": {
546
- "tags": [],
547
- "text": ""
548
- },
549
- "attribute": "active-section",
550
- "reflect": false,
551
- "defaultValue": "\"overview\""
552
- },
553
- "navItems": {
554
- "type": "string",
555
- "mutable": false,
556
- "complexType": {
557
- "original": "string",
558
- "resolved": "string",
559
- "references": {}
560
- },
561
- "required": false,
562
- "optional": false,
563
- "docs": {
564
- "tags": [],
565
- "text": ""
566
- },
567
- "attribute": "nav-items",
568
- "reflect": false,
569
- "defaultValue": "\"\""
570
- }
571
- };
572
- }
573
- static get states() {
574
- return {
575
- "currentActive": {},
576
- "visibleItems": {},
577
- "overflowItems": {},
578
- "showOverflowMenu": {},
579
- "overflowDropdownAlignLeft": {},
580
- "isMobile": {},
581
- "isManualNavigation": {}
582
- };
583
- }
584
- static get elementRef() { return "el"; }
585
- }