@hero-design/rn 8.85.0 → 8.87.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 +8 -2
- package/CHANGELOG.md +18 -0
- package/es/index.js +10763 -8758
- package/lib/index.js +10763 -8758
- package/package.json +2 -2
- package/src/components/Button/Button.tsx +22 -6
- package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +8 -2
- package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +3 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +139 -1
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +408 -3
- package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +3 -0
- package/src/components/Button/LoadingIndicator/index.tsx +4 -1
- package/src/components/Button/StyledButton.tsx +95 -5
- package/src/components/Button/__tests__/Button.spec.tsx +12 -0
- package/src/components/Button/__tests__/StyledButton.spec.tsx +10 -0
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +1240 -90
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +630 -40
- package/src/components/Carousel/CardCarousel.tsx +7 -2
- package/src/components/Carousel/StyledCardCarousel.tsx +6 -2
- package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +28 -1
- package/src/components/Carousel/__tests__/StyledCardCarousel.spec.tsx +7 -2
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +1799 -1
- package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +86 -1
- package/src/components/RichTextEditor/RichTextEditor.tsx +30 -1
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +59 -0
- package/src/components/RichTextEditor/types.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +10 -1
- package/src/theme/components/button.ts +5 -0
- package/src/theme/components/cardCarousel.ts +5 -1
- package/stats/8.86.0/rn-stats.html +4842 -0
- package/stats/8.87.0/rn-stats.html +4844 -0
- package/stats/8.87.1/rn-stats.html +4842 -0
- package/types/components/Button/Button.d.ts +1 -1
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
- package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +3 -3
- package/types/components/Carousel/CardCarousel.d.ts +4 -0
- package/types/components/Carousel/StyledCardCarousel.d.ts +2 -0
- package/types/components/RichTextEditor/RichTextEditor.d.ts +4 -0
- package/types/components/RichTextEditor/types.d.ts +1 -0
- package/types/theme/components/button.d.ts +5 -0
- package/types/theme/components/cardCarousel.d.ts +5 -1
|
@@ -65,6 +65,10 @@ export interface CardCarouselProps {
|
|
|
65
65
|
* onLayout event handler.
|
|
66
66
|
*/
|
|
67
67
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Gap between items.
|
|
70
|
+
*/
|
|
71
|
+
gap?: 'xsmall' | 'small' | 'medium';
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
export const getCardCarouselValidIndex = (index: number, length: number) => {
|
|
@@ -82,6 +86,7 @@ export const CardCarousel = forwardRef<CardCarouselHandles, CardCarouselProps>(
|
|
|
82
86
|
autoPlay = false,
|
|
83
87
|
autoPlayInterval = 3000,
|
|
84
88
|
onLayout,
|
|
89
|
+
gap = 'medium',
|
|
85
90
|
}: CardCarouselProps,
|
|
86
91
|
ref?: React.Ref<CardCarouselHandles>
|
|
87
92
|
) => {
|
|
@@ -181,12 +186,12 @@ export const CardCarousel = forwardRef<CardCarouselHandles, CardCarouselProps>(
|
|
|
181
186
|
const renderItem: ListRenderItem<React.ReactNode> = useCallback(
|
|
182
187
|
({ item }) => {
|
|
183
188
|
return (
|
|
184
|
-
<StyledItemWrapper style={{ width: itemWidth }}>
|
|
189
|
+
<StyledItemWrapper themeGap={gap} style={{ width: itemWidth }}>
|
|
185
190
|
<StyledCard>{item}</StyledCard>
|
|
186
191
|
</StyledItemWrapper>
|
|
187
192
|
);
|
|
188
193
|
},
|
|
189
|
-
[itemWidth]
|
|
194
|
+
[itemWidth, gap]
|
|
190
195
|
);
|
|
191
196
|
|
|
192
197
|
const { contentContainerPaddingHorizontal } =
|
|
@@ -18,8 +18,12 @@ const StyledCard = styled(Card)<CardProps>(({ theme }) => ({
|
|
|
18
18
|
flex: 1,
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
|
-
const StyledItemWrapper = styled(View)<
|
|
22
|
-
|
|
21
|
+
const StyledItemWrapper = styled(View)<
|
|
22
|
+
ViewProps & {
|
|
23
|
+
themeGap: 'xsmall' | 'small' | 'medium';
|
|
24
|
+
}
|
|
25
|
+
>(({ theme, themeGap }) => ({
|
|
26
|
+
padding: theme.__hd__.cardCarousel.space.carouselItemSpacing[themeGap],
|
|
23
27
|
}));
|
|
24
28
|
|
|
25
29
|
export { StyledCard, StyledItemWrapper, StyledWrapper, StyledPageControl };
|
|
@@ -112,7 +112,7 @@ describe('CardCarousel', () => {
|
|
|
112
112
|
beforeAll(() => {
|
|
113
113
|
Platform.OS = 'android';
|
|
114
114
|
});
|
|
115
|
-
it('should render correctly on
|
|
115
|
+
it('should render correctly on Android', () => {
|
|
116
116
|
const wrapper = renderWithTheme(
|
|
117
117
|
<CardCarousel
|
|
118
118
|
testID="cardCarousel"
|
|
@@ -209,4 +209,31 @@ describe('CardCarousel', () => {
|
|
|
209
209
|
});
|
|
210
210
|
});
|
|
211
211
|
});
|
|
212
|
+
|
|
213
|
+
describe('gap', () => {
|
|
214
|
+
it.each`
|
|
215
|
+
gap | platform
|
|
216
|
+
${'xsmall'} | ${'ios'}
|
|
217
|
+
${'small'} | ${'ios'}
|
|
218
|
+
${'medium'} | ${'ios'}
|
|
219
|
+
${'xsmall'} | ${'android'}
|
|
220
|
+
${'small'} | ${'android'}
|
|
221
|
+
${'medium'} | ${'android'}
|
|
222
|
+
`('renders correctly with gap $gap', ({ gap, platform }) => {
|
|
223
|
+
Platform.OS = platform;
|
|
224
|
+
const wrapper = renderWithTheme(
|
|
225
|
+
<CardCarousel
|
|
226
|
+
testID="cardCarousel"
|
|
227
|
+
style={{ width: 100, height: 100 }}
|
|
228
|
+
gap={gap}
|
|
229
|
+
items={[
|
|
230
|
+
<Typography.Body variant="small"> screen 1</Typography.Body>,
|
|
231
|
+
<Typography.Body variant="small"> screen 2</Typography.Body>,
|
|
232
|
+
]}
|
|
233
|
+
/>
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
237
|
+
});
|
|
238
|
+
});
|
|
212
239
|
});
|
|
@@ -31,8 +31,13 @@ describe('StyledCard', () => {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
describe('StyledItemWrapper', () => {
|
|
34
|
-
it
|
|
35
|
-
|
|
34
|
+
it.each`
|
|
35
|
+
gap
|
|
36
|
+
${'xsmall'}
|
|
37
|
+
${'small'}
|
|
38
|
+
${'medium'}
|
|
39
|
+
`('should render correctly with gap=$gap', ({ gap }) => {
|
|
40
|
+
const { toJSON } = renderWithTheme(<StyledItemWrapper themeGap={gap} />);
|
|
36
41
|
expect(toJSON()).toMatchSnapshot();
|
|
37
42
|
});
|
|
38
43
|
});
|