@gem-sdk/components 2.0.0-dev.391 → 2.0.0-dev.393

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 (36) hide show
  1. package/dist/cjs/form/components/form-email/FormEmail.js +29 -20
  2. package/dist/cjs/form/components/form-email/FormEmail.liquid.js +7 -5
  3. package/dist/cjs/form/components/form-email/common/composeClasses.js +11 -2
  4. package/dist/cjs/form/components/form-email/common/composeStyles.js +62 -2
  5. package/dist/cjs/form/components/newsletter/Newsletter.liquid.js +1 -0
  6. package/dist/cjs/form/components/newsletter/common/composeAttrs.js +1 -2
  7. package/dist/cjs/form/setting/contact/ContactInitConfig.js +3 -1
  8. package/dist/cjs/form/setting/form-email/configs/settings.js +190 -28
  9. package/dist/cjs/form/setting/form-email/configs/uiV2.js +262 -18
  10. package/dist/cjs/form/setting/text-input/configs/settings.js +6 -3
  11. package/dist/cjs/form/setting/text-input/configs/uiV2.js +2 -2
  12. package/dist/cjs/product/setting/product-badge/configs/settings.js +6 -0
  13. package/dist/cjs/product/setting/product-badge/configs/uiV2.js +14 -19
  14. package/dist/cjs/product/setting/product-vendor/configs/settings.js +12 -0
  15. package/dist/cjs/product/setting/product-vendor/configs/uiV2.js +1 -1
  16. package/dist/cjs/sticky/components/Sticky.js +4 -4
  17. package/dist/cjs/sticky/components/hooks/useSticky.js +19 -9
  18. package/dist/esm/form/components/form-email/FormEmail.js +32 -23
  19. package/dist/esm/form/components/form-email/FormEmail.liquid.js +8 -6
  20. package/dist/esm/form/components/form-email/common/composeClasses.js +11 -3
  21. package/dist/esm/form/components/form-email/common/composeStyles.js +63 -4
  22. package/dist/esm/form/components/newsletter/Newsletter.liquid.js +1 -0
  23. package/dist/esm/form/components/newsletter/common/composeAttrs.js +1 -2
  24. package/dist/esm/form/setting/contact/ContactInitConfig.js +3 -1
  25. package/dist/esm/form/setting/form-email/configs/settings.js +190 -28
  26. package/dist/esm/form/setting/form-email/configs/uiV2.js +262 -18
  27. package/dist/esm/form/setting/text-input/configs/settings.js +6 -3
  28. package/dist/esm/form/setting/text-input/configs/uiV2.js +2 -2
  29. package/dist/esm/product/setting/product-badge/configs/settings.js +6 -0
  30. package/dist/esm/product/setting/product-badge/configs/uiV2.js +14 -19
  31. package/dist/esm/product/setting/product-vendor/configs/settings.js +12 -0
  32. package/dist/esm/product/setting/product-vendor/configs/uiV2.js +1 -1
  33. package/dist/esm/sticky/components/Sticky.js +4 -4
  34. package/dist/esm/sticky/components/hooks/useSticky.js +20 -10
  35. package/dist/types/index.d.ts +26 -4
  36. package/package.json +2 -2
@@ -11,15 +11,23 @@ const composeContainerClasses = (setting, advanced, builderProps)=>{
11
11
  'flex flex-col': true
12
12
  });
13
13
  };
14
- const composeInnerClasses = (setting)=>{
14
+ const composeInnerClasses = (setting, builderProps)=>{
15
15
  const { typography, size } = setting ?? {};
16
+ const { uid } = builderProps ?? {};
16
17
  const appendTypoClass = composeTypographyClassName(setting?.typo, typography);
17
18
  return composeClasses({
18
19
  'gp-form-item': true,
19
20
  [appendTypoClass]: !!appendTypoClass,
20
21
  [genSizeClass(size?.type)]: !!size?.type,
21
- '!gp-outline-none !gp-h-auto focus:!gp-shadow-none hover:!gp-shadow-none !gp-bg-none': true
22
+ '!gp-outline-none focus:!gp-shadow-none hover:!gp-shadow-none !gp-bg-none': true,
23
+ [`email-form-${uid}`]: true
22
24
  });
23
25
  };
26
+ const getClassTitle = ()=>{
27
+ return {
28
+ 'gp-text-16': true,
29
+ 'gp-text-[#121212]': true
30
+ };
31
+ };
24
32
 
25
- export { composeContainerClasses, composeInnerClasses };
33
+ export { composeContainerClasses, composeInnerClasses, getClassTitle };
@@ -1,5 +1,5 @@
1
1
  import { filterTruthy } from '../../../helpers/common.js';
2
- import { composeAdvanceStyle, makeStyleResponsive, composeTypographyStyle, makeWidth, composeSize, getStyleShadow } from '@gem-sdk/core';
2
+ import { composeAdvanceStyle, makeStyleResponsive, composeTypographyStyle, makeWidth, makeGlobalSize, composeSize, getBorderStyle, getBorderRadiusStyle, getStyleShadow, getStyleBackgroundByDevice, getGradientBgrStyleByDevice, getSingleColorVariable, getCustomRadius } from '@gem-sdk/core';
3
3
 
4
4
  const composeStyles = (styles)=>filterTruthy(styles);
5
5
  const composeContainerStyles = (setting, advanced)=>{
@@ -24,9 +24,10 @@ const composeContainerStyles = (setting, advanced)=>{
24
24
  ...makeStyleResponsive('ta', align)
25
25
  });
26
26
  };
27
- const composeInnerStyles = (setting, advanced)=>{
27
+ const composeInnerStyles = (setting, advanced, styles)=>{
28
28
  const { border, rounded, hasBoxShadow, boxShadow } = advanced ?? {};
29
- const { typography, size, width } = setting ?? {};
29
+ const { wrapperBorder, borderRadius, globalSize, boxShadowEmailHover, boxShadowEmailActive, roundedEmailHover, textColorActive, roundedEmailActive, textColorHover, borderEmailHover, borderEmailActive, backgroundColorV2Active, backgroundColorV2Hover } = styles ?? {};
30
+ const { typography, size, width, background } = setting ?? {};
30
31
  const inputStyle = composeAdvanceStyle({
31
32
  border,
32
33
  rounded,
@@ -35,17 +36,75 @@ const composeInnerStyles = (setting, advanced)=>{
35
36
  });
36
37
  const appendTypoStyle = composeTypographyStyle(setting?.typo, typography);
37
38
  const inputWidth = makeStyleResponsive('w', makeWidth(width));
39
+ const composeGlobalSize = makeGlobalSize(globalSize);
38
40
  return composeStyles({
41
+ ...composeGlobalSize?.width?.['--w'] ? composeGlobalSize.width : {
42
+ '--w': '100%'
43
+ },
44
+ ...composeGlobalSize?.height?.['--h'] ? composeGlobalSize.height : {
45
+ '--h': 'auto'
46
+ },
47
+ ...composeGlobalSize.padding,
39
48
  ...appendTypoStyle,
40
49
  ...!size?.type ? composeSize(size?.custom) : {},
50
+ ...getBorderStyle(wrapperBorder),
51
+ ...getBorderRadiusStyle(borderRadius),
41
52
  ...inputWidth,
42
53
  ...inputStyle,
43
54
  ...getStyleShadow({
44
55
  value: boxShadow,
45
56
  styleAppliedFor: 'box-shadow',
46
57
  isEnableShadow: hasBoxShadow
58
+ }),
59
+ ...getStyleBackgroundByDevice(background),
60
+ ...getGradientBgrStyleByDevice(background),
61
+ ...getStyleShadow({
62
+ value: boxShadowEmailActive?.active,
63
+ state: 'focus',
64
+ styleAppliedFor: 'box-shadow',
65
+ isEnableShadow: true
66
+ }),
67
+ ...getStyleShadow({
68
+ value: boxShadowEmailHover?.hover,
69
+ state: 'hover',
70
+ styleAppliedFor: 'box-shadow',
71
+ isEnableShadow: true
72
+ }),
73
+ '--hvr-c': textColorHover?.hover ?? '',
74
+ '--focus-c': textColorActive?.active ?? '',
75
+ ...generateStylesTarget({
76
+ state: 'hover',
77
+ borderStyle: borderEmailHover?.hover,
78
+ background: backgroundColorV2Hover?.hover,
79
+ radius: roundedEmailHover?.hover
80
+ }),
81
+ ...generateStylesTarget({
82
+ state: 'focus',
83
+ borderStyle: borderEmailActive?.active,
84
+ background: backgroundColorV2Active?.active,
85
+ radius: roundedEmailActive?.active
47
86
  })
48
87
  });
49
88
  };
89
+ const generateStylesTarget = ({ state, borderStyle, background, radius })=>{
90
+ const { border, width, color } = borderStyle ?? {};
91
+ const getState = {
92
+ hover: 'hvr',
93
+ focus: 'focus'
94
+ };
95
+ const currentState = getState[state];
96
+ return {
97
+ ...width && {
98
+ [`--${currentState}-bw`]: `${width}`
99
+ },
100
+ ...border && {
101
+ [`--${currentState}-b`]: `${border} ${getSingleColorVariable(color)}`
102
+ },
103
+ ...background && {
104
+ [`--${currentState}-bgc`]: `${getSingleColorVariable(background)}`
105
+ },
106
+ ...getCustomRadius(state, radius)
107
+ };
108
+ };
50
109
 
51
- export { composeContainerStyles, composeInnerStyles };
110
+ export { composeContainerStyles, composeInnerStyles, generateStylesTarget };
@@ -38,6 +38,7 @@ const Newsletter = ({ builderProps, setting, children, style, formType, advanced
38
38
  ${{
39
39
  ...containerAttrs
40
40
  }}
41
+ data-callback='${JSON.stringify(setting?.callbackURL)}'
41
42
  style="${composedContainerStyles}"
42
43
  >
43
44
  <a
@@ -5,8 +5,7 @@ const composeContainerAttrs = (builderProps, setting)=>{
5
5
  return composeAttribute({
6
6
  'data-id': builderProps?.uid,
7
7
  id: builderProps?.uid,
8
- 'data-submit-action': setting?.afterSubmitAction,
9
- 'data-callback': JSON.stringify(setting?.callbackURL)
8
+ 'data-submit-action': setting?.afterSubmitAction
10
9
  });
11
10
  };
12
11
  const composeAnchorAttrs = (builderProps, setting)=>{
@@ -112,7 +112,9 @@ const contactInitConfig = [
112
112
  {
113
113
  tag: 'FormEmail',
114
114
  settings: {
115
- placeholder: 'Email'
115
+ placeholder: 'Email',
116
+ showTitle: true,
117
+ title: 'Email'
116
118
  },
117
119
  advanced: {
118
120
  'spacing-setting': {
@@ -8,6 +8,12 @@ const FormEmailSettings = [
8
8
  label: 'Placeholder',
9
9
  default: 'Enter your email address'
10
10
  },
11
+ {
12
+ id: 'placeholderColor',
13
+ type: 'color-picker-v2',
14
+ label: 'Color',
15
+ default: '#A3A3A3'
16
+ },
11
17
  {
12
18
  id: 'translate',
13
19
  type: 'input',
@@ -39,10 +45,12 @@ const FormEmailSettings = [
39
45
  type: 'paragraph-1'
40
46
  },
41
47
  hiddenSetting: {
42
- color: true,
43
48
  textAlign: true,
44
- textShadow: true
49
+ textShadow: true,
50
+ fontWeight: true,
51
+ transform: true
45
52
  },
53
+ disableCollapse: true,
46
54
  ignoreReRender: true
47
55
  },
48
56
  {
@@ -88,36 +96,190 @@ const FormEmailSettings = [
88
96
  }
89
97
  },
90
98
  {
91
- id: 'align',
92
- label: 'Alignment',
93
- type: 'option:value',
94
- options: [
95
- {
96
- label: 'Left',
97
- value: 'left',
98
- type: 'align',
99
- tooltip: 'Align left',
100
- iconName: 'gp-align-left'
101
- },
102
- {
103
- label: 'Center',
104
- value: 'center',
105
- type: 'align',
106
- tooltip: 'Align center',
107
- iconName: 'gp-align-center'
108
- },
109
- {
110
- label: 'Right',
111
- value: 'right',
112
- type: 'align',
113
- tooltip: 'Align right',
114
- iconName: 'gp-align-right'
99
+ id: 'background',
100
+ type: 'background-media',
101
+ ignoreReRender: true,
102
+ hideImage: true,
103
+ devices: {
104
+ desktop: {
105
+ default: {
106
+ type: 'color',
107
+ color: 'transparent'
108
+ }
115
109
  }
116
- ],
110
+ },
111
+ compoDefaultValue: {
112
+ desktop: {
113
+ default: {
114
+ type: 'color',
115
+ color: '#FFFFFF'
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ]
121
+ },
122
+ {
123
+ id: 'style',
124
+ controls: [
125
+ {
126
+ id: 'globalSize',
127
+ type: 'size-setting',
117
128
  devices: {
118
129
  desktop: {
119
- default: 'left'
130
+ default: {
131
+ width: '100%',
132
+ height: 'Auto',
133
+ padding: {
134
+ type: 'medium',
135
+ top: '4px',
136
+ bottom: '4px',
137
+ left: '16px',
138
+ right: '16px'
139
+ }
140
+ }
141
+ }
142
+ },
143
+ settingConfig: {
144
+ width: {},
145
+ height: {
146
+ displayOptions: [
147
+ 'auto',
148
+ 'small',
149
+ 'large',
150
+ 'medium'
151
+ ],
152
+ sizeConfig: {
153
+ small: '28px',
154
+ medium: '36px',
155
+ large: '44px'
156
+ }
157
+ }
158
+ },
159
+ hiddenSettings: [
160
+ 'shape',
161
+ 'gap'
162
+ ]
163
+ },
164
+ {
165
+ id: 'wrapperBorder',
166
+ type: 'border-v2',
167
+ label: 'Border',
168
+ default: {
169
+ border: 'solid',
170
+ width: '1px 1px 1px 1px',
171
+ position: 'all',
172
+ borderWidth: '1px',
173
+ color: '#7D7D7D',
174
+ isCustom: true
175
+ }
176
+ },
177
+ {
178
+ id: 'backgroundColorV2Hover',
179
+ type: 'color-picker-v2',
180
+ enableGradient: true
181
+ },
182
+ {
183
+ id: 'textColorHover',
184
+ type: 'color-picker-v2',
185
+ label: 'Text Color',
186
+ state: {
187
+ hover: true
188
+ }
189
+ },
190
+ {
191
+ id: 'borderEmailHover',
192
+ type: 'border',
193
+ emptyOnClear: true,
194
+ state: {
195
+ hover: true
196
+ }
197
+ },
198
+ {
199
+ id: 'roundedEmailHover',
200
+ type: 'radius-preset',
201
+ default: {
202
+ hover: {
203
+ radiusType: 'small'
204
+ }
205
+ },
206
+ state: {
207
+ hover: true
208
+ }
209
+ },
210
+ {
211
+ id: 'boxShadowEmailHover',
212
+ type: 'shadow-v2',
213
+ label: 'Button Shadow',
214
+ hideOnState: {
215
+ hover: true
216
+ },
217
+ default: {
218
+ hover: {
219
+ type: 'shadow-1',
220
+ distance: '4px',
221
+ blur: '12px',
222
+ spread: '0px',
223
+ color: 'rgba(0, 0, 0, 0.20)',
224
+ angle: 90
225
+ }
226
+ },
227
+ state: {
228
+ hover: true
229
+ }
230
+ },
231
+ {
232
+ id: 'backgroundColorV2Active',
233
+ type: 'color-picker-v2',
234
+ enableGradient: true
235
+ },
236
+ {
237
+ id: 'textColorActive',
238
+ type: 'color-picker-v2',
239
+ label: 'Text Color',
240
+ state: {
241
+ active: true
242
+ }
243
+ },
244
+ {
245
+ id: 'borderEmailActive',
246
+ type: 'border',
247
+ emptyOnClear: true,
248
+ state: {
249
+ active: true
250
+ }
251
+ },
252
+ {
253
+ id: 'roundedEmailActive',
254
+ type: 'radius-preset',
255
+ default: {
256
+ active: {
257
+ radiusType: 'small'
120
258
  }
259
+ },
260
+ state: {
261
+ active: true
262
+ }
263
+ },
264
+ {
265
+ id: 'boxShadowEmailActive',
266
+ type: 'shadow-v2',
267
+ label: 'Button Shadow',
268
+ hideOnState: {
269
+ active: true
270
+ },
271
+ default: {
272
+ active: {
273
+ type: 'shadow-1',
274
+ distance: '4px',
275
+ blur: '12px',
276
+ spread: '0px',
277
+ color: 'rgba(0, 0, 0, 0.20)',
278
+ angle: 90
279
+ }
280
+ },
281
+ state: {
282
+ active: true
121
283
  }
122
284
  }
123
285
  ]