@hero-design/rn 8.25.0 → 8.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/es/index.js +67 -61
- package/lib/index.js +65 -59
- package/package.json +5 -5
- package/src/components/Collapse/index.tsx +11 -10
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +21 -15
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +7 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +7 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +7 -5
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +152 -180
- package/src/components/FAB/FAB.tsx +15 -20
- package/src/components/FAB/StyledFAB.tsx +5 -10
- package/src/components/FAB/__tests__/StyledFAB.spec.tsx +4 -4
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +28 -13
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +170 -212
- package/src/components/PinInput/index.tsx +119 -88
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +28 -20
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +28 -20
- package/src/components/TextInput/StyledTextInput.tsx +4 -0
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +21 -1
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +112 -78
- package/src/components/TextInput/index.tsx +1 -4
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +14 -10
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +14 -10
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +5 -1
- package/src/theme/components/textInput.ts +16 -2
- package/types/components/Collapse/index.d.ts +1 -1
- package/types/components/FAB/StyledFAB.d.ts +1 -5
- package/types/components/PinInput/index.d.ts +12 -1
- package/types/theme/components/textInput.d.ts +4 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
1
|
+
[36m@hero-design/rn:build[0m: cache hit, replaying output [2mee3006d84e9b45f8[0m
|
|
2
|
+
[36m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
|
+
[36m@hero-design/rn:build: [0m$ rollup -c
|
|
4
|
+
[36m@hero-design/rn:build: [0m[36m
|
|
5
|
+
[36m@hero-design/rn:build: [0m[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
|
+
[36m@hero-design/rn:build: [0m[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
|
|
7
|
+
[36m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/Volumes/Data/Projects/hero-design2/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
+
[36m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m28.9s[22m[39m
|
|
9
|
+
[36m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as reactNative from 'react-native';
|
|
2
|
-
import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View,
|
|
3
|
-
import React, { useContext, createContext, createElement, useMemo, forwardRef, useEffect, useCallback, useRef, useState, isValidElement,
|
|
2
|
+
import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, UIManager, LayoutAnimation, TouchableOpacity, Text as Text$1, Easing, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, TouchableHighlight, ScrollView, Modal, FlatList, useWindowDimensions, TextInput as TextInput$1, PanResponder, InteractionManager, Keyboard, SectionList, RefreshControl as RefreshControl$1 } from 'react-native';
|
|
3
|
+
import React, { useContext, createContext, createElement, useMemo, forwardRef, useEffect, useCallback, useRef, useState, isValidElement, useImperativeHandle, useLayoutEffect } from 'react';
|
|
4
4
|
import { createIconSet } from 'react-native-vector-icons';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import DateTimePicker from '@react-native-community/datetimepicker';
|
|
@@ -1071,7 +1071,9 @@ var palette$b = {
|
|
|
1071
1071
|
yellow: yellow$1.base,
|
|
1072
1072
|
yellowDark15: yellow$1.darken15,
|
|
1073
1073
|
yellowDark75: yellow$1.darken75,
|
|
1074
|
+
yellowLight45: yellow$1.lighten45,
|
|
1074
1075
|
yellowLight60: yellow$1.lighten60,
|
|
1076
|
+
yellowLight75: yellow$1.lighten75,
|
|
1075
1077
|
yellowLight90: yellow$1.lighten90
|
|
1076
1078
|
};
|
|
1077
1079
|
var mauve$4 = colorScales.mauve,
|
|
@@ -2929,7 +2931,7 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2929
2931
|
var space = {
|
|
2930
2932
|
containerPadding: theme.space.medium,
|
|
2931
2933
|
labelLeft: theme.space.medium,
|
|
2932
|
-
labelTop: theme.lineHeights.small / -
|
|
2934
|
+
labelTop: theme.lineHeights.small / -4,
|
|
2933
2935
|
labelPaddingBottom: theme.space.small,
|
|
2934
2936
|
labelHorizontalPadding: theme.space.xsmall,
|
|
2935
2937
|
inputHorizontalMargin: theme.space.small,
|
|
@@ -2948,7 +2950,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2948
2950
|
labelInsideTextInput: theme.fontSizes.large,
|
|
2949
2951
|
error: theme.fontSizes.small,
|
|
2950
2952
|
maxLength: theme.fontSizes.small,
|
|
2951
|
-
asteriskLabel: theme.fontSizes.large
|
|
2953
|
+
asteriskLabel: theme.fontSizes.large,
|
|
2954
|
+
topLabel: theme.fontSizes.small
|
|
2952
2955
|
};
|
|
2953
2956
|
var borderWidths = {
|
|
2954
2957
|
container: {
|
|
@@ -2964,6 +2967,9 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2964
2967
|
textareaHeight: theme.sizes['15xlarge'],
|
|
2965
2968
|
textInputMaxHeight: theme.sizes['15xlarge']
|
|
2966
2969
|
};
|
|
2970
|
+
var lineHeights = {
|
|
2971
|
+
topLabel: theme.lineHeights.large / 2
|
|
2972
|
+
};
|
|
2967
2973
|
return {
|
|
2968
2974
|
colors: colors,
|
|
2969
2975
|
space: space,
|
|
@@ -2971,7 +2977,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2971
2977
|
fontSizes: fontSizes,
|
|
2972
2978
|
borderWidths: borderWidths,
|
|
2973
2979
|
radii: radii,
|
|
2974
|
-
sizes: sizes
|
|
2980
|
+
sizes: sizes,
|
|
2981
|
+
lineHeights: lineHeights
|
|
2975
2982
|
};
|
|
2976
2983
|
};
|
|
2977
2984
|
|
|
@@ -6027,26 +6034,6 @@ var index$a = components.reduce(function (acc, comp) {
|
|
|
6027
6034
|
});
|
|
6028
6035
|
}, styled);
|
|
6029
6036
|
|
|
6030
|
-
var StyledWrapper$c = index$a(Animated.View)({
|
|
6031
|
-
margin: 0,
|
|
6032
|
-
padding: 0,
|
|
6033
|
-
overflow: 'hidden'
|
|
6034
|
-
});
|
|
6035
|
-
/**
|
|
6036
|
-
* Height need to be high enough to cover most scenario
|
|
6037
|
-
* This container's purpose is only to help get correct children height and returns it
|
|
6038
|
-
* to use with Animated.timing
|
|
6039
|
-
*/
|
|
6040
|
-
var StyledHiddenWrapper = index$a(View)(function () {
|
|
6041
|
-
return {
|
|
6042
|
-
height: Dimensions.get('window').height
|
|
6043
|
-
};
|
|
6044
|
-
});
|
|
6045
|
-
var StyledChildWrapper = index$a(View)({
|
|
6046
|
-
margin: 0,
|
|
6047
|
-
padding: 0
|
|
6048
|
-
});
|
|
6049
|
-
|
|
6050
6037
|
// Get previous state value
|
|
6051
6038
|
var usePrevious = function usePrevious(value) {
|
|
6052
6039
|
var ref = React.useRef();
|
|
@@ -6072,13 +6059,37 @@ var useDeprecation = function useDeprecation(message) {
|
|
|
6072
6059
|
}, [message, cond]);
|
|
6073
6060
|
};
|
|
6074
6061
|
|
|
6062
|
+
var StyledWrapper$c = index$a(Animated.View)({
|
|
6063
|
+
margin: 0,
|
|
6064
|
+
padding: 0,
|
|
6065
|
+
overflow: 'hidden'
|
|
6066
|
+
});
|
|
6067
|
+
/**
|
|
6068
|
+
* Height need to be high enough to cover most scenario
|
|
6069
|
+
* This container's purpose is only to help get correct children height and returns it
|
|
6070
|
+
* to use with Animated.timing
|
|
6071
|
+
*/
|
|
6072
|
+
var StyledHiddenWrapper = index$a(View)(function () {
|
|
6073
|
+
return {
|
|
6074
|
+
height: Dimensions.get('window').height
|
|
6075
|
+
};
|
|
6076
|
+
});
|
|
6077
|
+
var StyledChildWrapper = index$a(View)({
|
|
6078
|
+
margin: 0,
|
|
6079
|
+
padding: 0
|
|
6080
|
+
});
|
|
6081
|
+
|
|
6082
|
+
if (Platform.OS === 'android') {
|
|
6083
|
+
if (UIManager.setLayoutAnimationEnabledExperimental) {
|
|
6084
|
+
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
6085
|
+
}
|
|
6086
|
+
}
|
|
6075
6087
|
var Collapse = function Collapse(_ref) {
|
|
6076
6088
|
var _ref$open = _ref.open,
|
|
6077
6089
|
open = _ref$open === void 0 ? false : _ref$open,
|
|
6078
6090
|
children = _ref.children,
|
|
6079
6091
|
testID = _ref.testID,
|
|
6080
6092
|
style = _ref.style;
|
|
6081
|
-
var collapseAnim = React.useRef(new Animated.Value(0)).current;
|
|
6082
6093
|
var _React$useState = React.useState(0),
|
|
6083
6094
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6084
6095
|
contentHeight = _React$useState2[0],
|
|
@@ -6086,11 +6097,7 @@ var Collapse = function Collapse(_ref) {
|
|
|
6086
6097
|
var previousOpenState = usePrevious(open);
|
|
6087
6098
|
useEffect(function () {
|
|
6088
6099
|
if (open !== previousOpenState && previousOpenState !== undefined || open) {
|
|
6089
|
-
|
|
6090
|
-
toValue: open ? contentHeight : 0,
|
|
6091
|
-
easing: Easing.inOut(Easing.cubic),
|
|
6092
|
-
useNativeDriver: false
|
|
6093
|
-
}).start();
|
|
6100
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
6094
6101
|
}
|
|
6095
6102
|
}, [open, previousOpenState, contentHeight]);
|
|
6096
6103
|
var fetchMaxHeight = useCallback(function (_ref2) {
|
|
@@ -6099,7 +6106,7 @@ var Collapse = function Collapse(_ref) {
|
|
|
6099
6106
|
}, []);
|
|
6100
6107
|
return /*#__PURE__*/React.createElement(StyledWrapper$c, {
|
|
6101
6108
|
style: {
|
|
6102
|
-
height:
|
|
6109
|
+
height: open ? contentHeight : 0
|
|
6103
6110
|
},
|
|
6104
6111
|
testID: testID
|
|
6105
6112
|
}, /*#__PURE__*/React.createElement(StyledHiddenWrapper, null, /*#__PURE__*/React.createElement(StyledChildWrapper, {
|
|
@@ -11663,14 +11670,18 @@ var StyledLabel = index$a(Typography.Text)(function (_ref3) {
|
|
|
11663
11670
|
var theme = _ref3.theme,
|
|
11664
11671
|
themeState = _ref3.themeState;
|
|
11665
11672
|
return {
|
|
11666
|
-
color: theme.__hd__.textInput.colors.labels[themeState]
|
|
11673
|
+
color: theme.__hd__.textInput.colors.labels[themeState],
|
|
11674
|
+
fontSize: theme.__hd__.textInput.fontSizes.topLabel,
|
|
11675
|
+
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
11667
11676
|
};
|
|
11668
11677
|
});
|
|
11669
11678
|
var StyledAsteriskLabel = index$a(Typography.Text)(function (_ref4) {
|
|
11670
11679
|
var theme = _ref4.theme,
|
|
11671
11680
|
themeState = _ref4.themeState;
|
|
11672
11681
|
return {
|
|
11673
|
-
color: theme.__hd__.textInput.colors.asterisks[themeState]
|
|
11682
|
+
color: theme.__hd__.textInput.colors.asterisks[themeState],
|
|
11683
|
+
fontSize: theme.__hd__.textInput.fontSizes.topLabel,
|
|
11684
|
+
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
11674
11685
|
};
|
|
11675
11686
|
});
|
|
11676
11687
|
var StyledLabelContainerInsideTextInput = index$a(View)(function (_ref5) {
|
|
@@ -11978,12 +11989,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
11978
11989
|
backgroundColor: backgroundColor
|
|
11979
11990
|
}
|
|
11980
11991
|
}, required && /*#__PURE__*/React.createElement(StyledAsteriskLabel, {
|
|
11981
|
-
themeState: state
|
|
11982
|
-
fontSize: "small"
|
|
11992
|
+
themeState: state
|
|
11983
11993
|
}, "*"), !!label && /*#__PURE__*/React.createElement(StyledLabel, {
|
|
11984
11994
|
nativeID: accessibilityLabelledBy,
|
|
11985
11995
|
testID: "input-label",
|
|
11986
|
-
fontSize: "small",
|
|
11987
11996
|
themeState: state,
|
|
11988
11997
|
style: {
|
|
11989
11998
|
backgroundColor: backgroundColor
|
|
@@ -12863,12 +12872,15 @@ var StyledFAB$1 = index$a(TouchableHighlight)(function (_ref) {
|
|
|
12863
12872
|
borderRadius: theme.radii.rounded,
|
|
12864
12873
|
alignItems: 'center',
|
|
12865
12874
|
justifyContent: 'center',
|
|
12866
|
-
overflow: 'hidden',
|
|
12867
12875
|
alignSelf: 'flex-start',
|
|
12868
12876
|
paddingHorizontal: theme.__hd__.fab.space.containerPaddingHorizontal,
|
|
12869
12877
|
paddingVertical: theme.__hd__.fab.space.containerPaddingVertical,
|
|
12870
12878
|
flexDirection: 'row',
|
|
12871
|
-
elevation: theme.__hd__.fab.shadows.elevation
|
|
12879
|
+
elevation: theme.__hd__.fab.shadows.elevation,
|
|
12880
|
+
shadowColor: theme.__hd__.fab.colors.shadow,
|
|
12881
|
+
shadowOffset: theme.__hd__.fab.shadows.offset,
|
|
12882
|
+
shadowRadius: theme.__hd__.fab.shadows.radius,
|
|
12883
|
+
shadowOpacity: theme.__hd__.fab.shadows.opacity
|
|
12872
12884
|
};
|
|
12873
12885
|
});
|
|
12874
12886
|
var StyledFABIcon = index$a(Icon)(function (_ref2) {
|
|
@@ -12892,15 +12904,6 @@ var StyledFABText = index$a(Typography.Text)(function (_ref3) {
|
|
|
12892
12904
|
marginHorizontal: theme.__hd__.fab.space.titleMarginHorizontal
|
|
12893
12905
|
};
|
|
12894
12906
|
});
|
|
12895
|
-
var StyledFABContainer = index$a(Box)(function (_ref4) {
|
|
12896
|
-
var theme = _ref4.theme;
|
|
12897
|
-
return {
|
|
12898
|
-
shadowColor: theme.__hd__.fab.colors.shadow,
|
|
12899
|
-
shadowOffset: theme.__hd__.fab.shadows.offset,
|
|
12900
|
-
shadowRadius: theme.__hd__.fab.shadows.radius,
|
|
12901
|
-
shadowOpacity: theme.__hd__.fab.shadows.opacity
|
|
12902
|
-
};
|
|
12903
|
-
});
|
|
12904
12907
|
|
|
12905
12908
|
var _excluded$b = ["active"];
|
|
12906
12909
|
var AnimatedIcons = Animated.createAnimatedComponent(StyledFABIcon);
|
|
@@ -12966,12 +12969,11 @@ var FAB = function FAB(_ref3) {
|
|
|
12966
12969
|
style = _ref3.style;
|
|
12967
12970
|
var isIconOnly = !title;
|
|
12968
12971
|
var theme = useTheme();
|
|
12969
|
-
return /*#__PURE__*/React.createElement(
|
|
12972
|
+
return /*#__PURE__*/React.createElement(StyledFAB$1, {
|
|
12973
|
+
underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
|
|
12974
|
+
onPress: onPress,
|
|
12970
12975
|
style: style,
|
|
12971
12976
|
testID: testID
|
|
12972
|
-
}, /*#__PURE__*/React.createElement(StyledFAB$1, {
|
|
12973
|
-
underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
|
|
12974
|
-
onPress: onPress
|
|
12975
12977
|
}, isIconOnly ? /*#__PURE__*/React.createElement(IconOnlyContent, {
|
|
12976
12978
|
animated: animated,
|
|
12977
12979
|
active: active,
|
|
@@ -12979,7 +12981,7 @@ var FAB = function FAB(_ref3) {
|
|
|
12979
12981
|
}) : /*#__PURE__*/React.createElement(IconWithTextContent, {
|
|
12980
12982
|
icon: icon,
|
|
12981
12983
|
title: title
|
|
12982
|
-
}))
|
|
12984
|
+
}));
|
|
12983
12985
|
};
|
|
12984
12986
|
|
|
12985
12987
|
var StyledActionItem = index$a(TouchableHighlight)(function (_ref) {
|
|
@@ -13477,7 +13479,7 @@ function getState(_ref) {
|
|
|
13477
13479
|
}
|
|
13478
13480
|
return 'default';
|
|
13479
13481
|
}
|
|
13480
|
-
|
|
13482
|
+
var PinInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
13481
13483
|
var _ref2$value = _ref2.value,
|
|
13482
13484
|
value = _ref2$value === void 0 ? '' : _ref2$value,
|
|
13483
13485
|
onChangeText = _ref2.onChangeText,
|
|
@@ -13516,19 +13518,23 @@ function PinInput(_ref2) {
|
|
|
13516
13518
|
}, []);
|
|
13517
13519
|
var changeText = useCallback(function (text) {
|
|
13518
13520
|
var pin = (text.match(/[0-9]/g) || []).join('');
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
if (pin.length === length && onFulfill) {
|
|
13523
|
-
onFulfill(pin);
|
|
13521
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(pin);
|
|
13522
|
+
if (pin.length === length) {
|
|
13523
|
+
onFulfill === null || onFulfill === void 0 ? void 0 : onFulfill(pin);
|
|
13524
13524
|
}
|
|
13525
|
-
}, []);
|
|
13525
|
+
}, [length, onChangeText, onFulfill]);
|
|
13526
13526
|
useEffect(function () {
|
|
13527
13527
|
// Must run after animations for keyboard to automatically open
|
|
13528
13528
|
if (autoFocus) {
|
|
13529
13529
|
InteractionManager.runAfterInteractions(focus);
|
|
13530
13530
|
}
|
|
13531
13531
|
}, [inputRef]);
|
|
13532
|
+
useImperativeHandle(ref, function () {
|
|
13533
|
+
return {
|
|
13534
|
+
focus: focus,
|
|
13535
|
+
blur: blur
|
|
13536
|
+
};
|
|
13537
|
+
});
|
|
13532
13538
|
return /*#__PURE__*/React.createElement(StyledWrapper$4, {
|
|
13533
13539
|
style: style,
|
|
13534
13540
|
testID: testID
|
|
@@ -13563,7 +13569,7 @@ function PinInput(_ref2) {
|
|
|
13563
13569
|
pointerEvents: "box-only",
|
|
13564
13570
|
testID: "pin-hidden-input"
|
|
13565
13571
|
}));
|
|
13566
|
-
}
|
|
13572
|
+
});
|
|
13567
13573
|
|
|
13568
13574
|
var THEME_INTENT_MAP = {
|
|
13569
13575
|
primary: 'primary',
|
package/lib/index.js
CHANGED
|
@@ -1101,7 +1101,9 @@ var palette$b = {
|
|
|
1101
1101
|
yellow: yellow$1.base,
|
|
1102
1102
|
yellowDark15: yellow$1.darken15,
|
|
1103
1103
|
yellowDark75: yellow$1.darken75,
|
|
1104
|
+
yellowLight45: yellow$1.lighten45,
|
|
1104
1105
|
yellowLight60: yellow$1.lighten60,
|
|
1106
|
+
yellowLight75: yellow$1.lighten75,
|
|
1105
1107
|
yellowLight90: yellow$1.lighten90
|
|
1106
1108
|
};
|
|
1107
1109
|
var mauve$4 = colorScales.mauve,
|
|
@@ -2959,7 +2961,7 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2959
2961
|
var space = {
|
|
2960
2962
|
containerPadding: theme.space.medium,
|
|
2961
2963
|
labelLeft: theme.space.medium,
|
|
2962
|
-
labelTop: theme.lineHeights.small / -
|
|
2964
|
+
labelTop: theme.lineHeights.small / -4,
|
|
2963
2965
|
labelPaddingBottom: theme.space.small,
|
|
2964
2966
|
labelHorizontalPadding: theme.space.xsmall,
|
|
2965
2967
|
inputHorizontalMargin: theme.space.small,
|
|
@@ -2978,7 +2980,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2978
2980
|
labelInsideTextInput: theme.fontSizes.large,
|
|
2979
2981
|
error: theme.fontSizes.small,
|
|
2980
2982
|
maxLength: theme.fontSizes.small,
|
|
2981
|
-
asteriskLabel: theme.fontSizes.large
|
|
2983
|
+
asteriskLabel: theme.fontSizes.large,
|
|
2984
|
+
topLabel: theme.fontSizes.small
|
|
2982
2985
|
};
|
|
2983
2986
|
var borderWidths = {
|
|
2984
2987
|
container: {
|
|
@@ -2994,6 +2997,9 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2994
2997
|
textareaHeight: theme.sizes['15xlarge'],
|
|
2995
2998
|
textInputMaxHeight: theme.sizes['15xlarge']
|
|
2996
2999
|
};
|
|
3000
|
+
var lineHeights = {
|
|
3001
|
+
topLabel: theme.lineHeights.large / 2
|
|
3002
|
+
};
|
|
2997
3003
|
return {
|
|
2998
3004
|
colors: colors,
|
|
2999
3005
|
space: space,
|
|
@@ -3001,7 +3007,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
3001
3007
|
fontSizes: fontSizes,
|
|
3002
3008
|
borderWidths: borderWidths,
|
|
3003
3009
|
radii: radii,
|
|
3004
|
-
sizes: sizes
|
|
3010
|
+
sizes: sizes,
|
|
3011
|
+
lineHeights: lineHeights
|
|
3005
3012
|
};
|
|
3006
3013
|
};
|
|
3007
3014
|
|
|
@@ -6057,26 +6064,6 @@ var index$a = components.reduce(function (acc, comp) {
|
|
|
6057
6064
|
});
|
|
6058
6065
|
}, styled);
|
|
6059
6066
|
|
|
6060
|
-
var StyledWrapper$c = index$a(reactNative.Animated.View)({
|
|
6061
|
-
margin: 0,
|
|
6062
|
-
padding: 0,
|
|
6063
|
-
overflow: 'hidden'
|
|
6064
|
-
});
|
|
6065
|
-
/**
|
|
6066
|
-
* Height need to be high enough to cover most scenario
|
|
6067
|
-
* This container's purpose is only to help get correct children height and returns it
|
|
6068
|
-
* to use with Animated.timing
|
|
6069
|
-
*/
|
|
6070
|
-
var StyledHiddenWrapper = index$a(reactNative.View)(function () {
|
|
6071
|
-
return {
|
|
6072
|
-
height: reactNative.Dimensions.get('window').height
|
|
6073
|
-
};
|
|
6074
|
-
});
|
|
6075
|
-
var StyledChildWrapper = index$a(reactNative.View)({
|
|
6076
|
-
margin: 0,
|
|
6077
|
-
padding: 0
|
|
6078
|
-
});
|
|
6079
|
-
|
|
6080
6067
|
// Get previous state value
|
|
6081
6068
|
var usePrevious = function usePrevious(value) {
|
|
6082
6069
|
var ref = React__default["default"].useRef();
|
|
@@ -6102,13 +6089,37 @@ var useDeprecation = function useDeprecation(message) {
|
|
|
6102
6089
|
}, [message, cond]);
|
|
6103
6090
|
};
|
|
6104
6091
|
|
|
6092
|
+
var StyledWrapper$c = index$a(reactNative.Animated.View)({
|
|
6093
|
+
margin: 0,
|
|
6094
|
+
padding: 0,
|
|
6095
|
+
overflow: 'hidden'
|
|
6096
|
+
});
|
|
6097
|
+
/**
|
|
6098
|
+
* Height need to be high enough to cover most scenario
|
|
6099
|
+
* This container's purpose is only to help get correct children height and returns it
|
|
6100
|
+
* to use with Animated.timing
|
|
6101
|
+
*/
|
|
6102
|
+
var StyledHiddenWrapper = index$a(reactNative.View)(function () {
|
|
6103
|
+
return {
|
|
6104
|
+
height: reactNative.Dimensions.get('window').height
|
|
6105
|
+
};
|
|
6106
|
+
});
|
|
6107
|
+
var StyledChildWrapper = index$a(reactNative.View)({
|
|
6108
|
+
margin: 0,
|
|
6109
|
+
padding: 0
|
|
6110
|
+
});
|
|
6111
|
+
|
|
6112
|
+
if (reactNative.Platform.OS === 'android') {
|
|
6113
|
+
if (reactNative.UIManager.setLayoutAnimationEnabledExperimental) {
|
|
6114
|
+
reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
6115
|
+
}
|
|
6116
|
+
}
|
|
6105
6117
|
var Collapse = function Collapse(_ref) {
|
|
6106
6118
|
var _ref$open = _ref.open,
|
|
6107
6119
|
open = _ref$open === void 0 ? false : _ref$open,
|
|
6108
6120
|
children = _ref.children,
|
|
6109
6121
|
testID = _ref.testID,
|
|
6110
6122
|
style = _ref.style;
|
|
6111
|
-
var collapseAnim = React__default["default"].useRef(new reactNative.Animated.Value(0)).current;
|
|
6112
6123
|
var _React$useState = React__default["default"].useState(0),
|
|
6113
6124
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6114
6125
|
contentHeight = _React$useState2[0],
|
|
@@ -6116,11 +6127,7 @@ var Collapse = function Collapse(_ref) {
|
|
|
6116
6127
|
var previousOpenState = usePrevious(open);
|
|
6117
6128
|
React.useEffect(function () {
|
|
6118
6129
|
if (open !== previousOpenState && previousOpenState !== undefined || open) {
|
|
6119
|
-
reactNative.
|
|
6120
|
-
toValue: open ? contentHeight : 0,
|
|
6121
|
-
easing: reactNative.Easing.inOut(reactNative.Easing.cubic),
|
|
6122
|
-
useNativeDriver: false
|
|
6123
|
-
}).start();
|
|
6130
|
+
reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut);
|
|
6124
6131
|
}
|
|
6125
6132
|
}, [open, previousOpenState, contentHeight]);
|
|
6126
6133
|
var fetchMaxHeight = React.useCallback(function (_ref2) {
|
|
@@ -6129,7 +6136,7 @@ var Collapse = function Collapse(_ref) {
|
|
|
6129
6136
|
}, []);
|
|
6130
6137
|
return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$c, {
|
|
6131
6138
|
style: {
|
|
6132
|
-
height:
|
|
6139
|
+
height: open ? contentHeight : 0
|
|
6133
6140
|
},
|
|
6134
6141
|
testID: testID
|
|
6135
6142
|
}, /*#__PURE__*/React__default["default"].createElement(StyledHiddenWrapper, null, /*#__PURE__*/React__default["default"].createElement(StyledChildWrapper, {
|
|
@@ -11693,14 +11700,18 @@ var StyledLabel = index$a(Typography.Text)(function (_ref3) {
|
|
|
11693
11700
|
var theme = _ref3.theme,
|
|
11694
11701
|
themeState = _ref3.themeState;
|
|
11695
11702
|
return {
|
|
11696
|
-
color: theme.__hd__.textInput.colors.labels[themeState]
|
|
11703
|
+
color: theme.__hd__.textInput.colors.labels[themeState],
|
|
11704
|
+
fontSize: theme.__hd__.textInput.fontSizes.topLabel,
|
|
11705
|
+
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
11697
11706
|
};
|
|
11698
11707
|
});
|
|
11699
11708
|
var StyledAsteriskLabel = index$a(Typography.Text)(function (_ref4) {
|
|
11700
11709
|
var theme = _ref4.theme,
|
|
11701
11710
|
themeState = _ref4.themeState;
|
|
11702
11711
|
return {
|
|
11703
|
-
color: theme.__hd__.textInput.colors.asterisks[themeState]
|
|
11712
|
+
color: theme.__hd__.textInput.colors.asterisks[themeState],
|
|
11713
|
+
fontSize: theme.__hd__.textInput.fontSizes.topLabel,
|
|
11714
|
+
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
11704
11715
|
};
|
|
11705
11716
|
});
|
|
11706
11717
|
var StyledLabelContainerInsideTextInput = index$a(reactNative.View)(function (_ref5) {
|
|
@@ -12008,12 +12019,10 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
12008
12019
|
backgroundColor: backgroundColor
|
|
12009
12020
|
}
|
|
12010
12021
|
}, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabel, {
|
|
12011
|
-
themeState: state
|
|
12012
|
-
fontSize: "small"
|
|
12022
|
+
themeState: state
|
|
12013
12023
|
}, "*"), !!label && /*#__PURE__*/React__default["default"].createElement(StyledLabel, {
|
|
12014
12024
|
nativeID: accessibilityLabelledBy,
|
|
12015
12025
|
testID: "input-label",
|
|
12016
|
-
fontSize: "small",
|
|
12017
12026
|
themeState: state,
|
|
12018
12027
|
style: {
|
|
12019
12028
|
backgroundColor: backgroundColor
|
|
@@ -12893,12 +12902,15 @@ var StyledFAB$1 = index$a(reactNative.TouchableHighlight)(function (_ref) {
|
|
|
12893
12902
|
borderRadius: theme.radii.rounded,
|
|
12894
12903
|
alignItems: 'center',
|
|
12895
12904
|
justifyContent: 'center',
|
|
12896
|
-
overflow: 'hidden',
|
|
12897
12905
|
alignSelf: 'flex-start',
|
|
12898
12906
|
paddingHorizontal: theme.__hd__.fab.space.containerPaddingHorizontal,
|
|
12899
12907
|
paddingVertical: theme.__hd__.fab.space.containerPaddingVertical,
|
|
12900
12908
|
flexDirection: 'row',
|
|
12901
|
-
elevation: theme.__hd__.fab.shadows.elevation
|
|
12909
|
+
elevation: theme.__hd__.fab.shadows.elevation,
|
|
12910
|
+
shadowColor: theme.__hd__.fab.colors.shadow,
|
|
12911
|
+
shadowOffset: theme.__hd__.fab.shadows.offset,
|
|
12912
|
+
shadowRadius: theme.__hd__.fab.shadows.radius,
|
|
12913
|
+
shadowOpacity: theme.__hd__.fab.shadows.opacity
|
|
12902
12914
|
};
|
|
12903
12915
|
});
|
|
12904
12916
|
var StyledFABIcon = index$a(Icon)(function (_ref2) {
|
|
@@ -12922,15 +12934,6 @@ var StyledFABText = index$a(Typography.Text)(function (_ref3) {
|
|
|
12922
12934
|
marginHorizontal: theme.__hd__.fab.space.titleMarginHorizontal
|
|
12923
12935
|
};
|
|
12924
12936
|
});
|
|
12925
|
-
var StyledFABContainer = index$a(Box)(function (_ref4) {
|
|
12926
|
-
var theme = _ref4.theme;
|
|
12927
|
-
return {
|
|
12928
|
-
shadowColor: theme.__hd__.fab.colors.shadow,
|
|
12929
|
-
shadowOffset: theme.__hd__.fab.shadows.offset,
|
|
12930
|
-
shadowRadius: theme.__hd__.fab.shadows.radius,
|
|
12931
|
-
shadowOpacity: theme.__hd__.fab.shadows.opacity
|
|
12932
|
-
};
|
|
12933
|
-
});
|
|
12934
12937
|
|
|
12935
12938
|
var _excluded$b = ["active"];
|
|
12936
12939
|
var AnimatedIcons = reactNative.Animated.createAnimatedComponent(StyledFABIcon);
|
|
@@ -12996,12 +12999,11 @@ var FAB = function FAB(_ref3) {
|
|
|
12996
12999
|
style = _ref3.style;
|
|
12997
13000
|
var isIconOnly = !title;
|
|
12998
13001
|
var theme = useTheme();
|
|
12999
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
13002
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledFAB$1, {
|
|
13003
|
+
underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
|
|
13004
|
+
onPress: onPress,
|
|
13000
13005
|
style: style,
|
|
13001
13006
|
testID: testID
|
|
13002
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledFAB$1, {
|
|
13003
|
-
underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
|
|
13004
|
-
onPress: onPress
|
|
13005
13007
|
}, isIconOnly ? /*#__PURE__*/React__default["default"].createElement(IconOnlyContent, {
|
|
13006
13008
|
animated: animated,
|
|
13007
13009
|
active: active,
|
|
@@ -13009,7 +13011,7 @@ var FAB = function FAB(_ref3) {
|
|
|
13009
13011
|
}) : /*#__PURE__*/React__default["default"].createElement(IconWithTextContent, {
|
|
13010
13012
|
icon: icon,
|
|
13011
13013
|
title: title
|
|
13012
|
-
}))
|
|
13014
|
+
}));
|
|
13013
13015
|
};
|
|
13014
13016
|
|
|
13015
13017
|
var StyledActionItem = index$a(reactNative.TouchableHighlight)(function (_ref) {
|
|
@@ -13507,7 +13509,7 @@ function getState(_ref) {
|
|
|
13507
13509
|
}
|
|
13508
13510
|
return 'default';
|
|
13509
13511
|
}
|
|
13510
|
-
|
|
13512
|
+
var PinInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
13511
13513
|
var _ref2$value = _ref2.value,
|
|
13512
13514
|
value = _ref2$value === void 0 ? '' : _ref2$value,
|
|
13513
13515
|
onChangeText = _ref2.onChangeText,
|
|
@@ -13546,19 +13548,23 @@ function PinInput(_ref2) {
|
|
|
13546
13548
|
}, []);
|
|
13547
13549
|
var changeText = React.useCallback(function (text) {
|
|
13548
13550
|
var pin = (text.match(/[0-9]/g) || []).join('');
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
if (pin.length === length && onFulfill) {
|
|
13553
|
-
onFulfill(pin);
|
|
13551
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(pin);
|
|
13552
|
+
if (pin.length === length) {
|
|
13553
|
+
onFulfill === null || onFulfill === void 0 ? void 0 : onFulfill(pin);
|
|
13554
13554
|
}
|
|
13555
|
-
}, []);
|
|
13555
|
+
}, [length, onChangeText, onFulfill]);
|
|
13556
13556
|
React.useEffect(function () {
|
|
13557
13557
|
// Must run after animations for keyboard to automatically open
|
|
13558
13558
|
if (autoFocus) {
|
|
13559
13559
|
reactNative.InteractionManager.runAfterInteractions(focus);
|
|
13560
13560
|
}
|
|
13561
13561
|
}, [inputRef]);
|
|
13562
|
+
React.useImperativeHandle(ref, function () {
|
|
13563
|
+
return {
|
|
13564
|
+
focus: focus,
|
|
13565
|
+
blur: blur
|
|
13566
|
+
};
|
|
13567
|
+
});
|
|
13562
13568
|
return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$4, {
|
|
13563
13569
|
style: style,
|
|
13564
13570
|
testID: testID
|
|
@@ -13593,7 +13599,7 @@ function PinInput(_ref2) {
|
|
|
13593
13599
|
pointerEvents: "box-only",
|
|
13594
13600
|
testID: "pin-hidden-input"
|
|
13595
13601
|
}));
|
|
13596
|
-
}
|
|
13602
|
+
});
|
|
13597
13603
|
|
|
13598
13604
|
var THEME_INTENT_MAP = {
|
|
13599
13605
|
primary: 'primary',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.25.
|
|
3
|
+
"version": "8.25.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.25.
|
|
24
|
+
"@hero-design/colors": "8.25.2",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/preset-typescript": "^7.17.12",
|
|
46
46
|
"@babel/runtime": "^7.18.9",
|
|
47
47
|
"@emotion/jest": "^11.9.3",
|
|
48
|
-
"@hero-design/eslint-plugin": "8.25.
|
|
48
|
+
"@hero-design/eslint-plugin": "8.25.2",
|
|
49
49
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
50
50
|
"@react-native-community/slider": "4.1.12",
|
|
51
51
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@types/react-native": "^0.67.7",
|
|
62
62
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
63
63
|
"babel-plugin-inline-import": "^3.0.0",
|
|
64
|
-
"eslint-config-hd": "8.25.
|
|
64
|
+
"eslint-config-hd": "8.25.2",
|
|
65
65
|
"jest": "^27.3.1",
|
|
66
|
-
"prettier-config-hd": "8.25.
|
|
66
|
+
"prettier-config-hd": "8.25.2",
|
|
67
67
|
"react": "18.0.0",
|
|
68
68
|
"react-native": "0.69.7",
|
|
69
69
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
import React, { useCallback, useEffect } from 'react';
|
|
3
3
|
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
4
|
-
import
|
|
4
|
+
import { LayoutAnimation, Platform, UIManager } from 'react-native';
|
|
5
|
+
import { usePrevious } from '../../utils/hooks';
|
|
5
6
|
import {
|
|
6
7
|
StyledChildWrapper,
|
|
7
8
|
StyledHiddenWrapper,
|
|
8
9
|
StyledWrapper,
|
|
9
10
|
} from './StyledCollapse';
|
|
10
|
-
import { usePrevious } from '../../utils/hooks';
|
|
11
11
|
|
|
12
12
|
export interface CollapseProps extends ViewProps {
|
|
13
13
|
/*
|
|
@@ -28,8 +28,13 @@ export interface CollapseProps extends ViewProps {
|
|
|
28
28
|
testID?: string;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
if (Platform.OS === 'android') {
|
|
32
|
+
if (UIManager.setLayoutAnimationEnabledExperimental) {
|
|
33
|
+
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
31
37
|
const Collapse = ({ open = false, children, testID, style }: CollapseProps) => {
|
|
32
|
-
const collapseAnim = React.useRef(new Animated.Value(0)).current;
|
|
33
38
|
const [contentHeight, setContentHeight] = React.useState<number>(0);
|
|
34
39
|
|
|
35
40
|
const previousOpenState = usePrevious(open);
|
|
@@ -39,11 +44,7 @@ const Collapse = ({ open = false, children, testID, style }: CollapseProps) => {
|
|
|
39
44
|
(open !== previousOpenState && previousOpenState !== undefined) ||
|
|
40
45
|
open
|
|
41
46
|
) {
|
|
42
|
-
|
|
43
|
-
toValue: open ? contentHeight : 0,
|
|
44
|
-
easing: Easing.inOut(Easing.cubic),
|
|
45
|
-
useNativeDriver: false,
|
|
46
|
-
}).start();
|
|
47
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
47
48
|
}
|
|
48
49
|
}, [open, previousOpenState, contentHeight]);
|
|
49
50
|
|
|
@@ -54,7 +55,7 @@ const Collapse = ({ open = false, children, testID, style }: CollapseProps) => {
|
|
|
54
55
|
return (
|
|
55
56
|
<StyledWrapper
|
|
56
57
|
style={{
|
|
57
|
-
height:
|
|
58
|
+
height: open ? contentHeight : 0,
|
|
58
59
|
}}
|
|
59
60
|
testID={testID}
|
|
60
61
|
>
|