@hero-design/rn 7.4.0 → 7.5.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 (155) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/assets/fonts/hero-icons.ttf +0 -0
  3. package/es/index.js +4117 -3926
  4. package/lib/assets/fonts/hero-icons.ttf +0 -0
  5. package/lib/index.js +4111 -3919
  6. package/package.json +2 -2
  7. package/playground/package.json +3 -3
  8. package/playground/src/Alert.tsx +80 -0
  9. package/playground/src/App.tsx +6 -0
  10. package/playground/src/MultipleThemes.tsx +34 -0
  11. package/src/components/Alert/StyledAlert.tsx +48 -0
  12. package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +686 -0
  13. package/src/components/Alert/__tests__/index.spec.tsx +83 -0
  14. package/src/components/Alert/index.tsx +109 -0
  15. package/src/components/Icon/HeroIcon/selection.json +1 -1
  16. package/src/components/Icon/IconList.ts +2 -0
  17. package/src/index.ts +2 -0
  18. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +22 -0
  19. package/src/theme/components/alert.ts +32 -0
  20. package/src/theme/global/colors.ts +1 -0
  21. package/src/theme/index.ts +3 -0
  22. package/types/{src/components/Progress/StyledProgressCircle.d.ts → components/Alert/StyledAlert.d.ts} +13 -14
  23. package/types/{src/components/Avatar → components/Alert}/__tests__/index.spec.d.ts +0 -0
  24. package/types/components/Alert/index.d.ts +42 -0
  25. package/types/components/Icon/IconList.d.ts +1 -1
  26. package/types/components/Icon/utils.d.ts +1 -1
  27. package/types/index.d.ts +2 -1
  28. package/types/theme/components/alert.d.ts +23 -0
  29. package/types/theme/global/colors.d.ts +1 -0
  30. package/types/theme/global/index.d.ts +1 -0
  31. package/types/theme/index.d.ts +2 -0
  32. package/.turbo/turbo-build:types.log +0 -2
  33. package/.turbo/turbo-test.log +0 -131
  34. package/.turbo/turbo-type-check.log +0 -7
  35. package/playground/src/Button.tsx~origin_master +0 -170
  36. package/types/playground/components/Avatar.d.ts +0 -2
  37. package/types/playground/components/Badge.d.ts +0 -2
  38. package/types/playground/components/BottomNavigation.d.ts +0 -2
  39. package/types/playground/components/Button.d.ts +0 -2
  40. package/types/playground/components/Card.d.ts +0 -2
  41. package/types/playground/components/Collapse.d.ts +0 -2
  42. package/types/playground/components/Divider.d.ts +0 -2
  43. package/types/playground/components/Drawer.d.ts +0 -2
  44. package/types/playground/components/FAB.d.ts +0 -2
  45. package/types/playground/components/Icon.d.ts +0 -2
  46. package/types/playground/components/IconButton.d.ts +0 -2
  47. package/types/playground/components/Progress.d.ts +0 -2
  48. package/types/playground/components/Tabs.d.ts +0 -2
  49. package/types/playground/components/Tag.d.ts +0 -2
  50. package/types/playground/components/Typography.d.ts +0 -2
  51. package/types/playground/index.d.ts +0 -2
  52. package/types/src/components/Avatar/StyledAvatar.d.ts +0 -46
  53. package/types/src/components/Avatar/__tests__/StyledAvatar.spec.d.ts +0 -1
  54. package/types/src/components/Avatar/index.d.ts +0 -25
  55. package/types/src/components/Badge/Status.d.ts +0 -24
  56. package/types/src/components/Badge/StyledBadge.d.ts +0 -28
  57. package/types/src/components/Badge/__tests__/Badge.spec.d.ts +0 -1
  58. package/types/src/components/Badge/__tests__/Status.spec.d.ts +0 -1
  59. package/types/src/components/Badge/index.d.ts +0 -32
  60. package/types/src/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -52
  61. package/types/src/components/BottomNavigation/__tests__/index.spec.d.ts +0 -1
  62. package/types/src/components/BottomNavigation/index.d.ts +0 -45
  63. package/types/src/components/Button/Button.d.ts +0 -57
  64. package/types/src/components/Button/IconButton.d.ts +0 -34
  65. package/types/src/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -20
  66. package/types/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +0 -1
  67. package/types/src/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +0 -1
  68. package/types/src/components/Button/LoadingIndicator/index.d.ts +0 -26
  69. package/types/src/components/Button/StyledButton.d.ts +0 -40
  70. package/types/src/components/Button/__tests__/Button.spec.d.ts +0 -1
  71. package/types/src/components/Button/__tests__/IconButton.spec.d.ts +0 -1
  72. package/types/src/components/Button/__tests__/StyledButton.spec.d.ts +0 -1
  73. package/types/src/components/Button/__tests__/index.spec.d.ts +0 -1
  74. package/types/src/components/Button/index.d.ts +0 -8
  75. package/types/src/components/Card/StyledCard.d.ts +0 -17
  76. package/types/src/components/Card/__tests__/StyledCard.spec.d.ts +0 -1
  77. package/types/src/components/Card/__tests__/index.spec.d.ts +0 -1
  78. package/types/src/components/Card/index.d.ts +0 -22
  79. package/types/src/components/Collapse/StyledCollapse.d.ts +0 -15
  80. package/types/src/components/Collapse/__tests__/StyledCollapse.spec.d.ts +0 -1
  81. package/types/src/components/Collapse/__tests__/index.spec.d.ts +0 -1
  82. package/types/src/components/Collapse/index.d.ts +0 -23
  83. package/types/src/components/Divider/StyledDivider.d.ts +0 -13
  84. package/types/src/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -1
  85. package/types/src/components/Divider/index.d.ts +0 -21
  86. package/types/src/components/Drawer/StyledDrawer.d.ts +0 -25
  87. package/types/src/components/Drawer/__tests__/index.spec.d.ts +0 -1
  88. package/types/src/components/Drawer/index.d.ts +0 -25
  89. package/types/src/components/FAB/ActionGroup/ActionItem.d.ts +0 -12
  90. package/types/src/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -30
  91. package/types/src/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -13
  92. package/types/src/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -1
  93. package/types/src/components/FAB/ActionGroup/index.d.ts +0 -34
  94. package/types/src/components/FAB/AnimatedFABIcon.d.ts +0 -6
  95. package/types/src/components/FAB/FAB.d.ts +0 -34
  96. package/types/src/components/FAB/StyledFAB.d.ts +0 -20
  97. package/types/src/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -1
  98. package/types/src/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -1
  99. package/types/src/components/FAB/__tests__/index.spec.d.ts +0 -1
  100. package/types/src/components/FAB/index.d.ts +0 -4
  101. package/types/src/components/Icon/HeroIcon/index.d.ts +0 -13
  102. package/types/src/components/Icon/IconList.d.ts +0 -2
  103. package/types/src/components/Icon/__tests__/index.spec.d.ts +0 -1
  104. package/types/src/components/Icon/index.d.ts +0 -27
  105. package/types/src/components/Icon/utils.d.ts +0 -2
  106. package/types/src/components/Progress/ProgressBar.d.ts +0 -18
  107. package/types/src/components/Progress/ProgressCircle.d.ts +0 -18
  108. package/types/src/components/Progress/StyledProgressBar.d.ts +0 -18
  109. package/types/src/components/Progress/__tests__/index.spec.d.ts +0 -1
  110. package/types/src/components/Progress/index.d.ts +0 -5
  111. package/types/src/components/Progress/types.d.ts +0 -1
  112. package/types/src/components/Tabs/ActiveTabIndicator.d.ts +0 -8
  113. package/types/src/components/Tabs/ScrollableTabs.d.ts +0 -3
  114. package/types/src/components/Tabs/StyledScrollableTabs.d.ts +0 -61
  115. package/types/src/components/Tabs/StyledTabs.d.ts +0 -55
  116. package/types/src/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +0 -1
  117. package/types/src/components/Tabs/__tests__/index.spec.d.ts +0 -1
  118. package/types/src/components/Tabs/index.d.ts +0 -54
  119. package/types/src/components/Tabs/utils.d.ts +0 -2
  120. package/types/src/components/Tag/StyledTag.d.ts +0 -20
  121. package/types/src/components/Tag/__tests__/Tag.spec.d.ts +0 -1
  122. package/types/src/components/Tag/index.d.ts +0 -21
  123. package/types/src/components/Typography/Text/StyledText.d.ts +0 -13
  124. package/types/src/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -1
  125. package/types/src/components/Typography/Text/__tests__/index.spec.d.ts +0 -1
  126. package/types/src/components/Typography/Text/index.d.ts +0 -30
  127. package/types/src/components/Typography/index.d.ts +0 -6
  128. package/types/src/index.d.ts +0 -19
  129. package/types/src/testHelpers/renderWithTheme.d.ts +0 -3
  130. package/types/src/theme/__tests__/index.spec.d.ts +0 -1
  131. package/types/src/theme/components/avatar.d.ts +0 -32
  132. package/types/src/theme/components/badge.d.ts +0 -29
  133. package/types/src/theme/components/bottomNavigation.d.ts +0 -23
  134. package/types/src/theme/components/button.d.ts +0 -37
  135. package/types/src/theme/components/card.d.ts +0 -10
  136. package/types/src/theme/components/divider.d.ts +0 -17
  137. package/types/src/theme/components/drawer.d.ts +0 -21
  138. package/types/src/theme/components/fab.d.ts +0 -51
  139. package/types/src/theme/components/icon.d.ts +0 -19
  140. package/types/src/theme/components/progress.d.ts +0 -21
  141. package/types/src/theme/components/tabs.d.ts +0 -27
  142. package/types/src/theme/components/tag.d.ts +0 -30
  143. package/types/src/theme/components/typography.d.ts +0 -26
  144. package/types/src/theme/global/borders.d.ts +0 -11
  145. package/types/src/theme/global/colors.d.ts +0 -31
  146. package/types/src/theme/global/index.d.ts +0 -41
  147. package/types/src/theme/global/scale.d.ts +0 -9
  148. package/types/src/theme/global/space.d.ts +0 -13
  149. package/types/src/theme/global/typography.d.ts +0 -21
  150. package/types/src/theme/index.d.ts +0 -35
  151. package/types/src/types.d.ts +0 -5
  152. package/types/src/utils/__tests__/scale.spec.d.ts +0 -1
  153. package/types/src/utils/helpers.d.ts +0 -2
  154. package/types/src/utils/hooks.d.ts +0 -1
  155. package/types/src/utils/scale.d.ts +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "7.4.0",
3
+ "version": "7.5.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@emotion/native": "^11.9.3",
27
27
  "@emotion/react": "^11.9.3",
28
- "@hero-design/colors": "7.4.0"
28
+ "@hero-design/colors": "7.5.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "17.0.2",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hero-design/playground",
3
3
  "private": true,
4
- "version": "7.4.0",
4
+ "version": "7.5.0",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
7
  "lint": "eslint src expoEntry.js --ext .js,.jsx,.ts,.tsx --ignore-path ../../../.gitignore",
@@ -13,8 +13,8 @@
13
13
  "visual-test": "detox build -c ios.sim.release && detox test -c ios.sim.release"
14
14
  },
15
15
  "dependencies": {
16
- "@hero-design/colors": "7.4.0",
17
- "@hero-design/rn": "7.4.0",
16
+ "@hero-design/colors": "7.5.0",
17
+ "@hero-design/rn": "7.5.0",
18
18
  "@react-native-community/masked-view": "^0.1.11",
19
19
  "@react-navigation/core": "^6.3.0",
20
20
  "@react-navigation/native": "^6.0.12",
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { ScrollView, View } from 'react-native';
3
+ import { Alert, Typography, useTheme } from '@hero-design/rn';
4
+
5
+ const AlertPlayground = (): JSX.Element => {
6
+ const theme = useTheme();
7
+
8
+ return (
9
+ <ScrollView style={{ flex: 1, padding: theme.space.medium }}>
10
+ <Typography.Text>Default variant</Typography.Text>
11
+ <View style={{ paddingVertical: theme.space.medium }}>
12
+ <Alert
13
+ title="Title"
14
+ content="Success"
15
+ intent="success"
16
+ style={{ marginBottom: theme.space.small }}
17
+ onClose={() => alert('Closed')}
18
+ />
19
+ <Alert
20
+ title="Title"
21
+ content="Info"
22
+ intent="info"
23
+ style={{ marginBottom: theme.space.small }}
24
+ onClose={() => alert('Closed')}
25
+ />
26
+ <Alert
27
+ title="Title"
28
+ content="Warning"
29
+ intent="warning"
30
+ style={{ marginBottom: theme.space.small }}
31
+ onClose={() => alert('Closed')}
32
+ />
33
+ <Alert
34
+ title="Title"
35
+ content="Error"
36
+ intent="error"
37
+ style={{ marginBottom: theme.space.small }}
38
+ onClose={() => alert('Closed')}
39
+ />
40
+ </View>
41
+ <Typography.Text>Round variant</Typography.Text>
42
+ <View style={{ paddingVertical: theme.space.medium }}>
43
+ <Alert
44
+ title="Title"
45
+ content="Success"
46
+ intent="success"
47
+ variant="round"
48
+ style={{ marginBottom: theme.space.small }}
49
+ onClose={() => alert('Closed')}
50
+ />
51
+ <Alert
52
+ title="Title"
53
+ content="Info"
54
+ intent="info"
55
+ variant="round"
56
+ style={{ marginBottom: theme.space.small }}
57
+ onClose={() => alert('Closed')}
58
+ />
59
+ <Alert
60
+ title="Title"
61
+ content="Warning"
62
+ intent="warning"
63
+ variant="round"
64
+ style={{ marginBottom: theme.space.small }}
65
+ onClose={() => alert('Closed')}
66
+ />
67
+ <Alert
68
+ title="Title"
69
+ content="Error"
70
+ intent="error"
71
+ variant="round"
72
+ style={{ marginBottom: theme.space.small }}
73
+ onClose={() => alert('Closed')}
74
+ />
75
+ </View>
76
+ </ScrollView>
77
+ );
78
+ };
79
+
80
+ export default AlertPlayground;
@@ -16,6 +16,7 @@ import {
16
16
  Divider,
17
17
  } from '@hero-design/rn';
18
18
 
19
+ import AlertPlayground from './Alert';
19
20
  import AvatarPlayground from './Avatar';
20
21
  import BadgePlayground from './Badge';
21
22
  import BottomNavigation from './BottomNavigation';
@@ -37,6 +38,7 @@ import TabsPlayground from './Tabs';
37
38
  import TagPlayground from './Tag';
38
39
  import TextInputPlayground from './TextInput';
39
40
  import TypographyPlayground from './Typography';
41
+ import MultipleThemesPlayground from './MultipleThemes';
40
42
 
41
43
  const heroIconFontPath = require('@hero-design/rn/assets/fonts/hero-icons.ttf');
42
44
  const beVietnamProLightFont = require('@hero-design/rn/assets/fonts/be-vietnam-pro-light.ttf');
@@ -44,6 +46,7 @@ const beVietnamProRegularFont = require('@hero-design/rn/assets/fonts/be-vietnam
44
46
  const beVietnamProSemiBoldFont = require('@hero-design/rn/assets/fonts/be-vietnam-pro-semibold.ttf');
45
47
 
46
48
  type RootStackParamList = {
49
+ Alert: undefined;
47
50
  Avatar: undefined;
48
51
  Badge: undefined;
49
52
  BottomNavigation: undefined;
@@ -66,6 +69,7 @@ type RootStackParamList = {
66
69
  Tag: undefined;
67
70
  TextInput: undefined;
68
71
  Typography: undefined;
72
+ MultipleThemes: undefined;
69
73
  };
70
74
 
71
75
  type Navigation = NativeStackScreenProps<RootStackParamList>;
@@ -73,6 +77,7 @@ type Navigation = NativeStackScreenProps<RootStackParamList>;
73
77
  const Stack = createNativeStackNavigator<RootStackParamList>();
74
78
 
75
79
  const components = [
80
+ { name: 'Alert', component: AlertPlayground },
76
81
  { name: 'Avatar', component: AvatarPlayground },
77
82
  { name: 'Badge', component: BadgePlayground },
78
83
  { name: 'BottomNavigation', component: BottomNavigation },
@@ -94,6 +99,7 @@ const components = [
94
99
  { name: 'Tag', component: TagPlayground },
95
100
  { name: 'TextInput', component: TextInputPlayground },
96
101
  { name: 'Typography', component: TypographyPlayground },
102
+ { name: 'MultipleThemes', component: MultipleThemesPlayground },
97
103
  ] as const;
98
104
 
99
105
  const ComponentItem = ({ name }: { name: string }): JSX.Element => {
@@ -0,0 +1,34 @@
1
+ import { ThemeProvider, theme, Button } from '@hero-design/rn';
2
+
3
+ import React from 'react';
4
+ import { Alert } from 'react-native';
5
+
6
+ const CustomizedTheme = {
7
+ ...theme,
8
+ __hd__: {
9
+ ...theme.__hd__,
10
+ button: {
11
+ ...theme.__hd__.button,
12
+ colors: {
13
+ ...theme.__hd__.button.colors,
14
+ primary: '#000000',
15
+ },
16
+ },
17
+ },
18
+ };
19
+ const MutipleThemesPlayground = () => (
20
+ <>
21
+ <Button
22
+ text="Button with Origin theme"
23
+ onPress={() => Alert.alert('Button')}
24
+ />
25
+ <ThemeProvider theme={CustomizedTheme}>
26
+ <Button
27
+ text="Button with Customized theme"
28
+ onPress={() => Alert.alert('Button')}
29
+ />
30
+ </ThemeProvider>
31
+ </>
32
+ );
33
+
34
+ export default MutipleThemesPlayground;
@@ -0,0 +1,48 @@
1
+ import styled from '@emotion/native';
2
+ import { ComponentProps } from 'react';
3
+ import { TouchableOpacity, View, ViewProps } from 'react-native';
4
+
5
+ const Container = styled(View)<{
6
+ themeVariant: 'default' | 'round';
7
+ themeIntent: 'success' | 'info' | 'warning' | 'error';
8
+ }>(({ theme, themeVariant = 'default', themeIntent }) => ({
9
+ borderRadius: themeVariant === 'round' ? theme.__hd__.alert.radii.default : 0,
10
+ backgroundColor: theme.__hd__.alert.colors[themeIntent],
11
+ minHeight: theme.__hd__.alert.sizes.height,
12
+ flexDirection: 'row',
13
+ }));
14
+
15
+ const IconContainer = styled(View)<ViewProps>(({ theme }) => ({
16
+ alignItems: 'center',
17
+ paddingLeft: theme.__hd__.alert.space.padding,
18
+ }));
19
+
20
+ const TextContainer = styled(View)<ViewProps>(({ theme }) => ({
21
+ paddingHorizontal: theme.__hd__.alert.space.padding,
22
+ flex: 1,
23
+ }));
24
+
25
+ const ContentContainer = styled(View)<{ showDivider: boolean }>(
26
+ ({ theme, showDivider }) => ({
27
+ paddingVertical: theme.__hd__.alert.space.padding,
28
+ flex: 1,
29
+ borderRightWidth: showDivider ? theme.__hd__.alert.borderWidths.base : 0,
30
+ borderColor: theme.__hd__.alert.colors.divider,
31
+ flexDirection: 'row',
32
+ })
33
+ );
34
+
35
+ const CTAWrapper = styled(TouchableOpacity)<
36
+ ComponentProps<typeof TouchableOpacity>
37
+ >(({ theme }) => ({
38
+ paddingHorizontal: theme.__hd__.alert.space.padding,
39
+ justifyContent: 'center',
40
+ }));
41
+
42
+ export {
43
+ Container,
44
+ ContentContainer,
45
+ TextContainer,
46
+ IconContainer,
47
+ CTAWrapper,
48
+ };