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