1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = exports.styles = void 0;
|
11 |
|
12 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13 |
|
14 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
15 |
|
16 | var React = _interopRequireWildcard(require("react"));
|
17 |
|
18 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
19 |
|
20 | var _clsx = _interopRequireDefault(require("clsx"));
|
21 |
|
22 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
23 |
|
24 | var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
|
25 |
|
26 | var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
27 |
|
28 | var styles = function styles(theme) {
|
29 | return {
|
30 |
|
31 | root: (0, _extends2.default)({}, theme.typography.button, {
|
32 | boxSizing: 'border-box',
|
33 | minHeight: 36,
|
34 | transition: theme.transitions.create(['background-color', 'box-shadow', 'border'], {
|
35 | duration: theme.transitions.duration.short
|
36 | }),
|
37 | borderRadius: '50%',
|
38 | padding: 0,
|
39 | minWidth: 0,
|
40 | width: 56,
|
41 | height: 56,
|
42 | boxShadow: theme.shadows[6],
|
43 | '&:active': {
|
44 | boxShadow: theme.shadows[12]
|
45 | },
|
46 | color: theme.palette.getContrastText(theme.palette.grey[300]),
|
47 | backgroundColor: theme.palette.grey[300],
|
48 | '&:hover': {
|
49 | backgroundColor: theme.palette.grey.A100,
|
50 |
|
51 | '@media (hover: none)': {
|
52 | backgroundColor: theme.palette.grey[300]
|
53 | },
|
54 | '&$disabled': {
|
55 | backgroundColor: theme.palette.action.disabledBackground
|
56 | },
|
57 | textDecoration: 'none'
|
58 | },
|
59 | '&$focusVisible': {
|
60 | boxShadow: theme.shadows[6]
|
61 | },
|
62 | '&$disabled': {
|
63 | color: theme.palette.action.disabled,
|
64 | boxShadow: theme.shadows[0],
|
65 | backgroundColor: theme.palette.action.disabledBackground
|
66 | }
|
67 | }),
|
68 |
|
69 |
|
70 | label: {
|
71 | width: '100%',
|
72 |
|
73 | display: 'inherit',
|
74 | alignItems: 'inherit',
|
75 | justifyContent: 'inherit'
|
76 | },
|
77 |
|
78 |
|
79 | primary: {
|
80 | color: theme.palette.primary.contrastText,
|
81 | backgroundColor: theme.palette.primary.main,
|
82 | '&:hover': {
|
83 | backgroundColor: theme.palette.primary.dark,
|
84 |
|
85 | '@media (hover: none)': {
|
86 | backgroundColor: theme.palette.primary.main
|
87 | }
|
88 | }
|
89 | },
|
90 |
|
91 |
|
92 | secondary: {
|
93 | color: theme.palette.secondary.contrastText,
|
94 | backgroundColor: theme.palette.secondary.main,
|
95 | '&:hover': {
|
96 | backgroundColor: theme.palette.secondary.dark,
|
97 |
|
98 | '@media (hover: none)': {
|
99 | backgroundColor: theme.palette.secondary.main
|
100 | }
|
101 | }
|
102 | },
|
103 |
|
104 |
|
105 | extended: {
|
106 | borderRadius: 48 / 2,
|
107 | padding: '0 16px',
|
108 | width: 'auto',
|
109 | minHeight: 'auto',
|
110 | minWidth: 48,
|
111 | height: 48,
|
112 | '&$sizeSmall': {
|
113 | width: 'auto',
|
114 | padding: '0 8px',
|
115 | borderRadius: 34 / 2,
|
116 | minWidth: 34,
|
117 | height: 34
|
118 | },
|
119 | '&$sizeMedium': {
|
120 | width: 'auto',
|
121 | padding: '0 16px',
|
122 | borderRadius: 40 / 2,
|
123 | minWidth: 40,
|
124 | height: 40
|
125 | }
|
126 | },
|
127 |
|
128 |
|
129 | focusVisible: {},
|
130 |
|
131 |
|
132 | disabled: {},
|
133 |
|
134 |
|
135 | colorInherit: {
|
136 | color: 'inherit'
|
137 | },
|
138 |
|
139 |
|
140 | sizeSmall: {
|
141 | width: 40,
|
142 | height: 40
|
143 | },
|
144 |
|
145 |
|
146 | sizeMedium: {
|
147 | width: 48,
|
148 | height: 48
|
149 | }
|
150 | };
|
151 | };
|
152 |
|
153 | exports.styles = styles;
|
154 | var Fab = React.forwardRef(function Fab(props, ref) {
|
155 | var children = props.children,
|
156 | classes = props.classes,
|
157 | className = props.className,
|
158 | _props$color = props.color,
|
159 | color = _props$color === void 0 ? 'default' : _props$color,
|
160 | _props$component = props.component,
|
161 | component = _props$component === void 0 ? 'button' : _props$component,
|
162 | _props$disabled = props.disabled,
|
163 | disabled = _props$disabled === void 0 ? false : _props$disabled,
|
164 | _props$disableFocusRi = props.disableFocusRipple,
|
165 | disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,
|
166 | focusVisibleClassName = props.focusVisibleClassName,
|
167 | _props$size = props.size,
|
168 | size = _props$size === void 0 ? 'large' : _props$size,
|
169 | _props$variant = props.variant,
|
170 | variant = _props$variant === void 0 ? 'round' : _props$variant,
|
171 | other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "color", "component", "disabled", "disableFocusRipple", "focusVisibleClassName", "size", "variant"]);
|
172 | return React.createElement(_ButtonBase.default, (0, _extends2.default)({
|
173 | className: (0, _clsx.default)(classes.root, className, variant !== "round" && classes.extended, size !== 'large' && classes["size".concat((0, _capitalize.default)(size))], disabled && classes.disabled, {
|
174 | 'primary': classes.primary,
|
175 | 'secondary': classes.secondary,
|
176 | 'inherit': classes.colorInherit
|
177 | }[color]),
|
178 | component: component,
|
179 | disabled: disabled,
|
180 | focusRipple: !disableFocusRipple,
|
181 | focusVisibleClassName: (0, _clsx.default)(classes.focusVisible, focusVisibleClassName),
|
182 | ref: ref
|
183 | }, other), React.createElement("span", {
|
184 | className: classes.label
|
185 | }, children));
|
186 | });
|
187 | process.env.NODE_ENV !== "production" ? Fab.propTypes = {
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 | |
194 |
|
195 |
|
196 | children: _propTypes.default
|
197 |
|
198 | .node.isRequired,
|
199 |
|
200 | |
201 |
|
202 |
|
203 |
|
204 | classes: _propTypes.default.object,
|
205 |
|
206 | |
207 |
|
208 |
|
209 | className: _propTypes.default.string,
|
210 |
|
211 | |
212 |
|
213 |
|
214 | color: _propTypes.default.oneOf(['default', 'inherit', 'primary', 'secondary']),
|
215 |
|
216 | |
217 |
|
218 |
|
219 |
|
220 | component: _propTypes.default
|
221 |
|
222 | .elementType,
|
223 |
|
224 | |
225 |
|
226 |
|
227 | disabled: _propTypes.default.bool,
|
228 |
|
229 | |
230 |
|
231 |
|
232 | disableFocusRipple: _propTypes.default.bool,
|
233 |
|
234 | |
235 |
|
236 |
|
237 | disableRipple: _propTypes.default.bool,
|
238 |
|
239 | |
240 |
|
241 |
|
242 | focusVisibleClassName: _propTypes.default.string,
|
243 |
|
244 | |
245 |
|
246 |
|
247 |
|
248 | href: _propTypes.default.string,
|
249 |
|
250 | |
251 |
|
252 |
|
253 |
|
254 | size: _propTypes.default.oneOf(['large', 'medium', 'small']),
|
255 |
|
256 | |
257 |
|
258 |
|
259 | variant: _propTypes.default.oneOf(['extended', 'round'])
|
260 | } : void 0;
|
261 |
|
262 | var _default = (0, _withStyles.default)(styles, {
|
263 | name: 'MuiFab'
|
264 | })(Fab);
|
265 |
|
266 | exports.default = _default; |
\ | No newline at end of file |