@hero-design/rn 8.27.1 → 8.27.2

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 (22) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/es/index.js +13 -69
  3. package/lib/index.js +13 -69
  4. package/package.json +5 -5
  5. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +6 -6
  6. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +2 -2
  7. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +2 -2
  8. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +2 -2
  9. package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +3 -17
  10. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +1065 -557
  11. package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +15 -9
  12. package/src/components/FAB/ActionGroup/index.tsx +35 -97
  13. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +10 -10
  14. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +10 -10
  15. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +10 -10
  16. package/src/components/TextInput/index.tsx +1 -1
  17. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +2 -2
  18. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +2 -2
  19. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +0 -1
  20. package/src/theme/components/fab.ts +0 -1
  21. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +1 -7
  22. package/types/theme/components/fab.d.ts +0 -1
@@ -4,5 +4,5 @@ $ rollup -c
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 '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
7
- created lib/index.js, es/index.js in 29s
7
+ created lib/index.js, es/index.js in 25.6s
8
8
  $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/es/index.js CHANGED
@@ -2327,8 +2327,7 @@ var getFABTheme = function getFABTheme(theme) {
2327
2327
  headerTextMarginRight: theme.space.large,
2328
2328
  headerTextMarginBottom: theme.space.large,
2329
2329
  containerPadding: theme.space.large - theme.space.xsmall,
2330
- titleMarginHorizontal: theme.space.small,
2331
- internalFABMarginBottom: theme.space.large
2330
+ titleMarginHorizontal: theme.space.small
2332
2331
  };
2333
2332
  var radii = {
2334
2333
  actionItem: theme.radii.rounded
@@ -12037,7 +12036,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
12037
12036
  testID: "input-suffix",
12038
12037
  icon: actualSuffix,
12039
12038
  spin: actualSuffix === 'loading',
12040
- size: "xsmall"
12039
+ size: "medium"
12041
12040
  }) : suffix), /*#__PURE__*/React.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React.createElement(Icon, {
12042
12041
  testID: "input-error-icon",
12043
12042
  icon: "circle-info",
@@ -13085,11 +13084,10 @@ var StyledBackdrop = index$a(Animated.View)(function (_ref2) {
13085
13084
  var theme = _ref2.theme;
13086
13085
  return {
13087
13086
  position: 'absolute',
13088
- flex: 1,
13089
- height: '100%',
13090
- width: '100%',
13091
- bottom: 0,
13087
+ left: 0,
13092
13088
  right: 0,
13089
+ top: 0,
13090
+ bottom: 0,
13093
13091
  backgroundColor: theme.__hd__.fab.colors.backdropBackground
13094
13092
  };
13095
13093
  });
@@ -13105,17 +13103,6 @@ var StyledHeaderText = index$a(Typography.Text)(function (_ref3) {
13105
13103
  textAlign: 'right'
13106
13104
  };
13107
13105
  });
13108
- var StyledModalView = index$a(View)({
13109
- position: 'absolute',
13110
- flex: 1,
13111
- height: '100%',
13112
- width: '100%',
13113
- bottom: 0,
13114
- right: 0,
13115
- justifyContent: 'flex-end',
13116
- alignItems: 'flex-end',
13117
- backgroundColor: 'transparent'
13118
- });
13119
13106
 
13120
13107
  var ActionItemsListComponent = function ActionItemsListComponent(_ref) {
13121
13108
  var style = _ref.style,
@@ -13138,43 +13125,15 @@ var ActionGroup = function ActionGroup(_ref2) {
13138
13125
  fabTitle = _ref2.fabTitle,
13139
13126
  _ref2$fabIcon = _ref2.fabIcon,
13140
13127
  fabIcon = _ref2$fabIcon === void 0 ? 'add' : _ref2$fabIcon;
13141
- var theme = useTheme();
13142
- // Internal state to control the animation of the action group
13143
- var _useState = useState(active),
13144
- _useState2 = _slicedToArray(_useState, 2),
13145
- visible = _useState2[0],
13146
- setVisibility = _useState2[1];
13147
13128
  var tranlateXAnimation = useRef(new Animated.Value(active ? 1 : 0));
13148
13129
  useEffect(function () {
13149
- if (active && !visible) {
13150
- setVisibility(true);
13151
- }
13152
- }, [active]);
13153
- useEffect(function () {
13154
- if (active) {
13155
- var animation = Animated.timing(tranlateXAnimation.current, {
13156
- toValue: 1,
13157
- useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
13158
- easing: Easing.inOut(Easing.cubic)
13159
- });
13160
- animation.start();
13161
- }
13162
- }, [active]);
13163
- // Make sure the animation finishes running before closing the modal
13164
- var onInternalFABPress = useCallback(function () {
13165
- if (!onPress) {
13166
- return;
13167
- }
13168
13130
  var animation = Animated.timing(tranlateXAnimation.current, {
13169
- toValue: 0,
13131
+ toValue: active ? 1 : 0,
13170
13132
  useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
13171
13133
  easing: Easing.inOut(Easing.cubic)
13172
13134
  });
13173
- animation.start(function () {
13174
- setVisibility(false);
13175
- onPress();
13176
- });
13177
- }, [visible]);
13135
+ animation.start();
13136
+ }, [active]);
13178
13137
  var interpolatedTranlateXAnimation = tranlateXAnimation.current.interpolate({
13179
13138
  inputRange: [0, 1],
13180
13139
  outputRange: [400, 0]
@@ -13191,18 +13150,13 @@ var ActionGroup = function ActionGroup(_ref2) {
13191
13150
  testID: testID,
13192
13151
  pointerEvents: "box-none",
13193
13152
  style: style
13194
- }, /*#__PURE__*/React.createElement(Modal, {
13195
- visible: visible,
13196
- transparent: true,
13197
- statusBarTranslucent: true,
13198
- animationType: "none"
13199
13153
  }, /*#__PURE__*/React.createElement(StyledBackdrop, {
13154
+ pointerEvents: active ? 'auto' : 'box-none',
13155
+ testID: "back-drop",
13200
13156
  style: {
13201
13157
  opacity: interpolatedBackdropOpacityAnimation
13202
- },
13203
- testID: "back-drop",
13204
- pointerEvents: active ? 'auto' : 'box-none'
13205
- }), /*#__PURE__*/React.createElement(StyledModalView, null, /*#__PURE__*/React.createElement(StyledActionGroupContainer, {
13158
+ }
13159
+ }), /*#__PURE__*/React.createElement(StyledActionGroupContainer, {
13206
13160
  pointerEvents: active ? 'auto' : 'none',
13207
13161
  testID: "action-group",
13208
13162
  style: {
@@ -13215,17 +13169,7 @@ var ActionGroup = function ActionGroup(_ref2) {
13215
13169
  testID: "header-text"
13216
13170
  }, headerTitle), /*#__PURE__*/React.createElement(ActionItemsListComponent, {
13217
13171
  items: items
13218
- })), active && /*#__PURE__*/React.createElement(StyledFAB, {
13219
- testID: "fab",
13220
- icon: fabIcon,
13221
- onPress: onInternalFABPress,
13222
- animated: true,
13223
- active: active,
13224
- title: fabTitle,
13225
- style: {
13226
- marginBottom: theme.__hd__.fab.space.internalFABMarginBottom
13227
- }
13228
- }))), !active && /*#__PURE__*/React.createElement(StyledFAB, {
13172
+ })), /*#__PURE__*/React.createElement(StyledFAB, {
13229
13173
  testID: "fab",
13230
13174
  icon: fabIcon,
13231
13175
  onPress: onPress,
package/lib/index.js CHANGED
@@ -2357,8 +2357,7 @@ var getFABTheme = function getFABTheme(theme) {
2357
2357
  headerTextMarginRight: theme.space.large,
2358
2358
  headerTextMarginBottom: theme.space.large,
2359
2359
  containerPadding: theme.space.large - theme.space.xsmall,
2360
- titleMarginHorizontal: theme.space.small,
2361
- internalFABMarginBottom: theme.space.large
2360
+ titleMarginHorizontal: theme.space.small
2362
2361
  };
2363
2362
  var radii = {
2364
2363
  actionItem: theme.radii.rounded
@@ -12067,7 +12066,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
12067
12066
  testID: "input-suffix",
12068
12067
  icon: actualSuffix,
12069
12068
  spin: actualSuffix === 'loading',
12070
- size: "xsmall"
12069
+ size: "medium"
12071
12070
  }) : suffix), /*#__PURE__*/React__default["default"].createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default["default"].createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__default["default"].createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default["default"].createElement(Icon, {
12072
12071
  testID: "input-error-icon",
12073
12072
  icon: "circle-info",
@@ -13115,11 +13114,10 @@ var StyledBackdrop = index$a(reactNative.Animated.View)(function (_ref2) {
13115
13114
  var theme = _ref2.theme;
13116
13115
  return {
13117
13116
  position: 'absolute',
13118
- flex: 1,
13119
- height: '100%',
13120
- width: '100%',
13121
- bottom: 0,
13117
+ left: 0,
13122
13118
  right: 0,
13119
+ top: 0,
13120
+ bottom: 0,
13123
13121
  backgroundColor: theme.__hd__.fab.colors.backdropBackground
13124
13122
  };
13125
13123
  });
@@ -13135,17 +13133,6 @@ var StyledHeaderText = index$a(Typography.Text)(function (_ref3) {
13135
13133
  textAlign: 'right'
13136
13134
  };
13137
13135
  });
13138
- var StyledModalView = index$a(reactNative.View)({
13139
- position: 'absolute',
13140
- flex: 1,
13141
- height: '100%',
13142
- width: '100%',
13143
- bottom: 0,
13144
- right: 0,
13145
- justifyContent: 'flex-end',
13146
- alignItems: 'flex-end',
13147
- backgroundColor: 'transparent'
13148
- });
13149
13136
 
13150
13137
  var ActionItemsListComponent = function ActionItemsListComponent(_ref) {
13151
13138
  var style = _ref.style,
@@ -13168,43 +13155,15 @@ var ActionGroup = function ActionGroup(_ref2) {
13168
13155
  fabTitle = _ref2.fabTitle,
13169
13156
  _ref2$fabIcon = _ref2.fabIcon,
13170
13157
  fabIcon = _ref2$fabIcon === void 0 ? 'add' : _ref2$fabIcon;
13171
- var theme = useTheme();
13172
- // Internal state to control the animation of the action group
13173
- var _useState = React.useState(active),
13174
- _useState2 = _slicedToArray(_useState, 2),
13175
- visible = _useState2[0],
13176
- setVisibility = _useState2[1];
13177
13158
  var tranlateXAnimation = React.useRef(new reactNative.Animated.Value(active ? 1 : 0));
13178
13159
  React.useEffect(function () {
13179
- if (active && !visible) {
13180
- setVisibility(true);
13181
- }
13182
- }, [active]);
13183
- React.useEffect(function () {
13184
- if (active) {
13185
- var animation = reactNative.Animated.timing(tranlateXAnimation.current, {
13186
- toValue: 1,
13187
- useNativeDriver: reactNative.Platform.OS === 'ios' || reactNative.Platform.OS === 'android',
13188
- easing: reactNative.Easing.inOut(reactNative.Easing.cubic)
13189
- });
13190
- animation.start();
13191
- }
13192
- }, [active]);
13193
- // Make sure the animation finishes running before closing the modal
13194
- var onInternalFABPress = React.useCallback(function () {
13195
- if (!onPress) {
13196
- return;
13197
- }
13198
13160
  var animation = reactNative.Animated.timing(tranlateXAnimation.current, {
13199
- toValue: 0,
13161
+ toValue: active ? 1 : 0,
13200
13162
  useNativeDriver: reactNative.Platform.OS === 'ios' || reactNative.Platform.OS === 'android',
13201
13163
  easing: reactNative.Easing.inOut(reactNative.Easing.cubic)
13202
13164
  });
13203
- animation.start(function () {
13204
- setVisibility(false);
13205
- onPress();
13206
- });
13207
- }, [visible]);
13165
+ animation.start();
13166
+ }, [active]);
13208
13167
  var interpolatedTranlateXAnimation = tranlateXAnimation.current.interpolate({
13209
13168
  inputRange: [0, 1],
13210
13169
  outputRange: [400, 0]
@@ -13221,18 +13180,13 @@ var ActionGroup = function ActionGroup(_ref2) {
13221
13180
  testID: testID,
13222
13181
  pointerEvents: "box-none",
13223
13182
  style: style
13224
- }, /*#__PURE__*/React__default["default"].createElement(reactNative.Modal, {
13225
- visible: visible,
13226
- transparent: true,
13227
- statusBarTranslucent: true,
13228
- animationType: "none"
13229
13183
  }, /*#__PURE__*/React__default["default"].createElement(StyledBackdrop, {
13184
+ pointerEvents: active ? 'auto' : 'box-none',
13185
+ testID: "back-drop",
13230
13186
  style: {
13231
13187
  opacity: interpolatedBackdropOpacityAnimation
13232
- },
13233
- testID: "back-drop",
13234
- pointerEvents: active ? 'auto' : 'box-none'
13235
- }), /*#__PURE__*/React__default["default"].createElement(StyledModalView, null, /*#__PURE__*/React__default["default"].createElement(StyledActionGroupContainer, {
13188
+ }
13189
+ }), /*#__PURE__*/React__default["default"].createElement(StyledActionGroupContainer, {
13236
13190
  pointerEvents: active ? 'auto' : 'none',
13237
13191
  testID: "action-group",
13238
13192
  style: {
@@ -13245,17 +13199,7 @@ var ActionGroup = function ActionGroup(_ref2) {
13245
13199
  testID: "header-text"
13246
13200
  }, headerTitle), /*#__PURE__*/React__default["default"].createElement(ActionItemsListComponent, {
13247
13201
  items: items
13248
- })), active && /*#__PURE__*/React__default["default"].createElement(StyledFAB, {
13249
- testID: "fab",
13250
- icon: fabIcon,
13251
- onPress: onInternalFABPress,
13252
- animated: true,
13253
- active: active,
13254
- title: fabTitle,
13255
- style: {
13256
- marginBottom: theme.__hd__.fab.space.internalFABMarginBottom
13257
- }
13258
- }))), !active && /*#__PURE__*/React__default["default"].createElement(StyledFAB, {
13202
+ })), /*#__PURE__*/React__default["default"].createElement(StyledFAB, {
13259
13203
  testID: "fab",
13260
13204
  icon: fabIcon,
13261
13205
  onPress: onPress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.27.1",
3
+ "version": "8.27.2",
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.27.1",
24
+ "@hero-design/colors": "8.27.2",
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.27.1",
48
+ "@hero-design/eslint-plugin": "8.27.2",
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,10 +61,10 @@
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.27.1",
64
+ "eslint-config-hd": "8.27.2",
65
65
  "eslint-plugin-import": "^2.27.5",
66
66
  "jest": "^27.3.1",
67
- "prettier-config-hd": "8.27.1",
67
+ "prettier-config-hd": "8.27.2",
68
68
  "react": "18.0.0",
69
69
  "react-native": "0.69.7",
70
70
  "react-native-gesture-handler": "~2.1.0",
@@ -187,14 +187,14 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
187
187
  Array [
188
188
  Object {
189
189
  "color": "#001f23",
190
- "fontSize": 16,
190
+ "fontSize": 24,
191
191
  },
192
192
  undefined,
193
193
  ]
194
194
  }
195
195
  testID="input-suffix"
196
196
  themeIntent="text"
197
- themeSize="xsmall"
197
+ themeSize="medium"
198
198
  />
199
199
  </View>
200
200
  <View
@@ -412,14 +412,14 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
412
412
  Array [
413
413
  Object {
414
414
  "color": "#001f23",
415
- "fontSize": 16,
415
+ "fontSize": 24,
416
416
  },
417
417
  undefined,
418
418
  ]
419
419
  }
420
420
  testID="input-suffix"
421
421
  themeIntent="text"
422
- themeSize="xsmall"
422
+ themeSize="medium"
423
423
  />
424
424
  </View>
425
425
  <View
@@ -643,14 +643,14 @@ exports[`DatePicker renders variant Calendar 1`] = `
643
643
  Array [
644
644
  Object {
645
645
  "color": "#001f23",
646
- "fontSize": 16,
646
+ "fontSize": 24,
647
647
  },
648
648
  undefined,
649
649
  ]
650
650
  }
651
651
  testID="input-suffix"
652
652
  themeIntent="text"
653
- themeSize="xsmall"
653
+ themeSize="medium"
654
654
  />
655
655
  </View>
656
656
  <View
@@ -187,14 +187,14 @@ exports[`DatePickerAndroid renders correctly 1`] = `
187
187
  Array [
188
188
  Object {
189
189
  "color": "#001f23",
190
- "fontSize": 16,
190
+ "fontSize": 24,
191
191
  },
192
192
  undefined,
193
193
  ]
194
194
  }
195
195
  testID="input-suffix"
196
196
  themeIntent="text"
197
- themeSize="xsmall"
197
+ themeSize="medium"
198
198
  />
199
199
  </View>
200
200
  <View
@@ -187,14 +187,14 @@ exports[`DatePickerCalendar renders correctly 1`] = `
187
187
  Array [
188
188
  Object {
189
189
  "color": "#001f23",
190
- "fontSize": 16,
190
+ "fontSize": 24,
191
191
  },
192
192
  undefined,
193
193
  ]
194
194
  }
195
195
  testID="input-suffix"
196
196
  themeIntent="text"
197
- themeSize="xsmall"
197
+ themeSize="medium"
198
198
  />
199
199
  </View>
200
200
  <View
@@ -187,14 +187,14 @@ exports[`DatePickerIOS renders correctly 1`] = `
187
187
  Array [
188
188
  Object {
189
189
  "color": "#001f23",
190
- "fontSize": 16,
190
+ "fontSize": 24,
191
191
  },
192
192
  undefined,
193
193
  ]
194
194
  }
195
195
  testID="input-suffix"
196
196
  themeIntent="text"
197
- themeSize="xsmall"
197
+ themeSize="medium"
198
198
  />
199
199
  </View>
200
200
  <View
@@ -34,11 +34,10 @@ const StyledBackdrop = styled(Animated.View)<
34
34
  ComponentProps<typeof Animated.View>
35
35
  >(({ theme }) => ({
36
36
  position: 'absolute',
37
- flex: 1,
38
- height: '100%',
39
- width: '100%',
40
- bottom: 0,
37
+ left: 0,
41
38
  right: 0,
39
+ top: 0,
40
+ bottom: 0,
42
41
  backgroundColor: theme.__hd__.fab.colors.backdropBackground,
43
42
  }));
44
43
 
@@ -52,23 +51,10 @@ const StyledHeaderText = styled(Typography.Text)<TextProps>(({ theme }) => ({
52
51
  textAlign: 'right',
53
52
  }));
54
53
 
55
- const StyledModalView = styled(View)({
56
- position: 'absolute',
57
- flex: 1,
58
- height: '100%',
59
- width: '100%',
60
- bottom: 0,
61
- right: 0,
62
- justifyContent: 'flex-end',
63
- alignItems: 'flex-end',
64
- backgroundColor: 'transparent',
65
- });
66
-
67
54
  export {
68
55
  StyledHeaderText,
69
56
  StyledBackdrop,
70
57
  StyledContainer,
71
58
  StyledActionGroupContainer,
72
59
  StyledFAB,
73
- StyledModalView,
74
60
  };