UNPKG

2.23 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import { capitalize } from '@material-ui/core/utils';
7import { withStyles } from '@material-ui/core/styles';
8import TimelineContext from './TimelineContext';
9export const styles = () => ({
10 /* Styles applied to the root element. */
11 root: {
12 display: 'flex',
13 flexDirection: 'column',
14 padding: '6px 16px',
15 flexGrow: 1
16 },
17
18 /* Styles applied to the root element if `align="left"`. */
19 alignLeft: {},
20
21 /* Styles applied to the root element if `align="right"`. */
22 alignRight: {},
23
24 /* Styles applied to the root element if `align="alternate"`. */
25 alignAlternate: {}
26});
27const Timeline = /*#__PURE__*/React.forwardRef(function Timeline(props, ref) {
28 const {
29 align = 'left',
30 classes,
31 className
32 } = props,
33 other = _objectWithoutPropertiesLoose(props, ["align", "classes", "className"]);
34
35 return /*#__PURE__*/React.createElement(TimelineContext.Provider, {
36 value: {
37 align
38 }
39 }, /*#__PURE__*/React.createElement("ul", _extends({
40 className: clsx(classes.root, classes[`align${capitalize(align)}`], className),
41 ref: ref
42 }, other)));
43});
44process.env.NODE_ENV !== "production" ? Timeline.propTypes = {
45 // ----------------------------- Warning --------------------------------
46 // | These PropTypes are generated from the TypeScript type definitions |
47 // | To update them edit the d.ts file and run "yarn proptypes" |
48 // ----------------------------------------------------------------------
49
50 /**
51 * The position where the timeline's content should appear.
52 */
53 align: PropTypes.oneOf(['alternate', 'left', 'right']),
54
55 /**
56 * The content of the component.
57 */
58 children: PropTypes.node,
59
60 /**
61 * Override or extend the styles applied to the component.
62 * See [CSS API](#css) below for more details.
63 */
64 classes: PropTypes.object,
65
66 /**
67 * @ignore
68 */
69 className: PropTypes.string
70} : void 0;
71export default withStyles(styles, {
72 name: 'MuiTimeline'
73})(Timeline);
\No newline at end of file