@heroui/autocomplete 2.3.22-beta.0 → 2.3.22
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 +12 -8
- package/dist/autocomplete.mjs +2 -2
- package/dist/{chunk-ZDTZDUZE.mjs → chunk-ENG265Z6.mjs} +12 -8
- package/dist/{chunk-JQJCJ7KH.mjs → chunk-FWJM6QZX.mjs} +1 -1
- package/dist/index.js +12 -8
- package/dist/index.mjs +2 -2
- package/dist/use-autocomplete.d.mts +20 -15
- package/dist/use-autocomplete.d.ts +20 -15
- package/dist/use-autocomplete.js +12 -8
- package/dist/use-autocomplete.mjs +1 -1
- package/package.json +20 -25
package/dist/autocomplete.js
CHANGED
|
@@ -34,17 +34,18 @@ var import_input = require("@heroui/input");
|
|
|
34
34
|
var import_framer_motion = require("framer-motion");
|
|
35
35
|
|
|
36
36
|
// src/use-autocomplete.ts
|
|
37
|
-
var import_system = require("@heroui/system");
|
|
38
|
-
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
|
|
39
|
-
var import_theme = require("@heroui/theme");
|
|
40
|
-
var import_i18n = require("@react-aria/i18n");
|
|
41
|
-
var import_combobox = require("@react-stately/combobox");
|
|
42
|
-
var import_react_utils = require("@heroui/react-utils");
|
|
43
|
-
var import_react = require("react");
|
|
44
|
-
var import_shared_utils = require("@heroui/shared-utils");
|
|
45
37
|
var import_utils = require("@react-aria/utils");
|
|
38
|
+
var import_shared_utils = require("@heroui/shared-utils");
|
|
39
|
+
var import_react = require("react");
|
|
40
|
+
var import_react_utils = require("@heroui/react-utils");
|
|
41
|
+
var import_combobox = require("@react-stately/combobox");
|
|
42
|
+
var import_i18n = require("@react-aria/i18n");
|
|
43
|
+
var import_theme = require("@heroui/theme");
|
|
44
|
+
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
|
|
45
|
+
var import_system = require("@heroui/system");
|
|
46
46
|
var import_combobox2 = require("@react-aria/combobox");
|
|
47
47
|
var import_form = require("@heroui/form");
|
|
48
|
+
var import_aria_utils = require("@heroui/aria-utils");
|
|
48
49
|
function useAutocomplete(originalProps) {
|
|
49
50
|
var _a, _b, _c, _d, _e;
|
|
50
51
|
const globalContext = (0, import_system.useProviderContext)();
|
|
@@ -86,6 +87,7 @@ function useAutocomplete(originalProps) {
|
|
|
86
87
|
errorMessage,
|
|
87
88
|
onOpenChange,
|
|
88
89
|
onClose,
|
|
90
|
+
onClear,
|
|
89
91
|
isReadOnly = false,
|
|
90
92
|
...otherProps
|
|
91
93
|
} = props;
|
|
@@ -299,6 +301,7 @@ function useAutocomplete(originalProps) {
|
|
|
299
301
|
}
|
|
300
302
|
state.setInputValue("");
|
|
301
303
|
state.open();
|
|
304
|
+
onClear == null ? void 0 : onClear();
|
|
302
305
|
},
|
|
303
306
|
"data-visible": !!state.selectedItem || ((_a2 = state.inputValue) == null ? void 0 : _a2.length) > 0,
|
|
304
307
|
className: slots.clearButton({
|
|
@@ -352,6 +355,7 @@ function useAutocomplete(originalProps) {
|
|
|
352
355
|
)
|
|
353
356
|
})
|
|
354
357
|
},
|
|
358
|
+
shouldCloseOnInteractOutside: (popoverProps2 == null ? void 0 : popoverProps2.shouldCloseOnInteractOutside) ? popoverProps2.shouldCloseOnInteractOutside : (element) => (0, import_aria_utils.ariaShouldCloseOnInteractOutside)(element, inputWrapperRef, state),
|
|
355
359
|
// when the popover is open, the focus should be on input instead of dialog
|
|
356
360
|
// therefore, we skip dialog focus here
|
|
357
361
|
disableDialogFocus: true
|
package/dist/autocomplete.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/use-autocomplete.ts
|
|
4
|
-
import { mapPropsVariants, useProviderContext } from "@heroui/system";
|
|
5
|
-
import { useSafeLayoutEffect } from "@heroui/use-safe-layout-effect";
|
|
6
|
-
import { autocomplete } from "@heroui/theme";
|
|
7
|
-
import { useFilter } from "@react-aria/i18n";
|
|
8
|
-
import { useComboBoxState } from "@react-stately/combobox";
|
|
9
|
-
import { useDOMRef } from "@heroui/react-utils";
|
|
10
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
11
|
-
import { clsx, dataAttr, objectToDeps } from "@heroui/shared-utils";
|
|
12
4
|
import { chain, mergeProps } from "@react-aria/utils";
|
|
5
|
+
import { clsx, dataAttr, objectToDeps } from "@heroui/shared-utils";
|
|
6
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
7
|
+
import { useDOMRef } from "@heroui/react-utils";
|
|
8
|
+
import { useComboBoxState } from "@react-stately/combobox";
|
|
9
|
+
import { useFilter } from "@react-aria/i18n";
|
|
10
|
+
import { autocomplete } from "@heroui/theme";
|
|
11
|
+
import { useSafeLayoutEffect } from "@heroui/use-safe-layout-effect";
|
|
12
|
+
import { mapPropsVariants, useProviderContext } from "@heroui/system";
|
|
13
13
|
import { useComboBox } from "@react-aria/combobox";
|
|
14
14
|
import { FormContext, useSlottedContext } from "@heroui/form";
|
|
15
|
+
import { ariaShouldCloseOnInteractOutside } from "@heroui/aria-utils";
|
|
15
16
|
function useAutocomplete(originalProps) {
|
|
16
17
|
var _a, _b, _c, _d, _e;
|
|
17
18
|
const globalContext = useProviderContext();
|
|
@@ -53,6 +54,7 @@ function useAutocomplete(originalProps) {
|
|
|
53
54
|
errorMessage,
|
|
54
55
|
onOpenChange,
|
|
55
56
|
onClose,
|
|
57
|
+
onClear,
|
|
56
58
|
isReadOnly = false,
|
|
57
59
|
...otherProps
|
|
58
60
|
} = props;
|
|
@@ -266,6 +268,7 @@ function useAutocomplete(originalProps) {
|
|
|
266
268
|
}
|
|
267
269
|
state.setInputValue("");
|
|
268
270
|
state.open();
|
|
271
|
+
onClear == null ? void 0 : onClear();
|
|
269
272
|
},
|
|
270
273
|
"data-visible": !!state.selectedItem || ((_a2 = state.inputValue) == null ? void 0 : _a2.length) > 0,
|
|
271
274
|
className: slots.clearButton({
|
|
@@ -319,6 +322,7 @@ function useAutocomplete(originalProps) {
|
|
|
319
322
|
)
|
|
320
323
|
})
|
|
321
324
|
},
|
|
325
|
+
shouldCloseOnInteractOutside: (popoverProps2 == null ? void 0 : popoverProps2.shouldCloseOnInteractOutside) ? popoverProps2.shouldCloseOnInteractOutside : (element) => ariaShouldCloseOnInteractOutside(element, inputWrapperRef, state),
|
|
322
326
|
// when the popover is open, the focus should be on input instead of dialog
|
|
323
327
|
// therefore, we skip dialog focus here
|
|
324
328
|
disableDialogFocus: true
|
package/dist/index.js
CHANGED
|
@@ -40,17 +40,18 @@ var import_input = require("@heroui/input");
|
|
|
40
40
|
var import_framer_motion = require("framer-motion");
|
|
41
41
|
|
|
42
42
|
// src/use-autocomplete.ts
|
|
43
|
-
var import_system = require("@heroui/system");
|
|
44
|
-
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
|
|
45
|
-
var import_theme = require("@heroui/theme");
|
|
46
|
-
var import_i18n = require("@react-aria/i18n");
|
|
47
|
-
var import_combobox = require("@react-stately/combobox");
|
|
48
|
-
var import_react_utils = require("@heroui/react-utils");
|
|
49
|
-
var import_react = require("react");
|
|
50
|
-
var import_shared_utils = require("@heroui/shared-utils");
|
|
51
43
|
var import_utils = require("@react-aria/utils");
|
|
44
|
+
var import_shared_utils = require("@heroui/shared-utils");
|
|
45
|
+
var import_react = require("react");
|
|
46
|
+
var import_react_utils = require("@heroui/react-utils");
|
|
47
|
+
var import_combobox = require("@react-stately/combobox");
|
|
48
|
+
var import_i18n = require("@react-aria/i18n");
|
|
49
|
+
var import_theme = require("@heroui/theme");
|
|
50
|
+
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
|
|
51
|
+
var import_system = require("@heroui/system");
|
|
52
52
|
var import_combobox2 = require("@react-aria/combobox");
|
|
53
53
|
var import_form = require("@heroui/form");
|
|
54
|
+
var import_aria_utils = require("@heroui/aria-utils");
|
|
54
55
|
function useAutocomplete(originalProps) {
|
|
55
56
|
var _a, _b, _c, _d, _e;
|
|
56
57
|
const globalContext = (0, import_system.useProviderContext)();
|
|
@@ -92,6 +93,7 @@ function useAutocomplete(originalProps) {
|
|
|
92
93
|
errorMessage,
|
|
93
94
|
onOpenChange,
|
|
94
95
|
onClose,
|
|
96
|
+
onClear,
|
|
95
97
|
isReadOnly = false,
|
|
96
98
|
...otherProps
|
|
97
99
|
} = props;
|
|
@@ -305,6 +307,7 @@ function useAutocomplete(originalProps) {
|
|
|
305
307
|
}
|
|
306
308
|
state.setInputValue("");
|
|
307
309
|
state.open();
|
|
310
|
+
onClear == null ? void 0 : onClear();
|
|
308
311
|
},
|
|
309
312
|
"data-visible": !!state.selectedItem || ((_a2 = state.inputValue) == null ? void 0 : _a2.length) > 0,
|
|
310
313
|
className: slots.clearButton({
|
|
@@ -358,6 +361,7 @@ function useAutocomplete(originalProps) {
|
|
|
358
361
|
)
|
|
359
362
|
})
|
|
360
363
|
},
|
|
364
|
+
shouldCloseOnInteractOutside: (popoverProps2 == null ? void 0 : popoverProps2.shouldCloseOnInteractOutside) ? popoverProps2.shouldCloseOnInteractOutside : (element) => (0, import_aria_utils.ariaShouldCloseOnInteractOutside)(element, inputWrapperRef, state),
|
|
361
365
|
// when the popover is open, the focus should be on input instead of dialog
|
|
362
366
|
// therefore, we skip dialog focus here
|
|
363
367
|
disableDialogFocus: true
|
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-FWJM6QZX.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useAutocomplete
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ENG265Z6.mjs";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
import { ListboxItem, ListboxSection } from "@heroui/listbox";
|
|
@@ -105,6 +105,11 @@ interface Props<T> extends Omit<HTMLHeroUIProps<"input">, keyof ComboBoxProps<T>
|
|
|
105
105
|
* Callback fired when the select menu is closed.
|
|
106
106
|
*/
|
|
107
107
|
onClose?: () => void;
|
|
108
|
+
/**
|
|
109
|
+
* Callback fired when the value is cleared.
|
|
110
|
+
* if you pass this prop, the clear button will be shown.
|
|
111
|
+
*/
|
|
112
|
+
onClear?: () => void;
|
|
108
113
|
/**
|
|
109
114
|
* Whether to enable virtualization of the listbox items.
|
|
110
115
|
* By default, virtualization is automatically enabled when the number of items is greater than 50.
|
|
@@ -132,77 +137,77 @@ declare function useAutocomplete<T extends object>(originalProps: UseAutocomplet
|
|
|
132
137
|
slots: {
|
|
133
138
|
base: (slotProps?: ({
|
|
134
139
|
isClearable?: boolean | undefined;
|
|
135
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
136
140
|
disableAnimation?: boolean | undefined;
|
|
141
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
137
142
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
138
143
|
listboxWrapper: (slotProps?: ({
|
|
139
144
|
isClearable?: boolean | undefined;
|
|
140
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
141
145
|
disableAnimation?: boolean | undefined;
|
|
146
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
142
147
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
143
148
|
listbox: (slotProps?: ({
|
|
144
149
|
isClearable?: boolean | undefined;
|
|
145
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
146
150
|
disableAnimation?: boolean | undefined;
|
|
151
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
147
152
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
148
153
|
popoverContent: (slotProps?: ({
|
|
149
154
|
isClearable?: boolean | undefined;
|
|
150
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
151
155
|
disableAnimation?: boolean | undefined;
|
|
156
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
152
157
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
153
158
|
endContentWrapper: (slotProps?: ({
|
|
154
159
|
isClearable?: boolean | undefined;
|
|
155
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
156
160
|
disableAnimation?: boolean | undefined;
|
|
161
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
157
162
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
158
163
|
clearButton: (slotProps?: ({
|
|
159
164
|
isClearable?: boolean | undefined;
|
|
160
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
161
165
|
disableAnimation?: boolean | undefined;
|
|
166
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
162
167
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
163
168
|
selectorButton: (slotProps?: ({
|
|
164
169
|
isClearable?: boolean | undefined;
|
|
165
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
166
170
|
disableAnimation?: boolean | undefined;
|
|
171
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
167
172
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
168
173
|
} & {
|
|
169
174
|
base: (slotProps?: ({
|
|
170
175
|
isClearable?: boolean | undefined;
|
|
171
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
172
176
|
disableAnimation?: boolean | undefined;
|
|
177
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
173
178
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
174
179
|
listboxWrapper: (slotProps?: ({
|
|
175
180
|
isClearable?: boolean | undefined;
|
|
176
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
177
181
|
disableAnimation?: boolean | undefined;
|
|
182
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
178
183
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
179
184
|
listbox: (slotProps?: ({
|
|
180
185
|
isClearable?: boolean | undefined;
|
|
181
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
182
186
|
disableAnimation?: boolean | undefined;
|
|
187
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
183
188
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
184
189
|
popoverContent: (slotProps?: ({
|
|
185
190
|
isClearable?: boolean | undefined;
|
|
186
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
187
191
|
disableAnimation?: boolean | undefined;
|
|
192
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
188
193
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
189
194
|
endContentWrapper: (slotProps?: ({
|
|
190
195
|
isClearable?: boolean | undefined;
|
|
191
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
192
196
|
disableAnimation?: boolean | undefined;
|
|
197
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
193
198
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
194
199
|
clearButton: (slotProps?: ({
|
|
195
200
|
isClearable?: boolean | undefined;
|
|
196
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
197
201
|
disableAnimation?: boolean | undefined;
|
|
202
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
198
203
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
199
204
|
selectorButton: (slotProps?: ({
|
|
200
205
|
isClearable?: boolean | undefined;
|
|
201
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
202
206
|
disableAnimation?: boolean | undefined;
|
|
207
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
203
208
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
204
209
|
} & {};
|
|
205
|
-
classNames: SlotsToClasses<"base" | "
|
|
210
|
+
classNames: SlotsToClasses<"base" | "clearButton" | "listbox" | "listboxWrapper" | "popoverContent" | "endContentWrapper" | "selectorButton"> | undefined;
|
|
206
211
|
isLoading: boolean | undefined;
|
|
207
212
|
clearIcon: ReactNode;
|
|
208
213
|
isOpen: boolean;
|
|
@@ -105,6 +105,11 @@ interface Props<T> extends Omit<HTMLHeroUIProps<"input">, keyof ComboBoxProps<T>
|
|
|
105
105
|
* Callback fired when the select menu is closed.
|
|
106
106
|
*/
|
|
107
107
|
onClose?: () => void;
|
|
108
|
+
/**
|
|
109
|
+
* Callback fired when the value is cleared.
|
|
110
|
+
* if you pass this prop, the clear button will be shown.
|
|
111
|
+
*/
|
|
112
|
+
onClear?: () => void;
|
|
108
113
|
/**
|
|
109
114
|
* Whether to enable virtualization of the listbox items.
|
|
110
115
|
* By default, virtualization is automatically enabled when the number of items is greater than 50.
|
|
@@ -132,77 +137,77 @@ declare function useAutocomplete<T extends object>(originalProps: UseAutocomplet
|
|
|
132
137
|
slots: {
|
|
133
138
|
base: (slotProps?: ({
|
|
134
139
|
isClearable?: boolean | undefined;
|
|
135
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
136
140
|
disableAnimation?: boolean | undefined;
|
|
141
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
137
142
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
138
143
|
listboxWrapper: (slotProps?: ({
|
|
139
144
|
isClearable?: boolean | undefined;
|
|
140
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
141
145
|
disableAnimation?: boolean | undefined;
|
|
146
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
142
147
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
143
148
|
listbox: (slotProps?: ({
|
|
144
149
|
isClearable?: boolean | undefined;
|
|
145
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
146
150
|
disableAnimation?: boolean | undefined;
|
|
151
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
147
152
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
148
153
|
popoverContent: (slotProps?: ({
|
|
149
154
|
isClearable?: boolean | undefined;
|
|
150
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
151
155
|
disableAnimation?: boolean | undefined;
|
|
156
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
152
157
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
153
158
|
endContentWrapper: (slotProps?: ({
|
|
154
159
|
isClearable?: boolean | undefined;
|
|
155
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
156
160
|
disableAnimation?: boolean | undefined;
|
|
161
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
157
162
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
158
163
|
clearButton: (slotProps?: ({
|
|
159
164
|
isClearable?: boolean | undefined;
|
|
160
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
161
165
|
disableAnimation?: boolean | undefined;
|
|
166
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
162
167
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
163
168
|
selectorButton: (slotProps?: ({
|
|
164
169
|
isClearable?: boolean | undefined;
|
|
165
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
166
170
|
disableAnimation?: boolean | undefined;
|
|
171
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
167
172
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
168
173
|
} & {
|
|
169
174
|
base: (slotProps?: ({
|
|
170
175
|
isClearable?: boolean | undefined;
|
|
171
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
172
176
|
disableAnimation?: boolean | undefined;
|
|
177
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
173
178
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
174
179
|
listboxWrapper: (slotProps?: ({
|
|
175
180
|
isClearable?: boolean | undefined;
|
|
176
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
177
181
|
disableAnimation?: boolean | undefined;
|
|
182
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
178
183
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
179
184
|
listbox: (slotProps?: ({
|
|
180
185
|
isClearable?: boolean | undefined;
|
|
181
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
182
186
|
disableAnimation?: boolean | undefined;
|
|
187
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
183
188
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
184
189
|
popoverContent: (slotProps?: ({
|
|
185
190
|
isClearable?: boolean | undefined;
|
|
186
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
187
191
|
disableAnimation?: boolean | undefined;
|
|
192
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
188
193
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
189
194
|
endContentWrapper: (slotProps?: ({
|
|
190
195
|
isClearable?: boolean | undefined;
|
|
191
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
192
196
|
disableAnimation?: boolean | undefined;
|
|
197
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
193
198
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
194
199
|
clearButton: (slotProps?: ({
|
|
195
200
|
isClearable?: boolean | undefined;
|
|
196
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
197
201
|
disableAnimation?: boolean | undefined;
|
|
202
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
198
203
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
199
204
|
selectorButton: (slotProps?: ({
|
|
200
205
|
isClearable?: boolean | undefined;
|
|
201
|
-
disableSelectorIconRotation?: boolean | undefined;
|
|
202
206
|
disableAnimation?: boolean | undefined;
|
|
207
|
+
disableSelectorIconRotation?: boolean | undefined;
|
|
203
208
|
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
204
209
|
} & {};
|
|
205
|
-
classNames: SlotsToClasses<"base" | "
|
|
210
|
+
classNames: SlotsToClasses<"base" | "clearButton" | "listbox" | "listboxWrapper" | "popoverContent" | "endContentWrapper" | "selectorButton"> | undefined;
|
|
206
211
|
isLoading: boolean | undefined;
|
|
207
212
|
clearIcon: ReactNode;
|
|
208
213
|
isOpen: boolean;
|
package/dist/use-autocomplete.js
CHANGED
|
@@ -24,17 +24,18 @@ __export(use_autocomplete_exports, {
|
|
|
24
24
|
useAutocomplete: () => useAutocomplete
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(use_autocomplete_exports);
|
|
27
|
-
var import_system = require("@heroui/system");
|
|
28
|
-
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
|
|
29
|
-
var import_theme = require("@heroui/theme");
|
|
30
|
-
var import_i18n = require("@react-aria/i18n");
|
|
31
|
-
var import_combobox = require("@react-stately/combobox");
|
|
32
|
-
var import_react_utils = require("@heroui/react-utils");
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var import_shared_utils = require("@heroui/shared-utils");
|
|
35
27
|
var import_utils = require("@react-aria/utils");
|
|
28
|
+
var import_shared_utils = require("@heroui/shared-utils");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_react_utils = require("@heroui/react-utils");
|
|
31
|
+
var import_combobox = require("@react-stately/combobox");
|
|
32
|
+
var import_i18n = require("@react-aria/i18n");
|
|
33
|
+
var import_theme = require("@heroui/theme");
|
|
34
|
+
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
|
|
35
|
+
var import_system = require("@heroui/system");
|
|
36
36
|
var import_combobox2 = require("@react-aria/combobox");
|
|
37
37
|
var import_form = require("@heroui/form");
|
|
38
|
+
var import_aria_utils = require("@heroui/aria-utils");
|
|
38
39
|
function useAutocomplete(originalProps) {
|
|
39
40
|
var _a, _b, _c, _d, _e;
|
|
40
41
|
const globalContext = (0, import_system.useProviderContext)();
|
|
@@ -76,6 +77,7 @@ function useAutocomplete(originalProps) {
|
|
|
76
77
|
errorMessage,
|
|
77
78
|
onOpenChange,
|
|
78
79
|
onClose,
|
|
80
|
+
onClear,
|
|
79
81
|
isReadOnly = false,
|
|
80
82
|
...otherProps
|
|
81
83
|
} = props;
|
|
@@ -289,6 +291,7 @@ function useAutocomplete(originalProps) {
|
|
|
289
291
|
}
|
|
290
292
|
state.setInputValue("");
|
|
291
293
|
state.open();
|
|
294
|
+
onClear == null ? void 0 : onClear();
|
|
292
295
|
},
|
|
293
296
|
"data-visible": !!state.selectedItem || ((_a2 = state.inputValue) == null ? void 0 : _a2.length) > 0,
|
|
294
297
|
className: slots.clearButton({
|
|
@@ -342,6 +345,7 @@ function useAutocomplete(originalProps) {
|
|
|
342
345
|
)
|
|
343
346
|
})
|
|
344
347
|
},
|
|
348
|
+
shouldCloseOnInteractOutside: (popoverProps2 == null ? void 0 : popoverProps2.shouldCloseOnInteractOutside) ? popoverProps2.shouldCloseOnInteractOutside : (element) => (0, import_aria_utils.ariaShouldCloseOnInteractOutside)(element, inputWrapperRef, state),
|
|
345
349
|
// when the popover is open, the focus should be on input instead of dialog
|
|
346
350
|
// therefore, we skip dialog focus here
|
|
347
351
|
disableDialogFocus: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroui/autocomplete",
|
|
3
|
-
"version": "2.3.22
|
|
3
|
+
"version": "2.3.22",
|
|
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,30 @@
|
|
|
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/
|
|
37
|
-
"@react-aria/
|
|
38
|
-
"@react-
|
|
39
|
-
"@react-
|
|
40
|
-
"@react-
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@heroui/
|
|
45
|
-
"@heroui/
|
|
46
|
-
"@heroui/
|
|
47
|
-
"@heroui/
|
|
48
|
-
"@heroui/
|
|
49
|
-
"@heroui/
|
|
50
|
-
"@heroui/
|
|
51
|
-
"@heroui/
|
|
52
|
-
"@heroui/shared-icons": "2.1.9-beta.0",
|
|
53
|
-
"@heroui/shared-utils": "2.1.10-beta.1",
|
|
54
|
-
"@heroui/spinner": "2.2.18-beta.0",
|
|
55
|
-
"@heroui/use-aria-button": "2.2.15-beta.0",
|
|
56
|
-
"@heroui/use-safe-layout-effect": "2.1.8-beta.1"
|
|
35
|
+
"@react-aria/combobox": "3.12.4",
|
|
36
|
+
"@react-aria/i18n": "3.12.10",
|
|
37
|
+
"@react-aria/utils": "3.29.1",
|
|
38
|
+
"@react-stately/combobox": "3.10.6",
|
|
39
|
+
"@react-types/combobox": "3.13.6",
|
|
40
|
+
"@react-types/shared": "3.30.0",
|
|
41
|
+
"@heroui/form": "2.1.20",
|
|
42
|
+
"@heroui/aria-utils": "2.2.18",
|
|
43
|
+
"@heroui/button": "2.2.21",
|
|
44
|
+
"@heroui/input": "2.4.21",
|
|
45
|
+
"@heroui/listbox": "2.3.20",
|
|
46
|
+
"@heroui/popover": "2.3.21",
|
|
47
|
+
"@heroui/react-utils": "2.1.11",
|
|
48
|
+
"@heroui/scroll-shadow": "2.3.14",
|
|
49
|
+
"@heroui/shared-icons": "2.1.9",
|
|
50
|
+
"@heroui/shared-utils": "2.1.9",
|
|
51
|
+
"@heroui/use-safe-layout-effect": "2.1.7"
|
|
57
52
|
},
|
|
58
53
|
"clean-package": "../../../clean-package.config.json",
|
|
59
54
|
"module": "dist/index.mjs",
|