@itcase/ui 1.2.11 → 1.2.13
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/List.js +1 -1
- package/dist/cjs/components/Select.js +1 -1
- package/dist/cjs/components/Video.js +1 -1
- package/dist/cjs/hooks/useStyles.js +77 -67
- package/dist/components/List.js +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Video.js +1 -1
- package/dist/css/styles/mediaqueries.css +1 -1
- package/dist/hooks/useStyles.js +77 -67
- package/package.json +1 -1
|
@@ -9,11 +9,11 @@ require('react');
|
|
|
9
9
|
require('lodash/camelCase');
|
|
10
10
|
require('lodash/maxBy');
|
|
11
11
|
require('lodash/upperFirst');
|
|
12
|
-
require('../hooks/styleAttributes.js');
|
|
13
12
|
require('../context/UIContext.js');
|
|
14
13
|
require('prop-types');
|
|
15
14
|
require('../hooks/useMediaQueries.js');
|
|
16
15
|
require('react-responsive');
|
|
16
|
+
require('../hooks/styleAttributes.js');
|
|
17
17
|
require('lodash/castArray');
|
|
18
18
|
require('../../tslib.es6-CCZ3TN_7.js');
|
|
19
19
|
|
|
@@ -17,11 +17,11 @@ require('../hooks/useStyles.js');
|
|
|
17
17
|
require('lodash/camelCase');
|
|
18
18
|
require('lodash/maxBy');
|
|
19
19
|
require('lodash/upperFirst');
|
|
20
|
-
require('../hooks/styleAttributes.js');
|
|
21
20
|
require('../context/UIContext.js');
|
|
22
21
|
require('prop-types');
|
|
23
22
|
require('../hooks/useMediaQueries.js');
|
|
24
23
|
require('react-responsive');
|
|
24
|
+
require('../hooks/styleAttributes.js');
|
|
25
25
|
require('../../Link-BoJdm1hz.js');
|
|
26
26
|
require('../../Tooltip-DkTKx9n-.js');
|
|
27
27
|
require('../../Title-zwP6c2U2.js');
|
|
@@ -7,11 +7,11 @@ require('react');
|
|
|
7
7
|
require('lodash/camelCase');
|
|
8
8
|
require('lodash/maxBy');
|
|
9
9
|
require('lodash/upperFirst');
|
|
10
|
-
require('../hooks/styleAttributes.js');
|
|
11
10
|
require('../context/UIContext.js');
|
|
12
11
|
require('prop-types');
|
|
13
12
|
require('../hooks/useMediaQueries.js');
|
|
14
13
|
require('react-responsive');
|
|
14
|
+
require('../hooks/styleAttributes.js');
|
|
15
15
|
|
|
16
16
|
function Video(props) {
|
|
17
17
|
var id = props.id, children = props.children, className = props.className, poster = props.poster, webm = props.webm, ogv = props.ogv, mp4 = props.mp4, type = props.type, position = props.position;
|
|
@@ -4,8 +4,8 @@ var React = require('react');
|
|
|
4
4
|
var camelCase = require('lodash/camelCase');
|
|
5
5
|
var maxBy = require('lodash/maxBy');
|
|
6
6
|
var upperFirst = require('lodash/upperFirst');
|
|
7
|
-
var styleAttributes = require('./styleAttributes.js');
|
|
8
7
|
var UIContext = require('../context/UIContext.js');
|
|
8
|
+
var styleAttributes = require('./styleAttributes.js');
|
|
9
9
|
require('prop-types');
|
|
10
10
|
require('./useMediaQueries.js');
|
|
11
11
|
require('react-responsive');
|
|
@@ -21,6 +21,15 @@ const removeDeviceType = originalKey => {
|
|
|
21
21
|
}, originalKey);
|
|
22
22
|
return withOutDeviceType;
|
|
23
23
|
};
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* rule of prop key:
|
|
27
|
+
*
|
|
28
|
+
* first is style second is div target third is device
|
|
29
|
+
* paddingHorizontal GridInnerWrapper MobileNormal
|
|
30
|
+
*
|
|
31
|
+
* paddingHorizontalGridInnerWrapperMobileNormal: "10px"
|
|
32
|
+
*/
|
|
24
33
|
function useStyles(props) {
|
|
25
34
|
const allDevicesTypes = UIContext.useUserDeviceContext();
|
|
26
35
|
const {
|
|
@@ -32,15 +41,6 @@ function useStyles(props) {
|
|
|
32
41
|
|
|
33
42
|
// prettier-ignore
|
|
34
43
|
const deviceBasePart = React.useMemo(() => isMobile && 'Mobile' || isTablet && 'Tablet' || isDesktop && 'Desktop' || '', [isMobile, isTablet, isDesktop]);
|
|
35
|
-
/*
|
|
36
|
-
* rule of prop key:
|
|
37
|
-
*
|
|
38
|
-
* first is style second is div target third is device
|
|
39
|
-
* paddingHorizontal GridInnerWrapper MobileNormal
|
|
40
|
-
*
|
|
41
|
-
* paddingHorizontalGridInnerWrapperMobileNormal: "10px"
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
44
|
const currentDevice = React.useMemo(() => {
|
|
45
45
|
const deviceTypes = Object.keys(allDevicesTypes).map(key => camelCase(key.replace('is', '')));
|
|
46
46
|
|
|
@@ -55,74 +55,84 @@ function useStyles(props) {
|
|
|
55
55
|
// Set non-existent "currentDevice" value, to collect default styles later
|
|
56
56
|
return currentDevice || '__DEVICE_IS_NOT_FOUND__';
|
|
57
57
|
}, [allDevicesTypes, deviceBasePart]);
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
// For every component props
|
|
62
|
-
Object.entries(props).forEach(([propKey, propValue]) => {
|
|
58
|
+
const propsStyleAttributes = React.useMemo(() => {
|
|
59
|
+
const styles = Object.entries(props).reduce((result, [propKey, propValue]) => {
|
|
63
60
|
// Collect list of possible styles for propKey. e.g:
|
|
64
61
|
// "borderLeftWidthWrapperInnerMobileNormal" to ["border", "borderLeftWidth"]
|
|
65
|
-
const
|
|
62
|
+
const possibleStyleAttributesList = styleAttributes.default.filter(styleAttribute => {
|
|
66
63
|
return propKey.startsWith(styleAttribute);
|
|
67
64
|
});
|
|
68
65
|
|
|
69
66
|
// Get longest style key (e.g. "borderLeftWidth")
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
const targetStyleAttribute = maxBy(possibleStyleAttributesList, 'length');
|
|
68
|
+
if (targetStyleAttribute) {
|
|
69
|
+
result[propKey] = propValue;
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}, {});
|
|
73
|
+
return styles;
|
|
74
|
+
// "props" object maybe big and frequently changing
|
|
75
|
+
}, [props]);
|
|
76
|
+
const collectedStyles = React.useMemo(() => {
|
|
77
|
+
const resultStylesGroups = {};
|
|
78
|
+
for (const [propKey, propValue] of Object.entries(propsStyleAttributes)) {
|
|
79
|
+
let value = null;
|
|
80
|
+
const possibleStyleAttributesList = styleAttributes.default.filter(styleAttribute => {
|
|
81
|
+
return propKey.startsWith(styleAttribute);
|
|
82
|
+
});
|
|
83
|
+
const styleAttributeKey = maxBy(possibleStyleAttributesList, 'length');
|
|
84
|
+
const isStyleForCurrentDevice = propKey.toLowerCase().endsWith(currentDevice.toLowerCase());
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
// e.g. "GridWrapperInner"
|
|
87
|
+
const targetElementKey = removeDeviceType(propKey.replace(styleAttributeKey, ''));
|
|
88
|
+
const targetElementGroupKey = camelCase(targetElementKey) || 'styles';
|
|
89
|
+
if (!resultStylesGroups[targetElementGroupKey]) {
|
|
90
|
+
resultStylesGroups[targetElementGroupKey] = {};
|
|
91
|
+
}
|
|
92
|
+
if (isStyleForCurrentDevice) {
|
|
93
|
+
value = propValue;
|
|
94
|
+
} else {
|
|
95
|
+
const propKeyWithOutDeviceType = `${styleAttributeKey}${targetElementKey}`;
|
|
96
|
+
const propKeyWithBaseDeviceType = `${propKeyWithOutDeviceType}${deviceBasePart}`;
|
|
97
|
+
const defaultValue = props[propKeyWithBaseDeviceType] || props[propKeyWithOutDeviceType];
|
|
98
|
+
let currentValue = resultStylesGroups[targetElementGroupKey][styleAttributeKey];
|
|
99
|
+
if (propKeyWithOutDeviceType.includes('Horizontal')) {
|
|
100
|
+
const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
|
|
101
|
+
currentValue = resultStylesGroups[targetElementGroupKey][keyLeft];
|
|
102
|
+
} else if (propKeyWithOutDeviceType.includes('Vertical')) {
|
|
103
|
+
const keyTop = styleAttributeKey.replace('Vertical', 'Top');
|
|
104
|
+
currentValue = resultStylesGroups[targetElementGroupKey][keyTop];
|
|
80
105
|
}
|
|
81
|
-
if (
|
|
82
|
-
value =
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const keyTop = currentStyleAttribute.replace('Vertical', 'Top');
|
|
93
|
-
currentValue = resultStyles[targetElementResultKey][keyTop];
|
|
94
|
-
}
|
|
95
|
-
if (!currentValue) {
|
|
96
|
-
value = defaultValue;
|
|
97
|
-
}
|
|
106
|
+
if (!currentValue) {
|
|
107
|
+
value = defaultValue;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (value) {
|
|
111
|
+
// TODO: handle 16px/9px propValues for Horizontal(Left/Right) and Vertical(Top/Bottom)
|
|
112
|
+
const HAS_UNIT = /\D/;
|
|
113
|
+
// prettier-ignore
|
|
114
|
+
const ignorePX = styleAttributeKey.includes('zIndex') || styleAttributeKey.includes('order');
|
|
115
|
+
if (!HAS_UNIT.test(value) && !ignorePX) {
|
|
116
|
+
value = `${value}px`;
|
|
98
117
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
resultStyles[targetElementResultKey][keyRight] = value;
|
|
112
|
-
} else if (currentStyleAttribute.includes('Vertical')) {
|
|
113
|
-
const keyTop = currentStyleAttribute.replace('Vertical', 'Top');
|
|
114
|
-
const keyBottom = currentStyleAttribute.replace('Vertical', 'Bottom');
|
|
115
|
-
resultStyles[targetElementResultKey][keyTop] = value;
|
|
116
|
-
resultStyles[targetElementResultKey][keyBottom] = value;
|
|
117
|
-
} else {
|
|
118
|
-
resultStyles[targetElementResultKey][currentStyleAttribute] = value;
|
|
119
|
-
}
|
|
118
|
+
if (styleAttributeKey.includes('Horizontal')) {
|
|
119
|
+
const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
|
|
120
|
+
const keyRight = styleAttributeKey.replace('Horizontal', 'Right');
|
|
121
|
+
resultStylesGroups[targetElementGroupKey][keyLeft] = value;
|
|
122
|
+
resultStylesGroups[targetElementGroupKey][keyRight] = value;
|
|
123
|
+
} else if (styleAttributeKey.includes('Vertical')) {
|
|
124
|
+
const keyTop = styleAttributeKey.replace('Vertical', 'Top');
|
|
125
|
+
const keyBottom = styleAttributeKey.replace('Vertical', 'Bottom');
|
|
126
|
+
resultStylesGroups[targetElementGroupKey][keyTop] = value;
|
|
127
|
+
resultStylesGroups[targetElementGroupKey][keyBottom] = value;
|
|
128
|
+
} else {
|
|
129
|
+
resultStylesGroups[targetElementGroupKey][styleAttributeKey] = value;
|
|
120
130
|
}
|
|
121
131
|
}
|
|
122
|
-
}
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
}
|
|
133
|
+
return resultStylesGroups;
|
|
134
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
|
+
}, [deviceBasePart, currentDevice, ...Object.values(propsStyleAttributes)]);
|
|
126
136
|
return collectedStyles;
|
|
127
137
|
}
|
|
128
138
|
|
package/dist/components/List.js
CHANGED
|
@@ -7,11 +7,11 @@ import 'react';
|
|
|
7
7
|
import 'lodash/camelCase';
|
|
8
8
|
import 'lodash/maxBy';
|
|
9
9
|
import 'lodash/upperFirst';
|
|
10
|
-
import '../hooks/styleAttributes.js';
|
|
11
10
|
import '../context/UIContext.js';
|
|
12
11
|
import 'prop-types';
|
|
13
12
|
import '../hooks/useMediaQueries.js';
|
|
14
13
|
import 'react-responsive';
|
|
14
|
+
import '../hooks/styleAttributes.js';
|
|
15
15
|
import 'lodash/castArray';
|
|
16
16
|
import '../tslib.es6-5FtW-kfi.js';
|
|
17
17
|
|
|
@@ -15,11 +15,11 @@ import '../hooks/useStyles.js';
|
|
|
15
15
|
import 'lodash/camelCase';
|
|
16
16
|
import 'lodash/maxBy';
|
|
17
17
|
import 'lodash/upperFirst';
|
|
18
|
-
import '../hooks/styleAttributes.js';
|
|
19
18
|
import '../context/UIContext.js';
|
|
20
19
|
import 'prop-types';
|
|
21
20
|
import '../hooks/useMediaQueries.js';
|
|
22
21
|
import 'react-responsive';
|
|
22
|
+
import '../hooks/styleAttributes.js';
|
|
23
23
|
import '../Link-BSquFKSX.js';
|
|
24
24
|
import '../Tooltip-DJufHBiQ.js';
|
|
25
25
|
import '../Title-BfSFPJtJ.js';
|
package/dist/components/Video.js
CHANGED
|
@@ -5,11 +5,11 @@ import 'react';
|
|
|
5
5
|
import 'lodash/camelCase';
|
|
6
6
|
import 'lodash/maxBy';
|
|
7
7
|
import 'lodash/upperFirst';
|
|
8
|
-
import '../hooks/styleAttributes.js';
|
|
9
8
|
import '../context/UIContext.js';
|
|
10
9
|
import 'prop-types';
|
|
11
10
|
import '../hooks/useMediaQueries.js';
|
|
12
11
|
import 'react-responsive';
|
|
12
|
+
import '../hooks/styleAttributes.js';
|
|
13
13
|
|
|
14
14
|
function Video(props) {
|
|
15
15
|
var id = props.id, children = props.children, className = props.className, poster = props.poster, webm = props.webm, ogv = props.ogv, mp4 = props.mp4, type = props.type, position = props.position;
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
|
|
66
66
|
@custom-media --mouse (hover: hover) and (pointer: fine);
|
|
67
67
|
|
|
68
|
-
@custom-media --tiny-viewport (width
|
|
68
|
+
@custom-media --tiny-viewport (width <= 1366px) and (height <= 720px);
|
|
69
69
|
|
|
70
70
|
@custom-media --small-viewport (width >= 1366px) and (height < 768px);
|
|
71
71
|
|
package/dist/hooks/useStyles.js
CHANGED
|
@@ -2,8 +2,8 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import camelCase from 'lodash/camelCase';
|
|
3
3
|
import maxBy from 'lodash/maxBy';
|
|
4
4
|
import upperFirst from 'lodash/upperFirst';
|
|
5
|
-
import styleAttributes from './styleAttributes.js';
|
|
6
5
|
import { useUserDeviceContext } from '../context/UIContext.js';
|
|
6
|
+
import styleAttributes from './styleAttributes.js';
|
|
7
7
|
import 'prop-types';
|
|
8
8
|
import './useMediaQueries.js';
|
|
9
9
|
import 'react-responsive';
|
|
@@ -19,6 +19,15 @@ const removeDeviceType = originalKey => {
|
|
|
19
19
|
}, originalKey);
|
|
20
20
|
return withOutDeviceType;
|
|
21
21
|
};
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* rule of prop key:
|
|
25
|
+
*
|
|
26
|
+
* first is style second is div target third is device
|
|
27
|
+
* paddingHorizontal GridInnerWrapper MobileNormal
|
|
28
|
+
*
|
|
29
|
+
* paddingHorizontalGridInnerWrapperMobileNormal: "10px"
|
|
30
|
+
*/
|
|
22
31
|
function useStyles(props) {
|
|
23
32
|
const allDevicesTypes = useUserDeviceContext();
|
|
24
33
|
const {
|
|
@@ -30,15 +39,6 @@ function useStyles(props) {
|
|
|
30
39
|
|
|
31
40
|
// prettier-ignore
|
|
32
41
|
const deviceBasePart = useMemo(() => isMobile && 'Mobile' || isTablet && 'Tablet' || isDesktop && 'Desktop' || '', [isMobile, isTablet, isDesktop]);
|
|
33
|
-
/*
|
|
34
|
-
* rule of prop key:
|
|
35
|
-
*
|
|
36
|
-
* first is style second is div target third is device
|
|
37
|
-
* paddingHorizontal GridInnerWrapper MobileNormal
|
|
38
|
-
*
|
|
39
|
-
* paddingHorizontalGridInnerWrapperMobileNormal: "10px"
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
42
|
const currentDevice = useMemo(() => {
|
|
43
43
|
const deviceTypes = Object.keys(allDevicesTypes).map(key => camelCase(key.replace('is', '')));
|
|
44
44
|
|
|
@@ -53,74 +53,84 @@ function useStyles(props) {
|
|
|
53
53
|
// Set non-existent "currentDevice" value, to collect default styles later
|
|
54
54
|
return currentDevice || '__DEVICE_IS_NOT_FOUND__';
|
|
55
55
|
}, [allDevicesTypes, deviceBasePart]);
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
// For every component props
|
|
60
|
-
Object.entries(props).forEach(([propKey, propValue]) => {
|
|
56
|
+
const propsStyleAttributes = useMemo(() => {
|
|
57
|
+
const styles = Object.entries(props).reduce((result, [propKey, propValue]) => {
|
|
61
58
|
// Collect list of possible styles for propKey. e.g:
|
|
62
59
|
// "borderLeftWidthWrapperInnerMobileNormal" to ["border", "borderLeftWidth"]
|
|
63
|
-
const
|
|
60
|
+
const possibleStyleAttributesList = styleAttributes.filter(styleAttribute => {
|
|
64
61
|
return propKey.startsWith(styleAttribute);
|
|
65
62
|
});
|
|
66
63
|
|
|
67
64
|
// Get longest style key (e.g. "borderLeftWidth")
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
const targetStyleAttribute = maxBy(possibleStyleAttributesList, 'length');
|
|
66
|
+
if (targetStyleAttribute) {
|
|
67
|
+
result[propKey] = propValue;
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}, {});
|
|
71
|
+
return styles;
|
|
72
|
+
// "props" object maybe big and frequently changing
|
|
73
|
+
}, [props]);
|
|
74
|
+
const collectedStyles = useMemo(() => {
|
|
75
|
+
const resultStylesGroups = {};
|
|
76
|
+
for (const [propKey, propValue] of Object.entries(propsStyleAttributes)) {
|
|
77
|
+
let value = null;
|
|
78
|
+
const possibleStyleAttributesList = styleAttributes.filter(styleAttribute => {
|
|
79
|
+
return propKey.startsWith(styleAttribute);
|
|
80
|
+
});
|
|
81
|
+
const styleAttributeKey = maxBy(possibleStyleAttributesList, 'length');
|
|
82
|
+
const isStyleForCurrentDevice = propKey.toLowerCase().endsWith(currentDevice.toLowerCase());
|
|
72
83
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
// e.g. "GridWrapperInner"
|
|
85
|
+
const targetElementKey = removeDeviceType(propKey.replace(styleAttributeKey, ''));
|
|
86
|
+
const targetElementGroupKey = camelCase(targetElementKey) || 'styles';
|
|
87
|
+
if (!resultStylesGroups[targetElementGroupKey]) {
|
|
88
|
+
resultStylesGroups[targetElementGroupKey] = {};
|
|
89
|
+
}
|
|
90
|
+
if (isStyleForCurrentDevice) {
|
|
91
|
+
value = propValue;
|
|
92
|
+
} else {
|
|
93
|
+
const propKeyWithOutDeviceType = `${styleAttributeKey}${targetElementKey}`;
|
|
94
|
+
const propKeyWithBaseDeviceType = `${propKeyWithOutDeviceType}${deviceBasePart}`;
|
|
95
|
+
const defaultValue = props[propKeyWithBaseDeviceType] || props[propKeyWithOutDeviceType];
|
|
96
|
+
let currentValue = resultStylesGroups[targetElementGroupKey][styleAttributeKey];
|
|
97
|
+
if (propKeyWithOutDeviceType.includes('Horizontal')) {
|
|
98
|
+
const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
|
|
99
|
+
currentValue = resultStylesGroups[targetElementGroupKey][keyLeft];
|
|
100
|
+
} else if (propKeyWithOutDeviceType.includes('Vertical')) {
|
|
101
|
+
const keyTop = styleAttributeKey.replace('Vertical', 'Top');
|
|
102
|
+
currentValue = resultStylesGroups[targetElementGroupKey][keyTop];
|
|
78
103
|
}
|
|
79
|
-
if (
|
|
80
|
-
value =
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const keyTop = currentStyleAttribute.replace('Vertical', 'Top');
|
|
91
|
-
currentValue = resultStyles[targetElementResultKey][keyTop];
|
|
92
|
-
}
|
|
93
|
-
if (!currentValue) {
|
|
94
|
-
value = defaultValue;
|
|
95
|
-
}
|
|
104
|
+
if (!currentValue) {
|
|
105
|
+
value = defaultValue;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (value) {
|
|
109
|
+
// TODO: handle 16px/9px propValues for Horizontal(Left/Right) and Vertical(Top/Bottom)
|
|
110
|
+
const HAS_UNIT = /\D/;
|
|
111
|
+
// prettier-ignore
|
|
112
|
+
const ignorePX = styleAttributeKey.includes('zIndex') || styleAttributeKey.includes('order');
|
|
113
|
+
if (!HAS_UNIT.test(value) && !ignorePX) {
|
|
114
|
+
value = `${value}px`;
|
|
96
115
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
resultStyles[targetElementResultKey][keyRight] = value;
|
|
110
|
-
} else if (currentStyleAttribute.includes('Vertical')) {
|
|
111
|
-
const keyTop = currentStyleAttribute.replace('Vertical', 'Top');
|
|
112
|
-
const keyBottom = currentStyleAttribute.replace('Vertical', 'Bottom');
|
|
113
|
-
resultStyles[targetElementResultKey][keyTop] = value;
|
|
114
|
-
resultStyles[targetElementResultKey][keyBottom] = value;
|
|
115
|
-
} else {
|
|
116
|
-
resultStyles[targetElementResultKey][currentStyleAttribute] = value;
|
|
117
|
-
}
|
|
116
|
+
if (styleAttributeKey.includes('Horizontal')) {
|
|
117
|
+
const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
|
|
118
|
+
const keyRight = styleAttributeKey.replace('Horizontal', 'Right');
|
|
119
|
+
resultStylesGroups[targetElementGroupKey][keyLeft] = value;
|
|
120
|
+
resultStylesGroups[targetElementGroupKey][keyRight] = value;
|
|
121
|
+
} else if (styleAttributeKey.includes('Vertical')) {
|
|
122
|
+
const keyTop = styleAttributeKey.replace('Vertical', 'Top');
|
|
123
|
+
const keyBottom = styleAttributeKey.replace('Vertical', 'Bottom');
|
|
124
|
+
resultStylesGroups[targetElementGroupKey][keyTop] = value;
|
|
125
|
+
resultStylesGroups[targetElementGroupKey][keyBottom] = value;
|
|
126
|
+
} else {
|
|
127
|
+
resultStylesGroups[targetElementGroupKey][styleAttributeKey] = value;
|
|
118
128
|
}
|
|
119
129
|
}
|
|
120
|
-
}
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
}
|
|
131
|
+
return resultStylesGroups;
|
|
132
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
133
|
+
}, [deviceBasePart, currentDevice, ...Object.values(propsStyleAttributes)]);
|
|
124
134
|
return collectedStyles;
|
|
125
135
|
}
|
|
126
136
|
|