@hero-design/rn 8.93.0 → 8.96.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 +7 -2
- package/CHANGELOG.md +18 -0
- package/es/index.js +2128 -1023
- package/lib/index.js +2127 -1021
- package/locales/en_AU.js +10 -0
- package/locales/en_AU.mjs +8 -0
- package/locales/en_CA.js +10 -0
- package/locales/en_CA.mjs +8 -0
- package/locales/index.js +11 -0
- package/locales/index.mjs +9 -0
- package/locales/types.js +2 -0
- package/locales/types.mjs +1 -0
- package/package.json +4 -3
- package/rollup.config.mjs +97 -58
- package/src/components/DatePicker/DatePickerAndroid.tsx +27 -7
- package/src/components/DatePicker/DatePickerCalendar.tsx +23 -4
- package/src/components/DatePicker/DatePickerIOS.tsx +27 -8
- package/src/components/DatePicker/__tests__/DatePicker.spec.tsx +30 -1
- package/src/components/DatePicker/__tests__/DatePickerAndroid.spec.tsx +27 -0
- package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +27 -0
- package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +28 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +1 -0
- package/src/components/DatePicker/hooks/__tests__/useFormatDate.spec.ts +61 -0
- package/src/components/DatePicker/{useCalculateDate.tsx → hooks/useCalculateDate.tsx} +1 -1
- package/src/components/DatePicker/hooks/useFormatDate.ts +25 -0
- package/src/components/DatePicker/hooks/utils.ts +30 -0
- package/src/components/DatePicker/types.ts +15 -1
- package/src/components/HeroDesignProvider/index.tsx +19 -6
- package/src/components/LocaleProvider/__tests__/utils.specs.ts +12 -0
- package/src/components/LocaleProvider/context.ts +7 -0
- package/src/components/LocaleProvider/hooks.ts +19 -0
- package/src/components/LocaleProvider/index.tsx +27 -0
- package/src/components/LocaleProvider/utils.ts +14 -0
- package/src/components/{Empty → StatusScreens/Empty}/StyledEmpty.tsx +11 -2
- package/src/components/StatusScreens/Empty/__tests__/__snapshots__/index.spec.tsx.snap +468 -0
- package/src/components/{Empty → StatusScreens/Empty}/__tests__/index.spec.tsx +16 -2
- package/src/components/StatusScreens/Empty/index.tsx +97 -0
- package/src/components/{Error → StatusScreens/Error}/StyledError.tsx +4 -4
- package/src/components/{Error → StatusScreens/Error}/__tests__/__snapshots__/index.spec.tsx.snap +300 -0
- package/src/components/{Error → StatusScreens/Error}/__tests__/index.spec.tsx +13 -3
- package/src/components/{Error → StatusScreens/Error}/index.tsx +39 -7
- package/src/components/StatusScreens/StatusIcon/__tests__/index.spec.tsx +31 -0
- package/src/components/StatusScreens/StatusIcon/assets/Add.tsx +49 -0
- package/src/components/StatusScreens/StatusIcon/assets/Boom.tsx +61 -0
- package/src/components/StatusScreens/StatusIcon/assets/Build.tsx +45 -0
- package/src/components/StatusScreens/StatusIcon/assets/Clock.tsx +38 -0
- package/src/components/StatusScreens/StatusIcon/assets/Confetti.tsx +78 -0
- package/src/components/StatusScreens/StatusIcon/assets/Connections.tsx +57 -0
- package/src/components/StatusScreens/StatusIcon/assets/Error.tsx +55 -0
- package/src/components/StatusScreens/StatusIcon/assets/Info.tsx +35 -0
- package/src/components/StatusScreens/StatusIcon/assets/List.tsx +37 -0
- package/src/components/StatusScreens/StatusIcon/assets/Location.tsx +37 -0
- package/src/components/StatusScreens/StatusIcon/assets/Merge.tsx +59 -0
- package/src/components/StatusScreens/StatusIcon/assets/Notifications.tsx +26 -0
- package/src/components/StatusScreens/StatusIcon/assets/Search.tsx +36 -0
- package/src/components/StatusScreens/StatusIcon/assets/Star.tsx +37 -0
- package/src/components/StatusScreens/StatusIcon/assets/Success.tsx +41 -0
- package/src/components/StatusScreens/StatusIcon/assets/User.tsx +43 -0
- package/src/components/StatusScreens/StatusIcon/index.tsx +63 -0
- package/src/components/StatusScreens/StatusIcon/types.ts +5 -0
- package/src/components/{Success → StatusScreens/Success}/StyledSuccess.tsx +4 -4
- package/src/components/{Success → StatusScreens/Success}/__tests__/__snapshots__/index.spec.tsx.snap +263 -0
- package/src/components/{Success → StatusScreens/Success}/__tests__/index.spec.tsx +13 -4
- package/src/components/{Success → StatusScreens/Success}/index.tsx +38 -7
- package/src/index.ts +5 -3
- package/src/locales/en_AU.ts +10 -0
- package/src/locales/en_CA.ts +10 -0
- package/src/locales/index.ts +7 -0
- package/src/locales/types.ts +12 -0
- package/src/testHelpers/renderWithTheme.tsx +7 -1
- package/src/types.ts +4 -0
- package/stats/8.94.0/rn-stats.html +4842 -0
- package/stats/8.95.0/rn-stats.html +4842 -0
- package/stats/8.96.0/rn-stats.html +4842 -0
- package/types/components/DatePicker/DatePickerAndroid.d.ts +1 -1
- package/types/components/DatePicker/DatePickerCalendar.d.ts +1 -1
- package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
- package/types/components/DatePicker/{useCalculateDate.d.ts → hooks/useCalculateDate.d.ts} +1 -1
- package/types/components/DatePicker/hooks/useFormatDate.d.ts +10 -0
- package/types/components/DatePicker/hooks/utils.d.ts +6 -0
- package/types/components/DatePicker/types.d.ts +8 -1
- package/types/components/HeroDesignProvider/index.d.ts +5 -1
- package/types/components/LocaleProvider/__tests__/utils.specs.d.ts +1 -0
- package/types/components/LocaleProvider/context.d.ts +3 -0
- package/types/components/LocaleProvider/hooks.d.ts +5 -0
- package/types/components/LocaleProvider/index.d.ts +7 -0
- package/types/components/LocaleProvider/utils.d.ts +3 -0
- package/types/components/{Empty → StatusScreens/Empty}/StyledEmpty.d.ts +9 -3
- package/types/components/{Empty → StatusScreens/Empty}/index.d.ts +8 -3
- package/types/components/{Error → StatusScreens/Error}/StyledError.d.ts +6 -6
- package/types/components/{Error → StatusScreens/Error}/index.d.ts +6 -1
- package/types/components/StatusScreens/StatusIcon/assets/Add.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Boom.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Build.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Clock.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Confetti.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Connections.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Error.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Info.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/List.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Location.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Merge.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Notifications.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Search.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Star.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/Success.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/assets/User.d.ts +4 -0
- package/types/components/StatusScreens/StatusIcon/index.d.ts +26 -0
- package/types/components/StatusScreens/StatusIcon/types.d.ts +5 -0
- package/types/components/{Success → StatusScreens/Success}/StyledSuccess.d.ts +5 -5
- package/types/components/{Success → StatusScreens/Success}/index.d.ts +6 -1
- package/types/index.d.ts +5 -4
- package/types/locales/en_AU.d.ts +3 -0
- package/types/locales/en_CA.d.ts +3 -0
- package/types/locales/index.d.ts +5 -0
- package/types/locales/types.d.ts +10 -0
- package/types/types.d.ts +2 -1
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +0 -218
- package/src/components/Empty/index.tsx +0 -73
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Empty renders empty state content correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"flex": 1,
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
>
|
|
11
|
+
<View
|
|
12
|
+
style={
|
|
13
|
+
[
|
|
14
|
+
{
|
|
15
|
+
"alignItems": "center",
|
|
16
|
+
"display": "flex",
|
|
17
|
+
"flex": 1,
|
|
18
|
+
"flexDirection": "column",
|
|
19
|
+
"justifyContent": "center",
|
|
20
|
+
"padding": 16,
|
|
21
|
+
},
|
|
22
|
+
undefined,
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
>
|
|
26
|
+
<Text
|
|
27
|
+
allowFontScaling={false}
|
|
28
|
+
style={
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"color": "#001f23",
|
|
32
|
+
"fontFamily": "Saiga-Medium",
|
|
33
|
+
"fontSize": 24,
|
|
34
|
+
"letterSpacing": 0.24,
|
|
35
|
+
"lineHeight": 32,
|
|
36
|
+
},
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
"color": "#001f23",
|
|
40
|
+
"marginBottom": 8,
|
|
41
|
+
"textAlign": "center",
|
|
42
|
+
},
|
|
43
|
+
undefined,
|
|
44
|
+
],
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
themeIntent="body"
|
|
48
|
+
themeLevel="h4"
|
|
49
|
+
themeTypeface="playful"
|
|
50
|
+
themeVariant="light"
|
|
51
|
+
>
|
|
52
|
+
You have no notification at this time
|
|
53
|
+
</Text>
|
|
54
|
+
<Text
|
|
55
|
+
allowFontScaling={false}
|
|
56
|
+
style={
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
"color": "#001f23",
|
|
60
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
61
|
+
"fontSize": 14,
|
|
62
|
+
"letterSpacing": 0.48,
|
|
63
|
+
"lineHeight": 22,
|
|
64
|
+
},
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
"color": "#4d6265",
|
|
68
|
+
"textAlign": "center",
|
|
69
|
+
},
|
|
70
|
+
undefined,
|
|
71
|
+
],
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
themeIntent="body"
|
|
75
|
+
themeTypeface="neutral"
|
|
76
|
+
themeVariant="small"
|
|
77
|
+
>
|
|
78
|
+
We'll notify you later.
|
|
79
|
+
</Text>
|
|
80
|
+
</View>
|
|
81
|
+
<View
|
|
82
|
+
pointerEvents="box-none"
|
|
83
|
+
position="bottom"
|
|
84
|
+
style={
|
|
85
|
+
[
|
|
86
|
+
{
|
|
87
|
+
"bottom": 0,
|
|
88
|
+
"elevation": 9999,
|
|
89
|
+
"flexDirection": "column-reverse",
|
|
90
|
+
"left": 0,
|
|
91
|
+
"paddingHorizontal": 24,
|
|
92
|
+
"paddingVertical": 16,
|
|
93
|
+
"position": "absolute",
|
|
94
|
+
"right": 0,
|
|
95
|
+
"top": 0,
|
|
96
|
+
},
|
|
97
|
+
undefined,
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
/>
|
|
101
|
+
</View>
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
exports[`Empty renders empty state with icon correctly 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
|
+
<View
|
|
128
|
+
style={
|
|
129
|
+
[
|
|
130
|
+
{
|
|
131
|
+
"marginBottom": 24,
|
|
132
|
+
},
|
|
133
|
+
undefined,
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
<RNSVGSvgView
|
|
138
|
+
align="xMidYMid"
|
|
139
|
+
bbHeight="72"
|
|
140
|
+
bbWidth="72"
|
|
141
|
+
focusable={false}
|
|
142
|
+
height="72"
|
|
143
|
+
meetOrSlice={0}
|
|
144
|
+
minX={0}
|
|
145
|
+
minY={0}
|
|
146
|
+
style={
|
|
147
|
+
[
|
|
148
|
+
{
|
|
149
|
+
"backgroundColor": "transparent",
|
|
150
|
+
"borderWidth": 0,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"flex": 0,
|
|
154
|
+
"height": 72,
|
|
155
|
+
"width": 72,
|
|
156
|
+
},
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
testID="empty-icon"
|
|
160
|
+
vbHeight={72}
|
|
161
|
+
vbWidth={72}
|
|
162
|
+
width="72"
|
|
163
|
+
>
|
|
164
|
+
<RNSVGGroup
|
|
165
|
+
fill={
|
|
166
|
+
{
|
|
167
|
+
"payload": 4278190080,
|
|
168
|
+
"type": 0,
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
>
|
|
172
|
+
<RNSVGDefs>
|
|
173
|
+
<RNSVGClipPath
|
|
174
|
+
fill={
|
|
175
|
+
{
|
|
176
|
+
"payload": 4278190080,
|
|
177
|
+
"type": 0,
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
name="clip0_19647_1726"
|
|
181
|
+
>
|
|
182
|
+
<RNSVGRect
|
|
183
|
+
fill={
|
|
184
|
+
{
|
|
185
|
+
"payload": 4294967295,
|
|
186
|
+
"type": 0,
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
height="72"
|
|
190
|
+
propList={
|
|
191
|
+
[
|
|
192
|
+
"fill",
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
width="71.6316"
|
|
196
|
+
x={0}
|
|
197
|
+
y={0}
|
|
198
|
+
/>
|
|
199
|
+
</RNSVGClipPath>
|
|
200
|
+
</RNSVGDefs>
|
|
201
|
+
<RNSVGRect
|
|
202
|
+
fill={
|
|
203
|
+
{
|
|
204
|
+
"payload": 4278190080,
|
|
205
|
+
"type": 0,
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
height="60.6316"
|
|
209
|
+
propList={
|
|
210
|
+
[
|
|
211
|
+
"stroke",
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
rx="20"
|
|
215
|
+
stroke={
|
|
216
|
+
{
|
|
217
|
+
"payload": 0,
|
|
218
|
+
"type": 0,
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
width="60.6316"
|
|
222
|
+
x={0}
|
|
223
|
+
y="11.3684"
|
|
224
|
+
/>
|
|
225
|
+
<RNSVGPath
|
|
226
|
+
clipRule={0}
|
|
227
|
+
d="M53.5235 19.5692L53.5265 19.5662C52.9085 19.6113 52.3367 19.8945 51.934 20.3553L38.3475 35.8072L31.977 29.3614H31.9739C31.5435 28.9306 30.9563 28.6836 30.3383 28.6776C29.7234 28.6716 29.13 28.9065 28.6903 29.3312C27.7834 30.2047 27.768 31.6355 28.6565 32.53L36.776 40.7468C37.228 41.2047 37.8582 41.4547 38.5069 41.4366C39.1587 41.4185 39.7706 41.1324 40.1948 40.6505L55.4381 23.3039V23.3009C56.2713 22.3551 56.1668 20.9214 55.1983 20.1021C54.7341 19.7166 54.1314 19.5238 53.5258 19.569L53.5235 19.5692Z"
|
|
228
|
+
fill={
|
|
229
|
+
{
|
|
230
|
+
"payload": 4282390880,
|
|
231
|
+
"type": 0,
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
fillRule={0}
|
|
235
|
+
propList={
|
|
236
|
+
[
|
|
237
|
+
"fill",
|
|
238
|
+
"fillRule",
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
/>
|
|
242
|
+
<RNSVGRect
|
|
243
|
+
fill={
|
|
244
|
+
{
|
|
245
|
+
"payload": 0,
|
|
246
|
+
"type": 0,
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
height="56.6316"
|
|
250
|
+
propList={
|
|
251
|
+
[
|
|
252
|
+
"fill",
|
|
253
|
+
"stroke",
|
|
254
|
+
"strokeWidth",
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
rx="18"
|
|
258
|
+
stroke={
|
|
259
|
+
{
|
|
260
|
+
"payload": 4282390880,
|
|
261
|
+
"type": 0,
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
strokeWidth="4"
|
|
265
|
+
width="56.6316"
|
|
266
|
+
x="13"
|
|
267
|
+
y="2"
|
|
268
|
+
/>
|
|
269
|
+
</RNSVGGroup>
|
|
270
|
+
</RNSVGSvgView>
|
|
271
|
+
</View>
|
|
272
|
+
<Text
|
|
273
|
+
allowFontScaling={false}
|
|
274
|
+
style={
|
|
275
|
+
[
|
|
276
|
+
{
|
|
277
|
+
"color": "#001f23",
|
|
278
|
+
"fontFamily": "Saiga-Medium",
|
|
279
|
+
"fontSize": 24,
|
|
280
|
+
"letterSpacing": 0.24,
|
|
281
|
+
"lineHeight": 32,
|
|
282
|
+
},
|
|
283
|
+
[
|
|
284
|
+
{
|
|
285
|
+
"color": "#001f23",
|
|
286
|
+
"marginBottom": 8,
|
|
287
|
+
"textAlign": "center",
|
|
288
|
+
},
|
|
289
|
+
undefined,
|
|
290
|
+
],
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
themeIntent="body"
|
|
294
|
+
themeLevel="h4"
|
|
295
|
+
themeTypeface="playful"
|
|
296
|
+
themeVariant="light"
|
|
297
|
+
>
|
|
298
|
+
You have no notification at this time
|
|
299
|
+
</Text>
|
|
300
|
+
<Text
|
|
301
|
+
allowFontScaling={false}
|
|
302
|
+
style={
|
|
303
|
+
[
|
|
304
|
+
{
|
|
305
|
+
"color": "#001f23",
|
|
306
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
307
|
+
"fontSize": 14,
|
|
308
|
+
"letterSpacing": 0.48,
|
|
309
|
+
"lineHeight": 22,
|
|
310
|
+
},
|
|
311
|
+
[
|
|
312
|
+
{
|
|
313
|
+
"color": "#4d6265",
|
|
314
|
+
"textAlign": "center",
|
|
315
|
+
},
|
|
316
|
+
undefined,
|
|
317
|
+
],
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
themeIntent="body"
|
|
321
|
+
themeTypeface="neutral"
|
|
322
|
+
themeVariant="small"
|
|
323
|
+
>
|
|
324
|
+
We'll notify you later.
|
|
325
|
+
</Text>
|
|
326
|
+
</View>
|
|
327
|
+
<View
|
|
328
|
+
pointerEvents="box-none"
|
|
329
|
+
position="bottom"
|
|
330
|
+
style={
|
|
331
|
+
[
|
|
332
|
+
{
|
|
333
|
+
"bottom": 0,
|
|
334
|
+
"elevation": 9999,
|
|
335
|
+
"flexDirection": "column-reverse",
|
|
336
|
+
"left": 0,
|
|
337
|
+
"paddingHorizontal": 24,
|
|
338
|
+
"paddingVertical": 16,
|
|
339
|
+
"position": "absolute",
|
|
340
|
+
"right": 0,
|
|
341
|
+
"top": 0,
|
|
342
|
+
},
|
|
343
|
+
undefined,
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
/>
|
|
347
|
+
</View>
|
|
348
|
+
`;
|
|
349
|
+
|
|
350
|
+
exports[`Empty renders empty state with image correctly 1`] = `
|
|
351
|
+
<View
|
|
352
|
+
style={
|
|
353
|
+
{
|
|
354
|
+
"flex": 1,
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
>
|
|
358
|
+
<View
|
|
359
|
+
style={
|
|
360
|
+
[
|
|
361
|
+
{
|
|
362
|
+
"alignItems": "center",
|
|
363
|
+
"display": "flex",
|
|
364
|
+
"flex": 1,
|
|
365
|
+
"flexDirection": "column",
|
|
366
|
+
"justifyContent": "center",
|
|
367
|
+
"padding": 16,
|
|
368
|
+
},
|
|
369
|
+
undefined,
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
>
|
|
373
|
+
<View
|
|
374
|
+
style={
|
|
375
|
+
[
|
|
376
|
+
{
|
|
377
|
+
"marginBottom": 24,
|
|
378
|
+
},
|
|
379
|
+
undefined,
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
testID="empty-image"
|
|
383
|
+
>
|
|
384
|
+
<Image
|
|
385
|
+
source={
|
|
386
|
+
{
|
|
387
|
+
"uri": "path_to_image",
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/>
|
|
391
|
+
</View>
|
|
392
|
+
<Text
|
|
393
|
+
allowFontScaling={false}
|
|
394
|
+
style={
|
|
395
|
+
[
|
|
396
|
+
{
|
|
397
|
+
"color": "#001f23",
|
|
398
|
+
"fontFamily": "Saiga-Medium",
|
|
399
|
+
"fontSize": 24,
|
|
400
|
+
"letterSpacing": 0.24,
|
|
401
|
+
"lineHeight": 32,
|
|
402
|
+
},
|
|
403
|
+
[
|
|
404
|
+
{
|
|
405
|
+
"color": "#001f23",
|
|
406
|
+
"marginBottom": 8,
|
|
407
|
+
"textAlign": "center",
|
|
408
|
+
},
|
|
409
|
+
undefined,
|
|
410
|
+
],
|
|
411
|
+
]
|
|
412
|
+
}
|
|
413
|
+
themeIntent="body"
|
|
414
|
+
themeLevel="h4"
|
|
415
|
+
themeTypeface="playful"
|
|
416
|
+
themeVariant="light"
|
|
417
|
+
>
|
|
418
|
+
You have no notification at this time
|
|
419
|
+
</Text>
|
|
420
|
+
<Text
|
|
421
|
+
allowFontScaling={false}
|
|
422
|
+
style={
|
|
423
|
+
[
|
|
424
|
+
{
|
|
425
|
+
"color": "#001f23",
|
|
426
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
427
|
+
"fontSize": 14,
|
|
428
|
+
"letterSpacing": 0.48,
|
|
429
|
+
"lineHeight": 22,
|
|
430
|
+
},
|
|
431
|
+
[
|
|
432
|
+
{
|
|
433
|
+
"color": "#4d6265",
|
|
434
|
+
"textAlign": "center",
|
|
435
|
+
},
|
|
436
|
+
undefined,
|
|
437
|
+
],
|
|
438
|
+
]
|
|
439
|
+
}
|
|
440
|
+
themeIntent="body"
|
|
441
|
+
themeTypeface="neutral"
|
|
442
|
+
themeVariant="small"
|
|
443
|
+
>
|
|
444
|
+
We'll notify you later.
|
|
445
|
+
</Text>
|
|
446
|
+
</View>
|
|
447
|
+
<View
|
|
448
|
+
pointerEvents="box-none"
|
|
449
|
+
position="bottom"
|
|
450
|
+
style={
|
|
451
|
+
[
|
|
452
|
+
{
|
|
453
|
+
"bottom": 0,
|
|
454
|
+
"elevation": 9999,
|
|
455
|
+
"flexDirection": "column-reverse",
|
|
456
|
+
"left": 0,
|
|
457
|
+
"paddingHorizontal": 24,
|
|
458
|
+
"paddingVertical": 16,
|
|
459
|
+
"position": "absolute",
|
|
460
|
+
"right": 0,
|
|
461
|
+
"top": 0,
|
|
462
|
+
},
|
|
463
|
+
undefined,
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
/>
|
|
467
|
+
</View>
|
|
468
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Image } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import renderWithTheme from '
|
|
4
|
+
import renderWithTheme from '../../../../testHelpers/renderWithTheme';
|
|
5
5
|
import Empty from '..';
|
|
6
6
|
|
|
7
7
|
describe('Empty', () => {
|
|
@@ -17,7 +17,7 @@ describe('Empty', () => {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('renders empty state with image correctly', () => {
|
|
20
|
-
const { toJSON } = renderWithTheme(
|
|
20
|
+
const { toJSON, getByTestId } = renderWithTheme(
|
|
21
21
|
<Empty
|
|
22
22
|
image={<Image source={{ uri: 'path_to_image' }} />}
|
|
23
23
|
title="You have no notification at this time"
|
|
@@ -26,5 +26,19 @@ describe('Empty', () => {
|
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
expect(toJSON()).toMatchSnapshot();
|
|
29
|
+
expect(getByTestId('empty-image')).toBeVisible();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders empty state with icon correctly', () => {
|
|
33
|
+
const { toJSON, getByTestId } = renderWithTheme(
|
|
34
|
+
<Empty
|
|
35
|
+
icon="success"
|
|
36
|
+
title="You have no notification at this time"
|
|
37
|
+
description="We'll notify you later."
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
expect(toJSON()).toMatchSnapshot();
|
|
42
|
+
expect(getByTestId('empty-icon')).toBeVisible();
|
|
29
43
|
});
|
|
30
44
|
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type {
|
|
4
|
+
ImageProps as RNImageProps,
|
|
5
|
+
StyleProp,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
import { ImageProps } from '../../Image';
|
|
10
|
+
import StatusIcon, { StatusIconName } from '../StatusIcon';
|
|
11
|
+
import {
|
|
12
|
+
StyledDescription,
|
|
13
|
+
StyledEmptyImageContainer,
|
|
14
|
+
StyledTitle,
|
|
15
|
+
StyledWrapper,
|
|
16
|
+
} from './StyledEmpty';
|
|
17
|
+
|
|
18
|
+
interface EmptyProps {
|
|
19
|
+
/**
|
|
20
|
+
* Image to be displayed.
|
|
21
|
+
*/
|
|
22
|
+
image?: ReactElement<ImageProps | RNImageProps>;
|
|
23
|
+
/**
|
|
24
|
+
* Empty's title.
|
|
25
|
+
*/
|
|
26
|
+
title: string;
|
|
27
|
+
/**
|
|
28
|
+
* Empty's description.
|
|
29
|
+
*/
|
|
30
|
+
description?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Empty's variant.
|
|
33
|
+
*/
|
|
34
|
+
variant?: 'light' | 'dark';
|
|
35
|
+
/**
|
|
36
|
+
* Additional style.
|
|
37
|
+
*/
|
|
38
|
+
style?: StyleProp<ViewStyle>;
|
|
39
|
+
/**
|
|
40
|
+
* Testing id of the component.
|
|
41
|
+
*/
|
|
42
|
+
testID?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Status icon to be displayed, this will replace the image prop.
|
|
45
|
+
*/
|
|
46
|
+
icon?: StatusIconName;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const renderImageOrIcon = ({
|
|
50
|
+
image,
|
|
51
|
+
icon,
|
|
52
|
+
}: {
|
|
53
|
+
image?: ReactElement<ImageProps | RNImageProps>;
|
|
54
|
+
icon?: StatusIconName;
|
|
55
|
+
}) => {
|
|
56
|
+
if (icon) {
|
|
57
|
+
return (
|
|
58
|
+
<StyledEmptyImageContainer>
|
|
59
|
+
<StatusIcon icon={icon} testID="empty-icon" />
|
|
60
|
+
</StyledEmptyImageContainer>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (image) {
|
|
65
|
+
return (
|
|
66
|
+
<StyledEmptyImageContainer testID="empty-image">
|
|
67
|
+
{image}
|
|
68
|
+
</StyledEmptyImageContainer>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const Empty = ({
|
|
76
|
+
image,
|
|
77
|
+
title,
|
|
78
|
+
description,
|
|
79
|
+
style,
|
|
80
|
+
testID,
|
|
81
|
+
variant = 'light',
|
|
82
|
+
icon,
|
|
83
|
+
}: EmptyProps): ReactElement => (
|
|
84
|
+
<StyledWrapper style={style} testID={testID}>
|
|
85
|
+
{renderImageOrIcon({ image, icon })}
|
|
86
|
+
<StyledTitle themeVariant={variant} level="h4" typeface="playful">
|
|
87
|
+
{title}
|
|
88
|
+
</StyledTitle>
|
|
89
|
+
{!!description && (
|
|
90
|
+
<StyledDescription variant="small" themeVariant={variant}>
|
|
91
|
+
{description}
|
|
92
|
+
</StyledDescription>
|
|
93
|
+
)}
|
|
94
|
+
</StyledWrapper>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
export default Empty;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import Image from '
|
|
4
|
-
import Typography from '
|
|
5
|
-
import Button from '
|
|
6
|
-
import Modal from '
|
|
3
|
+
import Image from '../../Image';
|
|
4
|
+
import Typography from '../../Typography';
|
|
5
|
+
import Button from '../../Button';
|
|
6
|
+
import Modal from '../../Modal';
|
|
7
7
|
|
|
8
8
|
type ErrorVariant = 'full-screen' | 'in-page';
|
|
9
9
|
|