cozy-sharing 10.4.1 → 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 (86) 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 +27 -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/stylesheet.css +10 -10
  46. package/package.json +14 -4
  47. package/src/SharedRecipients.jsx +2 -2
  48. package/src/SharedStatus.jsx +2 -2
  49. package/src/SharingOwnerAvatar.jsx +2 -2
  50. package/src/components/{Recipient/RecipientsAvatars.jsx → Avatar/AvatarList.jsx} +12 -11
  51. package/src/components/{Recipient/RecipientsAvatars.spec.jsx → Avatar/AvatarList.spec.jsx} +12 -11
  52. package/src/components/Avatar/AvatarList.stories.jsx +16 -0
  53. package/src/components/{Recipient/AvatarPlusX.jsx → Avatar/ExtraAvatar.jsx} +4 -4
  54. package/src/components/Avatar/ExtraAvatar.stories.jsx +13 -0
  55. package/src/components/{Recipient/RecipientAvatar.jsx → Avatar/MemberAvatar.jsx} +2 -2
  56. package/src/components/Avatar/MemberAvatar.stories.jsx +18 -0
  57. package/src/components/ConfirmTrustedRecipientsDialog.jsx +2 -2
  58. package/src/components/{Recipient/RecipientPlusX.jsx → Identity/ExtraIdentity.jsx} +5 -5
  59. package/src/components/Identity/ExtraIdentity.stories.jsx +16 -0
  60. package/src/components/Identity/Identity.stories.jsx +16 -0
  61. package/src/components/{Recipient/RecipientWithoutStatus.jsx → Identity/MemberIdentity.jsx} +2 -2
  62. package/src/components/Identity/MemberIdentity.stories.jsx +13 -0
  63. package/src/components/Identity/OwnerIdentity.stories.jsx +13 -0
  64. package/src/components/Recipient/LinkRecipient.stories.jsx +17 -0
  65. package/src/components/Recipient/LinkRecipientPermissions.stories.jsx +13 -0
  66. package/src/components/Recipient/{Recipient.jsx → MemberRecipient.jsx} +14 -10
  67. package/src/components/Recipient/{Recipient.spec.jsx → MemberRecipient.spec.jsx} +3 -3
  68. package/src/components/Recipient/MemberRecipient.stories.jsx +44 -0
  69. package/src/components/Recipient/{RecipientPermissions.jsx → MemberRecipientPermissions.jsx} +2 -2
  70. package/src/components/Recipient/MemberRecipientPermissions.stories.jsx +13 -0
  71. package/src/components/Recipient/{RecipientStatus.jsx → MemberRecipientStatus.jsx} +2 -2
  72. package/src/components/Recipient/MemberRecipientStatus.stories.jsx +13 -0
  73. package/src/components/Recipient/OwnerRecipient.jsx +2 -2
  74. package/src/components/Recipient/OwnerRecipient.stories.jsx +16 -0
  75. package/src/components/Recipient/OwnerRecipientDefault.jsx +2 -2
  76. package/src/components/Recipient/OwnerRecipientDefault.stories.jsx +13 -0
  77. package/src/components/Recipient/RecipientConfirm.jsx +7 -9
  78. package/src/components/Recipient/RecipientConfirm.stories.jsx +13 -0
  79. package/src/components/Recipient/RecipientList.jsx +2 -2
  80. package/src/components/Recipient/RecipientList.stories.jsx +28 -0
  81. package/src/components/ShareModal/SharingDetailsModal.jsx +1 -1
  82. package/src/components/WhoHasAccessLight.jsx +4 -4
  83. /package/dist/components/{Recipient → Identity}/Identity.js +0 -0
  84. /package/dist/components/{Recipient → Identity}/OwnerIdentity.js +0 -0
  85. /package/src/components/{Recipient → Identity}/Identity.jsx +0 -0
  86. /package/src/components/{Recipient → Identity}/OwnerIdentity.jsx +0 -0
@@ -0,0 +1,30 @@
1
+ const recipients = [
2
+ {
3
+ status: 'owner',
4
+ public_name: 'Alice',
5
+ email: 'alice@cozy.localhost',
6
+ instance: 'http://alice.cozy.localhost:8080',
7
+ type: 'two-way',
8
+ index: 0
9
+ },
10
+ {
11
+ status: 'pending',
12
+ email: 'bob@cozy.localhost',
13
+ type: 'two-way',
14
+ index: 1
15
+ },
16
+ {
17
+ name: 'Paul',
18
+ status: 'mail-not-sent',
19
+ email: 'paul@cozy.localhost',
20
+ index: 2
21
+ },
22
+ {
23
+ name: 'Eve',
24
+ status: 'ready',
25
+ email: 'eve@cozy.localhost',
26
+ index: 2
27
+ }
28
+ ]
29
+
30
+ export { recipients }
@@ -0,0 +1,18 @@
1
+ const config = {
2
+ stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
3
+ addons: [
4
+ "@storybook/addon-links",
5
+ "@storybook/addon-essentials",
6
+ "@storybook/addon-interactions",
7
+ ],
8
+ framework: {
9
+ name: "@storybook/react-webpack5",
10
+ options: {},
11
+ },
12
+ docs: {
13
+ autodocs: true
14
+ },
15
+ staticDirs: ['./public'],
16
+ };
17
+
18
+ export default config;
@@ -0,0 +1,6 @@
1
+ import { addons } from '@storybook/manager-api';
2
+ import { themes } from '@storybook/theming';
3
+
4
+ addons.setConfig({
5
+ theme: themes.light,
6
+ });
@@ -0,0 +1,21 @@
1
+ <!-- This is the `head` of the preview iframe -->
2
+ <!-- Pull in static files served from your Static directory or the internet -->
3
+
4
+ <meta name="color-scheme" content="only light" />
5
+ <style>
6
+ @font-face {
7
+ font-family: Lato;
8
+ font-style: normal;
9
+ font-weight: normal;
10
+ src: url("/Lato-Regular.immutable.woff2") format("woff2");
11
+ font-display: fallback;
12
+ }
13
+
14
+ @font-face {
15
+ font-family: Lato;
16
+ font-style: normal;
17
+ font-weight: bold;
18
+ src: url("/Lato-Bold.immutable.woff2") format("woff2");
19
+ font-display: fallback;
20
+ }
21
+ </style>
@@ -0,0 +1,64 @@
1
+ import React from "react";
2
+
3
+ import 'cozy-ui/dist/cozy-ui.min.css'
4
+ import 'cozy-ui/dist/cozy-ui.utils.min.css'
5
+ import 'cozy-ui/transpiled/react/stylesheet.css'
6
+
7
+ import I18n from 'cozy-ui/transpiled/react/providers/I18n'
8
+ import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
9
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme'
10
+ import { CozyProvider, createFakeClient } from 'cozy-client'
11
+
12
+ import enLocale from '../locales/en.json'
13
+
14
+ const preview = {
15
+ decorators: [
16
+ (Story) => {
17
+ const fakeClient = createFakeClient({
18
+ queries: {
19
+ 'io.cozy.settings/instance': {
20
+ doctype: 'io.cozy.settings',
21
+ definition: {
22
+ doctype: 'io.cozy.settings',
23
+ id: 'io.cozy.settings/io.cozy.settings.instance'
24
+ },
25
+ data: [
26
+ {
27
+ id: 'io.cozy.settings/io.cozy.settings.instance',
28
+ attributes: {
29
+ public_name: 'Alice'
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ },
35
+ clientOptions: {
36
+ uri: 'http://alice.cozy.localhost:8080'
37
+ }
38
+ })
39
+ return (
40
+ <CozyProvider client={fakeClient}>
41
+ <CozyTheme>
42
+ <BreakpointsProvider>
43
+ <I18n lang="en" dictRequire={() => enLocale}>
44
+ <div style={{position: "relative"}}>
45
+ <Story />
46
+ </div>
47
+ </I18n>
48
+ </BreakpointsProvider>
49
+ </CozyTheme>
50
+ </CozyProvider>
51
+ )},
52
+ ],
53
+ parameters: {
54
+ actions: { argTypesRegex: "^on[A-Z].*" },
55
+ controls: {
56
+ matchers: {
57
+ color: /(background|color)$/i,
58
+ date: /Date$/,
59
+ },
60
+ },
61
+ },
62
+ };
63
+
64
+ export default preview;
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [11.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@10.4.1...cozy-sharing@11.0.0) (2024-03-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add missing args into stories ([3658ead](https://github.com/cozy/cozy-libs/commit/3658ead89344c20f59d4c8693522c73d40c20761))
12
+
13
+
14
+ ### Code Refactoring
15
+
16
+ * Rename RecipientsAvatars into AvatarList ([abef583](https://github.com/cozy/cozy-libs/commit/abef5830bf774855e39e8cf0149e26b49f53a367))
17
+
18
+
19
+ ### Features
20
+
21
+ * Add stories to recipient components ([b32f881](https://github.com/cozy/cozy-libs/commit/b32f881e031d61676097f94a2015227e99e1fb67))
22
+ * **sharing:** Add storybook ([fa7a028](https://github.com/cozy/cozy-libs/commit/fa7a0286ee18421ead00a061d9a1aa8f6d755978))
23
+
24
+
25
+ ### BREAKING CHANGES
26
+
27
+ * If you were importing RecipientsAvatars directly you should now use `import { AvatarList as RecipientsAvatars } from 'cozy-sharing/dist/components/Avatar/AvatarList'`
28
+
29
+
30
+
31
+
32
+
6
33
  ## [10.4.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@10.4.0...cozy-sharing@10.4.1) (2024-03-01)
7
34
 
8
35
 
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["docId", "onClick"];
4
4
  import React from 'react';
5
- import RecipientsAvatars from './components/Recipient/RecipientsAvatars';
5
+ import { AvatarList } from './components/Avatar/AvatarList';
6
6
  import SharingContext from './context';
7
7
  import withLocales from './hoc/withLocales';
8
8
  export var SharedRecipients = withLocales(function (_ref) {
@@ -17,7 +17,7 @@ export var SharedRecipients = withLocales(function (_ref) {
17
17
  getSharingLink = _ref2.getSharingLink,
18
18
  isOwner = _ref2.isOwner;
19
19
 
20
- return !byDocId || !byDocId[docId] ? null : /*#__PURE__*/React.createElement(RecipientsAvatars, _extends({
20
+ return !byDocId || !byDocId[docId] ? null : /*#__PURE__*/React.createElement(AvatarList, _extends({
21
21
  recipients: getRecipients(docId),
22
22
  link: getSharingLink(docId) !== null,
23
23
  onClick: onClick,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import RecipientsAvatars from './components/Recipient/RecipientsAvatars';
2
+ import { AvatarList } from './components/Avatar/AvatarList';
3
3
  import SharingContext from './context';
4
4
  import withLocales from './hoc/withLocales';
5
5
  export var SharedStatus = withLocales(function (_ref) {
@@ -17,7 +17,7 @@ export var SharedStatus = withLocales(function (_ref) {
17
17
 
18
18
  return !byDocId || !byDocId[docId] ? /*#__PURE__*/React.createElement("span", {
19
19
  className: className + ' ' + noSharedClassName
20
- }, "\u2014") : /*#__PURE__*/React.createElement(RecipientsAvatars, {
20
+ }, "\u2014") : /*#__PURE__*/React.createElement(AvatarList, {
21
21
  className: className,
22
22
  recipients: getRecipients(docId),
23
23
  link: getSharingLink(docId) !== null,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["docId"];
4
4
  import React from 'react';
5
- import RecipientAvatar from './components/Recipient/RecipientAvatar';
5
+ import { MemberAvatar } from './components/Avatar/MemberAvatar';
6
6
  import SharingContext from './context';
7
7
  import withLocales from './hoc/withLocales';
8
8
  export var SharingOwnerAvatar = withLocales(function (_ref) {
@@ -14,7 +14,7 @@ export var SharingOwnerAvatar = withLocales(function (_ref) {
14
14
  byDocId = _ref2.byDocId,
15
15
  getOwner = _ref2.getOwner;
16
16
 
17
- return !byDocId || !byDocId[docId] ? null : /*#__PURE__*/React.createElement(RecipientAvatar, _extends({
17
+ return !byDocId || !byDocId[docId] ? null : /*#__PURE__*/React.createElement(MemberAvatar, _extends({
18
18
  recipient: getOwner(docId)
19
19
  }, rest));
20
20
  });
@@ -4,8 +4,8 @@ import React from 'react';
4
4
  import { useClient } from 'cozy-client';
5
5
  import Avatar from 'cozy-ui/transpiled/react/Avatar';
6
6
  import LinkIcon from 'cozy-ui/transpiled/react/Icons/Link';
7
- import AvatarPlusX from './AvatarPlusX';
8
- import RecipientAvatar from './RecipientAvatar';
7
+ import { ExtraAvatar } from './ExtraAvatar';
8
+ import { MemberAvatar } from './MemberAvatar';
9
9
  import { getDisplayName } from '../../models';
10
10
  var styles = {
11
11
  "recipient": "recipient__recipient___2DmZI",
@@ -47,7 +47,7 @@ export var excludeMeAsOwnerFromRecipients = function excludeMeAsOwnerFromRecipie
47
47
  });
48
48
  };
49
49
 
50
- var RecipientsAvatars = function RecipientsAvatars(_ref2) {
50
+ var AvatarList = function AvatarList(_ref2) {
51
51
  var recipients = _ref2.recipients,
52
52
  link = _ref2.link,
53
53
  size = _ref2.size,
@@ -63,7 +63,7 @@ var RecipientsAvatars = function RecipientsAvatars(_ref2) {
63
63
  client: client
64
64
  }).reverse(); // we reverse the recipients array because we use `flex-direction: row-reverse` to display them correctly
65
65
 
66
- var isAvatarPlusX = filteredRecipients.length > MAX_DISPLAYED_RECIPIENTS;
66
+ var hasExtraRecipients = filteredRecipients.length > MAX_DISPLAYED_RECIPIENTS;
67
67
  var extraRecipients = filteredRecipients.slice(MAX_DISPLAYED_RECIPIENTS).map(function (recipient) {
68
68
  return getDisplayName(recipient);
69
69
  });
@@ -72,22 +72,22 @@ var RecipientsAvatars = function RecipientsAvatars(_ref2) {
72
72
  className: cx(styles['recipients-avatars'], _defineProperty({}, styles['--interactive'], onClick), className),
73
73
  onClick: onClick
74
74
  }, link && /*#__PURE__*/React.createElement("span", {
75
- "data-testid": "recipientsAvatars-link"
75
+ "data-testid": "AvatarList-link"
76
76
  }, /*#__PURE__*/React.createElement(Avatar, {
77
77
  className: styles['recipients-avatars--link'],
78
78
  icon: LinkIcon,
79
79
  size: size
80
- })), isAvatarPlusX && /*#__PURE__*/React.createElement("span", {
81
- "data-testid": "recipientsAvatars-plusX"
82
- }, /*#__PURE__*/React.createElement(AvatarPlusX, {
80
+ })), hasExtraRecipients && /*#__PURE__*/React.createElement("span", {
81
+ "data-testid": "AvatarList-plusX"
82
+ }, /*#__PURE__*/React.createElement(ExtraAvatar, {
83
83
  className: styles['recipients-avatars--plusX'],
84
84
  extraRecipients: extraRecipients,
85
85
  size: size
86
86
  })), shownRecipients.map(function (recipient, idx) {
87
87
  return /*#__PURE__*/React.createElement("span", {
88
- "data-testid": "recipientsAvatars-avatar".concat(recipient.status === 'owner' ? '-owner' : ''),
88
+ "data-testid": "AvatarList-avatar".concat(recipient.status === 'owner' ? '-owner' : ''),
89
89
  key: idx
90
- }, /*#__PURE__*/React.createElement(RecipientAvatar, {
90
+ }, /*#__PURE__*/React.createElement(MemberAvatar, {
91
91
  recipient: recipient,
92
92
  size: size,
93
93
  className: cx(styles['recipients-avatars--avatar'])
@@ -95,4 +95,4 @@ var RecipientsAvatars = function RecipientsAvatars(_ref2) {
95
95
  }));
96
96
  };
97
97
 
98
- export default RecipientsAvatars;
98
+ export { AvatarList };
@@ -5,7 +5,7 @@ var _excluded = ["recipients", "link", "isOwner", "onClick"];
5
5
  import { render } from '@testing-library/react';
6
6
  import React from 'react';
7
7
  import { createMockClient } from 'cozy-client';
8
- import RecipientsAvatars, { MAX_DISPLAYED_RECIPIENTS, excludeMeAsOwnerFromRecipients } from './RecipientsAvatars';
8
+ import { AvatarList, MAX_DISPLAYED_RECIPIENTS, excludeMeAsOwnerFromRecipients } from './AvatarList';
9
9
  import AppLike from '../../../test/AppLike';
10
10
  var mockRecipients = new Array(MAX_DISPLAYED_RECIPIENTS - 1).fill({
11
11
  status: 'owner',
@@ -24,7 +24,7 @@ var mockMoreRecipientsThanMaxDisplayed = [].concat(_toConsumableArray(mockRecipi
24
24
  status: 'ready',
25
25
  name: 'John Connor'
26
26
  }]);
27
- describe('RecipientsAvatars', function () {
27
+ describe('AvatarList', function () {
28
28
  var client = createMockClient({});
29
29
 
30
30
  var setup = function setup(_ref) {
@@ -42,7 +42,7 @@ describe('RecipientsAvatars', function () {
42
42
 
43
43
  return render( /*#__PURE__*/React.createElement(AppLike, {
44
44
  client: client
45
- }, /*#__PURE__*/React.createElement(RecipientsAvatars, _extends({
45
+ }, /*#__PURE__*/React.createElement(AvatarList, _extends({
46
46
  recipients: recipients,
47
47
  onClick: onClick,
48
48
  isOwner: isOwner,
@@ -56,19 +56,19 @@ describe('RecipientsAvatars', function () {
56
56
  }),
57
57
  getByTestId = _setup.getByTestId;
58
58
 
59
- expect(getByTestId('recipientsAvatars-link')).toBeTruthy();
59
+ expect(getByTestId('AvatarList-link')).toBeTruthy();
60
60
  });
61
61
  it('should not render link icon if a link is not generated', function () {
62
62
  var _setup2 = setup({}),
63
63
  queryByTestId = _setup2.queryByTestId;
64
64
 
65
- expect(queryByTestId('recipientsAvatars-link')).toBeNull();
65
+ expect(queryByTestId('AvatarList-link')).toBeNull();
66
66
  });
67
67
  it('should hide me as owner by default', function () {
68
68
  var _setup3 = setup({}),
69
69
  queryByTestId = _setup3.queryByTestId;
70
70
 
71
- expect(queryByTestId('recipientsAvatars-avatar-owner')).toBeNull();
71
+ expect(queryByTestId('AvatarList-avatar-owner')).toBeNull();
72
72
  });
73
73
  it('should show me as owner if required', function () {
74
74
  var _setup4 = setup({
@@ -76,7 +76,7 @@ describe('RecipientsAvatars', function () {
76
76
  }),
77
77
  getByTestId = _setup4.getByTestId;
78
78
 
79
- expect(getByTestId('recipientsAvatars-avatar-owner')).toBeTruthy();
79
+ expect(getByTestId('AvatarList-avatar-owner')).toBeTruthy();
80
80
  });
81
81
  it('should show a +X icon with the correct number if there is more avatars than expected', function () {
82
82
  var _setup5 = setup({
@@ -87,7 +87,7 @@ describe('RecipientsAvatars', function () {
87
87
  getByText = _setup5.getByText;
88
88
 
89
89
  var delta = mockMoreRecipientsThanMaxDisplayed.length - MAX_DISPLAYED_RECIPIENTS;
90
- expect(getByTestId('recipientsAvatars-plusX')).toBeTruthy();
90
+ expect(getByTestId('AvatarList-plusX')).toBeTruthy();
91
91
  expect(getByText("+".concat(delta))).toBeTruthy();
92
92
  });
93
93
  it('should show both +X and link icon if necessary', function () {
@@ -98,8 +98,8 @@ describe('RecipientsAvatars', function () {
98
98
  }),
99
99
  getByTestId = _setup6.getByTestId;
100
100
 
101
- expect(getByTestId('recipientsAvatars-plusX')).toBeTruthy();
102
- expect(getByTestId('recipientsAvatars-link')).toBeTruthy();
101
+ expect(getByTestId('AvatarList-plusX')).toBeTruthy();
102
+ expect(getByTestId('AvatarList-link')).toBeTruthy();
103
103
  });
104
104
  });
105
105
  describe('excludeMeAsOwnerFromRecipients', function () {
@@ -0,0 +1,14 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { AvatarList } from './AvatarList';
3
+ import { recipients } from '../../../.storybook/fixtures/recipients';
4
+ var meta = {
5
+ component: AvatarList,
6
+ args: {
7
+ recipients: [].concat(_toConsumableArray(recipients), _toConsumableArray(recipients))
8
+ }
9
+ };
10
+ export default meta;
11
+ export var Default = {
12
+ name: 'Default',
13
+ args: {}
14
+ };
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import Avatar from 'cozy-ui/transpiled/react/Avatar';
5
5
  import { SharingTooltip, TooltipRecipientList } from '../Tooltip';
6
6
 
7
- var AvatarPlusX = function AvatarPlusX(_ref) {
7
+ var ExtraAvatar = function ExtraAvatar(_ref) {
8
8
  var className = _ref.className,
9
9
  size = _ref.size,
10
10
  _ref$extraRecipients = _ref.extraRecipients,
@@ -29,13 +29,13 @@ var AvatarPlusX = function AvatarPlusX(_ref) {
29
29
  })));
30
30
  };
31
31
 
32
- AvatarPlusX.propTypes = {
32
+ ExtraAvatar.propTypes = {
33
33
  extraRecipients: PropTypes.arrayOf(PropTypes.string),
34
34
  size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
35
35
  className: PropTypes.string
36
36
  };
37
- AvatarPlusX.defaultProps = {
37
+ ExtraAvatar.defaultProps = {
38
38
  extraRecipients: [],
39
39
  size: 'medium'
40
40
  };
41
- export default AvatarPlusX;
41
+ export { ExtraAvatar };
@@ -0,0 +1,10 @@
1
+ import { ExtraAvatar } from './ExtraAvatar';
2
+ var meta = {
3
+ component: ExtraAvatar,
4
+ args: {}
5
+ };
6
+ export default meta;
7
+ export var Default = {
8
+ name: 'Default',
9
+ args: {}
10
+ };
@@ -6,7 +6,7 @@ import { useClient } from 'cozy-client';
6
6
  import Avatar from 'cozy-ui/transpiled/react/Avatar';
7
7
  import { getDisplayName, getInitials } from '../../models';
8
8
 
9
- var RecipientAvatar = function RecipientAvatar(_ref) {
9
+ var MemberAvatar = function MemberAvatar(_ref) {
10
10
  var recipient = _ref.recipient,
11
11
  rest = _objectWithoutProperties(_ref, _excluded);
12
12
 
@@ -30,4 +30,4 @@ var RecipientAvatar = function RecipientAvatar(_ref) {
30
30
  }, rest));
31
31
  };
32
32
 
33
- export default RecipientAvatar;
33
+ export { MemberAvatar };
@@ -0,0 +1,15 @@
1
+ import { MemberAvatar } from './MemberAvatar';
2
+ var meta = {
3
+ component: MemberAvatar,
4
+ args: {
5
+ recipient: {
6
+ avatarPath: null,
7
+ name: 'John Doe'
8
+ }
9
+ }
10
+ };
11
+ export default meta;
12
+ export var Default = {
13
+ name: 'Default',
14
+ args: {}
15
+ };
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import React from 'react';
4
4
  import Typography from 'cozy-ui/transpiled/react/Typography';
5
5
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
6
- import Recipient from './Recipient/Recipient';
6
+ import MemberRecipient from './Recipient/MemberRecipient';
7
7
  import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer';
8
8
  /**
9
9
  * Displays the sharing interface that can be used when ConfirmTrustedRecipientsDialog is in sharing state
@@ -20,7 +20,7 @@ var SharingContent = function SharingContent(_ref) {
20
20
  variant: "body1",
21
21
  className: "u-mb-2"
22
22
  }, t("ConfirmRecipientModal.intruction")), recipientsToBeConfirmed.map(function (recipientConfirmationData) {
23
- return /*#__PURE__*/React.createElement(Recipient, _extends({}, recipientConfirmationData, {
23
+ return /*#__PURE__*/React.createElement(MemberRecipient, _extends({}, recipientConfirmationData, {
24
24
  key: "key_r_".concat(recipientConfirmationData.id),
25
25
  isOwner: false,
26
26
  recipientConfirmationData: recipientConfirmationData,
@@ -1,6 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import AvatarPlusX from './AvatarPlusX';
4
3
  import Identity from './Identity';
5
4
  import { getDisplayName } from '../../models';
6
5
  var styles = {
@@ -20,13 +19,14 @@ var styles = {
20
19
  "spin": "recipient__spin___2tYv3",
21
20
  "shake": "recipient__shake___TGyPp"
22
21
  };
22
+ import { ExtraAvatar } from '../Avatar/ExtraAvatar';
23
23
 
24
- var RecipientPlusX = function RecipientPlusX(_ref, _ref2) {
24
+ var ExtraIdentity = function ExtraIdentity(_ref, _ref2) {
25
25
  var extraRecipients = _ref.extraRecipients;
26
26
  var t = _ref2.t;
27
27
  return /*#__PURE__*/React.createElement("div", {
28
28
  className: styles['recipient']
29
- }, /*#__PURE__*/React.createElement(AvatarPlusX, {
29
+ }, /*#__PURE__*/React.createElement(ExtraAvatar, {
30
30
  extraRecipients: extraRecipients.map(function (recipient) {
31
31
  return getDisplayName(recipient);
32
32
  })
@@ -37,7 +37,7 @@ var RecipientPlusX = function RecipientPlusX(_ref, _ref2) {
37
37
  })));
38
38
  };
39
39
 
40
- RecipientPlusX.contextTypes = {
40
+ ExtraIdentity.contextTypes = {
41
41
  t: PropTypes.func.isRequired
42
42
  };
43
- export default RecipientPlusX;
43
+ export { ExtraIdentity };
@@ -0,0 +1,13 @@
1
+ import { ExtraIdentity } from './ExtraIdentity';
2
+ import { recipients } from '../../../.storybook/fixtures/recipients';
3
+ var meta = {
4
+ component: ExtraIdentity,
5
+ args: {
6
+ extraRecipients: recipients
7
+ }
8
+ };
9
+ export default meta;
10
+ export var Default = {
11
+ name: 'Default',
12
+ args: {}
13
+ };
@@ -0,0 +1,13 @@
1
+ import Identity from './Identity';
2
+ var meta = {
3
+ title: 'Components/Identity/Identity',
4
+ component: Identity,
5
+ args: {}
6
+ };
7
+ export default meta;
8
+ export var Default = {
9
+ name: 'Default',
10
+ args: {
11
+ name: 'John Doe'
12
+ }
13
+ };
@@ -22,7 +22,7 @@ var styles = {
22
22
  "shake": "recipient__shake___TGyPp"
23
23
  };
24
24
 
25
- var RecipientWithoutStatus = function RecipientWithoutStatus(_ref) {
25
+ var MemberIdentity = function MemberIdentity(_ref) {
26
26
  var instance = _ref.instance,
27
27
  rest = _objectWithoutProperties(_ref, _excluded);
28
28
 
@@ -40,4 +40,4 @@ var RecipientWithoutStatus = function RecipientWithoutStatus(_ref) {
40
40
  })));
41
41
  };
42
42
 
43
- export default RecipientWithoutStatus;
43
+ export { MemberIdentity };
@@ -0,0 +1,10 @@
1
+ import { MemberIdentity } from './MemberIdentity';
2
+ var meta = {
3
+ component: MemberIdentity,
4
+ args: {}
5
+ };
6
+ export default meta;
7
+ export var Default = {
8
+ name: 'Default',
9
+ args: {}
10
+ };
@@ -0,0 +1,10 @@
1
+ import OwnerIdentity from './OwnerIdentity';
2
+ var meta = {
3
+ component: OwnerIdentity,
4
+ args: {}
5
+ };
6
+ export default meta;
7
+ export var Default = {
8
+ name: 'Default',
9
+ args: {}
10
+ };
@@ -0,0 +1,16 @@
1
+ import LinkRecipient from './LinkRecipient';
2
+ var meta = {
3
+ component: LinkRecipient,
4
+ args: {
5
+ recipientConfirmationData: false,
6
+ verifyRecipient: function verifyRecipient() {
7
+ return true;
8
+ },
9
+ link: 'test',
10
+ fadeIn: false
11
+ }
12
+ };
13
+ export default meta;
14
+ export var Default = {
15
+ name: 'Default'
16
+ };
@@ -0,0 +1,10 @@
1
+ import LinkRecipientPermissions from './LinkRecipientPermissions';
2
+ var meta = {
3
+ component: LinkRecipientPermissions,
4
+ args: {}
5
+ };
6
+ export default meta;
7
+ export var Default = {
8
+ name: 'Default',
9
+ args: {}
10
+ };