From f643a750943add6e394b0f7a99d9384020a2b13b Mon Sep 17 00:00:00 2001 From: Justin Ahinon Date: Wed, 27 Apr 2022 08:27:03 +0200 Subject: [PATCH] Revert "Allow negative values for margin inputs (#40464)" This reverts commit a109d31c02042ad3c6e055f7aea61de9c999e57b. --- packages/block-editor/src/hooks/margin.js | 1 - packages/components/src/box-control/index.js | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/block-editor/src/hooks/margin.js b/packages/block-editor/src/hooks/margin.js index 19ea51dc1ff9b0..06d86c85345fc9 100644 --- a/packages/block-editor/src/hooks/margin.js +++ b/packages/block-editor/src/hooks/margin.js @@ -143,7 +143,6 @@ export function MarginEdit( props ) { units={ units } allowReset={ false } splitOnAxis={ splitOnAxis } - allowNegativeValues={ true } /> ), diff --git a/packages/components/src/box-control/index.js b/packages/components/src/box-control/index.js index a6744f420ac474..cbd11e19954353 100644 --- a/packages/components/src/box-control/index.js +++ b/packages/components/src/box-control/index.js @@ -46,7 +46,7 @@ function useUniqueId( idProp ) { } export default function BoxControl( { id: idProp, - inputProps, + inputProps = defaultInputProps, onChange = noop, label = __( 'Box Control' ), values: valuesProp, @@ -55,10 +55,7 @@ export default function BoxControl( { splitOnAxis = false, allowReset = true, resetValues = DEFAULT_VALUES, - allowNegativeValues = false, } ) { - inputProps = allowNegativeValues ? { min: -Infinity } : defaultInputProps; - const [ values, setValues ] = useControlledState( valuesProp, { fallback: DEFAULT_VALUES, } );