@hero-design/rn 8.79.1 → 8.80.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.
@@ -1,7 +1,7 @@
1
- (node:2859) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
1
+ (node:2843) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2
2
  (Use `node --trace-warnings ...` to show where the warning was created)
3
3
  
4
4
  src/index.ts → lib/index.js, es/index.js...
5
5
  (!) [plugin replace] @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
6
6
  (!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.
7
- created lib/index.js, es/index.js in 48.6s
7
+ created lib/index.js, es/index.js in 50.8s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.80.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#3502](https://github.com/Thinkei/hero-design/pull/3502) [`88c11405abfaf87625b9fde266d58d7fd09e25e9`](https://github.com/Thinkei/hero-design/commit/88c11405abfaf87625b9fde266d58d7fd09e25e9) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Chip] Add compact-outlined variant
8
+
3
9
  ## 8.79.1
4
10
 
5
11
  ### Patch Changes
package/es/index.js CHANGED
@@ -2646,9 +2646,7 @@ var getChipTheme = function getChipTheme(theme) {
2646
2646
  outlinedDefaultBackground: theme.colors.defaultGlobalSurface,
2647
2647
  outlinedSelectedBackground: theme.colors.secondaryOutline,
2648
2648
  outlinedSelectedBorder: theme.colors.primaryOutline,
2649
- outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface,
2650
- compactDefaultBackground: theme.colors.defaultGlobalSurface,
2651
- compactSelectedBackground: theme.colors.neutralGlobalSurface
2649
+ outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface
2652
2650
  };
2653
2651
  var space = {
2654
2652
  wrapperHorizontalPadding: theme.space.smallMedium,
@@ -13058,12 +13056,14 @@ var StyledChipWrapper = index$a(TouchableOpacity)(function (_ref) {
13058
13056
  case 'filled':
13059
13057
  return _objectSpread2({}, theme.__hd__.chip.shadows.filledWrapper);
13060
13058
  case 'outlined':
13059
+ case 'compact-outlined':
13061
13060
  return undefined;
13062
13061
  }
13063
13062
  };
13064
13063
  var getBorderStyles = function getBorderStyles() {
13065
13064
  switch (themeVariant) {
13066
13065
  case 'outlined':
13066
+ case 'compact-outlined':
13067
13067
  {
13068
13068
  return {
13069
13069
  borderColor: themeSelected ? theme.__hd__.chip.colors.outlinedSelectedBorder : theme.__hd__.chip.colors.outlinedDefaultBorder,
@@ -13083,42 +13083,34 @@ var StyledChipWrapper = index$a(TouchableOpacity)(function (_ref) {
13083
13083
  if (themeSelected) {
13084
13084
  switch (themeVariant) {
13085
13085
  case 'outlined':
13086
+ case 'compact-outlined':
13086
13087
  {
13087
13088
  return {
13088
13089
  backgroundColor: themeSelected ? theme.__hd__.chip.colors.outlinedSelectedBackground : theme.__hd__.chip.colors.outlinedDefaultBackground
13089
13090
  };
13090
13091
  }
13091
13092
  case 'filled':
13092
- {
13093
- return {
13094
- backgroundColor: theme.__hd__.chip.colors.secondaryBackground
13095
- };
13096
- }
13097
13093
  case 'compact':
13098
13094
  {
13099
13095
  return {
13100
- backgroundColor: theme.__hd__.chip.colors.compactSelectedBackground
13096
+ backgroundColor: theme.__hd__.chip.colors.secondaryBackground
13101
13097
  };
13102
13098
  }
13103
13099
  }
13104
13100
  } else {
13105
13101
  switch (themeVariant) {
13106
13102
  case 'outlined':
13103
+ case 'compact-outlined':
13107
13104
  {
13108
13105
  return {
13109
13106
  backgroundColor: theme.__hd__.chip.colors.outlinedDefaultBackground
13110
13107
  };
13111
13108
  }
13112
13109
  case 'filled':
13113
- {
13114
- return {
13115
- backgroundColor: theme.__hd__.chip.colors.filledBackground
13116
- };
13117
- }
13118
13110
  case 'compact':
13119
13111
  {
13120
13112
  return {
13121
- backgroundColor: theme.__hd__.chip.colors.compactDefaultBackground
13113
+ backgroundColor: theme.__hd__.chip.colors.filledBackground
13122
13114
  };
13123
13115
  }
13124
13116
  }
@@ -13127,6 +13119,7 @@ var StyledChipWrapper = index$a(TouchableOpacity)(function (_ref) {
13127
13119
  var getPaddingStyles = function getPaddingStyles() {
13128
13120
  switch (themeVariant) {
13129
13121
  case 'compact':
13122
+ case 'compact-outlined':
13130
13123
  {
13131
13124
  return {
13132
13125
  paddingHorizontal: theme.__hd__.chip.space.compactWrapperHorizontalPadding,
package/lib/index.js CHANGED
@@ -2673,9 +2673,7 @@ var getChipTheme = function getChipTheme(theme) {
2673
2673
  outlinedDefaultBackground: theme.colors.defaultGlobalSurface,
2674
2674
  outlinedSelectedBackground: theme.colors.secondaryOutline,
2675
2675
  outlinedSelectedBorder: theme.colors.primaryOutline,
2676
- outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface,
2677
- compactDefaultBackground: theme.colors.defaultGlobalSurface,
2678
- compactSelectedBackground: theme.colors.neutralGlobalSurface
2676
+ outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface
2679
2677
  };
2680
2678
  var space = {
2681
2679
  wrapperHorizontalPadding: theme.space.smallMedium,
@@ -13085,12 +13083,14 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
13085
13083
  case 'filled':
13086
13084
  return _objectSpread2({}, theme.__hd__.chip.shadows.filledWrapper);
13087
13085
  case 'outlined':
13086
+ case 'compact-outlined':
13088
13087
  return undefined;
13089
13088
  }
13090
13089
  };
13091
13090
  var getBorderStyles = function getBorderStyles() {
13092
13091
  switch (themeVariant) {
13093
13092
  case 'outlined':
13093
+ case 'compact-outlined':
13094
13094
  {
13095
13095
  return {
13096
13096
  borderColor: themeSelected ? theme.__hd__.chip.colors.outlinedSelectedBorder : theme.__hd__.chip.colors.outlinedDefaultBorder,
@@ -13110,42 +13110,34 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
13110
13110
  if (themeSelected) {
13111
13111
  switch (themeVariant) {
13112
13112
  case 'outlined':
13113
+ case 'compact-outlined':
13113
13114
  {
13114
13115
  return {
13115
13116
  backgroundColor: themeSelected ? theme.__hd__.chip.colors.outlinedSelectedBackground : theme.__hd__.chip.colors.outlinedDefaultBackground
13116
13117
  };
13117
13118
  }
13118
13119
  case 'filled':
13119
- {
13120
- return {
13121
- backgroundColor: theme.__hd__.chip.colors.secondaryBackground
13122
- };
13123
- }
13124
13120
  case 'compact':
13125
13121
  {
13126
13122
  return {
13127
- backgroundColor: theme.__hd__.chip.colors.compactSelectedBackground
13123
+ backgroundColor: theme.__hd__.chip.colors.secondaryBackground
13128
13124
  };
13129
13125
  }
13130
13126
  }
13131
13127
  } else {
13132
13128
  switch (themeVariant) {
13133
13129
  case 'outlined':
13130
+ case 'compact-outlined':
13134
13131
  {
13135
13132
  return {
13136
13133
  backgroundColor: theme.__hd__.chip.colors.outlinedDefaultBackground
13137
13134
  };
13138
13135
  }
13139
13136
  case 'filled':
13140
- {
13141
- return {
13142
- backgroundColor: theme.__hd__.chip.colors.filledBackground
13143
- };
13144
- }
13145
13137
  case 'compact':
13146
13138
  {
13147
13139
  return {
13148
- backgroundColor: theme.__hd__.chip.colors.compactDefaultBackground
13140
+ backgroundColor: theme.__hd__.chip.colors.filledBackground
13149
13141
  };
13150
13142
  }
13151
13143
  }
@@ -13154,6 +13146,7 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
13154
13146
  var getPaddingStyles = function getPaddingStyles() {
13155
13147
  switch (themeVariant) {
13156
13148
  case 'compact':
13149
+ case 'compact-outlined':
13157
13150
  {
13158
13151
  return {
13159
13152
  paddingHorizontal: theme.__hd__.chip.space.compactWrapperHorizontalPadding,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.79.1",
3
+ "version": "8.80.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -93,5 +93,6 @@
93
93
  "ts-jest": "^29.1.1",
94
94
  "typescript": "4.8.4"
95
95
  },
96
- "prettier": "prettier-config-hd"
96
+ "prettier": "prettier-config-hd",
97
+ "react-native": "src/index.ts"
97
98
  }
@@ -2,7 +2,7 @@ import styled from '@emotion/native';
2
2
  import { TouchableOpacity } from 'react-native';
3
3
 
4
4
  type StyledChipWrapperProps = {
5
- themeVariant?: 'outlined' | 'filled' | 'compact';
5
+ themeVariant?: 'outlined' | 'filled' | 'compact' | 'compact-outlined';
6
6
  themeSelected?: boolean;
7
7
  };
8
8
 
@@ -16,13 +16,15 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
16
16
  ...theme.__hd__.chip.shadows.filledWrapper,
17
17
  };
18
18
  case 'outlined':
19
+ case 'compact-outlined':
19
20
  return undefined;
20
21
  }
21
22
  };
22
23
 
23
24
  const getBorderStyles = () => {
24
25
  switch (themeVariant) {
25
- case 'outlined': {
26
+ case 'outlined':
27
+ case 'compact-outlined': {
26
28
  return {
27
29
  borderColor: themeSelected
28
30
  ? theme.__hd__.chip.colors.outlinedSelectedBorder
@@ -42,43 +44,34 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
42
44
  const getBackgroundStyles = () => {
43
45
  if (themeSelected) {
44
46
  switch (themeVariant) {
45
- case 'outlined': {
47
+ case 'outlined':
48
+ case 'compact-outlined': {
46
49
  return {
47
50
  backgroundColor: themeSelected
48
51
  ? theme.__hd__.chip.colors.outlinedSelectedBackground
49
52
  : theme.__hd__.chip.colors.outlinedDefaultBackground,
50
53
  };
51
54
  }
52
- case 'filled': {
53
- return {
54
- backgroundColor: theme.__hd__.chip.colors.secondaryBackground,
55
- };
56
- }
57
-
55
+ case 'filled':
58
56
  case 'compact': {
59
57
  return {
60
- backgroundColor:
61
- theme.__hd__.chip.colors.compactSelectedBackground,
58
+ backgroundColor: theme.__hd__.chip.colors.secondaryBackground,
62
59
  };
63
60
  }
64
61
  }
65
62
  } else {
66
63
  switch (themeVariant) {
67
- case 'outlined': {
64
+ case 'outlined':
65
+ case 'compact-outlined': {
68
66
  return {
69
67
  backgroundColor:
70
68
  theme.__hd__.chip.colors.outlinedDefaultBackground,
71
69
  };
72
70
  }
73
- case 'filled': {
74
- return {
75
- backgroundColor: theme.__hd__.chip.colors.filledBackground,
76
- };
77
- }
71
+ case 'filled':
78
72
  case 'compact': {
79
73
  return {
80
- backgroundColor:
81
- theme.__hd__.chip.colors.compactDefaultBackground,
74
+ backgroundColor: theme.__hd__.chip.colors.filledBackground,
82
75
  };
83
76
  }
84
77
  }
@@ -87,7 +80,8 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
87
80
 
88
81
  const getPaddingStyles = () => {
89
82
  switch (themeVariant) {
90
- case 'compact': {
83
+ case 'compact':
84
+ case 'compact-outlined': {
91
85
  return {
92
86
  paddingHorizontal:
93
87
  theme.__hd__.chip.space.compactWrapperHorizontalPadding,
@@ -942,7 +942,7 @@ exports[`Chip renders correctly with variant compact and selected true 1`] = `
942
942
  {
943
943
  "alignItems": "center",
944
944
  "alignSelf": "flex-start",
945
- "backgroundColor": "#f6f6f7",
945
+ "backgroundColor": "#ece8ef",
946
946
  "borderColor": "transparent",
947
947
  "borderRadius": 999,
948
948
  "elevation": 3,
@@ -1006,6 +1006,200 @@ exports[`Chip renders correctly with variant compact and selected true 1`] = `
1006
1006
  </View>
1007
1007
  `;
1008
1008
 
1009
+ exports[`Chip renders correctly with variant compact-outlined and selected false 1`] = `
1010
+ <View
1011
+ style={
1012
+ {
1013
+ "flex": 1,
1014
+ }
1015
+ }
1016
+ >
1017
+ <View
1018
+ accessibilityState={
1019
+ {
1020
+ "busy": undefined,
1021
+ "checked": undefined,
1022
+ "disabled": undefined,
1023
+ "expanded": undefined,
1024
+ "selected": undefined,
1025
+ }
1026
+ }
1027
+ accessibilityValue={
1028
+ {
1029
+ "max": undefined,
1030
+ "min": undefined,
1031
+ "now": undefined,
1032
+ "text": undefined,
1033
+ }
1034
+ }
1035
+ accessible={true}
1036
+ collapsable={false}
1037
+ focusable={false}
1038
+ onClick={[Function]}
1039
+ onResponderGrant={[Function]}
1040
+ onResponderMove={[Function]}
1041
+ onResponderRelease={[Function]}
1042
+ onResponderTerminate={[Function]}
1043
+ onResponderTerminationRequest={[Function]}
1044
+ onStartShouldSetResponder={[Function]}
1045
+ style={
1046
+ {
1047
+ "alignItems": "center",
1048
+ "alignSelf": "flex-start",
1049
+ "backgroundColor": "#ffffff",
1050
+ "borderColor": "#bfc1c5",
1051
+ "borderRadius": 999,
1052
+ "borderWidth": 1,
1053
+ "flexDirection": "row",
1054
+ "justifyContent": "center",
1055
+ "opacity": 1,
1056
+ "paddingHorizontal": 8,
1057
+ "paddingVertical": 4,
1058
+ }
1059
+ }
1060
+ testID="chip"
1061
+ >
1062
+ <Text
1063
+ allowFontScaling={false}
1064
+ style={
1065
+ [
1066
+ {
1067
+ "color": "#001f23",
1068
+ "fontFamily": "BeVietnamPro-Regular",
1069
+ "fontSize": 16,
1070
+ "letterSpacing": 0.48,
1071
+ "lineHeight": 24,
1072
+ },
1073
+ undefined,
1074
+ ]
1075
+ }
1076
+ themeIntent="body"
1077
+ themeTypeface="neutral"
1078
+ themeVariant="regular"
1079
+ >
1080
+ Cover my bills
1081
+ </Text>
1082
+ </View>
1083
+ <View
1084
+ pointerEvents="box-none"
1085
+ position="bottom"
1086
+ style={
1087
+ [
1088
+ {
1089
+ "bottom": 0,
1090
+ "elevation": 9999,
1091
+ "flexDirection": "column-reverse",
1092
+ "left": 0,
1093
+ "paddingHorizontal": 24,
1094
+ "paddingVertical": 16,
1095
+ "position": "absolute",
1096
+ "right": 0,
1097
+ "top": 0,
1098
+ },
1099
+ undefined,
1100
+ ]
1101
+ }
1102
+ />
1103
+ </View>
1104
+ `;
1105
+
1106
+ exports[`Chip renders correctly with variant compact-outlined and selected true 1`] = `
1107
+ <View
1108
+ style={
1109
+ {
1110
+ "flex": 1,
1111
+ }
1112
+ }
1113
+ >
1114
+ <View
1115
+ accessibilityState={
1116
+ {
1117
+ "busy": undefined,
1118
+ "checked": undefined,
1119
+ "disabled": undefined,
1120
+ "expanded": undefined,
1121
+ "selected": undefined,
1122
+ }
1123
+ }
1124
+ accessibilityValue={
1125
+ {
1126
+ "max": undefined,
1127
+ "min": undefined,
1128
+ "now": undefined,
1129
+ "text": undefined,
1130
+ }
1131
+ }
1132
+ accessible={true}
1133
+ collapsable={false}
1134
+ focusable={false}
1135
+ onClick={[Function]}
1136
+ onResponderGrant={[Function]}
1137
+ onResponderMove={[Function]}
1138
+ onResponderRelease={[Function]}
1139
+ onResponderTerminate={[Function]}
1140
+ onResponderTerminationRequest={[Function]}
1141
+ onStartShouldSetResponder={[Function]}
1142
+ style={
1143
+ {
1144
+ "alignItems": "center",
1145
+ "alignSelf": "flex-start",
1146
+ "backgroundColor": "#e8e9ea",
1147
+ "borderColor": "#001f23",
1148
+ "borderRadius": 999,
1149
+ "borderWidth": 1,
1150
+ "flexDirection": "row",
1151
+ "justifyContent": "center",
1152
+ "opacity": 1,
1153
+ "paddingHorizontal": 8,
1154
+ "paddingVertical": 4,
1155
+ }
1156
+ }
1157
+ testID="chip"
1158
+ >
1159
+ <Text
1160
+ allowFontScaling={false}
1161
+ style={
1162
+ [
1163
+ {
1164
+ "color": "#001f23",
1165
+ "fontFamily": "BeVietnamPro-Regular",
1166
+ "fontSize": 16,
1167
+ "letterSpacing": 0.48,
1168
+ "lineHeight": 24,
1169
+ },
1170
+ undefined,
1171
+ ]
1172
+ }
1173
+ themeIntent="body"
1174
+ themeTypeface="neutral"
1175
+ themeVariant="regular"
1176
+ >
1177
+ Cover my bills
1178
+ </Text>
1179
+ </View>
1180
+ <View
1181
+ pointerEvents="box-none"
1182
+ position="bottom"
1183
+ style={
1184
+ [
1185
+ {
1186
+ "bottom": 0,
1187
+ "elevation": 9999,
1188
+ "flexDirection": "column-reverse",
1189
+ "left": 0,
1190
+ "paddingHorizontal": 24,
1191
+ "paddingVertical": 16,
1192
+ "position": "absolute",
1193
+ "right": 0,
1194
+ "top": 0,
1195
+ },
1196
+ undefined,
1197
+ ]
1198
+ }
1199
+ />
1200
+ </View>
1201
+ `;
1202
+
1009
1203
  exports[`Chip renders correctly with variant filled and selected false 1`] = `
1010
1204
  <View
1011
1205
  style={
@@ -81,13 +81,15 @@ describe('Chip', () => {
81
81
  });
82
82
 
83
83
  it.each`
84
- variant | selected
85
- ${'filled'} | ${true}
86
- ${'filled'} | ${false}
87
- ${'outlined'} | ${true}
88
- ${'outlined'} | ${false}
89
- ${'compact'} | ${true}
90
- ${'compact'} | ${false}
84
+ variant | selected
85
+ ${'filled'} | ${true}
86
+ ${'filled'} | ${false}
87
+ ${'outlined'} | ${true}
88
+ ${'outlined'} | ${false}
89
+ ${'compact'} | ${true}
90
+ ${'compact'} | ${false}
91
+ ${'compact-outlined'} | ${true}
92
+ ${'compact-outlined'} | ${false}
91
93
  `(
92
94
  'renders correctly with variant $variant and selected $selected',
93
95
  ({ variant, selected }) => {
@@ -13,7 +13,7 @@ export interface ChipProps extends ViewProps {
13
13
  /**
14
14
  * Variant of the chip.
15
15
  */
16
- variant?: 'outlined' | 'filled' | 'compact';
16
+ variant?: 'outlined' | 'filled' | 'compact' | 'compact-outlined';
17
17
  /**
18
18
  * Whether the chip is selected.
19
19
  */
@@ -388,8 +388,6 @@ exports[`theme returns correct theme object 1`] = `
388
388
  "wrapper": 1,
389
389
  },
390
390
  "colors": {
391
- "compactDefaultBackground": "#ffffff",
392
- "compactSelectedBackground": "#f6f6f7",
393
391
  "filledBackground": "#ffffff",
394
392
  "outlinedDefaultBackground": "#ffffff",
395
393
  "outlinedDefaultBorder": "#bfc1c5",
@@ -9,8 +9,6 @@ const getChipTheme = (theme: GlobalTheme) => {
9
9
  outlinedSelectedBackground: theme.colors.secondaryOutline,
10
10
  outlinedSelectedBorder: theme.colors.primaryOutline,
11
11
  outlinedDefaultBorder: theme.colors.disabledOnDefaultGlobalSurface,
12
- compactDefaultBackground: theme.colors.defaultGlobalSurface,
13
- compactSelectedBackground: theme.colors.neutralGlobalSurface,
14
12
  };
15
13
 
16
14
  const space = {