@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/lib/index.js CHANGED
@@ -5206,6 +5206,8 @@ var getFonts = function getFonts(_ref) {
5206
5206
  lightItalic: "".concat(neutral, "-LightItalic"),
5207
5207
  regular: "".concat(neutral, "-Regular"),
5208
5208
  regularItalic: "".concat(neutral, "-RegularItalic"),
5209
+ medium: "".concat(neutral, "-Medium"),
5210
+ mediumItalic: "".concat(neutral, "-MediumItalic"),
5209
5211
  semiBold: "".concat(neutral, "-SemiBold"),
5210
5212
  semiBoldItalic: "".concat(neutral, "-SemiBoldItalic")
5211
5213
  },
@@ -5214,6 +5216,8 @@ var getFonts = function getFonts(_ref) {
5214
5216
  lightItalic: "".concat(playful, "-LightItalic"),
5215
5217
  regular: "".concat(playful, "-Regular"),
5216
5218
  regularItalic: "".concat(playful, "-RegularItalic"),
5219
+ medium: "".concat(playful, "-Regular"),
5220
+ mediumItalic: "".concat(playful, "-RegularItalic"),
5217
5221
  semiBold: "".concat(playful, "-Medium"),
5218
5222
  semiBoldItalic: "".concat(playful, "-MediumItalic")
5219
5223
  }
@@ -7241,33 +7245,41 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7241
7245
  asterisks: {
7242
7246
  "default": theme.colors.onErrorSurface,
7243
7247
  error: theme.colors.onErrorSurface,
7244
- disabled: theme.colors.disabledOnDefaultGlobalSurface,
7245
- readonly: theme.colors.inactiveOnDefaultGlobalSurface,
7248
+ disabled: theme.colors.onErrorSurface,
7249
+ readonly: theme.colors.onErrorSurface,
7246
7250
  filled: theme.colors.onErrorSurface
7247
7251
  },
7248
7252
  error: theme.colors.onErrorSurface,
7249
- text: theme.colors.onDefaultGlobalSurface,
7253
+ text: {
7254
+ "default": theme.colors.onDefaultGlobalSurface,
7255
+ filled: theme.colors.onDefaultGlobalSurface,
7256
+ error: theme.colors.onDefaultGlobalSurface,
7257
+ readonly: theme.colors.mutedOnDefaultGlobalSurface,
7258
+ disabled: theme.colors.mutedOnDefaultGlobalSurface
7259
+ },
7250
7260
  borders: {
7251
- "default": theme.colors.primaryOutline,
7261
+ "default": theme.colors.inactiveOutline,
7252
7262
  error: theme.colors.onErrorSurface,
7253
- disabled: theme.colors.disabledOutline,
7263
+ disabled: theme.colors.inactiveOutline,
7254
7264
  readonly: theme.colors.inactiveOutline,
7255
- filled: theme.colors.primaryOutline
7265
+ filled: theme.colors.inactiveOutline,
7266
+ focused: theme.colors.primaryOutline
7256
7267
  },
7257
7268
  labels: {
7258
- "default": theme.colors.onDefaultGlobalSurface,
7269
+ "default": theme.colors.mutedOnDefaultGlobalSurface,
7259
7270
  error: theme.colors.onDefaultGlobalSurface,
7260
7271
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
7261
7272
  readonly: theme.colors.mutedOnDefaultGlobalSurface,
7262
- filled: theme.colors.onDefaultGlobalSurface
7273
+ filled: theme.colors.mutedOnDefaultGlobalSurface
7263
7274
  },
7264
7275
  labelsInsideTextInput: {
7265
- "default": theme.colors.onDefaultGlobalSurface,
7276
+ "default": theme.colors.mutedOnDefaultGlobalSurface,
7266
7277
  error: theme.colors.onDefaultGlobalSurface,
7267
7278
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
7268
- readonly: theme.colors.inactiveOnDefaultGlobalSurface,
7269
- filled: theme.colors.onDefaultGlobalSurface
7279
+ readonly: theme.colors.mutedOnDefaultGlobalSurface,
7280
+ filled: theme.colors.mutedOnDefaultGlobalSurface
7270
7281
  },
7282
+ readonlyBackground: theme.colors.neutralGlobalSurface,
7271
7283
  maxLengthLabels: {
7272
7284
  "default": theme.colors.onDefaultGlobalSurface,
7273
7285
  error: theme.colors.onErrorSurface,
@@ -7284,19 +7296,21 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7284
7296
  }
7285
7297
  };
7286
7298
  var space = {
7287
- containerPadding: theme.space.medium,
7299
+ containerHorizontalPadding: theme.space.medium,
7300
+ containerVerticalPadding: theme.space.small,
7288
7301
  labelLeft: theme.space.xlarge,
7289
7302
  labelTop: theme.space.xlarge / 3,
7290
7303
  labelPaddingBottom: theme.space.small,
7291
7304
  labelHorizontalPadding: theme.space.xsmall,
7292
- inputHorizontalMargin: theme.space.small,
7305
+ inputHorizontalMargin: theme.space.smallMedium,
7293
7306
  errorContainerMarginRight: theme.space.xsmall,
7294
7307
  errorAndHelpTextContainerMarginTop: theme.space.xxsmall,
7295
- errorMarginLeft: theme.space.xsmall,
7296
- errorAndHelpTextContainerHorizontalPadding: theme.space.medium,
7297
7308
  containerMarginTop: theme.space.small,
7298
- labelInsideTextInputMarginTop: -theme.space.xxsmall,
7299
- errorAndHelpTextContainerPaddingTop: theme.space.xxsmall
7309
+ labelInsideTextInputMarginTop: 0,
7310
+ errorAndHelpTextContainerPaddingTop: theme.space.xxsmall,
7311
+ inputAndLabelContainerPaddingTop: theme.lineHeights.medium,
7312
+ labelFocusedTranslateY: theme.space.xsmall * 2,
7313
+ textareaLabelIdleTranslateY: theme.space.large
7300
7314
  };
7301
7315
  var fonts = {
7302
7316
  text: theme.fonts.neutral.regular
@@ -7312,19 +7326,21 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7312
7326
  var borderWidths = {
7313
7327
  container: {
7314
7328
  normal: theme.borderWidths.base,
7315
- focused: theme.borderWidths.medium
7329
+ focused: theme.borderWidths.base
7316
7330
  }
7317
7331
  };
7318
7332
  var radii = {
7319
7333
  container: theme.radii.medium
7320
7334
  };
7321
7335
  var sizes = {
7322
- errorAndHelpTextContainerHeight: theme.sizes.medium,
7323
- textareaHeight: theme.sizes['15xlarge'],
7336
+ errorAndHelpTextContainerMinHeight: theme.space.large,
7337
+ containerMinHeight: scale(58),
7338
+ textareaHeight: scale(120),
7324
7339
  textInputMaxHeight: theme.sizes['15xlarge']
7325
7340
  };
7326
7341
  var lineHeights = {
7327
- topLabel: theme.lineHeights.large / 2
7342
+ topLabel: theme.lineHeights.large / 2,
7343
+ label: theme.lineHeights.large
7328
7344
  };
7329
7345
  return {
7330
7346
  colors: colors,
@@ -7575,11 +7591,13 @@ var getTypographyTheme = function getTypographyTheme(theme) {
7575
7591
  body: {
7576
7592
  neutral: {
7577
7593
  semiBold: 0.24,
7594
+ medium: 0.3,
7578
7595
  regular: 0.48,
7579
7596
  small: 0.48
7580
7597
  },
7581
7598
  playful: {
7582
7599
  semiBold: 0.54,
7600
+ medium: 0.54,
7583
7601
  regular: 0.54,
7584
7602
  small: 0.54
7585
7603
  }
@@ -8221,9 +8239,15 @@ var Text = function Text(_ref) {
8221
8239
  var FONTWEIGHT_MAP$1 = {
8222
8240
  light: 'light',
8223
8241
  regular: 'regular',
8242
+ medium: 'medium',
8224
8243
  'semi-bold': 'semiBold'
8225
8244
  };
8226
8245
 
8246
+ var LETTER_SPACING_MAP = {
8247
+ regular: 0.36,
8248
+ medium: 0.3,
8249
+ 'semi-bold': 0.24
8250
+ };
8227
8251
  var StyledCaption = index$c(reactNative.Text)(function (_ref) {
8228
8252
  var themeFontWeight = _ref.themeFontWeight,
8229
8253
  themeIntent = _ref.themeIntent,
@@ -8231,10 +8255,11 @@ var StyledCaption = index$c(reactNative.Text)(function (_ref) {
8231
8255
  themeIsItalic = _ref.themeIsItalic;
8232
8256
  var baseFontWeight = FONTWEIGHT_MAP$1[themeFontWeight];
8233
8257
  var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(baseFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[baseFontWeight];
8258
+ var letterSpacing = LETTER_SPACING_MAP[themeFontWeight];
8234
8259
  return {
8235
8260
  fontSize: theme.__hd__.typography.fontSizes.caption,
8236
8261
  lineHeight: theme.__hd__.typography.lineHeights.caption,
8237
- letterSpacing: themeFontWeight === 'regular' ? 0.36 : 0.24,
8262
+ letterSpacing: letterSpacing,
8238
8263
  color: theme.__hd__.typography.colors[themeIntent],
8239
8264
  fontFamily: fontFamily
8240
8265
  };
@@ -8344,10 +8369,10 @@ var Caption = function Caption(_ref) {
8344
8369
  var StyledLabel$1 = index$c(reactNative.Text)(function (_ref) {
8345
8370
  var themeIntent = _ref.themeIntent,
8346
8371
  theme = _ref.theme,
8347
- themeIsItalic = _ref.themeIsItalic;
8348
- // For Label, we assume 'regular' weight for base font family
8349
- var baseFontWeight = 'regular';
8350
- var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(baseFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[baseFontWeight];
8372
+ themeIsItalic = _ref.themeIsItalic,
8373
+ _ref$themeFontWeight = _ref.themeFontWeight,
8374
+ themeFontWeight = _ref$themeFontWeight === void 0 ? 'regular' : _ref$themeFontWeight;
8375
+ var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(themeFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[themeFontWeight];
8351
8376
  return {
8352
8377
  fontSize: theme.__hd__.typography.fontSizes.label,
8353
8378
  lineHeight: theme.__hd__.typography.lineHeights.label,
@@ -8357,7 +8382,7 @@ var StyledLabel$1 = index$c(reactNative.Text)(function (_ref) {
8357
8382
  };
8358
8383
  });
8359
8384
 
8360
- var _excluded$N = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
8385
+ var _excluded$N = ["children", "intent", "allowFontScaling", "fontStyle", "fontWeight", "style", "testID"];
8361
8386
  var Label = function Label(_ref) {
8362
8387
  var children = _ref.children,
8363
8388
  _ref$intent = _ref.intent,
@@ -8366,6 +8391,8 @@ var Label = function Label(_ref) {
8366
8391
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8367
8392
  _ref$fontStyle = _ref.fontStyle,
8368
8393
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
8394
+ _ref$fontWeight = _ref.fontWeight,
8395
+ fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
8369
8396
  style = _ref.style,
8370
8397
  testID = _ref.testID,
8371
8398
  nativeProps = _objectWithoutProperties(_ref, _excluded$N);
@@ -8373,6 +8400,7 @@ var Label = function Label(_ref) {
8373
8400
  var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledLabel$1, _extends$1({}, nativeProps, {
8374
8401
  themeIntent: isAi ? 'body' : intent,
8375
8402
  themeIsItalic: fontStyle === 'italic',
8403
+ themeFontWeight: fontWeight,
8376
8404
  allowFontScaling: allowFontScaling,
8377
8405
  style: style,
8378
8406
  testID: testID
@@ -8433,12 +8461,16 @@ var Title = function Title(_ref) {
8433
8461
  var FONTWEIGHT_MAP = {
8434
8462
  regular: 'regular',
8435
8463
  small: 'regular',
8464
+ 'regular-medium': 'medium',
8465
+ 'small-medium': 'medium',
8436
8466
  'regular-bold': 'semiBold',
8437
8467
  'small-bold': 'semiBold'
8438
8468
  };
8439
8469
  var FONTSIZE_MAP = {
8440
8470
  regular: 'regular',
8441
8471
  small: 'small',
8472
+ 'regular-medium': 'regular',
8473
+ 'small-medium': 'small',
8442
8474
  'regular-bold': 'regular',
8443
8475
  'small-bold': 'small'
8444
8476
  };
@@ -8448,12 +8480,12 @@ var StyledBody$2 = index$c(reactNative.Text)(function (_ref) {
8448
8480
  themeTypeface = _ref.themeTypeface,
8449
8481
  themeVariant = _ref.themeVariant,
8450
8482
  themeIsItalic = _ref.themeIsItalic;
8451
- var baseFontWeight = FONTWEIGHT_MAP[themeVariant];
8452
- var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts[themeTypeface]["".concat(baseFontWeight, "Italic")] : theme.__hd__.typography.fonts[themeTypeface][baseFontWeight];
8483
+ var fontWeight = FONTWEIGHT_MAP[themeVariant];
8484
+ var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts[themeTypeface]["".concat(fontWeight, "Italic")] : theme.__hd__.typography.fonts[themeTypeface][fontWeight];
8453
8485
  return {
8454
8486
  fontSize: theme.__hd__.typography.fontSizes.body[themeTypeface][FONTSIZE_MAP[themeVariant]],
8455
8487
  lineHeight: theme.__hd__.typography.lineHeights.body[themeTypeface][FONTSIZE_MAP[themeVariant]],
8456
- letterSpacing: theme.__hd__.typography.letterSpacings.body[themeTypeface][FONTWEIGHT_MAP[themeVariant]],
8488
+ letterSpacing: theme.__hd__.typography.letterSpacings.body[themeTypeface][fontWeight],
8457
8489
  fontFamily: fontFamily,
8458
8490
  color: theme.__hd__.typography.colors[themeIntent]
8459
8491
  };
@@ -20682,6 +20714,24 @@ var index$9 = Object.assign(DefaultCheckbox, {
20682
20714
  Inline: InlineCheckbox
20683
20715
  });
20684
20716
 
20717
+ var genBorderWidth = function genBorderWidth(theme, themeState, themeFocused) {
20718
+ if (themeState === 'readonly') return 0;
20719
+ return themeFocused ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal;
20720
+ };
20721
+ var genBorderColor = function genBorderColor(theme, themeState, themeFocused, themeFilled) {
20722
+ var _theme$__hd__$textInp2;
20723
+ if (themeState === 'error' && !themeFilled) {
20724
+ return theme.__hd__.textInput.colors.borders["default"];
20725
+ }
20726
+ if (themeState === 'error' && themeFilled) {
20727
+ return theme.__hd__.textInput.colors.borders.error;
20728
+ }
20729
+ if (themeFocused) {
20730
+ var _theme$__hd__$textInp;
20731
+ 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"];
20732
+ }
20733
+ 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"];
20734
+ };
20685
20735
  var StyledContainer$7 = index$c(reactNative.View)(function (_ref) {
20686
20736
  var theme = _ref.theme;
20687
20737
  return {
@@ -20691,16 +20741,15 @@ var StyledContainer$7 = index$c(reactNative.View)(function (_ref) {
20691
20741
  });
20692
20742
  var StyledLabelContainerInsideTextInput = index$c(reactNative.Animated.View)(function (_ref2) {
20693
20743
  var themeVariant = _ref2.themeVariant,
20694
- themeHasPrefix = _ref2.themeHasPrefix,
20695
20744
  theme = _ref2.theme;
20696
20745
  return {
20697
20746
  flexDirection: 'row',
20698
20747
  alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
20699
20748
  position: 'absolute',
20700
20749
  zIndex: 1,
20701
- left: themeHasPrefix ? theme.space.xxlarge : theme.space.medium + theme.space.small,
20750
+ left: 0,
20702
20751
  right: theme.space.medium,
20703
- top: -theme.__hd__.textInput.space.labelTop
20752
+ top: 0
20704
20753
  };
20705
20754
  });
20706
20755
  var StyledLabelInsideTextInput = index$c(reactNative.View)(function (_ref3) {
@@ -20735,8 +20784,7 @@ var StyledErrorContainer$2 = index$c(reactNative.View)(function (_ref5) {
20735
20784
  var StyledError = index$c(Typography.Caption)(function (_ref6) {
20736
20785
  var theme = _ref6.theme;
20737
20786
  return {
20738
- color: theme.__hd__.textInput.colors.error,
20739
- marginLeft: theme.__hd__.textInput.space.errorMarginLeft
20787
+ color: theme.__hd__.textInput.colors.error
20740
20788
  };
20741
20789
  });
20742
20790
  var StyledMaxLengthMessage = index$c(Typography.Caption)(function (_ref7) {
@@ -20758,7 +20806,7 @@ var StyledTextInput = index$c(reactNative.TextInput)(function (_ref8) {
20758
20806
  fontSize: theme.__hd__.textInput.fontSizes.text,
20759
20807
  alignSelf: 'stretch',
20760
20808
  flexGrow: 2,
20761
- marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin,
20809
+ marginHorizontal: 0,
20762
20810
  paddingVertical: 0,
20763
20811
  maxHeight: theme.__hd__.textInput.sizes.textInputMaxHeight,
20764
20812
  height: themeVariant === 'text' ? undefined : theme.__hd__.textInput.sizes.textareaHeight,
@@ -20766,45 +20814,65 @@ var StyledTextInput = index$c(reactNative.TextInput)(function (_ref8) {
20766
20814
  };
20767
20815
  });
20768
20816
  var StyledBorderBackDrop = index$c(reactNative.View)(function (_ref9) {
20769
- var _theme$__hd__$textInp;
20770
20817
  var theme = _ref9.theme,
20771
20818
  themeFocused = _ref9.themeFocused,
20772
- themeState = _ref9.themeState;
20819
+ themeState = _ref9.themeState,
20820
+ themeFilled = _ref9.themeFilled;
20773
20821
  return _objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
20774
- borderWidth: themeFocused ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
20822
+ borderWidth: genBorderWidth(theme, themeState, themeFocused),
20775
20823
  borderRadius: theme.__hd__.textInput.radii.container,
20776
- 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"]
20824
+ borderColor: genBorderColor(theme, themeState, themeFocused, themeFilled)
20777
20825
  });
20778
20826
  });
20779
20827
  var StyledTextInputContainer = index$c(reactNative.View)(function (_ref10) {
20780
- var theme = _ref10.theme;
20781
- return {
20828
+ var theme = _ref10.theme,
20829
+ themeVariant = _ref10.themeVariant,
20830
+ themeState = _ref10.themeState;
20831
+ return _objectSpread2(_objectSpread2(_objectSpread2({
20782
20832
  flexDirection: 'row',
20783
20833
  alignItems: 'center',
20784
- padding: theme.__hd__.textInput.space.containerPadding,
20785
- backgroundColor: theme.__hd__.textInput.colors.containerBackground,
20834
+ paddingHorizontal: theme.__hd__.textInput.space.containerHorizontalPadding,
20835
+ paddingVertical: theme.__hd__.textInput.space.containerVerticalPadding,
20786
20836
  borderRadius: theme.__hd__.textInput.radii.container
20787
- };
20837
+ }, themeVariant === 'text' && {
20838
+ minHeight: theme.__hd__.textInput.sizes.containerMinHeight
20839
+ }), themeState === 'disabled' && {
20840
+ opacity: 0.5
20841
+ }), {}, {
20842
+ gap: theme.space.smallMedium
20843
+ });
20788
20844
  });
20789
- var StyledTextInputAndLabelContainer = index$c(reactNative.View)(function () {
20845
+ // Outer wrapper that owns flex-grow/shrink and provides the positioning context
20846
+ // for StyledLabelContainerInsideTextInput (position: absolute).
20847
+ var StyledInputContentContainer = index$c(reactNative.View)(function (_ref11) {
20848
+ var themeHasLabel = _ref11.themeHasLabel;
20790
20849
  return {
20791
- flexDirection: 'row',
20792
- alignItems: 'center',
20793
- alignSelf: 'stretch',
20794
20850
  flexGrow: 2,
20795
- flexShrink: 1
20851
+ flexShrink: 1,
20852
+ alignSelf: 'stretch',
20853
+ justifyContent: themeHasLabel ? 'flex-start' : 'center'
20796
20854
  };
20797
20855
  });
20798
- var StyledErrorAndHelpTextContainer = index$c(reactNative.View)(function (_ref11) {
20799
- var theme = _ref11.theme;
20856
+ var StyledTextInputAndLabelContainer = index$c(reactNative.View)(function (_ref12) {
20857
+ var theme = _ref12.theme,
20858
+ themeHasLabel = _ref12.themeHasLabel;
20859
+ return _objectSpread2({
20860
+ flexDirection: 'row',
20861
+ alignItems: 'center',
20862
+ alignSelf: 'stretch'
20863
+ }, themeHasLabel && {
20864
+ paddingTop: theme.__hd__.textInput.space.inputAndLabelContainerPaddingTop
20865
+ });
20866
+ });
20867
+ var StyledErrorAndHelpTextContainer = index$c(reactNative.View)(function (_ref13) {
20868
+ var theme = _ref13.theme;
20800
20869
  return {
20801
- paddingHorizontal: theme.__hd__.textInput.space.errorAndHelpTextContainerHorizontalPadding,
20802
- minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight,
20870
+ minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerMinHeight,
20803
20871
  paddingTop: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingTop
20804
20872
  };
20805
20873
  });
20806
- var StyledErrorAndMaxLengthContainer = index$c(reactNative.View)(function (_ref12) {
20807
- var theme = _ref12.theme;
20874
+ var StyledErrorAndMaxLengthContainer = index$c(reactNative.View)(function (_ref14) {
20875
+ var theme = _ref14.theme;
20808
20876
  return {
20809
20877
  flexDirection: 'row',
20810
20878
  justifyContent: 'space-between',
@@ -20841,12 +20909,7 @@ var LABEL_ANIMATION_DURATION = 150;
20841
20909
  var renderErrorOrHelpText = function renderErrorOrHelpText(_ref2) {
20842
20910
  var error = _ref2.error,
20843
20911
  helpText = _ref2.helpText;
20844
- return error ? /*#__PURE__*/React__namespace.default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(Icon, {
20845
- testID: "input-error-icon",
20846
- icon: "circle-info",
20847
- size: "xsmall",
20848
- intent: "danger"
20849
- }), /*#__PURE__*/React__namespace.default.createElement(StyledError, {
20912
+ return error ? /*#__PURE__*/React__namespace.default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(StyledError, {
20850
20913
  testID: "input-error-message"
20851
20914
  }, error)) : !!helpText && /*#__PURE__*/React__namespace.default.createElement(StyledHelperText, null, helpText);
20852
20915
  };
@@ -20876,7 +20939,7 @@ var renderSuffix$1 = function renderSuffix(_ref4) {
20876
20939
  suffix = _ref4.suffix;
20877
20940
  var actualSuffix = loading ? 'loading' : suffix;
20878
20941
  return typeof actualSuffix === 'string' ? /*#__PURE__*/React__namespace.default.createElement(Icon, {
20879
- intent: state === 'disabled' ? 'disabled-text' : 'text',
20942
+ intent: state === 'disabled' ? 'disabled-text' : 'muted',
20880
20943
  testID: "input-suffix",
20881
20944
  icon: actualSuffix,
20882
20945
  spin: actualSuffix === 'loading',
@@ -20887,10 +20950,10 @@ var renderPrefix$1 = function renderPrefix(_ref5) {
20887
20950
  var state = _ref5.state,
20888
20951
  prefix = _ref5.prefix;
20889
20952
  return typeof prefix === 'string' ? /*#__PURE__*/React__namespace.default.createElement(Icon, {
20890
- intent: state === 'disabled' ? 'disabled-text' : 'text',
20953
+ intent: state === 'disabled' ? 'disabled-text' : 'muted',
20891
20954
  testID: "input-prefix",
20892
20955
  icon: prefix,
20893
- size: "xsmall"
20956
+ size: "medium"
20894
20957
  }) : prefix;
20895
20958
  };
20896
20959
  var renderMaxLengthMessage = function renderMaxLengthMessage(_ref6) {
@@ -20937,13 +21000,10 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
20937
21000
  nativeProps = _objectWithoutProperties(_ref8, _excluded$t);
20938
21001
  var displayText = getDisplayText(value, defaultValue);
20939
21002
  var isEmptyValue = displayText.length === 0;
20940
- var _React$useState = React__namespace.default.useState({
20941
- height: 0,
20942
- width: 0
20943
- }),
21003
+ var _React$useState = React__namespace.default.useState(0),
20944
21004
  _React$useState2 = _slicedToArray(_React$useState, 2),
20945
- inputSize = _React$useState2[0],
20946
- setInputSize = _React$useState2[1];
21005
+ containerHeight = _React$useState2[0],
21006
+ setContainerHeight = _React$useState2[1];
20947
21007
  var _React$useState3 = React__namespace.default.useState(false),
20948
21008
  _React$useState4 = _slicedToArray(_React$useState3, 2),
20949
21009
  isFocused = _React$useState4[0],
@@ -20965,18 +21025,14 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
20965
21025
  useNativeDriver: true
20966
21026
  }).start();
20967
21027
  }, [focusAnimation, isEmptyValue, isFocused]);
20968
- var onLayout = React.useCallback(function (event) {
20969
- var _event$nativeEvent$la = event.nativeEvent.layout,
20970
- height = _event$nativeEvent$la.height,
20971
- width = _event$nativeEvent$la.width;
20972
- setInputSize(function (prev) {
20973
- return _objectSpread2(_objectSpread2({}, prev), {}, {
20974
- height: height,
20975
- width: width
20976
- });
20977
- });
20978
- }, []);
20979
21028
  var innerTextInput = React__namespace.default.useRef(null);
21029
+ var focusInnerTextInput = React.useCallback(function () {
21030
+ var _innerTextInput$curre;
21031
+ return (_innerTextInput$curre = innerTextInput.current) === null || _innerTextInput$curre === void 0 ? void 0 : _innerTextInput$curre.focus();
21032
+ }, []);
21033
+ var onContentLayout = React.useCallback(function (e) {
21034
+ setContainerHeight(e.nativeEvent.layout.height);
21035
+ }, []);
20980
21036
  React__namespace.default.useImperativeHandle(ref, function () {
20981
21037
  return {
20982
21038
  // we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
@@ -20984,24 +21040,24 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
20984
21040
  return innerTextInput.current;
20985
21041
  },
20986
21042
  focus: function focus() {
20987
- var _innerTextInput$curre;
20988
- (_innerTextInput$curre = innerTextInput.current) === null || _innerTextInput$curre === void 0 || _innerTextInput$curre.focus();
21043
+ var _innerTextInput$curre2;
21044
+ (_innerTextInput$curre2 = innerTextInput.current) === null || _innerTextInput$curre2 === void 0 || _innerTextInput$curre2.focus();
20989
21045
  },
20990
21046
  clear: function clear() {
20991
- var _innerTextInput$curre2;
20992
- return (_innerTextInput$curre2 = innerTextInput.current) === null || _innerTextInput$curre2 === void 0 ? void 0 : _innerTextInput$curre2.clear();
21047
+ var _innerTextInput$curre3;
21048
+ return (_innerTextInput$curre3 = innerTextInput.current) === null || _innerTextInput$curre3 === void 0 ? void 0 : _innerTextInput$curre3.clear();
20993
21049
  },
20994
21050
  setNativeProps: function setNativeProps(args) {
20995
- var _innerTextInput$curre3;
20996
- return (_innerTextInput$curre3 = innerTextInput.current) === null || _innerTextInput$curre3 === void 0 ? void 0 : _innerTextInput$curre3.setNativeProps(args);
21051
+ var _innerTextInput$curre4;
21052
+ return (_innerTextInput$curre4 = innerTextInput.current) === null || _innerTextInput$curre4 === void 0 ? void 0 : _innerTextInput$curre4.setNativeProps(args);
20997
21053
  },
20998
21054
  isFocused: function isFocused() {
20999
- var _innerTextInput$curre4;
21000
- return ((_innerTextInput$curre4 = innerTextInput.current) === null || _innerTextInput$curre4 === void 0 ? void 0 : _innerTextInput$curre4.isFocused()) || false;
21055
+ var _innerTextInput$curre5;
21056
+ return ((_innerTextInput$curre5 = innerTextInput.current) === null || _innerTextInput$curre5 === void 0 ? void 0 : _innerTextInput$curre5.isFocused()) || false;
21001
21057
  },
21002
21058
  blur: function blur() {
21003
- var _innerTextInput$curre5;
21004
- return (_innerTextInput$curre5 = innerTextInput.current) === null || _innerTextInput$curre5 === void 0 ? void 0 : _innerTextInput$curre5.blur();
21059
+ var _innerTextInput$curre6;
21060
+ return (_innerTextInput$curre6 = innerTextInput.current) === null || _innerTextInput$curre6 === void 0 ? void 0 : _innerTextInput$curre6.blur();
21005
21061
  }
21006
21062
  };
21007
21063
  }, [innerTextInput]);
@@ -21020,26 +21076,28 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21020
21076
  }, [textStyle]),
21021
21077
  borderStyle = _useMemo.borderStyle,
21022
21078
  textStyleWithoutBorderStyle = _useMemo.textStyleWithoutBorderStyle;
21079
+ var readonlyBackground = hexToRgba(theme.__hd__.textInput.colors.readonlyBackground, 0.7);
21023
21080
  var _useMemo2 = React.useMemo(function () {
21024
21081
  var _flattenTextStyle$bac;
21082
+ var defaultBackground = state === 'readonly' ? readonlyBackground : theme.__hd__.textInput.colors.containerBackground;
21025
21083
  if (!style) {
21026
21084
  return {
21027
- backgroundColor: theme.__hd__.textInput.colors.containerBackground
21085
+ backgroundColor: defaultBackground
21028
21086
  };
21029
21087
  }
21030
21088
  var flattenTextStyle = reactNative.StyleSheet.flatten(style);
21031
21089
  return {
21032
- backgroundColor: (_flattenTextStyle$bac = flattenTextStyle.backgroundColor) !== null && _flattenTextStyle$bac !== void 0 ? _flattenTextStyle$bac : theme.__hd__.textInput.colors.containerBackground,
21090
+ backgroundColor: (_flattenTextStyle$bac = flattenTextStyle.backgroundColor) !== null && _flattenTextStyle$bac !== void 0 ? _flattenTextStyle$bac : defaultBackground,
21033
21091
  styleWithoutBackgroundColor: omit(['backgroundColor'], flattenTextStyle)
21034
21092
  };
21035
- }, [style, theme]),
21093
+ }, [style, theme, state, readonlyBackground]),
21036
21094
  backgroundColor = _useMemo2.backgroundColor,
21037
21095
  styleWithoutBackgroundColor = _useMemo2.styleWithoutBackgroundColor;
21038
21096
  var nativeInputTestIDSuffix = testID ? "-".concat(testID) : '';
21039
21097
  var nativeInputProps = _objectSpread2(_objectSpread2({
21040
21098
  style: reactNative.StyleSheet.flatten([{
21041
21099
  backgroundColor: backgroundColor,
21042
- color: theme.__hd__.textInput.colors.text
21100
+ color: theme.__hd__.textInput.colors.text[state]
21043
21101
  }, textStyleWithoutBorderStyle]),
21044
21102
  testID: "text-input".concat(nativeInputTestIDSuffix),
21045
21103
  accessibilityState: {
@@ -21072,22 +21130,30 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21072
21130
  });
21073
21131
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
21074
21132
  style: styleWithoutBackgroundColor,
21075
- pointerEvents: state === 'disabled' || state === 'readonly' ? 'none' : 'auto',
21133
+ pointerEvents: state === 'disabled' || state === 'readonly' || loading ? 'none' : 'auto',
21076
21134
  testID: testID
21135
+ }, /*#__PURE__*/React__namespace.default.createElement(reactNative.Pressable, {
21136
+ onPress: focusInnerTextInput,
21137
+ accessible: false,
21138
+ importantForAccessibility: "no"
21077
21139
  }, /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
21078
- onLayout: onLayout
21140
+ themeVariant: variant,
21141
+ themeState: state
21079
21142
  }, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
21080
21143
  themeFocused: isFocused,
21081
21144
  themeState: state,
21145
+ themeFilled: !isEmptyValue,
21082
21146
  testID: "text-input-border",
21083
21147
  style: [{
21084
21148
  backgroundColor: backgroundColor
21085
21149
  }, borderStyle]
21086
- }), /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, renderPrefix$1({
21150
+ }), prefix !== undefined && /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, renderPrefix$1({
21087
21151
  state: state,
21088
21152
  prefix: prefix
21089
- })), /*#__PURE__*/React__namespace.default.createElement(StyledLabelContainerInsideTextInput, {
21090
- themeHasPrefix: !!prefix,
21153
+ })), /*#__PURE__*/React__namespace.default.createElement(StyledInputContentContainer, {
21154
+ themeHasLabel: !!label,
21155
+ onLayout: onContentLayout
21156
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledLabelContainerInsideTextInput, {
21091
21157
  themeVariant: variant,
21092
21158
  pointerEvents: "none",
21093
21159
  style: [{
@@ -21096,7 +21162,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21096
21162
  transform: [{
21097
21163
  translateY: focusAnimation.interpolate({
21098
21164
  inputRange: [0, 1],
21099
- outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, theme.space.xsmall]
21165
+ outputRange: [variant !== 'textarea' ? Math.max(0, (containerHeight - theme.__hd__.textInput.lineHeights.label) / 2) : theme.__hd__.textInput.space.textareaLabelIdleTranslateY, 0]
21100
21166
  })
21101
21167
  }, {
21102
21168
  scale: focusAnimation.interpolate({
@@ -21120,8 +21186,11 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21120
21186
  testID: "input-label-asterisk"
21121
21187
  }, "*"), /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
21122
21188
  testID: "input-label-text".concat(nativeInputTestIDSuffix),
21123
- numberOfLines: 1
21124
- }, label))), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, null, renderInput$1({
21189
+ numberOfLines: 1,
21190
+ intent: "muted"
21191
+ }, label))), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, {
21192
+ themeHasLabel: !!label
21193
+ }, renderInput$1({
21125
21194
  variant: variant,
21126
21195
  nativeInputProps: nativeInputProps,
21127
21196
  renderInputValue: renderInputValue,
@@ -21130,11 +21199,11 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21130
21199
  },
21131
21200
  theme: theme,
21132
21201
  state: state
21133
- })), renderSuffix$1({
21202
+ }))), renderSuffix$1({
21134
21203
  state: state,
21135
21204
  loading: loading,
21136
21205
  suffix: suffix
21137
- })), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21206
+ }))), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21138
21207
  error: error,
21139
21208
  helpText: helpText
21140
21209
  }), renderMaxLengthMessage({
@@ -41364,13 +41433,10 @@ var RichTextEditor = function RichTextEditor(_ref) {
41364
41433
  }
41365
41434
  return 'default';
41366
41435
  }, [isFocused, error, isEmptyValue]);
41367
- var _React$useState = React__namespace.default.useState({
41368
- height: 0,
41369
- width: 0
41370
- }),
41436
+ var _React$useState = React__namespace.default.useState(0),
41371
41437
  _React$useState2 = _slicedToArray(_React$useState, 2),
41372
- inputSize = _React$useState2[0],
41373
- setInputSize = _React$useState2[1];
41438
+ containerHeight = _React$useState2[0],
41439
+ setContainerHeight = _React$useState2[1];
41374
41440
  var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
41375
41441
  React.useEffect(function () {
41376
41442
  reactNative.Animated.timing(focusAnimation, {
@@ -41381,16 +41447,9 @@ var RichTextEditor = function RichTextEditor(_ref) {
41381
41447
  }).start();
41382
41448
  }, [focusAnimation, isEmptyValue, isFocused]);
41383
41449
  var onLayout = React.useCallback(function (event) {
41384
- var _event$nativeEvent$la = event.nativeEvent.layout,
41385
- height = _event$nativeEvent$la.height,
41386
- width = _event$nativeEvent$la.width;
41387
- setInputSize(function (prev) {
41388
- return _objectSpread2(_objectSpread2({}, prev), {}, {
41389
- height: height,
41390
- width: width
41391
- });
41392
- });
41450
+ setContainerHeight(event.nativeEvent.layout.height);
41393
41451
  }, []);
41452
+ var backgroundColor = theme.__hd__.textInput.colors.containerBackground;
41394
41453
  var handleEditorFocus = React.useCallback(function () {
41395
41454
  onFocus === null || onFocus === void 0 || onFocus();
41396
41455
  setIsFocused(true);
@@ -41401,8 +41460,20 @@ var RichTextEditor = function RichTextEditor(_ref) {
41401
41460
  }, [onBlur]);
41402
41461
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
41403
41462
  testID: testID
41463
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
41464
+ onLayout: onLayout,
41465
+ themeVariant: "text",
41466
+ themeState: state
41467
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
41468
+ themeState: state,
41469
+ themeFocused: isFocused,
41470
+ themeFilled: !isEmptyValue,
41471
+ style: {
41472
+ backgroundColor: backgroundColor
41473
+ }
41474
+ }), /*#__PURE__*/React__namespace.default.createElement(StyledInputContentContainer, {
41475
+ themeHasLabel: !!label
41404
41476
  }, /*#__PURE__*/React__namespace.default.createElement(StyledLabelContainerInsideTextInput, {
41405
- themeHasPrefix: false,
41406
41477
  themeVariant: "text",
41407
41478
  pointerEvents: "none",
41408
41479
  testID: "input-label-container",
@@ -41412,7 +41483,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
41412
41483
  transform: [{
41413
41484
  translateY: focusAnimation.interpolate({
41414
41485
  inputRange: [0, 1],
41415
- outputRange: [inputSize.height / 2, theme.space.xsmall]
41486
+ outputRange: [Math.max(0, (containerHeight - theme.__hd__.textInput.lineHeights.label) / 2), theme.__hd__.textInput.space.labelFocusedTranslateY]
41416
41487
  })
41417
41488
  }, {
41418
41489
  scale: focusAnimation.interpolate({
@@ -41433,13 +41504,11 @@ var RichTextEditor = function RichTextEditor(_ref) {
41433
41504
  },
41434
41505
  themeState: state
41435
41506
  }, "*"), /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
41507
+ intent: "muted",
41436
41508
  numberOfLines: 1
41437
- }, label))), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
41438
- onLayout: onLayout
41439
- }, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
41440
- themeState: state,
41441
- themeFocused: isFocused
41442
- }), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React__namespace.default.createElement(RichTextEditorInput, {
41509
+ }, label))), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, {
41510
+ themeHasLabel: !!label
41511
+ }, /*#__PURE__*/React__namespace.default.createElement(RichTextEditorInput, {
41443
41512
  name: name,
41444
41513
  value: value,
41445
41514
  style: [style, {
@@ -41453,12 +41522,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
41453
41522
  onBlur: handleEditorBlur,
41454
41523
  onFocus: handleEditorFocus,
41455
41524
  onCursorChange: onCursorChange
41456
- }))), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__namespace.default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(Icon, {
41457
- testID: "input-error-icon",
41458
- icon: "circle-info",
41459
- size: "xsmall",
41460
- intent: "danger"
41461
- }), /*#__PURE__*/React__namespace.default.createElement(StyledError, {
41525
+ })))), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__namespace.default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(StyledError, {
41462
41526
  testID: "input-error-message"
41463
41527
  }, error)) : !!helpText && /*#__PURE__*/React__namespace.default.createElement(StyledHelperText, null, helpText))));
41464
41528
  };
@@ -41696,7 +41760,7 @@ var StyledInput = index$c(reactNative.TextInput)(function (_ref4) {
41696
41760
  return {
41697
41761
  textAlignVertical: 'center',
41698
41762
  fontSize: theme.__hd__.search.fontSizes.text,
41699
- color: theme.__hd__.textInput.colors.text,
41763
+ color: theme.__hd__.textInput.colors.text["default"],
41700
41764
  alignSelf: 'stretch',
41701
41765
  flexGrow: 1,
41702
41766
  flexShrink: 1,