@hero-design/rn 8.124.2 → 8.125.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 (31) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/assets/fonts/BeVietnamPro-Medium.ttf +0 -0
  3. package/assets/fonts/BeVietnamPro-MediumItalic.ttf +0 -0
  4. package/es/index.js +200 -136
  5. package/lib/index.js +200 -136
  6. package/package.json +1 -1
  7. package/src/components/RichTextEditor/RichTextEditor.tsx +88 -74
  8. package/src/components/Search/StyledSearch.tsx +1 -1
  9. package/src/components/TextInput/StyledTextInput.tsx +74 -24
  10. package/src/components/TextInput/index.tsx +126 -103
  11. package/src/components/Typography/Body/StyledBody.tsx +16 -8
  12. package/src/components/Typography/Body/index.tsx +12 -3
  13. package/src/components/Typography/Caption/StyledCaption.tsx +10 -2
  14. package/src/components/Typography/Caption/index.tsx +1 -1
  15. package/src/components/Typography/Label/StyledLabel.tsx +4 -5
  16. package/src/components/Typography/Label/index.tsx +7 -0
  17. package/src/components/Typography/types.ts +1 -0
  18. package/src/theme/components/textInput.ts +32 -19
  19. package/src/theme/components/typography.ts +2 -0
  20. package/src/theme/global/typography.ts +6 -0
  21. package/types/components/TextInput/StyledTextInput.d.ts +29 -15
  22. package/types/components/Typography/Body/StyledBody.d.ts +1 -1
  23. package/types/components/Typography/Body/index.d.ts +6 -3
  24. package/types/components/Typography/Caption/StyledCaption.d.ts +1 -1
  25. package/types/components/Typography/Caption/index.d.ts +1 -1
  26. package/types/components/Typography/Label/StyledLabel.d.ts +1 -0
  27. package/types/components/Typography/Label/index.d.ts +6 -1
  28. package/types/components/Typography/types.d.ts +1 -0
  29. package/types/theme/components/textInput.d.ts +17 -5
  30. package/types/theme/components/typography.d.ts +2 -0
  31. package/types/theme/global/typography.d.ts +2 -0
package/es/index.js CHANGED
@@ -5176,6 +5176,8 @@ var getFonts = function getFonts(_ref) {
5176
5176
  lightItalic: "".concat(neutral, "-LightItalic"),
5177
5177
  regular: "".concat(neutral, "-Regular"),
5178
5178
  regularItalic: "".concat(neutral, "-RegularItalic"),
5179
+ medium: "".concat(neutral, "-Medium"),
5180
+ mediumItalic: "".concat(neutral, "-MediumItalic"),
5179
5181
  semiBold: "".concat(neutral, "-SemiBold"),
5180
5182
  semiBoldItalic: "".concat(neutral, "-SemiBoldItalic")
5181
5183
  },
@@ -5184,6 +5186,8 @@ var getFonts = function getFonts(_ref) {
5184
5186
  lightItalic: "".concat(playful, "-LightItalic"),
5185
5187
  regular: "".concat(playful, "-Regular"),
5186
5188
  regularItalic: "".concat(playful, "-RegularItalic"),
5189
+ medium: "".concat(playful, "-Regular"),
5190
+ mediumItalic: "".concat(playful, "-RegularItalic"),
5187
5191
  semiBold: "".concat(playful, "-Medium"),
5188
5192
  semiBoldItalic: "".concat(playful, "-MediumItalic")
5189
5193
  }
@@ -7211,33 +7215,41 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7211
7215
  asterisks: {
7212
7216
  "default": theme.colors.onErrorSurface,
7213
7217
  error: theme.colors.onErrorSurface,
7214
- disabled: theme.colors.disabledOnDefaultGlobalSurface,
7215
- readonly: theme.colors.inactiveOnDefaultGlobalSurface,
7218
+ disabled: theme.colors.onErrorSurface,
7219
+ readonly: theme.colors.onErrorSurface,
7216
7220
  filled: theme.colors.onErrorSurface
7217
7221
  },
7218
7222
  error: theme.colors.onErrorSurface,
7219
- text: theme.colors.onDefaultGlobalSurface,
7223
+ text: {
7224
+ "default": theme.colors.onDefaultGlobalSurface,
7225
+ filled: theme.colors.onDefaultGlobalSurface,
7226
+ error: theme.colors.onDefaultGlobalSurface,
7227
+ readonly: theme.colors.mutedOnDefaultGlobalSurface,
7228
+ disabled: theme.colors.mutedOnDefaultGlobalSurface
7229
+ },
7220
7230
  borders: {
7221
- "default": theme.colors.primaryOutline,
7231
+ "default": theme.colors.inactiveOutline,
7222
7232
  error: theme.colors.onErrorSurface,
7223
- disabled: theme.colors.disabledOutline,
7233
+ disabled: theme.colors.inactiveOutline,
7224
7234
  readonly: theme.colors.inactiveOutline,
7225
- filled: theme.colors.primaryOutline
7235
+ filled: theme.colors.inactiveOutline,
7236
+ focused: theme.colors.primaryOutline
7226
7237
  },
7227
7238
  labels: {
7228
- "default": theme.colors.onDefaultGlobalSurface,
7239
+ "default": theme.colors.mutedOnDefaultGlobalSurface,
7229
7240
  error: theme.colors.onDefaultGlobalSurface,
7230
7241
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
7231
7242
  readonly: theme.colors.mutedOnDefaultGlobalSurface,
7232
- filled: theme.colors.onDefaultGlobalSurface
7243
+ filled: theme.colors.mutedOnDefaultGlobalSurface
7233
7244
  },
7234
7245
  labelsInsideTextInput: {
7235
- "default": theme.colors.onDefaultGlobalSurface,
7246
+ "default": theme.colors.mutedOnDefaultGlobalSurface,
7236
7247
  error: theme.colors.onDefaultGlobalSurface,
7237
7248
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
7238
- readonly: theme.colors.inactiveOnDefaultGlobalSurface,
7239
- filled: theme.colors.onDefaultGlobalSurface
7249
+ readonly: theme.colors.mutedOnDefaultGlobalSurface,
7250
+ filled: theme.colors.mutedOnDefaultGlobalSurface
7240
7251
  },
7252
+ readonlyBackground: theme.colors.neutralGlobalSurface,
7241
7253
  maxLengthLabels: {
7242
7254
  "default": theme.colors.onDefaultGlobalSurface,
7243
7255
  error: theme.colors.onErrorSurface,
@@ -7254,19 +7266,21 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7254
7266
  }
7255
7267
  };
7256
7268
  var space = {
7257
- containerPadding: theme.space.medium,
7269
+ containerHorizontalPadding: theme.space.medium,
7270
+ containerVerticalPadding: theme.space.small,
7258
7271
  labelLeft: theme.space.xlarge,
7259
7272
  labelTop: theme.space.xlarge / 3,
7260
7273
  labelPaddingBottom: theme.space.small,
7261
7274
  labelHorizontalPadding: theme.space.xsmall,
7262
- inputHorizontalMargin: theme.space.small,
7275
+ inputHorizontalMargin: theme.space.smallMedium,
7263
7276
  errorContainerMarginRight: theme.space.xsmall,
7264
7277
  errorAndHelpTextContainerMarginTop: theme.space.xxsmall,
7265
- errorMarginLeft: theme.space.xsmall,
7266
- errorAndHelpTextContainerHorizontalPadding: theme.space.medium,
7267
7278
  containerMarginTop: theme.space.small,
7268
- labelInsideTextInputMarginTop: -theme.space.xxsmall,
7269
- errorAndHelpTextContainerPaddingTop: theme.space.xxsmall
7279
+ labelInsideTextInputMarginTop: 0,
7280
+ errorAndHelpTextContainerPaddingTop: theme.space.xxsmall,
7281
+ inputAndLabelContainerPaddingTop: theme.lineHeights.medium,
7282
+ labelFocusedTranslateY: theme.space.xsmall * 2,
7283
+ textareaLabelIdleTranslateY: theme.space.large
7270
7284
  };
7271
7285
  var fonts = {
7272
7286
  text: theme.fonts.neutral.regular
@@ -7282,19 +7296,21 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7282
7296
  var borderWidths = {
7283
7297
  container: {
7284
7298
  normal: theme.borderWidths.base,
7285
- focused: theme.borderWidths.medium
7299
+ focused: theme.borderWidths.base
7286
7300
  }
7287
7301
  };
7288
7302
  var radii = {
7289
7303
  container: theme.radii.medium
7290
7304
  };
7291
7305
  var sizes = {
7292
- errorAndHelpTextContainerHeight: theme.sizes.medium,
7293
- textareaHeight: theme.sizes['15xlarge'],
7306
+ errorAndHelpTextContainerMinHeight: theme.space.large,
7307
+ containerMinHeight: scale(58),
7308
+ textareaHeight: scale(120),
7294
7309
  textInputMaxHeight: theme.sizes['15xlarge']
7295
7310
  };
7296
7311
  var lineHeights = {
7297
- topLabel: theme.lineHeights.large / 2
7312
+ topLabel: theme.lineHeights.large / 2,
7313
+ label: theme.lineHeights.large
7298
7314
  };
7299
7315
  return {
7300
7316
  colors: colors,
@@ -7545,11 +7561,13 @@ var getTypographyTheme = function getTypographyTheme(theme) {
7545
7561
  body: {
7546
7562
  neutral: {
7547
7563
  semiBold: 0.24,
7564
+ medium: 0.3,
7548
7565
  regular: 0.48,
7549
7566
  small: 0.48
7550
7567
  },
7551
7568
  playful: {
7552
7569
  semiBold: 0.54,
7570
+ medium: 0.54,
7553
7571
  regular: 0.54,
7554
7572
  small: 0.54
7555
7573
  }
@@ -8191,9 +8209,15 @@ var Text = function Text(_ref) {
8191
8209
  var FONTWEIGHT_MAP$1 = {
8192
8210
  light: 'light',
8193
8211
  regular: 'regular',
8212
+ medium: 'medium',
8194
8213
  'semi-bold': 'semiBold'
8195
8214
  };
8196
8215
 
8216
+ var LETTER_SPACING_MAP = {
8217
+ regular: 0.36,
8218
+ medium: 0.3,
8219
+ 'semi-bold': 0.24
8220
+ };
8197
8221
  var StyledCaption = index$c(Text$1)(function (_ref) {
8198
8222
  var themeFontWeight = _ref.themeFontWeight,
8199
8223
  themeIntent = _ref.themeIntent,
@@ -8201,10 +8225,11 @@ var StyledCaption = index$c(Text$1)(function (_ref) {
8201
8225
  themeIsItalic = _ref.themeIsItalic;
8202
8226
  var baseFontWeight = FONTWEIGHT_MAP$1[themeFontWeight];
8203
8227
  var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(baseFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[baseFontWeight];
8228
+ var letterSpacing = LETTER_SPACING_MAP[themeFontWeight];
8204
8229
  return {
8205
8230
  fontSize: theme.__hd__.typography.fontSizes.caption,
8206
8231
  lineHeight: theme.__hd__.typography.lineHeights.caption,
8207
- letterSpacing: themeFontWeight === 'regular' ? 0.36 : 0.24,
8232
+ letterSpacing: letterSpacing,
8208
8233
  color: theme.__hd__.typography.colors[themeIntent],
8209
8234
  fontFamily: fontFamily
8210
8235
  };
@@ -8314,10 +8339,10 @@ var Caption = function Caption(_ref) {
8314
8339
  var StyledLabel$1 = index$c(Text$1)(function (_ref) {
8315
8340
  var themeIntent = _ref.themeIntent,
8316
8341
  theme = _ref.theme,
8317
- themeIsItalic = _ref.themeIsItalic;
8318
- // For Label, we assume 'regular' weight for base font family
8319
- var baseFontWeight = 'regular';
8320
- var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(baseFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[baseFontWeight];
8342
+ themeIsItalic = _ref.themeIsItalic,
8343
+ _ref$themeFontWeight = _ref.themeFontWeight,
8344
+ themeFontWeight = _ref$themeFontWeight === void 0 ? 'regular' : _ref$themeFontWeight;
8345
+ var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(themeFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[themeFontWeight];
8321
8346
  return {
8322
8347
  fontSize: theme.__hd__.typography.fontSizes.label,
8323
8348
  lineHeight: theme.__hd__.typography.lineHeights.label,
@@ -8327,7 +8352,7 @@ var StyledLabel$1 = index$c(Text$1)(function (_ref) {
8327
8352
  };
8328
8353
  });
8329
8354
 
8330
- var _excluded$N = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
8355
+ var _excluded$N = ["children", "intent", "allowFontScaling", "fontStyle", "fontWeight", "style", "testID"];
8331
8356
  var Label = function Label(_ref) {
8332
8357
  var children = _ref.children,
8333
8358
  _ref$intent = _ref.intent,
@@ -8336,6 +8361,8 @@ var Label = function Label(_ref) {
8336
8361
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8337
8362
  _ref$fontStyle = _ref.fontStyle,
8338
8363
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
8364
+ _ref$fontWeight = _ref.fontWeight,
8365
+ fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
8339
8366
  style = _ref.style,
8340
8367
  testID = _ref.testID,
8341
8368
  nativeProps = _objectWithoutProperties(_ref, _excluded$N);
@@ -8343,6 +8370,7 @@ var Label = function Label(_ref) {
8343
8370
  var styledText = /*#__PURE__*/React__default.createElement(StyledLabel$1, _extends$1({}, nativeProps, {
8344
8371
  themeIntent: isAi ? 'body' : intent,
8345
8372
  themeIsItalic: fontStyle === 'italic',
8373
+ themeFontWeight: fontWeight,
8346
8374
  allowFontScaling: allowFontScaling,
8347
8375
  style: style,
8348
8376
  testID: testID
@@ -8403,12 +8431,16 @@ var Title = function Title(_ref) {
8403
8431
  var FONTWEIGHT_MAP = {
8404
8432
  regular: 'regular',
8405
8433
  small: 'regular',
8434
+ 'regular-medium': 'medium',
8435
+ 'small-medium': 'medium',
8406
8436
  'regular-bold': 'semiBold',
8407
8437
  'small-bold': 'semiBold'
8408
8438
  };
8409
8439
  var FONTSIZE_MAP = {
8410
8440
  regular: 'regular',
8411
8441
  small: 'small',
8442
+ 'regular-medium': 'regular',
8443
+ 'small-medium': 'small',
8412
8444
  'regular-bold': 'regular',
8413
8445
  'small-bold': 'small'
8414
8446
  };
@@ -8418,12 +8450,12 @@ var StyledBody$2 = index$c(Text$1)(function (_ref) {
8418
8450
  themeTypeface = _ref.themeTypeface,
8419
8451
  themeVariant = _ref.themeVariant,
8420
8452
  themeIsItalic = _ref.themeIsItalic;
8421
- var baseFontWeight = FONTWEIGHT_MAP[themeVariant];
8422
- var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts[themeTypeface]["".concat(baseFontWeight, "Italic")] : theme.__hd__.typography.fonts[themeTypeface][baseFontWeight];
8453
+ var fontWeight = FONTWEIGHT_MAP[themeVariant];
8454
+ var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts[themeTypeface]["".concat(fontWeight, "Italic")] : theme.__hd__.typography.fonts[themeTypeface][fontWeight];
8423
8455
  return {
8424
8456
  fontSize: theme.__hd__.typography.fontSizes.body[themeTypeface][FONTSIZE_MAP[themeVariant]],
8425
8457
  lineHeight: theme.__hd__.typography.lineHeights.body[themeTypeface][FONTSIZE_MAP[themeVariant]],
8426
- letterSpacing: theme.__hd__.typography.letterSpacings.body[themeTypeface][FONTWEIGHT_MAP[themeVariant]],
8458
+ letterSpacing: theme.__hd__.typography.letterSpacings.body[themeTypeface][fontWeight],
8427
8459
  fontFamily: fontFamily,
8428
8460
  color: theme.__hd__.typography.colors[themeIntent]
8429
8461
  };
@@ -20652,6 +20684,24 @@ var index$9 = Object.assign(DefaultCheckbox, {
20652
20684
  Inline: InlineCheckbox
20653
20685
  });
20654
20686
 
20687
+ var genBorderWidth = function genBorderWidth(theme, themeState, themeFocused) {
20688
+ if (themeState === 'readonly') return 0;
20689
+ return themeFocused ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal;
20690
+ };
20691
+ var genBorderColor = function genBorderColor(theme, themeState, themeFocused, themeFilled) {
20692
+ var _theme$__hd__$textInp2;
20693
+ if (themeState === 'error' && !themeFilled) {
20694
+ return theme.__hd__.textInput.colors.borders["default"];
20695
+ }
20696
+ if (themeState === 'error' && themeFilled) {
20697
+ return theme.__hd__.textInput.colors.borders.error;
20698
+ }
20699
+ if (themeFocused) {
20700
+ var _theme$__hd__$textInp;
20701
+ return (_theme$__hd__$textInp = theme.__hd__.textInput.colors.borders.focused) !== null && _theme$__hd__$textInp !== void 0 ? _theme$__hd__$textInp : theme.__hd__.textInput.colors.borders["default"];
20702
+ }
20703
+ return (_theme$__hd__$textInp2 = theme.__hd__.textInput.colors.borders[themeState]) !== null && _theme$__hd__$textInp2 !== void 0 ? _theme$__hd__$textInp2 : theme.__hd__.textInput.colors.borders["default"];
20704
+ };
20655
20705
  var StyledContainer$7 = index$c(View)(function (_ref) {
20656
20706
  var theme = _ref.theme;
20657
20707
  return {
@@ -20661,16 +20711,15 @@ var StyledContainer$7 = index$c(View)(function (_ref) {
20661
20711
  });
20662
20712
  var StyledLabelContainerInsideTextInput = index$c(Animated.View)(function (_ref2) {
20663
20713
  var themeVariant = _ref2.themeVariant,
20664
- themeHasPrefix = _ref2.themeHasPrefix,
20665
20714
  theme = _ref2.theme;
20666
20715
  return {
20667
20716
  flexDirection: 'row',
20668
20717
  alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
20669
20718
  position: 'absolute',
20670
20719
  zIndex: 1,
20671
- left: themeHasPrefix ? theme.space.xxlarge : theme.space.medium + theme.space.small,
20720
+ left: 0,
20672
20721
  right: theme.space.medium,
20673
- top: -theme.__hd__.textInput.space.labelTop
20722
+ top: 0
20674
20723
  };
20675
20724
  });
20676
20725
  var StyledLabelInsideTextInput = index$c(View)(function (_ref3) {
@@ -20705,8 +20754,7 @@ var StyledErrorContainer$2 = index$c(View)(function (_ref5) {
20705
20754
  var StyledError = index$c(Typography.Caption)(function (_ref6) {
20706
20755
  var theme = _ref6.theme;
20707
20756
  return {
20708
- color: theme.__hd__.textInput.colors.error,
20709
- marginLeft: theme.__hd__.textInput.space.errorMarginLeft
20757
+ color: theme.__hd__.textInput.colors.error
20710
20758
  };
20711
20759
  });
20712
20760
  var StyledMaxLengthMessage = index$c(Typography.Caption)(function (_ref7) {
@@ -20728,7 +20776,7 @@ var StyledTextInput = index$c(TextInput$1)(function (_ref8) {
20728
20776
  fontSize: theme.__hd__.textInput.fontSizes.text,
20729
20777
  alignSelf: 'stretch',
20730
20778
  flexGrow: 2,
20731
- marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin,
20779
+ marginHorizontal: 0,
20732
20780
  paddingVertical: 0,
20733
20781
  maxHeight: theme.__hd__.textInput.sizes.textInputMaxHeight,
20734
20782
  height: themeVariant === 'text' ? undefined : theme.__hd__.textInput.sizes.textareaHeight,
@@ -20736,45 +20784,65 @@ var StyledTextInput = index$c(TextInput$1)(function (_ref8) {
20736
20784
  };
20737
20785
  });
20738
20786
  var StyledBorderBackDrop = index$c(View)(function (_ref9) {
20739
- var _theme$__hd__$textInp;
20740
20787
  var theme = _ref9.theme,
20741
20788
  themeFocused = _ref9.themeFocused,
20742
- themeState = _ref9.themeState;
20789
+ themeState = _ref9.themeState,
20790
+ themeFilled = _ref9.themeFilled;
20743
20791
  return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
20744
- borderWidth: themeFocused ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
20792
+ borderWidth: genBorderWidth(theme, themeState, themeFocused),
20745
20793
  borderRadius: theme.__hd__.textInput.radii.container,
20746
- 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"]
20794
+ borderColor: genBorderColor(theme, themeState, themeFocused, themeFilled)
20747
20795
  });
20748
20796
  });
20749
20797
  var StyledTextInputContainer = index$c(View)(function (_ref10) {
20750
- var theme = _ref10.theme;
20751
- return {
20798
+ var theme = _ref10.theme,
20799
+ themeVariant = _ref10.themeVariant,
20800
+ themeState = _ref10.themeState;
20801
+ return _objectSpread2(_objectSpread2(_objectSpread2({
20752
20802
  flexDirection: 'row',
20753
20803
  alignItems: 'center',
20754
- padding: theme.__hd__.textInput.space.containerPadding,
20755
- backgroundColor: theme.__hd__.textInput.colors.containerBackground,
20804
+ paddingHorizontal: theme.__hd__.textInput.space.containerHorizontalPadding,
20805
+ paddingVertical: theme.__hd__.textInput.space.containerVerticalPadding,
20756
20806
  borderRadius: theme.__hd__.textInput.radii.container
20757
- };
20807
+ }, themeVariant === 'text' && {
20808
+ minHeight: theme.__hd__.textInput.sizes.containerMinHeight
20809
+ }), themeState === 'disabled' && {
20810
+ opacity: 0.5
20811
+ }), {}, {
20812
+ gap: theme.space.smallMedium
20813
+ });
20758
20814
  });
20759
- var StyledTextInputAndLabelContainer = index$c(View)(function () {
20815
+ // Outer wrapper that owns flex-grow/shrink and provides the positioning context
20816
+ // for StyledLabelContainerInsideTextInput (position: absolute).
20817
+ var StyledInputContentContainer = index$c(View)(function (_ref11) {
20818
+ var themeHasLabel = _ref11.themeHasLabel;
20760
20819
  return {
20761
- flexDirection: 'row',
20762
- alignItems: 'center',
20763
- alignSelf: 'stretch',
20764
20820
  flexGrow: 2,
20765
- flexShrink: 1
20821
+ flexShrink: 1,
20822
+ alignSelf: 'stretch',
20823
+ justifyContent: themeHasLabel ? 'flex-start' : 'center'
20766
20824
  };
20767
20825
  });
20768
- var StyledErrorAndHelpTextContainer = index$c(View)(function (_ref11) {
20769
- var theme = _ref11.theme;
20826
+ var StyledTextInputAndLabelContainer = index$c(View)(function (_ref12) {
20827
+ var theme = _ref12.theme,
20828
+ themeHasLabel = _ref12.themeHasLabel;
20829
+ return _objectSpread2({
20830
+ flexDirection: 'row',
20831
+ alignItems: 'center',
20832
+ alignSelf: 'stretch'
20833
+ }, themeHasLabel && {
20834
+ paddingTop: theme.__hd__.textInput.space.inputAndLabelContainerPaddingTop
20835
+ });
20836
+ });
20837
+ var StyledErrorAndHelpTextContainer = index$c(View)(function (_ref13) {
20838
+ var theme = _ref13.theme;
20770
20839
  return {
20771
- paddingHorizontal: theme.__hd__.textInput.space.errorAndHelpTextContainerHorizontalPadding,
20772
- minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight,
20840
+ minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerMinHeight,
20773
20841
  paddingTop: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingTop
20774
20842
  };
20775
20843
  });
20776
- var StyledErrorAndMaxLengthContainer = index$c(View)(function (_ref12) {
20777
- var theme = _ref12.theme;
20844
+ var StyledErrorAndMaxLengthContainer = index$c(View)(function (_ref14) {
20845
+ var theme = _ref14.theme;
20778
20846
  return {
20779
20847
  flexDirection: 'row',
20780
20848
  justifyContent: 'space-between',
@@ -20811,12 +20879,7 @@ var LABEL_ANIMATION_DURATION = 150;
20811
20879
  var renderErrorOrHelpText = function renderErrorOrHelpText(_ref2) {
20812
20880
  var error = _ref2.error,
20813
20881
  helpText = _ref2.helpText;
20814
- return error ? /*#__PURE__*/React__default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default.createElement(Icon, {
20815
- testID: "input-error-icon",
20816
- icon: "circle-info",
20817
- size: "xsmall",
20818
- intent: "danger"
20819
- }), /*#__PURE__*/React__default.createElement(StyledError, {
20882
+ return error ? /*#__PURE__*/React__default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default.createElement(StyledError, {
20820
20883
  testID: "input-error-message"
20821
20884
  }, error)) : !!helpText && /*#__PURE__*/React__default.createElement(StyledHelperText, null, helpText);
20822
20885
  };
@@ -20846,7 +20909,7 @@ var renderSuffix$1 = function renderSuffix(_ref4) {
20846
20909
  suffix = _ref4.suffix;
20847
20910
  var actualSuffix = loading ? 'loading' : suffix;
20848
20911
  return typeof actualSuffix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
20849
- intent: state === 'disabled' ? 'disabled-text' : 'text',
20912
+ intent: state === 'disabled' ? 'disabled-text' : 'muted',
20850
20913
  testID: "input-suffix",
20851
20914
  icon: actualSuffix,
20852
20915
  spin: actualSuffix === 'loading',
@@ -20857,10 +20920,10 @@ var renderPrefix$1 = function renderPrefix(_ref5) {
20857
20920
  var state = _ref5.state,
20858
20921
  prefix = _ref5.prefix;
20859
20922
  return typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
20860
- intent: state === 'disabled' ? 'disabled-text' : 'text',
20923
+ intent: state === 'disabled' ? 'disabled-text' : 'muted',
20861
20924
  testID: "input-prefix",
20862
20925
  icon: prefix,
20863
- size: "xsmall"
20926
+ size: "medium"
20864
20927
  }) : prefix;
20865
20928
  };
20866
20929
  var renderMaxLengthMessage = function renderMaxLengthMessage(_ref6) {
@@ -20907,13 +20970,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
20907
20970
  nativeProps = _objectWithoutProperties(_ref8, _excluded$t);
20908
20971
  var displayText = getDisplayText(value, defaultValue);
20909
20972
  var isEmptyValue = displayText.length === 0;
20910
- var _React$useState = React__default.useState({
20911
- height: 0,
20912
- width: 0
20913
- }),
20973
+ var _React$useState = React__default.useState(0),
20914
20974
  _React$useState2 = _slicedToArray(_React$useState, 2),
20915
- inputSize = _React$useState2[0],
20916
- setInputSize = _React$useState2[1];
20975
+ containerHeight = _React$useState2[0],
20976
+ setContainerHeight = _React$useState2[1];
20917
20977
  var _React$useState3 = React__default.useState(false),
20918
20978
  _React$useState4 = _slicedToArray(_React$useState3, 2),
20919
20979
  isFocused = _React$useState4[0],
@@ -20935,18 +20995,14 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
20935
20995
  useNativeDriver: true
20936
20996
  }).start();
20937
20997
  }, [focusAnimation, isEmptyValue, isFocused]);
20938
- var onLayout = useCallback(function (event) {
20939
- var _event$nativeEvent$la = event.nativeEvent.layout,
20940
- height = _event$nativeEvent$la.height,
20941
- width = _event$nativeEvent$la.width;
20942
- setInputSize(function (prev) {
20943
- return _objectSpread2(_objectSpread2({}, prev), {}, {
20944
- height: height,
20945
- width: width
20946
- });
20947
- });
20948
- }, []);
20949
20998
  var innerTextInput = React__default.useRef(null);
20999
+ var focusInnerTextInput = useCallback(function () {
21000
+ var _innerTextInput$curre;
21001
+ return (_innerTextInput$curre = innerTextInput.current) === null || _innerTextInput$curre === void 0 ? void 0 : _innerTextInput$curre.focus();
21002
+ }, []);
21003
+ var onContentLayout = useCallback(function (e) {
21004
+ setContainerHeight(e.nativeEvent.layout.height);
21005
+ }, []);
20950
21006
  React__default.useImperativeHandle(ref, function () {
20951
21007
  return {
20952
21008
  // we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
@@ -20954,24 +21010,24 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
20954
21010
  return innerTextInput.current;
20955
21011
  },
20956
21012
  focus: function focus() {
20957
- var _innerTextInput$curre;
20958
- (_innerTextInput$curre = innerTextInput.current) === null || _innerTextInput$curre === void 0 || _innerTextInput$curre.focus();
21013
+ var _innerTextInput$curre2;
21014
+ (_innerTextInput$curre2 = innerTextInput.current) === null || _innerTextInput$curre2 === void 0 || _innerTextInput$curre2.focus();
20959
21015
  },
20960
21016
  clear: function clear() {
20961
- var _innerTextInput$curre2;
20962
- return (_innerTextInput$curre2 = innerTextInput.current) === null || _innerTextInput$curre2 === void 0 ? void 0 : _innerTextInput$curre2.clear();
21017
+ var _innerTextInput$curre3;
21018
+ return (_innerTextInput$curre3 = innerTextInput.current) === null || _innerTextInput$curre3 === void 0 ? void 0 : _innerTextInput$curre3.clear();
20963
21019
  },
20964
21020
  setNativeProps: function setNativeProps(args) {
20965
- var _innerTextInput$curre3;
20966
- return (_innerTextInput$curre3 = innerTextInput.current) === null || _innerTextInput$curre3 === void 0 ? void 0 : _innerTextInput$curre3.setNativeProps(args);
21021
+ var _innerTextInput$curre4;
21022
+ return (_innerTextInput$curre4 = innerTextInput.current) === null || _innerTextInput$curre4 === void 0 ? void 0 : _innerTextInput$curre4.setNativeProps(args);
20967
21023
  },
20968
21024
  isFocused: function isFocused() {
20969
- var _innerTextInput$curre4;
20970
- return ((_innerTextInput$curre4 = innerTextInput.current) === null || _innerTextInput$curre4 === void 0 ? void 0 : _innerTextInput$curre4.isFocused()) || false;
21025
+ var _innerTextInput$curre5;
21026
+ return ((_innerTextInput$curre5 = innerTextInput.current) === null || _innerTextInput$curre5 === void 0 ? void 0 : _innerTextInput$curre5.isFocused()) || false;
20971
21027
  },
20972
21028
  blur: function blur() {
20973
- var _innerTextInput$curre5;
20974
- return (_innerTextInput$curre5 = innerTextInput.current) === null || _innerTextInput$curre5 === void 0 ? void 0 : _innerTextInput$curre5.blur();
21029
+ var _innerTextInput$curre6;
21030
+ return (_innerTextInput$curre6 = innerTextInput.current) === null || _innerTextInput$curre6 === void 0 ? void 0 : _innerTextInput$curre6.blur();
20975
21031
  }
20976
21032
  };
20977
21033
  }, [innerTextInput]);
@@ -20990,26 +21046,28 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
20990
21046
  }, [textStyle]),
20991
21047
  borderStyle = _useMemo.borderStyle,
20992
21048
  textStyleWithoutBorderStyle = _useMemo.textStyleWithoutBorderStyle;
21049
+ var readonlyBackground = hexToRgba(theme.__hd__.textInput.colors.readonlyBackground, 0.7);
20993
21050
  var _useMemo2 = useMemo(function () {
20994
21051
  var _flattenTextStyle$bac;
21052
+ var defaultBackground = state === 'readonly' ? readonlyBackground : theme.__hd__.textInput.colors.containerBackground;
20995
21053
  if (!style) {
20996
21054
  return {
20997
- backgroundColor: theme.__hd__.textInput.colors.containerBackground
21055
+ backgroundColor: defaultBackground
20998
21056
  };
20999
21057
  }
21000
21058
  var flattenTextStyle = StyleSheet$1.flatten(style);
21001
21059
  return {
21002
- backgroundColor: (_flattenTextStyle$bac = flattenTextStyle.backgroundColor) !== null && _flattenTextStyle$bac !== void 0 ? _flattenTextStyle$bac : theme.__hd__.textInput.colors.containerBackground,
21060
+ backgroundColor: (_flattenTextStyle$bac = flattenTextStyle.backgroundColor) !== null && _flattenTextStyle$bac !== void 0 ? _flattenTextStyle$bac : defaultBackground,
21003
21061
  styleWithoutBackgroundColor: omit(['backgroundColor'], flattenTextStyle)
21004
21062
  };
21005
- }, [style, theme]),
21063
+ }, [style, theme, state, readonlyBackground]),
21006
21064
  backgroundColor = _useMemo2.backgroundColor,
21007
21065
  styleWithoutBackgroundColor = _useMemo2.styleWithoutBackgroundColor;
21008
21066
  var nativeInputTestIDSuffix = testID ? "-".concat(testID) : '';
21009
21067
  var nativeInputProps = _objectSpread2(_objectSpread2({
21010
21068
  style: StyleSheet$1.flatten([{
21011
21069
  backgroundColor: backgroundColor,
21012
- color: theme.__hd__.textInput.colors.text
21070
+ color: theme.__hd__.textInput.colors.text[state]
21013
21071
  }, textStyleWithoutBorderStyle]),
21014
21072
  testID: "text-input".concat(nativeInputTestIDSuffix),
21015
21073
  accessibilityState: {
@@ -21042,22 +21100,30 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21042
21100
  });
21043
21101
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
21044
21102
  style: styleWithoutBackgroundColor,
21045
- pointerEvents: state === 'disabled' || state === 'readonly' ? 'none' : 'auto',
21103
+ pointerEvents: state === 'disabled' || state === 'readonly' || loading ? 'none' : 'auto',
21046
21104
  testID: testID
21105
+ }, /*#__PURE__*/React__default.createElement(Pressable, {
21106
+ onPress: focusInnerTextInput,
21107
+ accessible: false,
21108
+ importantForAccessibility: "no"
21047
21109
  }, /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
21048
- onLayout: onLayout
21110
+ themeVariant: variant,
21111
+ themeState: state
21049
21112
  }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
21050
21113
  themeFocused: isFocused,
21051
21114
  themeState: state,
21115
+ themeFilled: !isEmptyValue,
21052
21116
  testID: "text-input-border",
21053
21117
  style: [{
21054
21118
  backgroundColor: backgroundColor
21055
21119
  }, borderStyle]
21056
- }), /*#__PURE__*/React__default.createElement(View, null, renderPrefix$1({
21120
+ }), prefix !== undefined && /*#__PURE__*/React__default.createElement(View, null, renderPrefix$1({
21057
21121
  state: state,
21058
21122
  prefix: prefix
21059
- })), /*#__PURE__*/React__default.createElement(StyledLabelContainerInsideTextInput, {
21060
- themeHasPrefix: !!prefix,
21123
+ })), /*#__PURE__*/React__default.createElement(StyledInputContentContainer, {
21124
+ themeHasLabel: !!label,
21125
+ onLayout: onContentLayout
21126
+ }, /*#__PURE__*/React__default.createElement(StyledLabelContainerInsideTextInput, {
21061
21127
  themeVariant: variant,
21062
21128
  pointerEvents: "none",
21063
21129
  style: [{
@@ -21066,7 +21132,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21066
21132
  transform: [{
21067
21133
  translateY: focusAnimation.interpolate({
21068
21134
  inputRange: [0, 1],
21069
- outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, theme.space.xsmall]
21135
+ outputRange: [variant !== 'textarea' ? Math.max(0, (containerHeight - theme.__hd__.textInput.lineHeights.label) / 2) : theme.__hd__.textInput.space.textareaLabelIdleTranslateY, 0]
21070
21136
  })
21071
21137
  }, {
21072
21138
  scale: focusAnimation.interpolate({
@@ -21090,8 +21156,11 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21090
21156
  testID: "input-label-asterisk"
21091
21157
  }, "*"), /*#__PURE__*/React__default.createElement(Typography.Body, {
21092
21158
  testID: "input-label-text".concat(nativeInputTestIDSuffix),
21093
- numberOfLines: 1
21094
- }, label))), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, null, renderInput$1({
21159
+ numberOfLines: 1,
21160
+ intent: "muted"
21161
+ }, label))), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, {
21162
+ themeHasLabel: !!label
21163
+ }, renderInput$1({
21095
21164
  variant: variant,
21096
21165
  nativeInputProps: nativeInputProps,
21097
21166
  renderInputValue: renderInputValue,
@@ -21100,11 +21169,11 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21100
21169
  },
21101
21170
  theme: theme,
21102
21171
  state: state
21103
- })), renderSuffix$1({
21172
+ }))), renderSuffix$1({
21104
21173
  state: state,
21105
21174
  loading: loading,
21106
21175
  suffix: suffix
21107
- })), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21176
+ }))), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21108
21177
  error: error,
21109
21178
  helpText: helpText
21110
21179
  }), renderMaxLengthMessage({
@@ -41334,13 +41403,10 @@ var RichTextEditor = function RichTextEditor(_ref) {
41334
41403
  }
41335
41404
  return 'default';
41336
41405
  }, [isFocused, error, isEmptyValue]);
41337
- var _React$useState = React__default.useState({
41338
- height: 0,
41339
- width: 0
41340
- }),
41406
+ var _React$useState = React__default.useState(0),
41341
41407
  _React$useState2 = _slicedToArray(_React$useState, 2),
41342
- inputSize = _React$useState2[0],
41343
- setInputSize = _React$useState2[1];
41408
+ containerHeight = _React$useState2[0],
41409
+ setContainerHeight = _React$useState2[1];
41344
41410
  var focusAnimation = useRef(new Animated.Value(0)).current;
41345
41411
  useEffect(function () {
41346
41412
  Animated.timing(focusAnimation, {
@@ -41351,16 +41417,9 @@ var RichTextEditor = function RichTextEditor(_ref) {
41351
41417
  }).start();
41352
41418
  }, [focusAnimation, isEmptyValue, isFocused]);
41353
41419
  var onLayout = useCallback(function (event) {
41354
- var _event$nativeEvent$la = event.nativeEvent.layout,
41355
- height = _event$nativeEvent$la.height,
41356
- width = _event$nativeEvent$la.width;
41357
- setInputSize(function (prev) {
41358
- return _objectSpread2(_objectSpread2({}, prev), {}, {
41359
- height: height,
41360
- width: width
41361
- });
41362
- });
41420
+ setContainerHeight(event.nativeEvent.layout.height);
41363
41421
  }, []);
41422
+ var backgroundColor = theme.__hd__.textInput.colors.containerBackground;
41364
41423
  var handleEditorFocus = useCallback(function () {
41365
41424
  onFocus === null || onFocus === void 0 || onFocus();
41366
41425
  setIsFocused(true);
@@ -41371,8 +41430,20 @@ var RichTextEditor = function RichTextEditor(_ref) {
41371
41430
  }, [onBlur]);
41372
41431
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
41373
41432
  testID: testID
41433
+ }, /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
41434
+ onLayout: onLayout,
41435
+ themeVariant: "text",
41436
+ themeState: state
41437
+ }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
41438
+ themeState: state,
41439
+ themeFocused: isFocused,
41440
+ themeFilled: !isEmptyValue,
41441
+ style: {
41442
+ backgroundColor: backgroundColor
41443
+ }
41444
+ }), /*#__PURE__*/React__default.createElement(StyledInputContentContainer, {
41445
+ themeHasLabel: !!label
41374
41446
  }, /*#__PURE__*/React__default.createElement(StyledLabelContainerInsideTextInput, {
41375
- themeHasPrefix: false,
41376
41447
  themeVariant: "text",
41377
41448
  pointerEvents: "none",
41378
41449
  testID: "input-label-container",
@@ -41382,7 +41453,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
41382
41453
  transform: [{
41383
41454
  translateY: focusAnimation.interpolate({
41384
41455
  inputRange: [0, 1],
41385
- outputRange: [inputSize.height / 2, theme.space.xsmall]
41456
+ outputRange: [Math.max(0, (containerHeight - theme.__hd__.textInput.lineHeights.label) / 2), theme.__hd__.textInput.space.labelFocusedTranslateY]
41386
41457
  })
41387
41458
  }, {
41388
41459
  scale: focusAnimation.interpolate({
@@ -41403,13 +41474,11 @@ var RichTextEditor = function RichTextEditor(_ref) {
41403
41474
  },
41404
41475
  themeState: state
41405
41476
  }, "*"), /*#__PURE__*/React__default.createElement(Typography.Body, {
41477
+ intent: "muted",
41406
41478
  numberOfLines: 1
41407
- }, label))), /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
41408
- onLayout: onLayout
41409
- }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
41410
- themeState: state,
41411
- themeFocused: isFocused
41412
- }), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React__default.createElement(RichTextEditorInput, {
41479
+ }, label))), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, {
41480
+ themeHasLabel: !!label
41481
+ }, /*#__PURE__*/React__default.createElement(RichTextEditorInput, {
41413
41482
  name: name,
41414
41483
  value: value,
41415
41484
  style: [style, {
@@ -41423,12 +41492,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
41423
41492
  onBlur: handleEditorBlur,
41424
41493
  onFocus: handleEditorFocus,
41425
41494
  onCursorChange: onCursorChange
41426
- }))), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default.createElement(Icon, {
41427
- testID: "input-error-icon",
41428
- icon: "circle-info",
41429
- size: "xsmall",
41430
- intent: "danger"
41431
- }), /*#__PURE__*/React__default.createElement(StyledError, {
41495
+ })))), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default.createElement(StyledError, {
41432
41496
  testID: "input-error-message"
41433
41497
  }, error)) : !!helpText && /*#__PURE__*/React__default.createElement(StyledHelperText, null, helpText))));
41434
41498
  };
@@ -41666,7 +41730,7 @@ var StyledInput = index$c(TextInput$1)(function (_ref4) {
41666
41730
  return {
41667
41731
  textAlignVertical: 'center',
41668
41732
  fontSize: theme.__hd__.search.fontSizes.text,
41669
- color: theme.__hd__.textInput.colors.text,
41733
+ color: theme.__hd__.textInput.colors.text["default"],
41670
41734
  alignSelf: 'stretch',
41671
41735
  flexGrow: 1,
41672
41736
  flexShrink: 1,