cozy-sharing 4.6.1 → 4.7.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
@@ -3,6 +3,22 @@
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
+ # [4.7.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.6.1...cozy-sharing@4.7.0) (2022-11-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **SharingProvider:** Wait until all request finish to rise allLoaded ([05b14c4](https://github.com/cozy/cozy-libs/commit/05b14c4af3b572c919f944a3b2b5ef5ec7b51257))
12
+
13
+
14
+ ### Features
15
+
16
+ * Add ShareButtonWithRecipients ([b1f99b3](https://github.com/cozy/cozy-libs/commit/b1f99b3f3ea6ed00b3c11e87042434239c83d94d))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [4.6.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.6.0...cozy-sharing@4.6.1) (2022-11-14)
7
23
 
8
24
  **Note:** Version bump only for package cozy-sharing
@@ -0,0 +1,41 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["docId", "onClick"];
4
+ import React from 'react';
5
+ import { ShareButton } from './ShareButton';
6
+ import { SharedRecipients } from './SharedRecipients';
7
+ import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints';
8
+ import SharingContext from './context';
9
+ import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid';
10
+ import Skeleton from 'cozy-ui/transpiled/react/Skeleton';
11
+ export var ShareButtonWithRecipients = function ShareButtonWithRecipients(_ref) {
12
+ var docId = _ref.docId,
13
+ onClick = _ref.onClick,
14
+ props = _objectWithoutProperties(_ref, _excluded);
15
+
16
+ var _useBreakpoints = useBreakpoints(),
17
+ isMobile = _useBreakpoints.isMobile;
18
+
19
+ return /*#__PURE__*/React.createElement(SharingContext.Consumer, null, function (_ref2) {
20
+ var allLoaded = _ref2.allLoaded;
21
+ return allLoaded ? /*#__PURE__*/React.createElement(Grid, {
22
+ container: true,
23
+ alignItems: "center",
24
+ className: "u-w-auto"
25
+ }, !isMobile && /*#__PURE__*/React.createElement(Grid, {
26
+ item: true
27
+ }, /*#__PURE__*/React.createElement(SharedRecipients, {
28
+ docId: docId,
29
+ onClick: onClick,
30
+ size: 32
31
+ })), /*#__PURE__*/React.createElement(Grid, {
32
+ item: true
33
+ }, /*#__PURE__*/React.createElement(ShareButton, _extends({
34
+ docId: docId,
35
+ onClick: onClick
36
+ }, props)))) : /*#__PURE__*/React.createElement(Skeleton, {
37
+ width: 120,
38
+ animation: "wave"
39
+ });
40
+ });
41
+ };
@@ -636,18 +636,15 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
636
636
  hasLoadedAtLeastOnePage: true
637
637
  }); // eslint-disable-next-line promise/catch-or-return
638
638
 
639
- fetchNextPermissions(permissions, this.dispatch, this.permissionCol).then(this.setState({
640
- allLoaded: true
641
- }));
639
+ _context12.next = 12;
640
+ return fetchNextPermissions(permissions, this.dispatch, this.permissionCol);
642
641
 
643
- if (!(doctype !== 'io.cozy.files')) {
644
- _context12.next = 13;
642
+ case 12:
643
+ if (!(doctype === 'io.cozy.files')) {
644
+ _context12.next = 22;
645
645
  break;
646
646
  }
647
647
 
648
- return _context12.abrupt("return");
649
-
650
- case 13:
651
648
  sharedDocIds = getSharedDocIdsBySharings(sharings);
652
649
  _context12.next = 16;
653
650
  return client.collection(doctype).all({
@@ -671,6 +668,11 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
671
668
  this.dispatch(receivePaths([].concat(_toConsumableArray(folderPaths), _toConsumableArray(filePaths))));
672
669
 
673
670
  case 22:
671
+ this.setState({
672
+ allLoaded: true
673
+ });
674
+
675
+ case 23:
674
676
  case "end":
675
677
  return _context12.stop();
676
678
  }
package/dist/index.js CHANGED
@@ -16,4 +16,5 @@ export { useFetchDocumentPath } from './components/useFetchDocumentPath';
16
16
  export { CozyPassFingerprintDialogContent } from './components/CozyPassFingerprintDialogContent';
17
17
  export { SharingBannerPlugin } from './SharingBanner';
18
18
  export { useSharingInfos } from './SharingBanner/hooks/useSharingInfos';
19
- export { ConfirmTrustedRecipientsDialog } from './ConfirmTrustedRecipientsDialog';
19
+ export { ConfirmTrustedRecipientsDialog } from './ConfirmTrustedRecipientsDialog';
20
+ export { ShareButtonWithRecipients } from './ShareButtonWithRecipients';
@@ -800,6 +800,7 @@ html {
800
800
  --borderGhostDisabledColor: rgba(255,255,255,0.24);
801
801
  --paperBackgroundColor: #297ef2;
802
802
  --defaultBackgroundColor: #579eff;
803
+ --contrastBackgroundColor: rgba(255,255,255,0.12);
803
804
  --primaryColorLight: #fff;
804
805
  --primaryColor: #fff;
805
806
  --primaryColorDark: #eaf3ff;
@@ -829,8 +830,9 @@ html {
829
830
  The CSS variables below are historic and we should strive not to
830
831
  use them. Prefer to use directly semantic colors above.
831
832
  */
832
- --iconColor: var(--secondaryTextColor);
833
+ --iconColor: currentColor;
833
834
  --textIconColor: #fff;
835
+ --actionMenuIconColor: #fff;
834
836
  --barIconColor: #fff;
835
837
  --barIconColorDisabled: rgba(255,255,255,0.88);
836
838
  --spinnerColor: #fff;
@@ -988,12 +990,14 @@ html,
988
990
  Stylus: primaryBackgroundLight - #F7FAFF, CSS: var(--primaryBackgroundLight)
989
991
  Stylus: paperBackgroundColor - #FFF, CSS: var(--paperBackgroundColor)
990
992
  Stylus: defaultBackgroundColor - #F4F5F6, CSS: var(--defaultBackgroundColor)
993
+ Stylus: contrastBackgroundColor - #F5F5F6, CSS: var(--contrastBackgroundColor)
991
994
 
992
995
  Styleguide Settings.theme.background
993
996
  */
994
997
  --primaryBackgroundLight: #f7faff;
995
998
  --paperBackgroundColor: #fff;
996
999
  --defaultBackgroundColor: #f4f5f6;
1000
+ --contrastBackgroundColor: rgba(29,33,42,0.048);
997
1001
  /*
998
1002
  Text colors
999
1003
 
@@ -1914,6 +1918,7 @@ input[type=text] {
1914
1918
  --borderGhostDisabledColor: rgba(255,255,255,0.24);
1915
1919
  --paperBackgroundColor: #297ef2;
1916
1920
  --defaultBackgroundColor: #579eff;
1921
+ --contrastBackgroundColor: rgba(255,255,255,0.12);
1917
1922
  --primaryColorLight: #fff;
1918
1923
  --primaryColor: #fff;
1919
1924
  --primaryColorDark: #eaf3ff;
@@ -1943,8 +1948,9 @@ input[type=text] {
1943
1948
  The CSS variables below are historic and we should strive not to
1944
1949
  use them. Prefer to use directly semantic colors above.
1945
1950
  */
1946
- --iconColor: var(--secondaryTextColor);
1951
+ --iconColor: currentColor;
1947
1952
  --textIconColor: #fff;
1953
+ --actionMenuIconColor: #fff;
1948
1954
  --barIconColor: #fff;
1949
1955
  --barIconColorDisabled: rgba(255,255,255,0.88);
1950
1956
  --spinnerColor: #fff;
@@ -2102,12 +2108,14 @@ html,
2102
2108
  Stylus: primaryBackgroundLight - #F7FAFF, CSS: var(--primaryBackgroundLight)
2103
2109
  Stylus: paperBackgroundColor - #FFF, CSS: var(--paperBackgroundColor)
2104
2110
  Stylus: defaultBackgroundColor - #F4F5F6, CSS: var(--defaultBackgroundColor)
2111
+ Stylus: contrastBackgroundColor - #F5F5F6, CSS: var(--contrastBackgroundColor)
2105
2112
 
2106
2113
  Styleguide Settings.theme.background
2107
2114
  */
2108
2115
  --primaryBackgroundLight: #f7faff;
2109
2116
  --paperBackgroundColor: #fff;
2110
2117
  --defaultBackgroundColor: #f4f5f6;
2118
+ --contrastBackgroundColor: rgba(29,33,42,0.048);
2111
2119
  /*
2112
2120
  Text colors
2113
2121
 
@@ -2395,6 +2403,7 @@ html,
2395
2403
  --borderGhostDisabledColor: rgba(255,255,255,0.24);
2396
2404
  --paperBackgroundColor: #297ef2;
2397
2405
  --defaultBackgroundColor: #579eff;
2406
+ --contrastBackgroundColor: rgba(255,255,255,0.12);
2398
2407
  --primaryColorLight: #fff;
2399
2408
  --primaryColor: #fff;
2400
2409
  --primaryColorDark: #eaf3ff;
@@ -2424,8 +2433,9 @@ html,
2424
2433
  The CSS variables below are historic and we should strive not to
2425
2434
  use them. Prefer to use directly semantic colors above.
2426
2435
  */
2427
- --iconColor: var(--secondaryTextColor);
2436
+ --iconColor: currentColor;
2428
2437
  --textIconColor: #fff;
2438
+ --actionMenuIconColor: #fff;
2429
2439
  --barIconColor: #fff;
2430
2440
  --barIconColorDisabled: rgba(255,255,255,0.88);
2431
2441
  --spinnerColor: #fff;
@@ -2583,12 +2593,14 @@ html,
2583
2593
  Stylus: primaryBackgroundLight - #F7FAFF, CSS: var(--primaryBackgroundLight)
2584
2594
  Stylus: paperBackgroundColor - #FFF, CSS: var(--paperBackgroundColor)
2585
2595
  Stylus: defaultBackgroundColor - #F4F5F6, CSS: var(--defaultBackgroundColor)
2596
+ Stylus: contrastBackgroundColor - #F5F5F6, CSS: var(--contrastBackgroundColor)
2586
2597
 
2587
2598
  Styleguide Settings.theme.background
2588
2599
  */
2589
2600
  --primaryBackgroundLight: #f7faff;
2590
2601
  --paperBackgroundColor: #fff;
2591
2602
  --defaultBackgroundColor: #f4f5f6;
2603
+ --contrastBackgroundColor: rgba(29,33,42,0.048);
2592
2604
  /*
2593
2605
  Text colors
2594
2606
 
@@ -2883,6 +2895,7 @@ html {
2883
2895
  --borderGhostDisabledColor: rgba(255,255,255,0.24);
2884
2896
  --paperBackgroundColor: #297ef2;
2885
2897
  --defaultBackgroundColor: #579eff;
2898
+ --contrastBackgroundColor: rgba(255,255,255,0.12);
2886
2899
  --primaryColorLight: #fff;
2887
2900
  --primaryColor: #fff;
2888
2901
  --primaryColorDark: #eaf3ff;
@@ -2912,8 +2925,9 @@ html {
2912
2925
  The CSS variables below are historic and we should strive not to
2913
2926
  use them. Prefer to use directly semantic colors above.
2914
2927
  */
2915
- --iconColor: var(--secondaryTextColor);
2928
+ --iconColor: currentColor;
2916
2929
  --textIconColor: #fff;
2930
+ --actionMenuIconColor: #fff;
2917
2931
  --barIconColor: #fff;
2918
2932
  --barIconColorDisabled: rgba(255,255,255,0.88);
2919
2933
  --spinnerColor: #fff;
@@ -3071,12 +3085,14 @@ html,
3071
3085
  Stylus: primaryBackgroundLight - #F7FAFF, CSS: var(--primaryBackgroundLight)
3072
3086
  Stylus: paperBackgroundColor - #FFF, CSS: var(--paperBackgroundColor)
3073
3087
  Stylus: defaultBackgroundColor - #F4F5F6, CSS: var(--defaultBackgroundColor)
3088
+ Stylus: contrastBackgroundColor - #F5F5F6, CSS: var(--contrastBackgroundColor)
3074
3089
 
3075
3090
  Styleguide Settings.theme.background
3076
3091
  */
3077
3092
  --primaryBackgroundLight: #f7faff;
3078
3093
  --paperBackgroundColor: #fff;
3079
3094
  --defaultBackgroundColor: #f4f5f6;
3095
+ --contrastBackgroundColor: rgba(29,33,42,0.048);
3080
3096
  /*
3081
3097
  Text colors
3082
3098
 
@@ -3300,6 +3316,7 @@ html,
3300
3316
  --borderGhostDisabledColor: rgba(255,255,255,0.24);
3301
3317
  --paperBackgroundColor: #297ef2;
3302
3318
  --defaultBackgroundColor: #579eff;
3319
+ --contrastBackgroundColor: rgba(255,255,255,0.12);
3303
3320
  --primaryColorLight: #fff;
3304
3321
  --primaryColor: #fff;
3305
3322
  --primaryColorDark: #eaf3ff;
@@ -3329,8 +3346,9 @@ html,
3329
3346
  The CSS variables below are historic and we should strive not to
3330
3347
  use them. Prefer to use directly semantic colors above.
3331
3348
  */
3332
- --iconColor: var(--secondaryTextColor);
3349
+ --iconColor: currentColor;
3333
3350
  --textIconColor: #fff;
3351
+ --actionMenuIconColor: #fff;
3334
3352
  --barIconColor: #fff;
3335
3353
  --barIconColorDisabled: rgba(255,255,255,0.88);
3336
3354
  --spinnerColor: #fff;
@@ -3488,12 +3506,14 @@ html,
3488
3506
  Stylus: primaryBackgroundLight - #F7FAFF, CSS: var(--primaryBackgroundLight)
3489
3507
  Stylus: paperBackgroundColor - #FFF, CSS: var(--paperBackgroundColor)
3490
3508
  Stylus: defaultBackgroundColor - #F4F5F6, CSS: var(--defaultBackgroundColor)
3509
+ Stylus: contrastBackgroundColor - #F5F5F6, CSS: var(--contrastBackgroundColor)
3491
3510
 
3492
3511
  Styleguide Settings.theme.background
3493
3512
  */
3494
3513
  --primaryBackgroundLight: #f7faff;
3495
3514
  --paperBackgroundColor: #fff;
3496
3515
  --defaultBackgroundColor: #f4f5f6;
3516
+ --contrastBackgroundColor: rgba(29,33,42,0.048);
3497
3517
  /*
3498
3518
  Text colors
3499
3519
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "4.6.1",
3
+ "version": "4.7.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -37,12 +37,11 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@babel/core": "7.16.12",
40
- "@material-ui/core": "4.12.3",
41
40
  "babel-jest": "26.6.3",
42
41
  "babel-plugin-css-modules-transform": "1.6.2",
43
42
  "babel-plugin-inline-react-svg": "1.1.2",
44
43
  "cozy-client": "34.1.0",
45
- "cozy-ui": "62.1.2",
44
+ "cozy-ui": "77.6.0",
46
45
  "enzyme": "3.11.0",
47
46
  "enzyme-adapter-react-16": "1.15.6",
48
47
  "enzyme-to-json": "3.6.2",
@@ -52,10 +51,9 @@
52
51
  "react-router": "^5.0.1"
53
52
  },
54
53
  "peerDependencies": {
55
- "@material-ui/core": "4",
56
54
  "cozy-client": "^34.1.0",
57
55
  "cozy-realtime": "^3.11.0",
58
- "cozy-ui": "^45.1.0",
56
+ "cozy-ui": ">=77.6.0",
59
57
  "prop-types": "^15.7.2",
60
58
  "react": "^16.12.0",
61
59
  "react-router": "^5.0.1"
@@ -63,5 +61,5 @@
63
61
  "sideEffects": [
64
62
  "*.css"
65
63
  ],
66
- "gitHead": "bf1c3b7b74f13f770cb978fc0879935575790482"
64
+ "gitHead": "c5a7a80ded9e8c0aae431449453744c51daa3c3f"
67
65
  }
@@ -0,0 +1,32 @@
1
+ import React from 'react'
2
+ import { ShareButton } from './ShareButton'
3
+ import { SharedRecipients } from './SharedRecipients'
4
+ import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
5
+ import SharingContext from './context'
6
+ import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
7
+ import Skeleton from 'cozy-ui/transpiled/react/Skeleton'
8
+
9
+ export const ShareButtonWithRecipients = ({ docId, onClick, ...props }) => {
10
+ const { isMobile } = useBreakpoints()
11
+
12
+ return (
13
+ <SharingContext.Consumer>
14
+ {({ allLoaded }) => {
15
+ return allLoaded ? (
16
+ <Grid container alignItems="center" className="u-w-auto">
17
+ {!isMobile && (
18
+ <Grid item>
19
+ <SharedRecipients docId={docId} onClick={onClick} size={32} />
20
+ </Grid>
21
+ )}
22
+ <Grid item>
23
+ <ShareButton docId={docId} onClick={onClick} {...props} />
24
+ </Grid>
25
+ </Grid>
26
+ ) : (
27
+ <Skeleton width={120} animation="wave" />
28
+ )
29
+ }}
30
+ </SharingContext.Consumer>
31
+ )
32
+ }
@@ -186,22 +186,24 @@ export class SharingProvider extends Component {
186
186
  )
187
187
  this.setState({ hasLoadedAtLeastOnePage: true })
188
188
  // eslint-disable-next-line promise/catch-or-return
189
- fetchNextPermissions(permissions, this.dispatch, this.permissionCol).then(
190
- this.setState({ allLoaded: true })
191
- )
192
- if (doctype !== 'io.cozy.files') return
193
- const sharedDocIds = getSharedDocIdsBySharings(sharings)
194
- const resp = await client.collection(doctype).all({ keys: sharedDocIds })
195
- const folderPaths = resp.data
196
- .filter(f => f.type === 'directory' && !f.trashed)
197
- .map(f => f.path)
198
- const filePaths = await fetchFilesPaths(
199
- client,
200
- doctype,
201
- resp.data.filter(f => f.type !== 'directory' && !f.trashed)
202
- )
189
+ await fetchNextPermissions(permissions, this.dispatch, this.permissionCol)
190
+
191
+ if (doctype === 'io.cozy.files') {
192
+ const sharedDocIds = getSharedDocIdsBySharings(sharings)
193
+ const resp = await client.collection(doctype).all({ keys: sharedDocIds })
194
+ const folderPaths = resp.data
195
+ .filter(f => f.type === 'directory' && !f.trashed)
196
+ .map(f => f.path)
197
+ const filePaths = await fetchFilesPaths(
198
+ client,
199
+ doctype,
200
+ resp.data.filter(f => f.type !== 'directory' && !f.trashed)
201
+ )
202
+
203
+ this.dispatch(receivePaths([...folderPaths, ...filePaths]))
204
+ }
203
205
 
204
- this.dispatch(receivePaths([...folderPaths, ...filePaths]))
206
+ this.setState({ allLoaded: true })
205
207
  }
206
208
 
207
209
  share = async ({
package/src/index.jsx CHANGED
@@ -20,3 +20,4 @@ export { CozyPassFingerprintDialogContent } from './components/CozyPassFingerpri
20
20
  export { SharingBannerPlugin } from './SharingBanner'
21
21
  export { useSharingInfos } from './SharingBanner/hooks/useSharingInfos'
22
22
  export { ConfirmTrustedRecipientsDialog } from './ConfirmTrustedRecipientsDialog'
23
+ export { ShareButtonWithRecipients } from './ShareButtonWithRecipients'