Skip to content

Commit

Permalink
BoxControl: Better minimum value support
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Dec 11, 2024
1 parent b659e93 commit 8f65488
Showing 1 changed file with 3 additions and 1 deletion.
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 8f65488

Please sign in to comment.