@hero-design/rn 8.16.1 → 8.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.16.1",
3
+ "version": "8.17.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.16.1",
24
+ "@hero-design/colors": "8.17.0",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -32,6 +32,7 @@
32
32
  "react": "18.0.0",
33
33
  "react-native": "0.69.7",
34
34
  "react-native-gesture-handler": "^1.10.3 | ~2.1.0",
35
+ "react-native-linear-gradient": "^2.6.2",
35
36
  "react-native-pager-view": "^5.4.25",
36
37
  "react-native-safe-area-context": "^3.0.2",
37
38
  "react-native-vector-icons": "^9.1.0",
@@ -44,7 +45,7 @@
44
45
  "@babel/preset-typescript": "^7.17.12",
45
46
  "@babel/runtime": "^7.18.9",
46
47
  "@emotion/jest": "^11.9.3",
47
- "@hero-design/eslint-plugin": "8.16.1",
48
+ "@hero-design/eslint-plugin": "8.17.0",
48
49
  "@react-native-community/datetimepicker": "^3.5.2",
49
50
  "@react-native-community/slider": "4.1.12",
50
51
  "@rollup/plugin-babel": "^5.3.1",
@@ -60,12 +61,13 @@
60
61
  "@types/react-native": "^0.67.7",
61
62
  "@types/react-native-vector-icons": "^6.4.10",
62
63
  "babel-plugin-inline-import": "^3.0.0",
63
- "eslint-config-hd": "8.16.1",
64
+ "eslint-config-hd": "8.17.0",
64
65
  "jest": "^27.3.1",
65
- "prettier-config-hd": "8.16.1",
66
+ "prettier-config-hd": "8.17.0",
66
67
  "react": "18.0.0",
67
68
  "react-native": "0.69.7",
68
69
  "react-native-gesture-handler": "~2.1.0",
70
+ "react-native-linear-gradient": "^2.6.2",
69
71
  "react-native-pager-view": "^5.4.25",
70
72
  "react-native-safe-area-context": "^3.0.2",
71
73
  "react-native-vector-icons": "^9.1.0",
package/rollup.config.js CHANGED
@@ -33,6 +33,7 @@ export default {
33
33
  'react-native-webview',
34
34
  'react-native-pager-view',
35
35
  'react-native-vector-icons',
36
+ 'react-native-linear-gradient',
36
37
  ],
37
38
  plugins: [
38
39
  replace({
@@ -110,8 +110,12 @@ const ErrorPage = ({
110
110
  secondaryCtaText && onSecondaryCtaPress !== undefined;
111
111
  const showButtonContainer = showCta || showSecondaryCta;
112
112
  return (
113
- <StyledErrorContainer testID={testID} themeVariant={variant}>
114
- <StyledErrorContent {...nativeProps}>
113
+ <StyledErrorContainer
114
+ testID={testID}
115
+ themeVariant={variant}
116
+ {...nativeProps}
117
+ >
118
+ <StyledErrorContent>
115
119
  {image && (
116
120
  <StyledErrorImageContainer>
117
121
  {renderImage(image)}
@@ -0,0 +1,25 @@
1
+ import styled from '@emotion/native';
2
+ import Box from '../Box';
3
+
4
+ type ThemeIntent = 'light' | 'dark';
5
+ type ThemeVariant = 'circular' | 'rectangular' | 'rounded';
6
+
7
+ const StyledContainer = styled(Box)<{
8
+ themeIntent: ThemeIntent;
9
+ themeVariant: ThemeVariant;
10
+ }>(({ theme, themeIntent, themeVariant }) => ({
11
+ backgroundColor:
12
+ themeIntent === 'light'
13
+ ? theme.__hd__.skeleton.colors.lightBackground
14
+ : theme.__hd__.skeleton.colors.darkBackground,
15
+ borderRadius: theme.__hd__.skeleton.radii[themeVariant],
16
+ }));
17
+
18
+ const StyledGradientContainer = styled(Box)<{ themeVariant: ThemeVariant }>(
19
+ ({ theme, themeVariant }) => ({
20
+ overflow: 'hidden',
21
+ borderRadius: theme.__hd__.skeleton.radii[themeVariant],
22
+ })
23
+ );
24
+
25
+ export { StyledContainer, StyledGradientContainer };
@@ -0,0 +1,498 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Skeleton renders correctly by default 1`] = `
4
+ <View
5
+ onLayout={[Function]}
6
+ style={
7
+ Array [
8
+ Object {},
9
+ Array [
10
+ Object {
11
+ "backgroundColor": "#f6f6f7",
12
+ "borderRadius": 16,
13
+ },
14
+ undefined,
15
+ ],
16
+ ]
17
+ }
18
+ themeIntent="light"
19
+ themeVariant="rounded"
20
+ >
21
+ <View
22
+ style={
23
+ Array [
24
+ Object {},
25
+ Array [
26
+ Object {
27
+ "borderRadius": 16,
28
+ "overflow": "hidden",
29
+ },
30
+ undefined,
31
+ ],
32
+ ]
33
+ }
34
+ themeVariant="rounded"
35
+ >
36
+ <BVLinearGradient
37
+ collapsable={false}
38
+ colors={
39
+ Array [
40
+ 4294375159,
41
+ 4294046451,
42
+ 4294375159,
43
+ ]
44
+ }
45
+ endPoint={
46
+ Object {
47
+ "x": 1,
48
+ "y": 0,
49
+ }
50
+ }
51
+ locations={null}
52
+ startPoint={
53
+ Object {
54
+ "x": 0,
55
+ "y": 0,
56
+ }
57
+ }
58
+ style={
59
+ Object {
60
+ "height": 0,
61
+ "transform": Array [
62
+ Object {
63
+ "translateX": -0,
64
+ },
65
+ ],
66
+ "width": 0,
67
+ }
68
+ }
69
+ />
70
+ </View>
71
+ </View>
72
+ `;
73
+
74
+ exports[`Skeleton renders correctly when intent is dark and variant is circular 1`] = `
75
+ <View
76
+ onLayout={[Function]}
77
+ style={
78
+ Array [
79
+ Object {},
80
+ Array [
81
+ Object {
82
+ "backgroundColor": "#ffffff",
83
+ "borderRadius": 999,
84
+ },
85
+ undefined,
86
+ ],
87
+ ]
88
+ }
89
+ themeIntent="dark"
90
+ themeVariant="circular"
91
+ >
92
+ <View
93
+ style={
94
+ Array [
95
+ Object {},
96
+ Array [
97
+ Object {
98
+ "borderRadius": 999,
99
+ "overflow": "hidden",
100
+ },
101
+ undefined,
102
+ ],
103
+ ]
104
+ }
105
+ themeVariant="circular"
106
+ >
107
+ <BVLinearGradient
108
+ collapsable={false}
109
+ colors={
110
+ Array [
111
+ 4294967295,
112
+ 4294046451,
113
+ 4294967295,
114
+ ]
115
+ }
116
+ endPoint={
117
+ Object {
118
+ "x": 1,
119
+ "y": 0,
120
+ }
121
+ }
122
+ locations={null}
123
+ startPoint={
124
+ Object {
125
+ "x": 0,
126
+ "y": 0,
127
+ }
128
+ }
129
+ style={
130
+ Object {
131
+ "height": 0,
132
+ "transform": Array [
133
+ Object {
134
+ "translateX": -0,
135
+ },
136
+ ],
137
+ "width": 0,
138
+ }
139
+ }
140
+ />
141
+ </View>
142
+ </View>
143
+ `;
144
+
145
+ exports[`Skeleton renders correctly when intent is dark and variant is rectangular 1`] = `
146
+ <View
147
+ onLayout={[Function]}
148
+ style={
149
+ Array [
150
+ Object {},
151
+ Array [
152
+ Object {
153
+ "backgroundColor": "#ffffff",
154
+ "borderRadius": 0,
155
+ },
156
+ undefined,
157
+ ],
158
+ ]
159
+ }
160
+ themeIntent="dark"
161
+ themeVariant="rectangular"
162
+ >
163
+ <View
164
+ style={
165
+ Array [
166
+ Object {},
167
+ Array [
168
+ Object {
169
+ "borderRadius": 0,
170
+ "overflow": "hidden",
171
+ },
172
+ undefined,
173
+ ],
174
+ ]
175
+ }
176
+ themeVariant="rectangular"
177
+ >
178
+ <BVLinearGradient
179
+ collapsable={false}
180
+ colors={
181
+ Array [
182
+ 4294967295,
183
+ 4294046451,
184
+ 4294967295,
185
+ ]
186
+ }
187
+ endPoint={
188
+ Object {
189
+ "x": 1,
190
+ "y": 0,
191
+ }
192
+ }
193
+ locations={null}
194
+ startPoint={
195
+ Object {
196
+ "x": 0,
197
+ "y": 0,
198
+ }
199
+ }
200
+ style={
201
+ Object {
202
+ "height": 0,
203
+ "transform": Array [
204
+ Object {
205
+ "translateX": -0,
206
+ },
207
+ ],
208
+ "width": 0,
209
+ }
210
+ }
211
+ />
212
+ </View>
213
+ </View>
214
+ `;
215
+
216
+ exports[`Skeleton renders correctly when intent is dark and variant is rounded 1`] = `
217
+ <View
218
+ onLayout={[Function]}
219
+ style={
220
+ Array [
221
+ Object {},
222
+ Array [
223
+ Object {
224
+ "backgroundColor": "#ffffff",
225
+ "borderRadius": 16,
226
+ },
227
+ undefined,
228
+ ],
229
+ ]
230
+ }
231
+ themeIntent="dark"
232
+ themeVariant="rounded"
233
+ >
234
+ <View
235
+ style={
236
+ Array [
237
+ Object {},
238
+ Array [
239
+ Object {
240
+ "borderRadius": 16,
241
+ "overflow": "hidden",
242
+ },
243
+ undefined,
244
+ ],
245
+ ]
246
+ }
247
+ themeVariant="rounded"
248
+ >
249
+ <BVLinearGradient
250
+ collapsable={false}
251
+ colors={
252
+ Array [
253
+ 4294967295,
254
+ 4294046451,
255
+ 4294967295,
256
+ ]
257
+ }
258
+ endPoint={
259
+ Object {
260
+ "x": 1,
261
+ "y": 0,
262
+ }
263
+ }
264
+ locations={null}
265
+ startPoint={
266
+ Object {
267
+ "x": 0,
268
+ "y": 0,
269
+ }
270
+ }
271
+ style={
272
+ Object {
273
+ "height": 0,
274
+ "transform": Array [
275
+ Object {
276
+ "translateX": -0,
277
+ },
278
+ ],
279
+ "width": 0,
280
+ }
281
+ }
282
+ />
283
+ </View>
284
+ </View>
285
+ `;
286
+
287
+ exports[`Skeleton renders correctly when intent is light and variant is circular 1`] = `
288
+ <View
289
+ onLayout={[Function]}
290
+ style={
291
+ Array [
292
+ Object {},
293
+ Array [
294
+ Object {
295
+ "backgroundColor": "#f6f6f7",
296
+ "borderRadius": 999,
297
+ },
298
+ undefined,
299
+ ],
300
+ ]
301
+ }
302
+ themeIntent="light"
303
+ themeVariant="circular"
304
+ >
305
+ <View
306
+ style={
307
+ Array [
308
+ Object {},
309
+ Array [
310
+ Object {
311
+ "borderRadius": 999,
312
+ "overflow": "hidden",
313
+ },
314
+ undefined,
315
+ ],
316
+ ]
317
+ }
318
+ themeVariant="circular"
319
+ >
320
+ <BVLinearGradient
321
+ collapsable={false}
322
+ colors={
323
+ Array [
324
+ 4294375159,
325
+ 4294046451,
326
+ 4294375159,
327
+ ]
328
+ }
329
+ endPoint={
330
+ Object {
331
+ "x": 1,
332
+ "y": 0,
333
+ }
334
+ }
335
+ locations={null}
336
+ startPoint={
337
+ Object {
338
+ "x": 0,
339
+ "y": 0,
340
+ }
341
+ }
342
+ style={
343
+ Object {
344
+ "height": 0,
345
+ "transform": Array [
346
+ Object {
347
+ "translateX": -0,
348
+ },
349
+ ],
350
+ "width": 0,
351
+ }
352
+ }
353
+ />
354
+ </View>
355
+ </View>
356
+ `;
357
+
358
+ exports[`Skeleton renders correctly when intent is light and variant is rectangular 1`] = `
359
+ <View
360
+ onLayout={[Function]}
361
+ style={
362
+ Array [
363
+ Object {},
364
+ Array [
365
+ Object {
366
+ "backgroundColor": "#f6f6f7",
367
+ "borderRadius": 0,
368
+ },
369
+ undefined,
370
+ ],
371
+ ]
372
+ }
373
+ themeIntent="light"
374
+ themeVariant="rectangular"
375
+ >
376
+ <View
377
+ style={
378
+ Array [
379
+ Object {},
380
+ Array [
381
+ Object {
382
+ "borderRadius": 0,
383
+ "overflow": "hidden",
384
+ },
385
+ undefined,
386
+ ],
387
+ ]
388
+ }
389
+ themeVariant="rectangular"
390
+ >
391
+ <BVLinearGradient
392
+ collapsable={false}
393
+ colors={
394
+ Array [
395
+ 4294375159,
396
+ 4294046451,
397
+ 4294375159,
398
+ ]
399
+ }
400
+ endPoint={
401
+ Object {
402
+ "x": 1,
403
+ "y": 0,
404
+ }
405
+ }
406
+ locations={null}
407
+ startPoint={
408
+ Object {
409
+ "x": 0,
410
+ "y": 0,
411
+ }
412
+ }
413
+ style={
414
+ Object {
415
+ "height": 0,
416
+ "transform": Array [
417
+ Object {
418
+ "translateX": -0,
419
+ },
420
+ ],
421
+ "width": 0,
422
+ }
423
+ }
424
+ />
425
+ </View>
426
+ </View>
427
+ `;
428
+
429
+ exports[`Skeleton renders correctly when intent is light and variant is rounded 1`] = `
430
+ <View
431
+ onLayout={[Function]}
432
+ style={
433
+ Array [
434
+ Object {},
435
+ Array [
436
+ Object {
437
+ "backgroundColor": "#f6f6f7",
438
+ "borderRadius": 16,
439
+ },
440
+ undefined,
441
+ ],
442
+ ]
443
+ }
444
+ themeIntent="light"
445
+ themeVariant="rounded"
446
+ >
447
+ <View
448
+ style={
449
+ Array [
450
+ Object {},
451
+ Array [
452
+ Object {
453
+ "borderRadius": 16,
454
+ "overflow": "hidden",
455
+ },
456
+ undefined,
457
+ ],
458
+ ]
459
+ }
460
+ themeVariant="rounded"
461
+ >
462
+ <BVLinearGradient
463
+ collapsable={false}
464
+ colors={
465
+ Array [
466
+ 4294375159,
467
+ 4294046451,
468
+ 4294375159,
469
+ ]
470
+ }
471
+ endPoint={
472
+ Object {
473
+ "x": 1,
474
+ "y": 0,
475
+ }
476
+ }
477
+ locations={null}
478
+ startPoint={
479
+ Object {
480
+ "x": 0,
481
+ "y": 0,
482
+ }
483
+ }
484
+ style={
485
+ Object {
486
+ "height": 0,
487
+ "transform": Array [
488
+ Object {
489
+ "translateX": -0,
490
+ },
491
+ ],
492
+ "width": 0,
493
+ }
494
+ }
495
+ />
496
+ </View>
497
+ </View>
498
+ `;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
3
+ import Skeleton from '..';
4
+
5
+ describe('Skeleton', () => {
6
+ it('renders correctly by default', () => {
7
+ const { toJSON } = renderWithTheme(<Skeleton />);
8
+
9
+ expect(toJSON()).toMatchSnapshot();
10
+ });
11
+
12
+ it.each`
13
+ variant | intent
14
+ ${'circular'} | ${'light'}
15
+ ${'circular'} | ${'dark'}
16
+ ${'rectangular'} | ${'light'}
17
+ ${'rectangular'} | ${'dark'}
18
+ ${'rounded'} | ${'light'}
19
+ ${'rounded'} | ${'dark'}
20
+ `(
21
+ 'renders correctly when intent is $intent and variant is $variant',
22
+ ({ variant, intent }) => {
23
+ const { toJSON } = renderWithTheme(
24
+ <Skeleton intent={intent} variant={variant} />
25
+ );
26
+
27
+ expect(toJSON()).toMatchSnapshot();
28
+ }
29
+ );
30
+ });