import React, {PropsWithChildren, SyntheticEvent} from 'react' import classnames from 'classnames' import FieldDocLabel from './FieldDocLabel' import Doc from './Doc' type BlockProps = PropsWithChildren & { "data-wd-key"?: string label?: string action?: React.ReactElement style?: object onChange?(...args: unknown[]): unknown fieldSpec?: object wideMode?: boolean error?: {message: string} }; type BlockState = { showDoc: boolean }; /** Wrap a component with a label */ export default class Block extends React.Component { _blockEl: HTMLDivElement | null = null; constructor (props: BlockProps) { super(props); this.state = { showDoc: false, } } onChange(e: React.BaseSyntheticEvent) { const value = e.target.value if (this.props.onChange) { return this.props.onChange(value === "" ? undefined : value) } } onToggleDoc = (val: boolean) => { this.setState({ showDoc: val }); } /** * Some fields for example bind click events inside the element * to close the picker. This in turn propagates to the