@total_onion/onion-library 1.0.59 → 1.0.60
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-form-selection-v3/form-selection-v3-extra.scss +6 -0
- package/components/block-form-selection-v3/form-selection-v3.js +80 -0
- package/components/block-form-selection-v3/form-selection-v3.php +14 -0
- package/components/block-form-selection-v3/form-selection-v3.scss +39 -0
- package/components/block-form-selection-v3/form-selection-v3.twig +41 -0
- package/components/block-form-selection-v3/group_68752e7949e53.json +274 -0
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export default function formselectionv3Js(options = {}) {
|
|
2
|
+
try {
|
|
3
|
+
const {block} = options;
|
|
4
|
+
|
|
5
|
+
// modal logic
|
|
6
|
+
const formContainer = block.querySelector(
|
|
7
|
+
'.form-selection-v3__container-modal'
|
|
8
|
+
);
|
|
9
|
+
const openModal = block.querySelector('.form-selection-v3__modal-open');
|
|
10
|
+
const closeModal = block.querySelector(
|
|
11
|
+
'.form-selection-v3__modal-close'
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
if (formContainer && openModal) {
|
|
15
|
+
openModal.addEventListener('click', function (e) {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
document.documentElement.classList.add('lock-position');
|
|
18
|
+
formContainer.style.display = 'block';
|
|
19
|
+
});
|
|
20
|
+
closeModal.addEventListener('click', function (e) {
|
|
21
|
+
document.documentElement.classList.remove('lock-position');
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
formContainer.style.display = 'none';
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// form logic
|
|
30
|
+
function validateFormFields(block) {
|
|
31
|
+
const inputs = block.querySelectorAll(
|
|
32
|
+
'.cdb_form_field input, .cdb_form_field select, .cdb_form_gdpr_information input, .cdb_form_privacypolicy_information input'
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
inputs.forEach((input) => {
|
|
36
|
+
const wrapper = input.closest(
|
|
37
|
+
'.cdb_form_field, .cdb_form_gdpr_information, .cdb_form_privacypolicy_information'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (!wrapper) return;
|
|
41
|
+
|
|
42
|
+
wrapper.classList.remove('invalid');
|
|
43
|
+
|
|
44
|
+
if (!input.hasAttribute('required')) return;
|
|
45
|
+
|
|
46
|
+
if (input.type === 'checkbox') {
|
|
47
|
+
if (!input.checked) {
|
|
48
|
+
wrapper.classList.add('invalid');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
input.addEventListener('change', () => {
|
|
52
|
+
if (input.checked) {
|
|
53
|
+
wrapper.classList.remove('invalid');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
if (!input.value.trim()) {
|
|
58
|
+
wrapper.classList.add('invalid');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
input.addEventListener('input', () => {
|
|
62
|
+
if (input.value.trim()) {
|
|
63
|
+
wrapper.classList.remove('invalid');
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const submit = block.querySelector('.cdb-submit');
|
|
71
|
+
|
|
72
|
+
submit.classList.add('cmpl-cta-style-11', 'cmpl-cta-animation-style-1');
|
|
73
|
+
|
|
74
|
+
submit.addEventListener('click', (e) => {
|
|
75
|
+
validateFormFields(block);
|
|
76
|
+
});
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(error);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
acf_register_block_type(
|
|
4
|
+
array(
|
|
5
|
+
'name' => 'form-selection-v3',
|
|
6
|
+
'title' => __( 'Form selection 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,39 @@
|
|
|
1
|
+
@use 'Assets/scss/modules/library-modules/core-mixins/core-mixins';
|
|
2
|
+
@use 'Assets/scss/modules/library-modules/core-functions/core-functions';
|
|
3
|
+
@use 'Assets/scss/theme/breakpoints';
|
|
4
|
+
@use 'Assets/scss/blocks/form-selection-v3/form-selection-v3-extra';
|
|
5
|
+
|
|
6
|
+
.form-selection-v3 {
|
|
7
|
+
pointer-events: all;
|
|
8
|
+
|
|
9
|
+
&__container-modal {
|
|
10
|
+
display: none;
|
|
11
|
+
position: fixed;
|
|
12
|
+
left: 0;
|
|
13
|
+
// top: var(--global-site-header-height);
|
|
14
|
+
top: 74px;
|
|
15
|
+
width: 100vw;
|
|
16
|
+
height: calc(100vh - 103px);
|
|
17
|
+
z-index: 9998;
|
|
18
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
19
|
+
|
|
20
|
+
@include core-mixins.device(breakpoints.$tabPortrait) {
|
|
21
|
+
top: 103px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__inner {
|
|
26
|
+
overflow-y: scroll;
|
|
27
|
+
width: 100vw;
|
|
28
|
+
z-index: 9999;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__modal-close {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: core-functions.fluidSize(20);
|
|
35
|
+
right: core-functions.fluidSize(20);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@include form-selection-v3-extra.additionalStyles();
|
|
39
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{% set blockClassName = "form-selection-v3" %}
|
|
2
|
+
{% set classNameEntryPoint = include('entry-points/entry-point-classes.twig', { fields: fields, block: block }, with_context = false) %}
|
|
3
|
+
{% set htmlEntryPoint = include('entry-points/entry-point-html.twig', { fields: fields, block: block, blockClassName, blockClassName }, with_context = false) %}
|
|
4
|
+
{% set dataAttributeEntryPoint = include('entry-points/entry-point-data-attribute.twig', { fields: fields, block: block }, with_context = false) %}
|
|
5
|
+
{% set styleEntryPoint = include('entry-points/entry-point-style.twig', { fields: fields, block: block, is_preview }, with_context = false) %}
|
|
6
|
+
{% set previewEntryPoint = include('entry-points/entry-point-preview-info.twig', { fields, block, displaytype, is_preview }, with_context = false) %}
|
|
7
|
+
|
|
8
|
+
{% set sectionStyles = styleEntryPoint %}
|
|
9
|
+
|
|
10
|
+
{% set displaySelector = fields.selector_type|ru %}
|
|
11
|
+
|
|
12
|
+
{{previewEntryPoint}}
|
|
13
|
+
<section {{block.anchor ? "id=" ~ block.anchor : ''}} class="{{blockClassName}} {{block.className}} {{classNameEntryPoint}} lazy-fade" {{dataAttributeEntryPoint}} data-blockid="{{block.id}}" style="{{sectionStyles}}" data-assetkey="{{blockClassName}}">
|
|
14
|
+
{% if displaySelector == 'modal' %}
|
|
15
|
+
<div class="{{ blockClassName }}__container-modal">
|
|
16
|
+
<div class="{{ blockClassName }}__inner">
|
|
17
|
+
<div class="{{ blockClassName }}__wrapper">
|
|
18
|
+
{% if fields.title %}
|
|
19
|
+
{{ fields.title }}
|
|
20
|
+
{% endif %}
|
|
21
|
+
{{function('do_shortcode', '[cdbform id=' ~ fields.form ~ ']')}}
|
|
22
|
+
<button class="{{ blockClassName }}__modal-close"></button>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<button class="{{ blockClassName }}__modal-open cmpl-cta-style-{{fields.cta_style|ru}} cmpl-cta-animation-style-2">{{fields.cta_text}}</button>
|
|
27
|
+
{% elseif displaySelector == 'inline' %}
|
|
28
|
+
<div class="{{ blockClassName }}__container-inline">
|
|
29
|
+
<div class="{{ blockClassName }}__inner">
|
|
30
|
+
<div class="{{ blockClassName }}__wrapper">
|
|
31
|
+
{% if fields.title %}
|
|
32
|
+
{{ fields.title }}
|
|
33
|
+
{% endif %}
|
|
34
|
+
{{function('do_shortcode', '[cdbform id=' ~ fields.form ~ ']')}}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
{% endif %}
|
|
39
|
+
|
|
40
|
+
{{htmlEntryPoint}}
|
|
41
|
+
</section>
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
{
|
|
2
|
+
"key": "group_68752e7949e53",
|
|
3
|
+
"title": "Block: Form Selection v3",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"key": "field_68752e7b32fc3",
|
|
7
|
+
"label": "Content",
|
|
8
|
+
"name": "",
|
|
9
|
+
"aria-label": "",
|
|
10
|
+
"type": "tab",
|
|
11
|
+
"instructions": "",
|
|
12
|
+
"required": 0,
|
|
13
|
+
"conditional_logic": 0,
|
|
14
|
+
"wrapper": {
|
|
15
|
+
"width": "",
|
|
16
|
+
"class": "",
|
|
17
|
+
"id": ""
|
|
18
|
+
},
|
|
19
|
+
"wpml_cf_preferences": 3,
|
|
20
|
+
"placement": "top",
|
|
21
|
+
"endpoint": 0,
|
|
22
|
+
"no_preference": 0,
|
|
23
|
+
"selected": 0
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"key": "field_687658c86889e",
|
|
27
|
+
"label": "Form",
|
|
28
|
+
"name": "form",
|
|
29
|
+
"aria-label": "",
|
|
30
|
+
"type": "post_object",
|
|
31
|
+
"instructions": "",
|
|
32
|
+
"required": 0,
|
|
33
|
+
"conditional_logic": 0,
|
|
34
|
+
"wrapper": {
|
|
35
|
+
"width": "",
|
|
36
|
+
"class": "",
|
|
37
|
+
"id": ""
|
|
38
|
+
},
|
|
39
|
+
"wpml_cf_preferences": 3,
|
|
40
|
+
"post_type": ["cdbform"],
|
|
41
|
+
"post_status": "",
|
|
42
|
+
"taxonomy": "",
|
|
43
|
+
"return_format": "id",
|
|
44
|
+
"multiple": 0,
|
|
45
|
+
"max": "",
|
|
46
|
+
"save_custom": 0,
|
|
47
|
+
"save_post_status": "publish",
|
|
48
|
+
"acfe_add_post": 0,
|
|
49
|
+
"acfe_edit_post": 0,
|
|
50
|
+
"acfe_bidirectional": {
|
|
51
|
+
"acfe_bidirectional_enabled": "0"
|
|
52
|
+
},
|
|
53
|
+
"allow_null": 0,
|
|
54
|
+
"bidirectional": 0,
|
|
55
|
+
"ui": 1,
|
|
56
|
+
"bidirectional_target": [],
|
|
57
|
+
"save_post_type": "",
|
|
58
|
+
"min": ""
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"key": "field_6876bff37b9d2",
|
|
62
|
+
"label": "Enable title",
|
|
63
|
+
"name": "enable_title",
|
|
64
|
+
"aria-label": "",
|
|
65
|
+
"type": "true_false",
|
|
66
|
+
"instructions": "",
|
|
67
|
+
"required": 0,
|
|
68
|
+
"conditional_logic": 0,
|
|
69
|
+
"wrapper": {
|
|
70
|
+
"width": "",
|
|
71
|
+
"class": "",
|
|
72
|
+
"id": ""
|
|
73
|
+
},
|
|
74
|
+
"wpml_cf_preferences": 3,
|
|
75
|
+
"message": "",
|
|
76
|
+
"default_value": 0,
|
|
77
|
+
"allow_in_bindings": 0,
|
|
78
|
+
"ui_on_text": "",
|
|
79
|
+
"ui_off_text": "",
|
|
80
|
+
"ui": 1,
|
|
81
|
+
"style": ""
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"key": "field_68778eff6c792",
|
|
85
|
+
"label": "Title",
|
|
86
|
+
"name": "title",
|
|
87
|
+
"aria-label": "",
|
|
88
|
+
"type": "wysiwyg",
|
|
89
|
+
"instructions": "",
|
|
90
|
+
"required": 0,
|
|
91
|
+
"conditional_logic": [
|
|
92
|
+
[
|
|
93
|
+
{
|
|
94
|
+
"field": "field_6876bff37b9d2",
|
|
95
|
+
"operator": "==",
|
|
96
|
+
"value": "1"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
],
|
|
100
|
+
"wrapper": {
|
|
101
|
+
"width": "",
|
|
102
|
+
"class": "",
|
|
103
|
+
"id": ""
|
|
104
|
+
},
|
|
105
|
+
"wpml_cf_preferences": 2,
|
|
106
|
+
"default_value": "",
|
|
107
|
+
"acfe_wysiwyg_height": 300,
|
|
108
|
+
"acfe_wysiwyg_max_height": "",
|
|
109
|
+
"acfe_wysiwyg_valid_elements": "",
|
|
110
|
+
"acfe_wysiwyg_custom_style": "",
|
|
111
|
+
"acfe_wysiwyg_disable_wp_style": 0,
|
|
112
|
+
"acfe_wysiwyg_autoresize": 0,
|
|
113
|
+
"acfe_wysiwyg_disable_resize": 0,
|
|
114
|
+
"acfe_wysiwyg_remove_path": 0,
|
|
115
|
+
"acfe_wysiwyg_menubar": 0,
|
|
116
|
+
"acfe_wysiwyg_transparent": 0,
|
|
117
|
+
"acfe_wysiwyg_merge_toolbar": 0,
|
|
118
|
+
"acfe_wysiwyg_custom_toolbar": 0,
|
|
119
|
+
"allow_in_bindings": 0,
|
|
120
|
+
"tabs": "visual",
|
|
121
|
+
"toolbar": "formatselect_align_bold_italic_underline_link_removeformat",
|
|
122
|
+
"media_upload": 0,
|
|
123
|
+
"delay": 0,
|
|
124
|
+
"acfe_wysiwyg_auto_init": 0,
|
|
125
|
+
"acfe_wysiwyg_min_height": 300,
|
|
126
|
+
"acfe_wysiwyg_toolbar_buttons": []
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"key": "field_68765a476889f",
|
|
130
|
+
"label": "Settings",
|
|
131
|
+
"name": "",
|
|
132
|
+
"aria-label": "",
|
|
133
|
+
"type": "tab",
|
|
134
|
+
"instructions": "",
|
|
135
|
+
"required": 0,
|
|
136
|
+
"conditional_logic": 0,
|
|
137
|
+
"wrapper": {
|
|
138
|
+
"width": "",
|
|
139
|
+
"class": "",
|
|
140
|
+
"id": ""
|
|
141
|
+
},
|
|
142
|
+
"wpml_cf_preferences": 3,
|
|
143
|
+
"placement": "top",
|
|
144
|
+
"endpoint": 0,
|
|
145
|
+
"no_preference": 0,
|
|
146
|
+
"selected": 0
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"key": "field_68765a510f751",
|
|
150
|
+
"label": "Selector type",
|
|
151
|
+
"name": "selector_type",
|
|
152
|
+
"aria-label": "",
|
|
153
|
+
"type": "radio",
|
|
154
|
+
"instructions": "",
|
|
155
|
+
"required": 0,
|
|
156
|
+
"conditional_logic": 0,
|
|
157
|
+
"wrapper": {
|
|
158
|
+
"width": "",
|
|
159
|
+
"class": "",
|
|
160
|
+
"id": ""
|
|
161
|
+
},
|
|
162
|
+
"wpml_cf_preferences": 3,
|
|
163
|
+
"choices": {
|
|
164
|
+
"__modal": "Modal",
|
|
165
|
+
"__inline": "Inline"
|
|
166
|
+
},
|
|
167
|
+
"default_value": "__modal",
|
|
168
|
+
"return_format": "value",
|
|
169
|
+
"allow_null": 0,
|
|
170
|
+
"other_choice": 0,
|
|
171
|
+
"allow_in_bindings": 1,
|
|
172
|
+
"layout": "horizontal",
|
|
173
|
+
"save_other_choice": 0
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"key": "field_68765ba89f2ae",
|
|
177
|
+
"label": "Cta text",
|
|
178
|
+
"name": "cta_text",
|
|
179
|
+
"aria-label": "",
|
|
180
|
+
"type": "text",
|
|
181
|
+
"instructions": "",
|
|
182
|
+
"required": 0,
|
|
183
|
+
"conditional_logic": [
|
|
184
|
+
[
|
|
185
|
+
{
|
|
186
|
+
"field": "field_68765a510f751",
|
|
187
|
+
"operator": "==",
|
|
188
|
+
"value": "__modal"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
],
|
|
192
|
+
"wrapper": {
|
|
193
|
+
"width": "",
|
|
194
|
+
"class": "",
|
|
195
|
+
"id": ""
|
|
196
|
+
},
|
|
197
|
+
"wpml_cf_preferences": 2,
|
|
198
|
+
"default_value": "",
|
|
199
|
+
"maxlength": "",
|
|
200
|
+
"allow_in_bindings": 1,
|
|
201
|
+
"placeholder": "",
|
|
202
|
+
"prepend": "",
|
|
203
|
+
"append": ""
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"key": "field_68765aea9f2ad",
|
|
207
|
+
"label": "Cta style",
|
|
208
|
+
"name": "cta_style",
|
|
209
|
+
"aria-label": "",
|
|
210
|
+
"type": "select",
|
|
211
|
+
"instructions": "",
|
|
212
|
+
"required": 0,
|
|
213
|
+
"conditional_logic": [
|
|
214
|
+
[
|
|
215
|
+
{
|
|
216
|
+
"field": "field_68765a510f751",
|
|
217
|
+
"operator": "==",
|
|
218
|
+
"value": "__modal"
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
],
|
|
222
|
+
"wrapper": {
|
|
223
|
+
"width": "",
|
|
224
|
+
"class": "",
|
|
225
|
+
"id": ""
|
|
226
|
+
},
|
|
227
|
+
"wpml_cf_preferences": 3,
|
|
228
|
+
"choices": {
|
|
229
|
+
"1": "First"
|
|
230
|
+
},
|
|
231
|
+
"default_value": 1,
|
|
232
|
+
"return_format": "value",
|
|
233
|
+
"multiple": 0,
|
|
234
|
+
"max": "",
|
|
235
|
+
"prepend": "",
|
|
236
|
+
"append": "",
|
|
237
|
+
"allow_null": 0,
|
|
238
|
+
"allow_in_bindings": 1,
|
|
239
|
+
"ui": 0,
|
|
240
|
+
"ajax": 0,
|
|
241
|
+
"placeholder": "",
|
|
242
|
+
"create_options": 0,
|
|
243
|
+
"save_options": 0,
|
|
244
|
+
"allow_custom": 0,
|
|
245
|
+
"search_placeholder": "",
|
|
246
|
+
"min": ""
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
"location": [
|
|
250
|
+
[
|
|
251
|
+
{
|
|
252
|
+
"param": "block",
|
|
253
|
+
"operator": "==",
|
|
254
|
+
"value": "acf\/form-selection-v3"
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
],
|
|
258
|
+
"menu_order": 0,
|
|
259
|
+
"position": "normal",
|
|
260
|
+
"style": "default",
|
|
261
|
+
"label_placement": "left",
|
|
262
|
+
"instruction_placement": "label",
|
|
263
|
+
"hide_on_screen": "",
|
|
264
|
+
"active": true,
|
|
265
|
+
"description": "",
|
|
266
|
+
"show_in_rest": 0,
|
|
267
|
+
"acfe_autosync": ["json"],
|
|
268
|
+
"acfml_field_group_mode": "localization",
|
|
269
|
+
"acfe_form": 0,
|
|
270
|
+
"acfe_display_title": "",
|
|
271
|
+
"acfe_meta": "",
|
|
272
|
+
"acfe_note": "",
|
|
273
|
+
"modified": 1752666084
|
|
274
|
+
}
|