@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/.turbo/turbo-build.log
CHANGED
|
@@ -3,6 +3,6 @@ $ rollup -c
|
|
|
3
3
|
[36m
|
|
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
|
-
[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/
|
|
7
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
6
|
+
[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/runner/_work/hero-design/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 [1m30s[22m[39m
|
|
8
8
|
$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.44.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2341](https://github.com/Thinkei/hero-design/pull/2341) [`68a91bfc1`](https://github.com/Thinkei/hero-design/commit/68a91bfc1c2a0cd6b46d6c35e59aeaa2ae86160d) Thanks [@luanlai2201](https://github.com/luanlai2201)! - [TextInput][richtexteditor] Add animation for label
|
|
8
|
+
|
|
3
9
|
## 8.44.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/es/index.js
CHANGED
|
@@ -3333,8 +3333,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
3333
3333
|
};
|
|
3334
3334
|
var space = {
|
|
3335
3335
|
containerPadding: theme.space.medium,
|
|
3336
|
-
labelLeft: theme.space.
|
|
3337
|
-
labelTop: theme.
|
|
3336
|
+
labelLeft: theme.space.xlarge,
|
|
3337
|
+
labelTop: theme.space.xlarge / 3,
|
|
3338
3338
|
labelPaddingBottom: theme.space.small,
|
|
3339
3339
|
labelHorizontalPadding: theme.space.xsmall,
|
|
3340
3340
|
inputHorizontalMargin: theme.space.small,
|
|
@@ -6761,7 +6761,7 @@ var Caption = function Caption(_ref) {
|
|
|
6761
6761
|
}), children);
|
|
6762
6762
|
};
|
|
6763
6763
|
|
|
6764
|
-
var StyledLabel$
|
|
6764
|
+
var StyledLabel$1 = index$a(Text$1)(function (_ref) {
|
|
6765
6765
|
var themeIntent = _ref.themeIntent,
|
|
6766
6766
|
theme = _ref.theme;
|
|
6767
6767
|
return {
|
|
@@ -6780,7 +6780,7 @@ var Label = function Label(_ref) {
|
|
|
6780
6780
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
6781
6781
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
6782
6782
|
nativeProps = _objectWithoutProperties(_ref, _excluded$y);
|
|
6783
|
-
return /*#__PURE__*/React.createElement(StyledLabel$
|
|
6783
|
+
return /*#__PURE__*/React.createElement(StyledLabel$1, _extends$1({}, nativeProps, {
|
|
6784
6784
|
themeIntent: intent,
|
|
6785
6785
|
allowFontScaling: allowFontScaling
|
|
6786
6786
|
}), children);
|
|
@@ -12429,7 +12429,7 @@ var StyledIconWrapper$3 = index$a(Box)(function (_ref2) {
|
|
|
12429
12429
|
marginRight: theme.__hd__.chip.space.iconWrapperMarginRight
|
|
12430
12430
|
};
|
|
12431
12431
|
});
|
|
12432
|
-
var StyledLabel
|
|
12432
|
+
var StyledLabel = index$a(Typography.Body)(function (_ref3) {
|
|
12433
12433
|
var themeSelected = _ref3.themeSelected,
|
|
12434
12434
|
themeVariant = _ref3.themeVariant,
|
|
12435
12435
|
theme = _ref3.theme;
|
|
@@ -12475,7 +12475,7 @@ var Chip = function Chip(_ref) {
|
|
|
12475
12475
|
themeSelected: selected,
|
|
12476
12476
|
themeVariant: variant,
|
|
12477
12477
|
testID: "chip-icon-".concat(internalIcon)
|
|
12478
|
-
})), /*#__PURE__*/React.createElement(StyledLabel
|
|
12478
|
+
})), /*#__PURE__*/React.createElement(StyledLabel, {
|
|
12479
12479
|
variant: "small",
|
|
12480
12480
|
themeVariant: variant,
|
|
12481
12481
|
themeSelected: selected
|
|
@@ -12581,45 +12581,22 @@ var StyledContainer$4 = index$a(View)(function (_ref) {
|
|
|
12581
12581
|
marginTop: theme.__hd__.textInput.space.containerMarginTop
|
|
12582
12582
|
};
|
|
12583
12583
|
});
|
|
12584
|
-
var
|
|
12585
|
-
var
|
|
12584
|
+
var StyledLabelContainerInsideTextInput = index$a(Animated.View)(function (_ref2) {
|
|
12585
|
+
var themeVariant = _ref2.themeVariant,
|
|
12586
|
+
theme = _ref2.theme;
|
|
12586
12587
|
return {
|
|
12587
|
-
position: 'absolute',
|
|
12588
12588
|
flexDirection: 'row',
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
backgroundColor: theme.__hd__.textInput.colors.labelBackground,
|
|
12589
|
+
alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
|
|
12590
|
+
position: 'absolute',
|
|
12592
12591
|
zIndex: 1,
|
|
12593
|
-
|
|
12592
|
+
left: -theme.__hd__.textInput.space.labelLeft,
|
|
12593
|
+
right: 0,
|
|
12594
|
+
top: -theme.__hd__.textInput.space.labelTop
|
|
12594
12595
|
};
|
|
12595
12596
|
});
|
|
12596
|
-
var
|
|
12597
|
+
var StyledLabelInsideTextInput = index$a(Typography.Body)(function (_ref3) {
|
|
12597
12598
|
var theme = _ref3.theme,
|
|
12598
12599
|
themeState = _ref3.themeState;
|
|
12599
|
-
return {
|
|
12600
|
-
color: theme.__hd__.textInput.colors.labels[themeState],
|
|
12601
|
-
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
12602
|
-
};
|
|
12603
|
-
});
|
|
12604
|
-
var StyledAsteriskLabel = index$a(Typography.Caption)(function (_ref4) {
|
|
12605
|
-
var theme = _ref4.theme,
|
|
12606
|
-
themeState = _ref4.themeState;
|
|
12607
|
-
return {
|
|
12608
|
-
color: theme.__hd__.textInput.colors.asterisks[themeState],
|
|
12609
|
-
lineHeight: theme.__hd__.textInput.lineHeights.topLabel
|
|
12610
|
-
};
|
|
12611
|
-
});
|
|
12612
|
-
var StyledLabelContainerInsideTextInput = index$a(View)(function (_ref5) {
|
|
12613
|
-
var themeVariant = _ref5.themeVariant;
|
|
12614
|
-
return _objectSpread2({
|
|
12615
|
-
flexDirection: 'row',
|
|
12616
|
-
zIndex: 9999,
|
|
12617
|
-
alignItems: themeVariant === 'text' ? 'center' : 'flex-start'
|
|
12618
|
-
}, StyleSheet$1.absoluteFillObject);
|
|
12619
|
-
});
|
|
12620
|
-
var StyledLabelInsideTextInput = index$a(Typography.Body)(function (_ref6) {
|
|
12621
|
-
var theme = _ref6.theme,
|
|
12622
|
-
themeState = _ref6.themeState;
|
|
12623
12600
|
return {
|
|
12624
12601
|
textAlignVertical: 'center',
|
|
12625
12602
|
alignContent: 'center',
|
|
@@ -12628,15 +12605,15 @@ var StyledLabelInsideTextInput = index$a(Typography.Body)(function (_ref6) {
|
|
|
12628
12605
|
marginTop: theme.__hd__.textInput.space.labelInsideTextInputMarginTop
|
|
12629
12606
|
};
|
|
12630
12607
|
});
|
|
12631
|
-
var StyledAsteriskLabelInsideTextInput = index$a(Typography.Body)(function (
|
|
12632
|
-
var theme =
|
|
12633
|
-
themeState =
|
|
12608
|
+
var StyledAsteriskLabelInsideTextInput = index$a(Typography.Body)(function (_ref4) {
|
|
12609
|
+
var theme = _ref4.theme,
|
|
12610
|
+
themeState = _ref4.themeState;
|
|
12634
12611
|
return {
|
|
12635
12612
|
color: theme.__hd__.textInput.colors.asterisks[themeState]
|
|
12636
12613
|
};
|
|
12637
12614
|
});
|
|
12638
|
-
var StyledErrorContainer$2 = index$a(View)(function (
|
|
12639
|
-
var theme =
|
|
12615
|
+
var StyledErrorContainer$2 = index$a(View)(function (_ref5) {
|
|
12616
|
+
var theme = _ref5.theme;
|
|
12640
12617
|
return {
|
|
12641
12618
|
marginRight: theme.__hd__.textInput.space.errorContainerMarginRight,
|
|
12642
12619
|
flexDirection: 'row',
|
|
@@ -12645,16 +12622,16 @@ var StyledErrorContainer$2 = index$a(View)(function (_ref8) {
|
|
|
12645
12622
|
flexGrow: 4
|
|
12646
12623
|
};
|
|
12647
12624
|
});
|
|
12648
|
-
var StyledError = index$a(Typography.Caption)(function (
|
|
12649
|
-
var theme =
|
|
12625
|
+
var StyledError = index$a(Typography.Caption)(function (_ref6) {
|
|
12626
|
+
var theme = _ref6.theme;
|
|
12650
12627
|
return {
|
|
12651
12628
|
color: theme.__hd__.textInput.colors.error,
|
|
12652
12629
|
marginLeft: theme.__hd__.textInput.space.errorMarginLeft
|
|
12653
12630
|
};
|
|
12654
12631
|
});
|
|
12655
|
-
var StyledMaxLengthMessage = index$a(Typography.Caption)(function (
|
|
12656
|
-
var theme =
|
|
12657
|
-
themeState =
|
|
12632
|
+
var StyledMaxLengthMessage = index$a(Typography.Caption)(function (_ref7) {
|
|
12633
|
+
var theme = _ref7.theme,
|
|
12634
|
+
themeState = _ref7.themeState;
|
|
12658
12635
|
return {
|
|
12659
12636
|
color: theme.__hd__.textInput.colors.maxLengthLabels[themeState],
|
|
12660
12637
|
marginRight: theme.__hd__.textInput.space.maxLengthLabelMarginLeft,
|
|
@@ -12665,9 +12642,9 @@ var StyledMaxLengthMessage = index$a(Typography.Caption)(function (_ref10) {
|
|
|
12665
12642
|
};
|
|
12666
12643
|
});
|
|
12667
12644
|
var StyledHelperText = Typography.Caption;
|
|
12668
|
-
var StyledTextInput = index$a(TextInput$1)(function (
|
|
12669
|
-
var theme =
|
|
12670
|
-
themeVariant =
|
|
12645
|
+
var StyledTextInput = index$a(TextInput$1)(function (_ref8) {
|
|
12646
|
+
var theme = _ref8.theme,
|
|
12647
|
+
themeVariant = _ref8.themeVariant;
|
|
12671
12648
|
return {
|
|
12672
12649
|
textAlignVertical: themeVariant === 'text' ? 'center' : 'top',
|
|
12673
12650
|
fontSize: theme.__hd__.textInput.fontSizes.text,
|
|
@@ -12680,19 +12657,19 @@ var StyledTextInput = index$a(TextInput$1)(function (_ref11) {
|
|
|
12680
12657
|
fontFamily: theme.__hd__.textInput.fonts.text
|
|
12681
12658
|
};
|
|
12682
12659
|
});
|
|
12683
|
-
var StyledBorderBackDrop = index$a(View)(function (
|
|
12660
|
+
var StyledBorderBackDrop = index$a(View)(function (_ref9) {
|
|
12684
12661
|
var _theme$__hd__$textInp;
|
|
12685
|
-
var theme =
|
|
12686
|
-
themeFocused =
|
|
12687
|
-
themeState =
|
|
12662
|
+
var theme = _ref9.theme,
|
|
12663
|
+
themeFocused = _ref9.themeFocused,
|
|
12664
|
+
themeState = _ref9.themeState;
|
|
12688
12665
|
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
12689
12666
|
borderWidth: themeFocused ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
|
|
12690
12667
|
borderRadius: theme.__hd__.textInput.radii.container,
|
|
12691
12668
|
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"]
|
|
12692
12669
|
});
|
|
12693
12670
|
});
|
|
12694
|
-
var StyledTextInputContainer = index$a(View)(function (
|
|
12695
|
-
var theme =
|
|
12671
|
+
var StyledTextInputContainer = index$a(View)(function (_ref10) {
|
|
12672
|
+
var theme = _ref10.theme;
|
|
12696
12673
|
return {
|
|
12697
12674
|
flexDirection: 'row',
|
|
12698
12675
|
alignItems: 'center',
|
|
@@ -12710,8 +12687,8 @@ var StyledTextInputAndLabelContainer = index$a(View)(function () {
|
|
|
12710
12687
|
flexShrink: 1
|
|
12711
12688
|
};
|
|
12712
12689
|
});
|
|
12713
|
-
var StyledErrorAndHelpTextContainer = index$a(View)(function (
|
|
12714
|
-
var theme =
|
|
12690
|
+
var StyledErrorAndHelpTextContainer = index$a(View)(function (_ref11) {
|
|
12691
|
+
var theme = _ref11.theme;
|
|
12715
12692
|
return {
|
|
12716
12693
|
paddingLeft: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingLeft,
|
|
12717
12694
|
minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight,
|
|
@@ -12749,6 +12726,7 @@ var getState$1 = function getState(_ref) {
|
|
|
12749
12726
|
// Fix issue: Placeholder is not shown on iOS when multiline is true
|
|
12750
12727
|
// https://github.com/callstack/react-native-paper/pull/3331
|
|
12751
12728
|
var EMPTY_PLACEHOLDER_VALUE = ' ';
|
|
12729
|
+
var LABEL_ANIMATION_DURATION = 150;
|
|
12752
12730
|
var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
12753
12731
|
var _ref3;
|
|
12754
12732
|
var label = _ref2.label,
|
|
@@ -12781,10 +12759,18 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
12781
12759
|
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
12782
12760
|
var isEmptyValue = displayText.length === 0;
|
|
12783
12761
|
var actualSuffix = loading ? 'loading' : suffix;
|
|
12784
|
-
var _React$useState = React.useState(
|
|
12762
|
+
var _React$useState = React.useState(0),
|
|
12785
12763
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
12786
|
-
|
|
12787
|
-
|
|
12764
|
+
inputHeight = _React$useState2[0],
|
|
12765
|
+
setInputHeight = _React$useState2[1];
|
|
12766
|
+
var _React$useState3 = React.useState(0),
|
|
12767
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
12768
|
+
prefixWidth = _React$useState4[0],
|
|
12769
|
+
setPrefixWidth = _React$useState4[1];
|
|
12770
|
+
var _React$useState5 = React.useState(false),
|
|
12771
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
12772
|
+
isFocused = _React$useState6[0],
|
|
12773
|
+
setIsFocused = _React$useState6[1];
|
|
12788
12774
|
var state = getState$1({
|
|
12789
12775
|
disabled: disabled,
|
|
12790
12776
|
error: error,
|
|
@@ -12795,6 +12781,23 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
12795
12781
|
});
|
|
12796
12782
|
var shouldShowMaxLength = maxLength !== undefined && !hideCharacterCount;
|
|
12797
12783
|
var theme = useTheme();
|
|
12784
|
+
var focusAnimation = useRef(new Animated.Value(0)).current;
|
|
12785
|
+
useEffect(function () {
|
|
12786
|
+
Animated.timing(focusAnimation, {
|
|
12787
|
+
toValue: isFocused || !isEmptyValue ? 1 : 0,
|
|
12788
|
+
duration: LABEL_ANIMATION_DURATION,
|
|
12789
|
+
easing: Easing.bezier(0.4, 0, 0.2, 1),
|
|
12790
|
+
useNativeDriver: true
|
|
12791
|
+
}).start();
|
|
12792
|
+
}, [focusAnimation, isEmptyValue, isFocused]);
|
|
12793
|
+
var onLayout = useCallback(function (event) {
|
|
12794
|
+
var height = event.nativeEvent.layout.height;
|
|
12795
|
+
setInputHeight(height);
|
|
12796
|
+
}, []);
|
|
12797
|
+
var onPrefixLayout = useCallback(function (event) {
|
|
12798
|
+
var width = event.nativeEvent.layout.width;
|
|
12799
|
+
setPrefixWidth(width);
|
|
12800
|
+
}, []);
|
|
12798
12801
|
var innerTextInput = React.useRef();
|
|
12799
12802
|
React.useImperativeHandle(ref, function () {
|
|
12800
12803
|
return {
|
|
@@ -12892,43 +12895,59 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
12892
12895
|
style: styleWithoutBackgroundColor,
|
|
12893
12896
|
pointerEvents: state === 'disabled' || state === 'readonly' ? 'none' : 'auto',
|
|
12894
12897
|
testID: testID
|
|
12895
|
-
}, /*#__PURE__*/React.createElement(StyledTextInputContainer,
|
|
12898
|
+
}, /*#__PURE__*/React.createElement(StyledTextInputContainer, {
|
|
12899
|
+
onLayout: onLayout
|
|
12900
|
+
}, /*#__PURE__*/React.createElement(StyledBorderBackDrop, {
|
|
12896
12901
|
themeFocused: isFocused,
|
|
12897
12902
|
themeState: state,
|
|
12898
12903
|
testID: "text-input-border",
|
|
12899
12904
|
style: [{
|
|
12900
12905
|
backgroundColor: backgroundColor
|
|
12901
12906
|
}, borderStyle]
|
|
12902
|
-
}),
|
|
12903
|
-
|
|
12904
|
-
|
|
12905
|
-
style: {
|
|
12906
|
-
backgroundColor: backgroundColor
|
|
12907
|
-
}
|
|
12908
|
-
}, required && /*#__PURE__*/React.createElement(StyledAsteriskLabel, {
|
|
12909
|
-
themeState: state
|
|
12910
|
-
}, "*"), !!label && /*#__PURE__*/React.createElement(StyledLabel, {
|
|
12911
|
-
nativeID: accessibilityLabelledBy,
|
|
12912
|
-
testID: "input-label",
|
|
12913
|
-
themeState: state,
|
|
12914
|
-
style: {
|
|
12915
|
-
backgroundColor: backgroundColor
|
|
12916
|
-
}
|
|
12917
|
-
}, label)), typeof prefix === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
12907
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
12908
|
+
onLayout: onPrefixLayout
|
|
12909
|
+
}, typeof prefix === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
12918
12910
|
intent: state === 'disabled' ? 'disabled-text' : 'text',
|
|
12919
12911
|
testID: "input-prefix",
|
|
12920
12912
|
icon: prefix,
|
|
12921
12913
|
size: "xsmall"
|
|
12922
|
-
}) : prefix, /*#__PURE__*/React.createElement(
|
|
12914
|
+
}) : prefix), /*#__PURE__*/React.createElement(StyledLabelContainerInsideTextInput, {
|
|
12923
12915
|
themeVariant: variant,
|
|
12924
|
-
pointerEvents: "none"
|
|
12916
|
+
pointerEvents: "none",
|
|
12917
|
+
style: [{
|
|
12918
|
+
position: 'absolute'
|
|
12919
|
+
}, {
|
|
12920
|
+
transform: [{
|
|
12921
|
+
translateY: focusAnimation.interpolate({
|
|
12922
|
+
inputRange: [0, 1],
|
|
12923
|
+
outputRange: [variant !== 'textarea' ? inputHeight / 2 : theme.space.large, 0]
|
|
12924
|
+
})
|
|
12925
|
+
}, {
|
|
12926
|
+
translateX: focusAnimation.interpolate({
|
|
12927
|
+
inputRange: [0, 1],
|
|
12928
|
+
outputRange: [prefix ? prefixWidth * 4 : theme.space.xxxlarge, 0]
|
|
12929
|
+
})
|
|
12930
|
+
}, {
|
|
12931
|
+
scale: focusAnimation.interpolate({
|
|
12932
|
+
inputRange: [0, 1],
|
|
12933
|
+
outputRange: [1, 0.75]
|
|
12934
|
+
})
|
|
12935
|
+
}]
|
|
12936
|
+
}]
|
|
12925
12937
|
}, required && /*#__PURE__*/React.createElement(StyledAsteriskLabelInsideTextInput, {
|
|
12926
|
-
|
|
12938
|
+
style: {
|
|
12939
|
+
backgroundColor: backgroundColor
|
|
12940
|
+
},
|
|
12941
|
+
themeState: state,
|
|
12942
|
+
testID: "input-label-asterisk"
|
|
12927
12943
|
}, "*"), !!label && /*#__PURE__*/React.createElement(StyledLabelInsideTextInput, {
|
|
12944
|
+
style: {
|
|
12945
|
+
backgroundColor: backgroundColor
|
|
12946
|
+
},
|
|
12928
12947
|
nativeID: accessibilityLabelledBy,
|
|
12929
12948
|
testID: "input-label",
|
|
12930
12949
|
themeState: state
|
|
12931
|
-
}, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
|
|
12950
|
+
}, label)), /*#__PURE__*/React.createElement(StyledTextInputAndLabelContainer, null, renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
|
|
12932
12951
|
themeVariant: variant,
|
|
12933
12952
|
multiline: variant === 'textarea' || nativeProps.multiline,
|
|
12934
12953
|
ref: function ref(reference) {
|
|
@@ -33923,6 +33942,23 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
33923
33942
|
postMessage(webview.current, message);
|
|
33924
33943
|
}
|
|
33925
33944
|
};
|
|
33945
|
+
var _React$useState = React.useState(0),
|
|
33946
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
33947
|
+
inputHeight = _React$useState2[0],
|
|
33948
|
+
setInputHeight = _React$useState2[1];
|
|
33949
|
+
var focusAnimation = useRef(new Animated.Value(0)).current;
|
|
33950
|
+
useEffect(function () {
|
|
33951
|
+
Animated.timing(focusAnimation, {
|
|
33952
|
+
toValue: isFocused || !isEmptyValue ? 1 : 0,
|
|
33953
|
+
duration: LABEL_ANIMATION_DURATION,
|
|
33954
|
+
easing: Easing.bezier(0.4, 0, 0.2, 1),
|
|
33955
|
+
useNativeDriver: true
|
|
33956
|
+
}).start();
|
|
33957
|
+
}, [focusAnimation, isEmptyValue, isFocused]);
|
|
33958
|
+
var onLayout = useCallback(function (event) {
|
|
33959
|
+
var height = event.nativeEvent.layout.height;
|
|
33960
|
+
setInputHeight(height);
|
|
33961
|
+
}, []);
|
|
33926
33962
|
useEffect(function () {
|
|
33927
33963
|
var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
|
|
33928
33964
|
return setIsFocused(true);
|
|
@@ -34012,25 +34048,47 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
34012
34048
|
}, []);
|
|
34013
34049
|
return /*#__PURE__*/React.createElement(StyledContainer$4, {
|
|
34014
34050
|
testID: testID
|
|
34015
|
-
}, /*#__PURE__*/React.createElement(
|
|
34016
|
-
themeState: state,
|
|
34017
|
-
themeFocused: isFocused
|
|
34018
|
-
}), (isFocused || label && !isEmptyValue) && /*#__PURE__*/React.createElement(StyledLabelContainer, {
|
|
34019
|
-
pointerEvents: "none"
|
|
34020
|
-
}, required && /*#__PURE__*/React.createElement(StyledAsteriskLabel, {
|
|
34021
|
-
themeState: state
|
|
34022
|
-
}, "*"), !!label && /*#__PURE__*/React.createElement(StyledLabel, {
|
|
34023
|
-
testID: "input-label",
|
|
34024
|
-
themeState: state
|
|
34025
|
-
}, label)), /*#__PURE__*/React.createElement(StyledTextInputAndLabelContainer, null, !isFocused && isEmptyValue && /*#__PURE__*/React.createElement(StyledLabelContainerInsideTextInput, {
|
|
34051
|
+
}, /*#__PURE__*/React.createElement(StyledLabelContainerInsideTextInput, {
|
|
34026
34052
|
themeVariant: "text",
|
|
34027
|
-
pointerEvents: "none"
|
|
34053
|
+
pointerEvents: "none",
|
|
34054
|
+
testID: "input-label-container",
|
|
34055
|
+
style: [{
|
|
34056
|
+
position: 'absolute'
|
|
34057
|
+
}, {
|
|
34058
|
+
transform: [{
|
|
34059
|
+
translateY: focusAnimation.interpolate({
|
|
34060
|
+
inputRange: [0, 1],
|
|
34061
|
+
outputRange: [inputHeight / 2, 0]
|
|
34062
|
+
})
|
|
34063
|
+
}, {
|
|
34064
|
+
translateX: focusAnimation.interpolate({
|
|
34065
|
+
inputRange: [0, 1],
|
|
34066
|
+
outputRange: [theme.space.xxxlarge, 0]
|
|
34067
|
+
})
|
|
34068
|
+
}, {
|
|
34069
|
+
scale: focusAnimation.interpolate({
|
|
34070
|
+
inputRange: [0, 1],
|
|
34071
|
+
outputRange: [1, 0.75]
|
|
34072
|
+
})
|
|
34073
|
+
}]
|
|
34074
|
+
}]
|
|
34028
34075
|
}, required && /*#__PURE__*/React.createElement(StyledAsteriskLabelInsideTextInput, {
|
|
34076
|
+
style: {
|
|
34077
|
+
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
34078
|
+
},
|
|
34029
34079
|
themeState: state
|
|
34030
34080
|
}, "*"), !!label && /*#__PURE__*/React.createElement(StyledLabelInsideTextInput, {
|
|
34081
|
+
style: {
|
|
34082
|
+
backgroundColor: theme.__hd__.textInput.colors.labelBackground
|
|
34083
|
+
},
|
|
34031
34084
|
testID: "input-label",
|
|
34032
34085
|
themeState: state
|
|
34033
|
-
}, label)), /*#__PURE__*/React.createElement(
|
|
34086
|
+
}, label)), /*#__PURE__*/React.createElement(StyledTextInputContainer, {
|
|
34087
|
+
onLayout: onLayout
|
|
34088
|
+
}, /*#__PURE__*/React.createElement(StyledBorderBackDrop, {
|
|
34089
|
+
themeState: state,
|
|
34090
|
+
themeFocused: isFocused
|
|
34091
|
+
}), /*#__PURE__*/React.createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
|
34034
34092
|
onPress: function onPress(e) {
|
|
34035
34093
|
return e.stopPropagation();
|
|
34036
34094
|
}
|