cozy-ui 57.9.2 → 57.10.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [57.10.0](https://github.com/cozy/cozy-ui/compare/v57.9.2...v57.10.0) (2021-11-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Forward remaining props to AppIcon ([ed86adf](https://github.com/cozy/cozy-ui/commit/ed86adf))
|
|
7
|
+
|
|
1
8
|
## [57.9.2](https://github.com/cozy/cozy-ui/compare/v57.9.1...v57.9.2) (2021-11-23)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import { useCozyTheme } from 'cozy-ui/transpiled/react/CozyTheme'
|
|
|
10
10
|
import cloudWallpaper from '../../docs/cloud-wallpaper.jpg'
|
|
11
11
|
|
|
12
12
|
const theme = useCozyTheme()
|
|
13
|
+
const app = { name: "Test App", slug: "testapp", type: "app" }
|
|
13
14
|
|
|
14
15
|
;
|
|
15
16
|
|
|
@@ -17,13 +18,13 @@ const theme = useCozyTheme()
|
|
|
17
18
|
<Grid container spacing={1} style={{ background: `center / cover no-repeat url(${cloudWallpaper})` }}
|
|
18
19
|
>
|
|
19
20
|
<Grid item>
|
|
20
|
-
<SquareAppIcon app=
|
|
21
|
+
<SquareAppIcon app={app} name="Normal" />
|
|
21
22
|
</Grid>
|
|
22
23
|
<Grid item>
|
|
23
|
-
<SquareAppIcon app=
|
|
24
|
+
<SquareAppIcon app={app} name="Maintenance" variant="maintenance" />
|
|
24
25
|
</Grid>
|
|
25
26
|
<Grid item>
|
|
26
|
-
<SquareAppIcon app=
|
|
27
|
+
<SquareAppIcon app={app} name="Error" variant="error" />
|
|
27
28
|
</Grid>
|
|
28
29
|
<Grid item>
|
|
29
30
|
<SquareAppIcon name="Add" variant="add" />
|
|
@@ -2,13 +2,13 @@ import React from 'react'
|
|
|
2
2
|
import cx from 'classnames'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import { makeStyles } from '@material-ui/styles'
|
|
5
|
+
import get from 'lodash/get'
|
|
5
6
|
|
|
6
7
|
import AppIcon from '../AppIcon'
|
|
7
8
|
import Badge from '../Badge'
|
|
8
9
|
import InfosBadge from '../InfosBadge'
|
|
9
10
|
import { nameToColor } from '../Avatar'
|
|
10
11
|
import Typography from '../Typography'
|
|
11
|
-
import { AppDoctype } from '../proptypes'
|
|
12
12
|
import Icon from '../Icon'
|
|
13
13
|
import iconPlus from '../Icons/Plus'
|
|
14
14
|
import iconWarning from '../Icons/WarningCircle'
|
|
@@ -61,9 +61,15 @@ const useStyles = makeStyles(theme => ({
|
|
|
61
61
|
}
|
|
62
62
|
}))
|
|
63
63
|
|
|
64
|
-
export const SquareAppIcon = ({
|
|
64
|
+
export const SquareAppIcon = ({
|
|
65
|
+
name,
|
|
66
|
+
variant,
|
|
67
|
+
IconContent,
|
|
68
|
+
...appIconProps
|
|
69
|
+
}) => {
|
|
65
70
|
const classes = useStyles()
|
|
66
|
-
const appName =
|
|
71
|
+
const appName =
|
|
72
|
+
name || get(appIconProps, 'app.name') || get(appIconProps, 'app') || ''
|
|
67
73
|
const letter = appName[0] || ''
|
|
68
74
|
|
|
69
75
|
return (
|
|
@@ -119,7 +125,7 @@ export const SquareAppIcon = ({ app, type, name, variant, IconContent }) => {
|
|
|
119
125
|
) : IconContent ? (
|
|
120
126
|
IconContent
|
|
121
127
|
) : (
|
|
122
|
-
<AppIcon
|
|
128
|
+
<AppIcon {...appIconProps} />
|
|
123
129
|
)}
|
|
124
130
|
</div>
|
|
125
131
|
)}
|
|
@@ -137,7 +143,6 @@ export const SquareAppIcon = ({ app, type, name, variant, IconContent }) => {
|
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
SquareAppIcon.propTypes = {
|
|
140
|
-
app: PropTypes.oneOfType([AppDoctype, PropTypes.string]),
|
|
141
146
|
name: PropTypes.string,
|
|
142
147
|
variant: PropTypes.oneOf([
|
|
143
148
|
'ghost',
|
|
@@ -146,8 +151,7 @@ SquareAppIcon.propTypes = {
|
|
|
146
151
|
'add',
|
|
147
152
|
'shortcut'
|
|
148
153
|
]),
|
|
149
|
-
IconContent: PropTypes.node
|
|
150
|
-
type: PropTypes.oneOf(['app', 'konnector'])
|
|
154
|
+
IconContent: PropTypes.node
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
export default SquareAppIcon
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import cx from 'classnames';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import { makeStyles } from '@material-ui/styles';
|
|
7
|
+
import get from 'lodash/get';
|
|
6
8
|
import AppIcon from "cozy-ui/transpiled/react/AppIcon";
|
|
7
9
|
import Badge from "cozy-ui/transpiled/react/Badge";
|
|
8
10
|
import InfosBadge from "cozy-ui/transpiled/react/InfosBadge";
|
|
9
11
|
import { nameToColor } from "cozy-ui/transpiled/react/Avatar";
|
|
10
12
|
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
11
|
-
import { AppDoctype } from "cozy-ui/transpiled/react/proptypes";
|
|
12
13
|
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
13
14
|
import iconPlus from "cozy-ui/transpiled/react/Icons/Plus";
|
|
14
15
|
import iconWarning from "cozy-ui/transpiled/react/Icons/WarningCircle";
|
|
@@ -74,13 +75,13 @@ var useStyles = makeStyles(function (theme) {
|
|
|
74
75
|
export var SquareAppIcon = function SquareAppIcon(_ref) {
|
|
75
76
|
var _cx;
|
|
76
77
|
|
|
77
|
-
var
|
|
78
|
-
type = _ref.type,
|
|
79
|
-
name = _ref.name,
|
|
78
|
+
var name = _ref.name,
|
|
80
79
|
variant = _ref.variant,
|
|
81
|
-
IconContent = _ref.IconContent
|
|
80
|
+
IconContent = _ref.IconContent,
|
|
81
|
+
appIconProps = _objectWithoutProperties(_ref, ["name", "variant", "IconContent"]);
|
|
82
|
+
|
|
82
83
|
var classes = useStyles();
|
|
83
|
-
var appName = name ||
|
|
84
|
+
var appName = name || get(appIconProps, 'app.name') || get(appIconProps, 'app') || '';
|
|
84
85
|
var letter = appName[0] || '';
|
|
85
86
|
return React.createElement("div", {
|
|
86
87
|
"data-testid": "square-app-icon",
|
|
@@ -115,20 +116,15 @@ export var SquareAppIcon = function SquareAppIcon(_ref) {
|
|
|
115
116
|
}, variant === 'add' ? React.createElement(Icon, {
|
|
116
117
|
icon: iconPlus,
|
|
117
118
|
color: color
|
|
118
|
-
}) : IconContent ? IconContent : React.createElement(AppIcon, {
|
|
119
|
-
app: app,
|
|
120
|
-
type: type
|
|
121
|
-
})))), React.createElement(Typography, {
|
|
119
|
+
}) : IconContent ? IconContent : React.createElement(AppIcon, appIconProps)))), React.createElement(Typography, {
|
|
122
120
|
className: cx(classes.name, 'u-spacellipsis'),
|
|
123
121
|
variant: "h6",
|
|
124
122
|
align: "center"
|
|
125
123
|
}, appName));
|
|
126
124
|
};
|
|
127
125
|
SquareAppIcon.propTypes = {
|
|
128
|
-
app: PropTypes.oneOfType([AppDoctype, PropTypes.string]),
|
|
129
126
|
name: PropTypes.string,
|
|
130
127
|
variant: PropTypes.oneOf(['ghost', 'maintenance', 'error', 'add', 'shortcut']),
|
|
131
|
-
IconContent: PropTypes.node
|
|
132
|
-
type: PropTypes.oneOf(['app', 'konnector'])
|
|
128
|
+
IconContent: PropTypes.node
|
|
133
129
|
};
|
|
134
130
|
export default SquareAppIcon;
|