Skip to content

Commit

Permalink
URLInput: Hard deprecate bottom margin (#64282)
Browse files Browse the repository at this point in the history
* URLInput: Add story

* URLInput: Hard deprecate bottom margin

* Add changelog

* Remove story

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent cd0118f commit a03615d
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Breaking Changes

- `URLInput`: Remove deprecated `__nextHasNoMarginBottom` prop and promote to default behavior ([#64282](https://github.com/WordPress/gutenberg/pull/64282)).
- `LineHeightControl`: Remove deprecated `__nextHasNoMarginBottom` prop and promote to default behavior ([#64281](https://github.com/WordPress/gutenberg/pull/64281)).

### Enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ const LinkControlSearchInput = forwardRef(
<div className="block-editor-link-control__search-input-container">
<URLInput
disableSuggestions={ currentLink?.url === value }
__nextHasNoMarginBottom
label={ __( 'Link' ) }
hideLabelFromVision={ hideLabelFromVision }
className={ className }
Expand Down
5 changes: 0 additions & 5 deletions packages/block-editor/src/components/url-input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ When hiding the URLInput using CSS (as is sometimes done for accessibility purpo

This prop allows the suggestions list to be programmatically not rendered by passing a boolean—it can be `true` to make sure suggestions aren't rendered, or `false`/`undefined` to fall back to the default behaviour of showing suggestions when matching autocompletion items are found.

### `__nextHasNoMarginBottom: Boolean`

Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4. (The prop can be safely removed once this happens.)

## Example


Expand All @@ -156,7 +152,6 @@ registerBlockType( /* ... */, {
edit( { className, attributes, setAttributes } ) {
return (
<URLInput
__nextHasNoMarginBottom
className={ className }
value={ attributes.url }
onChange={ ( url, post ) => setAttributes( { url, text: (post && post.title) || 'Click here' } ) }
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/components/url-input/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class URLInputButton extends Component {
onClick={ this.toggle }
/>
<URLInput
__nextHasNoMarginBottom
value={ url || '' }
onChange={ onChange }
/>
Expand Down
16 changes: 1 addition & 15 deletions packages/block-editor/src/components/url-input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import deprecated from '@wordpress/deprecated';
import { __, sprintf, _n } from '@wordpress/i18n';
import { Component, createRef } from '@wordpress/element';
import { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';
Expand Down Expand Up @@ -416,8 +415,6 @@ class URLInput extends Component {

renderControl() {
const {
/** Start opting into the new margin-free styles that will become the default in a future version. */
__nextHasNoMarginBottom = false,
label = null,
className,
isFullWidth,
Expand Down Expand Up @@ -473,19 +470,8 @@ class URLInput extends Component {
return renderControl( controlProps, inputProps, loading );
}

if ( ! __nextHasNoMarginBottom ) {
deprecated( 'Bottom margin styles for wp.blockEditor.URLInput', {
since: '6.2',
version: '6.5',
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',
} );
}

return (
<BaseControl
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
{ ...controlProps }
>
<BaseControl __nextHasNoMarginBottom { ...controlProps }>
<input { ...inputProps } />
{ loading && <Spinner /> }
</BaseControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function LinkEditor( {
{ ...props }
>
<URLInput
__nextHasNoMarginBottom
value={ value }
onChange={ onChangeInputValue }
autocompleteRef={ autocompleteRef }
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/social-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const SocialLinkURLPopover = ( {
>
<div className="block-editor-url-input">
<URLInput
__nextHasNoMarginBottom
value={ url }
onChange={ ( nextURL ) =>
setAttributes( { url: nextURL } )
Expand Down

0 comments on commit a03615d

Please sign in to comment.