@uxf/form 11.92.1 → 11.92.3
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.
|
@@ -6,6 +6,7 @@ import { ControlProps } from "../types";
|
|
|
6
6
|
export type MoneyInputValue = Money | null;
|
|
7
7
|
export type MoneyInputProps<FormData extends FieldValues> = Omit<ControlProps<FormData>, "defaultValue"> & Omit<FormControlProps<MoneyInputValue>, "value" | "onChange"> & {
|
|
8
8
|
defaultCurrency?: Currency;
|
|
9
|
+
helperText?: ReactNode;
|
|
9
10
|
id?: string;
|
|
10
11
|
label?: string;
|
|
11
12
|
leftAddon?: ReactNode;
|
|
@@ -49,7 +49,7 @@ const CONTROL_KEYS = ["v", "V", "c", "C", "x", "X", "a", "A"];
|
|
|
49
49
|
// Allow digits and decimal point (.,)
|
|
50
50
|
const ALLOWED_KEYS = /[0-9+\-.,]/;
|
|
51
51
|
function MoneyInput(props) {
|
|
52
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
53
53
|
const formContext = (0, form_context_1.useFormContext)();
|
|
54
54
|
const t = (0, translations_1.useUxfTranslation)();
|
|
55
55
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
|
|
@@ -117,6 +117,6 @@ function MoneyInput(props) {
|
|
|
117
117
|
field.onChange(newValue);
|
|
118
118
|
(_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, newValue, event);
|
|
119
119
|
};
|
|
120
|
-
return (react_1.default.createElement(text_input_1.TextInput, { className: "uxf-money-input uxf-input--no-spin-buttons", helperText: (_g = fieldState.error) === null || _g === void 0 ? void 0 : _g.message, id: id, inputMode: "decimal", isDisabled: formContext.isFormDisabled || props.isDisabled, isInvalid: Boolean(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: field.name, onChange: changeHandler, onKeyDown: keyDownHandler, ref: field.ref, rightAddon: props.rightAddon, rightElement: currencies_1.currencies[(
|
|
120
|
+
return (react_1.default.createElement(text_input_1.TextInput, { className: "uxf-money-input uxf-input--no-spin-buttons", helperText: (_h = (_g = fieldState.error) === null || _g === void 0 ? void 0 : _g.message) !== null && _h !== void 0 ? _h : props.helperText, id: id, inputMode: "decimal", isDisabled: formContext.isFormDisabled || props.isDisabled, isInvalid: Boolean(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: field.name, onChange: changeHandler, onKeyDown: keyDownHandler, ref: field.ref, rightAddon: props.rightAddon, rightElement: currencies_1.currencies[(_k = (_j = field.value) === null || _j === void 0 ? void 0 : _j.currency) !== null && _k !== void 0 ? _k : lastCurrency].symbol, step: 2, type: "number", value: (_m = (_l = field.value) === null || _l === void 0 ? void 0 : _l.amount) !== null && _m !== void 0 ? _m : "" }));
|
|
121
121
|
}
|
|
122
122
|
MoneyInput.displayName = "UxfFormMoneyInput";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/form",
|
|
3
|
-
"version": "11.92.
|
|
3
|
+
"version": "11.92.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@uxf/core": "11.91.0",
|
|
20
20
|
"@uxf/core-react": "11.91.0",
|
|
21
|
-
"@uxf/ui": "11.92.
|
|
21
|
+
"@uxf/ui": "11.92.3",
|
|
22
22
|
"coordinate-parser": "1.0.7",
|
|
23
23
|
"dayjs": "1.11.19",
|
|
24
24
|
"react-hook-form": "7.68.0"
|