Skip to content

Commit

Permalink
BoxControl: Better minimum value support (WordPress#67819)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jorgefilipecosta <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent 40022a3 commit 9e3bdeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)).
- `InputControl`: Deprecate 36px default size ([#66897](https://github.com/WordPress/gutenberg/pull/66897)).

### Bug Fixes

- `BoxControl`: Better respect for the `min` prop in the Range Slider ([#67819](https://github.com/WordPress/gutenberg/pull/67819)).

## 29.0.0 (2024-12-11)

### Breaking Changes
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/box-control/input-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default function BoxInputControl( {
setSelectedUnits,
sides,
side,
min = 0,
...props
}: BoxControlInputControlProps ) {
const defaultValuesToModify = getSidesToModify( side, sides );
Expand Down Expand Up @@ -154,6 +155,7 @@ export default function BoxInputControl( {
<Tooltip placement="top-end" text={ LABELS[ side ] }>
<StyledUnitControl
{ ...props }
min={ min }
__shouldNotWarnDeprecated36pxSize
__next40pxDefaultSize={ __next40pxDefaultSize }
className="component-box-control__unit-control"
Expand Down Expand Up @@ -184,7 +186,7 @@ export default function BoxInputControl( {
: undefined
);
} }
min={ 0 }
min={ isFinite( min ) ? min : 0 }
max={ CUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]?.max ?? 10 }
step={
CUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]?.step ?? 0.1
Expand Down

0 comments on commit 9e3bdeb

Please sign in to comment.