Sha256: 899f34dac7c4aaa87aea3d47a91fcfb70ac6bfd032f534376b40d972df88732e

Contents?: true

Size: 1.59 KB

Versions: 122

Compression:

Stored size: 1.59 KB

Contents

import React from 'react'
import classnames from 'classnames'

import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
import { GlobalProps, globalProps } from '../utilities/globalProps'

import TimelineItem from './_item'
import {
  TimelineStep,
  TimelineLabel,
  TimelineDetail,
} from './subcomponents'

type TimelineProps = {
  aria?: { [key: string]: string },
  children?: React.ReactChild[] | React.ReactChild,
  className?: string,
  data?: { [key: string]: string },
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  orientation?: string,
  showDate?: boolean,
  gap?: 'xs' | 'sm' | 'md' | 'lg' | 'none',
} & GlobalProps

const Timeline = ({
  aria = {},
  className,
  children,
  data = {},
  htmlOptions = {},
  id,
  orientation = 'horizontal',
  showDate = false,
  gap = 'none',
  ...props
}: TimelineProps): React.ReactElement => {
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const htmlProps = buildHtmlProps(htmlOptions)
  const dateStyle = showDate === true ? '_with_date' : ''
  const gapStyle = gap === 'none' ? '' : `gap_${gap}`
  const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle, gapStyle)

  return (
    <div
        {...ariaProps}
        {...dataProps}
        {...htmlProps}
        className={classnames(timelineCss, globalProps(props), className)}
        id={id}
    >
      {children}
    </div>
  )
}

Timeline.Item = TimelineItem
Timeline.Step = TimelineStep
Timeline.Label = TimelineLabel
Timeline.Detail = TimelineDetail

export default Timeline

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
playbook_ui-14.10.0.pre.rc.19 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.10.0.pre.rc.18 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PLAY1660reactdropzone5020 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.10.0.pre.rc.17 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.10.0.pre.rc.16 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.play17004992 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment4991 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.10.0.pre.rc.15 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PLAY16264952 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PLAY1731inputmasking4927 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4926 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4925 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.10.0.pre.rc.14 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.10.0.pre.rc.13 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4903 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4901 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4898 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4891 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.PLAY1731inputmasking4890 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment4889 app/pb_kits/playbook/pb_timeline/_timeline.tsx