@gem-sdk/components 2.0.0-dev.540 → 2.0.0-dev.542

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.
@@ -6,14 +6,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var core = require('@gem-sdk/core');
8
8
  var React = require('react');
9
+ var NoDataState = require('../../common/components/NoDataState.js');
9
10
 
10
11
  const ArticleContent = ({ styles, builderProps })=>{
11
12
  const article = core.useArticleStore((s)=>s.article);
12
13
  const [open, setOpen] = React.useState(false);
13
14
  const ref = React.useRef(null);
14
15
  const currentDevice = core.useCurrentDevice();
16
+ const storefrontUrl = core.useShopStore((s)=>s.storefrontUrl);
15
17
  const hasLineClamp = core.getResponsiveValueByScreen(styles?.hasLineClamp, currentDevice);
16
18
  const lineClamp = core.getResponsiveValueByScreen(styles?.lineClamp, currentDevice);
19
+ const addExcerptLink = ()=>{
20
+ if (!storefrontUrl) return undefined;
21
+ const url = new URL(storefrontUrl);
22
+ window.open(`${url.protocol}//${url.host}/admin/content/articles`);
23
+ };
17
24
  React.useEffect(()=>{
18
25
  setOpen(false);
19
26
  }, [
@@ -46,9 +53,19 @@ const ArticleContent = ({ styles, builderProps })=>{
46
53
  className: "gp-article-description",
47
54
  "data-article-id": article?.baseID?.replace('gid://shopify/OnlineStoreArticle/', ''),
48
55
  children: !article?.description ? /*#__PURE__*/ jsxRuntime.jsx("div", {
49
- children: /*#__PURE__*/ jsxRuntime.jsx("p", {
50
- className: "gp-p-2 gp-text-sm gp-font-semibold gp-text-gray-500",
51
- children: "This article does not have content."
56
+ children: /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
57
+ elementType: "secondary",
58
+ description: "Inform and provide value to the audience with article content.",
59
+ descriptionActions: [
60
+ {
61
+ text: 'Add article content',
62
+ callback: addExcerptLink
63
+ },
64
+ {
65
+ text: 'sync data',
66
+ callback: 'syncArticle'
67
+ }
68
+ ]
52
69
  })
53
70
  }) : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
54
71
  children: [
@@ -9,23 +9,38 @@ var Text = require('../../text/components/Text.js');
9
9
  var core = require('@gem-sdk/core');
10
10
  var React = require('react');
11
11
  var useArticleLink = require('../hooks/useArticleLink.js');
12
+ var NoDataState = require('../../common/components/NoDataState.js');
12
13
 
13
14
  const ArticleExcerpt = ({ setting, styles, builderProps })=>{
14
15
  const article = core.useArticleStore((s)=>s.article);
16
+ const storefrontUrl = core.useShopStore((s)=>s.storefrontUrl);
15
17
  const excerpt = React.useMemo(()=>{
16
18
  return article?.content?.excerptHtml;
17
19
  }, [
18
20
  article
19
21
  ]);
20
22
  const { shopifyArticleLink } = useArticleLink.useArticleLink();
23
+ const addExcerptLink = ()=>{
24
+ if (!storefrontUrl) return undefined;
25
+ const url = new URL(storefrontUrl);
26
+ window.open(`${url.protocol}//${url.host}/admin/content/articles`);
27
+ };
21
28
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
22
29
  id: `shopify-text-element-${builderProps?.uid}`,
23
30
  "data-article-id": article?.baseID?.replace('gid://shopify/OnlineStoreArticle/', ''),
24
- children: !article || !excerpt ? /*#__PURE__*/ jsxRuntime.jsx("div", {
25
- children: /*#__PURE__*/ jsxRuntime.jsx("p", {
26
- className: "gp-p-2 gp-text-sm gp-font-semibold gp-text-gray-500",
27
- children: "This article does not have an excerpt."
28
- })
31
+ children: !article || !excerpt ? /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
32
+ elementType: "secondary",
33
+ description: "Provide a brief summary or teaser of the article. ",
34
+ descriptionActions: [
35
+ {
36
+ text: 'Add article excerpt',
37
+ callback: addExcerptLink
38
+ },
39
+ {
40
+ text: 'sync data',
41
+ callback: 'syncArticle'
42
+ }
43
+ ]
29
44
  }) : setting?.linkArticle ? /*#__PURE__*/ jsxRuntime.jsx(Link, {
30
45
  href: shopifyArticleLink,
31
46
  title: article?.title,
@@ -23,8 +23,8 @@ const ArticleTag = ({ setting, builderProps, styles })=>{
23
23
  }
24
24
  }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
25
25
  children: /*#__PURE__*/ jsxRuntime.jsx("p", {
26
- className: "gp-p-2 gp-text-sm gp-font-semibold gp-text-gray-500",
27
- children: "This article does not have any tags"
26
+ className: "gp-bg-light-100 gp-border-dashed gp-border-[1px] gp-border-text-light-100 gp-text-text-light-500 gp-rounded-lg gp-px-2 gp-py-1 gp-text-12 gp-leading-5",
27
+ children: "No article tag"
28
28
  })
29
29
  })
30
30
  });
@@ -219,6 +219,7 @@ const ArticleListSettings = [
219
219
  id: 'verticalGutter',
220
220
  label: 'Column gap',
221
221
  type: 'input:unit-spacing',
222
+ hideUnit: true,
222
223
  units: [
223
224
  'px'
224
225
  ],
@@ -228,62 +229,14 @@ const ArticleListSettings = [
228
229
  }
229
230
  }
230
231
  },
231
- {
232
- id: 'grid',
233
- label: 'Grid',
234
- type: 'group',
235
- controls: [
236
- {
237
- id: 'horizontalGutter',
238
- label: 'Row gap',
239
- type: 'input:unit',
240
- units: [
241
- 'px'
242
- ],
243
- devices: {
244
- desktop: {
245
- default: '16px'
246
- },
247
- mobile: {
248
- default: '16px'
249
- }
250
- }
251
- },
252
- {
253
- id: 'verticalGutter',
254
- label: 'Column gap',
255
- type: 'input:unit-spacing',
256
- units: [
257
- 'px'
258
- ],
259
- devices: {
260
- desktop: {
261
- default: '16px'
262
- },
263
- mobile: {
264
- default: '8px'
265
- }
266
- }
267
- }
268
- ]
269
- },
270
232
  {
271
233
  id: 'wrapperBorder',
272
- type: 'border',
273
- label: 'Border',
274
- default: {
275
- borderType: 'none',
276
- border: 'none',
277
- width: '1px 1px 1px 1px',
278
- position: 'all',
279
- borderWidth: '1px',
280
- color: '#000000',
281
- isCustom: true
282
- }
234
+ type: 'border-v2',
235
+ label: 'Border'
283
236
  },
284
237
  {
285
238
  id: 'borderRadius',
286
- type: 'radius-preset',
239
+ type: 'corner-v2',
287
240
  label: 'Corner',
288
241
  default: {
289
242
  radiusType: 'none'
@@ -297,16 +250,8 @@ const ArticleListSettings = [
297
250
  },
298
251
  {
299
252
  id: 'shadow',
300
- type: 'boxShadow',
301
- label: 'Button Shadow',
302
- default: {
303
- type: 'custom',
304
- distance: '10px',
305
- blur: '12px',
306
- spread: '10px',
307
- color: 'rgba(18, 18, 18, 0.77)',
308
- angle: 40
309
- }
253
+ type: 'shadow-v2',
254
+ label: 'Button Shadow'
310
255
  }
311
256
  ]
312
257
  }
@@ -128,7 +128,7 @@ const uiV2 = [
128
128
  en: 'Border'
129
129
  },
130
130
  setting: {
131
- id: 'border',
131
+ id: 'wrapperBorder',
132
132
  state: 'normal'
133
133
  }
134
134
  },
@@ -137,7 +137,7 @@ const uiV2 = [
137
137
  en: 'Corner'
138
138
  },
139
139
  setting: {
140
- id: 'rounded',
140
+ id: 'borderRadius',
141
141
  state: 'normal'
142
142
  }
143
143
  },
@@ -21,6 +21,17 @@ const NoDataState = ({ title, description, elementType, builderAttrs, descriptio
21
21
  });
22
22
  window.dispatchEvent(event);
23
23
  };
24
+ const emitSyncArticle = ()=>{
25
+ const componentUid = refContainer.current?.closest('[data-component-type="component"]')?.getAttribute('data-uid');
26
+ if (!componentUid) return;
27
+ const event = new CustomEvent('editor:sync-article', {
28
+ bubbles: true,
29
+ detail: {
30
+ uid: componentUid
31
+ }
32
+ });
33
+ window.dispatchEvent(event);
34
+ };
24
35
  const emitNoDataSignal = ()=>{
25
36
  if (mode !== 'edit') return;
26
37
  const event = new CustomEvent('editor:product-source-no-data-warning', {
@@ -34,7 +45,8 @@ const NoDataState = ({ title, description, elementType, builderAttrs, descriptio
34
45
  window.dispatchEvent(event);
35
46
  };
36
47
  const presetCallback = {
37
- syncProduct: emitSyncProduct
48
+ syncProduct: emitSyncProduct,
49
+ syncArticle: emitSyncArticle
38
50
  };
39
51
  React.useEffect(()=>{
40
52
  const observer = new ResizeObserver(()=>{
@@ -74,6 +74,31 @@ const ControlUIV2 = [
74
74
  },
75
75
  setting: {
76
76
  id: 'iconItemColor'
77
+ },
78
+ controlChangeTrigger: {
79
+ settings: [
80
+ {
81
+ action: {
82
+ controlId: 'iconColor',
83
+ valueFromField: 'iconItemColor',
84
+ groupType: 'setting',
85
+ controlType: 'setting',
86
+ state: 'normal'
87
+ }
88
+ }
89
+ ],
90
+ options: {
91
+ noRecordHistory: true
92
+ }
93
+ },
94
+ options: {
95
+ updateFields: [
96
+ {
97
+ field: 'iconItemColor',
98
+ settingId: 'iconColor',
99
+ state: 'normal'
100
+ }
101
+ ]
77
102
  }
78
103
  },
79
104
  {
@@ -98,334 +123,6 @@ const ControlUIV2 = [
98
123
  }
99
124
  ]
100
125
  },
101
- // {
102
- // label: {
103
- // en: 'Size',
104
- // },
105
- // controls: [
106
- // {
107
- // type: 'control',
108
- // setting: {
109
- // id: 'size',
110
- // },
111
- // },
112
- // ],
113
- // },
114
- {
115
- label: {
116
- en: 'Item states'
117
- },
118
- controls: [
119
- {
120
- type: 'tab',
121
- controls: [
122
- {
123
- type: 'group',
124
- label: {
125
- en: 'Default'
126
- },
127
- controls: [
128
- {
129
- type: 'control',
130
- label: {
131
- en: 'Icon'
132
- },
133
- setting: {
134
- id: 'iconColor',
135
- state: 'normal'
136
- }
137
- },
138
- {
139
- type: 'control',
140
- label: {
141
- en: 'Background'
142
- },
143
- setting: {
144
- id: 'backgroundColor',
145
- state: 'normal'
146
- }
147
- },
148
- {
149
- type: 'control',
150
- label: {
151
- en: 'Border'
152
- },
153
- setting: {
154
- id: 'borderBundle',
155
- state: 'normal'
156
- }
157
- },
158
- {
159
- type: 'control',
160
- label: {
161
- en: 'Corner'
162
- },
163
- setting: {
164
- id: 'roundedBundle',
165
- state: 'normal'
166
- }
167
- },
168
- {
169
- label: {
170
- en: 'Shadow'
171
- },
172
- setting: {
173
- id: 'boxShadowBundle',
174
- state: 'normal'
175
- },
176
- options: {
177
- updateFields: [
178
- {
179
- field: 'normal.enable',
180
- settingId: 'hasBoxShadowBundle',
181
- state: 'normal'
182
- }
183
- ]
184
- },
185
- controlChangeTrigger: {
186
- settings: [
187
- {
188
- condition: `boxShadowBundle.normal.enable === true`,
189
- source: [
190
- 'boxShadowBundle',
191
- 'hasBoxShadowBundle'
192
- ],
193
- action: {
194
- controlId: 'hasBoxShadowBundle',
195
- groupType: 'style',
196
- controlType: 'style',
197
- state: 'normal',
198
- newValue: true
199
- }
200
- },
201
- {
202
- condition: `boxShadowBundle.normal.enable === false`,
203
- source: [
204
- 'boxShadowBundle',
205
- 'hasBoxShadowBundle'
206
- ],
207
- action: {
208
- controlId: 'hasBoxShadowBundle',
209
- groupType: 'style',
210
- controlType: 'style',
211
- state: 'normal',
212
- newValue: false
213
- }
214
- }
215
- ],
216
- options: {
217
- noRecordHistory: true
218
- }
219
- }
220
- }
221
- ]
222
- },
223
- {
224
- type: 'group',
225
- label: {
226
- en: 'Hover'
227
- },
228
- controls: [
229
- {
230
- type: 'control',
231
- label: {
232
- en: 'Icon'
233
- },
234
- setting: {
235
- id: 'iconColor',
236
- state: 'hover'
237
- }
238
- },
239
- {
240
- type: 'control',
241
- label: {
242
- en: 'Background'
243
- },
244
- setting: {
245
- id: 'backgroundColor',
246
- state: 'hover'
247
- }
248
- },
249
- {
250
- type: 'control',
251
- label: {
252
- en: 'Border'
253
- },
254
- setting: {
255
- id: 'borderBundle',
256
- state: 'hover'
257
- }
258
- },
259
- {
260
- type: 'control',
261
- label: {
262
- en: 'Corner'
263
- },
264
- setting: {
265
- id: 'roundedBundle',
266
- state: 'hover'
267
- }
268
- },
269
- {
270
- label: {
271
- en: 'Shadow'
272
- },
273
- setting: {
274
- id: 'boxShadowBundle',
275
- state: 'hover'
276
- },
277
- options: {
278
- updateFields: [
279
- {
280
- field: 'hover.enable',
281
- settingId: 'hasBoxShadowBundle',
282
- state: 'hover'
283
- }
284
- ]
285
- },
286
- controlChangeTrigger: {
287
- settings: [
288
- {
289
- condition: `boxShadowBundle.hover.enable === true`,
290
- source: [
291
- 'boxShadowBundle',
292
- 'hasBoxShadowBundle'
293
- ],
294
- action: {
295
- controlId: 'hasBoxShadowBundle',
296
- groupType: 'style',
297
- controlType: 'style',
298
- state: 'hover',
299
- newValue: true
300
- }
301
- },
302
- {
303
- condition: `boxShadowBundle.hover.enable === false`,
304
- source: [
305
- 'boxShadowBundle',
306
- 'hasBoxShadowBundle'
307
- ],
308
- action: {
309
- controlId: 'hasBoxShadowBundle',
310
- groupType: 'style',
311
- controlType: 'style',
312
- state: 'hover',
313
- newValue: false
314
- }
315
- }
316
- ],
317
- options: {
318
- noRecordHistory: true
319
- }
320
- }
321
- }
322
- ]
323
- },
324
- {
325
- type: 'group',
326
- label: {
327
- en: 'Active'
328
- },
329
- controls: [
330
- {
331
- type: 'control',
332
- label: {
333
- en: 'Icon'
334
- },
335
- setting: {
336
- id: 'iconColor',
337
- state: 'active'
338
- }
339
- },
340
- {
341
- type: 'control',
342
- label: {
343
- en: 'Background'
344
- },
345
- setting: {
346
- id: 'backgroundColor',
347
- state: 'active'
348
- }
349
- },
350
- {
351
- type: 'control',
352
- label: {
353
- en: 'Border'
354
- },
355
- setting: {
356
- id: 'borderBundle',
357
- state: 'active'
358
- }
359
- },
360
- {
361
- type: 'control',
362
- label: {
363
- en: 'Corner'
364
- },
365
- setting: {
366
- id: 'roundedBundle',
367
- state: 'active'
368
- }
369
- },
370
- {
371
- label: {
372
- en: 'Shadow'
373
- },
374
- setting: {
375
- id: 'boxShadowBundle',
376
- state: 'active'
377
- },
378
- options: {
379
- updateFields: [
380
- {
381
- field: 'active.enable',
382
- settingId: 'hasBoxShadowBundle',
383
- state: 'active'
384
- }
385
- ]
386
- },
387
- controlChangeTrigger: {
388
- settings: [
389
- {
390
- condition: `boxShadowBundle.active.enable === true`,
391
- source: [
392
- 'boxShadowBundle',
393
- 'hasBoxShadowBundle'
394
- ],
395
- action: {
396
- controlId: 'hasBoxShadowBundle',
397
- groupType: 'style',
398
- controlType: 'style',
399
- state: 'active',
400
- newValue: true
401
- }
402
- },
403
- {
404
- condition: `boxShadowBundle.active.enable === false`,
405
- source: [
406
- 'boxShadowBundle',
407
- 'hasBoxShadowBundle'
408
- ],
409
- action: {
410
- controlId: 'hasBoxShadowBundle',
411
- groupType: 'style',
412
- controlType: 'style',
413
- state: 'active',
414
- newValue: false
415
- }
416
- }
417
- ],
418
- options: {
419
- noRecordHistory: true
420
- }
421
- }
422
- }
423
- ]
424
- }
425
- ]
426
- }
427
- ]
428
- },
429
126
  {
430
127
  label: {
431
128
  en: 'Item style'
@@ -75,7 +75,7 @@ const getContainContentClasses = ()=>{
75
75
  };
76
76
  };
77
77
  const getTextClasses = ()=>{
78
- const classList = 'gp-cursor-pointer gp-overflow-hidden gp-whitespace-nowrap';
78
+ const classList = 'gp-cursor-pointer gp-overflow-hidden gp-whitespace-nowrap !gp-text-inherit';
79
79
  return {
80
80
  ...core.composeClasses(classList)
81
81
  };
@@ -69,6 +69,9 @@ const config = {
69
69
  {
70
70
  tag: 'TabItem'
71
71
  },
72
+ {
73
+ tag: 'TabItem'
74
+ },
72
75
  {
73
76
  tag: 'TabItem'
74
77
  }
@@ -12,8 +12,7 @@ const TabsSettings = [
12
12
  'Tab 1',
13
13
  'Tab 2',
14
14
  'Tab 3'
15
- ],
16
- expandItem: true
15
+ ]
17
16
  },
18
17
  {
19
18
  id: 'activeKey',
@@ -77,8 +76,6 @@ const TabsSettings = [
77
76
  color: 'text-1'
78
77
  }
79
78
  },
80
- hiddenSetting: {
81
- },
82
79
  ignoreReRender: true
83
80
  },
84
81
  {
@@ -154,7 +151,10 @@ const TabsSettings = [
154
151
  },
155
152
  {
156
153
  id: 'padding',
157
- type: 'padding-v2'
154
+ type: 'padding-v2',
155
+ devices: {
156
+ desktop: {}
157
+ }
158
158
  },
159
159
  {
160
160
  id: 'labelAlign',