cozy-ui 70.7.0 → 72.1.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,54 @@
1
+ # [72.1.0](https://github.com/cozy/cozy-ui/compare/v72.0.0...v72.1.0) (2022-08-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * Let the user able to select content ([7efff3d](https://github.com/cozy/cozy-ui/commit/7efff3d))
7
+
8
+ # [72.0.0](https://github.com/cozy/cozy-ui/compare/v71.0.0...v72.0.0) (2022-08-24)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Do not display Viewer's Download button on iOS Flagship app ([db2303d](https://github.com/cozy/cozy-ui/commit/db2303d))
14
+
15
+
16
+ ### Code Refactoring
17
+
18
+ * Handle footer items' gap in `FooterContent` container ([22776e2](https://github.com/cozy/cozy-ui/commit/22776e2))
19
+
20
+
21
+ ### BREAKING CHANGES
22
+
23
+ * Items inside of `FooterActionButtons` should not have
24
+ specified margins anymore as those are now handled by its container.
25
+ Remove them to avoid duplicate margins
26
+
27
+ # [71.0.0](https://github.com/cozy/cozy-ui/compare/v70.7.0...v71.0.0) (2022-08-24)
28
+
29
+
30
+ ### Features
31
+
32
+ * Exports all MUI styles functions ([8e9228c](https://github.com/cozy/cozy-ui/commit/8e9228c))
33
+
34
+
35
+ ### BREAKING CHANGES
36
+
37
+ * Imports of `makeStyles`, `useTheme` and `withStyles`
38
+ are no longer done like this
39
+ `import ... from cozy-ui/transpiled/react/helpers/[makeStyles|useTheme|withStyles]`
40
+ but instead
41
+ `import { ... } from cozy-ui/transpiled/react/styles`
42
+
43
+ You can use a codemods `transform-mui-styles-imports.js`
44
+ to automatically handle this breaking change.
45
+ [See the codemods documentation](https://github.com/cozy/cozy-libs/tree/master/packages/cozy-codemods).
46
+ Using linter js auto-correction can be a good idea after that.
47
+ Here a common example (don't forget to change `src` value):
48
+ ```
49
+ jscodeshift -t $(yarn global dir)/node_modules/@cozy/codemods/src/transforms/transform-mui-styles-imports.js src --parser babel --extensions js,jsx && yarn lint:js --fix
50
+ ```
51
+
1
52
  # [70.7.0](https://github.com/cozy/cozy-ui/compare/v70.6.2...v70.7.0) (2022-08-23)
2
53
 
3
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "70.7.0",
3
+ "version": "72.1.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -16,7 +16,8 @@ const useStyles = makeStyles(theme => ({
16
16
  height: '100%',
17
17
  paddingLeft: '1rem',
18
18
  paddingRight: '1rem',
19
- borderTop: `1px solid ${theme.palette.divider}`
19
+ borderTop: `1px solid ${theme.palette.divider}`,
20
+ columnGap: '0.5rem'
20
21
  }
21
22
  }))
22
23
 
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  import { useClient } from 'cozy-client'
5
+ import { isFlagshipApp, isIOS } from 'cozy-device-helper'
5
6
 
6
7
  import ForwardButton from './ForwardButton'
7
8
  import DownloadButton from './DownloadButton'
@@ -14,7 +15,10 @@ const ForwardOrDownloadButton = ({ file }) => {
14
15
  ? ForwardButton
15
16
  : DownloadButton
16
17
 
17
- return <FileActionButton file={file} />
18
+ // Temporarily disable Download button on iOS Flagship app until
19
+ // the download feature is fixed on this platform
20
+ // When fixed on this platform, revert this commit from PR #2215
21
+ return isFlagshipApp() && isIOS() ? null : <FileActionButton file={file} />
18
22
  }
19
23
 
20
24
  ForwardOrDownloadButton.propTypes = {
@@ -25,7 +25,6 @@ const Sharing = ({ file }) => {
25
25
  />
26
26
  )}
27
27
  <ShareButton
28
- className="u-mr-half"
29
28
  extension="full"
30
29
  useShortLabel
31
30
  docId={file.id}
@@ -102,7 +102,7 @@ const ShareButtonFake = () => {
102
102
  return (
103
103
  <Button
104
104
  label="Share"
105
- className="u-w-100 u-ml-0 u-mr-half"
105
+ className="u-w-100 u-ml-0 u-mr-0"
106
106
  variant="secondary"
107
107
  startIcon={<Icon icon={ShareIcon} />}
108
108
  onClick={() => {
@@ -47,11 +47,6 @@ class ViewerControls extends Component {
47
47
  }
48
48
  }
49
49
 
50
- onTap = () => {
51
- if (this.state.hidden) this.showControls()
52
- else this.hideAfterDelay()
53
- }
54
-
55
50
  hideAfterDelay = () => {
56
51
  clearTimeout(this.hideTimeout)
57
52
  this.hideTimeout = setTimeout(() => {
@@ -65,13 +60,18 @@ class ViewerControls extends Component {
65
60
  }
66
61
 
67
62
  initGestures = () => {
68
- const gestures = new Hammer(this.wrapped)
69
- gestures.on('swipe', this.onSwipe)
70
- gestures.on('tap', this.onTap)
71
- const tap = gestures.get('tap')
72
- const doubleTap = gestures.get('doubletap')
73
- doubleTap.recognizeWith(tap)
74
- tap.requireFailure(doubleTap)
63
+ const gestures = new Hammer(
64
+ this.wrapped,
65
+ this.props.breakpoints.isDesktop
66
+ ? {
67
+ cssProps: {
68
+ userSelect: 'auto'
69
+ }
70
+ }
71
+ : {}
72
+ )
73
+ if (!this.props.breakpoints.isDesktop) gestures.on('swipe', this.onSwipe)
74
+
75
75
  return gestures
76
76
  }
77
77
 
@@ -116,7 +116,6 @@ class ViewerControls extends Component {
116
116
  } = this.props
117
117
  const { showToolbar, showClose, toolbarRef } = toolbarProps
118
118
  const { hidden } = this.state
119
-
120
119
  return (
121
120
  <div
122
121
  className={cx(styles['viewer-controls'], {
@@ -0,0 +1 @@
1
+ export * from '@material-ui/core/styles'
@@ -14,7 +14,8 @@ var useStyles = makeStyles(function (theme) {
14
14
  height: '100%',
15
15
  paddingLeft: '1rem',
16
16
  paddingRight: '1rem',
17
- borderTop: "1px solid ".concat(theme.palette.divider)
17
+ borderTop: "1px solid ".concat(theme.palette.divider),
18
+ columnGap: '0.5rem'
18
19
  }
19
20
  };
20
21
  });
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useClient } from 'cozy-client';
4
+ import { isFlagshipApp, isIOS } from 'cozy-device-helper';
4
5
  import ForwardButton from "cozy-ui/transpiled/react/Viewer/Footer/ForwardButton";
5
6
  import DownloadButton from "cozy-ui/transpiled/react/Viewer/Footer/DownloadButton";
6
7
  import { shouldBeForwardButton } from "cozy-ui/transpiled/react/Viewer/Footer/helpers";
@@ -8,8 +9,11 @@ import { shouldBeForwardButton } from "cozy-ui/transpiled/react/Viewer/Footer/he
8
9
  var ForwardOrDownloadButton = function ForwardOrDownloadButton(_ref) {
9
10
  var file = _ref.file;
10
11
  var client = useClient();
11
- var FileActionButton = shouldBeForwardButton(client) ? ForwardButton : DownloadButton;
12
- return /*#__PURE__*/React.createElement(FileActionButton, {
12
+ var FileActionButton = shouldBeForwardButton(client) ? ForwardButton : DownloadButton; // Temporarily disable Download button on iOS Flagship app until
13
+ // the download feature is fixed on this platform
14
+ // When fixed on this platform, revert this commit from PR #2215
15
+
16
+ return isFlagshipApp() && isIOS() ? null : /*#__PURE__*/React.createElement(FileActionButton, {
13
17
  file: file
14
18
  });
15
19
  };
@@ -26,7 +26,6 @@ var Sharing = function Sharing(_ref) {
26
26
  return setShowShareModal(false);
27
27
  }
28
28
  }), /*#__PURE__*/React.createElement(ShareButton, {
29
- className: "u-mr-half",
30
29
  extension: "full",
31
30
  useShortLabel: true,
32
31
  docId: file.id,
@@ -108,10 +108,6 @@ var ViewerControls = /*#__PURE__*/function (_Component) {
108
108
  }
109
109
  });
110
110
 
111
- _defineProperty(_assertThisInitialized(_this), "onTap", function () {
112
- if (_this.state.hidden) _this.showControls();else _this.hideAfterDelay();
113
- });
114
-
115
111
  _defineProperty(_assertThisInitialized(_this), "hideAfterDelay", function () {
116
112
  clearTimeout(_this.hideTimeout);
117
113
  _this.hideTimeout = setTimeout(function () {
@@ -124,13 +120,12 @@ var ViewerControls = /*#__PURE__*/function (_Component) {
124
120
  });
125
121
 
126
122
  _defineProperty(_assertThisInitialized(_this), "initGestures", function () {
127
- var gestures = new Hammer(_this.wrapped);
128
- gestures.on('swipe', _this.onSwipe);
129
- gestures.on('tap', _this.onTap);
130
- var tap = gestures.get('tap');
131
- var doubleTap = gestures.get('doubletap');
132
- doubleTap.recognizeWith(tap);
133
- tap.requireFailure(doubleTap);
123
+ var gestures = new Hammer(_this.wrapped, _this.props.breakpoints.isDesktop ? {
124
+ cssProps: {
125
+ userSelect: 'auto'
126
+ }
127
+ } : {});
128
+ if (!_this.props.breakpoints.isDesktop) gestures.on('swipe', _this.onSwipe);
134
129
  return gestures;
135
130
  });
136
131
 
@@ -0,0 +1 @@
1
+ export * from '@material-ui/core/styles';
@@ -1,2 +0,0 @@
1
- import { makeStyles } from '@material-ui/core/styles'
2
- export default makeStyles
@@ -1,2 +0,0 @@
1
- import { useTheme } from '@material-ui/core'
2
- export default useTheme
@@ -1,2 +0,0 @@
1
- import { withStyles } from '@material-ui/core/styles'
2
- export default withStyles
@@ -1,2 +0,0 @@
1
- import { makeStyles } from '@material-ui/core/styles';
2
- export default makeStyles;
@@ -1,2 +0,0 @@
1
- import { useTheme } from '@material-ui/core';
2
- export default useTheme;
@@ -1,2 +0,0 @@
1
- import { withStyles } from '@material-ui/core/styles';
2
- export default withStyles;