@bluemarble/bm-components 0.0.87 → 0.0.88
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/esm/index.js
CHANGED
|
@@ -14817,17 +14817,24 @@ function InputMask(_a) {
|
|
|
14817
14817
|
return React__default.createElement(BaseInputMask, Object.assign({}, rest));
|
|
14818
14818
|
}
|
|
14819
14819
|
const BaseInputMask = (_a) => {
|
|
14820
|
-
var { mask, defaultValue, onChangeValue } = _a, rest = __rest(_a, ["mask", "defaultValue", "onChangeValue"]);
|
|
14821
|
-
const { ref, value,
|
|
14820
|
+
var { mask, defaultValue, onChangeValue, value: controlledValue } = _a, rest = __rest(_a, ["mask", "defaultValue", "onChangeValue", "value"]);
|
|
14821
|
+
const { ref, value, setValue, maskRef, unmaskedValue } = useIMask(mask, {
|
|
14822
|
+
onComplete: (...params) => {
|
|
14823
|
+
// console.log( )
|
|
14824
|
+
if (onChangeValue)
|
|
14825
|
+
onChangeValue(params[0], unmaskedValue);
|
|
14826
|
+
// params[1].updateValue()
|
|
14827
|
+
}
|
|
14828
|
+
});
|
|
14822
14829
|
useEffect(() => {
|
|
14823
14830
|
if (!value)
|
|
14824
14831
|
setValue(String(defaultValue));
|
|
14825
|
-
|
|
14832
|
+
maskRef.current.value = String(defaultValue);
|
|
14826
14833
|
}, [defaultValue]);
|
|
14827
14834
|
useEffect(() => {
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
}, [
|
|
14835
|
+
setValue(controlledValue);
|
|
14836
|
+
maskRef.current.value = controlledValue;
|
|
14837
|
+
}, [controlledValue]);
|
|
14831
14838
|
return React__default.createElement(BaseInput$1, Object.assign({ inputRef: ref }, rest));
|
|
14832
14839
|
};
|
|
14833
14840
|
function FormikInputMask(_a) {
|