corvée(dépendances) ajoute Carbon Fields

This commit is contained in:
gcch 2024-08-09 18:45:01 +02:00
commit 62368587e5
459 changed files with 72750 additions and 26 deletions

View file

@ -0,0 +1,50 @@
/**
* External dependencies.
*/
import { select } from '@wordpress/data';
import { addFilter } from '@wordpress/hooks';
import { withEffects } from 'refract-callbag';
/**
* Internal dependencies.
*/
import './style.scss';
/**
* Carbon Fields dependencies.
*/
import { fromSelector } from '@carbon-fields/core';
/**
* The function that controls the stream of side effects.
*
* @return {Object}
*/
function aperture() {
return fromSelector( select( 'carbon-fields/metaboxes' ).isFieldUpdated );
}
/**
* The function that causes the side effects.
*
* @param {Object} props
* @return {Function}
*/
function handler( props ) {
return function( { action } ) {
if ( ! action ) {
return;
}
const { container } = props;
const { payload } = action;
if ( container.fields.map( ( field ) => field.id ).indexOf( payload.fieldId ) >= 0 ) {
const $carbonContainer = window.jQuery( `.container-${ container.id }` );
$carbonContainer.closest( '.widget-inside' ).trigger( 'change' );
}
};
}
addFilter( 'carbon-fields.widget.classic', 'carbon-fields/metaboxes', withEffects( aperture, { handler } ) );

View file

@ -0,0 +1,31 @@
/* ==========================================================================
Widget
========================================================================== */
.cf-container-widget {
margin-bottom: 13px;
.cf-field {
margin: 1em 0 0;
padding: 0;
border-width: 0;
}
.cf-field + .cf-field {
border-top-width: 0;
}
.cf-complex__group-body {
border-width: 1px 1px 1px 1px;
margin-top: 0;
}
.cf-complex__group-body .cf-field {
padding: 12px;
}
.cf-complex__group-body .cf-field + .cf-field {
border-width: 1px 0 0 0;
padding-top: 1em;
}
}