@gem-sdk/core 1.23.0-moon.60 → 1.23.0-staging.100
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/components/ComponentToolbarPreview.js +6 -2
- package/dist/cjs/components/ComponentWrapper.js +2 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +7 -3
- package/dist/cjs/components/constant.js +5 -0
- package/dist/cjs/components/resize/Resize.js +4 -10
- package/dist/cjs/helpers/icon-list.js +61 -0
- package/dist/cjs/helpers/make-style.js +1 -1
- package/dist/cjs/helpers/size.js +110 -16
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -0
- package/dist/esm/components/ComponentToolbarPreview.js +6 -2
- package/dist/esm/components/ComponentWrapper.js +2 -1
- package/dist/esm/components/ComponentWrapperPreview.js +8 -4
- package/dist/esm/components/constant.js +5 -1
- package/dist/esm/components/resize/Resize.js +5 -11
- package/dist/esm/helpers/icon-list.js +58 -0
- package/dist/esm/helpers/make-style.js +1 -1
- package/dist/esm/helpers/size.js +107 -17
- package/dist/esm/index.js +2 -1
- package/dist/esm/web-components/src/helpers/styles/constant.js +7 -0
- package/dist/types/index.d.ts +92 -32
- package/package.json +3 -3
- package/dist/cjs/components/resize/Column.js +0 -280
- package/dist/esm/components/resize/Column.js +0 -276
|
@@ -161,10 +161,14 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
161
161
|
return false;
|
|
162
162
|
};
|
|
163
163
|
const toolbarName = ()=>{
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
164
|
+
const tag = props.tag;
|
|
165
|
+
if (tag === 'IconListV2') {
|
|
166
|
+
return 'Item list';
|
|
167
|
+
}
|
|
168
|
+
if (tag === 'IconList') {
|
|
166
169
|
return 'Advanced list';
|
|
167
170
|
}
|
|
171
|
+
const name = props.customLabel || props.label;
|
|
168
172
|
return name;
|
|
169
173
|
};
|
|
170
174
|
const onZoomOut = (e)=>{
|
|
@@ -20,6 +20,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
20
20
|
advanced: advanced
|
|
21
21
|
}),
|
|
22
22
|
/*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
23
|
+
className: advanced?.cssClass,
|
|
23
24
|
...children.props,
|
|
24
25
|
style,
|
|
25
26
|
advanced
|
|
@@ -35,7 +36,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
35
36
|
}),
|
|
36
37
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
37
38
|
style: style,
|
|
38
|
-
className: `${props.uid}`,
|
|
39
|
+
className: `${props.uid} ${advanced?.cssClass}`,
|
|
39
40
|
children: children
|
|
40
41
|
})
|
|
41
42
|
]
|
|
@@ -106,12 +106,16 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
106
106
|
advanced: advanced
|
|
107
107
|
}),
|
|
108
108
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
109
|
-
style: !props.
|
|
109
|
+
style: !constant.excludeApplyStyle.includes(props.tag) ? style : {
|
|
110
|
+
'--mb': style?.['--mb'],
|
|
111
|
+
'--mb-tablet': style?.['--mb-tablet'],
|
|
112
|
+
'--mb-mobile': style?.['--mb-mobile']
|
|
113
|
+
},
|
|
110
114
|
className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
|
|
111
115
|
...builderAttrs,
|
|
112
116
|
children: [
|
|
113
|
-
!props.
|
|
114
|
-
/*#__PURE__*/ react.isValidElement(children) && props.
|
|
117
|
+
!constant.excludeApplyStyle.includes(props.tag) && children,
|
|
118
|
+
/*#__PURE__*/ react.isValidElement(children) && constant.excludeApplyStyle.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
115
119
|
...children.props,
|
|
116
120
|
style,
|
|
117
121
|
advanced
|
|
@@ -44,6 +44,11 @@ const customRenderChildren = [
|
|
|
44
44
|
'IconList',
|
|
45
45
|
'Tabs'
|
|
46
46
|
];
|
|
47
|
+
const excludeApplyStyle = [
|
|
48
|
+
'IconListV2',
|
|
49
|
+
'Accordion'
|
|
50
|
+
];
|
|
47
51
|
|
|
48
52
|
exports.customRenderChildren = customRenderChildren;
|
|
49
53
|
exports.disableWrap = disableWrap;
|
|
54
|
+
exports.excludeApplyStyle = excludeApplyStyle;
|
|
@@ -3,19 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var Column = require('./Column.js');
|
|
7
6
|
var Spacing = require('./Spacing.js');
|
|
8
7
|
|
|
9
8
|
function Resize(props) {
|
|
10
|
-
return /*#__PURE__*/ jsxRuntime.
|
|
11
|
-
children:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}),
|
|
15
|
-
/*#__PURE__*/ jsxRuntime.jsx(Column.default, {
|
|
16
|
-
...props
|
|
17
|
-
})
|
|
18
|
-
]
|
|
9
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
10
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Spacing.default, {
|
|
11
|
+
...props
|
|
12
|
+
})
|
|
19
13
|
});
|
|
20
14
|
}
|
|
21
15
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constant = require('../web-components/src/helpers/styles/constant.js');
|
|
4
|
+
|
|
5
|
+
const TEXT_TOTAL_SPACING = 3; //Padding 2, margin 1
|
|
6
|
+
const composePostionIconList = (lineHeight, position, iconWidth)=>{
|
|
7
|
+
const compose = {};
|
|
8
|
+
composePositionLineHeight({
|
|
9
|
+
compose,
|
|
10
|
+
lineHeight,
|
|
11
|
+
device: 'desktop',
|
|
12
|
+
position,
|
|
13
|
+
iconWidth
|
|
14
|
+
});
|
|
15
|
+
composePositionLineHeight({
|
|
16
|
+
compose,
|
|
17
|
+
lineHeight,
|
|
18
|
+
device: 'tablet',
|
|
19
|
+
position,
|
|
20
|
+
iconWidth
|
|
21
|
+
});
|
|
22
|
+
composePositionLineHeight({
|
|
23
|
+
compose,
|
|
24
|
+
lineHeight,
|
|
25
|
+
device: 'mobile',
|
|
26
|
+
position,
|
|
27
|
+
iconWidth
|
|
28
|
+
});
|
|
29
|
+
return compose;
|
|
30
|
+
};
|
|
31
|
+
const composePositionLineHeight = ({ compose, lineHeight, device, position, iconWidth })=>{
|
|
32
|
+
const positionDevice = position?.[device];
|
|
33
|
+
const iconWidthDevice = iconWidth?.[device];
|
|
34
|
+
if (positionDevice) {
|
|
35
|
+
const suffix = constant.devicesMapping[device] ?? '';
|
|
36
|
+
if (positionDevice === 'center') {
|
|
37
|
+
compose.wrapper = {
|
|
38
|
+
...compose.wrapper,
|
|
39
|
+
[`--ai${suffix}`]: 'center'
|
|
40
|
+
};
|
|
41
|
+
compose.content = {
|
|
42
|
+
...compose.content,
|
|
43
|
+
[`--pos${suffix}`]: 'static'
|
|
44
|
+
};
|
|
45
|
+
} else if (iconWidthDevice) {
|
|
46
|
+
const computedTop = parseFloat(lineHeight.replaceAll(/[a-zA-Z]/g, '')) / 2 + TEXT_TOTAL_SPACING - iconWidthDevice / 2;
|
|
47
|
+
compose.wrapper = {
|
|
48
|
+
...compose.wrapper,
|
|
49
|
+
[`--ai${suffix}`]: 'flex-start'
|
|
50
|
+
};
|
|
51
|
+
compose.content = {
|
|
52
|
+
...compose.content,
|
|
53
|
+
[`--top${suffix}`]: `${Math.max(0, Math.ceil(computedTop))}px`,
|
|
54
|
+
[`--pos${suffix}`]: 'relative'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.composePositionLineHeight = composePositionLineHeight;
|
|
61
|
+
exports.composePostionIconList = composePostionIconList;
|
|
@@ -59,7 +59,7 @@ const makeStyleResponsive = (name, value)=>{
|
|
|
59
59
|
};
|
|
60
60
|
const makeWidth = (widthValue, fullWidthValue)=>{
|
|
61
61
|
const getVal = (deviceValue, widthValue, fullWidthValue)=>{
|
|
62
|
-
const widthVal = widthValue
|
|
62
|
+
const widthVal = getResonsiveValue.getResponsiveValueByScreen(widthValue, deviceValue);
|
|
63
63
|
const fullWidthVal = fullWidthValue?.[deviceValue] === undefined ? fullWidthValue?.['desktop'] : fullWidthValue?.[deviceValue];
|
|
64
64
|
if (fullWidthVal) {
|
|
65
65
|
return '100%';
|
package/dist/cjs/helpers/size.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var makeStyle = require('./make-style.js');
|
|
4
4
|
var constant = require('./constant.js');
|
|
5
|
+
var getResonsiveValue = require('./get-resonsive-value.js');
|
|
5
6
|
|
|
6
7
|
function getCustomSizeCSSByDevice(size, device) {
|
|
7
8
|
if (!size || !device) return {};
|
|
@@ -38,7 +39,15 @@ const makeGlobalSize = (globalSize)=>{
|
|
|
38
39
|
mobile: '--g-ct-w'
|
|
39
40
|
}),
|
|
40
41
|
height: makeStyle.makeStyleResponsive('h', getWidthHeightGlobalSize('height', globalSize)),
|
|
41
|
-
padding: getPaddingGlobalSize(globalSize)
|
|
42
|
+
padding: getPaddingGlobalSize(globalSize),
|
|
43
|
+
gap: getGlobalSizeGap(globalSize)
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const getGlobalSizeGap = (globalSize)=>{
|
|
47
|
+
return {
|
|
48
|
+
'--gg': globalSize?.desktop?.gap,
|
|
49
|
+
'--gg-tablet': globalSize?.tablet?.gap,
|
|
50
|
+
'--gg-mobile': globalSize?.mobile?.gap
|
|
42
51
|
};
|
|
43
52
|
};
|
|
44
53
|
const makeStyleWithDefault = (name, value, defaultVal)=>{
|
|
@@ -50,21 +59,102 @@ const makeStyleWithDefault = (name, value, defaultVal)=>{
|
|
|
50
59
|
};
|
|
51
60
|
const getWidthHeightGlobalSize = (type, globalSize)=>{
|
|
52
61
|
if (!globalSize) return {};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
mobile
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
let result = {};
|
|
63
|
+
const DEVICES = [
|
|
64
|
+
'desktop',
|
|
65
|
+
'mobile',
|
|
66
|
+
'tablet'
|
|
67
|
+
];
|
|
68
|
+
DEVICES.forEach((device)=>{
|
|
69
|
+
result = {
|
|
70
|
+
...result,
|
|
71
|
+
[device]: getResonsiveValue.getResponsiveValueByScreen(globalSize, device)?.[type]
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
return result;
|
|
75
|
+
};
|
|
76
|
+
const getHeightByShapeGlobalSize = (shapeByLayout)=>{
|
|
77
|
+
let result = {};
|
|
78
|
+
const DEVICES = [
|
|
79
|
+
'desktop',
|
|
80
|
+
'mobile',
|
|
81
|
+
'tablet'
|
|
82
|
+
];
|
|
83
|
+
DEVICES.forEach((device)=>{
|
|
84
|
+
const shapeByDevice = getResonsiveValue.getResponsiveValueByScreen(shapeByLayout, device);
|
|
85
|
+
const shapeValue = shapeByDevice?.shapeValue;
|
|
86
|
+
const height = shapeByDevice?.height;
|
|
87
|
+
result = {
|
|
88
|
+
...result,
|
|
89
|
+
[device]: shapeValue ? 'auto' : height || 'auto'
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
const getWidthByShapeGlobalSize = (shapeByLayout)=>{
|
|
95
|
+
let result = {};
|
|
96
|
+
const DEVICES = [
|
|
97
|
+
'desktop',
|
|
98
|
+
'mobile',
|
|
99
|
+
'tablet'
|
|
100
|
+
];
|
|
101
|
+
DEVICES.forEach((device)=>{
|
|
102
|
+
const shapeByDevice = getResonsiveValue.getResponsiveValueByScreen(shapeByLayout, device);
|
|
103
|
+
const width = shapeByDevice?.width;
|
|
104
|
+
if (width) {
|
|
105
|
+
result = {
|
|
106
|
+
...result,
|
|
107
|
+
[device]: width
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return result;
|
|
112
|
+
};
|
|
113
|
+
const getAspectRatioGlobalSize = (shape)=>{
|
|
114
|
+
let result = {};
|
|
115
|
+
const DEVICES = [
|
|
116
|
+
'desktop',
|
|
117
|
+
'mobile',
|
|
118
|
+
'tablet'
|
|
119
|
+
];
|
|
120
|
+
DEVICES.forEach((device)=>{
|
|
121
|
+
const shapeValue = getResonsiveValue.getResponsiveValueByScreen(shape, device)?.shapeValue;
|
|
122
|
+
if (shapeValue) {
|
|
123
|
+
result = {
|
|
124
|
+
...result,
|
|
125
|
+
[device]: shapeValue
|
|
126
|
+
};
|
|
127
|
+
} else {
|
|
128
|
+
const shapeConfig = getResonsiveValue.getResponsiveValueByScreen(shape, device)?.shape;
|
|
129
|
+
switch(shapeConfig){
|
|
130
|
+
case 'square':
|
|
131
|
+
result = {
|
|
132
|
+
...result,
|
|
133
|
+
[device]: '1/1'
|
|
134
|
+
};
|
|
135
|
+
break;
|
|
136
|
+
case 'vertical':
|
|
137
|
+
result = {
|
|
138
|
+
...result,
|
|
139
|
+
[device]: '3/4'
|
|
140
|
+
};
|
|
141
|
+
break;
|
|
142
|
+
case 'horizontal':
|
|
143
|
+
result = {
|
|
144
|
+
...result,
|
|
145
|
+
[device]: '4/3'
|
|
146
|
+
};
|
|
147
|
+
break;
|
|
148
|
+
case 'original':
|
|
149
|
+
result = {
|
|
150
|
+
...result,
|
|
151
|
+
[device]: 'auto'
|
|
152
|
+
};
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return result;
|
|
68
158
|
};
|
|
69
159
|
function getCustomPaddingSizeCSSByDevice(globalSize, device) {
|
|
70
160
|
if (!globalSize || !device) return {};
|
|
@@ -83,7 +173,11 @@ const getPaddingGlobalSize = (globalSize)=>{
|
|
|
83
173
|
exports.composeSize = composeSize;
|
|
84
174
|
exports.composeSizeCss = composeSizeCss;
|
|
85
175
|
exports.genSizeClass = genSizeClass;
|
|
176
|
+
exports.getAspectRatioGlobalSize = getAspectRatioGlobalSize;
|
|
177
|
+
exports.getGlobalSizeGap = getGlobalSizeGap;
|
|
178
|
+
exports.getHeightByShapeGlobalSize = getHeightByShapeGlobalSize;
|
|
86
179
|
exports.getPaddingGlobalSize = getPaddingGlobalSize;
|
|
180
|
+
exports.getWidthByShapeGlobalSize = getWidthByShapeGlobalSize;
|
|
87
181
|
exports.getWidthHeightGlobalSize = getWidthHeightGlobalSize;
|
|
88
182
|
exports.makeGlobalSize = makeGlobalSize;
|
|
89
183
|
exports.makeStyleWithDefault = makeStyleWithDefault;
|
package/dist/cjs/index.js
CHANGED
|
@@ -57,6 +57,7 @@ var shadow = require('./helpers/shadow.js');
|
|
|
57
57
|
var background = require('./helpers/background.js');
|
|
58
58
|
var query = require('./helpers/query.js');
|
|
59
59
|
var composeAdvanceStyle = require('./helpers/compose-advance-style.js');
|
|
60
|
+
var iconList = require('./helpers/icon-list.js');
|
|
60
61
|
var useAddToCart = require('./hooks/cart/use-add-to-cart.js');
|
|
61
62
|
var useCartData = require('./hooks/cart/use-cart-data.js');
|
|
62
63
|
var useCartDiscountCodesUpdate = require('./hooks/cart/use-cart-discount-codes-update.js');
|
|
@@ -221,7 +222,11 @@ exports.isLocalEnv = convert.isLocalEnv;
|
|
|
221
222
|
exports.composeSize = size.composeSize;
|
|
222
223
|
exports.composeSizeCss = size.composeSizeCss;
|
|
223
224
|
exports.genSizeClass = size.genSizeClass;
|
|
225
|
+
exports.getAspectRatioGlobalSize = size.getAspectRatioGlobalSize;
|
|
226
|
+
exports.getGlobalSizeGap = size.getGlobalSizeGap;
|
|
227
|
+
exports.getHeightByShapeGlobalSize = size.getHeightByShapeGlobalSize;
|
|
224
228
|
exports.getPaddingGlobalSize = size.getPaddingGlobalSize;
|
|
229
|
+
exports.getWidthByShapeGlobalSize = size.getWidthByShapeGlobalSize;
|
|
225
230
|
exports.getWidthHeightGlobalSize = size.getWidthHeightGlobalSize;
|
|
226
231
|
exports.makeGlobalSize = size.makeGlobalSize;
|
|
227
232
|
exports.makeStyleWithDefault = size.makeStyleWithDefault;
|
|
@@ -237,6 +242,8 @@ exports.generateProductQueryKey = query.generateProductQueryKey;
|
|
|
237
242
|
exports.generateProductsQueryKey = query.generateProductsQueryKey;
|
|
238
243
|
exports.composeAdvanceStyle = composeAdvanceStyle.composeAdvanceStyle;
|
|
239
244
|
exports.splitStyle = composeAdvanceStyle.splitStyle;
|
|
245
|
+
exports.composePositionLineHeight = iconList.composePositionLineHeight;
|
|
246
|
+
exports.composePostionIconList = iconList.composePostionIconList;
|
|
240
247
|
exports.useAddToCart = useAddToCart.useAddToCart;
|
|
241
248
|
exports.useCartData = useCartData.useCartData;
|
|
242
249
|
exports.useCartDiscountCodesUpdate = useCartDiscountCodesUpdate.useCartDiscountCodesUpdate;
|
|
@@ -159,10 +159,14 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
159
159
|
return false;
|
|
160
160
|
};
|
|
161
161
|
const toolbarName = ()=>{
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
162
|
+
const tag = props.tag;
|
|
163
|
+
if (tag === 'IconListV2') {
|
|
164
|
+
return 'Item list';
|
|
165
|
+
}
|
|
166
|
+
if (tag === 'IconList') {
|
|
164
167
|
return 'Advanced list';
|
|
165
168
|
}
|
|
169
|
+
const name = props.customLabel || props.label;
|
|
166
170
|
return name;
|
|
167
171
|
};
|
|
168
172
|
const onZoomOut = (e)=>{
|
|
@@ -16,6 +16,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
16
16
|
advanced: advanced
|
|
17
17
|
}),
|
|
18
18
|
/*#__PURE__*/ jsx(children.type, {
|
|
19
|
+
className: advanced?.cssClass,
|
|
19
20
|
...children.props,
|
|
20
21
|
style,
|
|
21
22
|
advanced
|
|
@@ -31,7 +32,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
31
32
|
}),
|
|
32
33
|
/*#__PURE__*/ jsx("div", {
|
|
33
34
|
style: style,
|
|
34
|
-
className: `${props.uid}`,
|
|
35
|
+
className: `${props.uid} ${advanced?.cssClass}`,
|
|
35
36
|
children: children
|
|
36
37
|
})
|
|
37
38
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useEffect, isValidElement } from 'react';
|
|
3
3
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
4
|
-
import { disableWrap } from './constant.js';
|
|
4
|
+
import { disableWrap, excludeApplyStyle } from './constant.js';
|
|
5
5
|
import RenderCustomCode from './RenderCustomCode.js';
|
|
6
6
|
import { ComponentToolbarPreview } from './ComponentToolbarPreview.js';
|
|
7
7
|
|
|
@@ -102,12 +102,16 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
102
102
|
advanced: advanced
|
|
103
103
|
}),
|
|
104
104
|
/*#__PURE__*/ jsxs("div", {
|
|
105
|
-
style: !props.
|
|
105
|
+
style: !excludeApplyStyle.includes(props.tag) ? style : {
|
|
106
|
+
'--mb': style?.['--mb'],
|
|
107
|
+
'--mb-tablet': style?.['--mb-tablet'],
|
|
108
|
+
'--mb-mobile': style?.['--mb-mobile']
|
|
109
|
+
},
|
|
106
110
|
className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
|
|
107
111
|
...builderAttrs,
|
|
108
112
|
children: [
|
|
109
|
-
!props.
|
|
110
|
-
/*#__PURE__*/ isValidElement(children) && props.
|
|
113
|
+
!excludeApplyStyle.includes(props.tag) && children,
|
|
114
|
+
/*#__PURE__*/ isValidElement(children) && excludeApplyStyle.includes(props.tag) && /*#__PURE__*/ jsx(children.type, {
|
|
111
115
|
...children.props,
|
|
112
116
|
style,
|
|
113
117
|
advanced
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Column from './Column.js';
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
2
|
import Spacing from './Spacing.js';
|
|
4
3
|
|
|
5
4
|
function Resize(props) {
|
|
6
|
-
return /*#__PURE__*/
|
|
7
|
-
children:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}),
|
|
11
|
-
/*#__PURE__*/ jsx(Column, {
|
|
12
|
-
...props
|
|
13
|
-
})
|
|
14
|
-
]
|
|
5
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
6
|
+
children: /*#__PURE__*/ jsx(Spacing, {
|
|
7
|
+
...props
|
|
8
|
+
})
|
|
15
9
|
});
|
|
16
10
|
}
|
|
17
11
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { devicesMapping } from '../web-components/src/helpers/styles/constant.js';
|
|
2
|
+
|
|
3
|
+
const TEXT_TOTAL_SPACING = 3; //Padding 2, margin 1
|
|
4
|
+
const composePostionIconList = (lineHeight, position, iconWidth)=>{
|
|
5
|
+
const compose = {};
|
|
6
|
+
composePositionLineHeight({
|
|
7
|
+
compose,
|
|
8
|
+
lineHeight,
|
|
9
|
+
device: 'desktop',
|
|
10
|
+
position,
|
|
11
|
+
iconWidth
|
|
12
|
+
});
|
|
13
|
+
composePositionLineHeight({
|
|
14
|
+
compose,
|
|
15
|
+
lineHeight,
|
|
16
|
+
device: 'tablet',
|
|
17
|
+
position,
|
|
18
|
+
iconWidth
|
|
19
|
+
});
|
|
20
|
+
composePositionLineHeight({
|
|
21
|
+
compose,
|
|
22
|
+
lineHeight,
|
|
23
|
+
device: 'mobile',
|
|
24
|
+
position,
|
|
25
|
+
iconWidth
|
|
26
|
+
});
|
|
27
|
+
return compose;
|
|
28
|
+
};
|
|
29
|
+
const composePositionLineHeight = ({ compose, lineHeight, device, position, iconWidth })=>{
|
|
30
|
+
const positionDevice = position?.[device];
|
|
31
|
+
const iconWidthDevice = iconWidth?.[device];
|
|
32
|
+
if (positionDevice) {
|
|
33
|
+
const suffix = devicesMapping[device] ?? '';
|
|
34
|
+
if (positionDevice === 'center') {
|
|
35
|
+
compose.wrapper = {
|
|
36
|
+
...compose.wrapper,
|
|
37
|
+
[`--ai${suffix}`]: 'center'
|
|
38
|
+
};
|
|
39
|
+
compose.content = {
|
|
40
|
+
...compose.content,
|
|
41
|
+
[`--pos${suffix}`]: 'static'
|
|
42
|
+
};
|
|
43
|
+
} else if (iconWidthDevice) {
|
|
44
|
+
const computedTop = parseFloat(lineHeight.replaceAll(/[a-zA-Z]/g, '')) / 2 + TEXT_TOTAL_SPACING - iconWidthDevice / 2;
|
|
45
|
+
compose.wrapper = {
|
|
46
|
+
...compose.wrapper,
|
|
47
|
+
[`--ai${suffix}`]: 'flex-start'
|
|
48
|
+
};
|
|
49
|
+
compose.content = {
|
|
50
|
+
...compose.content,
|
|
51
|
+
[`--top${suffix}`]: `${Math.max(0, Math.ceil(computedTop))}px`,
|
|
52
|
+
[`--pos${suffix}`]: 'relative'
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { composePositionLineHeight, composePostionIconList };
|
|
@@ -57,7 +57,7 @@ const makeStyleResponsive = (name, value)=>{
|
|
|
57
57
|
};
|
|
58
58
|
const makeWidth = (widthValue, fullWidthValue)=>{
|
|
59
59
|
const getVal = (deviceValue, widthValue, fullWidthValue)=>{
|
|
60
|
-
const widthVal = widthValue
|
|
60
|
+
const widthVal = getResponsiveValueByScreen(widthValue, deviceValue);
|
|
61
61
|
const fullWidthVal = fullWidthValue?.[deviceValue] === undefined ? fullWidthValue?.['desktop'] : fullWidthValue?.[deviceValue];
|
|
62
62
|
if (fullWidthVal) {
|
|
63
63
|
return '100%';
|