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

[pull] trunk from WordPress:trunk #87

Merged
merged 4 commits into from
Dec 14, 2024
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
167 changes: 110 additions & 57 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import clsx from 'clsx';
*/
import { useSelect, useDispatch } from '@wordpress/data';
import {
PanelBody,
TextControl,
TextareaControl,
ToolbarButton,
ToolbarGroup,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
import { __ } from '@wordpress/i18n';
Expand Down Expand Up @@ -382,67 +383,119 @@ export default function NavigationSubmenuEdit( {
</BlockControls>
{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ label || '' }
onChange={ ( labelValue ) => {
setAttributes( { label: labelValue } );
} }
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( {
label: '',
url: '',
description: '',
title: '',
rel: '',
} );
} }
>
<ToolsPanelItem
label={ __( 'Text' ) }
autoComplete="off"
/>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ url || '' }
onChange={ ( urlValue ) => {
setAttributes( { url: urlValue } );
} }
isShownByDefault
hasValue={ () => !! label }
onDeselect={ () => setAttributes( { label: '' } ) }
>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ label || '' }
onChange={ ( labelValue ) => {
setAttributes( { label: labelValue } );
} }
label={ __( 'Text' ) }
autoComplete="off"
/>
</ToolsPanelItem>

<ToolsPanelItem
label={ __( 'Link' ) }
autoComplete="off"
/>
<TextareaControl
__nextHasNoMarginBottom
value={ description || '' }
onChange={ ( descriptionValue ) => {
setAttributes( {
description: descriptionValue,
} );
} }
isShownByDefault
hasValue={ () => !! url }
onDeselect={ () => setAttributes( { url: '' } ) }
>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ url || '' }
onChange={ ( urlValue ) => {
setAttributes( { url: urlValue } );
} }
label={ __( 'Link' ) }
autoComplete="off"
/>
</ToolsPanelItem>

<ToolsPanelItem
label={ __( 'Description' ) }
help={ __(
'The description will be displayed in the menu if the current theme supports it.'
) }
/>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ title || '' }
onChange={ ( titleValue ) => {
setAttributes( { title: titleValue } );
} }
isShownByDefault
hasValue={ () => !! description }
onDeselect={ () =>
setAttributes( { description: '' } )
}
>
<TextareaControl
__nextHasNoMarginBottom
value={ description || '' }
onChange={ ( descriptionValue ) => {
setAttributes( {
description: descriptionValue,
} );
} }
label={ __( 'Description' ) }
help={ __(
'The description will be displayed in the menu if the current theme supports it.'
) }
/>
</ToolsPanelItem>

<ToolsPanelItem
label={ __( 'Title attribute' ) }
autoComplete="off"
help={ __(
'Additional information to help clarify the purpose of the link.'
) }
/>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ rel || '' }
onChange={ ( relValue ) => {
setAttributes( { rel: relValue } );
} }
isShownByDefault
hasValue={ () => !! title }
onDeselect={ () => setAttributes( { title: '' } ) }
>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ title || '' }
onChange={ ( titleValue ) => {
setAttributes( { title: titleValue } );
} }
label={ __( 'Title attribute' ) }
autoComplete="off"
help={ __(
'Additional information to help clarify the purpose of the link.'
) }
/>
</ToolsPanelItem>

<ToolsPanelItem
label={ __( 'Rel attribute' ) }
autoComplete="off"
help={ __(
'The relationship of the linked URL as space-separated link types.'
) }
/>
</PanelBody>
isShownByDefault
hasValue={ () => !! rel }
onDeselect={ () => setAttributes( { rel: '' } ) }
>
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ rel || '' }
onChange={ ( relValue ) => {
setAttributes( { rel: relValue } );
} }
label={ __( 'Rel attribute' ) }
autoComplete="off"
help={ __(
'The relationship of the linked URL as space-separated link types.'
) }
/>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
<div { ...blockProps }>
{ /* eslint-disable jsx-a11y/anchor-is-valid */ }
Expand Down
85 changes: 54 additions & 31 deletions packages/block-library/src/page-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ import {
Warning,
} from '@wordpress/block-editor';
import {
PanelBody,
ToolbarButton,
Spinner,
Notice,
ComboboxControl,
Button,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { useMemo, useState, useEffect, useCallback } from '@wordpress/element';
Expand Down Expand Up @@ -320,38 +321,60 @@ export default function PageListEdit( {
return (
<>
<InspectorControls>
{ pagesTree.length > 0 && (
<PanelBody>
<ComboboxControl
__nextHasNoMarginBottom
__next40pxDefaultSize
className="editor-page-attributes__parent"
label={ __( 'Parent' ) }
value={ parentPageID }
options={ pagesTree }
onChange={ ( value ) =>
setAttributes( { parentPageID: value ?? 0 } )
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( { parentPageID: 0 } );
} }
>
{ pagesTree.length > 0 && (
<ToolsPanelItem
label={ __( 'Parent Page' ) }
hasValue={ () => parentPageID !== 0 }
onDeselect={ () =>
setAttributes( { parentPageID: 0 } )
}
help={ __(
'Choose a page to show only its subpages.'
) }
/>
</PanelBody>
) }
{ allowConvertToLinks && (
<PanelBody title={ __( 'Edit this menu' ) }>
<p>{ convertDescription }</p>
<Button
__next40pxDefaultSize
variant="primary"
accessibleWhenDisabled
disabled={ ! hasResolvedPages }
onClick={ convertToNavigationLinks }
isShownByDefault
>
{ __( 'Edit' ) }
</Button>
</PanelBody>
) }
<ComboboxControl
__nextHasNoMarginBottom
__next40pxDefaultSize
className="editor-page-attributes__parent"
label={ __( 'Parent' ) }
value={ parentPageID }
options={ pagesTree }
onChange={ ( value ) =>
setAttributes( {
parentPageID: value ?? 0,
} )
}
help={ __(
'Choose a page to show only its subpages.'
) }
/>
</ToolsPanelItem>
) }

{ allowConvertToLinks && (
<ToolsPanelItem
label={ __( 'Edit Menu' ) }
isShownByDefault
>
<div>
<p>{ convertDescription }</p>
<Button
__next40pxDefaultSize
variant="primary"
accessibleWhenDisabled
disabled={ ! hasResolvedPages }
onClick={ convertToNavigationLinks }
>
{ __( 'Edit' ) }
</Button>
</div>
</ToolsPanelItem>
) }
</ToolsPanel>
</InspectorControls>
{ allowConvertToLinks && (
<>
Expand Down
53 changes: 34 additions & 19 deletions packages/block-library/src/query-pagination-numbers/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
*/
import { __ } from '@wordpress/i18n';
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
import { PanelBody, RangeControl } from '@wordpress/components';
import {
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
RangeControl,
} from '@wordpress/components';

const createPaginationItem = ( content, Tag = 'a', extraClass = '' ) => (
<Tag key={ content } className={ `page-numbers ${ extraClass }` }>
Expand Down Expand Up @@ -46,28 +50,39 @@ export default function QueryPaginationNumbersEdit( {
const paginationNumbers = previewPaginationNumbers(
parseInt( midSize, 10 )
);

return (
<>
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<RangeControl
__next40pxDefaultSize
__nextHasNoMarginBottom
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => setAttributes( { midSize: 2 } ) }
>
<ToolsPanelItem
label={ __( 'Number of links' ) }
help={ __(
'Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'
) }
value={ midSize }
onChange={ ( value ) => {
setAttributes( {
midSize: parseInt( value, 10 ),
} );
} }
min={ 0 }
max={ 5 }
withInputField={ false }
/>
</PanelBody>
hasValue={ () => midSize !== undefined }
onDeselect={ () => setAttributes( { midSize: 2 } ) }
isShownByDefault
>
<RangeControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Number of links' ) }
help={ __(
'Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'
) }
value={ midSize }
onChange={ ( value ) => {
setAttributes( {
midSize: parseInt( value, 10 ),
} );
} }
min={ 0 }
max={ 5 }
withInputField={ false }
/>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
<div { ...useBlockProps() }>{ paginationNumbers }</div>
</>
Expand Down
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

- Add new `Badge` component ([#66555](https://github.com/WordPress/gutenberg/pull/66555)).

### Internal

- `SlotFill`: rewrite the non-portal version to use `observableMap` ([#67400](https://github.com/WordPress/gutenberg/pull/67400)).

## 29.0.0 (2024-12-11)

### Breaking Changes
Expand Down
Loading
Loading