import React, { CSSProperties } from 'react'; import { useNode, UserComponent } from '@craftjs/core'; import { cssPropsToString } from '../../utils/style-helpers'; import { escapeHtml, escapeAttr, scopeId } from '../../utils/escape'; interface TextareaFieldProps { label?: string; name?: string; placeholder?: string; rows?: number; required?: boolean; style?: CSSProperties; animation?: string; animationDelay?: string; hideOnDesktop?: boolean; hideOnTablet?: boolean; hideOnMobile?: boolean; } export const TextareaField: UserComponent = ({ label = 'Message', name = 'message', placeholder = '', rows = 4, required = false, style = {}, }) => { const { connectors: { connect, drag }, selected, } = useNode((node) => ({ selected: node.events.selected, })); return (
{ if (ref) connect(drag(ref)); }} style={{ display: 'flex', flexDirection: 'column', gap: '4px', outline: selected ? '2px solid #3b82f6' : 'none', borderRadius: '4px', ...style, }} > {label && ( )}
`, }; };