mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
EIP-1559 - Allow decimals for maxFeePerGas and maxPriorityFeePerGas (#11664)
This commit is contained in:
parent
0849738003
commit
15cbe4e9a0
@ -71,6 +71,7 @@ export default function AdvancedGasControls({
|
|||||||
onChange={setGasLimit}
|
onChange={setGasLimit}
|
||||||
tooltipText={t('editGasLimitTooltip')}
|
tooltipText={t('editGasLimitTooltip')}
|
||||||
value={gasLimit}
|
value={gasLimit}
|
||||||
|
allowDecimals={false}
|
||||||
numeric
|
numeric
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
|
@ -27,6 +27,7 @@ export default function FormField({
|
|||||||
detailText,
|
detailText,
|
||||||
autoFocus,
|
autoFocus,
|
||||||
password,
|
password,
|
||||||
|
allowDecimals,
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -79,6 +80,7 @@ export default function FormField({
|
|||||||
value={value}
|
value={value}
|
||||||
detailText={detailText}
|
detailText={detailText}
|
||||||
autoFocus={autoFocus}
|
autoFocus={autoFocus}
|
||||||
|
allowDecimals={allowDecimals}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<input
|
<input
|
||||||
@ -117,6 +119,7 @@ FormField.propTypes = {
|
|||||||
autoFocus: PropTypes.bool,
|
autoFocus: PropTypes.bool,
|
||||||
numeric: PropTypes.bool,
|
numeric: PropTypes.bool,
|
||||||
password: PropTypes.bool,
|
password: PropTypes.bool,
|
||||||
|
allowDecimals: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
FormField.defaultProps = {
|
FormField.defaultProps = {
|
||||||
@ -131,4 +134,5 @@ FormField.defaultProps = {
|
|||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
numeric: false,
|
numeric: false,
|
||||||
password: false,
|
password: false,
|
||||||
|
allowDecimals: true,
|
||||||
};
|
};
|
||||||
|
@ -5,11 +5,12 @@ import Typography from '../typography/typography';
|
|||||||
import { COLORS, TYPOGRAPHY } from '../../../helpers/constants/design-system';
|
import { COLORS, TYPOGRAPHY } from '../../../helpers/constants/design-system';
|
||||||
|
|
||||||
export default function NumericInput({
|
export default function NumericInput({
|
||||||
detailText,
|
detailText = '',
|
||||||
value,
|
value = 0,
|
||||||
onChange,
|
onChange,
|
||||||
error,
|
error = '',
|
||||||
autoFocus,
|
autoFocus = false,
|
||||||
|
allowDecimals = true,
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -18,7 +19,14 @@ export default function NumericInput({
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => onChange?.(parseInt(e.target.value, 10))}
|
onKeyDown={(e) => {
|
||||||
|
if (!allowDecimals && e.key === '.') {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onChange={(e) => {
|
||||||
|
onChange?.(parseFloat(e.target.value, 10));
|
||||||
|
}}
|
||||||
min="0"
|
min="0"
|
||||||
autoFocus={autoFocus}
|
autoFocus={autoFocus}
|
||||||
/>
|
/>
|
||||||
@ -37,12 +45,5 @@ NumericInput.propTypes = {
|
|||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string,
|
||||||
autoFocus: PropTypes.bool,
|
autoFocus: PropTypes.bool,
|
||||||
};
|
allowDecimals: PropTypes.bool,
|
||||||
|
|
||||||
NumericInput.defaultProps = {
|
|
||||||
value: 0,
|
|
||||||
detailText: '',
|
|
||||||
onChange: undefined,
|
|
||||||
error: '',
|
|
||||||
autoFocus: false,
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user