core-maugli 1.2.73 → 1.2.74
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/package.json
CHANGED
|
@@ -45,12 +45,20 @@ const faqCard = (dict as any).faqCard || (fallbackDict as any).faqCard || {};
|
|
|
45
45
|
<span class="text-[var(--brand-color)]">{faqCard.faqLabel || 'FAQ:'}</span>
|
|
46
46
|
</h3>
|
|
47
47
|
</div>
|
|
48
|
-
<div class="flex-1 min-w-0 flex flex-col gap-
|
|
48
|
+
<div class="flex-1 min-w-0 flex flex-col gap-2">
|
|
49
49
|
{
|
|
50
|
-
faq.map(({ question, answer }) => (
|
|
51
|
-
<div>
|
|
52
|
-
<
|
|
53
|
-
|
|
50
|
+
faq.map(({ question, answer }, index) => (
|
|
51
|
+
<div class="faq-item border-b border-[var(--border-color)] last:border-b-0">
|
|
52
|
+
<button
|
|
53
|
+
class="faq-toggle w-full text-left py-3 flex items-center justify-between group hover:bg-[var(--bg-card)] px-2 rounded transition-colors"
|
|
54
|
+
data-index={index}
|
|
55
|
+
aria-expanded={index === 0 ? "true" : "false"}
|
|
56
|
+
aria-controls={`faq-answer-${index}`}
|
|
57
|
+
>
|
|
58
|
+
<span class="font-sans text-[16px] text-[var(--text-heading)] flex-1 pr-4">
|
|
59
|
+
{question}
|
|
60
|
+
</span>
|
|
61
|
+
<span class="faq-chevron flex-shrink-0 transition-transform duration-200" style={index === 0 ? "transform: rotate(90deg)" : ""}>
|
|
54
62
|
<svg width="16" height="16" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
55
63
|
<g clip-path="url(#clip0_3491_12515)">
|
|
56
64
|
<path
|
|
@@ -67,12 +75,60 @@ const faqCard = (dict as any).faqCard || (fallbackDict as any).faqCard || {};
|
|
|
67
75
|
</defs>
|
|
68
76
|
</svg>
|
|
69
77
|
</span>
|
|
70
|
-
|
|
78
|
+
</button>
|
|
79
|
+
<div
|
|
80
|
+
class="faq-answer overflow-hidden transition-all duration-300 ease-in-out"
|
|
81
|
+
id={`faq-answer-${index}`}
|
|
82
|
+
style={index === 0 ? "max-height: 1000px; opacity: 1;" : "max-height: 0; opacity: 0;"}
|
|
83
|
+
>
|
|
84
|
+
<div class="font-sans text-[14px] text-[var(--text-main)] pb-4 px-2">
|
|
85
|
+
{answer}
|
|
86
|
+
</div>
|
|
71
87
|
</div>
|
|
72
|
-
<div class="font-sans text-[14px] text-[var(--text-main)] ml-6">{answer}</div>
|
|
73
88
|
</div>
|
|
74
89
|
))
|
|
75
90
|
}
|
|
76
91
|
</div>
|
|
77
92
|
</div>
|
|
78
93
|
</section>
|
|
94
|
+
|
|
95
|
+
<script>
|
|
96
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
97
|
+
const faqToggles = document.querySelectorAll('.faq-toggle');
|
|
98
|
+
|
|
99
|
+
faqToggles.forEach(toggle => {
|
|
100
|
+
toggle.addEventListener('click', function() {
|
|
101
|
+
const index = this.dataset.index;
|
|
102
|
+
const answer = document.getElementById(`faq-answer-${index}`);
|
|
103
|
+
const chevron = this.querySelector('.faq-chevron');
|
|
104
|
+
const isExpanded = this.getAttribute('aria-expanded') === 'true';
|
|
105
|
+
|
|
106
|
+
// Закрываем все остальные
|
|
107
|
+
faqToggles.forEach((otherToggle, otherIndex) => {
|
|
108
|
+
if (otherToggle !== this) {
|
|
109
|
+
const otherAnswer = document.getElementById(`faq-answer-${otherIndex}`);
|
|
110
|
+
const otherChevron = otherToggle.querySelector('.faq-chevron');
|
|
111
|
+
|
|
112
|
+
otherToggle.setAttribute('aria-expanded', 'false');
|
|
113
|
+
otherAnswer.style.maxHeight = '0';
|
|
114
|
+
otherAnswer.style.opacity = '0';
|
|
115
|
+
otherChevron.style.transform = 'rotate(0deg)';
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Переключаем текущий
|
|
120
|
+
if (isExpanded) {
|
|
121
|
+
this.setAttribute('aria-expanded', 'false');
|
|
122
|
+
answer.style.maxHeight = '0';
|
|
123
|
+
answer.style.opacity = '0';
|
|
124
|
+
chevron.style.transform = 'rotate(0deg)';
|
|
125
|
+
} else {
|
|
126
|
+
this.setAttribute('aria-expanded', 'true');
|
|
127
|
+
answer.style.maxHeight = '1000px';
|
|
128
|
+
answer.style.opacity = '1';
|
|
129
|
+
chevron.style.transform = 'rotate(90deg)';
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
</script>
|