@hero-design/rn 8.36.3 → 8.37.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.
@@ -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 28s
7
+ created lib/index.js, es/index.js in 26.2s
8
8
  $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/es/index.js CHANGED
@@ -2304,7 +2304,6 @@ var getFABTheme = function getFABTheme(theme) {
2304
2304
  buttonPressedBackground: theme.colors.pressedSurface,
2305
2305
  buttonActiveBackground: theme.colors.pressedSurface,
2306
2306
  icon: theme.colors.onPrimary,
2307
- headerText: theme.colors.onDefaultGlobalSurface,
2308
2307
  actionItemBackground: theme.colors.secondary,
2309
2308
  actionItemPressedBackground: theme.colors.pressedSurface,
2310
2309
  backdropBackground: theme.colors.overlayGlobalSurface,
@@ -2318,17 +2317,14 @@ var getFABTheme = function getFABTheme(theme) {
2318
2317
  iconContainerHeight: theme.sizes.large
2319
2318
  };
2320
2319
  var fonts = {
2321
- header: theme.fonts.neutral.semiBold,
2322
2320
  actionItemText: theme.fonts.neutral.regular,
2323
2321
  title: theme.fonts.neutral.semiBold
2324
2322
  };
2325
2323
  var fontSizes = {
2326
- header: theme.fontSizes.xxxlarge,
2327
2324
  actionItemText: theme.fontSizes.large,
2328
2325
  title: theme.fontSizes.large
2329
2326
  };
2330
2327
  var lineHeights = {
2331
- header: theme.lineHeights.xxxlarge,
2332
2328
  actionItemText: theme.lineHeights.medium,
2333
2329
  title: theme.lineHeights.large,
2334
2330
  icon: theme.lineHeights.large
@@ -2347,8 +2343,6 @@ var getFABTheme = function getFABTheme(theme) {
2347
2343
  actionItemTextPaddingLeft: theme.space.xsmall,
2348
2344
  buttonMarginTop: theme.space.large,
2349
2345
  buttonMarginRight: theme.space.large,
2350
- headerTextMarginRight: theme.space.large,
2351
- headerTextMarginBottom: theme.space.large,
2352
2346
  containerPadding: theme.space.large - theme.space.xsmall,
2353
2347
  titleMarginHorizontal: theme.space.small
2354
2348
  };
@@ -7844,7 +7838,7 @@ var Divider = function Divider(_ref) {
7844
7838
  }));
7845
7839
  };
7846
7840
 
7847
- var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
7841
+ var AnimatedPressable$2 = Animated.createAnimatedComponent(Pressable);
7848
7842
  var AnimatedSafeAreaView = Animated.createAnimatedComponent(SafeAreaView);
7849
7843
  var StyledWrapper$9 = index$c(View)(_objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
7850
7844
  flexDirection: 'column-reverse'
@@ -7870,7 +7864,7 @@ var StyledBottomSheet = index$c(AnimatedSafeAreaView)(function (_ref) {
7870
7864
  maxHeight: '94%'
7871
7865
  };
7872
7866
  });
7873
- var StyledBackdrop$2 = index$c(AnimatedPressable$1)(function (_ref2) {
7867
+ var StyledBackdrop$2 = index$c(AnimatedPressable$2)(function (_ref2) {
7874
7868
  var theme = _ref2.theme;
7875
7869
  return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
7876
7870
  backgroundColor: theme.__hd__.bottomSheet.colors.backdrop,
@@ -12761,7 +12755,7 @@ var DatePicker = function DatePicker(_ref) {
12761
12755
  return /*#__PURE__*/React.createElement(DatePickerAndroid, props);
12762
12756
  };
12763
12757
 
12764
- var AnimatedPressable = Animated.createAnimatedComponent(Pressable);
12758
+ var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
12765
12759
  var StyledContainer$3 = index$c(View)(function (_ref) {
12766
12760
  var theme = _ref.theme,
12767
12761
  enableShadow = _ref.enableShadow;
@@ -12789,7 +12783,7 @@ var StyledDragableContainer = index$c(View)(function (_ref2) {
12789
12783
  flexDirection: 'column-reverse'
12790
12784
  });
12791
12785
  });
12792
- var StyledBackdrop$1 = index$c(AnimatedPressable)(function (_ref3) {
12786
+ var StyledBackdrop$1 = index$c(AnimatedPressable$1)(function (_ref3) {
12793
12787
  var theme = _ref3.theme;
12794
12788
  return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12795
12789
  backgroundColor: theme.__hd__.drawer.colors.backdrop
@@ -13615,7 +13609,8 @@ var StyledFAB = index$c(FAB)(function (_ref) {
13615
13609
  alignSelf: 'flex-end'
13616
13610
  };
13617
13611
  });
13618
- var StyledBackdrop = index$c(Animated.View)(function (_ref2) {
13612
+ var AnimatedPressable = Animated.createAnimatedComponent(Pressable);
13613
+ var StyledBackdrop = index$c(AnimatedPressable)(function (_ref2) {
13619
13614
  var theme = _ref2.theme;
13620
13615
  return {
13621
13616
  position: 'absolute',
@@ -13627,15 +13622,6 @@ var StyledBackdrop = index$c(Animated.View)(function (_ref2) {
13627
13622
  backgroundColor: theme.__hd__.fab.colors.backdropBackground
13628
13623
  };
13629
13624
  });
13630
- var StyledHeaderText = index$c(Typography.Title)(function (_ref3) {
13631
- var theme = _ref3.theme;
13632
- return {
13633
- color: theme.__hd__.fab.colors.headerText,
13634
- marginRight: theme.__hd__.fab.space.headerTextMarginRight,
13635
- marginBottom: theme.__hd__.fab.space.headerTextMarginBottom,
13636
- textAlign: 'right'
13637
- };
13638
- });
13639
13625
 
13640
13626
  var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13641
13627
  var headerTitle = _ref.headerTitle,
@@ -13645,15 +13631,12 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13645
13631
  items = _ref.items,
13646
13632
  testID = _ref.testID,
13647
13633
  fabTitle = _ref.fabTitle,
13634
+ onBackdropPress = _ref.onBackdropPress,
13648
13635
  _ref$fabIcon = _ref.fabIcon,
13649
13636
  fabIcon = _ref$fabIcon === void 0 ? 'add' : _ref$fabIcon;
13637
+ useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
13650
13638
  var fabRef = useRef(null);
13651
13639
  var tranlateXAnimation = useRef(new Animated.Value(active ? 1 : 0));
13652
- var titleTranslateYValue = React.useRef(new Animated.Value(0));
13653
- var titleTranslateY = titleTranslateYValue.current.interpolate({
13654
- inputRange: [0, 1],
13655
- outputRange: [50, 0]
13656
- });
13657
13640
  React.useImperativeHandle(ref, function () {
13658
13641
  return {
13659
13642
  showFAB: function showFAB() {
@@ -13671,13 +13654,10 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13671
13654
  };
13672
13655
  }, [fabRef]);
13673
13656
  React.useEffect(function () {
13674
- Animated.parallel([Animated.spring(tranlateXAnimation.current, {
13657
+ Animated.spring(tranlateXAnimation.current, {
13675
13658
  toValue: active ? 1 : 0,
13676
13659
  useNativeDriver: Platform.OS !== 'web'
13677
- }), Animated.spring(titleTranslateYValue.current, {
13678
- toValue: active ? 1 : 0,
13679
- useNativeDriver: Platform.OS !== 'web'
13680
- })]).start();
13660
+ }).start();
13681
13661
  }, [active]);
13682
13662
  var interpolatedActionGroupOpacityAnimation = tranlateXAnimation.current.interpolate({
13683
13663
  inputRange: [0, 1],
@@ -13713,22 +13693,15 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13713
13693
  testID: testID,
13714
13694
  style: [style]
13715
13695
  }, /*#__PURE__*/React.createElement(StyledBackdrop, {
13716
- testID: "back-drop"
13696
+ testID: "back-drop",
13697
+ onPress: onBackdropPress
13717
13698
  }), /*#__PURE__*/React.createElement(StyledActionGroupContainer, {
13718
13699
  testID: "action-group",
13700
+ pointerEvents: "box-none",
13719
13701
  style: {
13720
13702
  opacity: interpolatedActionGroupOpacityAnimation
13721
13703
  }
13722
- }, !!headerTitle && /*#__PURE__*/React.createElement(Animated.View, {
13723
- style: {
13724
- transform: [{
13725
- translateY: titleTranslateY
13726
- }]
13727
- }
13728
- }, /*#__PURE__*/React.createElement(StyledHeaderText, {
13729
- testID: "header-text",
13730
- level: "h4"
13731
- }, headerTitle)), /*#__PURE__*/React.createElement(Box, {
13704
+ }, /*#__PURE__*/React.createElement(Box, {
13732
13705
  style: [style, {
13733
13706
  paddingBottom: 0
13734
13707
  }]
package/lib/index.js CHANGED
@@ -2335,7 +2335,6 @@ var getFABTheme = function getFABTheme(theme) {
2335
2335
  buttonPressedBackground: theme.colors.pressedSurface,
2336
2336
  buttonActiveBackground: theme.colors.pressedSurface,
2337
2337
  icon: theme.colors.onPrimary,
2338
- headerText: theme.colors.onDefaultGlobalSurface,
2339
2338
  actionItemBackground: theme.colors.secondary,
2340
2339
  actionItemPressedBackground: theme.colors.pressedSurface,
2341
2340
  backdropBackground: theme.colors.overlayGlobalSurface,
@@ -2349,17 +2348,14 @@ var getFABTheme = function getFABTheme(theme) {
2349
2348
  iconContainerHeight: theme.sizes.large
2350
2349
  };
2351
2350
  var fonts = {
2352
- header: theme.fonts.neutral.semiBold,
2353
2351
  actionItemText: theme.fonts.neutral.regular,
2354
2352
  title: theme.fonts.neutral.semiBold
2355
2353
  };
2356
2354
  var fontSizes = {
2357
- header: theme.fontSizes.xxxlarge,
2358
2355
  actionItemText: theme.fontSizes.large,
2359
2356
  title: theme.fontSizes.large
2360
2357
  };
2361
2358
  var lineHeights = {
2362
- header: theme.lineHeights.xxxlarge,
2363
2359
  actionItemText: theme.lineHeights.medium,
2364
2360
  title: theme.lineHeights.large,
2365
2361
  icon: theme.lineHeights.large
@@ -2378,8 +2374,6 @@ var getFABTheme = function getFABTheme(theme) {
2378
2374
  actionItemTextPaddingLeft: theme.space.xsmall,
2379
2375
  buttonMarginTop: theme.space.large,
2380
2376
  buttonMarginRight: theme.space.large,
2381
- headerTextMarginRight: theme.space.large,
2382
- headerTextMarginBottom: theme.space.large,
2383
2377
  containerPadding: theme.space.large - theme.space.xsmall,
2384
2378
  titleMarginHorizontal: theme.space.small
2385
2379
  };
@@ -7875,7 +7869,7 @@ var Divider = function Divider(_ref) {
7875
7869
  }));
7876
7870
  };
7877
7871
 
7878
- var AnimatedPressable$1 = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
7872
+ var AnimatedPressable$2 = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
7879
7873
  var AnimatedSafeAreaView = reactNative.Animated.createAnimatedComponent(reactNative.SafeAreaView);
7880
7874
  var StyledWrapper$9 = index$c(reactNative.View)(_objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
7881
7875
  flexDirection: 'column-reverse'
@@ -7901,7 +7895,7 @@ var StyledBottomSheet = index$c(AnimatedSafeAreaView)(function (_ref) {
7901
7895
  maxHeight: '94%'
7902
7896
  };
7903
7897
  });
7904
- var StyledBackdrop$2 = index$c(AnimatedPressable$1)(function (_ref2) {
7898
+ var StyledBackdrop$2 = index$c(AnimatedPressable$2)(function (_ref2) {
7905
7899
  var theme = _ref2.theme;
7906
7900
  return _objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
7907
7901
  backgroundColor: theme.__hd__.bottomSheet.colors.backdrop,
@@ -12792,7 +12786,7 @@ var DatePicker = function DatePicker(_ref) {
12792
12786
  return /*#__PURE__*/React__default["default"].createElement(DatePickerAndroid, props);
12793
12787
  };
12794
12788
 
12795
- var AnimatedPressable = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
12789
+ var AnimatedPressable$1 = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
12796
12790
  var StyledContainer$3 = index$c(reactNative.View)(function (_ref) {
12797
12791
  var theme = _ref.theme,
12798
12792
  enableShadow = _ref.enableShadow;
@@ -12820,7 +12814,7 @@ var StyledDragableContainer = index$c(reactNative.View)(function (_ref2) {
12820
12814
  flexDirection: 'column-reverse'
12821
12815
  });
12822
12816
  });
12823
- var StyledBackdrop$1 = index$c(AnimatedPressable)(function (_ref3) {
12817
+ var StyledBackdrop$1 = index$c(AnimatedPressable$1)(function (_ref3) {
12824
12818
  var theme = _ref3.theme;
12825
12819
  return _objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
12826
12820
  backgroundColor: theme.__hd__.drawer.colors.backdrop
@@ -13646,7 +13640,8 @@ var StyledFAB = index$c(FAB)(function (_ref) {
13646
13640
  alignSelf: 'flex-end'
13647
13641
  };
13648
13642
  });
13649
- var StyledBackdrop = index$c(reactNative.Animated.View)(function (_ref2) {
13643
+ var AnimatedPressable = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
13644
+ var StyledBackdrop = index$c(AnimatedPressable)(function (_ref2) {
13650
13645
  var theme = _ref2.theme;
13651
13646
  return {
13652
13647
  position: 'absolute',
@@ -13658,15 +13653,6 @@ var StyledBackdrop = index$c(reactNative.Animated.View)(function (_ref2) {
13658
13653
  backgroundColor: theme.__hd__.fab.colors.backdropBackground
13659
13654
  };
13660
13655
  });
13661
- var StyledHeaderText = index$c(Typography.Title)(function (_ref3) {
13662
- var theme = _ref3.theme;
13663
- return {
13664
- color: theme.__hd__.fab.colors.headerText,
13665
- marginRight: theme.__hd__.fab.space.headerTextMarginRight,
13666
- marginBottom: theme.__hd__.fab.space.headerTextMarginBottom,
13667
- textAlign: 'right'
13668
- };
13669
- });
13670
13656
 
13671
13657
  var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13672
13658
  var headerTitle = _ref.headerTitle,
@@ -13676,15 +13662,12 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13676
13662
  items = _ref.items,
13677
13663
  testID = _ref.testID,
13678
13664
  fabTitle = _ref.fabTitle,
13665
+ onBackdropPress = _ref.onBackdropPress,
13679
13666
  _ref$fabIcon = _ref.fabIcon,
13680
13667
  fabIcon = _ref$fabIcon === void 0 ? 'add' : _ref$fabIcon;
13668
+ useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
13681
13669
  var fabRef = React.useRef(null);
13682
13670
  var tranlateXAnimation = React.useRef(new reactNative.Animated.Value(active ? 1 : 0));
13683
- var titleTranslateYValue = React__default["default"].useRef(new reactNative.Animated.Value(0));
13684
- var titleTranslateY = titleTranslateYValue.current.interpolate({
13685
- inputRange: [0, 1],
13686
- outputRange: [50, 0]
13687
- });
13688
13671
  React__default["default"].useImperativeHandle(ref, function () {
13689
13672
  return {
13690
13673
  showFAB: function showFAB() {
@@ -13702,13 +13685,10 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13702
13685
  };
13703
13686
  }, [fabRef]);
13704
13687
  React__default["default"].useEffect(function () {
13705
- reactNative.Animated.parallel([reactNative.Animated.spring(tranlateXAnimation.current, {
13688
+ reactNative.Animated.spring(tranlateXAnimation.current, {
13706
13689
  toValue: active ? 1 : 0,
13707
13690
  useNativeDriver: reactNative.Platform.OS !== 'web'
13708
- }), reactNative.Animated.spring(titleTranslateYValue.current, {
13709
- toValue: active ? 1 : 0,
13710
- useNativeDriver: reactNative.Platform.OS !== 'web'
13711
- })]).start();
13691
+ }).start();
13712
13692
  }, [active]);
13713
13693
  var interpolatedActionGroupOpacityAnimation = tranlateXAnimation.current.interpolate({
13714
13694
  inputRange: [0, 1],
@@ -13744,22 +13724,15 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13744
13724
  testID: testID,
13745
13725
  style: [style]
13746
13726
  }, /*#__PURE__*/React__default["default"].createElement(StyledBackdrop, {
13747
- testID: "back-drop"
13727
+ testID: "back-drop",
13728
+ onPress: onBackdropPress
13748
13729
  }), /*#__PURE__*/React__default["default"].createElement(StyledActionGroupContainer, {
13749
13730
  testID: "action-group",
13731
+ pointerEvents: "box-none",
13750
13732
  style: {
13751
13733
  opacity: interpolatedActionGroupOpacityAnimation
13752
13734
  }
13753
- }, !!headerTitle && /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
13754
- style: {
13755
- transform: [{
13756
- translateY: titleTranslateY
13757
- }]
13758
- }
13759
- }, /*#__PURE__*/React__default["default"].createElement(StyledHeaderText, {
13760
- testID: "header-text",
13761
- level: "h4"
13762
- }, headerTitle)), /*#__PURE__*/React__default["default"].createElement(Box, {
13735
+ }, /*#__PURE__*/React__default["default"].createElement(Box, {
13763
13736
  style: [style, {
13764
13737
  paddingBottom: 0
13765
13738
  }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.36.3",
3
+ "version": "8.37.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,14 +21,14 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.36.3",
24
+ "@hero-design/colors": "8.37.0",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21",
28
28
  "nanoid": "^4.0.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "@hero-design/react-native-month-year-picker": "^8.36.3",
31
+ "@hero-design/react-native-month-year-picker": "^8.37.0",
32
32
  "@react-native-community/datetimepicker": "^3.5.2",
33
33
  "@react-native-community/slider": "4.1.12",
34
34
  "react": "18.0.0",
@@ -48,8 +48,8 @@
48
48
  "@babel/preset-typescript": "^7.17.12",
49
49
  "@babel/runtime": "^7.18.9",
50
50
  "@emotion/jest": "^11.9.3",
51
- "@hero-design/eslint-plugin": "8.36.3",
52
- "@hero-design/react-native-month-year-picker": "^8.36.3",
51
+ "@hero-design/eslint-plugin": "8.37.0",
52
+ "@hero-design/react-native-month-year-picker": "^8.37.0",
53
53
  "@react-native-community/datetimepicker": "^3.5.2",
54
54
  "@react-native-community/slider": "4.1.12",
55
55
  "@rollup/plugin-babel": "^5.3.1",
@@ -65,10 +65,10 @@
65
65
  "@types/react-native": "^0.67.7",
66
66
  "@types/react-native-vector-icons": "^6.4.10",
67
67
  "babel-plugin-inline-import": "^3.0.0",
68
- "eslint-config-hd": "8.36.3",
68
+ "eslint-config-hd": "8.37.0",
69
69
  "eslint-plugin-import": "^2.27.5",
70
70
  "jest": "^27.3.1",
71
- "prettier-config-hd": "8.36.3",
71
+ "prettier-config-hd": "8.37.0",
72
72
  "react": "18.0.0",
73
73
  "react-native": "0.69.7",
74
74
  "react-native-gesture-handler": "~2.5.0",
@@ -1,10 +1,8 @@
1
- import { Animated, View } from 'react-native';
1
+ import { Animated, Pressable, View } from 'react-native';
2
2
  import styled from '@emotion/native';
3
3
  import type { ComponentProps } from 'react';
4
4
  import type { ViewProps } from 'react-native';
5
5
  import FAB from '../FAB';
6
- import Typography from '../../Typography';
7
- import type { TextProps } from '../../Typography/Text';
8
6
 
9
7
  const StyledContainer = styled(View)<ViewProps>({
10
8
  position: 'absolute',
@@ -40,9 +38,8 @@ const StyledFAB = styled(FAB)(({ theme }) => ({
40
38
  alignSelf: 'flex-end',
41
39
  }));
42
40
 
43
- const StyledBackdrop = styled(Animated.View)<
44
- ComponentProps<typeof Animated.View>
45
- >(({ theme }) => ({
41
+ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
42
+ const StyledBackdrop = styled(AnimatedPressable)(({ theme }) => ({
46
43
  position: 'absolute',
47
44
  left: 0,
48
45
  right: 0,
@@ -52,18 +49,10 @@ const StyledBackdrop = styled(Animated.View)<
52
49
  backgroundColor: theme.__hd__.fab.colors.backdropBackground,
53
50
  }));
54
51
 
55
- const StyledHeaderText = styled(Typography.Title)<TextProps>(({ theme }) => ({
56
- color: theme.__hd__.fab.colors.headerText,
57
- marginRight: theme.__hd__.fab.space.headerTextMarginRight,
58
- marginBottom: theme.__hd__.fab.space.headerTextMarginBottom,
59
- textAlign: 'right',
60
- }));
61
-
62
52
  export {
63
- StyledHeaderText,
53
+ StyledActionGroupContainer,
64
54
  StyledBackdrop,
65
55
  StyledContainer,
66
56
  StyledContainerInModal,
67
- StyledActionGroupContainer,
68
57
  StyledFAB,
69
58
  };
@@ -307,7 +307,18 @@ exports[`ActionGroup has active true 1`] = `
307
307
  }
308
308
  >
309
309
  <View
310
+ accessible={true}
310
311
  collapsable={false}
312
+ focusable={true}
313
+ onBlur={[Function]}
314
+ onClick={[Function]}
315
+ onFocus={[Function]}
316
+ onResponderGrant={[Function]}
317
+ onResponderMove={[Function]}
318
+ onResponderRelease={[Function]}
319
+ onResponderTerminate={[Function]}
320
+ onResponderTerminationRequest={[Function]}
321
+ onStartShouldSetResponder={[Function]}
311
322
  style={
312
323
  Object {
313
324
  "backgroundColor": "#000000",
@@ -323,6 +334,7 @@ exports[`ActionGroup has active true 1`] = `
323
334
  />
324
335
  <View
325
336
  collapsable={false}
337
+ pointerEvents="box-none"
326
338
  style={
327
339
  Object {
328
340
  "alignItems": "flex-end",
@@ -333,48 +345,6 @@ exports[`ActionGroup has active true 1`] = `
333
345
  }
334
346
  testID="action-group"
335
347
  >
336
- <View
337
- collapsable={false}
338
- style={
339
- Object {
340
- "transform": Array [
341
- Object {
342
- "translateY": 50,
343
- },
344
- ],
345
- }
346
- }
347
- >
348
- <Text
349
- allowFontScaling={false}
350
- style={
351
- Array [
352
- Object {
353
- "color": "#001f23",
354
- "fontFamily": "BeVietnamPro-SemiBold",
355
- "fontSize": 24,
356
- "letterSpacing": 0,
357
- "lineHeight": 32,
358
- },
359
- Array [
360
- Object {
361
- "color": "#001f23",
362
- "marginBottom": 24,
363
- "marginRight": 24,
364
- "textAlign": "right",
365
- },
366
- undefined,
367
- ],
368
- ]
369
- }
370
- testID="header-text"
371
- themeIntent="body"
372
- themeLevel="h4"
373
- themeTypeface="neutral"
374
- >
375
- What would you like to create?
376
- </Text>
377
- </View>
378
348
  <View
379
349
  style={
380
350
  Array [
@@ -10,40 +10,37 @@ describe('ActionGroup', () => {
10
10
  ${true}
11
11
  ${false}
12
12
  `('has active $active', ({ active }) => {
13
- const { toJSON, getByTestId, getByText, queryByTestId, queryByText } =
14
- renderWithTheme(
15
- <ActionGroup
16
- fabTitle="Shout out"
17
- active={active}
18
- headerTitle="What would you like to create?"
19
- items={[
20
- {
21
- icon: 'speaker',
22
- title: 'Give shout out',
23
- testID: 'speaker-action-item',
24
- },
25
- { icon: 'target', title: 'Goal', testID: 'target-action-item' },
26
- {
27
- icon: 'plane',
28
- title: 'Leave request',
29
- testID: 'plane-action-item',
30
- },
31
- {
32
- icon: 'health-bag',
33
- title: 'Safety incident',
34
- testID: 'health-bag-action-item',
35
- },
36
- { icon: 'clock', title: 'Timesheets', testID: 'clock-action-item' },
37
- ]}
38
- />
39
- );
13
+ const { toJSON, getByTestId, queryByTestId } = renderWithTheme(
14
+ <ActionGroup
15
+ fabTitle="Shout out"
16
+ active={active}
17
+ items={[
18
+ {
19
+ icon: 'speaker',
20
+ title: 'Give shout out',
21
+ testID: 'speaker-action-item',
22
+ },
23
+ { icon: 'target', title: 'Goal', testID: 'target-action-item' },
24
+ {
25
+ icon: 'plane',
26
+ title: 'Leave request',
27
+ testID: 'plane-action-item',
28
+ },
29
+ {
30
+ icon: 'health-bag',
31
+ title: 'Safety incident',
32
+ testID: 'health-bag-action-item',
33
+ },
34
+ { icon: 'clock', title: 'Timesheets', testID: 'clock-action-item' },
35
+ ]}
36
+ />
37
+ );
40
38
 
41
39
  expect(toJSON()).toMatchSnapshot();
42
40
 
43
41
  if (active) {
44
42
  // verify backdrop appears
45
43
  expect(queryByTestId('back-drop')).toBeDefined();
46
- expect(getByText('What would you like to create?')).toBeDefined();
47
44
  expect(getByTestId('speaker-action-item')).toBeDefined();
48
45
  expect(getByTestId('target-action-item')).toBeDefined();
49
46
  expect(getByTestId('plane-action-item')).toBeDefined();
@@ -51,7 +48,6 @@ describe('ActionGroup', () => {
51
48
  } else {
52
49
  // verify backdrop disappears
53
50
  expect(queryByTestId('back-drop')).toBeNull();
54
- expect(queryByText('What would you like to create?')).toBeNull();
55
51
  }
56
52
  });
57
53
 
@@ -74,4 +70,15 @@ describe('ActionGroup', () => {
74
70
  expect(onPressSpy).toBeCalledTimes(1);
75
71
  });
76
72
  });
73
+
74
+ describe('when user presses backdrop', () => {
75
+ it('calls onBackdropPress when active = true', () => {
76
+ const onBackdropPressSpy = jest.fn();
77
+ const { getByTestId } = renderWithTheme(
78
+ <ActionGroup onBackdropPress={onBackdropPressSpy} active />
79
+ );
80
+ fireEvent(getByTestId('back-drop'), 'press');
81
+ expect(onBackdropPressSpy).toBeCalledTimes(1);
82
+ });
83
+ });
77
84
  });
@@ -10,11 +10,11 @@ import {
10
10
  StyledContainer,
11
11
  StyledContainerInModal,
12
12
  StyledFAB,
13
- StyledHeaderText,
14
13
  } from './StyledActionGroup';
15
14
 
16
15
  import Box from '../../Box';
17
16
  import { FABHandles } from '../FAB';
17
+ import { useDeprecation } from '../../../utils/hooks';
18
18
 
19
19
  export type ActionGroupHandles = {
20
20
  showFAB: () => void;
@@ -24,6 +24,7 @@ export type ActionGroupHandles = {
24
24
 
25
25
  export interface ActionGroupProps {
26
26
  /**
27
+ * @deprecated headerTitle will be removed in the next major release.
27
28
  * Title of the action group header.
28
29
  */
29
30
  headerTitle?: string;
@@ -32,7 +33,10 @@ export interface ActionGroupProps {
32
33
  * This function is called on pressing the FAB button.
33
34
  * */
34
35
  onPress?: () => void;
35
-
36
+ /**
37
+ * This function is called on pressing the FAB backdrop.
38
+ * */
39
+ onBackdropPress?: () => void;
36
40
  /**
37
41
  * Specify if the FAB button is in active state and the action group is shown.
38
42
  * */
@@ -74,20 +78,20 @@ const ActionGroup = forwardRef<ActionGroupHandles, ActionGroupProps>(
74
78
  items,
75
79
  testID,
76
80
  fabTitle,
81
+ onBackdropPress,
77
82
  fabIcon = 'add',
78
83
  },
79
84
  ref
80
85
  ) => {
86
+ useDeprecation(
87
+ `FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.`,
88
+ headerTitle !== undefined
89
+ );
90
+
81
91
  const fabRef = useRef<FABHandles>(null);
82
92
  const tranlateXAnimation = useRef<Animated.Value>(
83
93
  new Animated.Value(active ? 1 : 0)
84
94
  );
85
- const titleTranslateYValue = React.useRef(new Animated.Value(0));
86
-
87
- const titleTranslateY = titleTranslateYValue.current.interpolate({
88
- inputRange: [0, 1],
89
- outputRange: [50, 0],
90
- });
91
95
 
92
96
  React.useImperativeHandle(
93
97
  ref,
@@ -100,16 +104,10 @@ const ActionGroup = forwardRef<ActionGroupHandles, ActionGroupProps>(
100
104
  );
101
105
 
102
106
  React.useEffect(() => {
103
- Animated.parallel([
104
- Animated.spring(tranlateXAnimation.current, {
105
- toValue: active ? 1 : 0,
106
- useNativeDriver: Platform.OS !== 'web',
107
- }),
108
- Animated.spring(titleTranslateYValue.current, {
109
- toValue: active ? 1 : 0,
110
- useNativeDriver: Platform.OS !== 'web',
111
- }),
112
- ]).start();
107
+ Animated.spring(tranlateXAnimation.current, {
108
+ toValue: active ? 1 : 0,
109
+ useNativeDriver: Platform.OS !== 'web',
110
+ }).start();
113
111
  }, [active]);
114
112
  const interpolatedActionGroupOpacityAnimation =
115
113
  tranlateXAnimation.current.interpolate({
@@ -148,23 +146,14 @@ const ActionGroup = forwardRef<ActionGroupHandles, ActionGroupProps>(
148
146
  statusBarTranslucent
149
147
  >
150
148
  <StyledContainerInModal testID={testID} style={[style]}>
151
- <StyledBackdrop testID="back-drop" />
149
+ <StyledBackdrop testID="back-drop" onPress={onBackdropPress} />
152
150
  <StyledActionGroupContainer
153
151
  testID="action-group"
152
+ pointerEvents="box-none"
154
153
  style={{
155
154
  opacity: interpolatedActionGroupOpacityAnimation,
156
155
  }}
157
156
  >
158
- {!!headerTitle && (
159
- <Animated.View
160
- style={{ transform: [{ translateY: titleTranslateY }] }}
161
- >
162
- <StyledHeaderText testID="header-text" level="h4">
163
- {headerTitle}
164
- </StyledHeaderText>
165
- </Animated.View>
166
- )}
167
-
168
157
  <Box style={[style, { paddingBottom: 0 }]}>
169
158
  {items?.map((itemProp, index) => (
170
159
  <ActionItem
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
3
- import { StyledHeaderText } from '../../FAB/ActionGroup/StyledActionGroup';
4
3
  import {
4
+ StyledHelperText,
5
5
  StyledLabel,
6
6
  StyledTextInput,
7
7
  StyledMaxLengthMessage,
@@ -113,7 +113,7 @@ describe('StyledMaxLengthMessage', () => {
113
113
  describe('StyledHelperText', () => {
114
114
  it('renders correctly', (): void => {
115
115
  const { toJSON } = renderWithTheme(
116
- <StyledHeaderText>helper text</StyledHeaderText>
116
+ <StyledHelperText>helper text</StyledHelperText>
117
117
  );
118
118
 
119
119
  expect(toJSON()).toMatchSnapshot();
@@ -659,24 +659,15 @@ exports[`StyledHelperText renders correctly 1`] = `
659
659
  Object {
660
660
  "color": "#001f23",
661
661
  "fontFamily": "BeVietnamPro-Regular",
662
- "fontSize": 42,
663
- "letterSpacing": 0,
664
- "lineHeight": 50,
662
+ "fontSize": 12,
663
+ "letterSpacing": 0.48,
664
+ "lineHeight": 16,
665
665
  },
666
- Array [
667
- Object {
668
- "color": "#001f23",
669
- "marginBottom": 24,
670
- "marginRight": 24,
671
- "textAlign": "right",
672
- },
673
- undefined,
674
- ],
666
+ undefined,
675
667
  ]
676
668
  }
669
+ themeFontWeight="regular"
677
670
  themeIntent="body"
678
- themeLevel="h1"
679
- themeTypeface="neutral"
680
671
  >
681
672
  helper text
682
673
  </Text>
@@ -473,23 +473,19 @@ Object {
473
473
  "buttonActiveBackground": "#33144d",
474
474
  "buttonBackground": "#401960",
475
475
  "buttonPressedBackground": "#33144d",
476
- "headerText": "#001f23",
477
476
  "icon": "#ffffff",
478
477
  "titleText": "#ffffff",
479
478
  },
480
479
  "fontSizes": Object {
481
480
  "actionItemText": 16,
482
- "header": 24,
483
481
  "title": 16,
484
482
  },
485
483
  "fonts": Object {
486
484
  "actionItemText": "BeVietnamPro-Regular",
487
- "header": "BeVietnamPro-SemiBold",
488
485
  "title": "BeVietnamPro-SemiBold",
489
486
  },
490
487
  "lineHeights": Object {
491
488
  "actionItemText": 22,
492
- "header": 32,
493
489
  "icon": 24,
494
490
  "title": 24,
495
491
  },
@@ -520,8 +516,6 @@ Object {
520
516
  "buttonMarginRight": 24,
521
517
  "buttonMarginTop": 24,
522
518
  "containerPadding": 20,
523
- "headerTextMarginBottom": 24,
524
- "headerTextMarginRight": 24,
525
519
  "titleMarginHorizontal": 8,
526
520
  },
527
521
  },
@@ -6,7 +6,6 @@ const getFABTheme = (theme: GlobalTheme) => {
6
6
  buttonPressedBackground: theme.colors.pressedSurface,
7
7
  buttonActiveBackground: theme.colors.pressedSurface,
8
8
  icon: theme.colors.onPrimary,
9
- headerText: theme.colors.onDefaultGlobalSurface,
10
9
  actionItemBackground: theme.colors.secondary,
11
10
  actionItemPressedBackground: theme.colors.pressedSurface,
12
11
  backdropBackground: theme.colors.overlayGlobalSurface,
@@ -22,19 +21,16 @@ const getFABTheme = (theme: GlobalTheme) => {
22
21
  };
23
22
 
24
23
  const fonts = {
25
- header: theme.fonts.neutral.semiBold,
26
24
  actionItemText: theme.fonts.neutral.regular,
27
25
  title: theme.fonts.neutral.semiBold,
28
26
  };
29
27
 
30
28
  const fontSizes = {
31
- header: theme.fontSizes.xxxlarge,
32
29
  actionItemText: theme.fontSizes.large,
33
30
  title: theme.fontSizes.large,
34
31
  };
35
32
 
36
33
  const lineHeights = {
37
- header: theme.lineHeights.xxxlarge,
38
34
  actionItemText: theme.lineHeights.medium,
39
35
  title: theme.lineHeights.large,
40
36
  icon: theme.lineHeights.large,
@@ -55,8 +51,6 @@ const getFABTheme = (theme: GlobalTheme) => {
55
51
  actionItemTextPaddingLeft: theme.space.xsmall,
56
52
  buttonMarginTop: theme.space.large,
57
53
  buttonMarginRight: theme.space.large,
58
- headerTextMarginRight: theme.space.large,
59
- headerTextMarginBottom: theme.space.large,
60
54
  containerPadding: theme.space.large - theme.space.xsmall,
61
55
  titleMarginHorizontal: theme.space.small,
62
56
  };
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Animated, View } from 'react-native';
3
3
  import type { ViewProps } from 'react-native';
4
- import type { TextProps } from '../../Typography/Text';
5
4
  declare const StyledContainer: import("@emotion/native").StyledComponent<ViewProps & {
6
5
  theme?: import("@emotion/react").Theme | undefined;
7
6
  as?: import("react").ElementType<any> | undefined;
@@ -24,14 +23,10 @@ declare const StyledFAB: import("@emotion/native").StyledComponent<import("../FA
24
23
  theme?: import("@emotion/react").Theme | undefined;
25
24
  as?: import("react").ElementType<any> | undefined;
26
25
  }, {}, {}>;
27
- declare const StyledBackdrop: import("@emotion/native").StyledComponent<Animated.AnimatedProps<ViewProps & import("react").RefAttributes<View>> & {
26
+ declare const StyledBackdrop: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").PressableProps & import("react").RefAttributes<View>> & {
28
27
  children?: import("react").ReactNode;
29
28
  } & {
30
29
  theme?: import("@emotion/react").Theme | undefined;
31
30
  as?: import("react").ElementType<any> | undefined;
32
31
  }, {}, {}>;
33
- declare const StyledHeaderText: import("@emotion/native").StyledComponent<import("../../Typography/Title").TitleProps & {
34
- theme?: import("@emotion/react").Theme | undefined;
35
- as?: import("react").ElementType<any> | undefined;
36
- } & TextProps, {}, {}>;
37
- export { StyledHeaderText, StyledBackdrop, StyledContainer, StyledContainerInModal, StyledActionGroupContainer, StyledFAB, };
32
+ export { StyledActionGroupContainer, StyledBackdrop, StyledContainer, StyledContainerInModal, StyledFAB, };
@@ -9,6 +9,7 @@ export type ActionGroupHandles = {
9
9
  };
10
10
  export interface ActionGroupProps {
11
11
  /**
12
+ * @deprecated headerTitle will be removed in the next major release.
12
13
  * Title of the action group header.
13
14
  */
14
15
  headerTitle?: string;
@@ -16,6 +17,10 @@ export interface ActionGroupProps {
16
17
  * This function is called on pressing the FAB button.
17
18
  * */
18
19
  onPress?: () => void;
20
+ /**
21
+ * This function is called on pressing the FAB backdrop.
22
+ * */
23
+ onBackdropPress?: () => void;
19
24
  /**
20
25
  * Specify if the FAB button is in active state and the action group is shown.
21
26
  * */
@@ -4,12 +4,10 @@ declare const getFABTheme: (theme: GlobalTheme) => {
4
4
  actionItem: number;
5
5
  };
6
6
  fonts: {
7
- header: string;
8
7
  actionItemText: string;
9
8
  title: string;
10
9
  };
11
10
  fontSizes: {
12
- header: number;
13
11
  actionItemText: number;
14
12
  title: number;
15
13
  };
@@ -18,7 +16,6 @@ declare const getFABTheme: (theme: GlobalTheme) => {
18
16
  buttonPressedBackground: string;
19
17
  buttonActiveBackground: string;
20
18
  icon: string;
21
- headerText: string;
22
19
  actionItemBackground: string;
23
20
  actionItemPressedBackground: string;
24
21
  backdropBackground: string;
@@ -32,7 +29,6 @@ declare const getFABTheme: (theme: GlobalTheme) => {
32
29
  iconContainerHeight: number;
33
30
  };
34
31
  lineHeights: {
35
- header: number;
36
32
  actionItemText: number;
37
33
  title: number;
38
34
  icon: number;
@@ -54,8 +50,6 @@ declare const getFABTheme: (theme: GlobalTheme) => {
54
50
  actionItemTextPaddingLeft: number;
55
51
  buttonMarginTop: number;
56
52
  buttonMarginRight: number;
57
- headerTextMarginRight: number;
58
- headerTextMarginBottom: number;
59
53
  containerPadding: number;
60
54
  titleMarginHorizontal: number;
61
55
  };