@telefonica/mistica 10.24.0 → 10.25.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 +21 -0
- package/dist/package-version.js +1 -1
- package/dist/popover.js +4 -6
- package/dist/theme-context-provider.d.ts +10 -0
- package/dist/theme-context-provider.js +14 -7
- package/dist/theme-context-provider.js.flow +11 -0
- package/dist/utils/types.d.ts +1 -7
- package/dist/utils/types.js.flow +1 -7
- package/dist-es/package-version.js +1 -1
- package/dist-es/popover.js +4 -6
- package/dist-es/theme-context-provider.js +14 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [10.25.0](https://github.com/Telefonica/mistica-web/compare/v10.24.2...v10.25.0) (2022-02-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **webview-bridge:** upgrade webview-bridge dependency ([#420](https://github.com/Telefonica/mistica-web/issues/420)) ([0b01b6e](https://github.com/Telefonica/mistica-web/commit/0b01b6ed67bb0bcb10927ffb44812095abacc233))
|
|
7
|
+
|
|
8
|
+
## [10.24.2](https://github.com/Telefonica/mistica-web/compare/v10.24.1...v10.24.2) (2022-02-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **Popover:** bug with close event propagation ([#421](https://github.com/Telefonica/mistica-web/issues/421)) ([0b439b6](https://github.com/Telefonica/mistica-web/commit/0b439b6cdb9ea6404d0ec2c6b50b61d99937cbc6))
|
|
14
|
+
|
|
15
|
+
## [10.24.1](https://github.com/Telefonica/mistica-web/compare/v10.24.0...v10.24.1) (2022-02-16)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **ThemeContextProvider:** Support SSR + Strict Mode ([#419](https://github.com/Telefonica/mistica-web/issues/419)) ([05b701d](https://github.com/Telefonica/mistica-web/commit/05b701d868d3b49a280c32365244771bd9c94416))
|
|
21
|
+
|
|
1
22
|
# [10.24.0](https://github.com/Telefonica/mistica-web/compare/v10.23.0...v10.24.0) (2022-02-15)
|
|
2
23
|
|
|
3
24
|
|
package/dist/package-version.js
CHANGED
package/dist/popover.js
CHANGED
|
@@ -302,11 +302,6 @@ var Popover = function Popover(param) {
|
|
|
302
302
|
}, [
|
|
303
303
|
isVisible
|
|
304
304
|
]);
|
|
305
|
-
var handleClose = function handleClose() {
|
|
306
|
-
if (onClose) {
|
|
307
|
-
onClose();
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
305
|
var popoverContainer = null;
|
|
311
306
|
if (isVisible && targetPosition) {
|
|
312
307
|
var ref2 = getPositionStyles(position, innerWidth, targetPosition, isTabletOrSmaller), containerStyles = ref2.containerStyles, arrowStyles = ref2.arrowStyles;
|
|
@@ -346,7 +341,10 @@ var Popover = function Popover(param) {
|
|
|
346
341
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
347
342
|
className: classes.closeButtonIcon,
|
|
348
343
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
|
|
349
|
-
onPress:
|
|
344
|
+
onPress: function onPress(e) {
|
|
345
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
346
|
+
e.stopPropagation();
|
|
347
|
+
},
|
|
350
348
|
trackingEvent: trackingEvent,
|
|
351
349
|
"aria-label": texts.modalClose,
|
|
352
350
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconCloseRegular.default, {
|
|
@@ -3,6 +3,16 @@ import type { ThemeConfig } from './theme';
|
|
|
3
3
|
export declare const useIsOsDarkModeEnabled: () => boolean;
|
|
4
4
|
declare type Props = {
|
|
5
5
|
theme: ThemeConfig;
|
|
6
|
+
/**
|
|
7
|
+
* You should use this prop if you use Strict Mode and Server Side Rendering together.
|
|
8
|
+
* This identifier will be used to generate unique class names for each instance of ThemeContextProvider.
|
|
9
|
+
* If no identifier is provided, this will fallback to an auto-incremented id, which will cause
|
|
10
|
+
* problems in SSR + Strict Mode because the class names from client and server won't match.
|
|
11
|
+
* More info: https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects
|
|
12
|
+
*
|
|
13
|
+
* Once we migrate to React18, we could remove this prop and use the useId hook instead.
|
|
14
|
+
*/
|
|
15
|
+
providerId?: string;
|
|
6
16
|
children?: React.ReactNode;
|
|
7
17
|
};
|
|
8
18
|
declare const ThemeContextProvider: React.FC<Props>;
|
|
@@ -145,7 +145,7 @@ exports.useIsOsDarkModeEnabled = useIsOsDarkModeEnabled;
|
|
|
145
145
|
// This counter will increment with every new instance of ThemeContextProvider in the app. In a typical app we don't need more than
|
|
146
146
|
// one instance of ThemeContextProvider. But some apps may depend on libs that use Mistica too, so there may be more than one instance
|
|
147
147
|
// in those cases. We use this counter to avoid class name collisions in those cases.
|
|
148
|
-
var
|
|
148
|
+
var nextJssInstanceId = 0;
|
|
149
149
|
var generateId = function() {
|
|
150
150
|
if (process.env.NODE_ENV === 'test') {
|
|
151
151
|
// in tests classnames are just the classame, whithout ids
|
|
@@ -166,12 +166,19 @@ var useDefaultHrefDecorator = function useDefaultHrefDecorator() {
|
|
|
166
166
|
};
|
|
167
167
|
};
|
|
168
168
|
var ThemeContextProvider = function ThemeContextProvider(param) {
|
|
169
|
-
var theme = param.theme, children = param.children;
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
var theme = param.theme, children = param.children, providerId = param.providerId;
|
|
170
|
+
var ref = _slicedToArray(React.useState(function() {
|
|
171
|
+
if (providerId) {
|
|
172
|
+
return providerId;
|
|
173
|
+
} else {
|
|
174
|
+
return (0, _environment).isServerSide() ? 0 : nextJssInstanceId++;
|
|
175
|
+
}
|
|
176
|
+
}), 1), instanceId = ref[0];
|
|
177
|
+
var classNamePrefix = React.useMemo(function() {
|
|
178
|
+
return process.env.NODE_ENV === 'test' ? '' : "mistica-".concat(_packageVersion.PACKAGE_VERSION.replace(/\./g, '-'), "_").concat(instanceId, "_");
|
|
179
|
+
}, [
|
|
180
|
+
instanceId
|
|
181
|
+
]);
|
|
175
182
|
var nextAriaId = React.useRef(1);
|
|
176
183
|
var getAriaId = React.useCallback(function() {
|
|
177
184
|
return "aria-id-hook-".concat(nextAriaId.current++);
|
|
@@ -5,6 +5,17 @@ import type { ThemeConfig } from "./theme";
|
|
|
5
5
|
declare export var useIsOsDarkModeEnabled: () => boolean;
|
|
6
6
|
declare type Props = {
|
|
7
7
|
theme: ThemeConfig,
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* You should use this prop if you use Strict Mode and Server Side Rendering together.
|
|
11
|
+
* This identifier will be used to generate unique class names for each instance of ThemeContextProvider.
|
|
12
|
+
* If no identifier is provided, this will fallback to an auto-incremented id, which will cause
|
|
13
|
+
* problems in SSR + Strict Mode because the class names from client and server won't match.
|
|
14
|
+
* More info: https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects
|
|
15
|
+
*
|
|
16
|
+
* Once we migrate to React18, we could remove this prop and use the useId hook instead.
|
|
17
|
+
*/
|
|
18
|
+
providerId?: string,
|
|
8
19
|
children?: React.Node,
|
|
9
20
|
};
|
|
10
21
|
declare var ThemeContextProvider: React.ComponentType<Props>;
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export type { RendersElement, RendersNullableElement } from './renders-element';
|
|
3
|
-
export
|
|
4
|
-
readonly [key: string]: unknown;
|
|
5
|
-
readonly category: string;
|
|
6
|
-
readonly action: string;
|
|
7
|
-
readonly label?: string;
|
|
8
|
-
readonly value?: number;
|
|
9
|
-
};
|
|
3
|
+
export type { TrackingEvent } from '@tef-novum/webview-bridge';
|
|
10
4
|
export declare type DataAttributes = {
|
|
11
5
|
[name: string]: string | number | boolean | undefined;
|
|
12
6
|
};
|
package/dist/utils/types.js.flow
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
export type { RendersElement, RendersNullableElement } from "./renders-element";
|
|
4
|
-
export type TrackingEvent
|
|
5
|
-
[key: string]: mixed,
|
|
6
|
-
+category: string,
|
|
7
|
-
+action: string,
|
|
8
|
-
+label?: string,
|
|
9
|
-
+value?: number,
|
|
10
|
-
};
|
|
4
|
+
export type { TrackingEvent } from "@tef-novum/webview-bridge";
|
|
11
5
|
export type DataAttributes = {
|
|
12
6
|
[name: string]: string | number | boolean | void,
|
|
13
7
|
};
|
|
@@ -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.25.0';
|
package/dist-es/popover.js
CHANGED
|
@@ -270,11 +270,6 @@ var Popover = function(param) {
|
|
|
270
270
|
}, [
|
|
271
271
|
isVisible
|
|
272
272
|
]);
|
|
273
|
-
var handleClose = function() {
|
|
274
|
-
if (onClose) {
|
|
275
|
-
onClose();
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
273
|
var popoverContainer = null;
|
|
279
274
|
if (isVisible && targetPosition) {
|
|
280
275
|
var ref2 = getPositionStyles(position, innerWidth, targetPosition, isTabletOrSmaller), containerStyles = ref2.containerStyles, arrowStyles = ref2.arrowStyles;
|
|
@@ -314,7 +309,10 @@ var Popover = function(param) {
|
|
|
314
309
|
/*#__PURE__*/ _jsx("div", {
|
|
315
310
|
className: classes.closeButtonIcon,
|
|
316
311
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
317
|
-
onPress:
|
|
312
|
+
onPress: function(e) {
|
|
313
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
314
|
+
e.stopPropagation();
|
|
315
|
+
},
|
|
318
316
|
trackingEvent: trackingEvent,
|
|
319
317
|
"aria-label": texts.modalClose,
|
|
320
318
|
children: /*#__PURE__*/ _jsx(IcnCloseRegular, {
|
|
@@ -112,7 +112,7 @@ export var useIsOsDarkModeEnabled = function() {
|
|
|
112
112
|
// This counter will increment with every new instance of ThemeContextProvider in the app. In a typical app we don't need more than
|
|
113
113
|
// one instance of ThemeContextProvider. But some apps may depend on libs that use Mistica too, so there may be more than one instance
|
|
114
114
|
// in those cases. We use this counter to avoid class name collisions in those cases.
|
|
115
|
-
var
|
|
115
|
+
var nextJssInstanceId = 0;
|
|
116
116
|
var generateId = function() {
|
|
117
117
|
if (process.env.NODE_ENV === 'test') {
|
|
118
118
|
// in tests classnames are just the classame, whithout ids
|
|
@@ -133,13 +133,19 @@ var useDefaultHrefDecorator = function() {
|
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
var ThemeContextProvider = function(param) {
|
|
136
|
-
var theme = param.theme, children = param.children;
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
var theme = param.theme, children = param.children, providerId = param.providerId;
|
|
137
|
+
var ref = _slicedToArray(React.useState(function() {
|
|
138
|
+
if (providerId) {
|
|
139
|
+
return providerId;
|
|
140
|
+
} else {
|
|
141
|
+
return isServerSide() ? 0 : nextJssInstanceId++;
|
|
142
|
+
}
|
|
143
|
+
}), 1), instanceId = ref[0];
|
|
144
|
+
var classNamePrefix = React.useMemo(function() {
|
|
145
|
+
return process.env.NODE_ENV === 'test' ? '' : "mistica-".concat(PACKAGE_VERSION.replace(/\./g, '-'), "_").concat(instanceId, "_");
|
|
146
|
+
}, [
|
|
147
|
+
instanceId
|
|
148
|
+
]);
|
|
143
149
|
var nextAriaId = React.useRef(1);
|
|
144
150
|
var getAriaId = React.useCallback(function() {
|
|
145
151
|
return "aria-id-hook-".concat(nextAriaId.current++);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telefonica/mistica",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.25.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
124
|
"@juggle/resize-observer": "^3.3.1",
|
|
125
|
-
"@tef-novum/webview-bridge": "^3.
|
|
125
|
+
"@tef-novum/webview-bridge": "^3.2.1",
|
|
126
126
|
"@telefonica/libphonenumber": "^2.8.0",
|
|
127
127
|
"classnames": "^2.3.1",
|
|
128
128
|
"jss": "^10.6.0",
|