cozy-ui 66.2.0 → 66.2.3
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/.bundlemonrc +20 -0
- package/CHANGELOG.md +21 -0
- package/package.json +2 -1
- package/react/AppSections/Readme.md +7 -4
- package/react/AppSections/_mockApps.js +23 -0
- package/react/AppSections/components/AppsSection.jsx +39 -14
- package/react/IconButton/index.jsx +12 -8
- package/transpiled/react/AppSections/_mockApps.js +24 -0
- package/transpiled/react/AppSections/components/AppsSection.js +36 -8
- package/transpiled/react/IconButton/index.js +5 -5
package/.bundlemonrc
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseDir": ".",
|
|
3
|
+
"files": [
|
|
4
|
+
{
|
|
5
|
+
"path": "dist/cozy-ui.min.css",
|
|
6
|
+
"maxPercentIncrease": 5,
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"path": "dist/cozy-ui.utils.min.css",
|
|
10
|
+
"maxPercentIncrease": 5,
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
"groups": [
|
|
14
|
+
{
|
|
15
|
+
"path": "transpiled/react/**",
|
|
16
|
+
"maxPercentIncrease": 0.5,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
"reportOutput": ["github"]
|
|
20
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [66.2.3](https://github.com/cozy/cozy-ui/compare/v66.2.2...v66.2.3) (2022-05-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* LowerCase the app name ([558da08](https://github.com/cozy/cozy-ui/commit/558da08))
|
|
7
|
+
|
|
8
|
+
## [66.2.2](https://github.com/cozy/cozy-ui/compare/v66.2.1...v66.2.2) (2022-05-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **IconButton:** Implementation of forwardRef ([a6405ba](https://github.com/cozy/cozy-ui/commit/a6405ba))
|
|
14
|
+
|
|
15
|
+
## [66.2.1](https://github.com/cozy/cozy-ui/compare/v66.2.0...v66.2.1) (2022-05-05)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* IconButton propagates ref ([0aba625](https://github.com/cozy/cozy-ui/commit/0aba625))
|
|
21
|
+
|
|
1
22
|
# [66.2.0](https://github.com/cozy/cozy-ui/compare/v66.1.0...v66.2.0) (2022-05-03)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "66.2.
|
|
3
|
+
"version": "66.2.3",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -149,6 +149,7 @@
|
|
|
149
149
|
"dependencies": {
|
|
150
150
|
"@babel/runtime": "^7.3.4",
|
|
151
151
|
"@popperjs/core": "^2.4.4",
|
|
152
|
+
"bundlemon": "^1.3.2",
|
|
152
153
|
"chart.js": "3.7.1",
|
|
153
154
|
"classnames": "^2.2.5",
|
|
154
155
|
"cozy-interapp": "^0.5.4",
|
|
@@ -5,9 +5,10 @@ import { I18n } from 'cozy-ui/transpiled/react/I18n'
|
|
|
5
5
|
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
|
|
6
6
|
import Sections from 'cozy-ui/transpiled/react/AppSections'
|
|
7
7
|
import Variants from 'cozy-ui/docs/components/Variants'
|
|
8
|
+
import CozyClient, { CozyProvider } from "cozy-client";
|
|
8
9
|
|
|
9
10
|
const locale = {}
|
|
10
|
-
|
|
11
|
+
const client = new CozyClient()
|
|
11
12
|
const WrapperSections = () => {
|
|
12
13
|
const handleAppClick = app => {
|
|
13
14
|
alert(JSON.stringify(app, null, 2))
|
|
@@ -31,8 +32,10 @@ const WrapperSections = () => {
|
|
|
31
32
|
;
|
|
32
33
|
|
|
33
34
|
<BreakpointsProvider>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
<CozyProvider client={client}>
|
|
36
|
+
<I18n dictRequire={lang => locale} lang="en">
|
|
37
|
+
<WrapperSections />
|
|
38
|
+
</I18n>
|
|
39
|
+
</CozyProvider>
|
|
37
40
|
</BreakpointsProvider>
|
|
38
41
|
```
|
|
@@ -129,6 +129,29 @@ export const apps = [
|
|
|
129
129
|
uninstallable: true,
|
|
130
130
|
isInRegistry: true
|
|
131
131
|
},
|
|
132
|
+
{
|
|
133
|
+
slug: 'konnector-withlowername',
|
|
134
|
+
name: 'easyflight',
|
|
135
|
+
icon: '<svg></svg>',
|
|
136
|
+
developer: { name: 'Author with long name' },
|
|
137
|
+
type: 'konnector',
|
|
138
|
+
categories: ['transport'],
|
|
139
|
+
tags: ['transport', 'files', 'bills'],
|
|
140
|
+
permissions: {
|
|
141
|
+
mock: {
|
|
142
|
+
type: 'io.mock.doctype'
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
version: '0.1.0',
|
|
146
|
+
versions: {
|
|
147
|
+
stable: ['0.1.0'],
|
|
148
|
+
beta: ['0.1.0'],
|
|
149
|
+
dev: ['0.1.0']
|
|
150
|
+
},
|
|
151
|
+
installed: true,
|
|
152
|
+
uninstallable: true,
|
|
153
|
+
isInRegistry: true
|
|
154
|
+
},
|
|
132
155
|
// don't add permissions to Photos for testing
|
|
133
156
|
{
|
|
134
157
|
slug: 'photos',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import { useI18n } from '../../I18n'
|
|
4
4
|
import useBreakpoints from '../../hooks/useBreakpoints'
|
|
@@ -9,6 +9,13 @@ import styles from './AppsSection.styl'
|
|
|
9
9
|
|
|
10
10
|
const makeNameGetter = t => app => getTranslatedManifestProperty(app, 'name', t)
|
|
11
11
|
|
|
12
|
+
const makeAppsListNameLowerCased = appsList => {
|
|
13
|
+
return appsList.map(app => ({
|
|
14
|
+
...app,
|
|
15
|
+
name: app.name.toLowerCase()
|
|
16
|
+
}))
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export const AppsSection = ({
|
|
13
20
|
appsList,
|
|
14
21
|
subtitle,
|
|
@@ -18,23 +25,41 @@ export const AppsSection = ({
|
|
|
18
25
|
}) => {
|
|
19
26
|
const { isMobile } = useBreakpoints()
|
|
20
27
|
const { t } = useI18n()
|
|
28
|
+
const apps = useMemo(() => makeAppsListNameLowerCased(appsList), [appsList])
|
|
29
|
+
const sortedApps = useMemo(() => {
|
|
30
|
+
return sortBy(apps, makeNameGetter(t))
|
|
31
|
+
}, [apps, t])
|
|
32
|
+
const getAppBySlug = useMemo(
|
|
33
|
+
() => slug => appsList.find(app => app.slug === slug),
|
|
34
|
+
[appsList]
|
|
35
|
+
)
|
|
36
|
+
|
|
21
37
|
return (
|
|
22
38
|
<div className={styles.AppsSection}>
|
|
23
39
|
{subtitle}
|
|
24
|
-
{
|
|
40
|
+
{apps && !!apps.length && (
|
|
25
41
|
<div className={styles.AppsSection__list}>
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
{sortedApps.map(app => {
|
|
43
|
+
const realApp = getAppBySlug(app.slug)
|
|
44
|
+
return (
|
|
45
|
+
<AppTile
|
|
46
|
+
app={realApp}
|
|
47
|
+
namePrefix={getTranslatedManifestProperty(
|
|
48
|
+
realApp,
|
|
49
|
+
'name_prefix',
|
|
50
|
+
t
|
|
51
|
+
)}
|
|
52
|
+
name={getTranslatedManifestProperty(realApp, 'name', t)}
|
|
53
|
+
onClick={() => onAppClick(realApp.slug)}
|
|
54
|
+
key={realApp.slug}
|
|
55
|
+
showDeveloper={!isMobile}
|
|
56
|
+
displaySpecificMaintenanceStyle={
|
|
57
|
+
displaySpecificMaintenanceStyle
|
|
58
|
+
}
|
|
59
|
+
IconComponent={IconComponent}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
})}
|
|
38
63
|
</div>
|
|
39
64
|
)}
|
|
40
65
|
</div>
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import cx from 'classnames'
|
|
4
4
|
import MuiIconButton from '@material-ui/core/IconButton'
|
|
5
5
|
|
|
6
|
-
const IconButton = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const IconButton = forwardRef(
|
|
7
|
+
({ size = 'medium', className, children, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<MuiIconButton ref={ref} className={cx(className, size)} {...props}>
|
|
10
|
+
{children}
|
|
11
|
+
</MuiIconButton>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
IconButton.displayName = 'IconButton'
|
|
13
17
|
|
|
14
18
|
IconButton.propTypes = {
|
|
15
19
|
className: PropTypes.string,
|
|
@@ -134,6 +134,30 @@ export var apps = [{
|
|
|
134
134
|
},
|
|
135
135
|
uninstallable: true,
|
|
136
136
|
isInRegistry: true
|
|
137
|
+
}, {
|
|
138
|
+
slug: 'konnector-withlowername',
|
|
139
|
+
name: 'easyflight',
|
|
140
|
+
icon: '<svg></svg>',
|
|
141
|
+
developer: {
|
|
142
|
+
name: 'Author with long name'
|
|
143
|
+
},
|
|
144
|
+
type: 'konnector',
|
|
145
|
+
categories: ['transport'],
|
|
146
|
+
tags: ['transport', 'files', 'bills'],
|
|
147
|
+
permissions: {
|
|
148
|
+
mock: {
|
|
149
|
+
type: 'io.mock.doctype'
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
version: '0.1.0',
|
|
153
|
+
versions: {
|
|
154
|
+
stable: ['0.1.0'],
|
|
155
|
+
beta: ['0.1.0'],
|
|
156
|
+
dev: ['0.1.0']
|
|
157
|
+
},
|
|
158
|
+
installed: true,
|
|
159
|
+
uninstallable: true,
|
|
160
|
+
isInRegistry: true
|
|
137
161
|
}, // don't add permissions to Photos for testing
|
|
138
162
|
{
|
|
139
163
|
slug: 'photos',
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
2
8
|
import PropTypes from 'prop-types';
|
|
3
9
|
import { useI18n } from "cozy-ui/transpiled/react/I18n";
|
|
4
10
|
import useBreakpoints from "cozy-ui/transpiled/react/hooks/useBreakpoints";
|
|
@@ -16,6 +22,14 @@ var makeNameGetter = function makeNameGetter(t) {
|
|
|
16
22
|
};
|
|
17
23
|
};
|
|
18
24
|
|
|
25
|
+
var makeAppsListNameLowerCased = function makeAppsListNameLowerCased(appsList) {
|
|
26
|
+
return appsList.map(function (app) {
|
|
27
|
+
return _objectSpread(_objectSpread({}, app), {}, {
|
|
28
|
+
name: app.name.toLowerCase()
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
19
33
|
export var AppsSection = function AppsSection(_ref) {
|
|
20
34
|
var appsList = _ref.appsList,
|
|
21
35
|
subtitle = _ref.subtitle,
|
|
@@ -29,19 +43,33 @@ export var AppsSection = function AppsSection(_ref) {
|
|
|
29
43
|
var _useI18n = useI18n(),
|
|
30
44
|
t = _useI18n.t;
|
|
31
45
|
|
|
46
|
+
var apps = useMemo(function () {
|
|
47
|
+
return makeAppsListNameLowerCased(appsList);
|
|
48
|
+
}, [appsList]);
|
|
49
|
+
var sortedApps = useMemo(function () {
|
|
50
|
+
return sortBy(apps, makeNameGetter(t));
|
|
51
|
+
}, [apps, t]);
|
|
52
|
+
var getAppBySlug = useMemo(function () {
|
|
53
|
+
return function (slug) {
|
|
54
|
+
return appsList.find(function (app) {
|
|
55
|
+
return app.slug === slug;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}, [appsList]);
|
|
32
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
60
|
className: styles.AppsSection
|
|
34
|
-
}, subtitle,
|
|
61
|
+
}, subtitle, apps && !!apps.length && /*#__PURE__*/React.createElement("div", {
|
|
35
62
|
className: styles.AppsSection__list
|
|
36
|
-
},
|
|
63
|
+
}, sortedApps.map(function (app) {
|
|
64
|
+
var realApp = getAppBySlug(app.slug);
|
|
37
65
|
return /*#__PURE__*/React.createElement(AppTile, {
|
|
38
|
-
app:
|
|
39
|
-
namePrefix: getTranslatedManifestProperty(
|
|
40
|
-
name: getTranslatedManifestProperty(
|
|
66
|
+
app: realApp,
|
|
67
|
+
namePrefix: getTranslatedManifestProperty(realApp, 'name_prefix', t),
|
|
68
|
+
name: getTranslatedManifestProperty(realApp, 'name', t),
|
|
41
69
|
onClick: function onClick() {
|
|
42
|
-
return onAppClick(
|
|
70
|
+
return onAppClick(realApp.slug);
|
|
43
71
|
},
|
|
44
|
-
key:
|
|
72
|
+
key: realApp.slug,
|
|
45
73
|
showDeveloper: !isMobile,
|
|
46
74
|
displaySpecificMaintenanceStyle: displaySpecificMaintenanceStyle,
|
|
47
75
|
IconComponent: IconComponent
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["size", "className", "children"];
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import MuiIconButton from '@material-ui/core/IconButton';
|
|
8
|
-
|
|
9
|
-
var IconButton = function IconButton(_ref) {
|
|
8
|
+
var IconButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
9
|
var _ref$size = _ref.size,
|
|
11
10
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
12
11
|
className = _ref.className,
|
|
@@ -14,10 +13,11 @@ var IconButton = function IconButton(_ref) {
|
|
|
14
13
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
14
|
|
|
16
15
|
return /*#__PURE__*/React.createElement(MuiIconButton, _extends({
|
|
16
|
+
ref: ref,
|
|
17
17
|
className: cx(className, size)
|
|
18
18
|
}, props), children);
|
|
19
|
-
};
|
|
20
|
-
|
|
19
|
+
});
|
|
20
|
+
IconButton.displayName = 'IconButton';
|
|
21
21
|
IconButton.propTypes = {
|
|
22
22
|
className: PropTypes.string,
|
|
23
23
|
size: PropTypes.oneOf(['small', 'medium', 'large'])
|