cozy-ui 58.2.0 → 58.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [58.3.0](https://github.com/cozy/cozy-ui/compare/v58.2.0...v58.3.0) (2021-12-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * Disable sharing button on Viewer ([c7303b3](https://github.com/cozy/cozy-ui/commit/c7303b3))
7
+
1
8
  # [58.2.0](https://github.com/cozy/cozy-ui/compare/v58.1.2...v58.2.0) (2021-12-08)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "58.2.0",
3
+ "version": "58.3.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -20,7 +20,7 @@ const useStyles = makeStyles(theme => ({
20
20
  }
21
21
  }))
22
22
 
23
- const BottomSheetContent = forwardRef(({ file }, ref) => {
23
+ const BottomSheetContent = forwardRef(({ file, disableSharing }, ref) => {
24
24
  const panelBlocks = getPanelBlocks({ panelBlocksSpecs, file })
25
25
  const FileActionButton = isMobileApp() ? ForwardButton : DownloadButton
26
26
  const styles = useStyles()
@@ -31,7 +31,7 @@ const BottomSheetContent = forwardRef(({ file }, ref) => {
31
31
  className={cx('u-flex u-flex-column u-ov-hidden', styles.stack)}
32
32
  >
33
33
  <Paper className={'u-flex u-ph-1 u-pb-1'} elevation={2} square ref={ref}>
34
- <Sharing file={file} />
34
+ {!disableSharing && <Sharing file={file} />}
35
35
  <FileActionButton file={file} />
36
36
  </Paper>
37
37
  {panelBlocks.map((PanelBlock, index) => (
@@ -50,7 +50,8 @@ const BottomSheetContent = forwardRef(({ file }, ref) => {
50
50
  })
51
51
 
52
52
  BottomSheetContent.propTypes = {
53
- file: PropTypes.object.isRequired
53
+ file: PropTypes.object.isRequired,
54
+ disableSharing: PropTypes.bool
54
55
  }
55
56
 
56
57
  export default BottomSheetContent
@@ -23,7 +23,7 @@ const useStyles = makeStyles(theme => ({
23
23
  }
24
24
  }))
25
25
 
26
- const FooterContent = ({ file, toolbarRef }) => {
26
+ const FooterContent = ({ file, toolbarRef, disableSharing }) => {
27
27
  const styles = useStyles()
28
28
  const FileActionButton = isMobileApp() ? ForwardButton : DownloadButton
29
29
  const actionButtonsRef = useRef()
@@ -35,21 +35,27 @@ const FooterContent = ({ file, toolbarRef }) => {
35
35
  actionButtonsRef={actionButtonsRef}
36
36
  toolbarRef={toolbarRef}
37
37
  >
38
- <BottomSheetContent file={file} ref={actionButtonsRef} />
38
+ <BottomSheetContent
39
+ file={file}
40
+ disableSharing={disableSharing}
41
+ ref={actionButtonsRef}
42
+ />
39
43
  </BottomSheetWrapper>
40
44
  )
41
45
  }
42
46
 
43
47
  return (
44
48
  <div className={styles.footer}>
45
- <Sharing file={file} />
49
+ {!disableSharing && <Sharing file={file} />}
46
50
  <FileActionButton file={file} />
47
51
  </div>
48
52
  )
49
53
  }
50
54
 
51
55
  FooterContent.propTypes = {
52
- file: PropTypes.object.isRequired
56
+ file: PropTypes.object.isRequired,
57
+ toolbarRef: PropTypes.object,
58
+ disableSharing: PropTypes.bool
53
59
  }
54
60
 
55
61
  export default FooterContent
@@ -145,6 +145,7 @@ Viewer.propTypes = {
145
145
  const ViewerInformationsWrapper = ({
146
146
  currentFile,
147
147
  disableFooter,
148
+ disableSharing,
148
149
  validForPanel,
149
150
  toolbarRef
150
151
  }) => {
@@ -152,7 +153,11 @@ const ViewerInformationsWrapper = ({
152
153
  <>
153
154
  {!disableFooter && (
154
155
  <Footer>
155
- <FooterContent file={currentFile} toolbarRef={toolbarRef} />
156
+ <FooterContent
157
+ file={currentFile}
158
+ toolbarRef={toolbarRef}
159
+ disableSharing={disableSharing}
160
+ />
156
161
  </Footer>
157
162
  )}
158
163
  {validForPanel && (
@@ -167,12 +172,19 @@ const ViewerInformationsWrapper = ({
167
172
  ViewerInformationsWrapper.propTypes = {
168
173
  currentFile: PropTypes.shape(FileDoctype).isRequired,
169
174
  disableFooter: PropTypes.bool,
175
+ disableSharing: PropTypes.bool,
170
176
  validForPanel: PropTypes.bool,
171
177
  toolbarRef: PropTypes.object
172
178
  }
173
179
 
174
180
  export const ViewerContainer = props => {
175
- const { className, disableFooter, disablePanel, ...rest } = props
181
+ const {
182
+ className,
183
+ disableFooter,
184
+ disablePanel,
185
+ disableSharing,
186
+ ...rest
187
+ } = props
176
188
  const { currentIndex, files } = props
177
189
  const toolbarRef = createRef()
178
190
  const { isDesktop } = useBreakpoints()
@@ -195,6 +207,7 @@ export const ViewerContainer = props => {
195
207
  />
196
208
  <ViewerInformationsWrapper
197
209
  disableFooter={disableFooter}
210
+ disableSharing={disableSharing}
198
211
  validForPanel={validForPanel}
199
212
  currentFile={currentFile}
200
213
  toolbarRef={toolbarRef}
@@ -225,10 +238,12 @@ ViewerContainer.propTypes = {
225
238
  /** To open the Only Office file */
226
239
  opener: PropTypes.func
227
240
  }),
228
- /** Show the panel containing more information about the file only on Desktop */
241
+ /** Show/Hide the panel containing more information about the file only on Desktop */
229
242
  disablePanel: PropTypes.bool,
230
- /** Show the panel containing more information about the file only on Phone & Tablet devices */
231
- disableFooter: PropTypes.bool
243
+ /** Show/Hide the panel containing more information about the file only on Phone & Tablet devices */
244
+ disableFooter: PropTypes.bool,
245
+ /** Show/Hide cozy share button */
246
+ disableSharing: PropTypes.bool
232
247
  }
233
248
 
234
249
  ViewerContainer.defaultProps = {
@@ -18,7 +18,8 @@ var useStyles = makeStyles(function (theme) {
18
18
  };
19
19
  });
20
20
  var BottomSheetContent = forwardRef(function (_ref, ref) {
21
- var file = _ref.file;
21
+ var file = _ref.file,
22
+ disableSharing = _ref.disableSharing;
22
23
  var panelBlocks = getPanelBlocks({
23
24
  panelBlocksSpecs: panelBlocksSpecs,
24
25
  file: file
@@ -33,7 +34,7 @@ var BottomSheetContent = forwardRef(function (_ref, ref) {
33
34
  elevation: 2,
34
35
  square: true,
35
36
  ref: ref
36
- }, React.createElement(Sharing, {
37
+ }, !disableSharing && React.createElement(Sharing, {
37
38
  file: file
38
39
  }), React.createElement(FileActionButton, {
39
40
  file: file
@@ -50,6 +51,7 @@ var BottomSheetContent = forwardRef(function (_ref, ref) {
50
51
  }));
51
52
  });
52
53
  BottomSheetContent.propTypes = {
53
- file: PropTypes.object.isRequired
54
+ file: PropTypes.object.isRequired,
55
+ disableSharing: PropTypes.bool
54
56
  };
55
57
  export default BottomSheetContent;
@@ -24,7 +24,8 @@ var useStyles = makeStyles(function (theme) {
24
24
 
25
25
  var FooterContent = function FooterContent(_ref) {
26
26
  var file = _ref.file,
27
- toolbarRef = _ref.toolbarRef;
27
+ toolbarRef = _ref.toolbarRef,
28
+ disableSharing = _ref.disableSharing;
28
29
  var styles = useStyles();
29
30
  var FileActionButton = isMobileApp() ? ForwardButton : DownloadButton;
30
31
  var actionButtonsRef = useRef();
@@ -38,13 +39,14 @@ var FooterContent = function FooterContent(_ref) {
38
39
  toolbarRef: toolbarRef
39
40
  }, React.createElement(BottomSheetContent, {
40
41
  file: file,
42
+ disableSharing: disableSharing,
41
43
  ref: actionButtonsRef
42
44
  }));
43
45
  }
44
46
 
45
47
  return React.createElement("div", {
46
48
  className: styles.footer
47
- }, React.createElement(Sharing, {
49
+ }, !disableSharing && React.createElement(Sharing, {
48
50
  file: file
49
51
  }), React.createElement(FileActionButton, {
50
52
  file: file
@@ -52,6 +54,8 @@ var FooterContent = function FooterContent(_ref) {
52
54
  };
53
55
 
54
56
  FooterContent.propTypes = {
55
- file: PropTypes.object.isRequired
57
+ file: PropTypes.object.isRequired,
58
+ toolbarRef: PropTypes.object,
59
+ disableSharing: PropTypes.bool
56
60
  };
57
61
  export default FooterContent;
@@ -174,11 +174,13 @@ Viewer.propTypes = {
174
174
  var ViewerInformationsWrapper = function ViewerInformationsWrapper(_ref) {
175
175
  var currentFile = _ref.currentFile,
176
176
  disableFooter = _ref.disableFooter,
177
+ disableSharing = _ref.disableSharing,
177
178
  validForPanel = _ref.validForPanel,
178
179
  toolbarRef = _ref.toolbarRef;
179
180
  return React.createElement(React.Fragment, null, !disableFooter && React.createElement(Footer, null, React.createElement(FooterContent, {
180
181
  file: currentFile,
181
- toolbarRef: toolbarRef
182
+ toolbarRef: toolbarRef,
183
+ disableSharing: disableSharing
182
184
  })), validForPanel && React.createElement(InformationPanel, null, React.createElement(PanelContent, {
183
185
  file: currentFile
184
186
  })));
@@ -187,6 +189,7 @@ var ViewerInformationsWrapper = function ViewerInformationsWrapper(_ref) {
187
189
  ViewerInformationsWrapper.propTypes = {
188
190
  currentFile: PropTypes.shape(FileDoctype).isRequired,
189
191
  disableFooter: PropTypes.bool,
192
+ disableSharing: PropTypes.bool,
190
193
  validForPanel: PropTypes.bool,
191
194
  toolbarRef: PropTypes.object
192
195
  };
@@ -194,7 +197,8 @@ export var ViewerContainer = function ViewerContainer(props) {
194
197
  var className = props.className,
195
198
  disableFooter = props.disableFooter,
196
199
  disablePanel = props.disablePanel,
197
- rest = _objectWithoutProperties(props, ["className", "disableFooter", "disablePanel"]);
200
+ disableSharing = props.disableSharing,
201
+ rest = _objectWithoutProperties(props, ["className", "disableFooter", "disablePanel", "disableSharing"]);
198
202
 
199
203
  var currentIndex = props.currentIndex,
200
204
  files = props.files;
@@ -220,6 +224,7 @@ export var ViewerContainer = function ViewerContainer(props) {
220
224
  toolbarRef: toolbarRef
221
225
  })), React.createElement(ViewerInformationsWrapper, {
222
226
  disableFooter: disableFooter,
227
+ disableSharing: disableSharing,
223
228
  validForPanel: validForPanel,
224
229
  currentFile: currentFile,
225
230
  toolbarRef: toolbarRef
@@ -255,11 +260,14 @@ ViewerContainer.propTypes = {
255
260
  opener: PropTypes.func
256
261
  }),
257
262
 
258
- /** Show the panel containing more information about the file only on Desktop */
263
+ /** Show/Hide the panel containing more information about the file only on Desktop */
259
264
  disablePanel: PropTypes.bool,
260
265
 
261
- /** Show the panel containing more information about the file only on Phone & Tablet devices */
262
- disableFooter: PropTypes.bool
266
+ /** Show/Hide the panel containing more information about the file only on Phone & Tablet devices */
267
+ disableFooter: PropTypes.bool,
268
+
269
+ /** Show/Hide cozy share button */
270
+ disableSharing: PropTypes.bool
263
271
  };
264
272
  ViewerContainer.defaultProps = {
265
273
  currentIndex: 0,