1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import RadioButtonUncheckedIcon from "../internal/svg-icons/RadioButtonUnchecked.js";
|
6 | import RadioButtonCheckedIcon from "../internal/svg-icons/RadioButtonChecked.js";
|
7 | import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
|
8 | import { styled } from "../zero-styled/index.js";
|
9 | import memoTheme from "../utils/memoTheme.js";
|
10 | import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11 | const RadioButtonIconRoot = styled('span', {
|
12 | shouldForwardProp: rootShouldForwardProp
|
13 | })({
|
14 | position: 'relative',
|
15 | display: 'flex'
|
16 | });
|
17 | const RadioButtonIconBackground = styled(RadioButtonUncheckedIcon)({
|
18 |
|
19 | transform: 'scale(1)'
|
20 | });
|
21 | const RadioButtonIconDot = styled(RadioButtonCheckedIcon)(memoTheme(({
|
22 | theme
|
23 | }) => ({
|
24 | left: 0,
|
25 | position: 'absolute',
|
26 | transform: 'scale(0)',
|
27 | transition: theme.transitions.create('transform', {
|
28 | easing: theme.transitions.easing.easeIn,
|
29 | duration: theme.transitions.duration.shortest
|
30 | }),
|
31 | variants: [{
|
32 | props: {
|
33 | checked: true
|
34 | },
|
35 | style: {
|
36 | transform: 'scale(1)',
|
37 | transition: theme.transitions.create('transform', {
|
38 | easing: theme.transitions.easing.easeOut,
|
39 | duration: theme.transitions.duration.shortest
|
40 | })
|
41 | }
|
42 | }]
|
43 | })));
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | function RadioButtonIcon(props) {
|
49 | const {
|
50 | checked = false,
|
51 | classes = {},
|
52 | fontSize
|
53 | } = props;
|
54 | const ownerState = {
|
55 | ...props,
|
56 | checked
|
57 | };
|
58 | return _jsxs(RadioButtonIconRoot, {
|
59 | className: classes.root,
|
60 | ownerState: ownerState,
|
61 | children: [_jsx(RadioButtonIconBackground, {
|
62 | fontSize: fontSize,
|
63 | className: classes.background,
|
64 | ownerState: ownerState
|
65 | }), _jsx(RadioButtonIconDot, {
|
66 | fontSize: fontSize,
|
67 | className: classes.dot,
|
68 | ownerState: ownerState
|
69 | })]
|
70 | });
|
71 | }
|
72 | process.env.NODE_ENV !== "production" ? RadioButtonIcon.propTypes = {
|
73 | |
74 |
|
75 |
|
76 | checked: PropTypes.bool,
|
77 | |
78 |
|
79 |
|
80 | classes: PropTypes.object,
|
81 | |
82 |
|
83 |
|
84 |
|
85 | fontSize: PropTypes.oneOf(['small', 'medium'])
|
86 | } : void 0;
|
87 | export default RadioButtonIcon; |
\ | No newline at end of file |