cozy-ui 135.2.0 → 135.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,54 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["color", "className"];
1
4
  import MuiAppBar from '@material-ui/core/AppBar';
2
- export default MuiAppBar;
5
+ import PropTypes from 'prop-types';
6
+ import React from 'react';
7
+ import { makeStyles } from "cozy-ui/transpiled/react/styles";
8
+ var useStyles = makeStyles(function (theme) {
9
+ return {
10
+ colorError: {
11
+ backgroundColor: theme.palette.error.main,
12
+ color: theme.palette.error.contrastText
13
+ },
14
+ colorWarning: {
15
+ backgroundColor: theme.palette.warning.main,
16
+ color: theme.palette.warning.contrastText
17
+ },
18
+ colorInfo: {
19
+ backgroundColor: theme.palette.info.main,
20
+ color: theme.palette.info.contrastText
21
+ },
22
+ colorSuccess: {
23
+ backgroundColor: theme.palette.success.main,
24
+ color: theme.palette.success.contrastText
25
+ }
26
+ };
27
+ });
28
+ var CUSTOM_COLOR_CLASSES = {
29
+ error: 'colorError',
30
+ warning: 'colorWarning',
31
+ info: 'colorInfo',
32
+ success: 'colorSuccess'
33
+ };
34
+ var AppBar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
35
+ var color = _ref.color,
36
+ className = _ref.className,
37
+ props = _objectWithoutProperties(_ref, _excluded);
38
+
39
+ var styles = useStyles();
40
+ var appBarColor = CUSTOM_COLOR_CLASSES[color] ? 'default' : color;
41
+ var customColorClass = CUSTOM_COLOR_CLASSES[color] ? styles[CUSTOM_COLOR_CLASSES[color]] : undefined;
42
+ return /*#__PURE__*/React.createElement(MuiAppBar, _extends({}, props, {
43
+ ref: ref,
44
+ color: appBarColor,
45
+ className: "".concat(className || '', " ").concat(customColorClass || '')
46
+ }));
47
+ });
48
+ AppBar.propTypes = {
49
+ color: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'warning', 'info', 'success'])
50
+ };
51
+ AppBar.defaultProps = {
52
+ color: 'default'
53
+ };
54
+ export default AppBar;