@hero-design/rn 8.6.0 → 8.7.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 (44) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  3. package/es/index.js +473 -420
  4. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  5. package/lib/index.js +473 -419
  6. package/package.json +5 -5
  7. package/src/components/Carousel/CarouselItem.tsx +19 -7
  8. package/src/components/Carousel/StyledCarousel.tsx +18 -1
  9. package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +622 -6
  10. package/src/components/Carousel/__tests__/index.spec.tsx +3 -1
  11. package/src/components/Carousel/index.tsx +12 -2
  12. package/src/components/Carousel/types.ts +8 -2
  13. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  14. package/src/components/Icon/IconList.ts +6 -0
  15. package/src/components/PageControl/StyledPageControl.tsx +17 -0
  16. package/src/components/PageControl/__tests__/__snapshots__/index.spec.tsx.snap +58 -0
  17. package/src/components/PageControl/__tests__/index.spec.tsx +21 -0
  18. package/src/components/PageControl/index.tsx +75 -0
  19. package/src/components/Typography/Text/StyledText.tsx +1 -0
  20. package/src/components/Typography/Text/index.tsx +1 -0
  21. package/src/index.ts +2 -0
  22. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +18 -12
  23. package/src/theme/components/carousel.ts +1 -16
  24. package/src/theme/components/pageControl.ts +25 -0
  25. package/src/theme/components/typography.ts +2 -0
  26. package/src/theme/getTheme.ts +3 -0
  27. package/types/components/Carousel/StyledCarousel.d.ts +14 -2
  28. package/types/components/Carousel/index.d.ts +5 -1
  29. package/types/components/Carousel/types.d.ts +7 -2
  30. package/types/components/Icon/IconList.d.ts +1 -1
  31. package/types/components/Icon/index.d.ts +1 -1
  32. package/types/components/Icon/utils.d.ts +1 -1
  33. package/types/components/{Carousel/CarouselPaginator/StyledCarouselPaginator.d.ts → PageControl/StyledPageControl.d.ts} +3 -3
  34. package/types/components/PageControl/index.d.ts +21 -0
  35. package/types/components/Typography/Text/StyledText.d.ts +1 -1
  36. package/types/components/Typography/Text/index.d.ts +1 -1
  37. package/types/index.d.ts +2 -1
  38. package/types/theme/components/carousel.d.ts +0 -12
  39. package/types/theme/components/pageControl.d.ts +18 -0
  40. package/types/theme/components/typography.d.ts +2 -0
  41. package/types/theme/getTheme.d.ts +2 -0
  42. package/src/components/Carousel/CarouselPaginator/StyledCarouselPaginator.tsx +0 -20
  43. package/src/components/Carousel/CarouselPaginator/index.tsx +0 -57
  44. package/types/components/Carousel/CarouselPaginator/index.d.ts +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.6.0",
24
+ "@hero-design/colors": "8.7.0",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -44,7 +44,7 @@
44
44
  "@babel/preset-typescript": "^7.17.12",
45
45
  "@babel/runtime": "^7.18.9",
46
46
  "@emotion/jest": "^11.9.3",
47
- "@hero-design/eslint-plugin": "8.6.0",
47
+ "@hero-design/eslint-plugin": "8.7.0",
48
48
  "@react-native-community/datetimepicker": "^3.5.2",
49
49
  "@react-native-community/slider": "4.1.12",
50
50
  "@rollup/plugin-babel": "^5.3.1",
@@ -60,9 +60,9 @@
60
60
  "@types/react-native": "^0.67.7",
61
61
  "@types/react-native-vector-icons": "^6.4.10",
62
62
  "babel-plugin-inline-import": "^3.0.0",
63
- "eslint-config-hd": "8.6.0",
63
+ "eslint-config-hd": "8.7.0",
64
64
  "jest": "^27.3.1",
65
- "prettier-config-hd": "8.6.0",
65
+ "prettier-config-hd": "8.7.0",
66
66
  "react": "18.0.0",
67
67
  "react-native": "0.69.7",
68
68
  "react-native-gesture-handler": "~2.1.0",
@@ -1,18 +1,24 @@
1
1
  import React from 'react';
2
-
3
2
  import {
4
3
  StyledCarouselContentWrapper,
5
4
  StyledCarouselHeading,
6
5
  StyledCarouselImage,
6
+ StyledCustomSizeCarouselImage,
7
7
  } from './StyledCarousel';
8
8
  import Box from '../Box';
9
9
  import Typography from '../Typography';
10
- import { CarouselData } from './types';
10
+ import { CarouselData, CarouselImageProps } from './types';
11
11
 
12
12
  interface CarouselItemProps extends Omit<CarouselData, 'background'> {
13
13
  width: number;
14
14
  }
15
15
 
16
+ function isCarouselImageProps(
17
+ image: CarouselImageProps | string
18
+ ): image is CarouselImageProps {
19
+ return typeof image !== 'string';
20
+ }
21
+
16
22
  const CarouselItem = ({
17
23
  width,
18
24
  image,
@@ -22,11 +28,17 @@ const CarouselItem = ({
22
28
  }: CarouselItemProps) => {
23
29
  return (
24
30
  <Box style={{ width }}>
25
- {image && (
26
- <StyledCarouselImage
27
- source={typeof image === 'string' ? { uri: image } : image}
28
- />
29
- )}
31
+ {image &&
32
+ (isCarouselImageProps(image) ? (
33
+ <StyledCustomSizeCarouselImage
34
+ source={image}
35
+ height={image.height}
36
+ width={image.width}
37
+ resizeMode={image.resizeMode}
38
+ />
39
+ ) : (
40
+ <StyledCarouselImage source={{ uri: image }} />
41
+ ))}
30
42
 
31
43
  <StyledCarouselContentWrapper
32
44
  paddingHorizontal="large"
@@ -1,9 +1,10 @@
1
- import { View } from 'react-native';
1
+ import { View, ImageResizeMode } from 'react-native';
2
2
  import styled from '@emotion/native';
3
3
  import Typography from '../Typography';
4
4
  import Image from '../Image';
5
5
  import Box from '../Box';
6
6
  import { scale } from '../../utils/scale';
7
+ import PageControl from '../PageControl';
7
8
 
8
9
  const StyledBackDrop = styled(View)<{
9
10
  themeSlideBackground: string;
@@ -35,6 +36,17 @@ const StyledCarouselImage = styled(Image)(() => ({
35
36
  resizeMode: 'contain',
36
37
  }));
37
38
 
39
+ const StyledCustomSizeCarouselImage = styled(Image)<{
40
+ height?: number;
41
+ width?: number;
42
+ resizeMode?: ImageResizeMode;
43
+ }>(({ height, resizeMode = 'contain', width }) => ({
44
+ alignSelf: 'center',
45
+ width,
46
+ height,
47
+ resizeMode,
48
+ }));
49
+
38
50
  const StyledCarouselContentWrapper = styled(Box)<{
39
51
  width: number;
40
52
  }>(({ width }) => ({
@@ -50,6 +62,9 @@ const StyledCarouselFooterWrapper = styled(View)(({ theme }) => ({
50
62
  marginBottom: theme.__hd__.carousel.space.footerMarginBottom,
51
63
  }));
52
64
 
65
+ const StyledPageControl = styled(PageControl)({
66
+ marginStart: 'auto',
67
+ });
53
68
  export {
54
69
  StyledBackDrop,
55
70
  StyledCarouselView,
@@ -57,4 +72,6 @@ export {
57
72
  StyledCarouselImage,
58
73
  StyledCarouselContentWrapper,
59
74
  StyledCarouselFooterWrapper,
75
+ StyledCustomSizeCarouselImage,
76
+ StyledPageControl,
60
77
  };