// Steps — numbered vertical list for tutorials / install guides. // Renders children as a column with a connecting line on the left // and an auto-incrementing badge for each direct child. // // Usage: // // // // // // … // // import { Children, isValidElement, type ReactNode } from 'react' import { cn } from '../cn' interface StepsProps { readonly children: ReactNode readonly className?: string } interface StepProps { readonly title?: ReactNode readonly children: ReactNode readonly className?: string } export const Steps = ({ children, className }: StepsProps): ReactNode => { // Inject 1-based index into each via a positional prop. We // could clone with React.cloneElement, but a CSS counter is simpler // + survives Suspense boundaries. const items = Children.toArray(children).filter(isValidElement) return (
    {items.map((child, i) => (
  1. {i + 1}
    {child}
  2. ))}
) } export const Step = ({ title, children, className }: StepProps): ReactNode => (
{title ?

{title}

: null}
{children}
)