@gem-sdk/components 2.0.0-dev.412 → 2.0.0-dev.413
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.
- package/dist/cjs/form/components/contact/common/composeStyles.js +3 -0
- package/dist/cjs/form/components/form-email/FormEmail.js +19 -18
- package/dist/cjs/form/components/form-email/FormEmail.liquid.js +6 -1
- package/dist/cjs/form/components/form-email/common/composeClasses.js +2 -2
- package/dist/cjs/form/components/textarea/TextArea.js +10 -18
- package/dist/cjs/form/components/textarea/TextArea.liquid.js +2 -2
- package/dist/cjs/form/components/textarea/common/composeStyles.js +8 -4
- package/dist/cjs/form/components/textfield/TextField.js +11 -19
- package/dist/cjs/form/components/textfield/TextField.liquid.js +2 -2
- package/dist/cjs/form/components/textfield/common/composeClasses.js +1 -1
- package/dist/cjs/form/components/textfield/common/composeStyles.js +11 -4
- package/dist/cjs/form/components/textinput/common/composeClasses.js +1 -1
- package/dist/cjs/form/setting/contact/ContactInitConfig.js +243 -12
- package/dist/cjs/form/setting/form-checkbox/configs/uiV2.js +56 -56
- package/dist/cjs/form/setting/form-dropdown/configs/uiV2.js +115 -121
- package/dist/cjs/form/setting/form-email/configs/settings.js +2 -1
- package/dist/cjs/form/setting/form-email/configs/uiV2.js +200 -205
- package/dist/cjs/form/setting/form-textarea/configs/settings.js +56 -0
- package/dist/cjs/form/setting/form-textarea/configs/uiV2.js +61 -5
- package/dist/cjs/form/setting/newsletter/NewsletterInitConfig.js +15 -0
- package/dist/cjs/form/setting/newsletter/configs/settings.js +77 -1
- package/dist/cjs/form/setting/newsletter/configs/uiV2.js +5 -8
- package/dist/cjs/form/setting/text-field/configs/settings.js +57 -0
- package/dist/cjs/form/setting/text-field/configs/uiV2.js +82 -5
- package/dist/esm/form/components/contact/common/composeStyles.js +4 -1
- package/dist/esm/form/components/form-email/FormEmail.js +19 -18
- package/dist/esm/form/components/form-email/FormEmail.liquid.js +6 -1
- package/dist/esm/form/components/form-email/common/composeClasses.js +2 -2
- package/dist/esm/form/components/textarea/TextArea.js +10 -18
- package/dist/esm/form/components/textarea/TextArea.liquid.js +2 -2
- package/dist/esm/form/components/textarea/common/composeStyles.js +9 -5
- package/dist/esm/form/components/textfield/TextField.js +11 -19
- package/dist/esm/form/components/textfield/TextField.liquid.js +2 -2
- package/dist/esm/form/components/textfield/common/composeClasses.js +1 -1
- package/dist/esm/form/components/textfield/common/composeStyles.js +12 -5
- package/dist/esm/form/components/textinput/common/composeClasses.js +1 -1
- package/dist/esm/form/setting/contact/ContactInitConfig.js +243 -12
- package/dist/esm/form/setting/form-checkbox/configs/uiV2.js +56 -56
- package/dist/esm/form/setting/form-dropdown/configs/uiV2.js +115 -121
- package/dist/esm/form/setting/form-email/configs/settings.js +2 -1
- package/dist/esm/form/setting/form-email/configs/uiV2.js +200 -205
- package/dist/esm/form/setting/form-textarea/configs/settings.js +56 -0
- package/dist/esm/form/setting/form-textarea/configs/uiV2.js +61 -5
- package/dist/esm/form/setting/newsletter/NewsletterInitConfig.js +15 -0
- package/dist/esm/form/setting/newsletter/configs/settings.js +77 -1
- package/dist/esm/form/setting/newsletter/configs/uiV2.js +5 -8
- package/dist/esm/form/setting/text-field/configs/settings.js +57 -0
- package/dist/esm/form/setting/text-field/configs/uiV2.js +82 -5
- package/dist/types/index.d.ts +17 -34
- package/package.json +2 -2
|
@@ -98,8 +98,8 @@ const SettingUIV2 = [
|
|
|
98
98
|
},
|
|
99
99
|
displayOptions: [
|
|
100
100
|
{
|
|
101
|
-
label: '
|
|
102
|
-
value: '
|
|
101
|
+
label: 'Full',
|
|
102
|
+
value: '100%',
|
|
103
103
|
showValue: true
|
|
104
104
|
}
|
|
105
105
|
]
|
|
@@ -131,8 +131,7 @@ const SettingUIV2 = [
|
|
|
131
131
|
en: 'Border'
|
|
132
132
|
},
|
|
133
133
|
setting: {
|
|
134
|
-
id: '
|
|
135
|
-
state: 'normal'
|
|
134
|
+
id: 'shapeBorder'
|
|
136
135
|
}
|
|
137
136
|
},
|
|
138
137
|
{
|
|
@@ -140,8 +139,7 @@ const SettingUIV2 = [
|
|
|
140
139
|
en: 'Corner'
|
|
141
140
|
},
|
|
142
141
|
setting: {
|
|
143
|
-
id: '
|
|
144
|
-
state: 'normal'
|
|
142
|
+
id: 'shapeRounded'
|
|
145
143
|
}
|
|
146
144
|
},
|
|
147
145
|
{
|
|
@@ -149,8 +147,7 @@ const SettingUIV2 = [
|
|
|
149
147
|
en: 'Shadow'
|
|
150
148
|
},
|
|
151
149
|
setting: {
|
|
152
|
-
id: '
|
|
153
|
-
state: 'normal'
|
|
150
|
+
id: 'shapeBoxShadow'
|
|
154
151
|
}
|
|
155
152
|
}
|
|
156
153
|
]
|
|
@@ -146,6 +146,63 @@ const TextFieldSettings = [
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: 'style',
|
|
152
|
+
controls: [
|
|
153
|
+
{
|
|
154
|
+
id: 'globalSize',
|
|
155
|
+
type: 'size-setting',
|
|
156
|
+
devices: {
|
|
157
|
+
desktop: {
|
|
158
|
+
default: {
|
|
159
|
+
width: '100%',
|
|
160
|
+
height: 'Auto',
|
|
161
|
+
padding: {
|
|
162
|
+
type: 'medium',
|
|
163
|
+
top: '12px',
|
|
164
|
+
bottom: '12px',
|
|
165
|
+
left: '12px',
|
|
166
|
+
right: '12px'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
settingConfig: {
|
|
172
|
+
width: {
|
|
173
|
+
displayOptions: [
|
|
174
|
+
'full',
|
|
175
|
+
'auto',
|
|
176
|
+
'small',
|
|
177
|
+
'large',
|
|
178
|
+
'medium'
|
|
179
|
+
],
|
|
180
|
+
sizeConfig: {
|
|
181
|
+
small: '100px',
|
|
182
|
+
medium: '116px',
|
|
183
|
+
large: '132px'
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
height: {
|
|
187
|
+
displayOptions: [
|
|
188
|
+
'auto',
|
|
189
|
+
'small',
|
|
190
|
+
'large',
|
|
191
|
+
'medium'
|
|
192
|
+
],
|
|
193
|
+
sizeConfig: {
|
|
194
|
+
small: '28px',
|
|
195
|
+
medium: '36px',
|
|
196
|
+
large: '44px'
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
hiddenSettings: [
|
|
201
|
+
'shape',
|
|
202
|
+
'gap'
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
149
206
|
}
|
|
150
207
|
];
|
|
151
208
|
|
|
@@ -40,16 +40,93 @@ const SettingUIV2 = [
|
|
|
40
40
|
label: {
|
|
41
41
|
en: 'Width'
|
|
42
42
|
},
|
|
43
|
-
|
|
44
|
-
id: 'width'
|
|
45
|
-
|
|
43
|
+
controlConfig: {
|
|
44
|
+
id: 'width',
|
|
45
|
+
type: 'dropdown:input',
|
|
46
|
+
label: 'Width',
|
|
47
|
+
inputType: 'number',
|
|
48
|
+
units: [
|
|
49
|
+
'px',
|
|
50
|
+
'%'
|
|
51
|
+
],
|
|
52
|
+
hideUnit: false,
|
|
53
|
+
linkWithSetting: {
|
|
54
|
+
name: 'globalSize',
|
|
55
|
+
field: 'width'
|
|
56
|
+
},
|
|
57
|
+
displayOptions: [
|
|
58
|
+
{
|
|
59
|
+
label: 'Fit content',
|
|
60
|
+
value: 'Auto',
|
|
61
|
+
showValue: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: 'Full',
|
|
65
|
+
value: '100%',
|
|
66
|
+
showValue: true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: 'Small',
|
|
70
|
+
value: '100px',
|
|
71
|
+
showValue: true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: 'Medium',
|
|
75
|
+
value: '116px',
|
|
76
|
+
showValue: true
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: 'Large',
|
|
80
|
+
value: '132px',
|
|
81
|
+
showValue: true
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
layout: 'horizontal'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: {
|
|
89
|
+
en: 'Height'
|
|
90
|
+
},
|
|
91
|
+
controlConfig: {
|
|
92
|
+
id: 'height',
|
|
93
|
+
type: 'dropdown:input',
|
|
94
|
+
label: 'Height',
|
|
95
|
+
inputType: 'number',
|
|
96
|
+
units: [
|
|
97
|
+
'px',
|
|
98
|
+
'%'
|
|
99
|
+
],
|
|
100
|
+
hideUnit: false,
|
|
101
|
+
linkWithSetting: {
|
|
102
|
+
name: 'globalSize',
|
|
103
|
+
field: 'height'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
layout: 'horizontal'
|
|
46
107
|
},
|
|
47
108
|
{
|
|
48
109
|
label: {
|
|
49
110
|
en: 'Padding'
|
|
50
111
|
},
|
|
51
|
-
|
|
52
|
-
id: '
|
|
112
|
+
controlConfig: {
|
|
113
|
+
id: 'padding',
|
|
114
|
+
type: 'padding-v2',
|
|
115
|
+
linkWithSetting: {
|
|
116
|
+
name: 'globalSize',
|
|
117
|
+
field: 'padding'
|
|
118
|
+
},
|
|
119
|
+
compoDefaultValue: {
|
|
120
|
+
desktop: {
|
|
121
|
+
default: {
|
|
122
|
+
type: 'medium',
|
|
123
|
+
top: '12px',
|
|
124
|
+
bottom: '12px',
|
|
125
|
+
left: '12px',
|
|
126
|
+
right: '12px'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
53
130
|
}
|
|
54
131
|
}
|
|
55
132
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filterTruthy } from '../../../helpers/common.js';
|
|
2
|
-
import { makeGlobalSize, getStyleBackgroundByDevice, getGradientBgrStyleByDevice } from '@gem-sdk/core';
|
|
2
|
+
import { makeGlobalSize, composeBorderResponsive, composeRadiusResponsive, getResponsiveStyleShadowWithoutState, getStyleBackgroundByDevice, getGradientBgrStyleByDevice } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
4
|
const composeStyles = (styles)=>filterTruthy(styles);
|
|
5
5
|
const composeContainerStyles = (setting, styles)=>{
|
|
@@ -12,6 +12,9 @@ const composeContainerStyles = (setting, styles)=>{
|
|
|
12
12
|
'--w': '100%'
|
|
13
13
|
},
|
|
14
14
|
...composeGlobalSize.padding,
|
|
15
|
+
...composeBorderResponsive(styles?.shapeBorder),
|
|
16
|
+
...composeRadiusResponsive(styles?.shapeRounded),
|
|
17
|
+
...getResponsiveStyleShadowWithoutState(styles?.shapeBoxShadow, 'box-shadow', styles?.shapeBoxShadow),
|
|
15
18
|
...getStyleBackgroundByDevice(background),
|
|
16
19
|
...getGradientBgrStyleByDevice(background)
|
|
17
20
|
});
|
|
@@ -9,7 +9,12 @@ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, children, st
|
|
|
9
9
|
const name = 'contact[email]';
|
|
10
10
|
const containerStyles = createStyle(composeContainerStyles(setting, advanced));
|
|
11
11
|
const innerStyles = createStyle(composeInnerStyles(setting, advanced, styles));
|
|
12
|
-
const containerClasses = createClass(composeContainerClasses(
|
|
12
|
+
const containerClasses = createClass(composeContainerClasses({
|
|
13
|
+
setting,
|
|
14
|
+
advanced,
|
|
15
|
+
builderProps,
|
|
16
|
+
type: 'react'
|
|
17
|
+
}));
|
|
13
18
|
const innerClasses = createClass(composeInnerClasses(setting, builderProps));
|
|
14
19
|
const classTitle = createClass(getClassTitle());
|
|
15
20
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -22,23 +27,19 @@ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, children, st
|
|
|
22
27
|
className: classTitle,
|
|
23
28
|
children: title
|
|
24
29
|
})),
|
|
25
|
-
/*#__PURE__*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
children
|
|
40
|
-
]
|
|
41
|
-
})
|
|
30
|
+
/*#__PURE__*/ jsx("input", {
|
|
31
|
+
type: "email",
|
|
32
|
+
className: innerClasses,
|
|
33
|
+
style: innerStyles,
|
|
34
|
+
placeholder: placeholder,
|
|
35
|
+
name: name,
|
|
36
|
+
required: required,
|
|
37
|
+
autoComplete: "email",
|
|
38
|
+
...hideOnClient && {
|
|
39
|
+
value: defaultEmail
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
children
|
|
42
43
|
]
|
|
43
44
|
});
|
|
44
45
|
};
|
|
@@ -16,7 +16,12 @@ const FormEmail = ({ builderProps, builderAttrs, setting, advanced, pageContext,
|
|
|
16
16
|
});
|
|
17
17
|
const containerStyles = createStyle(composeContainerStyles(setting, advanced));
|
|
18
18
|
const innerStyles = createStyle(composeInnerStyles(setting, advanced, styles));
|
|
19
|
-
const containerClasses = createClass(composeContainerClasses(
|
|
19
|
+
const containerClasses = createClass(composeContainerClasses({
|
|
20
|
+
setting,
|
|
21
|
+
advanced,
|
|
22
|
+
builderProps,
|
|
23
|
+
type: 'liquid'
|
|
24
|
+
}));
|
|
20
25
|
const innerClasses = createClass(composeInnerClasses(setting, builderProps));
|
|
21
26
|
const classTitle = createClass(getClassTitle());
|
|
22
27
|
return template`
|
|
@@ -2,11 +2,11 @@ import { filterTruthy } from '../../../helpers/common.js';
|
|
|
2
2
|
import { composeTypographyClassName, genSizeClass } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
4
|
const composeClasses = (styles)=>filterTruthy(styles);
|
|
5
|
-
const composeContainerClasses = (setting, advanced, builderProps)=>{
|
|
5
|
+
const composeContainerClasses = ({ setting, advanced, builderProps, type })=>{
|
|
6
6
|
const { hideOnClient } = setting ?? {};
|
|
7
7
|
return composeClasses({
|
|
8
8
|
[builderProps?.uid]: !!builderProps?.uid,
|
|
9
|
-
'!gp-hidden': hideOnClient,
|
|
9
|
+
'!gp-hidden': hideOnClient && type === 'liquid',
|
|
10
10
|
[advanced?.cssClass]: !!advanced?.cssClass,
|
|
11
11
|
'flex flex-col': true
|
|
12
12
|
});
|
|
@@ -4,11 +4,11 @@ import { composeContainerStyles, composeTextareaStyles } from './common/composeS
|
|
|
4
4
|
import { createStyle, createClass } from '@gem-sdk/system';
|
|
5
5
|
import { composeContainerClasses, composeTextareaClasses } from './common/composeClasses.js';
|
|
6
6
|
|
|
7
|
-
const FormTextArea = ({ setting, builderProps, className, builderAttrs, advanced, children })=>{
|
|
7
|
+
const FormTextArea = ({ setting, builderProps, className, builderAttrs, advanced, children, styles })=>{
|
|
8
8
|
const { text, name, placeholder, required } = setting ?? {};
|
|
9
9
|
const defaultName = name === '' || name === undefined ? 'contact[note]' : name;
|
|
10
10
|
const composedContainerStyles = createStyle(composeContainerStyles(advanced, setting));
|
|
11
|
-
const composedTextareaStyles = createStyle(composeTextareaStyles(advanced, setting));
|
|
11
|
+
const composedTextareaStyles = createStyle(composeTextareaStyles(advanced, setting, styles));
|
|
12
12
|
const composedContainerClasses = createClass(composeContainerClasses(advanced, builderProps));
|
|
13
13
|
const composedTextareaClasses = createClass(composeTextareaClasses(setting, builderProps, className ?? ''));
|
|
14
14
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -17,23 +17,15 @@ const FormTextArea = ({ setting, builderProps, className, builderAttrs, advanced
|
|
|
17
17
|
className: composedContainerClasses,
|
|
18
18
|
style: composedContainerStyles,
|
|
19
19
|
children: [
|
|
20
|
-
/*#__PURE__*/ jsx("
|
|
21
|
-
className:
|
|
22
|
-
|
|
20
|
+
/*#__PURE__*/ jsx("textarea", {
|
|
21
|
+
className: composedTextareaClasses,
|
|
22
|
+
placeholder: placeholder,
|
|
23
|
+
style: composedTextareaStyles,
|
|
24
|
+
required: required,
|
|
25
|
+
name: defaultName,
|
|
26
|
+
value: text
|
|
23
27
|
}),
|
|
24
|
-
|
|
25
|
-
children: [
|
|
26
|
-
/*#__PURE__*/ jsx("textarea", {
|
|
27
|
-
className: composedTextareaClasses,
|
|
28
|
-
placeholder: placeholder,
|
|
29
|
-
style: composedTextareaStyles,
|
|
30
|
-
required: required,
|
|
31
|
-
name: defaultName,
|
|
32
|
-
value: text
|
|
33
|
-
}),
|
|
34
|
-
children
|
|
35
|
-
]
|
|
36
|
-
})
|
|
28
|
+
children
|
|
37
29
|
]
|
|
38
30
|
});
|
|
39
31
|
};
|
|
@@ -4,7 +4,7 @@ import { createStyle, createClass, If } from '@gem-sdk/system';
|
|
|
4
4
|
import { composeContainerStyles, composeTextareaStyles } from './common/composeStyles.js';
|
|
5
5
|
import { composeContainerClasses, composeTextareaClasses } from './common/composeClasses.js';
|
|
6
6
|
|
|
7
|
-
const FormTextarea = ({ setting, builderProps, className, builderAttrs, advanced, pageContext })=>{
|
|
7
|
+
const FormTextarea = ({ setting, builderProps, className, builderAttrs, advanced, pageContext, styles })=>{
|
|
8
8
|
const { text, name, placeholder, required } = setting ?? {};
|
|
9
9
|
const defaultName = name === '' || name === undefined ? 'contact[note]' : name;
|
|
10
10
|
const { translate } = advanced ?? {};
|
|
@@ -16,7 +16,7 @@ const FormTextarea = ({ setting, builderProps, className, builderAttrs, advanced
|
|
|
16
16
|
translate
|
|
17
17
|
});
|
|
18
18
|
const composedContainerStyles = createStyle(composeContainerStyles(advanced, setting));
|
|
19
|
-
const composedTextareaStyles = createStyle(composeTextareaStyles(advanced, setting));
|
|
19
|
+
const composedTextareaStyles = createStyle(composeTextareaStyles(advanced, setting, styles));
|
|
20
20
|
const composedContainerClasses = createClass(composeContainerClasses(advanced, builderProps));
|
|
21
21
|
const composedTextareaClasses = createClass(composeTextareaClasses(setting, builderProps, className ?? ''));
|
|
22
22
|
return template`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filterTruthy } from '../../../helpers/common.js';
|
|
2
|
-
import { composeAdvanceStyle, makeStyleResponsive,
|
|
2
|
+
import { composeAdvanceStyle, makeStyleResponsive, composeTypographyStyle, makeGlobalSize, getGlobalColorStyle, composeSize, makeStyle, getSingleColorVariable, getStyleShadow } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
4
|
const composeStyles = (styles)=>filterTruthy(styles);
|
|
5
5
|
const composeContainerStyles = (advanced, setting)=>{
|
|
@@ -23,10 +23,10 @@ const composeContainerStyles = (advanced, setting)=>{
|
|
|
23
23
|
...makeStyleResponsive('ta', setting?.align)
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
const composeTextareaStyles = (advanced, setting)=>{
|
|
26
|
+
const composeTextareaStyles = (advanced, setting, styles)=>{
|
|
27
27
|
const { border, rounded, hasBoxShadow, boxShadow } = advanced ?? {};
|
|
28
|
-
const { typography
|
|
29
|
-
const
|
|
28
|
+
const { typography } = setting ?? {};
|
|
29
|
+
const { globalSize } = styles ?? {};
|
|
30
30
|
const appendTypoStyle = composeTypographyStyle(setting?.typo, typography);
|
|
31
31
|
const inputStyle = composeAdvanceStyle({
|
|
32
32
|
border,
|
|
@@ -34,14 +34,18 @@ const composeTextareaStyles = (advanced, setting)=>{
|
|
|
34
34
|
hasBoxShadow,
|
|
35
35
|
boxShadow
|
|
36
36
|
});
|
|
37
|
+
const composeGlobalSize = makeGlobalSize(globalSize);
|
|
37
38
|
return composeStyles({
|
|
39
|
+
...composeGlobalSize?.width?.['--w'] ? composeGlobalSize.width : {
|
|
40
|
+
'--w': '100%'
|
|
41
|
+
},
|
|
42
|
+
...composeGlobalSize.padding,
|
|
38
43
|
...getGlobalColorStyle(setting?.color),
|
|
39
44
|
...!setting?.size?.type ? composeSize(setting?.size?.custom) : {},
|
|
40
45
|
...makeStyle({
|
|
41
46
|
tt: setting?.transform
|
|
42
47
|
}),
|
|
43
48
|
...appendTypoStyle,
|
|
44
|
-
...textAreaWidth,
|
|
45
49
|
...inputStyle,
|
|
46
50
|
...makeStyle({
|
|
47
51
|
bc: getSingleColorVariable(border?.color)
|
|
@@ -4,37 +4,29 @@ import { createStyle, createClass } from '@gem-sdk/system';
|
|
|
4
4
|
import { composeContainerStyles, composeTextareaStyles } from './common/composeStyles.js';
|
|
5
5
|
import { composeContainerClasses, composeTextFieldClasses } from './common/composeClasses.js';
|
|
6
6
|
|
|
7
|
-
const TextField = ({ setting, builderProps, className, builderAttrs, advanced, children })=>{
|
|
7
|
+
const TextField = ({ setting, builderProps, className, builderAttrs, advanced, children, styles })=>{
|
|
8
8
|
const { text, name, placeholder, required } = setting ?? {};
|
|
9
9
|
const defaultName = name === '' || name === undefined ? 'contact[first_name]' : name;
|
|
10
10
|
const composedContainerStyles = createStyle(composeContainerStyles(advanced, setting));
|
|
11
11
|
const composedContainerClasses = createClass(composeContainerClasses(advanced, builderProps));
|
|
12
12
|
const composedTextFieldClasses = createClass(composeTextFieldClasses(setting, builderProps, className ?? ''));
|
|
13
|
-
const composedTextFieldStyles = createStyle(composeTextareaStyles(advanced, setting));
|
|
13
|
+
const composedTextFieldStyles = createStyle(composeTextareaStyles(advanced, setting, styles));
|
|
14
14
|
return /*#__PURE__*/ jsxs("div", {
|
|
15
15
|
...builderAttrs,
|
|
16
16
|
"data-id": builderProps?.uid,
|
|
17
17
|
className: composedContainerClasses,
|
|
18
18
|
style: composedContainerStyles,
|
|
19
19
|
children: [
|
|
20
|
-
/*#__PURE__*/ jsx("
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/*#__PURE__*/ jsx("input", {
|
|
21
|
+
type: "text",
|
|
22
|
+
className: composedTextFieldClasses,
|
|
23
|
+
style: composedTextFieldStyles,
|
|
24
|
+
placeholder: placeholder,
|
|
25
|
+
required: required,
|
|
26
|
+
name: defaultName,
|
|
27
|
+
value: text
|
|
23
28
|
}),
|
|
24
|
-
|
|
25
|
-
children: [
|
|
26
|
-
/*#__PURE__*/ jsx("input", {
|
|
27
|
-
type: "text",
|
|
28
|
-
className: composedTextFieldClasses,
|
|
29
|
-
style: composedTextFieldStyles,
|
|
30
|
-
placeholder: placeholder,
|
|
31
|
-
required: required,
|
|
32
|
-
name: defaultName,
|
|
33
|
-
value: text
|
|
34
|
-
}),
|
|
35
|
-
children
|
|
36
|
-
]
|
|
37
|
-
})
|
|
29
|
+
children
|
|
38
30
|
]
|
|
39
31
|
});
|
|
40
32
|
};
|
|
@@ -4,7 +4,7 @@ import { createStyle, createClass, If } from '@gem-sdk/system';
|
|
|
4
4
|
import { composeContainerStyles, composeTextareaStyles } from './common/composeStyles.js';
|
|
5
5
|
import { composeContainerClasses, composeTextFieldClasses } from './common/composeClasses.js';
|
|
6
6
|
|
|
7
|
-
const TextField = ({ setting, builderProps, className, builderAttrs, advanced, pageContext })=>{
|
|
7
|
+
const TextField = ({ setting, builderProps, className, builderAttrs, advanced, pageContext, styles })=>{
|
|
8
8
|
const { text, name, placeholder, required, translate } = setting ?? {};
|
|
9
9
|
const defaultName = name === '' || name === undefined ? 'contact[first_name]' : name;
|
|
10
10
|
const placeholderVal = getDynamicSourceLocales({
|
|
@@ -17,7 +17,7 @@ const TextField = ({ setting, builderProps, className, builderAttrs, advanced, p
|
|
|
17
17
|
const composedContainerStyles = createStyle(composeContainerStyles(advanced, setting));
|
|
18
18
|
const composedContainerClasses = createClass(composeContainerClasses(advanced, builderProps));
|
|
19
19
|
const composedTextFieldClasses = createClass(composeTextFieldClasses(setting, builderProps, className ?? ''));
|
|
20
|
-
const composedTextFieldStyles = createStyle(composeTextareaStyles(advanced, setting));
|
|
20
|
+
const composedTextFieldStyles = createStyle(composeTextareaStyles(advanced, setting, styles));
|
|
21
21
|
return template`
|
|
22
22
|
<div
|
|
23
23
|
${builderAttrs}
|
|
@@ -18,7 +18,7 @@ const composeTextFieldClasses = (setting, builderProps, className)=>{
|
|
|
18
18
|
[appendTypoClass]: !!appendTypoClass,
|
|
19
19
|
[globalColorClass]: !!globalColorClass,
|
|
20
20
|
[`${genSizeClass(setting?.size?.type)}`]: !!setting?.size?.type,
|
|
21
|
-
'gp-form-item !gp-outline-none
|
|
21
|
+
'gp-form-item !gp-outline-none focus:!gp-shadow-none hover:!gp-shadow-none !gp-bg-none': true
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filterTruthy } from '../../../helpers/common.js';
|
|
2
|
-
import { composeAdvanceStyle, makeStyleResponsive,
|
|
2
|
+
import { composeAdvanceStyle, makeStyleResponsive, composeTypographyStyle, makeGlobalSize, getGlobalColorStyle, composeSize, makeStyle, getSingleColorVariable, getStyleShadow } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
4
|
const composeStyles = (styles)=>filterTruthy(styles);
|
|
5
5
|
const composeContainerStyles = (advanced, setting)=>{
|
|
@@ -23,10 +23,10 @@ const composeContainerStyles = (advanced, setting)=>{
|
|
|
23
23
|
...makeStyleResponsive('ta', setting?.align)
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
const composeTextareaStyles = (advanced, setting)=>{
|
|
26
|
+
const composeTextareaStyles = (advanced, setting, styles)=>{
|
|
27
27
|
const { border, rounded, hasBoxShadow, boxShadow } = advanced ?? {};
|
|
28
|
-
const { typography
|
|
29
|
-
const
|
|
28
|
+
const { typography } = setting ?? {};
|
|
29
|
+
const { globalSize } = styles ?? {};
|
|
30
30
|
const appendTypoStyle = composeTypographyStyle(setting?.typo, typography);
|
|
31
31
|
const inputStyle = composeAdvanceStyle({
|
|
32
32
|
border,
|
|
@@ -34,14 +34,21 @@ const composeTextareaStyles = (advanced, setting)=>{
|
|
|
34
34
|
hasBoxShadow,
|
|
35
35
|
boxShadow
|
|
36
36
|
});
|
|
37
|
+
const composeGlobalSize = makeGlobalSize(globalSize);
|
|
37
38
|
return composeStyles({
|
|
39
|
+
...composeGlobalSize?.width?.['--w'] ? composeGlobalSize.width : {
|
|
40
|
+
'--w': '100%'
|
|
41
|
+
},
|
|
42
|
+
...composeGlobalSize?.height?.['--h'] ? composeGlobalSize.height : {
|
|
43
|
+
'--h': 'auto'
|
|
44
|
+
},
|
|
45
|
+
...composeGlobalSize.padding,
|
|
38
46
|
...getGlobalColorStyle(setting?.color),
|
|
39
47
|
...!setting?.size?.type ? composeSize(setting?.size?.custom) : {},
|
|
40
48
|
...makeStyle({
|
|
41
49
|
tt: setting?.transform
|
|
42
50
|
}),
|
|
43
51
|
...appendTypoStyle,
|
|
44
|
-
...textAreaWidth,
|
|
45
52
|
...inputStyle,
|
|
46
53
|
...makeStyle({
|
|
47
54
|
bc: getSingleColorVariable(border?.color)
|
|
@@ -17,7 +17,7 @@ const composeTextFieldClasses = (setting, builderProps, className)=>{
|
|
|
17
17
|
[builderProps?.uid]: !!builderProps?.uid,
|
|
18
18
|
[appendTypoClass]: !!appendTypoClass,
|
|
19
19
|
[globalColorClass]: !!globalColorClass,
|
|
20
|
-
'gp-form-item !gp-outline-none focus:!gp-shadow-none hover:!gp-shadow-none !gp-bg-none !gp-border-box': true
|
|
20
|
+
'gp-form-item !gp-outline-none focus:!gp-shadow-none hover:!gp-shadow-none !gp-bg-none !gp-border-box text-input-custom': true
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
|