sapo-components-ui-rn 1.1.66 → 1.1.67

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/dist/index.esm.js CHANGED
@@ -76,14 +76,14 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
76
76
  var BLUE180 = "#0B1826";
77
77
  var BLUE160 = "#133457";
78
78
  var BLUE140 = "#144E8E";
79
- var BLUE120 = "#144E8E";
79
+ var BLUE120 = "#0061CC";
80
80
  var BLUE100 = "#0071ED";
81
81
  var BLUE80 = "#1F8DFF";
82
- var BLUE60 = "#4DA5FF";
83
- var BLUE40 = "#8CC9FE";
84
- var BLUE20 = "#B2DDFF";
85
- var BLUE10 = "#D9EEFF";
86
- var BLUE5 = "#F2F7FF";
82
+ var BLUE60 = "#4DA3FF";
83
+ var BLUE40 = "#8CC3FE";
84
+ var BLUE20 = "#B2D7FF";
85
+ var BLUE10 = "#D9EBFF";
86
+ var BLUE5 = "#F2F8FF";
87
87
  var blue = {
88
88
  BLUE180: BLUE180,
89
89
  BLUE160: BLUE160,
@@ -5426,6 +5426,26 @@ function formatNumberInput$1(value, formatDecimal) {
5426
5426
  result = "-" + result;
5427
5427
  return result;
5428
5428
  }
5429
+ function formatShowInput(value, formatDecimal) {
5430
+ if (!value)
5431
+ return "";
5432
+ if (value === "")
5433
+ return "";
5434
+ // Xử lý số âm
5435
+ var isNegative = value.startsWith("-");
5436
+ var _a = value.replace(/[^0-9.]/g, "").split("."), intPart = _a[0], decimalPart = _a[1];
5437
+ // Format phần nguyên
5438
+ intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, "");
5439
+ // Giới hạn phần thập phân 3 số
5440
+ if (decimalPart)
5441
+ decimalPart = decimalPart.slice(0, formatDecimal);
5442
+ var result = intPart;
5443
+ if (decimalPart !== undefined)
5444
+ result += "." + decimalPart;
5445
+ if (isNegative)
5446
+ result = "-" + result;
5447
+ return result;
5448
+ }
5429
5449
  var TextInputNumber = function (_a) {
5430
5450
  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"]);
5431
5451
  var theme = useInternalTheme();
@@ -5729,8 +5749,14 @@ var TextInputNumber = function (_a) {
5729
5749
  if (inputValue.endsWith(".")) {
5730
5750
  finalValue = inputValue.slice(0, -1);
5731
5751
  }
5752
+ if (formatDecimal) {
5753
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(formatShowInput(finalValue, formatDecimal));
5754
+ }
5755
+ else {
5756
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(finalValue);
5757
+ }
5732
5758
  // Luôn truyền giá trị gốc (không format) để giữ nguyên dạng số
5733
- onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(finalValue);
5759
+ // onChangeText?.(finalValue);
5734
5760
  setIsShowModalKeyboard(false);
5735
5761
  };
5736
5762
  var checkValueEmpty = function () {
@@ -5773,7 +5799,7 @@ var TextInputNumber = function (_a) {
5773
5799
  borderRadius: BORDER_RADIUS_6,
5774
5800
  },
5775
5801
  {
5776
- height: height ? height : 48,
5802
+ height: height ? height : 56,
5777
5803
  },
5778
5804
  [
5779
5805
  styles$c.border,
@@ -5805,7 +5831,7 @@ var TextInputNumber = function (_a) {
5805
5831
  left && (React__default.createElement(View, { center: true, paddingRight: SPACE_8, height: "100%" }, left)),
5806
5832
  React__default.createElement(View, { full: true, paddingRight: SPACE_4 },
5807
5833
  !checkValueEmpty() && !checkLabelEmpty() && (React__default.createElement(View, null,
5808
- React__default.createElement(Text$1, { size: 12, color: colors.textSecondary, style: [
5834
+ React__default.createElement(Text$1, { size: 14, color: colors.textSecondary, style: [
5809
5835
  labelStyle,
5810
5836
  disabled && {
5811
5837
  color: colors.textPlaceholder,
@@ -5822,11 +5848,7 @@ var TextInputNumber = function (_a) {
5822
5848
  !checkValueEmpty() && prefix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [contentStyle, , disabled && disabledTextStyle] },
5823
5849
  prefix, " ")),
5824
5850
  React__default.createElement(View, { full: true },
5825
- React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [
5826
- styles$c.text14,
5827
- contentStyle,
5828
- disabled && disabledTextStyle,
5829
- ] },
5851
+ React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [contentStyle, disabled && disabledTextStyle] },
5830
5852
  checkValueEmpty()
5831
5853
  ? label
5832
5854
  : formatNumberInput$1(numberValue, formatDecimal),
@@ -5846,7 +5868,7 @@ var TextInputNumber = function (_a) {
5846
5868
  right && (React__default.createElement(View, { center: true, paddingLeft: SPACE_8, height: "100%" }, right)),
5847
5869
  React__default.createElement(Spacer, { width: SPACE_12 }))),
5848
5870
  !disabled && textError.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
5849
- React__default.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault, style: [textErrorStyle] }, textError))),
5871
+ React__default.createElement(Text$1, { size: 14, numberOfLines: 1, color: theme.colors.textErrorDefault, style: [textErrorStyle] }, textError))),
5850
5872
  React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade", onRequestClose: onCloseModalKeyboard },
5851
5873
  React__default.createElement(TouchableOpacity, { style: styles$c.modalOverlay, activeOpacity: 1, onPress: onCloseModalKeyboard },
5852
5874
  React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles$c.modalContent },