@hero-design/rn 8.9.0 → 8.9.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,9 +1,9 @@
1
- @hero-design/rn:build: cache hit, replaying output 78487fe2f2a69692
1
+ @hero-design/rn:build: cache hit, replaying output 598a53bbbdfa05fc
2
2
  @hero-design/rn:build: $ yarn build:js && yarn build:types
3
3
  @hero-design/rn:build: $ rollup -c
4
4
  @hero-design/rn:build: 
5
5
  @hero-design/rn:build: src/index.ts → lib/index.js, es/index.js...
6
6
  @hero-design/rn:build: (!) 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`.
7
7
  @hero-design/rn:build: (!) 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
8
- @hero-design/rn:build: created lib/index.js, es/index.js in 26s
8
+ @hero-design/rn:build: created lib/index.js, es/index.js in 23.5s
9
9
  @hero-design/rn:build: $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/es/index.js CHANGED
@@ -10675,7 +10675,7 @@ var StyledPageControl = index$a(PageControl)({
10675
10675
  });
10676
10676
 
10677
10677
  function isCarouselImageProps(image) {
10678
- return typeof image !== 'string';
10678
+ return _typeof(image) === 'object';
10679
10679
  }
10680
10680
  var CarouselItem = function CarouselItem(_ref) {
10681
10681
  var width = _ref.width,
@@ -10693,9 +10693,9 @@ var CarouselItem = function CarouselItem(_ref) {
10693
10693
  width: image.width,
10694
10694
  resizeMode: image.resizeMode
10695
10695
  }) : /*#__PURE__*/React.createElement(StyledCarouselImage, {
10696
- source: {
10696
+ source: typeof image === 'string' ? {
10697
10697
  uri: image
10698
- }
10698
+ } : image
10699
10699
  })), /*#__PURE__*/React.createElement(StyledCarouselContentWrapper, {
10700
10700
  paddingHorizontal: "large",
10701
10701
  marginTop: "large",
package/lib/index.js CHANGED
@@ -10704,7 +10704,7 @@ var StyledPageControl = index$a(PageControl)({
10704
10704
  });
10705
10705
 
10706
10706
  function isCarouselImageProps(image) {
10707
- return typeof image !== 'string';
10707
+ return _typeof(image) === 'object';
10708
10708
  }
10709
10709
  var CarouselItem = function CarouselItem(_ref) {
10710
10710
  var width = _ref.width,
@@ -10722,9 +10722,9 @@ var CarouselItem = function CarouselItem(_ref) {
10722
10722
  width: image.width,
10723
10723
  resizeMode: image.resizeMode
10724
10724
  }) : /*#__PURE__*/React__default["default"].createElement(StyledCarouselImage, {
10725
- source: {
10725
+ source: typeof image === 'string' ? {
10726
10726
  uri: image
10727
- }
10727
+ } : image
10728
10728
  })), /*#__PURE__*/React__default["default"].createElement(StyledCarouselContentWrapper, {
10729
10729
  paddingHorizontal: "large",
10730
10730
  marginTop: "large",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.9.0",
3
+ "version": "8.9.1",
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.9.0",
24
+ "@hero-design/colors": "8.9.1",
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.9.0",
47
+ "@hero-design/eslint-plugin": "8.9.1",
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.9.0",
63
+ "eslint-config-hd": "8.9.1",
64
64
  "jest": "^27.3.1",
65
- "prettier-config-hd": "8.9.0",
65
+ "prettier-config-hd": "8.9.1",
66
66
  "react": "18.0.0",
67
67
  "react-native": "0.69.7",
68
68
  "react-native-gesture-handler": "~2.1.0",
@@ -16,7 +16,7 @@ interface CarouselItemProps extends Omit<CarouselData, 'background'> {
16
16
  function isCarouselImageProps(
17
17
  image: CarouselImageProps | string
18
18
  ): image is CarouselImageProps {
19
- return typeof image !== 'string';
19
+ return typeof image === 'object';
20
20
  }
21
21
 
22
22
  const CarouselItem = ({
@@ -37,7 +37,9 @@ const CarouselItem = ({
37
37
  resizeMode={image.resizeMode}
38
38
  />
39
39
  ) : (
40
- <StyledCarouselImage source={{ uri: image }} />
40
+ <StyledCarouselImage
41
+ source={typeof image === 'string' ? { uri: image } : image}
42
+ />
41
43
  ))}
42
44
 
43
45
  <StyledCarouselContentWrapper
@@ -39,7 +39,7 @@ exports[`Carousel renders basic carousel 1`] = `
39
39
  "background": "#ece8ef",
40
40
  "body": "Access your Work, Money and Benefits in the palm of your hand.",
41
41
  "heading": "Welcome to the new Employment Hero app",
42
- "image": "https://picsum.photos/800/1200",
42
+ "image": 1,
43
43
  },
44
44
  Object {
45
45
  "background": "#ccd2d3",
@@ -58,7 +58,21 @@ exports[`Carousel renders basic carousel 1`] = `
58
58
  "background": "#ccd2d3",
59
59
  "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vitae pulvinar quam, ac facilisis massa. Aliquam facilisis nisi eu justo dignissim, vel tempus justo iaculis.",
60
60
  "heading": "Easier to get around",
61
- "image": "https://picsum.photos/800/1200",
61
+ "image": Object {
62
+ "height": 100,
63
+ "resizeMode": "cover",
64
+ "uri": "https://picsum.photos/1200/800",
65
+ "width": 30,
66
+ },
67
+ },
68
+ Object {
69
+ "background": "#ccd2d3",
70
+ "heading": "Test slide 4",
71
+ "image": Object {
72
+ "height": 100,
73
+ "uri": "https://picsum.photos/1200/800",
74
+ "width": 30,
75
+ },
62
76
  },
63
77
  ]
64
78
  }
@@ -119,11 +133,7 @@ exports[`Carousel renders basic carousel 1`] = `
119
133
  }
120
134
  >
121
135
  <Image
122
- source={
123
- Object {
124
- "uri": "https://picsum.photos/800/1200",
125
- }
126
- }
136
+ source={1}
127
137
  style={
128
138
  Array [
129
139
  Object {
@@ -370,9 +380,14 @@ exports[`Carousel renders basic carousel 1`] = `
370
380
  }
371
381
  >
372
382
  <Image
383
+ height={100}
384
+ resizeMode="cover"
373
385
  source={
374
386
  Object {
375
- "uri": "https://picsum.photos/800/1200",
387
+ "height": 100,
388
+ "resizeMode": "cover",
389
+ "uri": "https://picsum.photos/1200/800",
390
+ "width": 30,
376
391
  }
377
392
  }
378
393
  style={
@@ -384,14 +399,16 @@ exports[`Carousel renders basic carousel 1`] = `
384
399
  },
385
400
  Array [
386
401
  Object {
387
- "flex": 1,
388
- "resizeMode": "contain",
389
- "width": "100%",
402
+ "alignSelf": "center",
403
+ "height": 100,
404
+ "resizeMode": "cover",
405
+ "width": 30,
390
406
  },
391
407
  undefined,
392
408
  ],
393
409
  ]
394
410
  }
411
+ width={30}
395
412
  />
396
413
  <View
397
414
  marginTop="large"
@@ -465,6 +482,108 @@ exports[`Carousel renders basic carousel 1`] = `
465
482
  </View>
466
483
  </View>
467
484
  </View>
485
+ <View
486
+ onLayout={[Function]}
487
+ style={
488
+ Array [
489
+ Object {
490
+ "flexDirection": "row",
491
+ },
492
+ null,
493
+ ]
494
+ }
495
+ >
496
+ <View
497
+ style={
498
+ Array [
499
+ Object {},
500
+ Object {
501
+ "width": 750,
502
+ },
503
+ ]
504
+ }
505
+ >
506
+ <Image
507
+ height={100}
508
+ source={
509
+ Object {
510
+ "height": 100,
511
+ "uri": "https://picsum.photos/1200/800",
512
+ "width": 30,
513
+ }
514
+ }
515
+ style={
516
+ Array [
517
+ Object {
518
+ "borderRadius": 0,
519
+ "height": 72,
520
+ "width": 72,
521
+ },
522
+ Array [
523
+ Object {
524
+ "alignSelf": "center",
525
+ "height": 100,
526
+ "resizeMode": "contain",
527
+ "width": 30,
528
+ },
529
+ undefined,
530
+ ],
531
+ ]
532
+ }
533
+ width={30}
534
+ />
535
+ <View
536
+ marginTop="large"
537
+ paddingHorizontal="large"
538
+ style={
539
+ Array [
540
+ Object {
541
+ "marginTop": 24,
542
+ "paddingHorizontal": 24,
543
+ },
544
+ Array [
545
+ Object {
546
+ "minHeight": 250,
547
+ "width": 750,
548
+ },
549
+ undefined,
550
+ ],
551
+ ]
552
+ }
553
+ width={750}
554
+ >
555
+ <Text
556
+ style={
557
+ Array [
558
+ Object {
559
+ "color": "#001f23",
560
+ "fontFamily": "BeVietnamPro-Regular",
561
+ "fontSize": 14,
562
+ "letterSpacing": 0.42,
563
+ "lineHeight": 22,
564
+ },
565
+ Array [
566
+ Object {
567
+ "fontFamily": "RebondGrotesque-SemiBold",
568
+ "fontSize": 32,
569
+ "lineHeight": 44,
570
+ "marginBottom": 16,
571
+ "marginTop": 8,
572
+ },
573
+ undefined,
574
+ ],
575
+ ]
576
+ }
577
+ themeFontSize="medium"
578
+ themeFontWeight="regular"
579
+ themeIntent="body"
580
+ themeTypeface="neutral"
581
+ >
582
+ Test slide 4
583
+ </Text>
584
+ </View>
585
+ </View>
586
+ </View>
468
587
  </View>
469
588
  </RCTScrollView>
470
589
  <View
@@ -603,6 +722,20 @@ exports[`Carousel renders basic carousel 1`] = `
603
722
  }
604
723
  testID="page-control-indicator2"
605
724
  />
725
+ <View
726
+ collapsable={false}
727
+ style={
728
+ Object {
729
+ "backgroundColor": "#401960",
730
+ "borderRadius": 999,
731
+ "height": 8,
732
+ "marginHorizontal": 8,
733
+ "opacity": 0.5,
734
+ "width": 8,
735
+ }
736
+ }
737
+ testID="page-control-indicator3"
738
+ />
606
739
  </View>
607
740
  </View>
608
741
  </View>
@@ -648,7 +781,7 @@ exports[`Carousel should call skip call back when press skip 1`] = `
648
781
  "background": "#ece8ef",
649
782
  "body": "Access your Work, Money and Benefits in the palm of your hand.",
650
783
  "heading": "Welcome to the new Employment Hero app",
651
- "image": "https://picsum.photos/800/1200",
784
+ "image": 1,
652
785
  },
653
786
  Object {
654
787
  "background": "#ccd2d3",
@@ -667,7 +800,21 @@ exports[`Carousel should call skip call back when press skip 1`] = `
667
800
  "background": "#ccd2d3",
668
801
  "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vitae pulvinar quam, ac facilisis massa. Aliquam facilisis nisi eu justo dignissim, vel tempus justo iaculis.",
669
802
  "heading": "Easier to get around",
670
- "image": "https://picsum.photos/800/1200",
803
+ "image": Object {
804
+ "height": 100,
805
+ "resizeMode": "cover",
806
+ "uri": "https://picsum.photos/1200/800",
807
+ "width": 30,
808
+ },
809
+ },
810
+ Object {
811
+ "background": "#ccd2d3",
812
+ "heading": "Test slide 4",
813
+ "image": Object {
814
+ "height": 100,
815
+ "uri": "https://picsum.photos/1200/800",
816
+ "width": 30,
817
+ },
671
818
  },
672
819
  ]
673
820
  }
@@ -728,11 +875,7 @@ exports[`Carousel should call skip call back when press skip 1`] = `
728
875
  }
729
876
  >
730
877
  <Image
731
- source={
732
- Object {
733
- "uri": "https://picsum.photos/800/1200",
734
- }
735
- }
878
+ source={1}
736
879
  style={
737
880
  Array [
738
881
  Object {
@@ -979,9 +1122,14 @@ exports[`Carousel should call skip call back when press skip 1`] = `
979
1122
  }
980
1123
  >
981
1124
  <Image
1125
+ height={100}
1126
+ resizeMode="cover"
982
1127
  source={
983
1128
  Object {
984
- "uri": "https://picsum.photos/800/1200",
1129
+ "height": 100,
1130
+ "resizeMode": "cover",
1131
+ "uri": "https://picsum.photos/1200/800",
1132
+ "width": 30,
985
1133
  }
986
1134
  }
987
1135
  style={
@@ -993,14 +1141,16 @@ exports[`Carousel should call skip call back when press skip 1`] = `
993
1141
  },
994
1142
  Array [
995
1143
  Object {
996
- "flex": 1,
997
- "resizeMode": "contain",
998
- "width": "100%",
1144
+ "alignSelf": "center",
1145
+ "height": 100,
1146
+ "resizeMode": "cover",
1147
+ "width": 30,
999
1148
  },
1000
1149
  undefined,
1001
1150
  ],
1002
1151
  ]
1003
1152
  }
1153
+ width={30}
1004
1154
  />
1005
1155
  <View
1006
1156
  marginTop="large"
@@ -1074,6 +1224,108 @@ exports[`Carousel should call skip call back when press skip 1`] = `
1074
1224
  </View>
1075
1225
  </View>
1076
1226
  </View>
1227
+ <View
1228
+ onLayout={[Function]}
1229
+ style={
1230
+ Array [
1231
+ Object {
1232
+ "flexDirection": "row",
1233
+ },
1234
+ null,
1235
+ ]
1236
+ }
1237
+ >
1238
+ <View
1239
+ style={
1240
+ Array [
1241
+ Object {},
1242
+ Object {
1243
+ "width": 750,
1244
+ },
1245
+ ]
1246
+ }
1247
+ >
1248
+ <Image
1249
+ height={100}
1250
+ source={
1251
+ Object {
1252
+ "height": 100,
1253
+ "uri": "https://picsum.photos/1200/800",
1254
+ "width": 30,
1255
+ }
1256
+ }
1257
+ style={
1258
+ Array [
1259
+ Object {
1260
+ "borderRadius": 0,
1261
+ "height": 72,
1262
+ "width": 72,
1263
+ },
1264
+ Array [
1265
+ Object {
1266
+ "alignSelf": "center",
1267
+ "height": 100,
1268
+ "resizeMode": "contain",
1269
+ "width": 30,
1270
+ },
1271
+ undefined,
1272
+ ],
1273
+ ]
1274
+ }
1275
+ width={30}
1276
+ />
1277
+ <View
1278
+ marginTop="large"
1279
+ paddingHorizontal="large"
1280
+ style={
1281
+ Array [
1282
+ Object {
1283
+ "marginTop": 24,
1284
+ "paddingHorizontal": 24,
1285
+ },
1286
+ Array [
1287
+ Object {
1288
+ "minHeight": 250,
1289
+ "width": 750,
1290
+ },
1291
+ undefined,
1292
+ ],
1293
+ ]
1294
+ }
1295
+ width={750}
1296
+ >
1297
+ <Text
1298
+ style={
1299
+ Array [
1300
+ Object {
1301
+ "color": "#001f23",
1302
+ "fontFamily": "BeVietnamPro-Regular",
1303
+ "fontSize": 14,
1304
+ "letterSpacing": 0.42,
1305
+ "lineHeight": 22,
1306
+ },
1307
+ Array [
1308
+ Object {
1309
+ "fontFamily": "RebondGrotesque-SemiBold",
1310
+ "fontSize": 32,
1311
+ "lineHeight": 44,
1312
+ "marginBottom": 16,
1313
+ "marginTop": 8,
1314
+ },
1315
+ undefined,
1316
+ ],
1317
+ ]
1318
+ }
1319
+ themeFontSize="medium"
1320
+ themeFontWeight="regular"
1321
+ themeIntent="body"
1322
+ themeTypeface="neutral"
1323
+ >
1324
+ Test slide 4
1325
+ </Text>
1326
+ </View>
1327
+ </View>
1328
+ </View>
1077
1329
  </View>
1078
1330
  </RCTScrollView>
1079
1331
  <View
@@ -1212,6 +1464,20 @@ exports[`Carousel should call skip call back when press skip 1`] = `
1212
1464
  }
1213
1465
  testID="page-control-indicator2"
1214
1466
  />
1467
+ <View
1468
+ collapsable={false}
1469
+ style={
1470
+ Object {
1471
+ "backgroundColor": "#401960",
1472
+ "borderRadius": 999,
1473
+ "height": 8,
1474
+ "marginHorizontal": 8,
1475
+ "opacity": 0.5,
1476
+ "width": 8,
1477
+ }
1478
+ }
1479
+ testID="page-control-indicator3"
1480
+ />
1215
1481
  </View>
1216
1482
  </View>
1217
1483
  </View>
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { fireEvent } from '@testing-library/react-native';
3
-
3
+ import { ImageResizeMode } from 'react-native';
4
4
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
5
5
  import Carousel from '..';
6
6
  import Image from '../../Image';
@@ -9,7 +9,7 @@ import Button from '../../Button/Button';
9
9
 
10
10
  const carouselData = [
11
11
  {
12
- image: 'https://picsum.photos/800/1200',
12
+ image: 1, // Test the case when we import .png files as React Native component, it's convert to ImageRequireSource type (which is a number).
13
13
  heading: 'Welcome to the new Employment Hero app',
14
14
  body: 'Access your Work, Money and Benefits in the palm of your hand.',
15
15
  background: theme.colors.highlightedSurface,
@@ -22,11 +22,25 @@ const carouselData = [
22
22
  background: theme.colors.decorativePrimarySurface,
23
23
  },
24
24
  {
25
- image: 'https://picsum.photos/800/1200',
25
+ image: {
26
+ uri: 'https://picsum.photos/1200/800',
27
+ width: 30,
28
+ height: 100,
29
+ resizeMode: 'cover' as ImageResizeMode,
30
+ },
26
31
  heading: 'Easier to get around',
27
32
  body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vitae pulvinar quam, ac facilisis massa. Aliquam facilisis nisi eu justo dignissim, vel tempus justo iaculis.',
28
33
  background: theme.colors.decorativePrimarySurface,
29
34
  },
35
+ {
36
+ image: {
37
+ uri: 'https://picsum.photos/1200/800',
38
+ width: 30,
39
+ height: 100,
40
+ },
41
+ heading: 'Test slide 4',
42
+ background: theme.colors.decorativePrimarySurface,
43
+ },
30
44
  ];
31
45
 
32
46
  describe('Carousel', () => {
@@ -48,11 +62,6 @@ describe('Carousel', () => {
48
62
 
49
63
  // Slide 1
50
64
  expect(queryByText('Welcome to the new Employment Hero app')).toBeTruthy();
51
- expect(
52
- queryByText(
53
- 'Access your Work, Money and Benefits in the palm of your hand.'
54
- )
55
- ).toBeTruthy();
56
65
 
57
66
  // Slide 2
58
67
  expect(queryByText('Same app with a new look!')).toBeTruthy();