@hero-design/rn 8.57.1 → 8.58.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.
@@ -2,4 +2,4 @@
2
2
  src/index.ts → lib/index.js, es/index.js...
3
3
  (!) 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`.
4
4
  (!) 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
5
- created lib/index.js, es/index.js in 57.2s
5
+ created lib/index.js, es/index.js in 58.4s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.58.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2756](https://github.com/Thinkei/hero-design/pull/2756) [`de3e8fa92`](https://github.com/Thinkei/hero-design/commit/de3e8fa92aa4a3598fc24f6fbdf40c66066bbb90) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Carousel] Update styling and make image optional
8
+
9
+ ### Patch Changes
10
+
11
+ - [#2758](https://github.com/Thinkei/hero-design/pull/2758) [`61012afc4`](https://github.com/Thinkei/hero-design/commit/61012afc45105803d3bec4fc8ca8cf7cbe7f9363) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Tabs] Fix tabs bottom border on iOS not showing in full width
12
+
3
13
  ## 8.57.1
4
14
 
5
15
  ### Patch Changes
package/es/index.js CHANGED
@@ -2403,7 +2403,6 @@ var getCardTheme = function getCardTheme(theme) {
2403
2403
 
2404
2404
  var getCarouselTheme = function getCarouselTheme(theme) {
2405
2405
  var space = {
2406
- headingMarginTop: theme.space.small,
2407
2406
  headingMarginBottom: theme.space.medium,
2408
2407
  footerPaddingHorizontal: theme.space.large,
2409
2408
  footerPaddingVertical: theme.space.medium,
@@ -12239,7 +12238,6 @@ var StyledCarouselView = index$9(View)(function () {
12239
12238
  var StyledCarouselHeading = index$9(Typography.Title)(function (_ref2) {
12240
12239
  var theme = _ref2.theme;
12241
12240
  return {
12242
- marginTop: theme.__hd__.carousel.space.headingMarginTop,
12243
12241
  marginBottom: theme.__hd__.carousel.space.headingMarginBottom
12244
12242
  };
12245
12243
  });
@@ -12303,22 +12301,37 @@ var CarouselItem = function CarouselItem(_ref) {
12303
12301
  content = _ref.content,
12304
12302
  heading = _ref.heading,
12305
12303
  body = _ref.body;
12304
+ var theme = useTheme$1();
12305
+ var ImageComponent = React.useMemo(function () {
12306
+ if (image) {
12307
+ if (isCarouselImageProps(image)) {
12308
+ return /*#__PURE__*/React.createElement(StyledCustomSizeCarouselImage, {
12309
+ source: image,
12310
+ height: image.height,
12311
+ width: image.width,
12312
+ resizeMode: image.resizeMode,
12313
+ style: {
12314
+ marginBottom: theme.space.medium
12315
+ }
12316
+ });
12317
+ }
12318
+ return /*#__PURE__*/React.createElement(StyledCarouselImage, {
12319
+ source: typeof image === 'string' ? {
12320
+ uri: image
12321
+ } : image,
12322
+ style: {
12323
+ marginBottom: theme.space.medium
12324
+ }
12325
+ });
12326
+ }
12327
+ return null;
12328
+ }, [image]);
12306
12329
  return /*#__PURE__*/React.createElement(Box, {
12307
12330
  style: {
12308
12331
  width: width
12309
12332
  }
12310
- }, image && (isCarouselImageProps(image) ? /*#__PURE__*/React.createElement(StyledCustomSizeCarouselImage, {
12311
- source: image,
12312
- height: image.height,
12313
- width: image.width,
12314
- resizeMode: image.resizeMode
12315
- }) : /*#__PURE__*/React.createElement(StyledCarouselImage, {
12316
- source: typeof image === 'string' ? {
12317
- uri: image
12318
- } : image
12319
- })), /*#__PURE__*/React.createElement(StyledCarouselContentWrapper, {
12320
- paddingHorizontal: "large",
12321
- marginTop: "large",
12333
+ }, ImageComponent, /*#__PURE__*/React.createElement(StyledCarouselContentWrapper, {
12334
+ paddingHorizontal: "medium",
12322
12335
  width: width
12323
12336
  }, content, /*#__PURE__*/React.createElement(StyledCarouselHeading, {
12324
12337
  level: "h1",
@@ -17648,18 +17661,16 @@ var ScrollableTabHeader = function ScrollableTabHeader(_ref2) {
17648
17661
  });
17649
17662
  }, 100);
17650
17663
  },
17651
- style:
17652
- // Border styles specified in contentContainerStyle don't work
17653
- // so they need to be placed here instead on Android.
17654
- Platform.OS === 'android' ? {
17664
+ style: {
17655
17665
  borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
17656
17666
  borderBottomWidth: theme.__hd__.tabs.sizes.indicator
17657
- } : undefined,
17658
- contentContainerStyle: {
17659
- paddingHorizontal: theme.__hd__.tabs.space.flatListHorizontalPadding,
17667
+ },
17668
+ contentContainerStyle: _objectSpread2({
17669
+ paddingHorizontal: theme.__hd__.tabs.space.flatListHorizontalPadding
17670
+ }, Platform.OS === 'android' && {
17660
17671
  borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
17661
17672
  borderBottomWidth: theme.__hd__.tabs.sizes.indicator
17662
- },
17673
+ }),
17663
17674
  renderItem: function renderItem(_ref4) {
17664
17675
  var tab = _ref4.item,
17665
17676
  index = _ref4.index;
package/lib/index.js CHANGED
@@ -2433,7 +2433,6 @@ var getCardTheme = function getCardTheme(theme) {
2433
2433
 
2434
2434
  var getCarouselTheme = function getCarouselTheme(theme) {
2435
2435
  var space = {
2436
- headingMarginTop: theme.space.small,
2437
2436
  headingMarginBottom: theme.space.medium,
2438
2437
  footerPaddingHorizontal: theme.space.large,
2439
2438
  footerPaddingVertical: theme.space.medium,
@@ -12269,7 +12268,6 @@ var StyledCarouselView = index$9(reactNative.View)(function () {
12269
12268
  var StyledCarouselHeading = index$9(Typography.Title)(function (_ref2) {
12270
12269
  var theme = _ref2.theme;
12271
12270
  return {
12272
- marginTop: theme.__hd__.carousel.space.headingMarginTop,
12273
12271
  marginBottom: theme.__hd__.carousel.space.headingMarginBottom
12274
12272
  };
12275
12273
  });
@@ -12333,22 +12331,37 @@ var CarouselItem = function CarouselItem(_ref) {
12333
12331
  content = _ref.content,
12334
12332
  heading = _ref.heading,
12335
12333
  body = _ref.body;
12334
+ var theme = useTheme$1();
12335
+ var ImageComponent = React__default["default"].useMemo(function () {
12336
+ if (image) {
12337
+ if (isCarouselImageProps(image)) {
12338
+ return /*#__PURE__*/React__default["default"].createElement(StyledCustomSizeCarouselImage, {
12339
+ source: image,
12340
+ height: image.height,
12341
+ width: image.width,
12342
+ resizeMode: image.resizeMode,
12343
+ style: {
12344
+ marginBottom: theme.space.medium
12345
+ }
12346
+ });
12347
+ }
12348
+ return /*#__PURE__*/React__default["default"].createElement(StyledCarouselImage, {
12349
+ source: typeof image === 'string' ? {
12350
+ uri: image
12351
+ } : image,
12352
+ style: {
12353
+ marginBottom: theme.space.medium
12354
+ }
12355
+ });
12356
+ }
12357
+ return null;
12358
+ }, [image]);
12336
12359
  return /*#__PURE__*/React__default["default"].createElement(Box, {
12337
12360
  style: {
12338
12361
  width: width
12339
12362
  }
12340
- }, image && (isCarouselImageProps(image) ? /*#__PURE__*/React__default["default"].createElement(StyledCustomSizeCarouselImage, {
12341
- source: image,
12342
- height: image.height,
12343
- width: image.width,
12344
- resizeMode: image.resizeMode
12345
- }) : /*#__PURE__*/React__default["default"].createElement(StyledCarouselImage, {
12346
- source: typeof image === 'string' ? {
12347
- uri: image
12348
- } : image
12349
- })), /*#__PURE__*/React__default["default"].createElement(StyledCarouselContentWrapper, {
12350
- paddingHorizontal: "large",
12351
- marginTop: "large",
12363
+ }, ImageComponent, /*#__PURE__*/React__default["default"].createElement(StyledCarouselContentWrapper, {
12364
+ paddingHorizontal: "medium",
12352
12365
  width: width
12353
12366
  }, content, /*#__PURE__*/React__default["default"].createElement(StyledCarouselHeading, {
12354
12367
  level: "h1",
@@ -17678,18 +17691,16 @@ var ScrollableTabHeader = function ScrollableTabHeader(_ref2) {
17678
17691
  });
17679
17692
  }, 100);
17680
17693
  },
17681
- style:
17682
- // Border styles specified in contentContainerStyle don't work
17683
- // so they need to be placed here instead on Android.
17684
- reactNative.Platform.OS === 'android' ? {
17694
+ style: {
17685
17695
  borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
17686
17696
  borderBottomWidth: theme.__hd__.tabs.sizes.indicator
17687
- } : undefined,
17688
- contentContainerStyle: {
17689
- paddingHorizontal: theme.__hd__.tabs.space.flatListHorizontalPadding,
17697
+ },
17698
+ contentContainerStyle: _objectSpread2({
17699
+ paddingHorizontal: theme.__hd__.tabs.space.flatListHorizontalPadding
17700
+ }, reactNative.Platform.OS === 'android' && {
17690
17701
  borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
17691
17702
  borderBottomWidth: theme.__hd__.tabs.sizes.indicator
17692
- },
17703
+ }),
17693
17704
  renderItem: function renderItem(_ref4) {
17694
17705
  var tab = _ref4.item,
17695
17706
  index = _ref4.index;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.57.1",
3
+ "version": "8.58.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { useTheme } from '@emotion/react';
2
3
  import {
3
4
  StyledCarouselContentWrapper,
4
5
  StyledCarouselHeading,
@@ -26,27 +27,38 @@ const CarouselItem = ({
26
27
  heading,
27
28
  body,
28
29
  }: CarouselItemProps) => {
29
- return (
30
- <Box style={{ width }}>
31
- {image &&
32
- (isCarouselImageProps(image) ? (
30
+ const theme = useTheme();
31
+
32
+ const ImageComponent = React.useMemo(() => {
33
+ if (image) {
34
+ if (isCarouselImageProps(image)) {
35
+ return (
33
36
  <StyledCustomSizeCarouselImage
34
37
  source={image}
35
38
  height={image.height}
36
39
  width={image.width}
37
40
  resizeMode={image.resizeMode}
41
+ style={{ marginBottom: theme.space.medium }}
38
42
  />
39
- ) : (
40
- <StyledCarouselImage
41
- source={typeof image === 'string' ? { uri: image } : image}
42
- />
43
- ))}
43
+ );
44
+ }
45
+
46
+ return (
47
+ <StyledCarouselImage
48
+ source={typeof image === 'string' ? { uri: image } : image}
49
+ style={{ marginBottom: theme.space.medium }}
50
+ />
51
+ );
52
+ }
53
+
54
+ return null;
55
+ }, [image]);
56
+
57
+ return (
58
+ <Box style={{ width }}>
59
+ {ImageComponent}
44
60
 
45
- <StyledCarouselContentWrapper
46
- paddingHorizontal="large"
47
- marginTop="large"
48
- width={width}
49
- >
61
+ <StyledCarouselContentWrapper paddingHorizontal="medium" width={width}>
50
62
  {content}
51
63
  <StyledCarouselHeading level="h1" typeface="playful">
52
64
  {heading}
@@ -22,7 +22,6 @@ const StyledCarouselView = styled(View)(() => ({
22
22
  }));
23
23
 
24
24
  const StyledCarouselHeading = styled(Typography.Title)(({ theme }) => ({
25
- marginTop: theme.__hd__.carousel.space.headingMarginTop,
26
25
  marginBottom: theme.__hd__.carousel.space.headingMarginBottom,
27
26
  }));
28
27
 
@@ -34,8 +33,8 @@ const StyledCarouselImage = styled(Image)(() => ({
34
33
  }));
35
34
 
36
35
  const StyledCustomSizeCarouselImage = styled(Image)<{
37
- height?: number;
38
- width?: number;
36
+ height?: number | `${number}%`;
37
+ width?: number | `${number}%`;
39
38
  resizeMode?: ImageResizeMode;
40
39
  }>(({ height, resizeMode = 'contain', width }) => ({
41
40
  alignSelf: 'center',
@@ -93,6 +93,10 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
93
93
  "width": 30,
94
94
  },
95
95
  },
96
+ {
97
+ "background": "#ccd2d3",
98
+ "heading": "Test slide 5",
99
+ },
96
100
  ]
97
101
  }
98
102
  getItem={[Function]}
@@ -169,19 +173,19 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
169
173
  "resizeMode": "contain",
170
174
  "width": "100%",
171
175
  },
172
- undefined,
176
+ {
177
+ "marginBottom": 16,
178
+ },
173
179
  ],
174
180
  ]
175
181
  }
176
182
  />
177
183
  <View
178
- marginTop="large"
179
- paddingHorizontal="large"
184
+ paddingHorizontal="medium"
180
185
  style={
181
186
  [
182
187
  {
183
- "marginTop": 24,
184
- "paddingHorizontal": 24,
188
+ "paddingHorizontal": 16,
185
189
  },
186
190
  [
187
191
  {
@@ -207,7 +211,6 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
207
211
  [
208
212
  {
209
213
  "marginBottom": 16,
210
- "marginTop": 8,
211
214
  },
212
215
  undefined,
213
216
  ],
@@ -283,19 +286,19 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
283
286
  "resizeMode": "contain",
284
287
  "width": "100%",
285
288
  },
286
- undefined,
289
+ {
290
+ "marginBottom": 16,
291
+ },
287
292
  ],
288
293
  ]
289
294
  }
290
295
  />
291
296
  <View
292
- marginTop="large"
293
- paddingHorizontal="large"
297
+ paddingHorizontal="medium"
294
298
  style={
295
299
  [
296
300
  {
297
- "marginTop": 24,
298
- "paddingHorizontal": 24,
301
+ "paddingHorizontal": 16,
299
302
  },
300
303
  [
301
304
  {
@@ -338,7 +341,6 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
338
341
  [
339
342
  {
340
343
  "marginBottom": 16,
341
- "marginTop": 8,
342
344
  },
343
345
  undefined,
344
346
  ],
@@ -419,20 +421,20 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
419
421
  "resizeMode": "cover",
420
422
  "width": 30,
421
423
  },
422
- undefined,
424
+ {
425
+ "marginBottom": 16,
426
+ },
423
427
  ],
424
428
  ]
425
429
  }
426
430
  width={30}
427
431
  />
428
432
  <View
429
- marginTop="large"
430
- paddingHorizontal="large"
433
+ paddingHorizontal="medium"
431
434
  style={
432
435
  [
433
436
  {
434
- "marginTop": 24,
435
- "paddingHorizontal": 24,
437
+ "paddingHorizontal": 16,
436
438
  },
437
439
  [
438
440
  {
@@ -458,7 +460,6 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
458
460
  [
459
461
  {
460
462
  "marginBottom": 16,
461
- "marginTop": 8,
462
463
  },
463
464
  undefined,
464
465
  ],
@@ -537,20 +538,20 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
537
538
  "resizeMode": "contain",
538
539
  "width": 30,
539
540
  },
540
- undefined,
541
+ {
542
+ "marginBottom": 16,
543
+ },
541
544
  ],
542
545
  ]
543
546
  }
544
547
  width={30}
545
548
  />
546
549
  <View
547
- marginTop="large"
548
- paddingHorizontal="large"
550
+ paddingHorizontal="medium"
549
551
  style={
550
552
  [
551
553
  {
552
- "marginTop": 24,
553
- "paddingHorizontal": 24,
554
+ "paddingHorizontal": 16,
554
555
  },
555
556
  [
556
557
  {
@@ -576,7 +577,6 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
576
577
  [
577
578
  {
578
579
  "marginBottom": 16,
579
- "marginTop": 8,
580
580
  },
581
581
  undefined,
582
582
  ],
@@ -591,6 +591,72 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
591
591
  </View>
592
592
  </View>
593
593
  </View>
594
+ <View
595
+ onFocusCapture={[Function]}
596
+ style={
597
+ [
598
+ {
599
+ "flexDirection": "row",
600
+ },
601
+ null,
602
+ ]
603
+ }
604
+ >
605
+ <View
606
+ style={
607
+ [
608
+ {},
609
+ {
610
+ "width": 300,
611
+ },
612
+ ]
613
+ }
614
+ >
615
+ <View
616
+ paddingHorizontal="medium"
617
+ style={
618
+ [
619
+ {
620
+ "paddingHorizontal": 16,
621
+ },
622
+ [
623
+ {
624
+ "width": 300,
625
+ },
626
+ undefined,
627
+ ],
628
+ ]
629
+ }
630
+ width={300}
631
+ >
632
+ <Text
633
+ allowFontScaling={false}
634
+ style={
635
+ [
636
+ {
637
+ "color": "#001f23",
638
+ "fontFamily": "RebondGrotesque-SemiBold",
639
+ "fontSize": 36,
640
+ "letterSpacing": 1.5,
641
+ "lineHeight": 44,
642
+ },
643
+ [
644
+ {
645
+ "marginBottom": 16,
646
+ },
647
+ undefined,
648
+ ],
649
+ ]
650
+ }
651
+ themeIntent="body"
652
+ themeLevel="h1"
653
+ themeTypeface="playful"
654
+ >
655
+ Test slide 5
656
+ </Text>
657
+ </View>
658
+ </View>
659
+ </View>
594
660
  </View>
595
661
  </RCTScrollView>
596
662
  <View
@@ -770,6 +836,25 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
770
836
  }
771
837
  testID="page-control-indicator3"
772
838
  />
839
+ <View
840
+ accessibilityState={
841
+ {
842
+ "selected": false,
843
+ }
844
+ }
845
+ collapsable={false}
846
+ style={
847
+ {
848
+ "backgroundColor": "#401960",
849
+ "borderRadius": 999,
850
+ "height": 8,
851
+ "marginHorizontal": 8,
852
+ "opacity": 0.5,
853
+ "width": 8,
854
+ }
855
+ }
856
+ testID="page-control-indicator4"
857
+ />
773
858
  </View>
774
859
  </View>
775
860
  </View>
@@ -928,6 +1013,25 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
928
1013
  }
929
1014
  testID="page-control-indicator3"
930
1015
  />
1016
+ <View
1017
+ accessibilityState={
1018
+ {
1019
+ "selected": false,
1020
+ }
1021
+ }
1022
+ collapsable={false}
1023
+ style={
1024
+ {
1025
+ "backgroundColor": "#401960",
1026
+ "borderRadius": 999,
1027
+ "height": 8,
1028
+ "marginHorizontal": 8,
1029
+ "opacity": 0.5,
1030
+ "width": 8,
1031
+ }
1032
+ }
1033
+ testID="page-control-indicator4"
1034
+ />
931
1035
  </View>
932
1036
  </View>
933
1037
  <View
@@ -984,6 +1088,10 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
984
1088
  "width": 30,
985
1089
  },
986
1090
  },
1091
+ {
1092
+ "background": "#ccd2d3",
1093
+ "heading": "Test slide 5",
1094
+ },
987
1095
  ]
988
1096
  }
989
1097
  getItem={[Function]}
@@ -1060,19 +1168,19 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1060
1168
  "resizeMode": "contain",
1061
1169
  "width": "100%",
1062
1170
  },
1063
- undefined,
1171
+ {
1172
+ "marginBottom": 16,
1173
+ },
1064
1174
  ],
1065
1175
  ]
1066
1176
  }
1067
1177
  />
1068
1178
  <View
1069
- marginTop="large"
1070
- paddingHorizontal="large"
1179
+ paddingHorizontal="medium"
1071
1180
  style={
1072
1181
  [
1073
1182
  {
1074
- "marginTop": 24,
1075
- "paddingHorizontal": 24,
1183
+ "paddingHorizontal": 16,
1076
1184
  },
1077
1185
  [
1078
1186
  {
@@ -1098,7 +1206,6 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1098
1206
  [
1099
1207
  {
1100
1208
  "marginBottom": 16,
1101
- "marginTop": 8,
1102
1209
  },
1103
1210
  undefined,
1104
1211
  ],
@@ -1174,19 +1281,19 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1174
1281
  "resizeMode": "contain",
1175
1282
  "width": "100%",
1176
1283
  },
1177
- undefined,
1284
+ {
1285
+ "marginBottom": 16,
1286
+ },
1178
1287
  ],
1179
1288
  ]
1180
1289
  }
1181
1290
  />
1182
1291
  <View
1183
- marginTop="large"
1184
- paddingHorizontal="large"
1292
+ paddingHorizontal="medium"
1185
1293
  style={
1186
1294
  [
1187
1295
  {
1188
- "marginTop": 24,
1189
- "paddingHorizontal": 24,
1296
+ "paddingHorizontal": 16,
1190
1297
  },
1191
1298
  [
1192
1299
  {
@@ -1229,7 +1336,6 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1229
1336
  [
1230
1337
  {
1231
1338
  "marginBottom": 16,
1232
- "marginTop": 8,
1233
1339
  },
1234
1340
  undefined,
1235
1341
  ],
@@ -1310,20 +1416,20 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1310
1416
  "resizeMode": "cover",
1311
1417
  "width": 30,
1312
1418
  },
1313
- undefined,
1419
+ {
1420
+ "marginBottom": 16,
1421
+ },
1314
1422
  ],
1315
1423
  ]
1316
1424
  }
1317
1425
  width={30}
1318
1426
  />
1319
1427
  <View
1320
- marginTop="large"
1321
- paddingHorizontal="large"
1428
+ paddingHorizontal="medium"
1322
1429
  style={
1323
1430
  [
1324
1431
  {
1325
- "marginTop": 24,
1326
- "paddingHorizontal": 24,
1432
+ "paddingHorizontal": 16,
1327
1433
  },
1328
1434
  [
1329
1435
  {
@@ -1349,7 +1455,6 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1349
1455
  [
1350
1456
  {
1351
1457
  "marginBottom": 16,
1352
- "marginTop": 8,
1353
1458
  },
1354
1459
  undefined,
1355
1460
  ],
@@ -1428,20 +1533,20 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1428
1533
  "resizeMode": "contain",
1429
1534
  "width": 30,
1430
1535
  },
1431
- undefined,
1536
+ {
1537
+ "marginBottom": 16,
1538
+ },
1432
1539
  ],
1433
1540
  ]
1434
1541
  }
1435
1542
  width={30}
1436
1543
  />
1437
1544
  <View
1438
- marginTop="large"
1439
- paddingHorizontal="large"
1545
+ paddingHorizontal="medium"
1440
1546
  style={
1441
1547
  [
1442
1548
  {
1443
- "marginTop": 24,
1444
- "paddingHorizontal": 24,
1549
+ "paddingHorizontal": 16,
1445
1550
  },
1446
1551
  [
1447
1552
  {
@@ -1467,7 +1572,6 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1467
1572
  [
1468
1573
  {
1469
1574
  "marginBottom": 16,
1470
- "marginTop": 8,
1471
1575
  },
1472
1576
  undefined,
1473
1577
  ],
@@ -1482,6 +1586,348 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
1482
1586
  </View>
1483
1587
  </View>
1484
1588
  </View>
1589
+ <View
1590
+ onFocusCapture={[Function]}
1591
+ style={
1592
+ [
1593
+ {
1594
+ "flexDirection": "row",
1595
+ },
1596
+ null,
1597
+ ]
1598
+ }
1599
+ >
1600
+ <View
1601
+ style={
1602
+ [
1603
+ {},
1604
+ {
1605
+ "width": 300,
1606
+ },
1607
+ ]
1608
+ }
1609
+ >
1610
+ <View
1611
+ paddingHorizontal="medium"
1612
+ style={
1613
+ [
1614
+ {
1615
+ "paddingHorizontal": 16,
1616
+ },
1617
+ [
1618
+ {
1619
+ "width": 300,
1620
+ },
1621
+ undefined,
1622
+ ],
1623
+ ]
1624
+ }
1625
+ width={300}
1626
+ >
1627
+ <Text
1628
+ allowFontScaling={false}
1629
+ style={
1630
+ [
1631
+ {
1632
+ "color": "#001f23",
1633
+ "fontFamily": "RebondGrotesque-SemiBold",
1634
+ "fontSize": 36,
1635
+ "letterSpacing": 1.5,
1636
+ "lineHeight": 44,
1637
+ },
1638
+ [
1639
+ {
1640
+ "marginBottom": 16,
1641
+ },
1642
+ undefined,
1643
+ ],
1644
+ ]
1645
+ }
1646
+ themeIntent="body"
1647
+ themeLevel="h1"
1648
+ themeTypeface="playful"
1649
+ >
1650
+ Test slide 5
1651
+ </Text>
1652
+ </View>
1653
+ </View>
1654
+ </View>
1655
+ </View>
1656
+ </RCTScrollView>
1657
+ <View
1658
+ style={
1659
+ [
1660
+ {
1661
+ "flexDirection": "row",
1662
+ "justifyContent": "space-between",
1663
+ "marginBottom": 24,
1664
+ "paddingHorizontal": 24,
1665
+ "paddingVertical": 16,
1666
+ },
1667
+ undefined,
1668
+ ]
1669
+ }
1670
+ >
1671
+ <View
1672
+ accessibilityState={
1673
+ {
1674
+ "disabled": false,
1675
+ }
1676
+ }
1677
+ accessibilityValue={
1678
+ {
1679
+ "max": undefined,
1680
+ "min": undefined,
1681
+ "now": undefined,
1682
+ "text": undefined,
1683
+ }
1684
+ }
1685
+ accessible={true}
1686
+ focusable={true}
1687
+ onClick={[Function]}
1688
+ onResponderGrant={[Function]}
1689
+ onResponderMove={[Function]}
1690
+ onResponderRelease={[Function]}
1691
+ onResponderTerminate={[Function]}
1692
+ onResponderTerminationRequest={[Function]}
1693
+ onStartShouldSetResponder={[Function]}
1694
+ style={
1695
+ [
1696
+ {
1697
+ "alignItems": "center",
1698
+ "alignSelf": "stretch",
1699
+ "backgroundColor": "#401960",
1700
+ "borderRadius": 32,
1701
+ "flexDirection": "row",
1702
+ "height": 60,
1703
+ "justifyContent": "center",
1704
+ "padding": 16,
1705
+ },
1706
+ undefined,
1707
+ ]
1708
+ }
1709
+ >
1710
+ <Text
1711
+ allowFontScaling={false}
1712
+ disabled={false}
1713
+ ellipsizeMode="tail"
1714
+ numberOfLines={1}
1715
+ style={
1716
+ [
1717
+ {
1718
+ "color": "#001f23",
1719
+ "fontFamily": "BeVietnamPro-SemiBold",
1720
+ "fontSize": 18,
1721
+ "letterSpacing": 0.24,
1722
+ "lineHeight": 28,
1723
+ },
1724
+ [
1725
+ {
1726
+ "color": "#ffffff",
1727
+ "flexShrink": 1,
1728
+ "textAlign": "center",
1729
+ },
1730
+ undefined,
1731
+ ],
1732
+ ]
1733
+ }
1734
+ themeButtonVariant="filled-primary"
1735
+ themeIntent="body"
1736
+ themeLevel="h5"
1737
+ themeTypeface="neutral"
1738
+ >
1739
+ Skip
1740
+ </Text>
1741
+ </View>
1742
+ </View>
1743
+ </View>
1744
+ </View>
1745
+ <View
1746
+ pointerEvents="box-none"
1747
+ position="bottom"
1748
+ style={
1749
+ [
1750
+ {
1751
+ "bottom": 0,
1752
+ "elevation": 9999,
1753
+ "flexDirection": "column-reverse",
1754
+ "left": 0,
1755
+ "paddingHorizontal": 24,
1756
+ "paddingVertical": 16,
1757
+ "position": "absolute",
1758
+ "right": 0,
1759
+ "top": 0,
1760
+ },
1761
+ undefined,
1762
+ ]
1763
+ }
1764
+ />
1765
+ </View>
1766
+ `;
1767
+
1768
+ exports[`Carousel should render correctly when image is undefined 1`] = `
1769
+ <View
1770
+ style={
1771
+ {
1772
+ "flex": 1,
1773
+ }
1774
+ }
1775
+ >
1776
+ <View
1777
+ testID="carousel"
1778
+ >
1779
+ <View
1780
+ style={
1781
+ [
1782
+ {
1783
+ "backgroundColor": "#ccd2d3",
1784
+ "bottom": 0,
1785
+ "left": 0,
1786
+ "position": "absolute",
1787
+ "right": 0,
1788
+ "top": 0,
1789
+ },
1790
+ undefined,
1791
+ ]
1792
+ }
1793
+ themeSlideBackground="#ccd2d3"
1794
+ />
1795
+ <View
1796
+ style={
1797
+ [
1798
+ {
1799
+ "alignItems": "center",
1800
+ "height": 48,
1801
+ "justifyContent": "center",
1802
+ },
1803
+ undefined,
1804
+ ]
1805
+ }
1806
+ />
1807
+ <View
1808
+ style={
1809
+ [
1810
+ {
1811
+ "flexGrow": 2,
1812
+ "justifyContent": "space-between",
1813
+ },
1814
+ undefined,
1815
+ ]
1816
+ }
1817
+ >
1818
+ <RCTScrollView
1819
+ bounces={false}
1820
+ data={
1821
+ [
1822
+ {
1823
+ "background": "#ccd2d3",
1824
+ "heading": "Test slide 5",
1825
+ },
1826
+ ]
1827
+ }
1828
+ getItem={[Function]}
1829
+ getItemCount={[Function]}
1830
+ getItemLayout={[Function]}
1831
+ horizontal={true}
1832
+ keyExtractor={[Function]}
1833
+ onContentSizeChange={[Function]}
1834
+ onLayout={[Function]}
1835
+ onMomentumScrollBegin={[Function]}
1836
+ onMomentumScrollEnd={[Function]}
1837
+ onScroll={[Function]}
1838
+ onScrollBeginDrag={[Function]}
1839
+ onScrollEndDrag={[Function]}
1840
+ onViewableItemsChanged={[Function]}
1841
+ pagingEnabled={true}
1842
+ removeClippedSubviews={false}
1843
+ renderItem={[Function]}
1844
+ scrollEventThrottle={32}
1845
+ showsHorizontalScrollIndicator={false}
1846
+ stickyHeaderIndices={[]}
1847
+ testID="carousel_flatlist"
1848
+ viewabilityConfig={
1849
+ {
1850
+ "viewAreaCoveragePercentThreshold": 50,
1851
+ }
1852
+ }
1853
+ viewabilityConfigCallbackPairs={
1854
+ [
1855
+ {
1856
+ "onViewableItemsChanged": [Function],
1857
+ "viewabilityConfig": {
1858
+ "viewAreaCoveragePercentThreshold": 50,
1859
+ },
1860
+ },
1861
+ ]
1862
+ }
1863
+ >
1864
+ <View>
1865
+ <View
1866
+ onFocusCapture={[Function]}
1867
+ style={
1868
+ [
1869
+ {
1870
+ "flexDirection": "row",
1871
+ },
1872
+ null,
1873
+ ]
1874
+ }
1875
+ >
1876
+ <View
1877
+ style={
1878
+ [
1879
+ {},
1880
+ {
1881
+ "width": 0,
1882
+ },
1883
+ ]
1884
+ }
1885
+ >
1886
+ <View
1887
+ paddingHorizontal="medium"
1888
+ style={
1889
+ [
1890
+ {
1891
+ "paddingHorizontal": 16,
1892
+ },
1893
+ [
1894
+ {
1895
+ "width": 0,
1896
+ },
1897
+ undefined,
1898
+ ],
1899
+ ]
1900
+ }
1901
+ width={0}
1902
+ >
1903
+ <Text
1904
+ allowFontScaling={false}
1905
+ style={
1906
+ [
1907
+ {
1908
+ "color": "#001f23",
1909
+ "fontFamily": "RebondGrotesque-SemiBold",
1910
+ "fontSize": 36,
1911
+ "letterSpacing": 1.5,
1912
+ "lineHeight": 44,
1913
+ },
1914
+ [
1915
+ {
1916
+ "marginBottom": 16,
1917
+ },
1918
+ undefined,
1919
+ ],
1920
+ ]
1921
+ }
1922
+ themeIntent="body"
1923
+ themeLevel="h1"
1924
+ themeTypeface="playful"
1925
+ >
1926
+ Test slide 5
1927
+ </Text>
1928
+ </View>
1929
+ </View>
1930
+ </View>
1485
1931
  </View>
1486
1932
  </RCTScrollView>
1487
1933
  <View
@@ -8,8 +8,9 @@ import Button from '../../Button/Button';
8
8
  import HeroDesignProvider from '../../HeroDesignProvider';
9
9
  import Image from '../../Image';
10
10
  import { getCardCarouselValidIndex } from '../CardCarousel';
11
+ import { CarouselData } from '../types';
11
12
 
12
- const carouselData = [
13
+ const carouselData: CarouselData[] = [
13
14
  {
14
15
  image: 1, // Test the case when we import .png files as React Native component, it's convert to ImageRequireSource type (which is a number).
15
16
  heading: 'Welcome to the new Employment Hero app',
@@ -43,6 +44,10 @@ const carouselData = [
43
44
  heading: 'Test slide 4',
44
45
  background: theme.colors.decorativePrimarySurface,
45
46
  },
47
+ {
48
+ heading: 'Test slide 5',
49
+ background: theme.colors.decorativePrimarySurface,
50
+ },
46
51
  ];
47
52
 
48
53
  describe('Carousel', () => {
@@ -180,6 +185,20 @@ describe('Carousel', () => {
180
185
 
181
186
  expect(queryByTestId('page-control-indicator1')).toBeFalsy();
182
187
  });
188
+ it('should render correctly when image is undefined', () => {
189
+ const onPress = jest.fn();
190
+ const { toJSON } = renderWithTheme(
191
+ <Carousel
192
+ testID="carousel"
193
+ items={[carouselData[4]]}
194
+ renderActions={(_) => {
195
+ return <Button text="Skip" onPress={onPress} />;
196
+ }}
197
+ />
198
+ );
199
+
200
+ expect(toJSON()).toMatchSnapshot();
201
+ });
183
202
  });
184
203
 
185
204
  // write test for getCardCarouselValidIndex
@@ -2,13 +2,13 @@ import { ReactNode } from 'react';
2
2
  import { ImageSourcePropType, ImageResizeMode } from 'react-native';
3
3
 
4
4
  export type CarouselImageProps = ImageSourcePropType & {
5
- height?: number;
6
- width?: number;
5
+ height?: number | `${number}%`;
6
+ width?: number | `${number}%`;
7
7
  resizeMode?: ImageResizeMode;
8
8
  };
9
9
 
10
10
  export type CarouselData = {
11
- image: CarouselImageProps | string;
11
+ image?: CarouselImageProps | string;
12
12
  content?: ReactNode;
13
13
  heading: string;
14
14
  body?: string;
@@ -156,21 +156,19 @@ const ScrollableTabHeader = ({
156
156
  100
157
157
  );
158
158
  }}
159
- style={
160
- // Border styles specified in contentContainerStyle don't work
161
- // so they need to be placed here instead on Android.
162
- Platform.OS === 'android'
163
- ? {
164
- borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
165
- borderBottomWidth: theme.__hd__.tabs.sizes.indicator,
166
- }
167
- : undefined
168
- }
169
- contentContainerStyle={{
170
- paddingHorizontal: theme.__hd__.tabs.space.flatListHorizontalPadding,
159
+ style={{
171
160
  borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
172
161
  borderBottomWidth: theme.__hd__.tabs.sizes.indicator,
173
162
  }}
163
+ contentContainerStyle={{
164
+ paddingHorizontal: theme.__hd__.tabs.space.flatListHorizontalPadding,
165
+
166
+ // Specify it here again or the indicator won't show
167
+ ...(Platform.OS === 'android' && {
168
+ borderBottomColor: theme.__hd__.tabs.colors.headerBottom,
169
+ borderBottomWidth: theme.__hd__.tabs.sizes.indicator,
170
+ }),
171
+ }}
174
172
  renderItem={({ item: tab, index }) => {
175
173
  const {
176
174
  key,
@@ -145,8 +145,6 @@ exports[`Tabs.Scroll lazy not render lazy screen: xxx 1`] = `
145
145
  <RCTScrollView
146
146
  contentContainerStyle={
147
147
  {
148
- "borderBottomColor": "#e8e9ea",
149
- "borderBottomWidth": 2,
150
148
  "paddingHorizontal": 8,
151
149
  }
152
150
  }
@@ -209,6 +207,12 @@ exports[`Tabs.Scroll lazy not render lazy screen: xxx 1`] = `
209
207
  scrollEventThrottle={50}
210
208
  showsHorizontalScrollIndicator={false}
211
209
  stickyHeaderIndices={[]}
210
+ style={
211
+ {
212
+ "borderBottomColor": "#e8e9ea",
213
+ "borderBottomWidth": 2,
214
+ }
215
+ }
212
216
  viewabilityConfigCallbackPairs={[]}
213
217
  >
214
218
  <View>
@@ -1061,8 +1065,6 @@ exports[`Tabs.Scroll renders correctly 1`] = `
1061
1065
  <RCTScrollView
1062
1066
  contentContainerStyle={
1063
1067
  {
1064
- "borderBottomColor": "#e8e9ea",
1065
- "borderBottomWidth": 2,
1066
1068
  "paddingHorizontal": 8,
1067
1069
  }
1068
1070
  }
@@ -1125,6 +1127,12 @@ exports[`Tabs.Scroll renders correctly 1`] = `
1125
1127
  scrollEventThrottle={50}
1126
1128
  showsHorizontalScrollIndicator={false}
1127
1129
  stickyHeaderIndices={[]}
1130
+ style={
1131
+ {
1132
+ "borderBottomColor": "#e8e9ea",
1133
+ "borderBottomWidth": 2,
1134
+ }
1135
+ }
1128
1136
  viewabilityConfigCallbackPairs={[]}
1129
1137
  >
1130
1138
  <View>
@@ -1977,8 +1985,6 @@ exports[`useIsFocused renders correctly 1`] = `
1977
1985
  <RCTScrollView
1978
1986
  contentContainerStyle={
1979
1987
  {
1980
- "borderBottomColor": "#e8e9ea",
1981
- "borderBottomWidth": 2,
1982
1988
  "paddingHorizontal": 8,
1983
1989
  }
1984
1990
  }
@@ -2041,6 +2047,12 @@ exports[`useIsFocused renders correctly 1`] = `
2041
2047
  scrollEventThrottle={50}
2042
2048
  showsHorizontalScrollIndicator={false}
2043
2049
  stickyHeaderIndices={[]}
2050
+ style={
2051
+ {
2052
+ "borderBottomColor": "#e8e9ea",
2053
+ "borderBottomWidth": 2,
2054
+ }
2055
+ }
2044
2056
  viewabilityConfigCallbackPairs={[]}
2045
2057
  >
2046
2058
  <View>
@@ -40,8 +40,6 @@ exports[`ScrollableTabsHeader highlighted variant renders correctly 1`] = `
40
40
  <RCTScrollView
41
41
  contentContainerStyle={
42
42
  {
43
- "borderBottomColor": "#e8e9ea",
44
- "borderBottomWidth": 2,
45
43
  "paddingHorizontal": 8,
46
44
  }
47
45
  }
@@ -104,6 +102,12 @@ exports[`ScrollableTabsHeader highlighted variant renders correctly 1`] = `
104
102
  scrollEventThrottle={50}
105
103
  showsHorizontalScrollIndicator={false}
106
104
  stickyHeaderIndices={[]}
105
+ style={
106
+ {
107
+ "borderBottomColor": "#e8e9ea",
108
+ "borderBottomWidth": 2,
109
+ }
110
+ }
107
111
  viewabilityConfigCallbackPairs={[]}
108
112
  >
109
113
  <View>
@@ -700,8 +704,6 @@ exports[`ScrollableTabsHeader underlined variant renders correctly 1`] = `
700
704
  <RCTScrollView
701
705
  contentContainerStyle={
702
706
  {
703
- "borderBottomColor": "#e8e9ea",
704
- "borderBottomWidth": 2,
705
707
  "paddingHorizontal": 8,
706
708
  }
707
709
  }
@@ -764,6 +766,12 @@ exports[`ScrollableTabsHeader underlined variant renders correctly 1`] = `
764
766
  scrollEventThrottle={50}
765
767
  showsHorizontalScrollIndicator={false}
766
768
  stickyHeaderIndices={[]}
769
+ style={
770
+ {
771
+ "borderBottomColor": "#e8e9ea",
772
+ "borderBottomWidth": 2,
773
+ }
774
+ }
767
775
  viewabilityConfigCallbackPairs={[]}
768
776
  >
769
777
  <View>
@@ -312,7 +312,6 @@ exports[`theme returns correct theme object 1`] = `
312
312
  "footerPaddingHorizontal": 24,
313
313
  "footerPaddingVertical": 16,
314
314
  "headingMarginBottom": 16,
315
- "headingMarginTop": 8,
316
315
  "pageControlPaddingVertical": 8,
317
316
  "pageControlWrapperHeight": 48,
318
317
  },
@@ -3,7 +3,6 @@ import type { GlobalTheme } from '../global';
3
3
 
4
4
  const getCarouselTheme = (theme: GlobalTheme) => {
5
5
  const space = {
6
- headingMarginTop: theme.space.small,
7
6
  headingMarginBottom: theme.space.medium,
8
7
  footerPaddingHorizontal: theme.space.large,
9
8
  footerPaddingVertical: theme.space.medium,
@@ -26,8 +26,8 @@ declare const StyledCustomSizeCarouselImage: import("@emotion/native").StyledCom
26
26
  theme?: import("@emotion/react").Theme | undefined;
27
27
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
28
28
  } & {
29
- height?: number | undefined;
30
- width?: number | undefined;
29
+ height?: number | `${number}%` | undefined;
30
+ width?: number | `${number}%` | undefined;
31
31
  resizeMode?: ImageResizeMode | undefined;
32
32
  }, {}, {}>;
33
33
  declare const StyledCarouselContentWrapper: import("@emotion/native").StyledComponent<import("../Box").BoxProps & {
@@ -1,12 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ImageSourcePropType, ImageResizeMode } from 'react-native';
3
3
  export declare type CarouselImageProps = ImageSourcePropType & {
4
- height?: number;
5
- width?: number;
4
+ height?: number | `${number}%`;
5
+ width?: number | `${number}%`;
6
6
  resizeMode?: ImageResizeMode;
7
7
  };
8
8
  export declare type CarouselData = {
9
- image: CarouselImageProps | string;
9
+ image?: CarouselImageProps | string;
10
10
  content?: ReactNode;
11
11
  heading: string;
12
12
  body?: string;
@@ -1,7 +1,6 @@
1
1
  import type { GlobalTheme } from '../global';
2
2
  declare const getCarouselTheme: (theme: GlobalTheme) => {
3
3
  space: {
4
- headingMarginTop: number;
5
4
  headingMarginBottom: number;
6
5
  footerPaddingHorizontal: number;
7
6
  footerPaddingVertical: number;