1+ import { Badge } from '@sb/components/Badge' ;
12import type { Controls } from '@storybook/addon-docs/blocks' ;
23import { Description , Subtitle , Title , useOf } from '@storybook/addon-docs/blocks' ;
34import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js' ;
@@ -45,14 +46,25 @@ interface InfoTableProps {
4546 isChart ?: boolean ;
4647 experimental ?: boolean ;
4748 of : ComponentProps < typeof Controls > [ 'of' ] ;
49+ deprecationText ?: string ;
4850}
4951
50- export const InfoTable = ( { of, since, subComponents, mergeSubComponents } : InfoTableProps ) => {
52+ export const InfoTable = ( {
53+ of,
54+ since,
55+ subComponents,
56+ mergeSubComponents,
57+ deprecationText,
58+ isChart,
59+ } : InfoTableProps ) => {
5160 const context = useOf < 'meta' > ( of ) ;
5261 const { csfFile, preparedMeta } = context ;
62+ const { tags } = preparedMeta ;
5363 const moduleName = csfFile . meta . component . displayName ;
64+ const isDeprecated = tags . includes ( 'deprecated' ) ;
65+ const isCustom = tags . includes ( 'custom' ) || isChart ;
5466
55- const wcSubComponents = useGetSubComponentsOfModule ( moduleName . replace ( 'V2' , '' ) , preparedMeta . tags ) ;
67+ const wcSubComponents = useGetSubComponentsOfModule ( moduleName . replace ( 'V2' , '' ) , tags ) ;
5668 const subComps = mergeSubComponents
5769 ? [ ...( subComponents ?? [ ] ) , ...( wcSubComponents ?? [ ] ) ]
5870 : ( subComponents ?? wcSubComponents ) ;
@@ -68,6 +80,7 @@ export const InfoTable = ({ of, since, subComponents, mergeSubComponents }: Info
6880 await navigator . clipboard . write ( [ data ] ) ;
6981 }
7082 } ;
83+
7184 return (
7285 < table className = { classes . infoTable } >
7386 < tbody >
@@ -99,6 +112,30 @@ export const InfoTable = ({ of, since, subComponents, mergeSubComponents }: Info
99112 </ td >
100113 </ tr >
101114 ) }
115+ { isDeprecated && (
116+ < tr >
117+ < th >
118+ < Label > Deprecated</ Label >
119+ </ th >
120+ < td >
121+ < Text > { deprecationText } </ Text >
122+ </ td >
123+ </ tr >
124+ ) }
125+ { isCustom && (
126+ < tr >
127+ < th >
128+ < Label > Custom Component</ Label >
129+ </ th >
130+ < td >
131+ < Text >
132+ { isChart
133+ ? 'Charts are custom-built without defined design specifications! They use the Fiori color palette, but functionality and especially accessibility may not meet standard app requirements.'
134+ : 'This component either only partially follows design specifications or lacks them entirely. Please refer to the component description for details.' }
135+ </ Text >
136+ </ td >
137+ </ tr >
138+ ) }
102139 { ! ! subComps . length && (
103140 < tr className = { classes . hoverTr } >
104141 < th >
@@ -124,17 +161,39 @@ export const InfoTable = ({ of, since, subComponents, mergeSubComponents }: Info
124161 ) ;
125162} ;
126163
127- export const DocsHeader = ( { of, since, subComponents, mergeSubComponents, isChart, experimental } : InfoTableProps ) => {
164+ export const DocsHeader = ( {
165+ of,
166+ since,
167+ subComponents,
168+ mergeSubComponents,
169+ isChart,
170+ experimental,
171+ deprecationText,
172+ } : InfoTableProps ) => {
173+ const context = useOf < 'meta' > ( of ) ;
174+ const { preparedMeta } = context ;
175+ const { tags } = preparedMeta ;
176+ const isDeprecated = tags . includes ( 'deprecated' ) ;
177+ const isCustom = tags . includes ( 'custom' ) || isChart ;
128178 return (
129179 < ThemeProvider >
130180 < FlexBox alignItems = { FlexBoxAlignItems . Center } className = { classes . titleRow } >
131181 < Title />
132- { experimental && < Label className = { classes . experimentalLabel } > experimental</ Label > }
182+ { ! isDeprecated && experimental && < Badge type = "experimental" /> }
183+ { ! isDeprecated && isCustom && < Badge type = "custom" /> }
184+ { isDeprecated && < Badge type = "deprecated" /> }
133185 < span style = { { flexGrow : 1 } } />
134186 < Links isChart = { isChart } />
135187 </ FlexBox >
136188 < Subtitle />
137- < InfoTable of = { of } since = { since } subComponents = { subComponents } mergeSubComponents = { mergeSubComponents } />
189+ < InfoTable
190+ of = { of }
191+ since = { since }
192+ subComponents = { subComponents }
193+ mergeSubComponents = { mergeSubComponents }
194+ deprecationText = { deprecationText }
195+ isChart = { isChart }
196+ />
138197 < TableOfContent />
139198 < Description />
140199 { isChart && (
0 commit comments