@telefonica/mistica 12.4.0 → 12.6.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/button.d.ts +5 -4
- package/dist/button.js +14 -10
- package/dist/button.js.flow +5 -4
- package/dist/dialog.d.ts +20 -5
- package/dist/dialog.js +39 -14
- package/dist/dialog.js.flow +24 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/index.js.flow +2 -0
- package/dist/list.d.ts +2 -1
- package/dist/list.js.flow +2 -1
- package/dist/navigation-bar.js +7 -9
- package/dist/package-version.js +1 -1
- package/dist/text-field-base.js +21 -5
- package/dist/text-link.js +2 -1
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +2 -1
- package/dist/theme.js.flow +2 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +234 -78
- package/dist/tooltip.js.flow +2 -0
- package/dist/touchable.d.ts +3 -1
- package/dist/touchable.js +6 -1
- package/dist/touchable.js.flow +6 -1
- package/dist-es/button.js +14 -10
- package/dist-es/dialog.js +40 -15
- package/dist-es/index.js +1 -0
- package/dist-es/navigation-bar.js +7 -9
- package/dist-es/package-version.js +1 -1
- package/dist-es/text-field-base.js +23 -7
- package/dist-es/text-link.js +3 -1
- package/dist-es/theme.js +2 -1
- package/dist-es/tooltip.js +234 -78
- package/dist-es/touchable.js +6 -1
- package/package.json +2 -1
package/dist-es/dialog.js
CHANGED
|
@@ -137,11 +137,12 @@ import { isWebViewBridgeAvailable, nativeConfirm, nativeAlert } from "@tef-novum
|
|
|
137
137
|
import ThemeContext from "./theme-context";
|
|
138
138
|
import { useTheme, useScreenSize } from "./hooks";
|
|
139
139
|
import ButtonLayout from "./button-layout";
|
|
140
|
-
import { Text5, Text3 } from "./text";
|
|
140
|
+
import { Text5, Text4, Text3 } from "./text";
|
|
141
141
|
import { ESC } from "./utils/key-codes";
|
|
142
142
|
import Box from "./box";
|
|
143
143
|
import { isOldChrome, isRunningAcceptanceTest } from "./utils/platform";
|
|
144
144
|
import { useSetModalState } from "./modal-context-provider";
|
|
145
|
+
import { pxToRem } from "./utils/css";
|
|
145
146
|
import Stack from "./stack";
|
|
146
147
|
var animationsSupported = function(platformOverrides) {
|
|
147
148
|
return !isOldChrome(platformOverrides) && process.env.NODE_ENV !== "test" && !isRunningAcceptanceTest(platformOverrides);
|
|
@@ -233,7 +234,10 @@ var useDialogStyles = createUseStyles(function(theme) {
|
|
|
233
234
|
dialogContainer: {
|
|
234
235
|
width: "calc(100vw - 48px)",
|
|
235
236
|
margin: "auto",
|
|
236
|
-
padding:
|
|
237
|
+
padding: function(param) {
|
|
238
|
+
var isDialog = param.isDialog;
|
|
239
|
+
return isDialog ? "40px 24px 24px" : 24;
|
|
240
|
+
}
|
|
237
241
|
}
|
|
238
242
|
});
|
|
239
243
|
});
|
|
@@ -241,9 +245,8 @@ var Dialog = function(props) {
|
|
|
241
245
|
var ref = useTheme(), texts = ref.texts, colors = ref.colors;
|
|
242
246
|
var className = props.className, title = props.title, message = props.message, icon = props.icon, extra = props.extra, _cancelText = props.cancelText, cancelText = _cancelText === void 0 ? texts.dialogCancelButton : _cancelText, _acceptText = props.acceptText, acceptText = _acceptText === void 0 ? texts.dialogAcceptButton : _acceptText, handleCancel = props.onCancel, handleAccept = props.onAccept, _showCancel = props.showCancel, showCancel = _showCancel === void 0 ? false : _showCancel, _destructive = props.destructive, destructive = _destructive === void 0 ? false : _destructive;
|
|
243
247
|
var isTabletOrSmaller = useScreenSize().isTabletOrSmaller;
|
|
244
|
-
var withSecondaryButton = showCancel && !!handleCancel;
|
|
245
248
|
var classes = useDialogStyles({
|
|
246
|
-
|
|
249
|
+
isDialog: !!props.forceWeb
|
|
247
250
|
});
|
|
248
251
|
var mainButtonProps = {
|
|
249
252
|
onPress: handleAccept ? handleAccept : function() {},
|
|
@@ -257,15 +260,29 @@ var Dialog = function(props) {
|
|
|
257
260
|
children: [
|
|
258
261
|
icon && /*#__PURE__*/ _jsx(Box, {
|
|
259
262
|
paddingBottom: 24,
|
|
260
|
-
children: icon
|
|
263
|
+
children: /*#__PURE__*/ React.cloneElement(icon, {
|
|
264
|
+
size: pxToRem(isTabletOrSmaller ? 40 : 64)
|
|
265
|
+
})
|
|
261
266
|
}),
|
|
262
267
|
title && /*#__PURE__*/ _jsx(Box, {
|
|
263
268
|
paddingBottom: 16,
|
|
264
|
-
children: /*#__PURE__*/ _jsx(Text5, {
|
|
269
|
+
children: props.forceWeb ? /*#__PURE__*/ _jsx(Text5, {
|
|
270
|
+
as: "h2",
|
|
271
|
+
children: title
|
|
272
|
+
}) : /*#__PURE__*/ _jsx(Text4, {
|
|
273
|
+
regular: true,
|
|
265
274
|
as: "h2",
|
|
266
275
|
children: title
|
|
267
276
|
})
|
|
268
277
|
}),
|
|
278
|
+
props.subtitle && /*#__PURE__*/ _jsx(Box, {
|
|
279
|
+
paddingBottom: 16,
|
|
280
|
+
children: /*#__PURE__*/ _jsx(Text4, {
|
|
281
|
+
regular: true,
|
|
282
|
+
as: "h2",
|
|
283
|
+
children: props.subtitle
|
|
284
|
+
})
|
|
285
|
+
}),
|
|
269
286
|
/*#__PURE__*/ _jsx("div", {
|
|
270
287
|
className: classes.dialogContent,
|
|
271
288
|
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
@@ -273,7 +290,7 @@ var Dialog = function(props) {
|
|
|
273
290
|
children: [
|
|
274
291
|
/*#__PURE__*/ _jsx(Text3, {
|
|
275
292
|
color: colors.textSecondary,
|
|
276
|
-
|
|
293
|
+
regular: true,
|
|
277
294
|
children: message
|
|
278
295
|
}),
|
|
279
296
|
extra
|
|
@@ -283,6 +300,7 @@ var Dialog = function(props) {
|
|
|
283
300
|
/*#__PURE__*/ _jsx(Box, {
|
|
284
301
|
paddingTop: isTabletOrSmaller ? 24 : 32,
|
|
285
302
|
children: /*#__PURE__*/ _jsxs(ButtonLayout, {
|
|
303
|
+
link: props.forceWeb ? props.link : undefined,
|
|
286
304
|
children: [
|
|
287
305
|
destructive ? /*#__PURE__*/ _jsx(ButtonDanger, _objectSpread({
|
|
288
306
|
tabIndex: 1
|
|
@@ -396,10 +414,13 @@ var ModalDialog = function(props) {
|
|
|
396
414
|
]);
|
|
397
415
|
var handleClose = props.showCancel ? handleCancel : handleAccept;
|
|
398
416
|
var handleOverlayPress = React.useCallback(function(event) {
|
|
399
|
-
|
|
400
|
-
|
|
417
|
+
if (props.showClose) {
|
|
418
|
+
handleClose();
|
|
419
|
+
event.stopPropagation();
|
|
420
|
+
}
|
|
401
421
|
}, [
|
|
402
|
-
handleClose
|
|
422
|
+
handleClose,
|
|
423
|
+
props.showClose
|
|
403
424
|
]);
|
|
404
425
|
var handleKeyDown = React.useCallback(function(event) {
|
|
405
426
|
if (event.keyCode === ESC) {
|
|
@@ -473,7 +494,7 @@ var ModalDialog = function(props) {
|
|
|
473
494
|
closed: isClosing
|
|
474
495
|
}),
|
|
475
496
|
children: [
|
|
476
|
-
/*#__PURE__*/ _jsx("div", {
|
|
497
|
+
props.showClose && /*#__PURE__*/ _jsx("div", {
|
|
477
498
|
className: classes.modalCloseButtonContainer,
|
|
478
499
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
479
500
|
onPress: handleClose,
|
|
@@ -611,13 +632,14 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
611
632
|
}(React.Component);
|
|
612
633
|
export { DialogRoot as default };
|
|
613
634
|
var showDialog = function(param) {
|
|
614
|
-
var showCancel = param.showCancel, forceWeb = param.forceWeb;
|
|
635
|
+
var showCancel = param.showCancel, showClose = param.showClose, forceWeb = param.forceWeb;
|
|
615
636
|
return function(props) {
|
|
616
637
|
if (!dialogInstance) {
|
|
617
638
|
throw Error("Tried to show a dialog but the DialogRoot component was not mounted (mount <ThemeContextProvider>)");
|
|
618
639
|
}
|
|
619
640
|
dialogInstance.show(_objectSpread({
|
|
620
641
|
showCancel: showCancel,
|
|
642
|
+
showClose: showClose,
|
|
621
643
|
forceWeb: forceWeb
|
|
622
644
|
}, props));
|
|
623
645
|
};
|
|
@@ -626,17 +648,20 @@ var showDialog = function(param) {
|
|
|
626
648
|
* Shows alert dialog with supplied props
|
|
627
649
|
*/ export var alert = showDialog({
|
|
628
650
|
showCancel: false,
|
|
629
|
-
forceWeb: false
|
|
651
|
+
forceWeb: false,
|
|
652
|
+
showClose: false
|
|
630
653
|
});
|
|
631
654
|
/**
|
|
632
655
|
* Shows confirm dialog with supplied props
|
|
633
656
|
*/ export var confirm = showDialog({
|
|
634
657
|
showCancel: true,
|
|
635
|
-
forceWeb: false
|
|
658
|
+
forceWeb: false,
|
|
659
|
+
showClose: false
|
|
636
660
|
});
|
|
637
661
|
/**
|
|
638
662
|
* Shows dialog with supplied props
|
|
639
663
|
*/ export var dialog = showDialog({
|
|
640
664
|
showCancel: false,
|
|
641
|
-
forceWeb: true
|
|
665
|
+
forceWeb: true,
|
|
666
|
+
showClose: true
|
|
642
667
|
});
|
package/dist-es/index.js
CHANGED
|
@@ -90,6 +90,7 @@ export { default as IconSuccessVivo } from "./icons/icon-success-vivo";
|
|
|
90
90
|
export { SkeletonCircle, SkeletonRow, SkeletonLine, SkeletonRectangle, SkeletonText } from "./skeletons";
|
|
91
91
|
export { default as Circle } from "./circle";
|
|
92
92
|
export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport } from "./hooks";
|
|
93
|
+
export { pxToRem } from "./utils/css";
|
|
93
94
|
export { TrackingConfig, useTrackingConfig } from "./utils/analytics";
|
|
94
95
|
export { useDocumentVisibility } from "./utils/document-visibility";
|
|
95
96
|
export { ThemeVariant, useIsInverseVariant } from "./theme-variant-context";
|
|
@@ -355,8 +355,6 @@ var BurgerMenuIcon = function(param) {
|
|
|
355
355
|
};
|
|
356
356
|
var NAVBAR_ZINDEX = 25;
|
|
357
357
|
var BURGER_ZINDEX = 26;
|
|
358
|
-
var DESKTOP_NAVBAR_HEIGHT = 80;
|
|
359
|
-
var MOBILE_NAVBAR_HEIGHT = 56;
|
|
360
358
|
var BURGER_MENU_ANIMATION_DURATION_MS = 300;
|
|
361
359
|
var useStyles = createUseStyles(function(theme) {
|
|
362
360
|
var shadowAlpha = theme.isDarkMode ? 1 : 0.2;
|
|
@@ -383,7 +381,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
383
381
|
var isInverse = param.isInverse;
|
|
384
382
|
return isInverse ? theme.colors.navigationBarBackground : theme.colors.background;
|
|
385
383
|
},
|
|
386
|
-
height:
|
|
384
|
+
height: theme.dimensions.headerDesktopHeight,
|
|
387
385
|
padding: "16px 0",
|
|
388
386
|
borderBottomStyle: "solid",
|
|
389
387
|
borderBottomWidth: function(param) {
|
|
@@ -400,11 +398,11 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
400
398
|
var isMenuOpen = param.isMenuOpen, isInverse = param.isInverse;
|
|
401
399
|
return isMenuOpen || isInverse && !theme.isDarkMode ? "transparent" : theme.colors.divider;
|
|
402
400
|
},
|
|
403
|
-
height:
|
|
401
|
+
height: theme.dimensions.headerMobileHeight,
|
|
404
402
|
padding: "8px 0"
|
|
405
403
|
}),
|
|
406
404
|
section: _defineProperty({
|
|
407
|
-
height:
|
|
405
|
+
height: theme.dimensions.headerDesktopHeight,
|
|
408
406
|
display: "flex",
|
|
409
407
|
alignItems: "center",
|
|
410
408
|
padding: "0 8px",
|
|
@@ -425,17 +423,17 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
425
423
|
}
|
|
426
424
|
},
|
|
427
425
|
spacer: _defineProperty({
|
|
428
|
-
height:
|
|
426
|
+
height: theme.dimensions.headerDesktopHeight
|
|
429
427
|
}, theme.mq.tabletOrSmaller, {
|
|
430
|
-
height:
|
|
428
|
+
height: theme.dimensions.headerMobileHeight
|
|
431
429
|
}),
|
|
432
430
|
burgerMenu: {
|
|
433
431
|
zIndex: BURGER_ZINDEX,
|
|
434
432
|
position: "fixed",
|
|
435
|
-
top:
|
|
433
|
+
top: theme.dimensions.headerMobileHeight,
|
|
436
434
|
left: 0,
|
|
437
435
|
right: 0,
|
|
438
|
-
height: "calc(100vh - ".concat(
|
|
436
|
+
height: "calc(100vh - ".concat(theme.dimensions.headerMobileHeight, "px)"),
|
|
439
437
|
overflowY: "auto",
|
|
440
438
|
background: theme.colors.background,
|
|
441
439
|
boxShadow: function(param) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
|
|
2
|
-
export var PACKAGE_VERSION = "12.
|
|
2
|
+
export var PACKAGE_VERSION = "12.6.0";
|
|
@@ -104,8 +104,8 @@ import * as React from "react";
|
|
|
104
104
|
import { createUseStyles } from "./jss";
|
|
105
105
|
import { Label, HelperText, FieldContainer, LABEL_LEFT_POSITION, LABEL_SCALE_MOBILE, LABEL_SCALE_DESKTOP } from "./text-field-components";
|
|
106
106
|
import { Text3 } from "./text";
|
|
107
|
-
import { isIos, isRunningAcceptanceTest, isFirefox } from "./utils/platform";
|
|
108
|
-
import { useAriaId, useTheme, useScreenSize } from "./hooks";
|
|
107
|
+
import { isIos, isRunningAcceptanceTest, isFirefox, isSafari } from "./utils/platform";
|
|
108
|
+
import { useAriaId, useTheme, useScreenSize, useIsomorphicLayoutEffect } from "./hooks";
|
|
109
109
|
import classNames from "classnames";
|
|
110
110
|
import { combineRefs } from "./utils/common";
|
|
111
111
|
var commonInputStyles = function(theme) {
|
|
@@ -270,7 +270,10 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
270
270
|
position: "absolute"
|
|
271
271
|
},
|
|
272
272
|
prefix: (_obj2 = {
|
|
273
|
-
alignSelf:
|
|
273
|
+
alignSelf: function(param) {
|
|
274
|
+
var prefixAlignSelf = param.prefixAlignSelf;
|
|
275
|
+
return prefixAlignSelf;
|
|
276
|
+
},
|
|
274
277
|
paddingTop: function(param) {
|
|
275
278
|
var hasLabel = param.hasLabel;
|
|
276
279
|
return hasLabel ? 28 : 16;
|
|
@@ -315,7 +318,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
315
318
|
"fullWidth"
|
|
316
319
|
]);
|
|
317
320
|
var id = useAriaId(idProp);
|
|
318
|
-
var _$
|
|
321
|
+
var _$ref4 = _slicedToArray(React.useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) ? "filled" : "default"), 2), inputState = _$ref4[0], setInputState = _$ref4[1];
|
|
319
322
|
var colors = useTheme().colors;
|
|
320
323
|
var isTabletOrSmaller = useScreenSize().isTabletOrSmaller;
|
|
321
324
|
var _$ref1;
|
|
@@ -324,6 +327,18 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
324
327
|
// this shrinkLabel override is a workaround because I was unable to find a way to hide date
|
|
325
328
|
// and date-time native placeholders when the input is not required
|
|
326
329
|
var shrinkLabel = shrinkLabelProp || (rest.type === "date" || rest.type === "datetime-local" || rest.type === "month") && !rest.required;
|
|
330
|
+
var _$ref3 = _slicedToArray(React.useState("baseline"), 2), prefixAlignSelf = _$ref3[0], setPrefixAlignSelf = _$ref3[1];
|
|
331
|
+
useIsomorphicLayoutEffect(function() {
|
|
332
|
+
/**
|
|
333
|
+
* Safari check to workaround https://jira.tid.es/browse/WEB-648
|
|
334
|
+
* For some reason it is super hard to align the prefix text with the input text
|
|
335
|
+
* and get the same result in chrome and safari
|
|
336
|
+
*
|
|
337
|
+
* Using an effect to set the style to avoid problems with SSR
|
|
338
|
+
*/ if (isSafari()) {
|
|
339
|
+
setPrefixAlignSelf("initial");
|
|
340
|
+
}
|
|
341
|
+
}, []);
|
|
327
342
|
var classes = useStyles({
|
|
328
343
|
inputState: inputState,
|
|
329
344
|
error: error,
|
|
@@ -334,7 +349,8 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
334
349
|
prefix: prefix,
|
|
335
350
|
multiline: multiline,
|
|
336
351
|
type: rest.type,
|
|
337
|
-
disabled: rest.disabled
|
|
352
|
+
disabled: rest.disabled,
|
|
353
|
+
prefixAlignSelf: prefixAlignSelf
|
|
338
354
|
});
|
|
339
355
|
React.useEffect(function() {
|
|
340
356
|
if (inputState !== "focused" && (value === null || value === void 0 ? void 0 : value.length)) {
|
|
@@ -500,10 +516,10 @@ var TextFieldBaseAutosuggest = /*#__PURE__*/ React.forwardRef(function(_param, r
|
|
|
500
516
|
"getSuggestions",
|
|
501
517
|
"id"
|
|
502
518
|
]);
|
|
503
|
-
var _$
|
|
519
|
+
var _$ref6 = _slicedToArray(React.useState([]), 2), suggestions = _$ref6[0], setSuggestions = _$ref6[1];
|
|
504
520
|
var inputRef = React.useRef(null);
|
|
505
521
|
var classes = useSuggestionsStyles();
|
|
506
|
-
var _$
|
|
522
|
+
var _$ref5 = useTheme(), platformOverrides = _$ref5.platformOverrides, texts = _$ref5.texts;
|
|
507
523
|
var id = useAriaId(idProp);
|
|
508
524
|
var autoSuggestId = useAriaId();
|
|
509
525
|
if (getSuggestions && (props.value === undefined || props.defaultValue !== undefined)) {
|
package/dist-es/text-link.js
CHANGED
|
@@ -54,6 +54,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
54
54
|
return target;
|
|
55
55
|
}
|
|
56
56
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
57
|
+
// Specs: https://www.figma.com/file/koROdh3HpEPG2O8jG52Emh/Buttons-Component-Specs?node-id=0%3A1
|
|
57
58
|
import * as React from "react";
|
|
58
59
|
import { createUseStyles } from "./jss";
|
|
59
60
|
import Touchable from "./touchable";
|
|
@@ -69,7 +70,7 @@ var useStyles = createUseStyles(function(param) {
|
|
|
69
70
|
textLink: (_obj = {
|
|
70
71
|
width: "auto",
|
|
71
72
|
lineHeight: "inherit",
|
|
72
|
-
display: "inline
|
|
73
|
+
display: "inline",
|
|
73
74
|
color: colors.textLink,
|
|
74
75
|
wordBreak: "break-word",
|
|
75
76
|
cursor: "pointer"
|
|
@@ -123,6 +124,7 @@ var TextLink = function(_param) {
|
|
|
123
124
|
var _trackingEvent;
|
|
124
125
|
var _obj;
|
|
125
126
|
return /*#__PURE__*/ _jsx(Touchable, _objectSpread({}, props, {
|
|
127
|
+
as: props.onPress ? "a" : undefined,
|
|
126
128
|
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
|
|
127
129
|
disabled: disabled || formStatus === "sending",
|
|
128
130
|
className: classnames(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
|
package/dist-es/theme.js
CHANGED