@hero-design/rn 8.3.0 → 8.3.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.
Files changed (30) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +88 -88
  3. package/lib/index.js +85 -85
  4. package/package.json +5 -5
  5. package/src/components/Carousel/CarouselItem.tsx +1 -6
  6. package/src/components/Carousel/CarouselPaginator/StyledCarouselPaginator.tsx +10 -9
  7. package/src/components/Carousel/CarouselPaginator/index.tsx +2 -3
  8. package/src/components/Carousel/StyledCarousel.tsx +9 -6
  9. package/src/components/Carousel/__tests__/StyledCarousel.spec.tsx +3 -3
  10. package/src/components/Carousel/__tests__/__snapshots__/StyledCarousel.spec.tsx.snap +1 -2
  11. package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +600 -0
  12. package/src/components/Carousel/__tests__/index.spec.tsx +15 -7
  13. package/src/components/Carousel/index.tsx +65 -84
  14. package/src/components/TextInput/index.tsx +199 -197
  15. package/src/components/Typography/Text/StyledText.tsx +1 -0
  16. package/src/components/Typography/Text/index.tsx +1 -0
  17. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -2
  18. package/src/theme/components/carousel.ts +5 -2
  19. package/src/theme/components/typography.ts +2 -0
  20. package/src/theme/global/typography.ts +3 -0
  21. package/types/components/Carousel/CarouselItem.d.ts +1 -2
  22. package/types/components/Carousel/CarouselPaginator/StyledCarouselPaginator.d.ts +0 -2
  23. package/types/components/Carousel/StyledCarousel.d.ts +6 -4
  24. package/types/components/Carousel/index.d.ts +9 -23
  25. package/types/components/TextInput/index.d.ts +2 -2
  26. package/types/components/Typography/Text/StyledText.d.ts +1 -1
  27. package/types/components/Typography/Text/index.d.ts +1 -1
  28. package/types/theme/components/carousel.d.ts +3 -0
  29. package/types/theme/components/typography.d.ts +2 -0
  30. package/types/theme/global/typography.d.ts +1 -0
@@ -1,9 +1,17 @@
1
- import React, { useCallback, useRef, useState } from 'react';
1
+ import React, {
2
+ Dispatch,
3
+ SetStateAction,
4
+ useCallback,
5
+ useRef,
6
+ useEffect,
7
+ useState,
8
+ } from 'react';
2
9
  import {
3
10
  Animated,
4
11
  FlatList,
5
12
  StyleProp,
6
13
  useWindowDimensions,
14
+ View,
7
15
  ViewProps,
8
16
  ViewStyle,
9
17
  } from 'react-native';
@@ -11,11 +19,10 @@ import {
11
19
  import { CarouselData } from './types';
12
20
  import CarouselPaginator from './CarouselPaginator';
13
21
  import {
14
- StyledCarousel,
22
+ StyledBackDrop,
15
23
  StyledCarouselFooterWrapper,
16
24
  StyledCarouselView,
17
25
  } from './StyledCarousel';
18
- import Button from '../Button';
19
26
  import CarouselItem from './CarouselItem';
20
27
 
21
28
  interface CarouselProps extends ViewProps {
@@ -27,101 +34,86 @@ interface CarouselProps extends ViewProps {
27
34
  * Testing id of the component.
28
35
  */
29
36
  testID?: string;
30
-
31
- /**
32
- * Callback to be called when the user slides to the next slide.
33
- */
34
- onSlideChange?: (currentSlide?: CarouselData) => void;
35
-
36
37
  /**
37
- * Callback to be called when the user skips the intro carousel.
38
+ * onItemIndexChange event handler receiving index of selected Item.
38
39
  */
39
- onSkipPress?: (currentSlide?: CarouselData) => void;
40
-
41
- /**
42
- * Callback to be called when the user finishes the intro carousel.
43
- */
44
- onFinishPress?: (currentSlide?: CarouselData) => void;
45
-
40
+ onItemIndexChange?: Dispatch<SetStateAction<number>>;
46
41
  /**
47
42
  * Carousel data.
48
43
  */
49
44
  items: CarouselData[];
50
-
51
45
  /**
52
- * Finish button label.
46
+ * Render action elements function.
53
47
  */
54
- finishButtonLabel?: string;
55
-
48
+ renderActions?: (pageIndex: number) => JSX.Element;
56
49
  /**
57
- * Skip button label.
50
+ * Current selected item index.
58
51
  */
59
- skipButtonLabel?: string;
52
+ selectedItemIndex?: number;
53
+ }
60
54
 
61
- /**
62
- * Footer height.
63
- */
64
- footerHeight?: number;
55
+ export function useStateFromProp<T>(
56
+ initialValue: T
57
+ ): [T, Dispatch<SetStateAction<T>>] {
58
+ const [value, setValue] = useState(initialValue);
65
59
 
66
- /**
67
- * Min content height.
68
- */
69
- minContentHeight?: number;
60
+ useEffect(() => setValue(initialValue), [initialValue]);
61
+
62
+ return [value, setValue];
70
63
  }
71
64
 
72
65
  const Carousel = ({
73
66
  items,
74
- onFinishPress,
75
- onSkipPress,
76
- onSlideChange,
77
- finishButtonLabel = `Let's go!`,
78
- skipButtonLabel = 'Skip',
79
- footerHeight = 70,
80
- minContentHeight = 250,
67
+ onItemIndexChange,
68
+ renderActions,
69
+ selectedItemIndex = 0,
70
+ style,
81
71
  ...nativeProps
82
72
  }: CarouselProps) => {
83
- const carouselRef = useRef(null);
84
- const [currentSlideIndex, setCurrentSlideIndex] = useState(0);
85
- const { width } = useWindowDimensions();
73
+ const carouselRef = useRef<FlatList>(null);
86
74
 
87
- const scrollX = useRef(new Animated.Value(0)).current;
75
+ const [currentSlideIndex, setCurrentSlideIndex] =
76
+ useStateFromProp(selectedItemIndex);
88
77
 
89
- const visibleSlideChanged = useCallback(
90
- ({ viewableItems }) => {
91
- if (!viewableItems || (viewableItems && !viewableItems.length)) return;
92
- const currentIndex = viewableItems[0].index;
93
- setCurrentSlideIndex(viewableItems[0].index);
94
- const currentSlide = items[currentIndex];
95
- if (onSlideChange) {
96
- onSlideChange(currentSlide);
78
+ const internalOnItemIndexChange = useCallback(
79
+ (index: number) => {
80
+ setCurrentSlideIndex(index);
81
+ if (onItemIndexChange) {
82
+ onItemIndexChange(index);
97
83
  }
98
84
  },
99
- [items, onSlideChange]
85
+ [setCurrentSlideIndex, onItemIndexChange]
100
86
  );
87
+ const { width } = useWindowDimensions();
101
88
 
102
- const skipCarousel = useCallback(() => {
103
- const currentSlide = items[currentSlideIndex];
104
- if (onSkipPress) {
105
- onSkipPress(currentSlide);
106
- }
107
- }, [currentSlideIndex, onSkipPress, items]);
108
-
109
- const finishCarousel = useCallback(() => {
110
- const currentSlide = items[currentSlideIndex];
111
- if (onFinishPress) {
112
- onFinishPress(currentSlide);
113
- }
114
- }, [onFinishPress, items, currentSlideIndex]);
89
+ const scrollX = useRef(new Animated.Value(0)).current;
90
+ useEffect(() => {
91
+ // must use setTimeout since when layout is mounted, the pagination dots are not set correct scrollX
92
+ const handle = setTimeout(() => {
93
+ scrollX.setValue(currentSlideIndex * width);
94
+ carouselRef.current?.scrollToOffset({
95
+ offset: currentSlideIndex * width,
96
+ animated: true,
97
+ });
98
+ }, 100);
99
+ return () => {
100
+ clearTimeout(handle);
101
+ };
102
+ }, [currentSlideIndex, carouselRef]);
103
+
104
+ const visibleSlideChanged = useCallback(({ viewableItems }) => {
105
+ if (!viewableItems || (viewableItems && !viewableItems.length)) return;
106
+ const { index } = viewableItems[0];
107
+ internalOnItemIndexChange(index);
108
+ }, []);
115
109
 
116
110
  const viewConfig = useRef({ viewAreaCoveragePercentThreshold: 50 }).current;
117
111
 
118
- const isLastSlide = currentSlideIndex === items.length - 1;
119
-
120
112
  return (
121
- <StyledCarousel
122
- themeSlideBackground={items[currentSlideIndex].background}
123
- {...nativeProps}
124
- >
113
+ <View style={style} {...nativeProps}>
114
+ <StyledBackDrop
115
+ themeSlideBackground={items[currentSlideIndex].background}
116
+ />
125
117
  <StyledCarouselView>
126
118
  <FlatList
127
119
  horizontal
@@ -148,28 +140,17 @@ const Carousel = ({
148
140
  heading={heading}
149
141
  body={body}
150
142
  content={content}
151
- minHeight={minContentHeight}
152
143
  width={width}
153
144
  />
154
145
  );
155
146
  }}
156
147
  />
157
- <StyledCarouselFooterWrapper
158
- paddingHorizontal="large"
159
- flexDirection="row"
160
- justifyContent="space-between"
161
- style={{ height: footerHeight }}
162
- >
163
- <Button
164
- variant={isLastSlide ? 'filled' : 'text'}
165
- intent="primary"
166
- onPress={isLastSlide ? finishCarousel : skipCarousel}
167
- text={isLastSlide ? finishButtonLabel : skipButtonLabel}
168
- />
148
+ <StyledCarouselFooterWrapper>
149
+ {renderActions && renderActions(currentSlideIndex)}
169
150
  <CarouselPaginator numberOfSlides={items.length} scrollX={scrollX} />
170
151
  </StyledCarouselFooterWrapper>
171
152
  </StyledCarouselView>
172
- </StyledCarousel>
153
+ </View>
173
154
  );
174
155
  };
175
156
 
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { useMemo, forwardRef } from 'react';
2
2
  import { StyleSheet, TextInput as RNTextInput } from 'react-native';
3
3
  import type {
4
4
  TextInputProps as NativeTextInputProps,
@@ -141,225 +141,227 @@ export const getVariant = ({
141
141
  // https://github.com/callstack/react-native-paper/pull/3331
142
142
  const EMPTY_PLACEHOLDER_VALUE = ' ';
143
143
 
144
- const TextInput = (
145
- {
146
- label,
147
- prefix,
148
- suffix,
149
- style,
150
- textStyle,
151
- testID,
152
- accessibilityLabelledBy,
153
- error,
154
- required,
155
- editable = true,
156
- disabled = false,
157
- loading = false,
158
- maxLength,
159
- helpText,
160
- value,
161
- defaultValue,
162
- renderInputValue,
163
- ...nativeProps
164
- }: TextInputProps,
165
- ref?: React.Ref<TextInputHandles>
166
- ) => {
167
- const displayText = (value !== undefined ? value : defaultValue) ?? '';
168
- const isEmptyValue = displayText.length === 0;
169
- const actualSuffix = loading ? 'loading' : suffix;
144
+ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
145
+ (
146
+ {
147
+ label,
148
+ prefix,
149
+ suffix,
150
+ style,
151
+ textStyle,
152
+ testID,
153
+ accessibilityLabelledBy,
154
+ error,
155
+ required,
156
+ editable = true,
157
+ disabled = false,
158
+ loading = false,
159
+ maxLength,
160
+ helpText,
161
+ value,
162
+ defaultValue,
163
+ renderInputValue,
164
+ ...nativeProps
165
+ }: TextInputProps,
166
+ ref?: React.Ref<TextInputHandles>
167
+ ) => {
168
+ const displayText = (value !== undefined ? value : defaultValue) ?? '';
169
+ const isEmptyValue = displayText.length === 0;
170
+ const actualSuffix = loading ? 'loading' : suffix;
170
171
 
171
- const [isFocused, setIsFocused] = React.useState(false);
172
+ const [isFocused, setIsFocused] = React.useState(false);
172
173
 
173
- const variant = getVariant({
174
- disabled,
175
- error,
176
- editable,
177
- loading,
178
- isFocused,
179
- isEmptyValue,
180
- });
174
+ const variant = getVariant({
175
+ disabled,
176
+ error,
177
+ editable,
178
+ loading,
179
+ isFocused,
180
+ isEmptyValue,
181
+ });
181
182
 
182
- const shouldShowMaxLength = maxLength !== undefined;
183
+ const shouldShowMaxLength = maxLength !== undefined;
183
184
 
184
- const theme = useTheme();
185
+ const theme = useTheme();
185
186
 
186
- const innerTextInput = React.useRef<RNTextInput | undefined | null>();
187
- React.useImperativeHandle(
188
- ref,
189
- () => ({
190
- // we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
191
- getNativeTextInputRef: () => innerTextInput.current,
192
- focus: () => {
193
- innerTextInput.current?.focus();
194
- },
195
- clear: () => innerTextInput.current?.clear(),
196
- setNativeProps: (args: NativeTextInputProps) =>
197
- innerTextInput.current?.setNativeProps(args),
198
- isFocused: () => innerTextInput.current?.isFocused() || false,
199
- blur: () => innerTextInput.current?.blur(),
200
- }),
201
- [innerTextInput]
202
- );
187
+ const innerTextInput = React.useRef<RNTextInput | undefined | null>();
188
+ React.useImperativeHandle(
189
+ ref,
190
+ () => ({
191
+ // we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
192
+ getNativeTextInputRef: () => innerTextInput.current,
193
+ focus: () => {
194
+ innerTextInput.current?.focus();
195
+ },
196
+ clear: () => innerTextInput.current?.clear(),
197
+ setNativeProps: (args: NativeTextInputProps) =>
198
+ innerTextInput.current?.setNativeProps(args),
199
+ isFocused: () => innerTextInput.current?.isFocused() || false,
200
+ blur: () => innerTextInput.current?.blur(),
201
+ }),
202
+ [innerTextInput]
203
+ );
203
204
 
204
- const { borderStyle, textStyleWithoutBorderStyle } = useMemo(() => {
205
- if (!textStyle) {
206
- return {};
207
- }
205
+ const { borderStyle, textStyleWithoutBorderStyle } = useMemo(() => {
206
+ if (!textStyle) {
207
+ return {};
208
+ }
208
209
 
209
- const flattenTextStyle = StyleSheet.flatten(textStyle);
210
- const borderKeys = Object.keys(flattenTextStyle).filter((key) => {
211
- return key.startsWith('border');
212
- }) as Array<keyof TextStyle>;
213
- return {
214
- borderStyle: pick(borderKeys, flattenTextStyle),
215
- textStyleWithoutBorderStyle: omit(borderKeys, flattenTextStyle),
216
- };
217
- }, [textStyle]);
210
+ const flattenTextStyle = StyleSheet.flatten(textStyle);
211
+ const borderKeys = Object.keys(flattenTextStyle).filter((key) => {
212
+ return key.startsWith('border');
213
+ }) as Array<keyof TextStyle>;
214
+ return {
215
+ borderStyle: pick(borderKeys, flattenTextStyle),
216
+ textStyleWithoutBorderStyle: omit(borderKeys, flattenTextStyle),
217
+ };
218
+ }, [textStyle]);
218
219
 
219
- const nativeInputProps: NativeTextInputProps = {
220
- style: StyleSheet.flatten([
221
- { color: theme.__hd__.textInput.colors.text },
222
- textStyleWithoutBorderStyle,
223
- ]),
224
- testID: 'text-input',
225
- accessibilityState: {
226
- disabled: variant === 'disabled' || variant === 'readonly',
227
- },
228
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
229
- // @ts-ignore
230
- accessibilityLabelledBy,
231
- ...nativeProps,
232
- onFocus: (event) => {
233
- setIsFocused(true);
234
- nativeProps.onFocus?.(event);
235
- },
236
- onBlur: (event) => {
237
- setIsFocused(false);
238
- nativeProps.onBlur?.(event);
239
- },
240
- editable,
241
- maxLength,
242
- value,
243
- onChangeText: (text) => {
244
- nativeProps.onChangeText?.(text);
245
- },
246
- defaultValue,
247
- placeholder:
248
- isFocused || label === undefined
249
- ? nativeProps.placeholder
250
- : EMPTY_PLACEHOLDER_VALUE,
251
- };
220
+ const nativeInputProps: NativeTextInputProps = {
221
+ style: StyleSheet.flatten([
222
+ { color: theme.__hd__.textInput.colors.text },
223
+ textStyleWithoutBorderStyle,
224
+ ]),
225
+ testID: 'text-input',
226
+ accessibilityState: {
227
+ disabled: variant === 'disabled' || variant === 'readonly',
228
+ },
229
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
230
+ // @ts-ignore
231
+ accessibilityLabelledBy,
232
+ ...nativeProps,
233
+ onFocus: (event) => {
234
+ setIsFocused(true);
235
+ nativeProps.onFocus?.(event);
236
+ },
237
+ onBlur: (event) => {
238
+ setIsFocused(false);
239
+ nativeProps.onBlur?.(event);
240
+ },
241
+ editable,
242
+ maxLength,
243
+ value,
244
+ onChangeText: (text) => {
245
+ nativeProps.onChangeText?.(text);
246
+ },
247
+ defaultValue,
248
+ placeholder:
249
+ isFocused || label === undefined
250
+ ? nativeProps.placeholder
251
+ : EMPTY_PLACEHOLDER_VALUE,
252
+ };
252
253
 
253
- return (
254
- <StyledContainer
255
- style={style}
256
- pointerEvents={
257
- variant === 'disabled' || variant === 'readonly' ? 'none' : 'auto'
258
- }
259
- testID={testID}
260
- >
261
- <StyledTextInputContainer>
262
- <StyledBorderBackDrop
263
- themeFocused={isFocused}
264
- themeVariant={variant}
265
- style={borderStyle}
266
- />
267
- {(isFocused || (label && !isEmptyValue)) && (
268
- <StyledLabelContainer pointerEvents="none">
269
- {required && (
270
- <StyledAsteriskLabel themeVariant={variant} fontSize="small">
271
- *
272
- </StyledAsteriskLabel>
273
- )}
274
- {!!label && (
275
- <StyledLabel
276
- nativeID={accessibilityLabelledBy}
277
- testID="input-label"
278
- fontSize="small"
279
- themeVariant={variant}
280
- >
281
- {label}
282
- </StyledLabel>
283
- )}
284
- </StyledLabelContainer>
285
- )}
286
- {typeof prefix === 'string' ? (
287
- <Icon
288
- intent={variant === 'disabled' ? 'disabled-text' : 'text'}
289
- testID="input-prefix"
290
- icon={prefix}
291
- size="xsmall"
254
+ return (
255
+ <StyledContainer
256
+ style={style}
257
+ pointerEvents={
258
+ variant === 'disabled' || variant === 'readonly' ? 'none' : 'auto'
259
+ }
260
+ testID={testID}
261
+ >
262
+ <StyledTextInputContainer>
263
+ <StyledBorderBackDrop
264
+ themeFocused={isFocused}
265
+ themeVariant={variant}
266
+ style={borderStyle}
292
267
  />
293
- ) : (
294
- prefix
295
- )}
296
- <StyledTextInputAndLabelContainer>
297
- {!isFocused && isEmptyValue && (
298
- <StyledLabelContainerInsideTextInput pointerEvents="none">
268
+ {(isFocused || (label && !isEmptyValue)) && (
269
+ <StyledLabelContainer pointerEvents="none">
299
270
  {required && (
300
- <StyledAsteriskLabelInsideTextInput themeVariant={variant}>
271
+ <StyledAsteriskLabel themeVariant={variant} fontSize="small">
301
272
  *
302
- </StyledAsteriskLabelInsideTextInput>
273
+ </StyledAsteriskLabel>
303
274
  )}
304
275
  {!!label && (
305
- <StyledLabelInsideTextInput
276
+ <StyledLabel
306
277
  nativeID={accessibilityLabelledBy}
307
278
  testID="input-label"
308
- fontSize="medium"
279
+ fontSize="small"
309
280
  themeVariant={variant}
310
281
  >
311
282
  {label}
312
- </StyledLabelInsideTextInput>
283
+ </StyledLabel>
313
284
  )}
314
- </StyledLabelContainerInsideTextInput>
285
+ </StyledLabelContainer>
315
286
  )}
316
- {renderInputValue ? (
317
- renderInputValue(nativeInputProps)
318
- ) : (
319
- <StyledTextInput
320
- {...nativeInputProps}
321
- ref={(reference) => {
322
- innerTextInput.current = reference;
323
- }}
287
+ {typeof prefix === 'string' ? (
288
+ <Icon
289
+ intent={variant === 'disabled' ? 'disabled-text' : 'text'}
290
+ testID="input-prefix"
291
+ icon={prefix}
292
+ size="xsmall"
324
293
  />
294
+ ) : (
295
+ prefix
325
296
  )}
326
- </StyledTextInputAndLabelContainer>
327
- {typeof actualSuffix === 'string' ? (
328
- <Icon
329
- intent={variant === 'disabled' ? 'disabled-text' : 'text'}
330
- testID="input-suffix"
331
- icon={actualSuffix}
332
- spin={actualSuffix === 'loading'}
333
- size="xsmall"
334
- />
335
- ) : (
336
- suffix
337
- )}
338
- </StyledTextInputContainer>
339
- <StyledErrorAndHelpTextContainer>
340
- <StyledErrorAndMaxLengthContainer>
341
- {!!error && (
342
- <StyledErrorContainer>
343
- <Icon
344
- testID="input-error-icon"
345
- icon="circle-info"
346
- size="xsmall"
347
- intent="danger"
297
+ <StyledTextInputAndLabelContainer>
298
+ {!isFocused && isEmptyValue && (
299
+ <StyledLabelContainerInsideTextInput pointerEvents="none">
300
+ {required && (
301
+ <StyledAsteriskLabelInsideTextInput themeVariant={variant}>
302
+ *
303
+ </StyledAsteriskLabelInsideTextInput>
304
+ )}
305
+ {!!label && (
306
+ <StyledLabelInsideTextInput
307
+ nativeID={accessibilityLabelledBy}
308
+ testID="input-label"
309
+ fontSize="medium"
310
+ themeVariant={variant}
311
+ >
312
+ {label}
313
+ </StyledLabelInsideTextInput>
314
+ )}
315
+ </StyledLabelContainerInsideTextInput>
316
+ )}
317
+ {renderInputValue ? (
318
+ renderInputValue(nativeInputProps)
319
+ ) : (
320
+ <StyledTextInput
321
+ {...nativeInputProps}
322
+ ref={(reference) => {
323
+ innerTextInput.current = reference;
324
+ }}
348
325
  />
349
-
350
- <StyledError testID="input-error-message">{error}</StyledError>
351
- </StyledErrorContainer>
352
- )}
353
- {shouldShowMaxLength && (
354
- <StyledMaxLengthMessage themeVariant={variant} fontSize="small">
355
- {displayText.length}/{maxLength}
356
- </StyledMaxLengthMessage>
326
+ )}
327
+ </StyledTextInputAndLabelContainer>
328
+ {typeof actualSuffix === 'string' ? (
329
+ <Icon
330
+ intent={variant === 'disabled' ? 'disabled-text' : 'text'}
331
+ testID="input-suffix"
332
+ icon={actualSuffix}
333
+ spin={actualSuffix === 'loading'}
334
+ size="xsmall"
335
+ />
336
+ ) : (
337
+ suffix
357
338
  )}
358
- </StyledErrorAndMaxLengthContainer>
359
- {!!helpText && <StyledHelperText>{helpText}</StyledHelperText>}
360
- </StyledErrorAndHelpTextContainer>
361
- </StyledContainer>
362
- );
363
- };
339
+ </StyledTextInputContainer>
340
+ <StyledErrorAndHelpTextContainer>
341
+ <StyledErrorAndMaxLengthContainer>
342
+ {!!error && (
343
+ <StyledErrorContainer>
344
+ <Icon
345
+ testID="input-error-icon"
346
+ icon="circle-info"
347
+ size="xsmall"
348
+ intent="danger"
349
+ />
350
+
351
+ <StyledError testID="input-error-message">{error}</StyledError>
352
+ </StyledErrorContainer>
353
+ )}
354
+ {shouldShowMaxLength && (
355
+ <StyledMaxLengthMessage themeVariant={variant} fontSize="small">
356
+ {displayText.length}/{maxLength}
357
+ </StyledMaxLengthMessage>
358
+ )}
359
+ </StyledErrorAndMaxLengthContainer>
360
+ {!!helpText && <StyledHelperText>{helpText}</StyledHelperText>}
361
+ </StyledErrorAndHelpTextContainer>
362
+ </StyledContainer>
363
+ );
364
+ }
365
+ );
364
366
 
365
- export default React.forwardRef<TextInputHandles, TextInputProps>(TextInput);
367
+ export default TextInput;
@@ -15,6 +15,7 @@ const StyledText = styled(Text)<{
15
15
  | 'xlarge'
16
16
  | 'xxxlarge'
17
17
  | 'xxxxxlarge'
18
+ | '6xlarge'
18
19
  | '7xlarge';
19
20
  themeFontWeight: 'light' | 'regular' | 'semi-bold';
20
21
  themeIntent:
@@ -22,6 +22,7 @@ export interface TextProps extends NativeTextProps {
22
22
  | 'xlarge'
23
23
  | 'xxxlarge'
24
24
  | 'xxxxxlarge'
25
+ | '6xlarge'
25
26
  | '7xlarge';
26
27
  /**
27
28
  * Font weight of the text.