import React, { useEffect, useState } from 'react'; import { TextareaControl } from "../ui/textarea-control"; import { Controller, useFormContext } from 'react-hook-form'; // - the first call site off WordPress's ToggleControl and onto the ui/* adapter. The JSX below // is unchanged apart from dropping `__nextHasNoMarginBottom`, which is meaningless outside WordPress. import { ToggleControl } from '../ui/toggle-control'; import { Card, CardBody, CardHeader } from '../ui/wp-card'; import { Elevation } from '../ui/elevation'; import { Heading } from '../ui/heading'; import { Spacer } from '../ui/spacer'; import { FhirCodeableConcept, FhirValueSetSearch } from '../index.ts'; import { IValueSet, useValueSetServiceContext } from '../../services'; interface FhirBodyStructureProps { elevated?: boolean; disabled?: boolean; enableInlineActions?: boolean; } export const FhirBodyStructure: React.FC = ({ elevated = true, disabled = false }) => { const { control } = useFormContext(); const { fetchValueSet, valueSetUrls } = useValueSetServiceContext(); const [loading, setLoading] = useState(false); // value sets const [bodystructureRelativeLocation, setBodystructureRelativeLocation] = useState([]); const spacerMargin = '24px'; useEffect(() => { const loadValueSets = async () => { setLoading(true); try { const [ bodystructureRelativeLocationValueSet ] = await Promise.all([ fetchValueSet(valueSetUrls.bodystructureRelativeLocation), ]); setBodystructureRelativeLocation(bodystructureRelativeLocationValueSet); } catch (err) { console.error('Error loading value sets:', err); } finally { setLoading(false); } }; loadValueSets(); }, [fetchValueSet, valueSetUrls]); return ( {elevated && } Details {/* description */} ( )}/> {/* active */} ( )}/> {/* morphology */} {/* location */} {/* locationQualifier */} ); }; export default FhirBodyStructure;