@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/button.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { TouchableElement } from './touchable';
|
|
2
3
|
import type { DataAttributes, RendersElement, RendersNullableElement, TrackingEvent } from './utils/types';
|
|
3
4
|
import type { Location } from 'history';
|
|
4
5
|
export declare const BUTTON_MIN_WIDTH = 136;
|
|
@@ -84,10 +85,10 @@ interface ButtonLinkToProps extends ButtonLinkCommonProps {
|
|
|
84
85
|
href?: undefined;
|
|
85
86
|
}
|
|
86
87
|
export declare type ButtonLinkProps = ButtonLinkOnPressProps | ButtonLinkHrefProps | ButtonLinkToProps;
|
|
87
|
-
export declare const ButtonLink: React.ForwardRefExoticComponent<ButtonLinkProps & React.RefAttributes<
|
|
88
|
-
export declare const ButtonPrimary: React.
|
|
89
|
-
export declare const ButtonSecondary: React.
|
|
90
|
-
export declare const ButtonDanger: React.
|
|
88
|
+
export declare const ButtonLink: React.ForwardRefExoticComponent<ButtonLinkProps & React.RefAttributes<TouchableElement>>;
|
|
89
|
+
export declare const ButtonPrimary: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<TouchableElement>>;
|
|
90
|
+
export declare const ButtonSecondary: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<TouchableElement>>;
|
|
91
|
+
export declare const ButtonDanger: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<TouchableElement>>;
|
|
91
92
|
export declare type ButtonElement = RendersElement<typeof ButtonPrimary> | RendersElement<typeof ButtonSecondary> | RendersElement<typeof ButtonDanger>;
|
|
92
93
|
export declare type NullableButtonElement = RendersNullableElement<typeof ButtonPrimary> | RendersNullableElement<typeof ButtonSecondary> | RendersNullableElement<typeof ButtonDanger>;
|
|
93
94
|
export {};
|
package/dist/button.js
CHANGED
|
@@ -346,9 +346,9 @@ var renderButtonContent = function renderButtonContent(param) {
|
|
|
346
346
|
});
|
|
347
347
|
return resultChildrenArr;
|
|
348
348
|
};
|
|
349
|
-
var Button =
|
|
349
|
+
var Button = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
350
350
|
var eventFormat = (0, _analytics).useTrackingConfig().eventFormat;
|
|
351
|
-
var ref = (0, _formContext).useForm(), formStatus = ref.formStatus, formId = ref.formId;
|
|
351
|
+
var _$ref = (0, _formContext).useForm(), formStatus = _$ref.formStatus, formId = _$ref.formId;
|
|
352
352
|
var isInverse = (0, _themeVariantContext).useIsInverseVariant();
|
|
353
353
|
var classes = props.classes, loadingText = props.loadingText;
|
|
354
354
|
var isSubmitButton = !!props.submit;
|
|
@@ -358,7 +358,7 @@ var Button = function Button(props) {
|
|
|
358
358
|
// specially in iPhone). But we want the spinner to be visible during the show/hide animation.
|
|
359
359
|
// * When showSpinner prop is true, state is changed immediately.
|
|
360
360
|
// * When the transition ends this state is updated again if needed
|
|
361
|
-
var ref1 = _slicedToArray(React.useState(!!showSpinner), 2), shouldRenderSpinner = ref1[0], setShouldRenderSpinner = ref1[1];
|
|
361
|
+
var _$ref1 = _slicedToArray(React.useState(!!showSpinner), 2), shouldRenderSpinner = _$ref1[0], setShouldRenderSpinner = _$ref1[1];
|
|
362
362
|
React.useEffect(function() {
|
|
363
363
|
if (showSpinner && !shouldRenderSpinner) {
|
|
364
364
|
setShouldRenderSpinner(true);
|
|
@@ -405,6 +405,7 @@ var Button = function Button(props) {
|
|
|
405
405
|
var _trackingEvent;
|
|
406
406
|
var _obj;
|
|
407
407
|
var commonProps = {
|
|
408
|
+
ref: ref,
|
|
408
409
|
className: (0, _classnames).default(classes.button, props.className, (_obj = {}, _defineProperty(_obj, classes.small, props.small), _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.light, !isInverse), _defineProperty(_obj, classes.isLoading, showSpinner), _obj)),
|
|
409
410
|
style: _objectSpread({
|
|
410
411
|
cursor: props.fake ? "pointer" : undefined
|
|
@@ -518,7 +519,7 @@ var Button = function Button(props) {
|
|
|
518
519
|
throw Error("Bad button props");
|
|
519
520
|
}
|
|
520
521
|
return null;
|
|
521
|
-
};
|
|
522
|
+
});
|
|
522
523
|
var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
|
|
523
524
|
var paddingY = 6;
|
|
524
525
|
var paddingX = 12;
|
|
@@ -645,27 +646,30 @@ var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
645
646
|
return null;
|
|
646
647
|
});
|
|
647
648
|
exports.ButtonLink = ButtonLink;
|
|
648
|
-
var ButtonPrimary =
|
|
649
|
+
var ButtonPrimary = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
649
650
|
var classes = usePrimaryButtonStyles();
|
|
650
651
|
return /*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
|
|
652
|
+
ref: ref,
|
|
651
653
|
classes: classes,
|
|
652
654
|
type: "primary"
|
|
653
655
|
}));
|
|
654
|
-
};
|
|
656
|
+
});
|
|
655
657
|
exports.ButtonPrimary = ButtonPrimary;
|
|
656
|
-
var ButtonSecondary =
|
|
658
|
+
var ButtonSecondary = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
657
659
|
var classes = useSecondaryButtonStyles();
|
|
658
660
|
return /*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
|
|
661
|
+
ref: ref,
|
|
659
662
|
classes: classes,
|
|
660
663
|
type: "secondary"
|
|
661
664
|
}));
|
|
662
|
-
};
|
|
665
|
+
});
|
|
663
666
|
exports.ButtonSecondary = ButtonSecondary;
|
|
664
|
-
var ButtonDanger =
|
|
667
|
+
var ButtonDanger = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
665
668
|
var classes = useDangerButtonStyles();
|
|
666
669
|
return /*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
|
|
670
|
+
ref: ref,
|
|
667
671
|
classes: classes,
|
|
668
672
|
type: "danger"
|
|
669
673
|
}));
|
|
670
|
-
};
|
|
674
|
+
});
|
|
671
675
|
exports.ButtonDanger = ButtonDanger;
|
package/dist/button.js.flow
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import type { TouchableElement } from "./touchable";
|
|
4
5
|
import type {
|
|
5
6
|
DataAttributes,
|
|
6
7
|
RendersElement,
|
|
@@ -87,10 +88,10 @@ export type ButtonLinkProps =
|
|
|
87
88
|
| ButtonLinkOnPressProps
|
|
88
89
|
| ButtonLinkHrefProps
|
|
89
90
|
| ButtonLinkToProps;
|
|
90
|
-
declare export var ButtonLink: React.AbstractComponent<ButtonLinkProps,
|
|
91
|
-
declare export var ButtonPrimary: React.
|
|
92
|
-
declare export var ButtonSecondary: React.
|
|
93
|
-
declare export var ButtonDanger: React.
|
|
91
|
+
declare export var ButtonLink: React.AbstractComponent<ButtonLinkProps, TouchableElement>;
|
|
92
|
+
declare export var ButtonPrimary: React.AbstractComponent<ButtonProps, TouchableElement>;
|
|
93
|
+
declare export var ButtonSecondary: React.AbstractComponent<ButtonProps, TouchableElement>;
|
|
94
|
+
declare export var ButtonDanger: React.AbstractComponent<ButtonProps, TouchableElement>;
|
|
94
95
|
export type ButtonElement =
|
|
95
96
|
| RendersElement<typeof ButtonPrimary>
|
|
96
97
|
| RendersElement<typeof ButtonSecondary>
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,34 +1,49 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ButtonLink } from './button';
|
|
3
|
+
import type { RendersNullableElement } from './utils/types';
|
|
2
4
|
interface BaseDialogProps {
|
|
3
5
|
className?: string;
|
|
4
6
|
title?: string;
|
|
5
7
|
icon?: React.ReactElement;
|
|
6
8
|
message: string;
|
|
7
|
-
cancelText?: string;
|
|
8
9
|
acceptText?: string;
|
|
9
|
-
onCancel?: () => void;
|
|
10
10
|
onAccept?: () => void;
|
|
11
|
-
showCancel?: boolean;
|
|
12
11
|
destructive?: boolean;
|
|
13
12
|
}
|
|
14
13
|
interface AlertProps extends BaseDialogProps {
|
|
14
|
+
subtitle?: undefined;
|
|
15
15
|
extra?: undefined;
|
|
16
16
|
forceWeb?: undefined;
|
|
17
|
+
showClose?: boolean;
|
|
18
|
+
showCancel?: never;
|
|
19
|
+
cancelText?: never;
|
|
20
|
+
onCancel?: never;
|
|
17
21
|
}
|
|
18
22
|
interface ConfirmProps extends BaseDialogProps {
|
|
23
|
+
subtitle?: undefined;
|
|
19
24
|
extra?: undefined;
|
|
20
25
|
forceWeb?: undefined;
|
|
26
|
+
showClose?: boolean;
|
|
27
|
+
showCancel?: boolean;
|
|
28
|
+
cancelText?: string;
|
|
29
|
+
onCancel?: () => void;
|
|
21
30
|
}
|
|
22
31
|
interface ExtendedDialogProps extends BaseDialogProps {
|
|
23
|
-
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
extra?: React.ReactNode;
|
|
24
34
|
forceWeb?: boolean;
|
|
35
|
+
showClose?: boolean;
|
|
36
|
+
showCancel?: boolean;
|
|
37
|
+
cancelText?: string;
|
|
38
|
+
onCancel?: () => void;
|
|
39
|
+
link?: RendersNullableElement<typeof ButtonLink>;
|
|
25
40
|
}
|
|
26
41
|
declare type DialogProps = AlertProps | ConfirmProps | ExtendedDialogProps;
|
|
27
42
|
declare type DialogRootProps = {
|
|
28
43
|
children?: React.ReactNode;
|
|
29
44
|
};
|
|
30
45
|
declare type DialogRootState = {
|
|
31
|
-
dialogProps:
|
|
46
|
+
dialogProps: DialogProps | null;
|
|
32
47
|
isClosing: boolean;
|
|
33
48
|
instanceNumber: number;
|
|
34
49
|
};
|
package/dist/dialog.js
CHANGED
|
@@ -21,6 +21,7 @@ var _keyCodes = require("./utils/key-codes");
|
|
|
21
21
|
var _box = _interopRequireDefault(require("./box"));
|
|
22
22
|
var _platform = require("./utils/platform");
|
|
23
23
|
var _modalContextProvider = require("./modal-context-provider");
|
|
24
|
+
var _css = require("./utils/css");
|
|
24
25
|
var _stack = _interopRequireDefault(require("./stack"));
|
|
25
26
|
function _interopRequireDefault(obj) {
|
|
26
27
|
return obj && obj.__esModule ? obj : {
|
|
@@ -265,7 +266,10 @@ var useDialogStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
265
266
|
dialogContainer: {
|
|
266
267
|
width: "calc(100vw - 48px)",
|
|
267
268
|
margin: "auto",
|
|
268
|
-
padding:
|
|
269
|
+
padding: function padding(param) {
|
|
270
|
+
var isDialog = param.isDialog;
|
|
271
|
+
return isDialog ? "40px 24px 24px" : 24;
|
|
272
|
+
}
|
|
269
273
|
}
|
|
270
274
|
});
|
|
271
275
|
});
|
|
@@ -273,9 +277,8 @@ var Dialog = function Dialog(props) {
|
|
|
273
277
|
var ref = (0, _hooks).useTheme(), texts = ref.texts, colors = ref.colors;
|
|
274
278
|
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;
|
|
275
279
|
var isTabletOrSmaller = (0, _hooks).useScreenSize().isTabletOrSmaller;
|
|
276
|
-
var withSecondaryButton = showCancel && !!handleCancel;
|
|
277
280
|
var classes = useDialogStyles({
|
|
278
|
-
|
|
281
|
+
isDialog: !!props.forceWeb
|
|
279
282
|
});
|
|
280
283
|
var mainButtonProps = {
|
|
281
284
|
onPress: handleAccept ? handleAccept : function() {},
|
|
@@ -289,15 +292,29 @@ var Dialog = function Dialog(props) {
|
|
|
289
292
|
children: [
|
|
290
293
|
icon && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
291
294
|
paddingBottom: 24,
|
|
292
|
-
children: icon
|
|
295
|
+
children: /*#__PURE__*/ React.cloneElement(icon, {
|
|
296
|
+
size: (0, _css).pxToRem(isTabletOrSmaller ? 40 : 64)
|
|
297
|
+
})
|
|
293
298
|
}),
|
|
294
299
|
title && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
295
300
|
paddingBottom: 16,
|
|
296
|
-
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text5, {
|
|
301
|
+
children: props.forceWeb ? /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text5, {
|
|
302
|
+
as: "h2",
|
|
303
|
+
children: title
|
|
304
|
+
}) : /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text4, {
|
|
305
|
+
regular: true,
|
|
297
306
|
as: "h2",
|
|
298
307
|
children: title
|
|
299
308
|
})
|
|
300
309
|
}),
|
|
310
|
+
props.subtitle && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
311
|
+
paddingBottom: 16,
|
|
312
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text4, {
|
|
313
|
+
regular: true,
|
|
314
|
+
as: "h2",
|
|
315
|
+
children: props.subtitle
|
|
316
|
+
})
|
|
317
|
+
}),
|
|
301
318
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
302
319
|
className: classes.dialogContent,
|
|
303
320
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
@@ -305,7 +322,7 @@ var Dialog = function Dialog(props) {
|
|
|
305
322
|
children: [
|
|
306
323
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text3, {
|
|
307
324
|
color: colors.textSecondary,
|
|
308
|
-
|
|
325
|
+
regular: true,
|
|
309
326
|
children: message
|
|
310
327
|
}),
|
|
311
328
|
extra
|
|
@@ -315,6 +332,7 @@ var Dialog = function Dialog(props) {
|
|
|
315
332
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
316
333
|
paddingTop: isTabletOrSmaller ? 24 : 32,
|
|
317
334
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(_buttonLayout.default, {
|
|
335
|
+
link: props.forceWeb ? props.link : undefined,
|
|
318
336
|
children: [
|
|
319
337
|
destructive ? /*#__PURE__*/ (0, _jsxRuntime // eslint-disable-line jsx-a11y/tabindex-no-positive
|
|
320
338
|
).jsx(_button.ButtonDanger, _objectSpread({
|
|
@@ -428,10 +446,13 @@ var ModalDialog = function ModalDialog(props) {
|
|
|
428
446
|
]);
|
|
429
447
|
var handleClose = props.showCancel ? handleCancel : handleAccept;
|
|
430
448
|
var handleOverlayPress = React.useCallback(function(event) {
|
|
431
|
-
|
|
432
|
-
|
|
449
|
+
if (props.showClose) {
|
|
450
|
+
handleClose();
|
|
451
|
+
event.stopPropagation();
|
|
452
|
+
}
|
|
433
453
|
}, [
|
|
434
|
-
handleClose
|
|
454
|
+
handleClose,
|
|
455
|
+
props.showClose
|
|
435
456
|
]);
|
|
436
457
|
var handleKeyDown = React.useCallback(function(event) {
|
|
437
458
|
if (event.keyCode === _keyCodes.ESC) {
|
|
@@ -505,7 +526,7 @@ var ModalDialog = function ModalDialog(props) {
|
|
|
505
526
|
closed: isClosing
|
|
506
527
|
}),
|
|
507
528
|
children: [
|
|
508
|
-
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
529
|
+
props.showClose && /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
509
530
|
className: classes.modalCloseButtonContainer,
|
|
510
531
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
|
|
511
532
|
onPress: handleClose,
|
|
@@ -643,29 +664,33 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
643
664
|
}(React.Component);
|
|
644
665
|
exports.default = DialogRoot;
|
|
645
666
|
var showDialog = function showDialog(param) {
|
|
646
|
-
var showCancel = param.showCancel, forceWeb = param.forceWeb;
|
|
667
|
+
var showCancel = param.showCancel, showClose = param.showClose, forceWeb = param.forceWeb;
|
|
647
668
|
return function(props) {
|
|
648
669
|
if (!dialogInstance) {
|
|
649
670
|
throw Error("Tried to show a dialog but the DialogRoot component was not mounted (mount <ThemeContextProvider>)");
|
|
650
671
|
}
|
|
651
672
|
dialogInstance.show(_objectSpread({
|
|
652
673
|
showCancel: showCancel,
|
|
674
|
+
showClose: showClose,
|
|
653
675
|
forceWeb: forceWeb
|
|
654
676
|
}, props));
|
|
655
677
|
};
|
|
656
678
|
};
|
|
657
679
|
var alert = showDialog({
|
|
658
680
|
showCancel: false,
|
|
659
|
-
forceWeb: false
|
|
681
|
+
forceWeb: false,
|
|
682
|
+
showClose: false
|
|
660
683
|
});
|
|
661
684
|
exports.alert = alert;
|
|
662
685
|
var confirm = showDialog({
|
|
663
686
|
showCancel: true,
|
|
664
|
-
forceWeb: false
|
|
687
|
+
forceWeb: false,
|
|
688
|
+
showClose: false
|
|
665
689
|
});
|
|
666
690
|
exports.confirm = confirm;
|
|
667
691
|
var dialog = showDialog({
|
|
668
692
|
showCancel: false,
|
|
669
|
-
forceWeb: true
|
|
693
|
+
forceWeb: true,
|
|
694
|
+
showClose: true
|
|
670
695
|
});
|
|
671
696
|
exports.dialog = dialog;
|
package/dist/dialog.js.flow
CHANGED
|
@@ -1,32 +1,49 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { ButtonLink } from "./button";
|
|
5
|
+
import type { RendersNullableElement } from "./utils/types";
|
|
4
6
|
declare type BaseDialogProps = {
|
|
5
7
|
className?: string,
|
|
6
8
|
title?: string,
|
|
7
9
|
icon?: React.Element<any>,
|
|
8
10
|
message: string,
|
|
9
|
-
cancelText?: string,
|
|
10
11
|
acceptText?: string,
|
|
11
|
-
onCancel?: () => void,
|
|
12
12
|
onAccept?: () => void,
|
|
13
|
-
showCancel?: boolean,
|
|
14
13
|
destructive?: boolean,
|
|
15
14
|
};
|
|
16
|
-
declare type AlertProps = {
|
|
17
|
-
|
|
15
|
+
declare type AlertProps = {
|
|
16
|
+
...$Exact<BaseDialogProps>,
|
|
17
|
+
showClose?: boolean,
|
|
18
|
+
showCancel?: empty,
|
|
19
|
+
cancelText?: empty,
|
|
20
|
+
onCancel?: empty,
|
|
21
|
+
};
|
|
22
|
+
declare type ConfirmProps = {
|
|
23
|
+
...$Exact<BaseDialogProps>,
|
|
24
|
+
showClose?: boolean,
|
|
25
|
+
showCancel?: boolean,
|
|
26
|
+
cancelText?: string,
|
|
27
|
+
onCancel?: () => void,
|
|
28
|
+
};
|
|
18
29
|
declare type ExtendedDialogProps = {
|
|
19
30
|
...$Exact<BaseDialogProps>,
|
|
20
31
|
|
|
21
|
-
|
|
32
|
+
subtitle?: string,
|
|
33
|
+
extra?: React.Node,
|
|
22
34
|
forceWeb?: boolean,
|
|
35
|
+
showClose?: boolean,
|
|
36
|
+
showCancel?: boolean,
|
|
37
|
+
cancelText?: string,
|
|
38
|
+
onCancel?: () => void,
|
|
39
|
+
link?: RendersNullableElement<typeof ButtonLink>,
|
|
23
40
|
};
|
|
24
41
|
declare type DialogProps = AlertProps | ConfirmProps | ExtendedDialogProps;
|
|
25
42
|
declare type DialogRootProps = {
|
|
26
43
|
children?: React.Node,
|
|
27
44
|
};
|
|
28
45
|
declare type DialogRootState = {
|
|
29
|
-
dialogProps:
|
|
46
|
+
dialogProps: DialogProps | null,
|
|
30
47
|
isClosing: boolean,
|
|
31
48
|
instanceNumber: number,
|
|
32
49
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as ThemeContext } from './theme-context';
|
|
|
3
3
|
export { default as ThemeContextProvider } from './theme-context-provider';
|
|
4
4
|
export { default as ScreenReaderOnly } from './screen-reader-only';
|
|
5
5
|
export { default as Touchable } from './touchable';
|
|
6
|
+
export type { TouchableElement } from './touchable';
|
|
6
7
|
export { default as Spinner } from './spinner';
|
|
7
8
|
export { default as FadeIn } from './fade-in';
|
|
8
9
|
export { ButtonPrimary, ButtonSecondary, ButtonDanger, ButtonLink } from './button';
|
|
@@ -90,6 +91,7 @@ export { SkeletonCircle, SkeletonRow, SkeletonLine, SkeletonRectangle, SkeletonT
|
|
|
90
91
|
export { default as Circle } from './circle';
|
|
91
92
|
export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport, } from './hooks';
|
|
92
93
|
export type { ThemeConfig, ColorScheme, EventFormat } from './theme';
|
|
94
|
+
export { pxToRem } from './utils/css';
|
|
93
95
|
export { TrackingConfig, useTrackingConfig } from './utils/analytics';
|
|
94
96
|
export { useDocumentVisibility } from './utils/document-visibility';
|
|
95
97
|
export { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
|
package/dist/index.js
CHANGED
|
@@ -854,6 +854,12 @@ Object.defineProperty(exports, "useIsInViewport", {
|
|
|
854
854
|
return _hooks.useIsInViewport;
|
|
855
855
|
}
|
|
856
856
|
});
|
|
857
|
+
Object.defineProperty(exports, "pxToRem", {
|
|
858
|
+
enumerable: true,
|
|
859
|
+
get: function() {
|
|
860
|
+
return _css.pxToRem;
|
|
861
|
+
}
|
|
862
|
+
});
|
|
857
863
|
Object.defineProperty(exports, "TrackingConfig", {
|
|
858
864
|
enumerable: true,
|
|
859
865
|
get: function() {
|
|
@@ -10868,6 +10874,7 @@ var _iconSuccessVivo = _interopRequireDefault(require("./icons/icon-success-vivo
|
|
|
10868
10874
|
var _skeletons = require("./skeletons");
|
|
10869
10875
|
var _circle = _interopRequireDefault(require("./circle"));
|
|
10870
10876
|
var _hooks = require("./hooks");
|
|
10877
|
+
var _css = require("./utils/css");
|
|
10871
10878
|
var _analytics = require("./utils/analytics");
|
|
10872
10879
|
var _documentVisibility = require("./utils/document-visibility");
|
|
10873
10880
|
var _themeVariantContext = require("./theme-variant-context");
|
package/dist/index.js.flow
CHANGED
|
@@ -5,6 +5,7 @@ declare export { default as ThemeContext } from "./theme-context";
|
|
|
5
5
|
declare export { default as ThemeContextProvider } from "./theme-context-provider";
|
|
6
6
|
declare export { default as ScreenReaderOnly } from "./screen-reader-only";
|
|
7
7
|
declare export { default as Touchable } from "./touchable";
|
|
8
|
+
export type { TouchableElement } from "./touchable";
|
|
8
9
|
declare export { default as Spinner } from "./spinner";
|
|
9
10
|
declare export { default as FadeIn } from "./fade-in";
|
|
10
11
|
declare export {
|
|
@@ -153,6 +154,7 @@ declare export {
|
|
|
153
154
|
useIsInViewport,
|
|
154
155
|
} from "./hooks";
|
|
155
156
|
export type { ThemeConfig, ColorScheme, EventFormat } from "./theme";
|
|
157
|
+
declare export { pxToRem } from "./utils/css";
|
|
156
158
|
declare export { TrackingConfig, useTrackingConfig } from "./utils/analytics";
|
|
157
159
|
declare export { useDocumentVisibility } from "./utils/document-visibility";
|
|
158
160
|
declare export {
|
package/dist/list.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { TouchableElement } from './touchable';
|
|
2
3
|
import type { DataAttributes, TrackingEvent } from './utils/types';
|
|
3
4
|
interface CommonProps {
|
|
4
5
|
children?: void;
|
|
@@ -107,7 +108,7 @@ interface OnPressRowContentProps extends CommonProps {
|
|
|
107
108
|
right?: Right;
|
|
108
109
|
}
|
|
109
110
|
declare type RowContentProps = BasicRowContentProps | SwitchRowContentProps | RadioRowContentProps | CheckboxRowContentProps | HrefRowContentProps | ToRowContentProps | OnPressRowContentProps;
|
|
110
|
-
export declare const Row: React.ForwardRefExoticComponent<RowContentProps & React.RefAttributes<
|
|
111
|
+
export declare const Row: React.ForwardRefExoticComponent<RowContentProps & React.RefAttributes<TouchableElement>>;
|
|
111
112
|
declare type RowListProps = {
|
|
112
113
|
children: React.ReactNode;
|
|
113
114
|
ariaLabelledby?: string;
|
package/dist/list.js.flow
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import type { TouchableElement } from "./touchable";
|
|
4
5
|
import type { DataAttributes, TrackingEvent } from "./utils/types";
|
|
5
6
|
declare type CommonProps = {
|
|
6
7
|
headline?: string | React.Node,
|
|
@@ -76,7 +77,7 @@ declare type RowContentProps =
|
|
|
76
77
|
| HrefRowContentProps
|
|
77
78
|
| ToRowContentProps
|
|
78
79
|
| OnPressRowContentProps;
|
|
79
|
-
declare export var Row: React.AbstractComponent<RowContentProps,
|
|
80
|
+
declare export var Row: React.AbstractComponent<RowContentProps, TouchableElement>;
|
|
80
81
|
declare type RowListProps = {
|
|
81
82
|
children: React.Node,
|
|
82
83
|
ariaLabelledby?: string,
|
package/dist/navigation-bar.js
CHANGED
|
@@ -387,8 +387,6 @@ var BurgerMenuIcon = function BurgerMenuIcon(param) {
|
|
|
387
387
|
};
|
|
388
388
|
var NAVBAR_ZINDEX = 25;
|
|
389
389
|
var BURGER_ZINDEX = 26;
|
|
390
|
-
var DESKTOP_NAVBAR_HEIGHT = 80;
|
|
391
|
-
var MOBILE_NAVBAR_HEIGHT = 56;
|
|
392
390
|
var BURGER_MENU_ANIMATION_DURATION_MS = 300;
|
|
393
391
|
var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
394
392
|
var shadowAlpha = theme.isDarkMode ? 1 : 0.2;
|
|
@@ -415,7 +413,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
415
413
|
var isInverse = param.isInverse;
|
|
416
414
|
return isInverse ? theme.colors.navigationBarBackground : theme.colors.background;
|
|
417
415
|
},
|
|
418
|
-
height:
|
|
416
|
+
height: theme.dimensions.headerDesktopHeight,
|
|
419
417
|
padding: "16px 0",
|
|
420
418
|
borderBottomStyle: "solid",
|
|
421
419
|
borderBottomWidth: function borderBottomWidth(param) {
|
|
@@ -432,11 +430,11 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
432
430
|
var isMenuOpen = param.isMenuOpen, isInverse = param.isInverse;
|
|
433
431
|
return isMenuOpen || isInverse && !theme.isDarkMode ? "transparent" : theme.colors.divider;
|
|
434
432
|
},
|
|
435
|
-
height:
|
|
433
|
+
height: theme.dimensions.headerMobileHeight,
|
|
436
434
|
padding: "8px 0"
|
|
437
435
|
}),
|
|
438
436
|
section: _defineProperty({
|
|
439
|
-
height:
|
|
437
|
+
height: theme.dimensions.headerDesktopHeight,
|
|
440
438
|
display: "flex",
|
|
441
439
|
alignItems: "center",
|
|
442
440
|
padding: "0 8px",
|
|
@@ -457,17 +455,17 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
457
455
|
}
|
|
458
456
|
},
|
|
459
457
|
spacer: _defineProperty({
|
|
460
|
-
height:
|
|
458
|
+
height: theme.dimensions.headerDesktopHeight
|
|
461
459
|
}, theme.mq.tabletOrSmaller, {
|
|
462
|
-
height:
|
|
460
|
+
height: theme.dimensions.headerMobileHeight
|
|
463
461
|
}),
|
|
464
462
|
burgerMenu: {
|
|
465
463
|
zIndex: BURGER_ZINDEX,
|
|
466
464
|
position: "fixed",
|
|
467
|
-
top:
|
|
465
|
+
top: theme.dimensions.headerMobileHeight,
|
|
468
466
|
left: 0,
|
|
469
467
|
right: 0,
|
|
470
|
-
height: "calc(100vh - ".concat(
|
|
468
|
+
height: "calc(100vh - ".concat(theme.dimensions.headerMobileHeight, "px)"),
|
|
471
469
|
overflowY: "auto",
|
|
472
470
|
background: theme.colors.background,
|
|
473
471
|
boxShadow: function boxShadow(param) {
|
package/dist/package-version.js
CHANGED
package/dist/text-field-base.js
CHANGED
|
@@ -302,7 +302,10 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
302
302
|
position: "absolute"
|
|
303
303
|
},
|
|
304
304
|
prefix: (_obj2 = {
|
|
305
|
-
alignSelf:
|
|
305
|
+
alignSelf: function alignSelf(param) {
|
|
306
|
+
var prefixAlignSelf = param.prefixAlignSelf;
|
|
307
|
+
return prefixAlignSelf;
|
|
308
|
+
},
|
|
306
309
|
paddingTop: function paddingTop(param) {
|
|
307
310
|
var hasLabel = param.hasLabel;
|
|
308
311
|
return hasLabel ? 28 : 16;
|
|
@@ -347,7 +350,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
347
350
|
"fullWidth"
|
|
348
351
|
]);
|
|
349
352
|
var id = (0, _hooks).useAriaId(idProp);
|
|
350
|
-
var _$
|
|
353
|
+
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];
|
|
351
354
|
var colors = (0, _hooks).useTheme().colors;
|
|
352
355
|
var isTabletOrSmaller = (0, _hooks).useScreenSize().isTabletOrSmaller;
|
|
353
356
|
var _$ref1;
|
|
@@ -356,6 +359,18 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
356
359
|
// this shrinkLabel override is a workaround because I was unable to find a way to hide date
|
|
357
360
|
// and date-time native placeholders when the input is not required
|
|
358
361
|
var shrinkLabel = shrinkLabelProp || (rest.type === "date" || rest.type === "datetime-local" || rest.type === "month") && !rest.required;
|
|
362
|
+
var _$ref3 = _slicedToArray(React.useState("baseline"), 2), prefixAlignSelf = _$ref3[0], setPrefixAlignSelf = _$ref3[1];
|
|
363
|
+
(0, _hooks).useIsomorphicLayoutEffect(function() {
|
|
364
|
+
/**
|
|
365
|
+
* Safari check to workaround https://jira.tid.es/browse/WEB-648
|
|
366
|
+
* For some reason it is super hard to align the prefix text with the input text
|
|
367
|
+
* and get the same result in chrome and safari
|
|
368
|
+
*
|
|
369
|
+
* Using an effect to set the style to avoid problems with SSR
|
|
370
|
+
*/ if ((0, _platform).isSafari()) {
|
|
371
|
+
setPrefixAlignSelf("initial");
|
|
372
|
+
}
|
|
373
|
+
}, []);
|
|
359
374
|
var classes = useStyles({
|
|
360
375
|
inputState: inputState,
|
|
361
376
|
error: error,
|
|
@@ -366,7 +381,8 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
366
381
|
prefix: prefix,
|
|
367
382
|
multiline: multiline,
|
|
368
383
|
type: rest.type,
|
|
369
|
-
disabled: rest.disabled
|
|
384
|
+
disabled: rest.disabled,
|
|
385
|
+
prefixAlignSelf: prefixAlignSelf
|
|
370
386
|
});
|
|
371
387
|
React.useEffect(function() {
|
|
372
388
|
if (inputState !== "focused" && (value === null || value === void 0 ? void 0 : value.length)) {
|
|
@@ -534,10 +550,10 @@ var TextFieldBaseAutosuggest = /*#__PURE__*/ React.forwardRef(function(_param, r
|
|
|
534
550
|
"getSuggestions",
|
|
535
551
|
"id"
|
|
536
552
|
]);
|
|
537
|
-
var _$
|
|
553
|
+
var _$ref6 = _slicedToArray(React.useState([]), 2), suggestions = _$ref6[0], setSuggestions = _$ref6[1];
|
|
538
554
|
var inputRef = React.useRef(null);
|
|
539
555
|
var classes = useSuggestionsStyles();
|
|
540
|
-
var _$
|
|
556
|
+
var _$ref5 = (0, _hooks).useTheme(), platformOverrides = _$ref5.platformOverrides, texts = _$ref5.texts;
|
|
541
557
|
var id = (0, _hooks).useAriaId(idProp);
|
|
542
558
|
var autoSuggestId = (0, _hooks).useAriaId();
|
|
543
559
|
if (getSuggestions && (props.value === undefined || props.defaultValue !== undefined)) {
|
package/dist/text-link.js
CHANGED
|
@@ -101,7 +101,7 @@ var useStyles = (0, _jss).createUseStyles(function(param) {
|
|
|
101
101
|
textLink: (_obj = {
|
|
102
102
|
width: "auto",
|
|
103
103
|
lineHeight: "inherit",
|
|
104
|
-
display: "inline
|
|
104
|
+
display: "inline",
|
|
105
105
|
color: colors.textLink,
|
|
106
106
|
wordBreak: "break-word",
|
|
107
107
|
cursor: "pointer"
|
|
@@ -155,6 +155,7 @@ var TextLink = function TextLink(_param) {
|
|
|
155
155
|
var _trackingEvent;
|
|
156
156
|
var _obj;
|
|
157
157
|
return /*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({}, props, {
|
|
158
|
+
as: props.onPress ? "a" : undefined,
|
|
158
159
|
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
|
|
159
160
|
disabled: disabled || formStatus === "sending",
|
|
160
161
|
className: (0, _classnames).default(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
|
package/dist/theme.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare const TEXTS_ES: {
|
|
|
40
40
|
export declare const getTexts: (locale: Locale) => typeof TEXTS_ES;
|
|
41
41
|
export declare const dimensions: {
|
|
42
42
|
headerMobileHeight: number;
|
|
43
|
+
headerDesktopHeight: number;
|
|
43
44
|
};
|
|
44
45
|
export declare const mediaQueriesConfig: {
|
|
45
46
|
tabletMinWidth: number;
|
|
@@ -124,6 +125,7 @@ export declare type Theme = {
|
|
|
124
125
|
};
|
|
125
126
|
dimensions: {
|
|
126
127
|
headerMobileHeight: number;
|
|
128
|
+
headerDesktopHeight: number;
|
|
127
129
|
};
|
|
128
130
|
mq: MediaQueries;
|
|
129
131
|
colors: Colors;
|
package/dist/theme.js
CHANGED
|
@@ -232,7 +232,8 @@ var getTexts = function getTexts(locale) {
|
|
|
232
232
|
};
|
|
233
233
|
exports.getTexts = getTexts;
|
|
234
234
|
var dimensions = {
|
|
235
|
-
headerMobileHeight: 56
|
|
235
|
+
headerMobileHeight: 56,
|
|
236
|
+
headerDesktopHeight: 80
|
|
236
237
|
};
|
|
237
238
|
exports.dimensions = dimensions;
|
|
238
239
|
var mediaQueriesConfig = {
|
package/dist/theme.js.flow
CHANGED
|
@@ -42,6 +42,7 @@ declare var TEXTS_ES: {
|
|
|
42
42
|
declare export var getTexts: (locale: Locale) => typeof TEXTS_ES;
|
|
43
43
|
declare export var dimensions: {
|
|
44
44
|
headerMobileHeight: number,
|
|
45
|
+
headerDesktopHeight: number,
|
|
45
46
|
};
|
|
46
47
|
declare export var mediaQueriesConfig: {
|
|
47
48
|
tabletMinWidth: number,
|
|
@@ -128,6 +129,7 @@ export type Theme = {
|
|
|
128
129
|
},
|
|
129
130
|
dimensions: {
|
|
130
131
|
headerMobileHeight: number,
|
|
132
|
+
headerDesktopHeight: number,
|
|
131
133
|
},
|
|
132
134
|
mq: MediaQueries,
|
|
133
135
|
colors: Colors,
|