aport-tools 4.4.22 → 4.4.23
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 +13 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.23 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -550,15 +550,19 @@ var Input = function Input(_a) {
|
|
550
550
|
var _c = React.useState(""),
|
551
551
|
internalValue = _c[0],
|
552
552
|
setInternalValue = _c[1];
|
553
|
-
|
553
|
+
var isFirstRender = React.useRef(true); // Track the first render
|
554
|
+
// Initialize the internal value when `firstValue` changes or on first render
|
554
555
|
React.useEffect(function () {
|
555
|
-
if (
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
556
|
+
if (isFirstRender.current) {
|
557
|
+
isFirstRender.current = false;
|
558
|
+
if (firstValue !== undefined) {
|
559
|
+
setInternalValue(firstValue);
|
560
|
+
setFormValue(name, firstValue);
|
561
|
+
} else {
|
562
|
+
setInternalValue(formValues[name] || "");
|
563
|
+
}
|
560
564
|
}
|
561
|
-
}, [firstValue
|
565
|
+
}, [firstValue]); // Only re-run if `firstValue` changes
|
562
566
|
/**
|
563
567
|
* Handles text changes in the input field, applying formatting based on the inputType.
|
564
568
|
*
|