@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.js
CHANGED
|
@@ -810,27 +810,20 @@ function useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref
|
|
|
810
810
|
color: `var(--${PREFIX_BS}input-currency-symbol-color)`,
|
|
811
811
|
}), []);
|
|
812
812
|
const handleOnChange = React.useCallback((newValue) => {
|
|
813
|
-
const newNumber = (newValue === undefined || newValue === '')
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(innerNumber);
|
|
821
|
-
}, [onChange, innerNumber]);
|
|
813
|
+
const newNumber = (newValue === undefined || newValue === '') ? undefined : Number(newValue);
|
|
814
|
+
if (newNumber !== innerNumber) {
|
|
815
|
+
setInnerNumber(newNumber);
|
|
816
|
+
setInnerString(formatValue(newNumber, currencyOptions));
|
|
817
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newNumber);
|
|
818
|
+
}
|
|
819
|
+
}, [currencyOptions, onChange, innerNumber]);
|
|
822
820
|
React.useEffect(() => {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (value === undefined || value.toString() === '') {
|
|
827
|
-
return '';
|
|
821
|
+
if (value !== innerNumber) {
|
|
822
|
+
setInnerNumber(value);
|
|
823
|
+
setInnerString(formatValue(value, currencyOptions));
|
|
828
824
|
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
: innerString;
|
|
832
|
-
return valueToUse !== null && valueToUse !== void 0 ? valueToUse : '';
|
|
833
|
-
}, [value, innerType, innerNumber, innerString]);
|
|
825
|
+
}, [value, currencyOptions, innerNumber]);
|
|
826
|
+
const innerValue = React.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]);
|
|
834
827
|
return {
|
|
835
828
|
inputRef,
|
|
836
829
|
innerValue,
|
|
@@ -932,7 +925,7 @@ function DInputCurrencyBase(_a, ref) {
|
|
|
932
925
|
var { value, minValue, maxValue, currencyOptions, currencyCode, onFocus, onBlur, onChange } = _a, inputProps = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "onFocus", "onBlur", "onChange"]);
|
|
933
926
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
934
927
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
935
|
-
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal",
|
|
928
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
936
929
|
}
|
|
937
930
|
const ForwardedDInputCurrencyBase$1 = React.forwardRef(DInputCurrencyBase);
|
|
938
931
|
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
@@ -943,7 +936,7 @@ function DInputCurrency(_a, ref) {
|
|
|
943
936
|
const { currency: currencyOptions } = useDContext();
|
|
944
937
|
const { handleOnWheel, } = useDisableInputWheel(ref);
|
|
945
938
|
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
946
|
-
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal",
|
|
939
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
947
940
|
}
|
|
948
941
|
const ForwardedDInputCurrencyBase = React.forwardRef(DInputCurrency);
|
|
949
942
|
ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
|