import React from 'react'; import { InlineCode } from '~/components/base/code'; import { LI, UL } from '~/components/base/list'; import { P } from '~/components/base/paragraph'; import { H2, H4 } from '~/components/plugins/Headings'; import { CommentTagData, DefaultPropsDefinitionData, PropData, PropsDefinitionData, TypeDeclarationData, TypePropertyData, } from '~/components/plugins/api/APIDataTypes'; import { CommentTextBlock, resolveTypeName } from '~/components/plugins/api/APISectionUtils'; export type APISectionPropsProps = { data: PropsDefinitionData[]; defaultProps: DefaultPropsDefinitionData; }; const UNKNOWN_VALUE = '...'; const extractDefaultPropValue = ( { comment, name }: PropData, defaultProps: DefaultPropsDefinitionData ): string | undefined => { const annotationDefault = comment?.tags?.filter((tag: CommentTagData) => tag.tag === 'default'); if (annotationDefault?.length) { return annotationDefault[0].text; } return defaultProps?.type?.declaration?.children?.filter( (defaultProp: TypePropertyData) => defaultProp.name === name )[0]?.defaultValue; }; const renderInheritedProp = (ip: TypeDeclarationData) => { const component = ip?.typeArguments ? ip.typeArguments[0]?.queryType?.name : null; return component ? (
Type: