@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/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
|
}
|
|
@@ -5678,6 +5682,7 @@ var getBadgeTheme = function getBadgeTheme(theme) {
|
|
|
5678
5682
|
success: theme.colors.onSuccessSurface,
|
|
5679
5683
|
warning: theme.colors.onWarningSurface,
|
|
5680
5684
|
archived: theme.colors.onArchivedSurface,
|
|
5685
|
+
neutral: theme.colors.mutedOnDefaultGlobalSurface,
|
|
5681
5686
|
text: theme.colors.onDarkGlobalSurface,
|
|
5682
5687
|
border: theme.colors.defaultGlobalSurface,
|
|
5683
5688
|
countText: theme.colors.onDarkGlobalSurface,
|
|
@@ -5687,7 +5692,8 @@ var getBadgeTheme = function getBadgeTheme(theme) {
|
|
|
5687
5692
|
info: theme.colors.infoSurface,
|
|
5688
5693
|
success: theme.colors.successSurface,
|
|
5689
5694
|
warning: theme.colors.warningSurface,
|
|
5690
|
-
archived: theme.colors.archivedSurface
|
|
5695
|
+
archived: theme.colors.archivedSurface,
|
|
5696
|
+
neutral: theme.colors.neutralGlobalSurface
|
|
5691
5697
|
},
|
|
5692
5698
|
stringText: {
|
|
5693
5699
|
primary: theme.colors.primary,
|
|
@@ -5695,12 +5701,13 @@ var getBadgeTheme = function getBadgeTheme(theme) {
|
|
|
5695
5701
|
info: theme.colors.onInfoSurface,
|
|
5696
5702
|
success: theme.colors.onSuccessSurface,
|
|
5697
5703
|
warning: theme.colors.onWarningSurface,
|
|
5698
|
-
archived: theme.colors.onArchivedSurface
|
|
5704
|
+
archived: theme.colors.onArchivedSurface,
|
|
5705
|
+
neutral: theme.colors.onDefaultGlobalSurface
|
|
5699
5706
|
}
|
|
5700
5707
|
};
|
|
5701
5708
|
var fonts = {
|
|
5702
|
-
medium: theme.fonts.neutral.
|
|
5703
|
-
small: theme.fonts.neutral.
|
|
5709
|
+
medium: theme.fonts.neutral.medium,
|
|
5710
|
+
small: theme.fonts.neutral.medium
|
|
5704
5711
|
};
|
|
5705
5712
|
var fontSizes = {
|
|
5706
5713
|
medium: theme.fontSizes.small,
|
|
@@ -7211,33 +7218,41 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
7211
7218
|
asterisks: {
|
|
7212
7219
|
"default": theme.colors.onErrorSurface,
|
|
7213
7220
|
error: theme.colors.onErrorSurface,
|
|
7214
|
-
disabled: theme.colors.
|
|
7215
|
-
readonly: theme.colors.
|
|
7221
|
+
disabled: theme.colors.onErrorSurface,
|
|
7222
|
+
readonly: theme.colors.onErrorSurface,
|
|
7216
7223
|
filled: theme.colors.onErrorSurface
|
|
7217
7224
|
},
|
|
7218
7225
|
error: theme.colors.onErrorSurface,
|
|
7219
|
-
text:
|
|
7226
|
+
text: {
|
|
7227
|
+
"default": theme.colors.onDefaultGlobalSurface,
|
|
7228
|
+
filled: theme.colors.onDefaultGlobalSurface,
|
|
7229
|
+
error: theme.colors.onDefaultGlobalSurface,
|
|
7230
|
+
readonly: theme.colors.mutedOnDefaultGlobalSurface,
|
|
7231
|
+
disabled: theme.colors.mutedOnDefaultGlobalSurface
|
|
7232
|
+
},
|
|
7220
7233
|
borders: {
|
|
7221
|
-
"default": theme.colors.
|
|
7234
|
+
"default": theme.colors.inactiveOutline,
|
|
7222
7235
|
error: theme.colors.onErrorSurface,
|
|
7223
|
-
disabled: theme.colors.
|
|
7236
|
+
disabled: theme.colors.inactiveOutline,
|
|
7224
7237
|
readonly: theme.colors.inactiveOutline,
|
|
7225
|
-
filled: theme.colors.
|
|
7238
|
+
filled: theme.colors.inactiveOutline,
|
|
7239
|
+
focused: theme.colors.primaryOutline
|
|
7226
7240
|
},
|
|
7227
7241
|
labels: {
|
|
7228
|
-
"default": theme.colors.
|
|
7242
|
+
"default": theme.colors.mutedOnDefaultGlobalSurface,
|
|
7229
7243
|
error: theme.colors.onDefaultGlobalSurface,
|
|
7230
7244
|
disabled: theme.colors.disabledOnDefaultGlobalSurface,
|
|
7231
7245
|
readonly: theme.colors.mutedOnDefaultGlobalSurface,
|
|
7232
|
-
filled: theme.colors.
|
|
7246
|
+
filled: theme.colors.mutedOnDefaultGlobalSurface
|
|
7233
7247
|
},
|
|
7234
7248
|
labelsInsideTextInput: {
|
|
7235
|
-
"default": theme.colors.
|
|
7249
|
+
"default": theme.colors.mutedOnDefaultGlobalSurface,
|
|
7236
7250
|
error: theme.colors.onDefaultGlobalSurface,
|
|
7237
7251
|
disabled: theme.colors.disabledOnDefaultGlobalSurface,
|
|
7238
|
-
readonly: theme.colors.
|
|
7239
|
-
filled: theme.colors.
|
|
7252
|
+
readonly: theme.colors.mutedOnDefaultGlobalSurface,
|
|
7253
|
+
filled: theme.colors.mutedOnDefaultGlobalSurface
|
|
7240
7254
|
},
|
|
7255
|
+
readonlyBackground: theme.colors.neutralGlobalSurface,
|
|
7241
7256
|
maxLengthLabels: {
|
|
7242
7257
|
"default": theme.colors.onDefaultGlobalSurface,
|
|
7243
7258
|
error: theme.colors.onErrorSurface,
|
|
@@ -7254,19 +7269,21 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
7254
7269
|
}
|
|
7255
7270
|
};
|
|
7256
7271
|
var space = {
|
|
7257
|
-
|
|
7272
|
+
containerHorizontalPadding: theme.space.medium,
|
|
7273
|
+
containerVerticalPadding: theme.space.small,
|
|
7258
7274
|
labelLeft: theme.space.xlarge,
|
|
7259
7275
|
labelTop: theme.space.xlarge / 3,
|
|
7260
7276
|
labelPaddingBottom: theme.space.small,
|
|
7261
7277
|
labelHorizontalPadding: theme.space.xsmall,
|
|
7262
|
-
inputHorizontalMargin: theme.space.
|
|
7278
|
+
inputHorizontalMargin: theme.space.smallMedium,
|
|
7263
7279
|
errorContainerMarginRight: theme.space.xsmall,
|
|
7264
7280
|
errorAndHelpTextContainerMarginTop: theme.space.xxsmall,
|
|
7265
|
-
errorMarginLeft: theme.space.xsmall,
|
|
7266
|
-
errorAndHelpTextContainerHorizontalPadding: theme.space.medium,
|
|
7267
7281
|
containerMarginTop: theme.space.small,
|
|
7268
|
-
labelInsideTextInputMarginTop:
|
|
7269
|
-
errorAndHelpTextContainerPaddingTop: theme.space.xxsmall
|
|
7282
|
+
labelInsideTextInputMarginTop: 0,
|
|
7283
|
+
errorAndHelpTextContainerPaddingTop: theme.space.xxsmall,
|
|
7284
|
+
inputAndLabelContainerPaddingTop: theme.lineHeights.medium,
|
|
7285
|
+
labelFocusedTranslateY: theme.space.xsmall * 2,
|
|
7286
|
+
textareaLabelIdleTranslateY: theme.space.large
|
|
7270
7287
|
};
|
|
7271
7288
|
var fonts = {
|
|
7272
7289
|
text: theme.fonts.neutral.regular
|
|
@@ -7282,19 +7299,21 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
7282
7299
|
var borderWidths = {
|
|
7283
7300
|
container: {
|
|
7284
7301
|
normal: theme.borderWidths.base,
|
|
7285
|
-
focused: theme.borderWidths.
|
|
7302
|
+
focused: theme.borderWidths.base
|
|
7286
7303
|
}
|
|
7287
7304
|
};
|
|
7288
7305
|
var radii = {
|
|
7289
7306
|
container: theme.radii.medium
|
|
7290
7307
|
};
|
|
7291
7308
|
var sizes = {
|
|
7292
|
-
|
|
7293
|
-
|
|
7309
|
+
errorAndHelpTextContainerMinHeight: theme.space.large,
|
|
7310
|
+
containerMinHeight: scale(58),
|
|
7311
|
+
textareaHeight: scale(120),
|
|
7294
7312
|
textInputMaxHeight: theme.sizes['15xlarge']
|
|
7295
7313
|
};
|
|
7296
7314
|
var lineHeights = {
|
|
7297
|
-
topLabel: theme.lineHeights.large / 2
|
|
7315
|
+
topLabel: theme.lineHeights.large / 2,
|
|
7316
|
+
label: theme.lineHeights.large
|
|
7298
7317
|
};
|
|
7299
7318
|
return {
|
|
7300
7319
|
colors: colors,
|
|
@@ -7545,11 +7564,13 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
7545
7564
|
body: {
|
|
7546
7565
|
neutral: {
|
|
7547
7566
|
semiBold: 0.24,
|
|
7567
|
+
medium: 0.3,
|
|
7548
7568
|
regular: 0.48,
|
|
7549
7569
|
small: 0.48
|
|
7550
7570
|
},
|
|
7551
7571
|
playful: {
|
|
7552
7572
|
semiBold: 0.54,
|
|
7573
|
+
medium: 0.54,
|
|
7553
7574
|
regular: 0.54,
|
|
7554
7575
|
small: 0.54
|
|
7555
7576
|
}
|
|
@@ -8191,9 +8212,15 @@ var Text = function Text(_ref) {
|
|
|
8191
8212
|
var FONTWEIGHT_MAP$1 = {
|
|
8192
8213
|
light: 'light',
|
|
8193
8214
|
regular: 'regular',
|
|
8215
|
+
medium: 'medium',
|
|
8194
8216
|
'semi-bold': 'semiBold'
|
|
8195
8217
|
};
|
|
8196
8218
|
|
|
8219
|
+
var LETTER_SPACING_MAP = {
|
|
8220
|
+
regular: 0.36,
|
|
8221
|
+
medium: 0.3,
|
|
8222
|
+
'semi-bold': 0.24
|
|
8223
|
+
};
|
|
8197
8224
|
var StyledCaption = index$c(Text$1)(function (_ref) {
|
|
8198
8225
|
var themeFontWeight = _ref.themeFontWeight,
|
|
8199
8226
|
themeIntent = _ref.themeIntent,
|
|
@@ -8201,10 +8228,11 @@ var StyledCaption = index$c(Text$1)(function (_ref) {
|
|
|
8201
8228
|
themeIsItalic = _ref.themeIsItalic;
|
|
8202
8229
|
var baseFontWeight = FONTWEIGHT_MAP$1[themeFontWeight];
|
|
8203
8230
|
var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(baseFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[baseFontWeight];
|
|
8231
|
+
var letterSpacing = LETTER_SPACING_MAP[themeFontWeight];
|
|
8204
8232
|
return {
|
|
8205
8233
|
fontSize: theme.__hd__.typography.fontSizes.caption,
|
|
8206
8234
|
lineHeight: theme.__hd__.typography.lineHeights.caption,
|
|
8207
|
-
letterSpacing:
|
|
8235
|
+
letterSpacing: letterSpacing,
|
|
8208
8236
|
color: theme.__hd__.typography.colors[themeIntent],
|
|
8209
8237
|
fontFamily: fontFamily
|
|
8210
8238
|
};
|
|
@@ -8314,10 +8342,10 @@ var Caption = function Caption(_ref) {
|
|
|
8314
8342
|
var StyledLabel$1 = index$c(Text$1)(function (_ref) {
|
|
8315
8343
|
var themeIntent = _ref.themeIntent,
|
|
8316
8344
|
theme = _ref.theme,
|
|
8317
|
-
themeIsItalic = _ref.themeIsItalic
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(
|
|
8345
|
+
themeIsItalic = _ref.themeIsItalic,
|
|
8346
|
+
_ref$themeFontWeight = _ref.themeFontWeight,
|
|
8347
|
+
themeFontWeight = _ref$themeFontWeight === void 0 ? 'regular' : _ref$themeFontWeight;
|
|
8348
|
+
var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts.neutral["".concat(themeFontWeight, "Italic")] : theme.__hd__.typography.fonts.neutral[themeFontWeight];
|
|
8321
8349
|
return {
|
|
8322
8350
|
fontSize: theme.__hd__.typography.fontSizes.label,
|
|
8323
8351
|
lineHeight: theme.__hd__.typography.lineHeights.label,
|
|
@@ -8327,7 +8355,7 @@ var StyledLabel$1 = index$c(Text$1)(function (_ref) {
|
|
|
8327
8355
|
};
|
|
8328
8356
|
});
|
|
8329
8357
|
|
|
8330
|
-
var _excluded$N = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
|
|
8358
|
+
var _excluded$N = ["children", "intent", "allowFontScaling", "fontStyle", "fontWeight", "style", "testID"];
|
|
8331
8359
|
var Label = function Label(_ref) {
|
|
8332
8360
|
var children = _ref.children,
|
|
8333
8361
|
_ref$intent = _ref.intent,
|
|
@@ -8336,6 +8364,8 @@ var Label = function Label(_ref) {
|
|
|
8336
8364
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8337
8365
|
_ref$fontStyle = _ref.fontStyle,
|
|
8338
8366
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
8367
|
+
_ref$fontWeight = _ref.fontWeight,
|
|
8368
|
+
fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
|
|
8339
8369
|
style = _ref.style,
|
|
8340
8370
|
testID = _ref.testID,
|
|
8341
8371
|
nativeProps = _objectWithoutProperties(_ref, _excluded$N);
|
|
@@ -8343,6 +8373,7 @@ var Label = function Label(_ref) {
|
|
|
8343
8373
|
var styledText = /*#__PURE__*/React__default.createElement(StyledLabel$1, _extends$1({}, nativeProps, {
|
|
8344
8374
|
themeIntent: isAi ? 'body' : intent,
|
|
8345
8375
|
themeIsItalic: fontStyle === 'italic',
|
|
8376
|
+
themeFontWeight: fontWeight,
|
|
8346
8377
|
allowFontScaling: allowFontScaling,
|
|
8347
8378
|
style: style,
|
|
8348
8379
|
testID: testID
|
|
@@ -8403,12 +8434,16 @@ var Title = function Title(_ref) {
|
|
|
8403
8434
|
var FONTWEIGHT_MAP = {
|
|
8404
8435
|
regular: 'regular',
|
|
8405
8436
|
small: 'regular',
|
|
8437
|
+
'regular-medium': 'medium',
|
|
8438
|
+
'small-medium': 'medium',
|
|
8406
8439
|
'regular-bold': 'semiBold',
|
|
8407
8440
|
'small-bold': 'semiBold'
|
|
8408
8441
|
};
|
|
8409
8442
|
var FONTSIZE_MAP = {
|
|
8410
8443
|
regular: 'regular',
|
|
8411
8444
|
small: 'small',
|
|
8445
|
+
'regular-medium': 'regular',
|
|
8446
|
+
'small-medium': 'small',
|
|
8412
8447
|
'regular-bold': 'regular',
|
|
8413
8448
|
'small-bold': 'small'
|
|
8414
8449
|
};
|
|
@@ -8418,12 +8453,12 @@ var StyledBody$2 = index$c(Text$1)(function (_ref) {
|
|
|
8418
8453
|
themeTypeface = _ref.themeTypeface,
|
|
8419
8454
|
themeVariant = _ref.themeVariant,
|
|
8420
8455
|
themeIsItalic = _ref.themeIsItalic;
|
|
8421
|
-
var
|
|
8422
|
-
var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts[themeTypeface]["".concat(
|
|
8456
|
+
var fontWeight = FONTWEIGHT_MAP[themeVariant];
|
|
8457
|
+
var fontFamily = themeIsItalic ? theme.__hd__.typography.fonts[themeTypeface]["".concat(fontWeight, "Italic")] : theme.__hd__.typography.fonts[themeTypeface][fontWeight];
|
|
8423
8458
|
return {
|
|
8424
8459
|
fontSize: theme.__hd__.typography.fontSizes.body[themeTypeface][FONTSIZE_MAP[themeVariant]],
|
|
8425
8460
|
lineHeight: theme.__hd__.typography.lineHeights.body[themeTypeface][FONTSIZE_MAP[themeVariant]],
|
|
8426
|
-
letterSpacing: theme.__hd__.typography.letterSpacings.body[themeTypeface][
|
|
8461
|
+
letterSpacing: theme.__hd__.typography.letterSpacings.body[themeTypeface][fontWeight],
|
|
8427
8462
|
fontFamily: fontFamily,
|
|
8428
8463
|
color: theme.__hd__.typography.colors[themeIntent]
|
|
8429
8464
|
};
|
|
@@ -20652,6 +20687,24 @@ var index$9 = Object.assign(DefaultCheckbox, {
|
|
|
20652
20687
|
Inline: InlineCheckbox
|
|
20653
20688
|
});
|
|
20654
20689
|
|
|
20690
|
+
var genBorderWidth = function genBorderWidth(theme, themeState, themeFocused) {
|
|
20691
|
+
if (themeState === 'readonly') return 0;
|
|
20692
|
+
return themeFocused ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal;
|
|
20693
|
+
};
|
|
20694
|
+
var genBorderColor = function genBorderColor(theme, themeState, themeFocused, themeFilled) {
|
|
20695
|
+
var _theme$__hd__$textInp2;
|
|
20696
|
+
if (themeState === 'error' && !themeFilled) {
|
|
20697
|
+
return theme.__hd__.textInput.colors.borders["default"];
|
|
20698
|
+
}
|
|
20699
|
+
if (themeState === 'error' && themeFilled) {
|
|
20700
|
+
return theme.__hd__.textInput.colors.borders.error;
|
|
20701
|
+
}
|
|
20702
|
+
if (themeFocused) {
|
|
20703
|
+
var _theme$__hd__$textInp;
|
|
20704
|
+
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"];
|
|
20705
|
+
}
|
|
20706
|
+
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"];
|
|
20707
|
+
};
|
|
20655
20708
|
var StyledContainer$7 = index$c(View)(function (_ref) {
|
|
20656
20709
|
var theme = _ref.theme;
|
|
20657
20710
|
return {
|
|
@@ -20661,16 +20714,15 @@ var StyledContainer$7 = index$c(View)(function (_ref) {
|
|
|
20661
20714
|
});
|
|
20662
20715
|
var StyledLabelContainerInsideTextInput = index$c(Animated.View)(function (_ref2) {
|
|
20663
20716
|
var themeVariant = _ref2.themeVariant,
|
|
20664
|
-
themeHasPrefix = _ref2.themeHasPrefix,
|
|
20665
20717
|
theme = _ref2.theme;
|
|
20666
20718
|
return {
|
|
20667
20719
|
flexDirection: 'row',
|
|
20668
20720
|
alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
|
|
20669
20721
|
position: 'absolute',
|
|
20670
20722
|
zIndex: 1,
|
|
20671
|
-
left:
|
|
20723
|
+
left: 0,
|
|
20672
20724
|
right: theme.space.medium,
|
|
20673
|
-
top:
|
|
20725
|
+
top: 0
|
|
20674
20726
|
};
|
|
20675
20727
|
});
|
|
20676
20728
|
var StyledLabelInsideTextInput = index$c(View)(function (_ref3) {
|
|
@@ -20705,8 +20757,7 @@ var StyledErrorContainer$2 = index$c(View)(function (_ref5) {
|
|
|
20705
20757
|
var StyledError = index$c(Typography.Caption)(function (_ref6) {
|
|
20706
20758
|
var theme = _ref6.theme;
|
|
20707
20759
|
return {
|
|
20708
|
-
color: theme.__hd__.textInput.colors.error
|
|
20709
|
-
marginLeft: theme.__hd__.textInput.space.errorMarginLeft
|
|
20760
|
+
color: theme.__hd__.textInput.colors.error
|
|
20710
20761
|
};
|
|
20711
20762
|
});
|
|
20712
20763
|
var StyledMaxLengthMessage = index$c(Typography.Caption)(function (_ref7) {
|
|
@@ -20728,7 +20779,7 @@ var StyledTextInput = index$c(TextInput$1)(function (_ref8) {
|
|
|
20728
20779
|
fontSize: theme.__hd__.textInput.fontSizes.text,
|
|
20729
20780
|
alignSelf: 'stretch',
|
|
20730
20781
|
flexGrow: 2,
|
|
20731
|
-
marginHorizontal:
|
|
20782
|
+
marginHorizontal: 0,
|
|
20732
20783
|
paddingVertical: 0,
|
|
20733
20784
|
maxHeight: theme.__hd__.textInput.sizes.textInputMaxHeight,
|
|
20734
20785
|
height: themeVariant === 'text' ? undefined : theme.__hd__.textInput.sizes.textareaHeight,
|
|
@@ -20736,45 +20787,65 @@ var StyledTextInput = index$c(TextInput$1)(function (_ref8) {
|
|
|
20736
20787
|
};
|
|
20737
20788
|
});
|
|
20738
20789
|
var StyledBorderBackDrop = index$c(View)(function (_ref9) {
|
|
20739
|
-
var _theme$__hd__$textInp;
|
|
20740
20790
|
var theme = _ref9.theme,
|
|
20741
20791
|
themeFocused = _ref9.themeFocused,
|
|
20742
|
-
themeState = _ref9.themeState
|
|
20792
|
+
themeState = _ref9.themeState,
|
|
20793
|
+
themeFilled = _ref9.themeFilled;
|
|
20743
20794
|
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
20744
|
-
borderWidth:
|
|
20795
|
+
borderWidth: genBorderWidth(theme, themeState, themeFocused),
|
|
20745
20796
|
borderRadius: theme.__hd__.textInput.radii.container,
|
|
20746
|
-
borderColor: (
|
|
20797
|
+
borderColor: genBorderColor(theme, themeState, themeFocused, themeFilled)
|
|
20747
20798
|
});
|
|
20748
20799
|
});
|
|
20749
20800
|
var StyledTextInputContainer = index$c(View)(function (_ref10) {
|
|
20750
|
-
var theme = _ref10.theme
|
|
20751
|
-
|
|
20801
|
+
var theme = _ref10.theme,
|
|
20802
|
+
themeVariant = _ref10.themeVariant,
|
|
20803
|
+
themeState = _ref10.themeState;
|
|
20804
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
20752
20805
|
flexDirection: 'row',
|
|
20753
20806
|
alignItems: 'center',
|
|
20754
|
-
|
|
20755
|
-
|
|
20807
|
+
paddingHorizontal: theme.__hd__.textInput.space.containerHorizontalPadding,
|
|
20808
|
+
paddingVertical: theme.__hd__.textInput.space.containerVerticalPadding,
|
|
20756
20809
|
borderRadius: theme.__hd__.textInput.radii.container
|
|
20757
|
-
}
|
|
20810
|
+
}, themeVariant === 'text' && {
|
|
20811
|
+
minHeight: theme.__hd__.textInput.sizes.containerMinHeight
|
|
20812
|
+
}), themeState === 'disabled' && {
|
|
20813
|
+
opacity: 0.5
|
|
20814
|
+
}), {}, {
|
|
20815
|
+
gap: theme.space.smallMedium
|
|
20816
|
+
});
|
|
20758
20817
|
});
|
|
20759
|
-
|
|
20818
|
+
// Outer wrapper that owns flex-grow/shrink and provides the positioning context
|
|
20819
|
+
// for StyledLabelContainerInsideTextInput (position: absolute).
|
|
20820
|
+
var StyledInputContentContainer = index$c(View)(function (_ref11) {
|
|
20821
|
+
var themeHasLabel = _ref11.themeHasLabel;
|
|
20760
20822
|
return {
|
|
20761
|
-
flexDirection: 'row',
|
|
20762
|
-
alignItems: 'center',
|
|
20763
|
-
alignSelf: 'stretch',
|
|
20764
20823
|
flexGrow: 2,
|
|
20765
|
-
flexShrink: 1
|
|
20824
|
+
flexShrink: 1,
|
|
20825
|
+
alignSelf: 'stretch',
|
|
20826
|
+
justifyContent: themeHasLabel ? 'flex-start' : 'center'
|
|
20766
20827
|
};
|
|
20767
20828
|
});
|
|
20768
|
-
var
|
|
20769
|
-
var theme =
|
|
20829
|
+
var StyledTextInputAndLabelContainer = index$c(View)(function (_ref12) {
|
|
20830
|
+
var theme = _ref12.theme,
|
|
20831
|
+
themeHasLabel = _ref12.themeHasLabel;
|
|
20832
|
+
return _objectSpread2({
|
|
20833
|
+
flexDirection: 'row',
|
|
20834
|
+
alignItems: 'center',
|
|
20835
|
+
alignSelf: 'stretch'
|
|
20836
|
+
}, themeHasLabel && {
|
|
20837
|
+
paddingTop: theme.__hd__.textInput.space.inputAndLabelContainerPaddingTop
|
|
20838
|
+
});
|
|
20839
|
+
});
|
|
20840
|
+
var StyledErrorAndHelpTextContainer = index$c(View)(function (_ref13) {
|
|
20841
|
+
var theme = _ref13.theme;
|
|
20770
20842
|
return {
|
|
20771
|
-
|
|
20772
|
-
minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight,
|
|
20843
|
+
minHeight: theme.__hd__.textInput.sizes.errorAndHelpTextContainerMinHeight,
|
|
20773
20844
|
paddingTop: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingTop
|
|
20774
20845
|
};
|
|
20775
20846
|
});
|
|
20776
|
-
var StyledErrorAndMaxLengthContainer = index$c(View)(function (
|
|
20777
|
-
var theme =
|
|
20847
|
+
var StyledErrorAndMaxLengthContainer = index$c(View)(function (_ref14) {
|
|
20848
|
+
var theme = _ref14.theme;
|
|
20778
20849
|
return {
|
|
20779
20850
|
flexDirection: 'row',
|
|
20780
20851
|
justifyContent: 'space-between',
|
|
@@ -20811,12 +20882,7 @@ var LABEL_ANIMATION_DURATION = 150;
|
|
|
20811
20882
|
var renderErrorOrHelpText = function renderErrorOrHelpText(_ref2) {
|
|
20812
20883
|
var error = _ref2.error,
|
|
20813
20884
|
helpText = _ref2.helpText;
|
|
20814
|
-
return error ? /*#__PURE__*/React__default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default.createElement(
|
|
20815
|
-
testID: "input-error-icon",
|
|
20816
|
-
icon: "circle-info",
|
|
20817
|
-
size: "xsmall",
|
|
20818
|
-
intent: "danger"
|
|
20819
|
-
}), /*#__PURE__*/React__default.createElement(StyledError, {
|
|
20885
|
+
return error ? /*#__PURE__*/React__default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__default.createElement(StyledError, {
|
|
20820
20886
|
testID: "input-error-message"
|
|
20821
20887
|
}, error)) : !!helpText && /*#__PURE__*/React__default.createElement(StyledHelperText, null, helpText);
|
|
20822
20888
|
};
|
|
@@ -20846,7 +20912,7 @@ var renderSuffix$1 = function renderSuffix(_ref4) {
|
|
|
20846
20912
|
suffix = _ref4.suffix;
|
|
20847
20913
|
var actualSuffix = loading ? 'loading' : suffix;
|
|
20848
20914
|
return typeof actualSuffix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
20849
|
-
intent: state === 'disabled' ? 'disabled-text' : '
|
|
20915
|
+
intent: state === 'disabled' ? 'disabled-text' : 'muted',
|
|
20850
20916
|
testID: "input-suffix",
|
|
20851
20917
|
icon: actualSuffix,
|
|
20852
20918
|
spin: actualSuffix === 'loading',
|
|
@@ -20857,10 +20923,10 @@ var renderPrefix$1 = function renderPrefix(_ref5) {
|
|
|
20857
20923
|
var state = _ref5.state,
|
|
20858
20924
|
prefix = _ref5.prefix;
|
|
20859
20925
|
return typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
20860
|
-
intent: state === 'disabled' ? 'disabled-text' : '
|
|
20926
|
+
intent: state === 'disabled' ? 'disabled-text' : 'muted',
|
|
20861
20927
|
testID: "input-prefix",
|
|
20862
20928
|
icon: prefix,
|
|
20863
|
-
size: "
|
|
20929
|
+
size: "medium"
|
|
20864
20930
|
}) : prefix;
|
|
20865
20931
|
};
|
|
20866
20932
|
var renderMaxLengthMessage = function renderMaxLengthMessage(_ref6) {
|
|
@@ -20907,13 +20973,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
20907
20973
|
nativeProps = _objectWithoutProperties(_ref8, _excluded$t);
|
|
20908
20974
|
var displayText = getDisplayText(value, defaultValue);
|
|
20909
20975
|
var isEmptyValue = displayText.length === 0;
|
|
20910
|
-
var _React$useState = React__default.useState(
|
|
20911
|
-
height: 0,
|
|
20912
|
-
width: 0
|
|
20913
|
-
}),
|
|
20976
|
+
var _React$useState = React__default.useState(0),
|
|
20914
20977
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
20915
|
-
|
|
20916
|
-
|
|
20978
|
+
containerHeight = _React$useState2[0],
|
|
20979
|
+
setContainerHeight = _React$useState2[1];
|
|
20917
20980
|
var _React$useState3 = React__default.useState(false),
|
|
20918
20981
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
20919
20982
|
isFocused = _React$useState4[0],
|
|
@@ -20935,18 +20998,14 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
20935
20998
|
useNativeDriver: true
|
|
20936
20999
|
}).start();
|
|
20937
21000
|
}, [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
21001
|
var innerTextInput = React__default.useRef(null);
|
|
21002
|
+
var focusInnerTextInput = useCallback(function () {
|
|
21003
|
+
var _innerTextInput$curre;
|
|
21004
|
+
return (_innerTextInput$curre = innerTextInput.current) === null || _innerTextInput$curre === void 0 ? void 0 : _innerTextInput$curre.focus();
|
|
21005
|
+
}, []);
|
|
21006
|
+
var onContentLayout = useCallback(function (e) {
|
|
21007
|
+
setContainerHeight(e.nativeEvent.layout.height);
|
|
21008
|
+
}, []);
|
|
20950
21009
|
React__default.useImperativeHandle(ref, function () {
|
|
20951
21010
|
return {
|
|
20952
21011
|
// 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 +21013,24 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
20954
21013
|
return innerTextInput.current;
|
|
20955
21014
|
},
|
|
20956
21015
|
focus: function focus() {
|
|
20957
|
-
var _innerTextInput$
|
|
20958
|
-
(_innerTextInput$
|
|
21016
|
+
var _innerTextInput$curre2;
|
|
21017
|
+
(_innerTextInput$curre2 = innerTextInput.current) === null || _innerTextInput$curre2 === void 0 || _innerTextInput$curre2.focus();
|
|
20959
21018
|
},
|
|
20960
21019
|
clear: function clear() {
|
|
20961
|
-
var _innerTextInput$
|
|
20962
|
-
return (_innerTextInput$
|
|
21020
|
+
var _innerTextInput$curre3;
|
|
21021
|
+
return (_innerTextInput$curre3 = innerTextInput.current) === null || _innerTextInput$curre3 === void 0 ? void 0 : _innerTextInput$curre3.clear();
|
|
20963
21022
|
},
|
|
20964
21023
|
setNativeProps: function setNativeProps(args) {
|
|
20965
|
-
var _innerTextInput$
|
|
20966
|
-
return (_innerTextInput$
|
|
21024
|
+
var _innerTextInput$curre4;
|
|
21025
|
+
return (_innerTextInput$curre4 = innerTextInput.current) === null || _innerTextInput$curre4 === void 0 ? void 0 : _innerTextInput$curre4.setNativeProps(args);
|
|
20967
21026
|
},
|
|
20968
21027
|
isFocused: function isFocused() {
|
|
20969
|
-
var _innerTextInput$
|
|
20970
|
-
return ((_innerTextInput$
|
|
21028
|
+
var _innerTextInput$curre5;
|
|
21029
|
+
return ((_innerTextInput$curre5 = innerTextInput.current) === null || _innerTextInput$curre5 === void 0 ? void 0 : _innerTextInput$curre5.isFocused()) || false;
|
|
20971
21030
|
},
|
|
20972
21031
|
blur: function blur() {
|
|
20973
|
-
var _innerTextInput$
|
|
20974
|
-
return (_innerTextInput$
|
|
21032
|
+
var _innerTextInput$curre6;
|
|
21033
|
+
return (_innerTextInput$curre6 = innerTextInput.current) === null || _innerTextInput$curre6 === void 0 ? void 0 : _innerTextInput$curre6.blur();
|
|
20975
21034
|
}
|
|
20976
21035
|
};
|
|
20977
21036
|
}, [innerTextInput]);
|
|
@@ -20990,26 +21049,28 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
20990
21049
|
}, [textStyle]),
|
|
20991
21050
|
borderStyle = _useMemo.borderStyle,
|
|
20992
21051
|
textStyleWithoutBorderStyle = _useMemo.textStyleWithoutBorderStyle;
|
|
21052
|
+
var readonlyBackground = hexToRgba(theme.__hd__.textInput.colors.readonlyBackground, 0.7);
|
|
20993
21053
|
var _useMemo2 = useMemo(function () {
|
|
20994
21054
|
var _flattenTextStyle$bac;
|
|
21055
|
+
var defaultBackground = state === 'readonly' ? readonlyBackground : theme.__hd__.textInput.colors.containerBackground;
|
|
20995
21056
|
if (!style) {
|
|
20996
21057
|
return {
|
|
20997
|
-
backgroundColor:
|
|
21058
|
+
backgroundColor: defaultBackground
|
|
20998
21059
|
};
|
|
20999
21060
|
}
|
|
21000
21061
|
var flattenTextStyle = StyleSheet$1.flatten(style);
|
|
21001
21062
|
return {
|
|
21002
|
-
backgroundColor: (_flattenTextStyle$bac = flattenTextStyle.backgroundColor) !== null && _flattenTextStyle$bac !== void 0 ? _flattenTextStyle$bac :
|
|
21063
|
+
backgroundColor: (_flattenTextStyle$bac = flattenTextStyle.backgroundColor) !== null && _flattenTextStyle$bac !== void 0 ? _flattenTextStyle$bac : defaultBackground,
|
|
21003
21064
|
styleWithoutBackgroundColor: omit(['backgroundColor'], flattenTextStyle)
|
|
21004
21065
|
};
|
|
21005
|
-
}, [style, theme]),
|
|
21066
|
+
}, [style, theme, state, readonlyBackground]),
|
|
21006
21067
|
backgroundColor = _useMemo2.backgroundColor,
|
|
21007
21068
|
styleWithoutBackgroundColor = _useMemo2.styleWithoutBackgroundColor;
|
|
21008
21069
|
var nativeInputTestIDSuffix = testID ? "-".concat(testID) : '';
|
|
21009
21070
|
var nativeInputProps = _objectSpread2(_objectSpread2({
|
|
21010
21071
|
style: StyleSheet$1.flatten([{
|
|
21011
21072
|
backgroundColor: backgroundColor,
|
|
21012
|
-
color: theme.__hd__.textInput.colors.text
|
|
21073
|
+
color: theme.__hd__.textInput.colors.text[state]
|
|
21013
21074
|
}, textStyleWithoutBorderStyle]),
|
|
21014
21075
|
testID: "text-input".concat(nativeInputTestIDSuffix),
|
|
21015
21076
|
accessibilityState: {
|
|
@@ -21042,22 +21103,30 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
21042
21103
|
});
|
|
21043
21104
|
return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
|
|
21044
21105
|
style: styleWithoutBackgroundColor,
|
|
21045
|
-
pointerEvents: state === 'disabled' || state === 'readonly' ? 'none' : 'auto',
|
|
21106
|
+
pointerEvents: state === 'disabled' || state === 'readonly' || loading ? 'none' : 'auto',
|
|
21046
21107
|
testID: testID
|
|
21108
|
+
}, /*#__PURE__*/React__default.createElement(Pressable, {
|
|
21109
|
+
onPress: focusInnerTextInput,
|
|
21110
|
+
accessible: false,
|
|
21111
|
+
importantForAccessibility: "no"
|
|
21047
21112
|
}, /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
|
|
21048
|
-
|
|
21113
|
+
themeVariant: variant,
|
|
21114
|
+
themeState: state
|
|
21049
21115
|
}, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
|
|
21050
21116
|
themeFocused: isFocused,
|
|
21051
21117
|
themeState: state,
|
|
21118
|
+
themeFilled: !isEmptyValue,
|
|
21052
21119
|
testID: "text-input-border",
|
|
21053
21120
|
style: [{
|
|
21054
21121
|
backgroundColor: backgroundColor
|
|
21055
21122
|
}, borderStyle]
|
|
21056
|
-
}), /*#__PURE__*/React__default.createElement(View, null, renderPrefix$1({
|
|
21123
|
+
}), prefix !== undefined && /*#__PURE__*/React__default.createElement(View, null, renderPrefix$1({
|
|
21057
21124
|
state: state,
|
|
21058
21125
|
prefix: prefix
|
|
21059
|
-
})), /*#__PURE__*/React__default.createElement(
|
|
21060
|
-
|
|
21126
|
+
})), /*#__PURE__*/React__default.createElement(StyledInputContentContainer, {
|
|
21127
|
+
themeHasLabel: !!label,
|
|
21128
|
+
onLayout: onContentLayout
|
|
21129
|
+
}, /*#__PURE__*/React__default.createElement(StyledLabelContainerInsideTextInput, {
|
|
21061
21130
|
themeVariant: variant,
|
|
21062
21131
|
pointerEvents: "none",
|
|
21063
21132
|
style: [{
|
|
@@ -21066,7 +21135,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
21066
21135
|
transform: [{
|
|
21067
21136
|
translateY: focusAnimation.interpolate({
|
|
21068
21137
|
inputRange: [0, 1],
|
|
21069
|
-
outputRange: [variant !== 'textarea' ?
|
|
21138
|
+
outputRange: [variant !== 'textarea' ? Math.max(0, (containerHeight - theme.__hd__.textInput.lineHeights.label) / 2) : theme.__hd__.textInput.space.textareaLabelIdleTranslateY, 0]
|
|
21070
21139
|
})
|
|
21071
21140
|
}, {
|
|
21072
21141
|
scale: focusAnimation.interpolate({
|
|
@@ -21090,8 +21159,11 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
21090
21159
|
testID: "input-label-asterisk"
|
|
21091
21160
|
}, "*"), /*#__PURE__*/React__default.createElement(Typography.Body, {
|
|
21092
21161
|
testID: "input-label-text".concat(nativeInputTestIDSuffix),
|
|
21093
|
-
numberOfLines: 1
|
|
21094
|
-
|
|
21162
|
+
numberOfLines: 1,
|
|
21163
|
+
intent: "muted"
|
|
21164
|
+
}, label))), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, {
|
|
21165
|
+
themeHasLabel: !!label
|
|
21166
|
+
}, renderInput$1({
|
|
21095
21167
|
variant: variant,
|
|
21096
21168
|
nativeInputProps: nativeInputProps,
|
|
21097
21169
|
renderInputValue: renderInputValue,
|
|
@@ -21100,11 +21172,11 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
|
|
|
21100
21172
|
},
|
|
21101
21173
|
theme: theme,
|
|
21102
21174
|
state: state
|
|
21103
|
-
})), renderSuffix$1({
|
|
21175
|
+
}))), renderSuffix$1({
|
|
21104
21176
|
state: state,
|
|
21105
21177
|
loading: loading,
|
|
21106
21178
|
suffix: suffix
|
|
21107
|
-
})), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
|
|
21179
|
+
}))), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
|
|
21108
21180
|
error: error,
|
|
21109
21181
|
helpText: helpText
|
|
21110
21182
|
}), renderMaxLengthMessage({
|
|
@@ -41334,13 +41406,10 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41334
41406
|
}
|
|
41335
41407
|
return 'default';
|
|
41336
41408
|
}, [isFocused, error, isEmptyValue]);
|
|
41337
|
-
var _React$useState = React__default.useState(
|
|
41338
|
-
height: 0,
|
|
41339
|
-
width: 0
|
|
41340
|
-
}),
|
|
41409
|
+
var _React$useState = React__default.useState(0),
|
|
41341
41410
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
41342
|
-
|
|
41343
|
-
|
|
41411
|
+
containerHeight = _React$useState2[0],
|
|
41412
|
+
setContainerHeight = _React$useState2[1];
|
|
41344
41413
|
var focusAnimation = useRef(new Animated.Value(0)).current;
|
|
41345
41414
|
useEffect(function () {
|
|
41346
41415
|
Animated.timing(focusAnimation, {
|
|
@@ -41351,16 +41420,9 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41351
41420
|
}).start();
|
|
41352
41421
|
}, [focusAnimation, isEmptyValue, isFocused]);
|
|
41353
41422
|
var onLayout = useCallback(function (event) {
|
|
41354
|
-
|
|
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
|
-
});
|
|
41423
|
+
setContainerHeight(event.nativeEvent.layout.height);
|
|
41363
41424
|
}, []);
|
|
41425
|
+
var backgroundColor = theme.__hd__.textInput.colors.containerBackground;
|
|
41364
41426
|
var handleEditorFocus = useCallback(function () {
|
|
41365
41427
|
onFocus === null || onFocus === void 0 || onFocus();
|
|
41366
41428
|
setIsFocused(true);
|
|
@@ -41371,8 +41433,20 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41371
41433
|
}, [onBlur]);
|
|
41372
41434
|
return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
|
|
41373
41435
|
testID: testID
|
|
41436
|
+
}, /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
|
|
41437
|
+
onLayout: onLayout,
|
|
41438
|
+
themeVariant: "text",
|
|
41439
|
+
themeState: state
|
|
41440
|
+
}, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
|
|
41441
|
+
themeState: state,
|
|
41442
|
+
themeFocused: isFocused,
|
|
41443
|
+
themeFilled: !isEmptyValue,
|
|
41444
|
+
style: {
|
|
41445
|
+
backgroundColor: backgroundColor
|
|
41446
|
+
}
|
|
41447
|
+
}), /*#__PURE__*/React__default.createElement(StyledInputContentContainer, {
|
|
41448
|
+
themeHasLabel: !!label
|
|
41374
41449
|
}, /*#__PURE__*/React__default.createElement(StyledLabelContainerInsideTextInput, {
|
|
41375
|
-
themeHasPrefix: false,
|
|
41376
41450
|
themeVariant: "text",
|
|
41377
41451
|
pointerEvents: "none",
|
|
41378
41452
|
testID: "input-label-container",
|
|
@@ -41382,7 +41456,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41382
41456
|
transform: [{
|
|
41383
41457
|
translateY: focusAnimation.interpolate({
|
|
41384
41458
|
inputRange: [0, 1],
|
|
41385
|
-
outputRange: [
|
|
41459
|
+
outputRange: [Math.max(0, (containerHeight - theme.__hd__.textInput.lineHeights.label) / 2), theme.__hd__.textInput.space.labelFocusedTranslateY]
|
|
41386
41460
|
})
|
|
41387
41461
|
}, {
|
|
41388
41462
|
scale: focusAnimation.interpolate({
|
|
@@ -41403,13 +41477,11 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41403
41477
|
},
|
|
41404
41478
|
themeState: state
|
|
41405
41479
|
}, "*"), /*#__PURE__*/React__default.createElement(Typography.Body, {
|
|
41480
|
+
intent: "muted",
|
|
41406
41481
|
numberOfLines: 1
|
|
41407
|
-
}, label))), /*#__PURE__*/React__default.createElement(
|
|
41408
|
-
|
|
41409
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
41410
|
-
themeState: state,
|
|
41411
|
-
themeFocused: isFocused
|
|
41412
|
-
}), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React__default.createElement(RichTextEditorInput, {
|
|
41482
|
+
}, label))), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, {
|
|
41483
|
+
themeHasLabel: !!label
|
|
41484
|
+
}, /*#__PURE__*/React__default.createElement(RichTextEditorInput, {
|
|
41413
41485
|
name: name,
|
|
41414
41486
|
value: value,
|
|
41415
41487
|
style: [style, {
|
|
@@ -41423,12 +41495,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41423
41495
|
onBlur: handleEditorBlur,
|
|
41424
41496
|
onFocus: handleEditorFocus,
|
|
41425
41497
|
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(
|
|
41427
|
-
testID: "input-error-icon",
|
|
41428
|
-
icon: "circle-info",
|
|
41429
|
-
size: "xsmall",
|
|
41430
|
-
intent: "danger"
|
|
41431
|
-
}), /*#__PURE__*/React__default.createElement(StyledError, {
|
|
41498
|
+
})))), /*#__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
41499
|
testID: "input-error-message"
|
|
41433
41500
|
}, error)) : !!helpText && /*#__PURE__*/React__default.createElement(StyledHelperText, null, helpText))));
|
|
41434
41501
|
};
|
|
@@ -41666,7 +41733,7 @@ var StyledInput = index$c(TextInput$1)(function (_ref4) {
|
|
|
41666
41733
|
return {
|
|
41667
41734
|
textAlignVertical: 'center',
|
|
41668
41735
|
fontSize: theme.__hd__.search.fontSizes.text,
|
|
41669
|
-
color: theme.__hd__.textInput.colors.text,
|
|
41736
|
+
color: theme.__hd__.textInput.colors.text["default"],
|
|
41670
41737
|
alignSelf: 'stretch',
|
|
41671
41738
|
flexGrow: 1,
|
|
41672
41739
|
flexShrink: 1,
|