@gem-sdk/components 2.0.0-dev.416 → 2.0.0-dev.418

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,18 +6,16 @@ const getContainerAttrs = ({ uid, isDisabled = true, isDisableByLiquid })=>{
6
6
  'data-disabled': isDisableByLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled
7
7
  };
8
8
  };
9
- const getButtonAttrs = ({ isDisabled = true, isLiquid, buttonSide })=>{
9
+ const getButtonAttrs = ({ buttonSide })=>{
10
10
  return {
11
- disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
12
11
  title: buttonSide === 'left' ? 'Decrement' : 'Increment',
13
12
  'aria-label': buttonSide === 'left' ? 'decrement' : 'increment'
14
13
  };
15
14
  };
16
- const getInputAttr = ({ isDisabled = true, isLiquid, qtyStyle, quantity, currentVariant, defaultQty })=>{
15
+ const getInputAttr = ({ isLiquid, qtyStyle, quantity, currentVariant, defaultQty })=>{
17
16
  const attrs = {};
18
17
  if (currentVariant?.manageInventory) attrs['max'] = isLiquid ? '{{ current_variant.quantity_rule.max }}' : currentVariant?.inventoryQuantity ?? 1;
19
18
  return {
20
- disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
21
19
  type: qtyStyle === 'standard' ? 'text' : 'number',
22
20
  name: 'quantity',
23
21
  step: 1,
@@ -17,7 +17,7 @@ const getInputClasses = ({ styles, borderBtn, inputBackgroundColor, textColor })
17
17
  };
18
18
  };
19
19
  const getButtonClass = ({ borderBtn, buttonBackgroundColor, iconColor, buttonSide })=>{
20
- let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0' : '!gp-border-l-0'} `;
20
+ let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0 gp-minus' : '!gp-border-l-0 gp-plus'} `;
21
21
  const buttonColor = core.handleConvertClassColor(borderBtn);
22
22
  const buttonBgColor = core.getGlobalColorStateClass('bg', buttonBackgroundColor);
23
23
  const iconColorStateClass = core.getGlobalColorStateClass('text', iconColor);
@@ -118,9 +118,16 @@ const getContainerStyles = ({ inputHeight, align })=>{
118
118
  };
119
119
  };
120
120
  const getWrapperStyles = ({ backgroundColor, styles })=>{
121
+ const shapeShadow = styles?.shapeShadow;
122
+ const styleShadow = core.getResponsiveStyleShadow(shapeShadow, 'box-shadow', {
123
+ desktop: shapeShadow?.desktop ?? {},
124
+ tablet: shapeShadow?.tablet ?? shapeShadow?.desktop ?? {},
125
+ mobile: shapeShadow?.mobile ?? shapeShadow?.tablet ?? shapeShadow?.desktop ?? {}
126
+ });
121
127
  return {
122
128
  ...core.getGlobalColorStateStyle('bg', backgroundColor),
123
- ...core.makeStyleResponsive('maxw', styles?.quantityWidth)
129
+ ...core.makeStyleResponsive('maxw', styles?.quantityWidth),
130
+ ...styleShadow
124
131
  };
125
132
  };
126
133
 
@@ -46,7 +46,6 @@ const ProductQuantity = (props)=>{
46
46
  });
47
47
  const inputAttrs = system.createAttr({
48
48
  ...getAttrs.getInputAttr({
49
- isDisabled: !isInStock,
50
49
  qtyStyle,
51
50
  quantity,
52
51
  currentVariant,
@@ -85,7 +84,6 @@ const ProductQuantity = (props)=>{
85
84
  });
86
85
  const buttonLeftAttrs = system.createAttr({
87
86
  ...getAttrs.getButtonAttrs({
88
- isDisabled: !isInStock,
89
87
  buttonSide: 'left'
90
88
  })
91
89
  });
@@ -110,7 +108,6 @@ const ProductQuantity = (props)=>{
110
108
  });
111
109
  const buttonRightAttrs = system.createAttr({
112
110
  ...getAttrs.getButtonAttrs({
113
- isDisabled: !isInStock,
114
111
  buttonSide: 'right'
115
112
  })
116
113
  });
@@ -128,6 +125,7 @@ const ProductQuantity = (props)=>{
128
125
  style: wrapperStyles,
129
126
  children: [
130
127
  system.If(qtyStyle === 'standard', /*#__PURE__*/ jsxRuntime.jsx("button", {
128
+ disabled: !isInStock,
131
129
  ...buttonLeftAttrs,
132
130
  onClick: decrement,
133
131
  className: buttonLeftClass,
@@ -141,6 +139,7 @@ const ProductQuantity = (props)=>{
141
139
  })
142
140
  })),
143
141
  /*#__PURE__*/ jsxRuntime.jsx("input", {
142
+ disabled: !isInStock,
144
143
  ...inputAttrs,
145
144
  className: inputClass,
146
145
  style: inputStyle,
@@ -149,6 +148,7 @@ const ProductQuantity = (props)=>{
149
148
  }
150
149
  }),
151
150
  system.If(qtyStyle === 'standard', /*#__PURE__*/ jsxRuntime.jsx("button", {
151
+ disabled: !isInStock,
152
152
  ...buttonRightAttrs,
153
153
  onClick: increment,
154
154
  className: buttonRightClass,
@@ -86,7 +86,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
86
86
  });
87
87
  const buttonLeftAttrs = system.createAttr({
88
88
  ...getAttrs.getButtonAttrs({
89
- isLiquid: true,
90
89
  buttonSide: 'left'
91
90
  })
92
91
  });
@@ -110,7 +109,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
110
109
  });
111
110
  const buttonRightAttrs = system.createAttr({
112
111
  ...getAttrs.getButtonAttrs({
113
- isLiquid: true,
114
112
  buttonSide: 'right'
115
113
  })
116
114
  });
@@ -134,6 +132,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
134
132
  <div class="${wrapperClasses}" style="${wrapperStyles}">
135
133
  ${core.RenderIf(qtyStyle === 'standard', core.template /* liquid */ `
136
134
  <button
135
+ {% if available == false %} disabled {% endif %}
137
136
  ${{
138
137
  ...buttonLeftAttrs
139
138
  }}
@@ -142,11 +141,12 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
142
141
  >
143
142
  <span class="${iconWrapperClass}" style="${iconWidth}"
144
143
  >
145
- ${common.getPlusIcon(plusIcon)}
144
+ ${common.getPlusIcon(minusIcon)}
146
145
  </span>
147
146
  </button>
148
147
  `)}
149
148
  <input
149
+ {% if available == false %} disabled {% endif %}
150
150
  ${{
151
151
  ...inputAttrs
152
152
  }}
@@ -157,6 +157,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
157
157
 
158
158
  ${core.RenderIf(qtyStyle === 'standard', core.template /* liquid */ `
159
159
  <button
160
+ {% if available == false %} disabled {% endif %}
160
161
  ${{
161
162
  ...buttonRightAttrs
162
163
  }}
@@ -164,7 +165,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
164
165
  style="${buttonRightStyle}"
165
166
  >
166
167
  <span class="${iconWrapperClass}" style="${iconWidth}">
167
- ${common.getPlusIcon(minusIcon)}
168
+ ${common.getPlusIcon(plusIcon)}
168
169
  </span>
169
170
  </button>
170
171
  `)}
@@ -407,6 +407,31 @@ const ProductQuantitySettings = [
407
407
  }
408
408
  }
409
409
  },
410
+ {
411
+ id: 'shapeShadow',
412
+ type: 'shadow-v2',
413
+ devices: {
414
+ desktop: {
415
+ default: {
416
+ normal: {}
417
+ }
418
+ }
419
+ },
420
+ compoDefaultValue: {
421
+ desktop: {
422
+ default: {
423
+ normal: {
424
+ type: 'shadow-1',
425
+ distance: '4px',
426
+ blur: '4px',
427
+ spread: '0px',
428
+ color: '#121212',
429
+ angle: 90
430
+ }
431
+ }
432
+ }
433
+ }
434
+ },
410
435
  {
411
436
  id: 'buttonBoxShadow',
412
437
  type: 'shadow-v2',
@@ -521,52 +521,8 @@ const SettingUIV2 = [
521
521
  en: 'Shadow'
522
522
  },
523
523
  setting: {
524
- id: 'boxShadow',
524
+ id: 'shapeShadow',
525
525
  state: 'normal'
526
- },
527
- options: {
528
- updateFields: [
529
- {
530
- field: 'normal.enable',
531
- settingId: 'advanced.hasBoxShadow',
532
- state: 'normal'
533
- }
534
- ]
535
- },
536
- controlChangeTrigger: {
537
- settings: [
538
- {
539
- condition: `boxShadow.normal.enable === true`,
540
- source: [
541
- 'boxShadow',
542
- 'hasBoxShadow'
543
- ],
544
- action: {
545
- controlId: 'hasBoxShadow',
546
- groupType: 'advanced',
547
- controlType: 'advanced',
548
- state: 'normal',
549
- newValue: true
550
- }
551
- },
552
- {
553
- condition: `boxShadow.normal.enable === false`,
554
- source: [
555
- 'boxShadow',
556
- 'hasBoxShadow'
557
- ],
558
- action: {
559
- controlId: 'hasBoxShadow',
560
- groupType: 'advanced',
561
- controlType: 'advanced',
562
- state: 'normal',
563
- newValue: false
564
- }
565
- }
566
- ],
567
- options: {
568
- noRecordHistory: true
569
- }
570
526
  }
571
527
  }
572
528
  ]
@@ -4,18 +4,16 @@ const getContainerAttrs = ({ uid, isDisabled = true, isDisableByLiquid })=>{
4
4
  'data-disabled': isDisableByLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled
5
5
  };
6
6
  };
7
- const getButtonAttrs = ({ isDisabled = true, isLiquid, buttonSide })=>{
7
+ const getButtonAttrs = ({ buttonSide })=>{
8
8
  return {
9
- disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
10
9
  title: buttonSide === 'left' ? 'Decrement' : 'Increment',
11
10
  'aria-label': buttonSide === 'left' ? 'decrement' : 'increment'
12
11
  };
13
12
  };
14
- const getInputAttr = ({ isDisabled = true, isLiquid, qtyStyle, quantity, currentVariant, defaultQty })=>{
13
+ const getInputAttr = ({ isLiquid, qtyStyle, quantity, currentVariant, defaultQty })=>{
15
14
  const attrs = {};
16
15
  if (currentVariant?.manageInventory) attrs['max'] = isLiquid ? '{{ current_variant.quantity_rule.max }}' : currentVariant?.inventoryQuantity ?? 1;
17
16
  return {
18
- disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
19
17
  type: qtyStyle === 'standard' ? 'text' : 'number',
20
18
  name: 'quantity',
21
19
  step: 1,
@@ -15,7 +15,7 @@ const getInputClasses = ({ styles, borderBtn, inputBackgroundColor, textColor })
15
15
  };
16
16
  };
17
17
  const getButtonClass = ({ borderBtn, buttonBackgroundColor, iconColor, buttonSide })=>{
18
- let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0' : '!gp-border-l-0'} `;
18
+ let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0 gp-minus' : '!gp-border-l-0 gp-plus'} `;
19
19
  const buttonColor = handleConvertClassColor(borderBtn);
20
20
  const buttonBgColor = getGlobalColorStateClass('bg', buttonBackgroundColor);
21
21
  const iconColorStateClass = getGlobalColorStateClass('text', iconColor);
@@ -116,9 +116,16 @@ const getContainerStyles = ({ inputHeight, align })=>{
116
116
  };
117
117
  };
118
118
  const getWrapperStyles = ({ backgroundColor, styles })=>{
119
+ const shapeShadow = styles?.shapeShadow;
120
+ const styleShadow = getResponsiveStyleShadow(shapeShadow, 'box-shadow', {
121
+ desktop: shapeShadow?.desktop ?? {},
122
+ tablet: shapeShadow?.tablet ?? shapeShadow?.desktop ?? {},
123
+ mobile: shapeShadow?.mobile ?? shapeShadow?.tablet ?? shapeShadow?.desktop ?? {}
124
+ });
119
125
  return {
120
126
  ...getGlobalColorStateStyle('bg', backgroundColor),
121
- ...makeStyleResponsive('maxw', styles?.quantityWidth)
127
+ ...makeStyleResponsive('maxw', styles?.quantityWidth),
128
+ ...styleShadow
122
129
  };
123
130
  };
124
131
 
@@ -42,7 +42,6 @@ const ProductQuantity = (props)=>{
42
42
  });
43
43
  const inputAttrs = createAttr({
44
44
  ...getInputAttr({
45
- isDisabled: !isInStock,
46
45
  qtyStyle,
47
46
  quantity,
48
47
  currentVariant,
@@ -81,7 +80,6 @@ const ProductQuantity = (props)=>{
81
80
  });
82
81
  const buttonLeftAttrs = createAttr({
83
82
  ...getButtonAttrs({
84
- isDisabled: !isInStock,
85
83
  buttonSide: 'left'
86
84
  })
87
85
  });
@@ -106,7 +104,6 @@ const ProductQuantity = (props)=>{
106
104
  });
107
105
  const buttonRightAttrs = createAttr({
108
106
  ...getButtonAttrs({
109
- isDisabled: !isInStock,
110
107
  buttonSide: 'right'
111
108
  })
112
109
  });
@@ -124,6 +121,7 @@ const ProductQuantity = (props)=>{
124
121
  style: wrapperStyles,
125
122
  children: [
126
123
  If(qtyStyle === 'standard', /*#__PURE__*/ jsx("button", {
124
+ disabled: !isInStock,
127
125
  ...buttonLeftAttrs,
128
126
  onClick: decrement,
129
127
  className: buttonLeftClass,
@@ -137,6 +135,7 @@ const ProductQuantity = (props)=>{
137
135
  })
138
136
  })),
139
137
  /*#__PURE__*/ jsx("input", {
138
+ disabled: !isInStock,
140
139
  ...inputAttrs,
141
140
  className: inputClass,
142
141
  style: inputStyle,
@@ -145,6 +144,7 @@ const ProductQuantity = (props)=>{
145
144
  }
146
145
  }),
147
146
  If(qtyStyle === 'standard', /*#__PURE__*/ jsx("button", {
147
+ disabled: !isInStock,
148
148
  ...buttonRightAttrs,
149
149
  onClick: increment,
150
150
  className: buttonRightClass,
@@ -82,7 +82,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
82
82
  });
83
83
  const buttonLeftAttrs = createAttr({
84
84
  ...getButtonAttrs({
85
- isLiquid: true,
86
85
  buttonSide: 'left'
87
86
  })
88
87
  });
@@ -106,7 +105,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
106
105
  });
107
106
  const buttonRightAttrs = createAttr({
108
107
  ...getButtonAttrs({
109
- isLiquid: true,
110
108
  buttonSide: 'right'
111
109
  })
112
110
  });
@@ -130,6 +128,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
130
128
  <div class="${wrapperClasses}" style="${wrapperStyles}">
131
129
  ${RenderIf(qtyStyle === 'standard', template /* liquid */ `
132
130
  <button
131
+ {% if available == false %} disabled {% endif %}
133
132
  ${{
134
133
  ...buttonLeftAttrs
135
134
  }}
@@ -138,11 +137,12 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
138
137
  >
139
138
  <span class="${iconWrapperClass}" style="${iconWidth}"
140
139
  >
141
- ${getPlusIcon(plusIcon)}
140
+ ${getPlusIcon(minusIcon)}
142
141
  </span>
143
142
  </button>
144
143
  `)}
145
144
  <input
145
+ {% if available == false %} disabled {% endif %}
146
146
  ${{
147
147
  ...inputAttrs
148
148
  }}
@@ -153,6 +153,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
153
153
 
154
154
  ${RenderIf(qtyStyle === 'standard', template /* liquid */ `
155
155
  <button
156
+ {% if available == false %} disabled {% endif %}
156
157
  ${{
157
158
  ...buttonRightAttrs
158
159
  }}
@@ -160,7 +161,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
160
161
  style="${buttonRightStyle}"
161
162
  >
162
163
  <span class="${iconWrapperClass}" style="${iconWidth}">
163
- ${getPlusIcon(minusIcon)}
164
+ ${getPlusIcon(plusIcon)}
164
165
  </span>
165
166
  </button>
166
167
  `)}
@@ -405,6 +405,31 @@ const ProductQuantitySettings = [
405
405
  }
406
406
  }
407
407
  },
408
+ {
409
+ id: 'shapeShadow',
410
+ type: 'shadow-v2',
411
+ devices: {
412
+ desktop: {
413
+ default: {
414
+ normal: {}
415
+ }
416
+ }
417
+ },
418
+ compoDefaultValue: {
419
+ desktop: {
420
+ default: {
421
+ normal: {
422
+ type: 'shadow-1',
423
+ distance: '4px',
424
+ blur: '4px',
425
+ spread: '0px',
426
+ color: '#121212',
427
+ angle: 90
428
+ }
429
+ }
430
+ }
431
+ }
432
+ },
408
433
  {
409
434
  id: 'buttonBoxShadow',
410
435
  type: 'shadow-v2',
@@ -519,52 +519,8 @@ const SettingUIV2 = [
519
519
  en: 'Shadow'
520
520
  },
521
521
  setting: {
522
- id: 'boxShadow',
522
+ id: 'shapeShadow',
523
523
  state: 'normal'
524
- },
525
- options: {
526
- updateFields: [
527
- {
528
- field: 'normal.enable',
529
- settingId: 'advanced.hasBoxShadow',
530
- state: 'normal'
531
- }
532
- ]
533
- },
534
- controlChangeTrigger: {
535
- settings: [
536
- {
537
- condition: `boxShadow.normal.enable === true`,
538
- source: [
539
- 'boxShadow',
540
- 'hasBoxShadow'
541
- ],
542
- action: {
543
- controlId: 'hasBoxShadow',
544
- groupType: 'advanced',
545
- controlType: 'advanced',
546
- state: 'normal',
547
- newValue: true
548
- }
549
- },
550
- {
551
- condition: `boxShadow.normal.enable === false`,
552
- source: [
553
- 'boxShadow',
554
- 'hasBoxShadow'
555
- ],
556
- action: {
557
- controlId: 'hasBoxShadow',
558
- groupType: 'advanced',
559
- controlType: 'advanced',
560
- state: 'normal',
561
- newValue: false
562
- }
563
- }
564
- ],
565
- options: {
566
- noRecordHistory: true
567
- }
568
524
  }
569
525
  }
570
526
  ]
@@ -4041,6 +4041,7 @@ type ProductQuantityProps = BaseProps<{
4041
4041
  borderBtn?: ObjectDevices$1<StateProp<Border>>;
4042
4042
  iconSizeCustom?: ObjectDevices$1<number>;
4043
4043
  corner?: ObjectDevices$1<StateProp<CornerRadius>>;
4044
+ shapeShadow?: ObjectDevices$1<StateProp<ShadowProps$1>>;
4044
4045
  buttonBoxShadow?: ObjectDevices$1<StateProp<ShadowProps$1>>;
4045
4046
  inputBoxShadow?: ObjectDevices$1<StateProp<ShadowProps$1>>;
4046
4047
  backgroundColor?: StateProp<ColorValueType$1>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.416",
3
+ "version": "2.0.0-dev.418",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",