cozy-ui 110.8.0 → 110.8.2

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,17 @@
1
+ ## [110.8.2](https://github.com/cozy/cozy-ui/compare/v110.8.1...v110.8.2) (2024-07-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **ViewerControls:** children can contain undefined values ([506fd4c](https://github.com/cozy/cozy-ui/commit/506fd4c))
7
+
8
+ ## [110.8.1](https://github.com/cozy/cozy-ui/compare/v110.8.0...v110.8.1) (2024-07-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **PermissionDialog:** Show overflow icon on iOS ([f9f6073](https://github.com/cozy/cozy-ui/commit/f9f6073))
14
+
1
15
  # [110.8.0](https://github.com/cozy/cozy-ui/compare/v110.7.1...v110.8.0) (2024-07-09)
2
16
 
3
17
 
package/jest.config.js CHANGED
@@ -14,7 +14,9 @@ module.exports = {
14
14
  'react-pdf/dist/esm/entry.webpack': 'react-pdf',
15
15
  '^cozy-client$': 'cozy-client/dist/index'
16
16
  },
17
- transformIgnorePatterns: ['node_modules/(?!(react-styleguidist)/)'],
17
+ transformIgnorePatterns: [
18
+ 'node_modules/(?!(react-styleguidist|cozy-harvest-lib)/)'
19
+ ],
18
20
  testPathIgnorePatterns: ['/node_modules/', '/transpiled/', '/dist/'],
19
21
  transform: {
20
22
  '^.+\\.(ts|tsx|js|jsx)?$': 'babel-jest'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "110.8.0",
3
+ "version": "110.8.2",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -456,7 +456,10 @@ export const makeLightNormalOverrides = theme => ({
456
456
  }
457
457
  },
458
458
  '&.overflow': {
459
- overflowY: 'visible !important' // Allow the icon to overflow the dialog, otherwise it will be cut off
459
+ overflowY: 'visible !important', // Allow the icon to overflow the dialog, otherwise it will be cut off,
460
+ '& .cozyDialogContent': {
461
+ overflowY: 'visible !important' // This allow the overflow to work also on iOS
462
+ }
460
463
  }
461
464
  },
462
465
  scrollPaper: {
@@ -95,8 +95,8 @@ class ViewerControls extends Component {
95
95
 
96
96
  return React.Children.map(children, child => {
97
97
  if (
98
- child.type.name === 'ViewerByFile' ||
99
- child.type.displayName === 'ViewerByFile'
98
+ child?.type?.name === 'ViewerByFile' ||
99
+ child?.type?.displayName === 'ViewerByFile'
100
100
  ) {
101
101
  return React.cloneElement(child, {
102
102
  gestures: this.state.gestures,
@@ -0,0 +1,54 @@
1
+ import React from 'react'
2
+ import { render, screen } from '@testing-library/react'
3
+
4
+ import ViewerControls from './ViewerControls'
5
+ import ViewerByFile from './ViewerByFile'
6
+
7
+ jest.mock('../ViewersByFile/AudioViewer', () => () => <div>AudioViewer</div>)
8
+ jest.mock('../providers/EncryptedProvider', () => ({
9
+ useEncrypted: () => ({ url: 'random' })
10
+ }))
11
+
12
+ describe('ViewerControls', () => {
13
+ const file = {
14
+ _id: 'audio',
15
+ class: 'audio',
16
+ mime: 'audio/mp3',
17
+ name: 'sample.mp3'
18
+ }
19
+
20
+ const setup = ({ children } = {}) => {
21
+ render(
22
+ <ViewerControls
23
+ file={file}
24
+ onClose={() => {}}
25
+ hasPrevious={false}
26
+ hasNext={false}
27
+ onPrevious={() => {}}
28
+ onNext={() => {}}
29
+ expanded={false}
30
+ toolbarProps={{
31
+ showToolbar: false,
32
+ showClose: false,
33
+ showFilePath: false,
34
+ toolbarRef: undefined
35
+ }}
36
+ showNavigation={false}
37
+ >
38
+ {children}
39
+ </ViewerControls>
40
+ )
41
+ }
42
+
43
+ it('should only render children if they are ViewerByFile', () => {
44
+ setup({
45
+ children: [
46
+ undefined,
47
+ <div key="notViewer">not ViewerByFile</div>,
48
+ <ViewerByFile key="viewer" file={file} onClose={() => {}} />
49
+ ]
50
+ })
51
+ expect(screen.queryByText('not ViewerByFile')).not.toBeInTheDocument()
52
+ expect(screen.getByText('AudioViewer')).toBeInTheDocument()
53
+ })
54
+ })
@@ -529,6 +529,9 @@ export function makeDarkInvertedOverrides(theme: any): {
529
529
  };
530
530
  '&.overflow': {
531
531
  overflowY: string;
532
+ '& .cozyDialogContent': {
533
+ overflowY: string;
534
+ };
532
535
  };
533
536
  };
534
537
  scrollPaper: {
@@ -529,6 +529,9 @@ export function makeDarkNormalOverrides(theme: any): {
529
529
  };
530
530
  '&.overflow': {
531
531
  overflowY: string;
532
+ '& .cozyDialogContent': {
533
+ overflowY: string;
534
+ };
532
535
  };
533
536
  };
534
537
  scrollPaper: {
@@ -529,6 +529,9 @@ export function makeLightInvertedOverrides(theme: any): {
529
529
  };
530
530
  '&.overflow': {
531
531
  overflowY: string;
532
+ '& .cozyDialogContent': {
533
+ overflowY: string;
534
+ };
532
535
  };
533
536
  };
534
537
  scrollPaper: {
@@ -529,6 +529,9 @@ export function makeLightNormalOverrides(theme: any): {
529
529
  };
530
530
  '&.overflow': {
531
531
  overflowY: string;
532
+ '& .cozyDialogContent': {
533
+ overflowY: string;
534
+ };
532
535
  };
533
536
  };
534
537
  scrollPaper: {
@@ -426,8 +426,12 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
426
426
  maxWidth: '800px'
427
427
  }),
428
428
  '&.overflow': {
429
- overflowY: 'visible !important' // Allow the icon to overflow the dialog, otherwise it will be cut off
429
+ overflowY: 'visible !important',
430
+ // Allow the icon to overflow the dialog, otherwise it will be cut off,
431
+ '& .cozyDialogContent': {
432
+ overflowY: 'visible !important' // This allow the overflow to work also on iOS
430
433
 
434
+ }
431
435
  }
432
436
  },
433
437
  scrollPaper: {
@@ -141,7 +141,9 @@ var ViewerControls = /*#__PURE__*/function (_Component) {
141
141
 
142
142
  if (!children) return null;
143
143
  return React.Children.map(children, function (child) {
144
- if (child.type.name === 'ViewerByFile' || child.type.displayName === 'ViewerByFile') {
144
+ var _child$type, _child$type2;
145
+
146
+ if ((child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'ViewerByFile' || (child === null || child === void 0 ? void 0 : (_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName) === 'ViewerByFile') {
145
147
  return /*#__PURE__*/React.cloneElement(child, {
146
148
  gestures: _this2.state.gestures,
147
149
  gesturesRef: _this2.wrapped,