@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.
@@ -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 || defaultValue || '';
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
- {error && (
259
- <StyledErrorContainer>
260
- <Icon
261
- testID="input-error-icon"
262
- icon="circle-info"
263
- size="xsmall"
264
- intent="danger"
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
- <StyledError testID="input-error-message">{error}</StyledError>
268
- </StyledErrorContainer>
269
- )}
270
- {shouldShowMaxLength && (
271
- <StyledMaxLengthMessage themeVariant={variant} fontSize="small">
272
- {displayText.length}/{maxLength}
273
- </StyledMaxLengthMessage>
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
- "errorContainerMarginLeft": 16,
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
- export { StyledTextInputContainer, StyledLabel, StyledLabelContainer, StyledAsteriskLabel, StyledAsteriskLabelInsideTextInput, StyledTextInput, StyledError, StyledMaxLengthMessage, StyledLabelInsideTextInput, StyledContainer, StyledErrorContainer, StyledHelperText, StyledTextInputAndLabelContainer, StyledLabelContainerInsideTextInput, StyledErrorAndHelpTextContainer, StyledBorderBackDrop, };
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;