@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.
@@ -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
  },
@@ -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(()=>{
@@ -70,6 +70,31 @@ const ControlUIV2 = [
70
70
  },
71
71
  setting: {
72
72
  id: 'iconItemColor'
73
+ },
74
+ controlChangeTrigger: {
75
+ settings: [
76
+ {
77
+ action: {
78
+ controlId: 'iconColor',
79
+ valueFromField: 'iconItemColor',
80
+ groupType: 'setting',
81
+ controlType: 'setting',
82
+ state: 'normal'
83
+ }
84
+ }
85
+ ],
86
+ options: {
87
+ noRecordHistory: true
88
+ }
89
+ },
90
+ options: {
91
+ updateFields: [
92
+ {
93
+ field: 'iconItemColor',
94
+ settingId: 'iconColor',
95
+ state: 'normal'
96
+ }
97
+ ]
73
98
  }
74
99
  },
75
100
  {
@@ -94,334 +119,6 @@ const ControlUIV2 = [
94
119
  }
95
120
  ]
96
121
  },
97
- // {
98
- // label: {
99
- // en: 'Size',
100
- // },
101
- // controls: [
102
- // {
103
- // type: 'control',
104
- // setting: {
105
- // id: 'size',
106
- // },
107
- // },
108
- // ],
109
- // },
110
- {
111
- label: {
112
- en: 'Item states'
113
- },
114
- controls: [
115
- {
116
- type: 'tab',
117
- controls: [
118
- {
119
- type: 'group',
120
- label: {
121
- en: 'Default'
122
- },
123
- controls: [
124
- {
125
- type: 'control',
126
- label: {
127
- en: 'Icon'
128
- },
129
- setting: {
130
- id: 'iconColor',
131
- state: 'normal'
132
- }
133
- },
134
- {
135
- type: 'control',
136
- label: {
137
- en: 'Background'
138
- },
139
- setting: {
140
- id: 'backgroundColor',
141
- state: 'normal'
142
- }
143
- },
144
- {
145
- type: 'control',
146
- label: {
147
- en: 'Border'
148
- },
149
- setting: {
150
- id: 'borderBundle',
151
- state: 'normal'
152
- }
153
- },
154
- {
155
- type: 'control',
156
- label: {
157
- en: 'Corner'
158
- },
159
- setting: {
160
- id: 'roundedBundle',
161
- state: 'normal'
162
- }
163
- },
164
- {
165
- label: {
166
- en: 'Shadow'
167
- },
168
- setting: {
169
- id: 'boxShadowBundle',
170
- state: 'normal'
171
- },
172
- options: {
173
- updateFields: [
174
- {
175
- field: 'normal.enable',
176
- settingId: 'hasBoxShadowBundle',
177
- state: 'normal'
178
- }
179
- ]
180
- },
181
- controlChangeTrigger: {
182
- settings: [
183
- {
184
- condition: `boxShadowBundle.normal.enable === true`,
185
- source: [
186
- 'boxShadowBundle',
187
- 'hasBoxShadowBundle'
188
- ],
189
- action: {
190
- controlId: 'hasBoxShadowBundle',
191
- groupType: 'style',
192
- controlType: 'style',
193
- state: 'normal',
194
- newValue: true
195
- }
196
- },
197
- {
198
- condition: `boxShadowBundle.normal.enable === false`,
199
- source: [
200
- 'boxShadowBundle',
201
- 'hasBoxShadowBundle'
202
- ],
203
- action: {
204
- controlId: 'hasBoxShadowBundle',
205
- groupType: 'style',
206
- controlType: 'style',
207
- state: 'normal',
208
- newValue: false
209
- }
210
- }
211
- ],
212
- options: {
213
- noRecordHistory: true
214
- }
215
- }
216
- }
217
- ]
218
- },
219
- {
220
- type: 'group',
221
- label: {
222
- en: 'Hover'
223
- },
224
- controls: [
225
- {
226
- type: 'control',
227
- label: {
228
- en: 'Icon'
229
- },
230
- setting: {
231
- id: 'iconColor',
232
- state: 'hover'
233
- }
234
- },
235
- {
236
- type: 'control',
237
- label: {
238
- en: 'Background'
239
- },
240
- setting: {
241
- id: 'backgroundColor',
242
- state: 'hover'
243
- }
244
- },
245
- {
246
- type: 'control',
247
- label: {
248
- en: 'Border'
249
- },
250
- setting: {
251
- id: 'borderBundle',
252
- state: 'hover'
253
- }
254
- },
255
- {
256
- type: 'control',
257
- label: {
258
- en: 'Corner'
259
- },
260
- setting: {
261
- id: 'roundedBundle',
262
- state: 'hover'
263
- }
264
- },
265
- {
266
- label: {
267
- en: 'Shadow'
268
- },
269
- setting: {
270
- id: 'boxShadowBundle',
271
- state: 'hover'
272
- },
273
- options: {
274
- updateFields: [
275
- {
276
- field: 'hover.enable',
277
- settingId: 'hasBoxShadowBundle',
278
- state: 'hover'
279
- }
280
- ]
281
- },
282
- controlChangeTrigger: {
283
- settings: [
284
- {
285
- condition: `boxShadowBundle.hover.enable === true`,
286
- source: [
287
- 'boxShadowBundle',
288
- 'hasBoxShadowBundle'
289
- ],
290
- action: {
291
- controlId: 'hasBoxShadowBundle',
292
- groupType: 'style',
293
- controlType: 'style',
294
- state: 'hover',
295
- newValue: true
296
- }
297
- },
298
- {
299
- condition: `boxShadowBundle.hover.enable === false`,
300
- source: [
301
- 'boxShadowBundle',
302
- 'hasBoxShadowBundle'
303
- ],
304
- action: {
305
- controlId: 'hasBoxShadowBundle',
306
- groupType: 'style',
307
- controlType: 'style',
308
- state: 'hover',
309
- newValue: false
310
- }
311
- }
312
- ],
313
- options: {
314
- noRecordHistory: true
315
- }
316
- }
317
- }
318
- ]
319
- },
320
- {
321
- type: 'group',
322
- label: {
323
- en: 'Active'
324
- },
325
- controls: [
326
- {
327
- type: 'control',
328
- label: {
329
- en: 'Icon'
330
- },
331
- setting: {
332
- id: 'iconColor',
333
- state: 'active'
334
- }
335
- },
336
- {
337
- type: 'control',
338
- label: {
339
- en: 'Background'
340
- },
341
- setting: {
342
- id: 'backgroundColor',
343
- state: 'active'
344
- }
345
- },
346
- {
347
- type: 'control',
348
- label: {
349
- en: 'Border'
350
- },
351
- setting: {
352
- id: 'borderBundle',
353
- state: 'active'
354
- }
355
- },
356
- {
357
- type: 'control',
358
- label: {
359
- en: 'Corner'
360
- },
361
- setting: {
362
- id: 'roundedBundle',
363
- state: 'active'
364
- }
365
- },
366
- {
367
- label: {
368
- en: 'Shadow'
369
- },
370
- setting: {
371
- id: 'boxShadowBundle',
372
- state: 'active'
373
- },
374
- options: {
375
- updateFields: [
376
- {
377
- field: 'active.enable',
378
- settingId: 'hasBoxShadowBundle',
379
- state: 'active'
380
- }
381
- ]
382
- },
383
- controlChangeTrigger: {
384
- settings: [
385
- {
386
- condition: `boxShadowBundle.active.enable === true`,
387
- source: [
388
- 'boxShadowBundle',
389
- 'hasBoxShadowBundle'
390
- ],
391
- action: {
392
- controlId: 'hasBoxShadowBundle',
393
- groupType: 'style',
394
- controlType: 'style',
395
- state: 'active',
396
- newValue: true
397
- }
398
- },
399
- {
400
- condition: `boxShadowBundle.active.enable === false`,
401
- source: [
402
- 'boxShadowBundle',
403
- 'hasBoxShadowBundle'
404
- ],
405
- action: {
406
- controlId: 'hasBoxShadowBundle',
407
- groupType: 'style',
408
- controlType: 'style',
409
- state: 'active',
410
- newValue: false
411
- }
412
- }
413
- ],
414
- options: {
415
- noRecordHistory: true
416
- }
417
- }
418
- }
419
- ]
420
- }
421
- ]
422
- }
423
- ]
424
- },
425
122
  {
426
123
  label: {
427
124
  en: 'Item style'
@@ -73,7 +73,7 @@ const getContainContentClasses = ()=>{
73
73
  };
74
74
  };
75
75
  const getTextClasses = ()=>{
76
- const classList = 'gp-cursor-pointer gp-overflow-hidden gp-whitespace-nowrap';
76
+ const classList = 'gp-cursor-pointer gp-overflow-hidden gp-whitespace-nowrap !gp-text-inherit';
77
77
  return {
78
78
  ...composeClasses(classList)
79
79
  };
@@ -65,6 +65,9 @@ const config = {
65
65
  {
66
66
  tag: 'TabItem'
67
67
  },
68
+ {
69
+ tag: 'TabItem'
70
+ },
68
71
  {
69
72
  tag: 'TabItem'
70
73
  }
@@ -10,8 +10,7 @@ const TabsSettings = [
10
10
  'Tab 1',
11
11
  'Tab 2',
12
12
  'Tab 3'
13
- ],
14
- expandItem: true
13
+ ]
15
14
  },
16
15
  {
17
16
  id: 'activeKey',
@@ -75,8 +74,6 @@ const TabsSettings = [
75
74
  color: 'text-1'
76
75
  }
77
76
  },
78
- hiddenSetting: {
79
- },
80
77
  ignoreReRender: true
81
78
  },
82
79
  {
@@ -152,7 +149,10 @@ const TabsSettings = [
152
149
  },
153
150
  {
154
151
  id: 'padding',
155
- type: 'padding-v2'
152
+ type: 'padding-v2',
153
+ devices: {
154
+ desktop: {}
155
+ }
156
156
  },
157
157
  {
158
158
  id: 'labelAlign',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.540",
3
+ "version": "2.0.0-dev.542",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",