@hero-design/rn 7.2.2 → 7.3.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 (244) hide show
  1. package/.expo/packager-info.json +1 -1
  2. package/.expo/prebuild/cached-packages.json +4 -0
  3. package/.expo/xcodebuild-error.log +2 -0
  4. package/.expo/xcodebuild.log +11199 -0
  5. package/.turbo/turbo-build.log +8 -8
  6. package/.turbo/turbo-build:types.log +2 -0
  7. package/.turbo/turbo-test.log +131 -0
  8. package/.turbo/turbo-type-check.log +7 -0
  9. package/es/index.js +2409 -468
  10. package/jest.config.js +1 -1
  11. package/lib/index.js +2430 -484
  12. package/package.json +4 -2
  13. package/playground/components/Avatar.tsx +102 -0
  14. package/playground/components/Badge.tsx +146 -9
  15. package/playground/components/Button.tsx +138 -35
  16. package/playground/components/Card.tsx +36 -1
  17. package/playground/components/Collapse.tsx +99 -0
  18. package/playground/components/Drawer.tsx +32 -0
  19. package/playground/components/FAB.tsx +15 -0
  20. package/playground/components/IconButton.tsx +67 -0
  21. package/playground/components/Progress.tsx +95 -0
  22. package/playground/components/Tabs.tsx +106 -14
  23. package/playground/components/Tag.tsx +45 -0
  24. package/playground/index.tsx +18 -0
  25. package/src/components/Avatar/StyledAvatar.tsx +61 -0
  26. package/src/components/Avatar/__tests__/StyledAvatar.spec.tsx +48 -0
  27. package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +87 -0
  28. package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +88 -0
  29. package/src/components/Avatar/__tests__/index.spec.tsx +26 -0
  30. package/src/components/Avatar/index.tsx +71 -0
  31. package/src/components/Badge/Status.tsx +77 -0
  32. package/src/components/Badge/StyledBadge.tsx +38 -26
  33. package/src/components/Badge/__tests__/Badge.spec.tsx +16 -0
  34. package/src/components/Badge/__tests__/Status.spec.tsx +27 -0
  35. package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +133 -52
  36. package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +89 -0
  37. package/src/components/Badge/index.tsx +77 -19
  38. package/src/components/Button/Button.tsx +163 -0
  39. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +58 -0
  40. package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +20 -0
  41. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +101 -0
  42. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +606 -0
  43. package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +24 -0
  44. package/src/components/Button/LoadingIndicator/index.tsx +140 -0
  45. package/src/components/Button/StyledButton.tsx +254 -0
  46. package/src/components/Button/__tests__/Button.spec.tsx +86 -0
  47. package/src/components/Button/__tests__/{index.spec.tsx → IconButton.spec.tsx} +0 -0
  48. package/src/components/Button/__tests__/StyledButton.spec.tsx +154 -0
  49. package/src/components/Button/__tests__/__snapshots__/{index.spec.tsx.snap → IconButton.spec.tsx.snap} +0 -0
  50. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +895 -0
  51. package/src/components/Button/index.tsx +10 -2
  52. package/src/components/Card/StyledCard.tsx +27 -4
  53. package/src/components/Card/__tests__/StyledCard.spec.tsx +15 -3
  54. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +34 -1
  55. package/src/components/Card/__tests__/index.spec.tsx +16 -21
  56. package/src/components/Card/index.tsx +15 -2
  57. package/src/components/Collapse/StyledCollapse.tsx +15 -0
  58. package/src/components/Collapse/__tests__/StyledCollapse.spec.tsx +26 -0
  59. package/src/components/Collapse/__tests__/__snapshots__/StyledCollapse.spec.tsx.snap +37 -0
  60. package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +84 -0
  61. package/src/components/Collapse/__tests__/index.spec.tsx +42 -0
  62. package/src/components/Collapse/index.tsx +109 -0
  63. package/src/components/Divider/index.tsx +1 -1
  64. package/src/components/Drawer/StyledDrawer.tsx +39 -0
  65. package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +244 -0
  66. package/src/components/Drawer/__tests__/index.spec.tsx +37 -0
  67. package/src/components/Drawer/index.tsx +93 -0
  68. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +78 -62
  69. package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +2 -0
  70. package/src/components/FAB/ActionGroup/index.tsx +13 -0
  71. package/src/components/FAB/FAB.tsx +63 -13
  72. package/src/components/FAB/StyledFAB.tsx +25 -6
  73. package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +6 -2
  74. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +7 -3
  75. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +88 -6
  76. package/src/components/FAB/__tests__/index.spec.tsx +16 -0
  77. package/src/components/Progress/ProgressBar.tsx +73 -0
  78. package/src/components/Progress/ProgressCircle.tsx +165 -0
  79. package/src/components/Progress/StyledProgressBar.tsx +21 -0
  80. package/src/components/Progress/StyledProgressCircle.tsx +66 -0
  81. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +641 -0
  82. package/src/components/Progress/__tests__/index.spec.js +46 -0
  83. package/src/components/Progress/index.tsx +6 -0
  84. package/src/components/Progress/types.ts +1 -0
  85. package/src/components/Tabs/ActiveTabIndicator.tsx +37 -0
  86. package/src/components/Tabs/ScrollableTabs.tsx +216 -0
  87. package/src/components/Tabs/StyledScrollableTabs.tsx +60 -0
  88. package/src/components/Tabs/StyledTabs.tsx +30 -44
  89. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +84 -0
  90. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +591 -0
  91. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +317 -224
  92. package/src/components/Tabs/__tests__/index.spec.tsx +22 -21
  93. package/src/components/Tabs/index.tsx +155 -114
  94. package/src/components/Tabs/utils.ts +13 -0
  95. package/src/components/Tag/StyledTag.tsx +35 -0
  96. package/src/components/Tag/__tests__/Tag.spec.tsx +41 -0
  97. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +153 -0
  98. package/src/components/Tag/index.tsx +41 -0
  99. package/src/components/Typography/Text/index.tsx +1 -1
  100. package/src/index.ts +10 -0
  101. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +182 -20
  102. package/src/theme/components/avatar.ts +40 -0
  103. package/src/theme/components/badge.ts +14 -16
  104. package/src/theme/components/button.ts +57 -0
  105. package/src/theme/components/card.ts +8 -2
  106. package/src/theme/components/drawer.ts +24 -0
  107. package/src/theme/components/fab.ts +9 -2
  108. package/src/theme/components/progress.ts +27 -0
  109. package/src/theme/components/tabs.ts +22 -7
  110. package/src/theme/components/tag.ts +39 -0
  111. package/src/theme/global/borders.ts +13 -1
  112. package/src/theme/global/colors.ts +6 -1
  113. package/src/theme/global/index.ts +3 -1
  114. package/src/theme/global/scale.ts +3 -0
  115. package/src/theme/index.ts +16 -1
  116. package/src/utils/hooks.ts +10 -0
  117. package/testUtils/setup.tsx +43 -0
  118. package/types/playground/components/Avatar.d.ts +2 -0
  119. package/types/playground/components/Badge.d.ts +0 -0
  120. package/types/playground/components/BottomNavigation.d.ts +0 -0
  121. package/types/playground/components/Button.d.ts +0 -0
  122. package/types/playground/components/Card.d.ts +0 -0
  123. package/types/playground/components/Collapse.d.ts +2 -0
  124. package/types/playground/components/Divider.d.ts +0 -0
  125. package/types/playground/components/Drawer.d.ts +2 -0
  126. package/types/playground/components/FAB.d.ts +0 -0
  127. package/types/playground/components/Icon.d.ts +0 -0
  128. package/types/playground/components/IconButton.d.ts +2 -0
  129. package/types/playground/components/Progress.d.ts +2 -0
  130. package/types/playground/components/Tabs.d.ts +0 -0
  131. package/types/playground/components/Tag.d.ts +2 -0
  132. package/types/playground/components/Typography.d.ts +0 -0
  133. package/types/playground/index.d.ts +0 -0
  134. package/types/src/components/Avatar/StyledAvatar.d.ts +46 -0
  135. package/types/src/components/{BottomNavigation/__tests__/BottomNavigation.spec.d.ts → Avatar/__tests__/StyledAvatar.spec.d.ts} +0 -0
  136. package/types/src/components/{Card/__tests__/Card.spec.d.ts → Avatar/__tests__/index.spec.d.ts} +0 -0
  137. package/types/src/components/Avatar/index.d.ts +25 -0
  138. package/types/src/components/Badge/Status.d.ts +24 -0
  139. package/types/src/components/Badge/StyledBadge.d.ts +17 -9
  140. package/types/src/components/Badge/__tests__/Badge.spec.d.ts +0 -0
  141. package/types/src/components/{FAB/__tests__/StyledFABContainer.spec.d.ts → Badge/__tests__/Status.spec.d.ts} +0 -0
  142. package/types/src/components/Badge/index.d.ts +17 -7
  143. package/types/src/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
  144. package/types/src/components/BottomNavigation/__tests__/index.spec.d.ts +0 -0
  145. package/types/src/components/BottomNavigation/index.d.ts +0 -0
  146. package/types/src/components/Button/Button.d.ts +57 -0
  147. package/types/src/components/Button/IconButton.d.ts +0 -0
  148. package/types/src/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +20 -0
  149. package/types/src/components/{FAB/__tests__/StyledFABIcon.spec.d.ts → Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts} +0 -0
  150. package/types/src/components/{Icon/__tests__/Icon.spec.d.ts → Button/LoadingIndicator/__tests__/index.spec.d.ts} +0 -0
  151. package/types/src/components/Button/LoadingIndicator/index.d.ts +26 -0
  152. package/types/src/components/Button/StyledButton.d.ts +40 -0
  153. package/types/src/components/{Tabs/__tests__/Tabs.spec.d.ts → Button/__tests__/Button.spec.d.ts} +0 -0
  154. package/types/src/components/Button/__tests__/IconButton.spec.d.ts +1 -0
  155. package/types/src/components/Button/__tests__/StyledButton.spec.d.ts +1 -0
  156. package/types/src/components/Button/__tests__/index.spec.d.ts +0 -0
  157. package/types/src/components/Button/index.d.ts +8 -4
  158. package/types/src/components/Card/StyledCard.d.ts +9 -1
  159. package/types/src/components/Card/__tests__/StyledCard.spec.d.ts +0 -0
  160. package/types/src/components/Card/__tests__/index.spec.d.ts +0 -0
  161. package/types/src/components/Card/index.d.ts +5 -1
  162. package/types/src/components/Collapse/StyledCollapse.d.ts +15 -0
  163. package/types/src/components/Collapse/__tests__/StyledCollapse.spec.d.ts +1 -0
  164. package/types/src/components/Collapse/__tests__/index.spec.d.ts +1 -0
  165. package/types/src/components/Collapse/index.d.ts +23 -0
  166. package/types/src/components/Divider/StyledDivider.d.ts +0 -0
  167. package/types/src/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -0
  168. package/types/src/components/Divider/index.d.ts +0 -0
  169. package/types/src/components/Drawer/StyledDrawer.d.ts +25 -0
  170. package/types/src/components/Drawer/__tests__/index.spec.d.ts +1 -0
  171. package/types/src/components/Drawer/index.d.ts +25 -0
  172. package/types/src/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
  173. package/types/src/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
  174. package/types/src/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
  175. package/types/src/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -0
  176. package/types/src/components/FAB/ActionGroup/index.d.ts +5 -1
  177. package/types/src/components/FAB/AnimatedFABIcon.d.ts +0 -0
  178. package/types/src/components/FAB/FAB.d.ts +5 -1
  179. package/types/src/components/FAB/StyledFAB.d.ts +8 -2
  180. package/types/src/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -0
  181. package/types/src/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -0
  182. package/types/src/components/FAB/__tests__/index.spec.d.ts +0 -0
  183. package/types/src/components/FAB/index.d.ts +2 -2
  184. package/types/src/components/Icon/HeroIcon/index.d.ts +0 -0
  185. package/types/src/components/Icon/IconList.d.ts +0 -0
  186. package/types/src/components/Icon/__tests__/index.spec.d.ts +0 -0
  187. package/types/src/components/Icon/index.d.ts +0 -0
  188. package/types/src/components/Icon/utils.d.ts +1 -1
  189. package/types/src/components/Progress/ProgressBar.d.ts +18 -0
  190. package/types/src/components/Progress/ProgressCircle.d.ts +18 -0
  191. package/types/src/components/Progress/StyledProgressBar.d.ts +18 -0
  192. package/types/src/components/Progress/StyledProgressCircle.d.ts +38 -0
  193. package/types/src/components/Progress/__tests__/index.spec.d.ts +1 -0
  194. package/types/src/components/Progress/index.d.ts +5 -0
  195. package/types/src/components/Progress/types.d.ts +1 -0
  196. package/types/src/components/Tabs/ActiveTabIndicator.d.ts +8 -0
  197. package/types/src/components/Tabs/ScrollableTabs.d.ts +3 -0
  198. package/types/src/components/Tabs/StyledScrollableTabs.d.ts +61 -0
  199. package/types/src/components/Tabs/StyledTabs.d.ts +22 -22
  200. package/types/src/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +1 -0
  201. package/types/src/components/Tabs/__tests__/index.spec.d.ts +0 -0
  202. package/types/src/components/Tabs/index.d.ts +28 -19
  203. package/types/src/components/Tabs/utils.d.ts +2 -0
  204. package/types/src/components/Tag/StyledTag.d.ts +20 -0
  205. package/types/src/components/Tag/__tests__/Tag.spec.d.ts +1 -0
  206. package/types/src/components/Tag/index.d.ts +21 -0
  207. package/types/src/components/Typography/Text/StyledText.d.ts +0 -0
  208. package/types/src/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -0
  209. package/types/src/components/Typography/Text/__tests__/index.spec.d.ts +0 -0
  210. package/types/src/components/Typography/Text/index.d.ts +0 -0
  211. package/types/src/components/Typography/index.d.ts +0 -0
  212. package/types/src/index.d.ts +6 -1
  213. package/types/src/testHelpers/renderWithTheme.d.ts +0 -0
  214. package/types/src/theme/__tests__/index.spec.d.ts +0 -0
  215. package/types/src/theme/components/avatar.d.ts +32 -0
  216. package/types/src/theme/components/badge.d.ts +12 -13
  217. package/types/src/theme/components/bottomNavigation.d.ts +0 -0
  218. package/types/src/theme/components/button.d.ts +37 -0
  219. package/types/src/theme/components/card.d.ts +5 -1
  220. package/types/src/theme/components/divider.d.ts +0 -0
  221. package/types/src/theme/components/drawer.d.ts +21 -0
  222. package/types/src/theme/components/fab.d.ts +8 -1
  223. package/types/src/theme/components/icon.d.ts +0 -0
  224. package/types/src/theme/components/progress.d.ts +21 -0
  225. package/types/src/theme/components/tabs.d.ts +14 -2
  226. package/types/src/theme/components/tag.d.ts +30 -0
  227. package/types/src/theme/components/typography.d.ts +0 -0
  228. package/types/src/theme/global/borders.d.ts +7 -1
  229. package/types/src/theme/global/colors.d.ts +6 -1
  230. package/types/src/theme/global/index.d.ts +7 -1
  231. package/types/src/theme/global/scale.d.ts +1 -0
  232. package/types/src/theme/global/space.d.ts +0 -0
  233. package/types/src/theme/global/typography.d.ts +0 -0
  234. package/types/src/theme/index.d.ts +10 -0
  235. package/types/src/types.d.ts +0 -0
  236. package/types/src/utils/__tests__/scale.spec.d.ts +0 -0
  237. package/types/src/utils/helpers.d.ts +0 -0
  238. package/types/src/utils/hooks.d.ts +1 -0
  239. package/types/src/utils/scale.d.ts +0 -0
  240. package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +0 -33
  241. package/testUtils/setup.ts +0 -18
  242. package/types/src/components/FAB/StyledFABContainer.d.ts +0 -3
  243. package/types/src/components/FAB/StyledFABIcon.d.ts +0 -3
  244. package/types/src/styled-components.d.ts +0 -6
@@ -3,12 +3,15 @@ import palette from '@hero-design/colors';
3
3
  const systemPalette = {
4
4
  primary: palette.violet,
5
5
  primaryLight: palette.violetLight60,
6
+ primaryDark: palette.purpleDark15,
7
+ primaryBackground: palette.violetLight90,
8
+ secondary: palette.dodgerBlue,
9
+ secondaryLight: palette.dodgerBlueLight75,
6
10
  info: palette.dodgerBlue,
7
11
  infoLight: palette.dodgerBlueLight75,
8
12
  infoBackground: palette.dodgerBlueLight90,
9
13
  success: palette.green,
10
14
  successDark: palette.greenDark30,
11
- successLight: palette.greenDark75,
12
15
  successBackground: palette.grotesqueGreenLight90,
13
16
  danger: palette.red,
14
17
  dangerLight: palette.redLight60,
@@ -21,8 +24,10 @@ const systemPalette = {
21
24
  backgroundDark: palette.greyDark75,
22
25
  text: palette.greyDark75,
23
26
  disabledText: palette.greyDark15,
27
+ disabledLightText: palette.greyLight45,
24
28
  invertedText: palette.white,
25
29
  outline: palette.greyLight60,
30
+ archived: palette.greyLight45,
26
31
  };
27
32
 
28
33
  type SystemPalette = typeof systemPalette;
@@ -2,7 +2,7 @@ import { scale as defaultScale, Scale } from './scale';
2
2
  import { systemPalette as defaultSystemPalette, SystemPalette } from './colors';
3
3
  import { getFonts, getFontSizes, getLineHeights } from './typography';
4
4
  import { getSpace } from './space';
5
- import { getBorderWidths } from './borders';
5
+ import { getBorderWidths, getRadii } from './borders';
6
6
 
7
7
  const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
8
8
  const fonts = getFonts(scale.font);
@@ -10,6 +10,7 @@ const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
10
10
  const lineHeights = getLineHeights(fontSizes);
11
11
  const borderWidths = getBorderWidths(scale.borderWidth);
12
12
  const space = getSpace(scale.space);
13
+ const radii = getRadii(scale.radius);
13
14
 
14
15
  return {
15
16
  colors: {
@@ -20,6 +21,7 @@ const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
20
21
  lineHeights,
21
22
  borderWidths,
22
23
  space,
24
+ radii,
23
25
  };
24
26
  };
25
27
 
@@ -6,11 +6,14 @@ const BASE_FONT = 'BeVietnamPro';
6
6
 
7
7
  const BASE_FONT_SIZE = 10;
8
8
 
9
+ const BASE_RADIUS = 4;
10
+
9
11
  const scale = {
10
12
  borderWidth: BASE_BORDER_WIDTH,
11
13
  space: BASE_SPACE,
12
14
  font: BASE_FONT,
13
15
  fontSize: BASE_FONT_SIZE,
16
+ radius: BASE_RADIUS,
14
17
  };
15
18
 
16
19
  type Scale = typeof scale;
@@ -9,21 +9,31 @@ import {
9
9
 
10
10
  import getBadgeTheme from './components/badge';
11
11
  import getBottomNavigationTheme from './components/bottomNavigation';
12
+ import getButtonTheme from './components/button';
12
13
  import getCardTheme from './components/card';
13
14
  import getDividerTheme from './components/divider';
15
+ import getDrawerTheme from './components/drawer';
14
16
  import getTabsTheme from './components/tabs';
17
+ import getTagTheme from './components/tag';
15
18
  import getIconTheme from './components/icon';
19
+ import getProgressTheme from './components/progress';
16
20
  import getTypographyTheme from './components/typography';
17
21
  import getFABTheme from './components/fab';
22
+ import getAvatarTheme from './components/avatar';
18
23
 
19
24
  type Theme = GlobalTheme & {
20
25
  __hd__: {
26
+ avatar: ReturnType<typeof getAvatarTheme>;
21
27
  badge: ReturnType<typeof getBadgeTheme>;
22
28
  bottomNavigation: ReturnType<typeof getBottomNavigationTheme>;
29
+ button: ReturnType<typeof getButtonTheme>;
23
30
  card: ReturnType<typeof getCardTheme>;
24
31
  divider: ReturnType<typeof getDividerTheme>;
32
+ drawer: ReturnType<typeof getDrawerTheme>;
25
33
  icon: ReturnType<typeof getIconTheme>;
34
+ progress: ReturnType<typeof getProgressTheme>;
26
35
  tabs: ReturnType<typeof getTabsTheme>;
36
+ tag: ReturnType<typeof getTagTheme>;
27
37
  typography: ReturnType<typeof getTypographyTheme>;
28
38
  fab: ReturnType<typeof getFABTheme>;
29
39
  };
@@ -37,12 +47,17 @@ const getTheme = (
37
47
  return {
38
48
  ...globalTheme,
39
49
  __hd__: {
50
+ avatar: getAvatarTheme(globalTheme),
40
51
  badge: getBadgeTheme(globalTheme),
41
52
  bottomNavigation: getBottomNavigationTheme(globalTheme),
42
- card: getCardTheme(),
53
+ button: getButtonTheme(globalTheme),
54
+ card: getCardTheme(globalTheme),
43
55
  divider: getDividerTheme(globalTheme),
56
+ drawer: getDrawerTheme(globalTheme),
57
+ progress: getProgressTheme(globalTheme),
44
58
  icon: getIconTheme(globalTheme),
45
59
  tabs: getTabsTheme(globalTheme),
60
+ tag: getTagTheme(globalTheme),
46
61
  typography: getTypographyTheme(globalTheme),
47
62
  fab: getFABTheme(globalTheme),
48
63
  },
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ // Get previous state value
4
+ export const usePrevious = <T>(value: T) => {
5
+ const ref = React.useRef<T>();
6
+ React.useEffect(() => {
7
+ ref.current = value;
8
+ }, [value]);
9
+ return ref.current;
10
+ };
@@ -0,0 +1,43 @@
1
+ jest.mock('react-native-vector-icons', () => ({
2
+ createIconSetFromIcoMoon: jest.fn(() => 'HeroIcon'),
3
+ }));
4
+
5
+ jest.mock('react-native', () => {
6
+ const RN = jest.requireActual('react-native');
7
+
8
+ RN.Animated.timing = () => ({
9
+ start: () => jest.fn(),
10
+ stop: () => jest.fn(),
11
+ _isUsingNativeDriver: () => jest.fn(),
12
+ _startNativeLoop: () => jest.fn(),
13
+ });
14
+
15
+ return RN;
16
+ });
17
+
18
+ jest.mock('../src/utils/scale', () => ({
19
+ scale: jest.fn(size => size),
20
+ }));
21
+
22
+ jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
23
+ jest.mock('react-native-pager-view', () => {
24
+ const RealComponent = jest.requireActual('react-native-pager-view').default;
25
+ const React = jest.requireActual('react');
26
+
27
+ return class ViewPager extends React.Component<{
28
+ children: React.ReactNode;
29
+ }> {
30
+ index = 0;
31
+
32
+ setPage = (page: number) => {
33
+ const { children } = this.props;
34
+
35
+ this.index = Math.max(0, Math.min(page, React.Children.count(children)));
36
+ };
37
+
38
+ render() {
39
+ const { children } = this.props;
40
+ return <RealComponent>{children}</RealComponent>;
41
+ }
42
+ };
43
+ });
@@ -0,0 +1,2 @@
1
+ declare const AvatarPlayground: () => JSX.Element;
2
+ export default AvatarPlayground;
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ declare const CollapsePlayground: () => JSX.Element;
2
+ export default CollapsePlayground;
File without changes
@@ -0,0 +1,2 @@
1
+ declare const DrawerPlayground: () => JSX.Element;
2
+ export default DrawerPlayground;
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ declare const IconButtonPlayground: () => JSX.Element;
2
+ export default IconButtonPlayground;
@@ -0,0 +1,2 @@
1
+ declare const ProgressPlayground: () => JSX.Element;
2
+ export default ProgressPlayground;
File without changes
@@ -0,0 +1,2 @@
1
+ declare const TagPlayground: () => JSX.Element;
2
+ export default TagPlayground;
File without changes
File without changes
@@ -0,0 +1,46 @@
1
+ /// <reference types="react" />
2
+ import { View, Image, TouchableOpacity, Text } from 'react-native';
3
+ declare type ThemeSize = 'small' | 'medium' | 'large' | 'xlarge';
4
+ declare type ThemeIntent = 'primary' | 'info' | 'danger' | 'success' | 'warning';
5
+ declare const StyledPressable: import("@emotion/native").StyledComponent<import("react-native").TouchableOpacityProps & {
6
+ theme?: import("@emotion/react").Theme | undefined;
7
+ as?: import("react").ElementType<any> | undefined;
8
+ } & {
9
+ themeSize: ThemeSize;
10
+ themeIntent: ThemeIntent;
11
+ }, {}, {
12
+ ref?: import("react").Ref<TouchableOpacity> | undefined;
13
+ }>;
14
+ declare const StyledView: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
15
+ theme?: import("@emotion/react").Theme | undefined;
16
+ as?: import("react").ElementType<any> | undefined;
17
+ } & {
18
+ themeSize: ThemeSize;
19
+ themeIntent: ThemeIntent;
20
+ }, {}, {
21
+ ref?: import("react").Ref<View> | undefined;
22
+ }>;
23
+ declare const StyledTextWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
24
+ theme?: import("@emotion/react").Theme | undefined;
25
+ as?: import("react").ElementType<any> | undefined;
26
+ }, {}, {
27
+ ref?: import("react").Ref<View> | undefined;
28
+ }>;
29
+ declare const StyledText: import("@emotion/native").StyledComponent<import("react-native").TextProps & {
30
+ theme?: import("@emotion/react").Theme | undefined;
31
+ as?: import("react").ElementType<any> | undefined;
32
+ } & {
33
+ themeSize: ThemeSize;
34
+ themeIntent: ThemeIntent;
35
+ }, {}, {
36
+ ref?: import("react").Ref<Text> | undefined;
37
+ }>;
38
+ declare const StyledImage: import("@emotion/native").StyledComponent<import("react-native").ImageProps & {
39
+ theme?: import("@emotion/react").Theme | undefined;
40
+ as?: import("react").ElementType<any> | undefined;
41
+ } & {
42
+ themeSize: ThemeSize;
43
+ }, {}, {
44
+ ref?: import("react").Ref<Image> | undefined;
45
+ }>;
46
+ export { StyledPressable, StyledView, StyledImage, StyledTextWrapper, StyledText, };
@@ -0,0 +1,25 @@
1
+ import { ImageSourcePropType, StyleProp, ViewProps, ViewStyle } from 'react-native';
2
+ interface AvatarProps extends ViewProps {
3
+ /** Callback function when pressing component. */
4
+ onPress?: () => void;
5
+ /** Image source to be displayed on avatar. */
6
+ source?: ImageSourcePropType;
7
+ /** Renders title in the placeholder. */
8
+ title?: string;
9
+ /**
10
+ * Intent of the Icon.
11
+ */
12
+ intent?: 'primary' | 'info' | 'danger' | 'success' | 'warning';
13
+ /** Size of the avatar. */
14
+ size?: 'small' | 'medium' | 'large' | 'xlarge';
15
+ /**
16
+ * Addditional style.
17
+ */
18
+ style?: StyleProp<ViewStyle>;
19
+ /**
20
+ * Testing id of the component.
21
+ */
22
+ testID?: string;
23
+ }
24
+ declare const Avatar: ({ onPress, source, testID, style, title, size, intent, }: AvatarProps) => JSX.Element | null;
25
+ export default Avatar;
@@ -0,0 +1,24 @@
1
+ import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
+ import { ReactNode } from 'react';
3
+ export interface StatusProps extends ViewProps {
4
+ children: ReactNode;
5
+ /**
6
+ * Whether the Status Badge is visible.
7
+ */
8
+ visible?: boolean;
9
+ /**
10
+ /**
11
+ * Visual intent color to apply to Status Badge.
12
+ */
13
+ intent?: 'success' | 'warning' | 'danger' | 'info' | 'archived';
14
+ /**
15
+ * Additional style.
16
+ */
17
+ style?: StyleProp<ViewStyle>;
18
+ /**
19
+ * Testing id of the component.
20
+ */
21
+ testID?: string;
22
+ }
23
+ declare const Status: ({ children, visible, intent, style, testID, ...nativeProps }: StatusProps) => JSX.Element;
24
+ export default Status;
@@ -1,20 +1,28 @@
1
1
  /// <reference types="react" />
2
- import { View, Text } from 'react-native';
3
- declare type ThemeIntent = 'success' | 'warning' | 'danger' | 'info';
4
- declare const StyledView: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
2
+ import { Animated, Text } from 'react-native';
3
+ declare type ThemeIntent = 'success' | 'warning' | 'danger' | 'info' | 'archived';
4
+ declare type ThemePadding = 'narrowContent' | 'wideContent';
5
+ declare const StyledView: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>> & {
6
+ children?: import("react").ReactNode;
7
+ } & {
5
8
  theme?: import("@emotion/react").Theme | undefined;
6
9
  as?: import("react").ElementType<any> | undefined;
7
10
  } & {
8
11
  themeIntent: ThemeIntent;
9
- }, {}, {
10
- ref?: import("react").Ref<View> | undefined;
11
- }>;
12
+ themePadding: ThemePadding;
13
+ }, {}, {}>;
12
14
  declare const StyledText: import("@emotion/native").StyledComponent<import("react-native").TextProps & {
13
15
  theme?: import("@emotion/react").Theme | undefined;
14
16
  as?: import("react").ElementType<any> | undefined;
15
- } & {
16
- themeIntent: ThemeIntent;
17
17
  }, {}, {
18
18
  ref?: import("react").Ref<Text> | undefined;
19
19
  }>;
20
- export { StyledView, StyledText };
20
+ declare const StyledStatus: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>> & {
21
+ children?: import("react").ReactNode;
22
+ } & {
23
+ theme?: import("@emotion/react").Theme | undefined;
24
+ as?: import("react").ElementType<any> | undefined;
25
+ } & {
26
+ themeIntent: ThemeIntent;
27
+ }, {}, {}>;
28
+ export { StyledView, StyledText, StyledStatus };
@@ -1,14 +1,22 @@
1
- import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
- import { ReactElement } from 'react';
3
- interface BadgeProps extends ViewProps {
1
+ import { Animated, StyleProp, ViewStyle } from 'react-native';
2
+ import React from 'react';
3
+ interface BadgeProps extends React.ComponentProps<typeof Animated.View> {
4
4
  /**
5
5
  * Content of the Badge.
6
6
  */
7
- content: string;
7
+ content: string | number;
8
+ /**
9
+ * Whether the Badge is visible.
10
+ */
11
+ visible?: boolean;
12
+ /**
13
+ * The maximum number displayed on the badge. If number exceeds this value, `${max}+` are displayed instead. (Only applied when content is number.)
14
+ */
15
+ max?: number;
8
16
  /**
9
17
  * Visual intent color to apply to Badge.
10
18
  */
11
- intent?: 'success' | 'warning' | 'danger' | 'info';
19
+ intent?: 'success' | 'warning' | 'danger' | 'info' | 'archived';
12
20
  /**
13
21
  * Additional style.
14
22
  */
@@ -18,5 +26,7 @@ interface BadgeProps extends ViewProps {
18
26
  */
19
27
  testID?: string;
20
28
  }
21
- declare const Badge: ({ content, intent, style, testID, ...nativeProps }: BadgeProps) => ReactElement;
22
- export default Badge;
29
+ declare const _default: (({ content: originalContent, visible, max, intent, style, testID, ...nativeProps }: BadgeProps) => JSX.Element) & {
30
+ Status: ({ children, visible, intent, style, testID, ...nativeProps }: import("./Status").StatusProps) => JSX.Element;
31
+ };
32
+ export default _default;
File without changes
@@ -0,0 +1,57 @@
1
+ import { ReactChild } from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { IconName } from '../Icon';
4
+ import { Intent, ThemeVariant } from './StyledButton';
5
+ export interface ButtonProps {
6
+ /**
7
+ * Helps users understand what will happen when they perform an action on the accessibility element when that result is not clear from the accessibility label.
8
+ */
9
+ accessibilityHint?: string;
10
+ /**
11
+ * A succinct label in a localized string that identifies the accessibility element
12
+ */
13
+ accessibilityLabel?: string;
14
+ /**
15
+ * Disable state of button.
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * Places an icon within the button, before the button's text
20
+ */
21
+ icon?: IconName;
22
+ /**
23
+ * Visual intent color to apply to button. It is required for `filled`, `outlined` and `text` variants.
24
+ */
25
+ intent?: 'primary' | 'secondary';
26
+ /**
27
+ * Loading state of button.
28
+ */
29
+ loading?: boolean;
30
+ /**
31
+ * Set the handler to handle press event.
32
+ */
33
+ onPress: () => void;
34
+ /**
35
+ * Places an icon within the button, after the button's text
36
+ */
37
+ rightIcon?: IconName;
38
+ /**
39
+ * Addditional style.
40
+ */
41
+ style?: StyleProp<ViewStyle>;
42
+ /**
43
+ * Testing id of the component.
44
+ */
45
+ testID?: string;
46
+ /**
47
+ * Button label.
48
+ */
49
+ text: ReactChild;
50
+ /**
51
+ * Button type.
52
+ */
53
+ variant?: 'basic-transparent' | 'filled' | 'outlined';
54
+ }
55
+ export declare const getThemeVariant: (variant: 'basic-transparent' | 'filled' | 'outlined', intent: Intent) => ThemeVariant;
56
+ declare const Button: ({ accessibilityHint, accessibilityLabel, disabled, icon, intent, loading, onPress, rightIcon, style, testID, text, variant, }: ButtonProps) => JSX.Element;
57
+ export default Button;
File without changes
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { View, ViewProps } from 'react-native';
3
+ import { Theme } from '@emotion/react';
4
+ declare type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'outlined-primary' | 'outlined-secondary';
5
+ declare const StyledLoadingIndicatorWrapper: import("@emotion/native").StyledComponent<ViewProps & {
6
+ theme?: Theme | undefined;
7
+ as?: import("react").ElementType<any> | undefined;
8
+ }, {}, {
9
+ ref?: import("react").Ref<View> | undefined;
10
+ }>;
11
+ declare const StyledLoadingDot: import("@emotion/native").StyledComponent<ViewProps & {
12
+ theme?: Theme | undefined;
13
+ as?: import("react").ElementType<any> | undefined;
14
+ } & {
15
+ size?: number | undefined;
16
+ themeVariant: ThemeVariant;
17
+ }, {}, {
18
+ ref?: import("react").Ref<View> | undefined;
19
+ }>;
20
+ export { StyledLoadingIndicatorWrapper, StyledLoadingDot };
@@ -0,0 +1,26 @@
1
+ import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
+ declare type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'outlined-primary' | 'outlined-secondary';
3
+ interface LoadingIndicatorProps extends ViewProps {
4
+ /**
5
+ * Size of the loading dot.
6
+ */
7
+ count?: number;
8
+ /**
9
+ * Size of the loading dot.
10
+ */
11
+ size?: number;
12
+ /**
13
+ * Additional style.
14
+ */
15
+ style?: StyleProp<ViewStyle>;
16
+ /**
17
+ * Testing id of the component.
18
+ */
19
+ testID?: string;
20
+ /**
21
+ * Testing id of the component.
22
+ */
23
+ themeVariant: ThemeVariant;
24
+ }
25
+ declare const LoadingIndicator: ({ count, size, testID, themeVariant, ...nativeProps }: LoadingIndicatorProps) => JSX.Element;
26
+ export default LoadingIndicator;
@@ -0,0 +1,40 @@
1
+ /// <reference types="react" />
2
+ import { View } from 'react-native';
3
+ import { Theme } from '@emotion/react';
4
+ declare type Intent = 'primary' | 'secondary';
5
+ declare type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'outlined-primary' | 'outlined-secondary';
6
+ declare const StyledButtonContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
7
+ theme?: Theme | undefined;
8
+ as?: import("react").ElementType<any> | undefined;
9
+ } & {
10
+ disabled?: boolean | undefined;
11
+ pressed?: boolean | undefined;
12
+ themeVariant: ThemeVariant;
13
+ }, {}, {
14
+ ref?: import("react").Ref<View> | undefined;
15
+ }>;
16
+ declare const StyledButtonText: import("@emotion/native").StyledComponent<import("../Typography/Text").TextProps & {
17
+ theme?: Theme | undefined;
18
+ as?: import("react").ElementType<any> | undefined;
19
+ } & {
20
+ disabled?: boolean | undefined;
21
+ pressed?: boolean | undefined;
22
+ themeVariant: ThemeVariant;
23
+ }, {}, {}>;
24
+ declare const StyledButtonIconWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
25
+ theme?: Theme | undefined;
26
+ as?: import("react").ElementType<any> | undefined;
27
+ } & {
28
+ themePosition: 'left' | 'right';
29
+ }, {}, {
30
+ ref?: import("react").Ref<View> | undefined;
31
+ }>;
32
+ declare const StyledButtonIcon: import("@emotion/native").StyledComponent<import("../Icon").IconProps & {
33
+ theme?: Theme | undefined;
34
+ as?: import("react").ElementType<any> | undefined;
35
+ } & {
36
+ disabled?: boolean | undefined;
37
+ pressed?: boolean | undefined;
38
+ themeVariant: ThemeVariant;
39
+ }, {}, {}>;
40
+ export { StyledButtonContainer, StyledButtonText, StyledButtonIconWrapper, StyledButtonIcon, Intent, ThemeVariant, };
@@ -1,4 +1,8 @@
1
- declare const Button: {
2
- readonly Icon: ({ hitSlop, onPress, icon, testID, style, size, intent, }: import("./IconButton").IconButtonProps) => JSX.Element;
3
- };
4
- export default Button;
1
+ import { FunctionComponent } from 'react';
2
+ import { ButtonProps } from './Button';
3
+ import IconButton from './IconButton';
4
+ interface CompoundButtonProps extends FunctionComponent<ButtonProps> {
5
+ Icon: typeof IconButton;
6
+ }
7
+ declare const CompoundButton: CompoundButtonProps;
8
+ export default CompoundButton;
@@ -3,7 +3,15 @@ import { View } from 'react-native';
3
3
  declare const StyledCard: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
4
4
  theme?: import("@emotion/react").Theme | undefined;
5
5
  as?: import("react").ElementType<any> | undefined;
6
+ } & {
7
+ themeVariant: 'basic' | 'data';
6
8
  }, {}, {
7
9
  ref?: import("react").Ref<View> | undefined;
8
10
  }>;
9
- export { StyledCard };
11
+ declare const LeftDataCard: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
12
+ theme?: import("@emotion/react").Theme | undefined;
13
+ as?: import("react").ElementType<any> | undefined;
14
+ }, {}, {
15
+ ref?: import("react").Ref<View> | undefined;
16
+ }>;
17
+ export { StyledCard, LeftDataCard };
@@ -5,6 +5,10 @@ interface CardProps extends ViewProps {
5
5
  * Card's content.
6
6
  */
7
7
  children?: ReactNode;
8
+ /**
9
+ * Card type.
10
+ */
11
+ variant?: 'basic' | 'data';
8
12
  /**
9
13
  * Addditional style.
10
14
  */
@@ -14,5 +18,5 @@ interface CardProps extends ViewProps {
14
18
  */
15
19
  testID?: string;
16
20
  }
17
- declare const Card: (props: CardProps) => JSX.Element;
21
+ declare const Card: ({ variant, children, ...nativeProps }: CardProps) => JSX.Element;
18
22
  export default Card;