@hero-design/rn 8.44.0 → 8.44.1
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 +2 -2
- package/CHANGELOG.md +6 -0
- package/es/index.js +154 -96
- package/lib/index.js +154 -96
- package/package.json +1 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +102 -57
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +34 -19
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +34 -19
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +34 -19
- package/src/components/RichTextEditor/RichTextEditor.tsx +76 -38
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +126 -102
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +235 -146
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +201 -127
- package/src/components/TextInput/StyledTextInput.tsx +8 -31
- package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +0 -44
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +21 -638
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +1126 -833
- package/src/components/TextInput/__tests__/index.spec.tsx +2 -2
- package/src/components/TextInput/index.tsx +113 -57
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +68 -38
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +68 -38
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -2
- package/src/theme/components/textInput.ts +2 -2
- package/types/components/TextInput/StyledTextInput.d.ts +4 -24
- package/types/components/TextInput/index.d.ts +1 -0
package/lib/index.js
CHANGED
|
@@ -3363,8 +3363,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
3363
3363
|
};
|
|
3364
3364
|
var space = {
|
|
3365
3365
|
containerPadding: theme.space.medium,
|
|
3366
|
-
labelLeft: theme.space.
|
|
3367
|
-
labelTop: theme.
|
|
3366
|
+
labelLeft: theme.space.xlarge,
|
|
3367
|
+
labelTop: theme.space.xlarge / 3,
|
|
3368
3368
|
labelPaddingBottom: theme.space.small,
|
|
3369
3369
|
labelHorizontalPadding: theme.space.xsmall,
|
|
3370
3370
|
inputHorizontalMargin: theme.space.small,
|
|
@@ -6791,7 +6791,7 @@ var Caption = function Caption(_ref) {
|
|
|
6791
6791
|
}), children);
|
|
6792
6792
|
};
|
|
6793
6793
|
|
|
6794
|
-
var StyledLabel$
|
|
6794
|
+
var StyledLabel$1 = index$a(reactNative.Text)(function (_ref) {
|
|
6795
6795
|
var themeIntent = _ref.themeIntent,
|
|
6796
6796
|
theme = _ref.theme;
|
|
6797
6797
|
return {
|
|
@@ -6810,7 +6810,7 @@ var Label = function Label(_ref) {
|
|
|
6810
6810
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
6811
6811
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
6812
6812
|
nativeProps = _objectWithoutProperties(_ref, _excluded$y);
|
|
6813
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledLabel$
|
|
6813
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledLabel$1, _extends$1({}, nativeProps, {
|
|
6814
6814
|
themeIntent: intent,
|
|
6815
6815
|
allowFontScaling: allowFontScaling
|
|
6816
6816
|
}), children);
|
|
@@ -12459,7 +12459,7 @@ var StyledIconWrapper$3 = index$a(Box)(function (_ref2) {
|
|
|
12459
12459
|
marginRight: theme.__hd__.chip.space.iconWrapperMarginRight
|
|
12460
12460
|
};
|
|
12461
12461
|
});
|
|
12462
|
-
var StyledLabel
|
|
12462
|
+
var StyledLabel = index$a(Typography.Body)(function (_ref3) {
|
|
12463
12463
|
var themeSelected = _ref3.themeSelected,
|
|
12464
12464
|
themeVariant = _ref3.themeVariant,
|
|
12465
12465
|
theme = _ref3.theme;
|
|
@@ -12505,7 +12505,7 @@ var Chip = function Chip(_ref) {
|
|
|
12505
12505
|
themeSelected: selected,
|
|
12506
12506
|
themeVariant: variant,
|
|
12507
12507
|
testID: "chip-icon-".concat(internalIcon)
|
|
12508
|
-
})), /*#__PURE__*/React__default["default"].createElement(StyledLabel
|
|
12508
|
+
})), /*#__PURE__*/React__default["default"].createElement(StyledLabel, {
|
|
12509
12509
|
variant: "small",
|
|
12510
12510
|
themeVariant: variant,
|
|
12511
12511
|
themeSelected: selected
|
|
@@ -12611,45 +12611,22 @@ var StyledContainer$4 = index$a(reactNative.View)(function (_ref) {
|
|
|
12611
12611
|
marginTop: theme.__hd__.textInput.space.containerMarginTop
|
|
12612
12612
|
};
|
|
12613
12613
|
});
|
|
12614
|
-
var
|
|
12615
|
-
var
|
|
12614
|
+
var StyledLabelContainerInsideTextInput = index$a(reactNative.Animated.View)(function (_ref2) {
|
|
12615
|
+
var themeVariant = _ref2.themeVariant,
|
|
12616
|
+
theme = _ref2.theme;
|
|
12616
12617
|
return {
|
|
12617
|
-
position: 'absolute',
|
|
12618
12618
|
flexDirection: 'row',
|
|
12619
|
-
|
|
12620
|
-
|
|
12621
|
-
backgroundColor: theme.__hd__.textInput.colors.labelBackground,
|
|
12619
|
+
alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
|
|
12620
|
+
position: 'absolute',
|
|
12622
12621
|
zIndex: 1,
|
|
12623
|
-
|
|
12622
|
+
left: -theme.__hd__.textInput.space.labelLeft,
|
|
12623
|
+
right: 0,
|
|
12624
|
+
top: -theme.__hd__.textInput.space.labelTop
|
|
12624
12625
|
};
|
|
12625
12626
|
});
|
|
12626
|
-
var
|
|
12627
|
+
var StyledLabelInsideTextInput = index$a(Typography.Body)(function (_ref3) {
|
|
12627
12628
|
var theme = _ref3.theme,
|
|
12628
12629
|
themeState = _ref3.themeState;
|
|
12629
|
-
return {
|
|
12630
|
-
color: theme.__hd__.textInput.colors.labels[themeState],
|
|
12631
|
-
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
12632
|
-
};
|
|
12633
|
-
});
|
|
12634
|
-
var StyledAsteriskLabel = index$a(Typography.Caption)(function (_ref4) {
|
|
12635
|
-
var theme = _ref4.theme,
|
|
12636
|
-
themeState = _ref4.themeState;
|
|
12637
|
-
return {
|
|
12638
|
-
color: theme.__hd__.textInput.colors.asterisks[themeState],
|
|
12639
|
-
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
12640
|
-
};
|
|
12641
|
-
});
|
|
12642
|
-
var StyledLabelContainerInsideTextInput = index$a(reactNative.View)(function (_ref5) {
|
|
12643
|
-
var themeVariant = _ref5.themeVariant;
|
|
12644
|
-
return _objectSpread2({
|
|
12645
|
-
flexDirection: 'row',
|
|
12646
|
-
zIndex: 9999,
|
|
12647
|
-
alignItems: themeVariant === 'text' ? 'center' : 'flex-start'
|
|
12648
|
-
}, reactNative.StyleSheet.absoluteFillObject);
|
|
12649
|
-
});
|
|
12650
|
-
var StyledLabelInsideTextInput = index$a(Typography.Body)(function (_ref6) {
|
|
12651
|
-
var theme = _ref6.theme,
|
|
12652
|
-
themeState = _ref6.themeState;
|
|
12653
12630
|
return {
|
|
12654
12631
|
textAlignVertical: 'center',
|
|
12655
12632
|
alignContent: 'center',
|
|
@@ -12658,15 +12635,15 @@ var StyledLabelInsideTextInput = index$a(Typography.Body)(function (_ref6) {
|
|
|
12658
12635
|
marginTop: theme.__hd__.textInput.space.labelInsideTextInputMarginTop
|
|
12659
12636
|
};
|
|
12660
12637
|
});
|
|
12661
|
-
var StyledAsteriskLabelInsideTextInput = index$a(Typography.Body)(function (
|
|
12662
|
-
var theme =
|
|
12663
|
-
themeState =
|
|
12638
|
+
var StyledAsteriskLabelInsideTextInput = index$a(Typography.Body)(function (_ref4) {
|
|
12639
|
+
var theme = _ref4.theme,
|
|
12640
|
+
themeState = _ref4.themeState;
|
|
12664
12641
|
return {
|
|
12665
12642
|
color: theme.__hd__.textInput.colors.asterisks[themeState]
|
|
12666
12643
|
};
|
|
12667
12644
|
});
|
|
12668
|
-
var StyledErrorContainer$2 = index$a(reactNative.View)(function (
|
|
12669
|
-
var theme =
|
|
12645
|
+
var StyledErrorContainer$2 = index$a(reactNative.View)(function (_ref5) {
|
|
12646
|
+
var theme = _ref5.theme;
|
|
12670
12647
|
return {
|
|
12671
12648
|
marginRight: theme.__hd__.textInput.space.errorContainerMarginRight,
|
|
12672
12649
|
flexDirection: 'row',
|
|
@@ -12675,16 +12652,16 @@ var StyledErrorContainer$2 = index$a(reactNative.View)(function (_ref8) {
|
|
|
12675
12652
|
flexGrow: 4
|
|
12676
12653
|
};
|
|
12677
12654
|
});
|
|
12678
|
-
var StyledError = index$a(Typography.Caption)(function (
|
|
12679
|
-
var theme =
|
|
12655
|
+
var StyledError = index$a(Typography.Caption)(function (_ref6) {
|
|
12656
|
+
var theme = _ref6.theme;
|
|
12680
12657
|
return {
|
|
12681
12658
|
color: theme.__hd__.textInput.colors.error,
|
|
12682
12659
|
marginLeft: theme.__hd__.textInput.space.errorMarginLeft
|
|
12683
12660
|
};
|
|
12684
12661
|
});
|
|
12685
|
-
var StyledMaxLengthMessage = index$a(Typography.Caption)(function (
|
|
12686
|
-
var theme =
|
|
12687
|
-
themeState =
|
|
12662
|
+
var StyledMaxLengthMessage = index$a(Typography.Caption)(function (_ref7) {
|
|
12663
|
+
var theme = _ref7.theme,
|
|
12664
|
+
themeState = _ref7.themeState;
|
|
12688
12665
|
return {
|
|
12689
12666
|
color: theme.__hd__.textInput.colors.maxLengthLabels[themeState],
|
|
12690
12667
|
marginRight: theme.__hd__.textInput.space.maxLengthLabelMarginLeft,
|
|
@@ -12695,9 +12672,9 @@ var StyledMaxLengthMessage = index$a(Typography.Caption)(function (_ref10) {
|
|
|
12695
12672
|
};
|
|
12696
12673
|
});
|
|
12697
12674
|
var StyledHelperText = Typography.Caption;
|
|
12698
|
-
var StyledTextInput = index$a(reactNative.TextInput)(function (
|
|
12699
|
-
var theme =
|
|
12700
|
-
themeVariant =
|
|
12675
|
+
var StyledTextInput = index$a(reactNative.TextInput)(function (_ref8) {
|
|
12676
|
+
var theme = _ref8.theme,
|
|
12677
|
+
themeVariant = _ref8.themeVariant;
|
|
12701
12678
|
return {
|
|
12702
12679
|
textAlignVertical: themeVariant === 'text' ? 'center' : 'top',
|
|
12703
12680
|
fontSize: theme.__hd__.textInput.fontSizes.text,
|
|
@@ -12710,19 +12687,19 @@ var StyledTextInput = index$a(reactNative.TextInput)(function (_ref11) {
|
|
|
12710
12687
|
fontFamily: theme.__hd__.textInput.fonts.text
|
|
12711
12688
|
};
|
|
12712
12689
|
});
|
|
12713
|
-
var StyledBorderBackDrop = index$a(reactNative.View)(function (
|
|
12690
|
+
var StyledBorderBackDrop = index$a(reactNative.View)(function (_ref9) {
|
|
12714
12691
|
var _theme$__hd__$textInp;
|
|
12715
|
-
var theme =
|
|
12716
|
-
themeFocused =
|
|
12717
|
-
themeState =
|
|
12692
|
+
var theme = _ref9.theme,
|
|
12693
|
+
themeFocused = _ref9.themeFocused,
|
|
12694
|
+
themeState = _ref9.themeState;
|
|
12718
12695
|
return _objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
|
|
12719
12696
|
borderWidth: themeFocused ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
|
|
12720
12697
|
borderRadius: theme.__hd__.textInput.radii.container,
|
|
12721
12698
|
borderColor: (_theme$__hd__$textInp = theme.__hd__.textInput.colors.borders[themeState]) !== null && _theme$__hd__$textInp !== void 0 ? _theme$__hd__$textInp : theme.__hd__.textInput.colors.borders["default"]
|
|
12722
12699
|
});
|
|
12723
12700
|
});
|
|
12724
|
-
var StyledTextInputContainer = index$a(reactNative.View)(function (
|
|
12725
|
-
var theme =
|
|
12701
|
+
var StyledTextInputContainer = index$a(reactNative.View)(function (_ref10) {
|
|
12702
|
+
var theme = _ref10.theme;
|
|
12726
12703
|
return {
|
|
12727
12704
|
flexDirection: 'row',
|
|
12728
12705
|
alignItems: 'center',
|
|
@@ -12740,8 +12717,8 @@ var StyledTextInputAndLabelContainer = index$a(reactNative.View)(function () {
|
|
|
12740
12717
|
flexShrink: 1
|
|
12741
12718
|
};
|
|
12742
12719
|
});
|
|
12743
|
-
var StyledErrorAndHelpTextContainer = index$a(reactNative.View)(function (
|
|
12744
|
-
var theme =
|
|
12720
|
+
var StyledErrorAndHelpTextContainer = index$a(reactNative.View)(function (_ref11) {
|
|
12721
|
+
var theme = _ref11.theme;
|
|
12745
12722
|
return {
|
|
12746
12723
|
paddingLeft: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingLeft,
|
|
12747
12724
|
minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight,
|
|
@@ -12779,6 +12756,7 @@ var getState$1 = function getState(_ref) {
|
|
|
12779
12756
|
// Fix issue: Placeholder is not shown on iOS when multiline is true
|
|
12780
12757
|
// https://github.com/callstack/react-native-paper/pull/3331
|
|
12781
12758
|
var EMPTY_PLACEHOLDER_VALUE = ' ';
|
|
12759
|
+
var LABEL_ANIMATION_DURATION = 150;
|
|
12782
12760
|
var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
12783
12761
|
var _ref3;
|
|
12784
12762
|
var label = _ref2.label,
|
|
@@ -12811,10 +12789,18 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
12811
12789
|
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
12812
12790
|
var isEmptyValue = displayText.length === 0;
|
|
12813
12791
|
var actualSuffix = loading ? 'loading' : suffix;
|
|
12814
|
-
var _React$useState = React__default["default"].useState(
|
|
12792
|
+
var _React$useState = React__default["default"].useState(0),
|
|
12815
12793
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
12816
|
-
|
|
12817
|
-
|
|
12794
|
+
inputHeight = _React$useState2[0],
|
|
12795
|
+
setInputHeight = _React$useState2[1];
|
|
12796
|
+
var _React$useState3 = React__default["default"].useState(0),
|
|
12797
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
12798
|
+
prefixWidth = _React$useState4[0],
|
|
12799
|
+
setPrefixWidth = _React$useState4[1];
|
|
12800
|
+
var _React$useState5 = React__default["default"].useState(false),
|
|
12801
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
12802
|
+
isFocused = _React$useState6[0],
|
|
12803
|
+
setIsFocused = _React$useState6[1];
|
|
12818
12804
|
var state = getState$1({
|
|
12819
12805
|
disabled: disabled,
|
|
12820
12806
|
error: error,
|
|
@@ -12825,6 +12811,23 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
12825
12811
|
});
|
|
12826
12812
|
var shouldShowMaxLength = maxLength !== undefined && !hideCharacterCount;
|
|
12827
12813
|
var theme = useTheme();
|
|
12814
|
+
var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
12815
|
+
React.useEffect(function () {
|
|
12816
|
+
reactNative.Animated.timing(focusAnimation, {
|
|
12817
|
+
toValue: isFocused || !isEmptyValue ? 1 : 0,
|
|
12818
|
+
duration: LABEL_ANIMATION_DURATION,
|
|
12819
|
+
easing: reactNative.Easing.bezier(0.4, 0, 0.2, 1),
|
|
12820
|
+
useNativeDriver: true
|
|
12821
|
+
}).start();
|
|
12822
|
+
}, [focusAnimation, isEmptyValue, isFocused]);
|
|
12823
|
+
var onLayout = React.useCallback(function (event) {
|
|
12824
|
+
var height = event.nativeEvent.layout.height;
|
|
12825
|
+
setInputHeight(height);
|
|
12826
|
+
}, []);
|
|
12827
|
+
var onPrefixLayout = React.useCallback(function (event) {
|
|
12828
|
+
var width = event.nativeEvent.layout.width;
|
|
12829
|
+
setPrefixWidth(width);
|
|
12830
|
+
}, []);
|
|
12828
12831
|
var innerTextInput = React__default["default"].useRef();
|
|
12829
12832
|
React__default["default"].useImperativeHandle(ref, function () {
|
|
12830
12833
|
return {
|
|
@@ -12922,43 +12925,59 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
12922
12925
|
style: styleWithoutBackgroundColor,
|
|
12923
12926
|
pointerEvents: state === 'disabled' || state === 'readonly' ? 'none' : 'auto',
|
|
12924
12927
|
testID: testID
|
|
12925
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer,
|
|
12928
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer, {
|
|
12929
|
+
onLayout: onLayout
|
|
12930
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledBorderBackDrop, {
|
|
12926
12931
|
themeFocused: isFocused,
|
|
12927
12932
|
themeState: state,
|
|
12928
12933
|
testID: "text-input-border",
|
|
12929
12934
|
style: [{
|
|
12930
12935
|
backgroundColor: backgroundColor
|
|
12931
12936
|
}, borderStyle]
|
|
12932
|
-
}),
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
style: {
|
|
12936
|
-
backgroundColor: backgroundColor
|
|
12937
|
-
}
|
|
12938
|
-
}, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabel, {
|
|
12939
|
-
themeState: state
|
|
12940
|
-
}, "*"), !!label && /*#__PURE__*/React__default["default"].createElement(StyledLabel, {
|
|
12941
|
-
nativeID: accessibilityLabelledBy,
|
|
12942
|
-
testID: "input-label",
|
|
12943
|
-
themeState: state,
|
|
12944
|
-
style: {
|
|
12945
|
-
backgroundColor: backgroundColor
|
|
12946
|
-
}
|
|
12947
|
-
}, label)), typeof prefix === 'string' ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
12937
|
+
}), /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
|
|
12938
|
+
onLayout: onPrefixLayout
|
|
12939
|
+
}, typeof prefix === 'string' ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
12948
12940
|
intent: state === 'disabled' ? 'disabled-text' : 'text',
|
|
12949
12941
|
testID: "input-prefix",
|
|
12950
12942
|
icon: prefix,
|
|
12951
12943
|
size: "xsmall"
|
|
12952
|
-
}) : prefix, /*#__PURE__*/React__default["default"].createElement(
|
|
12944
|
+
}) : prefix), /*#__PURE__*/React__default["default"].createElement(StyledLabelContainerInsideTextInput, {
|
|
12953
12945
|
themeVariant: variant,
|
|
12954
|
-
pointerEvents: "none"
|
|
12946
|
+
pointerEvents: "none",
|
|
12947
|
+
style: [{
|
|
12948
|
+
position: 'absolute'
|
|
12949
|
+
}, {
|
|
12950
|
+
transform: [{
|
|
12951
|
+
translateY: focusAnimation.interpolate({
|
|
12952
|
+
inputRange: [0, 1],
|
|
12953
|
+
outputRange: [variant !== 'textarea' ? inputHeight / 2 : theme.space.large, 0]
|
|
12954
|
+
})
|
|
12955
|
+
}, {
|
|
12956
|
+
translateX: focusAnimation.interpolate({
|
|
12957
|
+
inputRange: [0, 1],
|
|
12958
|
+
outputRange: [prefix ? prefixWidth * 4 : theme.space.xxxlarge, 0]
|
|
12959
|
+
})
|
|
12960
|
+
}, {
|
|
12961
|
+
scale: focusAnimation.interpolate({
|
|
12962
|
+
inputRange: [0, 1],
|
|
12963
|
+
outputRange: [1, 0.75]
|
|
12964
|
+
})
|
|
12965
|
+
}]
|
|
12966
|
+
}]
|
|
12955
12967
|
}, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabelInsideTextInput, {
|
|
12956
|
-
|
|
12968
|
+
style: {
|
|
12969
|
+
backgroundColor: backgroundColor
|
|
12970
|
+
},
|
|
12971
|
+
themeState: state,
|
|
12972
|
+
testID: "input-label-asterisk"
|
|
12957
12973
|
}, "*"), !!label && /*#__PURE__*/React__default["default"].createElement(StyledLabelInsideTextInput, {
|
|
12974
|
+
style: {
|
|
12975
|
+
backgroundColor: backgroundColor
|
|
12976
|
+
},
|
|
12958
12977
|
nativeID: accessibilityLabelledBy,
|
|
12959
12978
|
testID: "input-label",
|
|
12960
12979
|
themeState: state
|
|
12961
|
-
}, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
|
|
12980
|
+
}, label)), /*#__PURE__*/React__default["default"].createElement(StyledTextInputAndLabelContainer, null, renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
|
|
12962
12981
|
themeVariant: variant,
|
|
12963
12982
|
multiline: variant === 'textarea' || nativeProps.multiline,
|
|
12964
12983
|
ref: function ref(reference) {
|
|
@@ -33953,6 +33972,23 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
33953
33972
|
postMessage(webview.current, message);
|
|
33954
33973
|
}
|
|
33955
33974
|
};
|
|
33975
|
+
var _React$useState = React__default["default"].useState(0),
|
|
33976
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
33977
|
+
inputHeight = _React$useState2[0],
|
|
33978
|
+
setInputHeight = _React$useState2[1];
|
|
33979
|
+
var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
33980
|
+
React.useEffect(function () {
|
|
33981
|
+
reactNative.Animated.timing(focusAnimation, {
|
|
33982
|
+
toValue: isFocused || !isEmptyValue ? 1 : 0,
|
|
33983
|
+
duration: LABEL_ANIMATION_DURATION,
|
|
33984
|
+
easing: reactNative.Easing.bezier(0.4, 0, 0.2, 1),
|
|
33985
|
+
useNativeDriver: true
|
|
33986
|
+
}).start();
|
|
33987
|
+
}, [focusAnimation, isEmptyValue, isFocused]);
|
|
33988
|
+
var onLayout = React.useCallback(function (event) {
|
|
33989
|
+
var height = event.nativeEvent.layout.height;
|
|
33990
|
+
setInputHeight(height);
|
|
33991
|
+
}, []);
|
|
33956
33992
|
React.useEffect(function () {
|
|
33957
33993
|
var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
|
|
33958
33994
|
return setIsFocused(true);
|
|
@@ -34042,25 +34078,47 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
34042
34078
|
}, []);
|
|
34043
34079
|
return /*#__PURE__*/React__default["default"].createElement(StyledContainer$4, {
|
|
34044
34080
|
testID: testID
|
|
34045
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
34046
|
-
themeState: state,
|
|
34047
|
-
themeFocused: isFocused
|
|
34048
|
-
}), (isFocused || label && !isEmptyValue) && /*#__PURE__*/React__default["default"].createElement(StyledLabelContainer, {
|
|
34049
|
-
pointerEvents: "none"
|
|
34050
|
-
}, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabel, {
|
|
34051
|
-
themeState: state
|
|
34052
|
-
}, "*"), !!label && /*#__PURE__*/React__default["default"].createElement(StyledLabel, {
|
|
34053
|
-
testID: "input-label",
|
|
34054
|
-
themeState: state
|
|
34055
|
-
}, label)), /*#__PURE__*/React__default["default"].createElement(StyledTextInputAndLabelContainer, null, !isFocused && isEmptyValue && /*#__PURE__*/React__default["default"].createElement(StyledLabelContainerInsideTextInput, {
|
|
34081
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledLabelContainerInsideTextInput, {
|
|
34056
34082
|
themeVariant: "text",
|
|
34057
|
-
pointerEvents: "none"
|
|
34083
|
+
pointerEvents: "none",
|
|
34084
|
+
testID: "input-label-container",
|
|
34085
|
+
style: [{
|
|
34086
|
+
position: 'absolute'
|
|
34087
|
+
}, {
|
|
34088
|
+
transform: [{
|
|
34089
|
+
translateY: focusAnimation.interpolate({
|
|
34090
|
+
inputRange: [0, 1],
|
|
34091
|
+
outputRange: [inputHeight / 2, 0]
|
|
34092
|
+
})
|
|
34093
|
+
}, {
|
|
34094
|
+
translateX: focusAnimation.interpolate({
|
|
34095
|
+
inputRange: [0, 1],
|
|
34096
|
+
outputRange: [theme.space.xxxlarge, 0]
|
|
34097
|
+
})
|
|
34098
|
+
}, {
|
|
34099
|
+
scale: focusAnimation.interpolate({
|
|
34100
|
+
inputRange: [0, 1],
|
|
34101
|
+
outputRange: [1, 0.75]
|
|
34102
|
+
})
|
|
34103
|
+
}]
|
|
34104
|
+
}]
|
|
34058
34105
|
}, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabelInsideTextInput, {
|
|
34106
|
+
style: {
|
|
34107
|
+
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
34108
|
+
},
|
|
34059
34109
|
themeState: state
|
|
34060
34110
|
}, "*"), !!label && /*#__PURE__*/React__default["default"].createElement(StyledLabelInsideTextInput, {
|
|
34111
|
+
style: {
|
|
34112
|
+
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
34113
|
+
},
|
|
34061
34114
|
testID: "input-label",
|
|
34062
34115
|
themeState: state
|
|
34063
|
-
}, label)), /*#__PURE__*/React__default["default"].createElement(
|
|
34116
|
+
}, label)), /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer, {
|
|
34117
|
+
onLayout: onLayout
|
|
34118
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledBorderBackDrop, {
|
|
34119
|
+
themeState: state,
|
|
34120
|
+
themeFocused: isFocused
|
|
34121
|
+
}), /*#__PURE__*/React__default["default"].createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React__default["default"].createElement(reactNative.TouchableWithoutFeedback, {
|
|
34064
34122
|
onPress: function onPress(e) {
|
|
34065
34123
|
return e.stopPropagation();
|
|
34066
34124
|
}
|