import React, { PropsWithChildren, ReactElement } from 'react' import FieldDocLabel from './FieldDocLabel' import Doc from './Doc' import generateUniqueId from '../libs/document-uid'; type FieldsetProps = PropsWithChildren & { label?: string, fieldSpec?: { doc?: string }, action?: ReactElement, }; type FieldsetState = { showDoc: boolean }; export default class Fieldset extends React.Component { _labelId: string; constructor (props: FieldsetProps) { super(props); this._labelId = generateUniqueId(`fieldset_label_`); this.state = { showDoc: false, } } onToggleDoc = (val: boolean) => { this.setState({ showDoc: val }); } render () { return
{this.props.fieldSpec &&
} {!this.props.fieldSpec &&
{this.props.label}
}
{this.props.action}
{this.props.children}
{this.props.fieldSpec &&
}
} }