cozy-sharing 10.4.0 → 11.0.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.
Files changed (90) hide show
  1. package/.storybook/fixtures/recipients.js +30 -0
  2. package/.storybook/main.js +18 -0
  3. package/.storybook/manager.js +6 -0
  4. package/.storybook/preview-head.html +21 -0
  5. package/.storybook/preview.jsx +64 -0
  6. package/.storybook/public/Lato-Bold.immutable.woff2 +0 -0
  7. package/.storybook/public/Lato-Regular.immutable.woff2 +0 -0
  8. package/CHANGELOG.md +38 -0
  9. package/dist/SharedRecipients.js +2 -2
  10. package/dist/SharedStatus.js +2 -2
  11. package/dist/SharingOwnerAvatar.js +2 -2
  12. package/dist/components/{Recipient/RecipientsAvatars.js → Avatar/AvatarList.js} +11 -11
  13. package/dist/components/{Recipient/RecipientsAvatars.spec.js → Avatar/AvatarList.spec.js} +10 -10
  14. package/dist/components/Avatar/AvatarList.stories.js +14 -0
  15. package/dist/components/{Recipient/AvatarPlusX.js → Avatar/ExtraAvatar.js} +4 -4
  16. package/dist/components/Avatar/ExtraAvatar.stories.js +10 -0
  17. package/dist/components/{Recipient/RecipientAvatar.js → Avatar/MemberAvatar.js} +2 -2
  18. package/dist/components/Avatar/MemberAvatar.stories.js +15 -0
  19. package/dist/components/ConfirmTrustedRecipientsDialog.js +2 -2
  20. package/dist/components/{Recipient/RecipientPlusX.js → Identity/ExtraIdentity.js} +5 -5
  21. package/dist/components/Identity/ExtraIdentity.stories.js +13 -0
  22. package/dist/components/Identity/Identity.stories.js +13 -0
  23. package/dist/components/{Recipient/RecipientWithoutStatus.js → Identity/MemberIdentity.js} +2 -2
  24. package/dist/components/Identity/MemberIdentity.stories.js +10 -0
  25. package/dist/components/Identity/OwnerIdentity.stories.js +10 -0
  26. package/dist/components/Recipient/LinkRecipient.stories.js +16 -0
  27. package/dist/components/Recipient/LinkRecipientPermissions.stories.js +10 -0
  28. package/dist/components/Recipient/{Recipient.js → MemberRecipient.js} +9 -9
  29. package/dist/components/Recipient/{Recipient.spec.js → MemberRecipient.spec.js} +3 -3
  30. package/dist/components/Recipient/MemberRecipient.stories.js +39 -0
  31. package/dist/components/Recipient/{RecipientPermissions.js → MemberRecipientPermissions.js} +2 -2
  32. package/dist/components/Recipient/MemberRecipientPermissions.stories.js +10 -0
  33. package/dist/components/Recipient/{RecipientStatus.js → MemberRecipientStatus.js} +2 -2
  34. package/dist/components/Recipient/MemberRecipientStatus.stories.js +10 -0
  35. package/dist/components/Recipient/OwnerRecipient.js +2 -2
  36. package/dist/components/Recipient/OwnerRecipient.stories.js +13 -0
  37. package/dist/components/Recipient/OwnerRecipientDefault.js +2 -2
  38. package/dist/components/Recipient/OwnerRecipientDefault.stories.js +10 -0
  39. package/dist/components/Recipient/RecipientConfirm.js +2 -2
  40. package/dist/components/Recipient/RecipientConfirm.stories.js +10 -0
  41. package/dist/components/Recipient/RecipientList.js +2 -2
  42. package/dist/components/Recipient/RecipientList.stories.js +26 -0
  43. package/dist/components/ShareModal/SharingDetailsModal.js +1 -1
  44. package/dist/components/WhoHasAccessLight.js +4 -4
  45. package/dist/helpers/files.js +10 -0
  46. package/dist/hooks/useFetchDocumentPath.js +18 -8
  47. package/dist/stylesheet.css +10 -10
  48. package/package.json +16 -5
  49. package/src/SharedRecipients.jsx +2 -2
  50. package/src/SharedStatus.jsx +2 -2
  51. package/src/SharingOwnerAvatar.jsx +2 -2
  52. package/src/components/{Recipient/RecipientsAvatars.jsx → Avatar/AvatarList.jsx} +12 -11
  53. package/src/components/{Recipient/RecipientsAvatars.spec.jsx → Avatar/AvatarList.spec.jsx} +12 -11
  54. package/src/components/Avatar/AvatarList.stories.jsx +16 -0
  55. package/src/components/{Recipient/AvatarPlusX.jsx → Avatar/ExtraAvatar.jsx} +4 -4
  56. package/src/components/Avatar/ExtraAvatar.stories.jsx +13 -0
  57. package/src/components/{Recipient/RecipientAvatar.jsx → Avatar/MemberAvatar.jsx} +2 -2
  58. package/src/components/Avatar/MemberAvatar.stories.jsx +18 -0
  59. package/src/components/ConfirmTrustedRecipientsDialog.jsx +2 -2
  60. package/src/components/{Recipient/RecipientPlusX.jsx → Identity/ExtraIdentity.jsx} +5 -5
  61. package/src/components/Identity/ExtraIdentity.stories.jsx +16 -0
  62. package/src/components/Identity/Identity.stories.jsx +16 -0
  63. package/src/components/{Recipient/RecipientWithoutStatus.jsx → Identity/MemberIdentity.jsx} +2 -2
  64. package/src/components/Identity/MemberIdentity.stories.jsx +13 -0
  65. package/src/components/Identity/OwnerIdentity.stories.jsx +13 -0
  66. package/src/components/Recipient/LinkRecipient.stories.jsx +17 -0
  67. package/src/components/Recipient/LinkRecipientPermissions.stories.jsx +13 -0
  68. package/src/components/Recipient/{Recipient.jsx → MemberRecipient.jsx} +14 -10
  69. package/src/components/Recipient/{Recipient.spec.jsx → MemberRecipient.spec.jsx} +3 -3
  70. package/src/components/Recipient/MemberRecipient.stories.jsx +44 -0
  71. package/src/components/Recipient/{RecipientPermissions.jsx → MemberRecipientPermissions.jsx} +2 -2
  72. package/src/components/Recipient/MemberRecipientPermissions.stories.jsx +13 -0
  73. package/src/components/Recipient/{RecipientStatus.jsx → MemberRecipientStatus.jsx} +2 -2
  74. package/src/components/Recipient/MemberRecipientStatus.stories.jsx +13 -0
  75. package/src/components/Recipient/OwnerRecipient.jsx +2 -2
  76. package/src/components/Recipient/OwnerRecipient.stories.jsx +16 -0
  77. package/src/components/Recipient/OwnerRecipientDefault.jsx +2 -2
  78. package/src/components/Recipient/OwnerRecipientDefault.stories.jsx +13 -0
  79. package/src/components/Recipient/RecipientConfirm.jsx +7 -9
  80. package/src/components/Recipient/RecipientConfirm.stories.jsx +13 -0
  81. package/src/components/Recipient/RecipientList.jsx +2 -2
  82. package/src/components/Recipient/RecipientList.stories.jsx +28 -0
  83. package/src/components/ShareModal/SharingDetailsModal.jsx +1 -1
  84. package/src/components/WhoHasAccessLight.jsx +4 -4
  85. package/src/helpers/files.js +9 -0
  86. package/src/hooks/useFetchDocumentPath.jsx +4 -0
  87. /package/dist/components/{Recipient → Identity}/Identity.js +0 -0
  88. /package/dist/components/{Recipient → Identity}/OwnerIdentity.js +0 -0
  89. /package/src/components/{Recipient → Identity}/Identity.jsx +0 -0
  90. /package/src/components/{Recipient → Identity}/OwnerIdentity.jsx +0 -0
@@ -0,0 +1,28 @@
1
+ import { RecipientList } from './RecipientList'
2
+ import { recipients } from '../../../.storybook/fixtures/recipients'
3
+
4
+ const meta = {
5
+ component: RecipientList,
6
+ args: {
7
+ recipients,
8
+ recipientsToBeConfirmed: [],
9
+ isOwner: false,
10
+ onRevoke: () => {},
11
+ onRevokeSelf: () => {},
12
+ verifyRecipient: () => true
13
+ }
14
+ }
15
+
16
+ export default meta
17
+
18
+ export const Default = {
19
+ name: 'Default',
20
+ args: {}
21
+ }
22
+
23
+ export const Owner = {
24
+ name: 'Owner',
25
+ args: {
26
+ isOwner: true
27
+ }
28
+ }
@@ -7,7 +7,7 @@ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
7
7
 
8
8
  import { getDisplayName } from '../../models'
9
9
  import styles from '../../styles/share.styl'
10
- import OwnerIdentity from '../Recipient/OwnerIdentity'
10
+ import OwnerIdentity from '../Identity/OwnerIdentity'
11
11
  import WhoHasAccess from '../WhoHasAccess'
12
12
 
13
13
  export const SharingDetailsModal = ({
@@ -1,8 +1,8 @@
1
1
  import cx from 'classnames'
2
2
  import React from 'react'
3
3
 
4
- import RecipientPlusX from './Recipient/RecipientPlusX'
5
- import RecipientWithoutStatus from './Recipient/RecipientWithoutStatus'
4
+ import { ExtraIdentity } from './Identity/ExtraIdentity'
5
+ import { MemberIdentity } from './Identity/MemberIdentity'
6
6
  import styles from '../styles/recipient.styl'
7
7
 
8
8
  const MAX_DISPLAYED_RECIPIENTS = 2
@@ -10,10 +10,10 @@ const MAX_DISPLAYED_RECIPIENTS = 2
10
10
  const WhoHasAccessLight = ({ recipients, className }) => (
11
11
  <div className={cx(styles['recipients-list-light'], className)}>
12
12
  {recipients.slice(0, MAX_DISPLAYED_RECIPIENTS).map((recipient, index) => (
13
- <RecipientWithoutStatus {...recipient} key={`key_recipient__${index}`} />
13
+ <MemberIdentity {...recipient} key={`key_recipient__${index}`} />
14
14
  ))}
15
15
  {recipients.length > MAX_DISPLAYED_RECIPIENTS && (
16
- <RecipientPlusX
16
+ <ExtraIdentity
17
17
  extraRecipients={recipients.slice(MAX_DISPLAYED_RECIPIENTS)}
18
18
  />
19
19
  )}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Fetches the file paths for the given files.
3
+ * Should not be used for directories.
4
+ *
5
+ * @param {Object} client - The cozy-client instance.
6
+ * @param {string} doctype - The type of document.
7
+ * @param {Array} files - The array of files.
8
+ * @returns {Promise<Array>} - The array of file paths.
9
+ */
1
10
  export const fetchFilesPaths = async (client, doctype, files) => {
2
11
  const parentDirIds = files
3
12
  .map(f => f.dir_id)
@@ -9,6 +9,10 @@ export const useFetchDocumentPath = (client, document) => {
9
9
  useEffect(() => {
10
10
  ;(async () => {
11
11
  try {
12
+ const isDirectory = document.type === 'directory'
13
+
14
+ if (isDirectory) return setDocumentPath(document.path)
15
+
12
16
  const path = await fetchFilesPaths(client, document._type, [document])
13
17
  setDocumentPath(path[0])
14
18
  // eslint-disable-next-line