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

DimensionControl: Deprecate 36px default size #66705

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Deprecations

- `Radio`: Deprecate 36px default size ([#66572](https://github.com/WordPress/gutenberg/pull/66572)).
- `DimensionControl`: Deprecate 36px default size ([#66705](https://github.com/WordPress/gutenberg/pull/66705)).

### Enhancements

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/dimension-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function MyCustomDimensionControl() {
return (
<DimensionControl
__nextHasNoMarginBottom
__next40pxDefaultSize
label={ 'Padding' }
icon={ 'desktop' }
onChange={ ( value ) => setPaddingSize( value ) }
Expand Down
8 changes: 8 additions & 0 deletions packages/components/src/dimension-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type { DimensionControlProps, Size } from './types';
import type { SelectControlSingleSelectionProps } from '../select-control/types';
import { ContextSystemProvider } from '../context';
import deprecated from '@wordpress/deprecated';
import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';

const CONTEXT_VALUE = {
BaseControl: {
Expand All @@ -41,6 +42,7 @@ const CONTEXT_VALUE = {
*
* return (
* <DimensionControl
* __next40pxDefaultSize
* __nextHasNoMarginBottom
* label={ 'Padding' }
* icon={ 'desktop' }
Expand Down Expand Up @@ -68,6 +70,12 @@ export function DimensionControl( props: DimensionControlProps ) {
version: '7.0',
} );

maybeWarnDeprecated36pxSize( {
componentName: 'DimensionControl',
__next40pxDefaultSize,
size: undefined,
} );

const onChangeSpacingSize: SelectControlSingleSelectionProps[ 'onChange' ] =
( val ) => {
const theSize = findSizeBySlug( sizes, val );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const Template: StoryFn< typeof DimensionControl > = ( args ) => (
export const Default = Template.bind( {} );
Default.args = {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: 'Please select a size',
sizes,
};
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = `
white-space: nowrap;
text-overflow: ellipsis;
font-size: 16px;
height: 32px;
min-height: 32px;
height: 40px;
min-height: 40px;
padding-top: 0;
padding-bottom: 0;
padding-left: 8px;
padding-right: 26px;
padding-left: 12px;
padding-right: 30px;
overflow: hidden;
}

Expand All @@ -157,8 +157,8 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = `
}

.emotion-21 {
-webkit-padding-end: 8px;
padding-inline-end: 8px;
-webkit-padding-end: 12px;
padding-inline-end: 12px;
position: absolute;
pointer-events: none;
right: 0;
Expand Down Expand Up @@ -408,12 +408,12 @@ exports[`DimensionControl rendering renders with defaults 1`] = `
white-space: nowrap;
text-overflow: ellipsis;
font-size: 16px;
height: 32px;
min-height: 32px;
height: 40px;
min-height: 40px;
padding-top: 0;
padding-bottom: 0;
padding-left: 8px;
padding-right: 26px;
padding-left: 12px;
padding-right: 30px;
overflow: hidden;
}

Expand All @@ -439,8 +439,8 @@ exports[`DimensionControl rendering renders with defaults 1`] = `
}

.emotion-21 {
-webkit-padding-end: 8px;
padding-inline-end: 8px;
-webkit-padding-end: 12px;
padding-inline-end: 12px;
position: absolute;
pointer-events: none;
right: 0;
Expand Down Expand Up @@ -700,12 +700,12 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`]
white-space: nowrap;
text-overflow: ellipsis;
font-size: 16px;
height: 32px;
min-height: 32px;
height: 40px;
min-height: 40px;
padding-top: 0;
padding-bottom: 0;
padding-left: 8px;
padding-right: 26px;
padding-left: 12px;
padding-right: 30px;
overflow: hidden;
}

Expand All @@ -731,8 +731,8 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`]
}

.emotion-21 {
-webkit-padding-end: 8px;
padding-inline-end: 8px;
-webkit-padding-end: 12px;
padding-inline-end: 12px;
position: absolute;
pointer-events: none;
right: 0;
Expand Down Expand Up @@ -1004,12 +1004,12 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`]
white-space: nowrap;
text-overflow: ellipsis;
font-size: 16px;
height: 32px;
min-height: 32px;
height: 40px;
min-height: 40px;
padding-top: 0;
padding-bottom: 0;
padding-left: 8px;
padding-right: 26px;
padding-left: 12px;
padding-right: 30px;
overflow: hidden;
}

Expand All @@ -1035,8 +1035,8 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`]
}

.emotion-21 {
-webkit-padding-end: 8px;
padding-inline-end: 8px;
-webkit-padding-end: 12px;
padding-inline-end: 12px;
position: absolute;
pointer-events: none;
right: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ import { plus } from '@wordpress/icons';
import { DimensionControl as _DimensionControl } from '../';

const DimensionControl = ( props ) => {
return <_DimensionControl { ...props } __nextHasNoMarginBottom />;
return (
<_DimensionControl
{ ...props }
__next40pxDefaultSize
__nextHasNoMarginBottom
/>
);
};

describe( 'DimensionControl', () => {
Expand Down
Loading