@hero-design/rn 8.99.0 → 8.99.1

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.
@@ -1,4 +1,4 @@
1
- (node:3214) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
1
+ (node:3213) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2
2
  (Use `node --trace-warnings ...` to show where the warning was created)
3
3
  
4
4
  src/index.ts → lib/index.js, es/index.js...
@@ -10,9 +10,9 @@
10
10
     ~~~~~~~~~~~~~~~~~~~
11
11
  
12
12
  (!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.
13
- created lib/index.js, es/index.js in 54.1s
13
+ created lib/index.js, es/index.js in 54s
14
14
  
15
15
  /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_AU.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_CA.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/index.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/types.ts → ., ....
16
16
  (!) Generated empty chunks
17
17
  "locales/types" and "locales/types"
18
- created ., . in 21.2s
18
+ created ., . in 20.5s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.99.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3816](https://github.com/Thinkei/hero-design/pull/3816) [`9ac2c1cabacfc6b8a5453dfe770e147484532579`](https://github.com/Thinkei/hero-design/commit/9ac2c1cabacfc6b8a5453dfe770e147484532579) Thanks [@ttkien](https://github.com/ttkien)! - [Empty][success][Error] support title with React Element
8
+
3
9
  ## 8.99.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.99.0",
3
+ "version": "8.99.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -101,6 +101,126 @@ exports[`Empty renders empty state content correctly 1`] = `
101
101
  </View>
102
102
  `;
103
103
 
104
+ exports[`Empty renders empty state content correctly with title is a React Element 1`] = `
105
+ <View
106
+ style={
107
+ {
108
+ "flex": 1,
109
+ }
110
+ }
111
+ >
112
+ <View
113
+ style={
114
+ [
115
+ {
116
+ "alignItems": "center",
117
+ "display": "flex",
118
+ "flex": 1,
119
+ "flexDirection": "column",
120
+ "justifyContent": "center",
121
+ "padding": 16,
122
+ },
123
+ undefined,
124
+ ]
125
+ }
126
+ >
127
+ <Text
128
+ allowFontScaling={false}
129
+ style={
130
+ [
131
+ {
132
+ "color": "#001f23",
133
+ "fontFamily": "Saiga-Medium",
134
+ "fontSize": 24,
135
+ "letterSpacing": 0.24,
136
+ "lineHeight": 32,
137
+ },
138
+ [
139
+ {
140
+ "color": "#001f23",
141
+ "marginBottom": 8,
142
+ "textAlign": "center",
143
+ },
144
+ undefined,
145
+ ],
146
+ ]
147
+ }
148
+ themeIntent="body"
149
+ themeLevel="h4"
150
+ themeTypeface="playful"
151
+ themeVariant="light"
152
+ >
153
+ <Text
154
+ allowFontScaling={false}
155
+ style={
156
+ [
157
+ {
158
+ "color": "#001f23",
159
+ "fontFamily": "BeVietnamPro-Regular",
160
+ "fontSize": 42,
161
+ "letterSpacing": 0,
162
+ "lineHeight": 50,
163
+ },
164
+ undefined,
165
+ ]
166
+ }
167
+ themeIntent="body"
168
+ themeLevel="h1"
169
+ themeTypeface="neutral"
170
+ >
171
+ You have no notification at this time
172
+ </Text>
173
+ </Text>
174
+ <Text
175
+ allowFontScaling={false}
176
+ style={
177
+ [
178
+ {
179
+ "color": "#001f23",
180
+ "fontFamily": "BeVietnamPro-Regular",
181
+ "fontSize": 14,
182
+ "letterSpacing": 0.48,
183
+ "lineHeight": 22,
184
+ },
185
+ [
186
+ {
187
+ "color": "#4d6265",
188
+ "textAlign": "center",
189
+ },
190
+ undefined,
191
+ ],
192
+ ]
193
+ }
194
+ themeIntent="body"
195
+ themeTypeface="neutral"
196
+ themeVariant="small"
197
+ >
198
+ We'll notify you later.
199
+ </Text>
200
+ </View>
201
+ <View
202
+ pointerEvents="box-none"
203
+ position="bottom"
204
+ style={
205
+ [
206
+ {
207
+ "bottom": 0,
208
+ "elevation": 9999,
209
+ "flexDirection": "column-reverse",
210
+ "left": 0,
211
+ "paddingHorizontal": 24,
212
+ "paddingVertical": 16,
213
+ "position": "absolute",
214
+ "right": 0,
215
+ "top": 0,
216
+ },
217
+ undefined,
218
+ ]
219
+ }
220
+ />
221
+ </View>
222
+ `;
223
+
104
224
  exports[`Empty renders empty state with icon correctly 1`] = `
105
225
  <View
106
226
  style={
@@ -3,10 +3,11 @@ import { Image } from 'react-native';
3
3
 
4
4
  import renderWithTheme from '../../../../testHelpers/renderWithTheme';
5
5
  import Empty from '..';
6
+ import Typography from '../../../Typography';
6
7
 
7
8
  describe('Empty', () => {
8
9
  it('renders empty state content correctly', () => {
9
- const { toJSON } = renderWithTheme(
10
+ const { toJSON, getByText } = renderWithTheme(
10
11
  <Empty
11
12
  title="You have no notification at this time"
12
13
  description="We'll notify you later."
@@ -14,6 +15,25 @@ describe('Empty', () => {
14
15
  );
15
16
 
16
17
  expect(toJSON()).toMatchSnapshot();
18
+ expect(getByText('You have no notification at this time')).toBeTruthy();
19
+ expect(getByText("We'll notify you later.")).toBeTruthy();
20
+ });
21
+
22
+ it('renders empty state content correctly with title is a React Element', () => {
23
+ const { toJSON, getByText } = renderWithTheme(
24
+ <Empty
25
+ title={
26
+ <Typography.Title>
27
+ You have no notification at this time
28
+ </Typography.Title>
29
+ }
30
+ description="We'll notify you later."
31
+ />
32
+ );
33
+
34
+ expect(toJSON()).toMatchSnapshot();
35
+ expect(getByText('You have no notification at this time')).toBeTruthy();
36
+ expect(getByText("We'll notify you later.")).toBeTruthy();
17
37
  });
18
38
 
19
39
  it('renders empty state with image correctly', () => {
@@ -23,7 +23,7 @@ interface EmptyProps {
23
23
  /**
24
24
  * Empty's title.
25
25
  */
26
- title: string;
26
+ title: string | ReactElement;
27
27
  /**
28
28
  * Empty's description.
29
29
  */
@@ -904,3 +904,137 @@ exports[`Error renders title only correctly 1`] = `
904
904
  />
905
905
  </View>
906
906
  `;
907
+
908
+ exports[`Error renders title only correctly with title is a React Element 1`] = `
909
+ <View
910
+ style={
911
+ {
912
+ "flex": 1,
913
+ }
914
+ }
915
+ >
916
+ <View
917
+ style={
918
+ [
919
+ {
920
+ "backgroundColor": "#f6f6f7",
921
+ "display": "flex",
922
+ "flex": 1,
923
+ "flexDirection": "column",
924
+ },
925
+ undefined,
926
+ ]
927
+ }
928
+ themeVariant="in-page"
929
+ >
930
+ <View
931
+ style={
932
+ [
933
+ {
934
+ "alignItems": "center",
935
+ "display": "flex",
936
+ "flex": 1,
937
+ "flexDirection": "column",
938
+ "justifyContent": "center",
939
+ "padding": 24,
940
+ },
941
+ undefined,
942
+ ]
943
+ }
944
+ >
945
+ <Text
946
+ allowFontScaling={false}
947
+ style={
948
+ [
949
+ {
950
+ "color": "#001f23",
951
+ "fontFamily": "Saiga-Medium",
952
+ "fontSize": 24,
953
+ "letterSpacing": 0.24,
954
+ "lineHeight": 32,
955
+ },
956
+ [
957
+ {
958
+ "color": "#001f23",
959
+ "marginBottom": 8,
960
+ "textAlign": "center",
961
+ },
962
+ undefined,
963
+ ],
964
+ ]
965
+ }
966
+ themeIntent="body"
967
+ themeLevel="h4"
968
+ themeTypeface="playful"
969
+ >
970
+ <Text
971
+ allowFontScaling={false}
972
+ style={
973
+ [
974
+ {
975
+ "color": "#001f23",
976
+ "fontFamily": "BeVietnamPro-Regular",
977
+ "fontSize": 42,
978
+ "letterSpacing": 0,
979
+ "lineHeight": 50,
980
+ },
981
+ undefined,
982
+ ]
983
+ }
984
+ themeIntent="body"
985
+ themeLevel="h1"
986
+ themeTypeface="neutral"
987
+ >
988
+ We’re sorry, something went wrong
989
+ </Text>
990
+ </Text>
991
+ <Text
992
+ allowFontScaling={false}
993
+ style={
994
+ [
995
+ {
996
+ "color": "#001f23",
997
+ "fontFamily": "Saiga-Regular",
998
+ "fontSize": 18,
999
+ "letterSpacing": 0.54,
1000
+ "lineHeight": 26,
1001
+ },
1002
+ [
1003
+ {
1004
+ "color": "#4d6265",
1005
+ "textAlign": "center",
1006
+ },
1007
+ undefined,
1008
+ ],
1009
+ ]
1010
+ }
1011
+ themeIntent="body"
1012
+ themeTypeface="playful"
1013
+ themeVariant="regular"
1014
+ >
1015
+ Please try again later
1016
+ </Text>
1017
+ </View>
1018
+ </View>
1019
+ <View
1020
+ pointerEvents="box-none"
1021
+ position="bottom"
1022
+ style={
1023
+ [
1024
+ {
1025
+ "bottom": 0,
1026
+ "elevation": 9999,
1027
+ "flexDirection": "column-reverse",
1028
+ "left": 0,
1029
+ "paddingHorizontal": 24,
1030
+ "paddingVertical": 16,
1031
+ "position": "absolute",
1032
+ "right": 0,
1033
+ "top": 0,
1034
+ },
1035
+ undefined,
1036
+ ]
1037
+ }
1038
+ />
1039
+ </View>
1040
+ `;
@@ -4,6 +4,7 @@ import renderWithTheme from '../../../../testHelpers/renderWithTheme';
4
4
  import Error from '..';
5
5
  import Image from '../../../Image';
6
6
  import Portal from '../../../Portal';
7
+ import Typography from '../../../Typography';
7
8
 
8
9
  const title = `We’re sorry, something went wrong`;
9
10
  const description = 'Please try again later';
@@ -18,6 +19,19 @@ describe('Error', () => {
18
19
  expect(getByText(description)).toBeTruthy();
19
20
  expect(toJSON()).toMatchSnapshot();
20
21
  });
22
+
23
+ it('renders title only correctly with title is a React Element', () => {
24
+ const { toJSON, getByText } = renderWithTheme(
25
+ <Error
26
+ title={<Typography.Title>{title}</Typography.Title>}
27
+ description={description}
28
+ />
29
+ );
30
+
31
+ expect(getByText(title)).toBeTruthy();
32
+ expect(getByText(description)).toBeTruthy();
33
+ expect(toJSON()).toMatchSnapshot();
34
+ });
21
35
  it('renders error screen with image correctly', () => {
22
36
  const { toJSON, getByText, getByTestId } = renderWithTheme(
23
37
  <Error title={title} description={description} image="path_to_image" />
@@ -42,7 +42,7 @@ interface ErrorProps extends ViewProps {
42
42
  /**
43
43
  * Title of the error
44
44
  */
45
- title: string;
45
+ title: string | ReactElement;
46
46
  /**
47
47
  * Description of the error
48
48
  */
@@ -896,6 +896,140 @@ exports[`Success renders title and description as ReactElement correctly 1`] = `
896
896
  </View>
897
897
  `;
898
898
 
899
+ exports[`Success renders title is a React Element correctly 1`] = `
900
+ <View
901
+ style={
902
+ {
903
+ "flex": 1,
904
+ }
905
+ }
906
+ >
907
+ <View
908
+ style={
909
+ [
910
+ {
911
+ "backgroundColor": "#f6f6f7",
912
+ "display": "flex",
913
+ "flex": 1,
914
+ "flexDirection": "column",
915
+ },
916
+ undefined,
917
+ ]
918
+ }
919
+ themeVariant="in-page"
920
+ >
921
+ <View
922
+ style={
923
+ [
924
+ {
925
+ "alignItems": "center",
926
+ "display": "flex",
927
+ "flex": 1,
928
+ "flexDirection": "column",
929
+ "justifyContent": "center",
930
+ "padding": 24,
931
+ },
932
+ undefined,
933
+ ]
934
+ }
935
+ >
936
+ <Text
937
+ allowFontScaling={false}
938
+ style={
939
+ [
940
+ {
941
+ "color": "#001f23",
942
+ "fontFamily": "Saiga-Medium",
943
+ "fontSize": 24,
944
+ "letterSpacing": 0.24,
945
+ "lineHeight": 32,
946
+ },
947
+ [
948
+ {
949
+ "color": "#001f23",
950
+ "marginBottom": 8,
951
+ "textAlign": "center",
952
+ },
953
+ undefined,
954
+ ],
955
+ ]
956
+ }
957
+ themeIntent="body"
958
+ themeLevel="h4"
959
+ themeTypeface="playful"
960
+ >
961
+ <Text
962
+ allowFontScaling={false}
963
+ style={
964
+ [
965
+ {
966
+ "color": "#001f23",
967
+ "fontFamily": "BeVietnamPro-Regular",
968
+ "fontSize": 42,
969
+ "letterSpacing": 0,
970
+ "lineHeight": 50,
971
+ },
972
+ undefined,
973
+ ]
974
+ }
975
+ themeIntent="body"
976
+ themeLevel="h1"
977
+ themeTypeface="neutral"
978
+ >
979
+ Two-Factor Authentication
980
+ </Text>
981
+ </Text>
982
+ <Text
983
+ allowFontScaling={false}
984
+ style={
985
+ [
986
+ {
987
+ "color": "#001f23",
988
+ "fontFamily": "BeVietnamPro-Regular",
989
+ "fontSize": 16,
990
+ "letterSpacing": 0.48,
991
+ "lineHeight": 24,
992
+ },
993
+ [
994
+ {
995
+ "color": "#4d6265",
996
+ "textAlign": "center",
997
+ },
998
+ undefined,
999
+ ],
1000
+ ]
1001
+ }
1002
+ themeIntent="body"
1003
+ themeTypeface="neutral"
1004
+ themeVariant="regular"
1005
+ >
1006
+ Protecting your sensitive data is important to us. Verifying your mobile number or using an authenticator app makes it harder for attackers to access personal and sensitive information.
1007
+ </Text>
1008
+ </View>
1009
+ </View>
1010
+ <View
1011
+ pointerEvents="box-none"
1012
+ position="bottom"
1013
+ style={
1014
+ [
1015
+ {
1016
+ "bottom": 0,
1017
+ "elevation": 9999,
1018
+ "flexDirection": "column-reverse",
1019
+ "left": 0,
1020
+ "paddingHorizontal": 24,
1021
+ "paddingVertical": 16,
1022
+ "position": "absolute",
1023
+ "right": 0,
1024
+ "top": 0,
1025
+ },
1026
+ undefined,
1027
+ ]
1028
+ }
1029
+ />
1030
+ </View>
1031
+ `;
1032
+
899
1033
  exports[`Success renders title only correctly 1`] = `
900
1034
  <View
901
1035
  style={
@@ -20,6 +20,19 @@ describe('Success', () => {
20
20
  expect(getByText(description)).toBeTruthy();
21
21
  });
22
22
 
23
+ it('renders title is a React Element correctly', () => {
24
+ const { toJSON, getByText } = renderWithTheme(
25
+ <Success
26
+ title={<Typography.Title>{title}</Typography.Title>}
27
+ description={description}
28
+ />
29
+ );
30
+
31
+ expect(toJSON()).toMatchSnapshot();
32
+ expect(getByText(title)).toBeTruthy();
33
+ expect(getByText(description)).toBeTruthy();
34
+ });
35
+
23
36
  it('renders title and description as ReactElement correctly', () => {
24
37
  const clickHereSpy = jest.fn();
25
38
  const { toJSON, getByText } = renderWithTheme(
@@ -31,7 +31,7 @@ export interface SuccessProps extends ViewProps {
31
31
  /**
32
32
  * Success's title.
33
33
  */
34
- title: string;
34
+ title: string | ReactElement;
35
35
  /**
36
36
  * Success's description.
37
37
  */