@telefonica/mistica 10.19.0 → 10.20.0
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/CHANGELOG.md +7 -0
- package/dist/button.js +24 -8
- package/dist/card.js +25 -28
- package/dist/header.d.ts +2 -0
- package/dist/header.js.flow +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js.flow +1 -0
- package/dist/package-version.js +1 -1
- package/dist/skins/blau.d.ts +6 -3
- package/dist/skins/blau.js +34 -5
- package/dist/skins/blau.js.flow +6 -3
- package/dist/skins/movistar.d.ts +21 -11
- package/dist/skins/movistar.js +76 -40
- package/dist/skins/movistar.js.flow +21 -11
- package/dist/skins/o2-classic.d.ts +21 -9
- package/dist/skins/o2-classic.js +64 -26
- package/dist/skins/o2-classic.js.flow +21 -9
- package/dist/skins/o2.d.ts +19 -17
- package/dist/skins/o2.js +68 -40
- package/dist/skins/o2.js.flow +19 -17
- package/dist/skins/telefonica.d.ts +18 -13
- package/dist/skins/telefonica.js +76 -45
- package/dist/skins/telefonica.js.flow +18 -13
- package/dist/skins/types.d.ts +12 -0
- package/dist/skins/types.js.flow +12 -0
- package/dist/skins/vivo.d.ts +9 -4
- package/dist/skins/vivo.js +37 -6
- package/dist/skins/vivo.js.flow +9 -4
- package/dist/tag.d.ts +6 -1
- package/dist/tag.js +133 -24
- package/dist/tag.js.flow +15 -1
- package/dist/text.d.ts +4 -0
- package/dist/text.js +13 -6
- package/dist/text.js.flow +10 -0
- package/dist-es/button.js +24 -8
- package/dist-es/card.js +26 -29
- package/dist-es/package-version.js +1 -1
- package/dist-es/skins/blau.js +36 -5
- package/dist-es/skins/movistar.js +78 -40
- package/dist-es/skins/o2-classic.js +66 -26
- package/dist-es/skins/o2.js +70 -40
- package/dist-es/skins/telefonica.js +78 -45
- package/dist-es/skins/vivo.js +39 -6
- package/dist-es/tag.js +130 -26
- package/dist-es/text.js +13 -6
- package/package.json +1 -1
package/dist-es/skins/vivo.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { applyAlpha } from '../utils/color';
|
|
2
2
|
import { VIVO_SKIN } from './constants';
|
|
3
|
+
// https://github.com/Telefonica/mistica-design/blob/production/tokens/vivo-constants.json
|
|
4
|
+
// https://github.com/Telefonica/mistica-design/blob/production/tokens/vivo-skin-schema.json
|
|
3
5
|
export var palette = {
|
|
4
6
|
vivoPurple: '#660099',
|
|
5
7
|
vivoPurpleDark: '#461E5F',
|
|
@@ -9,16 +11,21 @@ export var palette = {
|
|
|
9
11
|
vivoPurpleLight20: '#E0CCEB',
|
|
10
12
|
vivoPurpleLight10: '#EFE5F4',
|
|
11
13
|
vivoGreen: '#99CC33',
|
|
12
|
-
vivoGreenDark: '#
|
|
13
|
-
|
|
14
|
+
vivoGreenDark: '#225C3D',
|
|
15
|
+
vivoGreenLight30: '#91AE9E',
|
|
16
|
+
vivoGreenLight10: '#EDF8E8',
|
|
14
17
|
vivoBlue: '#00ABDB',
|
|
15
18
|
orange: '#FF9900',
|
|
16
|
-
orangeDark: '#
|
|
17
|
-
|
|
19
|
+
orangeDark: '#972A1D',
|
|
20
|
+
orangeLight10: '#FFEFE1',
|
|
21
|
+
orangeLight40: '#FFB84C',
|
|
18
22
|
pink: '#EB3D7D',
|
|
19
23
|
pepper: '#CC1F59',
|
|
20
24
|
pepperDark: '#B71D63',
|
|
25
|
+
pepperDark80: '#8F2052',
|
|
26
|
+
pepperLight40: '#DB628B',
|
|
21
27
|
pepperLight30: '#F7B1CB',
|
|
28
|
+
pepperLight10: '#FCE4EF',
|
|
22
29
|
grey1: '#F6F6F6',
|
|
23
30
|
grey2: '#EEEEEE',
|
|
24
31
|
grey3: '#DDDDDD',
|
|
@@ -121,7 +128,20 @@ export var getVivoSkin = function() {
|
|
|
121
128
|
textNavigationSearchBarHint: palette.vivoPurpleLight50,
|
|
122
129
|
textNavigationSearchBarText: palette.white,
|
|
123
130
|
textAppBar: palette.grey4,
|
|
124
|
-
textAppBarSelected: palette.vivoPurple
|
|
131
|
+
textAppBarSelected: palette.vivoPurple,
|
|
132
|
+
// TAGS
|
|
133
|
+
tagBackgroundSuccess: palette.vivoGreenLight10,
|
|
134
|
+
tagBackgroundWarning: palette.orangeLight10,
|
|
135
|
+
tagBackgroundError: palette.pepperLight10,
|
|
136
|
+
tagBackgroundPromo: palette.vivoPurpleLight10,
|
|
137
|
+
tagBackgroundActive: palette.vivoPurpleLight10,
|
|
138
|
+
tagBackgroundInactive: palette.grey1,
|
|
139
|
+
textTagSuccess: palette.vivoGreenDark,
|
|
140
|
+
textTagWarning: palette.orangeDark,
|
|
141
|
+
textTagError: palette.pepperDark80,
|
|
142
|
+
textTagPromo: palette.vivoPurple,
|
|
143
|
+
textTagActive: palette.vivoPurple,
|
|
144
|
+
textTagInactive: palette.grey5
|
|
125
145
|
},
|
|
126
146
|
darkModeColors: {
|
|
127
147
|
appBarBackground: palette.darkModeGrey,
|
|
@@ -189,7 +209,20 @@ export var getVivoSkin = function() {
|
|
|
189
209
|
textNavigationSearchBarHint: palette.grey4,
|
|
190
210
|
textNavigationSearchBarText: palette.grey2,
|
|
191
211
|
textAppBar: palette.grey5,
|
|
192
|
-
textAppBarSelected: palette.grey2
|
|
212
|
+
textAppBarSelected: palette.grey2,
|
|
213
|
+
// TAGS
|
|
214
|
+
tagBackgroundSuccess: applyAlpha(palette.white, 0.05),
|
|
215
|
+
tagBackgroundWarning: applyAlpha(palette.white, 0.05),
|
|
216
|
+
tagBackgroundError: applyAlpha(palette.white, 0.05),
|
|
217
|
+
tagBackgroundPromo: applyAlpha(palette.white, 0.05),
|
|
218
|
+
tagBackgroundActive: applyAlpha(palette.white, 0.05),
|
|
219
|
+
tagBackgroundInactive: applyAlpha(palette.white, 0.05),
|
|
220
|
+
textTagSuccess: palette.vivoGreenLight30,
|
|
221
|
+
textTagWarning: palette.orangeLight40,
|
|
222
|
+
textTagError: palette.pepperLight40,
|
|
223
|
+
textTagPromo: palette.vivoPurpleLight50,
|
|
224
|
+
textTagActive: palette.vivoPurpleLight50,
|
|
225
|
+
textTagInactive: palette.grey4
|
|
193
226
|
}
|
|
194
227
|
};
|
|
195
228
|
};
|
package/dist-es/tag.js
CHANGED
|
@@ -1,46 +1,150 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from './box';
|
|
2
3
|
import { useTheme } from './hooks';
|
|
3
4
|
import { createUseStyles } from './jss';
|
|
4
5
|
import { Text } from './text';
|
|
5
|
-
import { ThemeVariant } from './theme-variant-context';
|
|
6
|
+
import { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
|
|
7
|
+
import { pxToRem } from './utils/css';
|
|
8
|
+
function _arrayWithHoles(arr) {
|
|
9
|
+
if (Array.isArray(arr)) return arr;
|
|
10
|
+
}
|
|
11
|
+
function _iterableToArrayLimit(arr, i) {
|
|
12
|
+
var _arr = [];
|
|
13
|
+
var _n = true;
|
|
14
|
+
var _d = false;
|
|
15
|
+
var _e = undefined;
|
|
16
|
+
try {
|
|
17
|
+
for(var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true){
|
|
18
|
+
_arr.push(_s.value);
|
|
19
|
+
if (i && _arr.length === i) break;
|
|
20
|
+
}
|
|
21
|
+
} catch (err) {
|
|
22
|
+
_d = true;
|
|
23
|
+
_e = err;
|
|
24
|
+
} finally{
|
|
25
|
+
try {
|
|
26
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
27
|
+
} finally{
|
|
28
|
+
if (_d) throw _e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return _arr;
|
|
32
|
+
}
|
|
33
|
+
function _nonIterableRest() {
|
|
34
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
35
|
+
}
|
|
36
|
+
function _slicedToArray(arr, i) {
|
|
37
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
|
38
|
+
}
|
|
6
39
|
var useStyles = createUseStyles(function() {
|
|
7
40
|
return {
|
|
8
41
|
tag: {
|
|
9
|
-
backgroundColor: function(param) {
|
|
10
|
-
var color = param.color;
|
|
11
|
-
return color;
|
|
12
|
-
},
|
|
13
|
-
padding: '2px 8px',
|
|
14
|
-
borderRadius: 2,
|
|
15
|
-
minWidth: 48,
|
|
16
42
|
display: 'inline-flex',
|
|
43
|
+
flexDirection: 'row',
|
|
17
44
|
alignItems: 'center',
|
|
18
|
-
|
|
45
|
+
borderRadius: 50,
|
|
46
|
+
justifyContent: 'center',
|
|
47
|
+
minWidth: 56,
|
|
48
|
+
padding: function(param) {
|
|
49
|
+
var hasIcon = param.hasIcon;
|
|
50
|
+
return "4px 12px 4px ".concat(hasIcon ? 8 : 12, "px");
|
|
51
|
+
},
|
|
52
|
+
// FIXME: remove this style and use an inline style for the icon once WEB-338 gets merged
|
|
53
|
+
'& svg': {
|
|
54
|
+
display: 'block'
|
|
55
|
+
}
|
|
19
56
|
}
|
|
20
57
|
};
|
|
21
58
|
});
|
|
22
59
|
var Tag = function(param) {
|
|
23
|
-
var children = param.children, color = param.color;
|
|
60
|
+
var Icon = param.Icon, children = param.children, _type = param.type, type = _type === void 0 ? 'promo' : _type, color = param.color;
|
|
24
61
|
var classes = useStyles({
|
|
25
|
-
|
|
62
|
+
hasIcon: !!Icon
|
|
26
63
|
});
|
|
27
64
|
var ref = useTheme(), colors = ref.colors, isDarkMode = ref.isDarkMode;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
65
|
+
var isInverse = useIsInverseVariant();
|
|
66
|
+
if (!children) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Legacy implementation
|
|
71
|
+
*
|
|
72
|
+
* @deprecated to be removed in the next major version
|
|
73
|
+
*/ if (color) {
|
|
74
|
+
// Hardcode black text in darkmode because there isn't a black text color constant that we can use in dark mode
|
|
75
|
+
var blackText = isDarkMode ? '#313235' : colors.textPrimary;
|
|
76
|
+
var textColor = color === colors.inverse ? blackText : colors.textPrimaryInverse;
|
|
77
|
+
return(/*#__PURE__*/ _jsx(ThemeVariant, {
|
|
34
78
|
isInverse: false,
|
|
35
|
-
children: /*#__PURE__*/ _jsx(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
79
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
80
|
+
className: classes.tag,
|
|
81
|
+
style: {
|
|
82
|
+
background: color
|
|
83
|
+
},
|
|
84
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
85
|
+
color: textColor,
|
|
86
|
+
size: 14,
|
|
87
|
+
lineHeight: 20,
|
|
88
|
+
weight: "medium",
|
|
89
|
+
truncate: true,
|
|
90
|
+
children: children
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
var tagTypeToColors = {
|
|
96
|
+
promo: [
|
|
97
|
+
colors.textTagPromo,
|
|
98
|
+
colors.tagBackgroundPromo
|
|
99
|
+
],
|
|
100
|
+
active: [
|
|
101
|
+
colors.textTagActive,
|
|
102
|
+
colors.tagBackgroundActive
|
|
103
|
+
],
|
|
104
|
+
inactive: [
|
|
105
|
+
colors.textTagInactive,
|
|
106
|
+
colors.tagBackgroundInactive
|
|
107
|
+
],
|
|
108
|
+
success: [
|
|
109
|
+
colors.textTagSuccess,
|
|
110
|
+
colors.tagBackgroundSuccess
|
|
111
|
+
],
|
|
112
|
+
warning: [
|
|
113
|
+
colors.textTagWarning,
|
|
114
|
+
colors.tagBackgroundWarning
|
|
115
|
+
],
|
|
116
|
+
error: [
|
|
117
|
+
colors.textTagError,
|
|
118
|
+
colors.tagBackgroundError
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
var _type1 = _slicedToArray(tagTypeToColors[type], 2), textColor = _type1[0], backgroundColor = _type1[1];
|
|
122
|
+
var shouldUseInverseBackground = isInverse && !isDarkMode;
|
|
123
|
+
return(/*#__PURE__*/ _jsxs("span", {
|
|
124
|
+
className: classes.tag,
|
|
125
|
+
style: {
|
|
126
|
+
background: shouldUseInverseBackground ? colors.inverse : backgroundColor
|
|
127
|
+
},
|
|
128
|
+
children: [
|
|
129
|
+
Icon && /*#__PURE__*/ _jsx(Box, {
|
|
130
|
+
paddingRight: 4,
|
|
131
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
132
|
+
color: textColor,
|
|
133
|
+
size: pxToRem(16)
|
|
134
|
+
})
|
|
135
|
+
}),
|
|
136
|
+
/*#__PURE__*/ _jsx(ThemeVariant, {
|
|
137
|
+
isInverse: false,
|
|
138
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
139
|
+
color: textColor,
|
|
140
|
+
size: 14,
|
|
141
|
+
lineHeight: 20,
|
|
142
|
+
weight: "medium",
|
|
143
|
+
truncate: true,
|
|
144
|
+
children: children
|
|
145
|
+
})
|
|
42
146
|
})
|
|
43
|
-
|
|
147
|
+
]
|
|
44
148
|
}));
|
|
45
149
|
};
|
|
46
150
|
export default Tag;
|
package/dist-es/text.js
CHANGED
|
@@ -52,7 +52,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
52
52
|
}
|
|
53
53
|
return 'initial';
|
|
54
54
|
};
|
|
55
|
-
var _color,
|
|
55
|
+
var _color, _decoration;
|
|
56
56
|
return {
|
|
57
57
|
text: _defineProperty({
|
|
58
58
|
lineHeight: function(param) {
|
|
@@ -60,8 +60,14 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
60
60
|
return pxToRem(desktopLineHeight);
|
|
61
61
|
},
|
|
62
62
|
textTransform: function(param) {
|
|
63
|
-
var uppercase = param.uppercase;
|
|
64
|
-
|
|
63
|
+
var uppercase = param.uppercase, transform = param.transform;
|
|
64
|
+
if (uppercase) {
|
|
65
|
+
return 'uppercase';
|
|
66
|
+
}
|
|
67
|
+
if (transform) {
|
|
68
|
+
return transform;
|
|
69
|
+
}
|
|
70
|
+
return 'inherit';
|
|
65
71
|
},
|
|
66
72
|
fontSize: function(param) {
|
|
67
73
|
var desktopSize = param.desktopSize;
|
|
@@ -76,7 +82,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
76
82
|
return isInverse ? (_color = inverseColorsMap[color]) !== null && _color !== void 0 ? _color : color : color;
|
|
77
83
|
},
|
|
78
84
|
textDecoration: function(p) {
|
|
79
|
-
return (
|
|
85
|
+
return (_decoration = p.decoration) !== null && _decoration !== void 0 ? _decoration : 'inherit';
|
|
80
86
|
},
|
|
81
87
|
letterSpacing: function(param) {
|
|
82
88
|
var letterSpacing = param.letterSpacing;
|
|
@@ -112,7 +118,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
112
118
|
};
|
|
113
119
|
});
|
|
114
120
|
export var Text = function(param) {
|
|
115
|
-
var weight = param.weight, color = param.color, textDecoration = param.textDecoration, truncate = param.truncate, uppercase = param.uppercase, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'];
|
|
121
|
+
var weight = param.weight, color = param.color, textDecoration = param.textDecoration, _decoration = param.decoration, decoration = _decoration === void 0 ? textDecoration : _decoration, truncate = param.truncate, uppercase = param.uppercase, transform = param.transform, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'];
|
|
116
122
|
var isInverse = useIsInverseVariant();
|
|
117
123
|
var classes = useStyles({
|
|
118
124
|
isInverse: isInverse,
|
|
@@ -122,8 +128,9 @@ export var Text = function(param) {
|
|
|
122
128
|
desktopLineHeight: desktopLineHeight,
|
|
123
129
|
weight: weight,
|
|
124
130
|
color: color,
|
|
125
|
-
|
|
131
|
+
decoration: decoration,
|
|
126
132
|
uppercase: uppercase,
|
|
133
|
+
transform: transform,
|
|
127
134
|
wordBreak: wordBreak,
|
|
128
135
|
letterSpacing: letterSpacing,
|
|
129
136
|
truncate: truncate
|