@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,80 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
-
4
- import { Switch, Typography, useTheme } from '@hero-design/rn';
5
-
6
- type StateIndex = 'switchOne' | 'switchTwo' | 'switchThree' | 'switchFour';
7
-
8
- type SwitchStates = {
9
- switchOne: boolean;
10
- switchTwo: boolean;
11
- switchThree: boolean;
12
- switchFour: boolean;
13
- };
14
-
15
- const SwitchPlayground = () => {
16
- const theme = useTheme();
17
-
18
- const [isChecked, setIsChecked] = React.useState<SwitchStates>({
19
- switchOne: true,
20
- switchTwo: false,
21
- switchThree: true,
22
- switchFour: false,
23
- });
24
-
25
- const toggleState = React.useCallback(
26
- (switchId: StateIndex) =>
27
- setIsChecked({
28
- ...isChecked,
29
- [switchId]: !isChecked[switchId],
30
- }),
31
- [isChecked]
32
- );
33
-
34
- return (
35
- <View
36
- style={{
37
- margin: theme.space.medium,
38
- }}
39
- >
40
- <Typography.Text style={{ marginVertical: theme.space.xsmall }}>
41
- Medium size
42
- </Typography.Text>
43
- <Switch
44
- checked={isChecked.switchOne}
45
- onPress={() => toggleState('switchOne')}
46
- />
47
- <Switch
48
- style={{ marginTop: theme.space.small }}
49
- checked={isChecked.switchTwo}
50
- onPress={() => toggleState('switchTwo')}
51
- />
52
- <Switch checked disabled style={{ marginTop: theme.space.small }} />
53
- <Switch disabled style={{ marginTop: theme.space.small }} />
54
-
55
- <Typography.Text style={{ marginVertical: theme.space.xsmall }}>
56
- Small size
57
- </Typography.Text>
58
- <Switch
59
- size="small"
60
- checked={isChecked.switchThree}
61
- onPress={() => toggleState('switchThree')}
62
- />
63
- <Switch
64
- style={{ marginTop: theme.space.small }}
65
- size="small"
66
- checked={isChecked.switchFour}
67
- onPress={() => toggleState('switchFour')}
68
- />
69
- <Switch
70
- checked
71
- disabled
72
- style={{ marginTop: theme.space.small }}
73
- size="small"
74
- />
75
- <Switch disabled style={{ marginTop: theme.space.small }} size="small" />
76
- </View>
77
- );
78
- };
79
-
80
- export default SwitchPlayground;
@@ -1,136 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import {
4
- Tabs,
5
- Typography,
6
- TabType,
7
- Icon,
8
- useTheme,
9
- IconName,
10
- } from '@hero-design/rn';
11
-
12
- const CustomScreen = ({ title }: { title: string }) => (
13
- <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
14
- <Typography.Text>{title}</Typography.Text>
15
- </View>
16
- );
17
-
18
- const CustomItem = ({
19
- color,
20
- icon,
21
- title,
22
- }: {
23
- color: string;
24
- icon: IconName;
25
- title: string;
26
- }) => {
27
- const theme = useTheme();
28
-
29
- return (
30
- <View style={{ display: 'flex', flexDirection: 'row' }}>
31
- <Icon
32
- icon={icon}
33
- size="small"
34
- style={{ color, marginEnd: theme.space.small }}
35
- />
36
- <Typography.Text
37
- fontWeight="semi-bold"
38
- numberOfLines={1}
39
- style={{ color }}
40
- >
41
- {title}
42
- </Typography.Text>
43
- </View>
44
- );
45
- };
46
-
47
- const workTabs: TabType[] = [
48
- {
49
- key: 'activity',
50
- activeItem: 'Activity',
51
- component: <CustomScreen title="Activity" />,
52
- showBadge: true,
53
- },
54
- {
55
- key: 'news',
56
- activeItem: `What's new`,
57
- component: <CustomScreen title="News" />,
58
- },
59
- ];
60
-
61
- const WorkScreen = () => {
62
- const [selectedTabKey, setSelectedTabKey] = React.useState('activity');
63
-
64
- return (
65
- <Tabs
66
- onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
67
- selectedTabKey={selectedTabKey}
68
- tabs={workTabs}
69
- />
70
- );
71
- };
72
-
73
- const tabs: TabType[] = [
74
- {
75
- key: 'work',
76
- activeItem: ({ color }) => (
77
- <CustomItem color={color} icon="home-outlined" title="Home" />
78
- ),
79
- inactiveItem: 'home-outlined',
80
- component: <WorkScreen />,
81
- },
82
- {
83
- key: 'personal',
84
- activeItem: ({ color }) => (
85
- <CustomItem color={color} icon="bell-outlined" title="Notifications" />
86
- ),
87
- inactiveItem: 'bell-outlined',
88
- component: <CustomScreen title="Notifications Screen" />,
89
- showBadge: true,
90
- },
91
- {
92
- key: 'speaker',
93
- activeItem: ({ color }) => (
94
- <CustomItem color={color} icon="speaker-outlined" title="Shoutouts" />
95
- ),
96
- inactiveItem: 'speaker-outlined',
97
- component: <CustomScreen title="Shoutouts Screen" />,
98
- },
99
- {
100
- key: 'payslips',
101
- activeItem: 'Payslips',
102
- component: <CustomScreen title="Payslips Screen" />,
103
- },
104
- {
105
- key: 'leave',
106
- activeItem: 'Leave',
107
- component: <CustomScreen title="Leave Screen" />,
108
- showBadge: true,
109
- },
110
- {
111
- key: 'rosters',
112
- activeItem: 'Rosters',
113
- component: <CustomScreen title="Rosters Screen" />,
114
- },
115
- {
116
- key: 'timesheets',
117
- activeItem: 'Timesheets',
118
- component: <CustomScreen title="Timesheets Screen" />,
119
- },
120
- ];
121
-
122
- const TabsPlayground = () => {
123
- const [selectedTabKey, setSelectedTabKey] = React.useState('work');
124
-
125
- return (
126
- <Tabs.Scroll
127
- onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
128
- selectedTabKey={selectedTabKey}
129
- tabs={tabs}
130
- lazy
131
- lazyPreloadDistance={3}
132
- />
133
- );
134
- };
135
-
136
- export default TabsPlayground;
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import { Tag, useTheme } from '@hero-design/rn';
4
-
5
- const TagPlayground = () => {
6
- const theme = useTheme();
7
-
8
- return (
9
- <View style={{ margin: theme.space.medium }}>
10
- <View
11
- style={{
12
- display: 'flex',
13
- flexDirection: 'row',
14
- marginBottom: theme.space.small,
15
- }}
16
- >
17
- <Tag
18
- content="APPROVED"
19
- intent="success"
20
- style={{ marginEnd: theme.space.small }}
21
- />
22
- <Tag
23
- content="PENDING"
24
- intent="warning"
25
- style={{ marginEnd: theme.space.small }}
26
- />
27
- </View>
28
- <View
29
- style={{
30
- display: 'flex',
31
- flexDirection: 'row',
32
- }}
33
- >
34
- <Tag
35
- content="DECLINED"
36
- intent="danger"
37
- style={{ marginEnd: theme.space.small }}
38
- />
39
- <Tag content="SUBMITTED" style={{ marginEnd: theme.space.small }} />
40
- </View>
41
- </View>
42
- );
43
- };
44
-
45
- export default TagPlayground;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import { TextInput, useTheme } from '@hero-design/rn';
4
-
5
- const TextInputPlayground = () => {
6
- const theme = useTheme();
7
- return (
8
- <View style={{ padding: theme.space.medium }}>
9
- <TextInput label="Amount (AUD)" prefix="dollar-sign" />
10
- </View>
11
- );
12
- };
13
-
14
- export default TextInputPlayground;
@@ -1,114 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { View, Button } from 'react-native';
3
- import { Toast, Typography, useTheme } from '@hero-design/rn';
4
-
5
- type ToastConfig = {
6
- displayType: 'single' | 'stack';
7
- position: 'top' | 'bottom';
8
- };
9
-
10
- const getRandomIntent = () => {
11
- const intents = ['info', 'success', 'warning', 'error'] as const;
12
- return intents[Math.floor(Math.random() * 4)];
13
- };
14
-
15
- const ToastDemo = ({
16
- config,
17
- updateConfig,
18
- }: {
19
- config: ToastConfig;
20
- updateConfig: (conf: ToastConfig) => void;
21
- }) => {
22
- const theme = useTheme();
23
- const [permaToastIds, setPermaToastIds] = useState<string[]>([]);
24
- const toast = Toast.useToast();
25
- return (
26
- <View
27
- style={{
28
- flex: 1,
29
- padding: theme.space.medium,
30
- alignItems: 'center',
31
- justifyContent: 'center',
32
- }}
33
- >
34
- <Button
35
- title="Add Random Toast"
36
- onPress={() =>
37
- toast.show({
38
- content: Math.random().toString(),
39
- intent: getRandomIntent(),
40
- variant: 'round',
41
- actionLabel: 'ACTION',
42
- onAction: () => alert('Clicked'),
43
- })
44
- }
45
- />
46
- <Button
47
- title="Add Perma Toast"
48
- onPress={() => {
49
- const id = toast.show({
50
- content: `Perma Toast: ${Math.random().toString()}`,
51
- intent: getRandomIntent(),
52
- variant: 'round',
53
- actionLabel: 'UNDO',
54
- autoDismiss: false,
55
- });
56
- setPermaToastIds([id, ...permaToastIds]);
57
- }}
58
- />
59
- <Button
60
- title="Hide Oldest Perma Toast"
61
- onPress={() => {
62
- const id = permaToastIds[permaToastIds.length - 1];
63
- toast.hide(id);
64
- setPermaToastIds(permaToastIds.slice(0, -1));
65
- }}
66
- />
67
- <Button
68
- title="Clear all"
69
- onPress={() => {
70
- toast.clearAll();
71
- setPermaToastIds([]);
72
- }}
73
- />
74
- <View style={{ alignItems: 'center', marginTop: theme.space.large }}>
75
- <Typography.Text fontSize="large">
76
- Tap to change settings
77
- </Typography.Text>
78
- <Button
79
- title={`Display Type: ${config.displayType}`}
80
- onPress={() =>
81
- updateConfig({
82
- ...config,
83
- displayType: config.displayType === 'stack' ? 'single' : 'stack',
84
- })
85
- }
86
- />
87
- <Button
88
- title={`Position: ${config.position}`}
89
- onPress={() =>
90
- updateConfig({
91
- ...config,
92
- position: config.position === 'top' ? 'bottom' : 'top',
93
- })
94
- }
95
- />
96
- </View>
97
- </View>
98
- );
99
- };
100
-
101
- const ToastPlayground = () => {
102
- const [config, setConfig] = useState<ToastConfig>({
103
- displayType: 'single',
104
- position: 'top',
105
- });
106
-
107
- return (
108
- <Toast.Provider displayType={config.displayType} position={config.position}>
109
- <ToastDemo config={config} updateConfig={conf => setConfig(conf)} />
110
- </Toast.Provider>
111
- );
112
- };
113
-
114
- export default ToastPlayground;
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import { Typography, useTheme } from '@hero-design/rn';
4
-
5
- const TypographyPlayground = () => {
6
- const theme = useTheme();
7
-
8
- return (
9
- <View style={{ padding: theme.space.large }}>
10
- <Typography.Text fontSize="xlarge" fontWeight="semi-bold">
11
- This is a title
12
- </Typography.Text>
13
- <Typography.Text fontSize="large">This is a subtitle</Typography.Text>
14
- <Typography.Text>This is a 2nd subtitle</Typography.Text>
15
- <Typography.Text fontWeight="light">This is body text</Typography.Text>
16
- <Typography.Text intent="subdued" fontWeight="light">
17
- This is subdued text
18
- </Typography.Text>
19
- </View>
20
- );
21
- };
22
-
23
- export default TypographyPlayground;
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "declaration": true,
5
- "outDir": "types",
6
- "moduleResolution": "node",
7
- "esModuleInterop": true,
8
- "jsx": "react-native",
9
- "strict": true,
10
- "allowUnreachableCode": false,
11
- "noImplicitReturns": true,
12
- "noImplicitThis": true,
13
- "noUnusedLocals": true,
14
- "skipLibCheck": true,
15
- "types": ["jest"],
16
- "typeRoots": ["./src"]
17
- },
18
- "include": ["src"],
19
- "exclude": ["node_modules"],
20
- "extends": "expo/tsconfig.base"
21
- }
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { TouchableOpacity } from 'react-native';
3
- import { FooterText } from './StyledMultiSelect';
4
-
5
- function Footer({ label, onPress }: { label: string; onPress: () => void }) {
6
- return (
7
- <TouchableOpacity onPress={onPress}>
8
- <FooterText fontSize="large" fontWeight="semi-bold">
9
- {label}
10
- </FooterText>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- export default Footer;