@telefonica/mistica 10.22.3 → 10.23.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/dialog.d.ts +2 -0
- package/dist/dialog.js +17 -6
- package/dist/dialog.js.flow +2 -0
- package/dist/package-version.js +1 -1
- package/dist/theme-context-provider.js +2 -1
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js.flow +2 -0
- package/dist-es/dialog.js +17 -6
- package/dist-es/package-version.js +1 -1
- package/dist-es/theme-context-provider.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [10.23.0](https://github.com/Telefonica/mistica-web/compare/v10.22.3...v10.23.0) (2022-02-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Dialog:** allow disable history update in dialogs ([#412](https://github.com/Telefonica/mistica-web/issues/412)) ([178bc55](https://github.com/Telefonica/mistica-web/commit/178bc55abc19f0d9117d0a51bbcb5a8a2353f68e))
|
|
7
|
+
|
|
1
8
|
## [10.22.3](https://github.com/Telefonica/mistica-web/compare/v10.22.2...v10.22.3) (2022-02-08)
|
|
2
9
|
|
|
3
10
|
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { Theme } from './theme';
|
|
2
3
|
interface DialogProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
title?: string;
|
|
@@ -20,6 +21,7 @@ declare type DialogRootState = {
|
|
|
20
21
|
instanceNumber: number;
|
|
21
22
|
};
|
|
22
23
|
export default class DialogRoot extends React.Component<DialogRootProps, DialogRootState> {
|
|
24
|
+
static contextType: React.Context<Theme | null>;
|
|
23
25
|
state: DialogRootState;
|
|
24
26
|
componentDidMount(): void;
|
|
25
27
|
componentWillUnmount(): void;
|
package/dist/dialog.js
CHANGED
|
@@ -560,7 +560,9 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
560
560
|
dialogRootInstances++;
|
|
561
561
|
if (dialogRootInstances === 1) {
|
|
562
562
|
dialogInstance = this;
|
|
563
|
-
|
|
563
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
564
|
+
window.addEventListener('popstate', this.handleBack);
|
|
565
|
+
}
|
|
564
566
|
}
|
|
565
567
|
}
|
|
566
568
|
},
|
|
@@ -570,7 +572,9 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
570
572
|
dialogRootInstances--;
|
|
571
573
|
if (dialogRootInstances === 0) {
|
|
572
574
|
dialogInstance = null;
|
|
573
|
-
|
|
575
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
576
|
+
window.removeEventListener('popstate', this.handleBack);
|
|
577
|
+
}
|
|
574
578
|
}
|
|
575
579
|
}
|
|
576
580
|
},
|
|
@@ -580,8 +584,10 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
580
584
|
if (this.state.dialogProps) {
|
|
581
585
|
throw Error('Tried to show a dialog on top of another dialog. This functionality is not currently supported.');
|
|
582
586
|
}
|
|
583
|
-
|
|
584
|
-
|
|
587
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
588
|
+
// We add an additional entry to history with the same page, so the first time back is pressed we only close the Dialog
|
|
589
|
+
window.history.pushState(null, document.title, window.location.href);
|
|
590
|
+
}
|
|
585
591
|
this.setState({
|
|
586
592
|
dialogProps: props,
|
|
587
593
|
isClosing: false
|
|
@@ -591,8 +597,12 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
591
597
|
{
|
|
592
598
|
key: "close",
|
|
593
599
|
value: function close() {
|
|
594
|
-
|
|
595
|
-
|
|
600
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
601
|
+
// Here we have to remove the additional entry added to history when we created the Dialog
|
|
602
|
+
window.history.back();
|
|
603
|
+
} else {
|
|
604
|
+
this.handleBack();
|
|
605
|
+
}
|
|
596
606
|
}
|
|
597
607
|
},
|
|
598
608
|
{
|
|
@@ -651,6 +661,7 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
651
661
|
]);
|
|
652
662
|
return DialogRoot;
|
|
653
663
|
}(React.Component);
|
|
664
|
+
DialogRoot.contextType = _themeContext.default;
|
|
654
665
|
exports.default = DialogRoot;
|
|
655
666
|
var showDialog = function showDialog(param) {
|
|
656
667
|
var showCancel = param === void 0 ? false : param;
|
package/dist/dialog.js.flow
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import type { Theme } from "./theme";
|
|
4
5
|
declare type DialogProps = {
|
|
5
6
|
className?: string,
|
|
6
7
|
title?: string,
|
|
@@ -24,6 +25,7 @@ declare type DialogRootState = {
|
|
|
24
25
|
declare export default class DialogRoot
|
|
25
26
|
mixins React.Component<DialogRootProps, DialogRootState>
|
|
26
27
|
{
|
|
28
|
+
static contextType: React.Context<Theme | null>;
|
|
27
29
|
state: DialogRootState;
|
|
28
30
|
componentDidMount(): void;
|
|
29
31
|
componentWillUnmount(): void;
|
package/dist/package-version.js
CHANGED
|
@@ -197,7 +197,8 @@ var ThemeContextProvider = function ThemeContextProvider(param) {
|
|
|
197
197
|
Link: (_Link = theme.Link) !== null && _Link !== void 0 ? _Link : _theme.AnchorLink,
|
|
198
198
|
isDarkMode: isDarkModeEnabled,
|
|
199
199
|
isIos: (0, _platform).getPlatform(platformOverrides) === 'ios',
|
|
200
|
-
useHrefDecorator: (_useHrefDecorator = theme.useHrefDecorator) !== null && _useHrefDecorator !== void 0 ? _useHrefDecorator : useDefaultHrefDecorator
|
|
200
|
+
useHrefDecorator: (_useHrefDecorator = theme.useHrefDecorator) !== null && _useHrefDecorator !== void 0 ? _useHrefDecorator : useDefaultHrefDecorator,
|
|
201
|
+
unstable_disableHistoryUpdateInDialogs: !!theme.unstable_disableHistoryUpdateInDialogs
|
|
201
202
|
};
|
|
202
203
|
}, [
|
|
203
204
|
theme,
|
package/dist/theme.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ export declare type ThemeConfig = {
|
|
|
100
100
|
Link?: LinkComponent;
|
|
101
101
|
useHrefDecorator?: () => (href: string) => string;
|
|
102
102
|
enableTabFocus?: boolean;
|
|
103
|
+
unstable_disableHistoryUpdateInDialogs?: boolean;
|
|
103
104
|
};
|
|
104
105
|
export declare type Theme = {
|
|
105
106
|
skinName: SkinName;
|
|
@@ -134,5 +135,6 @@ export declare type Theme = {
|
|
|
134
135
|
isDarkMode: boolean;
|
|
135
136
|
isIos: boolean;
|
|
136
137
|
useHrefDecorator: () => (href: string) => string;
|
|
138
|
+
unstable_disableHistoryUpdateInDialogs: boolean;
|
|
137
139
|
};
|
|
138
140
|
export {};
|
package/dist/theme.js.flow
CHANGED
|
@@ -104,6 +104,7 @@ export type ThemeConfig = {
|
|
|
104
104
|
Link?: LinkComponent,
|
|
105
105
|
useHrefDecorator?: () => (href: string) => string,
|
|
106
106
|
enableTabFocus?: boolean,
|
|
107
|
+
unstable_disableHistoryUpdateInDialogs?: boolean,
|
|
107
108
|
};
|
|
108
109
|
export type Theme = {
|
|
109
110
|
skinName: SkinName,
|
|
@@ -138,6 +139,7 @@ export type Theme = {
|
|
|
138
139
|
isDarkMode: boolean,
|
|
139
140
|
isIos: boolean,
|
|
140
141
|
useHrefDecorator: () => (href: string) => string,
|
|
142
|
+
unstable_disableHistoryUpdateInDialogs: boolean,
|
|
141
143
|
};
|
|
142
144
|
declare export {};
|
|
143
145
|
|
package/dist-es/dialog.js
CHANGED
|
@@ -518,7 +518,9 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
518
518
|
dialogRootInstances++;
|
|
519
519
|
if (dialogRootInstances === 1) {
|
|
520
520
|
dialogInstance = this;
|
|
521
|
-
|
|
521
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
522
|
+
window.addEventListener('popstate', this.handleBack);
|
|
523
|
+
}
|
|
522
524
|
}
|
|
523
525
|
}
|
|
524
526
|
},
|
|
@@ -528,7 +530,9 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
528
530
|
dialogRootInstances--;
|
|
529
531
|
if (dialogRootInstances === 0) {
|
|
530
532
|
dialogInstance = null;
|
|
531
|
-
|
|
533
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
534
|
+
window.removeEventListener('popstate', this.handleBack);
|
|
535
|
+
}
|
|
532
536
|
}
|
|
533
537
|
}
|
|
534
538
|
},
|
|
@@ -538,8 +542,10 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
538
542
|
if (this.state.dialogProps) {
|
|
539
543
|
throw Error('Tried to show a dialog on top of another dialog. This functionality is not currently supported.');
|
|
540
544
|
}
|
|
541
|
-
|
|
542
|
-
|
|
545
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
546
|
+
// We add an additional entry to history with the same page, so the first time back is pressed we only close the Dialog
|
|
547
|
+
window.history.pushState(null, document.title, window.location.href);
|
|
548
|
+
}
|
|
543
549
|
this.setState({
|
|
544
550
|
dialogProps: props,
|
|
545
551
|
isClosing: false
|
|
@@ -549,8 +555,12 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
549
555
|
{
|
|
550
556
|
key: "close",
|
|
551
557
|
value: function close() {
|
|
552
|
-
|
|
553
|
-
|
|
558
|
+
if (!this.context.unstable_disableHistoryUpdateInDialogs) {
|
|
559
|
+
// Here we have to remove the additional entry added to history when we created the Dialog
|
|
560
|
+
window.history.back();
|
|
561
|
+
} else {
|
|
562
|
+
this.handleBack();
|
|
563
|
+
}
|
|
554
564
|
}
|
|
555
565
|
},
|
|
556
566
|
{
|
|
@@ -606,6 +616,7 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
606
616
|
]);
|
|
607
617
|
return DialogRoot;
|
|
608
618
|
}(React.Component);
|
|
619
|
+
DialogRoot.contextType = ThemeContext;
|
|
609
620
|
export { DialogRoot as default };
|
|
610
621
|
var showDialog = function(param) {
|
|
611
622
|
var showCancel = param === void 0 ? false : param;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
|
|
2
|
-
export var PACKAGE_VERSION = '10.
|
|
2
|
+
export var PACKAGE_VERSION = '10.23.0';
|
|
@@ -163,7 +163,8 @@ var ThemeContextProvider = function(param) {
|
|
|
163
163
|
Link: (_Link = theme.Link) !== null && _Link !== void 0 ? _Link : AnchorLink,
|
|
164
164
|
isDarkMode: isDarkModeEnabled,
|
|
165
165
|
isIos: getPlatform(platformOverrides) === 'ios',
|
|
166
|
-
useHrefDecorator: (_useHrefDecorator = theme.useHrefDecorator) !== null && _useHrefDecorator !== void 0 ? _useHrefDecorator : useDefaultHrefDecorator
|
|
166
|
+
useHrefDecorator: (_useHrefDecorator = theme.useHrefDecorator) !== null && _useHrefDecorator !== void 0 ? _useHrefDecorator : useDefaultHrefDecorator,
|
|
167
|
+
unstable_disableHistoryUpdateInDialogs: !!theme.unstable_disableHistoryUpdateInDialogs
|
|
167
168
|
};
|
|
168
169
|
}, [
|
|
169
170
|
theme,
|