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