diff --git a/packages/block-editor/src/components/colors-gradients/control.js b/packages/block-editor/src/components/colors-gradients/control.js index fb81f800c2b98d..9e969842da61fe 100644 --- a/packages/block-editor/src/components/colors-gradients/control.js +++ b/packages/block-editor/src/components/colors-gradients/control.js @@ -55,6 +55,7 @@ function ColorGradientControlInner( { clearable, showTitle = true, enableAlpha, + headingLevel, } ) { const canChooseAColor = onColorChange && ( ! isEmpty( colors ) || ! disableCustomColors ); @@ -84,6 +85,7 @@ function ColorGradientControlInner( { } clearable={ clearable } enableAlpha={ enableAlpha } + headingLevel={ headingLevel } /> ), [ TAB_GRADIENT.value ]: ( @@ -103,6 +105,7 @@ function ColorGradientControlInner( { __experimentalIsRenderedInSidebar } clearable={ clearable } + headingLevel={ headingLevel } /> ), }; diff --git a/packages/components/src/color-palette/index.tsx b/packages/components/src/color-palette/index.tsx index c967703141ea34..77e9fb46f48930 100644 --- a/packages/components/src/color-palette/index.tsx +++ b/packages/components/src/color-palette/index.tsx @@ -107,6 +107,7 @@ function MultiplePalettes( { onChange, value, actions, + headingLevel, }: MultiplePalettesProps ) { if ( colors.length === 0 ) { return null; @@ -117,7 +118,9 @@ function MultiplePalettes( { { colors.map( ( { name, colors: colorPalette }, index ) => { return ( - { name } + + { name } + onChange( undefined ), [ onChange ] ); const hasMultipleColorOrigins = isMultiplePaletteArray( colors ); @@ -235,6 +240,7 @@ function UnforwardedColorPalette( { __( 'Clear' ) } ), + headingLevel, }; return ( diff --git a/packages/components/src/color-palette/types.ts b/packages/components/src/color-palette/types.ts index 58f55ad8f758f4..cf7f3e640447c6 100644 --- a/packages/components/src/color-palette/types.ts +++ b/packages/components/src/color-palette/types.ts @@ -7,6 +7,7 @@ import type { CSSProperties, ReactNode } from 'react'; * Internal dependencies */ import type { DropdownProps } from '../dropdown/types'; +import type { HeadingSize } from '../heading/types'; export type ColorObject = { name: string; @@ -27,6 +28,7 @@ type PaletteProps = { onChange: ( newColor?: string, index?: number ) => void; value?: string; actions?: ReactNode; + headingLevel?: HeadingSize; }; export type SinglePaletteProps = PaletteProps & { @@ -80,4 +82,10 @@ export type ColorPaletteProps = Pick< PaletteProps, 'onChange' > & { * @default false */ __experimentalIsRenderedInSidebar?: boolean; + /** + * The heaeding level. + * + * @default 2 + */ + headingLevel?: HeadingSize; }; diff --git a/packages/components/src/gradient-picker/index.js b/packages/components/src/gradient-picker/index.js index 1a5338e4591656..e1d3892cc51d50 100644 --- a/packages/components/src/gradient-picker/index.js +++ b/packages/components/src/gradient-picker/index.js @@ -77,13 +77,16 @@ function MultipleOrigin( { onChange, value, actions, + headingLevel, } ) { return ( { gradients.map( ( { name, gradients: gradientSet }, index ) => { return ( - { name } + + { name } + onChange( undefined ), @@ -168,6 +172,7 @@ export default function GradientPicker( { ) } + headingLevel={ headingLevel } /> ) } diff --git a/packages/components/src/palette-edit/index.js b/packages/components/src/palette-edit/index.js index 5beccbeebfb85a..d90f02d8163e70 100644 --- a/packages/components/src/palette-edit/index.js +++ b/packages/components/src/palette-edit/index.js @@ -313,6 +313,7 @@ export default function PaletteEdit( { colors = EMPTY_ARRAY, onChange, paletteLabel, + paletteLabelLevel = 2, emptyMessage, canOnlyChangeValues, canReset, @@ -347,7 +348,9 @@ export default function PaletteEdit( { return ( - { paletteLabel } + + { paletteLabel } + { hasElements && isEditing && ( - + { labelText } { hasMenuItems && ( diff --git a/packages/components/src/tools-panel/tools-panel/component.tsx b/packages/components/src/tools-panel/tools-panel/component.tsx index fcfa353a0210d7..929868e3f1f8c5 100644 --- a/packages/components/src/tools-panel/tools-panel/component.tsx +++ b/packages/components/src/tools-panel/tools-panel/component.tsx @@ -23,6 +23,7 @@ const ToolsPanel = ( panelContext, resetAllItems, toggleItem, + headingLevel, ...toolsPanelProps } = useToolsPanel( props ); @@ -33,6 +34,7 @@ const ToolsPanel = ( label={ label } resetAll={ resetAllItems } toggleItem={ toggleItem } + headingLevel={ headingLevel } /> { children } diff --git a/packages/components/src/tools-panel/types.ts b/packages/components/src/tools-panel/types.ts index b95a50a4aa9cbc..bb73d06ce50e0d 100644 --- a/packages/components/src/tools-panel/types.ts +++ b/packages/components/src/tools-panel/types.ts @@ -3,6 +3,11 @@ */ import type { ReactNode } from 'react'; +/** + * Internal dependencies + */ +import type { HeadingSize } from '../heading/types'; + type ResetAllFilter = () => void; type ResetAll = ( filters?: ResetAllFilter[] ) => void; @@ -47,6 +52,10 @@ export type ToolsPanelProps = { * last visible `ToolsPanelItem` within the `ToolsPanel`. */ __experimentalLastVisibleItemClass?: string; + /** + * The heading level of the panel's header. + */ + headingLevel: HeadingSize; }; export type ToolsPanelHeaderProps = { @@ -67,6 +76,10 @@ export type ToolsPanelHeaderProps = { * `onSelect` or `onDeselect` callbacks as appropriate. */ toggleItem: ( label: string ) => void; + /** + * The heading level of the panel's header. + */ + headingLevel: HeadingSize; }; export type ToolsPanelItem = { diff --git a/packages/edit-site/src/components/global-styles/color-palette-panel.js b/packages/edit-site/src/components/global-styles/color-palette-panel.js index f29adec52b5cec..0f5984b158fc09 100644 --- a/packages/edit-site/src/components/global-styles/color-palette-panel.js +++ b/packages/edit-site/src/components/global-styles/color-palette-panel.js @@ -55,6 +55,7 @@ export default function ColorPalettePanel( { name } ) { colors={ themeColors } onChange={ setThemeColors } paletteLabel={ __( 'Theme' ) } + paletteLabelLevel={ 3 } /> ) } { !! defaultColors && @@ -66,12 +67,14 @@ export default function ColorPalettePanel( { name } ) { colors={ defaultColors } onChange={ setDefaultColors } paletteLabel={ __( 'Default' ) } + paletteLabelLevel={ 3 } /> ) } + { ( showContentSizeControl || showWideSizeControl ) && ( { __( 'Set the width of the main content area.' ) } diff --git a/packages/edit-site/src/components/global-styles/gradients-palette-panel.js b/packages/edit-site/src/components/global-styles/gradients-palette-panel.js index 6febec95e11971..02b2f5c1ca4f77 100644 --- a/packages/edit-site/src/components/global-styles/gradients-palette-panel.js +++ b/packages/edit-site/src/components/global-styles/gradients-palette-panel.js @@ -75,6 +75,7 @@ export default function GradientPalettePanel( { name } ) { gradients={ themeGradients } onChange={ setThemeGradients } paletteLabel={ __( 'Theme' ) } + paletteLabelLevel={ 3 } /> ) } { !! defaultGradients && @@ -86,12 +87,14 @@ export default function GradientPalettePanel( { name } ) { gradients={ defaultGradients } onChange={ setDefaultGradients } paletteLabel={ __( 'Default' ) } + paletteLabelLevel={ 3 } /> ) } { !! duotonePalette && !! duotonePalette.length && (
- { __( 'Duotone' ) } + { __( 'Duotone' ) } - { title } + + { title } + diff --git a/packages/edit-site/src/components/global-styles/palette.js b/packages/edit-site/src/components/global-styles/palette.js index 09148a55bd57a7..288403407a197e 100644 --- a/packages/edit-site/src/components/global-styles/palette.js +++ b/packages/edit-site/src/components/global-styles/palette.js @@ -65,7 +65,7 @@ function Palette( { name } ) { return ( - { __( 'Palette' ) } + { __( 'Palette' ) } diff --git a/packages/edit-site/src/components/global-styles/screen-button-color.js b/packages/edit-site/src/components/global-styles/screen-button-color.js index 2ee286e574f470..1c2e19391dc822 100644 --- a/packages/edit-site/src/components/global-styles/screen-button-color.js +++ b/packages/edit-site/src/components/global-styles/screen-button-color.js @@ -64,9 +64,9 @@ function ScreenButtonColor( { name, variation = '' } ) { ) } /> -

+

{ __( 'Text color' ) } -

+ -

+

{ __( 'Background color' ) } -

+ ); diff --git a/packages/edit-site/src/components/global-styles/screen-colors.js b/packages/edit-site/src/components/global-styles/screen-colors.js index d4a5ba84ce646a..9ed6c570566b08 100644 --- a/packages/edit-site/src/components/global-styles/screen-colors.js +++ b/packages/edit-site/src/components/global-styles/screen-colors.js @@ -233,7 +233,7 @@ function ScreenColors( { name, variation = '' } ) { - { __( 'Elements' ) } + { __( 'Elements' ) }
-

{ __( 'Select heading level' ) }

+

{ __( 'Select heading level' ) }

{ hasTextColor && (
-

+

{ selectedLevel === 'heading' ? __( 'Text color for all heading levels' ) : sprintf( @@ -159,7 +159,7 @@ function ScreenHeadingColor( { name, variation = '' } ) { __( 'Text color for %s' ), selectedLevel.toUpperCase() ) } -

+
) } { hasBackgroundColor && (
-

+

{ selectedLevel === 'heading' ? __( 'Background color for all heading levels' ) : sprintf( @@ -183,7 +184,7 @@ function ScreenHeadingColor( { name, variation = '' } ) { __( 'Background color for %s' ), selectedLevel.toUpperCase() ) } -

+
diff --git a/packages/edit-site/src/components/global-styles/screen-link-color.js b/packages/edit-site/src/components/global-styles/screen-link-color.js index 6403ff97e035a1..c83693e52e1937 100644 --- a/packages/edit-site/src/components/global-styles/screen-link-color.js +++ b/packages/edit-site/src/components/global-styles/screen-link-color.js @@ -111,6 +111,7 @@ function ScreenLinkColor( { name, variation = '' } ) { pseudoSelectorConfig.value === pseudoSelectorConfig.userValue } + headingLevel={ 3 } /> ); diff --git a/packages/edit-site/src/components/global-styles/screen-text-color.js b/packages/edit-site/src/components/global-styles/screen-text-color.js index 03dc46059333b3..e6202326d4edb0 100644 --- a/packages/edit-site/src/components/global-styles/screen-text-color.js +++ b/packages/edit-site/src/components/global-styles/screen-text-color.js @@ -53,6 +53,7 @@ function ScreenTextColor( { name, variation = '' } ) { colorValue={ color } onColorChange={ setColor } clearable={ color === userColor } + headingLevel={ 3 } /> ); diff --git a/packages/edit-site/src/components/global-styles/screen-typography.js b/packages/edit-site/src/components/global-styles/screen-typography.js index 6c813c454a2fcf..b7e89027d92ed2 100644 --- a/packages/edit-site/src/components/global-styles/screen-typography.js +++ b/packages/edit-site/src/components/global-styles/screen-typography.js @@ -109,7 +109,7 @@ function ScreenTypography( { name, variation = '' } ) { { ! name && (
- { __( 'Elements' ) } + { __( 'Elements' ) } + { children } );