Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BorderBoxControl: Omit unit select when values are mixed #44592

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
### Enhancements

- `FontSizePicker`: Updated to take up full width of its parent and have a 40px Reset button when `size` is `__unstable-large` ((44559)[https://github.com/WordPress/gutenberg/pull/44559]).
- `BorderBoxControl`: Omit unit select when values are mixed ([#44592](https://github.com/WordPress/gutenberg/pull/44592))
- `BorderControl`: Add ability to disable unit selection ([#44592](https://github.com/WordPress/gutenberg/pull/44592))

### Bug Fix

- `Popover`: fix limitShift logic by adding iframe offset correctly [#42950](https://github.com/WordPress/gutenberg/pull/42950)).
- `Popover`: fix limitShift logic by adding iframe offset correctly ([#42950](https://github.com/WordPress/gutenberg/pull/42950)).
- `Popover`: refine position-to-placement conversion logic, add tests ([#44377](https://github.com/WordPress/gutenberg/pull/44377)).
- `ToggleGroupControl`: adjust icon color when inactive, from `gray-700` to `gray-900` ([#44575](https://github.com/WordPress/gutenberg/pull/44575)).
- `TokenInput`: improve logic around the `aria-activedescendant` attribute, which was causing unintended focus behavior for some screen readers ([#44526](https://github.com/WordPress/gutenberg/pull/44526)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const BorderBoxControl = (
<BorderControl
className={ linkedControlClassName }
colors={ colors }
disableUnits={ hasMixedBorders }
disableCustomColors={ disableCustomColors }
enableAlpha={ enableAlpha }
enableStyle={ enableStyle }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ This toggles the ability to choose custom colors.

- Required: No

### `disableUnits`: `boolean`

This controls whether unit selection should be disabled.

- Required: No

### `enableAlpha`: `boolean`

This controls whether the alpha channel will be offered when selecting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const UnconnectedBorderControl = (
const {
colors,
disableCustomColors,
disableUnits,
enableAlpha,
enableStyle = true,
hideLabelFromVision,
Expand Down Expand Up @@ -97,6 +98,7 @@ const UnconnectedBorderControl = (
onChange={ onWidthChange }
value={ border?.width || '' }
placeholder={ placeholder }
disableUnits={ disableUnits }
__unstableInputWidth={ inputWidth }
/>
{ withSlider && (
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/border-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export type LabelProps = {

export type BorderControlProps = ColorProps &
LabelProps & {
/**
* This controls whether unit selection should be disabled.
*/
disableUnits?: boolean;
/**
* This controls whether to include border style options within the
* `BorderDropdown` sub-component.
Expand Down