UNPKG

3.54 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';
8export const styles = theme => ({
9 /* Styles applied to the root element. */
10 root: {
11 display: 'flex',
12 alignSelf: 'baseline',
13 borderStyle: 'solid',
14 borderWidth: 2,
15 padding: 4,
16 borderRadius: '50%',
17 boxShadow: theme.shadows[2],
18 marginTop: 8,
19 marginBottom: 8
20 },
21
22 /* Styles applied to the root element if `color="grey"` and `variant="default"`. */
23 defaultGrey: {
24 borderColor: 'transparent',
25 color: theme.palette.grey[50],
26 backgroundColor: theme.palette.grey[400]
27 },
28
29 /* Styles applied to the root element if `color="grey"` and `variant="outlined"`. */
30 outlinedGrey: {
31 boxShadow: 'none',
32 color: theme.palette.grey.contrastText,
33 borderColor: theme.palette.grey[400],
34 backgroundColor: 'transparent'
35 },
36
37 /* Styles applied to the root element if `color="primary"` and `variant="default"`. */
38 defaultPrimary: {
39 borderColor: 'transparent',
40 color: theme.palette.primary.contrastText,
41 backgroundColor: theme.palette.primary.main
42 },
43
44 /* Styles applied to the root element if `color="primary"` and `variant="outlined"`. */
45 outlinedPrimary: {
46 boxShadow: 'none',
47 backgroundColor: 'transparent',
48 borderColor: theme.palette.primary.main
49 },
50
51 /* Styles applied to the root element if `color="secondary"` and `variant="default"`. */
52 defaultSecondary: {
53 borderColor: 'transparent',
54 color: theme.palette.secondary.contrastText,
55 backgroundColor: theme.palette.secondary.main
56 },
57
58 /* Styles applied to the root element if `color="secondary"` and `variant="outlined"`. */
59 outlinedSecondary: {
60 boxShadow: 'none',
61 backgroundColor: 'transparent',
62 borderColor: theme.palette.secondary.main
63 }
64});
65const TimelineDot = /*#__PURE__*/React.forwardRef(function TimelineDot(props, ref) {
66 const {
67 classes,
68 className,
69 color = 'grey',
70 variant = 'default'
71 } = props,
72 other = _objectWithoutPropertiesLoose(props, ["classes", "className", "color", "variant"]);
73
74 return /*#__PURE__*/React.createElement("span", _extends({
75 className: clsx(classes.root, className, color !== 'inherit' && classes[`${variant}${capitalize(color)}`]),
76 ref: ref
77 }, other));
78});
79process.env.NODE_ENV !== "production" ? TimelineDot.propTypes = {
80 // ----------------------------- Warning --------------------------------
81 // | These PropTypes are generated from the TypeScript type definitions |
82 // | To update them edit the d.ts file and run "yarn proptypes" |
83 // ----------------------------------------------------------------------
84
85 /**
86 * The content of the component.
87 */
88 children: PropTypes.node,
89
90 /**
91 * Override or extend the styles applied to the component.
92 * See [CSS API](#css) below for more details.
93 */
94 classes: PropTypes.object,
95
96 /**
97 * @ignore
98 */
99 className: PropTypes.string,
100
101 /**
102 * The dot can have a different colors.
103 */
104 color: PropTypes.oneOf(['grey', 'inherit', 'primary', 'secondary']),
105
106 /**
107 * The dot can appear filled or outlined.
108 */
109 variant: PropTypes.oneOf(['default', 'outlined'])
110} : void 0;
111export default withStyles(styles, {
112 name: 'MuiTimelineDot'
113})(TimelineDot);
\No newline at end of file