cozy-ui 127.14.0 → 127.16.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,17 @@
1
+ # [127.16.0](https://github.com/cozy/cozy-ui/compare/v127.15.0...v127.16.0) (2025-08-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * Update FileImageLoader to be used in shared drive :sparkles: ([cb4db8f](https://github.com/cozy/cozy-ui/commit/cb4db8f))
7
+
8
+ # [127.15.0](https://github.com/cozy/cozy-ui/compare/v127.14.0...v127.15.0) (2025-08-25)
9
+
10
+
11
+ ### Features
12
+
13
+ * **ActionsMenuButton:** Add component ([cd65a6c](https://github.com/cozy/cozy-ui/commit/cd65a6c))
14
+
1
15
  # [127.14.0](https://github.com/cozy/cozy-ui/compare/v127.13.1...v127.14.0) (2025-08-21)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "127.14.0",
3
+ "version": "127.16.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -36,7 +36,13 @@ export const download = ({ encryptedUrl }) => {
36
36
  icon,
37
37
  label,
38
38
  Component: makeComponent(label, icon),
39
- action: (docs, { client, webviewIntent }) =>
40
- downloadFile({ client, file: docs[0], url: encryptedUrl, webviewIntent })
39
+ action: (docs, { client, webviewIntent, driveId }) =>
40
+ downloadFile({
41
+ client,
42
+ file: docs[0],
43
+ url: encryptedUrl,
44
+ webviewIntent,
45
+ driveId
46
+ })
41
47
  }
42
48
  }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "menu": "Menu",
2
3
  "viewInContacts": "View in Cozy Contacts",
3
4
  "viewInDrive": "Open",
4
5
  "modify": "Modify",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "menu": "Menu",
2
3
  "viewInContacts": "Voir dans Cozy Contacts",
3
4
  "viewInDrive": "Ouvrir",
4
5
  "modify": "Modifier",
@@ -0,0 +1,45 @@
1
+ import React, { useState, useRef } from 'react'
2
+
3
+ import ActionsMenu from '.'
4
+ import { locales } from './Actions/locales/withActionsLocales'
5
+ import Icon from '../Icon'
6
+ import IconButton from '../IconButton'
7
+ import DotsIcon from '../Icons/Dots'
8
+ import ListItemIcon from '../ListItemIcon'
9
+ import { useI18n, useExtendI18n } from '../providers/I18n'
10
+
11
+ const ActionsMenuButton = ({ docs, actions }) => {
12
+ const [showActions, setShowActions] = useState(false)
13
+ const actionsRef = useRef()
14
+ useExtendI18n(locales)
15
+ const { t } = useI18n()
16
+
17
+ return (
18
+ <>
19
+ <ListItemIcon>
20
+ <IconButton
21
+ ref={actionsRef}
22
+ arial-label={t('menu')}
23
+ onClick={() => setShowActions(true)}
24
+ >
25
+ <Icon icon={DotsIcon} />
26
+ </IconButton>
27
+ </ListItemIcon>
28
+ {showActions && (
29
+ <ActionsMenu
30
+ open
31
+ ref={actionsRef}
32
+ docs={docs}
33
+ actions={actions}
34
+ anchorOrigin={{
35
+ vertical: 'bottom',
36
+ horizontal: 'right'
37
+ }}
38
+ onClose={() => setShowActions(false)}
39
+ />
40
+ )}
41
+ </>
42
+ )
43
+ }
44
+
45
+ export default ActionsMenuButton
@@ -1,20 +1,9 @@
1
- import React, { useRef, useState } from 'react'
1
+ import React from 'react'
2
2
 
3
3
  import ContactIdentity from './Contacts/ContactIdentity'
4
- import { locales } from './locales/withContactsListLocales'
5
- import ActionsMenu from '../ActionsMenu'
6
- import Icon from '../Icon'
7
- import IconButton from '../IconButton'
8
- import DotsIcon from '../Icons/Dots'
9
- import ListItemIcon from '../ListItemIcon'
10
- import { useI18n, useExtendI18n } from '../providers/I18n'
4
+ import ActionsMenuButton from '../ActionsMenu/ActionsMenuButton'
11
5
 
12
6
  const Cell = ({ row, column, cell, actions }) => {
13
- const [showActions, setShowActions] = useState(false)
14
- useExtendI18n(locales)
15
- const { t } = useI18n()
16
- const actionsRef = useRef()
17
-
18
7
  if (column.id === 'fullname') {
19
8
  return <ContactIdentity contact={row} noWrapper />
20
9
  }
@@ -24,32 +13,7 @@ const Cell = ({ row, column, cell, actions }) => {
24
13
  return null
25
14
  }
26
15
 
27
- return (
28
- <>
29
- <ListItemIcon>
30
- <IconButton
31
- ref={actionsRef}
32
- arial-label={t('menu')}
33
- onClick={() => setShowActions(true)}
34
- >
35
- <Icon icon={DotsIcon} />
36
- </IconButton>
37
- </ListItemIcon>
38
- {showActions && (
39
- <ActionsMenu
40
- open
41
- ref={actionsRef}
42
- docs={[row]}
43
- actions={actions}
44
- anchorOrigin={{
45
- vertical: 'bottom',
46
- horizontal: 'right'
47
- }}
48
- onClose={() => setShowActions(false)}
49
- />
50
- )}
51
- </>
52
- )
16
+ return <ActionsMenuButton docs={[row]} actions={actions} />
53
17
  }
54
18
 
55
19
  return cell
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "empty": "EMPTY",
3
3
  "me": "me",
4
- "favorite": "favorites",
5
- "menu": "Menu"
4
+ "favorite": "favorites"
6
5
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "empty": "VIDE",
3
3
  "me": "moi",
4
- "favorite": "favoris",
5
- "menu": "Menu"
4
+ "favorite": "favoris"
6
5
  }
@@ -142,7 +142,7 @@ export class FileImageLoader extends Component {
142
142
  throw new Error('No pdf files fallback')
143
143
  }
144
144
  const src = await client
145
- .collection('io.cozy.files')
145
+ .collection('io.cozy.files', { driveId: file.driveId })
146
146
  .getDownloadLinkById(this.getFileId(file), file.name)
147
147
  await checkImageSource(src)
148
148
  if (this._mounted) {
@@ -5,9 +5,10 @@ export function download({ encryptedUrl }: {
5
5
  icon: typeof DownloadIcon;
6
6
  label: any;
7
7
  Component: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
8
- action: (docs: any, { client, webviewIntent }: {
8
+ action: (docs: any, { client, webviewIntent, driveId }: {
9
9
  client: any;
10
10
  webviewIntent: any;
11
+ driveId: any;
11
12
  }) => any;
12
13
  };
13
14
  import DownloadIcon from "../../Icons/Download";
@@ -37,12 +37,14 @@ export var download = function download(_ref) {
37
37
  Component: makeComponent(label, icon),
38
38
  action: function action(docs, _ref2) {
39
39
  var client = _ref2.client,
40
- webviewIntent = _ref2.webviewIntent;
40
+ webviewIntent = _ref2.webviewIntent,
41
+ driveId = _ref2.driveId;
41
42
  return downloadFile({
42
43
  client: client,
43
44
  file: docs[0],
44
45
  url: encryptedUrl,
45
- webviewIntent: webviewIntent
46
+ webviewIntent: webviewIntent,
47
+ driveId: driveId
46
48
  });
47
49
  }
48
50
  };
@@ -1,4 +1,5 @@
1
1
  var en = {
2
+ menu: "Menu",
2
3
  viewInContacts: "View in Cozy Contacts",
3
4
  viewInDrive: "Open",
4
5
  modify: "Modify",
@@ -27,6 +28,7 @@ var en = {
27
28
  call: "Call"
28
29
  };
29
30
  var fr = {
31
+ menu: "Menu",
30
32
  viewInContacts: "Voir dans Cozy Contacts",
31
33
  viewInDrive: "Ouvrir",
32
34
  modify: "Modifier",
@@ -0,0 +1,5 @@
1
+ export default ActionsMenuButton;
2
+ declare function ActionsMenuButton({ docs, actions }: {
3
+ docs: any;
4
+ actions: any;
5
+ }): JSX.Element;
@@ -0,0 +1,49 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useState, useRef } from 'react';
3
+ import ActionsMenu from "cozy-ui/transpiled/react/ActionsMenu";
4
+ import { locales } from "cozy-ui/transpiled/react/ActionsMenu/Actions/locales/withActionsLocales";
5
+ import Icon from "cozy-ui/transpiled/react/Icon";
6
+ import IconButton from "cozy-ui/transpiled/react/IconButton";
7
+ import DotsIcon from "cozy-ui/transpiled/react/Icons/Dots";
8
+ import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
9
+ import { useI18n, useExtendI18n } from "cozy-ui/transpiled/react/providers/I18n";
10
+
11
+ var ActionsMenuButton = function ActionsMenuButton(_ref) {
12
+ var docs = _ref.docs,
13
+ actions = _ref.actions;
14
+
15
+ var _useState = useState(false),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ showActions = _useState2[0],
18
+ setShowActions = _useState2[1];
19
+
20
+ var actionsRef = useRef();
21
+ useExtendI18n(locales);
22
+
23
+ var _useI18n = useI18n(),
24
+ t = _useI18n.t;
25
+
26
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(IconButton, {
27
+ ref: actionsRef,
28
+ "arial-label": t('menu'),
29
+ onClick: function onClick() {
30
+ return setShowActions(true);
31
+ }
32
+ }, /*#__PURE__*/React.createElement(Icon, {
33
+ icon: DotsIcon
34
+ }))), showActions && /*#__PURE__*/React.createElement(ActionsMenu, {
35
+ open: true,
36
+ ref: actionsRef,
37
+ docs: docs,
38
+ actions: actions,
39
+ anchorOrigin: {
40
+ vertical: 'bottom',
41
+ horizontal: 'right'
42
+ },
43
+ onClose: function onClose() {
44
+ return setShowActions(false);
45
+ }
46
+ }));
47
+ };
48
+
49
+ export default ActionsMenuButton;
@@ -1,13 +1,6 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useRef, useState } from 'react';
1
+ import React from 'react';
3
2
  import ContactIdentity from "cozy-ui/transpiled/react/ContactsList/Contacts/ContactIdentity";
4
- import { locales } from "cozy-ui/transpiled/react/ContactsList/locales/withContactsListLocales";
5
- import ActionsMenu from "cozy-ui/transpiled/react/ActionsMenu";
6
- import Icon from "cozy-ui/transpiled/react/Icon";
7
- import IconButton from "cozy-ui/transpiled/react/IconButton";
8
- import DotsIcon from "cozy-ui/transpiled/react/Icons/Dots";
9
- import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
10
- import { useI18n, useExtendI18n } from "cozy-ui/transpiled/react/providers/I18n";
3
+ import ActionsMenuButton from "cozy-ui/transpiled/react/ActionsMenu/ActionsMenuButton";
11
4
 
12
5
  var Cell = function Cell(_ref) {
13
6
  var row = _ref.row,
@@ -15,18 +8,6 @@ var Cell = function Cell(_ref) {
15
8
  cell = _ref.cell,
16
9
  actions = _ref.actions;
17
10
 
18
- var _useState = useState(false),
19
- _useState2 = _slicedToArray(_useState, 2),
20
- showActions = _useState2[0],
21
- setShowActions = _useState2[1];
22
-
23
- useExtendI18n(locales);
24
-
25
- var _useI18n = useI18n(),
26
- t = _useI18n.t;
27
-
28
- var actionsRef = useRef();
29
-
30
11
  if (column.id === 'fullname') {
31
12
  return /*#__PURE__*/React.createElement(ContactIdentity, {
32
13
  contact: row,
@@ -39,27 +20,10 @@ var Cell = function Cell(_ref) {
39
20
  return null;
40
21
  }
41
22
 
42
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(IconButton, {
43
- ref: actionsRef,
44
- "arial-label": t('menu'),
45
- onClick: function onClick() {
46
- return setShowActions(true);
47
- }
48
- }, /*#__PURE__*/React.createElement(Icon, {
49
- icon: DotsIcon
50
- }))), showActions && /*#__PURE__*/React.createElement(ActionsMenu, {
51
- open: true,
52
- ref: actionsRef,
23
+ return /*#__PURE__*/React.createElement(ActionsMenuButton, {
53
24
  docs: [row],
54
- actions: actions,
55
- anchorOrigin: {
56
- vertical: 'bottom',
57
- horizontal: 'right'
58
- },
59
- onClose: function onClose() {
60
- return setShowActions(false);
61
- }
62
- }));
25
+ actions: actions
26
+ });
63
27
  }
64
28
 
65
29
  return cell;
@@ -1,14 +1,12 @@
1
1
  var en = {
2
2
  empty: "EMPTY",
3
3
  me: "me",
4
- favorite: "favorites",
5
- menu: "Menu"
4
+ favorite: "favorites"
6
5
  };
7
6
  var fr = {
8
7
  empty: "VIDE",
9
8
  me: "moi",
10
- favorite: "favoris",
11
- menu: "Menu"
9
+ favorite: "favoris"
12
10
  };
13
11
  import withOnlyLocales from "cozy-ui/transpiled/react/providers/I18n/withOnlyLocales";
14
12
  export var locales = {
@@ -294,7 +294,9 @@ export var FileImageLoader = /*#__PURE__*/function (_Component) {
294
294
 
295
295
  case 5:
296
296
  _context4.next = 7;
297
- return client.collection('io.cozy.files').getDownloadLinkById(this.getFileId(file), file.name);
297
+ return client.collection('io.cozy.files', {
298
+ driveId: file.driveId
299
+ }).getDownloadLinkById(this.getFileId(file), file.name);
298
300
 
299
301
  case 7:
300
302
  src = _context4.sent;