1 | import { createElement } from 'react';
|
2 | import { bool } from 'prop-types';
|
3 | import clsx from 'clsx';
|
4 | import _extends from '@babel/runtime/helpers/esm/extends';
|
5 | import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
6 | import Typography from '@material-ui/core/Typography';
|
7 | import { makeStyles } from '@material-ui/core/styles';
|
8 | import IconButton from '@material-ui/core/IconButton';
|
9 |
|
10 | var useStyles = makeStyles(function (theme) {
|
11 | return {
|
12 | day: {
|
13 | width: 36,
|
14 | height: 36,
|
15 | fontSize: theme.typography.caption.fontSize,
|
16 | margin: '0 2px',
|
17 | color: theme.palette.text.primary,
|
18 | fontWeight: theme.typography.fontWeightMedium,
|
19 | padding: 0
|
20 | },
|
21 | hidden: {
|
22 | opacity: 0,
|
23 | pointerEvents: 'none'
|
24 | },
|
25 | current: {
|
26 | color: theme.palette.primary.main,
|
27 | fontWeight: 600
|
28 | },
|
29 | daySelected: {
|
30 | color: theme.palette.primary.contrastText,
|
31 | backgroundColor: theme.palette.primary.main,
|
32 | fontWeight: theme.typography.fontWeightMedium,
|
33 | '&:hover': {
|
34 | backgroundColor: theme.palette.primary.main
|
35 | }
|
36 | },
|
37 | dayDisabled: {
|
38 | pointerEvents: 'none',
|
39 | color: theme.palette.text.hint
|
40 | }
|
41 | };
|
42 | }, {
|
43 | name: 'MuiPickersDay'
|
44 | });
|
45 | var Day = function Day(_ref) {
|
46 | var children = _ref.children,
|
47 | disabled = _ref.disabled,
|
48 | hidden = _ref.hidden,
|
49 | current = _ref.current,
|
50 | selected = _ref.selected,
|
51 | other = _objectWithoutProperties(_ref, ["children", "disabled", "hidden", "current", "selected"]);
|
52 |
|
53 | var classes = useStyles();
|
54 | var className = clsx(classes.day, hidden && classes.hidden, current && classes.current, selected && classes.daySelected, disabled && classes.dayDisabled);
|
55 | return createElement(IconButton, _extends({
|
56 | className: className,
|
57 | tabIndex: hidden || disabled ? -1 : 0
|
58 | }, other), createElement(Typography, {
|
59 | variant: "body2",
|
60 | color: "inherit"
|
61 | }, children));
|
62 | };
|
63 | Day.displayName = 'Day';
|
64 | process.env.NODE_ENV !== "production" ? Day.propTypes = {
|
65 | current: bool,
|
66 | disabled: bool,
|
67 | hidden: bool,
|
68 | selected: bool
|
69 | } : void 0;
|
70 | Day.defaultProps = {
|
71 | disabled: false,
|
72 | hidden: false,
|
73 | current: false,
|
74 | selected: false
|
75 | };
|
76 |
|
77 | export default Day;
|
78 | export { Day, useStyles };
|
79 |
|