🔀 Merge branch 'trunk'

# Conflicts:
#	modules/ppcp-settings/resources/js/Components/ReusableComponents/SelectBox.js
This commit is contained in:
Philipp Stracker 2025-01-23 16:12:52 +01:00
commit 09ca3d0871
No known key found for this signature in database
24 changed files with 345 additions and 176 deletions

View file

@ -46,8 +46,31 @@ const SelectableContent = ( {
);
};
const handleClick = () => {
if ( type === 'checkbox' ) {
let newValue;
if ( Array.isArray( currentValue ) ) {
if ( currentValue.includes( value ) ) {
newValue = currentValue.filter(
( optionValue ) => optionValue !== value
);
} else {
newValue = [ ...currentValue, value ];
}
} else {
newValue = ! currentValue;
}
changeCallback( newValue );
}
};
return (
<div className={ boxClassName }>
<div
className={ boxClassName }
onClick={ type === 'checkbox' ? handleClick : undefined }
>
<InputField isRadio={ type === 'radio' } />
<div className="ppcp-r-select-box__content">