Skip to content
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
2 changes: 1 addition & 1 deletion .version-data.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "2025.1.2"
"version": "2026.0.0"
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wp-dsfr",
"version": "1.0.0",
"description": "DSFR theme and blocks for WordPress",
"version": "2026.0.0",
"description": "DSFR theme and blocks for WordPress",
"author": "Be API",
"repository": {
"type": "git",
Expand All @@ -14,9 +14,9 @@
"destroy": "wp-env destroy"
},
"dependencies": {
"@wordpress/env": "^9.8.0"
"@wordpress/env": "^11.9.0"
},
"volta": {
"node": "20.13.1"
"node": "24.11.0"
}
}
4 changes: 2 additions & 2 deletions wp-dsfr-blocks/.version-data.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"slug": "wp-dsfr-blocks",
"version": "1.0.0"
}
"version": "2026.0.0"
}
14 changes: 7 additions & 7 deletions wp-dsfr-blocks/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "wp-dsfr-blocks",
"version": "1.0.0",
"version": "2026.0.0",
"description": "DSFR Gutenberg blocks for wp-dsfr-theme",
"author": "Be API",
"repository": {
"type": "git",
"url": "https://github.com/BeAPI/wp-dsfr"
},
"repository": {
"type": "git",
"url": "https://github.com/BeAPI/wp-dsfr"
},
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"scripts": {
Expand All @@ -23,7 +23,7 @@
"wp-dsfr-blocks.php"
],
"devDependencies": {
"@wordpress/scripts": "^26.13.0",
"@wordpress/scripts": "^32.5.1",
"classnames": "^2.3.1",
"html-react-parser": "^5.1.10"
},
Expand All @@ -32,6 +32,6 @@
"@wordpress/icons": "^9.49.0"
},
"volta": {
"node": "20.13.1"
"node": "24.11.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ import { __ } from '@wordpress/i18n';
import { SelectControl } from '@wordpress/components';
import getDSFRColorList from '../utils/getDSFRColorList';

export default function (props) {
export default function ( props ) {
const colorsList = getDSFRColorList();
const options = [
{
label: __('Défaut', 'wp-dsfr-blocks'),
label: __( 'Défaut', 'wp-dsfr-blocks' ),
value: '',
},
];

for (const color in colorsList) {
options.push({
label: colorsList[color],
for ( const color in colorsList ) {
options.push( {
label: colorsList[ color ],
value: color,
});
} );
}

props = Object.assign(
{
label: __('Couleur du bloc', 'wp-dsfr-blocks'),
label: __( 'Couleur du bloc', 'wp-dsfr-blocks' ),
},
props,
{ options }
);

return <SelectControl {...props} />;
return <SelectControl { ...props } />;
}
23 changes: 13 additions & 10 deletions wp-dsfr-blocks/src/common/js/components/IconRaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,33 @@ import parse from 'html-react-parser';
*/
import { Icon } from '@wordpress/components';

export default function IconRaw({ content }) {
if (!Boolean(content)) {
export default function IconRaw( { content } ) {
if ( ! Boolean( content ) ) {
return <></>;
}

return (
<Icon
icon={() =>
parse(content, {
icon={ () =>
parse( content, {
trim: true,
replace: (domNode) => {
if (domNode.type === 'tag' && domNode.name === 'svg') {
replace: ( domNode ) => {
if (
domNode.type === 'tag' &&
domNode.name === 'svg'
) {
domNode.attribs.focusable = 'false';
domNode.attribs['aria-hidden'] = 'true';
domNode.attribs[ 'aria-hidden' ] = 'true';
}
if (
domNode.type !== 'tag' ||
(!domNode.parent && domNode.name !== 'svg') ||
!domNode.name
( ! domNode.parent && domNode.name !== 'svg' ) ||
! domNode.name
) {
return <></>;
}
},
})
} )
}
/>
);
Expand Down
34 changes: 17 additions & 17 deletions wp-dsfr-blocks/src/common/js/utils/getDSFRColorList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import { __ } from '@wordpress/i18n';

export default function () {
return {
'green-tilleul-verveine': __('Tilleul verveine', 'wp-dsfr-theme'),
'green-bourgeon': __('Bourgeon', 'wp-dsfr-theme'),
'green-emeraude': __('Émeraude', 'wp-dsfr-theme'),
'green-menthe': __('Menthe', 'wp-dsfr-theme'),
'green-archipel': __('Archipel', 'wp-dsfr-theme'),
'blue-ecume': __('Écume', 'wp-dsfr-theme'),
'blue-cumulus': __('Cumulus', 'wp-dsfr-theme'),
'purple-glycine': __('Glycine', 'wp-dsfr-theme'),
'pink-macaron': __('Macaron', 'wp-dsfr-theme'),
'pink-tuile': __('Tuile', 'wp-dsfr-theme'),
'yellow-tournesol': __('Tournesol', 'wp-dsfr-theme'),
'yellow-moutarde': __('Moutarde', 'wp-dsfr-theme'),
'orange-terre-battue': __('Terre battue', 'wp-dsfr-theme'),
'brown-cafe-creme': __('Café crème', 'wp-dsfr-theme'),
'brown-caramel': __('Caramel', 'wp-dsfr-theme'),
'brown-opera': __('Opéra', 'wp-dsfr-theme'),
'beige-gris-galet': __('Gris galet', 'wp-dsfr-theme'),
'green-tilleul-verveine': __( 'Tilleul verveine', 'wp-dsfr-theme' ),
'green-bourgeon': __( 'Bourgeon', 'wp-dsfr-theme' ),
'green-emeraude': __( 'Émeraude', 'wp-dsfr-theme' ),
'green-menthe': __( 'Menthe', 'wp-dsfr-theme' ),
'green-archipel': __( 'Archipel', 'wp-dsfr-theme' ),
'blue-ecume': __( 'Écume', 'wp-dsfr-theme' ),
'blue-cumulus': __( 'Cumulus', 'wp-dsfr-theme' ),
'purple-glycine': __( 'Glycine', 'wp-dsfr-theme' ),
'pink-macaron': __( 'Macaron', 'wp-dsfr-theme' ),
'pink-tuile': __( 'Tuile', 'wp-dsfr-theme' ),
'yellow-tournesol': __( 'Tournesol', 'wp-dsfr-theme' ),
'yellow-moutarde': __( 'Moutarde', 'wp-dsfr-theme' ),
'orange-terre-battue': __( 'Terre battue', 'wp-dsfr-theme' ),
'brown-cafe-creme': __( 'Café crème', 'wp-dsfr-theme' ),
'brown-caramel': __( 'Caramel', 'wp-dsfr-theme' ),
'brown-opera': __( 'Opéra', 'wp-dsfr-theme' ),
'beige-gris-galet': __( 'Gris galet', 'wp-dsfr-theme' ),
};
}
4 changes: 2 additions & 2 deletions wp-dsfr-blocks/src/common/js/utils/isValidURL.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function (str) {
export default function ( str ) {
try {
new URL(str);
new URL( str );
} catch {
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions wp-dsfr-blocks/src/common/js/utils/setDSFRBlockClassName.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function (blockProps, searchSuffix, replacement) {
if (!blockProps.className) {
export default function ( blockProps, searchSuffix, replacement ) {
if ( ! blockProps.className ) {
blockProps.className = '';
}

Expand All @@ -8,5 +8,5 @@ export default function (blockProps, searchSuffix, replacement) {
typeof replacement !== 'undefined' ? replacement : searchSuffix
);

blockProps.className = blockProps.className.replace('wp-block', '');
blockProps.className = blockProps.className.replace( 'wp-block', '' );
}
4 changes: 2 additions & 2 deletions wp-dsfr-blocks/src/common/js/utils/uniqid.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function (prefix) {
return prefix + '-' + Math.round(Math.random() * 16777215).toString(32);
export default function ( prefix ) {
return prefix + '-' + Math.round( Math.random() * 16777215 ).toString( 32 );
}
4 changes: 2 additions & 2 deletions wp-dsfr-blocks/src/fr-accordion-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "dsfr/fr-accordion-title",
"parent": ["dsfr/fr-accordion"],
"parent": [ "dsfr/fr-accordion" ],
"version": "1.0.0",
"title": "Titre d'accordéon",
"category": "widgets",
Expand All @@ -29,7 +29,7 @@
"default": ""
}
},
"usesContext": ["dsfr/fr-accordion--id"],
"usesContext": [ "dsfr/fr-accordion--id" ],
"textdomain": "wp-dsfr-blocks",
"editorScript": "file:./index.js"
}
22 changes: 11 additions & 11 deletions wp-dsfr-blocks/src/fr-accordion-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { useBlockProps, RichText } from '@wordpress/block-editor';
import { useEffect } from '@wordpress/element';
import setDSFRBlockClassName from '../common/js/utils/setDSFRBlockClassName';

export default function Edit({ attributes, setAttributes, context }) {
export default function Edit( { attributes, setAttributes, context } ) {
const blockProps = useBlockProps();
const { label } = attributes;

useEffect(() => {
setAttributes({ ariaControls: context['dsfr/fr-accordion--id'] });
}, [context['dsfr/fr-accordion--id']]);
useEffect( () => {
setAttributes( { ariaControls: context[ 'dsfr/fr-accordion--id' ] } );
}, [ context[ 'dsfr/fr-accordion--id' ] ] );

setDSFRBlockClassName(
blockProps,
Expand All @@ -18,16 +18,16 @@ export default function Edit({ attributes, setAttributes, context }) {
);

return (
<h3 {...blockProps}>
<h3 { ...blockProps }>
<RichText
tagName="span"
className="fr-accordion__btn"
allowedFormats={[]}
value={label}
placeholder={__("Titre de l'accordéon", 'wp-dsfr-blocks')}
onChange={(content) => {
setAttributes({ label: content });
}}
allowedFormats={ [] }
value={ label }
placeholder={ __( "Titre de l'accordéon", 'wp-dsfr-blocks' ) }
onChange={ ( content ) => {
setAttributes( { label: content } );
} }
/>
</h3>
);
Expand Down
4 changes: 2 additions & 2 deletions wp-dsfr-blocks/src/fr-accordion-title/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Edit from './edit';
import save from './save';
import metadata from './block.json';

registerBlockType(metadata.name, {
registerBlockType( metadata.name, {
edit: Edit,
save,
});
} );
8 changes: 4 additions & 4 deletions wp-dsfr-blocks/src/fr-accordion-title/save.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useBlockProps } from '@wordpress/block-editor';
import setDSFRBlockClassName from '../common/js/utils/setDSFRBlockClassName';

export default function save({ attributes: { label, ariaControls } }) {
export default function save( { attributes: { label, ariaControls } } ) {
const blockProps = useBlockProps.save();

setDSFRBlockClassName(
Expand All @@ -11,13 +11,13 @@ export default function save({ attributes: { label, ariaControls } }) {
);

return (
<h3 {...blockProps}>
<h3 { ...blockProps }>
<button
aria-expanded="false"
className="fr-accordion__btn"
aria-controls={ariaControls}
aria-controls={ ariaControls }
>
{label}
{ label }
</button>
</h3>
);
Expand Down
2 changes: 1 addition & 1 deletion wp-dsfr-blocks/src/fr-accordion/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "dsfr/fr-accordion",
"parent": ["dsfr/fr-accordions-group"],
"parent": [ "dsfr/fr-accordions-group" ],
"version": "1.0.0",
"title": "Accordéons",
"category": "widgets",
Expand Down
18 changes: 9 additions & 9 deletions wp-dsfr-blocks/src/fr-accordion/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { useEffect } from '@wordpress/element';
import setDSFRBlockClassName from '../common/js/utils/setDSFRBlockClassName';
import uniqid from '../common/js/utils/uniqid';

export default function Edit({ setAttributes }) {
export default function Edit( { setAttributes } ) {
const blockProps = useBlockProps();
const innerBlocksProps = useInnerBlocksProps(blockProps, {
const innerBlocksProps = useInnerBlocksProps( blockProps, {
directInsert: false,
templateLock: 'all',
template: [['dsfr/fr-accordion-title'], ['dsfr/fr-collapse']],
});
template: [ [ 'dsfr/fr-accordion-title' ], [ 'dsfr/fr-collapse' ] ],
} );

useEffect(() => {
setAttributes({ id: uniqid('fr-collapse') });
}, []); // eslint-disable-line react-hooks/exhaustive-deps
useEffect( () => {
setAttributes( { id: uniqid( 'fr-collapse' ) } );
}, [] ); // eslint-disable-line react-hooks/exhaustive-deps

setDSFRBlockClassName(innerBlocksProps, 'fr-accordion');
setDSFRBlockClassName( innerBlocksProps, 'fr-accordion' );

return <div {...innerBlocksProps} />;
return <div { ...innerBlocksProps } />;
}
4 changes: 2 additions & 2 deletions wp-dsfr-blocks/src/fr-accordion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Edit from './edit';
import save from './save';
import metadata from './block.json';

registerBlockType(metadata.name, {
registerBlockType( metadata.name, {
edit: Edit,
save,
});
} );
6 changes: 3 additions & 3 deletions wp-dsfr-blocks/src/fr-accordion/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
import setDSFRBlockClassName from '../common/js/utils/setDSFRBlockClassName';

export default function save() {
const innerBlocksProps = useInnerBlocksProps.save(useBlockProps.save());
const innerBlocksProps = useInnerBlocksProps.save( useBlockProps.save() );

setDSFRBlockClassName(innerBlocksProps, 'fr-accordion');
setDSFRBlockClassName( innerBlocksProps, 'fr-accordion' );

return <div {...innerBlocksProps} />;
return <div { ...innerBlocksProps } />;
}
Loading
Loading