Sha256: c8ddcab0463280560853f5c155c0f058230d73223b5f39f3b87e39fe26f07e5e

Contents?: true

Size: 1.47 KB

Versions: 26

Compression:

Stored size: 1.47 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,
} & GlobalProps

const Timeline = ({
  aria = {},
  className,
  children,
  data = {},
  htmlOptions = {},
  id,
  orientation = 'horizontal',
  showDate = false,
  ...props
}: TimelineProps): React.ReactElement => {
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const htmlProps = buildHtmlProps(htmlOptions)
  const dateStyle = showDate === true ? '_with_date' : ''
  const timelineCss = buildCss('pb_timeline_kit', `_${orientation}`, dateStyle)
  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

26 entries across 26 versions & 1 rubygems

Version Path
playbook_ui-14.8.0.pre.rc.4 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.8.0.pre.rc.3 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.alpha.PBNTR637quickpickdefaultdate4492 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.8.0.pre.rc.2 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.alpha.spacingquickchange4482 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.alpha.PBNTR637quickpickdefaultdate4478 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.alpha.PBNTR667railstypeaheadformintegration4454 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.8.0.pre.rc.1 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.8.0.pre.rc.0 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.6.2.pre.alpha.PLAY1613darkdatetimecolors4432 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.rc.19 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.rc.18 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.6.2.pre.alpha.PBNTR667railstypeaheadformintegration4424 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.rc.17 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.rc.16 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.rc.15 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.rc.14 app/pb_kits/playbook/pb_timeline/_timeline.tsx
playbook_ui-14.7.0.pre.rc.13 app/pb_kits/playbook/pb_timeline/_timeline.tsx