@wix/site-ui 1.346.0 → 1.348.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/dist/{6706.js → 1093.js} +3 -3
  2. package/dist/{8724.js → 1219.js} +2 -2
  3. package/dist/{7373.js → 1288.js} +8 -2
  4. package/dist/{5299.js → 1381.js} +98 -127
  5. package/dist/{3056.js → 1607.js} +32 -34
  6. package/dist/1629.js +2 -0
  7. package/dist/1669.js +75 -0
  8. package/dist/1718.js +26 -0
  9. package/dist/{1477.js → 201.js} +17 -26
  10. package/dist/2221.js +9 -0
  11. package/dist/{2445.js → 226.js} +12 -48
  12. package/dist/2387.js +7 -0
  13. package/dist/2580.js +6 -0
  14. package/dist/{1500.js → 2859.js} +10 -34
  15. package/dist/3014.js +178 -0
  16. package/dist/{6247.js → 3054.js} +3 -3
  17. package/dist/{7642.js → 3093.js} +1 -1
  18. package/dist/3189.js +5 -0
  19. package/dist/{7564.js → 331.js} +2 -2
  20. package/dist/3357.js +7 -0
  21. package/dist/{487.js → 3398.js} +38 -39
  22. package/dist/3502.js +224 -0
  23. package/dist/3695.js +50 -0
  24. package/dist/3829.js +1 -1
  25. package/dist/{6588.js → 3859.js} +115 -92
  26. package/dist/{3670.js → 3910.js} +28 -21
  27. package/dist/392.js +7 -0
  28. package/dist/{4549.js → 4155.js} +11 -3
  29. package/dist/4226.js +7 -0
  30. package/dist/{6329.js → 4229.js} +1 -1
  31. package/dist/4293.js +3 -0
  32. package/dist/4346.js +853 -2
  33. package/dist/{285.js → 4472.js} +3 -3
  34. package/dist/4605.js +207 -0
  35. package/dist/{7366.js → 488.js} +60 -7
  36. package/dist/{8750.js → 497.js} +190 -375
  37. package/dist/4989.js +35 -0
  38. package/dist/{6270.js → 510.js} +157 -196
  39. package/dist/5258.js +26 -0
  40. package/dist/{5036.js → 5275.js} +0 -3
  41. package/dist/{8171.js → 5298.js} +90 -102
  42. package/dist/5473.js +11 -0
  43. package/dist/{4745.js → 5490.js} +3 -1
  44. package/dist/{6089.js → 5561.js} +869 -786
  45. package/dist/{8996.js → 5595.js} +4 -3
  46. package/dist/5890.js +25 -0
  47. package/dist/{6046.js → 5969.js} +1 -1
  48. package/dist/5984.js +38 -0
  49. package/dist/{8527.js → 6006.js} +3 -3
  50. package/dist/6040.js +97 -0
  51. package/dist/{8758.js → 6137.js} +10 -8
  52. package/dist/{4281.js → 6140.js} +18 -10
  53. package/dist/{8960.js → 6191.js} +2 -2
  54. package/dist/6240.js +121 -0
  55. package/dist/{4490.js → 6373.js} +7 -5
  56. package/dist/{904.js → 6487.js} +19 -17
  57. package/dist/{9635.js → 6498.js} +1 -1
  58. package/dist/6499.js +4 -7
  59. package/dist/6508.js +7 -0
  60. package/dist/{8225.js → 6540.js} +1 -0
  61. package/dist/6551.js +46 -0
  62. package/dist/{9369.js → 6620.js} +35 -34
  63. package/dist/{4143.js → 6838.js} +19 -10
  64. package/dist/6902.js +48 -0
  65. package/dist/6904.js +51 -0
  66. package/dist/70.js +24 -0
  67. package/dist/7024.js +39 -0
  68. package/dist/{6882.js → 721.js} +737 -362
  69. package/dist/{951.js → 7270.js} +4 -4
  70. package/dist/{3485.js → 7323.js} +143 -111
  71. package/dist/{7541.js → 7488.js} +2 -2
  72. package/dist/{4863.js → 7542.js} +7 -6
  73. package/dist/7551.js +28 -0
  74. package/dist/{7021.js → 7640.js} +1 -1
  75. package/dist/{353.js → 7692.js} +3 -7
  76. package/dist/{4707.js → 7930.js} +2 -2
  77. package/dist/{8052.js → 8.js} +80 -64
  78. package/dist/{6914.js → 8129.js} +3 -15
  79. package/dist/{3319.js → 8358.js} +62 -63
  80. package/dist/{5864.js → 8407.js} +13 -13
  81. package/dist/8488.js +15 -0
  82. package/dist/{4768.js → 8495.js} +1 -1
  83. package/dist/8734.js +171 -0
  84. package/dist/{1763.js → 9018.js} +205 -331
  85. package/dist/9053.js +29 -0
  86. package/dist/9067.js +41 -0
  87. package/dist/{2861.js → 9120.js} +2 -2
  88. package/dist/{42.js → 9197.js} +2 -2
  89. package/dist/{9189.js → 9248.js} +36 -17
  90. package/dist/{2801.js → 9252.js} +4 -9
  91. package/dist/9295.js +7 -0
  92. package/dist/9303.js +8 -0
  93. package/dist/{167.js → 9374.js} +1 -1
  94. package/dist/{9352.js → 9540.js} +17 -47
  95. package/dist/9576.js +51 -0
  96. package/dist/{8272.js → 9591.js} +36 -46
  97. package/dist/{6107.js → 9770.js} +2 -2
  98. package/dist/{5085.js → 9880.js} +6 -3
  99. package/dist/Accordion/index.d.ts +207 -41
  100. package/dist/Accordion/index.js +75 -177
  101. package/dist/AlertDialog/index.d.ts +440 -140
  102. package/dist/AlertDialog/index.js +3 -13
  103. package/dist/Autocomplete/index.d.ts +722 -150
  104. package/dist/Autocomplete/index.js +16 -29
  105. package/dist/Avatar/index.d.ts +38 -3
  106. package/dist/Avatar/index.js +82 -28
  107. package/dist/Breadcrumbs/index.d.ts +63 -91
  108. package/dist/Breadcrumbs/index.js +1 -1
  109. package/dist/Button/index.d.ts +11 -0
  110. package/dist/Button/index.js +2 -2
  111. package/dist/Checkbox/index.d.ts +206 -36
  112. package/dist/Checkbox/index.js +293 -8
  113. package/dist/CheckboxField/index.css +1 -1
  114. package/dist/CheckboxField/index.d.ts +40 -36
  115. package/dist/CheckboxGroup/index.d.ts +50 -36
  116. package/dist/CheckboxGroup/index.js +87 -58
  117. package/dist/CheckboxGroupField/index.css +1 -1
  118. package/dist/Collapsible/index.d.ts +128 -36
  119. package/dist/Collapsible/index.js +21 -25
  120. package/dist/Combobox/index.d.ts +801 -158
  121. package/dist/Combobox/index.js +70 -114
  122. package/dist/ContextMenu/index.d.ts +1162 -195
  123. package/dist/ContextMenu/index.js +46 -36
  124. package/dist/Dialog/index.d.ts +425 -133
  125. package/dist/Dialog/index.js +8 -4
  126. package/dist/Drawer/index.d.ts +589 -144
  127. package/dist/Drawer/index.js +482 -562
  128. package/dist/Field/index.css +1 -1
  129. package/dist/Field/index.d.ts +341 -42
  130. package/dist/Field/index.js +123 -273
  131. package/dist/Fieldset/index.d.ts +11 -0
  132. package/dist/Fieldset/index.js +10 -17
  133. package/dist/Form/index.d.ts +43 -39
  134. package/dist/Form/index.js +58 -50
  135. package/dist/Input/index.css +1 -1
  136. package/dist/Input/index.d.ts +94 -42
  137. package/dist/Input/index.js +1 -1
  138. package/dist/Menu/index.d.ts +1140 -175
  139. package/dist/Menu/index.js +51 -67
  140. package/dist/Menubar/index.d.ts +651 -173
  141. package/dist/Menubar/index.js +12 -16
  142. package/dist/Meter/index.js +21 -18
  143. package/dist/NavigationMenu/index.d.ts +370 -86
  144. package/dist/NavigationMenu/index.js +144 -178
  145. package/dist/NumberField/index.css +1 -1
  146. package/dist/NumberField/index.d.ts +507 -47
  147. package/dist/NumberField/index.js +434 -718
  148. package/dist/Popover/index.d.ts +561 -142
  149. package/dist/Popover/index.js +181 -252
  150. package/dist/PreviewCard/index.d.ts +507 -143
  151. package/dist/PreviewCard/index.js +97 -151
  152. package/dist/Progress/index.d.ts +117 -3
  153. package/dist/Progress/index.js +37 -36
  154. package/dist/Radio/index.d.ts +177 -7
  155. package/dist/Radio/index.js +54 -70
  156. package/dist/RadioField/index.css +1 -1
  157. package/dist/RadioField/index.d.ts +23 -7
  158. package/dist/RadioGroup/index.d.ts +51 -37
  159. package/dist/RadioGroup/index.js +60 -51
  160. package/dist/RadioGroupField/index.css +1 -1
  161. package/dist/RadioGroupField/index.d.ts +40 -37
  162. package/dist/ScrollArea/index.d.ts +295 -1
  163. package/dist/ScrollArea/index.js +256 -324
  164. package/dist/Select/index.d.ts +516 -123
  165. package/dist/Select/index.js +513 -635
  166. package/dist/SelectField/index.css +1 -1
  167. package/dist/SelectField/index.d.ts +109 -134
  168. package/dist/SelectField/index.js +5 -1
  169. package/dist/Separator/index.d.ts +12 -0
  170. package/dist/Separator/index.js +1 -1
  171. package/dist/Slider/index.d.ts +383 -64
  172. package/dist/Slider/index.js +298 -374
  173. package/dist/Switch/index.d.ts +184 -37
  174. package/dist/Switch/index.js +44 -58
  175. package/dist/Tabs/index.d.ts +220 -35
  176. package/dist/Tabs/index.js +199 -193
  177. package/dist/Toast/index.d.ts +280 -64
  178. package/dist/Toast/index.js +299 -374
  179. package/dist/Toggle/index.d.ts +55 -35
  180. package/dist/Toggle/index.js +19 -13
  181. package/dist/ToggleGroup/index.d.ts +62 -35
  182. package/dist/ToggleGroup/index.js +13 -31
  183. package/dist/Toolbar/index.d.ts +117 -2
  184. package/dist/Toolbar/index.js +31 -43
  185. package/dist/Tooltip/index.d.ts +507 -150
  186. package/dist/Tooltip/index.js +163 -213
  187. package/dist/index.d.ts +12912 -5382
  188. package/package.json +3 -3
  189. package/dist/2205.js +0 -26
  190. package/dist/2274.js +0 -34
  191. package/dist/2287.js +0 -17
  192. package/dist/3020.js +0 -7
  193. package/dist/3021.js +0 -72
  194. package/dist/3140.js +0 -4
  195. package/dist/3248.js +0 -307
  196. package/dist/4026.js +0 -12
  197. package/dist/4922.js +0 -15
  198. package/dist/5659.js +0 -4
  199. package/dist/5992.js +0 -447
  200. package/dist/6330.js +0 -30
  201. package/dist/6535.js +0 -72
  202. package/dist/6917.js +0 -55
  203. package/dist/7725.js +0 -10
  204. package/dist/7871.js +0 -38
  205. package/dist/8106.js +0 -239
  206. package/dist/8685.js +0 -102
  207. package/dist/8935.js +0 -8
  208. package/dist/8971.js +0 -40
  209. package/dist/8979.js +0 -10
  210. package/dist/9048.js +0 -52
  211. package/dist/9087.js +0 -256
  212. package/dist/9255.js +0 -136
  213. /package/dist/{1457.js → 1068.js} +0 -0
  214. /package/dist/{6003.js → 1234.js} +0 -0
  215. /package/dist/{4723.js → 1282.js} +0 -0
  216. /package/dist/{6825.js → 1876.js} +0 -0
  217. /package/dist/{5778.js → 1885.js} +0 -0
  218. /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
  219. /package/dist/{1279.js → 3278.js} +0 -0
  220. /package/dist/{3296.js → 5568.js} +0 -0
  221. /package/dist/{8685.css → 6240.css} +0 -0
  222. /package/dist/{9829.js → 6488.js} +0 -0
  223. /package/dist/{9863.js → 6534.js} +0 -0
  224. /package/dist/{4495.js → 7718.js} +0 -0
  225. /package/dist/{3395.js → 8866.js} +0 -0
  226. /package/dist/{2418.js → 9837.js} +0 -0
@@ -1,45 +1,52 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { esm_formatErrorMessage, EMPTY_OBJECT, EMPTY_ARRAY, useMergedRefs, useRefWithInit, mergeProps, useRenderElement, NOOP } from "./8272.js";
3
- import { Store, useStore, createSelector } from "./2445.js";
4
- import { defaultItemEquality, findItemIndex, stringifyAsLabel, hasNullItemLabel, stringifyAsValue, compareItemEquality, isGroupedItems, selectedValueIncludes, removeItem } from "./7366.js";
5
- import { triggerOpenStateMapping, popupStateMapping, pressableTriggerOpenStateMapping } from "./6917.js";
6
- import { FieldRootContext, DEFAULT_FIELD_STATE_ATTRIBUTES, DEFAULT_FIELD_ROOT_CONTEXT, useLabelableContext, fieldValidityMapping, useFieldRootContext } from "./1477.js";
7
- import { getTarget, contains as shadowDom_contains } from "./4549.js";
8
- import { isElement } from "./3829.js";
9
- import { isInteractiveElement } from "./8758.js";
10
- import { createGenericEventDetails, createChangeEventDetails } from "./4768.js";
11
- import { itemPress, outsidePress, inputClear, closePress, focusOut, inputChange, listNavigation as reason_parts_listNavigation, inputPress, clearPress, escapeKey } from "./2418.js";
12
- import { useStableCallback } from "./7541.js";
13
- import { useCompositeListItem, useCompositeListItem_IndexGuessBehavior } from "./3021.js";
14
- import { useIsoLayoutEffect } from "./6499.js";
15
- import { useButton } from "./9189.js";
16
- import { visuallyHiddenInput, visuallyHidden } from "./8225.js";
17
- import { useDirection } from "./9863.js";
18
- import { useBaseUiId } from "./6046.js";
19
- import { resolveAriaLabelledBy } from "./6825.js";
20
- import { isAndroid, isFirefox, isIOS } from "./8971.js";
21
- import { stopEvent } from "./6330.js";
22
- import { transitionStatusMapping, useOpenChangeComplete } from "./9369.js";
23
- import { useTransitionStatus } from "./4863.js";
24
- import { CompositeList } from "./9255.js";
25
- import { useTimeout } from "./42.js";
26
- import { FloatingPortal_FloatingPortal, DROPDOWN_COLLISION_AVOIDANCE } from "./487.js";
27
- import { usePositioner, useFloatingRootContext, useAnchorPositioning, getDisabledMountTransitionStyles } from "./8750.js";
28
- import { useAnchoredPopupScrollLock } from "./6247.js";
29
- import { useOpenInteractionType, FloatingFocusManager, InternalBackdrop_InternalBackdrop } from "./3485.js";
30
- import { inertValue } from "./167.js";
31
- import { useLabelableId } from "./9048.js";
32
- import { useListNavigation, useTypeahead } from "./5299.js";
33
- import { useClick } from "./5864.js";
34
- import { ownerDocument } from "./9829.js";
35
- import { getPseudoElementBounds } from "./7373.js";
36
- import { useFormContext } from "./5085.js";
37
- import { useControlled } from "./8527.js";
38
- import { useValueAsRef } from "./4707.js";
39
- import { useRegisterFieldControl } from "./4281.js";
40
- import { useValueChanged } from "./2801.js";
41
- import { useDismiss } from "./5992.js";
42
- import { FOCUSABLE_POPUP_PROPS, useOnFirstRender } from "./8106.js";
2
+ import { utils_formatErrorMessage } from "./5473.js";
3
+ import { isInteractiveElement } from "./6137.js";
4
+ import { triggerOpenStateMapping, popupStateMapping, pressableTriggerOpenStateMapping } from "./6904.js";
5
+ import { FieldRootContext, DEFAULT_FIELD_STATE_ATTRIBUTES, DEFAULT_FIELD_ROOT_CONTEXT, useLabelableContext, fieldValidityMapping, useFieldRootContext } from "./201.js";
6
+ import { contains as shadowDom_contains, activeElement, getTarget, closest } from "./4155.js";
7
+ import { getOverflowAncestors, isElement, isHTMLElement } from "./3829.js";
8
+ import { createGenericEventDetails, createChangeEventDetails } from "./8495.js";
9
+ import { itemPress, outsidePress, inputClear, cancelOpen, closePress, imperativeAction, focusOut, inputChange, inputPress, clearPress, listNavigation as reason_parts_listNavigation, escapeKey } from "./9837.js";
10
+ import { useStableCallback } from "./7488.js";
11
+ import { EMPTY_ARRAY, useRefWithInit, EMPTY_OBJECT, mergeProps, useMergedRefs, useRenderElement, NOOP } from "./9591.js";
12
+ import { useCompositeListItem } from "./9576.js";
13
+ import { useIsoLayoutEffect } from "./3357.js";
14
+ import { defaultItemEquality, findSelectionIndex, findItemIndex, isSelectedValueDirty, stringifyAsLabel as resolveValueLabel_stringifyAsLabel, resolveSelectedIndex, hasNullItemLabel, compareItemEquality, selectedValueIncludes, stringifyAsValue, isGroupedItems, flattenLeafItems, useOnFirstRender, removeItem } from "./488.js";
15
+ import { useButton } from "./9248.js";
16
+ import { visuallyHiddenInput, visuallyHidden } from "./6540.js";
17
+ import { useDirection } from "./6534.js";
18
+ import { useSetFieldFocused } from "./5890.js";
19
+ import { useBaseUiId } from "./5969.js";
20
+ import { getHighlightReason } from "./9303.js";
21
+ import { android, ios } from "./2221.js";
22
+ import { stopEvent, isIndexOutOfListBounds, getGridNavigatedIndex } from "./8358.js";
23
+ import { gecko } from "./3189.js";
24
+ import { transitionStatusMapping } from "./8488.js";
25
+ import { useTransitionStatus } from "./7542.js";
26
+ import { useOpenChangeComplete } from "./6620.js";
27
+ import { CompositeList } from "./3014.js";
28
+ import { useTimeout } from "./9197.js";
29
+ import { FloatingPortal_FloatingPortal, DROPDOWN_COLLISION_AVOIDANCE } from "./3398.js";
30
+ import { usePositioner, useAnchorPositioning, getDisabledMountTransitionStyles } from "./497.js";
31
+ import { useAnchoredPopupScrollLock } from "./3054.js";
32
+ import { useOpenInteractionType, FloatingFocusManager, InternalBackdrop_InternalBackdrop } from "./7323.js";
33
+ import { inertValue } from "./9374.js";
34
+ import { useLabelableId } from "./6551.js";
35
+ import { resolveAriaLabelledBy } from "./1876.js";
36
+ import { useListNavigation, useTypeahead } from "./1381.js";
37
+ import { useClick } from "./8407.js";
38
+ import { ownerDocument } from "./6488.js";
39
+ import { isMouseWithinBounds } from "./1288.js";
40
+ import { stringifyLocale } from "./2580.js";
41
+ import { useFormContext } from "./9880.js";
42
+ import { useControlled } from "./6006.js";
43
+ import { ReactStore } from "./226.js";
44
+ import { useValueAsRef } from "./7930.js";
45
+ import { useRegisterFieldControl } from "./6140.js";
46
+ import { isScrollableY } from "./5258.js";
47
+ import { useDismiss, useUnmountAfterClose, FOCUSABLE_POPUP_PROPS, attachPreventUnmountOnClose } from "./4346.js";
48
+ import { useValueChanged } from "./9252.js";
49
+ import { useFloatingRootContext } from "./6902.js";
43
50
  import * as __rspack_external_react from "react";
44
51
  import * as __rspack_external_react_dom_7136dc57 from "react-dom";
45
52
  const ComboboxRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
@@ -48,119 +55,95 @@ const ComboboxFloatingContext = /*#__PURE__*/ __rspack_external_react.createCont
48
55
  if ("production" !== process.env.NODE_ENV) ComboboxFloatingContext.displayName = "ComboboxFloatingContext";
49
56
  const ComboboxDerivedItemsContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
50
57
  if ("production" !== process.env.NODE_ENV) ComboboxDerivedItemsContext.displayName = "ComboboxDerivedItemsContext";
58
+ const ComboboxHasItemsContext = /*#__PURE__*/ __rspack_external_react.createContext(false);
59
+ if ("production" !== process.env.NODE_ENV) ComboboxHasItemsContext.displayName = "ComboboxHasItemsContext";
51
60
  const ComboboxInputValueContext = /*#__PURE__*/ __rspack_external_react.createContext('');
52
61
  if ("production" !== process.env.NODE_ENV) ComboboxInputValueContext.displayName = "ComboboxInputValueContext";
53
62
  function useComboboxRootContext() {
54
63
  const context = __rspack_external_react.useContext(ComboboxRootContext);
55
- if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>.' : esm_formatErrorMessage(22));
64
+ if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>.' : utils_formatErrorMessage(22));
56
65
  return context;
57
66
  }
58
67
  function useComboboxFloatingContext() {
59
68
  const context = __rspack_external_react.useContext(ComboboxFloatingContext);
60
- if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>.' : esm_formatErrorMessage(23));
69
+ if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>.' : utils_formatErrorMessage(23));
61
70
  return context;
62
71
  }
63
72
  function useComboboxDerivedItemsContext() {
64
73
  const context = __rspack_external_react.useContext(ComboboxDerivedItemsContext);
65
- if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>.' : esm_formatErrorMessage(24));
74
+ if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>.' : utils_formatErrorMessage(24));
66
75
  return context;
67
76
  }
68
77
  function useComboboxInputValueContext() {
69
78
  return __rspack_external_react.useContext(ComboboxInputValueContext);
70
79
  }
71
- const selectors = {
72
- id: createSelector((state)=>state.id),
73
- labelId: createSelector((state)=>state.labelId),
74
- items: createSelector((state)=>state.items),
75
- selectedValue: createSelector((state)=>state.selectedValue),
76
- hasSelectionChips: createSelector((state)=>{
77
- const selectedValue = state.selectedValue;
78
- return Array.isArray(selectedValue) && selectedValue.length > 0;
79
- }),
80
- hasSelectedValue: createSelector((state)=>{
81
- const { selectedValue, selectionMode } = state;
82
- if (null == selectedValue) return false;
83
- if ('multiple' === selectionMode && Array.isArray(selectedValue)) return selectedValue.length > 0;
84
- return true;
85
- }),
86
- hasNullItemLabel: createSelector((state, enabled)=>enabled ? hasNullItemLabel(state.items) : false),
87
- open: createSelector((state)=>state.open),
88
- mounted: createSelector((state)=>state.mounted),
89
- forceMounted: createSelector((state)=>state.forceMounted),
90
- inline: createSelector((state)=>state.inline),
91
- activeIndex: createSelector((state)=>state.activeIndex),
92
- selectedIndex: createSelector((state)=>state.selectedIndex),
93
- isActive: createSelector((state, index)=>state.activeIndex === index),
94
- isSelected: createSelector((state, itemValue)=>{
95
- const comparer = state.isItemEqualToValue;
96
- const selectedValue = state.selectedValue;
97
- if (Array.isArray(selectedValue)) return selectedValue.some((selectedItem)=>compareItemEquality(itemValue, selectedItem, comparer));
98
- return compareItemEquality(itemValue, selectedValue, comparer);
99
- }),
100
- transitionStatus: createSelector((state)=>state.transitionStatus),
101
- popupProps: createSelector((state)=>state.popupProps),
102
- inputProps: createSelector((state)=>state.inputProps),
103
- triggerProps: createSelector((state)=>state.triggerProps),
104
- itemProps: createSelector((state)=>state.itemProps),
105
- positionerElement: createSelector((state)=>state.positionerElement),
106
- listElement: createSelector((state)=>state.listElement),
107
- triggerElement: createSelector((state)=>state.triggerElement),
108
- inputElement: createSelector((state)=>state.inputElement),
109
- inputGroupElement: createSelector((state)=>state.inputGroupElement),
110
- popupSide: createSelector((state)=>state.popupSide),
111
- openMethod: createSelector((state)=>state.openMethod),
112
- inputInsidePopup: createSelector((state)=>state.inputInsidePopup),
113
- inputOwnsFormValue: createSelector((state)=>state.inputOwnsFormValue),
114
- selectionMode: createSelector((state)=>state.selectionMode),
115
- name: createSelector((state)=>state.name),
116
- form: createSelector((state)=>state.form),
117
- disabled: createSelector((state)=>state.disabled),
118
- readOnly: createSelector((state)=>state.readOnly),
119
- required: createSelector((state)=>state.required),
120
- grid: createSelector((state)=>state.grid),
121
- virtualized: createSelector((state)=>state.virtualized),
122
- itemToStringLabel: createSelector((state)=>state.itemToStringLabel),
123
- isItemEqualToValue: createSelector((state)=>state.isItemEqualToValue),
124
- modal: createSelector((state)=>state.modal),
125
- autoHighlight: createSelector((state)=>state.autoHighlight),
126
- submitOnItemClick: createSelector((state)=>state.submitOnItemClick)
127
- };
80
+ function useComboboxHasItemsContext() {
81
+ return __rspack_external_react.useContext(ComboboxHasItemsContext);
82
+ }
83
+ const ComboboxInputDataAttributes_popupSide = 'data-popup-side';
84
+ const ComboboxInputDataAttributes_listEmpty = 'data-list-empty';
128
85
  const triggerStateAttributesMapping = {
129
86
  ...pressableTriggerOpenStateMapping,
130
87
  ...fieldValidityMapping,
131
88
  popupSide: (side)=>side ? {
132
- 'data-popup-side': side
89
+ [ComboboxInputDataAttributes_popupSide]: side
133
90
  } : null,
134
91
  listEmpty: (empty)=>empty ? {
135
- 'data-list-empty': ''
92
+ [ComboboxInputDataAttributes_listEmpty]: ''
136
93
  } : null
137
94
  };
138
- function handleInputPress(event, store, disabled, readOnly, shouldIgnoreTarget) {
139
- if (event.baseUIHandlerPrevented || readOnly) return;
95
+ function handleInputPress(event, store, disabled, shouldIgnoreTarget) {
96
+ if (event.baseUIHandlerPrevented) return;
140
97
  const target = getTarget(event.nativeEvent);
141
98
  const targetElement = isElement(target) ? target : null;
142
99
  if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) return;
143
100
  event.preventDefault();
144
101
  if (disabled) return;
145
- store.state.inputRef.current?.focus();
146
- if (store.state.openOnInputClick) store.state.setOpen(true, createChangeEventDetails(inputPress, event.nativeEvent));
102
+ store.context.inputRef.current?.focus();
103
+ if (store.state.openOnInputClick) store.context.setOpen(true, createChangeEventDetails(inputPress, event.nativeEvent));
104
+ }
105
+ function usePopupSide(store) {
106
+ const mounted = store.useState('mounted');
107
+ const popupSide = store.useState('popupSide');
108
+ const positionerElement = store.useState('positionerElement');
109
+ return mounted && positionerElement ? popupSide : null;
110
+ }
111
+ function useListEmpty() {
112
+ return 0 === useComboboxDerivedItemsContext().filteredItems.length;
113
+ }
114
+ function getChipNavigationKeys(direction) {
115
+ return 'rtl' === direction ? [
116
+ 'ArrowRight',
117
+ 'ArrowLeft'
118
+ ] : [
119
+ 'ArrowLeft',
120
+ 'ArrowRight'
121
+ ];
122
+ }
123
+ function getIndexAfterChipRemoval(index, chipCount) {
124
+ const nextIndex = index >= chipCount - 1 ? chipCount - 2 : index;
125
+ return nextIndex >= 0 ? nextIndex : void 0;
126
+ }
127
+ function clickHighlightedItem(store, activeIndex, nativeEvent) {
128
+ const listItem = store.context.listRef.current[activeIndex];
129
+ if (listItem) {
130
+ store.context.selectionEventRef.current = nativeEvent;
131
+ listItem.click();
132
+ store.context.selectionEventRef.current = null;
133
+ }
147
134
  }
148
135
  const ComboboxInputGroup_ComboboxInputGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
149
136
  const { render, className, style, ...elementProps } = componentProps;
150
137
  const { state: fieldState } = useFieldRootContext();
151
138
  const store = useComboboxRootContext();
152
- const { filteredItems } = useComboboxDerivedItemsContext();
153
- const open = useStore(store, selectors.open);
154
- const mounted = useStore(store, selectors.mounted);
155
- const popupSideValue = useStore(store, selectors.popupSide);
156
- const positionerElement = useStore(store, selectors.positionerElement);
157
- const comboboxDisabled = useStore(store, selectors.disabled);
158
- const readOnly = useStore(store, selectors.readOnly);
159
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
160
- const selectionMode = useStore(store, selectors.selectionMode);
161
- const popupSide = mounted && positionerElement ? popupSideValue : null;
139
+ const open = store.useState('open');
140
+ const comboboxDisabled = store.useState('disabled');
141
+ const readOnly = store.useState('readOnly');
142
+ const hasSelectedValue = store.useState('hasSelectedValue');
143
+ const selectionMode = store.useState('selectionMode');
144
+ const popupSide = usePopupSide(store);
162
145
  const disabled = comboboxDisabled;
163
- const listEmpty = 0 === filteredItems.length;
146
+ const listEmpty = useListEmpty();
164
147
  const placeholder = 'none' === selectionMode ? false : !hasSelectedValue;
165
148
  const state = {
166
149
  ...fieldState,
@@ -183,7 +166,7 @@ const ComboboxInputGroup_ComboboxInputGroup = /*#__PURE__*/ __rspack_external_re
183
166
  {
184
167
  role: 'group',
185
168
  onMouseDown (event) {
186
- handleInputPress(event, store, disabled, readOnly, (target)=>shadowDom_contains(store.state.chipsContainerRef.current, target));
169
+ handleInputPress(event, store, disabled, (target)=>shadowDom_contains(store.context.chipsContainerRef.current, target));
187
170
  }
188
171
  },
189
172
  elementProps
@@ -197,7 +180,7 @@ const ComboboxItemContext = /*#__PURE__*/ __rspack_external_react.createContext(
197
180
  if ("production" !== process.env.NODE_ENV) ComboboxItemContext.displayName = "ComboboxItemContext";
198
181
  function useComboboxItemContext() {
199
182
  const context = __rspack_external_react.useContext(ComboboxItemContext);
200
- if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>.' : esm_formatErrorMessage(19));
183
+ if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>.' : utils_formatErrorMessage(19));
201
184
  return context;
202
185
  }
203
186
  const ComboboxRowContext = /*#__PURE__*/ __rspack_external_react.createContext(false);
@@ -205,37 +188,32 @@ if ("production" !== process.env.NODE_ENV) ComboboxRowContext.displayName = "Com
205
188
  function useComboboxRowContext() {
206
189
  return __rspack_external_react.useContext(ComboboxRowContext);
207
190
  }
208
- const ComboboxItem_ComboboxItem = /*#__PURE__*/ __rspack_external_react.memo(/*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
209
- const { render, className, style, value: itemValue = null, index: indexProp, disabled = false, nativeButton = false, ...elementProps } = componentProps;
210
- const didPointerDownRef = __rspack_external_react.useRef(false);
191
+ function ComboboxItemInner(props) {
192
+ const { componentProps, forwardedRef, virtualized, indexFromFilter } = props;
193
+ const { render, className, style, value: itemValue = null, index: indexProp, disabled: disabledProp = false, nativeButton = false, ...elementProps } = componentProps;
211
194
  const textRef = __rspack_external_react.useRef(null);
212
195
  const listItem = useCompositeListItem({
196
+ guess: true,
213
197
  index: indexProp,
214
- textRef,
215
- indexGuessBehavior: useCompositeListItem_IndexGuessBehavior.GuessFromOrder
198
+ textRef
216
199
  });
217
200
  const store = useComboboxRootContext();
218
201
  const isRow = useComboboxRowContext();
219
- const { flatFilteredItems, hasItems } = useComboboxDerivedItemsContext();
220
- const open = useStore(store, selectors.open);
221
- const selectionMode = useStore(store, selectors.selectionMode);
222
- const readOnly = useStore(store, selectors.readOnly);
223
- const virtualized = useStore(store, selectors.virtualized);
224
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
202
+ const hasItems = useComboboxHasItemsContext();
203
+ const { props: itemProps, id: rootId, selectionMode, disabled: rootDisabled, readOnly, isItemEqualToValue } = store.useState('itemRoot');
204
+ const disabled = rootDisabled || disabledProp;
225
205
  const selectable = 'none' !== selectionMode;
226
- const index = indexProp ?? (virtualized ? findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index);
227
- const hasRegistered = -1 !== listItem.index;
228
- const rootId = useStore(store, selectors.id);
229
- const highlighted = useStore(store, selectors.isActive, index);
230
- const matchesSelectedValue = useStore(store, selectors.isSelected, itemValue);
231
- const itemProps = useStore(store, selectors.itemProps);
206
+ const index = indexProp ?? indexFromFilter ?? listItem.index;
207
+ const hasRegistered = -1 !== index;
208
+ const highlighted = store.useState('isActive', index);
209
+ const matchesSelectedValue = store.useState('isSelected', itemValue);
232
210
  const itemRef = __rspack_external_react.useRef(null);
233
211
  const id = null != rootId && hasRegistered ? `${rootId}-${index}` : void 0;
234
212
  const selected = matchesSelectedValue && selectable;
235
213
  useIsoLayoutEffect(()=>{
236
214
  const shouldRun = hasRegistered && (virtualized || null != indexProp);
237
215
  if (!shouldRun) return;
238
- const list = store.state.listRef.current;
216
+ const list = store.context.listRef.current;
239
217
  list[index] = itemRef.current;
240
218
  return ()=>{
241
219
  delete list[index];
@@ -249,33 +227,28 @@ const ComboboxItem_ComboboxItem = /*#__PURE__*/ __rspack_external_react.memo(/*#
249
227
  ]);
250
228
  useIsoLayoutEffect(()=>{
251
229
  if (!hasRegistered || hasItems) return;
252
- const visibleMap = store.state.valuesRef.current;
253
- visibleMap[index] = itemValue;
254
- if ('none' !== selectionMode) store.state.allValuesRef.current.push(itemValue);
230
+ const visibleValues = store.context.valuesRef.current;
231
+ visibleValues[index] = itemValue;
255
232
  return ()=>{
256
- delete visibleMap[index];
233
+ delete visibleValues[index];
257
234
  };
258
235
  }, [
259
236
  hasRegistered,
260
237
  hasItems,
261
238
  index,
262
239
  itemValue,
263
- store,
264
- selectionMode
240
+ store
265
241
  ]);
266
242
  useIsoLayoutEffect(()=>{
267
- if (!open) {
268
- didPointerDownRef.current = false;
269
- return;
270
- }
271
243
  if (!hasRegistered || hasItems) return;
272
244
  const selectedValue = store.state.selectedValue;
273
- const lastSelectedValue = Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue;
274
- if (compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) store.set('selectedIndex', index);
245
+ let nextIndex = store.state.selectedIndex;
246
+ if ('multiple' === store.state.selectionMode && Array.isArray(selectedValue)) nextIndex = resolveSelectedIndex(index, itemValue, store.context.valuesRef.current, selectedValue, isItemEqualToValue, nextIndex);
247
+ else if (compareItemEquality(itemValue, selectedValue, isItemEqualToValue)) nextIndex = index;
248
+ store.set('selectedIndex', nextIndex);
275
249
  }, [
276
250
  hasRegistered,
277
251
  hasItems,
278
- open,
279
252
  store,
280
253
  index,
281
254
  itemValue,
@@ -294,11 +267,11 @@ const ComboboxItem_ComboboxItem = /*#__PURE__*/ __rspack_external_react.memo(/*#
294
267
  };
295
268
  function commitSelection(nativeEvent) {
296
269
  function selectItem() {
297
- store.state.handleSelection(nativeEvent, itemValue);
270
+ store.context.handleSelection(nativeEvent, itemValue);
298
271
  }
299
272
  if (store.state.submitOnItemClick) {
300
273
  __rspack_external_react_dom_7136dc57.flushSync(selectItem);
301
- store.state.requestSubmit();
274
+ store.context.requestSubmit();
302
275
  } else selectItem();
303
276
  }
304
277
  const defaultProps = {
@@ -307,7 +280,7 @@ const ComboboxItem_ComboboxItem = /*#__PURE__*/ __rspack_external_react.memo(/*#
307
280
  'aria-selected': selectable ? selected : void 0,
308
281
  tabIndex: void 0,
309
282
  onPointerDownCapture (event) {
310
- didPointerDownRef.current = true;
283
+ if (event.isPrimary) store.context.pointerDownItemRef.current = event.currentTarget;
311
284
  event.preventDefault();
312
285
  },
313
286
  onMouseDown (event) {
@@ -318,8 +291,8 @@ const ComboboxItem_ComboboxItem = /*#__PURE__*/ __rspack_external_react.memo(/*#
318
291
  commitSelection(event.nativeEvent);
319
292
  },
320
293
  onMouseUp (event) {
321
- const pointerStartedOnItem = didPointerDownRef.current;
322
- didPointerDownRef.current = false;
294
+ const pointerStartedOnItem = store.context.pointerDownItemRef.current === event.currentTarget;
295
+ store.context.pointerDownItemRef.current = null;
323
296
  if (disabled || readOnly || 0 !== event.button || pointerStartedOnItem || !highlighted) return;
324
297
  commitSelection(event.nativeEvent);
325
298
  }
@@ -350,6 +323,34 @@ const ComboboxItem_ComboboxItem = /*#__PURE__*/ __rspack_external_react.memo(/*#
350
323
  value: contextValue,
351
324
  children: element
352
325
  });
326
+ }
327
+ function ComboboxItemVirtualizedIndex(props) {
328
+ const { componentProps, forwardedRef } = props;
329
+ const store = useComboboxRootContext();
330
+ const isItemEqualToValue = store.useState('isItemEqualToValue');
331
+ const { flatFilteredValues } = useComboboxDerivedItemsContext();
332
+ const lookupValue = componentProps.value ?? null;
333
+ const indexFromFilter = findItemIndex(flatFilteredValues, lookupValue, isItemEqualToValue);
334
+ return /*#__PURE__*/ jsx(ComboboxItemInner, {
335
+ componentProps: componentProps,
336
+ forwardedRef: forwardedRef,
337
+ virtualized: true,
338
+ indexFromFilter: indexFromFilter
339
+ });
340
+ }
341
+ const ComboboxItem_ComboboxItem = /*#__PURE__*/ __rspack_external_react.memo(/*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
342
+ const store = useComboboxRootContext();
343
+ const virtualized = store.useState('virtualized');
344
+ if (virtualized && null == componentProps.index) return /*#__PURE__*/ jsx(ComboboxItemVirtualizedIndex, {
345
+ componentProps: componentProps,
346
+ forwardedRef: forwardedRef
347
+ });
348
+ return /*#__PURE__*/ jsx(ComboboxItemInner, {
349
+ componentProps: componentProps,
350
+ forwardedRef: forwardedRef,
351
+ virtualized: virtualized,
352
+ indexFromFilter: void 0
353
+ });
353
354
  }));
354
355
  if ("production" !== process.env.NODE_ENV) ComboboxItem_ComboboxItem.displayName = "ComboboxItem";
355
356
  const ComboboxChipsContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
@@ -361,7 +362,7 @@ const ComboboxPositionerContext = /*#__PURE__*/ __rspack_external_react.createCo
361
362
  if ("production" !== process.env.NODE_ENV) ComboboxPositionerContext.displayName = "ComboboxPositionerContext";
362
363
  function useComboboxPositionerContext(optional) {
363
364
  const context = __rspack_external_react.useContext(ComboboxPositionerContext);
364
- if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component' : esm_formatErrorMessage(21));
365
+ if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component' : utils_formatErrorMessage(21));
365
366
  return context;
366
367
  }
367
368
  const ComboboxInternalDismissButton_ComboboxInternalDismissButton = /*#__PURE__*/ __rspack_external_react.forwardRef(function(_, forwardedRef) {
@@ -371,7 +372,7 @@ const ComboboxInternalDismissButton_ComboboxInternalDismissButton = /*#__PURE__*
371
372
  });
372
373
  const mergedRef = useMergedRefs(forwardedRef, buttonRef);
373
374
  function handleDismiss(event) {
374
- store.state.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent, event.currentTarget));
375
+ store.context.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent, event.currentTarget));
375
376
  }
376
377
  const dismissProps = getButtonProps({
377
378
  onClick: handleDismiss
@@ -387,56 +388,65 @@ const ComboboxInternalDismissButton_ComboboxInternalDismissButton = /*#__PURE__*
387
388
  if ("production" !== process.env.NODE_ENV) ComboboxInternalDismissButton_ComboboxInternalDismissButton.displayName = "ComboboxInternalDismissButton";
388
389
  const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
389
390
  const { render, className, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
390
- const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
391
+ const { state: fieldState, disabled: fieldDisabled, setTouched, validationMode, validation } = useFieldRootContext();
391
392
  const { labelId: fieldLabelId } = useLabelableContext();
392
393
  const comboboxChipsContext = useComboboxChipsContext();
393
394
  const positioning = useComboboxPositionerContext(true);
394
395
  const hasPositionerParent = Boolean(positioning);
395
396
  const store = useComboboxRootContext();
396
- const { filteredItems } = useComboboxDerivedItemsContext();
397
397
  const inputValue = useComboboxInputValueContext();
398
398
  const direction = useDirection();
399
- const required = useStore(store, selectors.required);
400
- const comboboxDisabled = useStore(store, selectors.disabled);
401
- const readOnly = useStore(store, selectors.readOnly);
402
- const name = useStore(store, selectors.name);
403
- const form = useStore(store, selectors.form);
404
- const selectionMode = useStore(store, selectors.selectionMode);
405
- const autoHighlightMode = useStore(store, selectors.autoHighlight);
406
- const inputProps = useStore(store, selectors.inputProps);
407
- const triggerProps = useStore(store, selectors.triggerProps);
408
- const open = useStore(store, selectors.open);
409
- const mounted = useStore(store, selectors.mounted);
410
- const selectedValue = useStore(store, selectors.selectedValue);
411
- const popupSideValue = useStore(store, selectors.popupSide);
412
- const positionerElement = useStore(store, selectors.positionerElement);
413
- const rootId = useStore(store, selectors.id);
414
- const inline = useStore(store, selectors.inline);
415
- const modal = useStore(store, selectors.modal);
399
+ const required = store.useState('required');
400
+ const comboboxDisabled = store.useState('disabled');
401
+ const readOnly = store.useState('readOnly');
402
+ const name = store.useState('name');
403
+ const form = store.useState('form');
404
+ const selectionMode = store.useState('selectionMode');
405
+ const autoHighlightMode = store.useState('autoHighlight');
406
+ const inputProps = store.useState('inputProps');
407
+ const triggerProps = store.useState('triggerProps');
408
+ const open = store.useState('open');
409
+ const mounted = store.useState('mounted');
410
+ const selectedValue = store.useState('selectedValue');
411
+ const rootId = store.useState('id');
412
+ const inline = store.useState('inline');
413
+ const modal = store.useState('modal');
416
414
  const autoHighlightEnabled = Boolean(autoHighlightMode);
417
- const popupSide = mounted && positionerElement ? popupSideValue : null;
415
+ const popupSide = usePopupSide(store);
418
416
  const disabled = fieldDisabled || comboboxDisabled || disabledProp;
419
- const listEmpty = 0 === filteredItems.length;
417
+ const listEmpty = useListEmpty();
418
+ const setFocused = useSetFieldFocused(disabled, store.context.inputRef);
420
419
  const isInsidePopup = hasPositionerParent || inline;
421
420
  const focusManagerModal = !isInsidePopup || modal;
422
421
  const id = useBaseUiId(idProp ?? (isInsidePopup ? void 0 : rootId));
423
- const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, void 0);
424
422
  const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
425
423
  const [composingValue, setComposingValue] = __rspack_external_react.useState(null);
426
424
  const isComposingRef = __rspack_external_react.useRef(false);
427
425
  const lastActiveIndexRef = __rspack_external_react.useRef(null);
428
- const shouldRestoreActiveIndexRef = __rspack_external_react.useRef(false);
426
+ useIsoLayoutEffect(()=>{
427
+ if (!open) lastActiveIndexRef.current = null;
428
+ }, [
429
+ open
430
+ ]);
429
431
  const inputOwnsFormValue = 'none' === selectionMode && !hasPositionerParent;
430
432
  const setInputElement = useStableCallback((element)=>{
431
433
  const nextIsInsidePopup = hasPositionerParent || store.state.inline;
432
- if (nextIsInsidePopup && !store.state.hasInputValue) store.state.setInputValue('', createChangeEventDetails("none"));
434
+ if (nextIsInsidePopup && !store.state.hasInputValue) store.context.setInputValue('', createChangeEventDetails("none"));
433
435
  store.update({
434
436
  inputElement: element,
435
437
  inputInsidePopup: nextIsInsidePopup,
436
438
  inputOwnsFormValue
437
439
  });
438
440
  });
439
- const validationProps = hasPositionerParent || !validation ? elementProps : validation.getValidationProps(elementProps);
441
+ const validationProps = hasPositionerParent ? elementProps : validation.getValidationProps(disabled, elementProps);
442
+ function clearHighlight(event) {
443
+ store.context.setIndices({
444
+ activeIndex: null,
445
+ selectedIndex: null,
446
+ type: getHighlightReason(event),
447
+ event
448
+ });
449
+ }
440
450
  const state = {
441
451
  ...fieldStateForInput,
442
452
  open,
@@ -448,40 +458,11 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
448
458
  function handleKeyDown(event) {
449
459
  if (!comboboxChipsContext) return;
450
460
  let nextIndex;
451
- const { highlightedChipIndex } = comboboxChipsContext;
452
461
  const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
453
- const isRtl = 'rtl' === direction;
454
- const previousChipKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
455
- const nextChipKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
456
- if (void 0 !== highlightedChipIndex) {
457
- if (event.key === previousChipKey) {
458
- event.preventDefault();
459
- nextIndex = highlightedChipIndex > 0 ? highlightedChipIndex - 1 : void 0;
460
- } else if (event.key === nextChipKey) {
461
- event.preventDefault();
462
- nextIndex = highlightedChipIndex < renderedChipsCount - 1 ? highlightedChipIndex + 1 : void 0;
463
- } else if ('Backspace' === event.key || 'Delete' === event.key) {
464
- event.preventDefault();
465
- const computedNextIndex = highlightedChipIndex >= selectedValue.length - 1 ? selectedValue.length - 2 : highlightedChipIndex;
466
- nextIndex = computedNextIndex >= 0 ? computedNextIndex : void 0;
467
- store.state.setIndices({
468
- activeIndex: null,
469
- selectedIndex: null,
470
- type: 'keyboard'
471
- });
472
- }
473
- return nextIndex;
474
- }
462
+ const [previousChipKey] = getChipNavigationKeys(direction);
475
463
  if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
476
464
  event.preventDefault();
477
465
  nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : void 0;
478
- } else if ('Backspace' === event.key && '' === event.currentTarget.value && selectedValue.length > 0) {
479
- store.state.setIndices({
480
- activeIndex: null,
481
- selectedIndex: null,
482
- type: 'keyboard'
483
- });
484
- event.preventDefault();
485
466
  }
486
467
  return nextIndex;
487
468
  }
@@ -489,18 +470,17 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
489
470
  state,
490
471
  ref: [
491
472
  forwardedRef,
492
- store.state.inputRef,
473
+ store.context.inputRef,
493
474
  setInputElement
494
475
  ],
495
476
  props: [
496
477
  inputProps,
497
478
  triggerProps,
498
479
  {
499
- type: 'text',
500
- value: componentProps.value ?? composingValue ?? inputValue,
480
+ value: composingValue ?? inputValue,
501
481
  'aria-readonly': readOnly || void 0,
502
482
  'aria-required': required || void 0,
503
- 'aria-labelledby': ariaLabelledBy,
483
+ 'aria-labelledby': fieldLabelId,
504
484
  disabled,
505
485
  readOnly,
506
486
  required: 'none' === selectionMode ? required : void 0,
@@ -511,11 +491,11 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
511
491
  id,
512
492
  onFocus () {
513
493
  setFocused(true);
514
- if (!inline || !shouldRestoreActiveIndexRef.current) return;
515
- shouldRestoreActiveIndexRef.current = false;
494
+ if (!inline) return;
516
495
  const nextActiveIndex = lastActiveIndexRef.current;
517
- if (null == nextActiveIndex || !Object.hasOwn(store.state.valuesRef.current, nextActiveIndex)) return;
518
- store.state.setIndices({
496
+ lastActiveIndexRef.current = null;
497
+ if (null == nextActiveIndex || !Object.hasOwn(store.context.valuesRef.current, nextActiveIndex)) return;
498
+ store.context.setIndices({
519
499
  activeIndex: nextActiveIndex
520
500
  });
521
501
  },
@@ -525,8 +505,7 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
525
505
  const activeIndex = store.state.activeIndex;
526
506
  if (inline && null !== activeIndex && 'always' !== autoHighlightMode) {
527
507
  lastActiveIndexRef.current = activeIndex;
528
- shouldRestoreActiveIndexRef.current = true;
529
- store.state.setIndices({
508
+ store.context.setIndices({
530
509
  activeIndex: null
531
510
  });
532
511
  }
@@ -536,7 +515,7 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
536
515
  }
537
516
  },
538
517
  onCompositionStart (event) {
539
- if (isAndroid) return;
518
+ if (android) return;
540
519
  isComposingRef.current = true;
541
520
  setComposingValue(event.currentTarget.value);
542
521
  },
@@ -544,76 +523,59 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
544
523
  isComposingRef.current = false;
545
524
  const next = event.currentTarget.value;
546
525
  setComposingValue(null);
547
- store.state.setInputValue(next, createChangeEventDetails(inputChange, event.nativeEvent));
526
+ store.context.setInputValue(next, createChangeEventDetails(inputChange, event.nativeEvent));
548
527
  },
549
528
  onChange (event) {
550
- const inputType = event.nativeEvent.inputType;
529
+ const nativeEvent = event.nativeEvent;
530
+ const inputType = nativeEvent.inputType;
551
531
  const autofillLikeInput = !inputType || 'insertReplacementText' === inputType;
552
532
  const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput;
533
+ function maybeOpenOnInput(trimmed) {
534
+ if (readOnly || disabled || !trimmed || !shouldOpenOnInput) return;
535
+ store.context.setOpen(true, createChangeEventDetails(inputChange, nativeEvent));
536
+ if (!autoHighlightEnabled) clearHighlight(nativeEvent);
537
+ }
553
538
  if (isComposingRef.current) {
554
539
  const nextVal = event.currentTarget.value;
555
540
  setComposingValue(nextVal);
556
- if ('' === nextVal && !store.state.openOnInputClick && !store.state.inputInsidePopup) store.state.setOpen(false, createChangeEventDetails(inputClear, event.nativeEvent));
541
+ if ('' === nextVal && !store.state.openOnInputClick && !store.state.inputInsidePopup) store.context.setOpen(false, createChangeEventDetails(inputClear, nativeEvent));
557
542
  const trimmed = nextVal.trim();
558
543
  const shouldMaintainHighlight = autoHighlightEnabled && '' !== trimmed;
559
- if (!readOnly && !disabled && trimmed) {
560
- if (shouldOpenOnInput) {
561
- store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
562
- if (!autoHighlightEnabled) store.state.setIndices({
563
- activeIndex: null,
564
- selectedIndex: null,
565
- type: store.state.keyboardActiveRef.current ? 'keyboard' : 'pointer'
566
- });
567
- }
568
- }
569
- if (open && null !== store.state.activeIndex && !shouldMaintainHighlight) store.state.setIndices({
570
- activeIndex: null,
571
- selectedIndex: null,
572
- type: store.state.keyboardActiveRef.current ? 'keyboard' : 'pointer'
573
- });
544
+ maybeOpenOnInput(trimmed);
545
+ if (open && null !== store.state.activeIndex && !shouldMaintainHighlight) clearHighlight(nativeEvent);
574
546
  return;
575
547
  }
576
- store.state.setInputValue(event.currentTarget.value, createChangeEventDetails(inputChange, event.nativeEvent));
548
+ const inputChangeDetails = createChangeEventDetails(inputChange, nativeEvent);
549
+ store.context.setInputValue(event.currentTarget.value, inputChangeDetails);
550
+ if (inputChangeDetails.isCanceled) return;
577
551
  const empty = '' === event.currentTarget.value;
578
- const clearDetails = createChangeEventDetails(inputClear, event.nativeEvent);
552
+ const clearDetails = createChangeEventDetails(inputClear, nativeEvent);
579
553
  if (empty && !store.state.inputInsidePopup) {
580
- if ('single' === selectionMode) store.state.setSelectedValue(null, clearDetails);
581
- if (!store.state.openOnInputClick) store.state.setOpen(false, clearDetails);
554
+ if ('single' === selectionMode) store.context.setSelectedValue(null, clearDetails);
555
+ if (!store.state.openOnInputClick) store.context.setOpen(false, clearDetails);
582
556
  }
583
- const trimmed = event.currentTarget.value.trim();
584
- if (!readOnly && !disabled && trimmed) {
585
- if (shouldOpenOnInput) {
586
- store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
587
- if (!autoHighlightEnabled) store.state.setIndices({
588
- activeIndex: null,
589
- selectedIndex: null,
590
- type: store.state.keyboardActiveRef.current ? 'keyboard' : 'pointer'
591
- });
592
- }
593
- }
594
- if (open && null !== store.state.activeIndex && !autoHighlightEnabled) store.state.setIndices({
595
- activeIndex: null,
596
- selectedIndex: null,
597
- type: store.state.keyboardActiveRef.current ? 'keyboard' : 'pointer'
598
- });
557
+ maybeOpenOnInput(event.currentTarget.value.trim());
558
+ if (open && null !== store.state.activeIndex && !autoHighlightEnabled) clearHighlight(nativeEvent);
599
559
  },
600
560
  onKeyDown (event) {
601
- if (disabled || readOnly) return;
602
561
  if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;
603
- store.state.keyboardActiveRef.current = true;
562
+ if (disabled || readOnly) {
563
+ if (readOnly && 'Enter' === event.key && open && null !== store.state.activeIndex) stopEvent(event);
564
+ return;
565
+ }
604
566
  const input = event.currentTarget;
605
567
  const scrollAmount = input.scrollWidth - input.clientWidth;
606
568
  const isRTL = 'rtl' === direction;
607
569
  if ('Home' === event.key) {
608
570
  stopEvent(event);
609
- const cursor = isFirefox && isRTL ? input.value.length : 0;
571
+ const cursor = gecko && isRTL ? input.value.length : 0;
610
572
  input.setSelectionRange(cursor, cursor);
611
573
  input.scrollLeft = 0;
612
574
  return;
613
575
  }
614
576
  if ('End' === event.key) {
615
577
  stopEvent(event);
616
- const cursor = isFirefox && isRTL ? 0 : input.value.length;
578
+ const cursor = gecko && isRTL ? 0 : input.value.length;
617
579
  input.setSelectionRange(cursor, cursor);
618
580
  input.scrollLeft = isRTL ? -scrollAmount : scrollAmount;
619
581
  return;
@@ -622,51 +584,33 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
622
584
  const isClear = 'multiple' === selectionMode && Array.isArray(selectedValue) ? 0 === selectedValue.length : null === selectedValue;
623
585
  const details = createChangeEventDetails(escapeKey, event.nativeEvent);
624
586
  const value = 'multiple' === selectionMode ? [] : null;
625
- store.state.setInputValue('', details);
626
- store.state.setSelectedValue(value, details);
587
+ store.context.setInputValue('', details);
588
+ store.context.setSelectedValue(value, details);
627
589
  if (!isClear && !store.state.inline && !details.isPropagationAllowed) event.stopPropagation();
628
590
  return;
629
591
  }
630
- if (comboboxChipsContext && 'Backspace' === event.key && '' === input.value && void 0 === comboboxChipsContext.highlightedChipIndex && Array.isArray(selectedValue) && selectedValue.length > 0) {
592
+ if (comboboxChipsContext && 'Backspace' === event.key && '' === input.value && Array.isArray(selectedValue) && selectedValue.length > 0) {
631
593
  const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
632
594
  const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;
633
595
  const newValue = selectedValue.filter((_, index)=>index !== removalIndex);
634
- store.state.setIndices({
635
- activeIndex: null,
636
- selectedIndex: null,
637
- type: store.state.keyboardActiveRef.current ? 'keyboard' : 'pointer'
638
- });
639
- store.state.setSelectedValue(newValue, createChangeEventDetails("none", event.nativeEvent));
596
+ clearHighlight(event.nativeEvent);
597
+ store.context.setSelectedValue(newValue, createChangeEventDetails("none", event.nativeEvent));
640
598
  return;
641
599
  }
642
- const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== void 0;
643
600
  const nextIndex = handleKeyDown(event);
644
- comboboxChipsContext?.setHighlightedChipIndex(nextIndex);
645
601
  if (void 0 !== nextIndex) comboboxChipsContext?.chipsRef.current[nextIndex]?.focus();
646
- else if (hadHighlightedChip) store.state.inputRef.current?.focus();
647
602
  if (229 === event.which) return;
648
603
  if ('Enter' === event.key && open) {
649
604
  const activeIndex = store.state.activeIndex;
650
605
  const nativeEvent = event.nativeEvent;
651
606
  if (null === activeIndex) {
652
607
  if (inline) return;
653
- store.state.setOpen(false, createChangeEventDetails("none", nativeEvent));
608
+ store.context.setOpen(false, createChangeEventDetails("none", nativeEvent));
654
609
  return;
655
610
  }
656
611
  stopEvent(event);
657
- const listItem = store.state.listRef.current[activeIndex];
658
- if (listItem) {
659
- store.state.selectionEventRef.current = nativeEvent;
660
- listItem.click();
661
- store.state.selectionEventRef.current = null;
662
- }
612
+ clickHighlightedItem(store, activeIndex, nativeEvent);
663
613
  }
664
- },
665
- onPointerMove () {
666
- store.state.keyboardActiveRef.current = false;
667
- },
668
- onPointerDown () {
669
- store.state.keyboardActiveRef.current = false;
670
614
  }
671
615
  },
672
616
  validationProps
@@ -680,7 +624,7 @@ const ComboboxInput_ComboboxInput = /*#__PURE__*/ __rspack_external_react.forwar
680
624
  return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
681
625
  children: [
682
626
  open && focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton_ComboboxInternalDismissButton, {
683
- ref: store.state.startDismissRef
627
+ ref: store.context.startDismissRef
684
628
  }),
685
629
  renderedInput
686
630
  ]
@@ -710,12 +654,12 @@ const ComboboxClear_ComboboxClear = /*#__PURE__*/ __rspack_external_react.forwar
710
654
  const { render, className, disabled: disabledProp = false, nativeButton = true, keepMounted = false, style, ...elementProps } = componentProps;
711
655
  const { disabled: fieldDisabled } = useFieldRootContext();
712
656
  const store = useComboboxRootContext();
713
- const selectionMode = useStore(store, selectors.selectionMode);
714
- const comboboxDisabled = useStore(store, selectors.disabled);
715
- const readOnly = useStore(store, selectors.readOnly);
716
- const open = useStore(store, selectors.open);
717
- const selectedValue = useStore(store, selectors.selectedValue);
718
- const hasSelectionChips = useStore(store, selectors.hasSelectionChips);
657
+ const selectionMode = store.useState('selectionMode');
658
+ const comboboxDisabled = store.useState('disabled');
659
+ const readOnly = store.useState('readOnly');
660
+ const open = store.useState('open');
661
+ const selectedValue = store.useState('selectedValue');
662
+ const hasSelectionChips = store.useState('hasSelectionChips');
719
663
  const inputValue = useComboboxInputValueContext();
720
664
  let visible = false;
721
665
  visible = 'none' === selectionMode ? '' !== inputValue : 'single' === selectionMode ? null != selectedValue : hasSelectionChips;
@@ -733,7 +677,7 @@ const ComboboxClear_ComboboxClear = /*#__PURE__*/ __rspack_external_react.forwar
733
677
  };
734
678
  useOpenChangeComplete({
735
679
  open: visible,
736
- ref: store.state.clearRef,
680
+ ref: store.context.clearRef,
737
681
  onComplete () {
738
682
  if (!visible) setMounted(false);
739
683
  }
@@ -743,7 +687,7 @@ const ComboboxClear_ComboboxClear = /*#__PURE__*/ __rspack_external_react.forwar
743
687
  ref: [
744
688
  forwardedRef,
745
689
  buttonRef,
746
- store.state.clearRef
690
+ store.context.clearRef
747
691
  ],
748
692
  props: [
749
693
  {
@@ -754,20 +698,22 @@ const ComboboxClear_ComboboxClear = /*#__PURE__*/ __rspack_external_react.forwar
754
698
  },
755
699
  onClick (event) {
756
700
  if (disabled || readOnly) return;
757
- const keyboardActiveRef = store.state.keyboardActiveRef;
758
- store.state.setInputValue('', createChangeEventDetails(clearPress, event.nativeEvent));
701
+ const type = getHighlightReason(event);
702
+ store.context.setInputValue('', createChangeEventDetails(clearPress, event.nativeEvent));
759
703
  if ('none' !== selectionMode) {
760
- store.state.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(clearPress, event.nativeEvent));
761
- store.state.setIndices({
704
+ store.context.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(clearPress, event.nativeEvent));
705
+ store.context.setIndices({
762
706
  activeIndex: null,
763
707
  selectedIndex: null,
764
- type: keyboardActiveRef.current ? 'keyboard' : 'pointer'
708
+ type,
709
+ event: event.nativeEvent
765
710
  });
766
- } else store.state.setIndices({
711
+ } else store.context.setIndices({
767
712
  activeIndex: null,
768
- type: keyboardActiveRef.current ? 'keyboard' : 'pointer'
713
+ type,
714
+ event: event.nativeEvent
769
715
  });
770
- store.state.inputRef.current?.focus();
716
+ store.context.inputRef.current?.focus();
771
717
  }
772
718
  },
773
719
  elementProps,
@@ -802,7 +748,6 @@ function ComboboxCollection(props) {
802
748
  const { filteredItems } = useComboboxDerivedItemsContext();
803
749
  const groupContext = useGroupCollectionContext();
804
750
  const itemsToRender = groupContext ? groupContext.items : filteredItems;
805
- if (!itemsToRender) return null;
806
751
  return /*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
807
752
  children: itemsToRender.map(children)
808
753
  });
@@ -814,10 +759,12 @@ const ComboboxList_ComboboxList = /*#__PURE__*/ __rspack_external_react.forwardR
814
759
  const floatingRootContext = useComboboxFloatingContext();
815
760
  const hasPositionerContext = Boolean(useComboboxPositionerContext(true));
816
761
  const { filteredItems, hasItems } = useComboboxDerivedItemsContext();
817
- const selectionMode = useStore(store, selectors.selectionMode);
818
- const grid = useStore(store, selectors.grid);
819
- const popupProps = useStore(store, selectors.popupProps);
820
- const virtualized = useStore(store, selectors.virtualized);
762
+ const selectionMode = store.useState('selectionMode');
763
+ const grid = store.useState('grid');
764
+ const readOnly = store.useState('readOnly');
765
+ const listProps = store.useState('listProps');
766
+ const virtualized = store.useState('virtualized');
767
+ const forceMounted = store.useState('forceMounted');
821
768
  const multiple = 'multiple' === selectionMode;
822
769
  const empty = 0 === filteredItems.length;
823
770
  const setPositionerElement = useStableCallback((element)=>{
@@ -846,42 +793,32 @@ const ComboboxList_ComboboxList = /*#__PURE__*/ __rspack_external_react.forwardR
846
793
  hasPositionerContext ? null : setPositionerElement
847
794
  ],
848
795
  props: [
849
- popupProps,
796
+ listProps,
850
797
  {
851
798
  children: resolvedChildren,
852
799
  tabIndex: -1,
853
800
  id: floatingId,
854
801
  role: grid ? 'grid' : 'listbox',
855
802
  'aria-multiselectable': multiple ? 'true' : void 0,
803
+ 'aria-readonly': !grid && readOnly ? true : void 0,
856
804
  onKeyDown (event) {
857
805
  if (store.state.disabled || store.state.readOnly) return;
858
806
  if ('Enter' === event.key) {
859
807
  const activeIndex = store.state.activeIndex;
860
808
  if (null == activeIndex) return;
861
809
  stopEvent(event);
862
- const nativeEvent = event.nativeEvent;
863
- const listItem = store.state.listRef.current[activeIndex];
864
- if (listItem) {
865
- store.state.selectionEventRef.current = nativeEvent;
866
- listItem.click();
867
- store.state.selectionEventRef.current = null;
868
- }
810
+ clickHighlightedItem(store, activeIndex, event.nativeEvent);
869
811
  }
870
- },
871
- onKeyDownCapture () {
872
- store.state.keyboardActiveRef.current = true;
873
- },
874
- onPointerMoveCapture () {
875
- store.state.keyboardActiveRef.current = false;
876
812
  }
877
813
  },
878
814
  elementProps
879
815
  ]
880
816
  });
881
817
  if (virtualized) return element;
818
+ const labelsRef = hasItems && !forceMounted ? void 0 : store.context.labelsRef;
882
819
  return /*#__PURE__*/ jsx(CompositeList, {
883
- elementsRef: store.state.listRef,
884
- labelsRef: hasItems ? void 0 : store.state.labelsRef,
820
+ elementsRef: store.context.listRef,
821
+ labelsRef: labelsRef,
885
822
  children: element
886
823
  });
887
824
  });
@@ -897,16 +834,16 @@ function findLastTextNode(root) {
897
834
  }
898
835
  return lastTextNode;
899
836
  }
900
- function useInitialLiveRegionTextMutation() {
837
+ function useInitialLiveRegionTextMutation(present = true) {
901
838
  const timeout = useTimeout();
902
839
  const rootRef = __rspack_external_react.useRef(null);
903
840
  __rspack_external_react.useEffect(()=>{
904
- if (isIOS) return;
841
+ if (!present || ios) return;
905
842
  const root = rootRef.current;
906
843
  if (null == root) return;
907
844
  const textNode = findLastTextNode(root);
908
845
  if (null == textNode) return;
909
- const originalValue = textNode.nodeValue ?? '';
846
+ const originalValue = textNode.data;
910
847
  const markedValue = `${originalValue}${LIVE_REGION_MARKER}`;
911
848
  textNode.nodeValue = markedValue;
912
849
  timeout.start(INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY, ()=>{
@@ -917,6 +854,7 @@ function useInitialLiveRegionTextMutation() {
917
854
  if (textNode.nodeValue === markedValue) textNode.nodeValue = originalValue;
918
855
  };
919
856
  }, [
857
+ present,
920
858
  rootRef,
921
859
  timeout
922
860
  ]);
@@ -949,9 +887,9 @@ const ComboboxBackdrop_stateAttributesMapping = {
949
887
  const ComboboxBackdrop_ComboboxBackdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
950
888
  const { render, className, style, ...elementProps } = componentProps;
951
889
  const store = useComboboxRootContext();
952
- const open = useStore(store, selectors.open);
953
- const mounted = useStore(store, selectors.mounted);
954
- const transitionStatus = useStore(store, selectors.transitionStatus);
890
+ const open = store.useState('open');
891
+ const mounted = store.useState('mounted');
892
+ const transitionStatus = store.useState('transitionStatus');
955
893
  const state = {
956
894
  open,
957
895
  transitionStatus
@@ -978,26 +916,25 @@ const ComboboxPortalContext = /*#__PURE__*/ __rspack_external_react.createContex
978
916
  if ("production" !== process.env.NODE_ENV) ComboboxPortalContext.displayName = "ComboboxPortalContext";
979
917
  function useComboboxPortalContext() {
980
918
  const context = __rspack_external_react.useContext(ComboboxPortalContext);
981
- if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Combobox.Portal> is missing.' : esm_formatErrorMessage(20));
919
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Combobox.Portal> is missing.' : utils_formatErrorMessage(20));
982
920
  return context;
983
921
  }
984
922
  const ComboboxPositioner_ComboboxPositioner = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
985
- const { render, className, anchor, positionMethod = 'absolute', side = 'bottom', align = 'center', sideOffset = 0, alignOffset = 0, collisionBoundary = 'clipping-ancestors', collisionPadding = 5, arrowPadding = 5, sticky = false, disableAnchorTracking = false, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style: styleProp, ...elementProps } = componentProps;
923
+ const { render, className, anchor, positionMethod, side, align, sideOffset, alignOffset, collisionBoundary = 'clipping-ancestors', collisionPadding, arrowPadding, sticky, disableAnchorTracking = false, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style: styleProp, ...elementProps } = componentProps;
986
924
  const store = useComboboxRootContext();
987
- const { filteredItems } = useComboboxDerivedItemsContext();
988
925
  const floatingRootContext = useComboboxFloatingContext();
989
926
  const keepMounted = useComboboxPortalContext();
990
- const modal = useStore(store, selectors.modal);
991
- const open = useStore(store, selectors.open);
992
- const mounted = useStore(store, selectors.mounted);
993
- const openMethod = useStore(store, selectors.openMethod);
994
- const positionerElement = useStore(store, selectors.positionerElement);
995
- const triggerElement = useStore(store, selectors.triggerElement);
996
- const inputElement = useStore(store, selectors.inputElement);
997
- const inputGroupElement = useStore(store, selectors.inputGroupElement);
998
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
999
- const transitionStatus = useStore(store, selectors.transitionStatus);
1000
- const empty = 0 === filteredItems.length;
927
+ const modal = store.useState('modal');
928
+ const open = store.useState('open');
929
+ const mounted = store.useState('mounted');
930
+ const openMethod = store.useState('openMethod');
931
+ const positionerElement = store.useState('positionerElement');
932
+ const triggerElement = store.useState('triggerElement');
933
+ const inputElement = store.useState('inputElement');
934
+ const inputGroupElement = store.useState('inputGroupElement');
935
+ const inputInsidePopup = store.useState('inputInsidePopup');
936
+ const transitionStatus = store.useState('transitionStatus');
937
+ const empty = useListEmpty();
1001
938
  const resolvedAnchor = anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement);
1002
939
  const positioning = useAnchorPositioning({
1003
940
  anchor: resolvedAnchor,
@@ -1057,6 +994,15 @@ const ComboboxPositioner_ComboboxPositioner = /*#__PURE__*/ __rspack_external_re
1057
994
  });
1058
995
  });
1059
996
  if ("production" !== process.env.NODE_ENV) ComboboxPositioner_ComboboxPositioner.displayName = "ComboboxPositioner";
997
+ function getComboboxPopupId(rootId) {
998
+ return null == rootId ? void 0 : `${rootId}-popup`;
999
+ }
1000
+ function utils_createCollatorItemFilter(collatorFilter, itemToStringLabel) {
1001
+ return (item, query)=>{
1002
+ if (null == item) return false;
1003
+ return collatorFilter.contains(item, query, itemToStringLabel);
1004
+ };
1005
+ }
1060
1006
  const ComboboxPopup_stateAttributesMapping = {
1061
1007
  ...popupStateMapping,
1062
1008
  ...transitionStatusMapping
@@ -1066,20 +1012,31 @@ const ComboboxPopup_ComboboxPopup = /*#__PURE__*/ __rspack_external_react.forwar
1066
1012
  const store = useComboboxRootContext();
1067
1013
  const positioning = useComboboxPositionerContext();
1068
1014
  const floatingRootContext = useComboboxFloatingContext();
1069
- const { filteredItems } = useComboboxDerivedItemsContext();
1070
- const mounted = useStore(store, selectors.mounted);
1071
- const open = useStore(store, selectors.open);
1072
- const openMethod = useStore(store, selectors.openMethod);
1073
- const transitionStatus = useStore(store, selectors.transitionStatus);
1074
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
1075
- const inputElement = useStore(store, selectors.inputElement);
1076
- const modal = useStore(store, selectors.modal);
1077
- const empty = 0 === filteredItems.length;
1015
+ const mounted = store.useState('mounted');
1016
+ const open = store.useState('open');
1017
+ const openMethod = store.useState('openMethod');
1018
+ const popupProps = store.useState('popupProps');
1019
+ const transitionStatus = store.useState('transitionStatus');
1020
+ const inputInsidePopup = store.useState('inputInsidePopup');
1021
+ const inputElement = store.useState('inputElement');
1022
+ const modal = store.useState('modal');
1023
+ const rootId = store.useState('id');
1024
+ const empty = useListEmpty();
1025
+ const popupId = elementProps.id ?? (inputInsidePopup ? getComboboxPopupId(rootId) : void 0);
1026
+ useIsoLayoutEffect(()=>{
1027
+ store.set('popupId', store.context.popupRef.current?.id || popupId);
1028
+ return ()=>{
1029
+ store.set('popupId', void 0);
1030
+ };
1031
+ }, [
1032
+ store,
1033
+ popupId
1034
+ ]);
1078
1035
  useOpenChangeComplete({
1079
1036
  open,
1080
- ref: store.state.popupRef,
1037
+ ref: store.context.popupRef,
1081
1038
  onComplete () {
1082
- if (open) store.state.onOpenChangeComplete(true);
1039
+ if (open) store.context.onOpenChangeComplete(true);
1083
1040
  }
1084
1041
  });
1085
1042
  const state = {
@@ -1094,15 +1051,16 @@ const ComboboxPopup_ComboboxPopup = /*#__PURE__*/ __rspack_external_react.forwar
1094
1051
  state,
1095
1052
  ref: [
1096
1053
  forwardedRef,
1097
- store.state.popupRef
1054
+ store.context.popupRef
1098
1055
  ],
1099
1056
  props: [
1057
+ popupProps,
1100
1058
  {
1059
+ id: popupId,
1101
1060
  role: inputInsidePopup ? 'dialog' : 'presentation',
1102
- tabIndex: -1,
1103
1061
  onFocus (event) {
1104
1062
  const target = getTarget(event.nativeEvent);
1105
- if ('touch' !== openMethod && (shadowDom_contains(store.state.listElement, target) || target === event.currentTarget)) store.state.inputRef.current?.focus();
1063
+ if ('touch' !== openMethod && (shadowDom_contains(store.state.listElement, target) || target === event.currentTarget)) store.context.inputRef.current?.focus();
1106
1064
  }
1107
1065
  },
1108
1066
  getDisabledMountTransitionStyles(transitionStatus),
@@ -1110,7 +1068,7 @@ const ComboboxPopup_ComboboxPopup = /*#__PURE__*/ __rspack_external_react.forwar
1110
1068
  ],
1111
1069
  stateAttributesMapping: ComboboxPopup_stateAttributesMapping
1112
1070
  });
1113
- const computedDefaultInitialFocus = inputInsidePopup ? (interactionType)=>'touch' === interactionType ? store.state.popupRef.current : inputElement : false;
1071
+ const computedDefaultInitialFocus = inputInsidePopup ? (interactionType)=>'touch' === interactionType ? store.context.popupRef.current : inputElement : false;
1114
1072
  const resolvedInitialFocus = void 0 === initialFocus ? computedDefaultInitialFocus : initialFocus;
1115
1073
  let resolvedFinalFocus;
1116
1074
  resolvedFinalFocus = null != finalFocus ? finalFocus : inputInsidePopup ? void 0 : false;
@@ -1123,14 +1081,14 @@ const ComboboxPopup_ComboboxPopup = /*#__PURE__*/ __rspack_external_react.forwar
1123
1081
  initialFocus: resolvedInitialFocus,
1124
1082
  returnFocus: resolvedFinalFocus,
1125
1083
  getInsideElements: ()=>[
1126
- store.state.startDismissRef.current,
1127
- store.state.endDismissRef.current
1084
+ store.context.startDismissRef.current,
1085
+ store.context.endDismissRef.current
1128
1086
  ],
1129
1087
  children: /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
1130
1088
  children: [
1131
1089
  element,
1132
1090
  focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton_ComboboxInternalDismissButton, {
1133
- ref: store.state.endDismissRef
1091
+ ref: store.context.endDismissRef
1134
1092
  })
1135
1093
  ]
1136
1094
  })
@@ -1141,7 +1099,7 @@ const ComboboxArrow_ComboboxArrow = /*#__PURE__*/ __rspack_external_react.forwar
1141
1099
  const { render, className, style, ...elementProps } = componentProps;
1142
1100
  const store = useComboboxRootContext();
1143
1101
  const { arrowRef, side, align, arrowUncentered, arrowStyles } = useComboboxPositionerContext();
1144
- const open = useStore(store, selectors.open);
1102
+ const open = store.useState('open');
1145
1103
  const state = {
1146
1104
  open,
1147
1105
  side,
@@ -1167,11 +1125,13 @@ const ComboboxGroupContext = /*#__PURE__*/ __rspack_external_react.createContext
1167
1125
  if ("production" !== process.env.NODE_ENV) ComboboxGroupContext.displayName = "ComboboxGroupContext";
1168
1126
  function useComboboxGroupContext() {
1169
1127
  const context = __rspack_external_react.useContext(ComboboxGroupContext);
1170
- if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxGroupContext is missing. ComboboxGroup parts must be placed within <Combobox.Group>.' : esm_formatErrorMessage(18));
1128
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxGroupContext is missing. ComboboxGroup parts must be placed within <Combobox.Group>.' : utils_formatErrorMessage(18));
1171
1129
  return context;
1172
1130
  }
1173
1131
  const ComboboxGroup_ComboboxGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
1174
1132
  const { render, className, style, items, ...elementProps } = componentProps;
1133
+ const store = useComboboxRootContext();
1134
+ const grid = store.useState('grid');
1175
1135
  const [labelId, setLabelId] = __rspack_external_react.useState();
1176
1136
  const contextValue = __rspack_external_react.useMemo(()=>({
1177
1137
  labelId,
@@ -1186,7 +1146,7 @@ const ComboboxGroup_ComboboxGroup = /*#__PURE__*/ __rspack_external_react.forwar
1186
1146
  ref: forwardedRef,
1187
1147
  props: [
1188
1148
  {
1189
- role: 'group',
1149
+ role: grid ? 'rowgroup' : 'group',
1190
1150
  'aria-labelledby': labelId
1191
1151
  },
1192
1152
  elementProps
@@ -1210,7 +1170,7 @@ const ComboboxGroupLabel_ComboboxGroupLabel = /*#__PURE__*/ __rspack_external_re
1210
1170
  useIsoLayoutEffect(()=>{
1211
1171
  setLabelId(id);
1212
1172
  return ()=>{
1213
- setLabelId(void 0);
1173
+ setLabelId((currentId)=>currentId === id ? void 0 : currentId);
1214
1174
  };
1215
1175
  }, [
1216
1176
  id,
@@ -1220,7 +1180,8 @@ const ComboboxGroupLabel_ComboboxGroupLabel = /*#__PURE__*/ __rspack_external_re
1220
1180
  ref: forwardedRef,
1221
1181
  props: [
1222
1182
  {
1223
- id
1183
+ id,
1184
+ 'aria-hidden': true
1224
1185
  },
1225
1186
  elementProps
1226
1187
  ]
@@ -1254,7 +1215,7 @@ const ComboboxEmpty_ComboboxEmpty = /*#__PURE__*/ __rspack_external_react.forwar
1254
1215
  return useRenderElement('div', componentProps, {
1255
1216
  ref: [
1256
1217
  forwardedRef,
1257
- store.state.emptyRef,
1218
+ store.context.emptyRef,
1258
1219
  emptyRef
1259
1220
  ],
1260
1221
  props: [
@@ -1269,68 +1230,59 @@ const ComboboxEmpty_ComboboxEmpty = /*#__PURE__*/ __rspack_external_react.forwar
1269
1230
  });
1270
1231
  });
1271
1232
  if ("production" !== process.env.NODE_ENV) ComboboxEmpty_ComboboxEmpty.displayName = "ComboboxEmpty";
1272
- const BOUNDARY_OFFSET = 2;
1273
1233
  const ComboboxTrigger_ComboboxTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
1274
1234
  const { render, className, nativeButton = true, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
1275
- const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
1235
+ const { state: fieldState, disabled: fieldDisabled, setTouched, validationMode, validation } = useFieldRootContext();
1276
1236
  const { labelId: fieldLabelId } = useLabelableContext();
1277
1237
  const store = useComboboxRootContext();
1278
- const { filteredItems } = useComboboxDerivedItemsContext();
1279
- const selectionMode = useStore(store, selectors.selectionMode);
1280
- const comboboxDisabled = useStore(store, selectors.disabled);
1281
- const readOnly = useStore(store, selectors.readOnly);
1282
- const required = useStore(store, selectors.required);
1283
- const mounted = useStore(store, selectors.mounted);
1284
- const popupSideValue = useStore(store, selectors.popupSide);
1285
- const positionerElement = useStore(store, selectors.positionerElement);
1286
- const listElement = useStore(store, selectors.listElement);
1287
- const triggerProps = useStore(store, selectors.triggerProps);
1288
- const triggerElement = useStore(store, selectors.triggerElement);
1289
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
1290
- const rootId = useStore(store, selectors.id);
1291
- const comboboxLabelId = useStore(store, selectors.labelId);
1292
- const open = useStore(store, selectors.open);
1293
- const selectedValue = useStore(store, selectors.selectedValue);
1294
- const activeIndex = useStore(store, selectors.activeIndex);
1295
- const selectedIndex = useStore(store, selectors.selectedIndex);
1296
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
1238
+ const selectionMode = store.useState('selectionMode');
1239
+ const comboboxDisabled = store.useState('disabled');
1240
+ const readOnly = store.useState('readOnly');
1241
+ const required = store.useState('required');
1242
+ const positionerElement = store.useState('positionerElement');
1243
+ const listElement = store.useState('listElement');
1244
+ const storedPopupId = store.useState('popupId');
1245
+ const triggerProps = store.useState('triggerProps');
1246
+ const inputInsidePopup = store.useState('inputInsidePopup');
1247
+ const rootId = store.useState('id');
1248
+ const comboboxLabelId = store.useState('labelId');
1249
+ const open = store.useState('open');
1250
+ const selectedValue = store.useState('selectedValue');
1251
+ const activeIndex = store.useState('activeIndex');
1252
+ const selectedIndex = store.useState('selectedIndex');
1253
+ const hasSelectedValue = store.useState('hasSelectedValue');
1297
1254
  const floatingRootContext = useComboboxFloatingContext();
1298
1255
  const inputValue = useComboboxInputValueContext();
1299
1256
  const focusTimeout = useTimeout();
1300
1257
  const disabled = fieldDisabled || comboboxDisabled || disabledProp;
1301
- const listEmpty = 0 === filteredItems.length;
1302
- const popupSide = mounted && positionerElement ? popupSideValue : null;
1258
+ const listEmpty = useListEmpty();
1259
+ const popupSide = usePopupSide(store);
1260
+ const triggerRef = __rspack_external_react.useRef(null);
1261
+ const setFocused = useSetFieldFocused(disabled, triggerRef);
1303
1262
  useLabelableId({
1304
1263
  id: inputInsidePopup ? idProp : void 0
1305
1264
  });
1306
1265
  const id = inputInsidePopup ? idProp ?? rootId : idProp;
1307
1266
  const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
1267
+ let ariaControls;
1268
+ if (open && inputInsidePopup) ariaControls = storedPopupId ?? getComboboxPopupId(rootId);
1269
+ else if (open) ariaControls = listElement?.id;
1308
1270
  const currentPointerTypeRef = __rspack_external_react.useRef('');
1309
1271
  function trackPointerType(event) {
1310
1272
  currentPointerTypeRef.current = event.pointerType;
1311
1273
  }
1312
- const domReference = floatingRootContext.useState('domReferenceElement');
1313
- __rspack_external_react.useEffect(()=>{
1314
- if (!inputInsidePopup) return;
1315
- if (triggerElement && triggerElement !== domReference) floatingRootContext.set('domReferenceElement', triggerElement);
1316
- }, [
1317
- triggerElement,
1318
- domReference,
1319
- floatingRootContext,
1320
- inputInsidePopup
1321
- ]);
1322
1274
  const { reference: triggerTypeaheadProps } = useTypeahead(floatingRootContext, {
1323
1275
  enabled: !open && !readOnly && !comboboxDisabled && 'single' === selectionMode,
1324
- listRef: store.state.labelsRef,
1276
+ listRef: store.context.labelsRef,
1325
1277
  activeIndex,
1326
1278
  selectedIndex,
1327
1279
  onMatch (index) {
1328
- const nextSelectedValue = store.state.valuesRef.current[index];
1329
- if (void 0 !== nextSelectedValue) store.state.setSelectedValue(nextSelectedValue, createChangeEventDetails('none'));
1280
+ const nextSelectedValue = store.context.valuesRef.current[index];
1281
+ if (void 0 !== nextSelectedValue) store.context.setSelectedValue(nextSelectedValue, createChangeEventDetails("none"));
1330
1282
  }
1331
1283
  });
1332
1284
  const { reference: triggerClickProps } = useClick(floatingRootContext, {
1333
- enabled: !readOnly && !comboboxDisabled,
1285
+ enabled: !comboboxDisabled,
1334
1286
  event: 'mousedown'
1335
1287
  });
1336
1288
  const { buttonRef, getButtonProps } = useButton({
@@ -1339,6 +1291,7 @@ const ComboboxTrigger_ComboboxTrigger = /*#__PURE__*/ __rspack_external_react.fo
1339
1291
  });
1340
1292
  const state = {
1341
1293
  ...fieldState,
1294
+ readOnly,
1342
1295
  open,
1343
1296
  disabled,
1344
1297
  popupSide,
@@ -1352,6 +1305,7 @@ const ComboboxTrigger_ComboboxTrigger = /*#__PURE__*/ __rspack_external_react.fo
1352
1305
  ref: [
1353
1306
  forwardedRef,
1354
1307
  buttonRef,
1308
+ triggerRef,
1355
1309
  setTriggerElement
1356
1310
  ],
1357
1311
  state,
@@ -1363,17 +1317,18 @@ const ComboboxTrigger_ComboboxTrigger = /*#__PURE__*/ __rspack_external_react.fo
1363
1317
  id,
1364
1318
  tabIndex: inputInsidePopup ? 0 : -1,
1365
1319
  role: inputInsidePopup ? 'combobox' : void 0,
1366
- 'aria-expanded': open ? 'true' : 'false',
1320
+ 'aria-expanded': open,
1367
1321
  'aria-haspopup': inputInsidePopup ? 'dialog' : 'listbox',
1368
- 'aria-controls': open ? listElement?.id : void 0,
1322
+ 'aria-controls': ariaControls,
1369
1323
  'aria-required': inputInsidePopup ? required || void 0 : void 0,
1324
+ 'aria-readonly': inputInsidePopup ? readOnly || void 0 : void 0,
1370
1325
  'aria-labelledby': ariaLabelledBy,
1371
1326
  onPointerDown: trackPointerType,
1372
1327
  onPointerEnter: trackPointerType,
1373
1328
  onFocus () {
1374
1329
  setFocused(true);
1375
- if (disabled || readOnly) return;
1376
- focusTimeout.start(0, store.state.forceMount);
1330
+ if (disabled) return;
1331
+ focusTimeout.start(0, store.context.forceMount);
1377
1332
  },
1378
1333
  onBlur (event) {
1379
1334
  if (shadowDom_contains(positionerElement, event.relatedTarget)) return;
@@ -1385,41 +1340,38 @@ const ComboboxTrigger_ComboboxTrigger = /*#__PURE__*/ __rspack_external_react.fo
1385
1340
  }
1386
1341
  },
1387
1342
  onMouseDown (event) {
1388
- if (disabled || readOnly) return;
1343
+ if (disabled) return;
1389
1344
  if (!inputInsidePopup) floatingRootContext.set('domReferenceElement', event.currentTarget);
1390
- store.state.forceMount();
1345
+ store.context.forceMount();
1391
1346
  if ('touch' !== currentPointerTypeRef.current) {
1392
- store.state.inputRef.current?.focus();
1347
+ store.context.inputRef.current?.focus();
1393
1348
  if (!inputInsidePopup) event.preventDefault();
1394
1349
  }
1395
1350
  if (open) return;
1396
1351
  const doc = ownerDocument(event.currentTarget);
1397
1352
  function handleMouseUp(mouseEvent) {
1398
- if (!triggerElement) return;
1353
+ const currentTriggerElement = store.state.triggerElement;
1354
+ if (!currentTriggerElement) return;
1399
1355
  const mouseUpTarget = getTarget(mouseEvent);
1400
1356
  const positioner = store.state.positionerElement;
1401
1357
  const list = store.state.listElement;
1402
- if (shadowDom_contains(triggerElement, mouseUpTarget) || shadowDom_contains(positioner, mouseUpTarget) || shadowDom_contains(list, mouseUpTarget) || mouseUpTarget === triggerElement) return;
1403
- const bounds = getPseudoElementBounds(triggerElement);
1404
- const withinHorizontal = mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET;
1405
- const withinVertical = mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET;
1406
- if (withinHorizontal && withinVertical) return;
1407
- store.state.setOpen(false, createChangeEventDetails('cancel-open', mouseEvent));
1358
+ if (shadowDom_contains(currentTriggerElement, mouseUpTarget) || shadowDom_contains(positioner, mouseUpTarget) || shadowDom_contains(list, mouseUpTarget)) return;
1359
+ if (isMouseWithinBounds(mouseEvent, currentTriggerElement)) return;
1360
+ store.context.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
1408
1361
  }
1409
1362
  if (inputInsidePopup) doc.addEventListener('mouseup', handleMouseUp, {
1410
1363
  once: true
1411
1364
  });
1412
1365
  },
1413
1366
  onKeyDown (event) {
1414
- if (disabled || readOnly) return;
1415
1367
  if ('ArrowDown' === event.key || 'ArrowUp' === event.key) {
1416
1368
  stopEvent(event);
1417
- store.state.setOpen(true, createChangeEventDetails(reason_parts_listNavigation, event.nativeEvent));
1418
- store.state.inputRef.current?.focus();
1369
+ store.context.setOpen(true, createChangeEventDetails(reason_parts_listNavigation, event.nativeEvent));
1370
+ store.context.inputRef.current?.focus();
1419
1371
  }
1420
1372
  }
1421
1373
  },
1422
- validation ? validation.getValidationProps(elementProps) : elementProps,
1374
+ validation.getValidationProps(disabled, elementProps),
1423
1375
  getButtonProps
1424
1376
  ],
1425
1377
  stateAttributesMapping: triggerStateAttributesMapping
@@ -1427,50 +1379,107 @@ const ComboboxTrigger_ComboboxTrigger = /*#__PURE__*/ __rspack_external_react.fo
1427
1379
  return element;
1428
1380
  });
1429
1381
  if ("production" !== process.env.NODE_ENV) ComboboxTrigger_ComboboxTrigger.displayName = "ComboboxTrigger";
1430
- function utils_createCollatorItemFilter(collatorFilter, itemToStringLabel) {
1431
- return (item, query)=>{
1432
- if (null == item) return false;
1433
- const itemString = stringifyAsLabel(item, itemToStringLabel);
1434
- return collatorFilter.contains(itemString, query);
1435
- };
1436
- }
1437
- function utils_createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue) {
1438
- return (item, query)=>{
1439
- if (null == item) return false;
1440
- if (!query) return true;
1441
- const itemString = stringifyAsLabel(item, itemToStringLabel);
1442
- const selectedString = null != selectedValue ? stringifyAsLabel(selectedValue, itemToStringLabel) : '';
1443
- if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) return true;
1444
- return collatorFilter.contains(itemString, query);
1445
- };
1382
+ function gridNavigation(event, prevIndex, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex, cols = 2) {
1383
+ const nextIndex = getGridNavigatedIndex(listRef.current, {
1384
+ event,
1385
+ orientation,
1386
+ loopFocus,
1387
+ rtl,
1388
+ cols,
1389
+ disabledIndices,
1390
+ minIndex,
1391
+ maxIndex,
1392
+ prevIndex: prevIndex > maxIndex ? minIndex : prevIndex,
1393
+ stopEvent: true
1394
+ });
1395
+ return isIndexOutOfListBounds(listRef.current, nextIndex) ? void 0 : nextIndex;
1446
1396
  }
1397
+ const selectors = {
1398
+ id: (state)=>state.id,
1399
+ labelId: (state)=>state.labelId,
1400
+ items: (state)=>state.items,
1401
+ selectedValue: (state)=>state.selectedValue,
1402
+ hasSelectionChips: (state)=>{
1403
+ const selectedValue = state.selectedValue;
1404
+ return Array.isArray(selectedValue) && selectedValue.length > 0;
1405
+ },
1406
+ hasSelectedValue: (state)=>{
1407
+ const { selectedValue, selectionMode } = state;
1408
+ if (null == selectedValue) return false;
1409
+ if ('multiple' === selectionMode && Array.isArray(selectedValue)) return selectedValue.length > 0;
1410
+ return true;
1411
+ },
1412
+ hasNullItemLabel: (state, enabled)=>enabled ? hasNullItemLabel(state.items) : false,
1413
+ open: (state)=>state.open,
1414
+ mounted: (state)=>state.mounted,
1415
+ forceMounted: (state)=>state.forceMounted,
1416
+ inline: (state)=>state.inline,
1417
+ activeIndex: (state)=>state.activeIndex,
1418
+ selectedIndex: (state)=>state.selectedIndex,
1419
+ isActive: (state, index)=>state.activeIndex === index,
1420
+ isSelected: (state, itemValue)=>{
1421
+ const comparer = state.isItemEqualToValue;
1422
+ const selectedValue = state.selectedValue;
1423
+ if (Array.isArray(selectedValue)) return selectedValue.some((selectedItem)=>compareItemEquality(itemValue, selectedItem, comparer));
1424
+ return compareItemEquality(itemValue, selectedValue, comparer);
1425
+ },
1426
+ transitionStatus: (state)=>state.transitionStatus,
1427
+ popupProps: (state)=>state.popupProps,
1428
+ listProps: (state)=>state.listProps,
1429
+ inputProps: (state)=>state.inputProps,
1430
+ triggerProps: (state)=>state.triggerProps,
1431
+ itemRoot: (state)=>state.itemRoot,
1432
+ positionerElement: (state)=>state.positionerElement,
1433
+ listElement: (state)=>state.listElement,
1434
+ popupId: (state)=>state.popupId,
1435
+ triggerElement: (state)=>state.triggerElement,
1436
+ inputElement: (state)=>state.inputElement,
1437
+ inputGroupElement: (state)=>state.inputGroupElement,
1438
+ popupSide: (state)=>state.popupSide,
1439
+ openMethod: (state)=>state.openMethod,
1440
+ inputInsidePopup: (state)=>state.inputInsidePopup,
1441
+ inputOwnsFormValue: (state)=>state.inputOwnsFormValue,
1442
+ selectionMode: (state)=>state.selectionMode,
1443
+ name: (state)=>state.name,
1444
+ form: (state)=>state.form,
1445
+ disabled: (state)=>state.disabled,
1446
+ readOnly: (state)=>state.readOnly,
1447
+ required: (state)=>state.required,
1448
+ grid: (state)=>state.grid,
1449
+ virtualized: (state)=>state.virtualized,
1450
+ itemToStringLabel: (state)=>state.itemToStringLabel,
1451
+ isItemEqualToValue: (state)=>state.isItemEqualToValue,
1452
+ modal: (state)=>state.modal,
1453
+ autoHighlight: (state)=>state.autoHighlight
1454
+ };
1447
1455
  const filterCache = new Map();
1448
1456
  function filter_getFilter(options = {}) {
1449
- const mergedOptions = {
1457
+ const { locale, ...restOptions } = options;
1458
+ const collatorOptions = {
1450
1459
  usage: 'search',
1451
1460
  sensitivity: 'base',
1452
1461
  ignorePunctuation: true,
1453
- ...options
1462
+ ...restOptions
1454
1463
  };
1455
- const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`;
1464
+ const cacheKey = `${stringifyLocale(locale)}|${JSON.stringify(collatorOptions)}`;
1456
1465
  const cachedFilter = filterCache.get(cacheKey);
1457
1466
  if (cachedFilter) return cachedFilter;
1458
- const collator = new Intl.Collator(options.locale, mergedOptions);
1467
+ const collator = new Intl.Collator(locale, collatorOptions);
1459
1468
  const filter = {
1460
1469
  contains (item, query, itemToString) {
1461
1470
  if (!query) return true;
1462
- const itemString = stringifyAsLabel(item, itemToString);
1471
+ const itemString = resolveValueLabel_stringifyAsLabel(item, itemToString);
1463
1472
  for(let i = 0; i <= itemString.length - query.length; i += 1)if (0 === collator.compare(itemString.slice(i, i + query.length), query)) return true;
1464
1473
  return false;
1465
1474
  },
1466
1475
  startsWith (item, query, itemToString) {
1467
1476
  if (!query) return true;
1468
- const itemString = stringifyAsLabel(item, itemToString);
1477
+ const itemString = resolveValueLabel_stringifyAsLabel(item, itemToString);
1469
1478
  return 0 === collator.compare(itemString.slice(0, query.length), query);
1470
1479
  },
1471
1480
  endsWith (item, query, itemToString) {
1472
1481
  if (!query) return true;
1473
- const itemString = stringifyAsLabel(item, itemToString);
1482
+ const itemString = resolveValueLabel_stringifyAsLabel(item, itemToString);
1474
1483
  const queryLength = query.length;
1475
1484
  return itemString.length >= queryLength && 0 === collator.compare(itemString.slice(itemString.length - queryLength), query);
1476
1485
  }
@@ -1478,21 +1487,21 @@ function filter_getFilter(options = {}) {
1478
1487
  filterCache.set(cacheKey, filter);
1479
1488
  return filter;
1480
1489
  }
1481
- function stringifyLocale(locale) {
1482
- if (Array.isArray(locale)) return locale.map((value)=>stringifyLocale(value)).join(',');
1483
- if (null == locale) return '';
1484
- return String(locale);
1485
- }
1486
1490
  const useCoreFilter = filter_getFilter;
1487
1491
  const NO_ACTIVE_VALUE = Symbol('none');
1488
1492
  const INITIAL_LAST_HIGHLIGHT = {
1489
1493
  value: NO_ACTIVE_VALUE,
1490
1494
  index: -1
1491
1495
  };
1496
+ function findCollectionItem(valueToItem, itemValue, isEqual) {
1497
+ const exactItem = valueToItem.get(itemValue);
1498
+ if (void 0 !== exactItem || isEqual === defaultItemEquality) return exactItem;
1499
+ for (const [derivedValue, item] of valueToItem)if (compareItemEquality(derivedValue, itemValue, isEqual)) return item;
1500
+ }
1492
1501
  function AriaCombobox(props) {
1493
- const { id: idProp, onOpenChangeComplete: onOpenChangeCompleteProp, defaultSelectedValue = null, selectedValue: selectedValueProp, onSelectedValueChange, defaultInputValue: defaultInputValueProp, inputValue: inputValueProp, open: openProp, defaultOpen = false, selectionMode = 'none', onItemHighlighted: onItemHighlightedProp, name: nameProp, form, disabled: disabledProp = false, readOnly = false, required = false, inputRef: inputRefProp, grid = false, items, filteredItems: filteredItemsProp, filter: filterProp, openOnInputClick = true, autoHighlight = false, keepHighlight = false, highlightItemOnHover = true, loopFocus = true, itemToStringLabel, itemToStringValue, isItemEqualToValue = defaultItemEquality, virtualized = false, inline: inlineProp = false, fillInputOnItemPress = true, modal = false, limit = -1, autoComplete = 'list', formAutoComplete, locale, submitOnItemClick = false } = props;
1502
+ const { id: idProp, onOpenChangeComplete: onOpenChangeCompleteProp, defaultSelectedValue = null, selectedValue: selectedValueProp, onSelectedValueChange, defaultInputValue, inputValue: inputValueProp, open: openProp, defaultOpen = false, selectionMode, onItemHighlighted: onItemHighlightedProp, name: nameProp, form, disabled: disabledProp = false, readOnly = false, required = false, inputRef: inputRefProp, grid = false, items: itemsProp, filteredItems: filteredItemsProp, filter: filterProp, filterQuery: filterQueryProp, openOnInputClick = true, autoHighlight = false, keepHighlight = false, highlightItemOnHover = true, loopFocus = true, itemToStringLabel: itemToStringLabelProp, itemToStringValue, isItemEqualToValue = defaultItemEquality, virtualized = false, inline: inlineProp = false, fillInputOnItemPress = true, modal = false, limit = -1, autoComplete = 'list', formAutoComplete, locale, submitOnItemClick = false } = props;
1494
1503
  const { clearErrors } = useFormContext();
1495
- const { setDirty, validityData, shouldValidateOnChange, setFilled, name: fieldName, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
1504
+ const { setDirty, validityData, setFilled, name: fieldName, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
1496
1505
  const direction = useDirection();
1497
1506
  const id = useLabelableId({
1498
1507
  id: idProp
@@ -1500,8 +1509,59 @@ function AriaCombobox(props) {
1500
1509
  const collatorFilter = useCoreFilter({
1501
1510
  locale
1502
1511
  });
1512
+ const collection = Array.isArray(itemsProp) ? null : itemsProp;
1513
+ if (collection && 'function' != typeof collection.label) throw new Error("production" !== process.env.NODE_ENV ? "Base UI: the `items` prop received an object that is not a collection, so its items cannot be read. Pass an array of items, an array of groups with items, or the result of `createItems()`. See https://base-ui.com/react/components/combobox#createitems" : utils_formatErrorMessage(100));
1514
+ const items = collection ? collection.data : itemsProp;
1515
+ const itemToValue = collection?.value;
1516
+ const storeItems = itemToValue ? void 0 : items;
1517
+ const externalWindow = __rspack_external_react.useMemo(()=>{
1518
+ if (!filteredItemsProp || !itemToValue) return;
1519
+ const flat = flattenLeafItems(filteredItemsProp);
1520
+ const values = flat.map(itemToValue);
1521
+ let valueToItem;
1522
+ return {
1523
+ values,
1524
+ findItem (itemValue, isEqual) {
1525
+ if (!valueToItem) {
1526
+ valueToItem = new Map();
1527
+ for(let i = 0; i < values.length; i += 1)if (!valueToItem.has(values[i])) valueToItem.set(values[i], flat[i]);
1528
+ }
1529
+ return findCollectionItem(valueToItem, itemValue, isEqual);
1530
+ }
1531
+ };
1532
+ }, [
1533
+ filteredItemsProp,
1534
+ itemToValue
1535
+ ]);
1536
+ const itemToStringLabel = __rspack_external_react.useMemo(()=>{
1537
+ if (!collection) return itemToStringLabelProp;
1538
+ return (itemValue)=>collection.label(itemValue, isItemEqualToValue, (unresolvedValue)=>{
1539
+ const externalItem = externalWindow?.findItem(unresolvedValue, isItemEqualToValue);
1540
+ if (null != externalItem) return collection.itemLabel(externalItem);
1541
+ return resolveValueLabel_stringifyAsLabel(unresolvedValue, itemToStringLabelProp);
1542
+ });
1543
+ }, [
1544
+ collection,
1545
+ itemToStringLabelProp,
1546
+ externalWindow,
1547
+ isItemEqualToValue
1548
+ ]);
1549
+ const filterItemToString = __rspack_external_react.useMemo(()=>{
1550
+ if (!collection) return itemToStringLabelProp;
1551
+ return Object.assign((item)=>collection.itemLabel(item), {
1552
+ selected: (value)=>resolveValueLabel_stringifyAsLabel(value, itemToStringLabel)
1553
+ });
1554
+ }, [
1555
+ collection,
1556
+ itemToStringLabel,
1557
+ itemToStringLabelProp
1558
+ ]);
1559
+ function stringifyValueLabel(item) {
1560
+ return resolveValueLabel_stringifyAsLabel(item, itemToStringLabel);
1561
+ }
1503
1562
  const [queryChangedAfterOpen, setQueryChangedAfterOpen] = __rspack_external_react.useState(false);
1504
1563
  const [closeQuery, setCloseQuery] = __rspack_external_react.useState(null);
1564
+ const previousCloseQueryRef = __rspack_external_react.useRef(closeQuery);
1505
1565
  const listRef = __rspack_external_react.useRef([]);
1506
1566
  const labelsRef = __rspack_external_react.useRef([]);
1507
1567
  const popupRef = __rspack_external_react.useRef(null);
@@ -1509,7 +1569,6 @@ function AriaCombobox(props) {
1509
1569
  const startDismissRef = __rspack_external_react.useRef(null);
1510
1570
  const endDismissRef = __rspack_external_react.useRef(null);
1511
1571
  const emptyRef = __rspack_external_react.useRef(null);
1512
- const keyboardActiveRef = __rspack_external_react.useRef(true);
1513
1572
  const hadInputClearRef = __rspack_external_react.useRef(false);
1514
1573
  const chipsContainerRef = __rspack_external_react.useRef(null);
1515
1574
  const clearRef = __rspack_external_react.useRef(null);
@@ -1517,12 +1576,12 @@ function AriaCombobox(props) {
1517
1576
  const lastHighlightRef = __rspack_external_react.useRef(INITIAL_LAST_HIGHLIGHT);
1518
1577
  const pendingQueryHighlightRef = __rspack_external_react.useRef(null);
1519
1578
  const valuesRef = __rspack_external_react.useRef([]);
1520
- const allValuesRef = __rspack_external_react.useRef([]);
1579
+ const pointerDownItemRef = __rspack_external_react.useRef(null);
1521
1580
  const disabled = fieldDisabled || disabledProp;
1522
1581
  const name = fieldName ?? nameProp;
1523
1582
  const multiple = 'multiple' === selectionMode;
1524
1583
  const single = 'single' === selectionMode;
1525
- const hasInputValue = void 0 !== inputValueProp || void 0 !== defaultInputValueProp;
1584
+ const hasInputValue = void 0 !== inputValueProp || void 0 !== defaultInputValue;
1526
1585
  const hasItems = void 0 !== items;
1527
1586
  const hasFilteredItemsProp = void 0 !== filteredItemsProp;
1528
1587
  let autoHighlightMode;
@@ -1536,19 +1595,15 @@ function AriaCombobox(props) {
1536
1595
  const filter = __rspack_external_react.useMemo(()=>{
1537
1596
  if (null === filterProp) return ()=>true;
1538
1597
  if (void 0 !== filterProp) return filterProp;
1539
- if (single && !queryChangedAfterOpen) return utils_createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue);
1540
- return utils_createCollatorItemFilter(collatorFilter, itemToStringLabel);
1598
+ return utils_createCollatorItemFilter(collatorFilter, filterItemToString);
1541
1599
  }, [
1542
1600
  filterProp,
1543
- single,
1544
- selectedValue,
1545
- queryChangedAfterOpen,
1546
1601
  collatorFilter,
1547
- itemToStringLabel
1602
+ filterItemToString
1548
1603
  ]);
1549
1604
  const initialDefaultInputValue = useRefWithInit(()=>{
1550
- if (hasInputValue) return defaultInputValueProp ?? '';
1551
- if (single) return stringifyAsLabel(selectedValue, itemToStringLabel);
1605
+ if (hasInputValue) return defaultInputValue ?? '';
1606
+ if (single) return stringifyValueLabel(selectedValue);
1552
1607
  return '';
1553
1608
  }).current;
1554
1609
  const [inputValue, setInputValueUnwrapped] = useControlled({
@@ -1564,18 +1619,13 @@ function AriaCombobox(props) {
1564
1619
  state: 'open'
1565
1620
  });
1566
1621
  const isGrouped = isGroupedItems(items);
1567
- const query = closeQuery ?? ('' === inputValue ? '' : String(inputValue).trim());
1568
- const selectedLabelString = single ? stringifyAsLabel(selectedValue, itemToStringLabel) : '';
1569
- const shouldBypassFiltering = single && !queryChangedAfterOpen && '' !== query && '' !== selectedLabelString && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);
1570
- const filterQuery = shouldBypassFiltering ? '' : query;
1571
- const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering;
1572
- const flatItems = __rspack_external_react.useMemo(()=>{
1573
- if (!items) return EMPTY_ARRAY;
1574
- if (isGrouped) return items.flatMap((group)=>group.items);
1575
- return items;
1576
- }, [
1577
- items,
1578
- isGrouped
1622
+ const query = open || null === closeQuery ? String(inputValue).trim() : closeQuery;
1623
+ const selectedLabelString = single ? stringifyValueLabel(selectedValue) : '';
1624
+ const shouldBypassFiltering = single && !queryChangedAfterOpen && '' !== query && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);
1625
+ const filterQuery = shouldBypassFiltering ? '' : filterQueryProp ?? query;
1626
+ const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering && (!collection || collection.hasValue(selectedValue, isItemEqualToValue));
1627
+ const flatItems = __rspack_external_react.useMemo(()=>items ? flattenLeafItems(items) : EMPTY_ARRAY, [
1628
+ items
1579
1629
  ]);
1580
1630
  const filteredItems = __rspack_external_react.useMemo(()=>{
1581
1631
  if (filteredItemsProp && !shouldIgnoreExternalFiltering) return filteredItemsProp;
@@ -1586,10 +1636,12 @@ function AriaCombobox(props) {
1586
1636
  let currentCount = 0;
1587
1637
  for (const group of groupedItems){
1588
1638
  if (limit > -1 && currentCount >= limit) break;
1589
- const candidateItems = '' === filterQuery ? group.items : group.items.filter((item)=>filter(item, filterQuery, itemToStringLabel));
1590
- if (0 === candidateItems.length) continue;
1591
1639
  const remainingLimit = limit > -1 ? limit - currentCount : 1 / 0;
1592
- const itemsToTake = candidateItems.slice(0, remainingLimit);
1640
+ const itemsToTake = '' === filterQuery ? group.items.slice(0, remainingLimit) : [];
1641
+ if ('' !== filterQuery) for (const item of group.items){
1642
+ if (itemsToTake.length >= remainingLimit) break;
1643
+ if (filter(item, filterQuery, filterItemToString)) itemsToTake.push(item);
1644
+ }
1593
1645
  if (itemsToTake.length > 0) {
1594
1646
  const newGroup = {
1595
1647
  ...group,
@@ -1605,7 +1657,7 @@ function AriaCombobox(props) {
1605
1657
  const limitedItems = [];
1606
1658
  for (const item of flatItems){
1607
1659
  if (limit > -1 && limitedItems.length >= limit) break;
1608
- if (filter(item, filterQuery, itemToStringLabel)) limitedItems.push(item);
1660
+ if (filter(item, filterQuery, filterItemToString)) limitedItems.push(item);
1609
1661
  }
1610
1662
  return limitedItems;
1611
1663
  }, [
@@ -1616,48 +1668,35 @@ function AriaCombobox(props) {
1616
1668
  filterQuery,
1617
1669
  limit,
1618
1670
  filter,
1619
- itemToStringLabel,
1671
+ filterItemToString,
1620
1672
  flatItems
1621
1673
  ]);
1622
- const flatFilteredItems = __rspack_external_react.useMemo(()=>{
1623
- if (isGrouped) {
1624
- const groups = filteredItems;
1625
- return groups.flatMap((g)=>g.items);
1626
- }
1627
- return filteredItems;
1674
+ const flatFilteredValues = __rspack_external_react.useMemo(()=>{
1675
+ if (externalWindow && filteredItems === filteredItemsProp) return externalWindow.values;
1676
+ const flat = flattenLeafItems(filteredItems);
1677
+ return itemToValue ? flat.map((item)=>itemToValue(item)) : flat;
1628
1678
  }, [
1629
1679
  filteredItems,
1630
- isGrouped
1680
+ filteredItemsProp,
1681
+ externalWindow,
1682
+ itemToValue
1631
1683
  ]);
1632
- const store = useRefWithInit(()=>new Store({
1684
+ const store = useRefWithInit(()=>{
1685
+ let initialSelectedIndex = null;
1686
+ if (inlineProp && open && hasItems && 'none' !== selectionMode) initialSelectedIndex = findSelectionIndex(flatFilteredValues, selectedValue, isItemEqualToValue, multiple);
1687
+ return new ReactStore({
1633
1688
  id,
1634
1689
  labelId: void 0,
1635
1690
  selectedValue,
1636
1691
  open,
1637
- filter,
1638
- query,
1639
- items,
1692
+ items: storeItems,
1640
1693
  selectionMode,
1641
- listRef,
1642
- labelsRef,
1643
- popupRef,
1644
- emptyRef,
1645
- inputRef,
1646
- startDismissRef,
1647
- endDismissRef,
1648
- keyboardActiveRef,
1649
- chipsContainerRef,
1650
- clearRef,
1651
- valuesRef,
1652
- allValuesRef,
1653
- selectionEventRef,
1654
1694
  name,
1655
1695
  form,
1656
1696
  disabled,
1657
1697
  readOnly,
1658
1698
  required,
1659
1699
  grid,
1660
- isGrouped,
1661
1700
  virtualized,
1662
1701
  openOnInputClick,
1663
1702
  itemToStringLabel,
@@ -1671,30 +1710,52 @@ function AriaCombobox(props) {
1671
1710
  transitionStatus: 'idle',
1672
1711
  inline: inlineProp,
1673
1712
  activeIndex: null,
1674
- selectedIndex: null,
1713
+ selectedIndex: initialSelectedIndex,
1675
1714
  popupProps: {},
1715
+ listProps: {},
1676
1716
  inputProps: {},
1677
1717
  triggerProps: {},
1678
- itemProps: EMPTY_OBJECT,
1718
+ itemRoot: {
1719
+ props: EMPTY_OBJECT,
1720
+ id,
1721
+ selectionMode,
1722
+ disabled,
1723
+ readOnly,
1724
+ isItemEqualToValue
1725
+ },
1679
1726
  positionerElement: null,
1680
1727
  listElement: null,
1728
+ popupId: void 0,
1681
1729
  triggerElement: null,
1682
1730
  inputElement: null,
1683
1731
  inputGroupElement: null,
1684
1732
  popupSide: null,
1685
1733
  openMethod: null,
1686
1734
  inputInsidePopup: true,
1687
- inputOwnsFormValue: 'none' === selectionMode,
1688
- onOpenChangeComplete: onOpenChangeCompleteProp || NOOP,
1735
+ inputOwnsFormValue: 'none' === selectionMode
1736
+ }, {
1737
+ onOpenChangeComplete: NOOP,
1689
1738
  setOpen: NOOP,
1690
1739
  setInputValue: NOOP,
1691
1740
  setSelectedValue: NOOP,
1692
1741
  setIndices: NOOP,
1693
- onItemHighlighted: NOOP,
1694
1742
  handleSelection: NOOP,
1695
1743
  forceMount: NOOP,
1696
- requestSubmit: NOOP
1697
- })).current;
1744
+ requestSubmit: NOOP,
1745
+ listRef,
1746
+ labelsRef,
1747
+ popupRef,
1748
+ emptyRef,
1749
+ inputRef,
1750
+ startDismissRef,
1751
+ endDismissRef,
1752
+ chipsContainerRef,
1753
+ clearRef,
1754
+ valuesRef,
1755
+ pointerDownItemRef,
1756
+ selectionEventRef
1757
+ }, selectors);
1758
+ }).current;
1698
1759
  const fieldRawValue = 'none' === selectionMode ? inputValue : selectedValue;
1699
1760
  const fieldStringValue = __rspack_external_react.useMemo(()=>{
1700
1761
  if ('none' === selectionMode) return fieldRawValue;
@@ -1708,59 +1769,53 @@ function AriaCombobox(props) {
1708
1769
  ]);
1709
1770
  const onItemHighlighted = useStableCallback(onItemHighlightedProp);
1710
1771
  const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp);
1711
- const activeIndex = useStore(store, selectors.activeIndex);
1712
- const selectedIndex = useStore(store, selectors.selectedIndex);
1713
- const positionerElement = useStore(store, selectors.positionerElement);
1714
- const listElement = useStore(store, selectors.listElement);
1715
- const triggerElement = useStore(store, selectors.triggerElement);
1716
- const inputElement = useStore(store, selectors.inputElement);
1717
- const inputGroupElement = useStore(store, selectors.inputGroupElement);
1718
- const inline = useStore(store, selectors.inline);
1719
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
1720
- const inputOwnsFormValue = useStore(store, selectors.inputOwnsFormValue);
1772
+ const activeIndex = store.useState('activeIndex');
1773
+ const selectedIndex = store.useState('selectedIndex');
1774
+ const positionerElement = store.useState('positionerElement');
1775
+ const listElement = store.useState('listElement');
1776
+ const triggerElement = store.useState('triggerElement');
1777
+ const inputElement = store.useState('inputElement');
1778
+ const inputGroupElement = store.useState('inputGroupElement');
1779
+ const inline = store.useState('inline');
1780
+ const inputInsidePopup = store.useState('inputInsidePopup');
1781
+ const inputOwnsFormValue = store.useState('inputOwnsFormValue');
1782
+ const inputMatchesSelectedValue = single && !inputInsidePopup && inputValue === selectedLabelString;
1721
1783
  const triggerRef = useValueAsRef(triggerElement);
1722
- const { mounted, setMounted, transitionStatus } = useTransitionStatus(open);
1723
1784
  const { openMethod, triggerProps } = useOpenInteractionType(open);
1724
1785
  const getStringifiedValueForForm = useStableCallback(()=>fieldStringValue);
1725
- useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, id, fieldRawValue, getStringifiedValueForForm);
1786
+ useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, id, fieldRawValue, getStringifiedValueForForm, !disabled, nameProp);
1726
1787
  const forceMount = useStableCallback(()=>{
1727
- if (items) labelsRef.current = flatFilteredItems.map((item)=>stringifyAsLabel(item, itemToStringLabel));
1788
+ if (items) labelsRef.current = flatFilteredValues.map(stringifyValueLabel);
1728
1789
  else store.set('forceMounted', true);
1729
1790
  });
1730
- const initialSelectedValueRef = __rspack_external_react.useRef(selectedValue);
1731
- useIsoLayoutEffect(()=>{
1732
- if (selectedValue !== initialSelectedValueRef.current) forceMount();
1733
- }, [
1734
- forceMount,
1735
- selectedValue
1736
- ]);
1791
+ const emitHighlight = useStableCallback((value, index, type, event)=>{
1792
+ if (-1 === index) {
1793
+ if (lastHighlightRef.current === INITIAL_LAST_HIGHLIGHT) return;
1794
+ lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
1795
+ } else lastHighlightRef.current = {
1796
+ value,
1797
+ index
1798
+ };
1799
+ onItemHighlighted(value, createGenericEventDetails(type, event, {
1800
+ index
1801
+ }));
1802
+ });
1737
1803
  const setIndices = useStableCallback((options)=>{
1738
- store.update(options);
1739
- const type = options.type || 'none';
1740
- if (void 0 === options.activeIndex) return;
1741
- if (null === options.activeIndex) {
1742
- if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
1743
- lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
1744
- onItemHighlighted(void 0, createGenericEventDetails(type, void 0, {
1745
- index: -1
1746
- }));
1747
- }
1748
- } else {
1749
- const activeValue = valuesRef.current[options.activeIndex];
1750
- lastHighlightRef.current = {
1751
- value: activeValue,
1752
- index: options.activeIndex
1753
- };
1754
- onItemHighlighted(activeValue, createGenericEventDetails(type, void 0, {
1755
- index: options.activeIndex
1756
- }));
1757
- }
1804
+ const update = {};
1805
+ if (void 0 !== options.activeIndex) update.activeIndex = options.activeIndex;
1806
+ if (void 0 !== options.selectedIndex) update.selectedIndex = options.selectedIndex;
1807
+ store.update(update);
1808
+ const activeIndexOption = options.activeIndex;
1809
+ if (void 0 === activeIndexOption) return;
1810
+ const type = options.type || "none";
1811
+ null === activeIndexOption ? emitHighlight(void 0, -1, type, options.event) : emitHighlight(valuesRef.current[activeIndexOption], activeIndexOption, type, options.event);
1758
1812
  });
1759
1813
  const setInputValue = useStableCallback((next, eventDetails)=>{
1760
- hadInputClearRef.current = eventDetails.reason === inputClear;
1761
1814
  props.onInputValueChange?.(next, eventDetails);
1762
1815
  if (eventDetails.isCanceled) return;
1816
+ hadInputClearRef.current = eventDetails.reason === inputClear;
1763
1817
  if (eventDetails.reason === inputChange) {
1818
+ if (open && null !== closeQuery) setCloseQuery(null);
1764
1819
  const event = eventDetails.event;
1765
1820
  const inputType = event.inputType;
1766
1821
  const isTypedInput = 'compositionend' === event.type || null != inputType && '' !== inputType && 'insertReplacementText' !== inputType;
@@ -1770,21 +1825,41 @@ function AriaCombobox(props) {
1770
1825
  pendingQueryHighlightRef.current = {
1771
1826
  hasQuery
1772
1827
  };
1773
- if (hasQuery && autoHighlightMode && null == store.state.activeIndex) store.set('activeIndex', 0);
1828
+ const list = store.state.listElement;
1829
+ if (!store.state.virtualized && list) {
1830
+ const popup = popupRef.current;
1831
+ for (const ancestor of getOverflowAncestors(list.firstElementChild ?? list)){
1832
+ if (!isHTMLElement(ancestor) || (popup ? !shadowDom_contains(popup, ancestor) : 'dialog' === ancestor.getAttribute('role'))) break;
1833
+ if (isScrollableY(ancestor)) {
1834
+ ancestor.scrollTop = 0;
1835
+ break;
1836
+ }
1837
+ }
1838
+ }
1839
+ if (hasQuery && autoHighlightMode && null == store.state.activeIndex && (open || inline)) store.set('activeIndex', 0);
1774
1840
  }
1775
- }
1841
+ } else if (eventDetails.reason === inputClear && '' === next && store.state.inputInsidePopup) pendingQueryHighlightRef.current = {
1842
+ hasQuery: false,
1843
+ selection: true
1844
+ };
1776
1845
  setInputValueUnwrapped(next);
1777
1846
  });
1847
+ const handleInterruptedReopen = useStableCallback((isInputChange)=>{
1848
+ const clearsPendingInput = !isInputChange && inputInsidePopup && !inline && '' !== inputValue && (String(inputValue).trim() === closeQuery || inputValue === selectedLabelString);
1849
+ if (!isInputChange && (clearsPendingInput || '' === inputValue || inputMatchesSelectedValue)) setQueryChangedAfterOpen(false);
1850
+ setCloseQuery(null);
1851
+ if (clearsPendingInput) setInputValue('', createChangeEventDetails(inputClear));
1852
+ });
1853
+ const [preventUnmountOnClose, setPreventUnmountOnClose] = __rspack_external_react.useState(false);
1778
1854
  const setOpen = useStableCallback((nextOpen, eventDetails)=>{
1779
1855
  if (open === nextOpen) return;
1780
- if ('escape-key' === eventDetails.reason && hasItems && 0 === flatFilteredItems.length && !store.state.emptyRef.current) eventDetails.allowPropagation();
1781
- props.onOpenChange?.(nextOpen, eventDetails);
1856
+ if (eventDetails.reason === escapeKey && hasItems && 0 === flatFilteredValues.length && !emptyRef.current) eventDetails.allowPropagation();
1857
+ const openEventDetails = eventDetails;
1858
+ const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(openEventDetails);
1859
+ props.onOpenChange?.(nextOpen, openEventDetails);
1860
+ if (pendingQueryHighlightRef.current?.hasQuery && eventDetails.reason === inputChange === eventDetails.isCanceled) pendingQueryHighlightRef.current = null;
1782
1861
  if (eventDetails.isCanceled) return;
1783
- if (nextOpen && multiple && inputInsidePopup && !inline && null !== closeQuery) {
1784
- setQueryChangedAfterOpen(false);
1785
- setCloseQuery(null);
1786
- if ('' !== inputValue) setInputValue('', createChangeEventDetails(inputClear, eventDetails.event));
1787
- }
1862
+ if (nextOpen && null !== closeQuery) handleInterruptedReopen(eventDetails.reason === inputChange);
1788
1863
  if (!nextOpen && queryChangedAfterOpen) {
1789
1864
  if (single) {
1790
1865
  if (!inline) setCloseQuery(query);
@@ -1794,9 +1869,12 @@ function AriaCombobox(props) {
1794
1869
  if (inputInsidePopup) setIndices({
1795
1870
  activeIndex: null
1796
1871
  });
1797
- if (!inputInsidePopup || inline) setInputValue('', createChangeEventDetails(inputClear, eventDetails.event));
1872
+ if (!inputInsidePopup || inline) setInputValue('', createChangeEventDetails(inputClear, eventDetails.event, void 0, {
1873
+ isItemPress: eventDetails.reason === itemPress
1874
+ }));
1798
1875
  }
1799
1876
  }
1877
+ if (!nextOpen) setPreventUnmountOnClose(shouldPreventUnmountOnClose());
1800
1878
  setOpenUnwrapped(nextOpen);
1801
1879
  if (!nextOpen && inputInsidePopup && (eventDetails.reason === focusOut || eventDetails.reason === outsidePress)) {
1802
1880
  setTouched(true);
@@ -1812,48 +1890,47 @@ function AriaCombobox(props) {
1812
1890
  if (eventDetails.isCanceled) return;
1813
1891
  setSelectedValueUnwrapped(nextValue);
1814
1892
  const shouldFillInput = 'none' === selectionMode && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup;
1815
- if (shouldFillInput) setInputValue(stringifyAsLabel(nextValue, itemToStringLabel), createChangeEventDetails(eventDetails.reason, eventDetails.event));
1816
- if (single && null != nextValue && eventDetails.reason !== inputChange && queryChangedAfterOpen && !inline) setCloseQuery(query);
1817
- });
1818
- const handleSelection = useStableCallback((event, passedValue)=>{
1819
- let itemValue = passedValue;
1820
- if (void 0 === itemValue) {
1821
- if (null === activeIndex) return;
1822
- itemValue = valuesRef.current[activeIndex];
1823
- }
1893
+ if (shouldFillInput) setInputValue(stringifyValueLabel(nextValue), createChangeEventDetails(eventDetails.reason, eventDetails.event));
1894
+ });
1895
+ const handleSelection = useStableCallback((event, itemValue)=>{
1824
1896
  const targetEl = getTarget(event);
1825
1897
  const overrideEvent = selectionEventRef.current ?? event;
1826
1898
  selectionEventRef.current = null;
1827
1899
  const eventDetails = createChangeEventDetails(itemPress, overrideEvent);
1828
- const href = targetEl?.closest('a')?.getAttribute('href');
1900
+ const href = closest(targetEl, 'a')?.getAttribute('href');
1829
1901
  if (href) {
1830
1902
  if (href.startsWith('#')) setOpen(false, eventDetails);
1831
1903
  return;
1832
1904
  }
1833
1905
  if (multiple) {
1834
1906
  const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];
1835
- const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, store.state.isItemEqualToValue);
1836
- const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, store.state.isItemEqualToValue) : [
1907
+ const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, isItemEqualToValue);
1908
+ const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, isItemEqualToValue) : [
1837
1909
  ...currentSelectedValue,
1838
1910
  itemValue
1839
1911
  ];
1840
1912
  setSelectedValue(nextValue, eventDetails);
1913
+ if (eventDetails.isCanceled) return;
1841
1914
  const wasFiltering = inputRef.current ? '' !== inputRef.current.value.trim() : false;
1842
1915
  if (!wasFiltering) return;
1843
- if (store.state.inputInsidePopup) setInputValue('', createChangeEventDetails(inputClear, eventDetails.event));
1844
- else setOpen(false, eventDetails);
1916
+ if (store.state.inputInsidePopup) {
1917
+ setInputValue('', createChangeEventDetails(inputClear, eventDetails.event, void 0, {
1918
+ isItemPress: true
1919
+ }));
1920
+ const pendingHighlight = pendingQueryHighlightRef.current;
1921
+ if (pendingHighlight && !isCurrentlySelected) pendingHighlight.toggledValue = itemValue;
1922
+ } else setOpen(false, eventDetails);
1845
1923
  } else {
1846
1924
  setSelectedValue(itemValue, eventDetails);
1925
+ if (eventDetails.isCanceled) return;
1847
1926
  setOpen(false, eventDetails);
1848
1927
  }
1849
1928
  });
1850
1929
  const requestSubmit = useStableCallback(()=>{
1851
- if (!store.state.submitOnItemClick) return;
1852
1930
  const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;
1853
1931
  if (formElement && 'function' == typeof formElement.requestSubmit) formElement.requestSubmit();
1854
1932
  });
1855
- const handleUnmount = useStableCallback(()=>{
1856
- setMounted(false);
1933
+ const handleUnmountCleanup = useStableCallback(()=>{
1857
1934
  onOpenChangeComplete?.(false);
1858
1935
  setQueryChangedAfterOpen(false);
1859
1936
  setCloseQuery(null);
@@ -1867,7 +1944,7 @@ function AriaCombobox(props) {
1867
1944
  if (single) if (store.state.inputInsidePopup) {
1868
1945
  if (inputRef.current && '' !== inputRef.current.value) setInputValue('', createChangeEventDetails(inputClear));
1869
1946
  } else {
1870
- const stringVal = stringifyAsLabel(selectedValue, itemToStringLabel);
1947
+ const stringVal = stringifyValueLabel(selectedValue);
1871
1948
  if (inputRef.current && inputRef.current.value !== stringVal) {
1872
1949
  const reason = '' === stringVal ? inputClear : "none";
1873
1950
  setInputValue(stringVal, createChangeEventDetails(reason));
@@ -1876,114 +1953,127 @@ function AriaCombobox(props) {
1876
1953
  });
1877
1954
  const resolvedPopupRef = __rspack_external_react.useMemo(()=>{
1878
1955
  if (inline && positionerElement) return {
1879
- current: positionerElement.closest('[role="dialog"]')
1956
+ current: closest(positionerElement, '[role="dialog"]')
1880
1957
  };
1881
1958
  return popupRef;
1882
1959
  }, [
1883
1960
  inline,
1884
1961
  positionerElement
1885
1962
  ]);
1886
- useOpenChangeComplete({
1887
- enabled: !props.actionsRef,
1963
+ const { mounted, transitionStatus, forceUnmount: handleUnmount } = useUnmountAfterClose({
1888
1964
  open,
1889
1965
  ref: resolvedPopupRef,
1890
- onComplete () {
1891
- if (!open) handleUnmount();
1892
- }
1966
+ preventUnmountOnClose,
1967
+ setPreventUnmountOnClose,
1968
+ onUnmount: handleUnmountCleanup
1893
1969
  });
1894
1970
  __rspack_external_react.useImperativeHandle(props.actionsRef, ()=>({
1895
- unmount: handleUnmount
1971
+ unmount: handleUnmount,
1972
+ close: ()=>setOpen(false, createChangeEventDetails(imperativeAction))
1896
1973
  }), [
1897
- handleUnmount
1974
+ handleUnmount,
1975
+ setOpen
1898
1976
  ]);
1899
1977
  useIsoLayoutEffect(function() {
1900
- if (open || 'none' === selectionMode) return;
1901
- const registry = items ? flatItems : allValuesRef.current;
1902
- if (multiple) {
1903
- const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
1904
- const lastValue = currentValue[currentValue.length - 1];
1905
- const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);
1906
- setIndices({
1907
- selectedIndex: -1 === lastIndex ? null : lastIndex
1908
- });
1909
- } else {
1910
- const index = findItemIndex(registry, selectedValue, isItemEqualToValue);
1911
- setIndices({
1912
- selectedIndex: -1 === index ? null : index
1913
- });
1914
- }
1978
+ const closeQueryReleased = null !== previousCloseQueryRef.current && null === closeQuery;
1979
+ previousCloseQueryRef.current = closeQuery;
1980
+ if (open && (!closeQueryReleased || !hasItems)) return;
1981
+ if (!open) pointerDownItemRef.current = null;
1982
+ if ('none' === selectionMode) return;
1983
+ const registry = hasItems ? flatFilteredValues : valuesRef.current;
1984
+ setIndices({
1985
+ selectedIndex: findSelectionIndex(registry, selectedValue, isItemEqualToValue, multiple)
1986
+ });
1915
1987
  }, [
1916
1988
  open,
1989
+ closeQuery,
1917
1990
  selectedValue,
1918
- items,
1919
1991
  selectionMode,
1920
- flatItems,
1921
1992
  multiple,
1993
+ hasItems,
1994
+ flatFilteredValues,
1922
1995
  isItemEqualToValue,
1923
1996
  setIndices
1924
1997
  ]);
1925
1998
  useIsoLayoutEffect(()=>{
1926
1999
  if (items) {
1927
- valuesRef.current = flatFilteredItems;
1928
- listRef.current.length = flatFilteredItems.length;
2000
+ valuesRef.current = flatFilteredValues;
2001
+ listRef.current.length = flatFilteredValues.length;
1929
2002
  }
1930
2003
  }, [
1931
2004
  items,
1932
- flatFilteredItems
2005
+ flatFilteredValues
2006
+ ]);
2007
+ useIsoLayoutEffect(()=>{
2008
+ if (!open && pendingQueryHighlightRef.current?.hasQuery) pendingQueryHighlightRef.current = null;
2009
+ }, [
2010
+ open
1933
2011
  ]);
1934
2012
  useIsoLayoutEffect(()=>{
2013
+ if (!open && inline && resolvedPopupRef.current) {
2014
+ pendingQueryHighlightRef.current = null;
2015
+ return;
2016
+ }
2017
+ const candidateItems = hasItems || hasFilteredItemsProp ? flatFilteredValues : valuesRef.current;
1935
2018
  const pendingHighlight = pendingQueryHighlightRef.current;
1936
2019
  if (pendingHighlight) {
2020
+ const listIsNavigable = open || inline || store.state.positionerElement?.hidden === false;
1937
2021
  if (pendingHighlight.hasQuery) {
1938
- if (autoHighlightMode) store.set('activeIndex', 0);
1939
- } else if ('always' === autoHighlightMode) store.set('activeIndex', 0);
1940
- pendingQueryHighlightRef.current = null;
2022
+ const input = inputRef.current;
2023
+ if (autoHighlightMode && '' !== String(inputValue).trim() && (!inline || 'always' === autoHighlightMode || input && activeElement(input.ownerDocument) === input)) {
2024
+ if (listIsNavigable && (void 0 !== candidateItems[0] || !hasItems && !hasFilteredItemsProp)) {
2025
+ store.set('activeIndex', 0);
2026
+ pendingQueryHighlightRef.current = null;
2027
+ }
2028
+ } else pendingQueryHighlightRef.current = null;
2029
+ } else if ('' === String(inputValue).trim()) {
2030
+ pendingQueryHighlightRef.current = null;
2031
+ if (listIsNavigable) {
2032
+ const clearedBySelection = pendingHighlight.selection;
2033
+ if ('always' === autoHighlightMode && !clearedBySelection && 'none' === store.state.selectionMode) store.set('activeIndex', 0);
2034
+ queueMicrotask(()=>{
2035
+ if (!store.state.open && (!store.state.inline || resolvedPopupRef.current) || inputRef.current && '' !== inputRef.current.value.trim()) return;
2036
+ const currentSelectedValue = store.state.selectedValue;
2037
+ const isMultiple = 'multiple' === store.state.selectionMode;
2038
+ const hasSelection = isMultiple && Array.isArray(currentSelectedValue) ? currentSelectedValue.length > 0 : 'none' !== store.state.selectionMode && null != currentSelectedValue;
2039
+ if (hasSelection) {
2040
+ const registry = hasItems || hasFilteredItemsProp ? flatFilteredValues : valuesRef.current;
2041
+ const toggledIndex = findItemIndex(registry, pendingHighlight.toggledValue, store.state.isItemEqualToValue);
2042
+ store.set('activeIndex', -1 !== toggledIndex ? toggledIndex : findSelectionIndex(registry, currentSelectedValue, store.state.isItemEqualToValue, isMultiple));
2043
+ } else if (clearedBySelection) store.set('activeIndex', null);
2044
+ else if ('always' === autoHighlightMode) store.set('activeIndex', 0);
2045
+ });
2046
+ }
2047
+ }
1941
2048
  }
1942
2049
  if (!open && !inline) return;
1943
- const shouldUseFlatFilteredItems = hasItems || hasFilteredItemsProp;
1944
- const candidateItems = shouldUseFlatFilteredItems ? flatFilteredItems : valuesRef.current;
1945
2050
  const storeActiveIndex = store.state.activeIndex;
1946
2051
  if (null == storeActiveIndex) {
1947
2052
  if ('always' === autoHighlightMode && candidateItems.length > 0) return void store.set('activeIndex', 0);
1948
- if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
1949
- lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
1950
- store.state.onItemHighlighted(void 0, createGenericEventDetails("none", void 0, {
1951
- index: -1
1952
- }));
1953
- }
2053
+ emitHighlight(void 0, -1, "none");
1954
2054
  return;
1955
2055
  }
1956
2056
  if (storeActiveIndex >= candidateItems.length) {
1957
- if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
1958
- lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
1959
- store.state.onItemHighlighted(void 0, createGenericEventDetails("none", void 0, {
1960
- index: -1
1961
- }));
1962
- }
2057
+ emitHighlight(void 0, -1, "none");
1963
2058
  store.set('activeIndex', null);
1964
2059
  return;
1965
2060
  }
1966
2061
  const itemValue = candidateItems[storeActiveIndex];
1967
2062
  const previouslyHighlightedItemValue = lastHighlightRef.current.value;
1968
2063
  const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);
1969
- if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {
1970
- lastHighlightRef.current = {
1971
- value: itemValue,
1972
- index: storeActiveIndex
1973
- };
1974
- store.state.onItemHighlighted(itemValue, createGenericEventDetails("none", void 0, {
1975
- index: storeActiveIndex
1976
- }));
1977
- }
2064
+ if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) emitHighlight(itemValue, storeActiveIndex, "none");
1978
2065
  }, [
1979
2066
  activeIndex,
1980
2067
  autoHighlightMode,
2068
+ emitHighlight,
1981
2069
  hasFilteredItemsProp,
1982
2070
  hasItems,
1983
- flatFilteredItems,
2071
+ flatFilteredValues,
1984
2072
  inline,
1985
2073
  open,
1986
- store
2074
+ resolvedPopupRef,
2075
+ store,
2076
+ inputValue
1987
2077
  ]);
1988
2078
  useIsoLayoutEffect(()=>{
1989
2079
  if ('none' === selectionMode) return void setFilled('' !== String(inputValue));
@@ -1996,42 +2086,50 @@ function AriaCombobox(props) {
1996
2086
  multiple
1997
2087
  ]);
1998
2088
  __rspack_external_react.useEffect(()=>{
1999
- if (hasItems && autoHighlightMode && 0 === flatFilteredItems.length) setIndices({
2089
+ if (hasItems && autoHighlightMode && 0 === flatFilteredValues.length) setIndices({
2000
2090
  activeIndex: null
2001
2091
  });
2002
2092
  }, [
2003
2093
  hasItems,
2004
2094
  autoHighlightMode,
2005
- flatFilteredItems.length,
2095
+ flatFilteredValues.length,
2006
2096
  setIndices
2007
2097
  ]);
2008
- useValueChanged(query, ()=>{
2009
- if (!open || '' === query || query === String(initialDefaultInputValue)) return;
2010
- setQueryChangedAfterOpen(true);
2011
- });
2012
- useValueChanged(selectedValue, ()=>{
2098
+ function handleQueryChanged() {
2099
+ if (open && '' !== query && query !== String(initialDefaultInputValue) && !inputMatchesSelectedValue) setQueryChangedAfterOpen(true);
2100
+ }
2101
+ function handleOpenChanged() {
2102
+ if (open && null !== closeQuery) handleInterruptedReopen(false);
2103
+ }
2104
+ let syncedSelectedLabel = false;
2105
+ function syncInputToSelectedLabel() {
2106
+ if (!syncedSelectedLabel && inputValue !== selectedLabelString) {
2107
+ syncedSelectedLabel = true;
2108
+ setInputValue(selectedLabelString, createChangeEventDetails("none"));
2109
+ }
2110
+ }
2111
+ function handleSelectedValueChanged() {
2013
2112
  if ('none' === selectionMode) return;
2014
2113
  clearErrors(name);
2015
- setDirty(selectedValue !== validityData.initialValue);
2016
- if (shouldValidateOnChange()) validation.commit(selectedValue);
2017
- else validation.commit(selectedValue, true);
2018
- if (single && !hasInputValue && !inputInsidePopup) {
2019
- const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
2020
- if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails("none"));
2021
- }
2022
- });
2023
- useValueChanged(inputValue, ()=>{
2114
+ setDirty(isSelectedValueDirty(selectedValue, validityData.initialValue, isItemEqualToValue));
2115
+ validation.change(selectedValue);
2116
+ if (single && !hasInputValue && !inputInsidePopup) syncInputToSelectedLabel();
2117
+ }
2118
+ function syncInputAfterItemsOrLabelChange() {
2119
+ if (single && !hasInputValue && !inputInsidePopup && !queryChangedAfterOpen) syncInputToSelectedLabel();
2120
+ }
2121
+ function handleInputValueChanged() {
2024
2122
  if ('none' !== selectionMode) return;
2025
2123
  clearErrors(name);
2026
2124
  setDirty(inputValue !== validityData.initialValue);
2027
- if (shouldValidateOnChange()) validation.commit(inputValue);
2028
- else validation.commit(inputValue, true);
2029
- });
2030
- useValueChanged(items, ()=>{
2031
- if (!single || hasInputValue || inputInsidePopup || queryChangedAfterOpen) return;
2032
- const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
2033
- if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails("none"));
2034
- });
2125
+ validation.change(inputValue);
2126
+ }
2127
+ useValueChanged(query, handleQueryChanged);
2128
+ useValueChanged(open, handleOpenChanged);
2129
+ useValueChanged(selectedValue, handleSelectedValueChanged);
2130
+ useValueChanged(selectedLabelString, syncInputAfterItemsOrLabelChange);
2131
+ useValueChanged(items, syncInputAfterItemsOrLabelChange);
2132
+ useValueChanged(inputValue, handleInputValueChanged);
2035
2133
  const floatingRootContext = useFloatingRootContext({
2036
2134
  open: inline ? true : open,
2037
2135
  onOpenChange: setOpen,
@@ -2040,16 +2138,13 @@ function AriaCombobox(props) {
2040
2138
  floating: positionerElement
2041
2139
  }
2042
2140
  });
2043
- let ariaHasPopup;
2044
- let ariaExpanded;
2045
- if (!inline) {
2046
- ariaHasPopup = grid ? 'grid' : 'listbox';
2047
- ariaExpanded = open ? 'true' : 'false';
2048
- }
2141
+ const ariaHasPopup = grid ? 'grid' : 'listbox';
2142
+ const expanded = open || inline;
2143
+ const ariaExpanded = expanded ? 'true' : 'false';
2049
2144
  const role = __rspack_external_react.useMemo(()=>{
2050
2145
  const isPlainInput = inputElement?.tagName === 'INPUT';
2051
2146
  const shouldTreatAsInput = null == inputElement || isPlainInput;
2052
- const shouldApplyAria = shouldTreatAsInput || open;
2147
+ const shouldApplyAria = shouldTreatAsInput || expanded;
2053
2148
  const reference = shouldTreatAsInput ? {
2054
2149
  autoComplete: 'off',
2055
2150
  spellCheck: 'false',
@@ -2060,8 +2155,8 @@ function AriaCombobox(props) {
2060
2155
  reference.role = 'combobox';
2061
2156
  reference['aria-expanded'] = ariaExpanded;
2062
2157
  reference['aria-haspopup'] = ariaHasPopup;
2063
- reference['aria-controls'] = open ? listElement?.id : void 0;
2064
- reference['aria-autocomplete'] = autoComplete;
2158
+ reference['aria-controls'] = expanded ? listElement?.id : void 0;
2159
+ reference['aria-autocomplete'] = readOnly ? 'none' : autoComplete;
2065
2160
  }
2066
2161
  return {
2067
2162
  reference,
@@ -2071,21 +2166,22 @@ function AriaCombobox(props) {
2071
2166
  };
2072
2167
  }, [
2073
2168
  inputElement,
2074
- open,
2169
+ expanded,
2075
2170
  ariaExpanded,
2076
2171
  ariaHasPopup,
2077
2172
  listElement?.id,
2078
- autoComplete
2173
+ autoComplete,
2174
+ readOnly
2079
2175
  ]);
2080
2176
  const click = useClick(floatingRootContext, {
2081
- enabled: !readOnly && !disabled && openOnInputClick,
2177
+ enabled: !disabled && openOnInputClick,
2082
2178
  event: 'mousedown-only',
2083
2179
  toggle: false,
2084
2180
  touchOpenDelay: inputInsidePopup ? 0 : 100,
2085
2181
  reason: inputPress
2086
2182
  });
2087
2183
  const dismiss = useDismiss(floatingRootContext, {
2088
- enabled: !readOnly && !disabled && !inline,
2184
+ enabled: !disabled && !inline,
2089
2185
  outsidePressEvent: {
2090
2186
  mouse: 'sloppy',
2091
2187
  touch: 'intentional'
@@ -2097,7 +2193,7 @@ function AriaCombobox(props) {
2097
2193
  }
2098
2194
  });
2099
2195
  const listNavigation = useListNavigation(floatingRootContext, {
2100
- enabled: !readOnly && !disabled,
2196
+ enabled: !disabled,
2101
2197
  id,
2102
2198
  listRef,
2103
2199
  activeIndex,
@@ -2108,137 +2204,127 @@ function AriaCombobox(props) {
2108
2204
  focusItemOnOpen: queryChangedAfterOpen || 'none' === selectionMode && !autoHighlightMode ? false : 'auto',
2109
2205
  focusItemOnHover: highlightItemOnHover,
2110
2206
  resetOnPointerLeave: !keepHighlight,
2111
- cols: grid ? 2 : 1,
2112
2207
  orientation: grid ? 'horizontal' : void 0,
2113
2208
  rtl: 'rtl' === direction,
2114
2209
  disabledIndices: EMPTY_ARRAY,
2210
+ grid: grid ? gridNavigation : void 0,
2115
2211
  onNavigate (nextActiveIndex, event) {
2116
- if (!event && !open || 'ending' === transitionStatus) return;
2117
- event ? setIndices({
2212
+ if (!event && !open && !(inline && null === nextActiveIndex) || 'ending' === transitionStatus) return;
2213
+ setIndices({
2118
2214
  activeIndex: nextActiveIndex,
2119
- type: keyboardActiveRef.current ? 'keyboard' : 'pointer'
2120
- }) : setIndices({
2121
- activeIndex: nextActiveIndex
2215
+ type: getHighlightReason(event),
2216
+ event: event?.nativeEvent
2122
2217
  });
2123
2218
  }
2124
2219
  });
2125
- const inputProps = __rspack_external_react.useMemo(()=>mergeProps(listNavigation.reference, dismiss.reference, click.reference, role.reference), [
2220
+ const inputProps = __rspack_external_react.useMemo(()=>mergeProps(listNavigation.reference, {
2221
+ onKeyDown (event) {
2222
+ if (grid && null == store.state.activeIndex && ('ArrowLeft' === event.key || 'ArrowRight' === event.key)) event.preventBaseUIHandler();
2223
+ }
2224
+ }, dismiss.reference, click.reference, role.reference), [
2126
2225
  listNavigation.reference,
2127
2226
  dismiss.reference,
2128
2227
  click.reference,
2129
- role.reference
2228
+ role.reference,
2229
+ grid,
2230
+ store
2231
+ ]);
2232
+ const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [
2233
+ dismiss.floating
2130
2234
  ]);
2131
- const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, listNavigation.floating, dismiss.floating, role.floating), [
2235
+ const listProps = __rspack_external_react.useMemo(()=>mergeProps(listNavigation.floating, role.floating), [
2132
2236
  listNavigation.floating,
2133
- dismiss.floating,
2134
2237
  role.floating
2135
2238
  ]);
2136
- const itemProps = __rspack_external_react.useMemo(()=>{
2239
+ const itemRoot = __rspack_external_react.useMemo(()=>{
2137
2240
  const listNavigationItemProps = listNavigation.item;
2138
- if (!listNavigationItemProps) return EMPTY_OBJECT;
2139
2241
  return {
2140
- ...listNavigationItemProps,
2141
- onFocus: void 0
2242
+ props: listNavigationItemProps ? {
2243
+ ...listNavigationItemProps,
2244
+ onFocus: void 0
2245
+ } : EMPTY_OBJECT,
2246
+ id,
2247
+ selectionMode,
2248
+ disabled,
2249
+ readOnly,
2250
+ isItemEqualToValue
2142
2251
  };
2143
2252
  }, [
2144
- listNavigation.item
2253
+ listNavigation.item,
2254
+ id,
2255
+ selectionMode,
2256
+ disabled,
2257
+ readOnly,
2258
+ isItemEqualToValue
2145
2259
  ]);
2260
+ store.useContextCallback('setOpen', setOpen);
2261
+ store.useContextCallback('setInputValue', setInputValue);
2262
+ store.useContextCallback('setSelectedValue', setSelectedValue);
2263
+ store.useContextCallback('setIndices', setIndices);
2264
+ store.useContextCallback('handleSelection', handleSelection);
2265
+ store.useContextCallback('forceMount', forceMount);
2266
+ store.useContextCallback('requestSubmit', requestSubmit);
2267
+ store.useContextCallback('onOpenChangeComplete', onOpenChangeCompleteProp);
2146
2268
  useOnFirstRender(()=>{
2147
2269
  store.update({
2148
2270
  inline: inlineProp,
2149
2271
  popupProps,
2272
+ listProps,
2150
2273
  inputProps,
2151
2274
  triggerProps,
2152
- itemProps,
2153
- setOpen,
2154
- setInputValue,
2155
- setSelectedValue,
2156
- setIndices,
2157
- onItemHighlighted,
2158
- handleSelection,
2159
- forceMount,
2160
- requestSubmit
2275
+ itemRoot
2161
2276
  });
2162
2277
  });
2163
- useIsoLayoutEffect(()=>{
2164
- store.update({
2165
- id,
2166
- selectedValue,
2167
- open,
2168
- mounted,
2169
- transitionStatus,
2170
- items,
2171
- inline: inlineProp,
2172
- popupProps,
2173
- inputProps,
2174
- triggerProps,
2175
- openMethod,
2176
- itemProps,
2177
- selectionMode,
2178
- name,
2179
- form,
2180
- disabled,
2181
- readOnly,
2182
- required,
2183
- grid,
2184
- isGrouped,
2185
- virtualized,
2186
- onOpenChangeComplete,
2187
- openOnInputClick,
2188
- itemToStringLabel,
2189
- modal,
2190
- autoHighlight: autoHighlightMode,
2191
- isItemEqualToValue,
2192
- submitOnItemClick,
2193
- hasInputValue,
2194
- requestSubmit,
2195
- inputOwnsFormValue: 'none' === selectionMode && (inlineProp || !store.state.inputInsidePopup)
2196
- });
2197
- }, [
2198
- store,
2278
+ const syncedValues = {
2199
2279
  id,
2200
2280
  selectedValue,
2201
2281
  open,
2202
2282
  mounted,
2203
2283
  transitionStatus,
2204
- items,
2284
+ items: storeItems,
2285
+ inline: inlineProp,
2205
2286
  popupProps,
2287
+ listProps,
2206
2288
  inputProps,
2207
- itemProps,
2208
- openMethod,
2209
2289
  triggerProps,
2290
+ itemRoot,
2291
+ openMethod,
2210
2292
  selectionMode,
2211
2293
  name,
2294
+ form,
2212
2295
  disabled,
2213
2296
  readOnly,
2214
2297
  required,
2215
- validation,
2216
2298
  grid,
2217
- isGrouped,
2218
2299
  virtualized,
2219
- onOpenChangeComplete,
2220
2300
  openOnInputClick,
2221
2301
  itemToStringLabel,
2222
2302
  modal,
2303
+ autoHighlight: autoHighlightMode,
2223
2304
  isItemEqualToValue,
2224
2305
  submitOnItemClick,
2225
- hasInputValue,
2226
- inlineProp,
2227
- requestSubmit,
2228
- autoHighlightMode,
2229
- form
2306
+ hasInputValue
2307
+ };
2308
+ useIsoLayoutEffect(()=>{
2309
+ store.update({
2310
+ ...syncedValues,
2311
+ inputOwnsFormValue: 'none' === selectionMode && (inlineProp || !store.state.inputInsidePopup)
2312
+ });
2313
+ }, [
2314
+ store,
2315
+ ...Object.values(syncedValues)
2230
2316
  ]);
2231
2317
  const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);
2232
2318
  const itemsContextValue = __rspack_external_react.useMemo(()=>({
2233
2319
  query,
2234
2320
  hasItems,
2235
2321
  filteredItems,
2236
- flatFilteredItems
2322
+ flatFilteredValues
2237
2323
  }), [
2238
2324
  query,
2239
2325
  hasItems,
2240
2326
  filteredItems,
2241
- flatFilteredItems
2327
+ flatFilteredValues
2242
2328
  ]);
2243
2329
  const serializedValue = __rspack_external_react.useMemo(()=>{
2244
2330
  if (Array.isArray(fieldRawValue)) return '';
@@ -2257,7 +2343,8 @@ function AriaCombobox(props) {
2257
2343
  type: "hidden",
2258
2344
  form: form,
2259
2345
  name: name,
2260
- value: currentSerializedValue
2346
+ value: currentSerializedValue,
2347
+ disabled: disabled
2261
2348
  }, currentSerializedValue);
2262
2349
  });
2263
2350
  }, [
@@ -2265,47 +2352,40 @@ function AriaCombobox(props) {
2265
2352
  selectedValue,
2266
2353
  form,
2267
2354
  name,
2268
- itemToStringValue
2355
+ itemToStringValue,
2356
+ disabled
2269
2357
  ]);
2270
2358
  const children = /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
2271
2359
  children: [
2272
2360
  props.children,
2273
2361
  /*#__PURE__*/ jsx("input", {
2274
- ...validation.getInputValidationProps({
2362
+ ...validation.getValidationProps(disabled, {
2275
2363
  onFocus () {
2276
2364
  if (inputInsidePopup) return void triggerElement?.focus();
2277
2365
  (inputRef.current || triggerElement)?.focus();
2278
2366
  },
2279
2367
  onChange (event) {
2280
- if (event.nativeEvent.defaultPrevented || disabled || readOnly) return void event.preventBaseUIHandler?.();
2368
+ if (event.nativeEvent.defaultPrevented || disabled || readOnly) return;
2281
2369
  const nextValue = event.currentTarget.value;
2370
+ const nextValueLower = nextValue.toLowerCase();
2282
2371
  const details = createChangeEventDetails("none", event.nativeEvent);
2372
+ const findSerializedMatchIndex = ()=>valuesRef.current.findIndex((candidate)=>stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyValueLabel(candidate).toLowerCase() === nextValueLower);
2283
2373
  function handleChange() {
2284
2374
  if (multiple) return;
2285
- if ('none' === selectionMode) {
2286
- setDirty(nextValue !== validityData.initialValue);
2287
- setInputValue(nextValue, details);
2288
- if (shouldValidateOnChange()) validation.commit(nextValue);
2289
- return;
2290
- }
2291
- const matchingValue = valuesRef.current.find((v)=>{
2292
- const candidateValue = stringifyAsValue(v, itemToStringValue);
2293
- if (candidateValue.toLowerCase() === nextValue.toLowerCase()) return true;
2294
- const candidateLabel = stringifyAsLabel(v, itemToStringLabel);
2295
- if (candidateLabel.toLowerCase() === nextValue.toLowerCase()) return true;
2296
- return false;
2375
+ if ('none' === selectionMode) return void setInputValue(nextValue, details);
2376
+ let matchingIndex = findSerializedMatchIndex();
2377
+ if (-1 === matchingIndex) matchingIndex = valuesRef.current.findIndex((_, index)=>{
2378
+ const renderedLabel = labelsRef.current[index];
2379
+ return null != renderedLabel && renderedLabel.toLowerCase() === nextValueLower;
2297
2380
  });
2298
- if (null != matchingValue) {
2299
- setDirty(matchingValue !== validityData.initialValue);
2300
- setSelectedValue?.(matchingValue, details);
2301
- if (shouldValidateOnChange()) validation.commit(matchingValue);
2302
- }
2381
+ const matchingValue = -1 === matchingIndex ? void 0 : valuesRef.current[matchingIndex];
2382
+ if (null != matchingValue) setSelectedValue?.(matchingValue, details);
2303
2383
  }
2304
- if (items) handleChange();
2305
- else {
2384
+ if (single) {
2306
2385
  forceMount();
2307
- queueMicrotask(handleChange);
2386
+ if (items && -1 === findSerializedMatchIndex()) store.set('forceMounted', true);
2308
2387
  }
2388
+ queueMicrotask(handleChange);
2309
2389
  }
2310
2390
  }),
2311
2391
  id: id && null == hiddenInputName ? `${id}-hidden-input` : void 0,
@@ -2329,11 +2409,14 @@ function AriaCombobox(props) {
2329
2409
  value: store,
2330
2410
  children: /*#__PURE__*/ jsx(ComboboxFloatingContext.Provider, {
2331
2411
  value: floatingRootContext,
2332
- children: /*#__PURE__*/ jsx(ComboboxDerivedItemsContext.Provider, {
2333
- value: itemsContextValue,
2334
- children: /*#__PURE__*/ jsx(ComboboxInputValueContext.Provider, {
2335
- value: inputValue,
2336
- children: children
2412
+ children: /*#__PURE__*/ jsx(ComboboxHasItemsContext.Provider, {
2413
+ value: hasItems,
2414
+ children: /*#__PURE__*/ jsx(ComboboxDerivedItemsContext.Provider, {
2415
+ value: itemsContextValue,
2416
+ children: /*#__PURE__*/ jsx(ComboboxInputValueContext.Provider, {
2417
+ value: inputValue,
2418
+ children: children
2419
+ })
2337
2420
  })
2338
2421
  })
2339
2422
  })
@@ -2342,8 +2425,8 @@ function AriaCombobox(props) {
2342
2425
  const ComboboxPortal_ComboboxPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
2343
2426
  const { keepMounted = false, ...portalProps } = props;
2344
2427
  const store = useComboboxRootContext();
2345
- const mounted = useStore(store, selectors.mounted);
2346
- const forceMounted = useStore(store, selectors.forceMounted);
2428
+ const mounted = store.useState('mounted');
2429
+ const forceMounted = store.useState('forceMounted');
2347
2430
  const shouldRender = mounted || keepMounted || forceMounted;
2348
2431
  if (!shouldRender) return null;
2349
2432
  return /*#__PURE__*/ jsx(ComboboxPortalContext.Provider, {
@@ -2355,4 +2438,4 @@ const ComboboxPortal_ComboboxPortal = /*#__PURE__*/ __rspack_external_react.forw
2355
2438
  });
2356
2439
  });
2357
2440
  if ("production" !== process.env.NODE_ENV) ComboboxPortal_ComboboxPortal.displayName = "ComboboxPortal";
2358
- export { AriaCombobox, ComboboxArrow_ComboboxArrow, ComboboxBackdrop_ComboboxBackdrop, ComboboxChipsContext, ComboboxClear_ComboboxClear, ComboboxCollection, ComboboxEmpty_ComboboxEmpty, ComboboxGroupLabel_ComboboxGroupLabel, ComboboxGroup_ComboboxGroup, ComboboxIcon_ComboboxIcon, ComboboxInputGroup_ComboboxInputGroup, ComboboxInput_ComboboxInput, ComboboxItem_ComboboxItem, ComboboxList_ComboboxList, ComboboxPopup_ComboboxPopup, ComboboxPortal_ComboboxPortal, ComboboxPositioner_ComboboxPositioner, ComboboxRow_ComboboxRow, ComboboxStatus_ComboboxStatus, ComboboxTrigger_ComboboxTrigger, handleInputPress, selectors, useComboboxChipsContext, useComboboxInputValueContext, useComboboxItemContext, useComboboxRootContext, useCoreFilter };
2441
+ export { AriaCombobox, ComboboxArrow_ComboboxArrow, ComboboxBackdrop_ComboboxBackdrop, ComboboxChipsContext, ComboboxClear_ComboboxClear, ComboboxCollection, ComboboxEmpty_ComboboxEmpty, ComboboxGroupLabel_ComboboxGroupLabel, ComboboxGroup_ComboboxGroup, ComboboxIcon_ComboboxIcon, ComboboxInputGroup_ComboboxInputGroup, ComboboxInput_ComboboxInput, ComboboxItem_ComboboxItem, ComboboxList_ComboboxList, ComboboxPopup_ComboboxPopup, ComboboxPortal_ComboboxPortal, ComboboxPositioner_ComboboxPositioner, ComboboxRow_ComboboxRow, ComboboxStatus_ComboboxStatus, ComboboxTrigger_ComboboxTrigger, getChipNavigationKeys, getIndexAfterChipRemoval, handleInputPress, useComboboxChipsContext, useComboboxInputValueContext, useComboboxItemContext, useComboboxRootContext, useCoreFilter };