diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 6abbb31fc140a9..9cce45efee06f5 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -8,50 +8,50 @@ This page lists the blocks included in the block-library package. -## Accordion Header +## Accordion -Accordion header. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordion-header)) +Displays a group of accordion headers and associated expandable content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordion)) -- **Name:** core/accordion-header +- **Name:** core/accordion - **Experimental:** true - **Category:** design -- **Parent:** core/accordion-item -- **Supports:** anchor, border, color (background, gradient, text), interactivity, shadow, spacing (margin, padding), typography (fontSize, textAlign), ~~align~~ -- **Attributes:** iconPosition, level, levelOptions, openByDefault, showIcon, textAlignment, title +- **Allowed Blocks:** core/accordion-content +- **Supports:** align (full, wide), background (backgroundImage, backgroundSize), color (background, gradient, text), interactivity, layout, shadow, spacing (blockGap, margin, padding), ~~html~~ +- **Attributes:** allowedBlocks, autoclose, iconPosition, showIcon -## Accordion +## Accordion Content -A single accordion that displays a header and expandable content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordion-item)) +Displays a section of content in an accordion, including a header and expandable content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordion-content)) -- **Name:** core/accordion-item +- **Name:** core/accordion-content - **Experimental:** true - **Category:** design -- **Parent:** core/accordions +- **Parent:** core/accordion - **Allowed Blocks:** core/accordion-header, core/accordion-panel - **Supports:** align (full, wide), color (background, gradient, text), interactivity, shadow, spacing (blockGap, margin) - **Attributes:** openByDefault -## Accordion Panel +## Accordion Header -Accordion Panel ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordion-panel)) +Displays an accordion header. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordion-header)) -- **Name:** core/accordion-panel +- **Name:** core/accordion-header - **Experimental:** true - **Category:** design -- **Parent:** core/accordion-item -- **Supports:** border, color (background, gradient, text), interactivity, shadow, spacing (blockGap, margin, padding), typography (fontSize, lineHeight) -- **Attributes:** allowedBlocks, isSelected, openByDefault, templateLock +- **Parent:** core/accordion-content +- **Supports:** anchor, border, color (background, gradient, text), interactivity, shadow, spacing (margin, padding), typography (fontSize, textAlign), ~~align~~ +- **Attributes:** iconPosition, level, levelOptions, openByDefault, showIcon, textAlignment, title -## Accordions +## Accordion Panel -A group of Accordion headers and associated expandable content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordions)) +Displays an accordion panel. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/accordion-panel)) -- **Name:** core/accordions +- **Name:** core/accordion-panel - **Experimental:** true - **Category:** design -- **Allowed Blocks:** core/accordion-item -- **Supports:** align (full, wide), background (backgroundImage, backgroundSize), color (background, gradient, text), interactivity, layout, shadow, spacing (blockGap, margin, padding), ~~html~~ -- **Attributes:** allowedBlocks, autoclose, iconPosition, showIcon +- **Parent:** core/accordion-content +- **Supports:** border, color (background, gradient, text), interactivity, shadow, spacing (blockGap, margin, padding), typography (fontSize, lineHeight) +- **Attributes:** allowedBlocks, isSelected, openByDefault, templateLock ## Archives diff --git a/lib/blocks.php b/lib/blocks.php index b734d6a317cadd..95caf1d7f192d3 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -46,8 +46,8 @@ function gutenberg_reregister_core_block_types() { 'embed', ), 'block_names' => array( - 'accordion-item.php' => 'core/accordion-item', - 'accordions.php' => 'core/accordions', + 'accordion-content.php' => 'core/accordion-content', + 'accordion.php' => 'core/accordion', 'archives.php' => 'core/archives', 'avatar.php' => 'core/avatar', 'block.php' => 'core/block', diff --git a/packages/block-library/package.json b/packages/block-library/package.json index b51781094197a5..6d000dd591c0f9 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -27,7 +27,7 @@ "react-native": "src/index", "wpScript": true, "wpScriptModuleExports": { - "./accordions/view": "./build-module/accordions/view.js", + "./accordion/view": "./build-module/accordion/view.js", "./file/view": "./build-module/file/view.js", "./form/view": "./build-module/form/view.js", "./image/view": "./build-module/image/view.js", diff --git a/packages/block-library/src/accordion-item/block.json b/packages/block-library/src/accordion-content/block.json similarity index 79% rename from packages/block-library/src/accordion-item/block.json rename to packages/block-library/src/accordion-content/block.json index 2381e228a19c5c..dd56525d9e70cb 100644 --- a/packages/block-library/src/accordion-item/block.json +++ b/packages/block-library/src/accordion-content/block.json @@ -1,14 +1,14 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, - "name": "core/accordion-item", + "name": "core/accordion-content", "version": "0.1.0", - "title": "Accordion", + "title": "Accordion Content", "category": "design", - "description": "A single accordion that displays a header and expandable content.", + "description": "Displays a section of content in an accordion, including a header and expandable content.", "example": {}, "__experimental": true, - "parent": [ "core/accordions" ], + "parent": [ "core/accordion" ], "allowedBlocks": [ "core/accordion-header", "core/accordion-panel" ], "supports": { "align": [ "wide", "full" ], diff --git a/packages/block-library/src/accordion-item/edit.js b/packages/block-library/src/accordion-content/edit.js similarity index 100% rename from packages/block-library/src/accordion-item/edit.js rename to packages/block-library/src/accordion-content/edit.js diff --git a/packages/block-library/src/accordion-item/icon.js b/packages/block-library/src/accordion-content/icon.js similarity index 100% rename from packages/block-library/src/accordion-item/icon.js rename to packages/block-library/src/accordion-content/icon.js diff --git a/packages/block-library/src/accordion-item/icons.js b/packages/block-library/src/accordion-content/icons.js similarity index 100% rename from packages/block-library/src/accordion-item/icons.js rename to packages/block-library/src/accordion-content/icons.js diff --git a/packages/block-library/src/accordion-item/index.js b/packages/block-library/src/accordion-content/index.js similarity index 100% rename from packages/block-library/src/accordion-item/index.js rename to packages/block-library/src/accordion-content/index.js diff --git a/packages/block-library/src/accordion-item/index.php b/packages/block-library/src/accordion-content/index.php similarity index 72% rename from packages/block-library/src/accordion-item/index.php rename to packages/block-library/src/accordion-content/index.php index 73dbacda63c1cb..cd0669d339e7b4 100644 --- a/packages/block-library/src/accordion-item/index.php +++ b/packages/block-library/src/accordion-content/index.php @@ -1,7 +1,7 @@ next_tag( array( 'class_name' => 'wp-block-accordion-item' ) ) ) { + if ( $p->next_tag( array( 'class_name' => 'wp-block-accordion-content' ) ) ) { $open_by_default = $attributes['openByDefault'] ? 'true' : 'false'; $p->set_attribute( 'data-wp-context', '{ "id": "' . $unique_id . '", "openByDefault": ' . $open_by_default . ' }' ); $p->set_attribute( 'data-wp-class--is-open', 'state.isOpen' ); $p->set_attribute( 'data-wp-init', 'callbacks.initIsOpen' ); - if ( $p->next_tag( array( 'class_name' => 'accordion-item__toggle' ) ) ) { + if ( $p->next_tag( array( 'class_name' => 'accordion-content__toggle' ) ) ) { $p->set_attribute( 'data-wp-on--click', 'actions.toggle' ); $p->set_attribute( 'id', $unique_id ); $p->set_attribute( 'aria-controls', $unique_id . '-panel' ); @@ -58,16 +58,16 @@ function block_core_accordion_item_render( $attributes, $content ) { } /** - * Registers the `core/accordion-item` block on server. + * Registers the `core/accordion-content` block on server. * * @since 6.6.0 */ -function register_block_core_accordion_item() { +function register_block_core_accordion_content() { register_block_type_from_metadata( - __DIR__ . '/accordion-item', + __DIR__ . '/accordion-content', array( - 'render_callback' => 'block_core_accordion_item_render', + 'render_callback' => 'block_core_accordion_content_render', ) ); } -add_action( 'init', 'register_block_core_accordion_item' ); +add_action( 'init', 'register_block_core_accordion_content' ); diff --git a/packages/block-library/src/accordion-item/init.js b/packages/block-library/src/accordion-content/init.js similarity index 100% rename from packages/block-library/src/accordion-item/init.js rename to packages/block-library/src/accordion-content/init.js diff --git a/packages/block-library/src/accordion-item/save.js b/packages/block-library/src/accordion-content/save.js similarity index 100% rename from packages/block-library/src/accordion-item/save.js rename to packages/block-library/src/accordion-content/save.js diff --git a/packages/block-library/src/accordion-header/block.json b/packages/block-library/src/accordion-header/block.json index 93e7df9299411b..c3e413e9f5f351 100644 --- a/packages/block-library/src/accordion-header/block.json +++ b/packages/block-library/src/accordion-header/block.json @@ -5,10 +5,10 @@ "version": "0.1.0", "title": "Accordion Header", "category": "design", - "description": "Accordion header.", + "description": "Displays an accordion header.", "example": {}, "__experimental": true, - "parent": [ "core/accordion-item" ], + "parent": [ "core/accordion-content" ], "usesContext": [ "core/accordion-icon-position", "core/accordion-show-icon" diff --git a/packages/block-library/src/accordion-header/edit.js b/packages/block-library/src/accordion-header/edit.js index 63ab1b51fbc8b6..2d79f722b6f4a4 100644 --- a/packages/block-library/src/accordion-header/edit.js +++ b/packages/block-library/src/accordion-header/edit.js @@ -21,7 +21,7 @@ import { ToolbarGroup } from '@wordpress/components'; /** * Internal dependencies */ -import { plus } from '../accordion-item/icons'; +import { plus } from '../accordion-content/icons'; const ICONS = { plus, @@ -73,7 +73,7 @@ export default function Edit( { attributes, setAttributes, context } ) { blockProps.className, colorProps.className, borderProps.className, - 'accordion-item__heading', + 'accordion-content__heading', { [ `has-custom-font-size` ]: blockProps.style.fontSize, [ `icon-position-left` ]: iconPosition === 'left', @@ -87,7 +87,7 @@ export default function Edit( { attributes, setAttributes, context } ) { } } >