@gem-sdk/components 2.0.0-dev.540 → 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.
@@ -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(()=>{
@@ -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
  },
@@ -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(()=>{
@@ -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.541",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",