@bluemarble/bm-components 0.0.87 → 0.0.89
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,22 @@ 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
|
+
if (onChangeValue)
|
|
14824
|
+
onChangeValue(params[0], unmaskedValue);
|
|
14825
|
+
}
|
|
14826
|
+
});
|
|
14822
14827
|
useEffect(() => {
|
|
14823
14828
|
if (!value)
|
|
14824
14829
|
setValue(String(defaultValue));
|
|
14825
|
-
|
|
14830
|
+
maskRef.current.value = String(defaultValue);
|
|
14826
14831
|
}, [defaultValue]);
|
|
14827
14832
|
useEffect(() => {
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
}, [
|
|
14833
|
+
setValue(controlledValue);
|
|
14834
|
+
maskRef.current.value = controlledValue;
|
|
14835
|
+
}, [controlledValue]);
|
|
14831
14836
|
return React__default.createElement(BaseInput$1, Object.assign({ inputRef: ref }, rest));
|
|
14832
14837
|
};
|
|
14833
14838
|
function FormikInputMask(_a) {
|