@total_onion/onion-library 1.0.108 → 1.0.111
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/components/block-accordion-v3/accordion-v3-extra.scss +6 -0
- package/components/block-accordion-v3/accordion-v3.js +119 -0
- package/components/block-accordion-v3/accordion-v3.php +14 -0
- package/components/block-accordion-v3/accordion-v3.scss +185 -0
- package/components/block-accordion-v3/accordion-v3.twig +52 -0
- package/components/block-accordion-v3/group_6888d2f0b230b.json +469 -0
- package/components/block-sub-group-container-v3/group_686ceba7d6066.json +2 -2
- package/components/component-text-editor-settings-v3/group_687a4e2334e37.json +22 -40
- package/components/component-wysiwyg-editor-v3/wysiwyg-editor-v3.twig +2 -2
- package/components/fields-core-typography-mixins-v3/core-typography-mixins-v3.scss +32 -10
- package/components/fields-core-typography-v3/core-typography-v3.php +69 -69
- package/components/fields-core-typography-v3/core-typography-v3.scss +225 -171
- package/components/fields-typography-settings-v3/group_6876149264002.json +42 -397
- package/package.json +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export default function accordionv3Js ( options = {} ) {
|
|
2
|
+
try {
|
|
3
|
+
const { block } = options;
|
|
4
|
+
|
|
5
|
+
const blockClassName = block.dataset.assetkey;
|
|
6
|
+
const sections = block.querySelectorAll(
|
|
7
|
+
`.${blockClassName}-content`
|
|
8
|
+
);
|
|
9
|
+
const closeAccordionSections = () => {
|
|
10
|
+
sections.forEach((section) => {
|
|
11
|
+
if (section.classList.contains('active')) {
|
|
12
|
+
const question = section.querySelector(
|
|
13
|
+
`.${blockClassName}-question-wrapper`
|
|
14
|
+
);
|
|
15
|
+
const answer = section.querySelector(
|
|
16
|
+
`.${blockClassName}-answer-wrapper`
|
|
17
|
+
);
|
|
18
|
+
const svg = section.querySelector(
|
|
19
|
+
`.${blockClassName}-icon`
|
|
20
|
+
);
|
|
21
|
+
const iconImage = section.querySelector(
|
|
22
|
+
`.${blockClassName}-image-wrapper`
|
|
23
|
+
);
|
|
24
|
+
const sectionHeight = answer.scrollHeight;
|
|
25
|
+
answer.animate(
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
height: sectionHeight + 'px'
|
|
29
|
+
},
|
|
30
|
+
{height: '0px'}
|
|
31
|
+
],
|
|
32
|
+
{
|
|
33
|
+
fill: 'forwards',
|
|
34
|
+
duration: 200,
|
|
35
|
+
easing: 'ease-out'
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
answer.setAttribute('aria-hidden', 'true');
|
|
39
|
+
question.classList.remove('active');
|
|
40
|
+
section.classList.remove('active');
|
|
41
|
+
if (svg) {
|
|
42
|
+
svg.classList.remove('active');
|
|
43
|
+
}
|
|
44
|
+
if (iconImage) {
|
|
45
|
+
iconImage.classList.remove('image-icon-active');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
sections.forEach((section) => {
|
|
52
|
+
const question = section.querySelector(
|
|
53
|
+
`.${blockClassName}-question-wrapper`
|
|
54
|
+
);
|
|
55
|
+
const answer = section.querySelector(
|
|
56
|
+
`.${blockClassName}-answer-wrapper`
|
|
57
|
+
);
|
|
58
|
+
const svg = section.querySelector(`.${blockClassName}-icon`);
|
|
59
|
+
const iconImage = section.querySelector(
|
|
60
|
+
`.${blockClassName}-image-wrapper`
|
|
61
|
+
);
|
|
62
|
+
question.addEventListener('click', () => {
|
|
63
|
+
const isCollapsed = answer.getAttribute('aria-hidden') === 'true';
|
|
64
|
+
closeAccordionSections();
|
|
65
|
+
if (isCollapsed) {
|
|
66
|
+
const sectionHeight = answer.scrollHeight;
|
|
67
|
+
answer.animate(
|
|
68
|
+
[
|
|
69
|
+
{height: '0px'},
|
|
70
|
+
{
|
|
71
|
+
height: sectionHeight + 'px'
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
{
|
|
75
|
+
fill: 'forwards',
|
|
76
|
+
duration: 200,
|
|
77
|
+
easing: 'ease-out'
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
section.classList.add('active');
|
|
81
|
+
answer.classList.add('active');
|
|
82
|
+
answer.setAttribute('aria-hidden', 'false');
|
|
83
|
+
if (svg) {
|
|
84
|
+
svg.classList.add('active');
|
|
85
|
+
}
|
|
86
|
+
if (iconImage) {
|
|
87
|
+
iconImage.classList.add('image-icon-active');
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
const sectionHeight = answer.scrollHeight;
|
|
91
|
+
section.classList.remove('active');
|
|
92
|
+
answer.animate(
|
|
93
|
+
[
|
|
94
|
+
{
|
|
95
|
+
height: sectionHeight + 'px'
|
|
96
|
+
},
|
|
97
|
+
{height: '0px'}
|
|
98
|
+
],
|
|
99
|
+
{
|
|
100
|
+
fill: 'forwards',
|
|
101
|
+
duration: 200,
|
|
102
|
+
easing: 'ease-out'
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
answer.classList.remove('active');
|
|
106
|
+
answer.setAttribute('aria-hidden', 'true');
|
|
107
|
+
if (svg) {
|
|
108
|
+
svg.classList.remove('active');
|
|
109
|
+
}
|
|
110
|
+
if (iconImage) {
|
|
111
|
+
iconImage.classList.remove('image-icon-active');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
} catch ( error ) {
|
|
117
|
+
console.error( error );
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
acf_register_block_type(
|
|
4
|
+
array(
|
|
5
|
+
'name' => 'accordion-v3',
|
|
6
|
+
'title' => __( 'Accordion v3', 'Global-theme Admin' ),
|
|
7
|
+
'render_callback' => 'athena_block_render_post_object',
|
|
8
|
+
'category' => 'common',
|
|
9
|
+
'icon' => get_svg_icon_content('brick.svg'),
|
|
10
|
+
'keywords' => array('content', 'text' ),
|
|
11
|
+
'mode' => 'preview',
|
|
12
|
+
'supports' => array( 'align' => false, 'anchor' => true ),
|
|
13
|
+
)
|
|
14
|
+
);
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
@use 'Assets/scss/modules/library-modules/core-mixins-v3/core-mixins-v3';
|
|
2
|
+
@use 'Assets/scss/modules/library-modules/core-functions-v3/core-functions-v3';
|
|
3
|
+
@use 'Assets/scss/theme/breakpoints';
|
|
4
|
+
@use 'Assets/scss/blocks/accordion-v3/accordion-v3-extra';
|
|
5
|
+
@use 'Assets/scss/modules/library-modules/content-container-settings-v3/content-container-settings-v3';
|
|
6
|
+
|
|
7
|
+
.accordion-v3 {
|
|
8
|
+
|
|
9
|
+
@include content-container-settings-v3.contentContainerSettingsV3();
|
|
10
|
+
width: 100%;
|
|
11
|
+
pointer-events: all;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: core-functions-v3.fluidSize(var(--title-gap), 'mobile');
|
|
15
|
+
@include core-mixins-v3.device(breakpoints.$tabPortrait) {
|
|
16
|
+
gap: core-functions-v3.fluidSize(var(--title-gap), 'portrait');
|
|
17
|
+
}
|
|
18
|
+
@include core-mixins-v3.device(breakpoints.$tabLandscape) {
|
|
19
|
+
gap: core-functions-v3.fluidSize(var(--title-gap), 'desktop');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&-wrapper {
|
|
23
|
+
text-align: initial;
|
|
24
|
+
background: var(--background-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-question-wrapper {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
place-items: flex-start;
|
|
30
|
+
button {
|
|
31
|
+
width: 100%;
|
|
32
|
+
align-items: center;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
background: unset;
|
|
35
|
+
padding: unset;
|
|
36
|
+
border: unset;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-image-wrapper {
|
|
41
|
+
grid-area: icon;
|
|
42
|
+
position: absolute;
|
|
43
|
+
right: core-functions-v3.fluidSize(2,'static');
|
|
44
|
+
width: core-functions-v3.fluidSize(var(--image-icon-size), 'mobile');
|
|
45
|
+
|
|
46
|
+
@include core-mixins-v3.device(breakpoints.$tabPortrait) {
|
|
47
|
+
width: core-functions-v3.fluidSize(var(--image-icon-size), 'portrait');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include core-mixins-v3.device(breakpoints.$tabLandscape) {
|
|
51
|
+
width: core-functions-v3.fluidSize(var(--image-icon-size), 'desktop');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
img {
|
|
55
|
+
width: 100%;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-question {
|
|
60
|
+
text-align: left;
|
|
61
|
+
display: grid;
|
|
62
|
+
grid-template:
|
|
63
|
+
'question icon'
|
|
64
|
+
'answer ...' / auto min-content;
|
|
65
|
+
&--icon-left {
|
|
66
|
+
grid-template:
|
|
67
|
+
'icon question'
|
|
68
|
+
'... answer' / min-content auto;
|
|
69
|
+
column-gap: core-functions-v3.fluidSize(20, 'static');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&-answer-wrapper {
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
height: 0;
|
|
76
|
+
grid-area: answer;
|
|
77
|
+
|
|
78
|
+
p {
|
|
79
|
+
padding-inline: core-functions-v3.fluidSize(
|
|
80
|
+
var(--text-padding-horizontal),
|
|
81
|
+
'mobile'
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
@include core-mixins-v3.device(breakpoints.$tabPortrait) {
|
|
85
|
+
padding-inline: core-functions-v3.fluidSize(
|
|
86
|
+
var(--text-padding-horizontal),
|
|
87
|
+
'portrait'
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@include core-mixins-v3.device(breakpoints.$tabLandscape) {
|
|
92
|
+
padding-inline: core-functions-v3.fluidSize(
|
|
93
|
+
var(--text-padding-horizontal),
|
|
94
|
+
'desktop'
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&-answer {
|
|
101
|
+
font-size: core-functions-v3.fontSize(22, 'static');
|
|
102
|
+
grid-column: 1/-1;
|
|
103
|
+
padding-bottom: core-functions-v3.fluidSize(20, 'mobile');
|
|
104
|
+
padding-top: core-functions-v3.fluidSize(20, 'mobile');
|
|
105
|
+
|
|
106
|
+
@include core-mixins-v3.device(breakpoints.$tabPortrait) {
|
|
107
|
+
padding-bottom: core-functions-v3.fluidSize(20, 'portrait');
|
|
108
|
+
padding-top: core-functions-v3.fluidSize(20, 'portrait');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@include core-mixins-v3.device(breakpoints.$tabLandscape) {
|
|
112
|
+
padding-bottom: core-functions-v3.fluidSize(20, 'desktop');
|
|
113
|
+
padding-top: core-functions-v3.fluidSize(20, 'desktop');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:last-child {
|
|
117
|
+
padding-bottom: 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&-icon {
|
|
122
|
+
grid-area: icon;
|
|
123
|
+
background: var(--icon-background-color);
|
|
124
|
+
display: flex;
|
|
125
|
+
align-items: center;
|
|
126
|
+
height: core-functions-v3.fluidSize(50, 'static');
|
|
127
|
+
width: core-functions-v3.fluidSize(50, 'static');
|
|
128
|
+
|
|
129
|
+
&.active {
|
|
130
|
+
.accordion-v3-animation {
|
|
131
|
+
&:before {
|
|
132
|
+
transform: rotate(90deg);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:after {
|
|
136
|
+
transform: rotate(180deg);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.image-icon-active {
|
|
143
|
+
transform: rotate(var(--image-icon-rotation-deg));
|
|
144
|
+
transition: transform 0.3s ease;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:not(.image-icon-active, .lottie-animations *) {
|
|
148
|
+
transform: rotate(0deg);
|
|
149
|
+
transition: transform 0.3s ease;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&-animation {
|
|
153
|
+
height: core-functions-v3.fluidSize(20, 'static');
|
|
154
|
+
margin: auto;
|
|
155
|
+
position: relative;
|
|
156
|
+
transition: transform 0.3s ease;
|
|
157
|
+
width: core-functions-v3.fluidSize(20, 'static');
|
|
158
|
+
|
|
159
|
+
&:before,
|
|
160
|
+
&:after {
|
|
161
|
+
background-color: red;
|
|
162
|
+
content: '';
|
|
163
|
+
position: absolute;
|
|
164
|
+
transition: transform 0.25s ease-out;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&:before {
|
|
168
|
+
height: 100%;
|
|
169
|
+
left: 50%;
|
|
170
|
+
margin-left: -1px;
|
|
171
|
+
top: 0;
|
|
172
|
+
width: 2px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&:after {
|
|
176
|
+
height: 2px;
|
|
177
|
+
left: 0;
|
|
178
|
+
margin-top: -1px;
|
|
179
|
+
top: 50%;
|
|
180
|
+
width: 100%;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@include accordion-v3-extra.additionalStyles();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
{% set blockClassName = "accordion-v3" %}
|
|
3
|
+
{% set classNameEntryPoint = include('entry-points/entry-point-classes.twig', { fields: fields, block: block }, with_context = false) %}
|
|
4
|
+
{% set htmlEntryPoint = include('entry-points/entry-point-html-v3.twig', { fields: fields, block: block, blockClassName, blockClassName }, with_context = false) %}
|
|
5
|
+
{% set dataAttributeEntryPoint = include('entry-points/entry-point-data-attribute.twig', { fields: fields, block: block }, with_context = false) %}
|
|
6
|
+
{% set styleEntryPoint = include('entry-points/entry-point-style.twig', { fields: fields, block: block, is_preview }, with_context = false) %}
|
|
7
|
+
{% set previewEntryPoint = include('entry-points/entry-point-preview-info.twig', { fields, block, displaytype, is_preview }, with_context = false) %}
|
|
8
|
+
|
|
9
|
+
{% set backgroundColor = '--background-color: ' ~ fields.accordion_title.background_color ~ ';' %}
|
|
10
|
+
{% set iconBackgroundColor = '--icon-background-color: ' ~ fields.accordion_title.icon_background_color ~ ';' %}
|
|
11
|
+
{% set textPaddingHorizontal = '--text-padding-horizontal: ' ~ fields.accordion_text.text_padding_horizontal ~ ';' %}
|
|
12
|
+
{% set enableCustomIcon = fields.accordion_title.enable_custom_icon %}
|
|
13
|
+
{% set imageIcon = get_image(fields.accordion_title.image_icon) %}
|
|
14
|
+
{% set imageIconSize = '--image-icon-size: ' ~ fields.accordion_title.image_icon_size ~ ';' %}
|
|
15
|
+
{% set imageIconRotationDeg = '--image-icon-rotation-deg: ' ~ fields.accordion_title.image_icon_rotation_deg ~ 'deg;' %}
|
|
16
|
+
|
|
17
|
+
{% set sectionStyles = styleEntryPoint ~ backgroundColor ~ iconBackgroundColor ~ textPaddingHorizontal ~ titleGap ~ imageIconSize ~ imageIconRotationDeg %}
|
|
18
|
+
|
|
19
|
+
{{previewEntryPoint}}
|
|
20
|
+
<style>
|
|
21
|
+
.{{blockClassName}}.{{block.id}}{
|
|
22
|
+
{{sectionStyles}}
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
<section {{block.anchor ? "id=" ~ block.anchor : ''}} class="{{blockClassName}} {{block.className}} {{classNameEntryPoint}} {{block.id}} lazy-fade" {{dataAttributeEntryPoint}} data-blockid="{{block.id}}" data-assetkey="{{blockClassName}}">
|
|
26
|
+
|
|
27
|
+
<div class="{{ blockClassName }}-wrapper">
|
|
28
|
+
<div class="{{ blockClassName }}-content">
|
|
29
|
+
<h3 class="{{ blockClassName }}-question-wrapper">
|
|
30
|
+
<button class="{{ blockClassName }}-question">
|
|
31
|
+
{% set block = block|merge({'id': block.id ~ '-' ~ 1 }) %}
|
|
32
|
+
{{ include('components/wysiwyg-editor-v3.twig', { fields: fields.title, block, blockClassName}, with_context = false, ignore_missing = true) }}
|
|
33
|
+
{% if enableCustomIcon %}
|
|
34
|
+
<div class="{{ blockClassName }}-image-wrapper">
|
|
35
|
+
<img class="{{ blockClassName }}-image-icon" src="{{imageIcon.src}}" alt="{{imageIcon.alt}}" width="{{imageIcon.width}}" height="{{imageIcon.height}}">
|
|
36
|
+
</div>
|
|
37
|
+
{% else %}
|
|
38
|
+
<div class="{{ blockClassName }}-icon">
|
|
39
|
+
<div class="{{ blockClassName }}-animation"></div>
|
|
40
|
+
</div>
|
|
41
|
+
{% endif %}
|
|
42
|
+
<div class="{{ blockClassName }}-answer-wrapper" aria-hidden="true">
|
|
43
|
+
{% set block = block|merge({'id': block.id ~ '-' ~ 2 }) %}
|
|
44
|
+
{{ include('components/wysiwyg-editor-v3.twig', { fields: fields.text, block, blockClassName}, with_context = false, ignore_missing = true) }}
|
|
45
|
+
</div>
|
|
46
|
+
</button>
|
|
47
|
+
</h3>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
{{htmlEntryPoint}}
|
|
52
|
+
</section>
|