@hero-design/rn 8.13.0 β 8.14.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/.turbo/turbo-build.log +9 -9
- package/es/index.js +5 -1
- package/lib/index.js +5 -1
- package/package.json +5 -5
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
- package/src/components/Error/__tests__/index.spec.tsx +2 -9
- package/src/components/Error/index.tsx +17 -9
- package/types/components/Error/index.d.ts +8 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
1
|
+
[32m@hero-design/rn:build[0m: cache hit, replaying output [2m03d15f462ba189d6[0m
|
|
2
|
+
[32m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
|
+
[32m@hero-design/rn:build: [0m$ rollup -c
|
|
4
|
+
[32m@hero-design/rn:build: [0m[36m
|
|
5
|
+
[32m@hero-design/rn:build: [0m[1msrc/index.ts[22m β [1mlib/index.js, es/index.js[22m...[39m
|
|
6
|
+
[32m@hero-design/rn:build: [0m[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
|
+
[32m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
+
[32m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m26.9s[22m[39m
|
|
9
|
+
[32m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -12380,7 +12380,7 @@ var StyledErrorDescription = index$a(Typography.Text)(function (_ref8) {
|
|
|
12380
12380
|
});
|
|
12381
12381
|
|
|
12382
12382
|
var _excluded$a = ["variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"],
|
|
12383
|
-
_excluded2 = ["visible", "variant", "title", "description", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
|
|
12383
|
+
_excluded2 = ["visible", "variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
|
|
12384
12384
|
var ErrorPage = function ErrorPage(_ref) {
|
|
12385
12385
|
var _ref$variant = _ref.variant,
|
|
12386
12386
|
variant = _ref$variant === void 0 ? 'in-page' : _ref$variant,
|
|
@@ -12427,12 +12427,14 @@ var Error$1 = function Error(_ref2) {
|
|
|
12427
12427
|
variant = _ref2$variant === void 0 ? 'in-page' : _ref2$variant,
|
|
12428
12428
|
title = _ref2.title,
|
|
12429
12429
|
description = _ref2.description,
|
|
12430
|
+
image = _ref2.image,
|
|
12430
12431
|
testID = _ref2.testID,
|
|
12431
12432
|
ctaText = _ref2.ctaText,
|
|
12432
12433
|
onCtaPress = _ref2.onCtaPress,
|
|
12433
12434
|
secondaryCtaText = _ref2.secondaryCtaText,
|
|
12434
12435
|
onSecondaryCtaPress = _ref2.onSecondaryCtaPress,
|
|
12435
12436
|
nativeProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
12437
|
+
useDeprecation("Visible prop is deprecated. Use conditional rendering instead", visible);
|
|
12436
12438
|
var _useState = useState(visible),
|
|
12437
12439
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12438
12440
|
isVisible = _useState2[0],
|
|
@@ -12478,6 +12480,7 @@ var Error$1 = function Error(_ref2) {
|
|
|
12478
12480
|
variant: variant,
|
|
12479
12481
|
title: title,
|
|
12480
12482
|
description: description,
|
|
12483
|
+
image: image,
|
|
12481
12484
|
testID: testID,
|
|
12482
12485
|
ctaText: ctaText,
|
|
12483
12486
|
onCtaPress: onCtaPress && function () {
|
|
@@ -12493,6 +12496,7 @@ var Error$1 = function Error(_ref2) {
|
|
|
12493
12496
|
variant: variant,
|
|
12494
12497
|
title: title,
|
|
12495
12498
|
description: description,
|
|
12499
|
+
image: image,
|
|
12496
12500
|
testID: testID,
|
|
12497
12501
|
ctaText: ctaText,
|
|
12498
12502
|
onCtaPress: onCtaPress,
|
package/lib/index.js
CHANGED
|
@@ -12409,7 +12409,7 @@ var StyledErrorDescription = index$a(Typography.Text)(function (_ref8) {
|
|
|
12409
12409
|
});
|
|
12410
12410
|
|
|
12411
12411
|
var _excluded$a = ["variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"],
|
|
12412
|
-
_excluded2 = ["visible", "variant", "title", "description", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
|
|
12412
|
+
_excluded2 = ["visible", "variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
|
|
12413
12413
|
var ErrorPage = function ErrorPage(_ref) {
|
|
12414
12414
|
var _ref$variant = _ref.variant,
|
|
12415
12415
|
variant = _ref$variant === void 0 ? 'in-page' : _ref$variant,
|
|
@@ -12456,12 +12456,14 @@ var Error$1 = function Error(_ref2) {
|
|
|
12456
12456
|
variant = _ref2$variant === void 0 ? 'in-page' : _ref2$variant,
|
|
12457
12457
|
title = _ref2.title,
|
|
12458
12458
|
description = _ref2.description,
|
|
12459
|
+
image = _ref2.image,
|
|
12459
12460
|
testID = _ref2.testID,
|
|
12460
12461
|
ctaText = _ref2.ctaText,
|
|
12461
12462
|
onCtaPress = _ref2.onCtaPress,
|
|
12462
12463
|
secondaryCtaText = _ref2.secondaryCtaText,
|
|
12463
12464
|
onSecondaryCtaPress = _ref2.onSecondaryCtaPress,
|
|
12464
12465
|
nativeProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
12466
|
+
useDeprecation("Visible prop is deprecated. Use conditional rendering instead", visible);
|
|
12465
12467
|
var _useState = React.useState(visible),
|
|
12466
12468
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12467
12469
|
isVisible = _useState2[0],
|
|
@@ -12507,6 +12509,7 @@ var Error$1 = function Error(_ref2) {
|
|
|
12507
12509
|
variant: variant,
|
|
12508
12510
|
title: title,
|
|
12509
12511
|
description: description,
|
|
12512
|
+
image: image,
|
|
12510
12513
|
testID: testID,
|
|
12511
12514
|
ctaText: ctaText,
|
|
12512
12515
|
onCtaPress: onCtaPress && function () {
|
|
@@ -12522,6 +12525,7 @@ var Error$1 = function Error(_ref2) {
|
|
|
12522
12525
|
variant: variant,
|
|
12523
12526
|
title: title,
|
|
12524
12527
|
description: description,
|
|
12528
|
+
image: image,
|
|
12525
12529
|
testID: testID,
|
|
12526
12530
|
ctaText: ctaText,
|
|
12527
12531
|
onCtaPress: onCtaPress,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.
|
|
24
|
+
"@hero-design/colors": "8.14.0",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/preset-typescript": "^7.17.12",
|
|
45
45
|
"@babel/runtime": "^7.18.9",
|
|
46
46
|
"@emotion/jest": "^11.9.3",
|
|
47
|
-
"@hero-design/eslint-plugin": "8.
|
|
47
|
+
"@hero-design/eslint-plugin": "8.14.0",
|
|
48
48
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
49
49
|
"@react-native-community/slider": "4.1.12",
|
|
50
50
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@types/react-native": "^0.67.7",
|
|
61
61
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
62
62
|
"babel-plugin-inline-import": "^3.0.0",
|
|
63
|
-
"eslint-config-hd": "8.
|
|
63
|
+
"eslint-config-hd": "8.14.0",
|
|
64
64
|
"jest": "^27.3.1",
|
|
65
|
-
"prettier-config-hd": "8.
|
|
65
|
+
"prettier-config-hd": "8.14.0",
|
|
66
66
|
"react": "18.0.0",
|
|
67
67
|
"react-native": "0.69.7",
|
|
68
68
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -57,6 +57,7 @@ exports[`Error renders error screen with image correctly 1`] = `
|
|
|
57
57
|
testID="error-image"
|
|
58
58
|
/>
|
|
59
59
|
<Text
|
|
60
|
+
allowFontScaling={false}
|
|
60
61
|
style={
|
|
61
62
|
Array [
|
|
62
63
|
Object {
|
|
@@ -86,6 +87,7 @@ exports[`Error renders error screen with image correctly 1`] = `
|
|
|
86
87
|
Weβre sorry, something went wrong
|
|
87
88
|
</Text>
|
|
88
89
|
<Text
|
|
90
|
+
allowFontScaling={false}
|
|
89
91
|
style={
|
|
90
92
|
Array [
|
|
91
93
|
Object {
|
|
@@ -190,6 +192,7 @@ exports[`Error renders full screen error page correctly 1`] = `
|
|
|
190
192
|
testID="error-image"
|
|
191
193
|
/>
|
|
192
194
|
<Text
|
|
195
|
+
allowFontScaling={false}
|
|
193
196
|
style={
|
|
194
197
|
Array [
|
|
195
198
|
Object {
|
|
@@ -219,6 +222,7 @@ exports[`Error renders full screen error page correctly 1`] = `
|
|
|
219
222
|
Weβre sorry, something went wrong
|
|
220
223
|
</Text>
|
|
221
224
|
<Text
|
|
225
|
+
allowFontScaling={false}
|
|
222
226
|
style={
|
|
223
227
|
Array [
|
|
224
228
|
Object {
|
|
@@ -282,6 +286,7 @@ exports[`Error renders title only correctly 1`] = `
|
|
|
282
286
|
}
|
|
283
287
|
>
|
|
284
288
|
<Text
|
|
289
|
+
allowFontScaling={false}
|
|
285
290
|
style={
|
|
286
291
|
Array [
|
|
287
292
|
Object {
|
|
@@ -311,6 +316,7 @@ exports[`Error renders title only correctly 1`] = `
|
|
|
311
316
|
Weβre sorry, something went wrong
|
|
312
317
|
</Text>
|
|
313
318
|
<Text
|
|
319
|
+
allowFontScaling={false}
|
|
314
320
|
style={
|
|
315
321
|
Array [
|
|
316
322
|
Object {
|
|
@@ -9,7 +9,7 @@ const description = 'Please try again later';
|
|
|
9
9
|
describe('Error', () => {
|
|
10
10
|
it('renders title only correctly', () => {
|
|
11
11
|
const { toJSON, getByText } = renderWithTheme(
|
|
12
|
-
<Error
|
|
12
|
+
<Error title={title} description={description} />
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
expect(getByText(title)).toBeTruthy();
|
|
@@ -18,12 +18,7 @@ describe('Error', () => {
|
|
|
18
18
|
});
|
|
19
19
|
it('renders error screen with image correctly', () => {
|
|
20
20
|
const { toJSON, getByText, getByTestId } = renderWithTheme(
|
|
21
|
-
<Error
|
|
22
|
-
visible
|
|
23
|
-
title={title}
|
|
24
|
-
description={description}
|
|
25
|
-
image="path_to_image"
|
|
26
|
-
/>
|
|
21
|
+
<Error title={title} description={description} image="path_to_image" />
|
|
27
22
|
);
|
|
28
23
|
|
|
29
24
|
expect(getByText(title)).toBeTruthy();
|
|
@@ -34,7 +29,6 @@ describe('Error', () => {
|
|
|
34
29
|
it('renders full screen error page correctly', () => {
|
|
35
30
|
const { toJSON, getByText, getByTestId } = renderWithTheme(
|
|
36
31
|
<Error
|
|
37
|
-
visible
|
|
38
32
|
variant="full-screen"
|
|
39
33
|
title={title}
|
|
40
34
|
description={description}
|
|
@@ -52,7 +46,6 @@ describe('Error', () => {
|
|
|
52
46
|
const onSecondaryCtaPress = jest.fn();
|
|
53
47
|
const { getByText } = renderWithTheme(
|
|
54
48
|
<Error
|
|
55
|
-
visible
|
|
56
49
|
title={title}
|
|
57
50
|
description={description}
|
|
58
51
|
image="path_to_image"
|
|
@@ -13,8 +13,15 @@ import {
|
|
|
13
13
|
StyledErrorModal,
|
|
14
14
|
StyledErrorTitle,
|
|
15
15
|
} from './StyledError';
|
|
16
|
+
import { useDeprecation } from '../../utils/hooks';
|
|
16
17
|
|
|
17
|
-
interface
|
|
18
|
+
interface ErrorProps extends ViewProps {
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use conditional rendering instead
|
|
21
|
+
*
|
|
22
|
+
* Visibility of the error
|
|
23
|
+
*/
|
|
24
|
+
visible?: boolean;
|
|
18
25
|
/**
|
|
19
26
|
* Variant of the error
|
|
20
27
|
*/
|
|
@@ -53,13 +60,6 @@ interface ErrorPageProps extends ViewProps {
|
|
|
53
60
|
onSecondaryCtaPress?: () => void;
|
|
54
61
|
}
|
|
55
62
|
|
|
56
|
-
type ErrorProps = ErrorPageProps & {
|
|
57
|
-
/**
|
|
58
|
-
* Visibility of the error
|
|
59
|
-
*/
|
|
60
|
-
visible: boolean;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
63
|
type onCloseCallbackType = 'cta' | 'secondaryCta' | null;
|
|
64
64
|
|
|
65
65
|
const ErrorPage = ({
|
|
@@ -73,7 +73,7 @@ const ErrorPage = ({
|
|
|
73
73
|
secondaryCtaText,
|
|
74
74
|
onSecondaryCtaPress,
|
|
75
75
|
...nativeProps
|
|
76
|
-
}:
|
|
76
|
+
}: ErrorProps): ReactElement => {
|
|
77
77
|
const showCta = ctaText && onCtaPress !== undefined;
|
|
78
78
|
const showSecondaryCta =
|
|
79
79
|
secondaryCtaText && onSecondaryCtaPress !== undefined;
|
|
@@ -127,6 +127,7 @@ const Error = ({
|
|
|
127
127
|
variant = 'in-page',
|
|
128
128
|
title,
|
|
129
129
|
description,
|
|
130
|
+
image,
|
|
130
131
|
testID,
|
|
131
132
|
ctaText,
|
|
132
133
|
onCtaPress,
|
|
@@ -134,6 +135,11 @@ const Error = ({
|
|
|
134
135
|
onSecondaryCtaPress,
|
|
135
136
|
...nativeProps
|
|
136
137
|
}: ErrorProps): ReactElement => {
|
|
138
|
+
useDeprecation(
|
|
139
|
+
`Visible prop is deprecated. Use conditional rendering instead`,
|
|
140
|
+
visible
|
|
141
|
+
);
|
|
142
|
+
|
|
137
143
|
const [isVisible, setIsVisible] = useState(visible);
|
|
138
144
|
const [ctaPressed, setCtaPressed] = useState<onCloseCallbackType>(null);
|
|
139
145
|
|
|
@@ -176,6 +182,7 @@ const Error = ({
|
|
|
176
182
|
variant={variant}
|
|
177
183
|
title={title}
|
|
178
184
|
description={description}
|
|
185
|
+
image={image}
|
|
179
186
|
testID={testID}
|
|
180
187
|
ctaText={ctaText}
|
|
181
188
|
onCtaPress={
|
|
@@ -202,6 +209,7 @@ const Error = ({
|
|
|
202
209
|
variant={variant}
|
|
203
210
|
title={title}
|
|
204
211
|
description={description}
|
|
212
|
+
image={image}
|
|
205
213
|
testID={testID}
|
|
206
214
|
ctaText={ctaText}
|
|
207
215
|
onCtaPress={onCtaPress}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ImageSourcePropType, ViewProps } from 'react-native';
|
|
3
3
|
import { ErrorVariant } from './StyledError';
|
|
4
|
-
interface
|
|
4
|
+
interface ErrorProps extends ViewProps {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use conditional rendering instead
|
|
7
|
+
*
|
|
8
|
+
* Visibility of the error
|
|
9
|
+
*/
|
|
10
|
+
visible?: boolean;
|
|
5
11
|
/**
|
|
6
12
|
* Variant of the error
|
|
7
13
|
*/
|
|
@@ -39,17 +45,11 @@ interface ErrorPageProps extends ViewProps {
|
|
|
39
45
|
*/
|
|
40
46
|
onSecondaryCtaPress?: () => void;
|
|
41
47
|
}
|
|
42
|
-
declare type ErrorProps = ErrorPageProps & {
|
|
43
|
-
/**
|
|
44
|
-
* Visibility of the error
|
|
45
|
-
*/
|
|
46
|
-
visible: boolean;
|
|
47
|
-
};
|
|
48
48
|
/**
|
|
49
49
|
* Renders error page
|
|
50
50
|
*
|
|
51
51
|
* @param {ErrorProps}
|
|
52
52
|
* @return {*} {ReactElement}
|
|
53
53
|
*/
|
|
54
|
-
declare const Error: ({ visible, variant, title, description, testID, ctaText, onCtaPress, secondaryCtaText, onSecondaryCtaPress, ...nativeProps }: ErrorProps) => ReactElement;
|
|
54
|
+
declare const Error: ({ visible, variant, title, description, image, testID, ctaText, onCtaPress, secondaryCtaText, onSecondaryCtaPress, ...nativeProps }: ErrorProps) => ReactElement;
|
|
55
55
|
export default Error;
|