@dynamic-framework/ui-react 1.32.0 → 1.32.2
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/css/dynamic-ui-non-root.css +5 -3
- package/dist/css/dynamic-ui-non-root.min.css +2 -2
- package/dist/css/dynamic-ui-root.css +15 -15
- package/dist/css/dynamic-ui-root.min.css +2 -2
- package/dist/css/dynamic-ui.css +19 -17
- package/dist/css/dynamic-ui.min.css +2 -2
- package/dist/index.esm.js +14 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/style/abstracts/variables/_colors.scss +14 -14
- package/src/style/base/_buttons.scss +2 -2
- package/src/style/components/_d-input-pin.scss +1 -0
- package/src/style/root/_root.scss +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -808,27 +808,20 @@ function useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref
|
|
|
808
808
|
color: `var(--${PREFIX_BS}input-currency-symbol-color)`,
|
|
809
809
|
}), []);
|
|
810
810
|
const handleOnChange = useCallback((newValue) => {
|
|
811
|
-
const newNumber = (newValue === undefined || newValue === '')
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(innerNumber);
|
|
819
|
-
}, [onChange, innerNumber]);
|
|
811
|
+
const newNumber = (newValue === undefined || newValue === '') ? undefined : Number(newValue);
|
|
812
|
+
if (newNumber !== innerNumber) {
|
|
813
|
+
setInnerNumber(newNumber);
|
|
814
|
+
setInnerString(formatValue(newNumber, currencyOptions));
|
|
815
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newNumber);
|
|
816
|
+
}
|
|
817
|
+
}, [currencyOptions, onChange, innerNumber]);
|
|
820
818
|
useEffect(() => {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
if (value === undefined || value.toString() === '') {
|
|
825
|
-
return '';
|
|
819
|
+
if (value !== innerNumber) {
|
|
820
|
+
setInnerNumber(value);
|
|
821
|
+
setInnerString(formatValue(value, currencyOptions));
|
|
826
822
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
: innerString;
|
|
830
|
-
return valueToUse !== null && valueToUse !== void 0 ? valueToUse : '';
|
|
831
|
-
}, [value, innerType, innerNumber, innerString]);
|
|
823
|
+
}, [value, currencyOptions, innerNumber]);
|
|
824
|
+
const innerValue = useMemo(() => { var _a; return (innerType === 'number' ? (_a = innerNumber === null || innerNumber === void 0 ? void 0 : innerNumber.toString()) !== null && _a !== void 0 ? _a : '' : innerString !== null && innerString !== void 0 ? innerString : ''); }, [innerType, innerNumber, innerString]);
|
|
832
825
|
return {
|
|
833
826
|
inputRef,
|
|
834
827
|
innerValue,
|
|
@@ -930,7 +923,7 @@ function DInputCurrencyBase(_a, ref) {
|
|
|
930
923
|
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = __rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
931
924
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
932
925
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
933
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal",
|
|
926
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
934
927
|
}
|
|
935
928
|
const ForwardedDInputCurrencyBase$1 = forwardRef(DInputCurrencyBase);
|
|
936
929
|
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
@@ -941,7 +934,7 @@ function DInputCurrency(_a, ref) {
|
|
|
941
934
|
const { currency: currencyOptions } = useDContext();
|
|
942
935
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
943
936
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
944
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal",
|
|
937
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
945
938
|
}
|
|
946
939
|
const ForwardedDInputCurrencyBase = forwardRef(DInputCurrency);
|
|
947
940
|
ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
|