cozy-sharing 36.0.0 → 36.1.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 +12 -0
- package/dist/components/ShareAutosuggest.js +6 -1
- package/dist/components/ShareByEmail.js +3 -0
- package/dist/components/ShareRecipientsInput.js +3 -0
- package/dist/components/SharedDrive/SharedDriveForm.js +4 -0
- package/dist/state.js +2 -2
- package/dist/state.spec.js +12 -0
- package/package.json +2 -2
- package/src/components/ShareAutosuggest.jsx +7 -1
- package/src/components/ShareByEmail.jsx +3 -0
- package/src/components/ShareRecipientsInput.jsx +3 -0
- package/src/components/SharedDrive/SharedDriveForm.jsx +4 -0
- package/src/state.js +2 -2
- package/src/state.spec.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
# [36.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@36.0.1...cozy-sharing@36.1.0) (2026-06-30)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **cozy-sharing:** ShareAutosuggest can now be autofocus false ([fabac23](https://github.com/cozy/cozy-libs/commit/fabac23c23cdd041d4bd70f0adaa99a974caf33d))
|
|
11
|
+
|
|
12
|
+
## [36.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@36.0.0...cozy-sharing@36.0.1) (2026-06-29)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **sharing:** Guard shared-path helpers against undefined path ([0365f75](https://github.com/cozy/cozy-libs/commit/0365f755ce4b4125250eb883658912ec05b77253))
|
|
17
|
+
|
|
6
18
|
# [36.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@35.0.0...cozy-sharing@36.0.0) (2026-06-25)
|
|
7
19
|
|
|
8
20
|
### Features
|
|
@@ -34,6 +34,7 @@ var ShareAutosuggest = function ShareAutosuggest(_ref) {
|
|
|
34
34
|
onRemove = _ref.onRemove,
|
|
35
35
|
enableCreateContact = _ref.enableCreateContact,
|
|
36
36
|
placeholder = _ref.placeholder,
|
|
37
|
+
autoFocus = _ref.autoFocus,
|
|
37
38
|
endAdornment = _ref.endAdornment;
|
|
38
39
|
|
|
39
40
|
var _useState = useState(''),
|
|
@@ -229,7 +230,7 @@ var ShareAutosuggest = function ShareAutosuggest(_ref) {
|
|
|
229
230
|
renderInputComponent: renderInput,
|
|
230
231
|
highlightFirstSuggestion: true,
|
|
231
232
|
inputProps: {
|
|
232
|
-
autoFocus:
|
|
233
|
+
autoFocus: autoFocus,
|
|
233
234
|
onFocus: onAutosuggestFocus,
|
|
234
235
|
onChange: onAutosuggestChange,
|
|
235
236
|
onPaste: onAutosuggestPaste,
|
|
@@ -243,6 +244,9 @@ var ShareAutosuggest = function ShareAutosuggest(_ref) {
|
|
|
243
244
|
}));
|
|
244
245
|
};
|
|
245
246
|
|
|
247
|
+
ShareAutosuggest.defaultProps = {
|
|
248
|
+
autoFocus: true
|
|
249
|
+
};
|
|
246
250
|
ShareAutosuggest.propTypes = {
|
|
247
251
|
loading: PropTypes.bool,
|
|
248
252
|
disabled: PropTypes.bool,
|
|
@@ -252,6 +256,7 @@ ShareAutosuggest.propTypes = {
|
|
|
252
256
|
onRemove: PropTypes.func.isRequired,
|
|
253
257
|
enableCreateContact: PropTypes.bool,
|
|
254
258
|
placeholder: PropTypes.string,
|
|
259
|
+
autoFocus: PropTypes.bool,
|
|
255
260
|
endAdornment: PropTypes.node
|
|
256
261
|
};
|
|
257
262
|
export default ShareAutosuggest;
|
|
@@ -34,6 +34,7 @@ export var ShareByEmail = function ShareByEmail(_ref) {
|
|
|
34
34
|
selectedOption = _ref.selectedOption,
|
|
35
35
|
onSelectedOptionChange = _ref.onSelectedOptionChange,
|
|
36
36
|
enableCreateContact = _ref.enableCreateContact,
|
|
37
|
+
autoFocus = _ref.autoFocus,
|
|
37
38
|
sharing = _ref.sharing;
|
|
38
39
|
|
|
39
40
|
var _useI18n = useI18n(),
|
|
@@ -75,6 +76,7 @@ export var ShareByEmail = function ShareByEmail(_ref) {
|
|
|
75
76
|
enableCreateContact: enableCreateContact,
|
|
76
77
|
currentRecipients: currentRecipients,
|
|
77
78
|
recipients: pendingRecipients,
|
|
79
|
+
autoFocus: autoFocus,
|
|
78
80
|
endAdornment: /*#__PURE__*/React.createElement(ShareTypeSelect, {
|
|
79
81
|
value: selectedOption,
|
|
80
82
|
options: getSharingOptions(),
|
|
@@ -91,6 +93,7 @@ ShareByEmail.propTypes = {
|
|
|
91
93
|
selectedOption: PropTypes.oneOf(['readWrite', 'readOnly']).isRequired,
|
|
92
94
|
onSelectedOptionChange: PropTypes.func.isRequired,
|
|
93
95
|
enableCreateContact: PropTypes.bool,
|
|
96
|
+
autoFocus: PropTypes.bool,
|
|
94
97
|
sharing: PropTypes.object
|
|
95
98
|
};
|
|
96
99
|
export default ShareByEmail;
|
|
@@ -32,6 +32,7 @@ var ShareRecipientsInput = function ShareRecipientsInput(_ref) {
|
|
|
32
32
|
onRemove = _ref.onRemove,
|
|
33
33
|
enableCreateContact = _ref.enableCreateContact,
|
|
34
34
|
disabled = _ref.disabled,
|
|
35
|
+
autoFocus = _ref.autoFocus,
|
|
35
36
|
endAdornment = _ref.endAdornment;
|
|
36
37
|
var reachableContactsQuery = buildReachableContactsQuery();
|
|
37
38
|
var reachableContactsResult = useQueryAll(reachableContactsQuery.definition, reachableContactsQuery.options);
|
|
@@ -93,6 +94,7 @@ var ShareRecipientsInput = function ShareRecipientsInput(_ref) {
|
|
|
93
94
|
onRemove: onRemove,
|
|
94
95
|
enableCreateContact: enableCreateContact,
|
|
95
96
|
placeholder: placeholder,
|
|
97
|
+
autoFocus: autoFocus,
|
|
96
98
|
endAdornment: endAdornment
|
|
97
99
|
});
|
|
98
100
|
};
|
|
@@ -105,6 +107,7 @@ ShareRecipientsInput.propTypes = {
|
|
|
105
107
|
onRemove: PropTypes.func.isRequired,
|
|
106
108
|
enableCreateContact: PropTypes.bool,
|
|
107
109
|
disabled: PropTypes.bool,
|
|
110
|
+
autoFocus: PropTypes.bool,
|
|
108
111
|
endAdornment: PropTypes.node
|
|
109
112
|
};
|
|
110
113
|
ShareRecipientsInput.defaultProps = {
|
|
@@ -13,6 +13,7 @@ var ShareByEmailSection = /*#__PURE__*/memo(function ShareByEmailSection(_ref) {
|
|
|
13
13
|
var pendingRecipients = _ref.pendingRecipients,
|
|
14
14
|
setPendingRecipients = _ref.setPendingRecipients,
|
|
15
15
|
selectedOption = _ref.selectedOption,
|
|
16
|
+
autoFocus = _ref.autoFocus,
|
|
16
17
|
setSelectedOption = _ref.setSelectedOption;
|
|
17
18
|
return /*#__PURE__*/React.createElement(DumbShareByEmail, {
|
|
18
19
|
currentRecipients: [],
|
|
@@ -20,6 +21,7 @@ var ShareByEmailSection = /*#__PURE__*/memo(function ShareByEmailSection(_ref) {
|
|
|
20
21
|
pendingRecipients: pendingRecipients,
|
|
21
22
|
onPendingRecipientsChange: setPendingRecipients,
|
|
22
23
|
selectedOption: selectedOption,
|
|
24
|
+
autoFocus: autoFocus,
|
|
23
25
|
onSelectedOptionChange: setSelectedOption
|
|
24
26
|
});
|
|
25
27
|
});
|
|
@@ -54,6 +56,7 @@ export var SharedDriveForm = withLocales(function (_ref2) {
|
|
|
54
56
|
size: "small",
|
|
55
57
|
className: "u-w-100 u-mt-1-half u-mb-1-half",
|
|
56
58
|
value: sharedDriveName,
|
|
59
|
+
autoFocus: true,
|
|
57
60
|
onChange: handleSharedDriveNameChange
|
|
58
61
|
}), /*#__PURE__*/React.createElement(Typography, {
|
|
59
62
|
variant: "h6",
|
|
@@ -62,6 +65,7 @@ export var SharedDriveForm = withLocales(function (_ref2) {
|
|
|
62
65
|
pendingRecipients: pendingRecipients,
|
|
63
66
|
setPendingRecipients: setPendingRecipients,
|
|
64
67
|
selectedOption: selectedOption,
|
|
68
|
+
autoFocus: false,
|
|
65
69
|
setSelectedOption: setSelectedOption
|
|
66
70
|
})), /*#__PURE__*/React.createElement("div", {
|
|
67
71
|
className: "u-flex u-ph-2 u-pv-1"
|
package/dist/state.js
CHANGED
|
@@ -621,7 +621,7 @@ var getApps = function getApps(state) {
|
|
|
621
621
|
};
|
|
622
622
|
|
|
623
623
|
export var hasSharedParent = function hasSharedParent(state, documentPath) {
|
|
624
|
-
if (!state.sharedPaths) {
|
|
624
|
+
if (!state.sharedPaths || !documentPath) {
|
|
625
625
|
return false; // hasSharedParent should not occur
|
|
626
626
|
}
|
|
627
627
|
|
|
@@ -630,7 +630,7 @@ export var hasSharedParent = function hasSharedParent(state, documentPath) {
|
|
|
630
630
|
});
|
|
631
631
|
};
|
|
632
632
|
export var hasSharedChild = function hasSharedChild(state, documentPath) {
|
|
633
|
-
if (!state.sharedPaths) {
|
|
633
|
+
if (!state.sharedPaths || !documentPath) {
|
|
634
634
|
return false; // hasSharedChild should not occur
|
|
635
635
|
}
|
|
636
636
|
|
package/dist/state.spec.js
CHANGED
|
@@ -574,6 +574,12 @@ describe('hasSharedParent helper', function () {
|
|
|
574
574
|
var result = hasSharedParent(state, documentPath);
|
|
575
575
|
expect(result).toBe(false);
|
|
576
576
|
});
|
|
577
|
+
it('should return false when documentPath is undefined', function () {
|
|
578
|
+
var state = {
|
|
579
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
580
|
+
};
|
|
581
|
+
expect(hasSharedParent(state, undefined)).toBe(false);
|
|
582
|
+
});
|
|
577
583
|
});
|
|
578
584
|
describe('hasSharedChild helper', function () {
|
|
579
585
|
it('returns true if a child is shared', function () {
|
|
@@ -592,6 +598,12 @@ describe('hasSharedChild helper', function () {
|
|
|
592
598
|
var result = hasSharedChild(state, documentPath);
|
|
593
599
|
expect(result).toBe(false);
|
|
594
600
|
});
|
|
601
|
+
it('should return false when documentPath is undefined', function () {
|
|
602
|
+
var state = {
|
|
603
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
604
|
+
};
|
|
605
|
+
expect(hasSharedChild(state, undefined)).toBe(false);
|
|
606
|
+
});
|
|
595
607
|
});
|
|
596
608
|
describe('getSharedDocIdsBySharings method', function () {
|
|
597
609
|
it('should test getSharedDocIdsBySharings', function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.1.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"sideEffects": [
|
|
86
86
|
"*.css"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "ff906a03f2a106d0ce4509bf988ce1aea628a333"
|
|
89
89
|
}
|
|
@@ -23,6 +23,7 @@ const ShareAutosuggest = ({
|
|
|
23
23
|
onRemove,
|
|
24
24
|
enableCreateContact,
|
|
25
25
|
placeholder,
|
|
26
|
+
autoFocus,
|
|
26
27
|
endAdornment
|
|
27
28
|
}) => {
|
|
28
29
|
const [inputValue, setInputValue] = useState('')
|
|
@@ -201,7 +202,7 @@ const ShareAutosuggest = ({
|
|
|
201
202
|
renderInputComponent={renderInput}
|
|
202
203
|
highlightFirstSuggestion
|
|
203
204
|
inputProps={{
|
|
204
|
-
autoFocus
|
|
205
|
+
autoFocus,
|
|
205
206
|
onFocus: onAutosuggestFocus,
|
|
206
207
|
onChange: onAutosuggestChange,
|
|
207
208
|
onPaste: onAutosuggestPaste,
|
|
@@ -217,6 +218,10 @@ const ShareAutosuggest = ({
|
|
|
217
218
|
)
|
|
218
219
|
}
|
|
219
220
|
|
|
221
|
+
ShareAutosuggest.defaultProps = {
|
|
222
|
+
autoFocus: true
|
|
223
|
+
}
|
|
224
|
+
|
|
220
225
|
ShareAutosuggest.propTypes = {
|
|
221
226
|
loading: PropTypes.bool,
|
|
222
227
|
disabled: PropTypes.bool,
|
|
@@ -226,6 +231,7 @@ ShareAutosuggest.propTypes = {
|
|
|
226
231
|
onRemove: PropTypes.func.isRequired,
|
|
227
232
|
enableCreateContact: PropTypes.bool,
|
|
228
233
|
placeholder: PropTypes.string,
|
|
234
|
+
autoFocus: PropTypes.bool,
|
|
229
235
|
endAdornment: PropTypes.node
|
|
230
236
|
}
|
|
231
237
|
|
|
@@ -22,6 +22,7 @@ export const ShareByEmail = ({
|
|
|
22
22
|
selectedOption,
|
|
23
23
|
onSelectedOptionChange,
|
|
24
24
|
enableCreateContact,
|
|
25
|
+
autoFocus,
|
|
25
26
|
sharing
|
|
26
27
|
}) => {
|
|
27
28
|
const { t } = useI18n()
|
|
@@ -70,6 +71,7 @@ export const ShareByEmail = ({
|
|
|
70
71
|
enableCreateContact={enableCreateContact}
|
|
71
72
|
currentRecipients={currentRecipients}
|
|
72
73
|
recipients={pendingRecipients}
|
|
74
|
+
autoFocus={autoFocus}
|
|
73
75
|
endAdornment={
|
|
74
76
|
<ShareTypeSelect
|
|
75
77
|
value={selectedOption}
|
|
@@ -92,6 +94,7 @@ ShareByEmail.propTypes = {
|
|
|
92
94
|
selectedOption: PropTypes.oneOf(['readWrite', 'readOnly']).isRequired,
|
|
93
95
|
onSelectedOptionChange: PropTypes.func.isRequired,
|
|
94
96
|
enableCreateContact: PropTypes.bool,
|
|
97
|
+
autoFocus: PropTypes.bool,
|
|
95
98
|
sharing: PropTypes.object
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -30,6 +30,7 @@ const ShareRecipientsInput = ({
|
|
|
30
30
|
onRemove,
|
|
31
31
|
enableCreateContact,
|
|
32
32
|
disabled,
|
|
33
|
+
autoFocus,
|
|
33
34
|
endAdornment
|
|
34
35
|
}) => {
|
|
35
36
|
const reachableContactsQuery = buildReachableContactsQuery()
|
|
@@ -128,6 +129,7 @@ const ShareRecipientsInput = ({
|
|
|
128
129
|
onRemove={onRemove}
|
|
129
130
|
enableCreateContact={enableCreateContact}
|
|
130
131
|
placeholder={placeholder}
|
|
132
|
+
autoFocus={autoFocus}
|
|
131
133
|
endAdornment={endAdornment}
|
|
132
134
|
/>
|
|
133
135
|
)
|
|
@@ -141,6 +143,7 @@ ShareRecipientsInput.propTypes = {
|
|
|
141
143
|
onRemove: PropTypes.func.isRequired,
|
|
142
144
|
enableCreateContact: PropTypes.bool,
|
|
143
145
|
disabled: PropTypes.bool,
|
|
146
|
+
autoFocus: PropTypes.bool,
|
|
144
147
|
endAdornment: PropTypes.node
|
|
145
148
|
}
|
|
146
149
|
|
|
@@ -16,6 +16,7 @@ const ShareByEmailSection = memo(function ShareByEmailSection({
|
|
|
16
16
|
pendingRecipients,
|
|
17
17
|
setPendingRecipients,
|
|
18
18
|
selectedOption,
|
|
19
|
+
autoFocus,
|
|
19
20
|
setSelectedOption
|
|
20
21
|
}) {
|
|
21
22
|
return (
|
|
@@ -25,6 +26,7 @@ const ShareByEmailSection = memo(function ShareByEmailSection({
|
|
|
25
26
|
pendingRecipients={pendingRecipients}
|
|
26
27
|
onPendingRecipientsChange={setPendingRecipients}
|
|
27
28
|
selectedOption={selectedOption}
|
|
29
|
+
autoFocus={autoFocus}
|
|
28
30
|
onSelectedOptionChange={setSelectedOption}
|
|
29
31
|
/>
|
|
30
32
|
)
|
|
@@ -54,6 +56,7 @@ export const SharedDriveForm = withLocales(({ onSuccess, onCancel }) => {
|
|
|
54
56
|
size="small"
|
|
55
57
|
className="u-w-100 u-mt-1-half u-mb-1-half"
|
|
56
58
|
value={sharedDriveName}
|
|
59
|
+
autoFocus
|
|
57
60
|
onChange={handleSharedDriveNameChange}
|
|
58
61
|
/>
|
|
59
62
|
<Typography variant="h6" className="u-mb-half">
|
|
@@ -63,6 +66,7 @@ export const SharedDriveForm = withLocales(({ onSuccess, onCancel }) => {
|
|
|
63
66
|
pendingRecipients={pendingRecipients}
|
|
64
67
|
setPendingRecipients={setPendingRecipients}
|
|
65
68
|
selectedOption={selectedOption}
|
|
69
|
+
autoFocus={false}
|
|
66
70
|
setSelectedOption={setSelectedOption}
|
|
67
71
|
/>
|
|
68
72
|
</div>
|
package/src/state.js
CHANGED
|
@@ -506,14 +506,14 @@ const getPermissionById = (state, id) =>
|
|
|
506
506
|
const getApps = state => state.apps
|
|
507
507
|
|
|
508
508
|
export const hasSharedParent = (state, documentPath) => {
|
|
509
|
-
if (!state.sharedPaths) {
|
|
509
|
+
if (!state.sharedPaths || !documentPath) {
|
|
510
510
|
return false // hasSharedParent should not occur
|
|
511
511
|
}
|
|
512
512
|
return state.sharedPaths.some(path => documentPath.indexOf(`${path}/`) === 0)
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
export const hasSharedChild = (state, documentPath) => {
|
|
516
|
-
if (!state.sharedPaths) {
|
|
516
|
+
if (!state.sharedPaths || !documentPath) {
|
|
517
517
|
return false // hasSharedChild should not occur
|
|
518
518
|
}
|
|
519
519
|
const ret = state.sharedPaths.some(
|
package/src/state.spec.js
CHANGED
|
@@ -739,6 +739,13 @@ describe('hasSharedParent helper', () => {
|
|
|
739
739
|
const result = hasSharedParent(state, documentPath)
|
|
740
740
|
expect(result).toBe(false)
|
|
741
741
|
})
|
|
742
|
+
|
|
743
|
+
it('should return false when documentPath is undefined', () => {
|
|
744
|
+
const state = {
|
|
745
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
746
|
+
}
|
|
747
|
+
expect(hasSharedParent(state, undefined)).toBe(false)
|
|
748
|
+
})
|
|
742
749
|
})
|
|
743
750
|
|
|
744
751
|
describe('hasSharedChild helper', () => {
|
|
@@ -759,6 +766,13 @@ describe('hasSharedChild helper', () => {
|
|
|
759
766
|
const result = hasSharedChild(state, documentPath)
|
|
760
767
|
expect(result).toBe(false)
|
|
761
768
|
})
|
|
769
|
+
|
|
770
|
+
it('should return false when documentPath is undefined', () => {
|
|
771
|
+
const state = {
|
|
772
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
773
|
+
}
|
|
774
|
+
expect(hasSharedChild(state, undefined)).toBe(false)
|
|
775
|
+
})
|
|
762
776
|
})
|
|
763
777
|
|
|
764
778
|
describe('getSharedDocIdsBySharings method', () => {
|