@ptcwebops/ptcw-design 6.4.12 → 6.4.13

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 (114) hide show
  1. package/dist/cjs/{component-35540bfb.js → component-06dda623.js} +1 -1
  2. package/dist/cjs/{component-1b8ad4d2.js → component-5b5b6a98.js} +1 -1
  3. package/dist/cjs/icon-asset_14.cjs.entry.js +1911 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/ptc-data-lookup.cjs.entry.js +2 -2
  6. package/dist/cjs/ptc-form-checkbox_2.cjs.entry.js +1 -1
  7. package/dist/cjs/ptc-multi-select_2.cjs.entry.js +2 -2
  8. package/dist/cjs/ptc-search-field.cjs.entry.js +95 -0
  9. package/dist/cjs/ptcw-design.cjs.js +1 -1
  10. package/dist/collection/components/ptc-subnav-v2/ptc-subnav-v2.js +2 -1
  11. package/dist/custom-elements/index.js +3 -2
  12. package/dist/esm/blog-detail-content_2.entry.js +1 -1
  13. package/dist/esm/blog-detail-layout.entry.js +1 -1
  14. package/dist/esm/blogs-search-section.entry.js +1 -1
  15. package/dist/esm/{component-8c53e377.js → component-274da230.js} +1 -1
  16. package/dist/esm/{component-9beac35b.js → component-341e4eaa.js} +1 -1
  17. package/dist/esm/homepage-jumbotron.entry.js +1 -1
  18. package/dist/esm/homepage-toggled-content.entry.js +1 -1
  19. package/dist/esm/icon-asset_14.entry.js +1894 -0
  20. package/dist/esm/innovator-toggle-container.entry.js +1 -1
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/most-popular-news.entry.js +1 -1
  23. package/dist/esm/my-component.entry.js +1 -1
  24. package/dist/esm/ptc-accordion-item.entry.js +1 -1
  25. package/dist/esm/ptc-collapse-list.entry.js +1 -1
  26. package/dist/esm/ptc-data-lookup.entry.js +2 -2
  27. package/dist/esm/ptc-form-checkbox_2.entry.js +2 -2
  28. package/dist/esm/ptc-homepage-image-feature.entry.js +1 -1
  29. package/dist/esm/ptc-homepage-video-background.entry.js +1 -1
  30. package/dist/esm/ptc-icon-card.entry.js +1 -1
  31. package/dist/esm/ptc-link.entry.js +1 -1
  32. package/dist/esm/ptc-media-card.entry.js +1 -1
  33. package/dist/esm/ptc-multi-select_2.entry.js +3 -3
  34. package/dist/esm/ptc-pricing-packaging-table.entry.js +1 -1
  35. package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
  36. package/dist/esm/ptc-search-field.entry.js +91 -0
  37. package/dist/esm/ptc-social-icons-footer.entry.js +1 -1
  38. package/dist/esm/ptcw-design.js +1 -1
  39. package/dist/esm/{utils-bdd0cc16.js → utils-a64ba942.js} +1 -1
  40. package/dist/ptcw-design/{p-2efd18d8.entry.js → p-0824f503.entry.js} +1 -1
  41. package/dist/ptcw-design/{p-bb86265c.entry.js → p-140c134e.entry.js} +1 -1
  42. package/dist/ptcw-design/{p-c7e948b2.js → p-22cf00e7.js} +1 -1
  43. package/dist/ptcw-design/{p-a318a793.entry.js → p-2fa5814b.entry.js} +1 -1
  44. package/dist/ptcw-design/{p-c101aeb5.entry.js → p-32bbcb5a.entry.js} +1 -1
  45. package/dist/ptcw-design/{p-b154bbdb.entry.js → p-3596ce5a.entry.js} +1 -1
  46. package/dist/ptcw-design/{p-2f7b6437.entry.js → p-681d26ef.entry.js} +1 -1
  47. package/dist/ptcw-design/{p-7777753a.entry.js → p-7524411a.entry.js} +1 -1
  48. package/dist/ptcw-design/p-809f3878.entry.js +1 -0
  49. package/dist/ptcw-design/{p-850e6e8c.entry.js → p-83632220.entry.js} +1 -1
  50. package/dist/ptcw-design/{p-87215e3a.entry.js → p-87a9a028.entry.js} +1 -1
  51. package/dist/ptcw-design/{p-a81833cd.entry.js → p-9461c4eb.entry.js} +1 -1
  52. package/dist/ptcw-design/{p-804dac0c.entry.js → p-a31f22a1.entry.js} +1 -1
  53. package/dist/ptcw-design/{p-d3c11c68.entry.js → p-b9966f20.entry.js} +1 -1
  54. package/dist/ptcw-design/{p-75c8fceb.entry.js → p-bdb2e42c.entry.js} +1 -1
  55. package/dist/ptcw-design/{p-98844b50.js → p-be533f0d.js} +1 -1
  56. package/dist/ptcw-design/{p-19832538.entry.js → p-bf15988f.entry.js} +1 -1
  57. package/dist/ptcw-design/{p-8234aa2a.entry.js → p-c1302aea.entry.js} +1 -1
  58. package/dist/ptcw-design/{p-03a1e1a5.entry.js → p-d8c1a14a.entry.js} +1 -1
  59. package/dist/ptcw-design/{p-83dabf2e.entry.js → p-e2da8109.entry.js} +1 -1
  60. package/dist/ptcw-design/p-e50a5a46.entry.js +1 -0
  61. package/dist/ptcw-design/{p-a28ff90b.entry.js → p-e51bb274.entry.js} +1 -1
  62. package/dist/ptcw-design/p-eabf87be.entry.js +1 -0
  63. package/dist/ptcw-design/{p-e65cbdb9.entry.js → p-edaf241d.entry.js} +1 -1
  64. package/dist/ptcw-design/{p-5b00a563.entry.js → p-fa045097.entry.js} +1 -1
  65. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  66. package/package.json +1 -1
  67. package/readme.md +1 -1
  68. package/dist/cjs/icon-asset_2.cjs.entry.js +0 -154
  69. package/dist/cjs/interfaces-574e6df7.js +0 -15
  70. package/dist/cjs/list-item.cjs.entry.js +0 -52
  71. package/dist/cjs/max-width-container.cjs.entry.js +0 -54
  72. package/dist/cjs/ptc-background-video.cjs.entry.js +0 -152
  73. package/dist/cjs/ptc-breadcrumb.cjs.entry.js +0 -53
  74. package/dist/cjs/ptc-button.cjs.entry.js +0 -117
  75. package/dist/cjs/ptc-img.cjs.entry.js +0 -136
  76. package/dist/cjs/ptc-jumbotron.cjs.entry.js +0 -184
  77. package/dist/cjs/ptc-para.cjs.entry.js +0 -139
  78. package/dist/cjs/ptc-picture.cjs.entry.js +0 -185
  79. package/dist/cjs/ptc-spacer.cjs.entry.js +0 -38
  80. package/dist/cjs/ptc-subnav-v2.cjs.entry.js +0 -533
  81. package/dist/cjs/ptc-title.cjs.entry.js +0 -161
  82. package/dist/cjs/ptc-tooltip.cjs.entry.js +0 -113
  83. package/dist/esm/icon-asset_2.entry.js +0 -149
  84. package/dist/esm/interfaces-4caedd26.js +0 -12
  85. package/dist/esm/list-item.entry.js +0 -48
  86. package/dist/esm/max-width-container.entry.js +0 -50
  87. package/dist/esm/ptc-background-video.entry.js +0 -148
  88. package/dist/esm/ptc-breadcrumb.entry.js +0 -49
  89. package/dist/esm/ptc-button.entry.js +0 -113
  90. package/dist/esm/ptc-img.entry.js +0 -132
  91. package/dist/esm/ptc-jumbotron.entry.js +0 -180
  92. package/dist/esm/ptc-para.entry.js +0 -135
  93. package/dist/esm/ptc-picture.entry.js +0 -181
  94. package/dist/esm/ptc-spacer.entry.js +0 -34
  95. package/dist/esm/ptc-subnav-v2.entry.js +0 -529
  96. package/dist/esm/ptc-title.entry.js +0 -157
  97. package/dist/esm/ptc-tooltip.entry.js +0 -109
  98. package/dist/ptcw-design/p-07b1afd5.entry.js +0 -1
  99. package/dist/ptcw-design/p-1acd3617.entry.js +0 -1
  100. package/dist/ptcw-design/p-2e288e60.entry.js +0 -1
  101. package/dist/ptcw-design/p-4313edfb.entry.js +0 -1
  102. package/dist/ptcw-design/p-474a9967.entry.js +0 -1
  103. package/dist/ptcw-design/p-561a622f.entry.js +0 -1
  104. package/dist/ptcw-design/p-674c828e.entry.js +0 -1
  105. package/dist/ptcw-design/p-6785dc81.entry.js +0 -1
  106. package/dist/ptcw-design/p-709cc1f0.entry.js +0 -1
  107. package/dist/ptcw-design/p-711bcdad.js +0 -1
  108. package/dist/ptcw-design/p-7226670f.entry.js +0 -1
  109. package/dist/ptcw-design/p-98e2b403.entry.js +0 -1
  110. package/dist/ptcw-design/p-9df3c31f.entry.js +0 -1
  111. package/dist/ptcw-design/p-b3cd2410.entry.js +0 -1
  112. package/dist/ptcw-design/p-d9ec506c.entry.js +0 -1
  113. package/dist/ptcw-design/p-ec22d0b8.entry.js +0 -1
  114. /package/dist/ptcw-design/{p-98426799.js → p-c1513c3f.js} +0 -0
@@ -1,529 +0,0 @@
1
- import { r as registerInstance, h, H as Host, a as getElement } from './index-0bf594c4.js';
2
-
3
- const ptcSubnavV2Css = "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 .mobile-dropdown-container .mobile-dropdown-button,:host .subnav-menu-left .overflow-menu-container .overflow-button,:host .subnav-menu-left ul.desktop-menu li a{color:var(--color-gray-07);text-decoration:none;padding:8px 12px;text-align:center;font-family:var(--ptc-font-latin);font-style:var(--ptc-font-style-normal);font-size:var(--ptc-font-size-xx-small);font-weight:var(--ptc-font-weight-bold);line-height:18px;display:flex;align-items:center;position:relative;border-bottom:3px solid transparent;height:100%;box-sizing:border-box;transition:all 0.2s ease}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown{position:absolute;top:100%;background:var(--color-standard-gray);border-radius:var(--ptc-border-radius-standard);box-shadow:var(--ptc-shadow-x-large);z-index:1001;padding:14px 0;margin-top:-4px;max-width:312px;width:-moz-max-content;width:max-content}:host .mobile-dropdown-container .mobile-dropdown li .mobile-dropdown-item,:host .subnav-menu-left .overflow-menu-container .overflow-dropdown a{display:block;padding:10px 32px 10px 24px;color:var(--color-gray-07);text-decoration:none;font-size:var(--ptc-font-size-xx-small);font-weight:var(--ptc-font-weight-bold);line-height:var(--ptc-line-height-densest);transition:all 0.2s ease;position:relative;border:none}:host{position:relative;display:block;font-family:var(--ptc-font-latin);background-color:var(--color-standard-gray);box-shadow:var(--ptc-shadow-small);transition:all 0.3s ease-in-out}:host.sticky-transition{transition:transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease-in-out, background-color 0.3s ease-in-out;box-shadow:0 2px 8px rgba(0, 0, 0, 0.15)}:host .subnav-container{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:0 24px;margin:0 auto;max-width:1200px;gap:24px}@media only screen and (min-width: 768px){:host .subnav-container{flex-wrap:wrap;gap:48px}}@media only screen and (min-width: 1200px){:host .subnav-container{padding:0;max-width:1136px}}@media only screen and (min-width: 1440px){:host .subnav-container{padding:0;max-width:1200px}}:host .subnav-container.full-width{justify-content:flex-start}:host .subnav-menu-left{display:flex;align-items:center;flex:1;align-self:stretch}@media only screen and (min-width: 768px){:host .subnav-menu-left{justify-content:flex-start}}:host .subnav-menu-left ul.desktop-menu{list-style:none;padding:0;margin:0;display:flex;align-items:center;justify-content:center;gap:4px;flex-wrap:wrap;align-self:stretch}@media only screen and (min-width: 768px){:host .subnav-menu-left ul.desktop-menu{justify-content:flex-start;gap:32px}}:host .subnav-menu-left ul.desktop-menu li{display:inline-block;height:100%}@media only screen and (min-width: 768px){:host .subnav-menu-left ul.desktop-menu li a{padding:20px 0 17px 0}}:host .subnav-menu-left ul.desktop-menu li a:hover{color:var(--color-gray-10)}:host .subnav-menu-left ul.desktop-menu li a.active{color:var(--color-gray-10);border-bottom:3px solid var(--color-green-07)}:host .subnav-menu-left ul.desktop-menu li a:focus-visible{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}:host .subnav-menu-left .overflow-menu-container{position:relative;display:none}@media only screen and (min-width: 768px){:host .subnav-menu-left .overflow-menu-container{display:inline-block}}:host .subnav-menu-left .overflow-menu-container .overflow-button{background:none;border:none;padding:20px 0 17px 0;cursor:pointer;justify-content:center;border-bottom:3px solid transparent;box-sizing:border-box}:host .subnav-menu-left .overflow-menu-container .overflow-button:hover{color:var(--color-gray-10)}:host .subnav-menu-left .overflow-menu-container .overflow-button:focus-visible{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}:host .subnav-menu-left .overflow-menu-container .overflow-button .overflow-dots{border-radius:2px;border:1px solid var(--color-gray-07);line-height:1;width:18px;height:18px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all 0.2s ease;box-sizing:border-box}:host .subnav-menu-left .overflow-menu-container .overflow-button .overflow-dots:hover{background-color:var(--color-gray-04);border-color:var(--color-gray-04)}:host .subnav-menu-left .overflow-menu-container .overflow-button .overflow-dots:hover svg circle{fill:var(--color-gray-10)}:host .subnav-menu-left .overflow-menu-container .overflow-button .overflow-dots:focus-visible{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}:host .subnav-menu-left .overflow-menu-container .overflow-button[aria-expanded],:host .subnav-menu-left .overflow-menu-container .overflow-button.selected-active{border-bottom-color:var(--color-green-07)}:host .subnav-menu-left .overflow-menu-container .overflow-button[aria-expanded] .overflow-dots,:host .subnav-menu-left .overflow-menu-container .overflow-button.selected-active .overflow-dots{background-color:var(--color-green-07);border-color:var(--color-green-07)}:host .subnav-menu-left .overflow-menu-container .overflow-button[aria-expanded] .overflow-dots svg circle,:host .subnav-menu-left .overflow-menu-container .overflow-button.selected-active .overflow-dots svg circle{fill:var(--color-white)}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown.align-right{left:auto;right:-2px}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown.align-left{left:0;right:auto}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown a{text-align:left;line-height:18px}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown a:hover{background-color:var(--color-gray-02);color:var(--color-gray-10)}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown a.active{color:var(--color-gray-10);border-bottom:none}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown a.active::before{content:\"\";display:block;width:2px;height:100%;background-color:var(--color-green-07);position:absolute;left:14px;top:0}:host .subnav-menu-left .overflow-menu-container .overflow-dropdown a:focus-visible{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}:host .subnav-menu-left.full-width{flex:1;width:100%;justify-content:flex-start}:host .subnav-menu-left.full-width .desktop-menu{width:100%}:host .mobile-dropdown-container{position:relative;display:block;height:100%;box-sizing:border-box}@media only screen and (min-width: 768px){:host .mobile-dropdown-container{display:none !important}}:host .mobile-dropdown-container .mobile-dropdown-button{background:transparent;border:none;border-bottom:3px solid var(--color-green-07);padding:20px 0 17px 0;justify-content:center;gap:10px;cursor:pointer}:host .mobile-dropdown-container .mobile-dropdown-button:focus-visible{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}:host .mobile-dropdown-container .mobile-dropdown-button[aria-expanded]{border-color:var(--color-green-07);color:var(--color-gray-10)}:host .mobile-dropdown-container .mobile-dropdown-button .mobile-selected-item{flex:1;text-align:left;color:var(--color-gray-07);font-size:var(--ptc-font-size-xx-small);font-weight:var(--ptc-font-weight-bold);line-height:var(--ptc-line-height-densest);display:-webkit-box;line-clamp:1;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;max-width:100%}:host .mobile-dropdown-container .mobile-dropdown-button .mobile-arrow{display:flex;align-items:center;justify-content:center;transition:transform 0.2s ease}:host .mobile-dropdown-container .mobile-dropdown-button .mobile-arrow svg{transition:transform 0.2s ease}:host .mobile-dropdown-container .mobile-dropdown-button .mobile-arrow.rotated svg{transform:rotate(180deg)}:host .mobile-dropdown-container .mobile-dropdown{position:absolute;top:calc(100% - 8px);left:-2px;background:var(--color-standard-gray);border-radius:var(--ptc-border-radius-standard);box-shadow:var(--ptc-shadow-medium);z-index:1001;margin:4px 0 0 0;overflow-y:auto;min-width:280px;width:-moz-fit-content;width:fit-content;list-style:none;padding:14px 0}:host .mobile-dropdown-container .mobile-dropdown li{display:block}:host .mobile-dropdown-container .mobile-dropdown li:last-child{border-bottom:none}:host .mobile-dropdown-container .mobile-dropdown li .mobile-dropdown-item{width:100%;background:none;text-align:left;cursor:pointer;word-break:break-word;display:block;box-sizing:border-box}:host .mobile-dropdown-container .mobile-dropdown li .mobile-dropdown-item.active{color:var(--color-gray-10)}:host .mobile-dropdown-container .mobile-dropdown li .mobile-dropdown-item.active::before{content:\"\";display:block;width:2px;height:100%;background-color:var(--color-green-07);position:absolute;left:14px;top:0}:host .mobile-dropdown-container .mobile-dropdown li .mobile-dropdown-item:focus-visible{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}:host .subnav-menu-right{max-width:50%;padding:12px 0}@media only screen and (min-width: 768px){:host .subnav-menu-right{width:auto;max-width:300px}}";
4
-
5
- const PtcSubnavV2 = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- this.cachedNavItems = null;
9
- this.isSticky = false;
10
- this.originalTop = 0;
11
- this.placeholderElement = null;
12
- this.measurementElement = null;
13
- this.handleClickOutside = (event) => {
14
- if (!this.el.contains(event.target)) {
15
- this.showOverflowMenu = false;
16
- }
17
- };
18
- this.handleKeyDown = (event) => {
19
- var _a;
20
- if (event.key === "Escape" && this.showOverflowMenu) {
21
- this.showOverflowMenu = false;
22
- (_a = this.overflowButton) === null || _a === void 0 ? void 0 : _a.focus();
23
- }
24
- };
25
- this.handleScroll = () => {
26
- // Throttle scroll events for better performance
27
- if (this.scrollThrottleTimeout) {
28
- return;
29
- }
30
- this.scrollThrottleTimeout = window.setTimeout(() => {
31
- // Don't update active state if user just manually navigated
32
- if (this.isManualNavigation) {
33
- this.scrollThrottleTimeout = null;
34
- return;
35
- }
36
- // Fallback scroll handler to ensure active state is updated
37
- const navItems = this.getNavItems();
38
- const subnavHeight = this.el.offsetHeight;
39
- const scrollPosition = window.scrollY + subnavHeight + 100; // Offset for better detection
40
- // Find the section that should be active based on scroll position
41
- let activeSection = navItems[0].id; // Default to first section
42
- for (let i = navItems.length - 1; i >= 0; i--) {
43
- const section = document.getElementById(navItems[i].id);
44
- if (section && section.offsetTop <= scrollPosition) {
45
- activeSection = navItems[i].id;
46
- break;
47
- }
48
- }
49
- // Only update if different from current active
50
- if (activeSection !== this.currentActive) {
51
- this.currentActive = activeSection;
52
- }
53
- this.scrollThrottleTimeout = null;
54
- }, 16); // ~60fps throttling
55
- };
56
- this.initializeStickyPosition = () => {
57
- // Store the original position of the subnav
58
- const rect = this.el.getBoundingClientRect();
59
- this.originalTop = rect.top + window.scrollY;
60
- };
61
- this.handleStickyScroll = () => {
62
- // Throttle sticky scroll events for better performance
63
- if (this.stickyScrollTimeout) {
64
- return;
65
- }
66
- this.stickyScrollTimeout = window.setTimeout(() => {
67
- var _a;
68
- const scrollY = window.scrollY;
69
- // Check if we should make the subnav sticky
70
- const shouldBeSticky = scrollY >= this.originalTop;
71
- if (shouldBeSticky && !this.isSticky) {
72
- // Store the original height before making it fixed
73
- const originalHeight = this.el.offsetHeight;
74
- // Create placeholder element to maintain space
75
- this.placeholderElement = document.createElement("div");
76
- this.placeholderElement.style.height = `${originalHeight}px`;
77
- this.placeholderElement.style.width = "100%";
78
- this.placeholderElement.style.pointerEvents = "none";
79
- // Insert placeholder before the subnav
80
- (_a = this.el.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(this.placeholderElement, this.el);
81
- // Add transition class for smooth animation
82
- this.el.classList.add("sticky-transition");
83
- // Apply fixed positioning with smooth transition
84
- this.el.style.position = "fixed";
85
- this.el.style.top = "0";
86
- this.el.style.left = "0";
87
- this.el.style.right = "0";
88
- this.el.style.width = "100%";
89
- this.el.style.zIndex = "105";
90
- this.el.style.transform = "translateY(0)";
91
- this.isSticky = true;
92
- }
93
- else if (!shouldBeSticky && this.isSticky) {
94
- // Remove transition class and reset transform
95
- this.el.classList.remove("sticky-transition");
96
- this.el.style.transform = "";
97
- // Remove fixed positioning and restore original position
98
- this.el.style.position = "";
99
- this.el.style.top = "";
100
- this.el.style.left = "";
101
- this.el.style.right = "";
102
- this.el.style.width = "";
103
- this.el.style.zIndex = "";
104
- this.isSticky = false;
105
- // Remove placeholder element
106
- if (this.placeholderElement) {
107
- this.placeholderElement.remove();
108
- this.placeholderElement = null;
109
- }
110
- }
111
- this.stickyScrollTimeout = null;
112
- }, 16); // ~60fps throttling
113
- };
114
- this.handleResize = () => {
115
- this.navContainer && setTimeout(() => this.calculateVisibleItems(), 10);
116
- // Recalculate original position on resize
117
- if (!this.isSticky) {
118
- this.initializeStickyPosition();
119
- }
120
- else if (this.placeholderElement) {
121
- // Update placeholder height if sticky and resized
122
- const currentHeight = this.el.offsetHeight;
123
- this.placeholderElement.style.height = `${currentHeight}px`;
124
- // Update originalTop based on placeholder position (layout may have changed)
125
- const placeholderRect = this.placeholderElement.getBoundingClientRect();
126
- this.originalTop = placeholderRect.top + window.scrollY;
127
- }
128
- };
129
- this.setupIntersectionObserver = () => {
130
- // Get all sections that correspond to our navigation items
131
- const navItems = this.getNavItems();
132
- // Create intersection observer
133
- this.intersectionObserver = new IntersectionObserver((entries) => {
134
- // Clear any existing timeout
135
- if (this.scrollTimeout) {
136
- clearTimeout(this.scrollTimeout);
137
- }
138
- // Debounce the intersection changes
139
- this.scrollTimeout = window.setTimeout(() => {
140
- // Don't update active state if user just manually navigated
141
- if (this.isManualNavigation) {
142
- return;
143
- }
144
- // Find all intersecting sections
145
- const intersectingSections = entries.filter((entry) => entry.isIntersecting);
146
- if (intersectingSections.length > 0) {
147
- // Sort by intersection ratio (how much of the section is visible)
148
- // and then by position (top to bottom)
149
- intersectingSections.sort((a, b) => {
150
- // First sort by intersection ratio (higher = more visible)
151
- if (b.intersectionRatio !== a.intersectionRatio) {
152
- return (b.intersectionRatio - a.intersectionRatio);
153
- }
154
- // If intersection ratios are equal, sort by position
155
- return (a.boundingClientRect.top -
156
- b.boundingClientRect.top);
157
- });
158
- // Get the most visible section
159
- const mostVisibleSection = intersectingSections[0];
160
- const sectionId = mostVisibleSection.target.id;
161
- if (sectionId && sectionId !== this.currentActive) {
162
- this.currentActive = sectionId;
163
- }
164
- }
165
- }, 100); // Increased debounce time for better performance
166
- }, {
167
- root: null,
168
- rootMargin: "-20% 0px -60% 0px",
169
- threshold: [0, 0.1, 0.25, 0.5, 0.75, 1.0], // Multiple thresholds for better detection
170
- });
171
- // Observe all sections
172
- navItems.forEach((item) => {
173
- const section = document.getElementById(item.id);
174
- if (section) {
175
- this.intersectionObserver.observe(section);
176
- }
177
- });
178
- };
179
- this.setupResizeObserver = () => {
180
- // Observe the parent element for layout changes
181
- this.resizeObserver = new ResizeObserver(() => {
182
- // Recalculate sticky position when parent layout changes
183
- if (!this.isSticky) {
184
- this.initializeStickyPosition();
185
- }
186
- else if (this.placeholderElement) {
187
- // If sticky, update originalTop based on placeholder position
188
- const placeholderRect = this.placeholderElement.getBoundingClientRect();
189
- this.originalTop = placeholderRect.top + window.scrollY;
190
- }
191
- });
192
- // Observe the element's parent or the element itself
193
- if (this.el.parentElement) {
194
- this.resizeObserver.observe(this.el.parentElement);
195
- }
196
- };
197
- this.extractNavItemsFromSlots = () => {
198
- const slotElement = this.el.querySelector('[slot="nav-items"]');
199
- if (!slotElement)
200
- return null;
201
- const links = slotElement.querySelectorAll("a");
202
- const items = Array.from(links)
203
- .map((link) => {
204
- var _a, _b;
205
- return ({
206
- id: ((_a = link.getAttribute("href")) === null || _a === void 0 ? void 0 : _a.substring(1)) || "",
207
- label: ((_b = link.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || "",
208
- title: link.getAttribute("title") || undefined,
209
- trackerId: link.getAttribute("tracker-id") || undefined,
210
- });
211
- })
212
- .filter((item) => Boolean(item.id && item.label));
213
- return items.length > 0 ? items : null;
214
- };
215
- this.getNavItems = () => {
216
- // Return cached items if available
217
- if (this.cachedNavItems) {
218
- return this.cachedNavItems;
219
- }
220
- // Extract navigation items from slots (SEO-friendly approach)
221
- const slotItems = this.extractNavItemsFromSlots();
222
- if (slotItems) {
223
- this.cachedNavItems = slotItems;
224
- return slotItems;
225
- }
226
- // If navItems prop is provided, parse and use it (fallback)
227
- const propItems = this.parsePropNavItems();
228
- if (propItems) {
229
- this.cachedNavItems = propItems;
230
- return propItems;
231
- }
232
- // Return empty array if no navigation items found
233
- console.warn("No navigation items found in slots or props for ptc-subnav-v2");
234
- return [];
235
- };
236
- this.hasActiveOverflowItem = () => {
237
- return this.overflowItems.some((item) => item.id === this.currentActive);
238
- };
239
- this.hasSubnavMenuRightContent = () => {
240
- const slotElement = this.el.querySelector('[slot="subnav-menu-right"]');
241
- return Boolean(slotElement === null || slotElement === void 0 ? void 0 : slotElement.children.length);
242
- };
243
- this.calculateVisibleItems = () => {
244
- const navItems = this.getNavItems();
245
- // Handle case where no navigation items are found
246
- if (navItems.length === 0) {
247
- this.visibleItems = [];
248
- this.overflowItems = [];
249
- return;
250
- }
251
- // Check if we're in mobile mode (below 767px)
252
- const wasMobile = this.isMobile;
253
- this.isMobile = window.innerWidth <= 767;
254
- // Force re-render if mobile state changed
255
- if (wasMobile !== this.isMobile) {
256
- this.showOverflowMenu = false; // Close any open menus when switching modes
257
- }
258
- if (this.isMobile) {
259
- // On mobile, show only the current active item
260
- const activeItem = navItems.find((item) => item.id === this.currentActive) ||
261
- navItems[0];
262
- this.visibleItems = [activeItem];
263
- this.overflowItems = navItems.filter((item) => item.id !== activeItem.id);
264
- }
265
- else {
266
- // Desktop behavior - calculate based on available width
267
- const containerWidth = this.navContainer
268
- ? this.navContainer.offsetWidth
269
- : 0;
270
- const buttonWidth = this.overflowButton
271
- ? this.overflowButton.offsetWidth + 32
272
- : 0; // 32px for gap
273
- const availableWidth = containerWidth - buttonWidth - 48; // 48px for right margin
274
- // Fallback if container width is not available yet
275
- if (containerWidth === 0) {
276
- this.visibleItems = navItems;
277
- this.overflowItems = [];
278
- return;
279
- }
280
- let visibleCount = 0;
281
- let totalWidth = 0;
282
- // Create or reuse measurement element
283
- if (!this.measurementElement) {
284
- this.measurementElement = document.createElement("div");
285
- this.measurementElement.style.position = "absolute";
286
- this.measurementElement.style.visibility = "hidden";
287
- this.measurementElement.style.whiteSpace = "nowrap";
288
- this.measurementElement.style.fontSize = "14px";
289
- this.measurementElement.style.fontWeight = "700";
290
- this.measurementElement.style.padding = "20px 0 20px 0";
291
- document.body.appendChild(this.measurementElement);
292
- }
293
- for (let i = 0; i < navItems.length; i++) {
294
- const item = navItems[i];
295
- this.measurementElement.textContent = item.label;
296
- const itemWidth = this.measurementElement.offsetWidth + 32; // 32px for gap
297
- if (totalWidth + itemWidth <= availableWidth) {
298
- totalWidth += itemWidth;
299
- visibleCount++;
300
- }
301
- else {
302
- break;
303
- }
304
- }
305
- this.visibleItems = navItems.slice(0, visibleCount);
306
- this.overflowItems = navItems.slice(visibleCount);
307
- }
308
- // Don't automatically show overflow menu - it should be closed by default
309
- // this.showOverflowMenu = this.overflowItems.length > 0;
310
- };
311
- this.toggleOverflowMenu = () => {
312
- this.showOverflowMenu = !this.showOverflowMenu;
313
- // After opening, measure and decide alignment to avoid viewport overflow
314
- if (!this.showOverflowMenu) {
315
- return;
316
- }
317
- requestAnimationFrame(() => {
318
- const container = this.overflowMenuContainer;
319
- const dropdown = this.overflowDropdownEl;
320
- if (!container || !dropdown)
321
- return;
322
- const containerRect = container.getBoundingClientRect();
323
- // Default positioning is right: -2px inside container
324
- const dropdownWidth = dropdown.offsetWidth || 0;
325
- const rightEdge = containerRect.right + 2;
326
- const leftEdge = rightEdge - dropdownWidth;
327
- // If left edge would be off the viewport, flip to left aligned
328
- this.overflowDropdownAlignLeft = leftEdge < 8; // keep a small gutter
329
- });
330
- };
331
- this.handleNavClick = (event, section) => {
332
- event.preventDefault();
333
- this.currentActive = section;
334
- // Set manual navigation flag to prevent intersection observer from overriding
335
- this.isManualNavigation = true;
336
- // Clear any existing manual navigation timeout
337
- if (this.manualNavigationTimeout) {
338
- clearTimeout(this.manualNavigationTimeout);
339
- }
340
- // Reset manual navigation flag after scroll animation completes
341
- this.manualNavigationTimeout = window.setTimeout(() => {
342
- this.isManualNavigation = false;
343
- }, 1500); // Give enough time for smooth scroll to complete
344
- // Emit custom event for parent components
345
- const customEvent = new CustomEvent("sectionChange", {
346
- detail: { section },
347
- bubbles: true,
348
- composed: true,
349
- });
350
- this.el.dispatchEvent(customEvent);
351
- // Smooth scroll to section if it exists, accounting for sticky nav height
352
- const targetElement = document.querySelector(`#${section}`);
353
- if (targetElement) {
354
- // Get the sticky nav height
355
- const navHeight = this.el.offsetHeight;
356
- // Calculate the target position with offset
357
- const targetPosition = targetElement.getBoundingClientRect().top +
358
- window.scrollY -
359
- navHeight;
360
- // Smooth scroll to the adjusted position
361
- window.scrollTo({
362
- top: targetPosition,
363
- behavior: "smooth",
364
- });
365
- }
366
- };
367
- this.activeSection = "overview";
368
- this.navItems = "";
369
- this.currentActive = "overview";
370
- this.visibleItems = [];
371
- this.overflowItems = [];
372
- this.showOverflowMenu = false;
373
- this.overflowDropdownAlignLeft = false;
374
- this.isMobile = false;
375
- this.isManualNavigation = false;
376
- }
377
- componentWillLoad() {
378
- this.currentActive = this.activeSection;
379
- }
380
- componentDidLoad() {
381
- this.bindEventHandlers();
382
- this.handleResize();
383
- this.addEventListeners();
384
- this.setupIntersectionObserver();
385
- this.setupResizeObserver();
386
- this.initializeStickyPosition();
387
- }
388
- bindEventHandlers() {
389
- this.boundHandleResize = this.handleResize.bind(this);
390
- this.boundHandleClickOutside = this.handleClickOutside.bind(this);
391
- this.boundHandleScroll = this.handleScroll.bind(this);
392
- this.boundHandleKeyDown = this.handleKeyDown.bind(this);
393
- this.boundHandleStickyScroll = this.handleStickyScroll.bind(this);
394
- }
395
- addEventListeners() {
396
- window.addEventListener("resize", this.boundHandleResize);
397
- document.addEventListener("click", this.boundHandleClickOutside);
398
- document.addEventListener("keydown", this.boundHandleKeyDown);
399
- window.addEventListener("scroll", this.boundHandleScroll, {
400
- passive: true,
401
- });
402
- window.addEventListener("scroll", this.boundHandleStickyScroll, {
403
- passive: true,
404
- });
405
- }
406
- disconnectedCallback() {
407
- this.removeEventListeners();
408
- this.cleanupTimeouts();
409
- this.cleanupIntersectionObserver();
410
- this.cleanupResizeObserver();
411
- this.cleanupElements();
412
- }
413
- removeEventListeners() {
414
- window.removeEventListener("resize", this.boundHandleResize);
415
- document.removeEventListener("click", this.boundHandleClickOutside);
416
- document.removeEventListener("keydown", this.boundHandleKeyDown);
417
- window.removeEventListener("scroll", this.boundHandleScroll);
418
- window.removeEventListener("scroll", this.boundHandleStickyScroll);
419
- }
420
- cleanupTimeouts() {
421
- if (this.scrollTimeout)
422
- clearTimeout(this.scrollTimeout);
423
- if (this.scrollThrottleTimeout)
424
- clearTimeout(this.scrollThrottleTimeout);
425
- if (this.manualNavigationTimeout)
426
- clearTimeout(this.manualNavigationTimeout);
427
- if (this.stickyScrollTimeout)
428
- clearTimeout(this.stickyScrollTimeout);
429
- }
430
- cleanupIntersectionObserver() {
431
- if (this.intersectionObserver) {
432
- this.intersectionObserver.disconnect();
433
- }
434
- }
435
- cleanupResizeObserver() {
436
- if (this.resizeObserver) {
437
- this.resizeObserver.disconnect();
438
- }
439
- }
440
- cleanupElements() {
441
- if (this.placeholderElement) {
442
- this.placeholderElement.remove();
443
- this.placeholderElement = null;
444
- }
445
- if (this.measurementElement) {
446
- this.measurementElement.remove();
447
- this.measurementElement = null;
448
- }
449
- }
450
- parsePropNavItems() {
451
- var _a;
452
- if (!((_a = this.navItems) === null || _a === void 0 ? void 0 : _a.trim()))
453
- return null;
454
- try {
455
- const parsedItems = JSON.parse(this.navItems);
456
- if (Array.isArray(parsedItems) && parsedItems.length > 0) {
457
- const validItems = parsedItems.filter((item) => Boolean(item &&
458
- typeof item.id === "string" &&
459
- typeof item.label === "string"));
460
- return validItems.length > 0 ? validItems : null;
461
- }
462
- }
463
- catch (error) {
464
- console.warn("Invalid navItems JSON provided to ptc-subnav-v2:", error);
465
- }
466
- return null;
467
- }
468
- render() {
469
- const navItems = this.getNavItems();
470
- const hasRightContent = this.hasSubnavMenuRightContent();
471
- const selectedMobileItem = this.isMobile
472
- ? navItems.find((item) => item.id === this.currentActive) ||
473
- navItems[0]
474
- : null;
475
- // If no navigation items, don't render the navigation
476
- if (navItems.length === 0) {
477
- 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" }))))));
478
- }
479
- 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 ? (
480
- // Mobile layout - dropdown with arrows
481
- h("div", { class: "mobile-dropdown-container" }, h("button", { class: "mobile-dropdown-button", onClick: this.toggleOverflowMenu, onKeyDown: (e) => {
482
- if (e.key === "Enter" ||
483
- e.key === " ") {
484
- e.preventDefault();
485
- this.toggleOverflowMenu();
486
- }
487
- }, "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) ||
488
- "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 ||
489
- `mobile-nav-${item.id}` }, h("a", { href: `#${item.id}`, class: `mobile-dropdown-item ${this.currentActive ===
490
- item.id
491
- ? "active"
492
- : ""}`, role: "menuitem", "aria-current": this.currentActive ===
493
- item.id
494
- ? "page"
495
- : undefined, title: item.title || "", onClick: (e) => {
496
- this.handleNavClick(e, item.id);
497
- this.showOverflowMenu = false;
498
- } }, item.label)))))))) : (
499
- // Desktop layout - original behavior
500
- 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
501
- ? "active"
502
- : "", title: item.title || "", onClick: (e) => this.handleNavClick(e, item.id), "aria-current": this.currentActive === item.id
503
- ? "page"
504
- : 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) => {
505
- if (e.key === "Enter" ||
506
- e.key === " ") {
507
- e.preventDefault();
508
- this.toggleOverflowMenu();
509
- }
510
- }, "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 =
511
- el) }, this.overflowItems.map((item) => (h("a", { key: item.id, href: `#${item.id}`, class: `mf-listen ${this
512
- .currentActive ===
513
- item.id
514
- ? "active"
515
- : ""}`, title: item.title || "", "tracker-id": item.trackerId ||
516
- `overflow-link-${item.id}`, role: "menuitem", onClick: (e) => {
517
- this.handleNavClick(e, item.id);
518
- this.showOverflowMenu = false;
519
- }, "aria-current": this
520
- .currentActive ===
521
- item.id
522
- ? "page"
523
- : undefined }, item.label)))))))))), hasRightContent && (h("div", { class: "subnav-menu-right" }, h("slot", { name: "subnav-menu-right" }))))));
524
- }
525
- get el() { return getElement(this); }
526
- };
527
- PtcSubnavV2.style = ptcSubnavV2Css;
528
-
529
- export { PtcSubnavV2 as ptc_subnav_v2 };