@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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +15 -0
- package/es/index.js +240 -116
- package/lib/index.js +240 -116
- package/package.json +2 -2
- package/src/components/AnimatedScroller/AnimatedFAB.tsx +99 -49
- package/src/components/AnimatedScroller/AnimatedScrollable.tsx +18 -3
- package/src/components/AnimatedScroller/__tests__/ScrollablesWithFAB.spec.tsx +30 -9
- package/src/components/AnimatedScroller/__tests__/__snapshots__/ScrollablesWithFAB.spec.tsx.snap +474 -447
- package/src/components/FAB/ActionGroup/ActionItem.tsx +3 -1
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +216 -211
- package/src/components/FAB/ActionGroup/index.tsx +34 -28
- package/src/components/FAB/FAB.tsx +102 -41
- package/src/components/FAB/StyledFAB.tsx +10 -8
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +34 -38
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +191 -170
- package/src/components/Radio/Radio.tsx +16 -4
- package/src/components/Radio/RadioGroup.tsx +10 -3
- package/src/components/Radio/StyledRadio.tsx +20 -3
- package/src/components/Radio/__tests__/Radio.spec.tsx +46 -13
- package/src/components/Radio/__tests__/RadioGroup.spec.tsx +40 -7
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +446 -77
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +946 -112
- package/src/components/Radio/types.ts +6 -1
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +8 -2
- package/src/theme/components/radio.ts +8 -2
- package/types/components/AnimatedScroller/AnimatedFAB.d.ts +3 -1
- package/types/components/AnimatedScroller/AnimatedScrollable.d.ts +1 -1
- package/types/components/FAB/StyledFAB.d.ts +4 -6
- package/types/components/Radio/Radio.d.ts +9 -1
- package/types/components/Radio/RadioGroup.d.ts +5 -1
- package/types/components/Radio/StyledRadio.d.ts +11 -1
- package/types/components/Radio/index.d.ts +1 -1
- package/types/components/Radio/types.d.ts +1 -0
- package/types/theme/components/radio.d.ts +7 -1
package/lib/index.js
CHANGED
|
@@ -1322,7 +1322,9 @@ var BASE_COLORS = {
|
|
|
1322
1322
|
theatreGold: '#a56822',
|
|
1323
1323
|
uniformGreen: '#4d4628',
|
|
1324
1324
|
yellow: '#fadb14',
|
|
1325
|
-
windsorGrey: '#606065'
|
|
1325
|
+
windsorGrey: '#606065',
|
|
1326
|
+
mist: '#e8e9f8',
|
|
1327
|
+
cloud: '#ccd9f5'
|
|
1326
1328
|
};
|
|
1327
1329
|
var colorScales = Object.entries(BASE_COLORS).reduce(function (acc, _ref16) {
|
|
1328
1330
|
var _ref17 = _slicedToArray(_ref16, 2),
|
|
@@ -1331,15 +1333,17 @@ var colorScales = Object.entries(BASE_COLORS).reduce(function (acc, _ref16) {
|
|
|
1331
1333
|
return Object.assign(Object.assign({}, acc), _defineProperty({}, key, createColorScales(value)));
|
|
1332
1334
|
}, {});
|
|
1333
1335
|
var blue$1 = colorScales.blue,
|
|
1334
|
-
|
|
1336
|
+
cloud = colorScales.cloud,
|
|
1337
|
+
deepSaffron$2 = colorScales.deepSaffron,
|
|
1335
1338
|
green$1 = colorScales.green,
|
|
1336
1339
|
grey$2 = colorScales.grey,
|
|
1337
1340
|
grotesqueGreen = colorScales.grotesqueGreen,
|
|
1338
|
-
|
|
1341
|
+
mist = colorScales.mist,
|
|
1339
1342
|
pink$1 = colorScales.pink,
|
|
1340
1343
|
purple$1 = colorScales.purple,
|
|
1341
|
-
vermilion$2 = colorScales.vermilion,
|
|
1342
1344
|
smalt = colorScales.smalt,
|
|
1345
|
+
ultramarineBlue$2 = colorScales.ultramarineBlue,
|
|
1346
|
+
vermilion$2 = colorScales.vermilion,
|
|
1343
1347
|
violet$1 = colorScales.violet,
|
|
1344
1348
|
yellow$1 = colorScales.yellow;
|
|
1345
1349
|
var palette$b = {
|
|
@@ -1358,9 +1362,11 @@ var palette$b = {
|
|
|
1358
1362
|
blueLight60: blue$1.lighten60,
|
|
1359
1363
|
blueLight75: blue$1.lighten75,
|
|
1360
1364
|
blueLight90: blue$1.lighten90,
|
|
1365
|
+
cloudLight90: cloud.lighten90,
|
|
1361
1366
|
dodgerBlue: ultramarineBlue$2.base,
|
|
1362
1367
|
dodgerBlueDark15: ultramarineBlue$2.darken15,
|
|
1363
1368
|
dodgerBlueDark30: ultramarineBlue$2.darken30,
|
|
1369
|
+
dodgerBlueDark60: ultramarineBlue$2.darken60,
|
|
1364
1370
|
dodgerBlueLight30: ultramarineBlue$2.lighten30,
|
|
1365
1371
|
dodgerBlueLight45: ultramarineBlue$2.lighten45,
|
|
1366
1372
|
dodgerBlueLight60: ultramarineBlue$2.lighten60,
|
|
@@ -1369,6 +1375,7 @@ var palette$b = {
|
|
|
1369
1375
|
green: green$1.base,
|
|
1370
1376
|
greenDark15: green$1.darken15,
|
|
1371
1377
|
greenDark30: green$1.darken30,
|
|
1378
|
+
greenDark60: green$1.darken60,
|
|
1372
1379
|
greenDark75: green$1.darken75,
|
|
1373
1380
|
greenLight30: green$1.lighten30,
|
|
1374
1381
|
greenLight75: green$1.lighten75,
|
|
@@ -1379,6 +1386,7 @@ var palette$b = {
|
|
|
1379
1386
|
greyDark45: grey$2.darken45,
|
|
1380
1387
|
greyDark60: grey$2.darken60,
|
|
1381
1388
|
greyDark75: grey$2.darken75,
|
|
1389
|
+
greyLight30: grey$2.lighten30,
|
|
1382
1390
|
greyLight45: grey$2.lighten45,
|
|
1383
1391
|
greyLight60: grey$2.lighten60,
|
|
1384
1392
|
greyLight75: grey$2.lighten75,
|
|
@@ -1392,20 +1400,27 @@ var palette$b = {
|
|
|
1392
1400
|
grotesqueGreenLight60: grotesqueGreen.lighten60,
|
|
1393
1401
|
grotesqueGreenLight75: grotesqueGreen.lighten75,
|
|
1394
1402
|
grotesqueGreenLight90: grotesqueGreen.lighten90,
|
|
1403
|
+
mistLight30: mist.lighten30,
|
|
1404
|
+
mistLight60: mist.lighten60,
|
|
1405
|
+
mistLight90: mist.lighten90,
|
|
1395
1406
|
orange: deepSaffron$2.base,
|
|
1396
1407
|
orangeDark15: deepSaffron$2.darken15,
|
|
1397
1408
|
orangeDark30: deepSaffron$2.darken30,
|
|
1409
|
+
orangeDark60: deepSaffron$2.darken60,
|
|
1398
1410
|
orangeDark75: deepSaffron$2.darken75,
|
|
1399
1411
|
orangeLight30: deepSaffron$2.lighten30,
|
|
1412
|
+
orangeLight60: deepSaffron$2.lighten60,
|
|
1400
1413
|
orangeLight75: deepSaffron$2.lighten75,
|
|
1401
1414
|
orangeLight90: deepSaffron$2.lighten90,
|
|
1402
1415
|
pink: pink$1.base,
|
|
1403
1416
|
pinkDark15: pink$1.darken15,
|
|
1404
1417
|
pinkDark30: pink$1.darken30,
|
|
1405
1418
|
pinkDark45: pink$1.darken45,
|
|
1419
|
+
pinkDark60: pink$1.darken60,
|
|
1406
1420
|
pinkDark75: pink$1.darken75,
|
|
1407
1421
|
pinkLight30: pink$1.lighten30,
|
|
1408
1422
|
pinkLight45: pink$1.lighten45,
|
|
1423
|
+
pinkLight60: pink$1.lighten60,
|
|
1409
1424
|
pinkLight75: pink$1.lighten75,
|
|
1410
1425
|
pinkLight90: pink$1.lighten90,
|
|
1411
1426
|
purple: purple$1.base,
|
|
@@ -1448,6 +1463,7 @@ var palette$b = {
|
|
|
1448
1463
|
yellow: yellow$1.base,
|
|
1449
1464
|
yellowDark15: yellow$1.darken15,
|
|
1450
1465
|
yellowDark30: yellow$1.darken30,
|
|
1466
|
+
yellowDark45: yellow$1.darken45,
|
|
1451
1467
|
yellowDark75: yellow$1.darken75,
|
|
1452
1468
|
yellowLight30: yellow$1.lighten30,
|
|
1453
1469
|
yellowLight45: yellow$1.lighten45,
|
|
@@ -2964,11 +2980,17 @@ var getProgressTheme = function getProgressTheme(theme) {
|
|
|
2964
2980
|
|
|
2965
2981
|
var getRadioTheme = function getRadioTheme(theme) {
|
|
2966
2982
|
var colors = {
|
|
2967
|
-
circle: theme.colors.
|
|
2983
|
+
circle: theme.colors.primary,
|
|
2984
|
+
checked: theme.colors.highlightedSurface,
|
|
2985
|
+
intents: {
|
|
2986
|
+
light: theme.colors.defaultGlobalSurface,
|
|
2987
|
+
dark: theme.colors.neutralGlobalSurface
|
|
2988
|
+
}
|
|
2968
2989
|
};
|
|
2969
2990
|
var space = {
|
|
2970
2991
|
circleLeftMargin: theme.space.small,
|
|
2971
|
-
|
|
2992
|
+
groupTopMarginSmall: theme.space.xsmall,
|
|
2993
|
+
groupTopMarginMedium: theme.space.medium
|
|
2972
2994
|
};
|
|
2973
2995
|
var boundingBoxSize = theme.sizes.large;
|
|
2974
2996
|
var innerPadding = theme.space.xsmall;
|
|
@@ -14416,7 +14438,8 @@ var Error$1 = function Error(_ref2) {
|
|
|
14416
14438
|
}, nativeProps));
|
|
14417
14439
|
};
|
|
14418
14440
|
|
|
14419
|
-
var
|
|
14441
|
+
var AnimatedTouchableHighlight = reactNative.Animated.createAnimatedComponent(reactNative.TouchableHighlight);
|
|
14442
|
+
var StyledFAB$1 = index$9(AnimatedTouchableHighlight)(function (_ref) {
|
|
14420
14443
|
var theme = _ref.theme,
|
|
14421
14444
|
themeActive = _ref.themeActive;
|
|
14422
14445
|
return {
|
|
@@ -14431,7 +14454,8 @@ var StyledFAB$1 = index$9(reactNative.TouchableHighlight)(function (_ref) {
|
|
|
14431
14454
|
shadowColor: theme.__hd__.fab.shadows.color,
|
|
14432
14455
|
shadowOffset: theme.__hd__.fab.shadows.offset,
|
|
14433
14456
|
shadowRadius: theme.__hd__.fab.shadows.radius,
|
|
14434
|
-
shadowOpacity: theme.__hd__.fab.shadows.opacity
|
|
14457
|
+
shadowOpacity: theme.__hd__.fab.shadows.opacity,
|
|
14458
|
+
height: theme.__hd__.fab.sizes.height
|
|
14435
14459
|
};
|
|
14436
14460
|
});
|
|
14437
14461
|
var StyledFABIcon = index$9(Icon)(function (_ref2) {
|
|
@@ -14523,16 +14547,14 @@ var IconWithTextContent = function IconWithTextContent(_ref2) {
|
|
|
14523
14547
|
testID: "styled-fab-icon"
|
|
14524
14548
|
})), /*#__PURE__*/React__default["default"].createElement(StyledFABText, null, title));
|
|
14525
14549
|
};
|
|
14526
|
-
var
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
},
|
|
14535
|
-
duration: reactNative.Platform.OS === 'ios' ? 300 : 400
|
|
14550
|
+
var animateWidth = function animateWidth() {
|
|
14551
|
+
reactNative.LayoutAnimation.configureNext({
|
|
14552
|
+
duration: reactNative.Platform.OS === 'ios' ? 200 : 400,
|
|
14553
|
+
update: {
|
|
14554
|
+
type: 'spring',
|
|
14555
|
+
springDamping: reactNative.Platform.OS === 'ios' ? 1 : 1.5
|
|
14556
|
+
}
|
|
14557
|
+
});
|
|
14536
14558
|
};
|
|
14537
14559
|
var FAB$1 = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
14538
14560
|
var _StyleSheet$flatten, _StyleSheet$flatten2;
|
|
@@ -14544,61 +14566,99 @@ var FAB$1 = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
|
14544
14566
|
active = _ref3.active,
|
|
14545
14567
|
style = _ref3.style;
|
|
14546
14568
|
var theme = useTheme();
|
|
14547
|
-
var _React$useState = React__default["default"].useState(
|
|
14548
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
14549
|
-
canAnimate = _React$useState2[0],
|
|
14550
|
-
setCanAnimate = _React$useState2[1];
|
|
14551
|
-
var _React$useState3 = React__default["default"].useState({
|
|
14569
|
+
var _React$useState = React__default["default"].useState({
|
|
14552
14570
|
hideTitle: false,
|
|
14553
14571
|
hideButton: false
|
|
14554
14572
|
}),
|
|
14555
|
-
_React$
|
|
14556
|
-
displayState = _React$
|
|
14557
|
-
setDisplayState = _React$
|
|
14573
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
14574
|
+
displayState = _React$useState2[0],
|
|
14575
|
+
setDisplayState = _React$useState2[1];
|
|
14558
14576
|
var isIconOnly = displayState.hideTitle || active || !title;
|
|
14577
|
+
var animatedValues = {
|
|
14578
|
+
opacity: React__default["default"].useRef(new reactNative.Animated.Value(1)).current,
|
|
14579
|
+
width: React__default["default"].useRef(new reactNative.Animated.Value(1)).current,
|
|
14580
|
+
translateY: React__default["default"].useRef(new reactNative.Animated.Value(0)).current
|
|
14581
|
+
};
|
|
14582
|
+
var marginBottom = Number((_StyleSheet$flatten = reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.marginBottom) || 0;
|
|
14583
|
+
var _React$useState3 = React__default["default"].useState(0),
|
|
14584
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
14585
|
+
buttonWidth = _React$useState4[0],
|
|
14586
|
+
setButtonWidth = _React$useState4[1];
|
|
14587
|
+
var hasSetButtonWidth = buttonWidth > 0;
|
|
14559
14588
|
React__default["default"].useImperativeHandle(ref, function () {
|
|
14560
14589
|
return {
|
|
14561
14590
|
show: function show() {
|
|
14591
|
+
reactNative.Animated.spring(animatedValues.translateY, {
|
|
14592
|
+
toValue: 0,
|
|
14593
|
+
useNativeDriver: true
|
|
14594
|
+
}).start();
|
|
14562
14595
|
setDisplayState({
|
|
14563
14596
|
hideButton: false,
|
|
14564
14597
|
hideTitle: false
|
|
14565
14598
|
});
|
|
14599
|
+
animateWidth();
|
|
14600
|
+
reactNative.Animated.spring(animatedValues.opacity, {
|
|
14601
|
+
toValue: 1,
|
|
14602
|
+
useNativeDriver: true
|
|
14603
|
+
}).start();
|
|
14566
14604
|
},
|
|
14567
14605
|
collapse: function collapse() {
|
|
14606
|
+
reactNative.Animated.parallel([reactNative.Animated.spring(animatedValues.opacity, {
|
|
14607
|
+
toValue: 1,
|
|
14608
|
+
useNativeDriver: true
|
|
14609
|
+
}), reactNative.Animated.spring(animatedValues.translateY, {
|
|
14610
|
+
toValue: 0,
|
|
14611
|
+
useNativeDriver: true
|
|
14612
|
+
})]).start();
|
|
14613
|
+
animateWidth();
|
|
14568
14614
|
setDisplayState({
|
|
14569
14615
|
hideButton: false,
|
|
14570
14616
|
hideTitle: true
|
|
14571
14617
|
});
|
|
14572
14618
|
},
|
|
14573
14619
|
hide: function hide() {
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14620
|
+
reactNative.Animated.stagger(20, [reactNative.Animated.spring(animatedValues.opacity, {
|
|
14621
|
+
toValue: 0,
|
|
14622
|
+
useNativeDriver: true
|
|
14623
|
+
}), reactNative.Animated.spring(animatedValues.translateY, {
|
|
14624
|
+
toValue: 1,
|
|
14625
|
+
useNativeDriver: true
|
|
14626
|
+
})]).start(function () {
|
|
14627
|
+
animateWidth();
|
|
14628
|
+
setDisplayState(function (previousState) {
|
|
14629
|
+
return _objectSpread2(_objectSpread2({}, previousState), {}, {
|
|
14630
|
+
hideButton: true
|
|
14631
|
+
});
|
|
14577
14632
|
});
|
|
14578
14633
|
});
|
|
14579
14634
|
}
|
|
14580
14635
|
};
|
|
14581
14636
|
}, []);
|
|
14582
|
-
React__default["default"].
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
}
|
|
14586
|
-
}, [isIconOnly, displayState.hideButton, canAnimate]);
|
|
14587
|
-
var marginBottom = Number((_StyleSheet$flatten = reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.marginBottom) || 0;
|
|
14588
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledFAB$1
|
|
14589
|
-
/** Add a small timeout before executing animation to prevent flakiness */, {
|
|
14590
|
-
onLayout: function onLayout() {
|
|
14591
|
-
return setTimeout(function () {
|
|
14592
|
-
return setCanAnimate(true);
|
|
14593
|
-
}, 500);
|
|
14637
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledFAB$1, {
|
|
14638
|
+
onLayout: function onLayout(event) {
|
|
14639
|
+
return !hasSetButtonWidth && !active && setButtonWidth(event.nativeEvent.layout.width);
|
|
14594
14640
|
},
|
|
14595
14641
|
underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
|
|
14596
14642
|
onPress: onPress,
|
|
14597
14643
|
style: [style, {
|
|
14598
|
-
bottom: displayState.hideButton ? -(marginBottom + theme.__hd__.fab.sizes.height * 2) : (_StyleSheet$flatten2 = reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten2 === void 0 ? void 0 : _StyleSheet$flatten2.bottom
|
|
14644
|
+
bottom: displayState.hideButton ? -(marginBottom + theme.__hd__.fab.sizes.height * 2) : (_StyleSheet$flatten2 = reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten2 === void 0 ? void 0 : _StyleSheet$flatten2.bottom,
|
|
14645
|
+
transform: [{
|
|
14646
|
+
translateY: animatedValues.translateY.interpolate({
|
|
14647
|
+
inputRange: [0, 1],
|
|
14648
|
+
outputRange: [0, marginBottom + theme.__hd__.fab.sizes.height * 2]
|
|
14649
|
+
})
|
|
14650
|
+
}]
|
|
14599
14651
|
}],
|
|
14600
14652
|
testID: testID,
|
|
14601
14653
|
themeActive: active
|
|
14654
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
|
|
14655
|
+
style: {
|
|
14656
|
+
flexDirection: 'row',
|
|
14657
|
+
opacity: animatedValues.opacity.interpolate({
|
|
14658
|
+
inputRange: [0, 1],
|
|
14659
|
+
outputRange: [0, 1]
|
|
14660
|
+
})
|
|
14661
|
+
}
|
|
14602
14662
|
}, isIconOnly ? /*#__PURE__*/React__default["default"].createElement(IconOnlyContent, {
|
|
14603
14663
|
animated: animated,
|
|
14604
14664
|
active: active,
|
|
@@ -14606,7 +14666,7 @@ var FAB$1 = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
|
14606
14666
|
}) : /*#__PURE__*/React__default["default"].createElement(IconWithTextContent, {
|
|
14607
14667
|
icon: icon,
|
|
14608
14668
|
title: title
|
|
14609
|
-
}));
|
|
14669
|
+
})));
|
|
14610
14670
|
});
|
|
14611
14671
|
FAB$1.displayName = 'FAB';
|
|
14612
14672
|
|
|
@@ -14656,7 +14716,9 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
14656
14716
|
reactNative.Animated.spring(animatedValue.current, {
|
|
14657
14717
|
toValue: active ? 1 : 0,
|
|
14658
14718
|
useNativeDriver: reactNative.Platform.OS !== 'web',
|
|
14659
|
-
delay: index *
|
|
14719
|
+
delay: index * 30,
|
|
14720
|
+
speed: 10,
|
|
14721
|
+
bounciness: 10
|
|
14660
14722
|
}).start();
|
|
14661
14723
|
}, [active, index]);
|
|
14662
14724
|
return /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
|
|
@@ -14733,8 +14795,9 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
14733
14795
|
_ref$fabIcon = _ref.fabIcon,
|
|
14734
14796
|
fabIcon = _ref$fabIcon === void 0 ? 'add' : _ref$fabIcon;
|
|
14735
14797
|
useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
|
|
14798
|
+
var theme = useTheme();
|
|
14736
14799
|
var fabRef = React.useRef(null);
|
|
14737
|
-
var
|
|
14800
|
+
var animatedValue = React.useRef(new reactNative.Animated.Value(active ? 1 : 0));
|
|
14738
14801
|
React__default["default"].useImperativeHandle(ref, function () {
|
|
14739
14802
|
return {
|
|
14740
14803
|
showFAB: function showFAB() {
|
|
@@ -14752,28 +14815,28 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
14752
14815
|
};
|
|
14753
14816
|
}, [fabRef]);
|
|
14754
14817
|
React__default["default"].useEffect(function () {
|
|
14755
|
-
reactNative.Animated.spring(
|
|
14818
|
+
reactNative.Animated.spring(animatedValue.current, {
|
|
14756
14819
|
toValue: active ? 1 : 0,
|
|
14820
|
+
delay: 100,
|
|
14757
14821
|
useNativeDriver: reactNative.Platform.OS !== 'web'
|
|
14758
14822
|
}).start();
|
|
14823
|
+
if (active) {
|
|
14824
|
+
var _fabRef$current4;
|
|
14825
|
+
(_fabRef$current4 = fabRef.current) === null || _fabRef$current4 === void 0 || _fabRef$current4.collapse();
|
|
14826
|
+
} else {
|
|
14827
|
+
var _fabRef$current5;
|
|
14828
|
+
(_fabRef$current5 = fabRef.current) === null || _fabRef$current5 === void 0 || _fabRef$current5.show();
|
|
14829
|
+
}
|
|
14759
14830
|
}, [active]);
|
|
14760
|
-
var
|
|
14831
|
+
var actionGroupOpacity = animatedValue.current.interpolate({
|
|
14761
14832
|
inputRange: [0, 1],
|
|
14762
14833
|
outputRange: [0, 1]
|
|
14763
14834
|
});
|
|
14764
|
-
var interpolatedFABOpacityAnimation = tranlateXAnimation.current.interpolate({
|
|
14765
|
-
inputRange: [0, 1],
|
|
14766
|
-
outputRange: [1, 0]
|
|
14767
|
-
});
|
|
14768
14835
|
return /*#__PURE__*/React__default["default"].createElement(StyledContainer$2, {
|
|
14769
14836
|
testID: testID,
|
|
14770
14837
|
pointerEvents: "box-none",
|
|
14771
14838
|
style: style
|
|
14772
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
|
|
14773
|
-
style: {
|
|
14774
|
-
opacity: interpolatedFABOpacityAnimation
|
|
14775
|
-
}
|
|
14776
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledFAB, {
|
|
14839
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, null, /*#__PURE__*/React__default["default"].createElement(StyledFAB, {
|
|
14777
14840
|
key: "fab",
|
|
14778
14841
|
testID: "fab",
|
|
14779
14842
|
icon: fabIcon,
|
|
@@ -14797,7 +14860,7 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
14797
14860
|
testID: "action-group",
|
|
14798
14861
|
pointerEvents: "box-none",
|
|
14799
14862
|
style: {
|
|
14800
|
-
opacity:
|
|
14863
|
+
opacity: actionGroupOpacity
|
|
14801
14864
|
}
|
|
14802
14865
|
}, /*#__PURE__*/React__default["default"].createElement(Box, {
|
|
14803
14866
|
style: [style, {
|
|
@@ -14810,7 +14873,13 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
14810
14873
|
index: active ? index : items.length - index,
|
|
14811
14874
|
active: active
|
|
14812
14875
|
}));
|
|
14813
|
-
}))), /*#__PURE__*/React__default["default"].createElement(StyledFAB
|
|
14876
|
+
}))), active && /*#__PURE__*/React__default["default"].createElement(StyledFAB
|
|
14877
|
+
// This FAB is moved up a bit compared to the original FAB,
|
|
14878
|
+
// set marginBottom to negative value to compensate for it
|
|
14879
|
+
, {
|
|
14880
|
+
style: {
|
|
14881
|
+
marginBottom: -theme.space.xxsmall
|
|
14882
|
+
},
|
|
14814
14883
|
key: "fab-in-portal",
|
|
14815
14884
|
testID: "fab-in-portal",
|
|
14816
14885
|
icon: fabIcon,
|
|
@@ -16128,9 +16197,18 @@ var InnerCircle = index$9(reactNative.View)(function (_ref2) {
|
|
|
16128
16197
|
};
|
|
16129
16198
|
});
|
|
16130
16199
|
var Spacer = index$9(reactNative.View)(function (_ref3) {
|
|
16131
|
-
var theme = _ref3.theme
|
|
16200
|
+
var theme = _ref3.theme,
|
|
16201
|
+
themeIntent = _ref3.themeIntent;
|
|
16202
|
+
return {
|
|
16203
|
+
marginTop: themeIntent === 'light' ? theme.__hd__.radio.space.groupTopMarginSmall : theme.__hd__.radio.space.groupTopMarginMedium
|
|
16204
|
+
};
|
|
16205
|
+
});
|
|
16206
|
+
var StyledRadio = index$9(List.Item)(function (_ref4) {
|
|
16207
|
+
var theme = _ref4.theme,
|
|
16208
|
+
themeIntent = _ref4.themeIntent,
|
|
16209
|
+
themeChecked = _ref4.themeChecked;
|
|
16132
16210
|
return {
|
|
16133
|
-
|
|
16211
|
+
backgroundColor: themeChecked ? theme.__hd__.radio.colors.checked : theme.__hd__.radio.colors.intents[themeIntent]
|
|
16134
16212
|
};
|
|
16135
16213
|
});
|
|
16136
16214
|
|
|
@@ -16147,17 +16225,23 @@ var Radio = function Radio(_ref2) {
|
|
|
16147
16225
|
checked = _ref2$checked === void 0 ? false : _ref2$checked,
|
|
16148
16226
|
onPress = _ref2.onPress,
|
|
16149
16227
|
style = _ref2.style,
|
|
16150
|
-
|
|
16151
|
-
|
|
16228
|
+
subText = _ref2.subText,
|
|
16229
|
+
testID = _ref2.testID,
|
|
16230
|
+
_ref2$inactiveIntent = _ref2.inactiveIntent,
|
|
16231
|
+
inactiveIntent = _ref2$inactiveIntent === void 0 ? 'light' : _ref2$inactiveIntent;
|
|
16232
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledRadio, {
|
|
16152
16233
|
onPress: onPress,
|
|
16153
16234
|
selected: checked,
|
|
16154
16235
|
title: text,
|
|
16236
|
+
subtitle: subText,
|
|
16155
16237
|
suffix: /*#__PURE__*/React__default["default"].createElement(RadioCircle, {
|
|
16156
16238
|
checked: checked,
|
|
16157
16239
|
text: text
|
|
16158
16240
|
}),
|
|
16159
16241
|
style: style,
|
|
16160
|
-
testID: testID
|
|
16242
|
+
testID: testID,
|
|
16243
|
+
themeIntent: inactiveIntent,
|
|
16244
|
+
themeChecked: checked
|
|
16161
16245
|
});
|
|
16162
16246
|
};
|
|
16163
16247
|
|
|
@@ -16178,19 +16262,25 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
16178
16262
|
options = _ref.options,
|
|
16179
16263
|
keyExtractor = _ref.keyExtractor,
|
|
16180
16264
|
style = _ref.style,
|
|
16181
|
-
testID = _ref.testID
|
|
16265
|
+
testID = _ref.testID,
|
|
16266
|
+
_ref$inactiveIntent = _ref.inactiveIntent,
|
|
16267
|
+
inactiveIntent = _ref$inactiveIntent === void 0 ? 'light' : _ref$inactiveIntent;
|
|
16182
16268
|
return /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
|
|
16183
16269
|
style: style,
|
|
16184
16270
|
testID: testID
|
|
16185
16271
|
}, options.map(function (option, index) {
|
|
16186
16272
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
16187
16273
|
key: getKey(option, index, keyExtractor)
|
|
16188
|
-
}, index !== 0 && /*#__PURE__*/React__default["default"].createElement(Spacer,
|
|
16274
|
+
}, index !== 0 && /*#__PURE__*/React__default["default"].createElement(Spacer, {
|
|
16275
|
+
themeIntent: inactiveIntent
|
|
16276
|
+
}), /*#__PURE__*/React__default["default"].createElement(Radio, {
|
|
16189
16277
|
text: option.text,
|
|
16278
|
+
subText: option.subText,
|
|
16190
16279
|
checked: option.value === value,
|
|
16191
16280
|
onPress: function onPress() {
|
|
16192
16281
|
return _onPress(option.value);
|
|
16193
|
-
}
|
|
16282
|
+
},
|
|
16283
|
+
inactiveIntent: inactiveIntent
|
|
16194
16284
|
}));
|
|
16195
16285
|
}));
|
|
16196
16286
|
};
|
|
@@ -35584,8 +35674,9 @@ var index = Object.assign(RichTextEditorWithRef, {
|
|
|
35584
35674
|
Toolbar: EditorToolbar
|
|
35585
35675
|
});
|
|
35586
35676
|
|
|
35587
|
-
var
|
|
35588
|
-
var
|
|
35677
|
+
var LAST_BREAKPOINT = 100;
|
|
35678
|
+
var MIDDLE_BREAKPOINT = 250;
|
|
35679
|
+
var MAX_ANIMATABLE_SCROLL_DISTANCE = 400;
|
|
35589
35680
|
var REF_ACTIONS_BY_COMPONENT = {
|
|
35590
35681
|
FAB: {
|
|
35591
35682
|
show: 'show',
|
|
@@ -35600,27 +35691,23 @@ var REF_ACTIONS_BY_COMPONENT = {
|
|
|
35600
35691
|
};
|
|
35601
35692
|
var AnimatedFAB = function AnimatedFAB(_ref) {
|
|
35602
35693
|
var fabProps = _ref.fabProps,
|
|
35603
|
-
contentOffsetY = _ref.contentOffsetY
|
|
35694
|
+
contentOffsetY = _ref.contentOffsetY,
|
|
35695
|
+
contentHeight = _ref.contentHeight,
|
|
35696
|
+
layoutHeight = _ref.layoutHeight;
|
|
35604
35697
|
var component = 'items' in fabProps ? 'ActionGroup' : 'FAB';
|
|
35605
|
-
var _React$useState = React__default["default"].useState('down'),
|
|
35606
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
35607
|
-
currentScrollDirection = _React$useState2[0],
|
|
35608
|
-
setCurrentScrollDirection = _React$useState2[1];
|
|
35609
|
-
var _React$useState3 = React__default["default"].useState(0),
|
|
35610
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
35611
|
-
lastScrollY = _React$useState4[0],
|
|
35612
|
-
setLastScrollY = _React$useState4[1];
|
|
35613
|
-
var _React$useState5 = React__default["default"].useState('show'),
|
|
35614
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
35615
|
-
fabState = _React$useState6[0],
|
|
35616
|
-
setFabState = _React$useState6[1];
|
|
35617
|
-
var _React$useState7 = React__default["default"].useState(SHOW_AND_HIDE_BREAKPOINT),
|
|
35618
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
35619
|
-
remainingScrollOffset = _React$useState8[0],
|
|
35620
|
-
setRemainingScrollOffset = _React$useState8[1];
|
|
35621
35698
|
var ref = React__default["default"].useRef(null);
|
|
35699
|
+
var currentContentHeight = React__default["default"].useRef(0);
|
|
35700
|
+
var currentLayoutHeight = React__default["default"].useRef(0);
|
|
35701
|
+
/** fabState is used to avoid calling duplicated animations. */
|
|
35702
|
+
var fabState = React__default["default"].useRef('show');
|
|
35703
|
+
/** remainingScrollOffset determines whether to animate the FAB. */
|
|
35704
|
+
var remainingScrollOffset = React__default["default"].useRef(MAX_ANIMATABLE_SCROLL_DISTANCE);
|
|
35705
|
+
/** currentScrollDirection is used to determine the scroll direction. */
|
|
35706
|
+
var currentScrollDirection = React__default["default"].useRef('down');
|
|
35707
|
+
/** lastScrollY is the scrollY from the preview scroll event. */
|
|
35708
|
+
var lastScrollY = React__default["default"].useRef(0);
|
|
35622
35709
|
var animateFab = React__default["default"].useCallback(function (newState) {
|
|
35623
|
-
if (fabState !== newState) {
|
|
35710
|
+
if (fabState.current !== newState) {
|
|
35624
35711
|
if (newState === 'show') {
|
|
35625
35712
|
var _ref$current;
|
|
35626
35713
|
(_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current[REF_ACTIONS_BY_COMPONENT[component].show]();
|
|
@@ -35631,37 +35718,64 @@ var AnimatedFAB = function AnimatedFAB(_ref) {
|
|
|
35631
35718
|
var _ref$current3;
|
|
35632
35719
|
(_ref$current3 = ref.current) === null || _ref$current3 === void 0 || _ref$current3[REF_ACTIONS_BY_COMPONENT[component].collapse]();
|
|
35633
35720
|
}
|
|
35634
|
-
|
|
35721
|
+
fabState.current = newState;
|
|
35635
35722
|
}
|
|
35636
|
-
}, [
|
|
35637
|
-
// Listen to ScrollView's contentOffsetY value
|
|
35638
|
-
contentOffsetY.addListener(function (_ref2) {
|
|
35639
|
-
var value = _ref2.value;
|
|
35640
|
-
if (value < 0) {
|
|
35641
|
-
return;
|
|
35642
|
-
}
|
|
35643
|
-
var newScrollDirection = value > lastScrollY ? 'down' : 'up';
|
|
35644
|
-
var isScrollingDown = newScrollDirection === 'down';
|
|
35645
|
-
if (newScrollDirection !== currentScrollDirection || lastScrollY === 0) {
|
|
35646
|
-
setLastScrollY(value);
|
|
35647
|
-
setCurrentScrollDirection(newScrollDirection);
|
|
35648
|
-
}
|
|
35649
|
-
var offsetFromLastDirection = Math.abs(value - lastScrollY);
|
|
35650
|
-
var offsetDiff = Math.round(Math.max(remainingScrollOffset - offsetFromLastDirection, 0));
|
|
35651
|
-
if (remainingScrollOffset > 0) {
|
|
35652
|
-
if (offsetDiff === SHOW_AND_HIDE_BREAKPOINT) {
|
|
35653
|
-
animateFab(isScrollingDown ? 'show' : 'hide');
|
|
35654
|
-
} else if (offsetDiff <= SHOW_AND_HIDE_BREAKPOINT && offsetDiff > COLLAPSE_BREAKPOINT) {
|
|
35655
|
-
animateFab('collapse');
|
|
35656
|
-
} else if (offsetDiff <= COLLAPSE_BREAKPOINT) {
|
|
35657
|
-
animateFab(isScrollingDown ? 'hide' : 'show');
|
|
35658
|
-
}
|
|
35659
|
-
setRemainingScrollOffset(offsetDiff);
|
|
35660
|
-
}
|
|
35661
|
-
});
|
|
35723
|
+
}, [component]);
|
|
35662
35724
|
React__default["default"].useEffect(function () {
|
|
35663
|
-
|
|
35664
|
-
|
|
35725
|
+
contentHeight.addListener(function (_ref2) {
|
|
35726
|
+
var value = _ref2.value;
|
|
35727
|
+
if (value > 0 && value !== currentContentHeight.current) {
|
|
35728
|
+
currentContentHeight.current = value;
|
|
35729
|
+
}
|
|
35730
|
+
});
|
|
35731
|
+
layoutHeight.addListener(function (_ref3) {
|
|
35732
|
+
var value = _ref3.value;
|
|
35733
|
+
if (value > 0 && value !== currentLayoutHeight.current) {
|
|
35734
|
+
currentLayoutHeight.current = value;
|
|
35735
|
+
}
|
|
35736
|
+
});
|
|
35737
|
+
// Listen to ScrollView's contentOffsetY value
|
|
35738
|
+
contentOffsetY.addListener(function (_ref4) {
|
|
35739
|
+
var value = _ref4.value;
|
|
35740
|
+
if (value < 0 ||
|
|
35741
|
+
// Prevent calling the function if the scroll is not significant
|
|
35742
|
+
value > 0 && Math.abs(value - lastScrollY.current) < 5) {
|
|
35743
|
+
return;
|
|
35744
|
+
}
|
|
35745
|
+
// Scroll up to top, bouncing included.
|
|
35746
|
+
if (value === 0 && lastScrollY.current !== 0) {
|
|
35747
|
+
animateFab('show');
|
|
35748
|
+
}
|
|
35749
|
+
var newScrollDirection = value >= lastScrollY.current ? 'down' : 'up';
|
|
35750
|
+
if (newScrollDirection !== currentScrollDirection.current) {
|
|
35751
|
+
// If scroll direction changes, reset all values
|
|
35752
|
+
currentScrollDirection.current = newScrollDirection;
|
|
35753
|
+
remainingScrollOffset.current = MAX_ANIMATABLE_SCROLL_DISTANCE;
|
|
35754
|
+
}
|
|
35755
|
+
var hasReachedBottom = value + currentLayoutHeight.current >= currentContentHeight.current;
|
|
35756
|
+
// Scroll down to bottom, bouncing included.
|
|
35757
|
+
if (hasReachedBottom) {
|
|
35758
|
+
animateFab('hide');
|
|
35759
|
+
return;
|
|
35760
|
+
}
|
|
35761
|
+
if (remainingScrollOffset.current) {
|
|
35762
|
+
var offsetDiff = Math.round(Math.max(Math.abs(value - lastScrollY.current), 0));
|
|
35763
|
+
var newRemainingScrollOffset = Math.max(remainingScrollOffset.current - offsetDiff, 0);
|
|
35764
|
+
if (newRemainingScrollOffset <= LAST_BREAKPOINT) {
|
|
35765
|
+
animateFab(currentScrollDirection.current === 'down' ? 'hide' : 'show');
|
|
35766
|
+
} else if (newRemainingScrollOffset <= MIDDLE_BREAKPOINT) {
|
|
35767
|
+
animateFab('collapse');
|
|
35768
|
+
}
|
|
35769
|
+
remainingScrollOffset.current = newRemainingScrollOffset;
|
|
35770
|
+
}
|
|
35771
|
+
lastScrollY.current = value;
|
|
35772
|
+
});
|
|
35773
|
+
return function () {
|
|
35774
|
+
contentOffsetY.removeAllListeners();
|
|
35775
|
+
contentHeight.removeAllListeners();
|
|
35776
|
+
layoutHeight.removeAllListeners();
|
|
35777
|
+
};
|
|
35778
|
+
}, [contentHeight, contentOffsetY, layoutHeight]);
|
|
35665
35779
|
return component === 'FAB' ? /*#__PURE__*/React__default["default"].createElement(FAB, _extends$1({
|
|
35666
35780
|
ref: ref
|
|
35667
35781
|
}, fabProps)) : /*#__PURE__*/React__default["default"].createElement(ActionGroup, _extends$1({
|
|
@@ -35673,6 +35787,8 @@ function AnimatedScroller(_ref) {
|
|
|
35673
35787
|
var ScrollComponent = _ref.ScrollComponent,
|
|
35674
35788
|
fabProps = _ref.fabProps;
|
|
35675
35789
|
var contentOffsetY = React__default["default"].useRef(new reactNative.Animated.Value(0)).current;
|
|
35790
|
+
var contentHeight = React__default["default"].useRef(new reactNative.Animated.Value(0)).current;
|
|
35791
|
+
var layoutHeight = React__default["default"].useRef(new reactNative.Animated.Value(0)).current;
|
|
35676
35792
|
// Common props for all ScrollView, FlatList and SectionList.
|
|
35677
35793
|
var _ScrollComponent$prop = ScrollComponent.props,
|
|
35678
35794
|
onScroll = _ScrollComponent$prop.onScroll,
|
|
@@ -35683,6 +35799,12 @@ function AnimatedScroller(_ref) {
|
|
|
35683
35799
|
nativeEvent: {
|
|
35684
35800
|
contentOffset: {
|
|
35685
35801
|
y: contentOffsetY
|
|
35802
|
+
},
|
|
35803
|
+
contentSize: {
|
|
35804
|
+
height: contentHeight
|
|
35805
|
+
},
|
|
35806
|
+
layoutMeasurement: {
|
|
35807
|
+
height: layoutHeight
|
|
35686
35808
|
}
|
|
35687
35809
|
}
|
|
35688
35810
|
}], {
|
|
@@ -35691,7 +35813,9 @@ function AnimatedScroller(_ref) {
|
|
|
35691
35813
|
})
|
|
35692
35814
|
})), !!fabProps && /*#__PURE__*/React__default["default"].createElement(AnimatedFAB, {
|
|
35693
35815
|
fabProps: fabProps,
|
|
35694
|
-
contentOffsetY: contentOffsetY
|
|
35816
|
+
contentOffsetY: contentOffsetY,
|
|
35817
|
+
contentHeight: contentHeight,
|
|
35818
|
+
layoutHeight: layoutHeight
|
|
35695
35819
|
}));
|
|
35696
35820
|
}
|
|
35697
35821
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.60.1-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/primitives-core": "11.0.0",
|
|
24
24
|
"@emotion/react": "^11.9.3",
|
|
25
|
-
"@hero-design/colors": "
|
|
25
|
+
"@hero-design/colors": "9.0.0-alpha.0",
|
|
26
26
|
"date-fns": "^2.16.1",
|
|
27
27
|
"hero-editor": "^1.9.21",
|
|
28
28
|
"nanoid": "^4.0.2"
|