componenteshospitais 1.8.3 → 1.8.4

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/cjs/index.js CHANGED
@@ -1502,10 +1502,14 @@ var InputField = function (_a) {
1502
1502
  var handleChange = function (e) {
1503
1503
  var inputValue = e.target.value;
1504
1504
  if (maskType === 'phone' || maskType === 'telefone') {
1505
- inputValue = inputValue.replace(/^\(0/, '(');
1505
+ var digits = inputValue.replace(/\D/g, '');
1506
+ if (digits.startsWith('0')) {
1507
+ digits = digits.substring(1);
1508
+ }
1509
+ inputValue = digits;
1506
1510
  }
1507
- if (type === 'number' && e.target.value.length > appliedMaxLength) {
1508
- e.target.value = e.target.value.slice(0, appliedMaxLength);
1511
+ if (type === 'number' && inputValue.length > appliedMaxLength) {
1512
+ inputValue = inputValue.slice(0, appliedMaxLength);
1509
1513
  }
1510
1514
  onChange(__assign(__assign({}, e), { target: __assign(__assign({}, e.target), { value: inputValue }) }));
1511
1515
  };