@rsuci/shared-form-components 1.0.101 → 1.0.102
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/NumberInput.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIxE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,kBAAkB,GAAG;QAAE,QAAQ,EAAE,WAAW,CAAA;KAAE,CAAC;IACzD,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/NumberInput.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIxE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,kBAAkB,GAAG;QAAE,QAAQ,EAAE,WAAW,CAAA;KAAE,CAAC;IACzD,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8F3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -21,6 +21,12 @@ const NumberInput = ({ variable, value, onChange, onBlur, error, disabled, valeu
|
|
|
21
21
|
effectiveMin,
|
|
22
22
|
currentValue: numericValue
|
|
23
23
|
});
|
|
24
|
+
const handleKeyDown = (e) => {
|
|
25
|
+
// Bloquer e, E, +, - (autorisés par type="number" en HTML5 mais non voulus)
|
|
26
|
+
if (['e', 'E', '+', '-'].includes(e.key)) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
24
30
|
const handleChange = (e) => {
|
|
25
31
|
if (isReadonly)
|
|
26
32
|
return;
|
|
@@ -64,6 +70,6 @@ const NumberInput = ({ variable, value, onChange, onBlur, error, disabled, valeu
|
|
|
64
70
|
return `${baseClasses} ${errorClasses} ${readonlyClasses.readonly}`;
|
|
65
71
|
return `${baseClasses} ${errorClasses} bg-white`;
|
|
66
72
|
};
|
|
67
|
-
return (_jsx("div", { style: containerStyle, children: _jsx("input", { type: "number", value: numericValue, onChange: handleChange, onBlur: onBlur, min: effectiveMin !== undefined ? effectiveMin : 0, max: props?.max, step: props?.step || 1, disabled: disabled, readOnly: isReadonly, style: textStyle, className: getInputClasses() }) }));
|
|
73
|
+
return (_jsx("div", { style: containerStyle, children: _jsx("input", { type: "number", value: numericValue, onChange: handleChange, onKeyDown: handleKeyDown, onBlur: onBlur, min: effectiveMin !== undefined ? effectiveMin : 0, max: props?.max, step: props?.step || 1, disabled: disabled, readOnly: isReadonly, style: textStyle, className: getInputClasses() }) }));
|
|
68
74
|
};
|
|
69
75
|
export default NumberInput;
|
package/package.json
CHANGED