@jobber/components 6.101.4 → 6.101.5-JOB-140604-4487daa.55

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.
Files changed (177) hide show
  1. package/dist/Autocomplete/Autocomplete.types.d.ts +11 -51
  2. package/dist/Autocomplete/components/MenuList.d.ts +3 -2
  3. package/dist/Autocomplete/components/PersistentRegion.d.ts +3 -2
  4. package/dist/Autocomplete/hooks/useAutocompleteListNav.d.ts +3 -2
  5. package/dist/Autocomplete/index.cjs +95 -51
  6. package/dist/Autocomplete/index.mjs +97 -53
  7. package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +14 -1
  8. package/dist/Autocomplete/useAutocomplete.d.ts +4 -3
  9. package/dist/Autocomplete/utils/interactionUtils.d.ts +14 -0
  10. package/dist/Card-cjs.js +1 -1
  11. package/dist/Card-es.js +1 -1
  12. package/dist/Checkbox/Checkbox.rebuilt.d.ts +2 -2
  13. package/dist/Checkbox/Checkbox.types.d.ts +24 -18
  14. package/dist/Checkbox/index.cjs +9 -2
  15. package/dist/Checkbox/index.mjs +9 -2
  16. package/dist/Chip/Chip.d.ts +1 -2
  17. package/dist/Chip/hooks/useChildComponent.d.ts +4 -3
  18. package/dist/Chip/index.cjs +1 -1
  19. package/dist/Chip-cjs.js +5 -4
  20. package/dist/Chip-es.js +5 -4
  21. package/dist/ChipDismissible-cjs.js +4 -4
  22. package/dist/ChipDismissible-es.js +5 -5
  23. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
  24. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
  25. package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +1 -1
  26. package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +1 -1
  27. package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +1 -1
  28. package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
  29. package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
  30. package/dist/Chips/index.cjs +2 -2
  31. package/dist/Chips/index.mjs +2 -2
  32. package/dist/Combobox/Combobox.d.ts +2 -1
  33. package/dist/Combobox/Combobox.types.d.ts +2 -2
  34. package/dist/Combobox/ComboboxProvider.d.ts +3 -3
  35. package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -1
  36. package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +2 -1
  37. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts +2 -1
  38. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContentList.d.ts +2 -1
  39. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts +2 -1
  40. package/dist/Combobox/hooks/useCombobox.d.ts +1 -1
  41. package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +2 -2
  42. package/dist/Combobox/hooks/useComboboxContent.d.ts +2 -1
  43. package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +1 -1
  44. package/dist/ComboboxActivator-cjs.js +2 -2
  45. package/dist/ComboboxActivator-es.js +3 -3
  46. package/dist/ComboboxTrigger-cjs.js +1 -1
  47. package/dist/ComboboxTrigger-es.js +2 -2
  48. package/dist/DataList/DataList.types.d.ts +2 -2
  49. package/dist/DataList/DataList.utils.d.ts +2 -2
  50. package/dist/DataList/components/DataListHeader/index.cjs +1 -0
  51. package/dist/DataList/components/DataListHeader/index.mjs +1 -0
  52. package/dist/DataList/components/DataListHeaderTile/components/DataListSortingOptions.d.ts +2 -2
  53. package/dist/DataList/components/DataListItem/DataListItemInternal.d.ts +2 -2
  54. package/dist/DataList/components/DataListItem/index.cjs +1 -0
  55. package/dist/DataList/components/DataListItem/index.mjs +1 -0
  56. package/dist/DataList/components/DataListItems/index.cjs +1 -0
  57. package/dist/DataList/components/DataListItems/index.mjs +1 -0
  58. package/dist/DataList/components/DataListLayout/index.cjs +1 -0
  59. package/dist/DataList/components/DataListLayout/index.mjs +1 -0
  60. package/dist/DataList/components/DataListSearch/index.cjs +2 -12
  61. package/dist/DataList/components/DataListSearch/index.mjs +2 -12
  62. package/dist/DataList/hooks/useGetItemActions.d.ts +1 -1
  63. package/dist/DataList/index.cjs +1 -8
  64. package/dist/DataList/index.mjs +1 -8
  65. package/dist/DataListActions-cjs.js +4 -2
  66. package/dist/DataListActions-es.js +4 -2
  67. package/dist/DataListItem-cjs.js +8 -7
  68. package/dist/DataListItem-es.js +9 -8
  69. package/dist/DataListSort-cjs.js +1 -1
  70. package/dist/DataListSort-es.js +2 -2
  71. package/dist/DataTable/SortIcon.d.ts +2 -1
  72. package/dist/DataTable/components/DataTableSortableHeader.d.ts +1 -1
  73. package/dist/DataTable/index.cjs +3 -2
  74. package/dist/DataTable/index.mjs +3 -2
  75. package/dist/DatePicker/DatePicker.d.ts +5 -1
  76. package/dist/DatePicker/index.cjs +2 -2
  77. package/dist/DatePicker/index.mjs +2 -2
  78. package/dist/DatePicker/useFocusOnSelectedDate.d.ts +1 -2
  79. package/dist/DatePicker-cjs.js +4 -2
  80. package/dist/DatePicker-es.js +5 -3
  81. package/dist/FormField/FormFieldAffix.d.ts +2 -2
  82. package/dist/FormField/FormFieldTypes.d.ts +3 -5
  83. package/dist/FormField/FormFieldWrapper.d.ts +5 -1
  84. package/dist/FormField/hooks/useFormFieldFocus.d.ts +1 -1
  85. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +9 -4
  86. package/dist/FormField-cjs.js +35 -31
  87. package/dist/FormField-es.js +35 -31
  88. package/dist/InputDate/InputDate.types.d.ts +12 -7
  89. package/dist/InputDate/index.cjs +35 -12
  90. package/dist/InputDate/index.mjs +35 -12
  91. package/dist/InputDate/useInputDateActivatorActions.d.ts +4 -8
  92. package/dist/InputEmail/InputEmail.types.d.ts +10 -20
  93. package/dist/InputEmail/hooks/useInputEmailActions.d.ts +10 -4
  94. package/dist/InputEmail/index.cjs +43 -60
  95. package/dist/InputEmail/index.mjs +44 -61
  96. package/dist/InputFile-cjs.js +5 -2
  97. package/dist/InputFile-es.js +5 -2
  98. package/dist/InputGroup-cjs.js +5 -2
  99. package/dist/InputGroup-es.js +5 -2
  100. package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +7 -15
  101. package/dist/InputNumber/index.cjs +7 -5
  102. package/dist/InputNumber/index.mjs +7 -5
  103. package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +12 -28
  104. package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +9 -4
  105. package/dist/InputPhoneNumber/index.cjs +37 -36
  106. package/dist/InputPhoneNumber/index.mjs +38 -37
  107. package/dist/InputText/InputText.d.ts +2 -2
  108. package/dist/InputText/InputText.types.d.ts +30 -25
  109. package/dist/InputText/index.cjs +54 -62
  110. package/dist/InputText/index.mjs +55 -63
  111. package/dist/InputText/useInputTextActions.d.ts +11 -5
  112. package/dist/InputText/useTextAreaResize.d.ts +2 -2
  113. package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
  114. package/dist/InputTime/InputTime.types.d.ts +13 -4
  115. package/dist/InputTime/hooks/useInputTimeActions.d.ts +21 -0
  116. package/dist/InputTime/index.cjs +90 -30
  117. package/dist/InputTime/index.mjs +93 -33
  118. package/dist/InternalChipDismissible-cjs.js +3 -3
  119. package/dist/InternalChipDismissible-es.js +4 -4
  120. package/dist/List/index.cjs +2 -2
  121. package/dist/List/index.mjs +2 -2
  122. package/dist/Menu/Menu.d.ts +2 -4
  123. package/dist/Menu/Menu.types.d.ts +21 -5
  124. package/dist/Menu-cjs.js +9 -9
  125. package/dist/Menu-es.js +9 -9
  126. package/dist/Modal/Modal.types.d.ts +3 -3
  127. package/dist/Modal/ModalContext.rebuilt.d.ts +2 -2
  128. package/dist/MultiSelect/DropDownMenu.d.ts +1 -1
  129. package/dist/MultiSelect/index.cjs +1 -0
  130. package/dist/MultiSelect/index.mjs +1 -0
  131. package/dist/MultiSelect-cjs.js +13 -7
  132. package/dist/MultiSelect-es.js +13 -7
  133. package/dist/RadioGroup/RadioGroup.d.ts +2 -1
  134. package/dist/RadioGroup/RadioOption.d.ts +1 -1
  135. package/dist/RecurringSelect/index.cjs +3 -2
  136. package/dist/RecurringSelect/index.mjs +3 -2
  137. package/dist/Select/Select.types.d.ts +7 -3
  138. package/dist/Select/hooks/useSelectActions.d.ts +5 -5
  139. package/dist/Select/index.cjs +27 -42
  140. package/dist/Select/index.mjs +29 -44
  141. package/dist/StatusLabel/StatusLabel.d.ts +2 -1
  142. package/dist/Tabs/hooks/useTabsOverflow.d.ts +2 -2
  143. package/dist/Tabs-cjs.js +4 -2
  144. package/dist/Tabs-es.js +5 -3
  145. package/dist/Tooltip/useTooltipPositioning.d.ts +1 -1
  146. package/dist/_baseEach-cjs.js +12 -12
  147. package/dist/_baseEach-es.js +1 -1
  148. package/dist/_baseFlatten-cjs.js +2 -2
  149. package/dist/_baseFlatten-es.js +1 -1
  150. package/dist/{_baseGet-cjs.js → _getAllKeys-cjs.js} +181 -181
  151. package/dist/{_baseGet-es.js → _getAllKeys-es.js} +182 -182
  152. package/dist/debounce-es.js +1 -1
  153. package/dist/filterDataAttributes-cjs.js +26 -0
  154. package/dist/filterDataAttributes-es.js +24 -0
  155. package/dist/floating-ui.react-cjs.js +115 -0
  156. package/dist/floating-ui.react-es.js +115 -1
  157. package/dist/helpers-cjs.js +1 -1
  158. package/dist/helpers-es.js +1 -1
  159. package/dist/index.cjs +4 -3
  160. package/dist/index.mjs +3 -2
  161. package/dist/omit-cjs.js +14 -14
  162. package/dist/omit-es.js +1 -1
  163. package/dist/sharedHelpers/filterDataAttributes.d.ts +17 -0
  164. package/dist/sharedHelpers/types.d.ts +231 -0
  165. package/dist/showToast-cjs.js +2 -2
  166. package/dist/showToast-es.js +2 -2
  167. package/dist/styles.css +32 -23
  168. package/dist/useChildComponent-cjs.js +1 -1
  169. package/dist/useChildComponent-es.js +1 -1
  170. package/dist/useScrollToActive-cjs.js +3 -3
  171. package/dist/useScrollToActive-es.js +2 -2
  172. package/dist/utils/mergeRefs.d.ts +2 -2
  173. package/package.json +2 -2
  174. package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +0 -32
  175. package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +0 -71
  176. package/dist/InputText/useInputTextFormField.d.ts +0 -352
  177. package/dist/Select/hooks/useSelectFormField.d.ts +0 -34
@@ -1,6 +1,14 @@
1
1
  import type { CSSProperties, Key, Ref, RefObject } from "react";
2
+ import type { AriaInputProps, FocusEvents, HTMLInputBaseProps, RebuiltInputCommonProps } from "../sharedHelpers/types";
2
3
  import type { FormFieldProps } from "../FormField";
3
4
  import type { InputTextRebuiltProps, InputTextRef } from "../InputText";
5
+ /**
6
+ * ARIA attributes for Autocomplete with managed/orchestrated behavior.
7
+ * Certain ARIA attributes are controlled internally by Autocomplete's
8
+ * state management and floating-ui integration and shouldn't be overridden.
9
+ */
10
+ interface AriaInputPropsManaged extends Omit<AriaInputProps, "aria-controls" | "aria-expanded" | "aria-activedescendant" | "aria-autocomplete"> {
11
+ }
4
12
  export type ExtraProps = Record<string, unknown>;
5
13
  type OptionValue = string | number;
6
14
  export interface BaseOption {
@@ -222,8 +230,7 @@ export type MenuFooter<Extra extends object = ExtraProps> = Extra & {
222
230
  };
223
231
  export type MenuItem<T extends OptionLike, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps> = MenuSection<T, SectionExtra, ActionExtra> | MenuOptions<T, ActionExtra> | MenuHeader<ActionExtra> | MenuFooter<ActionExtra>;
224
232
  export type AutocompleteValue<Value extends OptionLike, Multiple extends boolean> = Multiple extends true ? Value[] : Value | undefined;
225
- interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extends boolean, SectionExtra extends object, ActionExtra extends object> {
226
- version: 2;
233
+ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extends boolean, SectionExtra extends object, ActionExtra extends object> extends AriaInputPropsManaged, Pick<HTMLInputBaseProps, "name" | "disabled" | "readOnly" | "autoFocus">, Pick<RebuiltInputCommonProps, "placeholder" | "error" | "invalid" | "loading" | "description" | "size" | "prefix" | "suffix" | "version">, FocusEvents<HTMLInputElement | HTMLTextAreaElement> {
227
234
  /**
228
235
  * Whether the autocomplete allows multiple selections.
229
236
  * WARNING: This is currently incomplete and will not display selections, only data is returned.
@@ -243,14 +250,6 @@ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extend
243
250
  * Callback invoked when the input value changes.
244
251
  */
245
252
  readonly onInputChange: (value: string) => void;
246
- /**
247
- * Callback invoked when the input is blurred.
248
- */
249
- readonly onBlur?: () => void;
250
- /**
251
- * Callback invoked when the input is focused.
252
- */
253
- readonly onFocus?: () => void;
254
253
  /**
255
254
  * Custom equality for input text to option mapping.
256
255
  * Defaults to case-sensitive label equality via getOptionLabel.
@@ -380,46 +379,12 @@ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extend
380
379
  }) => MenuAction<ActionExtra>[]);
381
380
  /**
382
381
  * Whether the menu should open when the input gains focus.
382
+ * Note: Clicking on the input will always open the menu.
383
+ * openOnFocus only determines the behavior of focus events such as tabs or programmatic focus.
383
384
  *
384
385
  * @default true
385
386
  */
386
387
  readonly openOnFocus?: boolean;
387
- /**
388
- * The placeholder text for the input.
389
- */
390
- readonly placeholder?: string;
391
- /**
392
- * Whether the input is disabled.
393
- */
394
- readonly disabled?: boolean;
395
- /**
396
- * Error message to display below the input
397
- * When present, invalid appearance applied to the input
398
- */
399
- readonly error?: string;
400
- /**
401
- * Whether the input is invalid. Receives invalid appearance.
402
- */
403
- readonly invalid?: boolean;
404
- /**
405
- * Whether the input is read-only.
406
- * @default false
407
- */
408
- readonly readOnly?: boolean;
409
- /**
410
- * Description to display below the input
411
- */
412
- readonly description?: string;
413
- /**
414
- * Name of the input for form submission
415
- */
416
- readonly name?: string;
417
- /**
418
- * Size of the input
419
- */
420
- readonly size?: InputTextRebuiltProps["size"];
421
- readonly suffix?: InputTextRebuiltProps["suffix"];
422
- readonly prefix?: InputTextRebuiltProps["prefix"];
423
388
  /**
424
389
  * Callback invoked when the menu opens.
425
390
  *
@@ -430,11 +395,6 @@ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extend
430
395
  *
431
396
  */
432
397
  readonly onClose?: () => void;
433
- /**
434
- * Whether the menu is loading.
435
- * Displays glimmers in the menu
436
- */
437
- readonly loading?: boolean;
438
398
  /**
439
399
  * Custom render prop for content to render when `loading` is true.
440
400
  */
@@ -6,7 +6,7 @@ interface MenuListProps<T extends OptionLike> {
6
6
  readonly activeIndex: number | null;
7
7
  readonly indexOffset?: number;
8
8
  readonly getItemProps: (userProps?: Record<string, unknown>) => Record<string, unknown>;
9
- readonly listRef: React.MutableRefObject<Array<HTMLElement | null>>;
9
+ readonly listRef: React.RefObject<Array<HTMLElement | null>>;
10
10
  readonly listboxId: string;
11
11
  readonly customRenderOption?: AutocompleteRebuiltProps<T, false>["customRenderOption"];
12
12
  readonly customRenderSection?: AutocompleteRebuiltProps<T, false>["customRenderSection"];
@@ -14,6 +14,7 @@ interface MenuListProps<T extends OptionLike> {
14
14
  readonly getOptionLabel: (option: T) => string;
15
15
  readonly onSelect: (option: T) => void;
16
16
  readonly onAction: (action: ActionConfig) => void;
17
+ readonly onInteractionPointerDown: (e: React.PointerEvent) => void;
17
18
  readonly isOptionSelected: (option: T) => boolean;
18
19
  readonly slotOverrides?: {
19
20
  option?: {
@@ -30,7 +31,7 @@ interface MenuListProps<T extends OptionLike> {
30
31
  };
31
32
  };
32
33
  }
33
- export declare function MenuList<T extends OptionLike>({ items, activeIndex, indexOffset, getItemProps, listRef, listboxId, customRenderOption, customRenderSection, customRenderAction, getOptionLabel, onSelect, onAction, isOptionSelected, slotOverrides, }: MenuListProps<T>): React.JSX.Element;
34
+ export declare function MenuList<T extends OptionLike>({ items, activeIndex, indexOffset, getItemProps, listRef, listboxId, customRenderOption, customRenderSection, customRenderAction, getOptionLabel, onSelect, onAction, onInteractionPointerDown, isOptionSelected, slotOverrides, }: MenuListProps<T>): React.JSX.Element;
34
35
  export declare function DefaultActionContent({ textContent, }: {
35
36
  readonly textContent: string;
36
37
  }): React.JSX.Element;
@@ -7,12 +7,13 @@ interface PersistentRegionProps<T extends OptionLike> {
7
7
  readonly indexOffset: number;
8
8
  readonly listboxId?: string;
9
9
  readonly getItemProps: (args?: Record<string, unknown>) => Record<string, unknown>;
10
- readonly listRef: React.MutableRefObject<Array<HTMLElement | null>>;
10
+ readonly listRef: React.RefObject<Array<HTMLElement | null>>;
11
11
  readonly customRenderHeader?: AutocompleteRebuiltProps<T, false>["customRenderHeader"];
12
12
  readonly customRenderFooter?: AutocompleteRebuiltProps<T, false>["customRenderFooter"];
13
13
  readonly className?: string;
14
14
  readonly style?: React.CSSProperties;
15
15
  readonly onAction: (action: ActionConfig) => void;
16
+ readonly onInteractionPointerDown: (e: React.PointerEvent) => void;
16
17
  }
17
- export declare function PersistentRegion<T extends OptionLike>({ items, position, activeIndex, indexOffset, getItemProps, listRef, customRenderHeader, customRenderFooter, className, style, onAction, }: PersistentRegionProps<T>): React.JSX.Element | null;
18
+ export declare function PersistentRegion<T extends OptionLike>({ items, position, activeIndex, indexOffset, getItemProps, listRef, customRenderHeader, customRenderFooter, className, style, onAction, onInteractionPointerDown, }: PersistentRegionProps<T>): React.JSX.Element | null;
18
19
  export {};
@@ -8,7 +8,7 @@ export interface UseAutocompleteListNavReturn {
8
8
  getItemProps: UseInteractionsReturn["getItemProps"];
9
9
  activeIndex: number | null;
10
10
  setActiveIndex: (index: number | null) => void;
11
- listRef: React.MutableRefObject<Array<HTMLElement | null>>;
11
+ listRef: React.RefObject<Array<HTMLElement | null>>;
12
12
  open: boolean;
13
13
  setOpen: (open: boolean) => void;
14
14
  setReferenceElement: (el: HTMLElement | null) => void;
@@ -18,5 +18,6 @@ export interface UseAutocompleteListNavProps {
18
18
  shouldResetActiveIndexOnClose?: () => boolean;
19
19
  onMenuClose?: (reason?: string) => void;
20
20
  selectedIndex?: number | null;
21
+ readOnly?: boolean;
21
22
  }
22
- export declare function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose, onMenuClose, selectedIndex, }: UseAutocompleteListNavProps): UseAutocompleteListNavReturn;
23
+ export declare function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose, onMenuClose, selectedIndex, readOnly, }: UseAutocompleteListNavProps): UseAutocompleteListNavReturn;
@@ -13,6 +13,7 @@ var Icon = require('../Icon-cjs.js');
13
13
  var InputText_index = require('../InputText/index.cjs');
14
14
  var Glimmer = require('../Glimmer-cjs.js');
15
15
  var FormField = require('../FormField-cjs.js');
16
+ var filterDataAttributes = require('../filterDataAttributes-cjs.js');
16
17
  var tslib_es6 = require('../tslib.es6-cjs.js');
17
18
  require('react/jsx-runtime');
18
19
  require('react-dom');
@@ -20,18 +21,6 @@ require('react-hook-form');
20
21
  require('framer-motion');
21
22
  require('../Button-cjs.js');
22
23
  require('react-router-dom');
23
- require('../omit-cjs.js');
24
- require('../_commonjsHelpers-cjs.js');
25
- require('../_baseGet-cjs.js');
26
- require('../isTypedArray-cjs.js');
27
- require('../isObjectLike-cjs.js');
28
- require('../identity-cjs.js');
29
- require('../_getTag-cjs.js');
30
- require('../isSymbol-cjs.js');
31
- require('../keysIn-cjs.js');
32
- require('../_baseAssignValue-cjs.js');
33
- require('../_baseFlatten-cjs.js');
34
- require('../_setToString-cjs.js');
35
24
  require('../useFormFieldFocus-cjs.js');
36
25
  require('../InputValidation-cjs.js');
37
26
  require('../Spinner-cjs.js');
@@ -140,7 +129,7 @@ function invokeActiveItemOnEnter(event, activeIndex, renderable, onSelect, onAct
140
129
 
141
130
  const MENU_OFFSET = design.tokens["space-small"];
142
131
  const AUTOCOMPLETE_MAX_HEIGHT$1 = 300;
143
- function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose, onMenuClose, selectedIndex, }) {
132
+ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose, onMenuClose, selectedIndex, readOnly = false, }) {
144
133
  const [open, setOpen] = React.useState(false);
145
134
  const [activeIndex, setActiveIndex] = React.useState(null);
146
135
  const listRef = React.useRef([]);
@@ -172,6 +161,10 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
172
161
  }),
173
162
  ],
174
163
  });
164
+ const click = floatingUi_react.useClick(context, {
165
+ enabled: !readOnly,
166
+ toggle: false, // Only open, never close on click
167
+ });
175
168
  const listNav = floatingUi_react.useListNavigation(context, {
176
169
  listRef,
177
170
  activeIndex,
@@ -193,7 +186,7 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
193
186
  escapeKey: true,
194
187
  outsidePressEvent: "click",
195
188
  });
196
- const { getReferenceProps, getFloatingProps, getItemProps } = floatingUi_react.useInteractions([listNav, dismiss]);
189
+ const { getReferenceProps, getFloatingProps, getItemProps } = floatingUi_react.useInteractions([click, listNav, dismiss]);
197
190
  React.useEffect(() => {
198
191
  listRef.current.length = navigableCount;
199
192
  setActiveIndex(prev => {
@@ -220,11 +213,34 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
220
213
  };
221
214
  }
222
215
 
216
+ /**
217
+ * Handler that prevents default pointer behavior.
218
+ * Used to prevent blur/focus issues when clicking on non-interactive menu elements.
219
+ */
220
+ function preventDefaultPointerDown(e) {
221
+ e.preventDefault();
222
+ }
223
+ /**
224
+ * Creates a handler for pointer down events on interactive menu items (options/actions).
225
+ * Prevents default to avoid blur and sets flag for focus management.
226
+ *
227
+ * @param isHandlingMenuInteractionRef - Ref to track if a menu interaction is in progress
228
+ * @returns A pointer down event handler
229
+ */
230
+ function createInteractionPointerDownHandler(isHandlingMenuInteractionRef) {
231
+ return (e) => {
232
+ e.preventDefault();
233
+ // Set flag to prevent blur/focus handlers from interfering
234
+ isHandlingMenuInteractionRef.current = true;
235
+ };
236
+ }
237
+
223
238
  // Keeping this hook cohesive improves readability by centralizing related
224
239
  // interactions and state transitions.
225
240
  // eslint-disable-next-line max-statements
226
241
  function useAutocomplete(props) {
227
242
  const { menu, emptyActions, getOptionLabel: getOptionLabelProp, isOptionEqualToValue, inputValue, onInputChange, value, onChange, multiple, openOnFocus = true, readOnly = false, debounce: debounceMs = 300, } = props;
243
+ const isHandlingMenuInteractionRef = React.useRef(false);
228
244
  // TODO: Clean up the types in these refs by enhancing the type system in useCallbackRef
229
245
  const getOptionLabelPropRef = jobberHooks.useCallbackRef((opt) => getOptionLabelProp === null || getOptionLabelProp === void 0 ? void 0 : getOptionLabelProp(opt));
230
246
  const getOptionLabel = React.useCallback((opt) => {
@@ -267,7 +283,8 @@ function useAutocomplete(props) {
267
283
  const [debouncedInputValue, setDebouncedInputValue] = React.useState(inputValue);
268
284
  const debouncedSetter = jobberHooks.useDebounce(setDebouncedInputValue, debounceMs);
269
285
  React.useEffect(() => {
270
- if (debounceMs === 0) {
286
+ // Skip debounce when clearing input for immediate feedback, preventing flickering of last selected item
287
+ if (debounceMs === 0 || inputValue === "") {
271
288
  setDebouncedInputValue(inputValue);
272
289
  return;
273
290
  }
@@ -357,6 +374,7 @@ function useAutocomplete(props) {
357
374
  navigableCount: totalNavigableCount,
358
375
  shouldResetActiveIndexOnClose: () => !hasSelection,
359
376
  selectedIndex,
377
+ readOnly,
360
378
  onMenuClose: () => {
361
379
  if (props.allowFreeForm !== true) {
362
380
  const hasText = inputValue.trim().length > 0;
@@ -368,7 +386,6 @@ function useAutocomplete(props) {
368
386
  }
369
387
  },
370
388
  });
371
- const [inputFocused, setInputFocused] = React.useState(false);
372
389
  // Handles activeIndex reset and, in single-select mode only, clearing selection when input is empty
373
390
  React.useEffect(() => {
374
391
  const hasText = inputValue.trim().length > 0;
@@ -464,13 +481,24 @@ function useAutocomplete(props) {
464
481
  selectOption(option);
465
482
  // Might not always want to close on selection. Multi for example.
466
483
  setOpen(false);
484
+ if (refs.domReference.current instanceof HTMLElement) {
485
+ refs.domReference.current.focus();
486
+ }
467
487
  }, [selectOption, setOpen]);
468
488
  const onAction = React.useCallback((action) => {
469
489
  action.run();
470
490
  setActiveIndex(null);
471
491
  if (action.closeOnRun !== false)
472
492
  setOpen(false);
493
+ if (refs.domReference.current instanceof HTMLElement) {
494
+ refs.domReference.current.focus();
495
+ }
473
496
  }, [setOpen, setActiveIndex]);
497
+ /**
498
+ * Handler for mousedown on interactive menu items (options/actions)
499
+ * Prevents default to avoid blur and sets flag for focus management
500
+ */
501
+ const onInteractionPointerDown = React.useMemo(() => createInteractionPointerDownHandler(isHandlingMenuInteractionRef), []);
474
502
  function commitFromInputText(inputText) {
475
503
  var _a;
476
504
  if (inputText.length === 0)
@@ -510,18 +538,24 @@ function useAutocomplete(props) {
510
538
  multiple,
511
539
  value,
512
540
  ]);
513
- const onInputFocus = React.useCallback(() => {
541
+ const onInputFocus = React.useCallback((event) => {
514
542
  var _a;
515
- setInputFocused(true);
516
- if (!readOnly && openOnFocus)
543
+ if (!readOnly && openOnFocus && !isHandlingMenuInteractionRef.current) {
517
544
  setOpen(true);
518
- (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props);
545
+ }
546
+ // Only call user's onFocus for genuine focus events, not programmatic restorations
547
+ if (!isHandlingMenuInteractionRef.current) {
548
+ (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
549
+ }
550
+ isHandlingMenuInteractionRef.current = false;
519
551
  }, [props.onFocus, readOnly, openOnFocus, setOpen]);
520
- const onInputBlur = React.useCallback(() => {
552
+ const onInputBlur = React.useCallback((event) => {
521
553
  var _a, _b;
522
- setInputFocused(false);
554
+ if (isHandlingMenuInteractionRef.current) {
555
+ return;
556
+ }
523
557
  if (readOnly) {
524
- (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
558
+ (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
525
559
  return;
526
560
  }
527
561
  if (props.allowFreeForm === true) {
@@ -533,7 +567,7 @@ function useAutocomplete(props) {
533
567
  tryRestoreInputToSelectedLabel();
534
568
  }
535
569
  lastInputWasUser.current = false;
536
- (_b = props.onBlur) === null || _b === void 0 ? void 0 : _b.call(props);
570
+ (_b = props.onBlur) === null || _b === void 0 ? void 0 : _b.call(props, event);
537
571
  }, [
538
572
  readOnly,
539
573
  props.allowFreeForm,
@@ -625,11 +659,11 @@ function useAutocomplete(props) {
625
659
  setActiveIndex(null);
626
660
  }
627
661
  // Important: update open state before propagating the change so that downstream effects
628
- // dont see an intermediate state where inputValue changed but open was stale
662
+ // don't see an intermediate state where inputValue changed but open was stale
629
663
  if (!readOnly) {
630
664
  const hasText = val.trim().length > 0;
631
665
  const mustSelectFromOptions = hasText && !props.allowFreeForm;
632
- const keepOpenOnEmpty = openOnFocus && inputFocused;
666
+ const keepOpenOnEmpty = openOnFocus;
633
667
  setOpen(mustSelectFromOptions || keepOpenOnEmpty);
634
668
  }
635
669
  onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(val);
@@ -640,7 +674,6 @@ function useAutocomplete(props) {
640
674
  readOnly,
641
675
  props.allowFreeForm,
642
676
  openOnFocus,
643
- inputFocused,
644
677
  setOpen,
645
678
  ]);
646
679
  return {
@@ -669,6 +702,7 @@ function useAutocomplete(props) {
669
702
  // actions
670
703
  onSelection,
671
704
  onAction,
705
+ onInteractionPointerDown,
672
706
  // input handlers
673
707
  onInputChangeFromUser,
674
708
  onInputBlur,
@@ -679,7 +713,7 @@ function useAutocomplete(props) {
679
713
  };
680
714
  }
681
715
 
682
- function MenuList({ items, activeIndex, indexOffset = 0, getItemProps, listRef, listboxId, customRenderOption, customRenderSection, customRenderAction, getOptionLabel, onSelect, onAction, isOptionSelected, slotOverrides, }) {
716
+ function MenuList({ items, activeIndex, indexOffset = 0, getItemProps, listRef, listboxId, customRenderOption, customRenderSection, customRenderAction, getOptionLabel, onSelect, onAction, onInteractionPointerDown, isOptionSelected, slotOverrides, }) {
683
717
  let navigableIndex = -1;
684
718
  function renderItemNode(item) {
685
719
  var _a, _b, _c, _d, _e, _f;
@@ -703,6 +737,7 @@ function MenuList({ items, activeIndex, indexOffset = 0, getItemProps, listRef,
703
737
  customRenderOption,
704
738
  getOptionLabel,
705
739
  onSelect,
740
+ onInteractionPointerDown,
706
741
  indexOffset,
707
742
  optionClassName: (_c = slotOverrides === null || slotOverrides === void 0 ? void 0 : slotOverrides.option) === null || _c === void 0 ? void 0 : _c.className,
708
743
  optionStyle: (_d = slotOverrides === null || slotOverrides === void 0 ? void 0 : slotOverrides.option) === null || _d === void 0 ? void 0 : _d.style,
@@ -719,6 +754,7 @@ function MenuList({ items, activeIndex, indexOffset = 0, getItemProps, listRef,
719
754
  listboxId,
720
755
  customRenderAction,
721
756
  onAction,
757
+ onInteractionPointerDown,
722
758
  indexOffset,
723
759
  actionClassName: (_e = slotOverrides === null || slotOverrides === void 0 ? void 0 : slotOverrides.action) === null || _e === void 0 ? void 0 : _e.className,
724
760
  actionStyle: (_f = slotOverrides === null || slotOverrides === void 0 ? void 0 : slotOverrides.action) === null || _f === void 0 ? void 0 : _f.style,
@@ -732,12 +768,12 @@ function MenuList({ items, activeIndex, indexOffset = 0, getItemProps, listRef,
732
768
  function handleSectionRendering({ customRenderSection, section, sectionClassName, sectionStyle, }) {
733
769
  var _a;
734
770
  const headerContent = customRenderSection ? (customRenderSection(section)) : (React.createElement(DefaultSectionContent, { section: section }));
735
- return (React.createElement("div", { key: `section-${String((_a = section.key) !== null && _a !== void 0 ? _a : section.label)}`, role: "presentation", tabIndex: -1, "data-testid": "ATL-AutocompleteRebuilt-Section", className: classnames(styles$1.section, styles$1.stickyTop, sectionClassName), style: sectionStyle }, headerContent));
771
+ return (React.createElement("div", { key: `section-${String((_a = section.key) !== null && _a !== void 0 ? _a : section.label)}`, role: "presentation", tabIndex: -1, "data-testid": "ATL-AutocompleteRebuilt-Section", className: classnames(styles$1.section, styles$1.stickyTop, sectionClassName), style: sectionStyle, onPointerDown: preventDefaultPointerDown }, headerContent));
736
772
  }
737
773
  function DefaultSectionContent({ section, }) {
738
774
  return React.createElement(Heading.Heading, { level: 5 }, section.label);
739
775
  }
740
- function handleOptionRendering({ option, activeIndex, navigableIndex, getItemProps, listRef, listboxId, isOptionSelected, customRenderOption, getOptionLabel, onSelect, indexOffset = 0, optionClassName, optionStyle, }) {
776
+ function handleOptionRendering({ option, activeIndex, navigableIndex, getItemProps, listRef, listboxId, isOptionSelected, customRenderOption, getOptionLabel, onSelect, onInteractionPointerDown, indexOffset = 0, optionClassName, optionStyle, }) {
741
777
  var _a;
742
778
  const nextNavigableIndex = navigableIndex + 1;
743
779
  const isActive = activeIndex === nextNavigableIndex;
@@ -751,6 +787,7 @@ function handleOptionRendering({ option, activeIndex, navigableIndex, getItemPro
751
787
  listRef.current[idx] = node;
752
788
  },
753
789
  onClick: () => onSelect(option),
790
+ onPointerDown: onInteractionPointerDown,
754
791
  className: classnames(styles$1.option, isActive && styles$1.optionActive, optionClassName),
755
792
  style: optionStyle,
756
793
  }), { role: "option", tabIndex: -1, "aria-selected": isSelected ? true : false, id: `${listboxId}-item-${nextNavigableIndex + indexOffset}`, "data-index": nextNavigableIndex + indexOffset, "data-active": isActive ? true : undefined }), optionContent)),
@@ -762,7 +799,7 @@ function DefaultOptionContent({ isSelected, text, }) {
762
799
  React.createElement("div", { className: styles$1.icon }, isSelected && React.createElement(Icon.Icon, { name: "checkmark", size: "small" })),
763
800
  React.createElement(Text.Text, null, text)));
764
801
  }
765
- function handleActionRendering({ action, activeIndex, navigableIndex, getItemProps, listRef, listboxId, customRenderAction, onAction, indexOffset = 0, actionClassName, actionStyle, origin, }) {
802
+ function handleActionRendering({ action, activeIndex, navigableIndex, getItemProps, listRef, listboxId, customRenderAction, onAction, onInteractionPointerDown, indexOffset = 0, actionClassName, actionStyle, origin, }) {
766
803
  var _a;
767
804
  const nextNavigableIndex = navigableIndex + 1;
768
805
  const isActive = activeIndex === nextNavigableIndex;
@@ -780,6 +817,7 @@ function handleActionRendering({ action, activeIndex, navigableIndex, getItemPro
780
817
  closeOnRun: action.shouldClose,
781
818
  });
782
819
  },
820
+ onPointerDown: onInteractionPointerDown,
783
821
  className: classnames(styles$1.action, isActive && styles$1.actionActive, actionClassName),
784
822
  style: actionStyle,
785
823
  });
@@ -797,7 +835,7 @@ function DefaultActionContent({ textContent, }) {
797
835
  } }, textContent));
798
836
  }
799
837
 
800
- function PersistentRegion({ items, position, activeIndex, indexOffset, getItemProps, listRef, customRenderHeader, customRenderFooter, className, style, onAction, }) {
838
+ function PersistentRegion({ items, position, activeIndex, indexOffset, getItemProps, listRef, customRenderHeader, customRenderFooter, className, style, onAction, onInteractionPointerDown, }) {
801
839
  if (!items || items.length === 0)
802
840
  return null;
803
841
  let navigableIndex = -1;
@@ -812,13 +850,14 @@ function PersistentRegion({ items, position, activeIndex, indexOffset, getItemPr
812
850
  customRenderFooter,
813
851
  listRef,
814
852
  onAction,
853
+ onInteractionPointerDown,
815
854
  navigableIndex,
816
855
  });
817
856
  navigableIndex = result.nextNavigableIndex;
818
857
  return result.node;
819
858
  })));
820
859
  }
821
- function handlePersistentRendering({ persistent, position, activeIndex, indexOffset, getItemProps, customRenderHeader, customRenderFooter, listRef, onAction, navigableIndex, }) {
860
+ function handlePersistentRendering({ persistent, position, activeIndex, indexOffset, getItemProps, customRenderHeader, customRenderFooter, listRef, onAction, onInteractionPointerDown, navigableIndex, }) {
822
861
  const interactive = Boolean(persistent.onClick);
823
862
  if (!interactive) {
824
863
  const node = handleTextPersistentRendering({
@@ -839,6 +878,7 @@ function handlePersistentRendering({ persistent, position, activeIndex, indexOff
839
878
  customRenderFooter,
840
879
  listRef,
841
880
  onAction,
881
+ onInteractionPointerDown,
842
882
  navigableIndex,
843
883
  });
844
884
  }
@@ -854,9 +894,9 @@ function handleTextPersistentRendering({ persistent, position, customRenderHeade
854
894
  else {
855
895
  content = React.createElement(DefaultTextPersistentContent, { persistent: persistent });
856
896
  }
857
- return (React.createElement("div", { key: `persistent-${position}-${String((_a = persistent.key) !== null && _a !== void 0 ? _a : persistent.label)}`, role: "presentation", tabIndex: -1, className: styles$1.textPersistent }, content));
897
+ return (React.createElement("div", { key: `persistent-${position}-${String((_a = persistent.key) !== null && _a !== void 0 ? _a : persistent.label)}`, role: "presentation", tabIndex: -1, className: styles$1.textPersistent, onPointerDown: preventDefaultPointerDown }, content));
858
898
  }
859
- function handleActionPersistentRendering({ persistent, position, activeIndex, indexOffset, getItemProps, customRenderHeader, customRenderFooter, listRef, onAction, navigableIndex, }) {
899
+ function handleActionPersistentRendering({ persistent, position, activeIndex, indexOffset, getItemProps, customRenderHeader, customRenderFooter, listRef, onAction, onInteractionPointerDown, navigableIndex, }) {
860
900
  var _a;
861
901
  const nextNavigableIndex = navigableIndex + 1;
862
902
  const isActive = activeIndex === indexOffset + nextNavigableIndex;
@@ -883,13 +923,16 @@ function handleActionPersistentRendering({ persistent, position, activeIndex, in
883
923
  if (persistNode)
884
924
  listRef.current[idx] = persistNode;
885
925
  },
886
- onClick: () => onAction({
887
- run: () => {
888
- var _a;
889
- (_a = persistent.onClick) === null || _a === void 0 ? void 0 : _a.call(persistent);
890
- },
891
- closeOnRun: persistent.shouldClose,
892
- }),
926
+ onClick: () => {
927
+ onAction({
928
+ run: () => {
929
+ var _a;
930
+ (_a = persistent.onClick) === null || _a === void 0 ? void 0 : _a.call(persistent);
931
+ },
932
+ closeOnRun: persistent.shouldClose,
933
+ });
934
+ },
935
+ onPointerDown: onInteractionPointerDown,
893
936
  className: classnames(styles$1.action, isActive && styles$1.actionActive),
894
937
  }), { role: "button", tabIndex: -1 }), content)),
895
938
  nextNavigableIndex,
@@ -904,7 +947,7 @@ const AutocompleteRebuilt = React.forwardRef(AutocompleteRebuiltInternal);
904
947
  function AutocompleteRebuiltInternal(props, forwardedRef) {
905
948
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
906
949
  const { inputValue, placeholder, disabled, error, invalid, description, size: sizeProp, loading = false, } = props;
907
- const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, onSelection, onAction, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
950
+ const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, onSelection, onAction, onInteractionPointerDown, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
908
951
  const listboxId = React.useId();
909
952
  // Provides mount/unmount-aware transition styles for the floating element
910
953
  const { isMounted, styles: transitionStyles } = floatingUi_react.useTransitionStyles(context, {
@@ -920,10 +963,11 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
920
963
  onFocus: onInputFocus,
921
964
  onBlur: onInputBlur,
922
965
  });
923
- const inputProps = Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
924
- disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, autoComplete: "off", description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), { role: "combobox", "aria-autocomplete": "list", "aria-expanded": open ? true : false, "aria-controls": listboxId, "aria-activedescendant": open && activeIndex != null
966
+ const dataAttrs = filterDataAttributes.filterDataAttributes(props);
967
+ const inputProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
968
+ disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, autoComplete: "off", autoFocus: props.autoFocus, description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), { role: "combobox", "aria-autocomplete": "list", "aria-expanded": open ? true : false, "aria-controls": listboxId, "aria-activedescendant": open && activeIndex != null
925
969
  ? `${listboxId}-item-${activeIndex}`
926
- : undefined });
970
+ : undefined }), dataAttrs);
927
971
  const referenceInputRef = (node) => {
928
972
  setReferenceElement(node);
929
973
  // Workaround to get the width of the visual InputText element, which is not the same as
@@ -963,10 +1007,10 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
963
1007
  ? { width: menuWidth, maxWidth: menuWidth }
964
1008
  : {})),
965
1009
  })),
966
- React.createElement(PersistentRegion, { items: persistentsHeaders, position: "header", activeIndex: activeIndex, indexOffset: 0, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderHeader: props.customRenderHeader, customRenderFooter: props.customRenderFooter, onAction: onAction, className: classnames(styles$1.persistentHeader, (_c = props.UNSAFE_className) === null || _c === void 0 ? void 0 : _c.header), style: (_d = props.UNSAFE_styles) === null || _d === void 0 ? void 0 : _d.header }),
1010
+ React.createElement(PersistentRegion, { items: persistentsHeaders, position: "header", activeIndex: activeIndex, indexOffset: 0, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderHeader: props.customRenderHeader, customRenderFooter: props.customRenderFooter, onAction: onAction, onInteractionPointerDown: onInteractionPointerDown, className: classnames(styles$1.persistentHeader, (_c = props.UNSAFE_className) === null || _c === void 0 ? void 0 : _c.header), style: (_d = props.UNSAFE_styles) === null || _d === void 0 ? void 0 : _d.header }),
967
1011
  React.createElement("div", { className: styles$1.scrollRegion }, loading ? ((_e = props.customRenderLoading) !== null && _e !== void 0 ? _e : React.createElement(LoadingContent, null)) : (React.createElement(React.Fragment, null,
968
1012
  showEmptyStateMessage && (React.createElement(EmptyStateMessage, { emptyState: props.emptyStateMessage })),
969
- renderable.length > 0 && (React.createElement(MenuList, { items: renderable, activeIndex: activeIndexForMiddle, indexOffset: headerInteractiveCount, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderOption: props.customRenderOption, customRenderSection: props.customRenderSection, customRenderAction: props.customRenderAction, getOptionLabel: getOptionLabel, onSelect: onSelection, onAction: onAction, isOptionSelected: isOptionSelected, slotOverrides: {
1013
+ renderable.length > 0 && (React.createElement(MenuList, { items: renderable, activeIndex: activeIndexForMiddle, indexOffset: headerInteractiveCount, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderOption: props.customRenderOption, customRenderSection: props.customRenderSection, customRenderAction: props.customRenderAction, getOptionLabel: getOptionLabel, onSelect: onSelection, onAction: onAction, onInteractionPointerDown: onInteractionPointerDown, isOptionSelected: isOptionSelected, slotOverrides: {
970
1014
  option: {
971
1015
  className: (_f = props.UNSAFE_className) === null || _f === void 0 ? void 0 : _f.option,
972
1016
  style: (_g = props.UNSAFE_styles) === null || _g === void 0 ? void 0 : _g.option,
@@ -980,10 +1024,10 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
980
1024
  style: (_l = props.UNSAFE_styles) === null || _l === void 0 ? void 0 : _l.section,
981
1025
  },
982
1026
  } }))))),
983
- React.createElement(PersistentRegion, { items: persistentsFooters, position: "footer", activeIndex: activeIndex, indexOffset: headerInteractiveCount + middleNavigableCount, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderHeader: props.customRenderHeader, customRenderFooter: props.customRenderFooter, onAction: onAction, className: classnames(styles$1.persistentFooter, (_m = props.UNSAFE_className) === null || _m === void 0 ? void 0 : _m.footer), style: (_o = props.UNSAFE_styles) === null || _o === void 0 ? void 0 : _o.footer })))))));
1027
+ React.createElement(PersistentRegion, { items: persistentsFooters, position: "footer", activeIndex: activeIndex, indexOffset: headerInteractiveCount + middleNavigableCount, listboxId: listboxId, getItemProps: getItemProps, listRef: listRef, customRenderHeader: props.customRenderHeader, customRenderFooter: props.customRenderFooter, onAction: onAction, onInteractionPointerDown: onInteractionPointerDown, className: classnames(styles$1.persistentFooter, (_m = props.UNSAFE_className) === null || _m === void 0 ? void 0 : _m.footer), style: (_o = props.UNSAFE_styles) === null || _o === void 0 ? void 0 : _o.footer })))))));
984
1028
  }
985
1029
  function LoadingContent() {
986
- return (React.createElement("div", { className: styles$1.loadingList },
1030
+ return (React.createElement("div", { className: styles$1.loadingList, onPointerDown: preventDefaultPointerDown },
987
1031
  React.createElement(Glimmer.Glimmer, { shape: "rectangle", size: "base" }),
988
1032
  React.createElement(Glimmer.Glimmer, { shape: "rectangle", size: "base" }),
989
1033
  React.createElement(Glimmer.Glimmer, { shape: "rectangle", size: "base" })));
@@ -991,7 +1035,7 @@ function LoadingContent() {
991
1035
  function EmptyStateMessage({ emptyState, }) {
992
1036
  const emptyStateDefault = "No options";
993
1037
  const emptyStateContent = emptyState !== null && emptyState !== void 0 ? emptyState : emptyStateDefault;
994
- return React.createElement("div", { className: styles$1.emptyStateMessage }, emptyStateContent);
1038
+ return (React.createElement("div", { className: styles$1.emptyStateMessage, onPointerDown: preventDefaultPointerDown }, emptyStateContent));
995
1039
  }
996
1040
 
997
1041
  var styles = {"autocomplete":"_7mObJiwfPh4-","options":"dL5JShAJlKM-","heading":"PWZL-94hH7k-","visible":"_2RzcnTdaPyc-","option":"y9zhi8Wr8QA-","active":"_3Xg49dtL1Q8-","separator":"LIeh390F3W8-","icon":"K2phy6IC3TY-","text":"a6-LbUm5WnY-","label":"tQNbuxcE9nU-","details":"qacStG9-XbE-","spinning":"P9cQDL4MZ-s-"};