cozy-sharing 30.2.2 → 30.3.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,12 @@
|
|
|
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
|
+
# [30.3.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@30.2.2...cozy-sharing@30.3.0) (2026-04-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **cozy-sharing:** Auto-scroll highlighted suggestion into view ([8a367f7](https://github.com/cozy/cozy-libs/commit/8a367f73e36c9cce98cd492845faaf04ec4d1771))
|
|
11
|
+
|
|
6
12
|
## [30.2.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@30.2.1...cozy-sharing@30.2.2) (2026-04-22)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package cozy-sharing
|
|
@@ -53,6 +53,7 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
|
|
|
53
53
|
setLoadingDisplayed = _useState8[1];
|
|
54
54
|
|
|
55
55
|
var autosuggestRef = useRef(null);
|
|
56
|
+
var containerRef = useRef(null);
|
|
56
57
|
|
|
57
58
|
var computeSuggestions = function computeSuggestions(value) {
|
|
58
59
|
var inputValue = value.trim().toLowerCase();
|
|
@@ -151,6 +152,19 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
|
|
|
151
152
|
autosuggestRef === null || autosuggestRef === void 0 || (_autosuggestRef$curre2 = autosuggestRef.current) === null || _autosuggestRef$curre2 === void 0 || (_autosuggestRef$curre2 = _autosuggestRef$curre2.input) === null || _autosuggestRef$curre2 === void 0 || _autosuggestRef$curre2.focus();
|
|
152
153
|
};
|
|
153
154
|
|
|
155
|
+
var onSuggestionHighlighted = function onSuggestionHighlighted() {
|
|
156
|
+
requestAnimationFrame(function () {
|
|
157
|
+
if (!containerRef.current) return;
|
|
158
|
+
var highlighted = containerRef.current.querySelector('[aria-selected="true"]');
|
|
159
|
+
|
|
160
|
+
if (highlighted) {
|
|
161
|
+
highlighted.scrollIntoView({
|
|
162
|
+
block: 'nearest'
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
154
168
|
var renderInput = function renderInput(inputProps) {
|
|
155
169
|
return /*#__PURE__*/React.createElement("div", {
|
|
156
170
|
className: styles['recipientsContainer']
|
|
@@ -186,7 +200,9 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
|
|
|
186
200
|
});
|
|
187
201
|
};
|
|
188
202
|
|
|
189
|
-
return /*#__PURE__*/React.createElement(
|
|
203
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
ref: containerRef
|
|
205
|
+
}, /*#__PURE__*/React.createElement(Autosuggest, {
|
|
190
206
|
ref: autosuggestRef,
|
|
191
207
|
theme: styles,
|
|
192
208
|
suggestions: suggestions.slice(0, 20),
|
|
@@ -195,6 +211,7 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
|
|
|
195
211
|
},
|
|
196
212
|
onSuggestionsFetchRequested: onSuggestionsFetchRequested,
|
|
197
213
|
onSuggestionsClearRequested: onSuggestionsClearRequested,
|
|
214
|
+
onSuggestionHighlighted: onSuggestionHighlighted,
|
|
198
215
|
renderSuggestion: renderSuggestion,
|
|
199
216
|
renderInputComponent: renderInput,
|
|
200
217
|
highlightFirstSuggestion: true,
|
|
@@ -209,7 +226,7 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
|
|
|
209
226
|
className: styles['suggestionInput'],
|
|
210
227
|
disabled: disabled
|
|
211
228
|
}
|
|
212
|
-
});
|
|
229
|
+
}));
|
|
213
230
|
};
|
|
214
231
|
|
|
215
232
|
ShareAutocomplete.propTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "30.
|
|
3
|
+
"version": "30.3.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sideEffects": [
|
|
85
85
|
"*.css"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "8b1c0aece9584d82862592b6ab6e5579fa30be19"
|
|
88
88
|
}
|
|
@@ -33,6 +33,7 @@ const ShareAutocomplete = ({
|
|
|
33
33
|
const [isLoadingDisplayed, setLoadingDisplayed] = useState(false)
|
|
34
34
|
|
|
35
35
|
const autosuggestRef = useRef(null)
|
|
36
|
+
const containerRef = useRef(null)
|
|
36
37
|
|
|
37
38
|
const computeSuggestions = value => {
|
|
38
39
|
const inputValue = value.trim().toLowerCase()
|
|
@@ -138,6 +139,18 @@ const ShareAutocomplete = ({
|
|
|
138
139
|
autosuggestRef?.current?.input?.focus()
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
const onSuggestionHighlighted = () => {
|
|
143
|
+
requestAnimationFrame(() => {
|
|
144
|
+
if (!containerRef.current) return
|
|
145
|
+
const highlighted = containerRef.current.querySelector(
|
|
146
|
+
'[aria-selected="true"]'
|
|
147
|
+
)
|
|
148
|
+
if (highlighted) {
|
|
149
|
+
highlighted.scrollIntoView({ block: 'nearest' })
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
|
|
141
154
|
const renderInput = inputProps => (
|
|
142
155
|
<div className={styles['recipientsContainer']}>
|
|
143
156
|
{recipients.map((recipient, idx) => {
|
|
@@ -175,28 +188,31 @@ const ShareAutocomplete = ({
|
|
|
175
188
|
)
|
|
176
189
|
|
|
177
190
|
return (
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
191
|
+
<div ref={containerRef}>
|
|
192
|
+
<Autosuggest
|
|
193
|
+
ref={autosuggestRef}
|
|
194
|
+
theme={styles}
|
|
195
|
+
suggestions={suggestions.slice(0, 20)}
|
|
196
|
+
getSuggestionValue={contact => contact}
|
|
197
|
+
onSuggestionsFetchRequested={onSuggestionsFetchRequested}
|
|
198
|
+
onSuggestionsClearRequested={onSuggestionsClearRequested}
|
|
199
|
+
onSuggestionHighlighted={onSuggestionHighlighted}
|
|
200
|
+
renderSuggestion={renderSuggestion}
|
|
201
|
+
renderInputComponent={renderInput}
|
|
202
|
+
highlightFirstSuggestion
|
|
203
|
+
inputProps={{
|
|
204
|
+
onFocus: onAutosuggestFocus,
|
|
205
|
+
onChange: onAutosuggestChange,
|
|
206
|
+
onPaste: onAutosuggestPaste,
|
|
207
|
+
onBlur: onAutosuggestBlur,
|
|
208
|
+
value: inputValue,
|
|
209
|
+
type: 'email',
|
|
210
|
+
placeholder,
|
|
211
|
+
className: styles['suggestionInput'],
|
|
212
|
+
disabled
|
|
213
|
+
}}
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
200
216
|
)
|
|
201
217
|
}
|
|
202
218
|
|