@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "7.7.0",
3
+ "version": "7.9.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -9,7 +9,6 @@
9
9
  "scripts": {
10
10
  "lint": "eslint src --ext .js,.jsx,.ts,.tsx --ignore-path ../../.gitignore",
11
11
  "type-check": "tsc --noEmit",
12
- "dev": "expo start",
13
12
  "test": "jest --runInBand",
14
13
  "test:watch": "jest --runInBand --watch",
15
14
  "test:ci": "jest --runInBand --logHeapUsage",
@@ -17,15 +16,12 @@
17
16
  "build:types": "tsc --noEmit false --emitDeclarationOnly",
18
17
  "build": "yarn build:js && yarn build:types",
19
18
  "build:watch": "yarn build:js -w & yarn build:types -w",
20
- "publish:npm": "yarn publish --access public",
21
- "start": "expo start --dev-client",
22
- "android": "expo run:android",
23
- "ios": "expo run:ios"
19
+ "publish:npm": "yarn publish --access public"
24
20
  },
25
21
  "dependencies": {
26
22
  "@emotion/native": "^11.9.3",
27
23
  "@emotion/react": "^11.9.3",
28
- "@hero-design/colors": "7.7.0"
24
+ "@hero-design/colors": "7.9.0"
29
25
  },
30
26
  "peerDependencies": {
31
27
  "react": "17.0.2",
@@ -51,7 +47,7 @@
51
47
  "@testing-library/react-native": "^9.1.0",
52
48
  "@types/jest": "^27.0.2",
53
49
  "@types/react": "^17.0.39",
54
- "@types/react-native": "^0.66.16",
50
+ "@types/react-native": "^0.67.7",
55
51
  "@types/react-native-vector-icons": "^6.4.10",
56
52
  "@typescript-eslint/eslint-plugin": "^5.12.1",
57
53
  "@typescript-eslint/parser": "^5.12.1",
@@ -5,7 +5,7 @@ exports[`Alert Icon render custom icon correctly 1`] = `
5
5
  style={
6
6
  Array [
7
7
  Object {
8
- "backgroundColor": "#1dbeee",
8
+ "backgroundColor": "#b5c3fd",
9
9
  "borderRadius": 0,
10
10
  "flexDirection": "row",
11
11
  "minHeight": 48,
@@ -246,7 +246,7 @@ exports[`Alert renders correctly when intent is info 1`] = `
246
246
  style={
247
247
  Array [
248
248
  Object {
249
- "backgroundColor": "#1dbeee",
249
+ "backgroundColor": "#b5c3fd",
250
250
  "borderRadius": 0,
251
251
  "flexDirection": "row",
252
252
  "minHeight": 48,
@@ -27,7 +27,7 @@ interface AvatarProps extends ViewProps {
27
27
  /** Size of the avatar. */
28
28
  size?: 'small' | 'medium' | 'large' | 'xlarge';
29
29
  /**
30
- * Addditional style.
30
+ * Additional style.
31
31
  */
32
32
  style?: StyleProp<ViewStyle>;
33
33
  /**
@@ -32,7 +32,7 @@ export interface ButtonProps {
32
32
  /**
33
33
  * Visual intent color to apply to button. It is required for `filled`, `outlined` and `text` variants.
34
34
  */
35
- intent?: 'primary' | 'secondary';
35
+ intent?: 'primary' | 'secondary' | 'danger';
36
36
  /**
37
37
  * Loading state of button.
38
38
  */
@@ -46,7 +46,7 @@ export interface ButtonProps {
46
46
  */
47
47
  rightIcon?: IconName;
48
48
  /**
49
- * Addditional style.
49
+ * Additional style.
50
50
  */
51
51
  style?: StyleProp<ViewStyle>;
52
52
  /**
@@ -66,11 +66,13 @@ export interface ButtonProps {
66
66
  const FILLED_VARIANTS = {
67
67
  primary: 'filled-primary',
68
68
  secondary: 'filled-secondary',
69
+ danger: 'filled-danger',
69
70
  } as const;
70
71
 
71
72
  const OUTLINED_VARIANTS = {
72
73
  primary: 'outlined-primary',
73
74
  secondary: 'outlined-secondary',
75
+ danger: 'outlined-danger',
74
76
  } as const;
75
77
 
76
78
  export const getThemeVariant = (
@@ -2,14 +2,16 @@ import { View, ViewProps } from 'react-native';
2
2
  import styled, { ReactNativeStyle } from '@emotion/native';
3
3
  import { Theme } from '@emotion/react';
4
4
 
5
- type Intent = 'primary' | 'secondary';
5
+ type Intent = 'primary' | 'secondary' | 'danger';
6
6
 
7
7
  type ThemeVariant =
8
8
  | 'basic-transparent'
9
9
  | 'filled-primary'
10
10
  | 'filled-secondary'
11
+ | 'filled-danger'
11
12
  | 'outlined-primary'
12
- | 'outlined-secondary';
13
+ | 'outlined-secondary'
14
+ | 'outlined-danger';
13
15
 
14
16
  const genLoadingIndicatorStyles = (
15
17
  theme: Theme,
@@ -34,6 +36,7 @@ const StyledLoadingDot = styled(View)<{
34
36
  case 'basic-transparent':
35
37
  case 'filled-primary':
36
38
  case 'filled-secondary':
39
+ case 'filled-danger':
37
40
  return {
38
41
  backgroundColor: theme.__hd__.button.colors.invertedText,
39
42
  };
@@ -41,6 +44,8 @@ const StyledLoadingDot = styled(View)<{
41
44
  return genLoadingIndicatorStyles(theme, 'primary');
42
45
  case 'outlined-secondary':
43
46
  return genLoadingIndicatorStyles(theme, 'secondary');
47
+ case 'outlined-danger':
48
+ return genLoadingIndicatorStyles(theme, 'danger');
44
49
  }
45
50
  };
46
51
 
@@ -9,8 +9,10 @@ describe('StyledLoadingIndicator', () => {
9
9
  ${'basic-transparent'}
10
10
  ${'filled-primary'}
11
11
  ${'filled-secondary'}
12
+ ${'filled-danger'}
12
13
  ${'outlined-primary'}
13
14
  ${'outlined-secondary'}
15
+ ${'outlined-danger'}
14
16
  `('has $themeVariant style', ({ themeVariant }) => {
15
17
  const { toJSON } = renderWithTheme(
16
18
  <StyledLoadingDot themeVariant={themeVariant} />
@@ -20,6 +20,26 @@ exports[`StyledLoadingIndicator has basic-transparent style 1`] = `
20
20
  />
21
21
  `;
22
22
 
23
+ exports[`StyledLoadingIndicator has filled-danger style 1`] = `
24
+ <View
25
+ style={
26
+ Array [
27
+ Object {
28
+ "backgroundColor": "#ffffff",
29
+ "borderRadius": 8,
30
+ "height": 12,
31
+ "marginBottom": 4,
32
+ "marginHorizontal": 8,
33
+ "marginTop": 4,
34
+ "width": 12,
35
+ },
36
+ undefined,
37
+ ]
38
+ }
39
+ themeVariant="filled-danger"
40
+ />
41
+ `;
42
+
23
43
  exports[`StyledLoadingIndicator has filled-primary style 1`] = `
24
44
  <View
25
45
  style={
@@ -60,6 +80,26 @@ exports[`StyledLoadingIndicator has filled-secondary style 1`] = `
60
80
  />
61
81
  `;
62
82
 
83
+ exports[`StyledLoadingIndicator has outlined-danger style 1`] = `
84
+ <View
85
+ style={
86
+ Array [
87
+ Object {
88
+ "backgroundColor": "#de350b",
89
+ "borderRadius": 8,
90
+ "height": 12,
91
+ "marginBottom": 4,
92
+ "marginHorizontal": 8,
93
+ "marginTop": 4,
94
+ "width": 12,
95
+ },
96
+ undefined,
97
+ ]
98
+ }
99
+ themeVariant="outlined-danger"
100
+ />
101
+ `;
102
+
63
103
  exports[`StyledLoadingIndicator has outlined-primary style 1`] = `
64
104
  <View
65
105
  style={
@@ -121,6 +121,127 @@ exports[`LoadingIndicator renders correctly when themeVariant is basic-transpare
121
121
  </View>
122
122
  `;
123
123
 
124
+ exports[`LoadingIndicator renders correctly when themeVariant is filled-danger 1`] = `
125
+ <View
126
+ collapsable={false}
127
+ nativeID="animatedComponent"
128
+ style={
129
+ Array [
130
+ Object {
131
+ "alignItems": "center",
132
+ "flexDirection": "row",
133
+ "justifyContent": "center",
134
+ "paddingVertical": 2,
135
+ },
136
+ Object {},
137
+ ]
138
+ }
139
+ >
140
+ <View
141
+ collapsable={false}
142
+ nativeID="animatedComponent"
143
+ style={
144
+ Object {
145
+ "transform": Array [
146
+ Object {
147
+ "scale": 1,
148
+ },
149
+ ],
150
+ }
151
+ }
152
+ >
153
+ <View
154
+ collapsable={false}
155
+ nativeID="animatedComponent"
156
+ size={12}
157
+ style={
158
+ Array [
159
+ Object {
160
+ "backgroundColor": "#ffffff",
161
+ "borderRadius": 8,
162
+ "height": 12,
163
+ "marginBottom": 4,
164
+ "marginHorizontal": 8,
165
+ "marginTop": 4,
166
+ "width": 12,
167
+ },
168
+ Object {},
169
+ ]
170
+ }
171
+ themeVariant="filled-danger"
172
+ />
173
+ </View>
174
+ <View
175
+ collapsable={false}
176
+ nativeID="animatedComponent"
177
+ style={
178
+ Object {
179
+ "transform": Array [
180
+ Object {
181
+ "scale": 1,
182
+ },
183
+ ],
184
+ }
185
+ }
186
+ >
187
+ <View
188
+ collapsable={false}
189
+ nativeID="animatedComponent"
190
+ size={12}
191
+ style={
192
+ Array [
193
+ Object {
194
+ "backgroundColor": "#ffffff",
195
+ "borderRadius": 8,
196
+ "height": 12,
197
+ "marginBottom": 4,
198
+ "marginHorizontal": 8,
199
+ "marginTop": 4,
200
+ "width": 12,
201
+ },
202
+ Object {},
203
+ ]
204
+ }
205
+ themeVariant="filled-danger"
206
+ />
207
+ </View>
208
+ <View
209
+ collapsable={false}
210
+ nativeID="animatedComponent"
211
+ style={
212
+ Object {
213
+ "transform": Array [
214
+ Object {
215
+ "scale": 1,
216
+ },
217
+ ],
218
+ }
219
+ }
220
+ >
221
+ <View
222
+ collapsable={false}
223
+ nativeID="animatedComponent"
224
+ size={12}
225
+ style={
226
+ Array [
227
+ Object {
228
+ "backgroundColor": "#ffffff",
229
+ "borderRadius": 8,
230
+ "height": 12,
231
+ "marginBottom": 4,
232
+ "marginHorizontal": 8,
233
+ "marginTop": 4,
234
+ "width": 12,
235
+ },
236
+ Object {},
237
+ ]
238
+ }
239
+ themeVariant="filled-danger"
240
+ />
241
+ </View>
242
+ </View>
243
+ `;
244
+
124
245
  exports[`LoadingIndicator renders correctly when themeVariant is filled-primary 1`] = `
125
246
  <View
126
247
  collapsable={false}
@@ -363,6 +484,127 @@ exports[`LoadingIndicator renders correctly when themeVariant is filled-secondar
363
484
  </View>
364
485
  `;
365
486
 
487
+ exports[`LoadingIndicator renders correctly when themeVariant is outlined-danger 1`] = `
488
+ <View
489
+ collapsable={false}
490
+ nativeID="animatedComponent"
491
+ style={
492
+ Array [
493
+ Object {
494
+ "alignItems": "center",
495
+ "flexDirection": "row",
496
+ "justifyContent": "center",
497
+ "paddingVertical": 2,
498
+ },
499
+ Object {},
500
+ ]
501
+ }
502
+ >
503
+ <View
504
+ collapsable={false}
505
+ nativeID="animatedComponent"
506
+ style={
507
+ Object {
508
+ "transform": Array [
509
+ Object {
510
+ "scale": 1,
511
+ },
512
+ ],
513
+ }
514
+ }
515
+ >
516
+ <View
517
+ collapsable={false}
518
+ nativeID="animatedComponent"
519
+ size={12}
520
+ style={
521
+ Array [
522
+ Object {
523
+ "backgroundColor": "#de350b",
524
+ "borderRadius": 8,
525
+ "height": 12,
526
+ "marginBottom": 4,
527
+ "marginHorizontal": 8,
528
+ "marginTop": 4,
529
+ "width": 12,
530
+ },
531
+ Object {},
532
+ ]
533
+ }
534
+ themeVariant="outlined-danger"
535
+ />
536
+ </View>
537
+ <View
538
+ collapsable={false}
539
+ nativeID="animatedComponent"
540
+ style={
541
+ Object {
542
+ "transform": Array [
543
+ Object {
544
+ "scale": 1,
545
+ },
546
+ ],
547
+ }
548
+ }
549
+ >
550
+ <View
551
+ collapsable={false}
552
+ nativeID="animatedComponent"
553
+ size={12}
554
+ style={
555
+ Array [
556
+ Object {
557
+ "backgroundColor": "#de350b",
558
+ "borderRadius": 8,
559
+ "height": 12,
560
+ "marginBottom": 4,
561
+ "marginHorizontal": 8,
562
+ "marginTop": 4,
563
+ "width": 12,
564
+ },
565
+ Object {},
566
+ ]
567
+ }
568
+ themeVariant="outlined-danger"
569
+ />
570
+ </View>
571
+ <View
572
+ collapsable={false}
573
+ nativeID="animatedComponent"
574
+ style={
575
+ Object {
576
+ "transform": Array [
577
+ Object {
578
+ "scale": 1,
579
+ },
580
+ ],
581
+ }
582
+ }
583
+ >
584
+ <View
585
+ collapsable={false}
586
+ nativeID="animatedComponent"
587
+ size={12}
588
+ style={
589
+ Array [
590
+ Object {
591
+ "backgroundColor": "#de350b",
592
+ "borderRadius": 8,
593
+ "height": 12,
594
+ "marginBottom": 4,
595
+ "marginHorizontal": 8,
596
+ "marginTop": 4,
597
+ "width": 12,
598
+ },
599
+ Object {},
600
+ ]
601
+ }
602
+ themeVariant="outlined-danger"
603
+ />
604
+ </View>
605
+ </View>
606
+ `;
607
+
366
608
  exports[`LoadingIndicator renders correctly when themeVariant is outlined-primary 1`] = `
367
609
  <View
368
610
  collapsable={false}
@@ -9,8 +9,10 @@ describe('LoadingIndicator', () => {
9
9
  ${'basic-transparent'}
10
10
  ${'filled-primary'}
11
11
  ${'filled-secondary'}
12
+ ${'filled-danger'}
12
13
  ${'outlined-primary'}
13
14
  ${'outlined-secondary'}
15
+ ${'outlined-danger'}
14
16
  `(
15
17
  'renders correctly when themeVariant is $themeVariant',
16
18
  ({ themeVariant }) => {
@@ -16,8 +16,10 @@ type ThemeVariant =
16
16
  | 'basic-transparent'
17
17
  | 'filled-primary'
18
18
  | 'filled-secondary'
19
+ | 'filled-danger'
19
20
  | 'outlined-primary'
20
- | 'outlined-secondary';
21
+ | 'outlined-secondary'
22
+ | 'outlined-danger';
21
23
 
22
24
  const AnimatedLoadingIndicatorWrapper = Animated.createAnimatedComponent(
23
25
  StyledLoadingIndicatorWrapper
@@ -5,18 +5,21 @@ import { Theme } from '@emotion/react';
5
5
  import Icon from '../Icon';
6
6
  import Typography from '../Typography';
7
7
 
8
- type Intent = 'primary' | 'secondary';
8
+ type Intent = 'primary' | 'secondary' | 'danger';
9
9
 
10
10
  type ThemeVariant =
11
11
  | 'basic-transparent'
12
12
  | 'filled-primary'
13
13
  | 'filled-secondary'
14
+ | 'filled-danger'
14
15
  | 'outlined-primary'
15
- | 'outlined-secondary';
16
+ | 'outlined-secondary'
17
+ | 'outlined-danger';
16
18
 
17
19
  const PRESSED_COLORS = {
18
20
  primary: 'pressedPrimary',
19
21
  secondary: 'pressedSecondary',
22
+ danger: 'pressedDanger',
20
23
  } as const;
21
24
 
22
25
  const genBasicTransparentContainerStyles = (
@@ -161,10 +164,14 @@ const StyledButtonContainer = styled(View)<{
161
164
  return genFilledContainerStyles(theme, 'primary', pressed, disabled);
162
165
  case 'filled-secondary':
163
166
  return genFilledContainerStyles(theme, 'secondary', pressed, disabled);
167
+ case 'filled-danger':
168
+ return genFilledContainerStyles(theme, 'danger', pressed, disabled);
164
169
  case 'outlined-primary':
165
170
  return genOutlineContainerStyles(theme, 'primary', pressed, disabled);
166
171
  case 'outlined-secondary':
167
172
  return genOutlineContainerStyles(theme, 'secondary', pressed, disabled);
173
+ case 'outlined-danger':
174
+ return genOutlineContainerStyles(theme, 'danger', pressed, disabled);
168
175
  }
169
176
  });
170
177
 
@@ -185,6 +192,7 @@ const StyledButtonText = styled(Typography.Text)<{
185
192
  };
186
193
  case 'filled-primary':
187
194
  case 'filled-secondary':
195
+ case 'filled-danger':
188
196
  return {
189
197
  fontSize: theme.__hd__.button.fontSize.default,
190
198
  lineHeight: theme.__hd__.button.lineHeight.default,
@@ -194,6 +202,8 @@ const StyledButtonText = styled(Typography.Text)<{
194
202
  return genOutlineTextStyles(theme, 'primary', pressed, disabled);
195
203
  case 'outlined-secondary':
196
204
  return genOutlineTextStyles(theme, 'secondary', pressed, disabled);
205
+ case 'outlined-danger':
206
+ return genOutlineTextStyles(theme, 'danger', pressed, disabled);
197
207
  }
198
208
  };
199
209
  return {
@@ -230,11 +240,14 @@ const StyledButtonIcon = styled(Icon)<{
230
240
  };
231
241
  case 'filled-primary':
232
242
  case 'filled-secondary':
243
+ case 'filled-danger':
233
244
  return { color: theme.__hd__.button.colors.invertedText };
234
245
  case 'outlined-primary':
235
246
  return genOutlineTextStyles(theme, 'primary', pressed, disabled);
236
247
  case 'outlined-secondary':
237
248
  return genOutlineTextStyles(theme, 'secondary', pressed, disabled);
249
+ case 'outlined-danger':
250
+ return genOutlineTextStyles(theme, 'danger', pressed, disabled);
238
251
  }
239
252
  };
240
253
 
@@ -78,8 +78,10 @@ describe('getThemeVariant', () => {
78
78
  ${'basic-transparent'} | ${'primary'} | ${'basic-transparent'}
79
79
  ${'filled'} | ${'primary'} | ${'filled-primary'}
80
80
  ${'filled'} | ${'secondary'} | ${'filled-secondary'}
81
+ ${'filled'} | ${'danger'} | ${'filled-danger'}
81
82
  ${'outlined'} | ${'primary'} | ${'outlined-primary'}
82
83
  ${'outlined'} | ${'secondary'} | ${'outlined-secondary'}
84
+ ${'outlined'} | ${'danger'} | ${'outlined-danger'}
83
85
  `('returns $themeVariant', ({ variant, intent, themeVariant }) => {
84
86
  expect(getThemeVariant(variant, intent)).toBe(themeVariant);
85
87
  });
@@ -15,8 +15,10 @@ describe('StyledButtonContainer', () => {
15
15
  ${'basic-transparent'}
16
16
  ${'filled-primary'}
17
17
  ${'filled-secondary'}
18
+ ${'filled-danger'}
18
19
  ${'outlined-primary'}
19
20
  ${'outlined-secondary'}
21
+ ${'outlined-danger'}
20
22
  `('has $themeVariant style', ({ themeVariant }) => {
21
23
  const { toJSON } = renderWithTheme(
22
24
  <StyledButtonContainer themeVariant={themeVariant} />
@@ -30,8 +32,10 @@ describe('StyledButtonContainer', () => {
30
32
  ${'basic-transparent'}
31
33
  ${'filled-primary'}
32
34
  ${'filled-secondary'}
35
+ ${'filled-danger'}
33
36
  ${'outlined-primary'}
34
37
  ${'outlined-secondary'}
38
+ ${'outlined-danger'}
35
39
  `(
36
40
  'has pressed with the correct variant $themeVariant style',
37
41
  ({ themeVariant }) => {
@@ -57,8 +61,10 @@ describe('StyledButtonText', () => {
57
61
  ${'basic-transparent'}
58
62
  ${'filled-primary'}
59
63
  ${'filled-secondary'}
64
+ ${'filled-danger'}
60
65
  ${'outlined-primary'}
61
66
  ${'outlined-secondary'}
67
+ ${'outlined-danger'}
62
68
  `('has $themeVariant style', ({ themeVariant }) => {
63
69
  const { toJSON } = renderWithTheme(
64
70
  <StyledButtonText themeVariant={themeVariant}>Example</StyledButtonText>
@@ -72,8 +78,10 @@ describe('StyledButtonText', () => {
72
78
  ${'basic-transparent'}
73
79
  ${'filled-primary'}
74
80
  ${'filled-secondary'}
81
+ ${'filled-danger'}
75
82
  ${'outlined-primary'}
76
83
  ${'outlined-secondary'}
84
+ ${'outlined-danger'}
77
85
  `(
78
86
  'has pressed with the correct variant $themeVariant style',
79
87
  ({ themeVariant }) => {
@@ -117,8 +125,10 @@ describe('StyledButtonIcon', () => {
117
125
  ${'basic-transparent'}
118
126
  ${'filled-primary'}
119
127
  ${'filled-secondary'}
128
+ ${'filled-danger'}
120
129
  ${'outlined-primary'}
121
130
  ${'outlined-secondary'}
131
+ ${'outlined-danger'}
122
132
  `('has $themeVariant style', ({ themeVariant }) => {
123
133
  const { toJSON } = renderWithTheme(
124
134
  <StyledButtonIcon icon="bell" themeVariant={themeVariant} />
@@ -132,8 +142,10 @@ describe('StyledButtonIcon', () => {
132
142
  ${'basic-transparent'}
133
143
  ${'filled-primary'}
134
144
  ${'filled-secondary'}
145
+ ${'filled-danger'}
135
146
  ${'outlined-primary'}
136
147
  ${'outlined-secondary'}
148
+ ${'outlined-danger'}
137
149
  `(
138
150
  'has pressed with the correct variant $themeVariant style',
139
151
  ({ themeVariant }) => {