@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,533 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-63ddc79c.js');
6
-
7
- 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}}";
8
-
9
- const PtcSubnavV2 = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.cachedNavItems = null;
13
- this.isSticky = false;
14
- this.originalTop = 0;
15
- this.placeholderElement = null;
16
- this.measurementElement = null;
17
- this.handleClickOutside = (event) => {
18
- if (!this.el.contains(event.target)) {
19
- this.showOverflowMenu = false;
20
- }
21
- };
22
- this.handleKeyDown = (event) => {
23
- var _a;
24
- if (event.key === "Escape" && this.showOverflowMenu) {
25
- this.showOverflowMenu = false;
26
- (_a = this.overflowButton) === null || _a === void 0 ? void 0 : _a.focus();
27
- }
28
- };
29
- this.handleScroll = () => {
30
- // Throttle scroll events for better performance
31
- if (this.scrollThrottleTimeout) {
32
- return;
33
- }
34
- this.scrollThrottleTimeout = window.setTimeout(() => {
35
- // Don't update active state if user just manually navigated
36
- if (this.isManualNavigation) {
37
- this.scrollThrottleTimeout = null;
38
- return;
39
- }
40
- // Fallback scroll handler to ensure active state is updated
41
- const navItems = this.getNavItems();
42
- const subnavHeight = this.el.offsetHeight;
43
- const scrollPosition = window.scrollY + subnavHeight + 100; // Offset for better detection
44
- // Find the section that should be active based on scroll position
45
- let activeSection = navItems[0].id; // Default to first section
46
- for (let i = navItems.length - 1; i >= 0; i--) {
47
- const section = document.getElementById(navItems[i].id);
48
- if (section && section.offsetTop <= scrollPosition) {
49
- activeSection = navItems[i].id;
50
- break;
51
- }
52
- }
53
- // Only update if different from current active
54
- if (activeSection !== this.currentActive) {
55
- this.currentActive = activeSection;
56
- }
57
- this.scrollThrottleTimeout = null;
58
- }, 16); // ~60fps throttling
59
- };
60
- this.initializeStickyPosition = () => {
61
- // Store the original position of the subnav
62
- const rect = this.el.getBoundingClientRect();
63
- this.originalTop = rect.top + window.scrollY;
64
- };
65
- this.handleStickyScroll = () => {
66
- // Throttle sticky scroll events for better performance
67
- if (this.stickyScrollTimeout) {
68
- return;
69
- }
70
- this.stickyScrollTimeout = window.setTimeout(() => {
71
- var _a;
72
- const scrollY = window.scrollY;
73
- // Check if we should make the subnav sticky
74
- const shouldBeSticky = scrollY >= this.originalTop;
75
- if (shouldBeSticky && !this.isSticky) {
76
- // Store the original height before making it fixed
77
- const originalHeight = this.el.offsetHeight;
78
- // Create placeholder element to maintain space
79
- this.placeholderElement = document.createElement("div");
80
- this.placeholderElement.style.height = `${originalHeight}px`;
81
- this.placeholderElement.style.width = "100%";
82
- this.placeholderElement.style.pointerEvents = "none";
83
- // Insert placeholder before the subnav
84
- (_a = this.el.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(this.placeholderElement, this.el);
85
- // Add transition class for smooth animation
86
- this.el.classList.add("sticky-transition");
87
- // Apply fixed positioning with smooth transition
88
- this.el.style.position = "fixed";
89
- this.el.style.top = "0";
90
- this.el.style.left = "0";
91
- this.el.style.right = "0";
92
- this.el.style.width = "100%";
93
- this.el.style.zIndex = "105";
94
- this.el.style.transform = "translateY(0)";
95
- this.isSticky = true;
96
- }
97
- else if (!shouldBeSticky && this.isSticky) {
98
- // Remove transition class and reset transform
99
- this.el.classList.remove("sticky-transition");
100
- this.el.style.transform = "";
101
- // Remove fixed positioning and restore original position
102
- this.el.style.position = "";
103
- this.el.style.top = "";
104
- this.el.style.left = "";
105
- this.el.style.right = "";
106
- this.el.style.width = "";
107
- this.el.style.zIndex = "";
108
- this.isSticky = false;
109
- // Remove placeholder element
110
- if (this.placeholderElement) {
111
- this.placeholderElement.remove();
112
- this.placeholderElement = null;
113
- }
114
- }
115
- this.stickyScrollTimeout = null;
116
- }, 16); // ~60fps throttling
117
- };
118
- this.handleResize = () => {
119
- this.navContainer && setTimeout(() => this.calculateVisibleItems(), 10);
120
- // Recalculate original position on resize
121
- if (!this.isSticky) {
122
- this.initializeStickyPosition();
123
- }
124
- else if (this.placeholderElement) {
125
- // Update placeholder height if sticky and resized
126
- const currentHeight = this.el.offsetHeight;
127
- this.placeholderElement.style.height = `${currentHeight}px`;
128
- // Update originalTop based on placeholder position (layout may have changed)
129
- const placeholderRect = this.placeholderElement.getBoundingClientRect();
130
- this.originalTop = placeholderRect.top + window.scrollY;
131
- }
132
- };
133
- this.setupIntersectionObserver = () => {
134
- // Get all sections that correspond to our navigation items
135
- const navItems = this.getNavItems();
136
- // Create intersection observer
137
- this.intersectionObserver = new IntersectionObserver((entries) => {
138
- // Clear any existing timeout
139
- if (this.scrollTimeout) {
140
- clearTimeout(this.scrollTimeout);
141
- }
142
- // Debounce the intersection changes
143
- this.scrollTimeout = window.setTimeout(() => {
144
- // Don't update active state if user just manually navigated
145
- if (this.isManualNavigation) {
146
- return;
147
- }
148
- // Find all intersecting sections
149
- const intersectingSections = entries.filter((entry) => entry.isIntersecting);
150
- if (intersectingSections.length > 0) {
151
- // Sort by intersection ratio (how much of the section is visible)
152
- // and then by position (top to bottom)
153
- intersectingSections.sort((a, b) => {
154
- // First sort by intersection ratio (higher = more visible)
155
- if (b.intersectionRatio !== a.intersectionRatio) {
156
- return (b.intersectionRatio - a.intersectionRatio);
157
- }
158
- // If intersection ratios are equal, sort by position
159
- return (a.boundingClientRect.top -
160
- b.boundingClientRect.top);
161
- });
162
- // Get the most visible section
163
- const mostVisibleSection = intersectingSections[0];
164
- const sectionId = mostVisibleSection.target.id;
165
- if (sectionId && sectionId !== this.currentActive) {
166
- this.currentActive = sectionId;
167
- }
168
- }
169
- }, 100); // Increased debounce time for better performance
170
- }, {
171
- root: null,
172
- rootMargin: "-20% 0px -60% 0px",
173
- threshold: [0, 0.1, 0.25, 0.5, 0.75, 1.0], // Multiple thresholds for better detection
174
- });
175
- // Observe all sections
176
- navItems.forEach((item) => {
177
- const section = document.getElementById(item.id);
178
- if (section) {
179
- this.intersectionObserver.observe(section);
180
- }
181
- });
182
- };
183
- this.setupResizeObserver = () => {
184
- // Observe the parent element for layout changes
185
- this.resizeObserver = new ResizeObserver(() => {
186
- // Recalculate sticky position when parent layout changes
187
- if (!this.isSticky) {
188
- this.initializeStickyPosition();
189
- }
190
- else if (this.placeholderElement) {
191
- // If sticky, update originalTop based on placeholder position
192
- const placeholderRect = this.placeholderElement.getBoundingClientRect();
193
- this.originalTop = placeholderRect.top + window.scrollY;
194
- }
195
- });
196
- // Observe the element's parent or the element itself
197
- if (this.el.parentElement) {
198
- this.resizeObserver.observe(this.el.parentElement);
199
- }
200
- };
201
- this.extractNavItemsFromSlots = () => {
202
- const slotElement = this.el.querySelector('[slot="nav-items"]');
203
- if (!slotElement)
204
- return null;
205
- const links = slotElement.querySelectorAll("a");
206
- const items = Array.from(links)
207
- .map((link) => {
208
- var _a, _b;
209
- return ({
210
- id: ((_a = link.getAttribute("href")) === null || _a === void 0 ? void 0 : _a.substring(1)) || "",
211
- label: ((_b = link.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || "",
212
- title: link.getAttribute("title") || undefined,
213
- trackerId: link.getAttribute("tracker-id") || undefined,
214
- });
215
- })
216
- .filter((item) => Boolean(item.id && item.label));
217
- return items.length > 0 ? items : null;
218
- };
219
- this.getNavItems = () => {
220
- // Return cached items if available
221
- if (this.cachedNavItems) {
222
- return this.cachedNavItems;
223
- }
224
- // Extract navigation items from slots (SEO-friendly approach)
225
- const slotItems = this.extractNavItemsFromSlots();
226
- if (slotItems) {
227
- this.cachedNavItems = slotItems;
228
- return slotItems;
229
- }
230
- // If navItems prop is provided, parse and use it (fallback)
231
- const propItems = this.parsePropNavItems();
232
- if (propItems) {
233
- this.cachedNavItems = propItems;
234
- return propItems;
235
- }
236
- // Return empty array if no navigation items found
237
- console.warn("No navigation items found in slots or props for ptc-subnav-v2");
238
- return [];
239
- };
240
- this.hasActiveOverflowItem = () => {
241
- return this.overflowItems.some((item) => item.id === this.currentActive);
242
- };
243
- this.hasSubnavMenuRightContent = () => {
244
- const slotElement = this.el.querySelector('[slot="subnav-menu-right"]');
245
- return Boolean(slotElement === null || slotElement === void 0 ? void 0 : slotElement.children.length);
246
- };
247
- this.calculateVisibleItems = () => {
248
- const navItems = this.getNavItems();
249
- // Handle case where no navigation items are found
250
- if (navItems.length === 0) {
251
- this.visibleItems = [];
252
- this.overflowItems = [];
253
- return;
254
- }
255
- // Check if we're in mobile mode (below 767px)
256
- const wasMobile = this.isMobile;
257
- this.isMobile = window.innerWidth <= 767;
258
- // Force re-render if mobile state changed
259
- if (wasMobile !== this.isMobile) {
260
- this.showOverflowMenu = false; // Close any open menus when switching modes
261
- }
262
- if (this.isMobile) {
263
- // On mobile, show only the current active item
264
- const activeItem = navItems.find((item) => item.id === this.currentActive) ||
265
- navItems[0];
266
- this.visibleItems = [activeItem];
267
- this.overflowItems = navItems.filter((item) => item.id !== activeItem.id);
268
- }
269
- else {
270
- // Desktop behavior - calculate based on available width
271
- const containerWidth = this.navContainer
272
- ? this.navContainer.offsetWidth
273
- : 0;
274
- const buttonWidth = this.overflowButton
275
- ? this.overflowButton.offsetWidth + 32
276
- : 0; // 32px for gap
277
- const availableWidth = containerWidth - buttonWidth - 48; // 48px for right margin
278
- // Fallback if container width is not available yet
279
- if (containerWidth === 0) {
280
- this.visibleItems = navItems;
281
- this.overflowItems = [];
282
- return;
283
- }
284
- let visibleCount = 0;
285
- let totalWidth = 0;
286
- // Create or reuse measurement element
287
- if (!this.measurementElement) {
288
- this.measurementElement = document.createElement("div");
289
- this.measurementElement.style.position = "absolute";
290
- this.measurementElement.style.visibility = "hidden";
291
- this.measurementElement.style.whiteSpace = "nowrap";
292
- this.measurementElement.style.fontSize = "14px";
293
- this.measurementElement.style.fontWeight = "700";
294
- this.measurementElement.style.padding = "20px 0 20px 0";
295
- document.body.appendChild(this.measurementElement);
296
- }
297
- for (let i = 0; i < navItems.length; i++) {
298
- const item = navItems[i];
299
- this.measurementElement.textContent = item.label;
300
- const itemWidth = this.measurementElement.offsetWidth + 32; // 32px for gap
301
- if (totalWidth + itemWidth <= availableWidth) {
302
- totalWidth += itemWidth;
303
- visibleCount++;
304
- }
305
- else {
306
- break;
307
- }
308
- }
309
- this.visibleItems = navItems.slice(0, visibleCount);
310
- this.overflowItems = navItems.slice(visibleCount);
311
- }
312
- // Don't automatically show overflow menu - it should be closed by default
313
- // this.showOverflowMenu = this.overflowItems.length > 0;
314
- };
315
- this.toggleOverflowMenu = () => {
316
- this.showOverflowMenu = !this.showOverflowMenu;
317
- // After opening, measure and decide alignment to avoid viewport overflow
318
- if (!this.showOverflowMenu) {
319
- return;
320
- }
321
- requestAnimationFrame(() => {
322
- const container = this.overflowMenuContainer;
323
- const dropdown = this.overflowDropdownEl;
324
- if (!container || !dropdown)
325
- return;
326
- const containerRect = container.getBoundingClientRect();
327
- // Default positioning is right: -2px inside container
328
- const dropdownWidth = dropdown.offsetWidth || 0;
329
- const rightEdge = containerRect.right + 2;
330
- const leftEdge = rightEdge - dropdownWidth;
331
- // If left edge would be off the viewport, flip to left aligned
332
- this.overflowDropdownAlignLeft = leftEdge < 8; // keep a small gutter
333
- });
334
- };
335
- this.handleNavClick = (event, section) => {
336
- event.preventDefault();
337
- this.currentActive = section;
338
- // Set manual navigation flag to prevent intersection observer from overriding
339
- this.isManualNavigation = true;
340
- // Clear any existing manual navigation timeout
341
- if (this.manualNavigationTimeout) {
342
- clearTimeout(this.manualNavigationTimeout);
343
- }
344
- // Reset manual navigation flag after scroll animation completes
345
- this.manualNavigationTimeout = window.setTimeout(() => {
346
- this.isManualNavigation = false;
347
- }, 1500); // Give enough time for smooth scroll to complete
348
- // Emit custom event for parent components
349
- const customEvent = new CustomEvent("sectionChange", {
350
- detail: { section },
351
- bubbles: true,
352
- composed: true,
353
- });
354
- this.el.dispatchEvent(customEvent);
355
- // Smooth scroll to section if it exists, accounting for sticky nav height
356
- const targetElement = document.querySelector(`#${section}`);
357
- if (targetElement) {
358
- // Get the sticky nav height
359
- const navHeight = this.el.offsetHeight;
360
- // Calculate the target position with offset
361
- const targetPosition = targetElement.getBoundingClientRect().top +
362
- window.scrollY -
363
- navHeight;
364
- // Smooth scroll to the adjusted position
365
- window.scrollTo({
366
- top: targetPosition,
367
- behavior: "smooth",
368
- });
369
- }
370
- };
371
- this.activeSection = "overview";
372
- this.navItems = "";
373
- this.currentActive = "overview";
374
- this.visibleItems = [];
375
- this.overflowItems = [];
376
- this.showOverflowMenu = false;
377
- this.overflowDropdownAlignLeft = false;
378
- this.isMobile = false;
379
- this.isManualNavigation = false;
380
- }
381
- componentWillLoad() {
382
- this.currentActive = this.activeSection;
383
- }
384
- componentDidLoad() {
385
- this.bindEventHandlers();
386
- this.handleResize();
387
- this.addEventListeners();
388
- this.setupIntersectionObserver();
389
- this.setupResizeObserver();
390
- this.initializeStickyPosition();
391
- }
392
- bindEventHandlers() {
393
- this.boundHandleResize = this.handleResize.bind(this);
394
- this.boundHandleClickOutside = this.handleClickOutside.bind(this);
395
- this.boundHandleScroll = this.handleScroll.bind(this);
396
- this.boundHandleKeyDown = this.handleKeyDown.bind(this);
397
- this.boundHandleStickyScroll = this.handleStickyScroll.bind(this);
398
- }
399
- addEventListeners() {
400
- window.addEventListener("resize", this.boundHandleResize);
401
- document.addEventListener("click", this.boundHandleClickOutside);
402
- document.addEventListener("keydown", this.boundHandleKeyDown);
403
- window.addEventListener("scroll", this.boundHandleScroll, {
404
- passive: true,
405
- });
406
- window.addEventListener("scroll", this.boundHandleStickyScroll, {
407
- passive: true,
408
- });
409
- }
410
- disconnectedCallback() {
411
- this.removeEventListeners();
412
- this.cleanupTimeouts();
413
- this.cleanupIntersectionObserver();
414
- this.cleanupResizeObserver();
415
- this.cleanupElements();
416
- }
417
- removeEventListeners() {
418
- window.removeEventListener("resize", this.boundHandleResize);
419
- document.removeEventListener("click", this.boundHandleClickOutside);
420
- document.removeEventListener("keydown", this.boundHandleKeyDown);
421
- window.removeEventListener("scroll", this.boundHandleScroll);
422
- window.removeEventListener("scroll", this.boundHandleStickyScroll);
423
- }
424
- cleanupTimeouts() {
425
- if (this.scrollTimeout)
426
- clearTimeout(this.scrollTimeout);
427
- if (this.scrollThrottleTimeout)
428
- clearTimeout(this.scrollThrottleTimeout);
429
- if (this.manualNavigationTimeout)
430
- clearTimeout(this.manualNavigationTimeout);
431
- if (this.stickyScrollTimeout)
432
- clearTimeout(this.stickyScrollTimeout);
433
- }
434
- cleanupIntersectionObserver() {
435
- if (this.intersectionObserver) {
436
- this.intersectionObserver.disconnect();
437
- }
438
- }
439
- cleanupResizeObserver() {
440
- if (this.resizeObserver) {
441
- this.resizeObserver.disconnect();
442
- }
443
- }
444
- cleanupElements() {
445
- if (this.placeholderElement) {
446
- this.placeholderElement.remove();
447
- this.placeholderElement = null;
448
- }
449
- if (this.measurementElement) {
450
- this.measurementElement.remove();
451
- this.measurementElement = null;
452
- }
453
- }
454
- parsePropNavItems() {
455
- var _a;
456
- if (!((_a = this.navItems) === null || _a === void 0 ? void 0 : _a.trim()))
457
- return null;
458
- try {
459
- const parsedItems = JSON.parse(this.navItems);
460
- if (Array.isArray(parsedItems) && parsedItems.length > 0) {
461
- const validItems = parsedItems.filter((item) => Boolean(item &&
462
- typeof item.id === "string" &&
463
- typeof item.label === "string"));
464
- return validItems.length > 0 ? validItems : null;
465
- }
466
- }
467
- catch (error) {
468
- console.warn("Invalid navItems JSON provided to ptc-subnav-v2:", error);
469
- }
470
- return null;
471
- }
472
- render() {
473
- const navItems = this.getNavItems();
474
- const hasRightContent = this.hasSubnavMenuRightContent();
475
- const selectedMobileItem = this.isMobile
476
- ? navItems.find((item) => item.id === this.currentActive) ||
477
- navItems[0]
478
- : null;
479
- // If no navigation items, don't render the navigation
480
- if (navItems.length === 0) {
481
- return (index.h(index.Host, null, index.h("div", { class: `subnav-container ${!hasRightContent ? "full-width" : ""}` }, hasRightContent && (index.h("div", { class: "subnav-menu-right" }, index.h("slot", { name: "subnav-menu-right" }))))));
482
- }
483
- return (index.h(index.Host, null, index.h("div", { class: `subnav-container ${!hasRightContent ? "full-width" : ""}` }, index.h("nav", { class: `subnav-menu-left ${!hasRightContent ? "full-width" : ""}`, role: "navigation", "aria-label": "Sub navigation", ref: (el) => (this.navContainer = el) }, this.isMobile ? (
484
- // Mobile layout - dropdown with arrows
485
- index.h("div", { class: "mobile-dropdown-container" }, index.h("button", { class: "mobile-dropdown-button", onClick: this.toggleOverflowMenu, onKeyDown: (e) => {
486
- if (e.key === "Enter" ||
487
- e.key === " ") {
488
- e.preventDefault();
489
- this.toggleOverflowMenu();
490
- }
491
- }, "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) }, index.h("span", { class: "mobile-selected-item" }, (selectedMobileItem === null || selectedMobileItem === void 0 ? void 0 : selectedMobileItem.label) ||
492
- "Select Section"), index.h("span", { class: `mobile-arrow ${this.showOverflowMenu ? "rotated" : ""}`, "aria-hidden": "true" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", "aria-hidden": "true" }, index.h("path", { d: "M1 1.5L5.94975 6.44975L10.8995 1.5", stroke: "#00890B", "stroke-width": "2", "stroke-linecap": "round" })))), this.showOverflowMenu && (index.h("ul", { class: "mobile-dropdown", role: "menu", "aria-label": "Navigation sections" }, navItems.map((item) => (index.h("li", { key: item.id, class: "mf-listen", id: item.trackerId ||
493
- `mobile-nav-${item.id}` }, index.h("a", { href: `#${item.id}`, class: `mobile-dropdown-item ${this.currentActive ===
494
- item.id
495
- ? "active"
496
- : ""}`, role: "menuitem", "aria-current": this.currentActive ===
497
- item.id
498
- ? "page"
499
- : undefined, title: item.title || "", onClick: (e) => {
500
- this.handleNavClick(e, item.id);
501
- this.showOverflowMenu = false;
502
- } }, item.label)))))))) : (
503
- // Desktop layout - original behavior
504
- index.h("ul", { class: "desktop-menu" }, this.visibleItems.map((item) => (index.h("li", { key: item.id, class: "mf-listen", id: item.trackerId || `nav-${item.id}` }, index.h("a", { href: `#${item.id}`, class: this.currentActive === item.id
505
- ? "active"
506
- : "", title: item.title || "", onClick: (e) => this.handleNavClick(e, item.id), "aria-current": this.currentActive === item.id
507
- ? "page"
508
- : undefined }, item.label)))), this.overflowItems.length > 0 && (index.h("li", { class: "overflow-menu-container mf-listen", id: "overflow-menu", ref: (el) => (this.overflowMenuContainer = el) }, index.h("button", { class: `overflow-button ${this.hasActiveOverflowItem() ? "selected-active" : ""}`, onClick: this.toggleOverflowMenu, onKeyDown: (e) => {
509
- if (e.key === "Enter" ||
510
- e.key === " ") {
511
- e.preventDefault();
512
- this.toggleOverflowMenu();
513
- }
514
- }, "aria-expanded": this.showOverflowMenu, "aria-haspopup": "true", "aria-label": "Show more navigation items", "tracker-id": "overflow-button", ref: (el) => (this.overflowButton = el) }, index.h("span", { class: "overflow-dots", "aria-hidden": "true" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", "aria-hidden": "true" }, index.h("circle", { cx: "1.25", cy: "5", r: "1.25", fill: "#617480" }), index.h("circle", { cx: "5", cy: "5", r: "1.25", fill: "#617480" }), index.h("circle", { cx: "8.75", cy: "5", r: "1.25", fill: "#617480" })))), this.showOverflowMenu && (index.h("div", { class: `overflow-dropdown ${this.overflowDropdownAlignLeft ? "align-left" : "align-right"}`, role: "menu", "aria-label": "Additional navigation sections", ref: (el) => (this.overflowDropdownEl =
515
- el) }, this.overflowItems.map((item) => (index.h("a", { key: item.id, href: `#${item.id}`, class: `mf-listen ${this
516
- .currentActive ===
517
- item.id
518
- ? "active"
519
- : ""}`, title: item.title || "", "tracker-id": item.trackerId ||
520
- `overflow-link-${item.id}`, role: "menuitem", onClick: (e) => {
521
- this.handleNavClick(e, item.id);
522
- this.showOverflowMenu = false;
523
- }, "aria-current": this
524
- .currentActive ===
525
- item.id
526
- ? "page"
527
- : undefined }, item.label)))))))))), hasRightContent && (index.h("div", { class: "subnav-menu-right" }, index.h("slot", { name: "subnav-menu-right" }))))));
528
- }
529
- get el() { return index.getElement(this); }
530
- };
531
- PtcSubnavV2.style = ptcSubnavV2Css;
532
-
533
- exports.ptc_subnav_v2 = PtcSubnavV2;