@telefonica/mistica 11.6.0 → 11.9.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/dist/avatar.d.ts +14 -0
- package/dist/avatar.js +239 -0
- package/dist/avatar.js.flow +16 -0
- package/dist/badge.d.ts +2 -0
- package/dist/badge.js +24 -7
- package/dist/badge.js.flow +2 -0
- package/dist/button.js +35 -10
- package/dist/image.d.ts +3 -1
- package/dist/image.js +76 -11
- package/dist/image.js.flow +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +16 -2
- package/dist/index.js.flow +3 -1
- package/dist/package-version.js +1 -1
- package/dist/password-field.js +9 -8
- package/dist/placeholder.d.ts +0 -4
- package/dist/placeholder.js +1 -13
- package/dist/placeholder.js.flow +0 -4
- package/dist/section-title.d.ts +3 -0
- package/dist/section-title.js +3 -1
- package/dist/section-title.js.flow +3 -0
- package/dist/text-link.js +18 -5
- package/dist/text.js +8 -2
- package/dist/theme-context-provider.js +2 -1
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js.flow +2 -0
- package/dist/title.d.ts +13 -0
- package/dist/title.js +87 -0
- package/dist/title.js.flow +18 -0
- package/dist/utils/analytics.d.ts +3 -0
- package/dist/utils/analytics.js +5 -1
- package/dist/utils/analytics.js.flow +3 -0
- package/dist/video.d.ts +1 -1
- package/dist/video.js +8 -6
- package/dist/video.js.flow +1 -1
- package/dist-es/avatar.js +208 -0
- package/dist-es/badge.js +24 -7
- package/dist-es/button.js +36 -11
- package/dist-es/image.js +77 -11
- package/dist-es/index.js +3 -1
- package/dist-es/package-version.js +1 -1
- package/dist-es/password-field.js +9 -8
- package/dist-es/placeholder.js +0 -11
- package/dist-es/section-title.js +3 -1
- package/dist-es/text-link.js +19 -6
- package/dist-es/text.js +8 -2
- package/dist-es/theme-context-provider.js +2 -1
- package/dist-es/title.js +54 -0
- package/dist-es/utils/analytics.js +5 -0
- package/dist-es/video.js +8 -6
- package/package.json +3 -3
- package/dist/icons/icon-visibility-off.d.ts +0 -7
- package/dist/icons/icon-visibility-off.js +0 -49
- package/dist/icons/icon-visibility-off.js.flow +0 -9
- package/dist/icons/icon-visibility.d.ts +0 -7
- package/dist/icons/icon-visibility.js +0 -49
- package/dist/icons/icon-visibility.js.flow +0 -9
- package/dist-es/icons/icon-visibility-off.js +0 -22
- package/dist-es/icons/icon-visibility.js +0 -22
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function _iterableToArrayLimit(arr, i) {
|
|
10
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
|
+
if (_i == null) return;
|
|
12
|
+
var _arr = [];
|
|
13
|
+
var _n = true;
|
|
14
|
+
var _d = false;
|
|
15
|
+
var _s, _e;
|
|
16
|
+
try {
|
|
17
|
+
for(_i = _i.call(arr); !(_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.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
|
+
}
|
|
36
|
+
function _objectWithoutProperties(source, excluded) {
|
|
37
|
+
if (source == null) return {};
|
|
38
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
39
|
+
var key, i;
|
|
40
|
+
if (Object.getOwnPropertySymbols) {
|
|
41
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
42
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
43
|
+
key = sourceSymbolKeys[i];
|
|
44
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
45
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
46
|
+
target[key] = source[key];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return target;
|
|
50
|
+
}
|
|
51
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
52
|
+
if (source == null) return {};
|
|
53
|
+
var target = {};
|
|
54
|
+
var sourceKeys = Object.keys(source);
|
|
55
|
+
var key, i;
|
|
56
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
57
|
+
key = sourceKeys[i];
|
|
58
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
59
|
+
target[key] = source[key];
|
|
60
|
+
}
|
|
61
|
+
return target;
|
|
62
|
+
}
|
|
63
|
+
function _slicedToArray(arr, i) {
|
|
64
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
65
|
+
}
|
|
66
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
67
|
+
if (!o) return;
|
|
68
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
69
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
70
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
71
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
72
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
73
|
+
}
|
|
74
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
75
|
+
// https://www.figma.com/file/U4ipIXOk64bdM5tSvaqPKS/%5BREADY%5D--Avatar?node-id=2%3A61
|
|
76
|
+
import * as React from "react";
|
|
77
|
+
import Badge from "./badge";
|
|
78
|
+
import IconUserAccountRegular from "./generated/mistica-icons/icon-user-account-regular";
|
|
79
|
+
import { useTheme } from "./hooks";
|
|
80
|
+
import { createUseStyles } from "./jss";
|
|
81
|
+
import { useIsInverseVariant } from "./theme-variant-context";
|
|
82
|
+
var useStyles = createUseStyles(function() {
|
|
83
|
+
return {
|
|
84
|
+
avatar: {
|
|
85
|
+
borderRadius: "50%",
|
|
86
|
+
display: "flex",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
color: function(param) {
|
|
90
|
+
var textColor = param.textColor;
|
|
91
|
+
return textColor;
|
|
92
|
+
},
|
|
93
|
+
background: function(param) {
|
|
94
|
+
var backgroundColor = param.backgroundColor;
|
|
95
|
+
return backgroundColor;
|
|
96
|
+
},
|
|
97
|
+
width: function(param) {
|
|
98
|
+
var size = param.size;
|
|
99
|
+
return size;
|
|
100
|
+
},
|
|
101
|
+
height: function(param) {
|
|
102
|
+
var size = param.size;
|
|
103
|
+
return size;
|
|
104
|
+
},
|
|
105
|
+
overflow: "hidden"
|
|
106
|
+
},
|
|
107
|
+
image: {
|
|
108
|
+
width: function(param) {
|
|
109
|
+
var size = param.size;
|
|
110
|
+
return size;
|
|
111
|
+
},
|
|
112
|
+
height: function(param) {
|
|
113
|
+
var size = param.size;
|
|
114
|
+
return size;
|
|
115
|
+
},
|
|
116
|
+
objectFit: "cover"
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* Returns a right/top distance for the badge.
|
|
122
|
+
* The badge will be placed over the avatar's edge
|
|
123
|
+
* This is calculated using the `radius * (1 - sin(45deg))` distance minus a
|
|
124
|
+
* constant offset that depends on the badge size
|
|
125
|
+
*/ var getBadgeDistance = function(size, badge) {
|
|
126
|
+
if (!badge) {
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
var radius = size / 2;
|
|
130
|
+
var badgeOffset = badge === true ? 5 : 10; // badge=true renders a small circle
|
|
131
|
+
return radius * (1 - Math.sin(Math.PI / 4)) - badgeOffset;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Not using TextPresets here because we don't want to scale the avatar text with the device settings
|
|
135
|
+
*/ var renderText = function(size, text) {
|
|
136
|
+
if (!text) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
var fontSize;
|
|
140
|
+
if (size <= 40) {
|
|
141
|
+
fontSize = 14;
|
|
142
|
+
} else if (size <= 64) {
|
|
143
|
+
fontSize = 16;
|
|
144
|
+
} else {
|
|
145
|
+
fontSize = 18;
|
|
146
|
+
}
|
|
147
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
148
|
+
style: {
|
|
149
|
+
fontSize: fontSize,
|
|
150
|
+
textTransform: "uppercase"
|
|
151
|
+
},
|
|
152
|
+
children: text
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
var Avatar = function(_param) {
|
|
156
|
+
var size = _param.size, src = _param.src, _Icon = _param.Icon, Icon = _Icon === void 0 ? IconUserAccountRegular : _Icon, badge = _param.badge, _initials = _param.initials, initials = _initials === void 0 ? "" : _initials, ariaLabel = _param["aria-label"], props = _objectWithoutProperties(_param, [
|
|
157
|
+
"size",
|
|
158
|
+
"src",
|
|
159
|
+
"Icon",
|
|
160
|
+
"badge",
|
|
161
|
+
"initials",
|
|
162
|
+
"aria-label"
|
|
163
|
+
]);
|
|
164
|
+
var colors = useTheme().colors;
|
|
165
|
+
var isInverse = useIsInverseVariant();
|
|
166
|
+
var _backgroundColor;
|
|
167
|
+
var backgroundColor = (_backgroundColor = props.backgroundColor) !== null && _backgroundColor !== void 0 ? _backgroundColor : isInverse ? colors.brandDark : colors.tagBackgroundActive;
|
|
168
|
+
var _textColor;
|
|
169
|
+
var textColor = (_textColor = props.textColor) !== null && _textColor !== void 0 ? _textColor : isInverse ? colors.textPrimaryInverse : colors.textTagActive;
|
|
170
|
+
var ref = _slicedToArray(React.useState(false), 2), imgLoadError = ref[0], setImgLoadError = ref[1];
|
|
171
|
+
var classes = useStyles({
|
|
172
|
+
textColor: textColor,
|
|
173
|
+
backgroundColor: backgroundColor,
|
|
174
|
+
size: size
|
|
175
|
+
});
|
|
176
|
+
React.useEffect(function() {
|
|
177
|
+
setImgLoadError(false); // reset error state when url changes
|
|
178
|
+
}, [
|
|
179
|
+
src
|
|
180
|
+
]);
|
|
181
|
+
var letters = initials.trim().slice(0, 2);
|
|
182
|
+
var badgePosition = getBadgeDistance(size, badge);
|
|
183
|
+
var badgeValue = badge === true ? undefined : badge || 0;
|
|
184
|
+
var shouldRenderImage = !!src && !imgLoadError;
|
|
185
|
+
var iconSize = size <= 40 ? 16 : 24;
|
|
186
|
+
return /*#__PURE__*/ _jsx(Badge, {
|
|
187
|
+
value: badgeValue,
|
|
188
|
+
top: badgePosition,
|
|
189
|
+
right: badgePosition,
|
|
190
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
191
|
+
className: classes.avatar,
|
|
192
|
+
role: "img",
|
|
193
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : initials,
|
|
194
|
+
children: shouldRenderImage ? /*#__PURE__*/ _jsx("img", {
|
|
195
|
+
src: src,
|
|
196
|
+
className: classes.image,
|
|
197
|
+
onError: function() {
|
|
198
|
+
return setImgLoadError(true);
|
|
199
|
+
},
|
|
200
|
+
role: "none"
|
|
201
|
+
}) : renderText(size, letters) || /*#__PURE__*/ _jsx(Icon, {
|
|
202
|
+
size: iconSize,
|
|
203
|
+
color: "currentColor"
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
export default Avatar;
|
package/dist-es/badge.js
CHANGED
|
@@ -26,8 +26,14 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
26
26
|
var hasChildren = param.hasChildren;
|
|
27
27
|
return hasChildren ? "absolute" : "static";
|
|
28
28
|
},
|
|
29
|
-
top:
|
|
30
|
-
|
|
29
|
+
top: function(param) {
|
|
30
|
+
var top = param.top;
|
|
31
|
+
return top !== null && top !== void 0 ? top : -2;
|
|
32
|
+
},
|
|
33
|
+
right: function(param) {
|
|
34
|
+
var right = param.right;
|
|
35
|
+
return right !== null && right !== void 0 ? right : -6;
|
|
36
|
+
},
|
|
31
37
|
width: 8,
|
|
32
38
|
height: 8,
|
|
33
39
|
background: theme.colors.badge,
|
|
@@ -38,8 +44,14 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
38
44
|
display: "flex",
|
|
39
45
|
alignItems: "center",
|
|
40
46
|
justifyContent: "center",
|
|
41
|
-
top:
|
|
42
|
-
|
|
47
|
+
top: function(param) {
|
|
48
|
+
var top = param.top;
|
|
49
|
+
return top !== null && top !== void 0 ? top : -8;
|
|
50
|
+
},
|
|
51
|
+
right: function(param) {
|
|
52
|
+
var right = param.right;
|
|
53
|
+
return right !== null && right !== void 0 ? right : -9;
|
|
54
|
+
},
|
|
43
55
|
width: 18,
|
|
44
56
|
height: 18,
|
|
45
57
|
fontSize: 12,
|
|
@@ -47,7 +59,10 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
47
59
|
color: theme.colors.textPrimaryInverse
|
|
48
60
|
},
|
|
49
61
|
badgeBigNumber: {
|
|
50
|
-
right:
|
|
62
|
+
right: function(param) {
|
|
63
|
+
var right = param.right;
|
|
64
|
+
return right !== null && right !== void 0 ? right : -14;
|
|
65
|
+
},
|
|
51
66
|
width: 24,
|
|
52
67
|
borderRadius: 24
|
|
53
68
|
}
|
|
@@ -63,10 +78,12 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
63
78
|
* </IconButton>
|
|
64
79
|
* </Badge>
|
|
65
80
|
*/ var Badge = function(param) {
|
|
66
|
-
var children = param.children, value = param.value;
|
|
81
|
+
var children = param.children, value = param.value, right = param.right, top = param.top;
|
|
67
82
|
var hasChildren = !!children;
|
|
68
83
|
var classes = useStyles({
|
|
69
|
-
hasChildren: hasChildren
|
|
84
|
+
hasChildren: hasChildren,
|
|
85
|
+
right: right,
|
|
86
|
+
top: top
|
|
70
87
|
});
|
|
71
88
|
if (children && value === 0) {
|
|
72
89
|
return /*#__PURE__*/ _jsx(_Fragment, {
|
package/dist-es/button.js
CHANGED
|
@@ -84,7 +84,8 @@ import { pxToRem } from "./utils/css";
|
|
|
84
84
|
import { Text, Text2, Text3 } from "./text";
|
|
85
85
|
import Box from "./box";
|
|
86
86
|
import { getTextFromChildren } from "./utils/common";
|
|
87
|
-
import { eventActions, eventCategories } from "./utils/analytics";
|
|
87
|
+
import { eventActions, eventCategories, eventNames } from "./utils/analytics";
|
|
88
|
+
import { useTheme } from "./hooks";
|
|
88
89
|
export var BUTTON_MIN_WIDTH = 136;
|
|
89
90
|
var transitionTiming = "0.3s cubic-bezier(0.77, 0, 0.175, 1)";
|
|
90
91
|
var BORDER_PX = 1.5;
|
|
@@ -272,6 +273,7 @@ var useDangerButtonStyles = createUseStyles(function(theme) {
|
|
|
272
273
|
});
|
|
273
274
|
});
|
|
274
275
|
var Button = function(props) {
|
|
276
|
+
var analytics = useTheme().analytics;
|
|
275
277
|
var ref = useForm(), formStatus = ref.formStatus, formId = ref.formId;
|
|
276
278
|
var isInverse = useIsInverseVariant();
|
|
277
279
|
var classes = props.classes, loadingText = props.loadingText;
|
|
@@ -310,6 +312,21 @@ var Button = function(props) {
|
|
|
310
312
|
children: text
|
|
311
313
|
});
|
|
312
314
|
};
|
|
315
|
+
var createDefaultTrackingEvent = function() {
|
|
316
|
+
if (analytics.eventFormat === "google-analytics-4") {
|
|
317
|
+
return {
|
|
318
|
+
name: eventNames.userInteraction,
|
|
319
|
+
component_type: "".concat(props.type, "_button"),
|
|
320
|
+
component_copy: getTextFromChildren(props.children)
|
|
321
|
+
};
|
|
322
|
+
} else {
|
|
323
|
+
return {
|
|
324
|
+
category: eventCategories.userInteraction,
|
|
325
|
+
action: "".concat(props.type, "_button_tapped"),
|
|
326
|
+
label: getTextFromChildren(props.children)
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
};
|
|
313
330
|
var _trackingEvent;
|
|
314
331
|
var _obj;
|
|
315
332
|
var commonProps = {
|
|
@@ -317,11 +334,7 @@ var Button = function(props) {
|
|
|
317
334
|
style: _objectSpread({
|
|
318
335
|
cursor: props.fake ? "pointer" : undefined
|
|
319
336
|
}, props.style),
|
|
320
|
-
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ?
|
|
321
|
-
category: eventCategories.userInteraction,
|
|
322
|
-
action: "".concat(props.type, "_button_tapped"),
|
|
323
|
-
label: getTextFromChildren(props.children)
|
|
324
|
-
} : undefined,
|
|
337
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
|
|
325
338
|
dataAttributes: props.dataAttributes,
|
|
326
339
|
"aria-controls": props["aria-controls"],
|
|
327
340
|
"aria-expanded": props["aria-expanded"],
|
|
@@ -463,15 +476,27 @@ export var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
463
476
|
var formStatus = useForm().formStatus;
|
|
464
477
|
var classes = useButtonLinkStyles();
|
|
465
478
|
var isInverse = useIsInverseVariant();
|
|
479
|
+
var analytics = useTheme().analytics;
|
|
480
|
+
var createDefaultTrackingEvent = function() {
|
|
481
|
+
if (analytics.eventFormat === "google-analytics-4") {
|
|
482
|
+
return {
|
|
483
|
+
name: eventNames.userInteraction,
|
|
484
|
+
component_type: "link",
|
|
485
|
+
component_copy: getTextFromChildren(props.children)
|
|
486
|
+
};
|
|
487
|
+
} else {
|
|
488
|
+
return {
|
|
489
|
+
category: eventCategories.userInteraction,
|
|
490
|
+
action: eventActions.linkTapped,
|
|
491
|
+
label: getTextFromChildren(props.children)
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
};
|
|
466
495
|
var _trackingEvent;
|
|
467
496
|
var _obj;
|
|
468
497
|
var commonProps = {
|
|
469
498
|
className: classnames(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
|
|
470
|
-
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ?
|
|
471
|
-
category: eventCategories.userInteraction,
|
|
472
|
-
action: eventActions.linkTapped,
|
|
473
|
-
label: getTextFromChildren(props.children)
|
|
474
|
-
} : undefined,
|
|
499
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
|
|
475
500
|
dataAttributes: props.dataAttributes,
|
|
476
501
|
children: /*#__PURE__*/ _jsx(Text2, {
|
|
477
502
|
medium: true,
|
package/dist-es/image.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
1
9
|
function _defineProperty(obj, key, value) {
|
|
2
10
|
if (key in obj) {
|
|
3
11
|
Object.defineProperty(obj, key, {
|
|
@@ -11,6 +19,33 @@ function _defineProperty(obj, key, value) {
|
|
|
11
19
|
}
|
|
12
20
|
return obj;
|
|
13
21
|
}
|
|
22
|
+
function _iterableToArrayLimit(arr, i) {
|
|
23
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
24
|
+
if (_i == null) return;
|
|
25
|
+
var _arr = [];
|
|
26
|
+
var _n = true;
|
|
27
|
+
var _d = false;
|
|
28
|
+
var _s, _e;
|
|
29
|
+
try {
|
|
30
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
31
|
+
_arr.push(_s.value);
|
|
32
|
+
if (i && _arr.length === i) break;
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
_d = true;
|
|
36
|
+
_e = err;
|
|
37
|
+
} finally{
|
|
38
|
+
try {
|
|
39
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
40
|
+
} finally{
|
|
41
|
+
if (_d) throw _e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return _arr;
|
|
45
|
+
}
|
|
46
|
+
function _nonIterableRest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
14
49
|
function _objectSpread(target) {
|
|
15
50
|
for(var i = 1; i < arguments.length; i++){
|
|
16
51
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -53,6 +88,17 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
53
88
|
}
|
|
54
89
|
return target;
|
|
55
90
|
}
|
|
91
|
+
function _slicedToArray(arr, i) {
|
|
92
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
93
|
+
}
|
|
94
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
95
|
+
if (!o) return;
|
|
96
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
97
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
98
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
99
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
100
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
101
|
+
}
|
|
56
102
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
57
103
|
import * as React from "react";
|
|
58
104
|
import { createUseStyles } from "./jss";
|
|
@@ -79,22 +125,27 @@ var useStyles = createUseStyles(function() {
|
|
|
79
125
|
objectFit: "cover",
|
|
80
126
|
maxWidth: "100%",
|
|
81
127
|
maxHeight: "100%",
|
|
128
|
+
borderRadius: function(param) {
|
|
129
|
+
var noBorderRadius = param.noBorderRadius;
|
|
130
|
+
return noBorderRadius ? 0 : 4;
|
|
131
|
+
},
|
|
82
132
|
"@supports (aspect-ratio: 1 / 1)": {
|
|
83
|
-
borderRadius: function(param) {
|
|
84
|
-
var noBorderRadius = param.noBorderRadius;
|
|
85
|
-
return noBorderRadius ? 0 : 4;
|
|
86
|
-
},
|
|
87
133
|
aspectRatio: function(param) {
|
|
88
134
|
var aspectRatio = param.aspectRatio;
|
|
89
135
|
return aspectRatio !== null && aspectRatio !== void 0 ? aspectRatio : "unset";
|
|
90
136
|
}
|
|
91
137
|
},
|
|
92
138
|
"$wrapper &": {
|
|
139
|
+
borderRadius: 0,
|
|
93
140
|
position: "absolute",
|
|
94
141
|
width: "100%",
|
|
95
142
|
height: "100%",
|
|
96
143
|
top: 0,
|
|
97
144
|
left: 0
|
|
145
|
+
},
|
|
146
|
+
opacity: function(param) {
|
|
147
|
+
var isError = param.isError;
|
|
148
|
+
return isError ? 0 : 1;
|
|
98
149
|
}
|
|
99
150
|
},
|
|
100
151
|
wrapper: {
|
|
@@ -126,23 +177,28 @@ export var RATIO = {
|
|
|
126
177
|
"4:3": 4 / 3
|
|
127
178
|
};
|
|
128
179
|
var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
129
|
-
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? "" : _alt, dataAttributes = _param.dataAttributes, noBorderRadius = _param.noBorderRadius, src = _param.src, props = _objectWithoutProperties(_param, [
|
|
180
|
+
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? "" : _alt, dataAttributes = _param.dataAttributes, noBorderRadius = _param.noBorderRadius, src = _param.src, onError = _param.onError, onLoad = _param.onLoad, props = _objectWithoutProperties(_param, [
|
|
130
181
|
"aspectRatio",
|
|
131
182
|
"alt",
|
|
132
183
|
"dataAttributes",
|
|
133
184
|
"noBorderRadius",
|
|
134
|
-
"src"
|
|
185
|
+
"src",
|
|
186
|
+
"onError",
|
|
187
|
+
"onLoad"
|
|
135
188
|
]);
|
|
136
189
|
var supportsAspectRatio = useSupportsAspectRatio();
|
|
137
190
|
var noBorderRadiusContext = useDisableBorderRadius();
|
|
138
191
|
var noBorderSetting = noBorderRadius !== null && noBorderRadius !== void 0 ? noBorderRadius : noBorderRadiusContext;
|
|
139
|
-
|
|
140
|
-
var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number";
|
|
192
|
+
var _$ref = _slicedToArray(React.useState(false), 2), isError = _$ref[0], setIsError = _$ref[1];
|
|
141
193
|
var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
|
|
194
|
+
// if width or height are numeric, we can calculate the other with the ratio without css.
|
|
195
|
+
// if aspect ratio is 0, we use the original image proportions
|
|
196
|
+
var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
|
|
142
197
|
var classes = useStyles({
|
|
143
198
|
noBorderRadius: noBorderSetting,
|
|
144
199
|
aspectRatio: withCssAspectRatio ? ratio : undefined,
|
|
145
|
-
width: props.width
|
|
200
|
+
width: props.width,
|
|
201
|
+
isError: isError
|
|
146
202
|
});
|
|
147
203
|
var width = props.width;
|
|
148
204
|
var height = props.height;
|
|
@@ -157,11 +213,21 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
157
213
|
width = props.width || "100%";
|
|
158
214
|
}
|
|
159
215
|
var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
|
|
160
|
-
var img =
|
|
216
|
+
var img = // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/309
|
|
217
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
218
|
+
/*#__PURE__*/ _jsx("img", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
|
|
161
219
|
ref: ref,
|
|
162
220
|
src: src,
|
|
163
221
|
className: classes.image,
|
|
164
|
-
alt: alt
|
|
222
|
+
alt: alt,
|
|
223
|
+
onError: function(event) {
|
|
224
|
+
setIsError(true);
|
|
225
|
+
onError === null || onError === void 0 ? void 0 : onError(event);
|
|
226
|
+
},
|
|
227
|
+
onLoad: function(event) {
|
|
228
|
+
setIsError(false);
|
|
229
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(event);
|
|
230
|
+
}
|
|
165
231
|
}, !needsWrapper ? {
|
|
166
232
|
width: width,
|
|
167
233
|
height: height
|
package/dist-es/index.js
CHANGED
|
@@ -36,7 +36,8 @@ export { default as NavigationBreadcrumbs } from "./navigation-breadcrumbs";
|
|
|
36
36
|
export { default as Text, Text1, Text2, Text3, Text4, Text5, Text6, Text7, Text8, Text9, Text10 } from "./text";
|
|
37
37
|
export { default as Tag } from "./tag";
|
|
38
38
|
export { default as SectionTitle } from "./section-title";
|
|
39
|
-
export { Placeholder
|
|
39
|
+
export { Placeholder } from "./placeholder";
|
|
40
|
+
export { Title1, Title2 } from "./title";
|
|
40
41
|
export { RowList, Row, BoxedRowList, BoxedRow } from "./list";
|
|
41
42
|
export { default as Switch } from "./switch-component";
|
|
42
43
|
export { default as Checkbox } from "./checkbox";
|
|
@@ -53,6 +54,7 @@ export { default as Menu } from "./menu";
|
|
|
53
54
|
export { default as EmptyState } from "./empty-state";
|
|
54
55
|
export { default as EmptyStateCard } from "./empty-state-card";
|
|
55
56
|
export { default as Callout } from "./callout";
|
|
57
|
+
export { default as Avatar } from "./avatar";
|
|
56
58
|
export { useModalState } from "./modal-context-provider";
|
|
57
59
|
export { NavigationBar, MainNavigationBar, FunnelNavigationBar, NavigationBarActionGroup, NavigationBarAction, NavigationBarLogo } from "./navigation-bar";
|
|
58
60
|
export { default as Image } from "./image";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
|
|
2
|
-
export var PACKAGE_VERSION = "11.
|
|
2
|
+
export var PACKAGE_VERSION = "11.9.0";
|
|
@@ -105,14 +105,14 @@ import { useFieldProps } from "./form-context";
|
|
|
105
105
|
import { TextFieldBaseAutosuggest } from "./text-field-base";
|
|
106
106
|
import { useTheme } from "./hooks";
|
|
107
107
|
import IconButton from "./icon-button";
|
|
108
|
-
import
|
|
109
|
-
import
|
|
108
|
+
import IconAccesibilityRegular from "./generated/mistica-icons/icon-accesibility-regular";
|
|
109
|
+
import IconEyeRegular from "./generated/mistica-icons/icon-eye-regular";
|
|
110
110
|
import { createUseStyles } from "./jss";
|
|
111
111
|
var usePasswordAdornmentStyles = createUseStyles(function(theme) {
|
|
112
112
|
return {
|
|
113
113
|
shadow: _defineProperty({}, theme.mq.supportsHover, {
|
|
114
114
|
"&:hover": {
|
|
115
|
-
backgroundColor:
|
|
115
|
+
backgroundColor: theme.colors.backgroundAlternative
|
|
116
116
|
}
|
|
117
117
|
})
|
|
118
118
|
};
|
|
@@ -123,10 +123,11 @@ var PasswordAdornment = function(param) {
|
|
|
123
123
|
var classes = usePasswordAdornmentStyles();
|
|
124
124
|
var style = {
|
|
125
125
|
backgroundSize: "200%",
|
|
126
|
-
padding:
|
|
127
|
-
margin: -
|
|
126
|
+
padding: 8,
|
|
127
|
+
margin: -8,
|
|
128
128
|
borderRadius: "50%",
|
|
129
|
-
backgroundColor: undefined
|
|
129
|
+
backgroundColor: undefined,
|
|
130
|
+
transition: "background-color 0.2s ease-in-out"
|
|
130
131
|
};
|
|
131
132
|
return /*#__PURE__*/ _jsx(IconButton, {
|
|
132
133
|
"aria-label": texts.togglePasswordVisibilityLabel,
|
|
@@ -134,10 +135,10 @@ var PasswordAdornment = function(param) {
|
|
|
134
135
|
setVisibility(!isVisible);
|
|
135
136
|
focus();
|
|
136
137
|
},
|
|
137
|
-
size:
|
|
138
|
+
size: 40,
|
|
138
139
|
className: classes.shadow,
|
|
139
140
|
style: style,
|
|
140
|
-
children: isVisible ? /*#__PURE__*/ _jsx(
|
|
141
|
+
children: isVisible ? /*#__PURE__*/ _jsx(IconAccesibilityRegular, {}) : /*#__PURE__*/ _jsx(IconEyeRegular, {})
|
|
141
142
|
});
|
|
142
143
|
};
|
|
143
144
|
var PasswordField = function(_param) {
|
package/dist-es/placeholder.js
CHANGED
|
@@ -2,17 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { applyAlpha } from "./utils/color";
|
|
4
4
|
import { useTheme } from "./hooks";
|
|
5
|
-
export var AvatarPlaceholder = function(param) {
|
|
6
|
-
var _size = param.size, size = _size === void 0 ? "100%" : _size;
|
|
7
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
8
|
-
style: {
|
|
9
|
-
width: size,
|
|
10
|
-
height: size,
|
|
11
|
-
borderRadius: "50%",
|
|
12
|
-
background: "gray"
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
5
|
export var Placeholder = function(param) {
|
|
17
6
|
var _width = param.width, width = _width === void 0 ? "auto" : _width, _height = param.height, height = _height === void 0 ? 120 : _height;
|
|
18
7
|
var colors = useTheme().colors;
|
package/dist-es/section-title.js
CHANGED
|
@@ -30,7 +30,9 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
30
30
|
})
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use Title1 instead
|
|
35
|
+
*/ var SectionTitle = function(param) {
|
|
34
36
|
var children = param.children, id = param.id, right = param.right, _as = param.as, as = _as === void 0 ? "h3" : _as;
|
|
35
37
|
var classes = useStyles();
|
|
36
38
|
var theme = useTheme();
|
package/dist-es/text-link.js
CHANGED
|
@@ -61,7 +61,8 @@ import classnames from "classnames";
|
|
|
61
61
|
import { useIsInverseVariant } from "./theme-variant-context";
|
|
62
62
|
import { useForm } from "./form-context";
|
|
63
63
|
import { getTextFromChildren } from "./utils/common";
|
|
64
|
-
import { eventActions, eventCategories } from "./utils/analytics";
|
|
64
|
+
import { eventActions, eventCategories, eventNames } from "./utils/analytics";
|
|
65
|
+
import { useTheme } from "./hooks";
|
|
65
66
|
var useStyles = createUseStyles(function(theme) {
|
|
66
67
|
var _obj;
|
|
67
68
|
return {
|
|
@@ -96,14 +97,26 @@ var TextLink = function(_param) {
|
|
|
96
97
|
var classes = useStyles();
|
|
97
98
|
var isInverse = useIsInverseVariant();
|
|
98
99
|
var formStatus = useForm().formStatus;
|
|
100
|
+
var analytics = useTheme().analytics;
|
|
101
|
+
var createDefaultTrackingEvent = function() {
|
|
102
|
+
if (analytics.eventFormat === "google-analytics-4") {
|
|
103
|
+
return {
|
|
104
|
+
name: eventNames.userInteraction,
|
|
105
|
+
component_type: "link",
|
|
106
|
+
component_copy: getTextFromChildren(children)
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
return {
|
|
110
|
+
category: eventCategories.userInteraction,
|
|
111
|
+
action: eventActions.linkTapped,
|
|
112
|
+
label: getTextFromChildren(children)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
99
116
|
var _trackingEvent;
|
|
100
117
|
var _obj;
|
|
101
118
|
return /*#__PURE__*/ _jsx(Touchable, _objectSpread({}, props, {
|
|
102
|
-
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ?
|
|
103
|
-
category: eventCategories.userInteraction,
|
|
104
|
-
action: eventActions.linkTapped,
|
|
105
|
-
label: getTextFromChildren(children)
|
|
106
|
-
} : undefined,
|
|
119
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
|
|
107
120
|
disabled: disabled || formStatus === "sending",
|
|
108
121
|
className: classnames(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
|
|
109
122
|
children: children
|
package/dist-es/text.js
CHANGED
|
@@ -101,8 +101,14 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
101
101
|
"-webkit-line-clamp": lineClamp,
|
|
102
102
|
lineClamp: lineClamp,
|
|
103
103
|
wordBreak: function(param) {
|
|
104
|
-
var
|
|
105
|
-
return
|
|
104
|
+
var wordBreak = param.wordBreak;
|
|
105
|
+
return wordBreak ? "break-all" : "normal";
|
|
106
|
+
},
|
|
107
|
+
"@supports (overflow-wrap: anywhere)": {
|
|
108
|
+
wordBreak: function(param) {
|
|
109
|
+
var truncate = param.truncate;
|
|
110
|
+
return truncate === 1 || truncate === true ? "break-all" : "normal";
|
|
111
|
+
}
|
|
106
112
|
},
|
|
107
113
|
display: "box",
|
|
108
114
|
boxOrient: "vertical",
|