@hero-design/rn 8.59.0 → 8.60.1-alpha.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 (35) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +15 -0
  3. package/es/index.js +240 -116
  4. package/lib/index.js +240 -116
  5. package/package.json +2 -2
  6. package/src/components/AnimatedScroller/AnimatedFAB.tsx +99 -49
  7. package/src/components/AnimatedScroller/AnimatedScrollable.tsx +18 -3
  8. package/src/components/AnimatedScroller/__tests__/ScrollablesWithFAB.spec.tsx +30 -9
  9. package/src/components/AnimatedScroller/__tests__/__snapshots__/ScrollablesWithFAB.spec.tsx.snap +474 -447
  10. package/src/components/FAB/ActionGroup/ActionItem.tsx +3 -1
  11. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +216 -211
  12. package/src/components/FAB/ActionGroup/index.tsx +34 -28
  13. package/src/components/FAB/FAB.tsx +102 -41
  14. package/src/components/FAB/StyledFAB.tsx +10 -8
  15. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +34 -38
  16. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +191 -170
  17. package/src/components/Radio/Radio.tsx +16 -4
  18. package/src/components/Radio/RadioGroup.tsx +10 -3
  19. package/src/components/Radio/StyledRadio.tsx +20 -3
  20. package/src/components/Radio/__tests__/Radio.spec.tsx +46 -13
  21. package/src/components/Radio/__tests__/RadioGroup.spec.tsx +40 -7
  22. package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +446 -77
  23. package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +946 -112
  24. package/src/components/Radio/types.ts +6 -1
  25. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +8 -2
  26. package/src/theme/components/radio.ts +8 -2
  27. package/types/components/AnimatedScroller/AnimatedFAB.d.ts +3 -1
  28. package/types/components/AnimatedScroller/AnimatedScrollable.d.ts +1 -1
  29. package/types/components/FAB/StyledFAB.d.ts +4 -6
  30. package/types/components/Radio/Radio.d.ts +9 -1
  31. package/types/components/Radio/RadioGroup.d.ts +5 -1
  32. package/types/components/Radio/StyledRadio.d.ts +11 -1
  33. package/types/components/Radio/index.d.ts +1 -1
  34. package/types/components/Radio/types.d.ts +1 -0
  35. package/types/theme/components/radio.d.ts +7 -1
@@ -2,4 +2,4 @@
2
2
  src/index.ts → lib/index.js, es/index.js...
3
3
  (!) 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`.
4
4
  (!) 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
5
- created lib/index.js, es/index.js in 57.2s
5
+ created lib/index.js, es/index.js in 57.6s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.60.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2807](https://github.com/Thinkei/hero-design/pull/2807) [`391137af3`](https://github.com/Thinkei/hero-design/commit/391137af35cb9ae71da51d6863624da0251017aa) Thanks [@ttkien](https://github.com/ttkien)! - initial HDv9
8
+
9
+ - Updated dependencies [[`5c76fdb0b`](https://github.com/Thinkei/hero-design/commit/5c76fdb0b3565456f30864c78e42cc9a589747c9), [`391137af3`](https://github.com/Thinkei/hero-design/commit/391137af35cb9ae71da51d6863624da0251017aa)]:
10
+ - @hero-design/colors@9.0.0-alpha.0
11
+
12
+ ## 8.60.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#2747](https://github.com/Thinkei/hero-design/pull/2747) [`28106e711`](https://github.com/Thinkei/hero-design/commit/28106e711ef6a127e4bfa0890535489649ff516c) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [FAB][fab.actiongroup][Scrollables with FAB] Update animations using Animated
17
+
3
18
  ## 8.59.0
4
19
 
5
20
  ### Minor Changes
package/es/index.js CHANGED
@@ -1292,7 +1292,9 @@ var BASE_COLORS = {
1292
1292
  theatreGold: '#a56822',
1293
1293
  uniformGreen: '#4d4628',
1294
1294
  yellow: '#fadb14',
1295
- windsorGrey: '#606065'
1295
+ windsorGrey: '#606065',
1296
+ mist: '#e8e9f8',
1297
+ cloud: '#ccd9f5'
1296
1298
  };
1297
1299
  var colorScales = Object.entries(BASE_COLORS).reduce(function (acc, _ref16) {
1298
1300
  var _ref17 = _slicedToArray(_ref16, 2),
@@ -1301,15 +1303,17 @@ var colorScales = Object.entries(BASE_COLORS).reduce(function (acc, _ref16) {
1301
1303
  return Object.assign(Object.assign({}, acc), _defineProperty({}, key, createColorScales(value)));
1302
1304
  }, {});
1303
1305
  var blue$1 = colorScales.blue,
1304
- ultramarineBlue$2 = colorScales.ultramarineBlue,
1306
+ cloud = colorScales.cloud,
1307
+ deepSaffron$2 = colorScales.deepSaffron,
1305
1308
  green$1 = colorScales.green,
1306
1309
  grey$2 = colorScales.grey,
1307
1310
  grotesqueGreen = colorScales.grotesqueGreen,
1308
- deepSaffron$2 = colorScales.deepSaffron,
1311
+ mist = colorScales.mist,
1309
1312
  pink$1 = colorScales.pink,
1310
1313
  purple$1 = colorScales.purple,
1311
- vermilion$2 = colorScales.vermilion,
1312
1314
  smalt = colorScales.smalt,
1315
+ ultramarineBlue$2 = colorScales.ultramarineBlue,
1316
+ vermilion$2 = colorScales.vermilion,
1313
1317
  violet$1 = colorScales.violet,
1314
1318
  yellow$1 = colorScales.yellow;
1315
1319
  var palette$b = {
@@ -1328,9 +1332,11 @@ var palette$b = {
1328
1332
  blueLight60: blue$1.lighten60,
1329
1333
  blueLight75: blue$1.lighten75,
1330
1334
  blueLight90: blue$1.lighten90,
1335
+ cloudLight90: cloud.lighten90,
1331
1336
  dodgerBlue: ultramarineBlue$2.base,
1332
1337
  dodgerBlueDark15: ultramarineBlue$2.darken15,
1333
1338
  dodgerBlueDark30: ultramarineBlue$2.darken30,
1339
+ dodgerBlueDark60: ultramarineBlue$2.darken60,
1334
1340
  dodgerBlueLight30: ultramarineBlue$2.lighten30,
1335
1341
  dodgerBlueLight45: ultramarineBlue$2.lighten45,
1336
1342
  dodgerBlueLight60: ultramarineBlue$2.lighten60,
@@ -1339,6 +1345,7 @@ var palette$b = {
1339
1345
  green: green$1.base,
1340
1346
  greenDark15: green$1.darken15,
1341
1347
  greenDark30: green$1.darken30,
1348
+ greenDark60: green$1.darken60,
1342
1349
  greenDark75: green$1.darken75,
1343
1350
  greenLight30: green$1.lighten30,
1344
1351
  greenLight75: green$1.lighten75,
@@ -1349,6 +1356,7 @@ var palette$b = {
1349
1356
  greyDark45: grey$2.darken45,
1350
1357
  greyDark60: grey$2.darken60,
1351
1358
  greyDark75: grey$2.darken75,
1359
+ greyLight30: grey$2.lighten30,
1352
1360
  greyLight45: grey$2.lighten45,
1353
1361
  greyLight60: grey$2.lighten60,
1354
1362
  greyLight75: grey$2.lighten75,
@@ -1362,20 +1370,27 @@ var palette$b = {
1362
1370
  grotesqueGreenLight60: grotesqueGreen.lighten60,
1363
1371
  grotesqueGreenLight75: grotesqueGreen.lighten75,
1364
1372
  grotesqueGreenLight90: grotesqueGreen.lighten90,
1373
+ mistLight30: mist.lighten30,
1374
+ mistLight60: mist.lighten60,
1375
+ mistLight90: mist.lighten90,
1365
1376
  orange: deepSaffron$2.base,
1366
1377
  orangeDark15: deepSaffron$2.darken15,
1367
1378
  orangeDark30: deepSaffron$2.darken30,
1379
+ orangeDark60: deepSaffron$2.darken60,
1368
1380
  orangeDark75: deepSaffron$2.darken75,
1369
1381
  orangeLight30: deepSaffron$2.lighten30,
1382
+ orangeLight60: deepSaffron$2.lighten60,
1370
1383
  orangeLight75: deepSaffron$2.lighten75,
1371
1384
  orangeLight90: deepSaffron$2.lighten90,
1372
1385
  pink: pink$1.base,
1373
1386
  pinkDark15: pink$1.darken15,
1374
1387
  pinkDark30: pink$1.darken30,
1375
1388
  pinkDark45: pink$1.darken45,
1389
+ pinkDark60: pink$1.darken60,
1376
1390
  pinkDark75: pink$1.darken75,
1377
1391
  pinkLight30: pink$1.lighten30,
1378
1392
  pinkLight45: pink$1.lighten45,
1393
+ pinkLight60: pink$1.lighten60,
1379
1394
  pinkLight75: pink$1.lighten75,
1380
1395
  pinkLight90: pink$1.lighten90,
1381
1396
  purple: purple$1.base,
@@ -1418,6 +1433,7 @@ var palette$b = {
1418
1433
  yellow: yellow$1.base,
1419
1434
  yellowDark15: yellow$1.darken15,
1420
1435
  yellowDark30: yellow$1.darken30,
1436
+ yellowDark45: yellow$1.darken45,
1421
1437
  yellowDark75: yellow$1.darken75,
1422
1438
  yellowLight30: yellow$1.lighten30,
1423
1439
  yellowLight45: yellow$1.lighten45,
@@ -2934,11 +2950,17 @@ var getProgressTheme = function getProgressTheme(theme) {
2934
2950
 
2935
2951
  var getRadioTheme = function getRadioTheme(theme) {
2936
2952
  var colors = {
2937
- circle: theme.colors.onDefaultGlobalSurface
2953
+ circle: theme.colors.primary,
2954
+ checked: theme.colors.highlightedSurface,
2955
+ intents: {
2956
+ light: theme.colors.defaultGlobalSurface,
2957
+ dark: theme.colors.neutralGlobalSurface
2958
+ }
2938
2959
  };
2939
2960
  var space = {
2940
2961
  circleLeftMargin: theme.space.small,
2941
- groupTopMargin: theme.space.xsmall
2962
+ groupTopMarginSmall: theme.space.xsmall,
2963
+ groupTopMarginMedium: theme.space.medium
2942
2964
  };
2943
2965
  var boundingBoxSize = theme.sizes.large;
2944
2966
  var innerPadding = theme.space.xsmall;
@@ -14386,7 +14408,8 @@ var Error$1 = function Error(_ref2) {
14386
14408
  }, nativeProps));
14387
14409
  };
14388
14410
 
14389
- var StyledFAB$1 = index$9(TouchableHighlight)(function (_ref) {
14411
+ var AnimatedTouchableHighlight = Animated.createAnimatedComponent(TouchableHighlight);
14412
+ var StyledFAB$1 = index$9(AnimatedTouchableHighlight)(function (_ref) {
14390
14413
  var theme = _ref.theme,
14391
14414
  themeActive = _ref.themeActive;
14392
14415
  return {
@@ -14401,7 +14424,8 @@ var StyledFAB$1 = index$9(TouchableHighlight)(function (_ref) {
14401
14424
  shadowColor: theme.__hd__.fab.shadows.color,
14402
14425
  shadowOffset: theme.__hd__.fab.shadows.offset,
14403
14426
  shadowRadius: theme.__hd__.fab.shadows.radius,
14404
- shadowOpacity: theme.__hd__.fab.shadows.opacity
14427
+ shadowOpacity: theme.__hd__.fab.shadows.opacity,
14428
+ height: theme.__hd__.fab.sizes.height
14405
14429
  };
14406
14430
  });
14407
14431
  var StyledFABIcon = index$9(Icon)(function (_ref2) {
@@ -14493,16 +14517,14 @@ var IconWithTextContent = function IconWithTextContent(_ref2) {
14493
14517
  testID: "styled-fab-icon"
14494
14518
  })), /*#__PURE__*/React.createElement(StyledFABText, null, title));
14495
14519
  };
14496
- var defaultAnimation = {
14497
- create: {
14498
- type: 'easeInEaseOut',
14499
- property: 'opacity'
14500
- },
14501
- update: {
14502
- type: 'spring',
14503
- springDamping: Platform.OS === 'ios' ? 0.7 : 1.2
14504
- },
14505
- duration: Platform.OS === 'ios' ? 300 : 400
14520
+ var animateWidth = function animateWidth() {
14521
+ LayoutAnimation.configureNext({
14522
+ duration: Platform.OS === 'ios' ? 200 : 400,
14523
+ update: {
14524
+ type: 'spring',
14525
+ springDamping: Platform.OS === 'ios' ? 1 : 1.5
14526
+ }
14527
+ });
14506
14528
  };
14507
14529
  var FAB$1 = /*#__PURE__*/forwardRef(function (_ref3, ref) {
14508
14530
  var _StyleSheet$flatten, _StyleSheet$flatten2;
@@ -14514,61 +14536,99 @@ var FAB$1 = /*#__PURE__*/forwardRef(function (_ref3, ref) {
14514
14536
  active = _ref3.active,
14515
14537
  style = _ref3.style;
14516
14538
  var theme = useTheme();
14517
- var _React$useState = React.useState(false),
14518
- _React$useState2 = _slicedToArray(_React$useState, 2),
14519
- canAnimate = _React$useState2[0],
14520
- setCanAnimate = _React$useState2[1];
14521
- var _React$useState3 = React.useState({
14539
+ var _React$useState = React.useState({
14522
14540
  hideTitle: false,
14523
14541
  hideButton: false
14524
14542
  }),
14525
- _React$useState4 = _slicedToArray(_React$useState3, 2),
14526
- displayState = _React$useState4[0],
14527
- setDisplayState = _React$useState4[1];
14543
+ _React$useState2 = _slicedToArray(_React$useState, 2),
14544
+ displayState = _React$useState2[0],
14545
+ setDisplayState = _React$useState2[1];
14528
14546
  var isIconOnly = displayState.hideTitle || active || !title;
14547
+ var animatedValues = {
14548
+ opacity: React.useRef(new Animated.Value(1)).current,
14549
+ width: React.useRef(new Animated.Value(1)).current,
14550
+ translateY: React.useRef(new Animated.Value(0)).current
14551
+ };
14552
+ var marginBottom = Number((_StyleSheet$flatten = StyleSheet$1.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.marginBottom) || 0;
14553
+ var _React$useState3 = React.useState(0),
14554
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
14555
+ buttonWidth = _React$useState4[0],
14556
+ setButtonWidth = _React$useState4[1];
14557
+ var hasSetButtonWidth = buttonWidth > 0;
14529
14558
  React.useImperativeHandle(ref, function () {
14530
14559
  return {
14531
14560
  show: function show() {
14561
+ Animated.spring(animatedValues.translateY, {
14562
+ toValue: 0,
14563
+ useNativeDriver: true
14564
+ }).start();
14532
14565
  setDisplayState({
14533
14566
  hideButton: false,
14534
14567
  hideTitle: false
14535
14568
  });
14569
+ animateWidth();
14570
+ Animated.spring(animatedValues.opacity, {
14571
+ toValue: 1,
14572
+ useNativeDriver: true
14573
+ }).start();
14536
14574
  },
14537
14575
  collapse: function collapse() {
14576
+ Animated.parallel([Animated.spring(animatedValues.opacity, {
14577
+ toValue: 1,
14578
+ useNativeDriver: true
14579
+ }), Animated.spring(animatedValues.translateY, {
14580
+ toValue: 0,
14581
+ useNativeDriver: true
14582
+ })]).start();
14583
+ animateWidth();
14538
14584
  setDisplayState({
14539
14585
  hideButton: false,
14540
14586
  hideTitle: true
14541
14587
  });
14542
14588
  },
14543
14589
  hide: function hide() {
14544
- setDisplayState(function (previousState) {
14545
- return _objectSpread2(_objectSpread2({}, previousState), {}, {
14546
- hideButton: true
14590
+ Animated.stagger(20, [Animated.spring(animatedValues.opacity, {
14591
+ toValue: 0,
14592
+ useNativeDriver: true
14593
+ }), Animated.spring(animatedValues.translateY, {
14594
+ toValue: 1,
14595
+ useNativeDriver: true
14596
+ })]).start(function () {
14597
+ animateWidth();
14598
+ setDisplayState(function (previousState) {
14599
+ return _objectSpread2(_objectSpread2({}, previousState), {}, {
14600
+ hideButton: true
14601
+ });
14547
14602
  });
14548
14603
  });
14549
14604
  }
14550
14605
  };
14551
14606
  }, []);
14552
- React.useEffect(function () {
14553
- if (canAnimate) {
14554
- LayoutAnimation.configureNext(defaultAnimation);
14555
- }
14556
- }, [isIconOnly, displayState.hideButton, canAnimate]);
14557
- var marginBottom = Number((_StyleSheet$flatten = StyleSheet$1.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.marginBottom) || 0;
14558
- return /*#__PURE__*/React.createElement(StyledFAB$1
14559
- /** Add a small timeout before executing animation to prevent flakiness */, {
14560
- onLayout: function onLayout() {
14561
- return setTimeout(function () {
14562
- return setCanAnimate(true);
14563
- }, 500);
14607
+ return /*#__PURE__*/React.createElement(StyledFAB$1, {
14608
+ onLayout: function onLayout(event) {
14609
+ return !hasSetButtonWidth && !active && setButtonWidth(event.nativeEvent.layout.width);
14564
14610
  },
14565
14611
  underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
14566
14612
  onPress: onPress,
14567
14613
  style: [style, {
14568
- bottom: displayState.hideButton ? -(marginBottom + theme.__hd__.fab.sizes.height * 2) : (_StyleSheet$flatten2 = StyleSheet$1.flatten(style)) === null || _StyleSheet$flatten2 === void 0 ? void 0 : _StyleSheet$flatten2.bottom
14614
+ bottom: displayState.hideButton ? -(marginBottom + theme.__hd__.fab.sizes.height * 2) : (_StyleSheet$flatten2 = StyleSheet$1.flatten(style)) === null || _StyleSheet$flatten2 === void 0 ? void 0 : _StyleSheet$flatten2.bottom,
14615
+ transform: [{
14616
+ translateY: animatedValues.translateY.interpolate({
14617
+ inputRange: [0, 1],
14618
+ outputRange: [0, marginBottom + theme.__hd__.fab.sizes.height * 2]
14619
+ })
14620
+ }]
14569
14621
  }],
14570
14622
  testID: testID,
14571
14623
  themeActive: active
14624
+ }, /*#__PURE__*/React.createElement(Animated.View, {
14625
+ style: {
14626
+ flexDirection: 'row',
14627
+ opacity: animatedValues.opacity.interpolate({
14628
+ inputRange: [0, 1],
14629
+ outputRange: [0, 1]
14630
+ })
14631
+ }
14572
14632
  }, isIconOnly ? /*#__PURE__*/React.createElement(IconOnlyContent, {
14573
14633
  animated: animated,
14574
14634
  active: active,
@@ -14576,7 +14636,7 @@ var FAB$1 = /*#__PURE__*/forwardRef(function (_ref3, ref) {
14576
14636
  }) : /*#__PURE__*/React.createElement(IconWithTextContent, {
14577
14637
  icon: icon,
14578
14638
  title: title
14579
- }));
14639
+ })));
14580
14640
  });
14581
14641
  FAB$1.displayName = 'FAB';
14582
14642
 
@@ -14626,7 +14686,9 @@ var ActionItem = function ActionItem(_ref) {
14626
14686
  Animated.spring(animatedValue.current, {
14627
14687
  toValue: active ? 1 : 0,
14628
14688
  useNativeDriver: Platform.OS !== 'web',
14629
- delay: index * 20
14689
+ delay: index * 30,
14690
+ speed: 10,
14691
+ bounciness: 10
14630
14692
  }).start();
14631
14693
  }, [active, index]);
14632
14694
  return /*#__PURE__*/React.createElement(Animated.View, {
@@ -14703,8 +14765,9 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
14703
14765
  _ref$fabIcon = _ref.fabIcon,
14704
14766
  fabIcon = _ref$fabIcon === void 0 ? 'add' : _ref$fabIcon;
14705
14767
  useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
14768
+ var theme = useTheme();
14706
14769
  var fabRef = useRef(null);
14707
- var tranlateXAnimation = useRef(new Animated.Value(active ? 1 : 0));
14770
+ var animatedValue = useRef(new Animated.Value(active ? 1 : 0));
14708
14771
  React.useImperativeHandle(ref, function () {
14709
14772
  return {
14710
14773
  showFAB: function showFAB() {
@@ -14722,28 +14785,28 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
14722
14785
  };
14723
14786
  }, [fabRef]);
14724
14787
  React.useEffect(function () {
14725
- Animated.spring(tranlateXAnimation.current, {
14788
+ Animated.spring(animatedValue.current, {
14726
14789
  toValue: active ? 1 : 0,
14790
+ delay: 100,
14727
14791
  useNativeDriver: Platform.OS !== 'web'
14728
14792
  }).start();
14793
+ if (active) {
14794
+ var _fabRef$current4;
14795
+ (_fabRef$current4 = fabRef.current) === null || _fabRef$current4 === void 0 || _fabRef$current4.collapse();
14796
+ } else {
14797
+ var _fabRef$current5;
14798
+ (_fabRef$current5 = fabRef.current) === null || _fabRef$current5 === void 0 || _fabRef$current5.show();
14799
+ }
14729
14800
  }, [active]);
14730
- var interpolatedActionGroupOpacityAnimation = tranlateXAnimation.current.interpolate({
14801
+ var actionGroupOpacity = animatedValue.current.interpolate({
14731
14802
  inputRange: [0, 1],
14732
14803
  outputRange: [0, 1]
14733
14804
  });
14734
- var interpolatedFABOpacityAnimation = tranlateXAnimation.current.interpolate({
14735
- inputRange: [0, 1],
14736
- outputRange: [1, 0]
14737
- });
14738
14805
  return /*#__PURE__*/React.createElement(StyledContainer$2, {
14739
14806
  testID: testID,
14740
14807
  pointerEvents: "box-none",
14741
14808
  style: style
14742
- }, /*#__PURE__*/React.createElement(Animated.View, {
14743
- style: {
14744
- opacity: interpolatedFABOpacityAnimation
14745
- }
14746
- }, /*#__PURE__*/React.createElement(StyledFAB, {
14809
+ }, /*#__PURE__*/React.createElement(Animated.View, null, /*#__PURE__*/React.createElement(StyledFAB, {
14747
14810
  key: "fab",
14748
14811
  testID: "fab",
14749
14812
  icon: fabIcon,
@@ -14767,7 +14830,7 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
14767
14830
  testID: "action-group",
14768
14831
  pointerEvents: "box-none",
14769
14832
  style: {
14770
- opacity: interpolatedActionGroupOpacityAnimation
14833
+ opacity: actionGroupOpacity
14771
14834
  }
14772
14835
  }, /*#__PURE__*/React.createElement(Box, {
14773
14836
  style: [style, {
@@ -14780,7 +14843,13 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
14780
14843
  index: active ? index : items.length - index,
14781
14844
  active: active
14782
14845
  }));
14783
- }))), /*#__PURE__*/React.createElement(StyledFAB, {
14846
+ }))), active && /*#__PURE__*/React.createElement(StyledFAB
14847
+ // This FAB is moved up a bit compared to the original FAB,
14848
+ // set marginBottom to negative value to compensate for it
14849
+ , {
14850
+ style: {
14851
+ marginBottom: -theme.space.xxsmall
14852
+ },
14784
14853
  key: "fab-in-portal",
14785
14854
  testID: "fab-in-portal",
14786
14855
  icon: fabIcon,
@@ -16098,9 +16167,18 @@ var InnerCircle = index$9(View)(function (_ref2) {
16098
16167
  };
16099
16168
  });
16100
16169
  var Spacer = index$9(View)(function (_ref3) {
16101
- var theme = _ref3.theme;
16170
+ var theme = _ref3.theme,
16171
+ themeIntent = _ref3.themeIntent;
16172
+ return {
16173
+ marginTop: themeIntent === 'light' ? theme.__hd__.radio.space.groupTopMarginSmall : theme.__hd__.radio.space.groupTopMarginMedium
16174
+ };
16175
+ });
16176
+ var StyledRadio = index$9(List.Item)(function (_ref4) {
16177
+ var theme = _ref4.theme,
16178
+ themeIntent = _ref4.themeIntent,
16179
+ themeChecked = _ref4.themeChecked;
16102
16180
  return {
16103
- marginTop: theme.__hd__.radio.space.groupTopMargin
16181
+ backgroundColor: themeChecked ? theme.__hd__.radio.colors.checked : theme.__hd__.radio.colors.intents[themeIntent]
16104
16182
  };
16105
16183
  });
16106
16184
 
@@ -16117,17 +16195,23 @@ var Radio = function Radio(_ref2) {
16117
16195
  checked = _ref2$checked === void 0 ? false : _ref2$checked,
16118
16196
  onPress = _ref2.onPress,
16119
16197
  style = _ref2.style,
16120
- testID = _ref2.testID;
16121
- return /*#__PURE__*/React.createElement(List.BasicItem, {
16198
+ subText = _ref2.subText,
16199
+ testID = _ref2.testID,
16200
+ _ref2$inactiveIntent = _ref2.inactiveIntent,
16201
+ inactiveIntent = _ref2$inactiveIntent === void 0 ? 'light' : _ref2$inactiveIntent;
16202
+ return /*#__PURE__*/React.createElement(StyledRadio, {
16122
16203
  onPress: onPress,
16123
16204
  selected: checked,
16124
16205
  title: text,
16206
+ subtitle: subText,
16125
16207
  suffix: /*#__PURE__*/React.createElement(RadioCircle, {
16126
16208
  checked: checked,
16127
16209
  text: text
16128
16210
  }),
16129
16211
  style: style,
16130
- testID: testID
16212
+ testID: testID,
16213
+ themeIntent: inactiveIntent,
16214
+ themeChecked: checked
16131
16215
  });
16132
16216
  };
16133
16217
 
@@ -16148,19 +16232,25 @@ var RadioGroup = function RadioGroup(_ref) {
16148
16232
  options = _ref.options,
16149
16233
  keyExtractor = _ref.keyExtractor,
16150
16234
  style = _ref.style,
16151
- testID = _ref.testID;
16235
+ testID = _ref.testID,
16236
+ _ref$inactiveIntent = _ref.inactiveIntent,
16237
+ inactiveIntent = _ref$inactiveIntent === void 0 ? 'light' : _ref$inactiveIntent;
16152
16238
  return /*#__PURE__*/React.createElement(View, {
16153
16239
  style: style,
16154
16240
  testID: testID
16155
16241
  }, options.map(function (option, index) {
16156
16242
  return /*#__PURE__*/React.createElement(React.Fragment, {
16157
16243
  key: getKey(option, index, keyExtractor)
16158
- }, index !== 0 && /*#__PURE__*/React.createElement(Spacer, null), /*#__PURE__*/React.createElement(Radio, {
16244
+ }, index !== 0 && /*#__PURE__*/React.createElement(Spacer, {
16245
+ themeIntent: inactiveIntent
16246
+ }), /*#__PURE__*/React.createElement(Radio, {
16159
16247
  text: option.text,
16248
+ subText: option.subText,
16160
16249
  checked: option.value === value,
16161
16250
  onPress: function onPress() {
16162
16251
  return _onPress(option.value);
16163
- }
16252
+ },
16253
+ inactiveIntent: inactiveIntent
16164
16254
  }));
16165
16255
  }));
16166
16256
  };
@@ -35554,8 +35644,9 @@ var index = Object.assign(RichTextEditorWithRef, {
35554
35644
  Toolbar: EditorToolbar
35555
35645
  });
35556
35646
 
35557
- var COLLAPSE_BREAKPOINT = 10;
35558
- var SHOW_AND_HIDE_BREAKPOINT = 200;
35647
+ var LAST_BREAKPOINT = 100;
35648
+ var MIDDLE_BREAKPOINT = 250;
35649
+ var MAX_ANIMATABLE_SCROLL_DISTANCE = 400;
35559
35650
  var REF_ACTIONS_BY_COMPONENT = {
35560
35651
  FAB: {
35561
35652
  show: 'show',
@@ -35570,27 +35661,23 @@ var REF_ACTIONS_BY_COMPONENT = {
35570
35661
  };
35571
35662
  var AnimatedFAB = function AnimatedFAB(_ref) {
35572
35663
  var fabProps = _ref.fabProps,
35573
- contentOffsetY = _ref.contentOffsetY;
35664
+ contentOffsetY = _ref.contentOffsetY,
35665
+ contentHeight = _ref.contentHeight,
35666
+ layoutHeight = _ref.layoutHeight;
35574
35667
  var component = 'items' in fabProps ? 'ActionGroup' : 'FAB';
35575
- var _React$useState = React.useState('down'),
35576
- _React$useState2 = _slicedToArray(_React$useState, 2),
35577
- currentScrollDirection = _React$useState2[0],
35578
- setCurrentScrollDirection = _React$useState2[1];
35579
- var _React$useState3 = React.useState(0),
35580
- _React$useState4 = _slicedToArray(_React$useState3, 2),
35581
- lastScrollY = _React$useState4[0],
35582
- setLastScrollY = _React$useState4[1];
35583
- var _React$useState5 = React.useState('show'),
35584
- _React$useState6 = _slicedToArray(_React$useState5, 2),
35585
- fabState = _React$useState6[0],
35586
- setFabState = _React$useState6[1];
35587
- var _React$useState7 = React.useState(SHOW_AND_HIDE_BREAKPOINT),
35588
- _React$useState8 = _slicedToArray(_React$useState7, 2),
35589
- remainingScrollOffset = _React$useState8[0],
35590
- setRemainingScrollOffset = _React$useState8[1];
35591
35668
  var ref = React.useRef(null);
35669
+ var currentContentHeight = React.useRef(0);
35670
+ var currentLayoutHeight = React.useRef(0);
35671
+ /** fabState is used to avoid calling duplicated animations. */
35672
+ var fabState = React.useRef('show');
35673
+ /** remainingScrollOffset determines whether to animate the FAB. */
35674
+ var remainingScrollOffset = React.useRef(MAX_ANIMATABLE_SCROLL_DISTANCE);
35675
+ /** currentScrollDirection is used to determine the scroll direction. */
35676
+ var currentScrollDirection = React.useRef('down');
35677
+ /** lastScrollY is the scrollY from the preview scroll event. */
35678
+ var lastScrollY = React.useRef(0);
35592
35679
  var animateFab = React.useCallback(function (newState) {
35593
- if (fabState !== newState) {
35680
+ if (fabState.current !== newState) {
35594
35681
  if (newState === 'show') {
35595
35682
  var _ref$current;
35596
35683
  (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current[REF_ACTIONS_BY_COMPONENT[component].show]();
@@ -35601,37 +35688,64 @@ var AnimatedFAB = function AnimatedFAB(_ref) {
35601
35688
  var _ref$current3;
35602
35689
  (_ref$current3 = ref.current) === null || _ref$current3 === void 0 || _ref$current3[REF_ACTIONS_BY_COMPONENT[component].collapse]();
35603
35690
  }
35604
- setFabState(newState);
35691
+ fabState.current = newState;
35605
35692
  }
35606
- }, [fabState, component]);
35607
- // Listen to ScrollView's contentOffsetY value
35608
- contentOffsetY.addListener(function (_ref2) {
35609
- var value = _ref2.value;
35610
- if (value < 0) {
35611
- return;
35612
- }
35613
- var newScrollDirection = value > lastScrollY ? 'down' : 'up';
35614
- var isScrollingDown = newScrollDirection === 'down';
35615
- if (newScrollDirection !== currentScrollDirection || lastScrollY === 0) {
35616
- setLastScrollY(value);
35617
- setCurrentScrollDirection(newScrollDirection);
35618
- }
35619
- var offsetFromLastDirection = Math.abs(value - lastScrollY);
35620
- var offsetDiff = Math.round(Math.max(remainingScrollOffset - offsetFromLastDirection, 0));
35621
- if (remainingScrollOffset > 0) {
35622
- if (offsetDiff === SHOW_AND_HIDE_BREAKPOINT) {
35623
- animateFab(isScrollingDown ? 'show' : 'hide');
35624
- } else if (offsetDiff <= SHOW_AND_HIDE_BREAKPOINT && offsetDiff > COLLAPSE_BREAKPOINT) {
35625
- animateFab('collapse');
35626
- } else if (offsetDiff <= COLLAPSE_BREAKPOINT) {
35627
- animateFab(isScrollingDown ? 'hide' : 'show');
35628
- }
35629
- setRemainingScrollOffset(offsetDiff);
35630
- }
35631
- });
35693
+ }, [component]);
35632
35694
  React.useEffect(function () {
35633
- setRemainingScrollOffset(SHOW_AND_HIDE_BREAKPOINT);
35634
- }, [currentScrollDirection]);
35695
+ contentHeight.addListener(function (_ref2) {
35696
+ var value = _ref2.value;
35697
+ if (value > 0 && value !== currentContentHeight.current) {
35698
+ currentContentHeight.current = value;
35699
+ }
35700
+ });
35701
+ layoutHeight.addListener(function (_ref3) {
35702
+ var value = _ref3.value;
35703
+ if (value > 0 && value !== currentLayoutHeight.current) {
35704
+ currentLayoutHeight.current = value;
35705
+ }
35706
+ });
35707
+ // Listen to ScrollView's contentOffsetY value
35708
+ contentOffsetY.addListener(function (_ref4) {
35709
+ var value = _ref4.value;
35710
+ if (value < 0 ||
35711
+ // Prevent calling the function if the scroll is not significant
35712
+ value > 0 && Math.abs(value - lastScrollY.current) < 5) {
35713
+ return;
35714
+ }
35715
+ // Scroll up to top, bouncing included.
35716
+ if (value === 0 && lastScrollY.current !== 0) {
35717
+ animateFab('show');
35718
+ }
35719
+ var newScrollDirection = value >= lastScrollY.current ? 'down' : 'up';
35720
+ if (newScrollDirection !== currentScrollDirection.current) {
35721
+ // If scroll direction changes, reset all values
35722
+ currentScrollDirection.current = newScrollDirection;
35723
+ remainingScrollOffset.current = MAX_ANIMATABLE_SCROLL_DISTANCE;
35724
+ }
35725
+ var hasReachedBottom = value + currentLayoutHeight.current >= currentContentHeight.current;
35726
+ // Scroll down to bottom, bouncing included.
35727
+ if (hasReachedBottom) {
35728
+ animateFab('hide');
35729
+ return;
35730
+ }
35731
+ if (remainingScrollOffset.current) {
35732
+ var offsetDiff = Math.round(Math.max(Math.abs(value - lastScrollY.current), 0));
35733
+ var newRemainingScrollOffset = Math.max(remainingScrollOffset.current - offsetDiff, 0);
35734
+ if (newRemainingScrollOffset <= LAST_BREAKPOINT) {
35735
+ animateFab(currentScrollDirection.current === 'down' ? 'hide' : 'show');
35736
+ } else if (newRemainingScrollOffset <= MIDDLE_BREAKPOINT) {
35737
+ animateFab('collapse');
35738
+ }
35739
+ remainingScrollOffset.current = newRemainingScrollOffset;
35740
+ }
35741
+ lastScrollY.current = value;
35742
+ });
35743
+ return function () {
35744
+ contentOffsetY.removeAllListeners();
35745
+ contentHeight.removeAllListeners();
35746
+ layoutHeight.removeAllListeners();
35747
+ };
35748
+ }, [contentHeight, contentOffsetY, layoutHeight]);
35635
35749
  return component === 'FAB' ? /*#__PURE__*/React.createElement(FAB, _extends$1({
35636
35750
  ref: ref
35637
35751
  }, fabProps)) : /*#__PURE__*/React.createElement(ActionGroup, _extends$1({
@@ -35643,6 +35757,8 @@ function AnimatedScroller(_ref) {
35643
35757
  var ScrollComponent = _ref.ScrollComponent,
35644
35758
  fabProps = _ref.fabProps;
35645
35759
  var contentOffsetY = React.useRef(new Animated.Value(0)).current;
35760
+ var contentHeight = React.useRef(new Animated.Value(0)).current;
35761
+ var layoutHeight = React.useRef(new Animated.Value(0)).current;
35646
35762
  // Common props for all ScrollView, FlatList and SectionList.
35647
35763
  var _ScrollComponent$prop = ScrollComponent.props,
35648
35764
  onScroll = _ScrollComponent$prop.onScroll,
@@ -35653,6 +35769,12 @@ function AnimatedScroller(_ref) {
35653
35769
  nativeEvent: {
35654
35770
  contentOffset: {
35655
35771
  y: contentOffsetY
35772
+ },
35773
+ contentSize: {
35774
+ height: contentHeight
35775
+ },
35776
+ layoutMeasurement: {
35777
+ height: layoutHeight
35656
35778
  }
35657
35779
  }
35658
35780
  }], {
@@ -35661,7 +35783,9 @@ function AnimatedScroller(_ref) {
35661
35783
  })
35662
35784
  })), !!fabProps && /*#__PURE__*/React.createElement(AnimatedFAB, {
35663
35785
  fabProps: fabProps,
35664
- contentOffsetY: contentOffsetY
35786
+ contentOffsetY: contentOffsetY,
35787
+ contentHeight: contentHeight,
35788
+ layoutHeight: layoutHeight
35665
35789
  }));
35666
35790
  }
35667
35791