@hero-design/rn 7.10.2-rc.0 → 7.10.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 +8 -8
- package/es/index.js +21 -32
- package/lib/index.js +21 -32
- package/package.json +2 -2
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +240 -214
- package/src/components/Select/MultiSelect/index.tsx +11 -16
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +240 -214
- package/src/components/Select/SingleSelect/index.tsx +11 -16
- package/src/components/TextInput/StyledTextInput.tsx +7 -4
- package/src/components/TextInput/__tests__/.log/tsserver.log +8601 -0
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +0 -1
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +294 -182
- package/src/components/TextInput/index.tsx +20 -18
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1 -1
- package/src/theme/components/textInput.ts +1 -1
- package/types/components/TextInput/StyledTextInput.d.ts +7 -1
- package/types/theme/components/textInput.d.ts +1 -1
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
StyledLabelContainerInsideTextInput,
|
|
26
26
|
StyledErrorAndHelpTextContainer,
|
|
27
27
|
StyledBorderBackDrop,
|
|
28
|
+
StyledErrorAndMaxLengthContainer,
|
|
28
29
|
} from './StyledTextInput';
|
|
29
30
|
import Icon, { IconName } from '../Icon';
|
|
30
31
|
import { useTheme } from '../../theme';
|
|
@@ -139,8 +140,7 @@ const TextInput = ({
|
|
|
139
140
|
...nativeProps
|
|
140
141
|
}: TextInputProps): JSX.Element => {
|
|
141
142
|
const textInputReference = useRef<RNTextInput | null>(null);
|
|
142
|
-
const displayText = value
|
|
143
|
-
|
|
143
|
+
const displayText = (value !== undefined ? value : defaultValue) ?? '';
|
|
144
144
|
const isEmptyValue = displayText.length === 0;
|
|
145
145
|
|
|
146
146
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
@@ -255,23 +255,25 @@ const TextInput = ({
|
|
|
255
255
|
)}
|
|
256
256
|
</StyledTextInputContainer>
|
|
257
257
|
<StyledErrorAndHelpTextContainer>
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
<
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
258
|
+
<StyledErrorAndMaxLengthContainer>
|
|
259
|
+
{error && (
|
|
260
|
+
<StyledErrorContainer>
|
|
261
|
+
<Icon
|
|
262
|
+
testID="input-error-icon"
|
|
263
|
+
icon="circle-info"
|
|
264
|
+
size="xsmall"
|
|
265
|
+
intent="danger"
|
|
266
|
+
/>
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
<StyledError testID="input-error-message">{error}</StyledError>
|
|
269
|
+
</StyledErrorContainer>
|
|
270
|
+
)}
|
|
271
|
+
{shouldShowMaxLength && (
|
|
272
|
+
<StyledMaxLengthMessage themeVariant={variant} fontSize="small">
|
|
273
|
+
{displayText.length}/{maxLength}
|
|
274
|
+
</StyledMaxLengthMessage>
|
|
275
|
+
)}
|
|
276
|
+
</StyledErrorAndMaxLengthContainer>
|
|
275
277
|
{helpText && <StyledHelperText>{helpText}</StyledHelperText>}
|
|
276
278
|
</StyledErrorAndHelpTextContainer>
|
|
277
279
|
</StyledContainer>
|
|
@@ -588,7 +588,7 @@ Object {
|
|
|
588
588
|
"space": Object {
|
|
589
589
|
"containerMarginVertical": 8,
|
|
590
590
|
"containerPadding": 16,
|
|
591
|
-
"
|
|
591
|
+
"errorAndHelpTextContainerPaddingLeft": 16,
|
|
592
592
|
"errorContainerMarginRight": 4,
|
|
593
593
|
"errorMarginLeft": 4,
|
|
594
594
|
"inputHorizontalMargin": 8,
|
|
@@ -60,10 +60,10 @@ const getTextInputTheme = (theme: GlobalTheme) => {
|
|
|
60
60
|
labelHorizontalPadding: theme.space.xsmall,
|
|
61
61
|
inputHorizontalMargin: theme.space.small,
|
|
62
62
|
containerMarginVertical: theme.space.small,
|
|
63
|
-
errorContainerMarginLeft: theme.space.medium,
|
|
64
63
|
errorContainerMarginRight: theme.space.xsmall,
|
|
65
64
|
errorMarginLeft: theme.space.xsmall,
|
|
66
65
|
maxLengthLabelMarginLeft: theme.space.xsmall,
|
|
66
|
+
errorAndHelpTextContainerPaddingLeft: theme.space.medium,
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const fontSizes = {
|
|
@@ -94,4 +94,10 @@ declare const StyledErrorAndHelpTextContainer: import("@emotion/native").StyledC
|
|
|
94
94
|
}, {}, {
|
|
95
95
|
ref?: import("react").Ref<View> | undefined;
|
|
96
96
|
}>;
|
|
97
|
-
|
|
97
|
+
declare const StyledErrorAndMaxLengthContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
98
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
99
|
+
as?: import("react").ElementType<any> | undefined;
|
|
100
|
+
}, {}, {
|
|
101
|
+
ref?: import("react").Ref<View> | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
export { StyledTextInputContainer, StyledLabel, StyledLabelContainer, StyledAsteriskLabel, StyledAsteriskLabelInsideTextInput, StyledTextInput, StyledError, StyledMaxLengthMessage, StyledLabelInsideTextInput, StyledContainer, StyledErrorContainer, StyledHelperText, StyledTextInputAndLabelContainer, StyledLabelContainerInsideTextInput, StyledErrorAndHelpTextContainer, StyledBorderBackDrop, StyledErrorAndMaxLengthContainer, };
|
|
@@ -58,10 +58,10 @@ declare const getTextInputTheme: (theme: GlobalTheme) => {
|
|
|
58
58
|
labelHorizontalPadding: number;
|
|
59
59
|
inputHorizontalMargin: number;
|
|
60
60
|
containerMarginVertical: number;
|
|
61
|
-
errorContainerMarginLeft: number;
|
|
62
61
|
errorContainerMarginRight: number;
|
|
63
62
|
errorMarginLeft: number;
|
|
64
63
|
maxLengthLabelMarginLeft: number;
|
|
64
|
+
errorAndHelpTextContainerPaddingLeft: number;
|
|
65
65
|
};
|
|
66
66
|
fontSizes: {
|
|
67
67
|
text: number;
|