sapo-components-ui-rn 1.1.96 → 1.1.98

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,5 +1,5 @@
1
- import React from 'react';
2
- import { ViewStyle, StyleProp } from 'react-native';
1
+ import React from "react";
2
+ import { ViewStyle, StyleProp } from "react-native";
3
3
  export interface NumberKeyboardProps {
4
4
  /** Giá trị hiện tại của input */
5
5
  value?: string | number;
@@ -12,7 +12,7 @@ export interface NumberKeyboardProps {
12
12
  /** Giá trị tối thiểu cho phép */
13
13
  minValue?: number;
14
14
  /** Loại input: integer hoặc float */
15
- type?: 'integer' | 'float';
15
+ type?: "integer" | "float";
16
16
  /** Số chữ số thập phân cho phép */
17
17
  formatDecimal?: 1 | 2 | 3;
18
18
  /** Trạng thái hiển thị modal */
package/dist/index.esm.js CHANGED
@@ -5394,7 +5394,7 @@ function formatNumberInput$1(value, formatDecimal) {
5394
5394
  result = "-" + result;
5395
5395
  return result;
5396
5396
  }
5397
- function formatShowInput(value, formatDecimal) {
5397
+ function formatShowInput$1(value, formatDecimal) {
5398
5398
  if (!value)
5399
5399
  return "";
5400
5400
  if (value === "")
@@ -5755,7 +5755,7 @@ var TextInputNumber = function (_a) {
5755
5755
  finalValue = inputValue.slice(0, -1);
5756
5756
  }
5757
5757
  if (formatDecimal) {
5758
- onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(formatShowInput(finalValue, formatDecimal));
5758
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(formatShowInput$1(finalValue, formatDecimal));
5759
5759
  }
5760
5760
  else {
5761
5761
  onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(finalValue);
@@ -7336,40 +7336,50 @@ var styles$1 = StyleSheet.create(__assign({}, containerStyles));
7336
7336
 
7337
7337
  var formatNumberInput = function (value, formatDecimal) {
7338
7338
  if (!value)
7339
- return '';
7340
- if (value === '')
7341
- return '';
7342
- // Xử lý số âm
7343
- var isNegative = value.startsWith('-');
7344
- var _a = value.replace(/[^0-9.]/g, '').split('.'), intPart = _a[0], decimalPart = _a[1];
7345
- // Format phần nguyên
7346
- intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
7347
- // Giới hạn phần thập phân 3 số
7339
+ return "";
7340
+ if (value === "")
7341
+ return "";
7342
+ var isNegative = value.startsWith("-");
7343
+ var _a = value.replace(/[^0-9.]/g, "").split("."), intPart = _a[0], decimalPart = _a[1];
7344
+ intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
7345
+ if (decimalPart)
7346
+ decimalPart = decimalPart.slice(0, formatDecimal);
7347
+ var result = intPart;
7348
+ if (decimalPart !== undefined)
7349
+ result += "." + decimalPart;
7350
+ if (isNegative)
7351
+ result = "-" + result;
7352
+ return result;
7353
+ };
7354
+ var formatShowInput = function (value, formatDecimal) {
7355
+ if (!value)
7356
+ return "";
7357
+ if (value === "")
7358
+ return "";
7359
+ var isNegative = value.startsWith("-");
7360
+ var _a = value.replace(/[^0-9.]/g, "").split("."), intPart = _a[0], decimalPart = _a[1];
7361
+ intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, "");
7348
7362
  if (decimalPart)
7349
7363
  decimalPart = decimalPart.slice(0, formatDecimal);
7350
7364
  var result = intPart;
7351
7365
  if (decimalPart !== undefined)
7352
- result += '.' + decimalPart;
7366
+ result += "." + decimalPart;
7353
7367
  if (isNegative)
7354
- result = '-' + result;
7368
+ result = "-" + result;
7355
7369
  return result;
7356
7370
  };
7357
7371
  var NumberKeyboard = function (_a) {
7358
- var _b = _a.value, value = _b === void 0 ? '' : _b, _c = _a.label, label = _c === void 0 ? '' : _c, onChangeText = _a.onChangeText, _d = _a.maxValue, maxValue = _d === void 0 ? 999999999999 : _d, _e = _a.minValue, minValue = _e === void 0 ? 0 : _e, _f = _a.type, type = _f === void 0 ? 'integer' : _f, _g = _a.formatDecimal, formatDecimal = _g === void 0 ? 3 : _g, visible = _a.visible, onClose = _a.onClose, keyboardStyle = _a.keyboardStyle;
7372
+ var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, onChangeText = _a.onChangeText, _d = _a.maxValue, maxValue = _d === void 0 ? 999999999999 : _d, _e = _a.minValue, minValue = _e === void 0 ? 0 : _e, _f = _a.type, type = _f === void 0 ? "integer" : _f, _g = _a.formatDecimal, formatDecimal = _g === void 0 ? 3 : _g, visible = _a.visible, onClose = _a.onClose, keyboardStyle = _a.keyboardStyle;
7359
7373
  var theme = useInternalTheme();
7360
7374
  var colors = theme.colors;
7361
- var _h = useState((value === null || value === void 0 ? void 0 : value.toString()) || ''), inputValue = _h[0], setInputValue = _h[1];
7375
+ var _h = useState((value === null || value === void 0 ? void 0 : value.toString()) || ""), inputValue = _h[0], setInputValue = _h[1];
7362
7376
  var _j = useState(true), isFirstInput = _j[0], setIsFirstInput = _j[1];
7363
7377
  var _k = useState(true), canSave = _k[0], setCanSave = _k[1];
7364
7378
  useEffect(function () {
7365
7379
  if (visible) {
7366
- var newValue = (value === null || value === void 0 ? void 0 : value.toString()) || '';
7380
+ var newValue = (value === null || value === void 0 ? void 0 : value.toString()) || "";
7367
7381
  setInputValue(newValue);
7368
- // Logic mới: Không reset về trạng thái nhập mới khi đã có giá trị
7369
- // Chỉ set isFirstInput = true khi newValue rỗng hoặc chỉ có dấu trừ
7370
- // Điều này cho phép người dùng tiếp tục nhập từ giá trị hiện tại
7371
- // Ví dụ: value=999, người dùng có thể nhập "000" để tạo "999000"
7372
- if (newValue === '' || newValue === '-') {
7382
+ if (newValue === "" || newValue === "-") {
7373
7383
  setIsFirstInput(true);
7374
7384
  }
7375
7385
  else {
@@ -7381,68 +7391,71 @@ var NumberKeyboard = function (_a) {
7381
7391
  var currentValue = Number(inputValue);
7382
7392
  var minValueNumber = Number(minValue);
7383
7393
  var maxValueNumber = Number(maxValue);
7384
- // Kiểm tra canSave với logic mới để hỗ trợ số âm
7385
- // Ví dụ: value=-100, maxValue=999999999999, minValue=0
7386
- // -100 < 0 (minValue) nhưng |-100| = 100 <= 999999999999 (maxValue) → canSave = true
7387
7394
  var isValid = false;
7388
7395
  if (!isNaN(currentValue) &&
7389
7396
  !isNaN(minValueNumber) &&
7390
7397
  !isNaN(maxValueNumber)) {
7391
7398
  if (currentValue < 0) {
7392
- // Với số âm, kiểm tra giá trị tuyệt đối không vượt quá maxValue
7393
- // và giá trị không nhỏ hơn minValue (nếu minValue cũng là số âm)
7394
7399
  var absCurrent = Math.abs(currentValue);
7395
7400
  var absMaxValue = Math.abs(maxValueNumber);
7396
7401
  if (minValueNumber < 0) {
7397
- // Nếu minValue cũng là số âm, kiểm tra currentValue >= minValue
7398
7402
  isValid = currentValue >= minValueNumber && absCurrent <= absMaxValue;
7399
7403
  }
7400
7404
  else {
7401
- // Nếu minValue là số dương hoặc 0, chỉ kiểm tra giá trị tuyệt đối
7402
- // Điều này cho phép số âm luôn được lưu nếu không vượt quá maxValue
7403
7405
  isValid = absCurrent <= absMaxValue;
7404
7406
  }
7405
7407
  }
7406
7408
  else {
7407
- // Với số dương, kiểm tra bình thường
7408
7409
  isValid =
7409
7410
  currentValue >= minValueNumber && currentValue <= maxValueNumber;
7410
7411
  }
7411
7412
  }
7412
7413
  setCanSave(isValid);
7413
7414
  }, [inputValue, minValue, maxValue]);
7415
+ // Integer: chỉ cho phép "000" khi value hiện tại khác 0 (vd: 1→1000).
7416
+ // Rỗng / 0 / chỉ dấu "-" → disable nút 000.
7417
+ var is000Disabled = useMemo(function () {
7418
+ if (type !== "integer") {
7419
+ return true;
7420
+ }
7421
+ if (!inputValue || inputValue === "-") {
7422
+ return true;
7423
+ }
7424
+ var numericValue = Number(inputValue);
7425
+ return isNaN(numericValue) || numericValue === 0;
7426
+ }, [type, inputValue]);
7427
+ // Float: cho phép nhập "0" khi value rỗng, nhưng không cho "00" liên tiếp ở phần nguyên.
7428
+ var is0Disabled = useMemo(function () {
7429
+ if (type !== "float") {
7430
+ return false;
7431
+ }
7432
+ return inputValue === "0" || inputValue === "-0";
7433
+ }, [type, inputValue]);
7414
7434
  var handleKeyPress = function (key) {
7415
- if (key === 'del') {
7435
+ if (key === "del") {
7416
7436
  setInputValue(function (prev) { return prev.slice(0, -1); });
7417
7437
  }
7418
- else if (key === '000') {
7419
- if (type === 'integer') {
7420
- // Xử lý trường hợp nhập "000" để tạo số lớn hơn
7421
- // Ví dụ: "1" + "000" = "1000", "10" + "000" = "10000"
7422
- // Nếu vượt quá maxValue, sẽ tự động cắt bớt số 0
7423
- // Logic này đảm bảo người dùng có thể tiếp tục nhập số đã được khởi tạo
7424
- // Ví dụ: value=999, người dùng có thể nhập "000" để tạo "999000"
7425
- var newInputValue = inputValue + '000';
7438
+ else if (key === "000") {
7439
+ if (type === "integer") {
7440
+ if (is000Disabled) {
7441
+ return;
7442
+ }
7443
+ var newInputValue = inputValue + "000";
7426
7444
  var newValue = Number(newInputValue);
7427
7445
  var maxValueNumber = Number(maxValue);
7428
- // Kiểm tra nếu giá trị vượt quá maxValue, cắt bớt số 0
7429
7446
  if (!isNaN(newValue) &&
7430
7447
  !isNaN(maxValueNumber) &&
7431
7448
  newValue > maxValueNumber) {
7432
- // Tìm số 0 tối đa có thể thêm vào mà không vượt quá maxValue
7433
7449
  var tempValue = inputValue;
7434
- var tempNewValue = Number(tempValue + '000');
7435
- // Giảm dần số 0 cho đến khi không vượt quá maxValue
7436
- while (tempNewValue > maxValueNumber && tempValue.endsWith('0')) {
7450
+ var tempNewValue = Number(tempValue + "000");
7451
+ while (tempNewValue > maxValueNumber && tempValue.endsWith("0")) {
7437
7452
  tempValue = tempValue.slice(0, -1);
7438
- tempNewValue = Number(tempValue + '000');
7453
+ tempNewValue = Number(tempValue + "000");
7439
7454
  }
7440
- // Nếu vẫn vượt quá, chỉ thêm số 0 có thể
7441
7455
  if (tempNewValue > maxValueNumber) {
7442
- // Tìm số 0 tối đa có thể thêm
7443
7456
  var maxZeros = 0;
7444
7457
  for (var i = 1; i <= 3; i++) {
7445
- var testValue = Number(inputValue + '0'.repeat(i));
7458
+ var testValue = Number(inputValue + "0".repeat(i));
7446
7459
  if (testValue <= maxValueNumber) {
7447
7460
  maxZeros = i;
7448
7461
  }
@@ -7451,20 +7464,18 @@ var NumberKeyboard = function (_a) {
7451
7464
  }
7452
7465
  }
7453
7466
  if (maxZeros > 0) {
7454
- newInputValue = inputValue + '0'.repeat(maxZeros);
7467
+ newInputValue = inputValue + "0".repeat(maxZeros);
7455
7468
  newValue = Number(newInputValue);
7456
7469
  }
7457
7470
  else {
7458
- // Không thể thêm số 0 nào
7459
7471
  return;
7460
7472
  }
7461
7473
  }
7462
7474
  else {
7463
- newInputValue = tempValue + '000';
7475
+ newInputValue = tempValue + "000";
7464
7476
  newValue = Number(newInputValue);
7465
7477
  }
7466
7478
  }
7467
- // Kiểm tra xem có thể nhập được không sau khi xử lý "000"
7468
7479
  if (!isNaN(newValue) &&
7469
7480
  !isNaN(maxValueNumber) &&
7470
7481
  newValue <= maxValueNumber) {
@@ -7472,84 +7483,72 @@ var NumberKeyboard = function (_a) {
7472
7483
  }
7473
7484
  setIsFirstInput(false);
7474
7485
  }
7475
- // Nếu type là float, không cho phép nhập "000" ở đầu
7476
7486
  }
7477
- else if (key === '.') {
7478
- if (!inputValue.includes('.')) {
7479
- // Nếu inputValue là "0" hoặc rỗng, giữ lại số 0 và thêm dấu "."
7480
- if (inputValue === '0' || inputValue === '') {
7481
- setInputValue('0.');
7487
+ else if (key === ".") {
7488
+ if (!inputValue.includes(".")) {
7489
+ if (inputValue === "0" || inputValue === "") {
7490
+ setInputValue("0.");
7482
7491
  }
7483
- else if (inputValue === '-') {
7484
- // Nếu chỉ có dấu trừ, thêm "0."
7485
- setInputValue('-0.');
7492
+ else if (inputValue === "-" || inputValue === "-0") {
7493
+ setInputValue("-0.");
7486
7494
  }
7487
7495
  else {
7488
- // Nếu đã có giá trị, thêm dấu "." vào cuối
7489
7496
  setInputValue(function (prev) { return prev + key; });
7490
7497
  }
7491
7498
  setIsFirstInput(false);
7492
7499
  }
7493
7500
  }
7494
7501
  else {
7502
+ if (key === "0" && is0Disabled) {
7503
+ return;
7504
+ }
7495
7505
  if (isFirstInput) {
7496
- // Nếu type là float và key là "0", không cho phép nhập số 0 đầu tiên
7497
- if (type === 'float' && key === '000') {
7506
+ if (type === "float" && key === "000") {
7498
7507
  return;
7499
7508
  }
7500
- // Cho phép nhập số 0 đầu tiên cho type float, nhưng không cho phép nhập "000"
7501
- // Kiểm tra xem có thể nhập được không khi là lần đầu
7502
7509
  var newValue = Number(key);
7503
7510
  var maxValueNumber = Number(maxValue);
7504
7511
  if (!isNaN(newValue) && !isNaN(maxValueNumber)) {
7505
7512
  var canInput = false;
7506
7513
  if (newValue < 0) {
7507
- // Với số âm, kiểm tra giá trị tuyệt đối không vượt quá maxValue
7508
7514
  var absNewValue = Math.abs(newValue);
7509
7515
  var absMaxValue = Math.abs(maxValueNumber);
7510
7516
  canInput = absNewValue <= absMaxValue;
7511
7517
  }
7512
7518
  else {
7513
- // Với số dương, kiểm tra bình thường
7514
7519
  canInput = newValue <= maxValueNumber;
7515
7520
  }
7516
7521
  if (canInput) {
7517
- // Nếu inputValue rỗng hoặc chỉ có dấu trừ, thay thế hoàn toàn
7518
- if (inputValue === '' || inputValue === '-') {
7522
+ if (inputValue === "" || inputValue === "-") {
7519
7523
  setInputValue(key);
7520
7524
  }
7521
7525
  else {
7522
- // Nếu đã có giá trị, thêm vào cuối
7523
7526
  setInputValue(inputValue + key);
7524
7527
  }
7525
7528
  setIsFirstInput(false);
7526
7529
  }
7527
7530
  else {
7528
- // Nếu vượt quá maxValue ngay từ đầu, không cho phép nhập
7529
7531
  return;
7530
7532
  }
7531
7533
  }
7532
7534
  else {
7533
- // Nếu inputValue rỗng hoặc chỉ có dấu trừ, thay thế hoàn toàn
7534
- if (inputValue === '' || inputValue === '-') {
7535
+ if (inputValue === "" || inputValue === "-") {
7535
7536
  setInputValue(key);
7536
7537
  }
7537
7538
  else {
7538
- // Nếu đã có giá trị, thêm vào cuối
7539
7539
  setInputValue(inputValue + key);
7540
7540
  }
7541
7541
  setIsFirstInput(false);
7542
7542
  }
7543
7543
  }
7544
7544
  else {
7545
- // Kiểm tra nếu input bắt đầu bằng 0 và không có dấu chấm
7546
- if (inputValue === '0') {
7547
- if (key === '.') {
7548
- setInputValue('0.');
7545
+ if (inputValue === "0" || inputValue === "-0") {
7546
+ if (key === ".") {
7547
+ setInputValue(inputValue === "-0" ? "-0." : "0.");
7549
7548
  return;
7550
7549
  }
7551
- else if (key >= '1' && key <= '9') {
7552
- setInputValue(key);
7550
+ else if (key >= "1" && key <= "9") {
7551
+ setInputValue(inputValue.startsWith("-") ? "-".concat(key) : key);
7553
7552
  return;
7554
7553
  }
7555
7554
  else {
@@ -7559,90 +7558,68 @@ var NumberKeyboard = function (_a) {
7559
7558
  var newInputValue = inputValue + key;
7560
7559
  var newValue = Number(newInputValue);
7561
7560
  var maxValueNumber = Number(maxValue);
7562
- // Kiểm tra xem có thể nhập được không
7563
7561
  var canInput = false;
7564
7562
  var shouldCheckLength = true;
7565
7563
  if (!isNaN(newValue) && !isNaN(maxValueNumber)) {
7566
7564
  if (newValue < 0) {
7567
- // Với số âm, kiểm tra giá trị tuyệt đối không vượt quá maxValue
7568
7565
  var absNewValue = Math.abs(newValue);
7569
7566
  var absMaxValue = Math.abs(maxValueNumber);
7570
7567
  if (absNewValue <= absMaxValue) {
7571
7568
  canInput = true;
7572
7569
  }
7573
7570
  else {
7574
- // Nếu vượt quá maxValue, kiểm tra xem có thể nhập được không
7575
- // Khi chuỗi nhập chưa có dấu ".", người dùng đang gõ phần
7576
- // nguyên nên phải so độ dài với PHẦN NGUYÊN của maxValue.
7577
- // Nếu so với cả chuỗi (vd "999999.999" dài 10 ký tự) thì mốc
7578
- // chặn dài hơn số chữ số nguyên thật (6), cho gõ tới 9 chữ số.
7579
- var maxValueStr = newInputValue.includes('.')
7571
+ var maxValueStr = newInputValue.includes(".")
7580
7572
  ? absMaxValue.toString()
7581
7573
  : Math.trunc(absMaxValue).toString();
7582
- inputValue.length;
7583
7574
  var newLength = newInputValue.length;
7584
- // Nếu độ dài mới lớn hơn độ dài của maxValue, không cho phép nhập
7585
7575
  if (newLength > maxValueStr.length) {
7586
7576
  return;
7587
7577
  }
7588
- // Nếu độ dài bằng nhau, kiểm tra giá trị
7589
7578
  if (newLength === maxValueStr.length &&
7590
7579
  absNewValue > absMaxValue) {
7591
7580
  return;
7592
7581
  }
7593
- // Nếu độ dài nhỏ hơn, có thể nhập được (sẽ kiểm tra khi nhập tiếp)
7594
7582
  canInput = true;
7595
7583
  shouldCheckLength = false;
7596
7584
  }
7597
7585
  }
7598
7586
  else {
7599
- // Với số dương, kiểm tra bình thường
7600
7587
  if (newValue <= maxValueNumber) {
7601
7588
  canInput = true;
7602
7589
  }
7603
7590
  else {
7604
- // Nếu vượt quá maxValue, kiểm tra xem có thể nhập được không
7605
- // Xem giải thích ở nhánh số âm phía trên. Dùng Math.abs trước
7606
- // khi trunc để đối xứng với nhánh đó.
7607
- var maxValueStr = newInputValue.includes('.')
7591
+ var maxValueStr = newInputValue.includes(".")
7608
7592
  ? maxValueNumber.toString()
7609
7593
  : Math.trunc(Math.abs(maxValueNumber)).toString();
7610
- inputValue.length;
7611
7594
  var newLength = newInputValue.length;
7612
- // Nếu độ dài mới lớn hơn độ dài của maxValue, không cho phép nhập
7613
7595
  if (newLength > maxValueStr.length) {
7614
7596
  return;
7615
7597
  }
7616
- // Nếu độ dài bằng nhau, kiểm tra giá trị
7617
7598
  if (newLength === maxValueStr.length &&
7618
7599
  newValue > maxValueNumber) {
7619
7600
  return;
7620
7601
  }
7621
- // Nếu độ dài nhỏ hơn, có thể nhập được (sẽ kiểm tra khi nhập tiếp)
7622
- // Ví dụ: maxValue = 999, inputValue = "99", nhập "9" → "999" (OK)
7623
7602
  canInput = true;
7624
7603
  shouldCheckLength = false;
7625
7604
  }
7626
7605
  }
7627
7606
  }
7628
7607
  if (canInput) {
7629
- if (inputValue.includes('.')) {
7630
- // Xử lý số thập phân
7631
- var _a = inputValue.split('.'); _a[0]; var _b = _a[1], decimalPart = _b === void 0 ? '' : _b;
7608
+ if (inputValue.includes(".")) {
7609
+ var _a = inputValue.split("."), _b = _a[1], decimalPart = _b === void 0 ? "" : _b;
7632
7610
  if (newInputValue.length <= 12 && decimalPart.length === 0) {
7633
7611
  setInputValue(function (prev) { return prev + key; });
7634
7612
  }
7635
- else if (newInputValue.length <= 12 && decimalPart.length < 3) {
7613
+ else if (newInputValue.length <= 12 &&
7614
+ decimalPart.length < formatDecimal) {
7636
7615
  setInputValue(function (prev) { return prev + key; });
7637
7616
  }
7638
7617
  }
7639
7618
  else {
7640
- // Xử lý số nguyên
7641
7619
  if (shouldCheckLength && newInputValue.length <= 12) {
7642
7620
  setInputValue(function (prev) { return prev + key; });
7643
7621
  }
7644
7622
  else if (!shouldCheckLength) {
7645
- // Nếu không cần kiểm tra độ dài (đã kiểm tra maxValue ở trên)
7646
7623
  setInputValue(function (prev) { return prev + key; });
7647
7624
  }
7648
7625
  }
@@ -7651,59 +7628,66 @@ var NumberKeyboard = function (_a) {
7651
7628
  }
7652
7629
  };
7653
7630
  var handleClear = useCallback(function () {
7654
- setInputValue('');
7631
+ setInputValue("");
7655
7632
  setIsFirstInput(true);
7656
7633
  }, []);
7657
7634
  var handleSave = useCallback(function () {
7658
7635
  var finalValue = inputValue;
7659
- if (inputValue.endsWith('.')) {
7636
+ if (inputValue.endsWith(".")) {
7660
7637
  finalValue = inputValue.slice(0, -1);
7661
7638
  }
7662
- // Luôn truyền giá trị gốc (không format) để giữ nguyên dạng số
7663
- onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(finalValue);
7639
+ if (formatDecimal) {
7640
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(formatShowInput(finalValue, formatDecimal));
7641
+ }
7642
+ else {
7643
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(finalValue);
7644
+ }
7664
7645
  onClose();
7665
- }, [inputValue, onChangeText, onClose]);
7646
+ }, [inputValue, formatDecimal, onChangeText, onClose]);
7666
7647
  var handleClose = useCallback(function () {
7667
7648
  onClose();
7668
7649
  setTimeout(function () {
7669
- setInputValue((value === null || value === void 0 ? void 0 : value.toString()) || '');
7650
+ setInputValue((value === null || value === void 0 ? void 0 : value.toString()) || "");
7670
7651
  }, 300);
7671
7652
  }, [onClose, value]);
7672
- return (React__default.createElement(Modal, { visible: visible, transparent: true, animationType: "fade", onRequestClose: handleClose },
7653
+ return (React__default.createElement(Modal, { visible: visible, transparent: true, animationType: "fade", statusBarTranslucent: true, onRequestClose: handleClose },
7673
7654
  React__default.createElement(TouchableOpacity, { style: styles.modalOverlay, activeOpacity: 1, onPress: handleClose },
7674
7655
  React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: [styles.modalContent, keyboardStyle] },
7675
7656
  React__default.createElement(Text$1, { style: [styles.text18, styles.modalTitle] }, label),
7676
- React__default.createElement(View, { width: '100%' },
7677
- React__default.createElement(View, { paddingHorizontal: SPACE_40 },
7678
- React__default.createElement(Text$1, { numberOfLines: 1, style: [styles.text30, styles.valueText] }, formatNumberInput(inputValue, formatDecimal) || '0')),
7657
+ React__default.createElement(View, { width: "100%", style: styles.valueRow },
7658
+ React__default.createElement(View, { style: styles.valueTextContainer },
7659
+ React__default.createElement(Text$1, { numberOfLines: 1, style: [styles.text30, styles.valueText] }, formatNumberInput(inputValue, formatDecimal) || "\u00A0")),
7679
7660
  React__default.createElement(TouchableOpacity, { onPress: handleClear, style: styles.clearButton },
7680
7661
  React__default.createElement(SvgIcon, { name: "IconClearText", width: 24, height: 24, color: colors.textSecondary }))),
7681
7662
  React__default.createElement(View, { style: styles.keyboardGrid }, [
7682
- ['1', '2', '3'],
7683
- ['4', '5', '6'],
7684
- ['7', '8', '9'],
7685
- [type === 'integer' ? '000' : '.', '0', 'del'],
7663
+ ["1", "2", "3"],
7664
+ ["4", "5", "6"],
7665
+ ["7", "8", "9"],
7666
+ [type === "integer" ? "000" : ".", "0", "del"],
7686
7667
  ].map(function (row, rowIndex) { return (React__default.createElement(View, { key: rowIndex, style: styles.keyboardRow }, row.map(function (key) { return (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, key: key, style: [
7687
7668
  styles.keyButton,
7688
- key === '000' && type === 'float' && styles.disabledKey,
7689
- key === '.' &&
7690
- inputValue.includes('.') &&
7669
+ key === "000" && is000Disabled && styles.disabledKey,
7670
+ key === "0" && is0Disabled && styles.disabledKey,
7671
+ key === "." &&
7672
+ inputValue.includes(".") &&
7691
7673
  styles.disabledKey,
7692
- ], onPress: function () { return handleKeyPress(key); }, disabled: (key === '000' && type === 'float') ||
7693
- (key === '.' && inputValue.includes('.')) }, key === 'del' ? (React__default.createElement(SvgIcon, { name: "IconDelNumber", width: 24, height: 24 })) : (React__default.createElement(Text$1, { style: [
7674
+ ], onPress: function () { return handleKeyPress(key); }, disabled: (key === "000" && is000Disabled) ||
7675
+ (key === "0" && is0Disabled) ||
7676
+ (key === "." && inputValue.includes(".")) }, key === "del" ? (React__default.createElement(SvgIcon, { name: "IconDelNumber", width: 24, height: 24, color: colors.textSecondary })) : (React__default.createElement(Text$1, { style: [
7694
7677
  styles.keyText,
7695
7678
  styles.text22,
7696
- key === '000' &&
7697
- type === 'float' &&
7679
+ key === "000" &&
7680
+ is000Disabled &&
7698
7681
  styles.disabledKeyText,
7699
- key === '.' &&
7700
- inputValue.includes('.') &&
7682
+ key === "0" && is0Disabled && styles.disabledKeyText,
7683
+ key === "." &&
7684
+ inputValue.includes(".") &&
7701
7685
  styles.disabledKeyText,
7702
7686
  ] }, key)))); }))); })),
7703
7687
  React__default.createElement(View, { style: styles.actionRow },
7704
7688
  React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles.actionButton, onPress: handleClose },
7705
7689
  React__default.createElement(Text$1, { style: [styles.actionText, styles.text16] }, "\u0110\u00F3ng")),
7706
- React__default.createElement(Spacer, { style: { height: '100%' }, width: 1, backgroundColor: colors.borderPrimaryDefault }),
7690
+ React__default.createElement(Spacer, { style: { height: "100%" }, width: 1, backgroundColor: colors.borderPrimaryDefault }),
7707
7691
  React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: [styles.actionButton, !canSave && { opacity: 0.5 }], onPress: handleSave, disabled: !canSave },
7708
7692
  React__default.createElement(Text$1, { style: [
7709
7693
  styles.actionText,
@@ -7714,53 +7698,70 @@ var NumberKeyboard = function (_a) {
7714
7698
  };
7715
7699
  var styles = StyleSheet.create(__assign(__assign({}, containerStyles), { modalOverlay: {
7716
7700
  flex: 1,
7717
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
7718
- justifyContent: 'center',
7719
- alignItems: 'center',
7701
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
7702
+ justifyContent: "center",
7703
+ alignItems: "center",
7720
7704
  }, modalContent: {
7721
7705
  borderRadius: 20,
7722
- width: '90%',
7706
+ width: "90%",
7723
7707
  paddingBottom: 20,
7724
- alignItems: 'center',
7708
+ alignItems: "center",
7709
+ overflow: "hidden",
7710
+ zIndex: 1,
7725
7711
  }, modalTitle: {
7726
- textAlign: 'center',
7712
+ textAlign: "center",
7727
7713
  marginTop: 16,
7728
7714
  marginBottom: 8,
7729
- }, valueText: {
7730
- textAlign: 'center',
7731
- }, clearButton: {
7715
+ }, valueRow: {
7716
+ width: "100%",
7717
+ minHeight: 48,
7718
+ justifyContent: "center",
7719
+ position: "relative",
7720
+ }, valueTextContainer: {
7721
+ width: "100%",
7722
+ paddingHorizontal: SPACE_40,
7723
+ minHeight: 40,
7724
+ justifyContent: "center",
7725
+ alignItems: "center",
7726
+ }, valueText: __assign({ textAlign: "center", width: "100%" }, (Platform.OS === "android" && {
7727
+ includeFontPadding: false,
7728
+ textAlignVertical: "center",
7729
+ })), clearButton: {
7732
7730
  padding: 8,
7733
- position: 'absolute',
7731
+ position: "absolute",
7734
7732
  right: SPACE_12,
7733
+ top: 0,
7734
+ bottom: 0,
7735
+ justifyContent: "center",
7735
7736
  }, keyboardGrid: {
7736
7737
  marginVertical: 8,
7737
- width: '90%',
7738
+ width: "90%",
7738
7739
  }, keyboardRow: {
7739
- flexDirection: 'row',
7740
- justifyContent: 'space-between',
7740
+ flexDirection: "row",
7741
+ justifyContent: "space-between",
7741
7742
  marginBottom: 8,
7742
7743
  }, keyButton: {
7743
7744
  flex: 1,
7744
7745
  marginHorizontal: 6,
7745
- backgroundColor: '#F5F5F5',
7746
+ backgroundColor: "#F5F5F5",
7746
7747
  borderRadius: 8,
7747
- alignItems: 'center',
7748
- justifyContent: 'center',
7748
+ alignItems: "center",
7749
+ justifyContent: "center",
7749
7750
  height: 48,
7750
7751
  }, keyText: {
7751
- fontWeight: '500',
7752
+ fontWeight: "500",
7752
7753
  }, actionRow: {
7753
- flexDirection: 'row',
7754
- justifyContent: 'space-between',
7754
+ flexDirection: "row",
7755
+ justifyContent: "space-between",
7755
7756
  marginTop: 12,
7756
- width: '90%',
7757
+ width: "90%",
7757
7758
  paddingHorizontal: 16,
7758
7759
  }, actionButton: {
7759
7760
  flex: 1,
7760
- alignItems: 'center',
7761
+ alignItems: "center",
7761
7762
  paddingVertical: 12,
7762
7763
  }, actionText: {
7763
- fontWeight: '600',
7764
+ fontWeight: "600",
7764
7765
  }, disabledKey: {
7765
7766
  opacity: 0.5,
7766
7767
  }, disabledKeyText: {