@hero-design/rn 7.9.0 → 7.10.2-rc.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 (62) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/assets/fonts/hero-icons.ttf +0 -0
  3. package/es/index.js +733 -252
  4. package/lib/assets/fonts/hero-icons.ttf +0 -0
  5. package/lib/index.js +732 -251
  6. package/package.json +2 -2
  7. package/src/components/Button/Button.tsx +10 -2
  8. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +7 -1
  9. package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +3 -0
  10. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +60 -0
  11. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +363 -0
  12. package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +3 -0
  13. package/src/components/Button/LoadingIndicator/index.tsx +4 -1
  14. package/src/components/Button/StyledButton.tsx +57 -1
  15. package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +167 -0
  16. package/src/components/Button/UtilityButton/__tests__/index.spec.tsx +55 -0
  17. package/src/components/Button/UtilityButton/index.tsx +53 -0
  18. package/src/components/Button/UtilityButton/styled.tsx +25 -0
  19. package/src/components/Button/__tests__/Button.spec.tsx +3 -0
  20. package/src/components/Button/__tests__/StyledButton.spec.tsx +18 -0
  21. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +468 -0
  22. package/src/components/Button/index.tsx +3 -0
  23. package/src/components/Icon/HeroIcon/selection.json +1 -1
  24. package/src/components/Icon/IconList.ts +2 -0
  25. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +248 -94
  26. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +248 -94
  27. package/src/components/TextInput/StyledTextInput.tsx +133 -11
  28. package/src/components/TextInput/__tests__/.log/ti-10343.log +62 -0
  29. package/src/components/TextInput/__tests__/.log/tsserver.log +6983 -0
  30. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +143 -7
  31. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +922 -15
  32. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +2561 -0
  33. package/src/components/TextInput/__tests__/index.spec.tsx +346 -11
  34. package/src/components/TextInput/index.tsx +235 -28
  35. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +69 -3
  36. package/src/theme/components/button.ts +6 -0
  37. package/src/theme/components/textInput.ts +62 -3
  38. package/src/theme/global/colors.ts +1 -0
  39. package/src/types.ts +8 -1
  40. package/types/components/Button/Button.d.ts +2 -2
  41. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
  42. package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
  43. package/types/components/Button/StyledButton.d.ts +1 -1
  44. package/types/components/Button/UtilityButton/__tests__/index.spec.d.ts +1 -0
  45. package/types/components/Button/UtilityButton/index.d.ts +23 -0
  46. package/types/components/Button/UtilityButton/styled.d.ts +17 -0
  47. package/types/components/Button/index.d.ts +2 -0
  48. package/types/components/Icon/IconList.d.ts +1 -1
  49. package/types/components/Icon/utils.d.ts +1 -1
  50. package/types/components/TextInput/StyledTextInput.d.ts +82 -3
  51. package/types/components/TextInput/index.d.ts +33 -5
  52. package/types/theme/components/button.d.ts +6 -0
  53. package/types/theme/components/textInput.d.ts +61 -2
  54. package/types/theme/global/colors.d.ts +1 -0
  55. package/types/theme/global/index.d.ts +1 -0
  56. package/types/types.d.ts +2 -1
  57. package/.expo/README.md +0 -15
  58. package/.expo/packager-info.json +0 -10
  59. package/.expo/prebuild/cached-packages.json +0 -4
  60. package/.expo/settings.json +0 -10
  61. package/.expo/xcodebuild-error.log +0 -2
  62. package/.expo/xcodebuild.log +0 -11199
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "7.9.0",
3
+ "version": "7.10.2-rc.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": "7.9.0"
24
+ "@hero-design/colors": "7.10.2-rc.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": "17.0.2",
@@ -60,7 +60,7 @@ export interface ButtonProps {
60
60
  /**
61
61
  * Button type.
62
62
  */
63
- variant?: 'basic-transparent' | 'filled' | 'outlined';
63
+ variant?: 'basic-transparent' | 'filled' | 'outlined' | 'text';
64
64
  }
65
65
 
66
66
  const FILLED_VARIANTS = {
@@ -75,8 +75,14 @@ const OUTLINED_VARIANTS = {
75
75
  danger: 'outlined-danger',
76
76
  } as const;
77
77
 
78
+ const TEXT_VARIANTS = {
79
+ primary: 'text-primary',
80
+ secondary: 'text-secondary',
81
+ danger: 'text-danger',
82
+ } as const;
83
+
78
84
  export const getThemeVariant = (
79
- variant: 'basic-transparent' | 'filled' | 'outlined',
85
+ variant: 'basic-transparent' | 'filled' | 'outlined' | 'text',
80
86
  intent: Intent
81
87
  ): ThemeVariant => {
82
88
  switch (variant) {
@@ -86,6 +92,8 @@ export const getThemeVariant = (
86
92
  return FILLED_VARIANTS[intent];
87
93
  case 'outlined':
88
94
  return OUTLINED_VARIANTS[intent];
95
+ case 'text':
96
+ return TEXT_VARIANTS[intent];
89
97
  }
90
98
  };
91
99
 
@@ -11,7 +11,10 @@ type ThemeVariant =
11
11
  | 'filled-danger'
12
12
  | 'outlined-primary'
13
13
  | 'outlined-secondary'
14
- | 'outlined-danger';
14
+ | 'outlined-danger'
15
+ | 'text-primary'
16
+ | 'text-secondary'
17
+ | 'text-danger';
15
18
 
16
19
  const genLoadingIndicatorStyles = (
17
20
  theme: Theme,
@@ -41,10 +44,13 @@ const StyledLoadingDot = styled(View)<{
41
44
  backgroundColor: theme.__hd__.button.colors.invertedText,
42
45
  };
43
46
  case 'outlined-primary':
47
+ case 'text-primary':
44
48
  return genLoadingIndicatorStyles(theme, 'primary');
45
49
  case 'outlined-secondary':
50
+ case 'text-secondary':
46
51
  return genLoadingIndicatorStyles(theme, 'secondary');
47
52
  case 'outlined-danger':
53
+ case 'text-danger':
48
54
  return genLoadingIndicatorStyles(theme, 'danger');
49
55
  }
50
56
  };
@@ -13,6 +13,9 @@ describe('StyledLoadingIndicator', () => {
13
13
  ${'outlined-primary'}
14
14
  ${'outlined-secondary'}
15
15
  ${'outlined-danger'}
16
+ ${'text-primary'}
17
+ ${'text-secondary'}
18
+ ${'text-danger'}
16
19
  `('has $themeVariant style', ({ themeVariant }) => {
17
20
  const { toJSON } = renderWithTheme(
18
21
  <StyledLoadingDot themeVariant={themeVariant} />
@@ -139,3 +139,63 @@ exports[`StyledLoadingIndicator has outlined-secondary style 1`] = `
139
139
  themeVariant="outlined-secondary"
140
140
  />
141
141
  `;
142
+
143
+ exports[`StyledLoadingIndicator has text-danger style 1`] = `
144
+ <View
145
+ style={
146
+ Array [
147
+ Object {
148
+ "backgroundColor": "#de350b",
149
+ "borderRadius": 8,
150
+ "height": 12,
151
+ "marginBottom": 4,
152
+ "marginHorizontal": 8,
153
+ "marginTop": 4,
154
+ "width": 12,
155
+ },
156
+ undefined,
157
+ ]
158
+ }
159
+ themeVariant="text-danger"
160
+ />
161
+ `;
162
+
163
+ exports[`StyledLoadingIndicator has text-primary style 1`] = `
164
+ <View
165
+ style={
166
+ Array [
167
+ Object {
168
+ "backgroundColor": "#7622d7",
169
+ "borderRadius": 8,
170
+ "height": 12,
171
+ "marginBottom": 4,
172
+ "marginHorizontal": 8,
173
+ "marginTop": 4,
174
+ "width": 12,
175
+ },
176
+ undefined,
177
+ ]
178
+ }
179
+ themeVariant="text-primary"
180
+ />
181
+ `;
182
+
183
+ exports[`StyledLoadingIndicator has text-secondary style 1`] = `
184
+ <View
185
+ style={
186
+ Array [
187
+ Object {
188
+ "backgroundColor": "#4568fb",
189
+ "borderRadius": 8,
190
+ "height": 12,
191
+ "marginBottom": 4,
192
+ "marginHorizontal": 8,
193
+ "marginTop": 4,
194
+ "width": 12,
195
+ },
196
+ undefined,
197
+ ]
198
+ }
199
+ themeVariant="text-secondary"
200
+ />
201
+ `;
@@ -846,3 +846,366 @@ exports[`LoadingIndicator renders correctly when themeVariant is outlined-second
846
846
  </View>
847
847
  </View>
848
848
  `;
849
+
850
+ exports[`LoadingIndicator renders correctly when themeVariant is text-danger 1`] = `
851
+ <View
852
+ collapsable={false}
853
+ nativeID="animatedComponent"
854
+ style={
855
+ Array [
856
+ Object {
857
+ "alignItems": "center",
858
+ "flexDirection": "row",
859
+ "justifyContent": "center",
860
+ "paddingVertical": 2,
861
+ },
862
+ Object {},
863
+ ]
864
+ }
865
+ >
866
+ <View
867
+ collapsable={false}
868
+ nativeID="animatedComponent"
869
+ style={
870
+ Object {
871
+ "transform": Array [
872
+ Object {
873
+ "scale": 1,
874
+ },
875
+ ],
876
+ }
877
+ }
878
+ >
879
+ <View
880
+ collapsable={false}
881
+ nativeID="animatedComponent"
882
+ size={12}
883
+ style={
884
+ Array [
885
+ Object {
886
+ "backgroundColor": "#de350b",
887
+ "borderRadius": 8,
888
+ "height": 12,
889
+ "marginBottom": 4,
890
+ "marginHorizontal": 8,
891
+ "marginTop": 4,
892
+ "width": 12,
893
+ },
894
+ Object {},
895
+ ]
896
+ }
897
+ themeVariant="text-danger"
898
+ />
899
+ </View>
900
+ <View
901
+ collapsable={false}
902
+ nativeID="animatedComponent"
903
+ style={
904
+ Object {
905
+ "transform": Array [
906
+ Object {
907
+ "scale": 1,
908
+ },
909
+ ],
910
+ }
911
+ }
912
+ >
913
+ <View
914
+ collapsable={false}
915
+ nativeID="animatedComponent"
916
+ size={12}
917
+ style={
918
+ Array [
919
+ Object {
920
+ "backgroundColor": "#de350b",
921
+ "borderRadius": 8,
922
+ "height": 12,
923
+ "marginBottom": 4,
924
+ "marginHorizontal": 8,
925
+ "marginTop": 4,
926
+ "width": 12,
927
+ },
928
+ Object {},
929
+ ]
930
+ }
931
+ themeVariant="text-danger"
932
+ />
933
+ </View>
934
+ <View
935
+ collapsable={false}
936
+ nativeID="animatedComponent"
937
+ style={
938
+ Object {
939
+ "transform": Array [
940
+ Object {
941
+ "scale": 1,
942
+ },
943
+ ],
944
+ }
945
+ }
946
+ >
947
+ <View
948
+ collapsable={false}
949
+ nativeID="animatedComponent"
950
+ size={12}
951
+ style={
952
+ Array [
953
+ Object {
954
+ "backgroundColor": "#de350b",
955
+ "borderRadius": 8,
956
+ "height": 12,
957
+ "marginBottom": 4,
958
+ "marginHorizontal": 8,
959
+ "marginTop": 4,
960
+ "width": 12,
961
+ },
962
+ Object {},
963
+ ]
964
+ }
965
+ themeVariant="text-danger"
966
+ />
967
+ </View>
968
+ </View>
969
+ `;
970
+
971
+ exports[`LoadingIndicator renders correctly when themeVariant is text-primary 1`] = `
972
+ <View
973
+ collapsable={false}
974
+ nativeID="animatedComponent"
975
+ style={
976
+ Array [
977
+ Object {
978
+ "alignItems": "center",
979
+ "flexDirection": "row",
980
+ "justifyContent": "center",
981
+ "paddingVertical": 2,
982
+ },
983
+ Object {},
984
+ ]
985
+ }
986
+ >
987
+ <View
988
+ collapsable={false}
989
+ nativeID="animatedComponent"
990
+ style={
991
+ Object {
992
+ "transform": Array [
993
+ Object {
994
+ "scale": 1,
995
+ },
996
+ ],
997
+ }
998
+ }
999
+ >
1000
+ <View
1001
+ collapsable={false}
1002
+ nativeID="animatedComponent"
1003
+ size={12}
1004
+ style={
1005
+ Array [
1006
+ Object {
1007
+ "backgroundColor": "#7622d7",
1008
+ "borderRadius": 8,
1009
+ "height": 12,
1010
+ "marginBottom": 4,
1011
+ "marginHorizontal": 8,
1012
+ "marginTop": 4,
1013
+ "width": 12,
1014
+ },
1015
+ Object {},
1016
+ ]
1017
+ }
1018
+ themeVariant="text-primary"
1019
+ />
1020
+ </View>
1021
+ <View
1022
+ collapsable={false}
1023
+ nativeID="animatedComponent"
1024
+ style={
1025
+ Object {
1026
+ "transform": Array [
1027
+ Object {
1028
+ "scale": 1,
1029
+ },
1030
+ ],
1031
+ }
1032
+ }
1033
+ >
1034
+ <View
1035
+ collapsable={false}
1036
+ nativeID="animatedComponent"
1037
+ size={12}
1038
+ style={
1039
+ Array [
1040
+ Object {
1041
+ "backgroundColor": "#7622d7",
1042
+ "borderRadius": 8,
1043
+ "height": 12,
1044
+ "marginBottom": 4,
1045
+ "marginHorizontal": 8,
1046
+ "marginTop": 4,
1047
+ "width": 12,
1048
+ },
1049
+ Object {},
1050
+ ]
1051
+ }
1052
+ themeVariant="text-primary"
1053
+ />
1054
+ </View>
1055
+ <View
1056
+ collapsable={false}
1057
+ nativeID="animatedComponent"
1058
+ style={
1059
+ Object {
1060
+ "transform": Array [
1061
+ Object {
1062
+ "scale": 1,
1063
+ },
1064
+ ],
1065
+ }
1066
+ }
1067
+ >
1068
+ <View
1069
+ collapsable={false}
1070
+ nativeID="animatedComponent"
1071
+ size={12}
1072
+ style={
1073
+ Array [
1074
+ Object {
1075
+ "backgroundColor": "#7622d7",
1076
+ "borderRadius": 8,
1077
+ "height": 12,
1078
+ "marginBottom": 4,
1079
+ "marginHorizontal": 8,
1080
+ "marginTop": 4,
1081
+ "width": 12,
1082
+ },
1083
+ Object {},
1084
+ ]
1085
+ }
1086
+ themeVariant="text-primary"
1087
+ />
1088
+ </View>
1089
+ </View>
1090
+ `;
1091
+
1092
+ exports[`LoadingIndicator renders correctly when themeVariant is text-secondary 1`] = `
1093
+ <View
1094
+ collapsable={false}
1095
+ nativeID="animatedComponent"
1096
+ style={
1097
+ Array [
1098
+ Object {
1099
+ "alignItems": "center",
1100
+ "flexDirection": "row",
1101
+ "justifyContent": "center",
1102
+ "paddingVertical": 2,
1103
+ },
1104
+ Object {},
1105
+ ]
1106
+ }
1107
+ >
1108
+ <View
1109
+ collapsable={false}
1110
+ nativeID="animatedComponent"
1111
+ style={
1112
+ Object {
1113
+ "transform": Array [
1114
+ Object {
1115
+ "scale": 1,
1116
+ },
1117
+ ],
1118
+ }
1119
+ }
1120
+ >
1121
+ <View
1122
+ collapsable={false}
1123
+ nativeID="animatedComponent"
1124
+ size={12}
1125
+ style={
1126
+ Array [
1127
+ Object {
1128
+ "backgroundColor": "#4568fb",
1129
+ "borderRadius": 8,
1130
+ "height": 12,
1131
+ "marginBottom": 4,
1132
+ "marginHorizontal": 8,
1133
+ "marginTop": 4,
1134
+ "width": 12,
1135
+ },
1136
+ Object {},
1137
+ ]
1138
+ }
1139
+ themeVariant="text-secondary"
1140
+ />
1141
+ </View>
1142
+ <View
1143
+ collapsable={false}
1144
+ nativeID="animatedComponent"
1145
+ style={
1146
+ Object {
1147
+ "transform": Array [
1148
+ Object {
1149
+ "scale": 1,
1150
+ },
1151
+ ],
1152
+ }
1153
+ }
1154
+ >
1155
+ <View
1156
+ collapsable={false}
1157
+ nativeID="animatedComponent"
1158
+ size={12}
1159
+ style={
1160
+ Array [
1161
+ Object {
1162
+ "backgroundColor": "#4568fb",
1163
+ "borderRadius": 8,
1164
+ "height": 12,
1165
+ "marginBottom": 4,
1166
+ "marginHorizontal": 8,
1167
+ "marginTop": 4,
1168
+ "width": 12,
1169
+ },
1170
+ Object {},
1171
+ ]
1172
+ }
1173
+ themeVariant="text-secondary"
1174
+ />
1175
+ </View>
1176
+ <View
1177
+ collapsable={false}
1178
+ nativeID="animatedComponent"
1179
+ style={
1180
+ Object {
1181
+ "transform": Array [
1182
+ Object {
1183
+ "scale": 1,
1184
+ },
1185
+ ],
1186
+ }
1187
+ }
1188
+ >
1189
+ <View
1190
+ collapsable={false}
1191
+ nativeID="animatedComponent"
1192
+ size={12}
1193
+ style={
1194
+ Array [
1195
+ Object {
1196
+ "backgroundColor": "#4568fb",
1197
+ "borderRadius": 8,
1198
+ "height": 12,
1199
+ "marginBottom": 4,
1200
+ "marginHorizontal": 8,
1201
+ "marginTop": 4,
1202
+ "width": 12,
1203
+ },
1204
+ Object {},
1205
+ ]
1206
+ }
1207
+ themeVariant="text-secondary"
1208
+ />
1209
+ </View>
1210
+ </View>
1211
+ `;
@@ -13,6 +13,9 @@ describe('LoadingIndicator', () => {
13
13
  ${'outlined-primary'}
14
14
  ${'outlined-secondary'}
15
15
  ${'outlined-danger'}
16
+ ${'text-primary'}
17
+ ${'text-secondary'}
18
+ ${'text-danger'}
16
19
  `(
17
20
  'renders correctly when themeVariant is $themeVariant',
18
21
  ({ themeVariant }) => {
@@ -19,7 +19,10 @@ type ThemeVariant =
19
19
  | 'filled-danger'
20
20
  | 'outlined-primary'
21
21
  | 'outlined-secondary'
22
- | 'outlined-danger';
22
+ | 'outlined-danger'
23
+ | 'text-primary'
24
+ | 'text-secondary'
25
+ | 'text-danger';
23
26
 
24
27
  const AnimatedLoadingIndicatorWrapper = Animated.createAnimatedComponent(
25
28
  StyledLoadingIndicatorWrapper
@@ -14,7 +14,10 @@ type ThemeVariant =
14
14
  | 'filled-danger'
15
15
  | 'outlined-primary'
16
16
  | 'outlined-secondary'
17
- | 'outlined-danger';
17
+ | 'outlined-danger'
18
+ | 'text-primary'
19
+ | 'text-secondary'
20
+ | 'text-danger';
18
21
 
19
22
  const PRESSED_COLORS = {
20
23
  primary: 'pressedPrimary',
@@ -152,6 +155,35 @@ const genOutlineTextStyles = (
152
155
  };
153
156
  };
154
157
 
158
+ const genTextVariantTextStyles = (
159
+ theme: Theme,
160
+ intent: Intent,
161
+ pressed?: boolean,
162
+ disabled?: boolean
163
+ ): ReactNativeStyle => {
164
+ const textColorStyling = () => {
165
+ if (disabled) {
166
+ return {
167
+ color: theme.__hd__.button.colors.disabledText,
168
+ };
169
+ }
170
+
171
+ if (pressed) {
172
+ return {
173
+ color: theme.__hd__.button.colors[PRESSED_COLORS[intent]],
174
+ };
175
+ }
176
+
177
+ return { color: theme.__hd__.button.colors[intent] };
178
+ };
179
+
180
+ return {
181
+ fontSize: theme.__hd__.button.fontSize.textVariant,
182
+ lineHeight: theme.__hd__.button.lineHeight.default,
183
+ ...textColorStyling(),
184
+ };
185
+ };
186
+
155
187
  const StyledButtonContainer = styled(View)<{
156
188
  disabled?: boolean;
157
189
  pressed?: boolean;
@@ -172,6 +204,18 @@ const StyledButtonContainer = styled(View)<{
172
204
  return genOutlineContainerStyles(theme, 'secondary', pressed, disabled);
173
205
  case 'outlined-danger':
174
206
  return genOutlineContainerStyles(theme, 'danger', pressed, disabled);
207
+ case 'text-primary':
208
+ case 'text-secondary':
209
+ case 'text-danger':
210
+ return {
211
+ width: '100%',
212
+ flexDirection: 'row',
213
+ justifyContent: 'center',
214
+ alignItems: 'center',
215
+ padding: theme.__hd__.button.space.buttonPadding,
216
+ borderWidth: 0,
217
+ backgroundColor: 'transparent',
218
+ };
175
219
  }
176
220
  });
177
221
 
@@ -204,6 +248,12 @@ const StyledButtonText = styled(Typography.Text)<{
204
248
  return genOutlineTextStyles(theme, 'secondary', pressed, disabled);
205
249
  case 'outlined-danger':
206
250
  return genOutlineTextStyles(theme, 'danger', pressed, disabled);
251
+ case 'text-primary':
252
+ return genTextVariantTextStyles(theme, 'primary', pressed, disabled);
253
+ case 'text-secondary':
254
+ return genTextVariantTextStyles(theme, 'secondary', pressed, disabled);
255
+ case 'text-danger':
256
+ return genTextVariantTextStyles(theme, 'danger', pressed, disabled);
207
257
  }
208
258
  };
209
259
  return {
@@ -248,6 +298,12 @@ const StyledButtonIcon = styled(Icon)<{
248
298
  return genOutlineTextStyles(theme, 'secondary', pressed, disabled);
249
299
  case 'outlined-danger':
250
300
  return genOutlineTextStyles(theme, 'danger', pressed, disabled);
301
+ case 'text-primary':
302
+ return genTextVariantTextStyles(theme, 'primary', pressed, disabled);
303
+ case 'text-secondary':
304
+ return genTextVariantTextStyles(theme, 'secondary', pressed, disabled);
305
+ case 'text-danger':
306
+ return genTextVariantTextStyles(theme, 'danger', pressed, disabled);
251
307
  }
252
308
  };
253
309