import React, { useState, useEffect } from 'react'; import { Popover, ColorPicker } from '@wordpress/components'; // AG-Grid Cell Renderer Component const LCPGridColorRender = (props) => { const [color, setColor] = useState(props.value || ''); // Get the color value from the cell data const [isPopoverVisible, setPopoverVisible] = useState(false); // To toggle the visibility of the Popover useEffect(() => { // Update color if the value from AG-Grid changes if (props.value !== color) { setColor(props.value); } }, [props.value]); // Dependency on props.value so it updates when the cell value changes // Handle the color change from the color picker const handleColorChange = (newColor) => { setColor(newColor); // Optionally, update the cell value in AG-Grid here if (props.setValue) { props.setValue(newColor); } }; return (