@total_onion/onion-library 2.0.129 → 2.0.130

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.
@@ -0,0 +1,12 @@
1
+ // LIBRARY FILE - Do not modify/override here as your changes will be lost when the package is updated.
2
+ export default function backtotopbuttonJs(options = {}) {
3
+ try {
4
+ const {block} = options;
5
+ const button = block.querySelector('.back-to-top-button__button');
6
+ button.addEventListener('click', () =>
7
+ window.scrollTo({top: 0, behavior: 'smooth'})
8
+ );
9
+ } catch (error) {
10
+ console.error(error);
11
+ }
12
+ }
@@ -0,0 +1,67 @@
1
+ @use 'NodeModules/@total_onion/onion-library/components/fields-core-mixins-v3/core-mixins-v3';
2
+ @use 'NodeModules/@total_onion/onion-library/components/fields-core-functions-v3/core-functions-v3';
3
+ @use 'NodeModules/@total_onion/onion-library/breakpoints';
4
+
5
+ .back-to-top-button {
6
+ position: relative;
7
+ width: 100%;
8
+ z-index: 50;
9
+ overflow: unset;
10
+
11
+ &__arrow {
12
+ --arrow-colour: black;
13
+ position: absolute;
14
+ border-style: solid;
15
+ border-color: var(--arrow-colour);
16
+ border-width: 0 2px 2px 0;
17
+ display: inline-block;
18
+ transform: rotate(-135deg);
19
+ height: 20%;
20
+ width: 20%;
21
+ }
22
+
23
+ &__button {
24
+ --bg-colour: white;
25
+ display: flex;
26
+ justify-content: center;
27
+ align-items: center;
28
+ position: fixed;
29
+ cursor: pointer;
30
+ height: core-functions-v3.fluidSize(50, 'static');
31
+ width: core-functions-v3.fluidSize(50, 'static');
32
+ border: none;
33
+ border-radius: 50px;
34
+ padding: core-functions-v3.fluidSize(18, 'static');
35
+ background-color: var(--bg-colour);
36
+ right: core-functions-v3.fluidSize(10, 'mobile');
37
+ border-radius: var(--button-border-radius);
38
+
39
+ @include core-mixins-v3.device(breakpoints.$tabPortrait) {
40
+ right: core-functions-v3.fluidSize(30, 'portrait');
41
+ }
42
+
43
+ @include core-mixins-v3.device(breakpoints.$tabLandscape) {
44
+ right: core-functions-v3.fluidSize(60, 'desktop');
45
+ }
46
+
47
+ &--fixed {
48
+ position: fixed;
49
+ bottom: core-functions-v3.fluidSize(60, 'static');
50
+ }
51
+
52
+ &--absolute {
53
+ position: absolute;
54
+ translate: 0 -50%;
55
+ }
56
+
57
+ .wp-admin & {
58
+ position: absolute;
59
+ translate: 0 0;
60
+ bottom: 0;
61
+ }
62
+ }
63
+
64
+ &__image {
65
+ width: core-functions-v3.fluidSize(var(--image-size), 'static');
66
+ }
67
+ }
@@ -0,0 +1,37 @@
1
+ {# Do not edit this file outside of the component library as your changes will be lost with future updates. #}
2
+ {% set blockClassName = "back-to-top-button" %}
3
+ {% set classNameEntryPoint = include('entry-points/entry-point-classes.twig', { fields, block }, with_context = false) %}
4
+ {% set htmlEntryPoint = include('entry-points/entry-point-html.twig', { fields, block, blockClassName, options, environment, is_preview, nav_menus }, with_context = false) %}
5
+ {% set dataAttributeEntryPoint = include('entry-points/entry-point-data-attribute.twig', { fields, block }, with_context = false) %}
6
+ {% set styleEntryPoint = include('entry-points/entry-point-style.twig', { fields, block, displaytype, 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
+
10
+ {% set buttonBorderRadius = '--button-border-radius: ' ~ fields.btt_border_radius ~ ';' %}
11
+ {% set imageSize = '--image-size: ' ~ fields.image_size ~ ';' %}
12
+
13
+ {% set buttonImage = get_image(fields.btt_image) %}
14
+ {% set enabled = fields.enable_btt_button %}
15
+ {% set bgColour = fields.btt_background_colour %}
16
+ {% set arrowColour = fields.btt_arrow_colour %}
17
+ {% set position = fields.btt_position|ru %}
18
+
19
+ {% set sectionStyles = styleEntryPoint ~ buttonBorderRadius ~ imageSize %}
20
+ <style>
21
+ .{{blockClassName}}.{{block.id}}{
22
+ {{sectionStyles}}
23
+ }
24
+ </style>
25
+
26
+ {% if enabled %}
27
+ <section {{block.anchor ? "id=" ~ block.anchor : ''}} class="back-to-top-button {{blockClassName}} {{block.className}} {{classNameEntryPoint}} lazy-fade {{block.id}}" {{dataAttributeEntryPoint}} data-assetkey="back-to-top-button">
28
+ <button aria-label="back to the top button" class="back-to-top-button__button back-to-top-button__button--{{position}}" style="--bg-colour: {{bgColour}}">
29
+ {% if fields.enable_custom_image %}
30
+ <img class="back-to-top-button__image" width="{{buttonImage.width}}" height="{{buttonImage.height}}" src="{{ buttonImage.src }}" alt="{{buttonImage.alt}}">
31
+ {% else %}
32
+ <span class="back-to-top-button__arrow" style="--arrow-colour: {{arrowColour}}"></span>
33
+ {% endif %}
34
+ </button>
35
+ {{htmlEntryPoint}}
36
+ </section>
37
+ {% endif %}
@@ -0,0 +1,323 @@
1
+ {
2
+ "key": "group_63e24e04a1e61",
3
+ "title": "Block: Back To Top Button v3",
4
+ "fields": [
5
+ {
6
+ "key": "field_63e24e0734d7c",
7
+ "label": "Enable Back To Top Button",
8
+ "name": "enable_btt_button",
9
+ "aria-label": "",
10
+ "type": "true_false",
11
+ "instructions": "",
12
+ "required": 0,
13
+ "conditional_logic": 0,
14
+ "wrapper": {
15
+ "width": "",
16
+ "class": "",
17
+ "id": ""
18
+ },
19
+ "wpml_cf_preferences": 3,
20
+ "message": "",
21
+ "default_value": 0,
22
+ "ui_on_text": "",
23
+ "ui_off_text": "",
24
+ "ui": 1,
25
+ "style": ""
26
+ },
27
+ {
28
+ "key": "field_63e2505208af7",
29
+ "label": "Background Colour",
30
+ "name": "btt_background_colour",
31
+ "aria-label": "",
32
+ "type": "color_picker",
33
+ "instructions": "",
34
+ "required": 0,
35
+ "conditional_logic": [
36
+ [
37
+ {
38
+ "field": "field_63e24e0734d7c",
39
+ "operator": "==",
40
+ "value": "1"
41
+ }
42
+ ]
43
+ ],
44
+ "wrapper": {
45
+ "width": "",
46
+ "class": "",
47
+ "id": ""
48
+ },
49
+ "wpml_cf_preferences": 3,
50
+ "default_value": "",
51
+ "enable_opacity": 0,
52
+ "return_format": "string",
53
+ "display": "default",
54
+ "button_label": "Select Color",
55
+ "color_picker": true,
56
+ "absolute": false,
57
+ "input": true,
58
+ "allow_null": true,
59
+ "theme_colors": false,
60
+ "colors": [],
61
+ "custom_palette_source": "",
62
+ "palette_colors": "",
63
+ "show_color_wheel": true
64
+ },
65
+ {
66
+ "key": "field_63e3cd0cddfce",
67
+ "label": "Arrow Colour",
68
+ "name": "btt_arrow_colour",
69
+ "aria-label": "",
70
+ "type": "color_picker",
71
+ "instructions": "",
72
+ "required": 0,
73
+ "conditional_logic": [
74
+ [
75
+ {
76
+ "field": "field_63e24e0734d7c",
77
+ "operator": "==",
78
+ "value": "1"
79
+ },
80
+ {
81
+ "field": "field_651bfc5788b2f",
82
+ "operator": "!=",
83
+ "value": "1"
84
+ }
85
+ ]
86
+ ],
87
+ "wrapper": {
88
+ "width": "",
89
+ "class": "",
90
+ "id": ""
91
+ },
92
+ "wpml_cf_preferences": 3,
93
+ "user_roles": [
94
+ "all"
95
+ ],
96
+ "default_value": "",
97
+ "enable_opacity": 0,
98
+ "return_format": "string",
99
+ "display": "default",
100
+ "button_label": "Select Color",
101
+ "color_picker": true,
102
+ "absolute": false,
103
+ "input": true,
104
+ "allow_null": true,
105
+ "theme_colors": false,
106
+ "colors": [],
107
+ "custom_palette_source": "",
108
+ "palette_colors": "",
109
+ "show_color_wheel": true
110
+ },
111
+ {
112
+ "key": "field_63e29a05da971",
113
+ "label": "Position",
114
+ "name": "btt_position",
115
+ "aria-label": "",
116
+ "type": "select",
117
+ "instructions": "",
118
+ "required": 0,
119
+ "conditional_logic": [
120
+ [
121
+ {
122
+ "field": "field_63e24e0734d7c",
123
+ "operator": "==",
124
+ "value": "1"
125
+ }
126
+ ]
127
+ ],
128
+ "wrapper": {
129
+ "width": "",
130
+ "class": "",
131
+ "id": ""
132
+ },
133
+ "wpml_cf_preferences": 3,
134
+ "user_roles": [
135
+ "all"
136
+ ],
137
+ "choices": {
138
+ "__absolute": "Absolute",
139
+ "__fixed": "Fixed"
140
+ },
141
+ "default_value": false,
142
+ "return_format": "value",
143
+ "multiple": 0,
144
+ "allow_null": 0,
145
+ "ui": 0,
146
+ "ajax": 0,
147
+ "placeholder": "",
148
+ "allow_custom": 0,
149
+ "search_placeholder": "",
150
+ "prepend": "",
151
+ "append": "",
152
+ "min": "",
153
+ "max": "",
154
+ "create_options": 0,
155
+ "save_options": 0
156
+ },
157
+ {
158
+ "key": "field_651bf7e10a797",
159
+ "label": "Button Border Radius",
160
+ "name": "btt_border_radius",
161
+ "aria-label": "",
162
+ "type": "text",
163
+ "instructions": "",
164
+ "required": 0,
165
+ "conditional_logic": [
166
+ [
167
+ {
168
+ "field": "field_63e24e0734d7c",
169
+ "operator": "==",
170
+ "value": "1"
171
+ }
172
+ ]
173
+ ],
174
+ "wrapper": {
175
+ "width": "",
176
+ "class": "",
177
+ "id": ""
178
+ },
179
+ "wpml_cf_preferences": 2,
180
+ "user_roles": [
181
+ "all"
182
+ ],
183
+ "default_value": "0px",
184
+ "maxlength": "",
185
+ "placeholder": "",
186
+ "prepend": "",
187
+ "append": ""
188
+ },
189
+ {
190
+ "key": "field_651bfc5788b2f",
191
+ "label": "Enable Custom Image",
192
+ "name": "enable_custom_image",
193
+ "aria-label": "",
194
+ "type": "true_false",
195
+ "instructions": "",
196
+ "required": 0,
197
+ "conditional_logic": [
198
+ [
199
+ {
200
+ "field": "field_63e24e0734d7c",
201
+ "operator": "==",
202
+ "value": "1"
203
+ }
204
+ ]
205
+ ],
206
+ "wrapper": {
207
+ "width": "",
208
+ "class": "",
209
+ "id": ""
210
+ },
211
+ "wpml_cf_preferences": 3,
212
+ "user_roles": [
213
+ "all"
214
+ ],
215
+ "message": "",
216
+ "default_value": 0,
217
+ "ui_on_text": "",
218
+ "ui_off_text": "",
219
+ "ui": 1,
220
+ "style": ""
221
+ },
222
+ {
223
+ "key": "field_651c00fe13e1f",
224
+ "label": "Button Image",
225
+ "name": "btt_image",
226
+ "aria-label": "",
227
+ "type": "image",
228
+ "instructions": "",
229
+ "required": 0,
230
+ "conditional_logic": [
231
+ [
232
+ {
233
+ "field": "field_651bfc5788b2f",
234
+ "operator": "==",
235
+ "value": "1"
236
+ }
237
+ ]
238
+ ],
239
+ "wrapper": {
240
+ "width": "",
241
+ "class": "",
242
+ "id": ""
243
+ },
244
+ "wpml_cf_preferences": 3,
245
+ "user_roles": [
246
+ "all"
247
+ ],
248
+ "return_format": "array",
249
+ "library": "all",
250
+ "min_width": "",
251
+ "min_height": "",
252
+ "min_size": "",
253
+ "max_width": "",
254
+ "max_height": "",
255
+ "max_size": "",
256
+ "mime_types": "",
257
+ "preview_size": "medium",
258
+ "uploader": "",
259
+ "acfe_thumbnail": 0,
260
+ "upload_folder": ""
261
+ },
262
+ {
263
+ "key": "field_65251a3817f08",
264
+ "label": "Image Size",
265
+ "name": "image_size",
266
+ "aria-label": "",
267
+ "type": "range",
268
+ "instructions": "",
269
+ "required": 0,
270
+ "conditional_logic": [
271
+ [
272
+ {
273
+ "field": "field_651bfc5788b2f",
274
+ "operator": "==",
275
+ "value": "1"
276
+ }
277
+ ]
278
+ ],
279
+ "wrapper": {
280
+ "width": "",
281
+ "class": "",
282
+ "id": ""
283
+ },
284
+ "wpml_cf_preferences": 3,
285
+ "user_roles": [
286
+ "all"
287
+ ],
288
+ "default_value": 30,
289
+ "min": 0,
290
+ "max": 50,
291
+ "step": "",
292
+ "prepend": "",
293
+ "append": ""
294
+ }
295
+ ],
296
+ "location": [
297
+ [
298
+ {
299
+ "param": "block",
300
+ "operator": "==",
301
+ "value": "all"
302
+ }
303
+ ]
304
+ ],
305
+ "menu_order": 0,
306
+ "position": "normal",
307
+ "style": "default",
308
+ "label_placement": "top",
309
+ "instruction_placement": "label",
310
+ "hide_on_screen": "",
311
+ "active": false,
312
+ "description": "Library version - Do not modify in this project as any changes will be overwritten by future updates.",
313
+ "show_in_rest": 0,
314
+ "display_title": "",
315
+ "acfe_autosync": [
316
+ "json"
317
+ ],
318
+ "acfe_form": 0,
319
+ "acfe_display_title": "",
320
+ "acfe_meta": "",
321
+ "acfe_note": "",
322
+ "modified": 1762954117
323
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@total_onion/onion-library",
3
- "version": "2.0.129",
3
+ "version": "2.0.130",
4
4
  "description": "Component library",
5
5
  "main": "index.js",
6
6
  "scripts": {