@gem-sdk/components 2.0.0-dev.539 → 2.0.0-dev.541

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.
Files changed (42) hide show
  1. package/dist/cjs/article/components/ArticleContent.js +20 -3
  2. package/dist/cjs/article/components/ArticleExcerpt.js +20 -5
  3. package/dist/cjs/article/components/ArticleTag.js +2 -2
  4. package/dist/cjs/article/setting/configs/ArticleList/settings.js +6 -61
  5. package/dist/cjs/article/setting/configs/ArticleList/uiV2.js +2 -2
  6. package/dist/cjs/button/setting/configs/settings.js +14 -0
  7. package/dist/cjs/common/components/NoDataState.js +13 -1
  8. package/dist/cjs/estimate-delivery/components/EstimateDate.js +1 -3
  9. package/dist/cjs/estimate-delivery/setting/configs/settings.js +25 -49
  10. package/dist/cjs/estimate-delivery/setting/configs/uiV2.js +55 -62
  11. package/dist/cjs/image/components/AdaptiveImage.js +2 -2
  12. package/dist/cjs/image/components/common/styles.js +1 -1
  13. package/dist/cjs/image/setting/configs/settings.js +8 -4
  14. package/dist/cjs/image/setting/configs/uiV2.js +42 -43
  15. package/dist/cjs/image-comparison/components/hooks/useCompareImage.js +3 -2
  16. package/dist/cjs/image-comparison/setting/configs/settings.js +11 -5
  17. package/dist/cjs/product/setting/product-view-more/configs/settings.js +14 -0
  18. package/dist/cjs/tab/components/common/getClasses.js +1 -1
  19. package/dist/cjs/tab/setting/Tabs.js +3 -0
  20. package/dist/cjs/tab/setting/configs/settings.js +5 -5
  21. package/dist/esm/article/components/ArticleContent.js +21 -4
  22. package/dist/esm/article/components/ArticleExcerpt.js +21 -6
  23. package/dist/esm/article/components/ArticleTag.js +2 -2
  24. package/dist/esm/article/setting/configs/ArticleList/settings.js +6 -61
  25. package/dist/esm/article/setting/configs/ArticleList/uiV2.js +2 -2
  26. package/dist/esm/button/setting/configs/settings.js +14 -0
  27. package/dist/esm/common/components/NoDataState.js +13 -1
  28. package/dist/esm/estimate-delivery/components/EstimateDate.js +1 -3
  29. package/dist/esm/estimate-delivery/setting/configs/settings.js +25 -49
  30. package/dist/esm/estimate-delivery/setting/configs/uiV2.js +55 -62
  31. package/dist/esm/image/components/AdaptiveImage.js +2 -2
  32. package/dist/esm/image/components/common/styles.js +1 -1
  33. package/dist/esm/image/setting/configs/settings.js +8 -4
  34. package/dist/esm/image/setting/configs/uiV2.js +42 -43
  35. package/dist/esm/image-comparison/components/hooks/useCompareImage.js +3 -2
  36. package/dist/esm/image-comparison/setting/configs/settings.js +11 -5
  37. package/dist/esm/product/setting/product-view-more/configs/settings.js +14 -0
  38. package/dist/esm/tab/components/common/getClasses.js +1 -1
  39. package/dist/esm/tab/setting/Tabs.js +3 -0
  40. package/dist/esm/tab/setting/configs/settings.js +5 -5
  41. package/dist/types/index.d.ts +3 -0
  42. package/package.json +2 -2
@@ -21,21 +21,9 @@ const SettingUIV2 = [
21
21
  action: {
22
22
  controlId: 'shape',
23
23
  newValue: {
24
- desktop: {
25
- shape: 'square',
26
- shapeValue: '1/1',
27
- shapeLinked: true
28
- },
29
- tablet: {
30
- shape: 'square',
31
- shapeValue: '1/1',
32
- shapeLinked: true
33
- },
34
- mobile: {
35
- shape: 'square',
36
- shapeValue: '1/1',
37
- shapeLinked: true
38
- }
24
+ shape: 'square',
25
+ shapeValue: '1/1',
26
+ shapeLinked: true
39
27
  },
40
28
  groupType: 'style',
41
29
  controlType: 'style'
@@ -49,10 +37,10 @@ const SettingUIV2 = [
49
37
  action: {
50
38
  controlId: 'borderRadius',
51
39
  newValue: {
52
- bblr: '99999px',
53
- btrr: '99999px',
54
- bbrr: '99999px',
55
- btlr: '99999px',
40
+ bblr: '9999px',
41
+ btrr: '9999px',
42
+ bbrr: '9999px',
43
+ btlr: '9999px',
56
44
  radiusType: 'circle'
57
45
  },
58
46
  groupType: 'style',
@@ -67,18 +55,8 @@ const SettingUIV2 = [
67
55
  action: {
68
56
  controlId: 'shape',
69
57
  newValue: {
70
- desktop: {
71
- shape: 'original',
72
- shapeValue: ''
73
- },
74
- tablet: {
75
- shape: 'original',
76
- shapeValue: ''
77
- },
78
- mobile: {
79
- shape: 'original',
80
- shapeValue: ''
81
- }
58
+ shape: 'original',
59
+ shapeValue: ''
82
60
  },
83
61
  groupType: 'style',
84
62
  controlType: 'style'
@@ -169,7 +147,6 @@ const SettingUIV2 = [
169
147
  }
170
148
  },
171
149
  {
172
- conditionDisplay: "shape.shape !== 'original'",
173
150
  label: {
174
151
  en: 'Scale'
175
152
  },
@@ -301,20 +278,46 @@ const SettingUIV2 = [
301
278
  },
302
279
  controls: [
303
280
  {
281
+ type: 'combo',
304
282
  label: {
305
283
  en: 'Alt text'
306
284
  },
307
- setting: {
308
- id: 'alt'
309
- }
285
+ iconName: 'polaris-text-block',
286
+ fixedValue: 'Describes the appearance of the image',
287
+ getValueFromSettingID: 'alt',
288
+ isHideClear: true,
289
+ controls: [
290
+ {
291
+ label: {
292
+ en: 'Content'
293
+ },
294
+ setting: {
295
+ id: 'alt'
296
+ },
297
+ layout: 'vertical'
298
+ }
299
+ ]
310
300
  },
311
301
  {
302
+ type: 'combo',
312
303
  label: {
313
304
  en: 'Image title'
314
305
  },
315
- setting: {
316
- id: 'title'
317
- }
306
+ iconName: 'polaris-text-block',
307
+ fixedValue: 'Title',
308
+ getValueFromSettingID: 'title',
309
+ isHideClear: true,
310
+ controls: [
311
+ {
312
+ label: {
313
+ en: 'Content'
314
+ },
315
+ setting: {
316
+ id: 'title'
317
+ },
318
+ layout: 'vertical'
319
+ }
320
+ ]
318
321
  }
319
322
  ]
320
323
  },
@@ -322,10 +325,6 @@ const SettingUIV2 = [
322
325
  label: {
323
326
  en: 'Optimize LCP'
324
327
  },
325
- messageConfig: {
326
- type: 'info',
327
- message: 'You can optimize image size with our partnered app'
328
- },
329
328
  controls: [
330
329
  {
331
330
  label: {
@@ -368,7 +367,7 @@ const SettingUIV2 = [
368
367
  options: {
369
368
  labelVariant: 'primary',
370
369
  fullWidth: true,
371
- disableMessage: `Align is not supported when width is 100%`
370
+ disableMessage: `This option is disabled because the width is set to 100%`
372
371
  }
373
372
  }
374
373
  ]
@@ -19,8 +19,9 @@ const useCompareImage = ({ props, aspectRatio })=>{
19
19
  const leftImageRef = React.useRef(null);
20
20
  const { onListener, saveToElementInteractionData } = core.useInteraction();
21
21
  const ref = React.useRef(null);
22
- const memoAspectRatio = React.useMemo(()=>aspectRatio, [
23
- aspectRatio
22
+ const memoAspectRatio = React.useMemo(()=>aspectRatio || styles?.aspectRatio, [
23
+ aspectRatio,
24
+ styles?.aspectRatio
24
25
  ]);
25
26
  React.useEffect(()=>{
26
27
  const selector = `[data-id="${props?.componentUid}"]`;
@@ -32,6 +32,9 @@ const ImageComparisonSettings = [
32
32
  src: 'https://ucarecdn.com/f22eb586-02bc-4c17-910f-6435af22301b/-/format/auto/',
33
33
  width: 900,
34
34
  height: 600
35
+ },
36
+ hiddenSetting: {
37
+ seo: true
35
38
  }
36
39
  }
37
40
  ]
@@ -48,6 +51,9 @@ const ImageComparisonSettings = [
48
51
  src: 'https://ucarecdn.com/45dae4ae-3e07-40d9-a22c-4032c1c817d6/-/format/auto/',
49
52
  width: 900,
50
53
  height: 600
54
+ },
55
+ hiddenSetting: {
56
+ seo: true
51
57
  }
52
58
  }
53
59
  ]
@@ -503,21 +509,21 @@ const ImageComparisonSettings = [
503
509
  },
504
510
  {
505
511
  id: 'imageScale',
506
- type: 'layout-segment',
507
- iconViewBox: '0 0 66 48',
508
- enableItemBackground: true,
512
+ type: 'option:illustration',
509
513
  enableTooltip: true,
510
514
  label: 'Image scale',
511
515
  options: [
512
516
  {
513
517
  label: 'Fill image',
514
518
  value: 'cover',
515
- type: 'image'
519
+ type: 'image',
520
+ svgName: 'gp-image-cover'
516
521
  },
517
522
  {
518
523
  label: 'Fit image',
519
524
  value: 'contain',
520
- type: 'image'
525
+ type: 'image',
526
+ svgName: 'gp-image-contain'
521
527
  }
522
528
  ],
523
529
  devices: {
@@ -183,6 +183,13 @@ const ProductViewMoreSettings = [
183
183
  desktop: {
184
184
  default: {
185
185
  normal: {
186
+ size: 'cover',
187
+ position: {
188
+ x: 50,
189
+ y: 50
190
+ },
191
+ repeat: 'no-repeat',
192
+ attachment: 'scroll',
186
193
  image: {
187
194
  src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
188
195
  width: 1200,
@@ -190,6 +197,13 @@ const ProductViewMoreSettings = [
190
197
  }
191
198
  },
192
199
  hover: {
200
+ size: 'cover',
201
+ position: {
202
+ x: 50,
203
+ y: 50
204
+ },
205
+ repeat: 'no-repeat',
206
+ attachment: 'scroll',
193
207
  image: {
194
208
  src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
195
209
  width: 1200,
@@ -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',
@@ -1,15 +1,22 @@
1
1
  'use client';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { useArticleStore, useCurrentDevice, getResponsiveValueByScreen, composeTypographyClassName, composeTypographyStyle, isSafari, cls, getGlobalColorStateStyle, makeStyleResponsive, getStyleShadow, makeStyle } from '@gem-sdk/core';
3
+ import { useArticleStore, useCurrentDevice, useShopStore, getResponsiveValueByScreen, composeTypographyClassName, composeTypographyStyle, isSafari, cls, getGlobalColorStateStyle, makeStyleResponsive, getStyleShadow, makeStyle } from '@gem-sdk/core';
4
4
  import { useState, useRef, useEffect } from 'react';
5
+ import NoDataState from '../../common/components/NoDataState.js';
5
6
 
6
7
  const ArticleContent = ({ styles, builderProps })=>{
7
8
  const article = useArticleStore((s)=>s.article);
8
9
  const [open, setOpen] = useState(false);
9
10
  const ref = useRef(null);
10
11
  const currentDevice = useCurrentDevice();
12
+ const storefrontUrl = useShopStore((s)=>s.storefrontUrl);
11
13
  const hasLineClamp = getResponsiveValueByScreen(styles?.hasLineClamp, currentDevice);
12
14
  const lineClamp = getResponsiveValueByScreen(styles?.lineClamp, currentDevice);
15
+ const addExcerptLink = ()=>{
16
+ if (!storefrontUrl) return undefined;
17
+ const url = new URL(storefrontUrl);
18
+ window.open(`${url.protocol}//${url.host}/admin/content/articles`);
19
+ };
13
20
  useEffect(()=>{
14
21
  setOpen(false);
15
22
  }, [
@@ -42,9 +49,19 @@ const ArticleContent = ({ styles, builderProps })=>{
42
49
  className: "gp-article-description",
43
50
  "data-article-id": article?.baseID?.replace('gid://shopify/OnlineStoreArticle/', ''),
44
51
  children: !article?.description ? /*#__PURE__*/ jsx("div", {
45
- children: /*#__PURE__*/ jsx("p", {
46
- className: "gp-p-2 gp-text-sm gp-font-semibold gp-text-gray-500",
47
- children: "This article does not have content."
52
+ children: /*#__PURE__*/ jsx(NoDataState, {
53
+ elementType: "secondary",
54
+ description: "Inform and provide value to the audience with article content.",
55
+ descriptionActions: [
56
+ {
57
+ text: 'Add article content',
58
+ callback: addExcerptLink
59
+ },
60
+ {
61
+ text: 'sync data',
62
+ callback: 'syncArticle'
63
+ }
64
+ ]
48
65
  })
49
66
  }) : /*#__PURE__*/ jsxs(Fragment, {
50
67
  children: [
@@ -2,26 +2,41 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import Link from 'next/link';
4
4
  import Text from '../../text/components/Text.js';
5
- import { useArticleStore } from '@gem-sdk/core';
5
+ import { useArticleStore, useShopStore } from '@gem-sdk/core';
6
6
  import { useMemo } from 'react';
7
7
  import { useArticleLink } from '../hooks/useArticleLink.js';
8
+ import NoDataState from '../../common/components/NoDataState.js';
8
9
 
9
10
  const ArticleExcerpt = ({ setting, styles, builderProps })=>{
10
11
  const article = useArticleStore((s)=>s.article);
12
+ const storefrontUrl = useShopStore((s)=>s.storefrontUrl);
11
13
  const excerpt = useMemo(()=>{
12
14
  return article?.content?.excerptHtml;
13
15
  }, [
14
16
  article
15
17
  ]);
16
18
  const { shopifyArticleLink } = useArticleLink();
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
  return /*#__PURE__*/ jsx("div", {
18
25
  id: `shopify-text-element-${builderProps?.uid}`,
19
26
  "data-article-id": article?.baseID?.replace('gid://shopify/OnlineStoreArticle/', ''),
20
- children: !article || !excerpt ? /*#__PURE__*/ jsx("div", {
21
- children: /*#__PURE__*/ jsx("p", {
22
- className: "gp-p-2 gp-text-sm gp-font-semibold gp-text-gray-500",
23
- children: "This article does not have an excerpt."
24
- })
27
+ children: !article || !excerpt ? /*#__PURE__*/ jsx(NoDataState, {
28
+ elementType: "secondary",
29
+ description: "Provide a brief summary or teaser of the article. ",
30
+ descriptionActions: [
31
+ {
32
+ text: 'Add article excerpt',
33
+ callback: addExcerptLink
34
+ },
35
+ {
36
+ text: 'sync data',
37
+ callback: 'syncArticle'
38
+ }
39
+ ]
25
40
  }) : setting?.linkArticle ? /*#__PURE__*/ jsx(Link, {
26
41
  href: shopifyArticleLink,
27
42
  title: article?.title,
@@ -19,8 +19,8 @@ const ArticleTag = ({ setting, builderProps, styles })=>{
19
19
  }
20
20
  }) : /*#__PURE__*/ jsx("div", {
21
21
  children: /*#__PURE__*/ jsx("p", {
22
- className: "gp-p-2 gp-text-sm gp-font-semibold gp-text-gray-500",
23
- children: "This article does not have any tags"
22
+ 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",
23
+ children: "No article tag"
24
24
  })
25
25
  })
26
26
  });
@@ -217,6 +217,7 @@ const ArticleListSettings = [
217
217
  id: 'verticalGutter',
218
218
  label: 'Column gap',
219
219
  type: 'input:unit-spacing',
220
+ hideUnit: true,
220
221
  units: [
221
222
  'px'
222
223
  ],
@@ -226,62 +227,14 @@ const ArticleListSettings = [
226
227
  }
227
228
  }
228
229
  },
229
- {
230
- id: 'grid',
231
- label: 'Grid',
232
- type: 'group',
233
- controls: [
234
- {
235
- id: 'horizontalGutter',
236
- label: 'Row gap',
237
- type: 'input:unit',
238
- units: [
239
- 'px'
240
- ],
241
- devices: {
242
- desktop: {
243
- default: '16px'
244
- },
245
- mobile: {
246
- default: '16px'
247
- }
248
- }
249
- },
250
- {
251
- id: 'verticalGutter',
252
- label: 'Column gap',
253
- type: 'input:unit-spacing',
254
- units: [
255
- 'px'
256
- ],
257
- devices: {
258
- desktop: {
259
- default: '16px'
260
- },
261
- mobile: {
262
- default: '8px'
263
- }
264
- }
265
- }
266
- ]
267
- },
268
230
  {
269
231
  id: 'wrapperBorder',
270
- type: 'border',
271
- label: 'Border',
272
- default: {
273
- borderType: 'none',
274
- border: 'none',
275
- width: '1px 1px 1px 1px',
276
- position: 'all',
277
- borderWidth: '1px',
278
- color: '#000000',
279
- isCustom: true
280
- }
232
+ type: 'border-v2',
233
+ label: 'Border'
281
234
  },
282
235
  {
283
236
  id: 'borderRadius',
284
- type: 'radius-preset',
237
+ type: 'corner-v2',
285
238
  label: 'Corner',
286
239
  default: {
287
240
  radiusType: 'none'
@@ -295,16 +248,8 @@ const ArticleListSettings = [
295
248
  },
296
249
  {
297
250
  id: 'shadow',
298
- type: 'boxShadow',
299
- label: 'Button Shadow',
300
- default: {
301
- type: 'custom',
302
- distance: '10px',
303
- blur: '12px',
304
- spread: '10px',
305
- color: 'rgba(18, 18, 18, 0.77)',
306
- angle: 40
307
- }
251
+ type: 'shadow-v2',
252
+ label: 'Button Shadow'
308
253
  }
309
254
  ]
310
255
  }
@@ -126,7 +126,7 @@ const uiV2 = [
126
126
  en: 'Border'
127
127
  },
128
128
  setting: {
129
- id: 'border',
129
+ id: 'wrapperBorder',
130
130
  state: 'normal'
131
131
  }
132
132
  },
@@ -135,7 +135,7 @@ const uiV2 = [
135
135
  en: 'Corner'
136
136
  },
137
137
  setting: {
138
- id: 'rounded',
138
+ id: 'borderRadius',
139
139
  state: 'normal'
140
140
  }
141
141
  },
@@ -336,6 +336,13 @@ const ButtonSettings = [
336
336
  desktop: {
337
337
  default: {
338
338
  normal: {
339
+ size: 'cover',
340
+ position: {
341
+ x: 50,
342
+ y: 50
343
+ },
344
+ repeat: 'no-repeat',
345
+ attachment: 'scroll',
339
346
  image: {
340
347
  src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
341
348
  width: 1200,
@@ -343,6 +350,13 @@ const ButtonSettings = [
343
350
  }
344
351
  },
345
352
  hover: {
353
+ size: 'cover',
354
+ position: {
355
+ x: 50,
356
+ y: 50
357
+ },
358
+ repeat: 'no-repeat',
359
+ attachment: 'scroll',
346
360
  image: {
347
361
  src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
348
362
  width: 1200,
@@ -17,6 +17,17 @@ const NoDataState = ({ title, description, elementType, builderAttrs, descriptio
17
17
  });
18
18
  window.dispatchEvent(event);
19
19
  };
20
+ const emitSyncArticle = ()=>{
21
+ const componentUid = refContainer.current?.closest('[data-component-type="component"]')?.getAttribute('data-uid');
22
+ if (!componentUid) return;
23
+ const event = new CustomEvent('editor:sync-article', {
24
+ bubbles: true,
25
+ detail: {
26
+ uid: componentUid
27
+ }
28
+ });
29
+ window.dispatchEvent(event);
30
+ };
20
31
  const emitNoDataSignal = ()=>{
21
32
  if (mode !== 'edit') return;
22
33
  const event = new CustomEvent('editor:product-source-no-data-warning', {
@@ -30,7 +41,8 @@ const NoDataState = ({ title, description, elementType, builderAttrs, descriptio
30
41
  window.dispatchEvent(event);
31
42
  };
32
43
  const presetCallback = {
33
- syncProduct: emitSyncProduct
44
+ syncProduct: emitSyncProduct,
45
+ syncArticle: emitSyncArticle
34
46
  };
35
47
  useEffect(()=>{
36
48
  const observer = new ResizeObserver(()=>{
@@ -28,9 +28,7 @@ const EstimateDate = ({ setting, styles, builderAttrs, style, builderProps, adva
28
28
  cssClass: advancedClass
29
29
  },
30
30
  style: style,
31
- styles: {
32
- align: styles?.align
33
- },
31
+ styles: styles,
34
32
  setting: newSetting,
35
33
  className: wrapperClasses,
36
34
  children: children