11import { css } from '@patternfly/react-styles' ;
22import styles from '@patternfly/react-styles/css/components/DescriptionList/description-list' ;
3- import { formatBreakpointMods } from '../../helpers' ;
3+ import { formatBreakpointMods , useOUIAProps , OUIAProps } from '../../helpers' ;
44import cssGridTemplateColumnsMin from '@patternfly/react-tokens/dist/esm/c_description_list_GridTemplateColumns_min' ;
55import cssTermWidth from '@patternfly/react-tokens/dist/esm/c_description_list__term_width' ;
66import cssHorizontalTermWidth from '@patternfly/react-tokens/dist/esm/c_description_list_m_horizontal__term_width' ;
@@ -13,7 +13,7 @@ export interface BreakpointModifiers {
1313 '2xl' ?: string ;
1414}
1515
16- export interface DescriptionListProps extends Omit < React . HTMLProps < HTMLDListElement > , 'type' > {
16+ export interface DescriptionListProps extends Omit < React . HTMLProps < HTMLDListElement > , 'type' > , OUIAProps {
1717 /** Anything that can be rendered inside of the list */
1818 children ?: React . ReactNode ;
1919 /** Additional classes added to the list */
@@ -71,6 +71,10 @@ export interface DescriptionListProps extends Omit<React.HTMLProps<HTMLDListElem
7171 xl ?: string ;
7272 '2xl' ?: string ;
7373 } ;
74+ /** Value to overwrite the randomly generated data-ouia-component-id.*/
75+ ouiaId ?: number | string ;
76+ /** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
77+ ouiaSafe ?: boolean ;
7478}
7579
7680const setBreakpointModifiers = ( prefix : string , modifiers : BreakpointModifiers ) => {
@@ -99,8 +103,11 @@ export const DescriptionList: React.FunctionComponent<DescriptionListProps> = ({
99103 horizontalTermWidthModifier,
100104 orientation,
101105 style,
106+ ouiaId,
107+ ouiaSafe = true ,
102108 ...props
103109} : DescriptionListProps ) => {
110+ const ouiaProps = useOUIAProps ( DescriptionList . displayName , ouiaId , ouiaSafe ) ;
104111 if ( isAutoFit && autoFitMinModifier ) {
105112 style = {
106113 ...style ,
@@ -139,6 +146,7 @@ export const DescriptionList: React.FunctionComponent<DescriptionListProps> = ({
139146 ) }
140147 style = { style }
141148 { ...props }
149+ { ...ouiaProps }
142150 >
143151 { children }
144152 </ dl >
0 commit comments