@rtstic.dev/pulse 0.0.55 → 0.0.56

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.
@@ -1 +1,140 @@
1
- .w-form-formradioinput--inputType-custom.w--redirected-focus{box-shadow:none}.radio-checked{display:none}.w-form-formradioinput.w--redirected-checked~.radio-checked{display:flex}.w-checkbox-input--inputType-custom.w--redirected-focus{box-shadow:none}.w-input:focus,.w-select:focus{border-color:transparent;outline:0}.radio-inner-label{color:var(--text-colors--subtext)}input[type=radio]:checked+.radio-inner-label{color:var(--text-colors--title)}.checkbox-label{color:var(--text-colors--subtext)}.w-checkbox-input--inputType-custom.w--redirected-checked{background-color:#f66025;border-color:#f66025}input[type=checkbox]:checked+.checkbox-label{color:var(--text-colors--title)}.checkbox-field:has(input[type=checkbox]:checked){border-color:#f66025}.radio-inner-label,.checkbox-label{transition:color .3s ease}.checkbox-field{transition:border-color .3s ease}.w-checkbox-input--inputType-custom{transition:background-color .3s ease,border-color .3s ease}span.pulse-form-error{color:#e55757;font-size:var(--_text-size---body--s);line-height:var(--_line-height---line-height-body--s);font-weight:var(--_font-weight---font-weight-body--s);letter-spacing:var(--_letter-spacing---letter-spacing-body--s)}.field-error{color:#e55757;font-size:12px;line-height:var(--_line-height---line-height-body--s);font-weight:var(--_font-weight---font-weight-body--s);letter-spacing:var(--_letter-spacing---letter-spacing-body--s);position:absolute;bottom:-22px}[data-error-code=legal_required]{bottom:-8px;left:28px}[data-error-code=ERR_LEGAL_REQUIRED]{padding-left:18px}[form-flow-active=false]{display:none}[form-flow-active=true]{display:flex}[fullwidth]{width:100%}[hs-calender-active=true]{display:block;width:100%}[hs-calender-active=false]{display:none}div#iti-0__dropdown-content{background-color:#121212;border-color:#242424}#iti-0__search-input{background:#242424}.iti__search-input-wrapper{border-color:#242424}iframe{border:1px solid transparent!important}.w-form-done{border:1px solid transparent}.hubspot-submitted-form{display:none!important}[hs-calender-block][hs-calender-block-active=false],.step-2,[data-action=back]{display:none}.is-iti-input-wrapper{position:relative;z-index:2}[hs-thankyou-block-active=true]{display:flex}[hs-thankyou-block-active=false]{display:none}[data-step-1-terms]{display:block}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;background:none}select::-ms-expand{display:none}
1
+ /* src/form/styles.css */
2
+ .w-form-formradioinput--inputType-custom.w--redirected-focus {
3
+ box-shadow: none;
4
+ }
5
+ .radio-checked {
6
+ display: none;
7
+ }
8
+ .w-form-formradioinput.w--redirected-checked ~ .radio-checked {
9
+ display: flex;
10
+ }
11
+ .w-checkbox-input--inputType-custom.w--redirected-focus {
12
+ box-shadow: none;
13
+ }
14
+ .w-input:focus,
15
+ .w-select:focus {
16
+ border-color: transparent;
17
+ outline: 0;
18
+ }
19
+ .radio-inner-label {
20
+ color: var(--text-colors--subtext);
21
+ }
22
+ input[type=radio]:checked + .radio-inner-label {
23
+ color: var(--text-colors--title);
24
+ }
25
+ .checkbox-label {
26
+ color: var(--text-colors--subtext);
27
+ }
28
+ input[type=checkbox]:checked + .checkbox-label {
29
+ color: var(--text-colors--title);
30
+ }
31
+ .w-checkbox-input--inputType-custom.w--redirected-checked {
32
+ background-color: #F66025;
33
+ border-color: #F66025;
34
+ }
35
+ input[type=checkbox]:checked + .checkbox-label {
36
+ color: var(--text-colors--title);
37
+ }
38
+ .checkbox-field:has(input[type=checkbox]:checked) {
39
+ border-color: #F66025;
40
+ }
41
+ .radio-inner-label,
42
+ .checkbox-label {
43
+ transition: color 300ms ease;
44
+ }
45
+ .checkbox-field {
46
+ transition: border-color 300ms ease;
47
+ }
48
+ .w-checkbox-input--inputType-custom {
49
+ transition: background-color 300ms ease, border-color 300ms ease;
50
+ }
51
+ span.pulse-form-error {
52
+ color: #e55757;
53
+ font-size: var(--_text-size---body--s);
54
+ line-height: var(--_line-height---line-height-body--s);
55
+ font-weight: var(--_font-weight---font-weight-body--s);
56
+ letter-spacing: var(--_letter-spacing---letter-spacing-body--s);
57
+ }
58
+ .field-error {
59
+ color: #e55757;
60
+ font-size: 12px;
61
+ line-height: var(--_line-height---line-height-body--s);
62
+ font-weight: var(--_font-weight---font-weight-body--s);
63
+ letter-spacing: var(--_letter-spacing---letter-spacing-body--s);
64
+ position: absolute;
65
+ bottom: -22px;
66
+ }
67
+ [data-error-code=legal_required] {
68
+ bottom: -8px;
69
+ left: 28px;
70
+ }
71
+ [data-error-code=ERR_LEGAL_REQUIRED] {
72
+ padding-left: 18px;
73
+ }
74
+ [form-flow-active=false] {
75
+ display: none;
76
+ }
77
+ [form-flow-active=true] {
78
+ display: flex;
79
+ }
80
+ [fullwidth] {
81
+ width: 100%;
82
+ }
83
+ [hs-calender-active=true] {
84
+ display: block;
85
+ width: 100%;
86
+ }
87
+ [hs-calender-active=false] {
88
+ display: none;
89
+ }
90
+ div#iti-0__dropdown-content {
91
+ background-color: #121212;
92
+ border-color: #242424;
93
+ }
94
+ #iti-0__search-input {
95
+ background: #242424;
96
+ }
97
+ .iti__search-input-wrapper {
98
+ border-color: #242424;
99
+ }
100
+ iframe {
101
+ border: 1px solid transparent !important;
102
+ }
103
+ .w-form-done {
104
+ border: 1px solid transparent;
105
+ }
106
+ .hubspot-submitted-form {
107
+ display: none !important;
108
+ }
109
+ [hs-calender-block][hs-calender-block-active=false] {
110
+ display: none;
111
+ }
112
+ .step-2 {
113
+ display: none;
114
+ }
115
+ [data-action=back] {
116
+ display: none;
117
+ }
118
+ .is-iti-input-wrapper {
119
+ position: relative;
120
+ z-index: 2;
121
+ }
122
+ [hs-thankyou-block-active=true] {
123
+ display: flex;
124
+ }
125
+ [hs-thankyou-block-active=false] {
126
+ display: none;
127
+ }
128
+ [data-step-1-terms] {
129
+ display: block;
130
+ }
131
+ select {
132
+ appearance: none;
133
+ -webkit-appearance: none;
134
+ -moz-appearance: none;
135
+ background: none;
136
+ }
137
+ select::-ms-expand {
138
+ display: none;
139
+ }
140
+ /*# sourceMappingURL=styles.css.map */
@@ -1 +1,262 @@
1
- "use strict";(()=>{document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[pulse-faq-element="wrapper"]').forEach(e=>{let n=e.querySelector('[pulse-faq-element="toggle"]'),i=e.querySelector('[pulse-faq-element="content"]'),o=e.querySelector('[pulse-faq-element="content-inner"]'),s=e.querySelector('[pulse-faq-element="x-line"]'),a=e.querySelector('[pulse-faq-element="y-line"]');if(s&&gsap.set(s,{rotation:0}),a&&gsap.set(a,{rotation:0}),!n||!i||!o)return;let l=e.closest("[pulse-faq-group]"),u=l?.getAttribute("pulse-faq-group")||null,f=l?.getAttribute("pulse-faq-type")||"one-at-a-time";if(e.getAttribute("pulse-faq-initialopen")==="true"){gsap.set(i,{height:"auto",overflow:"hidden"}),gsap.set(o,{opacity:1}),n.setAttribute("data-state","open");let c=e.querySelector('[pulse-faq-element="x-line"]'),m=e.querySelector('[pulse-faq-element="y-line"]');c&&gsap.set(c,{rotation:180}),m&&gsap.set(m,{rotation:270}),q(e,u),p(e,u)}else gsap.set(i,{height:0}),gsap.set(o,{opacity:0}),n.setAttribute("data-state","closed");let r=!1;n.addEventListener("click",()=>{if(r)return;r=!0;let c=n.getAttribute("data-state")==="open";if(f==="one-at-a-time"&&l){let m=l.querySelectorAll('[pulse-faq-element="wrapper"] [data-state="open"]');if(c&&m.length===1){r=!1;return}}c?d(e,()=>{r=!1}):(f==="one-at-a-time"&&l&&L(l),y(e,u,()=>{r=!1}))})}),g()});window.addEventListener("resize",()=>{g()});function g(){window.innerWidth<992||(document.querySelectorAll("[pulse-faq-image-target]").forEach(t=>{let e=t.parentElement;e&&e.getAttribute("ratio-height")==="true"&&(e.style.height="auto",requestAnimationFrame(()=>{e.style.height=`${e.offsetHeight}px`}))}),document.querySelectorAll('[pulse-faq-tabgroup][ratio-height="true"]').forEach(t=>{t.style.height="auto",requestAnimationFrame(()=>{t.style.height=`${t.offsetHeight}px`})}))}function y(t,e,n){let i=t.querySelector('[pulse-faq-element="toggle"]'),o=t.querySelector('[pulse-faq-element="content"]'),s=t.querySelector('[pulse-faq-element="content-inner"]'),a=t.querySelector('[pulse-faq-element="x-line"]'),l=t.querySelector('[pulse-faq-element="y-line"]');if(!i||!o||!s||!a||!l)return;o.gsapAnimation?.kill();let u=gsap.timeline({onComplete:()=>{n?.()}});gsap.set(o,{height:"auto",visibility:"hidden",opacity:0});let f=o.offsetHeight;gsap.set(o,{height:0,visibility:"visible",opacity:1}),a&&gsap.to(a,{rotation:180,duration:.4,ease:"power2.inOut"}),l&&gsap.to(l,{rotation:270,duration:.4,ease:"power2.inOut"}),u.to(o,{height:f,duration:.5,ease:"power3.inOut",clearProps:"height",onComplete:()=>{o.style.height="auto"}}),u.to(s,{opacity:1,duration:.4,ease:"power2.out"},"-=0.35"),o.gsapAnimation=u,i.setAttribute("data-state","open");let r=i.querySelector('[pulse-faq-element="chevron"]');r&&gsap.to(r,{rotation:180,duration:.4,ease:"back.out(1.7)"}),q(t,e),p(t,e)}function d(t,e){let n=t.querySelector('[pulse-faq-element="toggle"]'),i=t.querySelector('[pulse-faq-element="content"]'),o=t.querySelector('[pulse-faq-element="content-inner"]'),s=t.querySelector('[pulse-faq-element="x-line"]'),a=t.querySelector('[pulse-faq-element="y-line"]');if(!n||!i||!o||!s||!a)return;s&&gsap.to(s,{rotation:0,duration:.4,ease:"power2.inOut"}),a&&gsap.to(a,{rotation:0,duration:.4,ease:"power2.inOut"}),i.gsapAnimation?.kill();let l=gsap.timeline({onComplete:()=>{e?.()}});l.to(o,{opacity:0,duration:.3,ease:"power2.in"}),l.to(i,{height:0,duration:.4,ease:"power3.inOut"},"-=0.25"),i.gsapAnimation=l,n.setAttribute("data-state","closed");let u=n.querySelector('[pulse-faq-element="chevron"]');u&&gsap.to(u,{rotation:0,duration:.4,ease:"back.out(1.7)"})}function L(t){t.querySelectorAll('[pulse-faq-element="wrapper"] [data-state="open"]').forEach(e=>{let n=e.closest('[pulse-faq-element="wrapper"]');n&&d(n)})}function q(t,e){if(!e)return;let n=document.querySelector(`[pulse-faq-text-target="${e}"]`),i=t.querySelector("[pulse-faq-text-source]");n&&i&&(n.textContent=i.textContent)}function p(t,e){if(!e)return;let n=document.querySelector(`[pulse-faq-button-text-target="${e}"]`),i=document.querySelector(`[pulse-faq-button-link-target="${e}"]`),o=t.querySelector("[pulse-faq-link-source]");if(o&&(n&&(n.textContent=o.textContent),i))for(let s=0;s<o.attributes.length;s++){let a=o.attributes[s];i.setAttribute(a.name,a.value)}}})();
1
+ "use strict";
2
+ (() => {
3
+ // src/global/accordions-v2.ts
4
+ document.addEventListener("DOMContentLoaded", () => {
5
+ const faqWrappers = document.querySelectorAll(
6
+ '[pulse-faq-element="wrapper"]'
7
+ );
8
+ faqWrappers.forEach((wrapper) => {
9
+ const toggle = wrapper.querySelector(
10
+ '[pulse-faq-element="toggle"]'
11
+ );
12
+ const content = wrapper.querySelector(
13
+ '[pulse-faq-element="content"]'
14
+ );
15
+ const contentInner = wrapper.querySelector(
16
+ '[pulse-faq-element="content-inner"]'
17
+ );
18
+ const xLine = wrapper.querySelector(
19
+ '[pulse-faq-element="x-line"]'
20
+ );
21
+ const yLine = wrapper.querySelector(
22
+ '[pulse-faq-element="y-line"]'
23
+ );
24
+ if (xLine) gsap.set(xLine, { rotation: 0 });
25
+ if (yLine) gsap.set(yLine, { rotation: 0 });
26
+ if (!toggle || !content || !contentInner) return;
27
+ const groupContainer = wrapper.closest("[pulse-faq-group]");
28
+ const groupName = groupContainer?.getAttribute("pulse-faq-group") || null;
29
+ const faqType = groupContainer?.getAttribute("pulse-faq-type") || "one-at-a-time";
30
+ if (wrapper.getAttribute("pulse-faq-initialopen") === "true") {
31
+ gsap.set(content, { height: "auto", overflow: "hidden" });
32
+ gsap.set(contentInner, { opacity: 1 });
33
+ toggle.setAttribute("data-state", "open");
34
+ const xLine2 = wrapper.querySelector(
35
+ '[pulse-faq-element="x-line"]'
36
+ );
37
+ const yLine2 = wrapper.querySelector(
38
+ '[pulse-faq-element="y-line"]'
39
+ );
40
+ if (xLine2) gsap.set(xLine2, { rotation: 180 });
41
+ if (yLine2) gsap.set(yLine2, { rotation: 270 });
42
+ updateFaqGroupText(wrapper, groupName);
43
+ updateFaqGroupButton(wrapper, groupName);
44
+ } else {
45
+ gsap.set(content, { height: 0 });
46
+ gsap.set(contentInner, { opacity: 0 });
47
+ toggle.setAttribute("data-state", "closed");
48
+ }
49
+ let isAnimating = false;
50
+ toggle.addEventListener("click", () => {
51
+ if (isAnimating) return;
52
+ isAnimating = true;
53
+ const isOpen = toggle.getAttribute("data-state") === "open";
54
+ if (faqType === "one-at-a-time" && groupContainer) {
55
+ const openFAQs = groupContainer.querySelectorAll(
56
+ '[pulse-faq-element="wrapper"] [data-state="open"]'
57
+ );
58
+ if (isOpen && openFAQs.length === 1) {
59
+ isAnimating = false;
60
+ return;
61
+ }
62
+ }
63
+ if (isOpen) {
64
+ closeAccordion(wrapper, () => {
65
+ isAnimating = false;
66
+ });
67
+ } else {
68
+ if (faqType === "one-at-a-time" && groupContainer) {
69
+ closeOtherAccordions(groupContainer);
70
+ }
71
+ openAccordion(wrapper, groupName, () => {
72
+ isAnimating = false;
73
+ });
74
+ }
75
+ });
76
+ });
77
+ handleRatioHeights();
78
+ });
79
+ window.addEventListener("resize", () => {
80
+ handleRatioHeights();
81
+ });
82
+ function handleRatioHeights() {
83
+ if (window.innerWidth < 992) return;
84
+ document.querySelectorAll("[pulse-faq-image-target]").forEach((imageTarget) => {
85
+ const wrapper = imageTarget.parentElement;
86
+ if (!wrapper) return;
87
+ if (wrapper.getAttribute("ratio-height") !== "true") return;
88
+ wrapper.style.height = "auto";
89
+ requestAnimationFrame(() => {
90
+ wrapper.style.height = `${wrapper.offsetHeight}px`;
91
+ });
92
+ });
93
+ document.querySelectorAll('[pulse-faq-tabgroup][ratio-height="true"]').forEach((tabGroup) => {
94
+ tabGroup.style.height = "auto";
95
+ requestAnimationFrame(() => {
96
+ tabGroup.style.height = `${tabGroup.offsetHeight}px`;
97
+ });
98
+ });
99
+ }
100
+ function openAccordion(wrapper, groupName, callback) {
101
+ const toggle = wrapper.querySelector(
102
+ '[pulse-faq-element="toggle"]'
103
+ );
104
+ const content = wrapper.querySelector(
105
+ '[pulse-faq-element="content"]'
106
+ );
107
+ const contentInner = wrapper.querySelector(
108
+ '[pulse-faq-element="content-inner"]'
109
+ );
110
+ const xLine = wrapper.querySelector(
111
+ '[pulse-faq-element="x-line"]'
112
+ );
113
+ const yLine = wrapper.querySelector(
114
+ '[pulse-faq-element="y-line"]'
115
+ );
116
+ if (!toggle || !content || !contentInner || !xLine || !yLine) return;
117
+ content.gsapAnimation?.kill();
118
+ const timeline = gsap.timeline({
119
+ onComplete: () => {
120
+ callback?.();
121
+ }
122
+ });
123
+ gsap.set(content, { height: "auto", visibility: "hidden", opacity: 0 });
124
+ const height = content.offsetHeight;
125
+ gsap.set(content, { height: 0, visibility: "visible", opacity: 1 });
126
+ if (xLine) {
127
+ gsap.to(xLine, {
128
+ rotation: 180,
129
+ duration: 0.4,
130
+ ease: "power2.inOut"
131
+ });
132
+ }
133
+ if (yLine) {
134
+ gsap.to(yLine, {
135
+ rotation: 270,
136
+ duration: 0.4,
137
+ ease: "power2.inOut"
138
+ });
139
+ }
140
+ timeline.to(content, {
141
+ height,
142
+ duration: 0.5,
143
+ ease: "power3.inOut",
144
+ clearProps: "height",
145
+ onComplete: () => {
146
+ content.style.height = "auto";
147
+ }
148
+ });
149
+ timeline.to(
150
+ contentInner,
151
+ { opacity: 1, duration: 0.4, ease: "power2.out" },
152
+ "-=0.35"
153
+ );
154
+ content.gsapAnimation = timeline;
155
+ toggle.setAttribute("data-state", "open");
156
+ const icon = toggle.querySelector(
157
+ '[pulse-faq-element="chevron"]'
158
+ );
159
+ if (icon) {
160
+ gsap.to(icon, { rotation: 180, duration: 0.4, ease: "back.out(1.7)" });
161
+ }
162
+ updateFaqGroupText(wrapper, groupName);
163
+ updateFaqGroupButton(wrapper, groupName);
164
+ }
165
+ function closeAccordion(wrapper, callback) {
166
+ const toggle = wrapper.querySelector(
167
+ '[pulse-faq-element="toggle"]'
168
+ );
169
+ const content = wrapper.querySelector(
170
+ '[pulse-faq-element="content"]'
171
+ );
172
+ const contentInner = wrapper.querySelector(
173
+ '[pulse-faq-element="content-inner"]'
174
+ );
175
+ const xLine = wrapper.querySelector(
176
+ '[pulse-faq-element="x-line"]'
177
+ );
178
+ const yLine = wrapper.querySelector(
179
+ '[pulse-faq-element="y-line"]'
180
+ );
181
+ if (!toggle || !content || !contentInner || !xLine || !yLine) return;
182
+ if (xLine) {
183
+ gsap.to(xLine, {
184
+ rotation: 0,
185
+ duration: 0.4,
186
+ ease: "power2.inOut"
187
+ });
188
+ }
189
+ if (yLine) {
190
+ gsap.to(yLine, {
191
+ rotation: 0,
192
+ duration: 0.4,
193
+ ease: "power2.inOut"
194
+ });
195
+ }
196
+ content.gsapAnimation?.kill();
197
+ const timeline = gsap.timeline({
198
+ onComplete: () => {
199
+ callback?.();
200
+ }
201
+ });
202
+ timeline.to(contentInner, { opacity: 0, duration: 0.3, ease: "power2.in" });
203
+ timeline.to(
204
+ content,
205
+ { height: 0, duration: 0.4, ease: "power3.inOut" },
206
+ "-=0.25"
207
+ );
208
+ content.gsapAnimation = timeline;
209
+ toggle.setAttribute("data-state", "closed");
210
+ const icon = toggle.querySelector(
211
+ '[pulse-faq-element="chevron"]'
212
+ );
213
+ if (icon) {
214
+ gsap.to(icon, { rotation: 0, duration: 0.4, ease: "back.out(1.7)" });
215
+ }
216
+ }
217
+ function closeOtherAccordions(groupContainer) {
218
+ groupContainer.querySelectorAll(
219
+ '[pulse-faq-element="wrapper"] [data-state="open"]'
220
+ ).forEach((openToggle) => {
221
+ const wrapper = openToggle.closest(
222
+ '[pulse-faq-element="wrapper"]'
223
+ );
224
+ if (wrapper) closeAccordion(wrapper);
225
+ });
226
+ }
227
+ function updateFaqGroupText(wrapper, groupName) {
228
+ if (!groupName) return;
229
+ const groupText = document.querySelector(
230
+ `[pulse-faq-text-target="${groupName}"]`
231
+ );
232
+ const textSource = wrapper.querySelector(
233
+ "[pulse-faq-text-source]"
234
+ );
235
+ if (groupText && textSource) {
236
+ groupText.textContent = textSource.textContent;
237
+ }
238
+ }
239
+ function updateFaqGroupButton(wrapper, groupName) {
240
+ if (!groupName) return;
241
+ const buttonTextTarget = document.querySelector(
242
+ `[pulse-faq-button-text-target="${groupName}"]`
243
+ );
244
+ const buttonLinkTarget = document.querySelector(
245
+ `[pulse-faq-button-link-target="${groupName}"]`
246
+ );
247
+ const linkSource = wrapper.querySelector(
248
+ "[pulse-faq-link-source]"
249
+ );
250
+ if (!linkSource) return;
251
+ if (buttonTextTarget) {
252
+ buttonTextTarget.textContent = linkSource.textContent;
253
+ }
254
+ if (buttonLinkTarget) {
255
+ for (let i = 0; i < linkSource.attributes.length; i++) {
256
+ const attr = linkSource.attributes[i];
257
+ buttonLinkTarget.setAttribute(attr.name, attr.value);
258
+ }
259
+ }
260
+ }
261
+ })();
262
+ //# sourceMappingURL=accordions-v2.js.map
@@ -1 +1,237 @@
1
- "use strict";(()=>{document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[pulse-faq-element="wrapper"]').forEach(e=>{let n=e.querySelector('[pulse-faq-element="toggle"]'),o=e.querySelector('[pulse-faq-element="content"]'),i=e.querySelector('[pulse-faq-element="content-inner"]');if(!n||!o||!i){console.warn("Required FAQ elements not found in wrapper");return}let l=e.closest("[pulse-faq-group]"),s=l?.getAttribute("pulse-faq-group")||null,r=l?.getAttribute("pulse-faq-type")||"one-at-a-time";e.getAttribute("pulse-faq-initialopen")==="true"?(gsap.set(o,{height:"auto",overflow:"hidden"}),gsap.set(i,{opacity:1}),n.setAttribute("data-state","open"),l&&c(l),q(e),g(e,s),d(e,s),p(e,s)):(gsap.set(o,{height:0}),gsap.set(i,{opacity:0}),n.setAttribute("data-state","closed"));let u=!1;n.addEventListener("click",()=>{if(u)return;u=!0;let a=n.getAttribute("data-state")==="open";if(r==="one-at-a-time"&&l){let h=l.querySelectorAll('[pulse-faq-element="wrapper"] [data-state="open"]');if(a&&h.length===1){u=!1;return}}a?m(e,()=>{u=!1}):(r==="one-at-a-time"&&l&&L(l),E(e,s,()=>{u=!1}))})}),f()});window.addEventListener("resize",()=>{f()});function f(){window.innerWidth<992||(document.querySelectorAll("[pulse-faq-image-target]").forEach(t=>{let e=t.parentElement;!e||e.getAttribute("ratio-height")!=="true"||(e.style.height="auto",requestAnimationFrame(()=>{e.style.height=`${e.offsetHeight}px`}))}),document.querySelectorAll('[pulse-faq-tabgroup][ratio-height="true"]').forEach(t=>{t.style.height="auto",requestAnimationFrame(()=>{t.style.height=`${t.offsetHeight}px`})}))}function E(t,e,n){let o=t.querySelector('[pulse-faq-element="toggle"]'),i=t.querySelector('[pulse-faq-element="content"]'),l=t.querySelector('[pulse-faq-element="content-inner"]');if(!o||!i||!l)return;i.gsapAnimation&&i.gsapAnimation.kill();let s=gsap.timeline({onComplete:()=>{n&&n()}});gsap.set(i,{height:"auto",visibility:"hidden",opacity:0});let r=i.offsetHeight;gsap.set(i,{height:0,visibility:"visible",opacity:1}),s.to(i,{height:r,duration:.5,ease:"power3.inOut",clearProps:"height",onComplete:()=>{i.style.height="auto"}}),s.to(l,{opacity:1,duration:.4,ease:"power2.out"},"-=0.35"),i.gsapAnimation=s,o.setAttribute("data-state","open");let u=o.querySelector('[pulse-faq-element="chevron"]');u&&gsap.to(u,{rotation:180,duration:.4,ease:"back.out(1.7)"});let a=t.closest("[pulse-faq-group]");a&&c(a),q(t),g(t,e),d(t,e),p(t,e)}function m(t,e){let n=t.querySelector('[pulse-faq-element="toggle"]'),o=t.querySelector('[pulse-faq-element="content"]'),i=t.querySelector('[pulse-faq-element="content-inner"]');if(!n||!o||!i)return;o.gsapAnimation&&o.gsapAnimation.kill();let l=gsap.timeline({onComplete:()=>{e&&e()}});l.to(i,{opacity:0,duration:.3,ease:"power2.in"}),l.to(o,{height:0,duration:.4,ease:"power3.inOut"},"-=0.25"),o.gsapAnimation=l,n.setAttribute("data-state","closed");let s=n.querySelector('[pulse-faq-element="chevron"]');s&&gsap.to(s,{rotation:0,duration:.4,ease:"back.out(1.7)"});let r=t.closest("[pulse-faq-group]");r&&c(r)}function L(t){t.querySelectorAll('[pulse-faq-element="wrapper"] [data-state="open"]').forEach(n=>{let o=n.closest('[pulse-faq-element="wrapper"]');o&&m(o)})}function g(t,e){if(!e)return;let n=document.querySelector(`[pulse-faq-image-target="${e}"]`);if(!n)return;let o=t.querySelector("[pulse-faq-image-source]");if(!o)return;let i=o.getAttribute("src");i&&n.setAttribute("src",i),n.setAttribute("srcset","")}function d(t,e){if(!e)return;let n=document.querySelector(`[pulse-faq-text-target="${e}"]`);if(!n)return;let o=t.querySelector("[pulse-faq-text-source]");o&&(n.textContent=o.textContent)}function p(t,e){if(!e)return;let n=document.querySelector(`[pulse-faq-button-text-target="${e}"]`),o=document.querySelector(`[pulse-faq-button-link-target="${e}"]`),i=t.querySelector("[pulse-faq-link-source]");if(i&&(n&&(n.textContent=i.textContent),o))for(let l=0;l<i.attributes.length;l++){let s=i.attributes[l];o.setAttribute(s.name,s.value)}}function c(t){t.querySelectorAll('[pulse-faq-element="dot"]').forEach(e=>gsap.set(e,{opacity:0,duration:.4}))}function q(t){let e=t.querySelector('[pulse-faq-element="dot"]');e&&gsap.set(e,{opacity:1,duration:.4})}})();
1
+ "use strict";
2
+ (() => {
3
+ // src/global/accordions.ts
4
+ document.addEventListener("DOMContentLoaded", () => {
5
+ const faqWrappers = document.querySelectorAll(
6
+ '[pulse-faq-element="wrapper"]'
7
+ );
8
+ faqWrappers.forEach((wrapper) => {
9
+ const toggle = wrapper.querySelector(
10
+ '[pulse-faq-element="toggle"]'
11
+ );
12
+ const content = wrapper.querySelector(
13
+ '[pulse-faq-element="content"]'
14
+ );
15
+ const contentInner = wrapper.querySelector(
16
+ '[pulse-faq-element="content-inner"]'
17
+ );
18
+ if (!toggle || !content || !contentInner) {
19
+ console.warn("Required FAQ elements not found in wrapper");
20
+ return;
21
+ }
22
+ const groupContainer = wrapper.closest("[pulse-faq-group]");
23
+ const groupName = groupContainer?.getAttribute("pulse-faq-group") || null;
24
+ const faqType = groupContainer?.getAttribute("pulse-faq-type") || "one-at-a-time";
25
+ if (wrapper.getAttribute("pulse-faq-initialopen") === "true") {
26
+ gsap.set(content, { height: "auto", overflow: "hidden" });
27
+ gsap.set(contentInner, { opacity: 1 });
28
+ toggle.setAttribute("data-state", "open");
29
+ if (groupContainer) hideDots(groupContainer);
30
+ showDot(wrapper);
31
+ updateFaqGroupImage(wrapper, groupName);
32
+ updateFaqGroupText(wrapper, groupName);
33
+ updateFaqGroupButton(wrapper, groupName);
34
+ } else {
35
+ gsap.set(content, { height: 0 });
36
+ gsap.set(contentInner, { opacity: 0 });
37
+ toggle.setAttribute("data-state", "closed");
38
+ }
39
+ let isAnimating = false;
40
+ toggle.addEventListener("click", () => {
41
+ if (isAnimating) return;
42
+ isAnimating = true;
43
+ const isOpen = toggle.getAttribute("data-state") === "open";
44
+ if (faqType === "one-at-a-time" && groupContainer) {
45
+ const openFAQs = groupContainer.querySelectorAll(
46
+ '[pulse-faq-element="wrapper"] [data-state="open"]'
47
+ );
48
+ if (isOpen && openFAQs.length === 1) {
49
+ isAnimating = false;
50
+ return;
51
+ }
52
+ }
53
+ if (isOpen) {
54
+ closeAccordion(wrapper, () => {
55
+ isAnimating = false;
56
+ });
57
+ } else {
58
+ if (faqType === "one-at-a-time" && groupContainer) {
59
+ closeOtherAccordions(groupContainer);
60
+ }
61
+ openAccordion(wrapper, groupName, () => {
62
+ isAnimating = false;
63
+ });
64
+ }
65
+ });
66
+ });
67
+ handleRatioHeights();
68
+ });
69
+ window.addEventListener("resize", () => {
70
+ handleRatioHeights();
71
+ });
72
+ function handleRatioHeights() {
73
+ if (window.innerWidth < 992) return;
74
+ document.querySelectorAll("[pulse-faq-image-target]").forEach((imageTarget) => {
75
+ const wrapper = imageTarget.parentElement;
76
+ if (!wrapper) return;
77
+ const ratioHeight = wrapper.getAttribute("ratio-height");
78
+ if (ratioHeight !== "true") return;
79
+ wrapper.style.height = "auto";
80
+ requestAnimationFrame(() => {
81
+ wrapper.style.height = `${wrapper.offsetHeight}px`;
82
+ });
83
+ });
84
+ document.querySelectorAll('[pulse-faq-tabgroup][ratio-height="true"]').forEach((tabGroup) => {
85
+ tabGroup.style.height = "auto";
86
+ requestAnimationFrame(() => {
87
+ tabGroup.style.height = `${tabGroup.offsetHeight}px`;
88
+ });
89
+ });
90
+ }
91
+ function openAccordion(wrapper, groupName, callback) {
92
+ const toggle = wrapper.querySelector(
93
+ '[pulse-faq-element="toggle"]'
94
+ );
95
+ const content = wrapper.querySelector(
96
+ '[pulse-faq-element="content"]'
97
+ );
98
+ const contentInner = wrapper.querySelector(
99
+ '[pulse-faq-element="content-inner"]'
100
+ );
101
+ if (!toggle || !content || !contentInner) return;
102
+ if (content.gsapAnimation) content.gsapAnimation.kill();
103
+ const timeline = gsap.timeline({
104
+ onComplete: () => {
105
+ if (callback) callback();
106
+ }
107
+ });
108
+ gsap.set(content, { height: "auto", visibility: "hidden", opacity: 0 });
109
+ const height = content.offsetHeight;
110
+ gsap.set(content, { height: 0, visibility: "visible", opacity: 1 });
111
+ timeline.to(content, {
112
+ height,
113
+ duration: 0.5,
114
+ ease: "power3.inOut",
115
+ clearProps: "height",
116
+ onComplete: () => {
117
+ content.style.height = "auto";
118
+ }
119
+ });
120
+ timeline.to(
121
+ contentInner,
122
+ { opacity: 1, duration: 0.4, ease: "power2.out" },
123
+ "-=0.35"
124
+ );
125
+ content.gsapAnimation = timeline;
126
+ toggle.setAttribute("data-state", "open");
127
+ const icon = toggle.querySelector(
128
+ '[pulse-faq-element="chevron"]'
129
+ );
130
+ if (icon)
131
+ gsap.to(icon, { rotation: 180, duration: 0.4, ease: "back.out(1.7)" });
132
+ const groupContainer = wrapper.closest("[pulse-faq-group]");
133
+ if (groupContainer) hideDots(groupContainer);
134
+ showDot(wrapper);
135
+ updateFaqGroupImage(wrapper, groupName);
136
+ updateFaqGroupText(wrapper, groupName);
137
+ updateFaqGroupButton(wrapper, groupName);
138
+ }
139
+ function closeAccordion(wrapper, callback) {
140
+ const toggle = wrapper.querySelector(
141
+ '[pulse-faq-element="toggle"]'
142
+ );
143
+ const content = wrapper.querySelector(
144
+ '[pulse-faq-element="content"]'
145
+ );
146
+ const contentInner = wrapper.querySelector(
147
+ '[pulse-faq-element="content-inner"]'
148
+ );
149
+ if (!toggle || !content || !contentInner) return;
150
+ if (content.gsapAnimation) content.gsapAnimation.kill();
151
+ const timeline = gsap.timeline({
152
+ onComplete: () => {
153
+ if (callback) callback();
154
+ }
155
+ });
156
+ timeline.to(contentInner, { opacity: 0, duration: 0.3, ease: "power2.in" });
157
+ timeline.to(
158
+ content,
159
+ { height: 0, duration: 0.4, ease: "power3.inOut" },
160
+ "-=0.25"
161
+ );
162
+ content.gsapAnimation = timeline;
163
+ toggle.setAttribute("data-state", "closed");
164
+ const icon = toggle.querySelector(
165
+ '[pulse-faq-element="chevron"]'
166
+ );
167
+ if (icon)
168
+ gsap.to(icon, { rotation: 0, duration: 0.4, ease: "back.out(1.7)" });
169
+ const groupContainer = wrapper.closest("[pulse-faq-group]");
170
+ if (groupContainer) hideDots(groupContainer);
171
+ }
172
+ function closeOtherAccordions(groupContainer) {
173
+ const openFAQs = groupContainer.querySelectorAll(
174
+ '[pulse-faq-element="wrapper"] [data-state="open"]'
175
+ );
176
+ openFAQs.forEach((openToggle) => {
177
+ const wrapper = openToggle.closest(
178
+ '[pulse-faq-element="wrapper"]'
179
+ );
180
+ if (wrapper) closeAccordion(wrapper);
181
+ });
182
+ }
183
+ function updateFaqGroupImage(wrapper, groupName) {
184
+ if (!groupName) return;
185
+ const groupImage = document.querySelector(
186
+ `[pulse-faq-image-target="${groupName}"]`
187
+ );
188
+ if (!groupImage) return;
189
+ const imageSource = wrapper.querySelector(
190
+ "[pulse-faq-image-source]"
191
+ );
192
+ if (!imageSource) return;
193
+ const newSrc = imageSource.getAttribute("src");
194
+ if (newSrc) groupImage.setAttribute("src", newSrc);
195
+ groupImage.setAttribute("srcset", "");
196
+ }
197
+ function updateFaqGroupText(wrapper, groupName) {
198
+ if (!groupName) return;
199
+ const groupText = document.querySelector(
200
+ `[pulse-faq-text-target="${groupName}"]`
201
+ );
202
+ if (!groupText) return;
203
+ const textSource = wrapper.querySelector(
204
+ "[pulse-faq-text-source]"
205
+ );
206
+ if (!textSource) return;
207
+ groupText.textContent = textSource.textContent;
208
+ }
209
+ function updateFaqGroupButton(wrapper, groupName) {
210
+ if (!groupName) return;
211
+ const buttonTextTarget = document.querySelector(
212
+ `[pulse-faq-button-text-target="${groupName}"]`
213
+ );
214
+ const buttonLinkTarget = document.querySelector(
215
+ `[pulse-faq-button-link-target="${groupName}"]`
216
+ );
217
+ const linkSource = wrapper.querySelector(
218
+ "[pulse-faq-link-source]"
219
+ );
220
+ if (!linkSource) return;
221
+ if (buttonTextTarget) buttonTextTarget.textContent = linkSource.textContent;
222
+ if (buttonLinkTarget) {
223
+ for (let i = 0; i < linkSource.attributes.length; i++) {
224
+ const attr = linkSource.attributes[i];
225
+ buttonLinkTarget.setAttribute(attr.name, attr.value);
226
+ }
227
+ }
228
+ }
229
+ function hideDots(scope) {
230
+ scope.querySelectorAll('[pulse-faq-element="dot"]').forEach((dot) => gsap.set(dot, { opacity: 0, duration: 0.4 }));
231
+ }
232
+ function showDot(wrapper) {
233
+ const dot = wrapper.querySelector('[pulse-faq-element="dot"]');
234
+ if (dot) gsap.set(dot, { opacity: 1, duration: 0.4 });
235
+ }
236
+ })();
237
+ //# sourceMappingURL=accordions.js.map