@hero-design/rn 8.27.1 → 8.27.3
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 +44 -76
- package/lib/index.js +44 -76
- package/package.json +5 -5
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +4 -0
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +6 -6
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
- package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Collapse/index.tsx +25 -4
- package/src/components/DatePicker/DatePickerIOS.tsx +19 -1
- package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +25 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +9 -9
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +3 -3
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +3 -3
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +3 -3
- package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +3 -17
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +1065 -557
- package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +15 -9
- package/src/components/FAB/ActionGroup/index.tsx +35 -97
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +2 -2
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +3 -3
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +14 -14
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +14 -14
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +3 -3
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +1 -1
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +1 -1
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/Tag/StyledTag.tsx +1 -0
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +19 -10
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +1 -1
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +24 -24
- package/src/components/TextInput/index.tsx +1 -1
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +4 -4
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +4 -4
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +2 -2
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +10 -8
- package/src/theme/components/fab.ts +0 -1
- package/src/theme/components/tag.ts +5 -2
- package/src/theme/global/typography.ts +2 -2
- package/types/components/Collapse/index.d.ts +1 -1
- package/types/components/DatePicker/DatePickerIOS.d.ts +1 -0
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +1 -7
- package/types/theme/components/fab.d.ts +0 -1
- package/types/theme/components/tag.d.ts +3 -0
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 [1m28.8s[22m[39m
|
|
8
8
|
$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -1608,8 +1608,8 @@ var getLineHeights = function getLineHeights(fontSizes) {
|
|
|
1608
1608
|
xlarge: fontSizes.xlarge + additionalSpace,
|
|
1609
1609
|
large: fontSizes.large + additionalSpace,
|
|
1610
1610
|
medium: fontSizes.medium + additionalSpace,
|
|
1611
|
-
small: fontSizes.small + additionalSpace,
|
|
1612
|
-
xsmall: fontSizes.xsmall + additionalSpace
|
|
1611
|
+
small: fontSizes.small + additionalSpace / 2,
|
|
1612
|
+
xsmall: fontSizes.xsmall + additionalSpace / 2
|
|
1613
1613
|
};
|
|
1614
1614
|
};
|
|
1615
1615
|
|
|
@@ -2327,8 +2327,7 @@ var getFABTheme = function getFABTheme(theme) {
|
|
|
2327
2327
|
headerTextMarginRight: theme.space.large,
|
|
2328
2328
|
headerTextMarginBottom: theme.space.large,
|
|
2329
2329
|
containerPadding: theme.space.large - theme.space.xsmall,
|
|
2330
|
-
titleMarginHorizontal: theme.space.small
|
|
2331
|
-
internalFABMarginBottom: theme.space.large
|
|
2330
|
+
titleMarginHorizontal: theme.space.small
|
|
2332
2331
|
};
|
|
2333
2332
|
var radii = {
|
|
2334
2333
|
actionItem: theme.radii.rounded
|
|
@@ -2868,9 +2867,12 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2868
2867
|
var fontSizes = {
|
|
2869
2868
|
"default": theme.fontSizes.small
|
|
2870
2869
|
};
|
|
2870
|
+
var lineHeights = {
|
|
2871
|
+
"default": theme.lineHeights.small
|
|
2872
|
+
};
|
|
2871
2873
|
var space = {
|
|
2872
2874
|
horizontalPadding: theme.space.small,
|
|
2873
|
-
verticalPadding: theme.space.
|
|
2875
|
+
verticalPadding: theme.space.xsmall
|
|
2874
2876
|
};
|
|
2875
2877
|
var radii = {
|
|
2876
2878
|
"default": theme.radii.base
|
|
@@ -2881,7 +2883,8 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2881
2883
|
fonts: fonts,
|
|
2882
2884
|
fontSizes: fontSizes,
|
|
2883
2885
|
space: space,
|
|
2884
|
-
radii: radii
|
|
2886
|
+
radii: radii,
|
|
2887
|
+
lineHeights: lineHeights
|
|
2885
2888
|
};
|
|
2886
2889
|
};
|
|
2887
2890
|
|
|
@@ -6100,14 +6103,19 @@ var Collapse = function Collapse(_ref) {
|
|
|
6100
6103
|
open = _ref$open === void 0 ? false : _ref$open,
|
|
6101
6104
|
children = _ref.children,
|
|
6102
6105
|
testID = _ref.testID,
|
|
6103
|
-
style = _ref.style
|
|
6106
|
+
style = _ref.style,
|
|
6107
|
+
onLayout = _ref.onLayout;
|
|
6104
6108
|
var _React$useState = React.useState(0),
|
|
6105
6109
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6106
6110
|
contentHeight = _React$useState2[0],
|
|
6107
6111
|
setContentHeight = _React$useState2[1];
|
|
6112
|
+
var _React$useState3 = React.useState(false),
|
|
6113
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
6114
|
+
componentMounted = _React$useState4[0],
|
|
6115
|
+
setComponentMounted = _React$useState4[1];
|
|
6108
6116
|
var previousOpenState = usePrevious(open);
|
|
6109
6117
|
useEffect(function () {
|
|
6110
|
-
if (open !== previousOpenState && previousOpenState !== undefined || open) {
|
|
6118
|
+
if ((open !== previousOpenState && previousOpenState !== undefined || open) && componentMounted) {
|
|
6111
6119
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
6112
6120
|
}
|
|
6113
6121
|
}, [open, previousOpenState, contentHeight]);
|
|
@@ -6115,10 +6123,15 @@ var Collapse = function Collapse(_ref) {
|
|
|
6115
6123
|
var height = _ref2.height;
|
|
6116
6124
|
setContentHeight(height);
|
|
6117
6125
|
}, []);
|
|
6126
|
+
var onCollapseLayout = useCallback(function (e) {
|
|
6127
|
+
setComponentMounted(true);
|
|
6128
|
+
onLayout === null || onLayout === void 0 ? void 0 : onLayout(e);
|
|
6129
|
+
}, []);
|
|
6118
6130
|
return /*#__PURE__*/React.createElement(StyledWrapper$c, {
|
|
6119
6131
|
style: {
|
|
6120
6132
|
height: open ? contentHeight : 0
|
|
6121
6133
|
},
|
|
6134
|
+
onLayout: onCollapseLayout,
|
|
6122
6135
|
testID: testID
|
|
6123
6136
|
}, /*#__PURE__*/React.createElement(StyledHiddenWrapper, null, /*#__PURE__*/React.createElement(StyledChildWrapper, {
|
|
6124
6137
|
onLayout: function onLayout(event) {
|
|
@@ -12037,7 +12050,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
12037
12050
|
testID: "input-suffix",
|
|
12038
12051
|
icon: actualSuffix,
|
|
12039
12052
|
spin: actualSuffix === 'loading',
|
|
12040
|
-
size: "
|
|
12053
|
+
size: "medium"
|
|
12041
12054
|
}) : suffix), /*#__PURE__*/React.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React.createElement(Icon, {
|
|
12042
12055
|
testID: "input-error-icon",
|
|
12043
12056
|
icon: "circle-info",
|
|
@@ -12219,6 +12232,15 @@ var StyledPickerWrapper$1 = index$a(View)(function (_ref) {
|
|
|
12219
12232
|
};
|
|
12220
12233
|
});
|
|
12221
12234
|
|
|
12235
|
+
var getInitialDateValue = function getInitialDateValue(value, minDate, maxDate) {
|
|
12236
|
+
if (minDate && value < minDate) {
|
|
12237
|
+
return minDate;
|
|
12238
|
+
}
|
|
12239
|
+
if (maxDate && value > maxDate) {
|
|
12240
|
+
return maxDate;
|
|
12241
|
+
}
|
|
12242
|
+
return value;
|
|
12243
|
+
};
|
|
12222
12244
|
var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
12223
12245
|
var value = _ref.value,
|
|
12224
12246
|
minDate = _ref.minDate,
|
|
@@ -12236,7 +12258,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
12236
12258
|
helpText = _ref.helpText,
|
|
12237
12259
|
style = _ref.style,
|
|
12238
12260
|
testID = _ref.testID;
|
|
12239
|
-
var _useState = useState(value || new Date()),
|
|
12261
|
+
var _useState = useState(getInitialDateValue(value || new Date(), minDate, maxDate)),
|
|
12240
12262
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12241
12263
|
selectingDate = _useState2[0],
|
|
12242
12264
|
setSelectingDate = _useState2[1];
|
|
@@ -13085,11 +13107,10 @@ var StyledBackdrop = index$a(Animated.View)(function (_ref2) {
|
|
|
13085
13107
|
var theme = _ref2.theme;
|
|
13086
13108
|
return {
|
|
13087
13109
|
position: 'absolute',
|
|
13088
|
-
|
|
13089
|
-
height: '100%',
|
|
13090
|
-
width: '100%',
|
|
13091
|
-
bottom: 0,
|
|
13110
|
+
left: 0,
|
|
13092
13111
|
right: 0,
|
|
13112
|
+
top: 0,
|
|
13113
|
+
bottom: 0,
|
|
13093
13114
|
backgroundColor: theme.__hd__.fab.colors.backdropBackground
|
|
13094
13115
|
};
|
|
13095
13116
|
});
|
|
@@ -13105,17 +13126,6 @@ var StyledHeaderText = index$a(Typography.Text)(function (_ref3) {
|
|
|
13105
13126
|
textAlign: 'right'
|
|
13106
13127
|
};
|
|
13107
13128
|
});
|
|
13108
|
-
var StyledModalView = index$a(View)({
|
|
13109
|
-
position: 'absolute',
|
|
13110
|
-
flex: 1,
|
|
13111
|
-
height: '100%',
|
|
13112
|
-
width: '100%',
|
|
13113
|
-
bottom: 0,
|
|
13114
|
-
right: 0,
|
|
13115
|
-
justifyContent: 'flex-end',
|
|
13116
|
-
alignItems: 'flex-end',
|
|
13117
|
-
backgroundColor: 'transparent'
|
|
13118
|
-
});
|
|
13119
13129
|
|
|
13120
13130
|
var ActionItemsListComponent = function ActionItemsListComponent(_ref) {
|
|
13121
13131
|
var style = _ref.style,
|
|
@@ -13138,43 +13148,15 @@ var ActionGroup = function ActionGroup(_ref2) {
|
|
|
13138
13148
|
fabTitle = _ref2.fabTitle,
|
|
13139
13149
|
_ref2$fabIcon = _ref2.fabIcon,
|
|
13140
13150
|
fabIcon = _ref2$fabIcon === void 0 ? 'add' : _ref2$fabIcon;
|
|
13141
|
-
var theme = useTheme();
|
|
13142
|
-
// Internal state to control the animation of the action group
|
|
13143
|
-
var _useState = useState(active),
|
|
13144
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
13145
|
-
visible = _useState2[0],
|
|
13146
|
-
setVisibility = _useState2[1];
|
|
13147
13151
|
var tranlateXAnimation = useRef(new Animated.Value(active ? 1 : 0));
|
|
13148
13152
|
useEffect(function () {
|
|
13149
|
-
if (active && !visible) {
|
|
13150
|
-
setVisibility(true);
|
|
13151
|
-
}
|
|
13152
|
-
}, [active]);
|
|
13153
|
-
useEffect(function () {
|
|
13154
|
-
if (active) {
|
|
13155
|
-
var animation = Animated.timing(tranlateXAnimation.current, {
|
|
13156
|
-
toValue: 1,
|
|
13157
|
-
useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
|
|
13158
|
-
easing: Easing.inOut(Easing.cubic)
|
|
13159
|
-
});
|
|
13160
|
-
animation.start();
|
|
13161
|
-
}
|
|
13162
|
-
}, [active]);
|
|
13163
|
-
// Make sure the animation finishes running before closing the modal
|
|
13164
|
-
var onInternalFABPress = useCallback(function () {
|
|
13165
|
-
if (!onPress) {
|
|
13166
|
-
return;
|
|
13167
|
-
}
|
|
13168
13153
|
var animation = Animated.timing(tranlateXAnimation.current, {
|
|
13169
|
-
toValue: 0,
|
|
13154
|
+
toValue: active ? 1 : 0,
|
|
13170
13155
|
useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
|
|
13171
13156
|
easing: Easing.inOut(Easing.cubic)
|
|
13172
13157
|
});
|
|
13173
|
-
animation.start(
|
|
13174
|
-
|
|
13175
|
-
onPress();
|
|
13176
|
-
});
|
|
13177
|
-
}, [visible]);
|
|
13158
|
+
animation.start();
|
|
13159
|
+
}, [active]);
|
|
13178
13160
|
var interpolatedTranlateXAnimation = tranlateXAnimation.current.interpolate({
|
|
13179
13161
|
inputRange: [0, 1],
|
|
13180
13162
|
outputRange: [400, 0]
|
|
@@ -13191,18 +13173,13 @@ var ActionGroup = function ActionGroup(_ref2) {
|
|
|
13191
13173
|
testID: testID,
|
|
13192
13174
|
pointerEvents: "box-none",
|
|
13193
13175
|
style: style
|
|
13194
|
-
}, /*#__PURE__*/React.createElement(Modal, {
|
|
13195
|
-
visible: visible,
|
|
13196
|
-
transparent: true,
|
|
13197
|
-
statusBarTranslucent: true,
|
|
13198
|
-
animationType: "none"
|
|
13199
13176
|
}, /*#__PURE__*/React.createElement(StyledBackdrop, {
|
|
13177
|
+
pointerEvents: active ? 'auto' : 'box-none',
|
|
13178
|
+
testID: "back-drop",
|
|
13200
13179
|
style: {
|
|
13201
13180
|
opacity: interpolatedBackdropOpacityAnimation
|
|
13202
|
-
}
|
|
13203
|
-
|
|
13204
|
-
pointerEvents: active ? 'auto' : 'box-none'
|
|
13205
|
-
}), /*#__PURE__*/React.createElement(StyledModalView, null, /*#__PURE__*/React.createElement(StyledActionGroupContainer, {
|
|
13181
|
+
}
|
|
13182
|
+
}), /*#__PURE__*/React.createElement(StyledActionGroupContainer, {
|
|
13206
13183
|
pointerEvents: active ? 'auto' : 'none',
|
|
13207
13184
|
testID: "action-group",
|
|
13208
13185
|
style: {
|
|
@@ -13215,17 +13192,7 @@ var ActionGroup = function ActionGroup(_ref2) {
|
|
|
13215
13192
|
testID: "header-text"
|
|
13216
13193
|
}, headerTitle), /*#__PURE__*/React.createElement(ActionItemsListComponent, {
|
|
13217
13194
|
items: items
|
|
13218
|
-
})),
|
|
13219
|
-
testID: "fab",
|
|
13220
|
-
icon: fabIcon,
|
|
13221
|
-
onPress: onInternalFABPress,
|
|
13222
|
-
animated: true,
|
|
13223
|
-
active: active,
|
|
13224
|
-
title: fabTitle,
|
|
13225
|
-
style: {
|
|
13226
|
-
marginBottom: theme.__hd__.fab.space.internalFABMarginBottom
|
|
13227
|
-
}
|
|
13228
|
-
}))), !active && /*#__PURE__*/React.createElement(StyledFAB, {
|
|
13195
|
+
})), /*#__PURE__*/React.createElement(StyledFAB, {
|
|
13229
13196
|
testID: "fab",
|
|
13230
13197
|
icon: fabIcon,
|
|
13231
13198
|
onPress: onPress,
|
|
@@ -15976,6 +15943,7 @@ var StyledText = index$a(Typography.Text)(function (_ref3) {
|
|
|
15976
15943
|
return {
|
|
15977
15944
|
fontFamily: theme.__hd__.tag.fonts["default"],
|
|
15978
15945
|
fontSize: theme.__hd__.tag.fontSizes["default"],
|
|
15946
|
+
lineHeight: theme.__hd__.tag.lineHeights["default"],
|
|
15979
15947
|
color: textColor,
|
|
15980
15948
|
includeFontPadding: false,
|
|
15981
15949
|
textAlignVertical: 'center',
|
package/lib/index.js
CHANGED
|
@@ -1638,8 +1638,8 @@ var getLineHeights = function getLineHeights(fontSizes) {
|
|
|
1638
1638
|
xlarge: fontSizes.xlarge + additionalSpace,
|
|
1639
1639
|
large: fontSizes.large + additionalSpace,
|
|
1640
1640
|
medium: fontSizes.medium + additionalSpace,
|
|
1641
|
-
small: fontSizes.small + additionalSpace,
|
|
1642
|
-
xsmall: fontSizes.xsmall + additionalSpace
|
|
1641
|
+
small: fontSizes.small + additionalSpace / 2,
|
|
1642
|
+
xsmall: fontSizes.xsmall + additionalSpace / 2
|
|
1643
1643
|
};
|
|
1644
1644
|
};
|
|
1645
1645
|
|
|
@@ -2357,8 +2357,7 @@ var getFABTheme = function getFABTheme(theme) {
|
|
|
2357
2357
|
headerTextMarginRight: theme.space.large,
|
|
2358
2358
|
headerTextMarginBottom: theme.space.large,
|
|
2359
2359
|
containerPadding: theme.space.large - theme.space.xsmall,
|
|
2360
|
-
titleMarginHorizontal: theme.space.small
|
|
2361
|
-
internalFABMarginBottom: theme.space.large
|
|
2360
|
+
titleMarginHorizontal: theme.space.small
|
|
2362
2361
|
};
|
|
2363
2362
|
var radii = {
|
|
2364
2363
|
actionItem: theme.radii.rounded
|
|
@@ -2898,9 +2897,12 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2898
2897
|
var fontSizes = {
|
|
2899
2898
|
"default": theme.fontSizes.small
|
|
2900
2899
|
};
|
|
2900
|
+
var lineHeights = {
|
|
2901
|
+
"default": theme.lineHeights.small
|
|
2902
|
+
};
|
|
2901
2903
|
var space = {
|
|
2902
2904
|
horizontalPadding: theme.space.small,
|
|
2903
|
-
verticalPadding: theme.space.
|
|
2905
|
+
verticalPadding: theme.space.xsmall
|
|
2904
2906
|
};
|
|
2905
2907
|
var radii = {
|
|
2906
2908
|
"default": theme.radii.base
|
|
@@ -2911,7 +2913,8 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2911
2913
|
fonts: fonts,
|
|
2912
2914
|
fontSizes: fontSizes,
|
|
2913
2915
|
space: space,
|
|
2914
|
-
radii: radii
|
|
2916
|
+
radii: radii,
|
|
2917
|
+
lineHeights: lineHeights
|
|
2915
2918
|
};
|
|
2916
2919
|
};
|
|
2917
2920
|
|
|
@@ -6130,14 +6133,19 @@ var Collapse = function Collapse(_ref) {
|
|
|
6130
6133
|
open = _ref$open === void 0 ? false : _ref$open,
|
|
6131
6134
|
children = _ref.children,
|
|
6132
6135
|
testID = _ref.testID,
|
|
6133
|
-
style = _ref.style
|
|
6136
|
+
style = _ref.style,
|
|
6137
|
+
onLayout = _ref.onLayout;
|
|
6134
6138
|
var _React$useState = React__default["default"].useState(0),
|
|
6135
6139
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6136
6140
|
contentHeight = _React$useState2[0],
|
|
6137
6141
|
setContentHeight = _React$useState2[1];
|
|
6142
|
+
var _React$useState3 = React__default["default"].useState(false),
|
|
6143
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
6144
|
+
componentMounted = _React$useState4[0],
|
|
6145
|
+
setComponentMounted = _React$useState4[1];
|
|
6138
6146
|
var previousOpenState = usePrevious(open);
|
|
6139
6147
|
React.useEffect(function () {
|
|
6140
|
-
if (open !== previousOpenState && previousOpenState !== undefined || open) {
|
|
6148
|
+
if ((open !== previousOpenState && previousOpenState !== undefined || open) && componentMounted) {
|
|
6141
6149
|
reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut);
|
|
6142
6150
|
}
|
|
6143
6151
|
}, [open, previousOpenState, contentHeight]);
|
|
@@ -6145,10 +6153,15 @@ var Collapse = function Collapse(_ref) {
|
|
|
6145
6153
|
var height = _ref2.height;
|
|
6146
6154
|
setContentHeight(height);
|
|
6147
6155
|
}, []);
|
|
6156
|
+
var onCollapseLayout = React.useCallback(function (e) {
|
|
6157
|
+
setComponentMounted(true);
|
|
6158
|
+
onLayout === null || onLayout === void 0 ? void 0 : onLayout(e);
|
|
6159
|
+
}, []);
|
|
6148
6160
|
return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$c, {
|
|
6149
6161
|
style: {
|
|
6150
6162
|
height: open ? contentHeight : 0
|
|
6151
6163
|
},
|
|
6164
|
+
onLayout: onCollapseLayout,
|
|
6152
6165
|
testID: testID
|
|
6153
6166
|
}, /*#__PURE__*/React__default["default"].createElement(StyledHiddenWrapper, null, /*#__PURE__*/React__default["default"].createElement(StyledChildWrapper, {
|
|
6154
6167
|
onLayout: function onLayout(event) {
|
|
@@ -12067,7 +12080,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
12067
12080
|
testID: "input-suffix",
|
|
12068
12081
|
icon: actualSuffix,
|
|
12069
12082
|
spin: actualSuffix === 'loading',
|
|
12070
|
-
size: "
|
|
12083
|
+
size: "medium"
|
|
12071
12084
|
}) : suffix), /*#__PURE__*/React__default["default"].createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default["default"].createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__default["default"].createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
12072
12085
|
testID: "input-error-icon",
|
|
12073
12086
|
icon: "circle-info",
|
|
@@ -12249,6 +12262,15 @@ var StyledPickerWrapper$1 = index$a(reactNative.View)(function (_ref) {
|
|
|
12249
12262
|
};
|
|
12250
12263
|
});
|
|
12251
12264
|
|
|
12265
|
+
var getInitialDateValue = function getInitialDateValue(value, minDate, maxDate) {
|
|
12266
|
+
if (minDate && value < minDate) {
|
|
12267
|
+
return minDate;
|
|
12268
|
+
}
|
|
12269
|
+
if (maxDate && value > maxDate) {
|
|
12270
|
+
return maxDate;
|
|
12271
|
+
}
|
|
12272
|
+
return value;
|
|
12273
|
+
};
|
|
12252
12274
|
var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
12253
12275
|
var value = _ref.value,
|
|
12254
12276
|
minDate = _ref.minDate,
|
|
@@ -12266,7 +12288,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
12266
12288
|
helpText = _ref.helpText,
|
|
12267
12289
|
style = _ref.style,
|
|
12268
12290
|
testID = _ref.testID;
|
|
12269
|
-
var _useState = React.useState(value || new Date()),
|
|
12291
|
+
var _useState = React.useState(getInitialDateValue(value || new Date(), minDate, maxDate)),
|
|
12270
12292
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12271
12293
|
selectingDate = _useState2[0],
|
|
12272
12294
|
setSelectingDate = _useState2[1];
|
|
@@ -13115,11 +13137,10 @@ var StyledBackdrop = index$a(reactNative.Animated.View)(function (_ref2) {
|
|
|
13115
13137
|
var theme = _ref2.theme;
|
|
13116
13138
|
return {
|
|
13117
13139
|
position: 'absolute',
|
|
13118
|
-
|
|
13119
|
-
height: '100%',
|
|
13120
|
-
width: '100%',
|
|
13121
|
-
bottom: 0,
|
|
13140
|
+
left: 0,
|
|
13122
13141
|
right: 0,
|
|
13142
|
+
top: 0,
|
|
13143
|
+
bottom: 0,
|
|
13123
13144
|
backgroundColor: theme.__hd__.fab.colors.backdropBackground
|
|
13124
13145
|
};
|
|
13125
13146
|
});
|
|
@@ -13135,17 +13156,6 @@ var StyledHeaderText = index$a(Typography.Text)(function (_ref3) {
|
|
|
13135
13156
|
textAlign: 'right'
|
|
13136
13157
|
};
|
|
13137
13158
|
});
|
|
13138
|
-
var StyledModalView = index$a(reactNative.View)({
|
|
13139
|
-
position: 'absolute',
|
|
13140
|
-
flex: 1,
|
|
13141
|
-
height: '100%',
|
|
13142
|
-
width: '100%',
|
|
13143
|
-
bottom: 0,
|
|
13144
|
-
right: 0,
|
|
13145
|
-
justifyContent: 'flex-end',
|
|
13146
|
-
alignItems: 'flex-end',
|
|
13147
|
-
backgroundColor: 'transparent'
|
|
13148
|
-
});
|
|
13149
13159
|
|
|
13150
13160
|
var ActionItemsListComponent = function ActionItemsListComponent(_ref) {
|
|
13151
13161
|
var style = _ref.style,
|
|
@@ -13168,43 +13178,15 @@ var ActionGroup = function ActionGroup(_ref2) {
|
|
|
13168
13178
|
fabTitle = _ref2.fabTitle,
|
|
13169
13179
|
_ref2$fabIcon = _ref2.fabIcon,
|
|
13170
13180
|
fabIcon = _ref2$fabIcon === void 0 ? 'add' : _ref2$fabIcon;
|
|
13171
|
-
var theme = useTheme();
|
|
13172
|
-
// Internal state to control the animation of the action group
|
|
13173
|
-
var _useState = React.useState(active),
|
|
13174
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
13175
|
-
visible = _useState2[0],
|
|
13176
|
-
setVisibility = _useState2[1];
|
|
13177
13181
|
var tranlateXAnimation = React.useRef(new reactNative.Animated.Value(active ? 1 : 0));
|
|
13178
13182
|
React.useEffect(function () {
|
|
13179
|
-
if (active && !visible) {
|
|
13180
|
-
setVisibility(true);
|
|
13181
|
-
}
|
|
13182
|
-
}, [active]);
|
|
13183
|
-
React.useEffect(function () {
|
|
13184
|
-
if (active) {
|
|
13185
|
-
var animation = reactNative.Animated.timing(tranlateXAnimation.current, {
|
|
13186
|
-
toValue: 1,
|
|
13187
|
-
useNativeDriver: reactNative.Platform.OS === 'ios' || reactNative.Platform.OS === 'android',
|
|
13188
|
-
easing: reactNative.Easing.inOut(reactNative.Easing.cubic)
|
|
13189
|
-
});
|
|
13190
|
-
animation.start();
|
|
13191
|
-
}
|
|
13192
|
-
}, [active]);
|
|
13193
|
-
// Make sure the animation finishes running before closing the modal
|
|
13194
|
-
var onInternalFABPress = React.useCallback(function () {
|
|
13195
|
-
if (!onPress) {
|
|
13196
|
-
return;
|
|
13197
|
-
}
|
|
13198
13183
|
var animation = reactNative.Animated.timing(tranlateXAnimation.current, {
|
|
13199
|
-
toValue: 0,
|
|
13184
|
+
toValue: active ? 1 : 0,
|
|
13200
13185
|
useNativeDriver: reactNative.Platform.OS === 'ios' || reactNative.Platform.OS === 'android',
|
|
13201
13186
|
easing: reactNative.Easing.inOut(reactNative.Easing.cubic)
|
|
13202
13187
|
});
|
|
13203
|
-
animation.start(
|
|
13204
|
-
|
|
13205
|
-
onPress();
|
|
13206
|
-
});
|
|
13207
|
-
}, [visible]);
|
|
13188
|
+
animation.start();
|
|
13189
|
+
}, [active]);
|
|
13208
13190
|
var interpolatedTranlateXAnimation = tranlateXAnimation.current.interpolate({
|
|
13209
13191
|
inputRange: [0, 1],
|
|
13210
13192
|
outputRange: [400, 0]
|
|
@@ -13221,18 +13203,13 @@ var ActionGroup = function ActionGroup(_ref2) {
|
|
|
13221
13203
|
testID: testID,
|
|
13222
13204
|
pointerEvents: "box-none",
|
|
13223
13205
|
style: style
|
|
13224
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactNative.Modal, {
|
|
13225
|
-
visible: visible,
|
|
13226
|
-
transparent: true,
|
|
13227
|
-
statusBarTranslucent: true,
|
|
13228
|
-
animationType: "none"
|
|
13229
13206
|
}, /*#__PURE__*/React__default["default"].createElement(StyledBackdrop, {
|
|
13207
|
+
pointerEvents: active ? 'auto' : 'box-none',
|
|
13208
|
+
testID: "back-drop",
|
|
13230
13209
|
style: {
|
|
13231
13210
|
opacity: interpolatedBackdropOpacityAnimation
|
|
13232
|
-
}
|
|
13233
|
-
|
|
13234
|
-
pointerEvents: active ? 'auto' : 'box-none'
|
|
13235
|
-
}), /*#__PURE__*/React__default["default"].createElement(StyledModalView, null, /*#__PURE__*/React__default["default"].createElement(StyledActionGroupContainer, {
|
|
13211
|
+
}
|
|
13212
|
+
}), /*#__PURE__*/React__default["default"].createElement(StyledActionGroupContainer, {
|
|
13236
13213
|
pointerEvents: active ? 'auto' : 'none',
|
|
13237
13214
|
testID: "action-group",
|
|
13238
13215
|
style: {
|
|
@@ -13245,17 +13222,7 @@ var ActionGroup = function ActionGroup(_ref2) {
|
|
|
13245
13222
|
testID: "header-text"
|
|
13246
13223
|
}, headerTitle), /*#__PURE__*/React__default["default"].createElement(ActionItemsListComponent, {
|
|
13247
13224
|
items: items
|
|
13248
|
-
})),
|
|
13249
|
-
testID: "fab",
|
|
13250
|
-
icon: fabIcon,
|
|
13251
|
-
onPress: onInternalFABPress,
|
|
13252
|
-
animated: true,
|
|
13253
|
-
active: active,
|
|
13254
|
-
title: fabTitle,
|
|
13255
|
-
style: {
|
|
13256
|
-
marginBottom: theme.__hd__.fab.space.internalFABMarginBottom
|
|
13257
|
-
}
|
|
13258
|
-
}))), !active && /*#__PURE__*/React__default["default"].createElement(StyledFAB, {
|
|
13225
|
+
})), /*#__PURE__*/React__default["default"].createElement(StyledFAB, {
|
|
13259
13226
|
testID: "fab",
|
|
13260
13227
|
icon: fabIcon,
|
|
13261
13228
|
onPress: onPress,
|
|
@@ -16006,6 +15973,7 @@ var StyledText = index$a(Typography.Text)(function (_ref3) {
|
|
|
16006
15973
|
return {
|
|
16007
15974
|
fontFamily: theme.__hd__.tag.fonts["default"],
|
|
16008
15975
|
fontSize: theme.__hd__.tag.fontSizes["default"],
|
|
15976
|
+
lineHeight: theme.__hd__.tag.lineHeights["default"],
|
|
16009
15977
|
color: textColor,
|
|
16010
15978
|
includeFontPadding: false,
|
|
16011
15979
|
textAlignVertical: 'center',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.27.
|
|
3
|
+
"version": "8.27.3",
|
|
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.27.
|
|
24
|
+
"@hero-design/colors": "8.27.3",
|
|
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.27.
|
|
48
|
+
"@hero-design/eslint-plugin": "8.27.3",
|
|
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,10 +61,10 @@
|
|
|
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.27.
|
|
64
|
+
"eslint-config-hd": "8.27.3",
|
|
65
65
|
"eslint-plugin-import": "^2.27.5",
|
|
66
66
|
"jest": "^27.3.1",
|
|
67
|
-
"prettier-config-hd": "8.27.
|
|
67
|
+
"prettier-config-hd": "8.27.3",
|
|
68
68
|
"react": "18.0.0",
|
|
69
69
|
"react-native": "0.69.7",
|
|
70
70
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -71,6 +71,7 @@ exports[`AccordionItem renders correctly when header is an element 1`] = `
|
|
|
71
71
|
</View>
|
|
72
72
|
<View
|
|
73
73
|
collapsable={false}
|
|
74
|
+
onLayout={[Function]}
|
|
74
75
|
style={
|
|
75
76
|
Object {
|
|
76
77
|
"height": 0,
|
|
@@ -205,6 +206,7 @@ exports[`AccordionItem renders correctly when header is string 1`] = `
|
|
|
205
206
|
</View>
|
|
206
207
|
<View
|
|
207
208
|
collapsable={false}
|
|
209
|
+
onLayout={[Function]}
|
|
208
210
|
style={
|
|
209
211
|
Object {
|
|
210
212
|
"height": 0,
|
|
@@ -339,6 +341,7 @@ exports[`AccordionItem renders correctly when open 1`] = `
|
|
|
339
341
|
</View>
|
|
340
342
|
<View
|
|
341
343
|
collapsable={false}
|
|
344
|
+
onLayout={[Function]}
|
|
342
345
|
style={
|
|
343
346
|
Object {
|
|
344
347
|
"height": 0,
|
|
@@ -473,6 +476,7 @@ exports[`AccordionItem renders correctly when variant is card 1`] = `
|
|
|
473
476
|
</View>
|
|
474
477
|
<View
|
|
475
478
|
collapsable={false}
|
|
479
|
+
onLayout={[Function]}
|
|
476
480
|
style={
|
|
477
481
|
Object {
|
|
478
482
|
"height": 0,
|
|
@@ -79,6 +79,7 @@ exports[`Accordion allows fully controlled 1`] = `
|
|
|
79
79
|
</View>
|
|
80
80
|
<View
|
|
81
81
|
collapsable={false}
|
|
82
|
+
onLayout={[Function]}
|
|
82
83
|
style={
|
|
83
84
|
Object {
|
|
84
85
|
"height": 0,
|
|
@@ -210,6 +211,7 @@ exports[`Accordion allows fully controlled 1`] = `
|
|
|
210
211
|
</View>
|
|
211
212
|
<View
|
|
212
213
|
collapsable={false}
|
|
214
|
+
onLayout={[Function]}
|
|
213
215
|
style={
|
|
214
216
|
Object {
|
|
215
217
|
"height": 0,
|
|
@@ -353,6 +355,7 @@ exports[`Accordion renders correctly 1`] = `
|
|
|
353
355
|
</View>
|
|
354
356
|
<View
|
|
355
357
|
collapsable={false}
|
|
358
|
+
onLayout={[Function]}
|
|
356
359
|
style={
|
|
357
360
|
Object {
|
|
358
361
|
"height": 0,
|
|
@@ -484,6 +487,7 @@ exports[`Accordion renders correctly 1`] = `
|
|
|
484
487
|
</View>
|
|
485
488
|
<View
|
|
486
489
|
collapsable={false}
|
|
490
|
+
onLayout={[Function]}
|
|
487
491
|
style={
|
|
488
492
|
Object {
|
|
489
493
|
"height": 0,
|
|
@@ -627,6 +631,7 @@ exports[`Accordion renders correctly when variant is card 1`] = `
|
|
|
627
631
|
</View>
|
|
628
632
|
<View
|
|
629
633
|
collapsable={false}
|
|
634
|
+
onLayout={[Function]}
|
|
630
635
|
style={
|
|
631
636
|
Object {
|
|
632
637
|
"height": 0,
|
|
@@ -769,6 +774,7 @@ exports[`Accordion renders correctly when variant is card 1`] = `
|
|
|
769
774
|
</View>
|
|
770
775
|
<View
|
|
771
776
|
collapsable={false}
|
|
777
|
+
onLayout={[Function]}
|
|
772
778
|
style={
|
|
773
779
|
Object {
|
|
774
780
|
"height": 0,
|
|
@@ -40,7 +40,7 @@ exports[`Badge has danger style when intent is danger 1`] = `
|
|
|
40
40
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
41
41
|
"fontSize": 12,
|
|
42
42
|
"includeFontPadding": false,
|
|
43
|
-
"lineHeight":
|
|
43
|
+
"lineHeight": 16,
|
|
44
44
|
"textAlign": "center",
|
|
45
45
|
"textAlignVertical": "center",
|
|
46
46
|
},
|
|
@@ -98,7 +98,7 @@ exports[`Badge has info style when intent is info 1`] = `
|
|
|
98
98
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
99
99
|
"fontSize": 12,
|
|
100
100
|
"includeFontPadding": false,
|
|
101
|
-
"lineHeight":
|
|
101
|
+
"lineHeight": 16,
|
|
102
102
|
"textAlign": "center",
|
|
103
103
|
"textAlignVertical": "center",
|
|
104
104
|
},
|
|
@@ -156,7 +156,7 @@ exports[`Badge has info style when intent is primary 1`] = `
|
|
|
156
156
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
157
157
|
"fontSize": 12,
|
|
158
158
|
"includeFontPadding": false,
|
|
159
|
-
"lineHeight":
|
|
159
|
+
"lineHeight": 16,
|
|
160
160
|
"textAlign": "center",
|
|
161
161
|
"textAlignVertical": "center",
|
|
162
162
|
},
|
|
@@ -214,7 +214,7 @@ exports[`Badge has success style when intent is success 1`] = `
|
|
|
214
214
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
215
215
|
"fontSize": 12,
|
|
216
216
|
"includeFontPadding": false,
|
|
217
|
-
"lineHeight":
|
|
217
|
+
"lineHeight": 16,
|
|
218
218
|
"textAlign": "center",
|
|
219
219
|
"textAlignVertical": "center",
|
|
220
220
|
},
|
|
@@ -272,7 +272,7 @@ exports[`Badge has warning style when intent is warning 1`] = `
|
|
|
272
272
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
273
273
|
"fontSize": 12,
|
|
274
274
|
"includeFontPadding": false,
|
|
275
|
-
"lineHeight":
|
|
275
|
+
"lineHeight": 16,
|
|
276
276
|
"textAlign": "center",
|
|
277
277
|
"textAlignVertical": "center",
|
|
278
278
|
},
|
|
@@ -331,7 +331,7 @@ exports[`Badge renders correctly with custom props 1`] = `
|
|
|
331
331
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
332
332
|
"fontSize": 12,
|
|
333
333
|
"includeFontPadding": false,
|
|
334
|
-
"lineHeight":
|
|
334
|
+
"lineHeight": 16,
|
|
335
335
|
"textAlign": "center",
|
|
336
336
|
"textAlignVertical": "center",
|
|
337
337
|
},
|