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

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 (24) 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/esm/form/components/form-email/FormEmail.js +32 -23
  13. package/dist/esm/form/components/form-email/FormEmail.liquid.js +8 -6
  14. package/dist/esm/form/components/form-email/common/composeClasses.js +11 -3
  15. package/dist/esm/form/components/form-email/common/composeStyles.js +63 -4
  16. package/dist/esm/form/components/newsletter/Newsletter.liquid.js +1 -0
  17. package/dist/esm/form/components/newsletter/common/composeAttrs.js +1 -2
  18. package/dist/esm/form/setting/contact/ContactInitConfig.js +3 -1
  19. package/dist/esm/form/setting/form-email/configs/settings.js +190 -28
  20. package/dist/esm/form/setting/form-email/configs/uiV2.js +262 -18
  21. package/dist/esm/form/setting/text-input/configs/settings.js +6 -3
  22. package/dist/esm/form/setting/text-input/configs/uiV2.js +2 -2
  23. package/dist/types/index.d.ts +25 -4
  24. package/package.json +2 -2
@@ -16,10 +16,20 @@ const SettingUIV2 = [
16
16
  isHideClear: true,
17
17
  controls: [
18
18
  {
19
- layout: 'vertical',
19
+ label: {
20
+ en: 'Content'
21
+ },
20
22
  setting: {
21
23
  id: 'placeholder'
22
24
  }
25
+ },
26
+ {
27
+ setting: {
28
+ id: 'placeholderColor'
29
+ },
30
+ label: {
31
+ en: 'Color'
32
+ }
23
33
  }
24
34
  ]
25
35
  },
@@ -40,65 +50,299 @@ const SettingUIV2 = [
40
50
  label: {
41
51
  en: 'Width'
42
52
  },
53
+ controlConfig: {
54
+ id: 'width',
55
+ type: 'dropdown:input',
56
+ label: 'Width',
57
+ inputType: 'number',
58
+ units: [
59
+ 'px',
60
+ '%'
61
+ ],
62
+ hideUnit: false,
63
+ linkWithSetting: {
64
+ name: 'globalSize',
65
+ field: 'width'
66
+ },
67
+ displayOptions: [
68
+ {
69
+ label: 'Default',
70
+ value: '1200px',
71
+ showValue: true
72
+ },
73
+ {
74
+ label: 'Full',
75
+ value: '100%',
76
+ showValue: true
77
+ }
78
+ ]
79
+ },
80
+ layout: 'horizontal'
81
+ },
82
+ {
83
+ label: {
84
+ en: 'Height'
85
+ },
86
+ controlConfig: {
87
+ id: 'height',
88
+ type: 'dropdown:input',
89
+ label: 'Height',
90
+ inputType: 'number',
91
+ units: [
92
+ 'px',
93
+ '%'
94
+ ],
95
+ hideUnit: false,
96
+ linkWithSetting: {
97
+ name: 'globalSize',
98
+ field: 'height'
99
+ }
100
+ },
101
+ layout: 'horizontal'
102
+ },
103
+ {
104
+ label: {
105
+ en: 'Padding'
106
+ },
107
+ controlConfig: {
108
+ id: 'padding',
109
+ type: 'padding-v2',
110
+ linkWithSetting: {
111
+ name: 'globalSize',
112
+ field: 'padding'
113
+ },
114
+ compoDefaultValue: {
115
+ desktop: {
116
+ default: {
117
+ type: 'medium',
118
+ top: '12px',
119
+ bottom: '12px',
120
+ left: '24px',
121
+ right: '24px'
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ label: {
131
+ en: 'Background'
132
+ },
133
+ controls: [
134
+ {
43
135
  setting: {
44
- id: 'width'
136
+ id: 'background'
137
+ },
138
+ layout: 'vertical'
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ label: {
144
+ en: 'Shape'
145
+ },
146
+ controls: [
147
+ {
148
+ label: {
149
+ en: 'Border'
150
+ },
151
+ controlConfig: {
152
+ id: 'border',
153
+ type: 'border-v2',
154
+ linkWithSetting: {
155
+ name: 'wrapperBorder'
156
+ }
45
157
  }
46
158
  },
47
159
  {
48
160
  label: {
49
- en: 'Padding'
161
+ en: 'Corner'
50
162
  },
51
163
  setting: {
52
- id: 'size'
164
+ id: 'rounded',
165
+ state: 'normal'
166
+ }
167
+ },
168
+ {
169
+ label: {
170
+ en: 'Shadow'
171
+ },
172
+ setting: {
173
+ id: 'boxShadow',
174
+ state: 'normal'
175
+ },
176
+ options: {
177
+ updateFields: [
178
+ {
179
+ field: 'enable',
180
+ settingId: 'hasBoxShadow',
181
+ state: 'normal'
182
+ }
183
+ ]
184
+ },
185
+ controlChangeTrigger: {
186
+ settings: [
187
+ {
188
+ condition: `boxShadow.normal.enable === true`,
189
+ source: [
190
+ 'boxShadow',
191
+ 'hasBoxShadow'
192
+ ],
193
+ action: {
194
+ controlId: 'hasBoxShadow',
195
+ groupType: 'advanced',
196
+ controlType: 'advanced',
197
+ state: 'normal',
198
+ newValue: true
199
+ }
200
+ },
201
+ {
202
+ condition: `boxShadow.normal.enable === false`,
203
+ source: [
204
+ 'boxShadow',
205
+ 'hasBoxShadow'
206
+ ],
207
+ action: {
208
+ controlId: 'hasBoxShadow',
209
+ groupType: 'advanced',
210
+ controlType: 'advanced',
211
+ state: 'normal',
212
+ newValue: false
213
+ }
214
+ }
215
+ ],
216
+ options: {
217
+ noRecordHistory: true
218
+ }
53
219
  }
54
220
  }
55
221
  ]
56
222
  },
57
223
  {
58
224
  label: {
59
- en: 'Configuration'
225
+ en: 'Hover effect'
60
226
  },
61
227
  controls: [
62
228
  {
63
229
  label: {
64
- en: 'Required'
230
+ en: 'Text color'
65
231
  },
66
232
  setting: {
67
- id: 'required'
233
+ id: 'textColorHover',
234
+ state: 'hover'
68
235
  }
69
236
  },
70
237
  {
71
238
  label: {
72
- en: 'Field name'
239
+ en: 'Background'
73
240
  },
74
241
  setting: {
75
- id: 'name'
242
+ id: 'backgroundColorV2Hover',
243
+ state: 'hover'
76
244
  }
77
245
  },
78
246
  {
79
247
  label: {
80
- en: 'Hide on client'
248
+ en: 'Border'
81
249
  },
82
250
  setting: {
83
- id: 'hideOnClient'
251
+ id: 'borderEmailHover',
252
+ state: 'hover'
253
+ }
254
+ },
255
+ {
256
+ label: {
257
+ en: 'Corner'
258
+ },
259
+ setting: {
260
+ id: 'roundedEmailHover',
261
+ state: 'hover'
262
+ }
263
+ },
264
+ {
265
+ label: {
266
+ en: 'Shadow'
267
+ },
268
+ setting: {
269
+ id: 'boxShadowEmailHover',
270
+ state: 'hover'
84
271
  }
85
272
  }
86
273
  ]
87
274
  },
88
275
  {
276
+ label: {
277
+ en: 'Active state'
278
+ },
89
279
  controls: [
90
280
  {
91
281
  label: {
92
- en: 'Align'
282
+ en: 'Text color'
283
+ },
284
+ setting: {
285
+ id: 'textColorActive',
286
+ state: 'active'
287
+ }
288
+ },
289
+ {
290
+ label: {
291
+ en: 'Background'
93
292
  },
94
- conditionEnable: '!(parseInt(width) >= 100 && width?.includes("%"))',
95
293
  setting: {
96
- id: 'align'
294
+ id: 'backgroundColorV2Active',
295
+ state: 'active'
296
+ }
297
+ },
298
+ {
299
+ label: {
300
+ en: 'Border'
97
301
  },
98
- options: {
99
- labelVariant: 'primary',
100
- fullWidth: true,
101
- disableMessage: `Align is not supported when width is 100%`
302
+ setting: {
303
+ id: 'borderEmailActive',
304
+ state: 'active'
305
+ }
306
+ },
307
+ {
308
+ label: {
309
+ en: 'Corner'
310
+ },
311
+ setting: {
312
+ id: 'roundedEmailActive',
313
+ state: 'active'
314
+ }
315
+ },
316
+ {
317
+ label: {
318
+ en: 'Shadow'
319
+ },
320
+ setting: {
321
+ id: 'boxShadowEmailActive',
322
+ state: 'active'
323
+ }
324
+ }
325
+ ]
326
+ },
327
+ {
328
+ label: {
329
+ en: 'Configuration'
330
+ },
331
+ controls: [
332
+ {
333
+ label: {
334
+ en: 'Required'
335
+ },
336
+ setting: {
337
+ id: 'required'
338
+ }
339
+ },
340
+ {
341
+ label: {
342
+ en: 'Hide on client'
343
+ },
344
+ setting: {
345
+ id: 'hideOnClient'
102
346
  }
103
347
  }
104
348
  ]
@@ -86,7 +86,10 @@ const TextInputSettings = [
86
86
  label: 'Text styles',
87
87
  type: 'typography-v2',
88
88
  default: {
89
- type: 'paragraph-1'
89
+ type: 'paragraph-1',
90
+ attrs: {
91
+ color: 'text-2'
92
+ }
90
93
  },
91
94
  hiddenSetting: {
92
95
  textAlign: true,
@@ -203,8 +206,8 @@ const TextInputSettings = [
203
206
  type: 'medium',
204
207
  top: '12px',
205
208
  bottom: '12px',
206
- left: '24px',
207
- right: '24px'
209
+ left: '12px',
210
+ right: '12px'
208
211
  }
209
212
  }
210
213
  }
@@ -133,8 +133,8 @@ const SettingUIV2 = [
133
133
  type: 'medium',
134
134
  top: '12px',
135
135
  bottom: '12px',
136
- left: '24px',
137
- right: '24px'
136
+ left: '12px',
137
+ right: '12px'
138
138
  }
139
139
  }
140
140
  }
@@ -1,36 +1,45 @@
1
1
  'use client';
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { createStyle, createClass } from '@gem-sdk/system';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { createStyle, createClass, If } from '@gem-sdk/system';
4
4
  import { composeContainerStyles, composeInnerStyles } from './common/composeStyles.js';
5
- import { composeContainerClasses, composeInnerClasses } from './common/composeClasses.js';
5
+ import { composeContainerClasses, composeInnerClasses, getClassTitle } from './common/composeClasses.js';
6
6
 
7
- const FormEmail = ({ builderProps, builderAttrs, setting, advanced, children })=>{
8
- const { placeholder, required, defaultEmail, hideOnClient } = setting ?? {};
7
+ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, children, styles })=>{
8
+ const { placeholder, required, defaultEmail, hideOnClient, title, showTitle } = setting ?? {};
9
9
  const name = 'contact[email]';
10
10
  const containerStyles = createStyle(composeContainerStyles(setting, advanced));
11
- const innerStyles = createStyle(composeInnerStyles(setting, advanced));
11
+ const innerStyles = createStyle(composeInnerStyles(setting, advanced, styles));
12
12
  const containerClasses = createClass(composeContainerClasses(setting, advanced, builderProps));
13
- const innerClasses = createClass(composeInnerClasses(setting));
14
- return /*#__PURE__*/ jsx("div", {
13
+ const innerClasses = createClass(composeInnerClasses(setting, builderProps));
14
+ const classTitle = createClass(getClassTitle());
15
+ return /*#__PURE__*/ jsxs("div", {
15
16
  ...builderAttrs,
16
17
  "data-id": builderProps?.uid,
17
18
  className: containerClasses,
18
19
  style: containerStyles,
19
- children: /*#__PURE__*/ jsxs("div", {
20
- children: [
21
- /*#__PURE__*/ jsx("input", {
22
- type: "email",
23
- className: innerClasses,
24
- style: innerStyles,
25
- placeholder: placeholder,
26
- name: name,
27
- required: required,
28
- autoComplete: "email",
29
- value: hideOnClient ? defaultEmail : ''
30
- }),
31
- children
32
- ]
33
- })
20
+ children: [
21
+ If(showTitle, /*#__PURE__*/ jsx("span", {
22
+ className: classTitle,
23
+ children: title
24
+ })),
25
+ /*#__PURE__*/ jsxs("div", {
26
+ children: [
27
+ /*#__PURE__*/ jsx("input", {
28
+ type: "email",
29
+ className: innerClasses,
30
+ style: innerStyles,
31
+ placeholder: placeholder,
32
+ name: name,
33
+ required: required,
34
+ autoComplete: "email",
35
+ ...hideOnClient && {
36
+ value: defaultEmail
37
+ }
38
+ }),
39
+ children
40
+ ]
41
+ })
42
+ ]
34
43
  });
35
44
  };
36
45
 
@@ -2,10 +2,10 @@ import { template } from '@gem-sdk/core';
2
2
  import { getDynamicSourceLocales } from '../../../helpers.js';
3
3
  import { createStyle, createClass, If } from '@gem-sdk/system';
4
4
  import { composeContainerStyles, composeInnerStyles } from './common/composeStyles.js';
5
- import { composeContainerClasses, composeInnerClasses } from './common/composeClasses.js';
5
+ import { composeContainerClasses, composeInnerClasses, getClassTitle } from './common/composeClasses.js';
6
6
 
7
- const FormEmail = ({ builderProps, builderAttrs, setting, advanced, pageContext })=>{
8
- const { placeholder, required, hideOnClient, defaultEmail, translate } = setting ?? {};
7
+ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, pageContext, styles })=>{
8
+ const { placeholder, required, hideOnClient, defaultEmail, translate, showTitle, title } = setting ?? {};
9
9
  const name = 'contact[email]';
10
10
  const placeholderVal = getDynamicSourceLocales({
11
11
  val: placeholder,
@@ -15,9 +15,10 @@ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, pageContext
15
15
  translate
16
16
  });
17
17
  const containerStyles = createStyle(composeContainerStyles(setting, advanced));
18
- const innerStyles = createStyle(composeInnerStyles(setting, advanced));
18
+ const innerStyles = createStyle(composeInnerStyles(setting, advanced, styles));
19
19
  const containerClasses = createClass(composeContainerClasses(setting, advanced, builderProps));
20
- const innerClasses = createClass(composeInnerClasses(setting));
20
+ const innerClasses = createClass(composeInnerClasses(setting, builderProps));
21
+ const classTitle = createClass(getClassTitle());
21
22
  return template`
22
23
  <div
23
24
  ${{
@@ -27,6 +28,7 @@ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, pageContext
27
28
  class="${containerClasses}"
28
29
  style="${containerStyles}"
29
30
  >
31
+ ${If(showTitle, `<span className="${classTitle}">${title}</span>`)}
30
32
  <input
31
33
  type="email"
32
34
  class="${innerClasses}"
@@ -35,7 +37,7 @@ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, pageContext
35
37
  name="${name}"
36
38
  ${If(required, 'required')}
37
39
  autocomplete="email"
38
- value="${hideOnClient ? defaultEmail : ''}"
40
+ ${If(hideOnClient, `value="${defaultEmail}`)}
39
41
  ></input>
40
42
  </div>
41
43
  `;
@@ -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': {