sapo-components-ui-rn 1.1.54 → 1.1.55

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.
@@ -1,4 +1,4 @@
1
1
  import * as React from "react";
2
2
  import type { ChildTextInputProps } from "./types";
3
- declare const TextInputFlat: ({ disabled, editable, label, error, selectionColor: customSelectionColor, cursorColor, underlineColor, underlineStyle, activeUnderlineColor, textColor, dense, style, theme, render, multiline, parentState, innerRef, onFocus, forceFocus, onBlur, onChangeText, onLayoutAnimatedText, onLabelTextLayout, onLeftAffixLayoutChange, onRightAffixLayoutChange, onInputLayout, left, right, prefix, suffix, placeholderTextColor, clearButton, contentStyle, scaledLabel, outlineStyle, outlineColor, value, textError, required, labelScaleValue, textErrorStyle, ...rest }: ChildTextInputProps) => React.JSX.Element;
3
+ declare const TextInputFlat: ({ disabled, editable, label, error, selectionColor: customSelectionColor, cursorColor, underlineColor, underlineStyle, activeUnderlineColor, textColor, dense, style, theme, render, multiline, parentState, innerRef, onFocus, forceFocus, onBlur, onChangeText, onLayoutAnimatedText, onLabelTextLayout, onLeftAffixLayoutChange, onRightAffixLayoutChange, onInputLayout, left, right, prefix, suffix, placeholderTextColor, clearButton, contentStyle, scaledLabel, outlineStyle, outlineColor, value, textError, required, ...rest }: ChildTextInputProps) => React.JSX.Element;
4
4
  export default TextInputFlat;
package/dist/index.esm.js CHANGED
@@ -5084,8 +5084,8 @@ var SvgIcon = function (_a) {
5084
5084
  };
5085
5085
 
5086
5086
  var TextInputFlat = function (_a) {
5087
- var _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.editable, editable = _c === void 0 ? true : _c, label = _a.label, _d = _a.error, error = _d === void 0 ? false : _d, customSelectionColor = _a.selectionColor, cursorColor = _a.cursorColor, underlineColor = _a.underlineColor; _a.underlineStyle; var activeUnderlineColor = _a.activeUnderlineColor, textColor = _a.textColor, dense = _a.dense, style = _a.style, theme = _a.theme, _e = _a.render, render = _e === void 0 ? function (props) { return React$3.createElement(TextInput$1, __assign({}, props)); } : _e, _f = _a.multiline, multiline = _f === void 0 ? false : _f, parentState = _a.parentState, innerRef = _a.innerRef, onFocus = _a.onFocus; _a.forceFocus; var onBlur = _a.onBlur, onChangeText = _a.onChangeText, onLayoutAnimatedText = _a.onLayoutAnimatedText, onLabelTextLayout = _a.onLabelTextLayout; _a.onLeftAffixLayoutChange; _a.onRightAffixLayoutChange; var onInputLayout = _a.onInputLayout, left = _a.left, right = _a.right, prefix = _a.prefix, suffix = _a.suffix, placeholderTextColor = _a.placeholderTextColor, clearButton = _a.clearButton, contentStyle = _a.contentStyle, scaledLabel = _a.scaledLabel, outlineStyle = _a.outlineStyle, outlineColor = _a.outlineColor, value = _a.value, textError = _a.textError, required = _a.required, _g = _a.labelScaleValue, labelScaleValue = _g === void 0 ? MINIMIZED_LABEL_FONT_SIZE : _g, textErrorStyle = _a.textErrorStyle, rest = __rest(_a, ["disabled", "editable", "label", "error", "selectionColor", "cursorColor", "underlineColor", "underlineStyle", "activeUnderlineColor", "textColor", "dense", "style", "theme", "render", "multiline", "parentState", "innerRef", "onFocus", "forceFocus", "onBlur", "onChangeText", "onLayoutAnimatedText", "onLabelTextLayout", "onLeftAffixLayoutChange", "onRightAffixLayoutChange", "onInputLayout", "left", "right", "prefix", "suffix", "placeholderTextColor", "clearButton", "contentStyle", "scaledLabel", "outlineStyle", "outlineColor", "value", "textError", "required", "labelScaleValue", "textErrorStyle"]);
5088
- var _h = React$3.useState(value || ""), inputValue = _h[0], setInputValue = _h[1];
5087
+ var _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.editable, editable = _c === void 0 ? true : _c, label = _a.label, _d = _a.error, error = _d === void 0 ? false : _d, customSelectionColor = _a.selectionColor, cursorColor = _a.cursorColor, underlineColor = _a.underlineColor; _a.underlineStyle; var activeUnderlineColor = _a.activeUnderlineColor, textColor = _a.textColor, dense = _a.dense, style = _a.style, theme = _a.theme, _e = _a.render, render = _e === void 0 ? function (props) { return React$3.createElement(TextInput$1, __assign({}, props)); } : _e, _f = _a.multiline, multiline = _f === void 0 ? false : _f, parentState = _a.parentState, innerRef = _a.innerRef, onFocus = _a.onFocus; _a.forceFocus; var onBlur = _a.onBlur, onChangeText = _a.onChangeText, onLayoutAnimatedText = _a.onLayoutAnimatedText, onLabelTextLayout = _a.onLabelTextLayout; _a.onLeftAffixLayoutChange; _a.onRightAffixLayoutChange; var onInputLayout = _a.onInputLayout, left = _a.left, right = _a.right, prefix = _a.prefix, suffix = _a.suffix, placeholderTextColor = _a.placeholderTextColor, clearButton = _a.clearButton, contentStyle = _a.contentStyle, scaledLabel = _a.scaledLabel, outlineStyle = _a.outlineStyle, outlineColor = _a.outlineColor, value = _a.value, textError = _a.textError, required = _a.required, rest = __rest(_a, ["disabled", "editable", "label", "error", "selectionColor", "cursorColor", "underlineColor", "underlineStyle", "activeUnderlineColor", "textColor", "dense", "style", "theme", "render", "multiline", "parentState", "innerRef", "onFocus", "forceFocus", "onBlur", "onChangeText", "onLayoutAnimatedText", "onLabelTextLayout", "onLeftAffixLayoutChange", "onRightAffixLayoutChange", "onInputLayout", "left", "right", "prefix", "suffix", "placeholderTextColor", "clearButton", "contentStyle", "scaledLabel", "outlineStyle", "outlineColor", "value", "textError", "required"]);
5088
+ var _g = React$3.useState(value || ""), inputValue = _g[0], setInputValue = _g[1];
5089
5089
  React$3.useEffect(function () {
5090
5090
  if (value === undefined) {
5091
5091
  setInputValue("");
@@ -5107,37 +5107,37 @@ var TextInputFlat = function (_a) {
5107
5107
  var roundness = theme.roundness;
5108
5108
  var font = theme.fonts.bodyLarge;
5109
5109
  var hasActiveOutline = parentState.focused || error;
5110
- var _j = getConstants(), LABEL_PADDING_TOP = _j.LABEL_PADDING_TOP, FLAT_INPUT_OFFSET = _j.FLAT_INPUT_OFFSET, MIN_HEIGHT = _j.MIN_HEIGHT;
5111
- var _k = (StyleSheet.flatten(style) || {}), fontSizeStyle = _k.fontSize, lineHeightStyle = _k.lineHeight, fontWeight = _k.fontWeight, height = _k.height, paddingHorizontal = _k.paddingHorizontal; _k.textAlign; __rest(_k, ["fontSize", "lineHeight", "fontWeight", "height", "paddingHorizontal", "textAlign"]);
5110
+ var _h = getConstants(), LABEL_PADDING_TOP = _h.LABEL_PADDING_TOP, FLAT_INPUT_OFFSET = _h.FLAT_INPUT_OFFSET, MIN_HEIGHT = _h.MIN_HEIGHT;
5111
+ var _j = (StyleSheet.flatten(style) || {}), fontSizeStyle = _j.fontSize, lineHeightStyle = _j.lineHeight, fontWeight = _j.fontWeight, height = _j.height, paddingHorizontal = _j.paddingHorizontal; _j.textAlign; __rest(_j, ["fontSize", "lineHeight", "fontWeight", "height", "paddingHorizontal", "textAlign"]);
5112
5112
  var fontSize = fontSizeStyle || MAXIMIZED_LABEL_FONT_SIZE;
5113
5113
  var lineHeight = lineHeightStyle || (Platform.OS === "web" ? fontSize * 1.2 : undefined);
5114
5114
  var isPaddingHorizontalPassed = paddingHorizontal !== undefined && typeof paddingHorizontal === "number";
5115
5115
  var adornmentConfig = getAdornmentConfig({
5116
5116
  left: left,
5117
- right: right
5117
+ right: right,
5118
5118
  });
5119
- var _l = calculateFlatInputHorizontalPadding({
5120
- adornmentConfig: adornmentConfig
5121
- }), paddingLeft = _l.paddingLeft, paddingRight = _l.paddingRight;
5119
+ var _k = calculateFlatInputHorizontalPadding({
5120
+ adornmentConfig: adornmentConfig,
5121
+ }), paddingLeft = _k.paddingLeft, paddingRight = _k.paddingRight;
5122
5122
  if (isPaddingHorizontalPassed) {
5123
5123
  paddingLeft = paddingHorizontal;
5124
5124
  paddingRight = paddingHorizontal;
5125
5125
  }
5126
- var _m = getFlatInputColors({
5126
+ var _l = getFlatInputColors({
5127
5127
  underlineColor: underlineColor,
5128
5128
  activeUnderlineColor: activeUnderlineColor,
5129
5129
  customSelectionColor: customSelectionColor,
5130
5130
  textColor: textColor,
5131
5131
  disabled: disabled,
5132
5132
  error: error,
5133
- theme: theme
5134
- }), inputTextColor = _m.inputTextColor, activeColor = _m.activeColor, placeholderColor = _m.placeholderColor, errorColor = _m.errorColor, backgroundColor = _m.backgroundColor, selectionColor = _m.selectionColor;
5133
+ theme: theme,
5134
+ }), inputTextColor = _l.inputTextColor, activeColor = _l.activeColor, placeholderColor = _l.placeholderColor, errorColor = _l.errorColor, backgroundColor = _l.backgroundColor, selectionColor = _l.selectionColor;
5135
5135
  ({
5136
5136
  backgroundColor: backgroundColor,
5137
5137
  borderTopLeftRadius: theme.roundness,
5138
- borderTopRightRadius: theme.roundness
5138
+ borderTopRightRadius: theme.roundness,
5139
5139
  });
5140
- var labelScale = labelScaleValue / fontSize;
5140
+ var labelScale = MINIMIZED_LABEL_FONT_SIZE / fontSize;
5141
5141
  var fontScale = MAXIMIZED_LABEL_FONT_SIZE / fontSize;
5142
5142
  var labelWidth = parentState.labelLayout.width;
5143
5143
  var labelHeight = parentState.labelLayout.height;
@@ -5169,14 +5169,14 @@ var TextInputFlat = function (_a) {
5169
5169
  label: label,
5170
5170
  scale: fontScale,
5171
5171
  isAndroid: isAndroid,
5172
- styles: StyleSheet.flatten(dense ? styles$e.inputFlatDense : styles$e.inputFlat)
5172
+ styles: StyleSheet.flatten(dense ? styles$e.inputFlatDense : styles$e.inputFlat),
5173
5173
  };
5174
5174
  var pad = calculatePadding(paddingSettings);
5175
5175
  adjustPaddingFlat(__assign(__assign({}, paddingSettings), { pad: pad }));
5176
5176
  var baseLabelTranslateY = -labelHalfHeight - (topPosition + MINIMIZED_LABEL_Y_OFFSET);
5177
5177
  var placeholderOpacityAnims = React$3.useRef([
5178
5178
  new Animated$1.Value(0),
5179
- new Animated$1.Value(1)
5179
+ new Animated$1.Value(1),
5180
5180
  ]).current;
5181
5181
  var placeholderOpacity = hasActiveOutline
5182
5182
  ? parentState.labeled
@@ -5185,7 +5185,7 @@ var TextInputFlat = function (_a) {
5185
5185
  // Before it was done by setting placeholder's value to " ", but inputs have the same props
5186
5186
  // what causes broken styles due to: https://github.com/facebook/react-native/issues/48249
5187
5187
  var placeholderTextColorBasedOnState = parentState.displayPlaceholder
5188
- ? (placeholderTextColor !== null && placeholderTextColor !== void 0 ? placeholderTextColor : placeholderColor)
5188
+ ? placeholderTextColor !== null && placeholderTextColor !== void 0 ? placeholderTextColor : placeholderColor
5189
5189
  : "transparent";
5190
5190
  var minHeight = height ||
5191
5191
  (dense ? (label ? MIN_DENSE_HEIGHT_WL : MIN_DENSE_HEIGHT) : MIN_HEIGHT);
@@ -5228,7 +5228,7 @@ var TextInputFlat = function (_a) {
5228
5228
  ? parentState.labelLayout.measured
5229
5229
  ? 1
5230
5230
  : 0
5231
- : 1
5231
+ : 1,
5232
5232
  };
5233
5233
  var getBorderColor = function () {
5234
5234
  if (disabled) {
@@ -5248,7 +5248,7 @@ var TextInputFlat = function (_a) {
5248
5248
  var _a;
5249
5249
  if (parentState.focused) {
5250
5250
  return (React$3.createElement(View$1, { style: {
5251
- paddingBottom: Platform.OS === "ios" ? 9 : 14
5251
+ paddingBottom: Platform.OS === "ios" ? 9 : 14,
5252
5252
  } },
5253
5253
  React$3.createElement(Text$1, { color: theme.colors.textSecondary }, " ",
5254
5254
  suffix)));
@@ -5256,7 +5256,7 @@ var TextInputFlat = function (_a) {
5256
5256
  else if (parentState.value !== undefined &&
5257
5257
  ((_a = parentState.value) === null || _a === void 0 ? void 0 : _a.toString()) !== "") {
5258
5258
  return (React$3.createElement(View$1, { style: {
5259
- paddingBottom: Platform.OS === "ios" ? 9 : 14
5259
+ paddingBottom: Platform.OS === "ios" ? 9 : 14,
5260
5260
  } },
5261
5261
  React$3.createElement(Text$1, { color: theme.colors.textSecondary }, " ",
5262
5262
  suffix)));
@@ -5267,7 +5267,7 @@ var TextInputFlat = function (_a) {
5267
5267
  var _a;
5268
5268
  if (parentState.focused) {
5269
5269
  return (React$3.createElement(View$1, { style: {
5270
- paddingBottom: Platform.OS === "ios" ? 9 : 14
5270
+ paddingBottom: Platform.OS === "ios" ? 9 : 14,
5271
5271
  } },
5272
5272
  React$3.createElement(Text$1, { color: theme.colors.textSecondary },
5273
5273
  prefix, " ")));
@@ -5275,7 +5275,7 @@ var TextInputFlat = function (_a) {
5275
5275
  else if (parentState.value !== undefined &&
5276
5276
  ((_a = parentState.value) === null || _a === void 0 ? void 0 : _a.toString()) !== "") {
5277
5277
  return (React$3.createElement(View$1, { style: {
5278
- paddingBottom: Platform.OS === "ios" ? 9 : 14
5278
+ paddingBottom: Platform.OS === "ios" ? 9 : 14,
5279
5279
  } },
5280
5280
  React$3.createElement(Text$1, { color: theme.colors.textSecondary },
5281
5281
  prefix, " ")));
@@ -5298,17 +5298,17 @@ var TextInputFlat = function (_a) {
5298
5298
  borderRadius: BORDER_RADIUS_6,
5299
5299
  borderWidth: 1,
5300
5300
  borderColor: getBorderColor(),
5301
- height: inputHeight,
5301
+ height: 48,
5302
5302
  overflow: "hidden",
5303
5303
  backgroundColor: disabled
5304
5304
  ? theme.colors.surfacePrimaryDisabled
5305
- : theme.colors.surfacePrimaryDefault
5305
+ : theme.colors.surfacePrimaryDefault,
5306
5306
  } },
5307
5307
  React$3.createElement(View$1, { style: {
5308
5308
  flexDirection: "row",
5309
5309
  height: "100%",
5310
5310
  alignItems: "center",
5311
- justifyContent: "center"
5311
+ justifyContent: "center",
5312
5312
  } },
5313
5313
  left && React$3.createElement(View$1, { style: { paddingLeft: SPACE_12 } }, left),
5314
5314
  left ? React$3.createElement(Spacer, { width: SPACE_8 }) : React$3.createElement(Spacer, { width: SPACE_12 })),
@@ -5317,8 +5317,8 @@ var TextInputFlat = function (_a) {
5317
5317
  styles$e.labelContainer,
5318
5318
  {
5319
5319
  minHeight: minHeight,
5320
- flex: 1
5321
- }
5320
+ flex: 1,
5321
+ },
5322
5322
  ] },
5323
5323
  label ? (React$3.createElement(InputLabel$1, __assign({ inputValue: inputValue, labeled: parentState.labeled, error: parentState.error, focused: parentState.focused, scaledLabel: scaledLabel, wiggle: Boolean(parentState.value && labelProps.labelError), labelLayoutMeasured: parentState.labelLayout.measured, labelLayoutWidth: parentState.labelLayout.width, labelLayoutHeight: parentState.labelLayout.height, required: required }, labelProps))) : null,
5324
5324
  React$3.createElement(View$1, { style: { flexDirection: "row", alignItems: "flex-end" } },
@@ -5328,70 +5328,70 @@ var TextInputFlat = function (_a) {
5328
5328
  renderPrefix(), render === null || render === void 0 ? void 0 :
5329
5329
  render(__assign(__assign({}, rest), { ref: innerRef, onChangeText: handleChangeText, value: inputValue, placeholder: rest.placeholder, editable: !disabled && editable, selectionColor: selectionColor, cursorColor: typeof cursorColor === "undefined" ? activeColor : cursorColor, placeholderTextColor: placeholderTextColorBasedOnState, onFocus: onFocus, onBlur: onBlur, underlineColorAndroid: "transparent", multiline: multiline, style: [
5330
5330
  styles$e.input,
5331
- __assign(__assign({ height: inputHeight, paddingLeft: paddingLeft, paddingRight: paddingRight, paddingTop: parentState.focused || parentState.value
5331
+ __assign(__assign({ paddingLeft: paddingLeft, paddingRight: paddingRight, paddingTop: parentState.focused || parentState.value
5332
5332
  ? Platform.OS === "android"
5333
- ? inputHeight / 4 + inputHeight / 8
5334
- : inputHeight / 4
5333
+ ? SPACE_16
5334
+ : SPACE_12
5335
5335
  : 0 }, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: multiline ? "top" : "center", marginTop: Platform.OS === "android" ? SPACE_8 : SPACE_6 }),
5336
- contentStyle
5336
+ contentStyle,
5337
5337
  ] })),
5338
5338
  renderSuffix())),
5339
5339
  !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$e.clearButton },
5340
5340
  React$3.createElement(SvgIcon, { name: "IconClearText", width: 24, height: 24 }))) : (React$3.createElement(Spacer, { width: SPACE_12 })),
5341
5341
  checkLineRightAction() && (React$3.createElement(Spacer, { width: 1, height: 24, backgroundColor: theme.colors.borderPrimaryDefault, style: {
5342
- marginRight: SPACE_8
5342
+ marginRight: SPACE_8,
5343
5343
  } })),
5344
5344
  React$3.createElement(View$1, { style: {
5345
5345
  flexDirection: "row",
5346
5346
  height: "100%",
5347
5347
  alignItems: "center",
5348
- justifyContent: "center"
5348
+ justifyContent: "center",
5349
5349
  } },
5350
5350
  right && !clearButton && React$3.createElement(Spacer, { width: SPACE_8 }),
5351
5351
  right && (React$3.createElement(View$1, { style: {
5352
- paddingRight: SPACE_12
5352
+ paddingRight: SPACE_12,
5353
5353
  } }, right)))),
5354
5354
  error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View$1, { style: styles$e.vError },
5355
- React$3.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault, style: [textErrorStyle] }, textError)))));
5355
+ React$3.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError)))));
5356
5356
  };
5357
5357
  var styles$e = StyleSheet.create({
5358
5358
  placeholder: {
5359
5359
  position: "absolute",
5360
- left: 0
5360
+ left: 0,
5361
5361
  },
5362
5362
  labelContainer: {
5363
5363
  paddingTop: 0,
5364
- paddingBottom: 0
5364
+ paddingBottom: 0,
5365
5365
  // flex: 1,
5366
5366
  },
5367
5367
  input: {
5368
5368
  // margin: 0,
5369
5369
  flex: 1,
5370
- height: 48
5370
+ height: 48,
5371
5371
  },
5372
5372
  inputFlat: {
5373
5373
  paddingTop: 24,
5374
- paddingBottom: 4
5374
+ paddingBottom: 4,
5375
5375
  },
5376
5376
  inputFlatDense: {
5377
5377
  paddingTop: 22,
5378
- paddingBottom: 2
5378
+ paddingBottom: 2,
5379
5379
  },
5380
5380
  patchContainer: {
5381
5381
  height: 24,
5382
- zIndex: 2
5382
+ zIndex: 2,
5383
5383
  },
5384
5384
  densePatchContainer: {
5385
5385
  height: 22,
5386
- zIndex: 2
5386
+ zIndex: 2,
5387
5387
  },
5388
5388
  clearButton: {
5389
- padding: SPACE_6
5389
+ padding: SPACE_6,
5390
5390
  },
5391
5391
  vError: {
5392
5392
  paddingTop: SPACE_4,
5393
- paddingHorizontal: SPACE_12
5394
- }
5393
+ paddingHorizontal: SPACE_12,
5394
+ },
5395
5395
  });
5396
5396
 
5397
5397
  var TextInputDefault = function (_a) {