import { useState, useEffect } from '@wordpress/element'; import { TextControl, Flex, FlexItem, ColorPicker, Popover, Button, ColorPalette, } from '@wordpress/components'; import { useControlSettingSet } from '../_hooks'; import { __, sprintf } from '@wordpress/i18n'; type Props = { value: string; title: string; description?: string; onChange: (value: string) => void; }; export default function ApuraText({ value, title, description, onChange, }: Props) { const [ currentValue, setCurrentValue ] = useState(value); useEffect(() => { if (currentValue !== value) { onChange(currentValue || ''); } }, [currentValue]); return (
{description &&

{description}

} setCurrentValue(value)} />
); }