| 1 |
import styles from '@patternfly/react-styles/css/components/ProgressStepper/progress-stepper'; |
| 2 |
import { css } from '@patternfly/react-styles'; |
| 3 |
|
| 4 |
export interface ProgressStepperProps extends React.DetailedHTMLProps< |
| 5 |
React.OlHTMLAttributes<HTMLOListElement>, |
| 6 |
HTMLOListElement |
| 7 |
> { |
| 8 |
/** Content rendered inside the progress stepper. */ |
| 9 |
children?: React.ReactNode; |
| 10 |
/** Additional classes applied to the progress stepper container. */ |
| 11 |
className?: string; |
| 12 |
/** Flag indicating the progress stepper should be centered. */ |
| 13 |
isCenterAligned?: boolean; |
| 14 |
/** Flag indicating the progress stepper has a vertical layout. */ |
| 15 |
isVertical?: boolean; |
| 16 |
/** Flag indicating the progress stepper should be rendered compactly. */ |
| 17 |
isCompact?: boolean; |
| 18 |
/** Adds an accessible label to the progress stepper. */ |
| 19 |
'aria-label'?: string; |
| 20 |
} |
| 21 |
|
| 22 |
export const ProgressStepper: React.FunctionComponent<ProgressStepperProps> = ({ |
| 23 |
children, |
| 24 |
className, |
| 25 |
isCenterAligned, |
| 26 |
isVertical, |
| 27 |
isCompact, |
| 28 |
'aria-label': ariaLabel, |
| 29 |
...props |
| 30 |
}: ProgressStepperProps) => ( |
| 31 |
<ol |
| 32 |
className={css( |
| 33 |
styles.progressStepper, |
| 34 |
isCenterAligned && styles.modifiers.center, |
| 35 |
isVertical && styles.modifiers.vertical, |
| 36 |
isCompact && styles.modifiers.compact, |
| 37 |
className |
| 38 |
)} |
| 39 |
role="list" |
| 40 |
aria-label={ariaLabel} |
| 41 |
{...props} |
| 42 |
> |
| 43 |
{children} |
| 44 |
</ol> |
| 45 |
); |
| 46 |
ProgressStepper.displayName = 'ProgressStepper'; |