@itcase/ui 1.9.51 → 1.9.52
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/{Avatar_cjs_CZ0XJ6d2.js → Avatar_cjs_CvbURI0f.js} +1 -1
- package/dist/{Avatar_es_B2gMldVe.js → Avatar_es_CV-ffIJu.js} +1 -1
- package/dist/{ChipsGroup_cjs_D0xy5I4S.js → ChipsGroup_cjs_CE-nNENH.js} +2 -4
- package/dist/{ChipsGroup_es_C_dgXLfC.js → ChipsGroup_es_CxqwFgoo.js} +2 -4
- package/dist/{Image_cjs_C_FMjUjx.js → Image_cjs_Hvjp2QDB.js} +2 -2
- package/dist/{Image_es_Ca7UQOkj.js → Image_es_DpOCNWpn.js} +2 -2
- package/dist/{SelectContainer_cjs_DshFNYWN.js → SelectContainer_cjs_qWAMLIkz.js} +5 -5
- package/dist/{SelectContainer_es_BQ3-SqL2.js → SelectContainer_es_kRH4DsEh.js} +5 -5
- package/dist/cjs/components/Avatar.js +2 -2
- package/dist/cjs/components/AvatarStack.js +2 -2
- package/dist/cjs/components/Checkbox.js +47 -50
- package/dist/cjs/components/Checkmark.js +31 -6
- package/dist/cjs/components/Chips.js +1 -1
- package/dist/cjs/components/DatePeriod.js +8 -8
- package/dist/cjs/components/DatePicker.js +4 -4
- package/dist/cjs/components/Drawer.js +23 -24
- package/dist/cjs/components/Image.js +1 -1
- package/dist/cjs/components/InputPassword.js +1 -1
- package/dist/cjs/components/Select/stories/__mock__.js +4 -4
- package/dist/cjs/components/Select.js +2 -2
- package/dist/cjs/components/Tile.js +2 -1
- package/dist/cjs/context/Notifications.js +1 -1
- package/dist/cjs/context/UIContext.js +7 -1
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.helpers.js +9 -9
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.js +3 -3
- package/dist/cjs/hooks/useStyles/styleAttributes.js +166 -43
- package/dist/cjs/hooks/useStyles/useStyles.js +169 -155
- package/dist/cjs/utils/mergeAppearanceKeys.js +14 -1
- package/dist/components/Avatar.js +2 -2
- package/dist/components/AvatarStack.js +2 -2
- package/dist/components/Checkbox.js +47 -50
- package/dist/components/Checkmark.js +31 -6
- package/dist/components/Chips.js +1 -1
- package/dist/components/DatePeriod.js +8 -8
- package/dist/components/DatePicker.js +4 -4
- package/dist/components/Drawer.js +23 -24
- package/dist/components/Image.js +1 -1
- package/dist/components/InputPassword.js +1 -1
- package/dist/components/Select/stories/__mock__.js +4 -4
- package/dist/components/Select.js +2 -2
- package/dist/components/Tile.js +2 -1
- package/dist/context/Notifications.js +1 -1
- package/dist/context/UIContext.js +7 -1
- package/dist/css/styles/bundles.css +102 -97
- package/dist/hooks/useActiveClasses/useActiveClasses.helpers.js +9 -9
- package/dist/hooks/useActiveClasses/useActiveClasses.js +3 -3
- package/dist/hooks/useStyles/styleAttributes.js +166 -43
- package/dist/hooks/useStyles/useStyles.js +169 -155
- package/dist/types/components/Avatar/Avatar.interface.d.ts +2 -2
- package/dist/types/components/AvatarStack/AvatarStack.interface.d.ts +9 -15
- package/dist/types/components/Breadcrumbs/Breadcrumbs.interface.d.ts +9 -8
- package/dist/types/components/Checkbox/Checkbox.interface.d.ts +3 -3
- package/dist/types/components/Checkbox/appearance/checkboxShape.d.ts +3 -0
- package/dist/types/components/Checkmark/Checkmark.interface.d.ts +8 -2
- package/dist/types/components/Checkmark/appearance/checkmarkError.d.ts +3 -0
- package/dist/types/components/Checkmark/stories/CheckmarkError.stories.d.ts +23 -0
- package/dist/types/components/Chips/Chips.interface.d.ts +2 -2
- package/dist/types/components/DatePeriod/DatePeriod.interface.d.ts +20 -19
- package/dist/types/components/DatePeriod/stories/DatePeriodSize.stories.d.ts +3 -0
- package/dist/types/components/DatePicker/DatePicker.interface.d.ts +4 -3
- package/dist/types/components/HeroTitle/HeroTitle.interface.d.ts +1 -1
- package/dist/types/components/Link/Link.interface.d.ts +1 -1
- package/dist/types/components/List/List.interface.d.ts +1 -1
- package/dist/types/components/Loader/Loader.interface.d.ts +4 -3
- package/dist/types/components/MenuItem/MenuItem.interface.d.ts +1 -1
- package/dist/types/components/Notification/Notification.interface.d.ts +2 -2
- package/dist/types/components/Search/Search.interface.d.ts +10 -9
- package/dist/types/components/Search/SearchInput.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputDefault.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputDemo.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputDisabled.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputError.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputRequire.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputShape.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputSize.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputStyle.stories.d.ts +7 -7
- package/dist/types/components/Search/stories/SearchInputSuccess.stories.d.ts +7 -7
- package/dist/types/components/Select/Select.interface.d.ts +9 -7
- package/dist/types/components/Select/SelectContainer.d.ts +4 -1
- package/dist/types/components/Select/SelectMultiValue.d.ts +2 -2
- package/dist/types/components/Select/stories/Select.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectDefault.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectDisabled.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectError.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectRequire.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectShape.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectSize.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectStyle.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/SelectSuccess.stories.d.ts +5 -3
- package/dist/types/components/Select/stories/__mock__/index.d.ts +2 -2
- package/dist/types/components/Swiper/Swiper.interface.d.ts +2 -11
- package/dist/types/components/Text/Text.interface.d.ts +2 -2
- package/dist/types/context/Notifications.d.ts +1 -1
- package/dist/types/context/Notifications.interface.d.ts +2 -1
- package/dist/types/context/UIContext.d.ts +10 -4
- package/dist/types/hooks/useActiveClasses/useActiveClasses.interface.d.ts +1 -2
- package/dist/types/hooks/useStyles/styleAttributes.d.ts +2 -3
- package/dist/types/hooks/useStyles/styleAttributes.interface.d.ts +9 -3
- package/dist/types/hooks/useStyles/useStyles.d.ts +4 -1
- package/dist/types/utils/mergeAppearanceKeys.d.ts +6 -1
- package/dist/utils/mergeAppearanceKeys.js +14 -1
- package/package.json +12 -12
- package/dist/{DatePicker_cjs_avA-OHmZ.js → DatePicker_cjs_BJzVpk0o.js} +3 -3
- package/dist/{DatePicker_es_ungoFvip.js → DatePicker_es_BP0iWHMt.js} +3 -3
|
@@ -24,167 +24,181 @@ require('../../utils/setViewportProperty.js');
|
|
|
24
24
|
* paddingHorizontalGridInnerWrapperMobileNormal: "10px"
|
|
25
25
|
*/
|
|
26
26
|
function useStyles(props) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
27
|
+
const { deviceCurrentMainType, deviceCurrentType, deviceTypesList } = UIContext.useUserDeviceContext();
|
|
28
|
+
const propsStyleAttributes = React.useMemo(() => {
|
|
29
|
+
const styles = Object.entries(props).reduce((result, [propKey, propValue]) => {
|
|
30
|
+
const styleAttributeKey = getTargetStyleAttributeKey(propKey, propValue);
|
|
31
|
+
if (styleAttributeKey) {
|
|
32
|
+
result[propKey] = propValue;
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}, {});
|
|
36
|
+
return styles;
|
|
37
|
+
// "props" object maybe big and frequently changing
|
|
38
|
+
}, [props]);
|
|
39
|
+
const collectedStyles = React.useMemo(() => {
|
|
40
|
+
const resultStylesGroups = {};
|
|
41
|
+
for (const [propKey, propValue] of Object.entries(propsStyleAttributes)) {
|
|
42
|
+
let value = null;
|
|
43
|
+
const styleAttributeKey = getTargetStyleAttributeKey(propKey, propValue);
|
|
44
|
+
const isStyleForCurrentDevice = propKey
|
|
45
|
+
.toLowerCase()
|
|
46
|
+
.endsWith(deviceCurrentType.toLowerCase());
|
|
47
|
+
// e.g. "GridWrapperInner"
|
|
48
|
+
const targetElementKey = removeDeviceType(propKey.replace(styleAttributeKey, ''), deviceTypesList);
|
|
49
|
+
const targetElementGroupKey = camelCase(targetElementKey) || 'styles';
|
|
50
|
+
if (!resultStylesGroups[targetElementGroupKey]) {
|
|
51
|
+
resultStylesGroups[targetElementGroupKey] = {};
|
|
52
|
+
}
|
|
53
|
+
if (isStyleForCurrentDevice) {
|
|
54
|
+
value = propValue;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const propKeyWithOutDeviceType = `${styleAttributeKey}${targetElementKey}`;
|
|
58
|
+
const propKeyWithBaseDeviceType = `${propKeyWithOutDeviceType}${upperFirst(deviceCurrentMainType)}`;
|
|
59
|
+
const defaultValue = props[propKeyWithBaseDeviceType] || props[propKeyWithOutDeviceType];
|
|
60
|
+
let currentValue = resultStylesGroups[targetElementGroupKey][styleAttributeKey];
|
|
61
|
+
if (propKeyWithOutDeviceType.includes('Horizontal')) {
|
|
62
|
+
const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
|
|
63
|
+
currentValue =
|
|
64
|
+
resultStylesGroups[targetElementGroupKey][keyLeft];
|
|
65
|
+
}
|
|
66
|
+
else if (propKeyWithOutDeviceType.includes('Vertical')) {
|
|
67
|
+
const keyTop = styleAttributeKey.replace('Vertical', 'Top');
|
|
68
|
+
currentValue =
|
|
69
|
+
resultStylesGroups[targetElementGroupKey][keyTop];
|
|
70
|
+
}
|
|
71
|
+
if (!currentValue) {
|
|
72
|
+
value = defaultValue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (value) {
|
|
76
|
+
// Check not digit symbols. Chars means some unit ("px", "em", "rem" or custom "m")
|
|
77
|
+
const isValueHasUnit = /\D/.test(value);
|
|
78
|
+
// If value has some unit
|
|
79
|
+
if (isValueHasUnit) {
|
|
80
|
+
// Check value on our custom "m"(module) unit
|
|
81
|
+
/** Pattern for:
|
|
82
|
+
* 1m
|
|
83
|
+
* 1.5m
|
|
84
|
+
* 1m 1m 1.5m
|
|
85
|
+
* 0 0 1m 1m
|
|
86
|
+
*/
|
|
87
|
+
const isValueHasModuleUnit = /\d+\.?\d*m\s?(?![a-zA-Z]+)/.test(value);
|
|
88
|
+
// If value has module unit
|
|
89
|
+
if (isValueHasModuleUnit) {
|
|
90
|
+
/** Order for shorthand properties:
|
|
91
|
+
* top
|
|
92
|
+
* right
|
|
93
|
+
* bottom
|
|
94
|
+
* left
|
|
95
|
+
* or:
|
|
96
|
+
* top
|
|
97
|
+
* right and left
|
|
98
|
+
* bottom
|
|
99
|
+
* or:
|
|
100
|
+
* top and bottom
|
|
101
|
+
* right and left
|
|
102
|
+
*/
|
|
103
|
+
const valuePxPartsList = value
|
|
104
|
+
.split(' ')
|
|
105
|
+
.map((valuePart) => {
|
|
106
|
+
const valueModule = valuePart.replace(/[a-z]/gi, '');
|
|
107
|
+
const valuePx = parseFloat(valueModule) * 8;
|
|
108
|
+
return `${valuePx}px`;
|
|
109
|
+
}, []);
|
|
110
|
+
value = valuePxPartsList.join(' ');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Some properties doesn't have any units
|
|
115
|
+
const ignorePX = ['zIndex', 'order', 'flexGrow'].includes(styleAttributeKey);
|
|
116
|
+
if (!ignorePX) {
|
|
117
|
+
// Add px to non-unit value
|
|
118
|
+
value = `${value}px`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (styleAttributeKey.includes('Horizontal')) {
|
|
122
|
+
const keyRight = styleAttributeKey.replace('Horizontal', 'Right');
|
|
123
|
+
const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
|
|
124
|
+
const valuePartsList = value.split(' ');
|
|
125
|
+
const valueRight = valuePartsList[0];
|
|
126
|
+
const valueLeft = valuePartsList[1] || valuePartsList[0];
|
|
127
|
+
resultStylesGroups[targetElementGroupKey][keyRight] = valueRight;
|
|
128
|
+
resultStylesGroups[targetElementGroupKey][keyLeft] = valueLeft;
|
|
129
|
+
}
|
|
130
|
+
else if (styleAttributeKey.includes('Vertical')) {
|
|
131
|
+
const keyTop = styleAttributeKey.replace('Vertical', 'Top');
|
|
132
|
+
const keyBottom = styleAttributeKey.replace('Vertical', 'Bottom');
|
|
133
|
+
const valuePartsList = value.split(' ');
|
|
134
|
+
const valueTop = valuePartsList[0];
|
|
135
|
+
const valueBottom = valuePartsList[1] || valuePartsList[0];
|
|
136
|
+
resultStylesGroups[targetElementGroupKey][keyTop] = valueTop;
|
|
137
|
+
resultStylesGroups[targetElementGroupKey][keyBottom] = valueBottom;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
resultStylesGroups[targetElementGroupKey][styleAttributeKey] = value;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
68
143
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (isValueHasUnit) {
|
|
78
|
-
// Check value on our custom "m"(module) unit
|
|
79
|
-
/** Pattern for:
|
|
80
|
-
* 1m
|
|
81
|
-
* 1.5m
|
|
82
|
-
* 1m 1m 1.5m
|
|
83
|
-
* 0 0 1m 1m
|
|
84
|
-
*/
|
|
85
|
-
const isValueHasModuleUnit = /\d+\.?\d*m\s?(?![a-zA-Z]+)/.test(value);
|
|
86
|
-
// If value has module unit
|
|
87
|
-
if (isValueHasModuleUnit) {
|
|
88
|
-
/** Order for shorthand properties:
|
|
89
|
-
* top
|
|
90
|
-
* right
|
|
91
|
-
* bottom
|
|
92
|
-
* left
|
|
93
|
-
* or:
|
|
94
|
-
* top
|
|
95
|
-
* right and left
|
|
96
|
-
* bottom
|
|
97
|
-
* or:
|
|
98
|
-
* top and bottom
|
|
99
|
-
* right and left
|
|
100
|
-
*/
|
|
101
|
-
const valuePxPartsList = value.split(' ').map(valuePart => {
|
|
102
|
-
const valueModule = valuePart.replace(/[a-z]/gi, '');
|
|
103
|
-
const valuePx = parseFloat(valueModule) * 8;
|
|
104
|
-
return `${valuePx}px`;
|
|
105
|
-
}, []);
|
|
106
|
-
value = valuePxPartsList.join(' ');
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
// Some properties doesn't have any units
|
|
110
|
-
const ignorePX = ['zIndex', 'order', 'flexGrow'].includes(styleAttributeKey);
|
|
111
|
-
if (!ignorePX) {
|
|
112
|
-
// Add px to non-unit value
|
|
113
|
-
value = `${value}px`;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (styleAttributeKey.includes('Horizontal')) {
|
|
117
|
-
const keyRight = styleAttributeKey.replace('Horizontal', 'Right');
|
|
118
|
-
const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
|
|
119
|
-
const valuePartsList = value.split(' ');
|
|
120
|
-
const valueRight = valuePartsList[0];
|
|
121
|
-
const valueLeft = valuePartsList[1] || valuePartsList[0];
|
|
122
|
-
resultStylesGroups[targetElementGroupKey][keyRight] = valueRight;
|
|
123
|
-
resultStylesGroups[targetElementGroupKey][keyLeft] = valueLeft;
|
|
124
|
-
} else if (styleAttributeKey.includes('Vertical')) {
|
|
125
|
-
const keyTop = styleAttributeKey.replace('Vertical', 'Top');
|
|
126
|
-
const keyBottom = styleAttributeKey.replace('Vertical', 'Bottom');
|
|
127
|
-
const valuePartsList = value.split(' ');
|
|
128
|
-
const valueTop = valuePartsList[0];
|
|
129
|
-
const valueBottom = valuePartsList[1] || valuePartsList[0];
|
|
130
|
-
resultStylesGroups[targetElementGroupKey][keyTop] = valueTop;
|
|
131
|
-
resultStylesGroups[targetElementGroupKey][keyBottom] = valueBottom;
|
|
132
|
-
} else {
|
|
133
|
-
resultStylesGroups[targetElementGroupKey][styleAttributeKey] = value;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return resultStylesGroups;
|
|
138
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
139
|
-
}, [deviceCurrentMainType, deviceCurrentType, ...Object.values(propsStyleAttributes)]);
|
|
140
|
-
return collectedStyles;
|
|
144
|
+
return resultStylesGroups;
|
|
145
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
146
|
+
}, [
|
|
147
|
+
deviceCurrentMainType,
|
|
148
|
+
deviceCurrentType,
|
|
149
|
+
...Object.values(propsStyleAttributes),
|
|
150
|
+
]);
|
|
151
|
+
return collectedStyles;
|
|
141
152
|
}
|
|
142
153
|
const removeDeviceType = (originalKey, deviceTypesList) => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
154
|
+
// Remove "mobile"/"tablet"/"desktop"
|
|
155
|
+
const withOutDeviceType = deviceTypesList.reduce((cleanKey, deviceType) => {
|
|
156
|
+
if (cleanKey.endsWith(upperFirst(deviceType))) {
|
|
157
|
+
return cleanKey.replace(upperFirst(deviceType), '');
|
|
158
|
+
}
|
|
159
|
+
return cleanKey;
|
|
160
|
+
}, originalKey);
|
|
161
|
+
return withOutDeviceType;
|
|
151
162
|
};
|
|
152
163
|
const getTargetStyleAttributeKey = (styleKey, styleValue = '') => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
// Collect list of possible styles for propKey. e.g:
|
|
165
|
+
// "borderLeftWidthWrapperInnerMobileNormal" to ["border", "borderLeftWidth"]
|
|
166
|
+
const possibleStyleAttributesList = styleAttributes.default.filter((styleAttribute) => {
|
|
167
|
+
// Attribute can be array with key on first position and params on second
|
|
168
|
+
if (Array.isArray(styleAttribute)) {
|
|
169
|
+
// First item always attribute key (e.g. border, width, etc)
|
|
170
|
+
const styleAttributeKey = styleAttribute[0];
|
|
171
|
+
// Second item always params with some settings or methods
|
|
172
|
+
const styleAttributeParams = styleAttribute[1] || {};
|
|
173
|
+
// If is target attribute key
|
|
174
|
+
if (styleKey.startsWith(styleAttributeKey)) {
|
|
175
|
+
// If target attribute params has validate method
|
|
176
|
+
if (styleAttributeParams.validate) {
|
|
177
|
+
// Return validation result for target attribute
|
|
178
|
+
return styleAttributeParams.validate(styleValue);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
// Or always add to list
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// Else ignore
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
// If is target attribute
|
|
192
|
+
return styleKey.startsWith(String(styleAttribute));
|
|
171
193
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
});
|
|
181
|
-
// Get longest style key (e.g. "borderLeftWidth")
|
|
182
|
-
const targetStyleAttribute = maxBy(possibleStyleAttributesList, styleAttribute => {
|
|
183
|
-
const key = index_helpers.getStyleAttributeKey(styleAttribute);
|
|
184
|
-
return key.length;
|
|
185
|
-
});
|
|
186
|
-
const styleAttributeKey = index_helpers.getStyleAttributeKey(targetStyleAttribute);
|
|
187
|
-
return styleAttributeKey;
|
|
194
|
+
});
|
|
195
|
+
// Get longest style key (e.g. "borderLeftWidth")
|
|
196
|
+
const targetStyleAttribute = maxBy(possibleStyleAttributesList, (styleAttribute) => {
|
|
197
|
+
const key = index_helpers.getStyleAttributeKey(styleAttribute);
|
|
198
|
+
return key.length;
|
|
199
|
+
});
|
|
200
|
+
const styleAttributeKey = index_helpers.getStyleAttributeKey(targetStyleAttribute);
|
|
201
|
+
return styleAttributeKey;
|
|
188
202
|
};
|
|
189
203
|
|
|
190
204
|
exports.useStyles = useStyles;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @example
|
|
5
|
+
* mergeAppearanceKeys(' ', '1', undefined, '2', '1') === '1 2'
|
|
6
|
+
*/
|
|
7
|
+
const mergeAppearanceKeys = (...appearances) => {
|
|
8
|
+
const trimmedAppearances = appearances
|
|
9
|
+
.map((appearance) => appearance?.trim())
|
|
10
|
+
.filter(Boolean);
|
|
11
|
+
if (trimmedAppearances.length < 2) {
|
|
12
|
+
return trimmedAppearances[0] ?? '';
|
|
13
|
+
}
|
|
14
|
+
const uniqueAppearances = Array.from(new Set(trimmedAppearances));
|
|
15
|
+
return uniqueAppearances.join(' ');
|
|
16
|
+
};
|
|
4
17
|
|
|
5
18
|
exports.mergeAppearanceKeys = mergeAppearanceKeys;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Avatar, a as avatarAppearance, b as avatarConfig } from '../
|
|
1
|
+
export { A as Avatar, a as avatarAppearance, b as avatarConfig } from '../Avatar_es_CV-ffIJu.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'clsx';
|
|
@@ -24,4 +24,4 @@ import '../hooks/useStyles/useStyles.js';
|
|
|
24
24
|
import 'lodash/maxBy';
|
|
25
25
|
import '../Link_es_BDAmhIzd.js';
|
|
26
26
|
import '../Text_es_DVNvU0m0.js';
|
|
27
|
-
import '../
|
|
27
|
+
import '../Image_es_DpOCNWpn.js';
|
|
@@ -4,7 +4,7 @@ import { mergeAppearanceKeys } from '../utils/mergeAppearanceKeys.js';
|
|
|
4
4
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
5
5
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
6
6
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
7
|
-
import { A as Avatar } from '../
|
|
7
|
+
import { A as Avatar } from '../Avatar_es_CV-ffIJu.js';
|
|
8
8
|
import { G as Group } from '../Group_es_Y1qBBLZU.js';
|
|
9
9
|
import { T as Text } from '../Text_es_DVNvU0m0.js';
|
|
10
10
|
import 'react';
|
|
@@ -26,7 +26,7 @@ import 'react-inlinesvg';
|
|
|
26
26
|
import '../hoc/urlWithAssetPrefix.js';
|
|
27
27
|
import '../context/UrlAssetPrefix.js';
|
|
28
28
|
import '../Link_es_BDAmhIzd.js';
|
|
29
|
-
import '../
|
|
29
|
+
import '../Image_es_DpOCNWpn.js';
|
|
30
30
|
|
|
31
31
|
const avatarStackAppearanceSize = {
|
|
32
32
|
size16: {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import { T as Text } from '../Text_es_DVNvU0m0.js';
|
|
3
4
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
4
5
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
5
|
-
import
|
|
6
|
+
import '../hooks/useStyles/useStyles.js';
|
|
6
7
|
import 'react';
|
|
7
8
|
import 'lodash/camelCase';
|
|
8
|
-
import 'lodash/
|
|
9
|
+
import 'lodash/maxBy';
|
|
9
10
|
import 'lodash/upperFirst';
|
|
10
11
|
import '../context/Notifications.js';
|
|
11
12
|
import 'uuid';
|
|
@@ -16,79 +17,79 @@ import 'react-responsive';
|
|
|
16
17
|
import '../utils/setViewportProperty.js';
|
|
17
18
|
import '../hooks.js';
|
|
18
19
|
import '../hooks/useStyles/styleAttributes.js';
|
|
19
|
-
import '
|
|
20
|
-
import 'lodash/maxBy';
|
|
20
|
+
import 'lodash/castArray';
|
|
21
21
|
|
|
22
22
|
const checkboxAppearanceDefault = {
|
|
23
23
|
defaultPrimary: {
|
|
24
|
+
fill: 'surfaceSecondary',
|
|
24
25
|
fillCheckbox: 'surfaceSecondary',
|
|
25
|
-
fillCheckboxActive: '
|
|
26
|
-
fillCheckboxActiveHover: '
|
|
26
|
+
fillCheckboxActive: 'surfaceQuaternary',
|
|
27
|
+
fillCheckboxActiveHover: 'surfaceActiveHoverTertiary',
|
|
27
28
|
fillCheckboxHover: 'surfaceHoverTertiary',
|
|
28
|
-
fillCheckmark: 'surfacePrimary',
|
|
29
29
|
labelTextColor: 'surfaceTextPrimary',
|
|
30
30
|
descTextColor: 'surfaceTextPrimary',
|
|
31
|
-
borderColorCheckbox: '
|
|
32
|
-
borderColorCheckboxActive: '
|
|
33
|
-
borderColorCheckboxActiveHover: '
|
|
31
|
+
borderColorCheckbox: 'surfaceBorderQuaternary',
|
|
32
|
+
borderColorCheckboxActive: 'surfaceBorderQuaternary',
|
|
33
|
+
borderColorCheckboxActiveHover: 'surfaceBorderActivePrimary',
|
|
34
34
|
borderColorCheckboxHover: 'surfaceBorderHoverPrimary',
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const checkboxAppearanceDisabled = {
|
|
39
39
|
disabledPrimary: {
|
|
40
|
-
fill: 'surfacePrimary',
|
|
41
|
-
borderColor: 'errorBorderQuaternary',
|
|
42
|
-
borderHover: 'errorBorderHoverQuaternary',
|
|
43
|
-
textColor: 'surfaceTextQuaternary',
|
|
44
|
-
},
|
|
45
|
-
disabledSecondary: {
|
|
46
40
|
fill: 'surfaceSecondary',
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
fillCheckbox: 'surfaceSecondary',
|
|
42
|
+
fillCheckboxActive: 'surfaceQuaternary',
|
|
43
|
+
fillCheckboxActiveHover: 'surfaceActiveHoverTertiary',
|
|
44
|
+
fillCheckboxHover: 'surfaceHoverTertiary',
|
|
45
|
+
labelTextColor: 'disabledTextSecondary',
|
|
46
|
+
descTextColor: 'disabledTextSecondary',
|
|
47
|
+
borderColorCheckbox: 'surfaceBorderQuaternary',
|
|
48
|
+
borderColorCheckboxActive: 'surfaceBorderQuaternary',
|
|
49
|
+
borderColorCheckboxActiveHover: 'surfaceBorderActivePrimary',
|
|
50
|
+
borderColorCheckboxHover: 'surfaceBorderHoverPrimary',
|
|
49
51
|
},
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
const checkboxAppearanceError = {
|
|
53
55
|
errorPrimary: {
|
|
54
56
|
fill: 'errorTertiary',
|
|
55
|
-
fillCheckbox: '
|
|
56
|
-
fillCheckboxActive: '
|
|
57
|
+
fillCheckbox: 'errorTertiary',
|
|
58
|
+
fillCheckboxActive: 'errorQuaternary',
|
|
57
59
|
fillCheckboxActiveHover: 'errorActiveHoverPrimary',
|
|
58
|
-
fillCheckboxHover: '
|
|
59
|
-
fillCheckmark: 'errorPrimary',
|
|
60
|
+
fillCheckboxHover: 'errorHoverTertiary',
|
|
60
61
|
labelTextColor: 'surfaceTextPrimary',
|
|
61
62
|
descTextColor: 'surfaceTextPrimary',
|
|
62
|
-
borderColorCheckbox: '
|
|
63
|
-
borderColorCheckboxActive: '
|
|
63
|
+
borderColorCheckbox: 'errorBorderQuaternary',
|
|
64
|
+
borderColorCheckboxActive: 'errorBorderActiveQuaternary',
|
|
64
65
|
borderColorCheckboxActiveHover: 'errorBorderActivePrimary',
|
|
65
66
|
borderColorCheckboxHover: 'errorBorderHoverPrimary',
|
|
66
67
|
},
|
|
67
|
-
errorSecondary: {
|
|
68
|
-
fill: 'errorSecondary',
|
|
69
|
-
borderColor: 'errorBorderTertiary',
|
|
70
|
-
borderHover: 'errorBorderHoverQuaternary',
|
|
71
|
-
},
|
|
72
68
|
};
|
|
73
69
|
|
|
74
70
|
const checkboxAppearanceRequire = {
|
|
75
71
|
requirePrimary: {
|
|
72
|
+
fill: 'warningTertiary',
|
|
76
73
|
fillCheckbox: 'warningTertiary',
|
|
77
|
-
fillCheckboxActive: '
|
|
78
|
-
fillCheckboxActiveHover: '
|
|
79
|
-
fillCheckboxHover: '
|
|
80
|
-
fillCheckmark: 'warningPrimary',
|
|
74
|
+
fillCheckboxActive: 'warningPrimary',
|
|
75
|
+
fillCheckboxActiveHover: 'warningActiveHoverPrimary',
|
|
76
|
+
fillCheckboxHover: 'warningHoverTertiary',
|
|
81
77
|
labelTextColor: 'surfaceTextPrimary',
|
|
82
78
|
descTextColor: 'surfaceTextPrimary',
|
|
83
|
-
borderColorCheckbox: '
|
|
84
|
-
borderColorCheckboxActive: '
|
|
79
|
+
borderColorCheckbox: 'warningBorderSecondary',
|
|
80
|
+
borderColorCheckboxActive: 'warningBorderSecondary',
|
|
85
81
|
borderColorCheckboxActiveHover: 'warningBorderActivePrimary',
|
|
86
82
|
borderColorCheckboxHover: 'warningBorderHoverPrimary',
|
|
87
83
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const checkboxAppearanceShape = {
|
|
87
|
+
rounded: {
|
|
88
|
+
shape: 'rounded',
|
|
89
|
+
},
|
|
90
|
+
roundedS: {
|
|
91
|
+
shape: 'rounded',
|
|
92
|
+
shapeStrength: '0_5m',
|
|
92
93
|
},
|
|
93
94
|
};
|
|
94
95
|
|
|
@@ -139,23 +140,18 @@ const checkboxAppearanceStyle = {
|
|
|
139
140
|
|
|
140
141
|
const checkboxAppearanceSuccess = {
|
|
141
142
|
successPrimary: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
fill: 'successTertiary',
|
|
144
|
+
fillCheckbox: 'successTertiary',
|
|
145
|
+
fillCheckboxActive: 'successSecondary',
|
|
146
|
+
fillCheckboxActiveHover: 'successActiveHoverPrimary',
|
|
145
147
|
fillCheckboxHover: 'successHoverTertiary',
|
|
146
|
-
fillCheckmark: 'successPrimary',
|
|
147
148
|
labelTextColor: 'surfaceTextPrimary',
|
|
148
149
|
descTextColor: 'surfaceTextPrimary',
|
|
149
|
-
borderColorCheckbox: '
|
|
150
|
-
borderColorCheckboxActive: '
|
|
150
|
+
borderColorCheckbox: 'successBorderSecondary',
|
|
151
|
+
borderColorCheckboxActive: 'successBorderSecondary',
|
|
151
152
|
borderColorCheckboxActiveHover: 'successBorderActivePrimary',
|
|
152
153
|
borderColorCheckboxHover: 'successBorderHoverPrimary',
|
|
153
154
|
},
|
|
154
|
-
successSecondary: {
|
|
155
|
-
fill: 'successSecondary',
|
|
156
|
-
borderColor: 'successBorderTertiary',
|
|
157
|
-
borderHover: 'successBorderHoverQuaternary',
|
|
158
|
-
},
|
|
159
155
|
};
|
|
160
156
|
|
|
161
157
|
const checkboxAppearance = {
|
|
@@ -166,6 +162,7 @@ const checkboxAppearance = {
|
|
|
166
162
|
...checkboxAppearanceDisabled,
|
|
167
163
|
...checkboxAppearanceSize,
|
|
168
164
|
...checkboxAppearanceStyle,
|
|
165
|
+
...checkboxAppearanceShape,
|
|
169
166
|
};
|
|
170
167
|
|
|
171
168
|
const checkboxConfig = {
|