// @flow strict import * as React from 'react'; import {classify} from '../../utils/classify'; import css from './Timeline.module.css'; export const ORIENTATION = Object.freeze({ left: 'left', right: 'right', }); type ClassNames = $ReadOnly<{wrapper?: string}>; export type Orientation = $Values; export type TimelineProps = { children: React.Node, classNames?: ClassNames, orientation?: Orientation, }; const Timeline_ = ( {classNames, orientation = ORIENTATION.left, children}: TimelineProps, ref, ): React.Node => { const childrenArray = React.Children.toArray(children).filter(Boolean); const timelineItems = childrenArray.map((timelineItem) => React.cloneElement(timelineItem, { ...timelineItem.props, orientation, }), ); return (
{timelineItems}
); }; export const Timeline = (React.forwardRef( Timeline_, ): React$AbstractComponent);