/** * EDIT: Colors */ import { memoize, times } from 'lodash'; import { default as GetClasses } from './get-classes.js'; const ColorsEdit = ( props ) => { const { InnerBlocks, InspectorControls, useBlockProps } = wp.blockEditor; const { PanelBody, ToggleControl } = wp.components; // Get attributes from props. const { setAttributes } = props; const { className, hideHex, hideRGB, hideCMYK, showCopy, search } = props.attributes; const blockProps = useBlockProps(); // Figure out what classes should be applied to the colors. const colorsClasses = GetClasses( props ); // Change event handlers. const onChangeHideHex = ( value ) => { setAttributes( { hideHex: value } ) }; const onChangeHideRGB = ( value ) => { setAttributes( { hideRGB: value } ) }; const onChangeHideCMYK = ( value ) => { setAttributes( { hideCMYK: value } ) }; const onChangeShowCopy = ( value ) => { setAttributes( { showCopy: value } ) }; const onChangeSearch = ( value ) => { setAttributes( { search: value } ) }; // Set of allowed child blocks. const allowedBlocks = [ 'tdg/color' ]; // Template for child cards. const getColorsTemplate = memoize( () => { return times( 3, () => [ 'tdg/color' ] ); } ); // Return the edit UI. return (