11import type { Controls } from '@storybook/addon-docs/blocks' ;
2- import { Heading , useOf } from '@storybook/addon-docs/blocks' ;
2+ import { Heading , Subheading , useOf } from '@storybook/addon-docs/blocks' ;
33import TagDesign from '@ui5/webcomponents/dist/types/TagDesign.js' ;
44import { Tag , Link , MessageStrip , Popover } from '@ui5/webcomponents-react' ;
55import type * as CEM from '@ui5/webcomponents-tools/lib/cem/types' ;
@@ -48,14 +48,20 @@ function Name(props: CEM.ClassMember) {
4848 ) ;
4949}
5050
51- export function DomRefTable ( { of } : { of : ComponentProps < typeof Controls > [ 'of' ] } ) {
51+ export function DomRefTable ( {
52+ of,
53+ isSubheading,
54+ } : {
55+ of : ComponentProps < typeof Controls > [ 'of' ] ;
56+ isSubheading ?: boolean ;
57+ } ) {
5258 const { story : storyContext } = useOf < 'story' > ( of ) ;
5359 const storyTags : string [ ] = storyContext . tags ;
5460 const cemModuleName = storyTags ?. find ( ( tag ) => tag . startsWith ( 'cem-module:' ) ) ;
55- const componentName = storyContext . component . displayName ;
61+ const componentName = of ?. displayName ?? storyContext . component . displayName ;
5662 const popoverRef = useRef ( null ) ;
5763
58- const knownAttributes = new Set ( Object . keys ( storyContext . argTypes ) ) ;
64+ const knownAttributes = new Set ( Object . keys ( of ?. __docgenInfo ?. props ?? storyContext . argTypes ) ) ;
5965 const cem = useGetCem ( storyTags ) ;
6066 const moduleName = cemModuleName ? cemModuleName . split ( ':' ) [ 1 ] : componentName ;
6167
@@ -69,12 +75,13 @@ export function DomRefTable({ of }: { of: ComponentProps<typeof Controls>['of']
6975 return ! ( knownAttributes . has ( row . name ) && ! row . type ?. text ?. includes ( 'HTMLElement' ) ) ;
7076 } ) ?? [ ] ;
7177 const cssParts : CEM . CssPart [ ] = componentMembers ?. cssParts ?? [ ] ;
78+ const HeadingComponent = isSubheading ? Subheading : Heading ;
7279
7380 return (
7481 < >
7582 { rows . length > 0 ? (
7683 < >
77- < Heading > DOM Properties & Methods </ Heading >
84+ < HeadingComponent > DOM Properties & Methods </ HeadingComponent >
7885 < p >
7986 This component exposes public properties and methods. You can use them directly on the instance of the
8087 component, e.g. by using React Refs.
@@ -150,7 +157,7 @@ export function DomRefTable({ of }: { of: ComponentProps<typeof Controls>['of']
150157
151158 { cssParts . length > 0 ? (
152159 < >
153- < Heading > CSS Shadow Parts</ Heading >
160+ < HeadingComponent > CSS Shadow Parts</ HeadingComponent >
154161 < p >
155162 < Link target = { '_blank' } href = { 'https://developer.mozilla.org/en-US/docs/Web/CSS/::part' } >
156163 CSS Shadow Parts
0 commit comments