import React, { useId } from 'react' import { ComboboxTree as UIKitComboboxTree } from '@planview/pv-uikit' import type { ComboboxTreeProps as UIKitComboboxTreeProps } from '@planview/pv-uikit' import Field from '../field' type ComboboxTreePropsSingle = Omit< Extract, 'error' | 'label' | 'warning' > type ComboboxTreePropsMulti = Omit< Extract, 'error' | 'label' | 'warning' > type ComboboxTreeProps = (ComboboxTreePropsSingle | ComboboxTreePropsMulti) & Pick< React.ComponentPropsWithRef, 'label' | 'error' | 'withAsterisk' | 'labelPosition' | 'warning' > & { id?: string } /** * Implementation combines [Form Field specification](https://design.planview.com/components/forms/form-field) * with [ComboboxTree specification](https://design.planview.com/components/forms/combobox-tree). * * `import { ComboboxTree } from '@planview/pv-form'` * */ export const ComboboxTree = ({ labelPosition, label, error, warning, withAsterisk, id: incomingId, inputProps, ...rest }: ComboboxTreeProps) => { const internalId = `pv-form-${useId()}` const id = incomingId ?? internalId const isFieldRequired = !!( withAsterisk ?? (typeof label !== 'string' && (label?.required ?? label?.requiredTooltip)) ) return ( {(fieldProps) => ( )} ) }