@heroui/autocomplete 2.3.21-beta.2 → 2.3.21
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/dist/autocomplete.js +23 -5
- package/dist/autocomplete.mjs +2 -2
- package/dist/{chunk-OHYOYGT2.mjs → chunk-ORFKRCF3.mjs} +23 -5
- package/dist/{chunk-DNIGSRME.mjs → chunk-R4R544ZH.mjs} +1 -1
- package/dist/index.js +23 -5
- package/dist/index.mjs +2 -2
- package/dist/use-autocomplete.js +23 -5
- package/dist/use-autocomplete.mjs +1 -1
- package/package.json +25 -25
package/dist/autocomplete.js
CHANGED
|
@@ -215,12 +215,30 @@ function useAutocomplete(originalProps) {
|
|
|
215
215
|
}
|
|
216
216
|
}, [inputRef.current]);
|
|
217
217
|
(0, import_react.useEffect)(() => {
|
|
218
|
-
let
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
let keyToFocus;
|
|
219
|
+
if (state.selectedKey !== null && state.collection.getItem(state.selectedKey) && !state.disabledKeys.has(state.selectedKey)) {
|
|
220
|
+
keyToFocus = state.selectedKey;
|
|
221
|
+
} else {
|
|
222
|
+
let firstAvailableKey = state.collection.getFirstKey();
|
|
223
|
+
while (firstAvailableKey && state.disabledKeys.has(firstAvailableKey)) {
|
|
224
|
+
firstAvailableKey = state.collection.getKeyAfter(firstAvailableKey);
|
|
225
|
+
}
|
|
226
|
+
keyToFocus = firstAvailableKey;
|
|
227
|
+
}
|
|
228
|
+
state.selectionManager.setFocusedKey(keyToFocus);
|
|
229
|
+
}, [state.collection, state.disabledKeys, state.selectedKey]);
|
|
230
|
+
(0, import_react.useEffect)(() => {
|
|
231
|
+
if (state.isOpen && popoverRef.current && listBoxRef.current) {
|
|
232
|
+
let selectedItem = listBoxRef.current.querySelector("[aria-selected=true] [data-label=true]");
|
|
233
|
+
let scrollShadow = scrollShadowRef.current;
|
|
234
|
+
if (selectedItem && scrollShadow && selectedItem.parentElement) {
|
|
235
|
+
let scrollShadowRect = scrollShadow == null ? void 0 : scrollShadow.getBoundingClientRect();
|
|
236
|
+
let scrollShadowHeight = scrollShadowRect.height;
|
|
237
|
+
scrollShadow.scrollTop = selectedItem.parentElement.offsetTop - scrollShadowHeight / 2 + selectedItem.parentElement.clientHeight / 2;
|
|
238
|
+
state.selectionManager.setFocusedKey(state.selectedKey);
|
|
239
|
+
}
|
|
221
240
|
}
|
|
222
|
-
|
|
223
|
-
}, [state.collection, state.disabledKeys]);
|
|
241
|
+
}, [state.isOpen, disableAnimation]);
|
|
224
242
|
(0, import_react.useEffect)(() => {
|
|
225
243
|
if (isOpen) {
|
|
226
244
|
if (popoverRef.current && inputWrapperRef.current) {
|
package/dist/autocomplete.mjs
CHANGED
|
@@ -182,12 +182,30 @@ function useAutocomplete(originalProps) {
|
|
|
182
182
|
}
|
|
183
183
|
}, [inputRef.current]);
|
|
184
184
|
useEffect(() => {
|
|
185
|
-
let
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
let keyToFocus;
|
|
186
|
+
if (state.selectedKey !== null && state.collection.getItem(state.selectedKey) && !state.disabledKeys.has(state.selectedKey)) {
|
|
187
|
+
keyToFocus = state.selectedKey;
|
|
188
|
+
} else {
|
|
189
|
+
let firstAvailableKey = state.collection.getFirstKey();
|
|
190
|
+
while (firstAvailableKey && state.disabledKeys.has(firstAvailableKey)) {
|
|
191
|
+
firstAvailableKey = state.collection.getKeyAfter(firstAvailableKey);
|
|
192
|
+
}
|
|
193
|
+
keyToFocus = firstAvailableKey;
|
|
194
|
+
}
|
|
195
|
+
state.selectionManager.setFocusedKey(keyToFocus);
|
|
196
|
+
}, [state.collection, state.disabledKeys, state.selectedKey]);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
if (state.isOpen && popoverRef.current && listBoxRef.current) {
|
|
199
|
+
let selectedItem = listBoxRef.current.querySelector("[aria-selected=true] [data-label=true]");
|
|
200
|
+
let scrollShadow = scrollShadowRef.current;
|
|
201
|
+
if (selectedItem && scrollShadow && selectedItem.parentElement) {
|
|
202
|
+
let scrollShadowRect = scrollShadow == null ? void 0 : scrollShadow.getBoundingClientRect();
|
|
203
|
+
let scrollShadowHeight = scrollShadowRect.height;
|
|
204
|
+
scrollShadow.scrollTop = selectedItem.parentElement.offsetTop - scrollShadowHeight / 2 + selectedItem.parentElement.clientHeight / 2;
|
|
205
|
+
state.selectionManager.setFocusedKey(state.selectedKey);
|
|
206
|
+
}
|
|
188
207
|
}
|
|
189
|
-
|
|
190
|
-
}, [state.collection, state.disabledKeys]);
|
|
208
|
+
}, [state.isOpen, disableAnimation]);
|
|
191
209
|
useEffect(() => {
|
|
192
210
|
if (isOpen) {
|
|
193
211
|
if (popoverRef.current && inputWrapperRef.current) {
|
package/dist/index.js
CHANGED
|
@@ -221,12 +221,30 @@ function useAutocomplete(originalProps) {
|
|
|
221
221
|
}
|
|
222
222
|
}, [inputRef.current]);
|
|
223
223
|
(0, import_react.useEffect)(() => {
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
let keyToFocus;
|
|
225
|
+
if (state.selectedKey !== null && state.collection.getItem(state.selectedKey) && !state.disabledKeys.has(state.selectedKey)) {
|
|
226
|
+
keyToFocus = state.selectedKey;
|
|
227
|
+
} else {
|
|
228
|
+
let firstAvailableKey = state.collection.getFirstKey();
|
|
229
|
+
while (firstAvailableKey && state.disabledKeys.has(firstAvailableKey)) {
|
|
230
|
+
firstAvailableKey = state.collection.getKeyAfter(firstAvailableKey);
|
|
231
|
+
}
|
|
232
|
+
keyToFocus = firstAvailableKey;
|
|
233
|
+
}
|
|
234
|
+
state.selectionManager.setFocusedKey(keyToFocus);
|
|
235
|
+
}, [state.collection, state.disabledKeys, state.selectedKey]);
|
|
236
|
+
(0, import_react.useEffect)(() => {
|
|
237
|
+
if (state.isOpen && popoverRef.current && listBoxRef.current) {
|
|
238
|
+
let selectedItem = listBoxRef.current.querySelector("[aria-selected=true] [data-label=true]");
|
|
239
|
+
let scrollShadow = scrollShadowRef.current;
|
|
240
|
+
if (selectedItem && scrollShadow && selectedItem.parentElement) {
|
|
241
|
+
let scrollShadowRect = scrollShadow == null ? void 0 : scrollShadow.getBoundingClientRect();
|
|
242
|
+
let scrollShadowHeight = scrollShadowRect.height;
|
|
243
|
+
scrollShadow.scrollTop = selectedItem.parentElement.offsetTop - scrollShadowHeight / 2 + selectedItem.parentElement.clientHeight / 2;
|
|
244
|
+
state.selectionManager.setFocusedKey(state.selectedKey);
|
|
245
|
+
}
|
|
227
246
|
}
|
|
228
|
-
|
|
229
|
-
}, [state.collection, state.disabledKeys]);
|
|
247
|
+
}, [state.isOpen, disableAnimation]);
|
|
230
248
|
(0, import_react.useEffect)(() => {
|
|
231
249
|
if (isOpen) {
|
|
232
250
|
if (popoverRef.current && inputWrapperRef.current) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
autocomplete_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R4R544ZH.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useAutocomplete
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ORFKRCF3.mjs";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
import { ListboxItem, ListboxSection } from "@heroui/listbox";
|
package/dist/use-autocomplete.js
CHANGED
|
@@ -205,12 +205,30 @@ function useAutocomplete(originalProps) {
|
|
|
205
205
|
}
|
|
206
206
|
}, [inputRef.current]);
|
|
207
207
|
(0, import_react.useEffect)(() => {
|
|
208
|
-
let
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
let keyToFocus;
|
|
209
|
+
if (state.selectedKey !== null && state.collection.getItem(state.selectedKey) && !state.disabledKeys.has(state.selectedKey)) {
|
|
210
|
+
keyToFocus = state.selectedKey;
|
|
211
|
+
} else {
|
|
212
|
+
let firstAvailableKey = state.collection.getFirstKey();
|
|
213
|
+
while (firstAvailableKey && state.disabledKeys.has(firstAvailableKey)) {
|
|
214
|
+
firstAvailableKey = state.collection.getKeyAfter(firstAvailableKey);
|
|
215
|
+
}
|
|
216
|
+
keyToFocus = firstAvailableKey;
|
|
217
|
+
}
|
|
218
|
+
state.selectionManager.setFocusedKey(keyToFocus);
|
|
219
|
+
}, [state.collection, state.disabledKeys, state.selectedKey]);
|
|
220
|
+
(0, import_react.useEffect)(() => {
|
|
221
|
+
if (state.isOpen && popoverRef.current && listBoxRef.current) {
|
|
222
|
+
let selectedItem = listBoxRef.current.querySelector("[aria-selected=true] [data-label=true]");
|
|
223
|
+
let scrollShadow = scrollShadowRef.current;
|
|
224
|
+
if (selectedItem && scrollShadow && selectedItem.parentElement) {
|
|
225
|
+
let scrollShadowRect = scrollShadow == null ? void 0 : scrollShadow.getBoundingClientRect();
|
|
226
|
+
let scrollShadowHeight = scrollShadowRect.height;
|
|
227
|
+
scrollShadow.scrollTop = selectedItem.parentElement.offsetTop - scrollShadowHeight / 2 + selectedItem.parentElement.clientHeight / 2;
|
|
228
|
+
state.selectionManager.setFocusedKey(state.selectedKey);
|
|
229
|
+
}
|
|
211
230
|
}
|
|
212
|
-
|
|
213
|
-
}, [state.collection, state.disabledKeys]);
|
|
231
|
+
}, [state.isOpen, disableAnimation]);
|
|
214
232
|
(0, import_react.useEffect)(() => {
|
|
215
233
|
if (isOpen) {
|
|
216
234
|
if (popoverRef.current && inputWrapperRef.current) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroui/autocomplete",
|
|
3
|
-
"version": "2.3.21
|
|
3
|
+
"version": "2.3.21",
|
|
4
4
|
"description": "An autocomplete combines a text input with a listbox, allowing users to filter a list of options to items matching a query.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"autocomplete"
|
|
@@ -25,35 +25,35 @@
|
|
|
25
25
|
"url": "https://github.com/heroui-inc/heroui/issues"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@heroui/system": ">=2.4.
|
|
29
|
-
"@heroui/theme": ">=2.4.
|
|
28
|
+
"@heroui/system": ">=2.4.7",
|
|
29
|
+
"@heroui/theme": ">=2.4.6",
|
|
30
30
|
"framer-motion": ">=11.5.6 || >=12.0.0-alpha.1",
|
|
31
31
|
"react": ">=18 || >=19.0.0-rc.0",
|
|
32
32
|
"react-dom": ">=18 || >=19.0.0-rc.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@react-aria/combobox": "3.12.
|
|
36
|
-
"@react-aria/focus": "3.20.
|
|
37
|
-
"@react-aria/i18n": "3.12.
|
|
38
|
-
"@react-aria/interactions": "3.25.
|
|
39
|
-
"@react-aria/utils": "3.
|
|
40
|
-
"@react-aria/visually-hidden": "3.8.
|
|
41
|
-
"@react-stately/combobox": "3.10.
|
|
42
|
-
"@react-types/combobox": "3.13.
|
|
43
|
-
"@react-types/shared": "3.29.
|
|
44
|
-
"@heroui/
|
|
45
|
-
"@heroui/
|
|
46
|
-
"@heroui/
|
|
47
|
-
"@heroui/
|
|
48
|
-
"@heroui/
|
|
49
|
-
"@heroui/
|
|
50
|
-
"@heroui/react-utils": "2.1.
|
|
51
|
-
"@heroui/scroll-shadow": "2.3.
|
|
52
|
-
"@heroui/shared-icons": "2.1.8
|
|
53
|
-
"@heroui/shared-utils": "2.1.
|
|
54
|
-
"@heroui/spinner": "2.2.17
|
|
55
|
-
"@heroui/use-aria-button": "2.2.14
|
|
56
|
-
"@heroui/use-safe-layout-effect": "2.1.
|
|
35
|
+
"@react-aria/combobox": "3.12.3",
|
|
36
|
+
"@react-aria/focus": "3.20.3",
|
|
37
|
+
"@react-aria/i18n": "3.12.9",
|
|
38
|
+
"@react-aria/interactions": "3.25.1",
|
|
39
|
+
"@react-aria/utils": "3.29.0",
|
|
40
|
+
"@react-aria/visually-hidden": "3.8.23",
|
|
41
|
+
"@react-stately/combobox": "3.10.5",
|
|
42
|
+
"@react-types/combobox": "3.13.5",
|
|
43
|
+
"@react-types/shared": "3.29.1",
|
|
44
|
+
"@heroui/aria-utils": "2.2.17",
|
|
45
|
+
"@heroui/button": "2.2.20",
|
|
46
|
+
"@heroui/input": "2.4.20",
|
|
47
|
+
"@heroui/listbox": "2.3.19",
|
|
48
|
+
"@heroui/popover": "2.3.20",
|
|
49
|
+
"@heroui/form": "2.1.19",
|
|
50
|
+
"@heroui/react-utils": "2.1.10",
|
|
51
|
+
"@heroui/scroll-shadow": "2.3.13",
|
|
52
|
+
"@heroui/shared-icons": "2.1.8",
|
|
53
|
+
"@heroui/shared-utils": "2.1.9",
|
|
54
|
+
"@heroui/spinner": "2.2.17",
|
|
55
|
+
"@heroui/use-aria-button": "2.2.14",
|
|
56
|
+
"@heroui/use-safe-layout-effect": "2.1.7"
|
|
57
57
|
},
|
|
58
58
|
"clean-package": "../../../clean-package.config.json",
|
|
59
59
|
"module": "dist/index.mjs",
|