sapo-components-ui-rn 1.1.56 → 1.1.57

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.
@@ -15,6 +15,10 @@ export type Props = React.ComponentPropsWithRef<typeof NativeTextInput> & {
15
15
  type?: "integer" | "float";
16
16
  formatDecimal?: 1 | 2 | 3;
17
17
  required?: boolean;
18
+ labelScaleValue?: number;
19
+ labelStyle?: StyleProp<TextStyle>;
20
+ textErrorStyle?: StyleProp<TextStyle>;
21
+ height?: number;
18
22
  /**
19
23
  * If true, user won't be able to interact with the component.
20
24
  */
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { StyleProp, ViewStyle, TouchableOpacityProps } from "react-native";
2
+ import { StyleProp, ViewStyle, TouchableOpacityProps, TextStyle } from "react-native";
3
3
  import { ThemeProp } from "../../types";
4
4
  export interface TextInputNumberProps extends TouchableOpacityProps {
5
5
  style?: StyleProp<ViewStyle>;
@@ -19,6 +19,10 @@ export interface TextInputNumberProps extends TouchableOpacityProps {
19
19
  type?: "integer" | "float";
20
20
  formatDecimal?: 1 | 2 | 3;
21
21
  required?: boolean;
22
+ labelStyle?: StyleProp<TextStyle>;
23
+ contentStyle?: StyleProp<TextStyle>;
24
+ textErrorStyle?: StyleProp<TextStyle>;
25
+ height?: number;
22
26
  }
23
- declare const _default: React.MemoExoticComponent<({ style, value, label, textError, left, right, onChangeText, disabled, theme: themeOverrides, prefix, suffix, clearButton, maxValue, minValue, type, formatDecimal, required, ...props }: TextInputNumberProps) => React.JSX.Element>;
27
+ declare const _default: React.MemoExoticComponent<({ style, value, label, textError, left, right, onChangeText, disabled, theme: themeOverrides, prefix, suffix, clearButton, maxValue, minValue, type, formatDecimal, required, labelStyle, contentStyle, textErrorStyle, height, ...props }: TextInputNumberProps) => React.JSX.Element>;
24
28
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { TextInput as NativeTextInput, Animated, TextStyle, LayoutChangeEvent, ColorValue, StyleProp, ViewProps, ViewStyle, NativeSyntheticEvent, TextLayoutEventData } from "react-native";
2
+ import type { TextInput as NativeTextInput, Animated, TextStyle, LayoutChangeEvent, ColorValue, StyleProp, ViewProps, ViewStyle, NativeSyntheticEvent, TextLayoutEventData, TextProps } from "react-native";
3
3
  import type { $Omit, InternalTheme, ThemeProp } from "./../../types";
4
4
  export type TextInputLabelProp = string | React.ReactElement;
5
5
  type TextInputProps = React.ComponentPropsWithRef<typeof NativeTextInput> & {
@@ -79,6 +79,7 @@ export type State = {
79
79
  width: number;
80
80
  };
81
81
  contentStyle?: StyleProp<ViewProps>;
82
+ labelStyle?: StyleProp<TextProps>;
82
83
  };
83
84
  export type ChildTextInputProps = {
84
85
  parentState: State;
@@ -97,6 +98,10 @@ export type ChildTextInputProps = {
97
98
  suffix?: string;
98
99
  textError?: string;
99
100
  required?: boolean;
101
+ labelStyle?: StyleProp<TextStyle>;
102
+ labelScaleValue?: number;
103
+ textErrorStyle?: StyleProp<TextStyle>;
104
+ inputHeight?: number;
100
105
  } & $Omit<TextInputTypesWithoutMode, "theme"> & {
101
106
  theme: InternalTheme;
102
107
  };
package/dist/index.esm.js CHANGED
@@ -5661,7 +5661,7 @@ function formatNumberInput$1(value, formatDecimal) {
5661
5661
  return result;
5662
5662
  }
5663
5663
  var TextInputNumber = function (_a) {
5664
- var style = _a.style, _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.textError, textError = _d === void 0 ? "" : _d, left = _a.left, right = _a.right, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.suffix, suffix = _g === void 0 ? "" : _g, _h = _a.clearButton, clearButton = _h === void 0 ? false : _h, _j = _a.maxValue, maxValue = _j === void 0 ? 999999999999 : _j, _k = _a.minValue, minValue = _k === void 0 ? 0 : _k, _l = _a.type, type = _l === void 0 ? "integer" : _l, _m = _a.formatDecimal, formatDecimal = _m === void 0 ? 3 : _m, _o = _a.required, required = _o === void 0 ? false : _o, props = __rest(_a, ["style", "value", "label", "textError", "left", "right", "onChangeText", "disabled", "theme", "prefix", "suffix", "clearButton", "maxValue", "minValue", "type", "formatDecimal", "required"]);
5664
+ var style = _a.style, _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.textError, textError = _d === void 0 ? "" : _d, left = _a.left, right = _a.right, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.suffix, suffix = _g === void 0 ? "" : _g, _h = _a.clearButton, clearButton = _h === void 0 ? false : _h, _j = _a.maxValue, maxValue = _j === void 0 ? 999999999999 : _j, _k = _a.minValue, minValue = _k === void 0 ? 0 : _k, _l = _a.type, type = _l === void 0 ? "integer" : _l, _m = _a.formatDecimal, formatDecimal = _m === void 0 ? 3 : _m, _o = _a.required, required = _o === void 0 ? false : _o, labelStyle = _a.labelStyle, contentStyle = _a.contentStyle, textErrorStyle = _a.textErrorStyle, height = _a.height, props = __rest(_a, ["style", "value", "label", "textError", "left", "right", "onChangeText", "disabled", "theme", "prefix", "suffix", "clearButton", "maxValue", "minValue", "type", "formatDecimal", "required", "labelStyle", "contentStyle", "textErrorStyle", "height"]);
5665
5665
  var theme = useInternalTheme();
5666
5666
  var colors = theme.colors;
5667
5667
  var _p = useState(false), isShowModalKeyboard = _p[0], setIsShowModalKeyboard = _p[1];
@@ -6006,6 +6006,9 @@ var TextInputNumber = function (_a) {
6006
6006
  {
6007
6007
  borderRadius: BORDER_RADIUS_6,
6008
6008
  },
6009
+ {
6010
+ height: height ? height : 48,
6011
+ },
6009
6012
  [
6010
6013
  styles$c.border,
6011
6014
  {
@@ -6037,6 +6040,7 @@ var TextInputNumber = function (_a) {
6037
6040
  React__default.createElement(View, { full: true, paddingRight: SPACE_4 },
6038
6041
  !checkValueEmpty() && !checkLabelEmpty() && (React__default.createElement(View, null,
6039
6042
  React__default.createElement(Text$1, { size: 12, color: colors.textSecondary, style: [
6043
+ labelStyle,
6040
6044
  disabled && {
6041
6045
  color: colors.textPlaceholder,
6042
6046
  },
@@ -6045,17 +6049,25 @@ var TextInputNumber = function (_a) {
6045
6049
  },
6046
6050
  ] },
6047
6051
  label,
6048
- required && React__default.createElement(Text$1, { color: colors.textErrorDefault }, " *")))),
6052
+ required && (React__default.createElement(Text$1, { style: [labelStyle], color: colors.textErrorDefault },
6053
+ " ",
6054
+ "*"))))),
6049
6055
  React__default.createElement(View, { row: true, alignCenter: true },
6050
- !checkValueEmpty() && prefix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [disabled && disabledTextStyle] },
6056
+ !checkValueEmpty() && prefix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [contentStyle, , disabled && disabledTextStyle] },
6051
6057
  prefix, " ")),
6052
6058
  React__default.createElement(View, { full: true },
6053
- React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [styles$c.text14, disabled && disabledTextStyle] },
6059
+ React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [
6060
+ styles$c.text14,
6061
+ contentStyle,
6062
+ disabled && disabledTextStyle,
6063
+ ] },
6054
6064
  checkValueEmpty()
6055
6065
  ? label
6056
6066
  : formatNumberInput$1(numberValue, formatDecimal),
6057
- checkValueEmpty() && required && (React__default.createElement(Text$1, { color: colors.textErrorDefault }, " *")))),
6058
- !checkValueEmpty() && suffix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [disabled && disabledTextStyle] }, " ",
6067
+ checkValueEmpty() && required && (React__default.createElement(Text$1, { style: [contentStyle], color: colors.textErrorDefault },
6068
+ " ",
6069
+ "*")))),
6070
+ !checkValueEmpty() && suffix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [contentStyle, disabled && disabledTextStyle] }, " ",
6059
6071
  suffix)))),
6060
6072
  clearButton && !checkValueEmpty() && (React__default.createElement(TouchableOpacity, { style: {
6061
6073
  alignContent: "center",
@@ -6068,7 +6080,7 @@ var TextInputNumber = function (_a) {
6068
6080
  right && (React__default.createElement(View, { center: true, paddingLeft: SPACE_8, height: "100%" }, right)),
6069
6081
  React__default.createElement(Spacer, { width: SPACE_12 }))),
6070
6082
  !disabled && textError.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
6071
- React__default.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError))),
6083
+ React__default.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault, style: [textErrorStyle] }, textError))),
6072
6084
  React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade", onRequestClose: onCloseModalKeyboard },
6073
6085
  React__default.createElement(TouchableOpacity, { style: styles$c.modalOverlay, activeOpacity: 1, onPress: onCloseModalKeyboard },
6074
6086
  React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles$c.modalContent },
@@ -6118,7 +6130,8 @@ var styles$c = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
6118
6130
  height: 48,
6119
6131
  flexDirection: "row",
6120
6132
  justifyContent: "space-between",
6121
- paddingVertical: Platform.OS === "android" ? 3 : SPACE_6,
6133
+ alignItems: "center",
6134
+ // paddingVertical: Platform.OS === "android" ? 3 : SPACE_6
6122
6135
  }, border: {
6123
6136
  borderWidth: BORDER_WIDTH_1,
6124
6137
  }, small: {
@@ -6208,7 +6221,7 @@ var DefaultRenderer = function (props) { return React__default.createElement(Tex
6208
6221
  * @extends TextInput props https://reactnative.dev/docs/textinput#props
6209
6222
  */
6210
6223
  var TextInput = forwardRef(function (_a, ref) {
6211
- var _b = _a.mode, mode = _b === void 0 ? "flat" : _b, _c = _a.dense, dense = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.error, errorProp = _e === void 0 ? false : _e, _f = _a.multiline, multiline = _f === void 0 ? false : _f, _g = _a.editable, editable = _g === void 0 ? true : _g, contentStyle = _a.contentStyle, _h = _a.render, render = _h === void 0 ? DefaultRenderer : _h; _a.theme; var placeholderTextColor = _a.placeholderTextColor, clearButton = _a.clearButton, textError = _a.textError, prefix = _a.prefix, suffix = _a.suffix, maxValue = _a.maxValue, minValue = _a.minValue, type = _a.type, _j = _a.required, required = _j === void 0 ? false : _j, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix", "suffix", "maxValue", "minValue", "type", "required"]);
6224
+ var _b = _a.mode, mode = _b === void 0 ? "flat" : _b, _c = _a.dense, dense = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.error, errorProp = _e === void 0 ? false : _e, _f = _a.multiline, multiline = _f === void 0 ? false : _f, _g = _a.editable, editable = _g === void 0 ? true : _g, contentStyle = _a.contentStyle, _h = _a.render, render = _h === void 0 ? DefaultRenderer : _h; _a.theme; var placeholderTextColor = _a.placeholderTextColor, clearButton = _a.clearButton, textError = _a.textError, prefix = _a.prefix, suffix = _a.suffix, maxValue = _a.maxValue, minValue = _a.minValue, type = _a.type, _j = _a.required, required = _j === void 0 ? false : _j, labelStyle = _a.labelStyle, textErrorStyle = _a.textErrorStyle, height = _a.height, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix", "suffix", "maxValue", "minValue", "type", "required", "labelStyle", "textErrorStyle", "height"]);
6212
6225
  var theme = useInternalTheme();
6213
6226
  var isControlled = rest.value !== undefined;
6214
6227
  var validInputValue = isControlled ? rest.value : rest.defaultValue;
@@ -6410,7 +6423,7 @@ var TextInput = forwardRef(function (_a, ref) {
6410
6423
  }, onFocus: handleFocus, forceFocus: forceFocus, onBlur: handleBlur, allowFontScaling: false, onChangeText: handleChangeText, onLayoutAnimatedText: handleLayoutAnimatedText, onInputLayout: handleInputContainerLayout, onLabelTextLayout: handleLabelTextLayout, onLeftAffixLayoutChange: onLeftAffixLayoutChange, onRightAffixLayoutChange: onRightAffixLayoutChange, maxFontSizeMultiplier: maxFontSizeMultiplier, contentStyle: contentStyle, scaledLabel: scaledLabel })));
6411
6424
  }
6412
6425
  if (mode === "number") {
6413
- return (React__default.createElement(TextInputNumber$1, { textError: textError, disabled: disabled, prefix: prefix, suffix: suffix, value: value, right: rest.right, left: rest.left, required: required, label: rest.label, clearButton: clearButton, onChangeText: handleChangeText, maxValue: maxValue, minValue: minValue, formatDecimal: rest.formatDecimal, type: type }));
6426
+ return (React__default.createElement(TextInputNumber$1, { textError: textError, disabled: disabled, prefix: prefix, suffix: suffix, value: value, right: rest.right, left: rest.left, required: required, label: rest.label, clearButton: clearButton, onChangeText: handleChangeText, maxValue: maxValue, minValue: minValue, formatDecimal: rest.formatDecimal, type: type, labelStyle: labelStyle, textErrorStyle: textErrorStyle, contentStyle: contentStyle, height: height }));
6414
6427
  }
6415
6428
  return (React__default.createElement(TextInputFlat, __assign({ dense: dense, disabled: disabled, error: errorProp, textError: textError, editable: editable, prefix: prefix, suffix: suffix, clearButton: clearButton, required: required, render: render }, rest, { theme: theme, value: value, parentState: {
6416
6429
  labeled: labeled,