This commit is contained in:
Antoine M 2026-05-05 14:56:26 +02:00
parent 887aed22ab
commit e12ccb8581
12 changed files with 82 additions and 58 deletions

View File

@ -411,6 +411,10 @@ return array(
'style' => 'file:./style-index.css',
'viewScript' => 'file:./view.js',
'attributes' => array(
'hasBorder' => array(
'type' => 'boolean',
'default' => true
),
'hasBackgroundColor' => array(
'type' => 'boolean',
'default' => false
@ -1196,6 +1200,14 @@ return array(
'title' => array(
'type' => 'string',
'default' => ''
),
'iconId' => array(
'type' => 'number',
'default' => 0
),
'iconUrl' => array(
'type' => 'string',
'default' => ''
)
)
),

View File

@ -17,6 +17,10 @@
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"attributes": {
"hasBorder": {
"type": "boolean",
"default": true
},
"hasBackgroundColor": {
"type": "boolean",
"default": false

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'b9d661166b3c086cffae');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '3bb8c381c4f6eeb1196a');

View File

@ -41,7 +41,7 @@ function isColorLight(color) {
\*************************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/content-card","version":"0.1.0","title":"Content Card","category":"carhop-blocks","icon":"smiley","description":"Carte de contenu pour la mise en forme d\'éléments de contenu","example":{},"supports":{"html":false},"textdomain":"carhop-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"hasBackgroundColor":{"type":"boolean","default":false},"backgroundColor":{"type":"string","default":"#136f63"},"hasLightBackground":{"type":"boolean","default":true},"textColor":{"type":"string","default":"#136f63"}}}');
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/content-card","version":"0.1.0","title":"Content Card","category":"carhop-blocks","icon":"smiley","description":"Carte de contenu pour la mise en forme d\'éléments de contenu","example":{},"supports":{"html":false},"textdomain":"carhop-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"hasBorder":{"type":"boolean","default":true},"hasBackgroundColor":{"type":"boolean","default":false},"backgroundColor":{"type":"string","default":"#136f63"},"hasLightBackground":{"type":"boolean","default":true},"textColor":{"type":"string","default":"#136f63"}}}');
/***/ }),
@ -81,7 +81,8 @@ function Edit({
hasBackgroundColor,
backgroundColor,
textColor,
hasLightBackground
hasLightBackground,
hasBorder
} = attributes;
function onBackgroundColorChange(value) {
if (value === undefined) {
@ -116,35 +117,21 @@ function Edit({
});
}
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, {
className: "deligraph-blocks-components-image__panel-body",
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Arrière plan", "deligraph-blocks"),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.CheckboxControl, {
label: "Arri\xE8re plan color\xE9",
checked: hasBackgroundColor,
onChange: onHasBackgroundColorChange
}), hasBackgroundColor && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ColorPalette, {
colors: colors,
value: backgroundColor,
onChange: onBackgroundColorChange
})
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, {
className: "deligraph-blocks-components-image__panel-body",
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Couleur du texte", "deligraph-blocks"),
children: hasBackgroundColor && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ColorPalette, {
colors: colors,
value: textColor,
onChange: onTextColorChange
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Options", "carhop-blocks"),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.CheckboxControl, {
label: "Bordure",
checked: hasBorder,
onChange: value => setAttributes({
hasBorder: value
})
})
})]
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
className: `content-card ${hasLightBackground ? "content-card--bg-light" : "content-card--bg-dark"}`,
className: `content-card ${hasLightBackground ? "content-card--bg-light" : "content-card--bg-dark"} ${hasBorder ? "content-card--has-border" : ""}`,
style: {
"--content-card-text-color": textColor !== null && textColor !== void 0 ? textColor : "inherit",
"--content-card-background-color": hasBackgroundColor ? backgroundColor : "transparent"
@ -156,7 +143,7 @@ function Edit({
template: [["core/paragraph", {
placeholder: "Ajouter ici le texte"
}]],
allowedBlocks: ["core/heading", "core/paragraph", "core/group", "core/list", "core/button", "core/buttons", "carhop-blocks/heading", "carhop-blocks/cta-group"]
allowedBlocks: ["core/heading", "core/paragraph", "core/group", "core/list", "core/button", "core/buttons", "carhop-blocks/heading", "carhop-blocks/cta-group", "carhop-blocks/cta"]
})
})
})]
@ -243,11 +230,12 @@ function save({
backgroundColor,
textColor,
hasLightBackground,
hasBackgroundColor
hasBackgroundColor,
hasBorder
} = attributes;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.useBlockProps.save({
className: `content-card ${hasLightBackground ? "content-card--bg-light" : "content-card--bg-dark"}`,
className: `content-card ${hasLightBackground ? "content-card--bg-light" : "content-card--bg-dark"} ${hasBorder ? "content-card--has-border" : ""}`,
style: {
"--content-card-text-color": textColor !== null && textColor !== void 0 ? textColor : "inherit",
"--content-card-background-color": hasBackgroundColor ? backgroundColor : "transparent"

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,14 @@
"title": {
"type": "string",
"default": ""
},
"iconId": {
"type": "number",
"default": 0
},
"iconUrl": {
"type": "string",
"default": ""
}
}
}

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'f0707b941eb4f50b49b3');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '4780c6235b38248e46c9');

View File

@ -8,7 +8,7 @@
\****************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/tab","version":"0.1.0","title":"Tab","category":"carhop-blocks","icon":"smiley","description":"Tab pour la mise en forme supérieure d\'éléments de contenu","example":{},"supports":{"html":false,"color":{"text":true,"background":false,"link":false}},"textdomain":"tab","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"title":{"type":"string","default":""}}}');
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/tab","version":"0.1.0","title":"Tab","category":"carhop-blocks","icon":"smiley","description":"Tab pour la mise en forme supérieure d\'éléments de contenu","example":{},"supports":{"html":false,"color":{"text":true,"background":false,"link":false}},"textdomain":"tab","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"title":{"type":"string","default":""},"iconId":{"type":"number","default":0},"iconUrl":{"type":"string","default":""}}}');
/***/ }),
@ -48,6 +48,7 @@ function Edit({
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
className: "block-chapo"
});
console.log(attributes);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, {
@ -111,22 +112,17 @@ function Edit({
})
})
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
...blockProps,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText, {
tagName: "h2",
className: "tab__title",
placeholder: "Titre",
value: title,
onChange: value => setAttributes({
title: value
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks, {
allowedBlocks: ["core/heading", "core/paragraph", "core/list", "core/button", "core/buttons", "core/image", "core/embed", "core/quote", "core/pullquote", "core/media-text", "core/table", "core/group", "core/columns", "core/post-title", "carhop-blocks/cta", "carhop-blocks/heading", "carhop-blocks/cta-group", "carhop-blocks/audio-player", "carhop-blocks/content-box", "carhop-blocks/notice-panel", "shortcode"],
template: [["core/paragraph", {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks, {
allowedBlocks: ["core/heading", "core/paragraph", "core/list", "core/button", "core/buttons", "core/image", "core/embed", "core/quote", "core/pullquote", "core/media-text", "core/table", "core/group", "core/columns", "core/post-title", "carhop-blocks/cta", "carhop-blocks/heading", "carhop-blocks/cta-group", "carhop-blocks/audio-player", "carhop-blocks/content-box", "carhop-blocks/content-card", "carhop-blocks/notice-panel", "shortcode"],
template: [["core/heading", {
content: "Titre",
level: 3
}], ["core/paragraph", {
content: "Contenu"
}]]
})]
})
})]
});
}
@ -179,6 +175,10 @@ __webpack_require__.r(__webpack_exports__);
})
})
},
__experimentalLabel: attributes => {
const label = attributes?.title?.trim();
return label || _block_json__WEBPACK_IMPORTED_MODULE_4__.title;
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});
@ -212,12 +212,8 @@ function save({
const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.useBlockProps.save({
className: "tab"
});
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.RichText.Content, {
value: title,
tagName: "h2",
className: "tab__title"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.InnerBlocks.Content, {})]
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.Fragment, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.InnerBlocks.Content, {})
});
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '9351ef08403e5d3a4db5');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '36820ff09c645c75d8de');

View File

@ -5,12 +5,29 @@
/*!**************************************************!*\
!*** ./src/core-variants/core-buttons/editor.js ***!
\**************************************************/
/***/ (() => {
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
wp.blocks.registerBlockStyle("core/buttons", {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockStyle)("core/buttons", {
name: "big-buttons",
label: "Grands boutons "
});
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockVariation)("core/button", {
name: "email-button",
title: "Bouton email",
description: "Ajoute une icone email devant le texte.",
attributes: {
className: "email-button"
},
isActive: ({
className = ""
}) => className.split(/\s+/).includes("email-button"),
scope: ["inserter", "transform", "block"]
});
/***/ }),
@ -546,7 +563,6 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _core_embed_variant_editor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_core_embed_variant_editor_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _core_list_variant_editor_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./core-list-variant/editor.js */ "./src/core-variants/core-list-variant/editor.js");
/* harmony import */ var _core_buttons_editor_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./core-buttons/editor.js */ "./src/core-variants/core-buttons/editor.js");
/* harmony import */ var _core_buttons_editor_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_core_buttons_editor_js__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _core_columns_editor_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./core-columns/editor.js */ "./src/core-variants/core-columns/editor.js");
/* harmony import */ var _core_pullquote_editor_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./core-pullquote/editor.js */ "./src/core-variants/core-pullquote/editor.js");
/* harmony import */ var _core_pullquote_editor_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_core_pullquote_editor_js__WEBPACK_IMPORTED_MODULE_6__);

File diff suppressed because one or more lines are too long