@hero-design/rn 8.22.0 → 8.23.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 (32) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +235 -65
  3. package/lib/index.js +235 -64
  4. package/package.json +5 -5
  5. package/src/components/Alert/index.tsx +6 -0
  6. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  7. package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +5 -5
  8. package/src/components/List/ListItem.tsx +12 -8
  9. package/src/components/Success/StyledSuccess.tsx +87 -0
  10. package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +497 -0
  11. package/src/components/Success/__tests__/index.spec.tsx +78 -0
  12. package/src/components/Success/index.tsx +129 -0
  13. package/src/components/Tag/StyledTag.tsx +1 -1
  14. package/src/components/Tag/__tests__/Tag.spec.tsx +22 -71
  15. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +106 -53
  16. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +265 -0
  17. package/src/components/TextInput/__tests__/index.spec.tsx +29 -0
  18. package/src/components/TextInput/index.tsx +6 -1
  19. package/src/index.ts +2 -0
  20. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +33 -3
  21. package/src/theme/components/empty.ts +1 -1
  22. package/src/theme/components/error.ts +1 -1
  23. package/src/theme/components/success.ts +40 -0
  24. package/src/theme/components/tag.ts +1 -1
  25. package/src/theme/getTheme.ts +3 -0
  26. package/src/utils/hooks.ts +1 -1
  27. package/types/components/Success/StyledSuccess.d.ts +54 -0
  28. package/types/components/Success/index.d.ts +42 -0
  29. package/types/components/TextInput/index.d.ts +5 -1
  30. package/types/index.d.ts +2 -1
  31. package/types/theme/components/success.d.ts +32 -0
  32. package/types/theme/getTheme.d.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.22.0",
3
+ "version": "8.23.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.22.0",
24
+ "@hero-design/colors": "8.23.0",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -45,7 +45,7 @@
45
45
  "@babel/preset-typescript": "^7.17.12",
46
46
  "@babel/runtime": "^7.18.9",
47
47
  "@emotion/jest": "^11.9.3",
48
- "@hero-design/eslint-plugin": "8.22.0",
48
+ "@hero-design/eslint-plugin": "8.23.0",
49
49
  "@react-native-community/datetimepicker": "^3.5.2",
50
50
  "@react-native-community/slider": "4.1.12",
51
51
  "@rollup/plugin-babel": "^5.3.1",
@@ -61,9 +61,9 @@
61
61
  "@types/react-native": "^0.67.7",
62
62
  "@types/react-native-vector-icons": "^6.4.10",
63
63
  "babel-plugin-inline-import": "^3.0.0",
64
- "eslint-config-hd": "8.22.0",
64
+ "eslint-config-hd": "8.23.0",
65
65
  "jest": "^27.3.1",
66
- "prettier-config-hd": "8.22.0",
66
+ "prettier-config-hd": "8.23.0",
67
67
  "react": "18.0.0",
68
68
  "react-native": "0.69.7",
69
69
  "react-native-gesture-handler": "~2.1.0",
@@ -11,6 +11,7 @@ import {
11
11
  TextContainer,
12
12
  } from './StyledAlert';
13
13
  import type { IconName } from '../Icon';
14
+ import { useDeprecation } from '../../utils/hooks';
14
15
 
15
16
  const getIntentIcon = (
16
17
  intent: 'success' | 'info' | 'warning' | 'error' | 'notification'
@@ -84,6 +85,11 @@ const Alert = ({
84
85
  style,
85
86
  testID,
86
87
  }: AlertProps): JSX.Element => {
88
+ useDeprecation(
89
+ `Alert's notification intent is deprecated and will be removed in the next major release. Please use other intents instead.`,
90
+ intent === 'notification'
91
+ );
92
+
87
93
  return (
88
94
  <Container
89
95
  themeVariant={variant}
@@ -32,7 +32,7 @@ exports[`Empty renders empty state content correctly 1`] = `
32
32
  "color": "#001f23",
33
33
  "fontFamily": "RebondGrotesque-SemiBold",
34
34
  "fontSize": 24,
35
- "marginBottom": 16,
35
+ "marginBottom": 8,
36
36
  "textAlign": "center",
37
37
  },
38
38
  undefined,
@@ -127,7 +127,7 @@ exports[`Empty renders empty state with image correctly 1`] = `
127
127
  "color": "#001f23",
128
128
  "fontFamily": "RebondGrotesque-SemiBold",
129
129
  "fontSize": 24,
130
- "marginBottom": 16,
130
+ "marginBottom": 8,
131
131
  "textAlign": "center",
132
132
  },
133
133
  undefined,
@@ -35,7 +35,7 @@ exports[`Error renders error screen with custom image element correctly 1`] = `
35
35
  Array [
36
36
  Object {
37
37
  "height": 176,
38
- "marginBottom": 32,
38
+ "marginBottom": 24,
39
39
  "width": 176,
40
40
  },
41
41
  undefined,
@@ -159,7 +159,7 @@ exports[`Error renders error screen with image correctly 1`] = `
159
159
  Array [
160
160
  Object {
161
161
  "height": 176,
162
- "marginBottom": 32,
162
+ "marginBottom": 24,
163
163
  "width": 176,
164
164
  },
165
165
  undefined,
@@ -182,7 +182,7 @@ exports[`Error renders error screen with image correctly 1`] = `
182
182
  Array [
183
183
  Object {
184
184
  "height": 176,
185
- "marginBottom": 32,
185
+ "marginBottom": 24,
186
186
  "resizeMode": "contain",
187
187
  "width": 176,
188
188
  },
@@ -307,7 +307,7 @@ exports[`Error renders full screen error page correctly 1`] = `
307
307
  Array [
308
308
  Object {
309
309
  "height": 176,
310
- "marginBottom": 32,
310
+ "marginBottom": 24,
311
311
  "width": 176,
312
312
  },
313
313
  undefined,
@@ -330,7 +330,7 @@ exports[`Error renders full screen error page correctly 1`] = `
330
330
  Array [
331
331
  Object {
332
332
  "height": 176,
333
- "marginBottom": 32,
333
+ "marginBottom": 24,
334
334
  "resizeMode": "contain",
335
335
  "width": 176,
336
336
  },
@@ -1,21 +1,21 @@
1
1
  import React, { ReactElement } from 'react';
2
2
 
3
- import { View } from 'react-native';
4
3
  import type { ReactNode } from 'react';
5
4
  import type { StyleProp, ViewStyle } from 'react-native';
5
+ import { View } from 'react-native';
6
+ import { useTheme } from '../../theme';
7
+ import type { IconName } from '../Icon';
6
8
  import Icon from '../Icon';
7
9
  import Typography from '../Typography';
8
10
  import {
9
- StyledListItemContainer,
10
11
  StyledChildrenContainer,
11
- StyledLeadingStatus,
12
12
  StyledContentContainer,
13
+ StyledLeadingStatus,
14
+ StyledListItemContainer,
13
15
  StyledPrefixContainer,
14
16
  StyledSuffixContainer,
15
17
  StyledTitleContainer,
16
18
  } from './StyledListItem';
17
- import type { IconName } from '../Icon';
18
- import { useTheme } from '../../theme';
19
19
 
20
20
  export interface ListItemProps {
21
21
  /**
@@ -123,9 +123,13 @@ const ListItem = ({
123
123
  </StyledPrefixContainer>
124
124
  )}
125
125
  <StyledTitleContainer>
126
- <Typography.Text intent="body" fontSize="large">
127
- {title}
128
- </Typography.Text>
126
+ {typeof title === 'string' ? (
127
+ <Typography.Text intent="body" fontSize="large">
128
+ {title}
129
+ </Typography.Text>
130
+ ) : (
131
+ title
132
+ )}
129
133
  {!!subtitle && (
130
134
  <Typography.Text intent="subdued" fontSize="small">
131
135
  {subtitle}
@@ -0,0 +1,87 @@
1
+ import styled from '@emotion/native';
2
+ import { Modal, View } from 'react-native';
3
+ import Image from '../Image';
4
+ import Typography from '../Typography';
5
+ import Button from '../Button';
6
+
7
+ type SuccessVariant = 'full-screen' | 'in-page';
8
+
9
+ const StyledSuccessContainer = styled(View)<{ themeVariant: SuccessVariant }>(
10
+ ({ theme, themeVariant }) => ({
11
+ display: 'flex',
12
+ flex: 1,
13
+ flexDirection: 'column',
14
+ backgroundColor:
15
+ themeVariant === 'in-page'
16
+ ? theme.__hd__.success.colors.inPageBackground
17
+ : theme.__hd__.success.colors.fullScreenBackground,
18
+ })
19
+ );
20
+
21
+ const StyledSuccessImage = styled(Image)(({ theme }) => ({
22
+ marginBottom: theme.__hd__.success.space.imageMarginBottom,
23
+ width: theme.__hd__.success.sizes.image,
24
+ height: theme.__hd__.success.sizes.image,
25
+ resizeMode: 'contain',
26
+ }));
27
+
28
+ const StyledSuccessContent = styled(View)(({ theme }) => ({
29
+ display: 'flex',
30
+ flex: 1,
31
+ flexDirection: 'column',
32
+ justifyContent: 'center',
33
+ alignItems: 'center',
34
+ padding: theme.__hd__.success.space.wrapperPadding,
35
+ }));
36
+
37
+ const StyledSuccessImageContainer = styled(View)(({ theme }) => ({
38
+ marginBottom: theme.__hd__.success.space.imageMarginBottom,
39
+ width: theme.__hd__.success.sizes.image,
40
+ height: theme.__hd__.success.sizes.image,
41
+ }));
42
+
43
+ const StyledSuccessTitle = styled(Typography.Text)(({ theme }) => ({
44
+ fontFamily: theme.__hd__.success.fonts.title,
45
+ fontSize: theme.__hd__.success.fontSizes.title,
46
+ textAlign: 'center',
47
+ marginBottom: theme.__hd__.success.space.titleMarginBottom,
48
+ color: theme.__hd__.success.colors.title,
49
+ }));
50
+
51
+ const StyledSuccessDescription = styled(Typography.Text)(({ theme }) => ({
52
+ fontFamily: theme.__hd__.success.fonts.description,
53
+ fontSize: theme.__hd__.success.fontSizes.description,
54
+ textAlign: 'center',
55
+ color: theme.__hd__.success.colors.description,
56
+ }));
57
+
58
+ const StyledSuccessButtonContainer = styled(View)(({ theme }) => ({
59
+ display: 'flex',
60
+ flexDirection: 'column',
61
+ justifyContent: 'center',
62
+ alignItems: 'center',
63
+ paddingHorizontal: theme.__hd__.success.space.button.wrapperHorizontalPadding,
64
+ paddingVertical: theme.__hd__.success.space.button.wrapperVerticalPadding,
65
+ }));
66
+
67
+ const StyledSuccessButtonPrimary = styled(Button)(({ theme }) => ({
68
+ padding: theme.__hd__.success.space.button.padding,
69
+ }));
70
+
71
+ const StyledSuccessModal = styled(Modal)({
72
+ height: '100%',
73
+ width: '100%',
74
+ });
75
+
76
+ export {
77
+ SuccessVariant,
78
+ StyledSuccessImage,
79
+ StyledSuccessContainer,
80
+ StyledSuccessContent,
81
+ StyledSuccessImageContainer,
82
+ StyledSuccessTitle,
83
+ StyledSuccessDescription,
84
+ StyledSuccessButtonContainer,
85
+ StyledSuccessButtonPrimary,
86
+ StyledSuccessModal,
87
+ };