zz-shopify-components 0.35.1-beta.1 → 0.35.1-beta.10

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.
@@ -311,51 +311,52 @@ body.zz-dialog-open {
311
311
  .zz-btn.zz-btn-default.zz-btn-black {
312
312
  background: transparent;
313
313
  color: #2D2D2D;
314
- border: 1.5px solid #2D2D2D;
314
+ border: 1px solid #2D2D2D;
315
315
  }
316
316
 
317
317
  .zz-btn.zz-btn-default.zz-btn-white {
318
318
  background: transparent;
319
319
  color: #fff;
320
- border: 1.5px solid #FFFFFF4D;
320
+ border: 1px solid #FFFFFF;
321
+ font-weight: 400;
321
322
  }
322
323
 
323
324
  .zz-btn.zz-btn-default.zz-btn-orange {
324
325
  background: transparent;
325
326
  color: #FC6C0F;
326
- border: 1.5px solid #FC6C0F;
327
+ border: 1px solid #FC6C0F;
327
328
  }
328
329
 
329
330
  .zz-btn.zz-btn-default.zz-btn-yellow {
330
331
  background: transparent;
331
332
  color: #000;
332
- border: 1.5px solid #FFEB00;
333
+ border: 1px solid #FFEB00;
333
334
  }
334
335
 
335
336
  .zz-btn.zz-btn-default.zz-btn-blue {
336
337
  background: transparent;
337
338
  color: #378DDD;
338
- border: 1.5px solid #378DDD;
339
+ border: 1px solid #378DDD;
339
340
  }
340
341
 
341
342
  .zz-btn.zz-btn-round.zz-btn-black {
342
343
  background: transparent;
343
344
  color: #2D2D2D;
344
- border: 1.5px solid #2D2D2D;
345
+ border: 1px solid #2D2D2D;
345
346
  border-radius: 30px;
346
347
  }
347
348
 
348
349
  .zz-btn.zz-btn-round.zz-btn-white {
349
350
  background: transparent;
350
351
  color: #fff;
351
- border: 1.5px solid #FFFFFF4D;
352
+ border: 1px solid #FFFFFF4D;
352
353
  border-radius: 30px;
353
354
  }
354
355
 
355
356
  .zz-btn.zz-btn-round.zz-btn-orange {
356
357
  background: transparent;
357
358
  color: #ff9900;
358
- border: 1.5px solid #ff9900;
359
+ border: 1px solid #ff9900;
359
360
  border-radius: 30px;
360
361
  }
361
362
 
@@ -408,6 +409,11 @@ body.zz-dialog-open {
408
409
  font-size: 14px;
409
410
  }
410
411
 
412
+ .zz-btn.zz-btn-large.zz-btn-default {
413
+ padding: 0px 1.6rem;
414
+
415
+ }
416
+
411
417
  @media (min-width: 1024px) {
412
418
  .zz-btn {
413
419
  height: 40px;
@@ -434,6 +440,10 @@ body.zz-dialog-open {
434
440
  .zz-btn-link.zz-btn-link-large {
435
441
  font-size: 16px;
436
442
  }
443
+
444
+ .zz-btn.zz-btn-large.zz-btn-default {
445
+ padding: 0px 30px;
446
+ }
437
447
  }
438
448
 
439
449
  .zz-video-btn.zz-btn.zz-btn-white {
@@ -511,4 +521,7 @@ body.zz-dialog-open {
511
521
  height: 0;
512
522
  display: none;
513
523
  /* Chrome/Safari/Edge */
514
- }
524
+ }
525
+ .zz-hidden {
526
+ display: none !important;
527
+ }
@@ -680,3 +680,54 @@ if (!customElements.get('zz-normal-modal')) {
680
680
 
681
681
  customElements.define('zz-normal-modal', ZZNormalModal);
682
682
  }
683
+
684
+ function updateCountryVisibility(currentCountry, marketWordList) {
685
+ console.log('updateCountryVisibility', currentCountry);
686
+ if (!currentCountry) return;
687
+
688
+ // currentCountry 当前国家记录的是PHcountry
689
+ // 查找currentCountry对应的showCountry
690
+ const selectCountry = marketWordList.find(
691
+ (item) => item.PHcountry === currentCountry
692
+ );
693
+ if (!selectCountry) return;
694
+ currentCountry = selectCountry.showCountry;
695
+ const isEuropeCountry = selectCountry.formState === 'Europe';
696
+
697
+ // visibleCountries 使用的是marketWordList中country字段
698
+ currentCountry = currentCountry.toUpperCase();
699
+
700
+ document.querySelectorAll('[data-visibility-rule]').forEach((element) => {
701
+ if (!element.dataset.visibilityCountries) return;
702
+
703
+ const rule = element.dataset.visibilityRule;
704
+ const countries = (element.dataset.visibilityCountries || '')
705
+ .split(',')
706
+ .map((item) => item.trim().toUpperCase())
707
+ .filter(Boolean);
708
+ const isMatchedCountry =
709
+ countries.includes(currentCountry) ||
710
+ (countries.includes('EU') && isEuropeCountry);
711
+
712
+ let visible = true;
713
+
714
+ switch (rule) {
715
+ case 'country_only':
716
+ visible = isMatchedCountry;
717
+ break;
718
+
719
+ case 'country_exclude':
720
+ visible = !isMatchedCountry;
721
+ break;
722
+
723
+ default:
724
+ visible = true;
725
+ }
726
+
727
+ if (visible) {
728
+ element.classList.remove('zz-hidden');
729
+ } else {
730
+ element.classList.add('zz-hidden');
731
+ }
732
+ });
733
+ }
@@ -143,27 +143,27 @@ document.addEventListener('DOMContentLoaded', () => {
143
143
  ease: 'power1.out',
144
144
  });
145
145
  });
146
- });
147
146
 
148
- // 跟随滚动缓慢显示
149
- const slowReveal = document.querySelectorAll('.slow-reveal');
150
- slowReveal.forEach((element) => {
151
- // 过滤出不包含 no-fade-in 类名的子元素
152
- const children = Array.from(element.children).filter(
153
- (child) => !child.classList.contains('no-fade-in')
154
- );
155
- gsap.from(children, {
156
- scrollTrigger: {
157
- trigger: element,
158
- start: 'top 80%',
159
- end: 'top 60%',
160
- scrub: 1, // 平滑跟随滚动
161
- toggleActions: 'play none none reverse',
162
- },
163
- opacity: 1,
164
- y: 100,
165
- duration: 0.4,
166
- stagger: 0.1,
167
- ease: 'power1.out',
147
+ // 跟随滚动缓慢显示
148
+ const slowReveal = document.querySelectorAll('.slow-reveal');
149
+ slowReveal.forEach((element) => {
150
+ // 过滤出不包含 no-fade-in 类名的子元素
151
+ const children = Array.from(element.children).filter(
152
+ (child) => !child.classList.contains('no-fade-in')
153
+ );
154
+ gsap.from(children, {
155
+ scrollTrigger: {
156
+ trigger: element,
157
+ start: 'top 80%',
158
+ end: 'top 60%',
159
+ scrub: 1, // 平滑跟随滚动
160
+ toggleActions: 'play none none reverse',
161
+ },
162
+ opacity: 1,
163
+ y: 100,
164
+ duration: 0.4,
165
+ stagger: 0.1,
166
+ ease: 'power1.out',
167
+ });
168
168
  });
169
169
  });
@@ -0,0 +1,327 @@
1
+ {% liquid
2
+ if block.settings.modal_id != blank
3
+ assign modal_id = block.settings.modal_id
4
+ else
5
+ assign modal_id = 'zz-bottom-popup-' | append: block.id
6
+ endif
7
+ %}
8
+
9
+ <style>
10
+ #shopify-block-{{ block.id }} .zz-bottom-popup {
11
+ display: block;
12
+ width: 100%;
13
+ }
14
+
15
+ #shopify-block-{{ block.id }} .zz-bottom-popup__modal {
16
+ display: block;
17
+ }
18
+
19
+ #shopify-block-{{ block.id }} .zz-bottom-popup__overlay {
20
+ position: fixed;
21
+ inset: 0;
22
+ z-index: 888;
23
+ background: rgba(0, 0, 0, 0.6);
24
+ opacity: 0;
25
+ pointer-events: none;
26
+ transition: opacity 0.35s ease;
27
+ }
28
+
29
+ #shopify-block-{{ block.id }} .zz-bottom-popup__overlay.is-open {
30
+ opacity: 1;
31
+ pointer-events: auto;
32
+ }
33
+ @media screen and (max-width: 1023px) {
34
+ #shopify-block-{{ block.id }} .zz-bottom-popup__content {
35
+ height: {{ block.settings.mobile_height }}vh;
36
+ max-height: {{ block.settings.mobile_height }}vh;
37
+ padding: {{ block.settings.mobile_padding_top }}px {{ block.settings.mobile_padding_x }}px 0;
38
+
39
+ }
40
+ }
41
+
42
+ #shopify-block-{{ block.id }} .zz-bottom-popup__content {
43
+ position: fixed;
44
+ left: 0;
45
+ bottom: 0;
46
+ z-index: 889;
47
+ display: flex;
48
+ flex-direction: column;
49
+ width: 100vw;
50
+ border-radius: 20px 20px 0 0;
51
+ background: {{ block.settings.background_color }};
52
+ box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
53
+ opacity: 0;
54
+ overflow: hidden;
55
+ outline: none;
56
+ transform: translate3d(0, 100%, 0);
57
+ transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
58
+ box-sizing: border-box;
59
+ }
60
+
61
+ #shopify-block-{{ block.id }} .zz-bottom-popup__content.is-open {
62
+ opacity: 1;
63
+ transform: translate3d(0, 0, 0);
64
+ }
65
+
66
+ #shopify-block-{{ block.id }} .zz-bottom-popup__close {
67
+ position: absolute;
68
+ top: 16px;
69
+ right: 16px;
70
+ z-index: 101;
71
+ display: inline-flex;
72
+ align-items: center;
73
+ justify-content: center;
74
+ width: 32px;
75
+ height: 32px;
76
+ padding: 0;
77
+ border: 0;
78
+ border-radius: 999px;
79
+ background: rgba(255, 255, 255, 0.12);
80
+ backdrop-filter: blur(10px);
81
+ -webkit-backdrop-filter: blur(10px);
82
+ cursor: pointer;
83
+ overflow: hidden;
84
+ }
85
+
86
+ #shopify-block-{{ block.id }} .zz-bottom-popup__body {
87
+ display: flex;
88
+ flex-direction: column;
89
+ min-height: 0;
90
+ flex: 1 1 auto;
91
+ padding-bottom: 34px;
92
+ overflow-y: auto;
93
+ {% comment %} scrollbar-width: thin;
94
+ scrollbar-color: rgba(255, 255, 255, 0.18) transparent; {% endcomment %}
95
+ }
96
+
97
+ #shopify-block-{{ block.id }} .zz-bottom-popup__inner {
98
+ width: 100%;
99
+ margin: 0 auto;
100
+ display: flex;
101
+ flex-direction: column;
102
+ align-items: stretch;
103
+ box-sizing: border-box;
104
+ }
105
+
106
+ @media screen and (min-width: 1024px) {
107
+ #shopify-block-{{ block.id }} .zz-bottom-popup__content {
108
+ height: {{ block.settings.pc_height }}vh;
109
+ max-height: {{ block.settings.pc_height }}vh;
110
+ padding-top: {{ block.settings.pc_padding_top }}px;
111
+ }
112
+
113
+ #shopify-block-{{ block.id }} .zz-bottom-popup__close {
114
+ top: auto;
115
+ right: auto;
116
+ right: 30px;
117
+ top: 30px;
118
+ width: 40px;
119
+ height: 40px;
120
+ }
121
+
122
+ #shopify-block-{{ block.id }} .zz-bottom-popup__body {
123
+ padding-bottom: 90px;
124
+ }
125
+
126
+ #shopify-block-{{ block.id }} .zz-bottom-popup__inner {
127
+ {% if block.settings.pc_full_width %}
128
+ width: 100%;
129
+ {% else %}
130
+ width: {{ block.settings.pc_lg_width }}vw;
131
+ {% endif %}
132
+ }
133
+ }
134
+
135
+ @media screen and (min-width: 1280px) {
136
+ #shopify-block-{{ block.id }} .zz-bottom-popup__inner {
137
+ {% if block.settings.pc_full_width %}
138
+ width: 100%;
139
+ {% else %}
140
+ width: {{ block.settings.pc_xl_width }}px;
141
+ {% endif %}
142
+ }
143
+ }
144
+ </style>
145
+
146
+ <div class="zz-bottom-popup" {{ block.shopify_attributes }}>
147
+ <zz-normal-modal id="{{ modal_id }}" class="zz-bottom-popup__modal" aria-hidden="true">
148
+ <div class="zz-bottom-popup__overlay" data-modal-overlay>&nbsp;</div>
149
+ <div
150
+ class="zz-bottom-popup__content"
151
+ data-modal-content
152
+ role="dialog"
153
+ aria-modal="true"
154
+ aria-labelledby="{{ modal_id }}-title"
155
+ tabindex="-1"
156
+ >
157
+ <button
158
+ class="zz-bottom-popup__close"
159
+ type="button"
160
+ data-modal-close
161
+ aria-label="{{ 'accessibility.close' | t }}"
162
+ >
163
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
164
+ <foreignObject x="-10" y="-10" width="60" height="60"><div xmlns="http://www.w3.org/1999/xhtml" style="backdrop-filter:blur(5px);clip-path:url(#zz_bottom_popup_blur_{{ block.id }});height:100%;width:100%"></div></foreignObject><circle data-figma-bg-blur-radius="10" cx="20" cy="20" r="20" fill="white" fill-opacity="0.15"/>
165
+ <path d="M14.1196 25.9395L25.999 14.0601" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
166
+ <path d="M14.1196 14.0605L25.999 25.9399" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
167
+ <defs>
168
+ <clipPath id="zz_bottom_popup_blur_{{ block.id }}" transform="translate(10 10)"><circle cx="20" cy="20" r="20"/></clipPath>
169
+ </defs>
170
+ </svg>
171
+ </button>
172
+
173
+ <div class="zz-bottom-popup__body zz-overflow-scrollbar-hidden">
174
+ <div class="zz-bottom-popup__inner" id="{{ modal_id }}-title">
175
+ {% content_for 'blocks' %}
176
+ </div>
177
+ </div>
178
+ </div>
179
+ </zz-normal-modal>
180
+ </div>
181
+
182
+ <script>
183
+ document.addEventListener('DOMContentLoaded', function() {
184
+ var blockRoot = document.getElementById('shopify-block-{{ block.id }}');
185
+
186
+ if (!blockRoot || blockRoot.dataset.bottomPopupBound === 'true') {
187
+ return;
188
+ }
189
+
190
+ blockRoot.dataset.bottomPopupBound = 'true';
191
+
192
+ var modal = blockRoot.querySelector('zz-normal-modal');
193
+ var closeButton = blockRoot.querySelector('[data-modal-close]');
194
+ var overlay = blockRoot.querySelector('[data-modal-overlay]');
195
+ var modalTarget = '#{{ modal_id }}';
196
+ var triggers = document.querySelectorAll('[data-zz-modal-target="' + modalTarget + '"]');
197
+ console.log('triggers----------triggers',triggers);
198
+ if (!modal) {
199
+ return;
200
+ }
201
+
202
+ triggers.forEach(function(trigger) {
203
+ trigger.setAttribute('aria-controls', '{{ modal_id }}');
204
+
205
+ trigger.addEventListener('click', function() {
206
+ if (typeof modal.show === 'function') {
207
+ modal.show();
208
+ trigger.setAttribute('aria-expanded', 'true');
209
+ }
210
+ });
211
+ });
212
+
213
+ [closeButton, overlay].forEach(function(element) {
214
+ if (!element) {
215
+ return;
216
+ }
217
+
218
+ element.addEventListener('click', function() {
219
+ triggers.forEach(function(trigger) {
220
+ trigger.setAttribute('aria-expanded', 'false');
221
+ });
222
+ });
223
+ });
224
+
225
+ document.addEventListener('keydown', function(event) {
226
+ if (event.key === 'Escape') {
227
+ triggers.forEach(function(trigger) {
228
+ trigger.setAttribute('aria-expanded', 'false');
229
+ });
230
+ }
231
+ });
232
+
233
+ });
234
+ </script>
235
+
236
+ {% schema %}
237
+ {
238
+ "name": "ZZ Bottom Popup",
239
+ "settings": [
240
+ {
241
+ "type": "text",
242
+ "id": "modal_id",
243
+ "label": "弹窗 id",
244
+ "info": "用于外部按钮通过 data-zz-modal-target 触发"
245
+ },
246
+ {
247
+ "type": "color_background",
248
+ "id": "background_color",
249
+ "label": "背景颜色",
250
+ "default": "#000000"
251
+ },
252
+ {
253
+ "type": "header",
254
+ "content": "💻 PC端布局设置"
255
+ },
256
+ {
257
+ "type": "number",
258
+ "id": "pc_height",
259
+ "label": "PC端占屏幕高度 (vh)",
260
+ "default": 88
261
+ },
262
+ {
263
+ "type": "checkbox",
264
+ "id": "pc_full_width",
265
+ "label": "是否全屏展示",
266
+ "default": true
267
+ },
268
+ {
269
+ "type": "number",
270
+ "id": "pc_xl_width",
271
+ "label": "XL屏幕内容区域宽度 (px)",
272
+ "default": 1200,
273
+ "visible_if": "{{ block.settings.pc_full_width == false }}",
274
+ "info": "非全屏展示时有效"
275
+ },
276
+ {
277
+ "type": "number",
278
+ "id": "pc_lg_width",
279
+ "label": "LG屏幕内容区域宽度 (vw)",
280
+ "default": 90,
281
+ "visible_if": "{{ block.settings.pc_full_width == false }}",
282
+ "info": "非全屏展示时有效"
283
+ },
284
+ {
285
+ "type": "number",
286
+ "id": "pc_padding_top",
287
+ "label": "PC端内容顶部内边距",
288
+ "default": 40,
289
+ "info": "单位:px"
290
+ },
291
+ {
292
+ "type": "header",
293
+ "content": "📱 移动端布局设置"
294
+ },
295
+ {
296
+ "type": "number",
297
+ "id": "mobile_height",
298
+ "label": "移动端占屏幕高度 (vh)",
299
+ "default": 80
300
+ },
301
+ {
302
+ "type": "number",
303
+ "id": "mobile_padding_top",
304
+ "label": "移动端内容顶部内边距",
305
+ "default": 40,
306
+ "info": "单位:px"
307
+ },
308
+ {
309
+ "type": "number",
310
+ "id": "mobile_padding_x",
311
+ "label": "移动端左右内边距",
312
+ "default": 20,
313
+ "info": "单位:px"
314
+ }
315
+ ],
316
+ "blocks": [
317
+ {
318
+ "type": "@theme"
319
+ }
320
+ ],
321
+ "presets": [
322
+ {
323
+ "name": "ZZ Bottom Popup"
324
+ }
325
+ ]
326
+ }
327
+ {% endschema %}
@@ -1,6 +1,7 @@
1
1
  {% schema %}
2
2
  {
3
3
  "name": "Button v2",
4
+ "class": "zz-button-v2",
4
5
  "settings": [
5
6
  {
6
7
  "type": "text",
@@ -102,6 +103,18 @@
102
103
  ],
103
104
  "default": "black",
104
105
  },
106
+ {
107
+ "type": "color",
108
+ "id": "custom_background_color",
109
+ "label": "自定义背景颜色",
110
+ "info": "按钮颜色有限,颜色自定义"
111
+ },
112
+ {
113
+ "type": "color",
114
+ "id": "custom_text_color",
115
+ "label": "自定义文字颜色",
116
+ "info": "按钮文字颜色有限,颜色自定义"
117
+ },
105
118
  {
106
119
  "type": "select",
107
120
  "id": "size",
@@ -132,6 +145,16 @@
132
145
  ],
133
146
  "default": "auto"
134
147
  },
148
+ {
149
+ "type": "select",
150
+ "id": "prefix_icon",
151
+ "label": "前缀图标",
152
+ "options": [
153
+ { "value": "none", "label": "不展示" },
154
+ { "value": "plus", "label": "加号" }
155
+ ],
156
+ "default": "none"
157
+ },
135
158
  {
136
159
  "type": "select",
137
160
  "id": "postfix_icon",
@@ -172,6 +195,11 @@
172
195
  "id": "modal_id",
173
196
  "label": "按钮触发modal的id",
174
197
  },
198
+ {
199
+ "type": "text",
200
+ "id": "custom_class",
201
+ "label": "自定义类名",
202
+ },
175
203
  {
176
204
  "type": "text",
177
205
  "id": "click_event_class_name",
@@ -193,6 +221,10 @@
193
221
 
194
222
  {% assign btn_class = 'zz-button' | append: block.id %}
195
223
 
224
+ {% if block.settings.custom_class != blank %}
225
+ {% assign btn_class = btn_class | append: ' ' | append: block.settings.custom_class %}
226
+ {% endif %}
227
+
196
228
  <style>
197
229
 
198
230
  {% if block.settings.mobile_width == 'full' %}
@@ -203,6 +235,18 @@
203
235
  }
204
236
  }
205
237
  {% endif %}
238
+
239
+ {% if block.settings.custom_background_color != blank %}
240
+ #shopify-block-{{ block.id }} .{{ btn_class }} {
241
+ background: {{ block.settings.custom_background_color }} !important;
242
+ }
243
+ {% endif %}
244
+
245
+ {% if block.settings.custom_text_color != blank %}
246
+ #shopify-block-{{ block.id }} .{{ btn_class }} {
247
+ color: {{ block.settings.custom_text_color }} !important;
248
+ }
249
+ {% endif %}
206
250
  </style>
207
251
 
208
252
  {% render 'zz-button-v2',
@@ -211,6 +255,7 @@
211
255
  color: block.settings.color,
212
256
  text: block.settings.text,
213
257
  size: block.settings.size,
258
+ prefix_icon: block.settings.prefix_icon,
214
259
  postfix_icon: block.settings.postfix_icon,
215
260
  icon_size: block.settings.icon_size,
216
261
  icon_left_margin: block.settings.icon_left_margin,
@@ -102,6 +102,14 @@
102
102
  ],
103
103
  "default": "left"
104
104
  },
105
+ {
106
+ "type": "checkbox",
107
+ "id": "separate_display",
108
+ "label": "区分显示pc还是mb",
109
+ "default": false,
110
+ "info": "区分显示pc还是mb, true时 没有配置PC与mb将不会显示。不会使用PC的配置来配置mb"
111
+
112
+ },
105
113
  {
106
114
  "type": "select",
107
115
  "id": "animation",
@@ -182,7 +190,8 @@
182
190
  mobile_font_size: block.settings.mobile_font_size,
183
191
  pc_text_align: block.settings.pc_text_align,
184
192
  mobile_text_align: block.settings.mobile_text_align,
185
- class_name: block.settings.animation
193
+ class_name: block.settings.animation,
194
+ separate_display: block.settings.separate_display,
186
195
  %}
187
196
 
188
197
  {% if block.settings.use_margin %}
@@ -153,6 +153,14 @@
153
153
  "default": false,
154
154
  "info": "Blod 高亮文字是否加粗"
155
155
 
156
+ },
157
+ {
158
+ "type": "checkbox",
159
+ "id": "separate_display",
160
+ "label": "区分显示pc还是mb",
161
+ "default": false,
162
+ "info": "区分显示pc还是mb, true时 没有配置PC与mb将不会显示。不会使用PC的配置来配置mb"
163
+
156
164
  },
157
165
 
158
166
  {
@@ -221,6 +229,7 @@
221
229
  mobile_text_align: block.settings.mobile_text_align,
222
230
  pc_font_line_height: block.settings.pc_font_line_height,
223
231
  mobile_font_line_height: block.settings.mobile_font_line_height,
232
+ separate_display: block.settings.separate_display,
224
233
  %}
225
234
 
226
235