@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.
- package/dist/form/book-a-demo.js +679 -2
- package/dist/form/index.js +962 -2
- package/dist/form/index.js.map +2 -2
- package/dist/form/pricing.css +2 -0
- package/dist/form/pricing.js +790 -2
- package/dist/form/styles.css +140 -1
- package/dist/global/accordions-v2.js +262 -1
- package/dist/global/accordions.js +237 -1
- package/dist/global/faqs.js +116 -1
- package/dist/global/loader.js +76 -1
- package/dist/global/styles.css +252 -1
- package/dist/home/depth.js +243 -3
- package/dist/home/hero-animation/loader.js +67810 -1397
- package/dist/home/hero-animation/scroll.js +401 -1
- package/dist/home/hero-animation/styles.css +233 -1
- package/dist/home/hero-animation/torch.js +62 -1
- package/dist/home/horizontal-scroll.css +49 -1
- package/dist/home/horizontal-scroll.js +140 -1
- package/dist/home/tabs-v2.js +134 -1
- package/dist/home/tabs.js +163 -1
- package/dist/lever/styles.css +31 -1
- package/dist/marquee/index.js +557 -2
- package/dist/marquee/styles.css +26 -1
- package/dist/slider/freescroll-cards.js +51 -1
- package/dist/slider/freescroll-slider.js +31 -1
- package/dist/slider/testimonial.js +30 -1
- package/package.json +3 -3
package/dist/form/styles.css
CHANGED
|
@@ -1 +1,140 @@
|
|
|
1
|
-
|
|
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";
|
|
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";
|
|
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
|