@hero-design/rn 8.124.2 → 8.126.0

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 (39) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/assets/fonts/BeVietnamPro-Medium.ttf +0 -0
  3. package/assets/fonts/BeVietnamPro-MediumItalic.ttf +0 -0
  4. package/es/index.js +207 -140
  5. package/lib/index.js +207 -140
  6. package/package.json +2 -2
  7. package/src/components/Badge/Status.tsx +8 -1
  8. package/src/components/Badge/StyledBadge.tsx +2 -1
  9. package/src/components/Badge/types.ts +8 -1
  10. package/src/components/RichTextEditor/RichTextEditor.tsx +88 -74
  11. package/src/components/Search/StyledSearch.tsx +1 -1
  12. package/src/components/TextInput/StyledTextInput.tsx +74 -24
  13. package/src/components/TextInput/index.tsx +126 -103
  14. package/src/components/Typography/Body/StyledBody.tsx +16 -8
  15. package/src/components/Typography/Body/index.tsx +12 -3
  16. package/src/components/Typography/Caption/StyledCaption.tsx +10 -2
  17. package/src/components/Typography/Caption/index.tsx +1 -1
  18. package/src/components/Typography/Label/StyledLabel.tsx +4 -5
  19. package/src/components/Typography/Label/index.tsx +7 -0
  20. package/src/components/Typography/types.ts +1 -0
  21. package/src/theme/components/badge.ts +5 -2
  22. package/src/theme/components/textInput.ts +32 -19
  23. package/src/theme/components/typography.ts +2 -0
  24. package/src/theme/global/typography.ts +6 -0
  25. package/types/components/Badge/Status.d.ts +1 -1
  26. package/types/components/Badge/StyledBadge.d.ts +1 -1
  27. package/types/components/Badge/types.d.ts +1 -1
  28. package/types/components/TextInput/StyledTextInput.d.ts +29 -15
  29. package/types/components/Typography/Body/StyledBody.d.ts +1 -1
  30. package/types/components/Typography/Body/index.d.ts +6 -3
  31. package/types/components/Typography/Caption/StyledCaption.d.ts +1 -1
  32. package/types/components/Typography/Caption/index.d.ts +1 -1
  33. package/types/components/Typography/Label/StyledLabel.d.ts +1 -0
  34. package/types/components/Typography/Label/index.d.ts +6 -1
  35. package/types/components/Typography/types.d.ts +1 -0
  36. package/types/theme/components/badge.d.ts +3 -0
  37. package/types/theme/components/textInput.d.ts +17 -5
  38. package/types/theme/components/typography.d.ts +2 -0
  39. package/types/theme/global/typography.d.ts +2 -0
@@ -2,20 +2,20 @@ import React, {
2
2
  useMemo,
3
3
  forwardRef,
4
4
  useRef,
5
- useCallback,
6
5
  useEffect,
6
+ useCallback,
7
7
  } from 'react';
8
- import { StyleSheet, Animated, Easing, View } from 'react-native';
8
+ import { StyleSheet, Animated, Easing, Pressable, View } from 'react-native';
9
9
  import type {
10
10
  TextInputProps as RNTextInputProps,
11
11
  StyleProp,
12
12
  ViewStyle,
13
13
  TextStyle,
14
- LayoutChangeEvent,
15
14
  TextInput as RNTextInput,
16
15
  BlurEvent,
17
16
  FocusEvent,
18
17
  } from 'react-native';
18
+ import { hexToRgba, omit, pick } from '../../utils/helpers';
19
19
  import {
20
20
  StyledTextInputContainer,
21
21
  StyledLabelInsideTextInput,
@@ -25,6 +25,7 @@ import {
25
25
  StyledMaxLengthMessage,
26
26
  StyledErrorContainer,
27
27
  StyledAsteriskLabelInsideTextInput,
28
+ StyledInputContentContainer,
28
29
  StyledTextInputAndLabelContainer,
29
30
  StyledLabelContainerInsideTextInput,
30
31
  StyledErrorAndHelpTextContainer,
@@ -37,7 +38,6 @@ import type { Theme } from '../../theme';
37
38
  import { useTheme } from '../../theme';
38
39
  import type { State } from './StyledTextInput';
39
40
  import type { IconName } from '../Icon';
40
- import { omit, pick } from '../../utils/helpers';
41
41
  import Typography from '../Typography';
42
42
 
43
43
  export type TextInputHandles = Pick<
@@ -187,13 +187,6 @@ export const renderErrorOrHelpText = ({
187
187
  }) => {
188
188
  return error ? (
189
189
  <StyledErrorContainer>
190
- <Icon
191
- testID="input-error-icon"
192
- icon="circle-info"
193
- size="xsmall"
194
- intent="danger"
195
- />
196
-
197
190
  <StyledError testID="input-error-message">{error}</StyledError>
198
191
  </StyledErrorContainer>
199
192
  ) : (
@@ -252,7 +245,7 @@ export const renderSuffix = ({
252
245
  const actualSuffix = loading ? 'loading' : suffix;
253
246
  return typeof actualSuffix === 'string' ? (
254
247
  <Icon
255
- intent={state === 'disabled' ? 'disabled-text' : 'text'}
248
+ intent={state === 'disabled' ? 'disabled-text' : 'muted'}
256
249
  testID="input-suffix"
257
250
  icon={actualSuffix}
258
251
  spin={actualSuffix === 'loading'}
@@ -272,10 +265,10 @@ export const renderPrefix = ({
272
265
  }) => {
273
266
  return typeof prefix === 'string' ? (
274
267
  <Icon
275
- intent={state === 'disabled' ? 'disabled-text' : 'text'}
268
+ intent={state === 'disabled' ? 'disabled-text' : 'muted'}
276
269
  testID="input-prefix"
277
270
  icon={prefix}
278
- size="xsmall"
271
+ size="medium"
279
272
  />
280
273
  ) : (
281
274
  prefix
@@ -337,10 +330,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
337
330
  const displayText = getDisplayText(value, defaultValue);
338
331
  const isEmptyValue = displayText.length === 0;
339
332
 
340
- const [inputSize, setInputSize] = React.useState<{
341
- height: number;
342
- width: number;
343
- }>({ height: 0, width: 0 });
333
+ const [containerHeight, setContainerHeight] = React.useState(0);
344
334
 
345
335
  const [isFocused, setIsFocused] = React.useState(false);
346
336
 
@@ -366,12 +356,17 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
366
356
  }).start();
367
357
  }, [focusAnimation, isEmptyValue, isFocused]);
368
358
 
369
- const onLayout = useCallback((event: LayoutChangeEvent) => {
370
- const { height, width } = event.nativeEvent.layout;
371
- setInputSize((prev) => ({ ...prev, height, width }));
372
- }, []);
373
-
374
359
  const innerTextInput = React.useRef<RNTextInput | undefined | null>(null);
360
+ const focusInnerTextInput = useCallback(
361
+ () => innerTextInput.current?.focus(),
362
+ []
363
+ );
364
+ const onContentLayout = useCallback(
365
+ (e: { nativeEvent: { layout: { height: number } } }) => {
366
+ setContainerHeight(e.nativeEvent.layout.height);
367
+ },
368
+ []
369
+ );
375
370
  React.useImperativeHandle(
376
371
  ref,
377
372
  () => ({
@@ -404,24 +399,30 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
404
399
  };
405
400
  }, [textStyle]);
406
401
 
402
+ const readonlyBackground = hexToRgba(
403
+ theme.__hd__.textInput.colors.readonlyBackground,
404
+ 0.7
405
+ );
406
+
407
407
  const { backgroundColor, styleWithoutBackgroundColor } = useMemo(() => {
408
+ const defaultBackground =
409
+ state === 'readonly'
410
+ ? readonlyBackground
411
+ : theme.__hd__.textInput.colors.containerBackground;
412
+
408
413
  if (!style) {
409
- return {
410
- backgroundColor: theme.__hd__.textInput.colors.containerBackground,
411
- };
414
+ return { backgroundColor: defaultBackground };
412
415
  }
413
416
 
414
417
  const flattenTextStyle = StyleSheet.flatten(style);
415
418
  return {
416
- backgroundColor:
417
- flattenTextStyle.backgroundColor ??
418
- theme.__hd__.textInput.colors.containerBackground,
419
+ backgroundColor: flattenTextStyle.backgroundColor ?? defaultBackground,
419
420
  styleWithoutBackgroundColor: omit(
420
421
  ['backgroundColor'],
421
422
  flattenTextStyle
422
423
  ),
423
424
  };
424
- }, [style, theme]);
425
+ }, [style, theme, state, readonlyBackground]);
425
426
 
426
427
  const nativeInputTestIDSuffix = testID ? `-${testID}` : '';
427
428
 
@@ -429,7 +430,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
429
430
  style: StyleSheet.flatten([
430
431
  {
431
432
  backgroundColor,
432
- color: theme.__hd__.textInput.colors.text,
433
+ color: theme.__hd__.textInput.colors.text[state],
433
434
  },
434
435
  textStyleWithoutBorderStyle,
435
436
  ]),
@@ -467,90 +468,112 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
467
468
  <StyledContainer
468
469
  style={styleWithoutBackgroundColor}
469
470
  pointerEvents={
470
- state === 'disabled' || state === 'readonly' ? 'none' : 'auto'
471
+ state === 'disabled' || state === 'readonly' || loading
472
+ ? 'none'
473
+ : 'auto'
471
474
  }
472
475
  testID={testID}
473
476
  >
474
- <StyledTextInputContainer onLayout={onLayout}>
475
- <StyledBorderBackDrop
476
- themeFocused={isFocused}
477
- themeState={state}
478
- testID="text-input-border"
479
- style={[{ backgroundColor }, borderStyle]}
480
- />
481
-
482
- <View>{renderPrefix({ state, prefix })}</View>
483
- <StyledLabelContainerInsideTextInput
484
- themeHasPrefix={!!prefix}
485
- themeVariant={variant}
486
- pointerEvents="none"
487
- style={[
488
- {
489
- transformOrigin: 'left top',
490
- },
491
- {
492
- transform: [
477
+ <Pressable
478
+ onPress={focusInnerTextInput}
479
+ accessible={false}
480
+ importantForAccessibility="no"
481
+ >
482
+ <StyledTextInputContainer themeVariant={variant} themeState={state}>
483
+ <StyledBorderBackDrop
484
+ themeFocused={isFocused}
485
+ themeState={state}
486
+ themeFilled={!isEmptyValue}
487
+ testID="text-input-border"
488
+ style={[{ backgroundColor }, borderStyle]}
489
+ />
490
+
491
+ {prefix !== undefined && (
492
+ <View>{renderPrefix({ state, prefix })}</View>
493
+ )}
494
+ <StyledInputContentContainer
495
+ themeHasLabel={!!label}
496
+ onLayout={onContentLayout}
497
+ >
498
+ <StyledLabelContainerInsideTextInput
499
+ themeVariant={variant}
500
+ pointerEvents="none"
501
+ style={[
493
502
  {
494
- translateY: focusAnimation.interpolate({
495
- inputRange: [0, 1],
496
- outputRange: [
497
- variant !== 'textarea'
498
- ? inputSize.height / 2
499
- : theme.space.large,
500
- theme.space.xsmall,
501
- ],
502
- }),
503
+ transformOrigin: 'left top',
503
504
  },
504
505
  {
505
- scale: focusAnimation.interpolate({
506
- inputRange: [0, 1],
507
- outputRange: [1, 0.75],
508
- }),
506
+ transform: [
507
+ {
508
+ translateY: focusAnimation.interpolate({
509
+ inputRange: [0, 1],
510
+ outputRange: [
511
+ variant !== 'textarea'
512
+ ? Math.max(
513
+ 0,
514
+ (containerHeight -
515
+ theme.__hd__.textInput.lineHeights.label) /
516
+ 2
517
+ )
518
+ : theme.__hd__.textInput.space
519
+ .textareaLabelIdleTranslateY,
520
+ 0,
521
+ ],
522
+ }),
523
+ },
524
+ {
525
+ scale: focusAnimation.interpolate({
526
+ inputRange: [0, 1],
527
+ outputRange: [1, 0.75],
528
+ }),
529
+ },
530
+ ],
509
531
  },
510
- ],
511
- },
512
- ]}
513
- >
514
- {!!label && (
515
- <StyledLabelInsideTextInput
516
- style={{ backgroundColor }}
517
- nativeID={accessibilityLabelledBy}
518
- testID={`input-label${nativeInputTestIDSuffix}`}
519
- themeState={state}
532
+ ]}
520
533
  >
521
- {required && (
522
- <StyledAsteriskLabelInsideTextInput
534
+ {!!label && (
535
+ <StyledLabelInsideTextInput
523
536
  style={{ backgroundColor }}
537
+ nativeID={accessibilityLabelledBy}
538
+ testID={`input-label${nativeInputTestIDSuffix}`}
524
539
  themeState={state}
525
- testID="input-label-asterisk"
526
540
  >
527
- *
528
- </StyledAsteriskLabelInsideTextInput>
541
+ {required && (
542
+ <StyledAsteriskLabelInsideTextInput
543
+ style={{ backgroundColor }}
544
+ themeState={state}
545
+ testID="input-label-asterisk"
546
+ >
547
+ *
548
+ </StyledAsteriskLabelInsideTextInput>
549
+ )}
550
+ <Typography.Body
551
+ testID={`input-label-text${nativeInputTestIDSuffix}`}
552
+ numberOfLines={1}
553
+ intent="muted"
554
+ >
555
+ {label}
556
+ </Typography.Body>
557
+ </StyledLabelInsideTextInput>
529
558
  )}
530
- <Typography.Body
531
- testID={`input-label-text${nativeInputTestIDSuffix}`}
532
- numberOfLines={1}
533
- >
534
- {label}
535
- </Typography.Body>
536
- </StyledLabelInsideTextInput>
537
- )}
538
- </StyledLabelContainerInsideTextInput>
539
-
540
- <StyledTextInputAndLabelContainer>
541
- {renderInput({
542
- variant,
543
- nativeInputProps,
544
- renderInputValue,
545
- ref: (rnTextInputRef) => {
546
- innerTextInput.current = rnTextInputRef;
547
- },
548
- theme,
549
- state,
550
- })}
551
- </StyledTextInputAndLabelContainer>
552
- {renderSuffix({ state, loading, suffix })}
553
- </StyledTextInputContainer>
559
+ </StyledLabelContainerInsideTextInput>
560
+
561
+ <StyledTextInputAndLabelContainer themeHasLabel={!!label}>
562
+ {renderInput({
563
+ variant,
564
+ nativeInputProps,
565
+ renderInputValue,
566
+ ref: (rnTextInputRef) => {
567
+ innerTextInput.current = rnTextInputRef;
568
+ },
569
+ theme,
570
+ state,
571
+ })}
572
+ </StyledTextInputAndLabelContainer>
573
+ </StyledInputContentContainer>
574
+ {renderSuffix({ state, loading, suffix })}
575
+ </StyledTextInputContainer>
576
+ </Pressable>
554
577
  <StyledErrorAndHelpTextContainer>
555
578
  <StyledErrorAndMaxLengthContainer>
556
579
  {renderErrorOrHelpText({ error, helpText })}
@@ -2,12 +2,20 @@ import styled from '@emotion/native';
2
2
  import { Text } from 'react-native';
3
3
  import type { TypographyColorIntent } from '../types';
4
4
 
5
- type ThemeVariant = 'small' | 'small-bold' | 'regular' | 'regular-bold';
6
- type FontWeights = 'regular' | 'semiBold';
5
+ type ThemeVariant =
6
+ | 'small'
7
+ | 'small-bold'
8
+ | 'small-medium'
9
+ | 'regular'
10
+ | 'regular-bold'
11
+ | 'regular-medium';
12
+ type FontWeights = 'regular' | 'medium' | 'semiBold';
7
13
 
8
14
  const FONTWEIGHT_MAP: Record<ThemeVariant, FontWeights> = {
9
15
  regular: 'regular',
10
16
  small: 'regular',
17
+ 'regular-medium': 'medium',
18
+ 'small-medium': 'medium',
11
19
  'regular-bold': 'semiBold',
12
20
  'small-bold': 'semiBold',
13
21
  } as const;
@@ -16,6 +24,8 @@ type FontSizes = 'regular' | 'small';
16
24
  const FONTSIZE_MAP: Record<ThemeVariant, FontSizes> = {
17
25
  regular: 'regular',
18
26
  small: 'small',
27
+ 'regular-medium': 'regular',
28
+ 'small-medium': 'small',
19
29
  'regular-bold': 'regular',
20
30
  'small-bold': 'small',
21
31
  } as const;
@@ -25,10 +35,10 @@ const StyledBody = styled(Text)<{
25
35
  themeVariant: ThemeVariant;
26
36
  themeIsItalic?: boolean;
27
37
  }>(({ themeIntent, theme, themeTypeface, themeVariant, themeIsItalic }) => {
28
- const baseFontWeight = FONTWEIGHT_MAP[themeVariant];
38
+ const fontWeight = FONTWEIGHT_MAP[themeVariant];
29
39
  const fontFamily = themeIsItalic
30
- ? theme.__hd__.typography.fonts[themeTypeface][`${baseFontWeight}Italic`]
31
- : theme.__hd__.typography.fonts[themeTypeface][baseFontWeight];
40
+ ? theme.__hd__.typography.fonts[themeTypeface][`${fontWeight}Italic`]
41
+ : theme.__hd__.typography.fonts[themeTypeface][fontWeight];
32
42
 
33
43
  return {
34
44
  fontSize:
@@ -40,9 +50,7 @@ const StyledBody = styled(Text)<{
40
50
  FONTSIZE_MAP[themeVariant]
41
51
  ],
42
52
  letterSpacing:
43
- theme.__hd__.typography.letterSpacings.body[themeTypeface][
44
- FONTWEIGHT_MAP[themeVariant]
45
- ],
53
+ theme.__hd__.typography.letterSpacings.body[themeTypeface][fontWeight],
46
54
  fontFamily,
47
55
  color: theme.__hd__.typography.colors[themeIntent],
48
56
  };
@@ -31,12 +31,21 @@ export interface BodyProps extends NativeTextProps {
31
31
  * The typeface to render the text in:
32
32
  * - `neutral`: The default typeface for the platform.
33
33
  * - `playful`: To visualise a playful content.
34
+ *
35
+ * Note: `regular-medium` and `small-medium` variants are only available with the `neutral` typeface.
34
36
  */
35
37
  typeface?: 'neutral' | 'playful';
36
38
  /**
37
- * size variant of the text.
38
- * */
39
- variant?: 'regular' | 'regular-bold' | 'small' | 'small-bold';
39
+ * Size and weight variant of the text.
40
+ * Medium variants (`regular-medium`, `small-medium`) are available with the `neutral` typeface only.
41
+ */
42
+ variant?:
43
+ | 'regular'
44
+ | 'regular-medium'
45
+ | 'regular-bold'
46
+ | 'small'
47
+ | 'small-medium'
48
+ | 'small-bold';
40
49
  /**
41
50
  * Font style to apply to the text.
42
51
  */
@@ -3,8 +3,14 @@ import styled from '@emotion/native';
3
3
  import type { TypographyColorIntent } from '../types';
4
4
  import { FONTWEIGHT_MAP } from '../types';
5
5
 
6
+ const LETTER_SPACING_MAP: Record<'regular' | 'medium' | 'semi-bold', number> = {
7
+ regular: 0.36,
8
+ medium: 0.3,
9
+ 'semi-bold': 0.24,
10
+ } as const;
11
+
6
12
  const StyledCaption = styled(Text)<{
7
- themeFontWeight: 'regular' | 'semi-bold';
13
+ themeFontWeight: 'regular' | 'medium' | 'semi-bold';
8
14
  themeIntent: TypographyColorIntent;
9
15
  themeIsItalic?: boolean;
10
16
  }>(({ themeFontWeight, themeIntent, theme, themeIsItalic }) => {
@@ -13,10 +19,12 @@ const StyledCaption = styled(Text)<{
13
19
  ? theme.__hd__.typography.fonts.neutral[`${baseFontWeight}Italic`]
14
20
  : theme.__hd__.typography.fonts.neutral[baseFontWeight];
15
21
 
22
+ const letterSpacing = LETTER_SPACING_MAP[themeFontWeight];
23
+
16
24
  return {
17
25
  fontSize: theme.__hd__.typography.fontSizes.caption,
18
26
  lineHeight: theme.__hd__.typography.lineHeights.caption,
19
- letterSpacing: themeFontWeight === 'regular' ? 0.36 : 0.24,
27
+ letterSpacing,
20
28
  color: theme.__hd__.typography.colors[themeIntent],
21
29
  fontFamily,
22
30
  };
@@ -18,7 +18,7 @@ export interface CaptionProps extends NativeTextProps {
18
18
  /**
19
19
  * Font weight of the text.
20
20
  */
21
- fontWeight?: 'regular' | 'semi-bold';
21
+ fontWeight?: 'regular' | 'medium' | 'semi-bold';
22
22
  /**
23
23
  * Visual intent color to apply to the text.
24
24
  */
@@ -5,12 +5,11 @@ import type { TypographyColorIntent } from '../types';
5
5
  const StyledLabel = styled(Text)<{
6
6
  themeIntent: TypographyColorIntent;
7
7
  themeIsItalic?: boolean;
8
- }>(({ themeIntent, theme, themeIsItalic }) => {
9
- // For Label, we assume 'regular' weight for base font family
10
- const baseFontWeight = 'regular';
8
+ themeFontWeight?: 'regular' | 'medium';
9
+ }>(({ themeIntent, theme, themeIsItalic, themeFontWeight = 'regular' }) => {
11
10
  const fontFamily = themeIsItalic
12
- ? theme.__hd__.typography.fonts.neutral[`${baseFontWeight}Italic`]
13
- : theme.__hd__.typography.fonts.neutral[baseFontWeight];
11
+ ? theme.__hd__.typography.fonts.neutral[`${themeFontWeight}Italic`]
12
+ : theme.__hd__.typography.fonts.neutral[themeFontWeight];
14
13
 
15
14
  return {
16
15
  fontSize: theme.__hd__.typography.fontSizes.label,
@@ -31,6 +31,11 @@ export interface LabelProps extends NativeTextProps {
31
31
  * Font style to apply to the text.
32
32
  */
33
33
  fontStyle?: 'normal' | 'italic';
34
+ /**
35
+ * Font weight. Only `'medium'` (500) is available in addition to the default `'regular'` (400).
36
+ * Medium weight is supported for the neutral typeface only.
37
+ */
38
+ fontWeight?: 'regular' | 'medium';
34
39
  }
35
40
 
36
41
  const Label = ({
@@ -38,6 +43,7 @@ const Label = ({
38
43
  intent = 'body',
39
44
  allowFontScaling = false,
40
45
  fontStyle = 'normal',
46
+ fontWeight = 'regular',
41
47
  style,
42
48
  testID,
43
49
  ...nativeProps
@@ -49,6 +55,7 @@ const Label = ({
49
55
  {...nativeProps}
50
56
  themeIntent={isAi ? 'body' : intent}
51
57
  themeIsItalic={fontStyle === 'italic'}
58
+ themeFontWeight={fontWeight}
52
59
  allowFontScaling={allowFontScaling}
53
60
  style={style}
54
61
  testID={testID}
@@ -1,6 +1,7 @@
1
1
  export const FONTWEIGHT_MAP = {
2
2
  light: 'light',
3
3
  regular: 'regular',
4
+ medium: 'medium',
4
5
  'semi-bold': 'semiBold',
5
6
  } as const;
6
7
 
@@ -9,6 +9,7 @@ const getBadgeTheme = (theme: GlobalTheme) => {
9
9
  success: theme.colors.onSuccessSurface,
10
10
  warning: theme.colors.onWarningSurface,
11
11
  archived: theme.colors.onArchivedSurface,
12
+ neutral: theme.colors.mutedOnDefaultGlobalSurface,
12
13
  text: theme.colors.onDarkGlobalSurface,
13
14
  border: theme.colors.defaultGlobalSurface,
14
15
  countText: theme.colors.onDarkGlobalSurface,
@@ -19,6 +20,7 @@ const getBadgeTheme = (theme: GlobalTheme) => {
19
20
  success: theme.colors.successSurface,
20
21
  warning: theme.colors.warningSurface,
21
22
  archived: theme.colors.archivedSurface,
23
+ neutral: theme.colors.neutralGlobalSurface,
22
24
  },
23
25
  stringText: {
24
26
  primary: theme.colors.primary,
@@ -27,12 +29,13 @@ const getBadgeTheme = (theme: GlobalTheme) => {
27
29
  success: theme.colors.onSuccessSurface,
28
30
  warning: theme.colors.onWarningSurface,
29
31
  archived: theme.colors.onArchivedSurface,
32
+ neutral: theme.colors.onDefaultGlobalSurface,
30
33
  },
31
34
  };
32
35
 
33
36
  const fonts = {
34
- medium: theme.fonts.neutral.regular,
35
- small: theme.fonts.neutral.semiBold,
37
+ medium: theme.fonts.neutral.medium,
38
+ small: theme.fonts.neutral.medium,
36
39
  };
37
40
 
38
41
  const fontSizes = {
@@ -1,4 +1,5 @@
1
1
  import type { GlobalTheme } from '../global';
2
+ import { scale } from '../../utils/scale';
2
3
 
3
4
  const getTextInputTheme = (theme: GlobalTheme) => {
4
5
  const colors = {
@@ -7,33 +8,41 @@ const getTextInputTheme = (theme: GlobalTheme) => {
7
8
  asterisks: {
8
9
  default: theme.colors.onErrorSurface,
9
10
  error: theme.colors.onErrorSurface,
10
- disabled: theme.colors.disabledOnDefaultGlobalSurface,
11
- readonly: theme.colors.inactiveOnDefaultGlobalSurface,
11
+ disabled: theme.colors.onErrorSurface,
12
+ readonly: theme.colors.onErrorSurface,
12
13
  filled: theme.colors.onErrorSurface,
13
14
  },
14
15
  error: theme.colors.onErrorSurface,
15
- text: theme.colors.onDefaultGlobalSurface,
16
+ text: {
17
+ default: theme.colors.onDefaultGlobalSurface,
18
+ filled: theme.colors.onDefaultGlobalSurface,
19
+ error: theme.colors.onDefaultGlobalSurface,
20
+ readonly: theme.colors.mutedOnDefaultGlobalSurface,
21
+ disabled: theme.colors.mutedOnDefaultGlobalSurface,
22
+ },
16
23
  borders: {
17
- default: theme.colors.primaryOutline,
24
+ default: theme.colors.inactiveOutline,
18
25
  error: theme.colors.onErrorSurface,
19
- disabled: theme.colors.disabledOutline,
26
+ disabled: theme.colors.inactiveOutline,
20
27
  readonly: theme.colors.inactiveOutline,
21
- filled: theme.colors.primaryOutline,
28
+ filled: theme.colors.inactiveOutline,
29
+ focused: theme.colors.primaryOutline,
22
30
  },
23
31
  labels: {
24
- default: theme.colors.onDefaultGlobalSurface,
32
+ default: theme.colors.mutedOnDefaultGlobalSurface,
25
33
  error: theme.colors.onDefaultGlobalSurface,
26
34
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
27
35
  readonly: theme.colors.mutedOnDefaultGlobalSurface,
28
- filled: theme.colors.onDefaultGlobalSurface,
36
+ filled: theme.colors.mutedOnDefaultGlobalSurface,
29
37
  },
30
38
  labelsInsideTextInput: {
31
- default: theme.colors.onDefaultGlobalSurface,
39
+ default: theme.colors.mutedOnDefaultGlobalSurface,
32
40
  error: theme.colors.onDefaultGlobalSurface,
33
41
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
34
- readonly: theme.colors.inactiveOnDefaultGlobalSurface,
35
- filled: theme.colors.onDefaultGlobalSurface,
42
+ readonly: theme.colors.mutedOnDefaultGlobalSurface,
43
+ filled: theme.colors.mutedOnDefaultGlobalSurface,
36
44
  },
45
+ readonlyBackground: theme.colors.neutralGlobalSurface,
37
46
  maxLengthLabels: {
38
47
  default: theme.colors.onDefaultGlobalSurface,
39
48
  error: theme.colors.onErrorSurface,
@@ -51,19 +60,21 @@ const getTextInputTheme = (theme: GlobalTheme) => {
51
60
  };
52
61
 
53
62
  const space = {
54
- containerPadding: theme.space.medium,
63
+ containerHorizontalPadding: theme.space.medium,
64
+ containerVerticalPadding: theme.space.small,
55
65
  labelLeft: theme.space.xlarge,
56
66
  labelTop: theme.space.xlarge / 3,
57
67
  labelPaddingBottom: theme.space.small,
58
68
  labelHorizontalPadding: theme.space.xsmall,
59
- inputHorizontalMargin: theme.space.small,
69
+ inputHorizontalMargin: theme.space.smallMedium,
60
70
  errorContainerMarginRight: theme.space.xsmall,
61
71
  errorAndHelpTextContainerMarginTop: theme.space.xxsmall,
62
- errorMarginLeft: theme.space.xsmall,
63
- errorAndHelpTextContainerHorizontalPadding: theme.space.medium,
64
72
  containerMarginTop: theme.space.small,
65
- labelInsideTextInputMarginTop: -theme.space.xxsmall,
73
+ labelInsideTextInputMarginTop: 0,
66
74
  errorAndHelpTextContainerPaddingTop: theme.space.xxsmall,
75
+ inputAndLabelContainerPaddingTop: theme.lineHeights.medium,
76
+ labelFocusedTranslateY: theme.space.xsmall * 2,
77
+ textareaLabelIdleTranslateY: theme.space.large,
67
78
  };
68
79
 
69
80
  const fonts = {
@@ -82,7 +93,7 @@ const getTextInputTheme = (theme: GlobalTheme) => {
82
93
  const borderWidths = {
83
94
  container: {
84
95
  normal: theme.borderWidths.base,
85
- focused: theme.borderWidths.medium,
96
+ focused: theme.borderWidths.base,
86
97
  },
87
98
  };
88
99
 
@@ -91,13 +102,15 @@ const getTextInputTheme = (theme: GlobalTheme) => {
91
102
  };
92
103
 
93
104
  const sizes = {
94
- errorAndHelpTextContainerHeight: theme.sizes.medium,
95
- textareaHeight: theme.sizes['15xlarge'],
105
+ errorAndHelpTextContainerMinHeight: theme.space.large,
106
+ containerMinHeight: scale(58),
107
+ textareaHeight: scale(120),
96
108
  textInputMaxHeight: theme.sizes['15xlarge'],
97
109
  };
98
110
 
99
111
  const lineHeights = {
100
112
  topLabel: theme.lineHeights.large / 2,
113
+ label: theme.lineHeights.large,
101
114
  };
102
115
 
103
116
  return {
@@ -125,11 +125,13 @@ const getTypographyTheme = (theme: GlobalTheme) => {
125
125
  body: {
126
126
  neutral: {
127
127
  semiBold: 0.24,
128
+ medium: 0.3,
128
129
  regular: 0.48,
129
130
  small: 0.48,
130
131
  },
131
132
  playful: {
132
133
  semiBold: 0.54,
134
+ medium: 0.54,
133
135
  regular: 0.54,
134
136
  small: 0.54,
135
137
  },