@hero-design/rn 7.7.0 → 7.9.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 (221) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/es/index.js +1775 -333
  3. package/lib/index.js +1780 -336
  4. package/package.json +4 -8
  5. package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  6. package/src/components/Avatar/index.tsx +1 -1
  7. package/src/components/Button/Button.tsx +4 -2
  8. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +7 -2
  9. package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +2 -0
  10. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +40 -0
  11. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +242 -0
  12. package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +2 -0
  13. package/src/components/Button/LoadingIndicator/index.tsx +3 -1
  14. package/src/components/Button/StyledButton.tsx +15 -2
  15. package/src/components/Button/__tests__/Button.spec.tsx +2 -0
  16. package/src/components/Button/__tests__/StyledButton.spec.tsx +12 -0
  17. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +314 -0
  18. package/src/components/Card/DataCard/StyledDataCard.tsx +18 -0
  19. package/src/components/Card/DataCard/__tests__/StyledDataCard.spec.tsx +24 -0
  20. package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +96 -0
  21. package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +151 -0
  22. package/src/components/Card/DataCard/__tests__/index.spec.tsx +30 -0
  23. package/src/components/Card/DataCard/index.tsx +35 -0
  24. package/src/components/Card/StyledCard.tsx +1 -3
  25. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +0 -1
  26. package/src/components/Card/index.tsx +7 -2
  27. package/src/components/Checkbox/index.tsx +1 -1
  28. package/src/components/Collapse/index.tsx +1 -1
  29. package/src/components/Icon/HeroIcon/index.tsx +3 -1
  30. package/src/components/Icon/index.tsx +3 -2
  31. package/src/components/List/BasicListItem.tsx +98 -0
  32. package/src/components/List/ListItem.tsx +142 -0
  33. package/src/components/List/StyledBasicListItem.tsx +34 -0
  34. package/src/components/List/StyledListItem.tsx +82 -0
  35. package/src/components/List/__tests__/BasicListItem.spec.tsx +37 -0
  36. package/src/components/List/__tests__/ListItem.spec.tsx +110 -0
  37. package/src/components/List/__tests__/StyledBasicListItem.spec.tsx +24 -0
  38. package/src/components/List/__tests__/StyledListItem.spec.tsx +48 -0
  39. package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +103 -0
  40. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +760 -0
  41. package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +105 -0
  42. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +200 -0
  43. package/src/components/List/index.tsx +14 -0
  44. package/src/components/SectionHeading/index.tsx +1 -1
  45. package/src/components/Select/Footer.tsx +13 -0
  46. package/src/components/Select/MultiSelect/Option.tsx +25 -0
  47. package/src/components/Select/MultiSelect/OptionList.tsx +30 -63
  48. package/src/components/Select/MultiSelect/__tests__/Option.spec.tsx +16 -0
  49. package/src/components/Select/MultiSelect/__tests__/OptionList.spec.tsx +42 -0
  50. package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +70 -0
  51. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +627 -0
  52. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +6 -6
  53. package/src/components/Select/MultiSelect/index.tsx +8 -7
  54. package/src/components/Select/SingleSelect/Option.tsx +23 -0
  55. package/src/components/Select/SingleSelect/OptionList.tsx +43 -0
  56. package/src/components/Select/SingleSelect/__tests__/Option.spec.tsx +16 -0
  57. package/src/components/Select/SingleSelect/__tests__/OptionList.spec.tsx +42 -0
  58. package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +56 -0
  59. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +571 -0
  60. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +1430 -0
  61. package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +89 -0
  62. package/src/components/Select/SingleSelect/index.tsx +89 -0
  63. package/src/components/Select/{MultiSelect/StyledMultiSelect.tsx → StyledSelect.tsx} +1 -1
  64. package/src/components/Select/{MultiSelect/__tests__/StyledMultiSelect.spec.tsx → __tests__/StyledSelect.spec.tsx} +2 -2
  65. package/src/components/Select/{MultiSelect/__tests__/__snapshots__/StyledMultiSelect.spec.tsx.snap → __tests__/__snapshots__/StyledSelect.spec.tsx.snap} +0 -0
  66. package/src/components/Select/helpers.tsx +18 -0
  67. package/src/components/Select/index.tsx +4 -3
  68. package/src/components/Select/{MultiSelect/types.ts → types.ts} +0 -0
  69. package/src/components/Switch/index.tsx +1 -1
  70. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +2 -2
  71. package/src/components/Toolbar/StyledToolbar.tsx +42 -0
  72. package/src/components/Toolbar/ToolbarGroup.tsx +31 -0
  73. package/src/components/Toolbar/ToolbarItem.tsx +57 -0
  74. package/src/components/Toolbar/__tests__/ToolbarGroup.spec.tsx +32 -0
  75. package/src/components/Toolbar/__tests__/ToolbarItem.spec.tsx +57 -0
  76. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +391 -0
  77. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +355 -0
  78. package/src/components/Toolbar/index.tsx +18 -0
  79. package/src/components/Typography/Text/StyledText.tsx +8 -1
  80. package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +5 -0
  81. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +110 -0
  82. package/src/components/Typography/Text/index.tsx +9 -2
  83. package/src/index.ts +4 -0
  84. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +83 -3
  85. package/src/theme/components/button.ts +2 -0
  86. package/src/theme/components/card.ts +13 -2
  87. package/src/theme/components/icon.ts +1 -0
  88. package/src/theme/components/list.ts +46 -0
  89. package/src/theme/components/toolbar.ts +27 -0
  90. package/src/theme/components/typography.ts +4 -0
  91. package/src/theme/global/colors.ts +9 -2
  92. package/src/theme/global/space.ts +2 -0
  93. package/src/theme/index.ts +6 -0
  94. package/tsconfig.json +1 -2
  95. package/types/components/Avatar/index.d.ts +1 -1
  96. package/types/components/Button/Button.d.ts +2 -2
  97. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
  98. package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
  99. package/types/components/Button/StyledButton.d.ts +2 -2
  100. package/types/components/Card/DataCard/StyledDataCard.d.ts +16 -0
  101. package/types/components/{Select/MultiSelect/__tests__/StyledMultiSelect.spec.d.ts → Card/DataCard/__tests__/StyledDataCard.spec.d.ts} +0 -0
  102. package/types/components/Card/DataCard/__tests__/index.spec.d.ts +1 -0
  103. package/types/components/Card/DataCard/index.d.ts +22 -0
  104. package/types/components/Card/index.d.ts +7 -3
  105. package/types/components/Checkbox/index.d.ts +1 -1
  106. package/types/components/Collapse/index.d.ts +1 -1
  107. package/types/components/Icon/HeroIcon/index.d.ts +1 -1
  108. package/types/components/Icon/index.d.ts +2 -2
  109. package/types/components/List/BasicListItem.d.ts +43 -0
  110. package/types/components/List/ListItem.d.ts +51 -0
  111. package/types/components/List/StyledBasicListItem.d.ts +29 -0
  112. package/types/components/List/StyledListItem.d.ts +51 -0
  113. package/types/components/List/__tests__/BasicListItem.spec.d.ts +1 -0
  114. package/types/components/List/__tests__/ListItem.spec.d.ts +1 -0
  115. package/types/components/List/__tests__/StyledBasicListItem.spec.d.ts +1 -0
  116. package/types/components/List/__tests__/StyledListItem.spec.d.ts +1 -0
  117. package/types/components/List/index.d.ts +8 -0
  118. package/types/components/SectionHeading/index.d.ts +1 -1
  119. package/types/components/Select/{MultiSelect/Footer.d.ts → Footer.d.ts} +2 -2
  120. package/types/components/Select/MultiSelect/Option.d.ts +6 -0
  121. package/types/components/Select/MultiSelect/OptionList.d.ts +7 -1
  122. package/types/components/Select/MultiSelect/__tests__/Option.spec.d.ts +1 -0
  123. package/types/components/Select/MultiSelect/__tests__/OptionList.spec.d.ts +1 -0
  124. package/types/components/Select/MultiSelect/index.d.ts +4 -4
  125. package/types/components/Select/SingleSelect/Option.d.ts +6 -0
  126. package/types/components/Select/SingleSelect/OptionList.d.ts +9 -0
  127. package/types/components/Select/SingleSelect/__tests__/Option.spec.d.ts +1 -0
  128. package/types/components/Select/SingleSelect/__tests__/OptionList.spec.d.ts +1 -0
  129. package/types/components/Select/SingleSelect/__tests__/index.spec.d.ts +1 -0
  130. package/types/components/Select/SingleSelect/index.d.ts +35 -0
  131. package/types/components/Select/{MultiSelect/StyledMultiSelect.d.ts → StyledSelect.d.ts} +1 -1
  132. package/types/components/Select/__tests__/StyledSelect.spec.d.ts +1 -0
  133. package/types/components/Select/helpers.d.ts +2 -0
  134. package/types/components/Select/index.d.ts +3 -3
  135. package/types/components/Select/{MultiSelect/types.d.ts → types.d.ts} +0 -0
  136. package/types/components/Switch/index.d.ts +1 -1
  137. package/types/components/Toolbar/StyledToolbar.d.ts +22 -0
  138. package/types/components/Toolbar/ToolbarGroup.d.ts +13 -0
  139. package/types/components/Toolbar/ToolbarItem.d.ts +25 -0
  140. package/types/components/Toolbar/__tests__/ToolbarGroup.spec.d.ts +1 -0
  141. package/types/components/Toolbar/__tests__/ToolbarItem.spec.d.ts +1 -0
  142. package/types/components/Toolbar/index.d.ts +11 -0
  143. package/types/components/Typography/Text/StyledText.d.ts +1 -1
  144. package/types/components/Typography/Text/index.d.ts +2 -2
  145. package/types/index.d.ts +3 -1
  146. package/types/theme/components/button.d.ts +2 -0
  147. package/types/theme/components/card.d.ts +10 -0
  148. package/types/theme/components/icon.d.ts +1 -0
  149. package/types/theme/components/list.d.ts +40 -0
  150. package/types/theme/components/toolbar.d.ts +21 -0
  151. package/types/theme/components/typography.d.ts +4 -0
  152. package/types/theme/global/colors.d.ts +5 -0
  153. package/types/theme/global/index.d.ts +5 -0
  154. package/types/theme/global/space.d.ts +1 -0
  155. package/types/theme/index.d.ts +4 -0
  156. package/playground/.detoxrc.json +0 -49
  157. package/playground/.prettierrc.json +0 -8
  158. package/playground/.turbo/turbo-type-check.log +0 -7
  159. package/playground/app.json +0 -9
  160. package/playground/babel.config.js +0 -63
  161. package/playground/e2e/config.json +0 -9
  162. package/playground/e2e/environment.js +0 -23
  163. package/playground/e2e/firstTest.e2e.js +0 -16
  164. package/playground/expoEntry.js +0 -5
  165. package/playground/fonts/be-vietnam-pro-light.ttf +0 -0
  166. package/playground/fonts/be-vietnam-pro-regular.ttf +0 -0
  167. package/playground/fonts/be-vietnam-pro-semibold.ttf +0 -0
  168. package/playground/fonts/hero-icons.ttf +0 -0
  169. package/playground/index.js +0 -7
  170. package/playground/ios/MobileHeroDesignPlayground/AppDelegate.h +0 -9
  171. package/playground/ios/MobileHeroDesignPlayground/AppDelegate.m +0 -75
  172. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/AppIcon.appiconset/Contents.json +0 -38
  173. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/Contents.json +0 -6
  174. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/Contents.json +0 -21
  175. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
  176. package/playground/ios/MobileHeroDesignPlayground/Info.plist +0 -85
  177. package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground-Bridging-Header.h +0 -3
  178. package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground.entitlements +0 -8
  179. package/playground/ios/MobileHeroDesignPlayground/SplashScreen.storyboard +0 -40
  180. package/playground/ios/MobileHeroDesignPlayground/Supporting/Expo.plist +0 -16
  181. package/playground/ios/MobileHeroDesignPlayground/main.m +0 -10
  182. package/playground/ios/MobileHeroDesignPlayground/noop-file.swift +0 -4
  183. package/playground/ios/MobileHeroDesignPlayground.xcodeproj/project.pbxproj +0 -515
  184. package/playground/ios/MobileHeroDesignPlayground.xcodeproj/xcshareddata/xcschemes/MobileHeroDesignPlayground.xcscheme +0 -88
  185. package/playground/ios/MobileHeroDesignPlayground.xcworkspace/contents.xcworkspacedata +0 -10
  186. package/playground/ios/MobileHeroDesignPlayground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  187. package/playground/ios/Podfile +0 -49
  188. package/playground/ios/Podfile.lock +0 -478
  189. package/playground/ios/Podfile.properties.json +0 -3
  190. package/playground/metro.config.js +0 -24
  191. package/playground/package.json +0 -63
  192. package/playground/src/Alert.tsx +0 -80
  193. package/playground/src/App.tsx +0 -210
  194. package/playground/src/Avatar.tsx +0 -102
  195. package/playground/src/Badge.tsx +0 -187
  196. package/playground/src/BottomNavigation.tsx +0 -72
  197. package/playground/src/BottomSheet.tsx +0 -43
  198. package/playground/src/Button.tsx +0 -170
  199. package/playground/src/Card.tsx +0 -342
  200. package/playground/src/Checkbox.tsx +0 -55
  201. package/playground/src/Collapse.tsx +0 -99
  202. package/playground/src/ContentNavigator.tsx +0 -58
  203. package/playground/src/Divider.tsx +0 -13
  204. package/playground/src/Drawer.tsx +0 -32
  205. package/playground/src/FAB.tsx +0 -66
  206. package/playground/src/Icon.tsx +0 -144
  207. package/playground/src/IconButton.tsx +0 -78
  208. package/playground/src/MultipleThemes.tsx +0 -34
  209. package/playground/src/Progress.tsx +0 -95
  210. package/playground/src/Radio.tsx +0 -25
  211. package/playground/src/SectionHeading.tsx +0 -68
  212. package/playground/src/Select.tsx +0 -32
  213. package/playground/src/Spinner.tsx +0 -19
  214. package/playground/src/Switch.tsx +0 -80
  215. package/playground/src/Tabs.tsx +0 -136
  216. package/playground/src/Tag.tsx +0 -45
  217. package/playground/src/TextInput.tsx +0 -14
  218. package/playground/src/Toast.tsx +0 -114
  219. package/playground/src/Typography.tsx +0 -23
  220. package/playground/tsconfig.json +0 -21
  221. package/src/components/Select/MultiSelect/Footer.tsx +0 -15
@@ -1,210 +0,0 @@
1
- import React from 'react';
2
- /* eslint-disable import/no-extraneous-dependencies */
3
- import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
4
- import {
5
- createNativeStackNavigator,
6
- NativeStackScreenProps,
7
- } from '@react-navigation/native-stack';
8
- import { loadAsync } from 'expo-font';
9
- import { SafeAreaView, FlatList, View, TouchableOpacity } from 'react-native';
10
- import {
11
- ThemeProvider,
12
- theme,
13
- useTheme,
14
- Typography,
15
- Icon,
16
- Divider,
17
- } from '@hero-design/rn';
18
-
19
- import AlertPlayground from './Alert';
20
- import AvatarPlayground from './Avatar';
21
- import BadgePlayground from './Badge';
22
- import BottomNavigation from './BottomNavigation';
23
- import BottomSheet from './BottomSheet';
24
- import Button from './Button';
25
- import CardPlayground from './Card';
26
- import CollapsePlayground from './Collapse';
27
- import CheckboxPlayground from './Checkbox';
28
- import ContentNavigatorPlayground from './ContentNavigator';
29
- import DividerPlayground from './Divider';
30
- import DrawerPlayground from './Drawer';
31
- import FABPlayground from './FAB';
32
- import IconPlayground from './Icon';
33
- import IconButtonPlayground from './IconButton';
34
- import ProgressPlayground from './Progress';
35
- import SpinnerPlayground from './Spinner';
36
- import SectionHeadingPlayground from './SectionHeading';
37
- import RadioPlayground from './Radio';
38
- import SelectPlayground from './Select';
39
- import SwitchPlayground from './Switch';
40
- import TabsPlayground from './Tabs';
41
- import TagPlayground from './Tag';
42
- import TextInputPlayground from './TextInput';
43
- import ToastPlayground from './Toast';
44
- import TypographyPlayground from './Typography';
45
- import MultipleThemesPlayground from './MultipleThemes';
46
-
47
- const heroIconFontPath = require('@hero-design/rn/assets/fonts/hero-icons.ttf');
48
- const beVietnamProLightFont = require('@hero-design/rn/assets/fonts/be-vietnam-pro-light.ttf');
49
- const beVietnamProRegularFont = require('@hero-design/rn/assets/fonts/be-vietnam-pro-regular.ttf');
50
- const beVietnamProSemiBoldFont = require('@hero-design/rn/assets/fonts/be-vietnam-pro-semibold.ttf');
51
-
52
- type RootStackParamList = {
53
- Alert: undefined;
54
- Avatar: undefined;
55
- Badge: undefined;
56
- BottomNavigation: undefined;
57
- BottomSheet: undefined;
58
- Button: undefined;
59
- Card: undefined;
60
- Collapse: undefined;
61
- Checkbox: undefined;
62
- ContentNavigator: undefined;
63
- Divider: undefined;
64
- Drawer: undefined;
65
- FAB: undefined;
66
- Home: undefined;
67
- Icon: undefined;
68
- IconButton: undefined;
69
- Progress: undefined;
70
- Spinner: undefined;
71
- Radio: undefined;
72
- SectionHeading: undefined;
73
- Select: undefined;
74
- Switch: undefined;
75
- Tabs: undefined;
76
- Tag: undefined;
77
- TextInput: undefined;
78
- Toast: undefined;
79
- Typography: undefined;
80
- MultipleThemes: undefined;
81
- };
82
-
83
- type Navigation = NativeStackScreenProps<RootStackParamList>;
84
-
85
- const Stack = createNativeStackNavigator<RootStackParamList>();
86
-
87
- const components = [
88
- { name: 'Alert', component: AlertPlayground },
89
- { name: 'Avatar', component: AvatarPlayground },
90
- { name: 'Badge', component: BadgePlayground },
91
- { name: 'BottomNavigation', component: BottomNavigation },
92
- { name: 'BottomSheet', component: BottomSheet },
93
- { name: 'Button', component: Button },
94
- { name: 'Card', component: CardPlayground },
95
- { name: 'Collapse', component: CollapsePlayground },
96
- { name: 'Checkbox', component: CheckboxPlayground },
97
- { name: 'ContentNavigator', component: ContentNavigatorPlayground },
98
- { name: 'Divider', component: DividerPlayground },
99
- { name: 'Drawer', component: DrawerPlayground },
100
- { name: 'FAB', component: FABPlayground },
101
- { name: 'Icon', component: IconPlayground },
102
- { name: 'IconButton', component: IconButtonPlayground },
103
- { name: 'Progress', component: ProgressPlayground },
104
- { name: 'Spinner', component: SpinnerPlayground },
105
- { name: 'Radio', component: RadioPlayground },
106
- { name: 'SectionHeading', component: SectionHeadingPlayground },
107
- { name: 'Select', component: SelectPlayground },
108
- { name: 'Switch', component: SwitchPlayground },
109
- { name: 'Tabs', component: TabsPlayground },
110
- { name: 'Tag', component: TagPlayground },
111
- { name: 'TextInput', component: TextInputPlayground },
112
- { name: 'Toast', component: ToastPlayground },
113
- { name: 'Typography', component: TypographyPlayground },
114
- { name: 'MultipleThemes', component: MultipleThemesPlayground },
115
- ] as const;
116
-
117
- const ComponentItem = ({ name }: { name: string }): JSX.Element => {
118
- const hdTheme = useTheme();
119
-
120
- return (
121
- <View
122
- style={{
123
- flex: 1,
124
- flexDirection: 'row',
125
- alignItems: 'center',
126
- justifyContent: 'space-between',
127
- marginHorizontal: hdTheme.space.medium,
128
- marginVertical: hdTheme.space.medium,
129
- }}
130
- >
131
- <Typography.Text fontSize="large">{name}</Typography.Text>
132
- <Icon
133
- icon="arrow-right"
134
- size="small"
135
- style={{ color: hdTheme.colors.disabledText }}
136
- />
137
- </View>
138
- );
139
- };
140
-
141
- const ComponentList = ({ navigation }: Navigation) => (
142
- <SafeAreaView>
143
- <FlatList
144
- data={components}
145
- renderItem={({ item }) => (
146
- <>
147
- {/* work around to make ts-ignore work inside return component
148
- // @ts-ignore */}
149
- <TouchableOpacity onPress={() => navigation.navigate(item.name)}>
150
- <ComponentItem name={item.name} />
151
- </TouchableOpacity>
152
- <Divider marginHorizontal="small" />
153
- </>
154
- )}
155
- />
156
- </SafeAreaView>
157
- );
158
-
159
- const App = () => {
160
- const CustomNavigationTheme = {
161
- ...DefaultTheme,
162
- colors: {
163
- ...DefaultTheme.colors,
164
- primary: theme.colors.primary,
165
- background: theme.colors.platformBackground,
166
- },
167
- };
168
- const [fontsLoaded, setFontsLoaded] = React.useState(false);
169
-
170
- React.useEffect(() => {
171
- async function loadFonts() {
172
- await loadAsync({
173
- 'hero-icons': heroIconFontPath,
174
- 'BeVietnamPro-Light': beVietnamProLightFont,
175
- 'BeVietnamPro-Regular': beVietnamProRegularFont,
176
- 'BeVietnamPro-SemiBold': beVietnamProSemiBoldFont,
177
- }).catch(console.error);
178
-
179
- setFontsLoaded(true);
180
- }
181
-
182
- loadFonts();
183
- }, []);
184
-
185
- if (!fontsLoaded) {
186
- return null;
187
- }
188
- return (
189
- <ThemeProvider theme={theme}>
190
- <NavigationContainer theme={CustomNavigationTheme}>
191
- <Stack.Navigator initialRouteName="Home">
192
- <Stack.Screen
193
- name="Home"
194
- component={ComponentList}
195
- options={{ title: 'Mobile Hero Design' }}
196
- />
197
- {components.map(component => (
198
- <Stack.Screen
199
- key={component.name}
200
- name={component.name}
201
- component={component.component}
202
- />
203
- ))}
204
- </Stack.Navigator>
205
- </NavigationContainer>
206
- </ThemeProvider>
207
- );
208
- };
209
-
210
- export default App;
@@ -1,102 +0,0 @@
1
- import React from 'react';
2
- import { Alert, View } from 'react-native';
3
- import { Avatar, Typography, useTheme } from '@hero-design/rn';
4
-
5
- const AvatarPlayground = () => {
6
- const theme = useTheme();
7
- const source = { uri: 'https://i.pravatar.cc/300' };
8
- const text = 'MD';
9
-
10
- const createTwoButtonAlert = () =>
11
- Alert.alert('Alert Title', 'My Alert Msg', [
12
- {
13
- text: 'Cancel',
14
- onPress: () => {},
15
- style: 'cancel',
16
- },
17
- { text: 'OK', onPress: () => {} },
18
- ]);
19
-
20
- return (
21
- <View
22
- style={{
23
- marginVertical: theme.space.medium,
24
- marginHorizontal: theme.space.medium,
25
- }}
26
- >
27
- <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
28
- Avatar with different sizes
29
- </Typography.Text>
30
- <View
31
- style={{
32
- flexDirection: 'row',
33
- marginBottom: theme.space.large,
34
- alignItems: 'flex-end',
35
- }}
36
- >
37
- <Avatar source={source} />
38
- <Avatar
39
- source={source}
40
- size="medium"
41
- style={{ marginLeft: theme.space.xsmall }}
42
- />
43
- <Avatar
44
- source={source}
45
- size="large"
46
- style={{ marginLeft: theme.space.xsmall }}
47
- />
48
- <Avatar
49
- source={source}
50
- size="xlarge"
51
- style={{ marginLeft: theme.space.xsmall }}
52
- />
53
- </View>
54
-
55
- <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
56
- Text Avatar with different sizes
57
- </Typography.Text>
58
- <View
59
- style={{
60
- flexDirection: 'row',
61
- marginBottom: theme.space.large,
62
- alignItems: 'flex-end',
63
- }}
64
- >
65
- <Avatar title={text} />
66
- <Avatar
67
- title={text}
68
- size="medium"
69
- intent="info"
70
- style={{ marginLeft: theme.space.xsmall }}
71
- />
72
- <Avatar
73
- title={text}
74
- size="large"
75
- intent="success"
76
- style={{ marginLeft: theme.space.xsmall }}
77
- />
78
- <Avatar
79
- title={text}
80
- size="xlarge"
81
- intent="danger"
82
- style={{ marginLeft: theme.space.xsmall }}
83
- />
84
- </View>
85
-
86
- <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
87
- Pressable avatar
88
- </Typography.Text>
89
- <View
90
- style={{
91
- flexDirection: 'row',
92
- marginBottom: theme.space.large,
93
- alignItems: 'flex-end',
94
- }}
95
- >
96
- <Avatar source={source} onPress={createTwoButtonAlert} size="large" />
97
- </View>
98
- </View>
99
- );
100
- };
101
-
102
- export default AvatarPlayground;
@@ -1,187 +0,0 @@
1
- import React from 'react';
2
- import { Button, View } from 'react-native';
3
- import { Badge, Icon, Typography, useTheme } from '@hero-design/rn';
4
-
5
- const BadgePlayground = () => {
6
- const theme = useTheme();
7
- const [isVisibleBadge, setIsVisibleBadge] = React.useState(true);
8
- const [isVisibleStatusBadge, setIsVisibleStatusBadge] = React.useState(true);
9
-
10
- return (
11
- <View style={{ margin: theme.space.medium }}>
12
- <Typography.Text fontWeight="semi-bold">Standalone</Typography.Text>
13
- <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
14
- Text
15
- </Typography.Text>
16
- <View
17
- style={{
18
- display: 'flex',
19
- flexDirection: 'row',
20
- marginBottom: theme.space.small,
21
- }}
22
- >
23
- <Badge
24
- content="APPROVED"
25
- intent="success"
26
- style={{ marginEnd: theme.space.small }}
27
- />
28
- <Badge
29
- content="PENDING"
30
- intent="warning"
31
- style={{ marginEnd: theme.space.small }}
32
- />
33
- </View>
34
- <View
35
- style={{
36
- display: 'flex',
37
- flexDirection: 'row',
38
- marginBottom: theme.space.small,
39
- }}
40
- >
41
- <Badge
42
- content="DECLINED"
43
- intent="danger"
44
- style={{ marginEnd: theme.space.small }}
45
- />
46
- <Badge
47
- content="SUBMITTED"
48
- intent="info"
49
- style={{ marginEnd: theme.space.small }}
50
- />
51
- <Badge
52
- content="ARCHIVED"
53
- intent="archived"
54
- style={{ marginEnd: theme.space.small }}
55
- />
56
- </View>
57
-
58
- <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
59
- Number
60
- </Typography.Text>
61
- <View
62
- style={{
63
- display: 'flex',
64
- flexDirection: 'row',
65
- marginBottom: theme.space.small,
66
- }}
67
- >
68
- <Badge content={9} style={{ marginEnd: theme.space.small }} />
69
- <Badge content={99} style={{ marginEnd: theme.space.small }} />
70
- <Badge content={100} />
71
- </View>
72
- <View
73
- style={{
74
- display: 'flex',
75
- flexDirection: 'row',
76
- marginBottom: theme.space.large,
77
- }}
78
- >
79
- <Badge
80
- content={9}
81
- style={{ marginEnd: theme.space.small }}
82
- intent="success"
83
- />
84
- <Badge
85
- content={9}
86
- max={5}
87
- style={{ marginEnd: theme.space.small }}
88
- intent="warning"
89
- />
90
- <Badge
91
- content={90}
92
- max={80}
93
- intent="danger"
94
- style={{ marginEnd: theme.space.small }}
95
- />
96
- <Badge
97
- content={99}
98
- intent="info"
99
- style={{ marginEnd: theme.space.small }}
100
- />
101
- <Badge max={999} content={1000} intent="archived" />
102
- </View>
103
- <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
104
- Visible Badge
105
- </Typography.Text>
106
- <View
107
- style={{
108
- display: 'flex',
109
- flexDirection: 'row',
110
- marginBottom: theme.space.large,
111
- }}
112
- >
113
- <View
114
- style={{
115
- display: 'flex',
116
- flexDirection: 'row',
117
- alignItems: 'center',
118
- marginEnd: theme.space.medium,
119
- }}
120
- >
121
- <Typography.Text style={{ marginEnd: theme.space.small }}>
122
- Notes
123
- </Typography.Text>
124
- <Badge content={1} intent="archived" visible={isVisibleBadge} />
125
- </View>
126
- <Button
127
- title="Click"
128
- onPress={() => setIsVisibleBadge(visible => !visible)}
129
- />
130
- </View>
131
-
132
- <Typography.Text fontWeight="semi-bold">Status</Typography.Text>
133
- <View
134
- style={{
135
- display: 'flex',
136
- flexDirection: 'row',
137
- marginBottom: theme.space.small,
138
- }}
139
- >
140
- <Badge.Status style={{ marginEnd: theme.space.small }}>
141
- <Icon icon="bell" size="small" />
142
- </Badge.Status>
143
- <Badge.Status intent="warning" style={{ marginEnd: theme.space.small }}>
144
- <Icon icon="bell" size="small" />
145
- </Badge.Status>
146
- <Badge.Status intent="info" style={{ marginEnd: theme.space.small }}>
147
- <Icon icon="bell" size="small" />
148
- </Badge.Status>
149
- <Badge.Status intent="success" style={{ marginEnd: theme.space.small }}>
150
- <Icon icon="bell" size="small" />
151
- </Badge.Status>
152
- <Badge.Status
153
- intent="archived"
154
- style={{ marginEnd: theme.space.small }}
155
- >
156
- <Icon icon="bell" size="small" />
157
- </Badge.Status>
158
- <Badge.Status style={{ marginEnd: theme.space.small }}>
159
- <Typography.Text>Activity</Typography.Text>
160
- </Badge.Status>
161
- </View>
162
- <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
163
- Visible Status Badge
164
- </Typography.Text>
165
- <View
166
- style={{
167
- display: 'flex',
168
- flexDirection: 'row',
169
- alignItems: 'center',
170
- }}
171
- >
172
- <Badge.Status
173
- visible={isVisibleStatusBadge}
174
- style={{ marginEnd: theme.space.small }}
175
- >
176
- <Typography.Text>Activity</Typography.Text>
177
- </Badge.Status>
178
- <Button
179
- title="Click"
180
- onPress={() => setIsVisibleStatusBadge(visible => !visible)}
181
- />
182
- </View>
183
- </View>
184
- );
185
- };
186
-
187
- export default BadgePlayground;
@@ -1,72 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import {
4
- BottomNavigation,
5
- Typography,
6
- BottomNavigationTabType,
7
- } from '@hero-design/rn';
8
-
9
- const HomeScreen = () => (
10
- <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
11
- <Typography.Text>Home Screen</Typography.Text>
12
- </View>
13
- );
14
-
15
- const FeedScreen = () => (
16
- <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
17
- <Typography.Text>Feed Screen</Typography.Text>
18
- </View>
19
- );
20
-
21
- const AlertsScreen = () => (
22
- <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
23
- <Typography.Text>Alerts Screen</Typography.Text>
24
- </View>
25
- );
26
-
27
- const ProfileScreen = () => (
28
- <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
29
- <Typography.Text>Profile Screen</Typography.Text>
30
- </View>
31
- );
32
-
33
- const tabs: BottomNavigationTabType[] = [
34
- {
35
- key: 'home',
36
- title: 'Home',
37
- icon: 'home',
38
- component: <HomeScreen />,
39
- },
40
- {
41
- key: 'feed',
42
- title: 'Feed',
43
- icon: 'speaker',
44
- component: <FeedScreen />,
45
- },
46
- {
47
- key: 'alerts',
48
- title: 'Alerts',
49
- icon: 'bell',
50
- component: <AlertsScreen />,
51
- },
52
- {
53
- key: 'profile',
54
- title: 'Profile',
55
- icon: 'user',
56
- component: <ProfileScreen />,
57
- },
58
- ];
59
-
60
- const BottomNavigationPlayground = () => {
61
- const [selectedTabKey, setSelectedTabKey] = React.useState('home');
62
-
63
- return (
64
- <BottomNavigation
65
- onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
66
- selectedTabKey={selectedTabKey}
67
- tabs={tabs}
68
- />
69
- );
70
- };
71
-
72
- export default BottomNavigationPlayground;
@@ -1,43 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { View, Button } from 'react-native';
3
-
4
- import { BottomSheet, Typography, useTheme } from '@hero-design/rn';
5
-
6
- const Content = () => {
7
- const theme = useTheme();
8
-
9
- return (
10
- <View style={{ padding: theme.space.medium }}>
11
- <Typography.Text>Sheet Content</Typography.Text>
12
- <Typography.Text>Sheet Content</Typography.Text>
13
- <Typography.Text>Sheet Content</Typography.Text>
14
- <Typography.Text>Sheet Content</Typography.Text>
15
- <Typography.Text>Sheet Content</Typography.Text>
16
- <Typography.Text>Sheet Content</Typography.Text>
17
- <Typography.Text>Sheet Content</Typography.Text>
18
- <Typography.Text>Sheet Content</Typography.Text>
19
- <Typography.Text>Sheet Content</Typography.Text>
20
- <Typography.Text>Sheet Content</Typography.Text>
21
- </View>
22
- );
23
- };
24
-
25
- const BottomSheetPlayground = (): JSX.Element => {
26
- const [visible, setVisiblity] = useState(false);
27
-
28
- return (
29
- <View style={{ flex: 1, alignItems: 'center' }}>
30
- <Button title="Toggle Bottom Sheet" onPress={() => setVisiblity(true)} />
31
- <BottomSheet
32
- open={visible}
33
- header="Title"
34
- footer={<Button title="Close" onPress={() => setVisiblity(false)} />}
35
- onRequestClose={() => setVisiblity(false)}
36
- >
37
- <Content />
38
- </BottomSheet>
39
- </View>
40
- );
41
- };
42
-
43
- export default BottomSheetPlayground;