@gem-sdk/components 2.0.0-dev.630 → 2.0.0-dev.633

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.
@@ -186,6 +186,8 @@ const generateBorderCornerStyles = ({ uid, device, borderBtn, roundedBtn, builde
186
186
  width: 100%;
187
187
  position: absolute;
188
188
  pointer-events: none;
189
+ top: 0;
190
+ left: 0;
189
191
  ${core.composeBorderCss(normalBorder)}
190
192
  ${core.composeCornerCss(normalCorner)}
191
193
  `;
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const getButtonSetting = (setting, label, htmlType)=>{
3
+ const getButtonSetting = ({ setting, htmlType, label, styles })=>{
4
4
  const { iconSvg, iconAlign, couponLayout, translate, shouldClearSpace, iconVisible } = setting ?? {};
5
+ const labelConvert = styles?.enableTextStyle ? label : '';
5
6
  return {
6
- label,
7
+ label: labelConvert,
7
8
  htmlType,
8
9
  iconAlign,
9
10
  iconSvg,
@@ -4,7 +4,8 @@ var core = require('@gem-sdk/core');
4
4
 
5
5
  const getButtonStyles = (styles)=>{
6
6
  return {
7
- ...styles
7
+ ...styles,
8
+ enableTextStyle: styles?.enableTextStyle !== undefined ? styles.enableTextStyle : true
8
9
  };
9
10
  };
10
11
  const getButtonStyle = (style, styles)=>{
@@ -44,13 +45,16 @@ const getInnerBorderCornerCss = (data)=>{
44
45
  const closeMediaQuery = mediaQuery ? '}' : '';
45
46
  return `
46
47
  ${mediaQuery}
47
- .gp-coupon[data-active="true"] .${uid} {
48
+ .gp-coupon[data-active="true"] .${uid}::before {
48
49
  ${core.composeBorderCss(borderBtnV2?.[device]?.active, {
49
50
  important: true
50
51
  })};
51
52
  ${core.composeCornerCss(roundedBtnV2?.[device]?.active, true)};
52
53
  box-shadow: ${getShadowValue(boxShadowBtnV2?.[device]?.active)} !important;
53
54
  }
55
+ .gp-coupon[data-active="true"] .${uid} {
56
+ ${core.composeCornerCss(roundedBtnV2?.[device]?.active, true)};
57
+ }
54
58
  ${closeMediaQuery}
55
59
  `;
56
60
  };
@@ -35,7 +35,12 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles: styles$1,
35
35
  if (mode !== 'edit') changeStateILP();
36
36
  },
37
37
  setting: {
38
- ...index.getButtonSetting(setting, defaultLabelState, 'button')
38
+ ...index.getButtonSetting({
39
+ setting,
40
+ label: defaultLabelState,
41
+ htmlType: 'button',
42
+ styles: styles$1
43
+ })
39
44
  },
40
45
  style: {
41
46
  ...styles.getButtonStyle(style, styles$1)
@@ -11,13 +11,14 @@ var styles = require('../common/styles.js');
11
11
  var classes = require('../common/classes.js');
12
12
 
13
13
  const Coupon = ({ setting, builderProps, builderAttrs, style, styles: styles$1, advanced, pageContext })=>{
14
- const { backgroundColorV2, textColorHover } = styles$1 ?? {};
14
+ const { backgroundColorV2, textColorHover, enableTextStyle } = styles$1 ?? {};
15
15
  const { defaultLabel, clickedLabel, copyContent } = setting ?? {};
16
16
  const composeContextState = system.createStateOrContext({
17
17
  defaultLabel,
18
18
  clickedLabel,
19
19
  copyContent,
20
- uid: builderProps?.uid
20
+ uid: builderProps?.uid,
21
+ enableTextStyle
21
22
  });
22
23
  const composeCouponComponentClasses = system.createClass(classes.getActiveClasses(backgroundColorV2, textColorHover));
23
24
  const computedInnerBorderCornerCss = styles.getInnerBorderCornerCss({
@@ -37,7 +38,12 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles: styles$1,
37
38
  },
38
39
  builderAttrs: builderAttrs,
39
40
  setting: {
40
- ...index.getButtonSetting(setting, defaultLabel, 'button')
41
+ ...index.getButtonSetting({
42
+ setting,
43
+ label: defaultLabel,
44
+ htmlType: 'button',
45
+ styles: styles$1
46
+ })
41
47
  },
42
48
  style: {
43
49
  ...styles.getButtonStyle(style, styles$1)
@@ -10,6 +10,11 @@ const useCoupon = (setting)=>{
10
10
  const { defaultLabel, copyContent, clickedLabel } = setting ?? {};
11
11
  const [dataActive, setDataActive] = React.useState(false);
12
12
  const [defaultLabelState, setDefaultLabelState] = React.useState(defaultLabel);
13
+ React.useEffect(()=>{
14
+ setDefaultLabelState(defaultLabel);
15
+ }, [
16
+ defaultLabel
17
+ ]);
13
18
  const changeStateILP = ()=>{
14
19
  setDefaultLabelState(clickedLabel);
15
20
  setDataActive(true);
@@ -190,7 +190,7 @@ const CouponSettings = [
190
190
  default: {
191
191
  normal: 'brand',
192
192
  hover: 'highlight',
193
- active: '#00A042'
193
+ active: '#2C934E'
194
194
  }
195
195
  }
196
196
  },
@@ -199,7 +199,7 @@ const CouponSettings = [
199
199
  default: {
200
200
  normal: 'brand',
201
201
  hover: 'highlight',
202
- active: '#00A042'
202
+ active: '#2C934E'
203
203
  }
204
204
  }
205
205
  }
@@ -219,23 +219,7 @@ const CouponSettings = [
219
219
  },
220
220
  {
221
221
  id: 'textColorHover',
222
- type: 'color-picker-v2',
223
- devices: {
224
- desktop: {
225
- default: {
226
- hover: 'text-3',
227
- active: 'text-3'
228
- }
229
- }
230
- },
231
- compoDefaultValue: {
232
- desktop: {
233
- default: {
234
- hover: 'text-3',
235
- active: 'text-3'
236
- }
237
- }
238
- }
222
+ type: 'color-picker-v2'
239
223
  },
240
224
  {
241
225
  id: 'align',
@@ -372,7 +356,8 @@ const CouponSettings = [
372
356
  desktop: {
373
357
  default: '8px'
374
358
  }
375
- }
359
+ },
360
+ ignoreMax: true
376
361
  },
377
362
  {
378
363
  id: 'globalSize',
@@ -293,6 +293,7 @@ const SettingUIV2 = [
293
293
  iconName: 'polaris-text-block',
294
294
  getValueFromSettingID: 'defaultLabel',
295
295
  isHideClear: true,
296
+ conditionDisplay: 'enableTextStyle == true',
296
297
  compoDefaultValue: 'Copy',
297
298
  popoverLabel: {
298
299
  en: 'Content'
@@ -35,7 +35,8 @@ const EstimateDate = ({ setting = {}, styles, builderAttrs, style, builderProps,
35
35
  type: 'Liquid',
36
36
  styles,
37
37
  setting,
38
- builderProps
38
+ builderProps,
39
+ pageContext
39
40
  });
40
41
  return core.template`
41
42
  <gp-estimate-date>
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var RyviuConfig = {
6
6
  id: 'ryviu',
7
7
  label: 'Ryviu',
8
- logoUrl: 'https://ucarecdn.com/6afde2d0-a39e-48a1-be03-c9fa271cd8f6/-/format/auto/-/preview/3000x3000/-/quality/lighter/Ryviu.png?width=22&height=22',
8
+ logoUrl: 'https://cdn.shopify.com/app-store/listing_images/e80ca8383d6dc37c48bc5bf8092658c4/icon/CJed0K2x44sDEAE=.png',
9
9
  tag: 'Ryviu'
10
10
  };
11
11
 
@@ -184,6 +184,8 @@ const generateBorderCornerStyles = ({ uid, device, borderBtn, roundedBtn, builde
184
184
  width: 100%;
185
185
  position: absolute;
186
186
  pointer-events: none;
187
+ top: 0;
188
+ left: 0;
187
189
  ${composeBorderCss(normalBorder)}
188
190
  ${composeCornerCss(normalCorner)}
189
191
  `;
@@ -1,7 +1,8 @@
1
- const getButtonSetting = (setting, label, htmlType)=>{
1
+ const getButtonSetting = ({ setting, htmlType, label, styles })=>{
2
2
  const { iconSvg, iconAlign, couponLayout, translate, shouldClearSpace, iconVisible } = setting ?? {};
3
+ const labelConvert = styles?.enableTextStyle ? label : '';
3
4
  return {
4
- label,
5
+ label: labelConvert,
5
6
  htmlType,
6
7
  iconAlign,
7
8
  iconSvg,
@@ -2,7 +2,8 @@ import { makeStyleResponsive, composeBorderCss, composeCornerCss, getStyleShadow
2
2
 
3
3
  const getButtonStyles = (styles)=>{
4
4
  return {
5
- ...styles
5
+ ...styles,
6
+ enableTextStyle: styles?.enableTextStyle !== undefined ? styles.enableTextStyle : true
6
7
  };
7
8
  };
8
9
  const getButtonStyle = (style, styles)=>{
@@ -42,13 +43,16 @@ const getInnerBorderCornerCss = (data)=>{
42
43
  const closeMediaQuery = mediaQuery ? '}' : '';
43
44
  return `
44
45
  ${mediaQuery}
45
- .gp-coupon[data-active="true"] .${uid} {
46
+ .gp-coupon[data-active="true"] .${uid}::before {
46
47
  ${composeBorderCss(borderBtnV2?.[device]?.active, {
47
48
  important: true
48
49
  })};
49
50
  ${composeCornerCss(roundedBtnV2?.[device]?.active, true)};
50
51
  box-shadow: ${getShadowValue(boxShadowBtnV2?.[device]?.active)} !important;
51
52
  }
53
+ .gp-coupon[data-active="true"] .${uid} {
54
+ ${composeCornerCss(roundedBtnV2?.[device]?.active, true)};
55
+ }
52
56
  ${closeMediaQuery}
53
57
  `;
54
58
  };
@@ -31,7 +31,12 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
31
31
  if (mode !== 'edit') changeStateILP();
32
32
  },
33
33
  setting: {
34
- ...getButtonSetting(setting, defaultLabelState, 'button')
34
+ ...getButtonSetting({
35
+ setting,
36
+ label: defaultLabelState,
37
+ htmlType: 'button',
38
+ styles
39
+ })
35
40
  },
36
41
  style: {
37
42
  ...getButtonStyle(style, styles)
@@ -7,13 +7,14 @@ import { getInnerBorderCornerCss, getButtonStyle, getButtonStyles } from '../com
7
7
  import { getActiveClasses } from '../common/classes.js';
8
8
 
9
9
  const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced, pageContext })=>{
10
- const { backgroundColorV2, textColorHover } = styles ?? {};
10
+ const { backgroundColorV2, textColorHover, enableTextStyle } = styles ?? {};
11
11
  const { defaultLabel, clickedLabel, copyContent } = setting ?? {};
12
12
  const composeContextState = createStateOrContext({
13
13
  defaultLabel,
14
14
  clickedLabel,
15
15
  copyContent,
16
- uid: builderProps?.uid
16
+ uid: builderProps?.uid,
17
+ enableTextStyle
17
18
  });
18
19
  const composeCouponComponentClasses = createClass(getActiveClasses(backgroundColorV2, textColorHover));
19
20
  const computedInnerBorderCornerCss = getInnerBorderCornerCss({
@@ -33,7 +34,12 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
33
34
  },
34
35
  builderAttrs: builderAttrs,
35
36
  setting: {
36
- ...getButtonSetting(setting, defaultLabel, 'button')
37
+ ...getButtonSetting({
38
+ setting,
39
+ label: defaultLabel,
40
+ htmlType: 'button',
41
+ styles
42
+ })
37
43
  },
38
44
  style: {
39
45
  ...getButtonStyle(style, styles)
@@ -1,11 +1,16 @@
1
1
  import { useEditorMode } from '@gem-sdk/core';
2
- import { useState } from 'react';
2
+ import { useState, useEffect } from 'react';
3
3
 
4
4
  const useCoupon = (setting)=>{
5
5
  const mode = useEditorMode();
6
6
  const { defaultLabel, copyContent, clickedLabel } = setting ?? {};
7
7
  const [dataActive, setDataActive] = useState(false);
8
8
  const [defaultLabelState, setDefaultLabelState] = useState(defaultLabel);
9
+ useEffect(()=>{
10
+ setDefaultLabelState(defaultLabel);
11
+ }, [
12
+ defaultLabel
13
+ ]);
9
14
  const changeStateILP = ()=>{
10
15
  setDefaultLabelState(clickedLabel);
11
16
  setDataActive(true);
@@ -188,7 +188,7 @@ const CouponSettings = [
188
188
  default: {
189
189
  normal: 'brand',
190
190
  hover: 'highlight',
191
- active: '#00A042'
191
+ active: '#2C934E'
192
192
  }
193
193
  }
194
194
  },
@@ -197,7 +197,7 @@ const CouponSettings = [
197
197
  default: {
198
198
  normal: 'brand',
199
199
  hover: 'highlight',
200
- active: '#00A042'
200
+ active: '#2C934E'
201
201
  }
202
202
  }
203
203
  }
@@ -217,23 +217,7 @@ const CouponSettings = [
217
217
  },
218
218
  {
219
219
  id: 'textColorHover',
220
- type: 'color-picker-v2',
221
- devices: {
222
- desktop: {
223
- default: {
224
- hover: 'text-3',
225
- active: 'text-3'
226
- }
227
- }
228
- },
229
- compoDefaultValue: {
230
- desktop: {
231
- default: {
232
- hover: 'text-3',
233
- active: 'text-3'
234
- }
235
- }
236
- }
220
+ type: 'color-picker-v2'
237
221
  },
238
222
  {
239
223
  id: 'align',
@@ -370,7 +354,8 @@ const CouponSettings = [
370
354
  desktop: {
371
355
  default: '8px'
372
356
  }
373
- }
357
+ },
358
+ ignoreMax: true
374
359
  },
375
360
  {
376
361
  id: 'globalSize',
@@ -291,6 +291,7 @@ const SettingUIV2 = [
291
291
  iconName: 'polaris-text-block',
292
292
  getValueFromSettingID: 'defaultLabel',
293
293
  isHideClear: true,
294
+ conditionDisplay: 'enableTextStyle == true',
294
295
  compoDefaultValue: 'Copy',
295
296
  popoverLabel: {
296
297
  en: 'Content'
@@ -31,7 +31,8 @@ const EstimateDate = ({ setting = {}, styles, builderAttrs, style, builderProps,
31
31
  type: 'Liquid',
32
32
  styles,
33
33
  setting,
34
- builderProps
34
+ builderProps,
35
+ pageContext
35
36
  });
36
37
  return template`
37
38
  <gp-estimate-date>
@@ -1,7 +1,7 @@
1
1
  var RyviuConfig = {
2
2
  id: 'ryviu',
3
3
  label: 'Ryviu',
4
- logoUrl: 'https://ucarecdn.com/6afde2d0-a39e-48a1-be03-c9fa271cd8f6/-/format/auto/-/preview/3000x3000/-/quality/lighter/Ryviu.png?width=22&height=22',
4
+ logoUrl: 'https://cdn.shopify.com/app-store/listing_images/e80ca8383d6dc37c48bc5bf8092658c4/icon/CJed0K2x44sDEAE=.png',
5
5
  tag: 'Ryviu'
6
6
  };
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.630",
3
+ "version": "2.0.0-dev.633",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",