@heroui/autocomplete 2.3.11 → 2.3.12

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.
@@ -1,229 +0,0 @@
1
- import * as tailwind_variants from 'tailwind-variants';
2
- import * as _react_stately_combobox from '@react-stately/combobox';
3
- import { FilterFn } from '@react-stately/combobox';
4
- import * as react from 'react';
5
- import { ReactNode } from 'react';
6
- import * as _heroui_system from '@heroui/system';
7
- import { PropGetter, DOMAttributes, HTMLHeroUIProps } from '@heroui/system';
8
- import { AutocompleteVariantProps, SlotsToClasses, AutocompleteSlots } from '@heroui/theme';
9
- import { ReactRef } from '@heroui/react-utils';
10
- import { ComboBoxProps } from '@react-types/combobox';
11
- import { PopoverProps } from '@heroui/popover';
12
- import { ListboxProps } from '@heroui/listbox';
13
- import { InputProps } from '@heroui/input';
14
- import { ScrollShadowProps } from '@heroui/scroll-shadow';
15
- import { ButtonProps } from '@heroui/button';
16
- import { AsyncLoadable } from '@react-types/shared';
17
-
18
- interface Props<T> extends Omit<HTMLHeroUIProps<"input">, keyof ComboBoxProps<T>> {
19
- /**
20
- * Ref to the DOM node.
21
- */
22
- ref?: ReactRef<HTMLElement | null>;
23
- /**
24
- * The ref to the scroll element. Useful when having async loading of items.
25
- */
26
- scrollRef?: ReactRef<HTMLElement | null>;
27
- /**
28
- * The icon that represents the autocomplete open state. Usually a chevron icon.
29
- */
30
- selectorIcon?: ReactNode;
31
- /**
32
- * The icon that represents the clear button. Usually a cross icon.
33
- */
34
- clearIcon?: ReactNode;
35
- /**
36
- * Whether to display a top and bottom arrow indicators when the listbox is scrollable.
37
- * @default true
38
- */
39
- showScrollIndicators?: boolean;
40
- /**
41
- * Props to be passed to the scroll shadow component. This component
42
- * adds a shadow to the top and bottom of the listbox when it is scrollable.
43
- *
44
- * @default { hideScrollBar: true, offset: 15 }
45
- */
46
- scrollShadowProps?: Partial<ScrollShadowProps>;
47
- /**
48
- * Props to be passed to the popover component.
49
- *
50
- * @default { placement: "bottom", triggerScaleOnOpen: false, offset: 5 }
51
- */
52
- popoverProps?: Partial<PopoverProps>;
53
- /**
54
- * Props to be passed to the listbox component.
55
- *
56
- * @default { disableAnimation: false }
57
- */
58
- listboxProps?: Partial<ListboxProps>;
59
- /**
60
- * Props to be passed to the input component.
61
- *
62
- * @default { disableAnimation: false }
63
- */
64
- inputProps?: Partial<InputProps>;
65
- /**
66
- * Whether the clear button should be hidden.
67
- * @default false
68
- * @deprecated Use `isClearable` instead.
69
- */
70
- disableClearable?: boolean;
71
- /**
72
- * Props to be passed to the selector button component.
73
- * @default { size: "sm", variant: "light", radius: "full", isIconOnly: true }
74
- */
75
- selectorButtonProps?: Partial<ButtonProps>;
76
- /**
77
- * Props to be passed to the clear button component.
78
- * @default { size: "sm", variant: "light", radius: "full", isIconOnly: true }
79
- */
80
- clearButtonProps?: Partial<ButtonProps>;
81
- /**
82
- * The filter options to use when filtering items based on user input.
83
- * @default {sensitivity: 'base'}
84
- */
85
- filterOptions?: Intl.CollatorOptions;
86
- /**
87
- * Whether the autocomplete allows the menu to be open when the collection is empty.
88
- * @default true
89
- */
90
- allowsEmptyCollection?: boolean;
91
- /**
92
- * Whether the autocomplete menu should close on blur.
93
- * @default true
94
- * */
95
- shouldCloseOnBlur?: boolean;
96
- /**
97
- * Classes object to style the autocomplete and its children.
98
- */
99
- classNames?: SlotsToClasses<AutocompleteSlots>;
100
- /**
101
- * The filter function used to determine if a option should be included in the autocomplete list.
102
- * */
103
- defaultFilter?: FilterFn;
104
- /**
105
- * Callback fired when the select menu is closed.
106
- */
107
- onClose?: () => void;
108
- /**
109
- * Whether to enable virtualization of the listbox items.
110
- * By default, virtualization is automatically enabled when the number of items is greater than 50.
111
- * @default undefined
112
- */
113
- isVirtualized?: boolean;
114
- }
115
- type UseAutocompleteProps<T> = Props<T> & Omit<InputProps, "children" | "value" | "isClearable" | "defaultValue" | "classNames"> & ComboBoxProps<T> & AsyncLoadable & AutocompleteVariantProps & {
116
- /**
117
- * The height of each item in the listbox.
118
- * This is required for virtualized listboxes to calculate the height of each item.
119
- */
120
- itemHeight?: number;
121
- /**
122
- * The max height of the listbox (which will be rendered in a popover).
123
- * This is required for virtualized listboxes to set the maximum height of the listbox.
124
- */
125
- maxListboxHeight?: number;
126
- };
127
- declare function useAutocomplete<T extends object>(originalProps: UseAutocompleteProps<T>): {
128
- Component: _heroui_system.As<any>;
129
- inputRef: react.RefObject<HTMLInputElement>;
130
- label: ReactNode;
131
- state: _react_stately_combobox.ComboBoxState<T>;
132
- slots: {
133
- base: (slotProps?: ({
134
- isClearable?: boolean | undefined;
135
- disableAnimation?: boolean | undefined;
136
- disableSelectorIconRotation?: boolean | undefined;
137
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
138
- listboxWrapper: (slotProps?: ({
139
- isClearable?: boolean | undefined;
140
- disableAnimation?: boolean | undefined;
141
- disableSelectorIconRotation?: boolean | undefined;
142
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
143
- listbox: (slotProps?: ({
144
- isClearable?: boolean | undefined;
145
- disableAnimation?: boolean | undefined;
146
- disableSelectorIconRotation?: boolean | undefined;
147
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
148
- popoverContent: (slotProps?: ({
149
- isClearable?: boolean | undefined;
150
- disableAnimation?: boolean | undefined;
151
- disableSelectorIconRotation?: boolean | undefined;
152
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
153
- endContentWrapper: (slotProps?: ({
154
- isClearable?: boolean | undefined;
155
- disableAnimation?: boolean | undefined;
156
- disableSelectorIconRotation?: boolean | undefined;
157
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
158
- clearButton: (slotProps?: ({
159
- isClearable?: boolean | undefined;
160
- disableAnimation?: boolean | undefined;
161
- disableSelectorIconRotation?: boolean | undefined;
162
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
163
- selectorButton: (slotProps?: ({
164
- isClearable?: boolean | undefined;
165
- disableAnimation?: boolean | undefined;
166
- disableSelectorIconRotation?: boolean | undefined;
167
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
168
- } & {
169
- base: (slotProps?: ({
170
- isClearable?: boolean | undefined;
171
- disableAnimation?: boolean | undefined;
172
- disableSelectorIconRotation?: boolean | undefined;
173
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
174
- listboxWrapper: (slotProps?: ({
175
- isClearable?: boolean | undefined;
176
- disableAnimation?: boolean | undefined;
177
- disableSelectorIconRotation?: boolean | undefined;
178
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
179
- listbox: (slotProps?: ({
180
- isClearable?: boolean | undefined;
181
- disableAnimation?: boolean | undefined;
182
- disableSelectorIconRotation?: boolean | undefined;
183
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
184
- popoverContent: (slotProps?: ({
185
- isClearable?: boolean | undefined;
186
- disableAnimation?: boolean | undefined;
187
- disableSelectorIconRotation?: boolean | undefined;
188
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
189
- endContentWrapper: (slotProps?: ({
190
- isClearable?: boolean | undefined;
191
- disableAnimation?: boolean | undefined;
192
- disableSelectorIconRotation?: boolean | undefined;
193
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
194
- clearButton: (slotProps?: ({
195
- isClearable?: boolean | undefined;
196
- disableAnimation?: boolean | undefined;
197
- disableSelectorIconRotation?: boolean | undefined;
198
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
199
- selectorButton: (slotProps?: ({
200
- isClearable?: boolean | undefined;
201
- disableAnimation?: boolean | undefined;
202
- disableSelectorIconRotation?: boolean | undefined;
203
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
204
- } & {};
205
- classNames: SlotsToClasses<"base" | "clearButton" | "listbox" | "listboxWrapper" | "popoverContent" | "endContentWrapper" | "selectorButton"> | undefined;
206
- isLoading: boolean | undefined;
207
- clearIcon: ReactNode;
208
- isOpen: boolean;
209
- endContent: ReactNode;
210
- isClearable: boolean | undefined;
211
- disableAnimation: boolean;
212
- allowsCustomValue: boolean;
213
- selectorIcon: ReactNode;
214
- getBaseProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
215
- getInputProps: () => InputProps;
216
- getListBoxProps: () => ListboxProps<object>;
217
- getPopoverProps: (props?: DOMAttributes) => PopoverProps;
218
- getEmptyPopoverProps: () => {
219
- ref: react.RefObject<HTMLDivElement>;
220
- className: string;
221
- };
222
- getClearButtonProps: () => ButtonProps;
223
- getSelectorButtonProps: () => ButtonProps;
224
- getListBoxWrapperProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
225
- getEndContentWrapperProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
226
- };
227
- type UseAutocompleteReturn = ReturnType<typeof useAutocomplete>;
228
-
229
- export { UseAutocompleteProps, UseAutocompleteReturn, useAutocomplete };
@@ -1,400 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/use-autocomplete.ts
22
- var use_autocomplete_exports = {};
23
- __export(use_autocomplete_exports, {
24
- useAutocomplete: () => useAutocomplete
25
- });
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
- var import_utils = require("@react-aria/utils");
36
- var import_combobox2 = require("@react-aria/combobox");
37
- var import_form = require("@heroui/form");
38
- var import_aria_utils = require("@heroui/aria-utils");
39
- function useAutocomplete(originalProps) {
40
- var _a, _b, _c, _d, _e;
41
- const globalContext = (0, import_system.useProviderContext)();
42
- const { validationBehavior: formValidationBehavior } = (0, import_form.useSlottedContext)(import_form.FormContext) || {};
43
- const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.autocomplete.variantKeys);
44
- const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
45
- const isClearable = originalProps.disableClearable !== void 0 ? !originalProps.disableClearable : originalProps.isReadOnly ? false : originalProps.isClearable;
46
- const {
47
- ref,
48
- as,
49
- label,
50
- isLoading,
51
- menuTrigger = "focus",
52
- filterOptions = {
53
- sensitivity: "base"
54
- },
55
- children,
56
- selectorIcon,
57
- clearIcon,
58
- scrollRef: scrollRefProp,
59
- defaultFilter,
60
- endContent,
61
- allowsEmptyCollection = true,
62
- shouldCloseOnBlur = true,
63
- popoverProps = {},
64
- inputProps: userInputProps = {},
65
- scrollShadowProps = {},
66
- listboxProps = {},
67
- selectorButtonProps = {},
68
- clearButtonProps = {},
69
- showScrollIndicators = true,
70
- allowsCustomValue = false,
71
- isVirtualized,
72
- maxListboxHeight = 256,
73
- itemHeight = 32,
74
- validationBehavior = (_c = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _c : "native",
75
- className,
76
- classNames,
77
- errorMessage,
78
- onOpenChange,
79
- onClose,
80
- isReadOnly = false,
81
- ...otherProps
82
- } = props;
83
- const { contains } = (0, import_i18n.useFilter)(filterOptions);
84
- let state = (0, import_combobox.useComboBoxState)({
85
- ...originalProps,
86
- children,
87
- menuTrigger,
88
- validationBehavior,
89
- shouldCloseOnBlur,
90
- allowsEmptyCollection,
91
- defaultFilter: defaultFilter && typeof defaultFilter === "function" ? defaultFilter : contains,
92
- onOpenChange: (open, menuTrigger2) => {
93
- onOpenChange == null ? void 0 : onOpenChange(open, menuTrigger2);
94
- if (!open) {
95
- onClose == null ? void 0 : onClose();
96
- }
97
- }
98
- });
99
- state = {
100
- ...state,
101
- ...isReadOnly && {
102
- disabledKeys: /* @__PURE__ */ new Set([...state.collection.getKeys()])
103
- }
104
- };
105
- const buttonRef = (0, import_react.useRef)(null);
106
- const inputWrapperRef = (0, import_react.useRef)(null);
107
- const listBoxRef = (0, import_react.useRef)(null);
108
- const popoverRef = (0, import_react.useRef)(null);
109
- const inputRef = (0, import_react_utils.useDOMRef)(ref);
110
- const scrollShadowRef = (0, import_react_utils.useDOMRef)(scrollRefProp);
111
- const {
112
- buttonProps,
113
- inputProps,
114
- listBoxProps,
115
- isInvalid: isAriaInvalid,
116
- validationDetails,
117
- validationErrors
118
- } = (0, import_combobox2.useComboBox)(
119
- {
120
- validationBehavior,
121
- ...originalProps,
122
- inputRef,
123
- buttonRef,
124
- listBoxRef,
125
- popoverRef
126
- },
127
- state
128
- );
129
- const isInvalid = originalProps.isInvalid || isAriaInvalid;
130
- const slotsProps = {
131
- inputProps: (0, import_utils.mergeProps)(
132
- {
133
- label,
134
- ref: inputRef,
135
- wrapperRef: inputWrapperRef,
136
- onClick: () => {
137
- if (!state.isOpen && !!state.selectedItem) {
138
- state.open();
139
- }
140
- },
141
- isClearable: false,
142
- disableAnimation
143
- },
144
- userInputProps
145
- ),
146
- popoverProps: (0, import_utils.mergeProps)(
147
- {
148
- offset: 5,
149
- placement: "bottom",
150
- triggerScaleOnOpen: false,
151
- disableAnimation
152
- },
153
- popoverProps
154
- ),
155
- scrollShadowProps: (0, import_utils.mergeProps)(
156
- {
157
- ref: scrollShadowRef,
158
- isEnabled: (_d = showScrollIndicators && state.collection.size > 5) != null ? _d : true,
159
- hideScrollBar: true,
160
- offset: 15
161
- },
162
- scrollShadowProps
163
- ),
164
- listboxProps: (0, import_utils.mergeProps)(
165
- {
166
- hideEmptyContent: allowsCustomValue,
167
- emptyContent: "No results found.",
168
- disableAnimation
169
- },
170
- listboxProps
171
- ),
172
- selectorButtonProps: (0, import_utils.mergeProps)(
173
- {
174
- isLoading,
175
- size: "sm",
176
- variant: "light",
177
- radius: "full",
178
- color: isInvalid ? "danger" : originalProps == null ? void 0 : originalProps.color,
179
- isIconOnly: true,
180
- disableAnimation
181
- },
182
- selectorButtonProps
183
- ),
184
- clearButtonProps: (0, import_utils.mergeProps)(
185
- {
186
- size: "sm",
187
- variant: "light",
188
- radius: "full",
189
- color: isInvalid ? "danger" : originalProps == null ? void 0 : originalProps.color,
190
- isIconOnly: true,
191
- disableAnimation
192
- },
193
- clearButtonProps
194
- )
195
- };
196
- const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
197
- const isOpen = ((_e = slotsProps.listboxProps) == null ? void 0 : _e.hideEmptyContent) ? state.isOpen && !!state.collection.size : state.isOpen;
198
- (0, import_use_safe_layout_effect.useSafeLayoutEffect)(() => {
199
- if (!inputRef.current)
200
- return;
201
- const key = inputRef.current.value;
202
- const item = state.collection.getItem(key);
203
- if (item && state.inputValue !== item.textValue) {
204
- state.setSelectedKey(key);
205
- state.setInputValue(item.textValue);
206
- }
207
- }, [inputRef.current]);
208
- (0, import_react.useEffect)(() => {
209
- let key = state.collection.getFirstKey();
210
- while (key && state.disabledKeys.has(key)) {
211
- key = state.collection.getKeyAfter(key);
212
- }
213
- state.selectionManager.setFocusedKey(key);
214
- }, [state.collection, state.disabledKeys]);
215
- (0, import_react.useEffect)(() => {
216
- if (isOpen) {
217
- if (popoverRef.current && inputWrapperRef.current) {
218
- let rect = inputWrapperRef.current.getBoundingClientRect();
219
- let popover = popoverRef.current;
220
- popover.style.width = rect.width + "px";
221
- }
222
- }
223
- }, [isOpen]);
224
- if (inputProps.onKeyDown) {
225
- const originalOnKeyDown = inputProps.onKeyDown;
226
- inputProps.onKeyDown = (e) => {
227
- if ("continuePropagation" in e) {
228
- e.stopPropagation = () => {
229
- };
230
- }
231
- return originalOnKeyDown(e);
232
- };
233
- }
234
- const Component = as || "div";
235
- const slots = (0, import_react.useMemo)(
236
- () => (0, import_theme.autocomplete)({
237
- ...variantProps,
238
- isClearable,
239
- disableAnimation,
240
- className
241
- }),
242
- [(0, import_shared_utils.objectToDeps)(variantProps), isClearable, disableAnimation, className]
243
- );
244
- const getBaseProps = () => ({
245
- "data-invalid": (0, import_shared_utils.dataAttr)(isInvalid),
246
- "data-open": (0, import_shared_utils.dataAttr)(state.isOpen),
247
- className: slots.base({ class: baseStyles })
248
- });
249
- const getSelectorButtonProps = () => {
250
- var _a2;
251
- return {
252
- ref: buttonRef,
253
- ...(0, import_utils.mergeProps)(buttonProps, slotsProps.selectorButtonProps),
254
- "data-open": (0, import_shared_utils.dataAttr)(state.isOpen),
255
- className: slots.selectorButton({
256
- class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.selectorButton, (_a2 = slotsProps.selectorButtonProps) == null ? void 0 : _a2.className)
257
- })
258
- };
259
- };
260
- const getClearButtonProps = () => {
261
- var _a2, _b2;
262
- return {
263
- ...(0, import_utils.mergeProps)(buttonProps, slotsProps.clearButtonProps),
264
- onPressStart: () => {
265
- var _a3;
266
- (_a3 = inputRef.current) == null ? void 0 : _a3.focus();
267
- },
268
- onPress: (e) => {
269
- var _a3, _b3;
270
- (_b3 = (_a3 = slotsProps.clearButtonProps) == null ? void 0 : _a3.onPress) == null ? void 0 : _b3.call(_a3, e);
271
- if (state.selectedItem) {
272
- state.setSelectedKey(null);
273
- }
274
- state.setInputValue("");
275
- state.open();
276
- },
277
- "data-visible": !!state.selectedItem || ((_a2 = state.inputValue) == null ? void 0 : _a2.length) > 0,
278
- className: slots.clearButton({
279
- class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.clearButton, (_b2 = slotsProps.clearButtonProps) == null ? void 0 : _b2.className)
280
- })
281
- };
282
- };
283
- const hasUncommittedValidation = validationBehavior === "native" && state.displayValidation.isInvalid === false && state.realtimeValidation.isInvalid === true;
284
- const getInputProps = () => ({
285
- ...otherProps,
286
- ...inputProps,
287
- ...slotsProps.inputProps,
288
- isInvalid: hasUncommittedValidation ? void 0 : isInvalid,
289
- validationBehavior,
290
- errorMessage: typeof errorMessage === "function" ? errorMessage({ isInvalid, validationErrors, validationDetails }) : errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" ")),
291
- onClick: (0, import_utils.chain)(slotsProps.inputProps.onClick, otherProps.onClick)
292
- });
293
- const getListBoxProps = () => {
294
- const shouldVirtualize = isVirtualized != null ? isVirtualized : state.collection.size > 50;
295
- return {
296
- state,
297
- ref: listBoxRef,
298
- isVirtualized: shouldVirtualize,
299
- virtualization: shouldVirtualize ? {
300
- maxListboxHeight,
301
- itemHeight
302
- } : void 0,
303
- scrollShadowProps: slotsProps.scrollShadowProps,
304
- ...(0, import_utils.mergeProps)(slotsProps.listboxProps, listBoxProps, {
305
- shouldHighlightOnFocus: true
306
- })
307
- };
308
- };
309
- const getPopoverProps = (props2 = {}) => {
310
- var _a2, _b2, _c2;
311
- const popoverProps2 = (0, import_utils.mergeProps)(slotsProps.popoverProps, props2);
312
- return {
313
- state,
314
- ref: popoverRef,
315
- triggerRef: inputWrapperRef,
316
- scrollRef: listBoxRef,
317
- triggerType: "listbox",
318
- ...popoverProps2,
319
- classNames: {
320
- ...(_a2 = slotsProps.popoverProps) == null ? void 0 : _a2.classNames,
321
- content: slots.popoverContent({
322
- class: (0, import_shared_utils.clsx)(
323
- classNames == null ? void 0 : classNames.popoverContent,
324
- (_c2 = (_b2 = slotsProps.popoverProps) == null ? void 0 : _b2.classNames) == null ? void 0 : _c2["content"],
325
- props2.className
326
- )
327
- })
328
- },
329
- shouldCloseOnInteractOutside: (popoverProps2 == null ? void 0 : popoverProps2.shouldCloseOnInteractOutside) ? popoverProps2.shouldCloseOnInteractOutside : (element) => (0, import_aria_utils.ariaShouldCloseOnInteractOutside)(element, inputWrapperRef, state),
330
- disableDialogFocus: true
331
- };
332
- };
333
- const getEmptyPopoverProps = () => {
334
- return {
335
- ref: popoverRef,
336
- className: "hidden"
337
- };
338
- };
339
- const getListBoxWrapperProps = (props2 = {}) => {
340
- var _a2, _b2;
341
- return {
342
- ...(0, import_utils.mergeProps)(slotsProps.scrollShadowProps, props2),
343
- className: slots.listboxWrapper({
344
- class: (0, import_shared_utils.clsx)(
345
- classNames == null ? void 0 : classNames.listboxWrapper,
346
- (_a2 = slotsProps.scrollShadowProps) == null ? void 0 : _a2.className,
347
- props2 == null ? void 0 : props2.className
348
- )
349
- }),
350
- style: {
351
- maxHeight: (_b2 = originalProps.maxListboxHeight) != null ? _b2 : 256
352
- }
353
- };
354
- };
355
- const getEndContentWrapperProps = (props2 = {}) => ({
356
- className: slots.endContentWrapper({
357
- class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.endContentWrapper, props2 == null ? void 0 : props2.className)
358
- }),
359
- onPointerDown: (0, import_utils.chain)(props2.onPointerDown, (e) => {
360
- var _a2;
361
- if (e.button === 0 && e.currentTarget === e.target) {
362
- (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
363
- }
364
- }),
365
- onMouseDown: (0, import_utils.chain)(props2.onMouseDown, (e) => {
366
- if (e.button === 0 && e.currentTarget === e.target) {
367
- e.preventDefault();
368
- }
369
- })
370
- });
371
- return {
372
- Component,
373
- inputRef,
374
- label,
375
- state,
376
- slots,
377
- classNames,
378
- isLoading,
379
- clearIcon,
380
- isOpen,
381
- endContent,
382
- isClearable,
383
- disableAnimation,
384
- allowsCustomValue,
385
- selectorIcon,
386
- getBaseProps,
387
- getInputProps,
388
- getListBoxProps,
389
- getPopoverProps,
390
- getEmptyPopoverProps,
391
- getClearButtonProps,
392
- getSelectorButtonProps,
393
- getListBoxWrapperProps,
394
- getEndContentWrapperProps
395
- };
396
- }
397
- // Annotate the CommonJS export names for ESM import in node:
398
- 0 && (module.exports = {
399
- useAutocomplete
400
- });
@@ -1,7 +0,0 @@
1
- "use client";
2
- import {
3
- useAutocomplete
4
- } from "./chunk-QZCVHGAT.mjs";
5
- export {
6
- useAutocomplete
7
- };