@hero-design/rn 7.10.2 → 7.12.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 (103) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/assets/fonts/hero-icons.ttf +0 -0
  3. package/es/index.js +3778 -728
  4. package/global-setup.js +3 -0
  5. package/jest.config.js +1 -0
  6. package/lib/assets/fonts/hero-icons.ttf +0 -0
  7. package/lib/index.js +3779 -726
  8. package/package.json +7 -3
  9. package/rollup.config.js +8 -1
  10. package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
  11. package/src/components/ContentNavigator/__tests__/index.spec.tsx +19 -2
  12. package/src/components/ContentNavigator/index.tsx +12 -1
  13. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
  14. package/src/components/FAB/ActionGroup/index.tsx +16 -5
  15. package/src/components/Icon/HeroIcon/selection.json +1 -1
  16. package/src/components/Icon/IconList.ts +1 -0
  17. package/src/components/PinInput/PinCell.tsx +34 -0
  18. package/src/components/PinInput/StyledPinInput.tsx +88 -0
  19. package/src/components/PinInput/__tests__/PinCell.spec.tsx +48 -0
  20. package/src/components/PinInput/__tests__/StyledPinInput.spec.tsx +22 -0
  21. package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +186 -0
  22. package/src/components/PinInput/__tests__/__snapshots__/StyledPinInput.spec.tsx.snap +58 -0
  23. package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +1028 -0
  24. package/src/components/PinInput/__tests__/index.spec.tsx +91 -0
  25. package/src/components/PinInput/index.tsx +173 -0
  26. package/src/components/Select/MultiSelect/Option.tsx +1 -1
  27. package/src/components/Select/MultiSelect/OptionList.tsx +48 -26
  28. package/src/components/Select/MultiSelect/__tests__/OptionList.spec.tsx +13 -0
  29. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1062 -556
  30. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +983 -889
  31. package/src/components/Select/MultiSelect/index.tsx +59 -31
  32. package/src/components/Select/SingleSelect/OptionList.tsx +45 -26
  33. package/src/components/Select/SingleSelect/__tests__/OptionList.spec.tsx +8 -0
  34. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +992 -500
  35. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +880 -786
  36. package/src/components/Select/SingleSelect/index.tsx +60 -31
  37. package/src/components/Select/StyledOptionList.tsx +88 -0
  38. package/src/components/Select/StyledSelect.tsx +18 -16
  39. package/src/components/Select/__tests__/StyledSelect.spec.tsx +1 -14
  40. package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +0 -13
  41. package/src/components/Select/types.tsx +47 -0
  42. package/src/components/TextInput/__tests__/index.spec.tsx +15 -0
  43. package/src/components/TextInput/index.tsx +20 -16
  44. package/src/components/TimePicker/StyledTimePicker.tsx +8 -0
  45. package/src/components/TimePicker/TimePickerAndroid.tsx +61 -0
  46. package/src/components/TimePicker/TimePickerIOS.tsx +91 -0
  47. package/src/components/TimePicker/__tests__/TimePicker.spec.tsx +34 -0
  48. package/src/components/TimePicker/__tests__/TimePickerAndroid.spec.tsx +39 -0
  49. package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +46 -0
  50. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +200 -0
  51. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +513 -0
  52. package/src/components/TimePicker/index.tsx +15 -0
  53. package/src/components/TimePicker/types.ts +50 -0
  54. package/src/components/Typography/Text/StyledText.tsx +1 -1
  55. package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
  56. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
  57. package/src/components/Typography/Text/index.tsx +1 -1
  58. package/src/index.ts +4 -0
  59. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +44 -0
  60. package/src/theme/components/pinInput.ts +45 -0
  61. package/src/theme/components/select.ts +4 -0
  62. package/src/theme/components/timePicker.ts +11 -0
  63. package/src/theme/components/typography.ts +2 -0
  64. package/src/theme/global/colors.ts +1 -1
  65. package/src/theme/global/space.ts +10 -10
  66. package/src/theme/index.ts +9 -3
  67. package/testUtils/setup.tsx +10 -0
  68. package/types/components/ContentNavigator/index.d.ts +5 -1
  69. package/types/components/Icon/IconList.d.ts +1 -1
  70. package/types/components/Icon/utils.d.ts +1 -1
  71. package/types/components/PinInput/PinCell.d.ts +8 -0
  72. package/types/components/PinInput/StyledPinInput.d.ts +73 -0
  73. package/types/components/PinInput/__tests__/PinCell.spec.d.ts +1 -0
  74. package/types/components/PinInput/__tests__/StyledPinInput.spec.d.ts +1 -0
  75. package/types/components/PinInput/__tests__/index.spec.d.ts +1 -0
  76. package/types/components/PinInput/index.d.ts +48 -0
  77. package/types/components/Select/MultiSelect/OptionList.d.ts +1 -1
  78. package/types/components/Select/MultiSelect/index.d.ts +3 -25
  79. package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
  80. package/types/components/Select/SingleSelect/index.d.ts +4 -26
  81. package/types/components/Select/StyledOptionList.d.ts +17 -0
  82. package/types/components/Select/StyledSelect.d.ts +7 -7
  83. package/types/components/Select/index.d.ts +1 -1
  84. package/types/components/Select/types.d.ts +44 -0
  85. package/types/components/TimePicker/StyledTimePicker.d.ts +8 -0
  86. package/types/components/TimePicker/TimePickerAndroid.d.ts +3 -0
  87. package/types/components/TimePicker/TimePickerIOS.d.ts +3 -0
  88. package/types/components/TimePicker/__tests__/TimePicker.spec.d.ts +1 -0
  89. package/types/components/TimePicker/__tests__/TimePickerAndroid.spec.d.ts +1 -0
  90. package/types/components/TimePicker/__tests__/TimePickerIOS.spec.d.ts +1 -0
  91. package/types/components/TimePicker/index.d.ts +3 -0
  92. package/types/components/TimePicker/types.d.ts +49 -0
  93. package/types/components/Typography/Text/StyledText.d.ts +1 -1
  94. package/types/components/Typography/Text/index.d.ts +1 -1
  95. package/types/index.d.ts +3 -1
  96. package/types/theme/components/pinInput.d.ts +35 -0
  97. package/types/theme/components/select.d.ts +4 -0
  98. package/types/theme/components/timePicker.d.ts +6 -0
  99. package/types/theme/components/typography.d.ts +2 -0
  100. package/types/theme/index.d.ts +6 -2
  101. package/src/components/Select/types.ts +0 -1
  102. package/src/components/TextInput/__tests__/.log/ti-10343.log +0 -62
  103. package/src/components/TextInput/__tests__/.log/tsserver.log +0 -15584
@@ -33,6 +33,7 @@ const IconList = [
33
33
  'circle-up',
34
34
  'circle-warning',
35
35
  'clock',
36
+ 'clock-3',
36
37
  'cloud-download',
37
38
  'cloud-upload',
38
39
  'cog',
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import {
3
+ State,
4
+ StyledCell,
5
+ StyledCellText,
6
+ StyledFilledMask,
7
+ StyledMask,
8
+ } from './StyledPinInput';
9
+
10
+ function PinCell({
11
+ value,
12
+ secure = true,
13
+ focused = false,
14
+ state = 'default',
15
+ }: {
16
+ value: string;
17
+ secure?: boolean;
18
+ focused?: boolean;
19
+ state?: State;
20
+ }) {
21
+ return (
22
+ <StyledCell themeFocused={focused} themeState={state}>
23
+ {value === '' && <StyledMask themeState={state} testID="pin-cell-mask" />}
24
+ {value !== '' && secure && (
25
+ <StyledFilledMask themeState={state} testID="pin-cell-filled-mask" />
26
+ )}
27
+ {value !== '' && !secure && (
28
+ <StyledCellText themeState={state}>{value}</StyledCellText>
29
+ )}
30
+ </StyledCell>
31
+ );
32
+ }
33
+
34
+ export default PinCell;
@@ -0,0 +1,88 @@
1
+ import styled from '@emotion/native';
2
+ import { Text, TextInput, View } from 'react-native';
3
+
4
+ export const StyledWrapper = styled(View)(() => ({
5
+ alignContent: 'flex-start',
6
+ }));
7
+
8
+ export const StyledPinWrapper = styled(View)(() => ({
9
+ flexDirection: 'row',
10
+ }));
11
+
12
+ export type State = 'default' | 'disabled' | 'error';
13
+
14
+ export const StyledCell = styled(View)<{
15
+ themeFocused: boolean;
16
+ themeState: State;
17
+ }>(({ theme, themeFocused, themeState }) => ({
18
+ justifyContent: 'center',
19
+ alignItems: 'center',
20
+ width: theme.__hd__.pinInput.sizes.cellWidth,
21
+ height: theme.__hd__.pinInput.sizes.cellHeight,
22
+ borderWidth: themeFocused
23
+ ? theme.__hd__.pinInput.borderWidths.focused
24
+ : theme.__hd__.pinInput.borderWidths.default,
25
+ borderRadius: theme.__hd__.pinInput.radii.cell,
26
+ borderColor: theme.__hd__.pinInput.colors[themeState],
27
+ }));
28
+
29
+ export const StyledCellText = styled(Text)<{
30
+ themeState: State;
31
+ }>(({ theme, themeState }) => ({
32
+ fontFamily: theme.__hd__.pinInput.fonts.cellText,
33
+ fontSize: theme.__hd__.pinInput.fontSizes.cellText,
34
+ color: theme.__hd__.pinInput.colors[themeState],
35
+ }));
36
+
37
+ export const StyledSpacer = styled(View)(({ theme }) => ({
38
+ marginLeft: theme.__hd__.pinInput.space.spacer,
39
+ }));
40
+
41
+ export const StyledMask = styled(View)<{
42
+ themeState: State;
43
+ }>(({ theme, themeState }) => ({
44
+ width: theme.__hd__.pinInput.sizes.mask,
45
+ height: theme.__hd__.pinInput.sizes.mask,
46
+ borderWidth: theme.__hd__.pinInput.borderWidths.default,
47
+ borderRadius: theme.__hd__.pinInput.radii.mask,
48
+ borderColor: theme.__hd__.pinInput.colors[themeState],
49
+ }));
50
+
51
+ export const StyledFilledMask = styled(View)<{
52
+ themeState: State;
53
+ }>(({ theme, themeState }) => ({
54
+ width: theme.__hd__.pinInput.sizes.mask,
55
+ height: theme.__hd__.pinInput.sizes.mask,
56
+ borderWidth: theme.__hd__.pinInput.borderWidths.default,
57
+ borderRadius: theme.__hd__.pinInput.radii.mask,
58
+ borderColor: theme.__hd__.pinInput.colors[themeState],
59
+ backgroundColor: theme.__hd__.pinInput.colors[themeState],
60
+ }));
61
+
62
+ export const StyledHiddenInput = styled(TextInput)<{ themePinLength: number }>(
63
+ ({ themePinLength, theme }) => {
64
+ const { cellWidth } = theme.__hd__.pinInput.sizes;
65
+ const spacerWidth = theme.__hd__.pinInput.space.spacer;
66
+
67
+ return {
68
+ position: 'absolute',
69
+ opacity: 0,
70
+ left: 0,
71
+ top: 0,
72
+ width: themePinLength * cellWidth + (themePinLength - 1) * spacerWidth,
73
+ height: '100%',
74
+ };
75
+ }
76
+ );
77
+
78
+ export const StyledErrorContainer = styled(View)(({ theme }) => ({
79
+ flexDirection: 'row',
80
+ paddingTop: theme.__hd__.pinInput.space.errorMessagePadding,
81
+ }));
82
+
83
+ export const StyledErrorMessage = styled(Text)(({ theme }) => ({
84
+ fontFamily: theme.__hd__.pinInput.fonts.errorMessage,
85
+ fontSize: theme.__hd__.pinInput.fontSizes.errorMessage,
86
+ color: theme.__hd__.pinInput.colors.error,
87
+ paddingLeft: theme.__hd__.pinInput.space.errorMessagePadding,
88
+ }));
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
3
+ import PinCell from '../PinCell';
4
+
5
+ describe('PinCell', () => {
6
+ it('renders mask when value is an empty string', () => {
7
+ const { getByTestId } = renderWithTheme(<PinCell value="" />);
8
+
9
+ expect(getByTestId('pin-cell-mask')).toBeDefined();
10
+ });
11
+
12
+ it('renders text when secure is false', () => {
13
+ const { queryAllByText } = renderWithTheme(
14
+ <PinCell value="1" secure={false} />
15
+ );
16
+
17
+ expect(queryAllByText('1')).toHaveLength(1);
18
+ });
19
+
20
+ it('renders filled mask when secure is true', () => {
21
+ const { getByTestId, queryAllByText } = renderWithTheme(
22
+ <PinCell value="1" secure />
23
+ );
24
+
25
+ expect(queryAllByText('1')).toHaveLength(0);
26
+ expect(getByTestId('pin-cell-filled-mask')).toBeDefined();
27
+ });
28
+
29
+ // this covers tests for Styled-Components in PinCell
30
+ // including StyledCell, StyledMask, StyledCellText, StyledFilledMask
31
+ it.each`
32
+ focused | state
33
+ ${true} | ${'default'}
34
+ ${true} | ${'error'}
35
+ ${false} | ${'default'}
36
+ ${false} | ${'disabled'}
37
+ ${false} | ${'error'}
38
+ `(
39
+ 'renders correctly when focused is $focused, state is $state',
40
+ ({ focused, state }) => {
41
+ const { toJSON } = renderWithTheme(
42
+ <PinCell value="1" secure={false} focused={focused} state={state} />
43
+ );
44
+
45
+ expect(toJSON()).toMatchSnapshot();
46
+ }
47
+ );
48
+ });
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
3
+ import { StyledHiddenInput } from '../StyledPinInput';
4
+
5
+ describe('StyledHiddenInput', () => {
6
+ it.each`
7
+ themePinLength | width
8
+ ${4} | ${208}
9
+ ${6} | ${320}
10
+ ${8} | ${432}
11
+ `(
12
+ 'has correct width when pin length is $themePinLength',
13
+ ({ themePinLength, width }) => {
14
+ const wrapper = renderWithTheme(
15
+ <StyledHiddenInput themePinLength={themePinLength} />
16
+ );
17
+
18
+ expect(wrapper.toJSON()).toHaveStyle({ width });
19
+ expect(wrapper.toJSON()).toMatchSnapshot();
20
+ }
21
+ );
22
+ });
@@ -0,0 +1,186 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`PinCell renders correctly when focused is false, state is default 1`] = `
4
+ <View
5
+ style={
6
+ Array [
7
+ Object {
8
+ "alignItems": "center",
9
+ "borderColor": "#292a2b",
10
+ "borderRadius": 8,
11
+ "borderWidth": 1,
12
+ "height": 48,
13
+ "justifyContent": "center",
14
+ "width": 40,
15
+ },
16
+ undefined,
17
+ ]
18
+ }
19
+ themeFocused={false}
20
+ themeState="default"
21
+ >
22
+ <Text
23
+ style={
24
+ Array [
25
+ Object {
26
+ "color": "#292a2b",
27
+ "fontFamily": "BeVietnamPro-SemiBold",
28
+ "fontSize": 28,
29
+ },
30
+ undefined,
31
+ ]
32
+ }
33
+ themeState="default"
34
+ >
35
+ 1
36
+ </Text>
37
+ </View>
38
+ `;
39
+
40
+ exports[`PinCell renders correctly when focused is false, state is disabled 1`] = `
41
+ <View
42
+ style={
43
+ Array [
44
+ Object {
45
+ "alignItems": "center",
46
+ "borderColor": "#bfc1c5",
47
+ "borderRadius": 8,
48
+ "borderWidth": 1,
49
+ "height": 48,
50
+ "justifyContent": "center",
51
+ "width": 40,
52
+ },
53
+ undefined,
54
+ ]
55
+ }
56
+ themeFocused={false}
57
+ themeState="disabled"
58
+ >
59
+ <Text
60
+ style={
61
+ Array [
62
+ Object {
63
+ "color": "#bfc1c5",
64
+ "fontFamily": "BeVietnamPro-SemiBold",
65
+ "fontSize": 28,
66
+ },
67
+ undefined,
68
+ ]
69
+ }
70
+ themeState="disabled"
71
+ >
72
+ 1
73
+ </Text>
74
+ </View>
75
+ `;
76
+
77
+ exports[`PinCell renders correctly when focused is false, state is error 1`] = `
78
+ <View
79
+ style={
80
+ Array [
81
+ Object {
82
+ "alignItems": "center",
83
+ "borderColor": "#de350b",
84
+ "borderRadius": 8,
85
+ "borderWidth": 1,
86
+ "height": 48,
87
+ "justifyContent": "center",
88
+ "width": 40,
89
+ },
90
+ undefined,
91
+ ]
92
+ }
93
+ themeFocused={false}
94
+ themeState="error"
95
+ >
96
+ <Text
97
+ style={
98
+ Array [
99
+ Object {
100
+ "color": "#de350b",
101
+ "fontFamily": "BeVietnamPro-SemiBold",
102
+ "fontSize": 28,
103
+ },
104
+ undefined,
105
+ ]
106
+ }
107
+ themeState="error"
108
+ >
109
+ 1
110
+ </Text>
111
+ </View>
112
+ `;
113
+
114
+ exports[`PinCell renders correctly when focused is true, state is default 1`] = `
115
+ <View
116
+ style={
117
+ Array [
118
+ Object {
119
+ "alignItems": "center",
120
+ "borderColor": "#292a2b",
121
+ "borderRadius": 8,
122
+ "borderWidth": 2,
123
+ "height": 48,
124
+ "justifyContent": "center",
125
+ "width": 40,
126
+ },
127
+ undefined,
128
+ ]
129
+ }
130
+ themeFocused={true}
131
+ themeState="default"
132
+ >
133
+ <Text
134
+ style={
135
+ Array [
136
+ Object {
137
+ "color": "#292a2b",
138
+ "fontFamily": "BeVietnamPro-SemiBold",
139
+ "fontSize": 28,
140
+ },
141
+ undefined,
142
+ ]
143
+ }
144
+ themeState="default"
145
+ >
146
+ 1
147
+ </Text>
148
+ </View>
149
+ `;
150
+
151
+ exports[`PinCell renders correctly when focused is true, state is error 1`] = `
152
+ <View
153
+ style={
154
+ Array [
155
+ Object {
156
+ "alignItems": "center",
157
+ "borderColor": "#de350b",
158
+ "borderRadius": 8,
159
+ "borderWidth": 2,
160
+ "height": 48,
161
+ "justifyContent": "center",
162
+ "width": 40,
163
+ },
164
+ undefined,
165
+ ]
166
+ }
167
+ themeFocused={true}
168
+ themeState="error"
169
+ >
170
+ <Text
171
+ style={
172
+ Array [
173
+ Object {
174
+ "color": "#de350b",
175
+ "fontFamily": "BeVietnamPro-SemiBold",
176
+ "fontSize": 28,
177
+ },
178
+ undefined,
179
+ ]
180
+ }
181
+ themeState="error"
182
+ >
183
+ 1
184
+ </Text>
185
+ </View>
186
+ `;
@@ -0,0 +1,58 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`StyledHiddenInput has correct width when pin length is 4 1`] = `
4
+ <TextInput
5
+ style={
6
+ Array [
7
+ Object {
8
+ "height": "100%",
9
+ "left": 0,
10
+ "opacity": 0,
11
+ "position": "absolute",
12
+ "top": 0,
13
+ "width": 208,
14
+ },
15
+ undefined,
16
+ ]
17
+ }
18
+ themePinLength={4}
19
+ />
20
+ `;
21
+
22
+ exports[`StyledHiddenInput has correct width when pin length is 6 1`] = `
23
+ <TextInput
24
+ style={
25
+ Array [
26
+ Object {
27
+ "height": "100%",
28
+ "left": 0,
29
+ "opacity": 0,
30
+ "position": "absolute",
31
+ "top": 0,
32
+ "width": 320,
33
+ },
34
+ undefined,
35
+ ]
36
+ }
37
+ themePinLength={6}
38
+ />
39
+ `;
40
+
41
+ exports[`StyledHiddenInput has correct width when pin length is 8 1`] = `
42
+ <TextInput
43
+ style={
44
+ Array [
45
+ Object {
46
+ "height": "100%",
47
+ "left": 0,
48
+ "opacity": 0,
49
+ "position": "absolute",
50
+ "top": 0,
51
+ "width": 432,
52
+ },
53
+ undefined,
54
+ ]
55
+ }
56
+ themePinLength={8}
57
+ />
58
+ `;