@hero-design/rn 8.86.0 → 8.87.1-alpha.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 +12 -0
- package/es/index.js +14 -6
- package/lib/index.js +14 -6
- package/package.json +1 -1
- 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/theme/__tests__/__snapshots__/index.spec.ts.snap +5 -1
- package/src/theme/components/cardCarousel.ts +5 -1
- package/stats/8.87.0/rn-stats.html +4844 -0
- package/stats/8.87.1/rn-stats.html +4842 -0
- package/types/components/Carousel/CardCarousel.d.ts +4 -0
- package/types/components/Carousel/StyledCardCarousel.d.ts +2 -0
- package/types/components/CompoundSearch/CompoundSearchHandler.d.ts +31 -0
- package/types/components/CompoundSearch/CompoundSearchTextInput.d.ts +60 -0
- package/types/components/CompoundSearch/StyledCompoundSearch.d.ts +40 -0
- package/types/components/CompoundSearch/index.d.ts +8 -0
- package/types/components/CompoundSearch/utils.d.ts +8 -0
- package/types/components/FloatingIsland/SingleLine/StyledSingleLine.d.ts +15 -0
- package/types/components/FloatingIsland/SingleLine/index.d.ts +24 -0
- package/types/theme/components/cardCarousel.d.ts +5 -1
- package/types/theme/components/compoundSearch.d.ts +36 -0
- package/.turbo/turbo-build.log +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.87.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3619](https://github.com/Thinkei/hero-design/pull/3619) [`88bfafcf9fc3dcaea7fd5ce14c29c03f3b9e80d2`](https://github.com/Thinkei/hero-design/commit/88bfafcf9fc3dcaea7fd5ce14c29c03f3b9e80d2) Thanks [@sonnguyen-eh](https://github.com/sonnguyen-eh)! - Bump hero-editor to 1.15.4, create new events and expose new functions in RichTextEditor
|
|
8
|
+
|
|
9
|
+
## 8.87.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#3620](https://github.com/Thinkei/hero-design/pull/3620) [`5a7779f2a1283c746bd918e5f3fd35fec8471369`](https://github.com/Thinkei/hero-design/commit/5a7779f2a1283c746bd918e5f3fd35fec8471369) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Carousel.Card] Support gap prop
|
|
14
|
+
|
|
3
15
|
## 8.86.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/es/index.js
CHANGED
|
@@ -2644,8 +2644,12 @@ var getCarouselTheme = function getCarouselTheme(theme) {
|
|
|
2644
2644
|
var getCardCarouselTheme = function getCardCarouselTheme(theme) {
|
|
2645
2645
|
var space = {
|
|
2646
2646
|
pageControlMarginTop: theme.space.medium,
|
|
2647
|
-
|
|
2648
|
-
|
|
2647
|
+
contentContainerPaddingHorizontal: theme.space.large,
|
|
2648
|
+
carouselItemSpacing: {
|
|
2649
|
+
xsmall: theme.space.xxsmall,
|
|
2650
|
+
small: theme.space.xsmall,
|
|
2651
|
+
medium: theme.space.small
|
|
2652
|
+
}
|
|
2649
2653
|
};
|
|
2650
2654
|
var colors = {
|
|
2651
2655
|
carouselItemBackground: theme.colors.defaultSurface
|
|
@@ -13157,9 +13161,10 @@ var StyledCard = index$a(Card$1)(function (_ref2) {
|
|
|
13157
13161
|
};
|
|
13158
13162
|
});
|
|
13159
13163
|
var StyledItemWrapper = index$a(View)(function (_ref3) {
|
|
13160
|
-
var theme = _ref3.theme
|
|
13164
|
+
var theme = _ref3.theme,
|
|
13165
|
+
themeGap = _ref3.themeGap;
|
|
13161
13166
|
return {
|
|
13162
|
-
padding: theme.__hd__.cardCarousel.space.carouselItemSpacing
|
|
13167
|
+
padding: theme.__hd__.cardCarousel.space.carouselItemSpacing[themeGap]
|
|
13163
13168
|
};
|
|
13164
13169
|
});
|
|
13165
13170
|
|
|
@@ -13187,7 +13192,9 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13187
13192
|
autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
|
|
13188
13193
|
_ref$autoPlayInterval = _ref.autoPlayInterval,
|
|
13189
13194
|
autoPlayInterval = _ref$autoPlayInterval === void 0 ? 3000 : _ref$autoPlayInterval,
|
|
13190
|
-
onLayout = _ref.onLayout
|
|
13195
|
+
onLayout = _ref.onLayout,
|
|
13196
|
+
_ref$gap = _ref.gap,
|
|
13197
|
+
gap = _ref$gap === void 0 ? 'medium' : _ref$gap;
|
|
13191
13198
|
var _useState = useState(0),
|
|
13192
13199
|
_useState2 = _slicedToArray(_useState, 2),
|
|
13193
13200
|
currentIndex = _useState2[0],
|
|
@@ -13271,11 +13278,12 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13271
13278
|
var renderItem = useCallback(function (_ref3) {
|
|
13272
13279
|
var item = _ref3.item;
|
|
13273
13280
|
return /*#__PURE__*/React__default.createElement(StyledItemWrapper, {
|
|
13281
|
+
themeGap: gap,
|
|
13274
13282
|
style: {
|
|
13275
13283
|
width: itemWidth
|
|
13276
13284
|
}
|
|
13277
13285
|
}, /*#__PURE__*/React__default.createElement(StyledCard, null, item));
|
|
13278
|
-
}, [itemWidth]);
|
|
13286
|
+
}, [itemWidth, gap]);
|
|
13279
13287
|
var contentContainerPaddingHorizontal = theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal;
|
|
13280
13288
|
return /*#__PURE__*/React__default.createElement(StyledWrapper$9, {
|
|
13281
13289
|
style: style,
|
package/lib/index.js
CHANGED
|
@@ -2672,8 +2672,12 @@ var getCarouselTheme = function getCarouselTheme(theme) {
|
|
|
2672
2672
|
var getCardCarouselTheme = function getCardCarouselTheme(theme) {
|
|
2673
2673
|
var space = {
|
|
2674
2674
|
pageControlMarginTop: theme.space.medium,
|
|
2675
|
-
|
|
2676
|
-
|
|
2675
|
+
contentContainerPaddingHorizontal: theme.space.large,
|
|
2676
|
+
carouselItemSpacing: {
|
|
2677
|
+
xsmall: theme.space.xxsmall,
|
|
2678
|
+
small: theme.space.xsmall,
|
|
2679
|
+
medium: theme.space.small
|
|
2680
|
+
}
|
|
2677
2681
|
};
|
|
2678
2682
|
var colors = {
|
|
2679
2683
|
carouselItemBackground: theme.colors.defaultSurface
|
|
@@ -13185,9 +13189,10 @@ var StyledCard = index$a(Card$1)(function (_ref2) {
|
|
|
13185
13189
|
};
|
|
13186
13190
|
});
|
|
13187
13191
|
var StyledItemWrapper = index$a(reactNative.View)(function (_ref3) {
|
|
13188
|
-
var theme = _ref3.theme
|
|
13192
|
+
var theme = _ref3.theme,
|
|
13193
|
+
themeGap = _ref3.themeGap;
|
|
13189
13194
|
return {
|
|
13190
|
-
padding: theme.__hd__.cardCarousel.space.carouselItemSpacing
|
|
13195
|
+
padding: theme.__hd__.cardCarousel.space.carouselItemSpacing[themeGap]
|
|
13191
13196
|
};
|
|
13192
13197
|
});
|
|
13193
13198
|
|
|
@@ -13215,7 +13220,9 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
13215
13220
|
autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
|
|
13216
13221
|
_ref$autoPlayInterval = _ref.autoPlayInterval,
|
|
13217
13222
|
autoPlayInterval = _ref$autoPlayInterval === void 0 ? 3000 : _ref$autoPlayInterval,
|
|
13218
|
-
onLayout = _ref.onLayout
|
|
13223
|
+
onLayout = _ref.onLayout,
|
|
13224
|
+
_ref$gap = _ref.gap,
|
|
13225
|
+
gap = _ref$gap === void 0 ? 'medium' : _ref$gap;
|
|
13219
13226
|
var _useState = React.useState(0),
|
|
13220
13227
|
_useState2 = _slicedToArray(_useState, 2),
|
|
13221
13228
|
currentIndex = _useState2[0],
|
|
@@ -13299,11 +13306,12 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
13299
13306
|
var renderItem = React.useCallback(function (_ref3) {
|
|
13300
13307
|
var item = _ref3.item;
|
|
13301
13308
|
return /*#__PURE__*/React__namespace.default.createElement(StyledItemWrapper, {
|
|
13309
|
+
themeGap: gap,
|
|
13302
13310
|
style: {
|
|
13303
13311
|
width: itemWidth
|
|
13304
13312
|
}
|
|
13305
13313
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCard, null, item));
|
|
13306
|
-
}, [itemWidth]);
|
|
13314
|
+
}, [itemWidth, gap]);
|
|
13307
13315
|
var contentContainerPaddingHorizontal = theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal;
|
|
13308
13316
|
return /*#__PURE__*/React__namespace.default.createElement(StyledWrapper$9, {
|
|
13309
13317
|
style: style,
|
package/package.json
CHANGED
|
@@ -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
|
});
|