@telus-uds/components-base 3.1.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.
- package/CHANGELOG.md +35 -2
- package/lib/cjs/Card/CardBase.js +2 -1
- package/lib/cjs/Carousel/Carousel.js +202 -51
- package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +1 -15
- package/lib/cjs/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -6
- package/lib/cjs/ExpandCollapse/Control.js +3 -1
- package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +1 -1
- package/lib/cjs/List/ListItemBase.js +1 -2
- package/lib/cjs/List/ListItemMark.js +6 -2
- package/lib/cjs/Modal/ModalContent.js +1 -1
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib/cjs/Notification/Notification.js +15 -25
- package/lib/cjs/TextInput/TextArea.js +10 -1
- package/lib/cjs/Typography/Typography.js +9 -3
- package/lib/esm/Card/CardBase.js +2 -1
- package/lib/esm/Carousel/Carousel.js +203 -52
- package/lib/esm/Carousel/CarouselItem/CarouselItem.js +2 -16
- package/lib/esm/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -6
- package/lib/esm/ExpandCollapse/Control.js +3 -1
- package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +1 -1
- package/lib/esm/List/ListItemBase.js +1 -2
- package/lib/esm/List/ListItemMark.js +6 -2
- package/lib/esm/Modal/ModalContent.js +1 -1
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib/esm/Notification/Notification.js +16 -26
- package/lib/esm/TextInput/TextArea.js +10 -1
- package/lib/esm/Typography/Typography.js +9 -3
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Card/CardBase.jsx +2 -1
- package/src/Carousel/Carousel.jsx +200 -55
- package/src/Carousel/CarouselItem/CarouselItem.jsx +1 -7
- package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +5 -4
- package/src/ExpandCollapse/Control.jsx +3 -1
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +1 -1
- package/src/List/ListItemBase.jsx +1 -2
- package/src/List/ListItemMark.jsx +9 -3
- package/src/Modal/ModalContent.jsx +1 -1
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +1 -1
- package/src/Notification/Notification.jsx +14 -17
- package/src/TextInput/TextArea.jsx +11 -1
- package/src/Typography/Typography.jsx +9 -3
|
@@ -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
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
505
|
+
Animated.timing(panToAnimate, { toValue, duration: 1, useNativeDriver: false }).start(
|
|
475
506
|
handleAnimationEndToIndex
|
|
476
507
|
)
|
|
477
508
|
} else if (isAutoPlayEnabled) {
|
|
478
|
-
Animated.timing(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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
|
-
}, [
|
|
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
|
-
|
|
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
|
-
({
|
|
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={
|
|
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={
|
|
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
|
-
|
|
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
|
|
|
@@ -29,7 +29,7 @@ const ExpandCollapseMini = React.forwardRef(
|
|
|
29
29
|
// Remove unwanted look and feel from ExpandCollapse(background pressed, focus border and text underline)
|
|
30
30
|
icon: null,
|
|
31
31
|
borderColor: 'transparent',
|
|
32
|
-
textLine: 'none',
|
|
32
|
+
textLine: tokens.textLine ?? 'none',
|
|
33
33
|
backgroundColor: 'transparent'
|
|
34
34
|
}}
|
|
35
35
|
// TODO refactor
|
|
@@ -27,8 +27,13 @@ const selectBulletPositioningStyles = ({ itemIconSize }) => ({
|
|
|
27
27
|
height: itemIconSize
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
-
const selectBulletContainerStyles = ({
|
|
30
|
+
const selectBulletContainerStyles = ({
|
|
31
|
+
itemBulletContainerWidth,
|
|
32
|
+
itemBulletContainerHeight,
|
|
33
|
+
itemBulletContainerAlign
|
|
34
|
+
}) => ({
|
|
31
35
|
width: itemBulletContainerWidth,
|
|
36
|
+
height: itemBulletContainerHeight,
|
|
32
37
|
alignItems: itemBulletContainerAlign
|
|
33
38
|
})
|
|
34
39
|
|
|
@@ -45,11 +50,12 @@ const ListItemMark = React.forwardRef(({ icon, iconColor, iconSize, tokens = {}
|
|
|
45
50
|
const themeTokens = typeof tokens === 'function' ? tokens() : tokens
|
|
46
51
|
|
|
47
52
|
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens)
|
|
53
|
+
const bulletContainerStyles = selectBulletContainerStyles(themeTokens)
|
|
48
54
|
|
|
49
55
|
if (icon) {
|
|
50
56
|
const iconTokens = selectItemIconTokens(themeTokens)
|
|
51
57
|
return (
|
|
52
|
-
<View style={sideItemContainerStyles}>
|
|
58
|
+
<View style={[sideItemContainerStyles, bulletContainerStyles]}>
|
|
53
59
|
<IconComponent size={iconSize || iconTokens.size} color={iconColor || iconTokens.color} />
|
|
54
60
|
</View>
|
|
55
61
|
)
|
|
@@ -66,7 +72,7 @@ const ListItemMark = React.forwardRef(({ icon, iconColor, iconSize, tokens = {}
|
|
|
66
72
|
style={[staticStyles.bulletPositioning, itemBulletPositioningStyles]}
|
|
67
73
|
testID="unordered-item-bullet"
|
|
68
74
|
>
|
|
69
|
-
<Icon icon={bulletIcon} tokens={{ color: bulletColor }} />
|
|
75
|
+
<Icon icon={bulletIcon} tokens={{ color: bulletColor, size: themeTokens.itemIconSize }} />
|
|
70
76
|
</View>
|
|
71
77
|
</View>
|
|
72
78
|
)
|
|
@@ -117,7 +117,7 @@ const ModalContent = React.forwardRef(
|
|
|
117
117
|
<Typography variant={{ size: subHeadingSize }}>{subHeading}</Typography>
|
|
118
118
|
</View>
|
|
119
119
|
)}
|
|
120
|
-
{Boolean(bodyText && hasHeadingSection) && <Spacer space={3} />}
|
|
120
|
+
{Boolean((bodyText || children) && hasHeadingSection) && <Spacer space={3} />}
|
|
121
121
|
</View>
|
|
122
122
|
)}
|
|
123
123
|
{bodyText && (
|
|
@@ -275,9 +275,9 @@ const MultiSelectFilter = React.forwardRef(
|
|
|
275
275
|
{subtitle}
|
|
276
276
|
</Typography>
|
|
277
277
|
</Row>
|
|
278
|
-
<Spacer space={4} />
|
|
279
278
|
</>
|
|
280
279
|
)}
|
|
280
|
+
<Spacer space={4} />
|
|
281
281
|
<View style={styles.options}>
|
|
282
282
|
<ScrollView onLayout={handleScrollViewLayout}>
|
|
283
283
|
<Row distribute="between" onLayout={handleRowLayout}>
|