@telus-uds/components-base 3.2.0 → 3.3.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/lib/cjs/Card/CardBase.js +2 -1
  3. package/lib/cjs/Carousel/Carousel.js +202 -51
  4. package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +1 -15
  5. package/lib/cjs/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -6
  6. package/lib/cjs/ExpandCollapse/Control.js +3 -1
  7. package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +1 -1
  8. package/lib/cjs/List/ListItemBase.js +1 -2
  9. package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +2 -2
  10. package/lib/cjs/TextInput/TextArea.js +10 -1
  11. package/lib/cjs/Typography/Typography.js +8 -2
  12. package/lib/esm/Card/CardBase.js +2 -1
  13. package/lib/esm/Carousel/Carousel.js +203 -52
  14. package/lib/esm/Carousel/CarouselItem/CarouselItem.js +2 -16
  15. package/lib/esm/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -6
  16. package/lib/esm/ExpandCollapse/Control.js +3 -1
  17. package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +1 -1
  18. package/lib/esm/List/ListItemBase.js +1 -2
  19. package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +2 -2
  20. package/lib/esm/TextInput/TextArea.js +10 -1
  21. package/lib/esm/Typography/Typography.js +8 -2
  22. package/lib/package.json +1 -1
  23. package/package.json +1 -1
  24. package/src/Card/CardBase.jsx +2 -1
  25. package/src/Carousel/Carousel.jsx +200 -55
  26. package/src/Carousel/CarouselItem/CarouselItem.jsx +1 -7
  27. package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +5 -4
  28. package/src/ExpandCollapse/Control.jsx +3 -1
  29. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +1 -1
  30. package/src/List/ListItemBase.jsx +1 -2
  31. package/src/MultiSelectFilter/MultiSelectFilter.jsx +1 -1
  32. package/src/TextInput/TextArea.jsx +11 -1
  33. package/src/Typography/Typography.jsx +8 -2
@@ -129,8 +129,7 @@ const staticStyles = StyleSheet.create({
129
129
  titleAndContentContainer: {
130
130
  flexDirection: 'column',
131
131
  flexShrink: 1,
132
- flexGrow: 1,
133
- textAlign: 'justify'
132
+ flexGrow: 1
134
133
  }
135
134
  });
136
135
  ListItemBase.propTypes = {
@@ -286,9 +286,9 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
286
286
  },
287
287
  children: subtitle
288
288
  })
289
- }), /*#__PURE__*/_jsx(Spacer, {
290
- space: 4
291
289
  })]
290
+ }), /*#__PURE__*/_jsx(Spacer, {
291
+ space: 4
292
292
  }), /*#__PURE__*/_jsx(View, {
293
293
  style: styles.options,
294
294
  children: /*#__PURE__*/_jsx(ScrollView, {
@@ -40,6 +40,7 @@ const TextArea = /*#__PURE__*/React.forwardRef((_ref, ref) => {
40
40
  } = _ref;
41
41
  const themeTokens = useThemeTokens('TextArea', tokens, variant);
42
42
  const [inputHeight, setInputHeight] = React.useState();
43
+ const isUpdatingHeight = React.useRef(false);
43
44
 
44
45
  // adjust the text area's height as new lines are added to the content
45
46
  const onHeightChange = _ref2 => {
@@ -51,8 +52,16 @@ const TextArea = /*#__PURE__*/React.forwardRef((_ref, ref) => {
51
52
  }
52
53
  } = _ref2;
53
54
  // on native this is happens out of the box
54
- if (Platform.OS === 'web') {
55
+ if (Platform.OS === 'web' && !isUpdatingHeight.current) {
56
+ isUpdatingHeight.current = true;
55
57
  setInputHeight(height);
58
+ // setTimeout is used to “wait” for the next update cycle before allowing a new height adjustment,
59
+ // avoiding multiple updates in the same render and preventing a possible infinite loop or constant re-renders.
60
+ setTimeout(() => {
61
+ isUpdatingHeight.current = false;
62
+ }, 0);
63
+ } else {
64
+ setInputHeight(null);
56
65
  }
57
66
  };
58
67
  const {
@@ -112,13 +112,19 @@ const Typography = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
112
112
  backgroundClip: 'text'
113
113
  } : styles;
114
114
  };
115
+
116
+ /**
117
+ * Added to maintain previous behavior, as the 'auto' value for the 'align' prop now defaults to 'inherit' on the web,
118
+ * maintaining the previous behavior that was changed in the Text component of react-native.
119
+ */
120
+ const resolvedAlign = Platform.OS === 'web' && align === 'auto' ? 'inherit' : align;
115
121
  let textStyles;
116
122
  let mediaIds;
117
123
  if (enableMediaQueryStyleSheet) {
118
124
  const transformedThemeTokens = Object.entries(themeTokens).reduce((acc, _ref4) => {
119
125
  let [vp, viewportTokens] = _ref4;
120
126
  acc[vp] = selectTextStyles({
121
- textAlign: align,
127
+ textAlign: resolvedAlign,
122
128
  textDecorationLine,
123
129
  ...viewportTokens
124
130
  }, themeOptions);
@@ -147,7 +153,7 @@ const Typography = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
147
153
  mediaIds = ids.text;
148
154
  } else {
149
155
  textStyles = selectTextStyles({
150
- textAlign: align,
156
+ textAlign: resolvedAlign,
151
157
  textDecorationLine,
152
158
  ...themeTokens
153
159
  }, themeOptions);
package/lib/package.json CHANGED
@@ -83,6 +83,6 @@
83
83
  "standard-engine": {
84
84
  "skip": true
85
85
  },
86
- "version": "3.2.0",
86
+ "version": "3.3.0",
87
87
  "types": "types/index.d.ts"
88
88
  }
package/package.json CHANGED
@@ -83,6 +83,6 @@
83
83
  "standard-engine": {
84
84
  "skip": true
85
85
  },
86
- "version": "3.2.0",
86
+ "version": "3.3.0",
87
87
  "types": "types/index.d.ts"
88
88
  }
@@ -72,11 +72,12 @@ const CardBase = React.forwardRef(
72
72
  <View style={cardStyle} dataSet={dataSet} ref={ref} {...props}>
73
73
  {src ? (
74
74
  <ImageBackground
75
- alt={alt}
76
75
  source={imageSourceViewport}
77
76
  imageStyle={{ borderRadius: cardStyle?.borderRadius - cardStyle?.borderWidth }}
78
77
  resizeMode={backgroundImageResizeMode}
79
78
  style={styles.imageBackground}
79
+ accessible={true}
80
+ accessibilityLabel={alt}
80
81
  >
81
82
  {children}
82
83
  </ImageBackground>
@@ -25,11 +25,11 @@ import CarouselThumbnailNavigation from './CarouselThumbnailNavigation'
25
25
  import CarouselTabsPanel from './CarouselTabs/CarouselTabsPanel'
26
26
  import CarouselTabsPanelItem from './CarouselTabs/CarouselTabsPanelItem'
27
27
  import dictionary from './dictionary'
28
+ import Box from '../Box'
28
29
  import {
29
30
  ITEMS_PER_VIEWPORT_MD,
30
31
  ITEMS_PER_VIEWPORT_LG_XL,
31
32
  DEFAULT_POSITION_OFFSET,
32
- HERO_POSITION_OFFSET,
33
33
  LARGE_VIEWPORT_MARGIN,
34
34
  DEFAULT_VIEWPORT_MARGIN
35
35
  } from './Constants'
@@ -54,6 +54,24 @@ const staticStyles = StyleSheet.create({
54
54
  zIndex: 1,
55
55
  right: Platform.OS === 'web' ? undefined : 40,
56
56
  top: 40
57
+ },
58
+ heroMainContainer: {
59
+ position: 'absolute',
60
+ top: 0,
61
+ left: 0,
62
+ right: 0,
63
+ bottom: 0,
64
+ overflow: 'hidden',
65
+ zIndex: -1
66
+ },
67
+ heroSwipeArea: {
68
+ position: 'absolute',
69
+ top: 0,
70
+ left: 0,
71
+ right: 0,
72
+ bottom: 0,
73
+ zIndex: -1,
74
+ flexDirection: 'row'
57
75
  }
58
76
  })
59
77
 
@@ -75,6 +93,11 @@ const selectSwipeAreaStyles = (
75
93
  flexDirection: 'row'
76
94
  })
77
95
 
96
+ const selectHeroContainerStyles = (width, hidden) => ({
97
+ width,
98
+ visibility: hidden ? 'hidden' : 'visible'
99
+ })
100
+
78
101
  const getDynamicPositionProperty = (areStylesAppliedOnPreviousButton) =>
79
102
  areStylesAppliedOnPreviousButton ? 'left' : 'right'
80
103
 
@@ -84,19 +107,13 @@ const selectControlButtonPositionStyles = ({
84
107
  positionProperty = getDynamicPositionProperty(),
85
108
  spaceBetweenSlideAndButton,
86
109
  enablePeeking,
87
- enableDisplayMultipleItemsPerSlide,
88
- enableHero,
89
- viewport
110
+ enableDisplayMultipleItemsPerSlide
90
111
  }) => {
91
112
  const styles = {}
92
113
  if (positionVariant === 'edge') {
93
114
  styles[positionProperty] = -1 * (buttonWidth / 2)
94
115
  } else if (positionVariant === 'inside') {
95
- if (enableHero && viewport === 'xl') {
96
- styles[positionProperty] = HERO_POSITION_OFFSET
97
- } else {
98
- styles[positionProperty] = DEFAULT_POSITION_OFFSET
99
- }
116
+ styles[positionProperty] = DEFAULT_POSITION_OFFSET
100
117
  } else if (positionVariant === 'outside') {
101
118
  if (enablePeeking || enableDisplayMultipleItemsPerSlide) {
102
119
  styles[positionProperty] = 0
@@ -115,9 +132,7 @@ const selectPreviousNextNavigationButtonStyles = (
115
132
  isLastSlide,
116
133
  areStylesAppliedOnPreviousButton,
117
134
  enablePeeking,
118
- enableDisplayMultipleItemsPerSlide,
119
- enableHero,
120
- viewport
135
+ enableDisplayMultipleItemsPerSlide
121
136
  ) => {
122
137
  const styles = {
123
138
  zIndex: 1,
@@ -139,9 +154,7 @@ const selectPreviousNextNavigationButtonStyles = (
139
154
  positionProperty: getDynamicPositionProperty(areStylesAppliedOnPreviousButton),
140
155
  spaceBetweenSlideAndButton: spaceBetweenSlideAndPreviousNextNavigation,
141
156
  enablePeeking,
142
- enableDisplayMultipleItemsPerSlide,
143
- enableHero,
144
- viewport
157
+ enableDisplayMultipleItemsPerSlide
145
158
  })
146
159
  }
147
160
  }
@@ -204,17 +217,14 @@ const selectMainContainerStyles = (enableHero, viewport) => {
204
217
  return {}
205
218
  }
206
219
 
207
- const selectNavigationStyles = (tabs, tabsPanelHeight, enableHero, viewport) => {
208
- let marginTop = 0
220
+ const selectNavigationStyles = (tabs, enableHero, viewport) => {
209
221
  let marginHorizontal = 0
210
222
 
211
223
  if (enableHero && tabs) {
212
- marginTop = -tabsPanelHeight
213
224
  marginHorizontal = viewport === 'xl' ? LARGE_VIEWPORT_MARGIN : DEFAULT_VIEWPORT_MARGIN
214
225
  }
215
226
 
216
227
  return {
217
- marginTop,
218
228
  marginHorizontal
219
229
  }
220
230
  }
@@ -350,6 +360,7 @@ const Carousel = React.forwardRef(
350
360
  itemLabel = 'item',
351
361
  previousNextNavigationPosition = 'inside',
352
362
  stepTrackerVariant,
363
+ progressBarVariant = { style: 'subtle' },
353
364
  previousNextIconSize = 'default',
354
365
  minDistanceToCapture = 5,
355
366
  minDistanceForAction = 0.2,
@@ -368,7 +379,8 @@ const Carousel = React.forwardRef(
368
379
  <CarouselThumbnailNavigation thumbnails={thumbnails} />
369
380
  ) : (
370
381
  <CarouselStepTracker
371
- variant={stepTrackerVariant}
382
+ stepTrackerVariant={stepTrackerVariant}
383
+ progressBarVariant={progressBarVariant}
372
384
  enableDisplayMultipleItemsPerSlide={enableDisplayMultipleItemsPerSlide}
373
385
  />
374
386
  ),
@@ -420,6 +432,13 @@ const Carousel = React.forwardRef(
420
432
  height: 0
421
433
  })
422
434
  const containerLayoutRef = React.useRef(containerLayout)
435
+ const [heroContainerLayout, setHeroContainerLayout] = React.useState({
436
+ x: 0,
437
+ y: 0,
438
+ width: 0,
439
+ height: 0
440
+ })
441
+ const heroContainerLayoutRef = React.useRef(heroContainerLayout)
423
442
 
424
443
  const [previousNextNavigationButtonWidth, setPreviousNextNavigationButtonWidth] =
425
444
  React.useState(0)
@@ -427,6 +446,9 @@ const Carousel = React.forwardRef(
427
446
  const pan = React.useRef(new Animated.ValueXY()).current
428
447
  const animatedX = React.useRef(0)
429
448
  const animatedY = React.useRef(0)
449
+ const heroPan = React.useRef(new Animated.ValueXY()).current
450
+ const heroAnimatedX = React.useRef(0)
451
+ const heroAnimatedY = React.useRef(0)
430
452
  const [isAnimating, setIsAnimating] = React.useState(false)
431
453
  /**
432
454
  * While having the same starting point, `isAutoPlayEnabled` and `isCarouselPlaying` are different states
@@ -465,31 +487,40 @@ const Carousel = React.forwardRef(
465
487
  y: animatedY.current
466
488
  })
467
489
  pan.setValue({ x: 0, y: 0 })
468
- }, [pan, animatedX])
490
+ if (enableHero) {
491
+ heroAnimatedX.current = heroContainerLayoutRef.current.width * activeIndexRef.current * -1
492
+ heroAnimatedY.current = 0
493
+ heroPan.setOffset({
494
+ x: heroAnimatedX.current,
495
+ y: heroAnimatedY.current
496
+ })
497
+ heroPan.setValue({ x: 0, y: 0 })
498
+ }
499
+ }, [pan, animatedX, heroPan, heroAnimatedX, enableHero])
469
500
 
470
501
  const animate = React.useCallback(
471
- (toValue, toIndex) => {
502
+ (panToAnimate, toValue, toIndex) => {
472
503
  const handleAnimationEndToIndex = (...args) => handleAnimationEnd(toIndex, ...args)
473
504
  if (reduceMotionRef.current || isSwiping.current) {
474
- Animated.timing(pan, { toValue, duration: 1, useNativeDriver: false }).start(
505
+ Animated.timing(panToAnimate, { toValue, duration: 1, useNativeDriver: false }).start(
475
506
  handleAnimationEndToIndex
476
507
  )
477
508
  } else if (isAutoPlayEnabled) {
478
- Animated.timing(pan, {
509
+ Animated.timing(panToAnimate, {
479
510
  ...springConfig,
480
511
  toValue,
481
512
  useNativeDriver: false,
482
513
  duration: transitionDuration * 1000
483
514
  }).start(handleAnimationEndToIndex)
484
515
  } else if (enablePeeking || enableDisplayMultipleItemsPerSlide) {
485
- Animated.timing(pan, {
516
+ Animated.timing(panToAnimate, {
486
517
  ...springConfig,
487
518
  toValue,
488
519
  useNativeDriver: false,
489
520
  duration: transitionDuration ? transitionDuration * 1000 : 1000
490
521
  }).start(handleAnimationEndToIndex)
491
522
  } else {
492
- Animated.spring(pan, {
523
+ Animated.spring(panToAnimate, {
493
524
  ...springConfig,
494
525
  toValue,
495
526
  useNativeDriver: false
@@ -497,7 +528,6 @@ const Carousel = React.forwardRef(
497
528
  }
498
529
  },
499
530
  [
500
- pan,
501
531
  springConfig,
502
532
  handleAnimationEnd,
503
533
  transitionDuration,
@@ -534,7 +564,10 @@ const Carousel = React.forwardRef(
534
564
 
535
565
  const index = activeIndexRef.current + calcDelta
536
566
  if (skipChanges) {
537
- animate(toValue, index)
567
+ animate(pan, toValue, index)
568
+ if (enableHero) {
569
+ animate(heroPan, toValue, index)
570
+ }
538
571
  return calcDelta
539
572
  }
540
573
 
@@ -551,7 +584,12 @@ const Carousel = React.forwardRef(
551
584
  )
552
585
 
553
586
  toValue.x = finalWidth * -1 * calcDelta
554
- animate(toValue, index)
587
+ const heroToValue = { x: 0, y: 0 }
588
+ heroToValue.x = heroContainerLayoutRef.current.width * -1 * calcDelta
589
+ animate(pan, toValue, index)
590
+ if (enableHero) {
591
+ animate(heroPan, heroToValue, index)
592
+ }
555
593
  if (isCarouselPlaying) {
556
594
  stopAutoplay()
557
595
  if (
@@ -584,7 +622,10 @@ const Carousel = React.forwardRef(
584
622
  stopAutoplay,
585
623
  isAutoPlayEnabled,
586
624
  viewport,
587
- enablePeeking
625
+ enablePeeking,
626
+ pan,
627
+ heroPan,
628
+ enableHero
588
629
  ]
589
630
  )
590
631
 
@@ -625,8 +666,6 @@ const Carousel = React.forwardRef(
625
666
  [fixOffsetAndGo]
626
667
  )
627
668
 
628
- const [tabsPanelHeight, setTabsPanelHeight] = React.useState(0)
629
-
630
669
  React.useEffect(() => {
631
670
  activeIndexRef.current = activeIndex
632
671
  }, [activeIndex])
@@ -639,6 +678,10 @@ const Carousel = React.forwardRef(
639
678
  containerLayoutRef.current = containerLayout
640
679
  }, [containerLayout])
641
680
 
681
+ React.useEffect(() => {
682
+ heroContainerLayoutRef.current = heroContainerLayout
683
+ }, [heroContainerLayout])
684
+
642
685
  React.useEffect(() => {
643
686
  pan.x.addListener(({ value }) => {
644
687
  animatedX.current = value
@@ -646,6 +689,14 @@ const Carousel = React.forwardRef(
646
689
  pan.y.addListener(({ value }) => {
647
690
  animatedY.current = value
648
691
  })
692
+ if (enableHero) {
693
+ heroPan.x.addListener(({ value }) => {
694
+ heroAnimatedX.current = value
695
+ })
696
+ heroPan.y.addListener(({ value }) => {
697
+ heroAnimatedY.current = value
698
+ })
699
+ }
649
700
  if (isCarouselPlaying) {
650
701
  startAutoplay()
651
702
  }
@@ -653,8 +704,21 @@ const Carousel = React.forwardRef(
653
704
  stopAutoplay()
654
705
  pan.x.removeAllListeners()
655
706
  pan.y.removeAllListeners()
707
+ if (enableHero) {
708
+ heroPan.x.removeAllListeners()
709
+ heroPan.y.removeAllListeners()
710
+ }
656
711
  }
657
- }, [pan.x, pan.y, startAutoplay, stopAutoplay, isCarouselPlaying])
712
+ }, [
713
+ pan.x,
714
+ pan.y,
715
+ heroPan.x,
716
+ heroPan.y,
717
+ startAutoplay,
718
+ stopAutoplay,
719
+ isCarouselPlaying,
720
+ enableHero
721
+ ])
658
722
 
659
723
  React.useEffect(() => {
660
724
  const subscription = Dimensions.addEventListener('change', () => {
@@ -682,16 +746,18 @@ const Carousel = React.forwardRef(
682
746
  }
683
747
  }, [stopAutoplay])
684
748
 
685
- const onTabsPanelLayout = (event) => {
686
- setTabsPanelHeight(event.nativeEvent.layout.height)
687
- }
688
-
689
749
  const onContainerLayout = ({
690
750
  nativeEvent: {
691
751
  layout: { x, y, width, height }
692
752
  }
693
753
  }) => setContainerLayout((prevState) => ({ ...prevState, x, y, width, height }))
694
754
 
755
+ const onHeroContainerLayout = ({
756
+ nativeEvent: {
757
+ layout: { x, y, width, height }
758
+ }
759
+ }) => setHeroContainerLayout((prevState) => ({ ...prevState, x, y, width, height }))
760
+
695
761
  const onPreviousNextNavigationButtonLayout = ({
696
762
  nativeEvent: {
697
763
  layout: { width }
@@ -742,7 +808,7 @@ const Carousel = React.forwardRef(
742
808
  const correction = gesture.moveX - gesture.x0
743
809
 
744
810
  if (Math.abs(correction) < containerLayoutRef.current.width * minDistanceForAction) {
745
- animate({ x: 0, y: 0 }, 0)
811
+ animate(pan, { x: 0, y: 0 }, 0)
746
812
  } else {
747
813
  const delta = correction > 0 ? -1 : 1
748
814
  updateIndex(delta, TRANSITION_MODES.SWIPE)
@@ -752,6 +818,65 @@ const Carousel = React.forwardRef(
752
818
  }
753
819
  }),
754
820
  [
821
+ pan,
822
+ updateIndex,
823
+ updateOffset,
824
+ animate,
825
+ isSwipeAllowed,
826
+ minDistanceForAction,
827
+ handleAnimationStart,
828
+ minDistanceToCapture,
829
+ startAutoplay,
830
+ stopAutoplay,
831
+ isCarouselPlaying
832
+ ]
833
+ )
834
+
835
+ const heroPanResponder = React.useMemo(
836
+ () =>
837
+ PanResponder.create({
838
+ onPanResponderTerminationRequest: () => false,
839
+ onMoveShouldSetResponderCapture: () => true,
840
+ onMoveShouldSetPanResponderCapture: (_, gestureState) => {
841
+ if (!isSwipeAllowed()) {
842
+ return false
843
+ }
844
+
845
+ handleAnimationStart(activeIndexRef.current)
846
+
847
+ const allow = Math.abs(gestureState.dx) > minDistanceToCapture
848
+
849
+ if (allow) {
850
+ isSwiping.current = true
851
+ stopAutoplay()
852
+ }
853
+
854
+ return allow
855
+ },
856
+ onPanResponderGrant: () => {
857
+ updateOffset()
858
+ },
859
+ onPanResponderMove: Animated.event([null, { dx: heroPan.x }], {
860
+ useNativeDriver: false
861
+ }),
862
+ onPanResponderRelease: (_, gesture) => {
863
+ if (isCarouselPlaying) {
864
+ startAutoplay()
865
+ }
866
+ const correction = gesture.moveX - gesture.x0
867
+
868
+ if (Math.abs(correction) < containerLayoutRef.current.width * minDistanceForAction) {
869
+ animate(heroPan, { x: 0, y: 0 }, 0)
870
+ } else {
871
+ const delta = correction > 0 ? -1 : 1
872
+ updateIndex(delta, TRANSITION_MODES.SWIPE)
873
+ }
874
+
875
+ isSwiping.current = false
876
+ }
877
+ }),
878
+ [
879
+ heroPan,
755
880
  updateIndex,
756
881
  updateOffset,
757
882
  animate,
@@ -759,7 +884,6 @@ const Carousel = React.forwardRef(
759
884
  minDistanceForAction,
760
885
  handleAnimationStart,
761
886
  minDistanceToCapture,
762
- pan.x,
763
887
  startAutoplay,
764
888
  stopAutoplay,
765
889
  isCarouselPlaying
@@ -888,9 +1012,7 @@ const Carousel = React.forwardRef(
888
1012
  positionProperty: getDynamicPositionProperty(),
889
1013
  spaceBetweenSlideAndButton: spaceBetweenSlideAndPreviousNextNavigation,
890
1014
  enablePeeking,
891
- enableDisplayMultipleItemsPerSlide,
892
- enableHero,
893
- viewport
1015
+ enableDisplayMultipleItemsPerSlide
894
1016
  })
895
1017
  ]}
896
1018
  >
@@ -914,9 +1036,7 @@ const Carousel = React.forwardRef(
914
1036
  isLastSlide,
915
1037
  true,
916
1038
  enablePeeking,
917
- enableDisplayMultipleItemsPerSlide,
918
- enableHero,
919
- viewport
1039
+ enableDisplayMultipleItemsPerSlide
920
1040
  )}
921
1041
  testID="previous-button-container"
922
1042
  >
@@ -974,9 +1094,7 @@ const Carousel = React.forwardRef(
974
1094
  peekingProps: getPeekingProps(viewport),
975
1095
  enableDisplayMultipleItemsPerSlide,
976
1096
  viewport,
977
- backgroundColor: element.props.backgroundColor,
978
- enableHero,
979
- tabsPanelHeight
1097
+ backgroundColor: element.props.backgroundColor
980
1098
  })
981
1099
  return <React.Fragment key={index.toFixed(2)}>{clonedElement}</React.Fragment>
982
1100
  })}
@@ -992,9 +1110,7 @@ const Carousel = React.forwardRef(
992
1110
  isLastSlide,
993
1111
  false,
994
1112
  enablePeeking,
995
- enableDisplayMultipleItemsPerSlide,
996
- enableHero,
997
- viewport
1113
+ enableDisplayMultipleItemsPerSlide
998
1114
  )}
999
1115
  testID="next-button-container"
1000
1116
  >
@@ -1012,14 +1128,39 @@ const Carousel = React.forwardRef(
1012
1128
  </View>
1013
1129
  ) : null}
1014
1130
  </View>
1015
- <View
1016
- style={selectNavigationStyles(tabs, tabsPanelHeight, enableHero, viewport)}
1017
- onLayout={tabs && onTabsPanelLayout}
1018
- >
1131
+ <View style={selectNavigationStyles(tabs, enableHero, viewport)}>
1019
1132
  {showPanelNavigation ? activePanelNavigation : null}
1020
1133
  </View>
1021
1134
  </CarouselProvider>
1022
1135
  </View>
1136
+ {enableHero && (
1137
+ <View style={staticStyles.heroMainContainer}>
1138
+ <Animated.View
1139
+ style={StyleSheet.flatten([
1140
+ staticStyles.heroSwipeArea,
1141
+ {
1142
+ transform: [{ translateX: heroPan.x }, { translateY: heroPan.y }]
1143
+ }
1144
+ ])}
1145
+ onLayout={onHeroContainerLayout}
1146
+ {...heroPanResponder.panHandlers}
1147
+ {...getA11yPropsFromHtmlTag(tag)}
1148
+ accessibilityLiveRegion={accessibilityLiveRegion}
1149
+ >
1150
+ {childrenArray.map((element, index) => {
1151
+ const hidden = !isAnimating && index !== activeIndex
1152
+ return (
1153
+ <View
1154
+ style={selectHeroContainerStyles(heroContainerLayout.width, hidden)}
1155
+ key={index.toFixed(2)}
1156
+ >
1157
+ <Box flex={1} variant={{ background: element.props.backgroundColor }} />
1158
+ </View>
1159
+ )
1160
+ })}
1161
+ </Animated.View>
1162
+ </View>
1163
+ )}
1023
1164
  </View>
1024
1165
  )
1025
1166
  }
@@ -1033,6 +1174,10 @@ Carousel.propTypes = {
1033
1174
  * Prop related to StepTracker Variants
1034
1175
  */
1035
1176
  stepTrackerVariant: variantProp.propType,
1177
+ /**
1178
+ * Prop related to ProgressBar Variants
1179
+ */
1180
+ progressBarVariant: variantProp.propType,
1036
1181
  /**
1037
1182
  * Slides to render in Carousel. Wrap individual slides in `Carousel.Item`
1038
1183
  */
@@ -11,7 +11,6 @@ import {
11
11
  } from '../../utils'
12
12
  import { useCarousel } from '../CarouselContext'
13
13
  import { ITEMS_PER_VIEWPORT_MD, ITEMS_PER_VIEWPORT_LG_XL, GAP_BETWEEN_ITEMS } from '../Constants'
14
- import Box from '../../Box'
15
14
 
16
15
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
17
16
 
@@ -101,8 +100,6 @@ const CarouselItem = React.forwardRef(
101
100
  enableDisplayMultipleItemsPerSlide,
102
101
  viewport,
103
102
  backgroundColor,
104
- enableHero,
105
- tabsPanelHeight,
106
103
  ...rest
107
104
  },
108
105
  ref
@@ -131,10 +128,7 @@ const CarouselItem = React.forwardRef(
131
128
  {...focusabilityProps}
132
129
  ref={ref}
133
130
  >
134
- <Box variant={{ background: backgroundColor }} space={0} flex={1}>
135
- {children}
136
- {enableHero && <View style={{ height: tabsPanelHeight }} />}
137
- </Box>
131
+ {children}
138
132
  </View>
139
133
  )
140
134
  }
@@ -9,7 +9,7 @@ import Progress from '../../Progress'
9
9
  import { variantProp } from '../../utils'
10
10
 
11
11
  const CarouselStepTracker = React.forwardRef(
12
- ({ variant, enableDisplayMultipleItemsPerSlide }, ref) => {
12
+ ({ stepTrackerVariant, progressBarVariant, enableDisplayMultipleItemsPerSlide }, ref) => {
13
13
  const {
14
14
  activeIndex,
15
15
  totalItems,
@@ -47,7 +47,7 @@ const CarouselStepTracker = React.forwardRef(
47
47
  items: totalItems,
48
48
  current: activeIndex + 1
49
49
  }}
50
- variant={{ style: 'subtle' }}
50
+ variant={progressBarVariant}
51
51
  accessibilityLabel={getCopyWithPlaceholders('stepTrackerLabel')}
52
52
  />
53
53
  </Progress>
@@ -66,7 +66,7 @@ const CarouselStepTracker = React.forwardRef(
66
66
  stepTrackerLabel: getCopyWithPlaceholders('stepTrackerLabel')
67
67
  }}
68
68
  tokens={stepTrackerTokens}
69
- variant={variant}
69
+ variant={stepTrackerVariant}
70
70
  />
71
71
  </StackView>
72
72
  )
@@ -76,7 +76,8 @@ const CarouselStepTracker = React.forwardRef(
76
76
  CarouselStepTracker.displayName = 'CarouselStepTracker'
77
77
 
78
78
  CarouselStepTracker.propTypes = {
79
- variant: variantProp.propType,
79
+ stepTrackerVariant: variantProp.propType,
80
+ progressBarVariant: variantProp.propType,
80
81
  enableDisplayMultipleItemsPerSlide: PropTypes.bool
81
82
  }
82
83
 
@@ -39,7 +39,9 @@ function selectContainerStyles({
39
39
  borderBottomRightRadius,
40
40
  borderTopLeftRadius,
41
41
  borderBottomLeftRadius,
42
- ...verticalAlignRow(verticalAlign, iconPosition === 'right')
42
+ ...verticalAlignRow(verticalAlign, iconPosition === 'right'),
43
+ // Updated default alignment due to the change in Pressable's behavior from div to button on web.
44
+ textAlign: Platform.OS === 'web' ? 'inherit' : undefined
43
45
  }
44
46
  }
45
47