Skip to content

Commit

Permalink
BoxControl: Better minimum value support (#67819)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
  • 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

1 comment on commit 9e3bdeb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 9e3bdeb.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12294971147
📝 Reported issues:

Please sign in to comment.