@hero-design/rn 8.30.3 → 8.30.4
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/es/index.js +70 -169
- package/lib/index.js +70 -169
- package/package.json +5 -5
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +3 -33
- package/src/components/Carousel/index.tsx +18 -5
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +818 -981
- package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +11 -4
- package/src/components/FAB/ActionGroup/index.tsx +98 -142
- package/src/components/FAB/AnimatedFABIcon.tsx +5 -3
- package/src/components/FAB/FAB.tsx +28 -112
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +9 -27
- package/src/components/FAB/__tests__/index.spec.tsx +2 -22
- package/src/components/Skeleton/__tests__/__snapshots__/index.spec.tsx.snap +14 -14
- package/src/components/Skeleton/index.tsx +3 -7
- package/src/types.ts +0 -4
- package/testUtils/setup.tsx +0 -2
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +1 -1
- package/types/components/FAB/ActionGroup/index.d.ts +1 -7
- package/types/components/FAB/FAB.d.ts +2 -8
- package/types/components/FAB/index.d.ts +2 -3
- package/types/types.d.ts +1 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -4,5 +4,5 @@ $ rollup -c
|
|
|
4
4
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
5
5
|
[1m[33m(!) 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`.[39m[22m
|
|
6
6
|
[1m[33m(!) 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[39m[22m
|
|
7
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
7
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m27.5s[22m[39m
|
|
8
8
|
$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -11558,12 +11558,18 @@ var Carousel = function Carousel(_ref) {
|
|
|
11558
11558
|
clearTimeout(handle);
|
|
11559
11559
|
};
|
|
11560
11560
|
}, [currentSlideIndex, carouselRef]);
|
|
11561
|
-
var
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
var
|
|
11561
|
+
var handleMomentumScrollEnd = function handleMomentumScrollEnd(event) {
|
|
11562
|
+
// Calculate the current index based on the scroll position and container width
|
|
11563
|
+
var containerWidth = event.nativeEvent.layoutMeasurement.width;
|
|
11564
|
+
var scrollPosition = event.nativeEvent.contentOffset.x;
|
|
11565
|
+
/**
|
|
11566
|
+
* By rounding down, we ensure that any partial visibility of the next item does not affect the index value
|
|
11567
|
+
* This helps maintain consistent behavior and aligns with the desired functionality of considering the left-most visible item as the current item.
|
|
11568
|
+
*/
|
|
11569
|
+
var index = Math.floor(scrollPosition / containerWidth);
|
|
11570
|
+
// Call the callback function with the current index
|
|
11565
11571
|
internalOnItemIndexChange(index);
|
|
11566
|
-
}
|
|
11572
|
+
};
|
|
11567
11573
|
var viewConfig = useRef({
|
|
11568
11574
|
viewAreaCoveragePercentThreshold: 50
|
|
11569
11575
|
}).current;
|
|
@@ -11580,7 +11586,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
11580
11586
|
pagingEnabled: true,
|
|
11581
11587
|
bounces: false,
|
|
11582
11588
|
data: items,
|
|
11583
|
-
|
|
11589
|
+
onMomentumScrollEnd: handleMomentumScrollEnd,
|
|
11584
11590
|
viewabilityConfig: viewConfig,
|
|
11585
11591
|
scrollEventThrottle: 32,
|
|
11586
11592
|
ref: carouselRef,
|
|
@@ -11593,8 +11599,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
11593
11599
|
}], {
|
|
11594
11600
|
useNativeDriver: false
|
|
11595
11601
|
}),
|
|
11596
|
-
renderItem: function renderItem(
|
|
11597
|
-
var item =
|
|
11602
|
+
renderItem: function renderItem(_ref2) {
|
|
11603
|
+
var item = _ref2.item;
|
|
11598
11604
|
if (!item) return null;
|
|
11599
11605
|
var image = item.image,
|
|
11600
11606
|
heading = item.heading,
|
|
@@ -12974,9 +12980,11 @@ var AnimatedFABIcon = function AnimatedFABIcon(_ref) {
|
|
|
12974
12980
|
iconProps = _objectWithoutProperties(_ref, _excluded$c);
|
|
12975
12981
|
var rotateAnimation = useRef(new Animated.Value(active ? 1 : 0));
|
|
12976
12982
|
useEffect(function () {
|
|
12977
|
-
var animation = Animated.
|
|
12983
|
+
var animation = Animated.timing(rotateAnimation.current, {
|
|
12978
12984
|
toValue: active ? 1 : 0,
|
|
12979
|
-
useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android'
|
|
12985
|
+
useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
|
|
12986
|
+
easing: Easing.inOut(Easing.ease),
|
|
12987
|
+
duration: 300
|
|
12980
12988
|
});
|
|
12981
12989
|
animation.start();
|
|
12982
12990
|
return function () {
|
|
@@ -12998,11 +13006,6 @@ var AnimatedFABIcon = function AnimatedFABIcon(_ref) {
|
|
|
12998
13006
|
}, iconProps)));
|
|
12999
13007
|
};
|
|
13000
13008
|
|
|
13001
|
-
if (Platform.OS === 'android') {
|
|
13002
|
-
if (UIManager.setLayoutAnimationEnabledExperimental) {
|
|
13003
|
-
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
13004
|
-
}
|
|
13005
|
-
}
|
|
13006
13009
|
var IconOnlyContent = function IconOnlyContent(_ref) {
|
|
13007
13010
|
var icon = _ref.icon,
|
|
13008
13011
|
animated = _ref.animated,
|
|
@@ -13028,19 +13031,7 @@ var IconWithTextContent = function IconWithTextContent(_ref2) {
|
|
|
13028
13031
|
testID: "styled-fab-icon"
|
|
13029
13032
|
})), /*#__PURE__*/React.createElement(StyledFABText, null, title));
|
|
13030
13033
|
};
|
|
13031
|
-
var
|
|
13032
|
-
create: {
|
|
13033
|
-
type: 'easeInEaseOut',
|
|
13034
|
-
property: 'opacity'
|
|
13035
|
-
},
|
|
13036
|
-
update: {
|
|
13037
|
-
type: 'spring',
|
|
13038
|
-
springDamping: 1
|
|
13039
|
-
},
|
|
13040
|
-
duration: 400
|
|
13041
|
-
};
|
|
13042
|
-
var FAB = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
13043
|
-
var _StyleSheet$flatten, _StyleSheet$flatten2;
|
|
13034
|
+
var FAB = function FAB(_ref3) {
|
|
13044
13035
|
var onPress = _ref3.onPress,
|
|
13045
13036
|
title = _ref3.title,
|
|
13046
13037
|
icon = _ref3.icon,
|
|
@@ -13048,75 +13039,22 @@ var FAB = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
13048
13039
|
testID = _ref3.testID,
|
|
13049
13040
|
active = _ref3.active,
|
|
13050
13041
|
style = _ref3.style;
|
|
13042
|
+
var isIconOnly = !title;
|
|
13051
13043
|
var theme = useTheme();
|
|
13052
|
-
|
|
13053
|
-
hideTitle: false,
|
|
13054
|
-
hideButton: false
|
|
13055
|
-
}),
|
|
13056
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
13057
|
-
displayState = _React$useState2[0],
|
|
13058
|
-
setDisplayState = _React$useState2[1];
|
|
13059
|
-
var _React$useState3 = React.useState(false),
|
|
13060
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
13061
|
-
canAnimate = _React$useState4[0],
|
|
13062
|
-
setCanAnimate = _React$useState4[1];
|
|
13063
|
-
var isIconOnly = displayState.hideTitle || active || !title;
|
|
13064
|
-
useImperativeHandle(ref, function () {
|
|
13065
|
-
return {
|
|
13066
|
-
show: function show() {
|
|
13067
|
-
setDisplayState({
|
|
13068
|
-
hideButton: false,
|
|
13069
|
-
hideTitle: false
|
|
13070
|
-
});
|
|
13071
|
-
},
|
|
13072
|
-
collapse: function collapse() {
|
|
13073
|
-
setDisplayState({
|
|
13074
|
-
hideButton: false,
|
|
13075
|
-
hideTitle: true
|
|
13076
|
-
});
|
|
13077
|
-
},
|
|
13078
|
-
hide: function hide() {
|
|
13079
|
-
setDisplayState(function (previousState) {
|
|
13080
|
-
return _objectSpread2(_objectSpread2({}, previousState), {}, {
|
|
13081
|
-
hideButton: true
|
|
13082
|
-
});
|
|
13083
|
-
});
|
|
13084
|
-
}
|
|
13085
|
-
};
|
|
13086
|
-
}, [displayState]);
|
|
13087
|
-
useEffect(function () {
|
|
13088
|
-
if (canAnimate) {
|
|
13089
|
-
LayoutAnimation.configureNext(defaultAnimation);
|
|
13090
|
-
}
|
|
13091
|
-
}, [isIconOnly]);
|
|
13092
|
-
useEffect(function () {
|
|
13093
|
-
if (canAnimate) {
|
|
13094
|
-
LayoutAnimation.configureNext(defaultAnimation);
|
|
13095
|
-
}
|
|
13096
|
-
}, [displayState.hideButton]);
|
|
13097
|
-
var marginBottom = Number((_StyleSheet$flatten = StyleSheet$1.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.marginBottom) || 0;
|
|
13098
|
-
return /*#__PURE__*/React.createElement(StyledFAB$1
|
|
13099
|
-
/** Add a small timeout before executing animation to prevent flakiness on android */, {
|
|
13100
|
-
onLayout: function onLayout() {
|
|
13101
|
-
return setTimeout(function () {
|
|
13102
|
-
return setCanAnimate(true);
|
|
13103
|
-
}, 200);
|
|
13104
|
-
},
|
|
13044
|
+
return /*#__PURE__*/React.createElement(StyledFAB$1, {
|
|
13105
13045
|
underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
|
|
13106
13046
|
onPress: onPress,
|
|
13107
|
-
style:
|
|
13108
|
-
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
|
|
13109
|
-
}],
|
|
13047
|
+
style: style,
|
|
13110
13048
|
testID: testID
|
|
13111
13049
|
}, isIconOnly ? /*#__PURE__*/React.createElement(IconOnlyContent, {
|
|
13112
13050
|
animated: animated,
|
|
13113
13051
|
active: active,
|
|
13114
|
-
icon:
|
|
13052
|
+
icon: icon
|
|
13115
13053
|
}) : /*#__PURE__*/React.createElement(IconWithTextContent, {
|
|
13116
13054
|
icon: icon,
|
|
13117
13055
|
title: title
|
|
13118
13056
|
}));
|
|
13119
|
-
}
|
|
13057
|
+
};
|
|
13120
13058
|
|
|
13121
13059
|
var StyledActionItem = index$a(TouchableHighlight)(function (_ref) {
|
|
13122
13060
|
var theme = _ref.theme;
|
|
@@ -13213,55 +13151,40 @@ var StyledHeaderText = index$a(Typography.Text)(function (_ref3) {
|
|
|
13213
13151
|
};
|
|
13214
13152
|
});
|
|
13215
13153
|
|
|
13216
|
-
var
|
|
13217
|
-
var
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
style
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13154
|
+
var ActionItemsListComponent = function ActionItemsListComponent(_ref) {
|
|
13155
|
+
var style = _ref.style,
|
|
13156
|
+
items = _ref.items;
|
|
13157
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
13158
|
+
style: style
|
|
13159
|
+
}, items === null || items === void 0 ? void 0 : items.map(function (itemProp) {
|
|
13160
|
+
return /*#__PURE__*/React.createElement(ActionItem, _extends$1({
|
|
13161
|
+
key: itemProp.key || "".concat(itemProp.icon, "_").concat(itemProp.title)
|
|
13162
|
+
}, itemProp));
|
|
13163
|
+
}));
|
|
13164
|
+
};
|
|
13165
|
+
var ActionGroup = function ActionGroup(_ref2) {
|
|
13166
|
+
var headerTitle = _ref2.headerTitle,
|
|
13167
|
+
onPress = _ref2.onPress,
|
|
13168
|
+
active = _ref2.active,
|
|
13169
|
+
style = _ref2.style,
|
|
13170
|
+
items = _ref2.items,
|
|
13171
|
+
testID = _ref2.testID,
|
|
13172
|
+
fabTitle = _ref2.fabTitle,
|
|
13173
|
+
_ref2$fabIcon = _ref2.fabIcon,
|
|
13174
|
+
fabIcon = _ref2$fabIcon === void 0 ? 'add' : _ref2$fabIcon;
|
|
13227
13175
|
var tranlateXAnimation = useRef(new Animated.Value(active ? 1 : 0));
|
|
13228
|
-
var animatedValues = useRef((items === null || items === void 0 ? void 0 : items.map(function () {
|
|
13229
|
-
return new Animated.Value(0);
|
|
13230
|
-
})) || []).current;
|
|
13231
|
-
var translateYAnimations = animatedValues === null || animatedValues === void 0 ? void 0 : animatedValues.map(function (value) {
|
|
13232
|
-
return value.interpolate({
|
|
13233
|
-
inputRange: [0, 1],
|
|
13234
|
-
outputRange: active ? [100, 0] : [40, 0]
|
|
13235
|
-
});
|
|
13236
|
-
});
|
|
13237
|
-
useImperativeHandle(ref, function () {
|
|
13238
|
-
return {
|
|
13239
|
-
showFAB: function showFAB() {
|
|
13240
|
-
var _fabRef$current;
|
|
13241
|
-
return (_fabRef$current = fabRef.current) === null || _fabRef$current === void 0 ? void 0 : _fabRef$current.show();
|
|
13242
|
-
},
|
|
13243
|
-
collapseFAB: function collapseFAB() {
|
|
13244
|
-
var _fabRef$current2;
|
|
13245
|
-
return (_fabRef$current2 = fabRef.current) === null || _fabRef$current2 === void 0 ? void 0 : _fabRef$current2.collapse();
|
|
13246
|
-
},
|
|
13247
|
-
hideFAB: function hideFAB() {
|
|
13248
|
-
var _fabRef$current3;
|
|
13249
|
-
return (_fabRef$current3 = fabRef.current) === null || _fabRef$current3 === void 0 ? void 0 : _fabRef$current3.hide();
|
|
13250
|
-
}
|
|
13251
|
-
};
|
|
13252
|
-
}, [fabRef]);
|
|
13253
13176
|
useEffect(function () {
|
|
13254
|
-
Animated.
|
|
13177
|
+
var animation = Animated.timing(tranlateXAnimation.current, {
|
|
13255
13178
|
toValue: active ? 1 : 0,
|
|
13256
|
-
useNativeDriver: Platform.OS
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
}
|
|
13179
|
+
useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
|
|
13180
|
+
easing: Easing.inOut(Easing.cubic)
|
|
13181
|
+
});
|
|
13182
|
+
animation.start();
|
|
13183
|
+
}, [active]);
|
|
13184
|
+
var interpolatedTranlateXAnimation = tranlateXAnimation.current.interpolate({
|
|
13185
|
+
inputRange: [0, 1],
|
|
13186
|
+
outputRange: [400, 0]
|
|
13187
|
+
});
|
|
13265
13188
|
var interpolatedBackdropOpacityAnimation = tranlateXAnimation.current.interpolate({
|
|
13266
13189
|
inputRange: [0, 1],
|
|
13267
13190
|
outputRange: [0, 0.4]
|
|
@@ -13284,39 +13207,24 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13284
13207
|
pointerEvents: active ? 'auto' : 'none',
|
|
13285
13208
|
testID: "action-group",
|
|
13286
13209
|
style: {
|
|
13287
|
-
opacity: interpolatedActionGroupOpacityAnimation
|
|
13288
|
-
}
|
|
13289
|
-
}, !!headerTitle && /*#__PURE__*/React.createElement(Animated.View, {
|
|
13290
|
-
style: {
|
|
13210
|
+
opacity: interpolatedActionGroupOpacityAnimation,
|
|
13291
13211
|
transform: [{
|
|
13292
|
-
|
|
13212
|
+
translateX: interpolatedTranlateXAnimation
|
|
13293
13213
|
}]
|
|
13294
13214
|
}
|
|
13295
|
-
}, /*#__PURE__*/React.createElement(StyledHeaderText, {
|
|
13215
|
+
}, !!headerTitle && /*#__PURE__*/React.createElement(StyledHeaderText, {
|
|
13296
13216
|
testID: "header-text"
|
|
13297
|
-
}, headerTitle)
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
}]
|
|
13301
|
-
}, items === null || items === void 0 ? void 0 : items.map(function (itemProp, index) {
|
|
13302
|
-
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
13303
|
-
key: itemProp.key || "".concat(itemProp.icon, "_").concat(itemProp.title),
|
|
13304
|
-
style: {
|
|
13305
|
-
transform: [{
|
|
13306
|
-
translateY: translateYAnimations[index]
|
|
13307
|
-
}]
|
|
13308
|
-
}
|
|
13309
|
-
}, /*#__PURE__*/React.createElement(ActionItem, itemProp));
|
|
13310
|
-
}))), /*#__PURE__*/React.createElement(StyledFAB, {
|
|
13217
|
+
}, headerTitle), /*#__PURE__*/React.createElement(ActionItemsListComponent, {
|
|
13218
|
+
items: items
|
|
13219
|
+
})), /*#__PURE__*/React.createElement(StyledFAB, {
|
|
13311
13220
|
testID: "fab",
|
|
13312
13221
|
icon: fabIcon,
|
|
13313
13222
|
onPress: onPress,
|
|
13314
13223
|
animated: true,
|
|
13315
13224
|
active: active,
|
|
13316
|
-
title: fabTitle
|
|
13317
|
-
ref: fabRef
|
|
13225
|
+
title: fabTitle
|
|
13318
13226
|
}));
|
|
13319
|
-
}
|
|
13227
|
+
};
|
|
13320
13228
|
|
|
13321
13229
|
var index$6 = Object.assign(FAB, {
|
|
13322
13230
|
ActionGroup: ActionGroup
|
|
@@ -14999,7 +14907,7 @@ var getGradientColors = function getGradientColors(theme, intent) {
|
|
|
14999
14907
|
}
|
|
15000
14908
|
};
|
|
15001
14909
|
var Skeleton = function Skeleton(_ref) {
|
|
15002
|
-
var _StyleSheet$flatten
|
|
14910
|
+
var _StyleSheet$flatten;
|
|
15003
14911
|
var _ref$intent = _ref.intent,
|
|
15004
14912
|
intent = _ref$intent === void 0 ? 'light' : _ref$intent,
|
|
15005
14913
|
_ref$variant = _ref.variant,
|
|
@@ -15015,14 +14923,10 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
15015
14923
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15016
14924
|
containerWidth = _useState2[0],
|
|
15017
14925
|
setContainerWidth = _useState2[1];
|
|
15018
|
-
var _useState3 = useState(
|
|
14926
|
+
var _useState3 = useState(false),
|
|
15019
14927
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
var _useState5 = useState(false),
|
|
15023
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
15024
|
-
shouldStartAnimation = _useState6[0],
|
|
15025
|
-
setShouldStartAnimation = _useState6[1];
|
|
14928
|
+
shouldStartAnimation = _useState4[0],
|
|
14929
|
+
setShouldStartAnimation = _useState4[1];
|
|
15026
14930
|
var animatedValue = useRef(new Animated.Value(0)).current;
|
|
15027
14931
|
useEffect(function () {
|
|
15028
14932
|
if (shouldStartAnimation) {
|
|
@@ -15039,10 +14943,7 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
15039
14943
|
outputRange: [-containerWidth, containerWidth]
|
|
15040
14944
|
});
|
|
15041
14945
|
var onContainerLayout = useCallback(function (e) {
|
|
15042
|
-
var
|
|
15043
|
-
width = _e$nativeEvent$layout.width,
|
|
15044
|
-
height = _e$nativeEvent$layout.height;
|
|
15045
|
-
setContainerHeight(height);
|
|
14946
|
+
var width = e.nativeEvent.layout.width;
|
|
15046
14947
|
setContainerWidth(width);
|
|
15047
14948
|
if (!shouldStartAnimation) {
|
|
15048
14949
|
setShouldStartAnimation(true);
|
|
@@ -15060,8 +14961,8 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
15060
14961
|
start: gradientPositions.start,
|
|
15061
14962
|
end: gradientPositions.end,
|
|
15062
14963
|
style: {
|
|
15063
|
-
width:
|
|
15064
|
-
height:
|
|
14964
|
+
width: '100%',
|
|
14965
|
+
height: '100%',
|
|
15065
14966
|
transform: [{
|
|
15066
14967
|
translateX: translateX
|
|
15067
14968
|
}]
|