@gem-sdk/components 2.0.0-dev.332 → 2.0.0-dev.334

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 (38) hide show
  1. package/dist/cjs/post-purchase/product/settings/product-image/ProductFeatureImage.js +33 -0
  2. package/dist/cjs/post-purchase/product/settings/product-image/ProductGalleryImage.js +85 -0
  3. package/dist/cjs/post-purchase/product/settings/product-image/ProductImageLayoutSetting.js +69 -0
  4. package/dist/cjs/post-purchase/product/settings/product-image/ProductImages.js +3 -1
  5. package/dist/cjs/post-purchase/product/settings/product-image/uiV1.js +42 -0
  6. package/dist/cjs/product/components/ProductBadge/common/getAttrs.js +74 -0
  7. package/dist/cjs/product/components/ProductBadge/common/getClasses.js +79 -0
  8. package/dist/cjs/product/components/ProductBadge/common/getStyles.js +144 -0
  9. package/dist/cjs/product/components/ProductBadge/constants.js +1 -9
  10. package/dist/cjs/product/components/ProductBadge/index.js +125 -117
  11. package/dist/cjs/product/components/ProductBadge/index.liquid.js +97 -111
  12. package/dist/cjs/product/components/ProductBadge/utils/common.js +11 -0
  13. package/dist/cjs/product/components/ProductBadge/utils/getRotateShape.js +10 -5
  14. package/dist/cjs/product/components/ProductBadge/utils/shape.js +14 -1
  15. package/dist/cjs/product/index.js +1 -1
  16. package/dist/cjs/product/setting/product-badge/configs/settings.js +72 -93
  17. package/dist/cjs/product/setting/product-badge/configs/uiV2.js +93 -15
  18. package/dist/esm/post-purchase/product/settings/product-image/ProductFeatureImage.js +31 -0
  19. package/dist/esm/post-purchase/product/settings/product-image/ProductGalleryImage.js +83 -0
  20. package/dist/esm/post-purchase/product/settings/product-image/ProductImageLayoutSetting.js +67 -0
  21. package/dist/esm/post-purchase/product/settings/product-image/ProductImages.js +3 -1
  22. package/dist/esm/post-purchase/product/settings/product-image/uiV1.js +40 -0
  23. package/dist/esm/product/components/ProductBadge/common/getAttrs.js +67 -0
  24. package/dist/esm/product/components/ProductBadge/common/getClasses.js +70 -0
  25. package/dist/esm/product/components/ProductBadge/common/getStyles.js +137 -0
  26. package/dist/esm/product/components/ProductBadge/constants.js +2 -5
  27. package/dist/esm/product/components/ProductBadge/index.js +128 -120
  28. package/dist/esm/product/components/ProductBadge/index.liquid.js +99 -113
  29. package/dist/esm/product/components/ProductBadge/utils/common.js +12 -2
  30. package/dist/esm/product/components/ProductBadge/utils/getRotateShape.js +10 -5
  31. package/dist/esm/product/components/ProductBadge/utils/shape.js +14 -1
  32. package/dist/esm/product/index.js +1 -1
  33. package/dist/esm/product/setting/product-badge/configs/settings.js +72 -93
  34. package/dist/esm/product/setting/product-badge/configs/uiV2.js +93 -15
  35. package/dist/types/index.d.ts +1 -3
  36. package/package.json +2 -2
  37. package/dist/cjs/product/components/ProductBadge/hooks/useProductBadgeStyles.js +0 -83
  38. package/dist/esm/product/components/ProductBadge/hooks/useProductBadgeStyles.js +0 -81
@@ -1,14 +1,45 @@
1
1
  const SettingUIV2 = [
2
2
  {
3
3
  label: {
4
- en: 'Layout'
4
+ en: 'Style'
5
5
  },
6
6
  controls: [
7
7
  {
8
8
  setting: {
9
- id: 'contentType'
9
+ id: 'shape'
10
10
  },
11
- layout: 'vertical'
11
+ layout: 'vertical',
12
+ controlChangeTrigger: {
13
+ settings: [
14
+ {
15
+ condition: "shape.includes('image')",
16
+ source: [
17
+ 'shape'
18
+ ],
19
+ action: {
20
+ controlId: 'contentType',
21
+ newValue: 'image',
22
+ groupType: 'setting',
23
+ controlType: 'setting'
24
+ }
25
+ },
26
+ {
27
+ condition: "!shape.includes('image')",
28
+ source: [
29
+ 'shape'
30
+ ],
31
+ action: {
32
+ controlId: 'contentType',
33
+ newValue: 'text',
34
+ groupType: 'setting',
35
+ controlType: 'setting'
36
+ }
37
+ }
38
+ ],
39
+ options: {
40
+ noRecordHistory: true
41
+ }
42
+ }
12
43
  }
13
44
  ]
14
45
  },
@@ -37,12 +68,33 @@ const SettingUIV2 = [
37
68
  conditionDisplay: 'contentType === "text"',
38
69
  controls: [
39
70
  {
40
- id: 'displayContent',
71
+ id: 'content-badge',
72
+ type: 'combo',
73
+ iconName: 'polaris-plus',
74
+ isHideClear: true,
75
+ fixedValue: 'Edit',
76
+ popoverLabel: {
77
+ en: 'Content'
78
+ },
79
+ label: {
80
+ en: 'Content'
81
+ },
41
82
  setting: {
42
83
  id: 'displayContent'
43
84
  },
44
85
  layout: 'vertical',
45
- conditionDisplay: 'contentType == "text"'
86
+ conditionDisplay: 'contentType == "text"',
87
+ controls: [
88
+ {
89
+ label: {
90
+ en: 'Content'
91
+ },
92
+ layout: 'vertical',
93
+ setting: {
94
+ id: 'displayContent'
95
+ }
96
+ }
97
+ ]
46
98
  },
47
99
  {
48
100
  id: 'typo',
@@ -87,15 +139,6 @@ const SettingUIV2 = [
87
139
  },
88
140
  conditionDisplay: 'contentType == "text"',
89
141
  controls: [
90
- {
91
- label: {
92
- en: 'Shape'
93
- },
94
- setting: {
95
- id: 'shape'
96
- },
97
- conditionDisplay: 'contentType == "text"'
98
- },
99
142
  {
100
143
  label: {
101
144
  en: 'Color'
@@ -185,7 +228,7 @@ const SettingUIV2 = [
185
228
  {
186
229
  type: 'control',
187
230
  setting: {
188
- id: 'imageSize'
231
+ id: 'imageSizeV2'
189
232
  },
190
233
  layout: 'vertical'
191
234
  },
@@ -234,6 +277,11 @@ const SettingUIV2 = [
234
277
  label: 'Fit content',
235
278
  value: 'Auto',
236
279
  showValue: true
280
+ },
281
+ {
282
+ label: 'Default',
283
+ value: 'default',
284
+ showValue: true
237
285
  }
238
286
  ]
239
287
  },
@@ -283,6 +331,36 @@ const SettingUIV2 = [
283
331
  }
284
332
  ]
285
333
  },
334
+ {
335
+ label: {
336
+ en: 'Position'
337
+ },
338
+ controls: [
339
+ {
340
+ id: 'badge-position',
341
+ type: 'combo',
342
+ iconName: 'polaris-plus',
343
+ isHideClear: true,
344
+ fixedValue: 'Edit',
345
+ popoverLabel: {
346
+ en: 'Position'
347
+ },
348
+ label: {
349
+ en: 'Position'
350
+ },
351
+ layout: 'vertical',
352
+ controls: [
353
+ {
354
+ layout: 'vertical',
355
+ setting: {
356
+ id: 'position'
357
+ }
358
+ }
359
+ ]
360
+ }
361
+ ],
362
+ conditionDisplay: 'positionWithImage === "inside"'
363
+ },
286
364
  {
287
365
  controls: [
288
366
  {
@@ -3621,9 +3621,7 @@ type ProductBadgeProps = BasePropsWrap<{
3621
3621
  wrapperBorder?: Border;
3622
3622
  borderRadius?: CornerRadius;
3623
3623
  hasShadow?: boolean;
3624
- textSize?: ObjectDevices<SizeSettingGlobal>;
3625
3624
  textSizeV2?: ObjectDevices<SizeSettingGlobal>;
3626
- imageSize?: ObjectDevices<SizeSettingGlobal>;
3627
3625
  imageSizeV2?: ObjectDevices<SizeSettingGlobal>;
3628
3626
  align?: ObjectDevices<AlignProp>;
3629
3627
  shapeShadow: ShadowProps;
@@ -6117,7 +6115,7 @@ declare const FileUpload: ({ setting, styles, builderProps, pageContext }: FileU
6117
6115
 
6118
6116
  declare const Product: (props: ProductProps) => string;
6119
6117
 
6120
- declare const ProductBadge: ({ styles, builderProps, isInsideProductImage, builderAttrs, setting, style, imageData, dotData, }: ProductBadgeProps & {
6118
+ declare const ProductBadge: (props: ProductBadgeProps & {
6121
6119
  pageContext?: PageContext;
6122
6120
  }) => string;
6123
6121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.332",
3
+ "version": "2.0.0-dev.334",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -22,7 +22,7 @@
22
22
  "relationship": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/get-control-relationship.js && node ./scripts/get-element-relationship.js"
23
23
  },
24
24
  "devDependencies": {
25
- "@gem-sdk/core": "2.0.0-dev.324",
25
+ "@gem-sdk/core": "2.0.0-dev.334",
26
26
  "@gem-sdk/styles": "2.0.0-dev.324",
27
27
  "@gem-sdk/system": "2.0.0-dev.324",
28
28
  "@types/react-transition-group": "^4.4.5"
@@ -1,83 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@gem-sdk/core');
4
- var shape = require('../utils/shape.js');
5
- var common = require('../utils/common.js');
6
- var getShapePosition = require('../utils/getShapePosition.js');
7
- var getRotateShape = require('../utils/getRotateShape.js');
8
- var getStyleAdvanced = require('../utils/getStyleAdvanced.js');
9
- var stylesV2 = require('../utils/stylesV2.js');
10
- var getWhiteSpace = require('../utils/getWhiteSpace.js');
11
-
12
- const useProductBadgeStyles = ({ setting, styles, style, isInsideProductImage, navigationPosition, imageData, dotData, currentDevice })=>{
13
- const isTextBadge = setting?.contentType === 'text';
14
- // currently use imageSize v1, update later
15
- const badgeSize = isTextBadge ? styles?.textSizeV2 : styles?.imageSize;
16
- const shape$1 = shape.getShape(setting?.shape);
17
- const isDropOutsideProductImage = setting?.positionWithImage === 'outside';
18
- const placementClass = common.getShapePlacementClass(isInsideProductImage, style, currentDevice);
19
- const shapePosition = getShapePosition.getShapePosition({
20
- positionType: styles?.position,
21
- isLiquid: false,
22
- navigationPosition,
23
- dataImage: {
24
- ...imageData,
25
- ...dotData
26
- }
27
- });
28
- const wrapperStyles = common.getWrapperStyle(false);
29
- const sizeStyles = isTextBadge ? common.getSize(shape$1, badgeSize) : common.getSize(undefined, badgeSize);
30
- const paddingShape = common.getShapeWrapperPadding(shape$1?.ratio);
31
- const shadowStyles = stylesV2.getStyleShadowV2('.product-badge-item', isTextBadge ? styles?.textBadgeShadow : styles?.imageBadgeShadow);
32
- const borderStyles = shape$1?.supportBorder ? isTextBadge ? stylesV2.getStyleBorder(styles?.textBadgeBorder) : stylesV2.getStyleBorder(styles?.imageBadgeBorder) : {};
33
- const cornerStyles = isTextBadge ? stylesV2.getStyleCornerRadius(styles?.textBadgeCorner, shape$1?.shapeRadius) : stylesV2.getStyleCornerRadius(styles?.imageBadgeCorner, shape$1?.shapeRadius);
34
- const textBadgePadding = core.makeGlobalSize(styles?.textSizeV2).padding;
35
- const imageBadgePadding = core.makeGlobalSize(styles?.imageSizeV2).padding;
36
- const textBadgeStyles = {
37
- ...getWhiteSpace.getWhiteSpaceStyle(styles?.textSizeV2),
38
- ...getRotateShape.composeTextStyleByPosition(shape$1, styles?.position, isDropOutsideProductImage),
39
- ...core.composeTypographyStyle(styles?.typo),
40
- ...core.getStyleShadow({
41
- value: styles?.typo?.custom?.textShadow,
42
- styleAppliedFor: 'text-shadow',
43
- isEnableShadow: styles?.typo?.custom?.textShadow?.type !== 'none'
44
- }),
45
- ...stylesV2.getStyleBackground(!!shape$1?.backgroundColorInText, styles?.badgeColorV2),
46
- ...textBadgePadding
47
- };
48
- const textBadgeContainerStyles = {
49
- ...borderStyles,
50
- ...cornerStyles,
51
- ...getRotateShape.composeShapeStyleByPosition(shape$1, styles?.position, isDropOutsideProductImage),
52
- ...stylesV2.getStyleBackground(!shape$1?.backgroundColorInText, styles?.badgeColorV2),
53
- ...paddingShape
54
- };
55
- const imageBadgeContainerStyles = {
56
- ...borderStyles,
57
- ...cornerStyles,
58
- ...imageBadgePadding
59
- };
60
- const advancedStyles = getStyleAdvanced.getStyleAdvanced(!isDropOutsideProductImage ? {
61
- ...shapePosition,
62
- ...sizeStyles
63
- } : {}, style);
64
- return {
65
- isTextBadge,
66
- isDropOutsideProductImage,
67
- placementClass,
68
- sizeStyles,
69
- paddingShape,
70
- shadowStyles,
71
- borderStyles,
72
- cornerStyles,
73
- wrapperStyles,
74
- advancedStyles,
75
- textBadgeStyles,
76
- textBadgeContainerStyles,
77
- imageBadgeContainerStyles,
78
- shape: shape$1,
79
- badgeSize
80
- };
81
- };
82
-
83
- exports.useProductBadgeStyles = useProductBadgeStyles;
@@ -1,81 +0,0 @@
1
- import { makeGlobalSize, composeTypographyStyle, getStyleShadow } from '@gem-sdk/core';
2
- import { getShape } from '../utils/shape.js';
3
- import { getSize, getShapePlacementClass, getWrapperStyle, getShapeWrapperPadding } from '../utils/common.js';
4
- import { getShapePosition } from '../utils/getShapePosition.js';
5
- import { composeTextStyleByPosition, composeShapeStyleByPosition } from '../utils/getRotateShape.js';
6
- import { getStyleAdvanced } from '../utils/getStyleAdvanced.js';
7
- import { getStyleShadowV2, getStyleBorder, getStyleCornerRadius, getStyleBackground } from '../utils/stylesV2.js';
8
- import { getWhiteSpaceStyle } from '../utils/getWhiteSpace.js';
9
-
10
- const useProductBadgeStyles = ({ setting, styles, style, isInsideProductImage, navigationPosition, imageData, dotData, currentDevice })=>{
11
- const isTextBadge = setting?.contentType === 'text';
12
- // currently use imageSize v1, update later
13
- const badgeSize = isTextBadge ? styles?.textSizeV2 : styles?.imageSize;
14
- const shape = getShape(setting?.shape);
15
- const isDropOutsideProductImage = setting?.positionWithImage === 'outside';
16
- const placementClass = getShapePlacementClass(isInsideProductImage, style, currentDevice);
17
- const shapePosition = getShapePosition({
18
- positionType: styles?.position,
19
- isLiquid: false,
20
- navigationPosition,
21
- dataImage: {
22
- ...imageData,
23
- ...dotData
24
- }
25
- });
26
- const wrapperStyles = getWrapperStyle(false);
27
- const sizeStyles = isTextBadge ? getSize(shape, badgeSize) : getSize(undefined, badgeSize);
28
- const paddingShape = getShapeWrapperPadding(shape?.ratio);
29
- const shadowStyles = getStyleShadowV2('.product-badge-item', isTextBadge ? styles?.textBadgeShadow : styles?.imageBadgeShadow);
30
- const borderStyles = shape?.supportBorder ? isTextBadge ? getStyleBorder(styles?.textBadgeBorder) : getStyleBorder(styles?.imageBadgeBorder) : {};
31
- const cornerStyles = isTextBadge ? getStyleCornerRadius(styles?.textBadgeCorner, shape?.shapeRadius) : getStyleCornerRadius(styles?.imageBadgeCorner, shape?.shapeRadius);
32
- const textBadgePadding = makeGlobalSize(styles?.textSizeV2).padding;
33
- const imageBadgePadding = makeGlobalSize(styles?.imageSizeV2).padding;
34
- const textBadgeStyles = {
35
- ...getWhiteSpaceStyle(styles?.textSizeV2),
36
- ...composeTextStyleByPosition(shape, styles?.position, isDropOutsideProductImage),
37
- ...composeTypographyStyle(styles?.typo),
38
- ...getStyleShadow({
39
- value: styles?.typo?.custom?.textShadow,
40
- styleAppliedFor: 'text-shadow',
41
- isEnableShadow: styles?.typo?.custom?.textShadow?.type !== 'none'
42
- }),
43
- ...getStyleBackground(!!shape?.backgroundColorInText, styles?.badgeColorV2),
44
- ...textBadgePadding
45
- };
46
- const textBadgeContainerStyles = {
47
- ...borderStyles,
48
- ...cornerStyles,
49
- ...composeShapeStyleByPosition(shape, styles?.position, isDropOutsideProductImage),
50
- ...getStyleBackground(!shape?.backgroundColorInText, styles?.badgeColorV2),
51
- ...paddingShape
52
- };
53
- const imageBadgeContainerStyles = {
54
- ...borderStyles,
55
- ...cornerStyles,
56
- ...imageBadgePadding
57
- };
58
- const advancedStyles = getStyleAdvanced(!isDropOutsideProductImage ? {
59
- ...shapePosition,
60
- ...sizeStyles
61
- } : {}, style);
62
- return {
63
- isTextBadge,
64
- isDropOutsideProductImage,
65
- placementClass,
66
- sizeStyles,
67
- paddingShape,
68
- shadowStyles,
69
- borderStyles,
70
- cornerStyles,
71
- wrapperStyles,
72
- advancedStyles,
73
- textBadgeStyles,
74
- textBadgeContainerStyles,
75
- imageBadgeContainerStyles,
76
- shape,
77
- badgeSize
78
- };
79
- };
80
-
81
- export { useProductBadgeStyles };