1 | import * as React from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import clsx from 'clsx';
|
4 | import RadioButtonUncheckedIcon from '../internal/svg-icons/RadioButtonUnchecked';
|
5 | import RadioButtonCheckedIcon from '../internal/svg-icons/RadioButtonChecked';
|
6 | import withStyles from '../styles/withStyles';
|
7 | export const styles = theme => ({
|
8 | root: {
|
9 | position: 'relative',
|
10 | display: 'flex',
|
11 | '&$checked $layer': {
|
12 | transform: 'scale(1)',
|
13 | transition: theme.transitions.create('transform', {
|
14 | easing: theme.transitions.easing.easeOut,
|
15 | duration: theme.transitions.duration.shortest
|
16 | })
|
17 | }
|
18 | },
|
19 | layer: {
|
20 | left: 0,
|
21 | position: 'absolute',
|
22 | transform: 'scale(0)',
|
23 | transition: theme.transitions.create('transform', {
|
24 | easing: theme.transitions.easing.easeIn,
|
25 | duration: theme.transitions.duration.shortest
|
26 | })
|
27 | },
|
28 | checked: {}
|
29 | });
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | function RadioButtonIcon(props) {
|
35 | const {
|
36 | checked,
|
37 | classes,
|
38 | fontSize
|
39 | } = props;
|
40 | return React.createElement("div", {
|
41 | className: clsx(classes.root, checked && classes.checked)
|
42 | }, React.createElement(RadioButtonUncheckedIcon, {
|
43 | fontSize: fontSize
|
44 | }), React.createElement(RadioButtonCheckedIcon, {
|
45 | fontSize: fontSize,
|
46 | className: classes.layer
|
47 | }));
|
48 | }
|
49 |
|
50 | process.env.NODE_ENV !== "production" ? RadioButtonIcon.propTypes = {
|
51 | |
52 |
|
53 |
|
54 | checked: PropTypes.bool,
|
55 |
|
56 | |
57 |
|
58 |
|
59 |
|
60 | classes: PropTypes.object.isRequired,
|
61 |
|
62 | |
63 |
|
64 |
|
65 |
|
66 | fontSize: PropTypes.oneOf(['small', 'medium'])
|
67 | } : void 0;
|
68 | export default withStyles(styles, {
|
69 | name: 'PrivateRadioButtonIcon'
|
70 | })(RadioButtonIcon); |
\ | No newline at end of file |