@hero-design/rn 8.3.0 → 8.3.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.
- package/.turbo/turbo-build.log +9 -9
- package/es/index.js +74 -73
- package/lib/index.js +74 -73
- package/package.json +5 -5
- package/src/components/Carousel/CarouselItem.tsx +1 -6
- package/src/components/Carousel/CarouselPaginator/StyledCarouselPaginator.tsx +10 -9
- package/src/components/Carousel/CarouselPaginator/index.tsx +2 -3
- package/src/components/Carousel/StyledCarousel.tsx +9 -6
- package/src/components/Carousel/__tests__/StyledCarousel.spec.tsx +3 -3
- package/src/components/Carousel/__tests__/__snapshots__/StyledCarousel.spec.tsx.snap +1 -2
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +600 -0
- package/src/components/Carousel/__tests__/index.spec.tsx +15 -7
- package/src/components/Carousel/index.tsx +65 -84
- package/src/components/Typography/Text/StyledText.tsx +1 -0
- package/src/components/Typography/Text/index.tsx +1 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -2
- package/src/theme/components/carousel.ts +5 -2
- package/src/theme/components/typography.ts +2 -0
- package/src/theme/global/typography.ts +3 -0
- package/types/components/Carousel/CarouselItem.d.ts +1 -2
- package/types/components/Carousel/CarouselPaginator/StyledCarouselPaginator.d.ts +0 -2
- package/types/components/Carousel/StyledCarousel.d.ts +6 -4
- package/types/components/Carousel/index.d.ts +9 -23
- package/types/components/Typography/Text/StyledText.d.ts +1 -1
- package/types/components/Typography/Text/index.d.ts +1 -1
- package/types/theme/components/carousel.d.ts +3 -0
- package/types/theme/components/typography.d.ts +2 -0
- package/types/theme/global/typography.d.ts +1 -0
|
@@ -5,6 +5,7 @@ import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
|
5
5
|
import Carousel from '..';
|
|
6
6
|
import Image from '../../Image';
|
|
7
7
|
import { theme } from '../../..';
|
|
8
|
+
import Button from '../../Button/Button';
|
|
8
9
|
|
|
9
10
|
const carouselData = [
|
|
10
11
|
{
|
|
@@ -30,15 +31,14 @@ const carouselData = [
|
|
|
30
31
|
|
|
31
32
|
describe('Carousel', () => {
|
|
32
33
|
it('renders basic carousel', async () => {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const { getByTestId, queryByText } = renderWithTheme(
|
|
34
|
+
const onPress = jest.fn();
|
|
35
|
+
const { getByTestId, queryByText, toJSON } = renderWithTheme(
|
|
37
36
|
<Carousel
|
|
38
37
|
testID="carousel"
|
|
39
38
|
items={carouselData}
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
renderActions={(_) => {
|
|
40
|
+
return <Button text="Skip" onPress={onPress} />;
|
|
41
|
+
}}
|
|
42
42
|
/>
|
|
43
43
|
);
|
|
44
44
|
|
|
@@ -69,13 +69,21 @@ describe('Carousel', () => {
|
|
|
69
69
|
'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.'
|
|
70
70
|
)
|
|
71
71
|
).toBeTruthy();
|
|
72
|
+
|
|
73
|
+
expect(toJSON()).toMatchSnapshot();
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
it('should call skip call back when press skip', () => {
|
|
75
77
|
const onSkip = jest.fn();
|
|
76
78
|
|
|
77
79
|
const { queryByText } = renderWithTheme(
|
|
78
|
-
<Carousel
|
|
80
|
+
<Carousel
|
|
81
|
+
testID="carousel"
|
|
82
|
+
items={carouselData}
|
|
83
|
+
renderActions={(_) => {
|
|
84
|
+
return <Button text="Skip" onPress={onSkip} />;
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
79
87
|
);
|
|
80
88
|
|
|
81
89
|
expect(queryByText('Skip')).toBeTruthy();
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
Dispatch,
|
|
3
|
+
SetStateAction,
|
|
4
|
+
useCallback,
|
|
5
|
+
useRef,
|
|
6
|
+
useEffect,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
2
9
|
import {
|
|
3
10
|
Animated,
|
|
4
11
|
FlatList,
|
|
5
12
|
StyleProp,
|
|
6
13
|
useWindowDimensions,
|
|
14
|
+
View,
|
|
7
15
|
ViewProps,
|
|
8
16
|
ViewStyle,
|
|
9
17
|
} from 'react-native';
|
|
@@ -11,11 +19,10 @@ import {
|
|
|
11
19
|
import { CarouselData } from './types';
|
|
12
20
|
import CarouselPaginator from './CarouselPaginator';
|
|
13
21
|
import {
|
|
14
|
-
|
|
22
|
+
StyledBackDrop,
|
|
15
23
|
StyledCarouselFooterWrapper,
|
|
16
24
|
StyledCarouselView,
|
|
17
25
|
} from './StyledCarousel';
|
|
18
|
-
import Button from '../Button';
|
|
19
26
|
import CarouselItem from './CarouselItem';
|
|
20
27
|
|
|
21
28
|
interface CarouselProps extends ViewProps {
|
|
@@ -27,101 +34,86 @@ interface CarouselProps extends ViewProps {
|
|
|
27
34
|
* Testing id of the component.
|
|
28
35
|
*/
|
|
29
36
|
testID?: string;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Callback to be called when the user slides to the next slide.
|
|
33
|
-
*/
|
|
34
|
-
onSlideChange?: (currentSlide?: CarouselData) => void;
|
|
35
|
-
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
+
* onItemIndexChange event handler receiving index of selected Item.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Callback to be called when the user finishes the intro carousel.
|
|
43
|
-
*/
|
|
44
|
-
onFinishPress?: (currentSlide?: CarouselData) => void;
|
|
45
|
-
|
|
40
|
+
onItemIndexChange?: Dispatch<SetStateAction<number>>;
|
|
46
41
|
/**
|
|
47
42
|
* Carousel data.
|
|
48
43
|
*/
|
|
49
44
|
items: CarouselData[];
|
|
50
|
-
|
|
51
45
|
/**
|
|
52
|
-
*
|
|
46
|
+
* Render action elements function.
|
|
53
47
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
renderActions?: (pageIndex: number) => JSX.Element;
|
|
56
49
|
/**
|
|
57
|
-
*
|
|
50
|
+
* Current selected item index.
|
|
58
51
|
*/
|
|
59
|
-
|
|
52
|
+
selectedItemIndex?: number;
|
|
53
|
+
}
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
export function useStateFromProp<T>(
|
|
56
|
+
initialValue: T
|
|
57
|
+
): [T, Dispatch<SetStateAction<T>>] {
|
|
58
|
+
const [value, setValue] = useState(initialValue);
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
minContentHeight?: number;
|
|
60
|
+
useEffect(() => setValue(initialValue), [initialValue]);
|
|
61
|
+
|
|
62
|
+
return [value, setValue];
|
|
70
63
|
}
|
|
71
64
|
|
|
72
65
|
const Carousel = ({
|
|
73
66
|
items,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
skipButtonLabel = 'Skip',
|
|
79
|
-
footerHeight = 70,
|
|
80
|
-
minContentHeight = 250,
|
|
67
|
+
onItemIndexChange,
|
|
68
|
+
renderActions,
|
|
69
|
+
selectedItemIndex = 0,
|
|
70
|
+
style,
|
|
81
71
|
...nativeProps
|
|
82
72
|
}: CarouselProps) => {
|
|
83
|
-
const carouselRef = useRef(null);
|
|
84
|
-
const [currentSlideIndex, setCurrentSlideIndex] = useState(0);
|
|
85
|
-
const { width } = useWindowDimensions();
|
|
73
|
+
const carouselRef = useRef<FlatList>(null);
|
|
86
74
|
|
|
87
|
-
const
|
|
75
|
+
const [currentSlideIndex, setCurrentSlideIndex] =
|
|
76
|
+
useStateFromProp(selectedItemIndex);
|
|
88
77
|
|
|
89
|
-
const
|
|
90
|
-
(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const currentSlide = items[currentIndex];
|
|
95
|
-
if (onSlideChange) {
|
|
96
|
-
onSlideChange(currentSlide);
|
|
78
|
+
const internalOnItemIndexChange = useCallback(
|
|
79
|
+
(index: number) => {
|
|
80
|
+
setCurrentSlideIndex(index);
|
|
81
|
+
if (onItemIndexChange) {
|
|
82
|
+
onItemIndexChange(index);
|
|
97
83
|
}
|
|
98
84
|
},
|
|
99
|
-
[
|
|
85
|
+
[setCurrentSlideIndex, onItemIndexChange]
|
|
100
86
|
);
|
|
87
|
+
const { width } = useWindowDimensions();
|
|
101
88
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
89
|
+
const scrollX = useRef(new Animated.Value(0)).current;
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
// must use setTimeout since when layout is mounted, the pagination dots are not set correct scrollX
|
|
92
|
+
const handle = setTimeout(() => {
|
|
93
|
+
scrollX.setValue(currentSlideIndex * width);
|
|
94
|
+
carouselRef.current?.scrollToOffset({
|
|
95
|
+
offset: currentSlideIndex * width,
|
|
96
|
+
animated: true,
|
|
97
|
+
});
|
|
98
|
+
}, 100);
|
|
99
|
+
return () => {
|
|
100
|
+
clearTimeout(handle);
|
|
101
|
+
};
|
|
102
|
+
}, [currentSlideIndex, carouselRef]);
|
|
103
|
+
|
|
104
|
+
const visibleSlideChanged = useCallback(({ viewableItems }) => {
|
|
105
|
+
if (!viewableItems || (viewableItems && !viewableItems.length)) return;
|
|
106
|
+
const { index } = viewableItems[0];
|
|
107
|
+
internalOnItemIndexChange(index);
|
|
108
|
+
}, []);
|
|
115
109
|
|
|
116
110
|
const viewConfig = useRef({ viewAreaCoveragePercentThreshold: 50 }).current;
|
|
117
111
|
|
|
118
|
-
const isLastSlide = currentSlideIndex === items.length - 1;
|
|
119
|
-
|
|
120
112
|
return (
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
<View style={style} {...nativeProps}>
|
|
114
|
+
<StyledBackDrop
|
|
115
|
+
themeSlideBackground={items[currentSlideIndex].background}
|
|
116
|
+
/>
|
|
125
117
|
<StyledCarouselView>
|
|
126
118
|
<FlatList
|
|
127
119
|
horizontal
|
|
@@ -148,28 +140,17 @@ const Carousel = ({
|
|
|
148
140
|
heading={heading}
|
|
149
141
|
body={body}
|
|
150
142
|
content={content}
|
|
151
|
-
minHeight={minContentHeight}
|
|
152
143
|
width={width}
|
|
153
144
|
/>
|
|
154
145
|
);
|
|
155
146
|
}}
|
|
156
147
|
/>
|
|
157
|
-
<StyledCarouselFooterWrapper
|
|
158
|
-
|
|
159
|
-
flexDirection="row"
|
|
160
|
-
justifyContent="space-between"
|
|
161
|
-
style={{ height: footerHeight }}
|
|
162
|
-
>
|
|
163
|
-
<Button
|
|
164
|
-
variant={isLastSlide ? 'filled' : 'text'}
|
|
165
|
-
intent="primary"
|
|
166
|
-
onPress={isLastSlide ? finishCarousel : skipCarousel}
|
|
167
|
-
text={isLastSlide ? finishButtonLabel : skipButtonLabel}
|
|
168
|
-
/>
|
|
148
|
+
<StyledCarouselFooterWrapper>
|
|
149
|
+
{renderActions && renderActions(currentSlideIndex)}
|
|
169
150
|
<CarouselPaginator numberOfSlides={items.length} scrollX={scrollX} />
|
|
170
151
|
</StyledCarouselFooterWrapper>
|
|
171
152
|
</StyledCarouselView>
|
|
172
|
-
</
|
|
153
|
+
</View>
|
|
173
154
|
);
|
|
174
155
|
};
|
|
175
156
|
|
|
@@ -258,13 +258,13 @@ Object {
|
|
|
258
258
|
"paginatorBackgroundColor": "#401960",
|
|
259
259
|
},
|
|
260
260
|
"fontSizes": Object {
|
|
261
|
-
"heading":
|
|
261
|
+
"heading": 36,
|
|
262
262
|
},
|
|
263
263
|
"fonts": Object {
|
|
264
264
|
"heading": "RebondGrotesque-SemiBold",
|
|
265
265
|
},
|
|
266
266
|
"lineHeights": Object {
|
|
267
|
-
"heading":
|
|
267
|
+
"heading": 44,
|
|
268
268
|
},
|
|
269
269
|
"radii": Object {
|
|
270
270
|
"paginatorBorderRadius": 999,
|
|
@@ -275,6 +275,9 @@ Object {
|
|
|
275
275
|
"paginatorWidth": 8,
|
|
276
276
|
},
|
|
277
277
|
"space": Object {
|
|
278
|
+
"footerMarginBottom": 24,
|
|
279
|
+
"footerPaddingHorizontal": 24,
|
|
280
|
+
"footerPaddingVertical": 16,
|
|
278
281
|
"headingMarginBottom": 16,
|
|
279
282
|
"headingMarginTop": 8,
|
|
280
283
|
"paginatorMarginHorizontal": 8,
|
|
@@ -927,6 +930,7 @@ Object {
|
|
|
927
930
|
"warning": "#ffa234",
|
|
928
931
|
},
|
|
929
932
|
"fontSizes": Object {
|
|
933
|
+
"6xlarge": 36,
|
|
930
934
|
"7xlarge": 42,
|
|
931
935
|
"large": 16,
|
|
932
936
|
"medium": 14,
|
|
@@ -948,6 +952,7 @@ Object {
|
|
|
948
952
|
},
|
|
949
953
|
},
|
|
950
954
|
"lineHeights": Object {
|
|
955
|
+
"6xlarge": 44,
|
|
951
956
|
"7xlarge": 50,
|
|
952
957
|
"large": 24,
|
|
953
958
|
"medium": 22,
|
|
@@ -1007,6 +1012,7 @@ Object {
|
|
|
1007
1012
|
"warningSurface": "#fff6eb",
|
|
1008
1013
|
},
|
|
1009
1014
|
"fontSizes": Object {
|
|
1015
|
+
"6xlarge": 36,
|
|
1010
1016
|
"7xlarge": 42,
|
|
1011
1017
|
"large": 16,
|
|
1012
1018
|
"medium": 14,
|
|
@@ -1031,6 +1037,7 @@ Object {
|
|
|
1031
1037
|
},
|
|
1032
1038
|
},
|
|
1033
1039
|
"lineHeights": Object {
|
|
1040
|
+
"6xlarge": 44,
|
|
1034
1041
|
"7xlarge": 50,
|
|
1035
1042
|
"large": 24,
|
|
1036
1043
|
"medium": 22,
|
|
@@ -9,6 +9,9 @@ const getCarouselTheme = (theme: GlobalTheme) => {
|
|
|
9
9
|
headingMarginTop: theme.space.small,
|
|
10
10
|
headingMarginBottom: theme.space.medium,
|
|
11
11
|
paginatorMarginHorizontal: theme.space.small,
|
|
12
|
+
footerPaddingHorizontal: theme.space.large,
|
|
13
|
+
footerPaddingVertical: theme.space.medium,
|
|
14
|
+
footerMarginBottom: theme.space.large,
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
const sizes = {
|
|
@@ -22,7 +25,7 @@ const getCarouselTheme = (theme: GlobalTheme) => {
|
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
const fontSizes = {
|
|
25
|
-
heading: theme.fontSizes
|
|
28
|
+
heading: theme.fontSizes['6xlarge'],
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
const fonts = {
|
|
@@ -30,7 +33,7 @@ const getCarouselTheme = (theme: GlobalTheme) => {
|
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
const lineHeights = {
|
|
33
|
-
heading: theme.lineHeights
|
|
36
|
+
heading: theme.lineHeights['6xlarge'],
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
return { colors, sizes, radii, space, fonts, fontSizes, lineHeights };
|
|
@@ -20,6 +20,7 @@ const getTypographyTheme = (theme: GlobalTheme) => {
|
|
|
20
20
|
xlarge: theme.fontSizes.xlarge,
|
|
21
21
|
xxxlarge: theme.fontSizes.xxxlarge,
|
|
22
22
|
xxxxxlarge: theme.fontSizes.xxxxxlarge,
|
|
23
|
+
'6xlarge': theme.fontSizes['6xlarge'],
|
|
23
24
|
'7xlarge': theme.fontSizes['7xlarge'],
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -30,6 +31,7 @@ const getTypographyTheme = (theme: GlobalTheme) => {
|
|
|
30
31
|
xlarge: theme.lineHeights.xlarge,
|
|
31
32
|
xxxlarge: theme.lineHeights.xxxlarge,
|
|
32
33
|
xxxxxlarge: theme.lineHeights.xxxxxlarge,
|
|
34
|
+
'6xlarge': theme.lineHeights['6xlarge'],
|
|
33
35
|
'7xlarge': theme.lineHeights['7xlarge'],
|
|
34
36
|
};
|
|
35
37
|
|
|
@@ -13,6 +13,7 @@ interface Fonts {
|
|
|
13
13
|
|
|
14
14
|
interface FontSizes {
|
|
15
15
|
'7xlarge': number;
|
|
16
|
+
'6xlarge': number;
|
|
16
17
|
xxxxxlarge: number;
|
|
17
18
|
xxxxlarge: number;
|
|
18
19
|
xxxlarge: number;
|
|
@@ -62,6 +63,7 @@ const getFontSizes = (baseFontSize: number): FontSizes => {
|
|
|
62
63
|
});
|
|
63
64
|
return {
|
|
64
65
|
'7xlarge': scale(fontSizes[10]), // 42
|
|
66
|
+
'6xlarge': scale(fontSizes[9]), // 36
|
|
65
67
|
xxxxxlarge: scale(fontSizes[8]), // 32
|
|
66
68
|
xxxxlarge: scale(fontSizes[7]), // 28
|
|
67
69
|
xxxlarge: scale(fontSizes[6]), // 24
|
|
@@ -78,6 +80,7 @@ const getLineHeights = (fontSizes: FontSizes): LineHeights => {
|
|
|
78
80
|
const additionalSpace = 8;
|
|
79
81
|
return {
|
|
80
82
|
'7xlarge': fontSizes['7xlarge'] + additionalSpace,
|
|
83
|
+
'6xlarge': fontSizes['6xlarge'] + additionalSpace,
|
|
81
84
|
xxxxxlarge: fontSizes.xxxxxlarge + additionalSpace,
|
|
82
85
|
xxxxlarge: fontSizes.xxxxlarge + additionalSpace,
|
|
83
86
|
xxxlarge: fontSizes.xxxlarge + additionalSpace,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CarouselData } from './types';
|
|
2
2
|
interface CarouselItemProps extends Omit<CarouselData, 'background'> {
|
|
3
3
|
width: number;
|
|
4
|
-
minHeight: number;
|
|
5
4
|
}
|
|
6
|
-
declare const CarouselItem: ({ width, image, content, heading, body,
|
|
5
|
+
declare const CarouselItem: ({ width, image, content, heading, body, }: CarouselItemProps) => JSX.Element;
|
|
7
6
|
export default CarouselItem;
|
|
@@ -10,7 +10,5 @@ declare const StyledCarouselPaginatorAnimatedView: import("@emotion/native").Sty
|
|
|
10
10
|
} & {
|
|
11
11
|
theme?: import("@emotion/react").Theme | undefined;
|
|
12
12
|
as?: import("react").ElementType<any> | undefined;
|
|
13
|
-
} & {
|
|
14
|
-
indicatorWidth: Animated.AnimatedInterpolation;
|
|
15
13
|
}, {}, {}>;
|
|
16
14
|
export { StyledCarouselPaginator, StyledCarouselPaginatorAnimatedView };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
|
-
declare const
|
|
2
|
+
declare const StyledBackDrop: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any> | undefined;
|
|
5
5
|
} & {
|
|
@@ -27,8 +27,10 @@ declare const StyledCarouselContentWrapper: import("@emotion/native").StyledComp
|
|
|
27
27
|
} & {
|
|
28
28
|
width: number;
|
|
29
29
|
}, {}, {}>;
|
|
30
|
-
declare const StyledCarouselFooterWrapper: import("@emotion/native").StyledComponent<import("
|
|
30
|
+
declare const StyledCarouselFooterWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
31
31
|
theme?: import("@emotion/react").Theme | undefined;
|
|
32
32
|
as?: import("react").ElementType<any> | undefined;
|
|
33
|
-
}, {}, {
|
|
34
|
-
|
|
33
|
+
}, {}, {
|
|
34
|
+
ref?: import("react").Ref<View> | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
export { StyledBackDrop, StyledCarouselView, StyledCarouselHeading, StyledCarouselImage, StyledCarouselContentWrapper, StyledCarouselFooterWrapper, };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
1
2
|
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
2
3
|
import { CarouselData } from './types';
|
|
3
4
|
interface CarouselProps extends ViewProps {
|
|
@@ -10,37 +11,22 @@ interface CarouselProps extends ViewProps {
|
|
|
10
11
|
*/
|
|
11
12
|
testID?: string;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* onItemIndexChange event handler receiving index of selected Item.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Callback to be called when the user skips the intro carousel.
|
|
18
|
-
*/
|
|
19
|
-
onSkipPress?: (currentSlide?: CarouselData) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Callback to be called when the user finishes the intro carousel.
|
|
22
|
-
*/
|
|
23
|
-
onFinishPress?: (currentSlide?: CarouselData) => void;
|
|
16
|
+
onItemIndexChange?: Dispatch<SetStateAction<number>>;
|
|
24
17
|
/**
|
|
25
18
|
* Carousel data.
|
|
26
19
|
*/
|
|
27
20
|
items: CarouselData[];
|
|
28
21
|
/**
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
finishButtonLabel?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Skip button label.
|
|
34
|
-
*/
|
|
35
|
-
skipButtonLabel?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Footer height.
|
|
22
|
+
* Render action elements function.
|
|
38
23
|
*/
|
|
39
|
-
|
|
24
|
+
renderActions?: (pageIndex: number) => JSX.Element;
|
|
40
25
|
/**
|
|
41
|
-
*
|
|
26
|
+
* Current selected item index.
|
|
42
27
|
*/
|
|
43
|
-
|
|
28
|
+
selectedItemIndex?: number;
|
|
44
29
|
}
|
|
45
|
-
declare
|
|
30
|
+
export declare function useStateFromProp<T>(initialValue: T): [T, Dispatch<SetStateAction<T>>];
|
|
31
|
+
declare const Carousel: ({ items, onItemIndexChange, renderActions, selectedItemIndex, style, ...nativeProps }: CarouselProps) => JSX.Element;
|
|
46
32
|
export default Carousel;
|
|
@@ -3,7 +3,7 @@ declare const StyledText: import("@emotion/native").StyledComponent<import("reac
|
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any> | undefined;
|
|
5
5
|
} & {
|
|
6
|
-
themeFontSize: 'small' | 'medium' | 'large' | 'xlarge' | 'xxxlarge' | 'xxxxxlarge' | '7xlarge';
|
|
6
|
+
themeFontSize: 'small' | 'medium' | 'large' | 'xlarge' | 'xxxlarge' | 'xxxxxlarge' | '6xlarge' | '7xlarge';
|
|
7
7
|
themeFontWeight: 'light' | 'regular' | 'semi-bold';
|
|
8
8
|
themeIntent: 'body' | 'subdued' | 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger' | 'inverted';
|
|
9
9
|
themeTypeface: 'neutral' | 'playful';
|
|
@@ -8,7 +8,7 @@ export interface TextProps extends NativeTextProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Size of the text.
|
|
10
10
|
*/
|
|
11
|
-
fontSize?: 'small' | 'medium' | 'large' | 'xlarge' | 'xxxlarge' | 'xxxxxlarge' | '7xlarge';
|
|
11
|
+
fontSize?: 'small' | 'medium' | 'large' | 'xlarge' | 'xxxlarge' | 'xxxxxlarge' | '6xlarge' | '7xlarge';
|
|
12
12
|
/**
|
|
13
13
|
* Font weight of the text.
|
|
14
14
|
*/
|
|
@@ -15,6 +15,9 @@ declare const getCarouselTheme: (theme: GlobalTheme) => {
|
|
|
15
15
|
headingMarginTop: number;
|
|
16
16
|
headingMarginBottom: number;
|
|
17
17
|
paginatorMarginHorizontal: number;
|
|
18
|
+
footerPaddingHorizontal: number;
|
|
19
|
+
footerPaddingVertical: number;
|
|
20
|
+
footerMarginBottom: number;
|
|
18
21
|
};
|
|
19
22
|
fonts: {
|
|
20
23
|
heading: string;
|
|
@@ -19,6 +19,7 @@ declare const getTypographyTheme: (theme: GlobalTheme) => {
|
|
|
19
19
|
xlarge: number;
|
|
20
20
|
xxxlarge: number;
|
|
21
21
|
xxxxxlarge: number;
|
|
22
|
+
'6xlarge': number;
|
|
22
23
|
'7xlarge': number;
|
|
23
24
|
};
|
|
24
25
|
lineHeights: {
|
|
@@ -28,6 +29,7 @@ declare const getTypographyTheme: (theme: GlobalTheme) => {
|
|
|
28
29
|
xlarge: number;
|
|
29
30
|
xxxlarge: number;
|
|
30
31
|
xxxxxlarge: number;
|
|
32
|
+
'6xlarge': number;
|
|
31
33
|
'7xlarge': number;
|
|
32
34
|
};
|
|
33
35
|
};
|