@tramvai/react 2.24.3 → 2.26.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/lib/error/hoc.d.ts +1 -1
- package/lib/lazy/lazy.d.ts +1 -1
- package/lib/react.es.js +9 -10
- package/lib/react.js +9 -10
- package/package.json +5 -5
package/lib/error/hoc.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use UniversalErrorBoundary component
|
|
4
4
|
*/
|
|
5
|
-
export declare const withError: ({ fallbackComponent
|
|
5
|
+
export declare const withError: ({ fallbackComponent }?: {
|
|
6
6
|
fallbackComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
7
7
|
}) => <T extends React.ComponentType<{
|
|
8
8
|
children?: React.ReactNode;
|
package/lib/lazy/lazy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoadableComponent, DefaultComponent } from '@loadable/component';
|
|
2
2
|
import type { TramvaiComponent, TramvaiComponentDecl } from '../typings/components';
|
|
3
|
-
export declare const resolveLazyComponent: (componentOrLoader?: TramvaiComponentDecl
|
|
3
|
+
export declare const resolveLazyComponent: (componentOrLoader?: TramvaiComponentDecl) => Promise<TramvaiComponent | undefined>;
|
|
4
4
|
interface Options {
|
|
5
5
|
loading?: JSX.Element;
|
|
6
6
|
}
|
package/lib/react.es.js
CHANGED
|
@@ -40,27 +40,26 @@ const withDi = (deps) => (WrappedComponent) => {
|
|
|
40
40
|
function WrapperWithPropsFromDi(props) {
|
|
41
41
|
const depsInstance = useDi(deps);
|
|
42
42
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
43
|
-
return jsx(WrappedComponent,
|
|
43
|
+
return jsx(WrappedComponent, { ...props, ...depsInstance });
|
|
44
44
|
}
|
|
45
45
|
return hoistStatics(WrapperWithPropsFromDi, WrappedComponent);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
const FallbackError = () => {
|
|
49
|
-
return (jsxs("div", { children: [jsx("div",
|
|
49
|
+
return (jsxs("div", { children: [jsx("div", { style: {
|
|
50
50
|
textAlign: 'center',
|
|
51
51
|
marginBottom: 11,
|
|
52
52
|
paddingTop: 26,
|
|
53
53
|
fontSize: 30,
|
|
54
54
|
lineHeight: '36px',
|
|
55
55
|
fontWeight: 200,
|
|
56
|
-
}
|
|
57
|
-
jsxs("div", Object.assign({ style: {
|
|
56
|
+
}, children: "An error occurred :(" }), jsxs("div", { style: {
|
|
58
57
|
textAlign: 'center',
|
|
59
58
|
marginBottom: 17,
|
|
60
59
|
color: '#9299a2',
|
|
61
60
|
fontSize: 20,
|
|
62
61
|
lineHeight: '24px',
|
|
63
|
-
}
|
|
62
|
+
}, children: ["Try", ' ', jsx("a", { href: "", onClick: () => window.location.reload(), children: "reloading the page" })] })] }));
|
|
64
63
|
};
|
|
65
64
|
FallbackError.displayName = 'FallbackError';
|
|
66
65
|
|
|
@@ -97,12 +96,12 @@ class UniversalErrorBoundary extends Component {
|
|
|
97
96
|
return children;
|
|
98
97
|
}
|
|
99
98
|
if (Fallback) {
|
|
100
|
-
return jsx(Fallback, { url: url, error: error }
|
|
99
|
+
return jsx(Fallback, { url: url, error: error });
|
|
101
100
|
}
|
|
102
101
|
if (fallbackFromDi) {
|
|
103
102
|
return fallbackFromDi;
|
|
104
103
|
}
|
|
105
|
-
return jsx(FallbackError, {}
|
|
104
|
+
return jsx(FallbackError, {});
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
UniversalErrorBoundary.displayName = 'UniversalErrorBoundary';
|
|
@@ -143,7 +142,7 @@ let ErrorBoundary = class ErrorBoundary extends Component {
|
|
|
143
142
|
if (!hasError) {
|
|
144
143
|
return children;
|
|
145
144
|
}
|
|
146
|
-
return fallbackComponent || fallbackComponentFromDi || jsx(FallbackError, {}
|
|
145
|
+
return fallbackComponent || fallbackComponentFromDi || jsx(FallbackError, {});
|
|
147
146
|
}
|
|
148
147
|
};
|
|
149
148
|
ErrorBoundary.displayName = 'ErrorBoundary';
|
|
@@ -157,9 +156,9 @@ ErrorBoundary = __decorate([
|
|
|
157
156
|
/**
|
|
158
157
|
* @deprecated Use UniversalErrorBoundary component
|
|
159
158
|
*/
|
|
160
|
-
const withError = ({ fallbackComponent
|
|
159
|
+
const withError = ({ fallbackComponent } = {}) => (WrappedComponent) => {
|
|
161
160
|
function WrapperWithError(props) {
|
|
162
|
-
return (jsx(ErrorBoundary,
|
|
161
|
+
return (jsx(ErrorBoundary, { fallbackComponent: fallbackComponent, children: jsx(WrappedComponent, { ...props }) }));
|
|
163
162
|
}
|
|
164
163
|
return hoistStatics(WrapperWithError, WrappedComponent);
|
|
165
164
|
};
|
package/lib/react.js
CHANGED
|
@@ -50,27 +50,26 @@ const withDi = (deps) => (WrappedComponent) => {
|
|
|
50
50
|
function WrapperWithPropsFromDi(props) {
|
|
51
51
|
const depsInstance = useDi(deps);
|
|
52
52
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
53
|
-
return jsxRuntime.jsx(WrappedComponent,
|
|
53
|
+
return jsxRuntime.jsx(WrappedComponent, { ...props, ...depsInstance });
|
|
54
54
|
}
|
|
55
55
|
return hoistStatics__default["default"](WrapperWithPropsFromDi, WrappedComponent);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
const FallbackError = () => {
|
|
59
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div",
|
|
59
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { style: {
|
|
60
60
|
textAlign: 'center',
|
|
61
61
|
marginBottom: 11,
|
|
62
62
|
paddingTop: 26,
|
|
63
63
|
fontSize: 30,
|
|
64
64
|
lineHeight: '36px',
|
|
65
65
|
fontWeight: 200,
|
|
66
|
-
}
|
|
67
|
-
jsxRuntime.jsxs("div", Object.assign({ style: {
|
|
66
|
+
}, children: "An error occurred :(" }), jsxRuntime.jsxs("div", { style: {
|
|
68
67
|
textAlign: 'center',
|
|
69
68
|
marginBottom: 17,
|
|
70
69
|
color: '#9299a2',
|
|
71
70
|
fontSize: 20,
|
|
72
71
|
lineHeight: '24px',
|
|
73
|
-
}
|
|
72
|
+
}, children: ["Try", ' ', jsxRuntime.jsx("a", { href: "", onClick: () => window.location.reload(), children: "reloading the page" })] })] }));
|
|
74
73
|
};
|
|
75
74
|
FallbackError.displayName = 'FallbackError';
|
|
76
75
|
|
|
@@ -107,12 +106,12 @@ class UniversalErrorBoundary extends react.Component {
|
|
|
107
106
|
return children;
|
|
108
107
|
}
|
|
109
108
|
if (Fallback) {
|
|
110
|
-
return jsxRuntime.jsx(Fallback, { url: url, error: error }
|
|
109
|
+
return jsxRuntime.jsx(Fallback, { url: url, error: error });
|
|
111
110
|
}
|
|
112
111
|
if (fallbackFromDi) {
|
|
113
112
|
return fallbackFromDi;
|
|
114
113
|
}
|
|
115
|
-
return jsxRuntime.jsx(FallbackError, {}
|
|
114
|
+
return jsxRuntime.jsx(FallbackError, {});
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
UniversalErrorBoundary.displayName = 'UniversalErrorBoundary';
|
|
@@ -153,7 +152,7 @@ exports.ErrorBoundary = class ErrorBoundary extends react.Component {
|
|
|
153
152
|
if (!hasError) {
|
|
154
153
|
return children;
|
|
155
154
|
}
|
|
156
|
-
return fallbackComponent || fallbackComponentFromDi || jsxRuntime.jsx(FallbackError, {}
|
|
155
|
+
return fallbackComponent || fallbackComponentFromDi || jsxRuntime.jsx(FallbackError, {});
|
|
157
156
|
}
|
|
158
157
|
};
|
|
159
158
|
exports.ErrorBoundary.displayName = 'ErrorBoundary';
|
|
@@ -167,9 +166,9 @@ exports.ErrorBoundary = tslib.__decorate([
|
|
|
167
166
|
/**
|
|
168
167
|
* @deprecated Use UniversalErrorBoundary component
|
|
169
168
|
*/
|
|
170
|
-
const withError = ({ fallbackComponent
|
|
169
|
+
const withError = ({ fallbackComponent } = {}) => (WrappedComponent) => {
|
|
171
170
|
function WrapperWithError(props) {
|
|
172
|
-
return (jsxRuntime.jsx(exports.ErrorBoundary,
|
|
171
|
+
return (jsxRuntime.jsx(exports.ErrorBoundary, { fallbackComponent: fallbackComponent, children: jsxRuntime.jsx(WrappedComponent, { ...props }) }));
|
|
173
172
|
}
|
|
174
173
|
return hoistStatics__default["default"](WrapperWithError, WrappedComponent);
|
|
175
174
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/react.js",
|
|
6
6
|
"typings": "lib/react.d.ts",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@loadable/component": "^5.15.2",
|
|
22
22
|
"@types/loadable__component": "^5.13.4",
|
|
23
|
-
"@tramvai/types-actions-state-context": "2.
|
|
23
|
+
"@tramvai/types-actions-state-context": "2.26.0",
|
|
24
24
|
"hoist-non-react-statics": "^3.3.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@tinkoff/dippy": "0.8.
|
|
27
|
+
"@tinkoff/dippy": "0.8.5",
|
|
28
28
|
"@tinkoff/utils": "^2.1.2",
|
|
29
|
-
"@tinkoff/url": "0.8.
|
|
29
|
+
"@tinkoff/url": "0.8.3",
|
|
30
30
|
"react": ">=16.14.0",
|
|
31
31
|
"react-dom": ">=16.14.0",
|
|
32
|
-
"tslib": "^2.0
|
|
32
|
+
"tslib": "^2.4.0"
|
|
33
33
|
},
|
|
34
34
|
"module": "lib/react.es.js",
|
|
35
35
|
"license": "Apache-2.0"
|