@fluentui/react-combobox 9.2.4 → 9.2.5

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 (292) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +82 -1
  3. package/CHANGELOG.md +22 -2
  4. package/lib/Combobox.js.map +1 -1
  5. package/lib/ComboboxField.js.map +1 -1
  6. package/lib/Dropdown.js.map +1 -1
  7. package/lib/Listbox.js.map +1 -1
  8. package/lib/Option.js.map +1 -1
  9. package/lib/OptionGroup.js.map +1 -1
  10. package/lib/components/Combobox/Combobox.js.map +1 -1
  11. package/lib/components/Combobox/Combobox.types.js +1 -1
  12. package/lib/components/Combobox/Combobox.types.js.map +1 -1
  13. package/lib/components/Combobox/index.js.map +1 -1
  14. package/lib/components/Combobox/renderCombobox.js +2 -12
  15. package/lib/components/Combobox/renderCombobox.js.map +1 -1
  16. package/lib/components/Combobox/useCombobox.js +11 -11
  17. package/lib/components/Combobox/useCombobox.js.map +1 -1
  18. package/lib/components/Combobox/useComboboxStyles.js.map +1 -1
  19. package/lib/components/ComboboxField/ComboboxField.js +1 -2
  20. package/lib/components/ComboboxField/ComboboxField.js.map +1 -1
  21. package/lib/components/ComboboxField/index.js.map +1 -1
  22. package/lib/components/Dropdown/Dropdown.js.map +1 -1
  23. package/lib/components/Dropdown/Dropdown.types.js.map +1 -1
  24. package/lib/components/Dropdown/index.js.map +1 -1
  25. package/lib/components/Dropdown/renderDropdown.js +2 -12
  26. package/lib/components/Dropdown/renderDropdown.js.map +1 -1
  27. package/lib/components/Dropdown/useDropdown.js +4 -4
  28. package/lib/components/Dropdown/useDropdown.js.map +1 -1
  29. package/lib/components/Dropdown/useDropdownStyles.js.map +1 -1
  30. package/lib/components/Listbox/Listbox.js.map +1 -1
  31. package/lib/components/Listbox/Listbox.types.js.map +1 -1
  32. package/lib/components/Listbox/index.js.map +1 -1
  33. package/lib/components/Listbox/renderListbox.js +1 -3
  34. package/lib/components/Listbox/renderListbox.js.map +1 -1
  35. package/lib/components/Listbox/useListbox.js.map +1 -1
  36. package/lib/components/Listbox/useListboxStyles.js.map +1 -1
  37. package/lib/components/Option/Option.js.map +1 -1
  38. package/lib/components/Option/Option.types.js +1 -1
  39. package/lib/components/Option/Option.types.js.map +1 -1
  40. package/lib/components/Option/index.js.map +1 -1
  41. package/lib/components/Option/renderOption.js +1 -5
  42. package/lib/components/Option/renderOption.js.map +1 -1
  43. package/lib/components/Option/useOption.js +4 -4
  44. package/lib/components/Option/useOption.js.map +1 -1
  45. package/lib/components/Option/useOptionStyles.js.map +1 -1
  46. package/lib/components/OptionGroup/OptionGroup.js.map +1 -1
  47. package/lib/components/OptionGroup/OptionGroup.types.js.map +1 -1
  48. package/lib/components/OptionGroup/index.js.map +1 -1
  49. package/lib/components/OptionGroup/renderOptionGroup.js +1 -5
  50. package/lib/components/OptionGroup/renderOptionGroup.js.map +1 -1
  51. package/lib/components/OptionGroup/useOptionGroup.js +1 -0
  52. package/lib/components/OptionGroup/useOptionGroup.js.map +1 -1
  53. package/lib/components/OptionGroup/useOptionGroupStyles.js.map +1 -1
  54. package/lib/contexts/ComboboxContext.js.map +1 -1
  55. package/lib/contexts/ListboxContext.js.map +1 -1
  56. package/lib/contexts/useComboboxContextValues.js.map +1 -1
  57. package/lib/contexts/useListboxContextValues.js.map +1 -1
  58. package/lib/index.js.map +1 -1
  59. package/lib/utils/ComboboxBase.types.js +1 -1
  60. package/lib/utils/ComboboxBase.types.js.map +1 -1
  61. package/lib/utils/OptionCollection.types.js.map +1 -1
  62. package/lib/utils/Selection.types.js +1 -1
  63. package/lib/utils/Selection.types.js.map +1 -1
  64. package/lib/utils/dropdownKeyActions.js +1 -0
  65. package/lib/utils/dropdownKeyActions.js.map +1 -1
  66. package/lib/utils/internalTokens.js.map +1 -1
  67. package/lib/utils/useComboboxBaseState.js +1 -3
  68. package/lib/utils/useComboboxBaseState.js.map +1 -1
  69. package/lib/utils/useComboboxPopup.js.map +1 -1
  70. package/lib/utils/useOptionCollection.js +4 -4
  71. package/lib/utils/useOptionCollection.js.map +1 -1
  72. package/lib/utils/useScrollOptionsIntoView.js.map +1 -1
  73. package/lib/utils/useSelection.js.map +1 -1
  74. package/lib/utils/useTriggerListboxSlots.js +6 -6
  75. package/lib/utils/useTriggerListboxSlots.js.map +1 -1
  76. package/lib-commonjs/Combobox.js +5 -4
  77. package/lib-commonjs/Combobox.js.map +1 -1
  78. package/lib-commonjs/ComboboxField.js +5 -4
  79. package/lib-commonjs/ComboboxField.js.map +1 -1
  80. package/lib-commonjs/Dropdown.js +5 -4
  81. package/lib-commonjs/Dropdown.js.map +1 -1
  82. package/lib-commonjs/Listbox.js +5 -4
  83. package/lib-commonjs/Listbox.js.map +1 -1
  84. package/lib-commonjs/Option.js +5 -4
  85. package/lib-commonjs/Option.js.map +1 -1
  86. package/lib-commonjs/OptionGroup.js +5 -4
  87. package/lib-commonjs/OptionGroup.js.map +1 -1
  88. package/lib-commonjs/components/Combobox/Combobox.js +21 -22
  89. package/lib-commonjs/components/Combobox/Combobox.js.map +1 -1
  90. package/lib-commonjs/components/Combobox/Combobox.types.js +5 -2
  91. package/lib-commonjs/components/Combobox/Combobox.types.js.map +1 -1
  92. package/lib-commonjs/components/Combobox/index.js +9 -8
  93. package/lib-commonjs/components/Combobox/index.js.map +1 -1
  94. package/lib-commonjs/components/Combobox/renderCombobox.js +17 -30
  95. package/lib-commonjs/components/Combobox/renderCombobox.js.map +1 -1
  96. package/lib-commonjs/components/Combobox/useCombobox.js +220 -246
  97. package/lib-commonjs/components/Combobox/useCombobox.js.map +1 -1
  98. package/lib-commonjs/components/Combobox/useComboboxStyles.js +642 -292
  99. package/lib-commonjs/components/Combobox/useComboboxStyles.js.map +1 -1
  100. package/lib-commonjs/components/ComboboxField/ComboboxField.js +17 -11
  101. package/lib-commonjs/components/ComboboxField/ComboboxField.js.map +1 -1
  102. package/lib-commonjs/components/ComboboxField/index.js +5 -4
  103. package/lib-commonjs/components/ComboboxField/index.js.map +1 -1
  104. package/lib-commonjs/components/Dropdown/Dropdown.js +21 -22
  105. package/lib-commonjs/components/Dropdown/Dropdown.js.map +1 -1
  106. package/lib-commonjs/components/Dropdown/Dropdown.types.js +3 -2
  107. package/lib-commonjs/components/Dropdown/Dropdown.types.js.map +1 -1
  108. package/lib-commonjs/components/Dropdown/index.js +9 -8
  109. package/lib-commonjs/components/Dropdown/index.js.map +1 -1
  110. package/lib-commonjs/components/Dropdown/renderDropdown.js +17 -30
  111. package/lib-commonjs/components/Dropdown/renderDropdown.js.map +1 -1
  112. package/lib-commonjs/components/Dropdown/useDropdown.js +138 -152
  113. package/lib-commonjs/components/Dropdown/useDropdown.js.map +1 -1
  114. package/lib-commonjs/components/Dropdown/useDropdownStyles.js +618 -279
  115. package/lib-commonjs/components/Dropdown/useDropdownStyles.js.map +1 -1
  116. package/lib-commonjs/components/Listbox/Listbox.js +21 -22
  117. package/lib-commonjs/components/Listbox/Listbox.js.map +1 -1
  118. package/lib-commonjs/components/Listbox/Listbox.types.js +3 -2
  119. package/lib-commonjs/components/Listbox/Listbox.types.js.map +1 -1
  120. package/lib-commonjs/components/Listbox/index.js +9 -8
  121. package/lib-commonjs/components/Listbox/index.js.map +1 -1
  122. package/lib-commonjs/components/Listbox/renderListbox.js +16 -21
  123. package/lib-commonjs/components/Listbox/renderListbox.js.map +1 -1
  124. package/lib-commonjs/components/Listbox/useListbox.js +93 -109
  125. package/lib-commonjs/components/Listbox/useListbox.js.map +1 -1
  126. package/lib-commonjs/components/Listbox/useListboxStyles.js +59 -35
  127. package/lib-commonjs/components/Listbox/useListboxStyles.js.map +1 -1
  128. package/lib-commonjs/components/Option/Option.js +19 -20
  129. package/lib-commonjs/components/Option/Option.js.map +1 -1
  130. package/lib-commonjs/components/Option/Option.types.js +5 -2
  131. package/lib-commonjs/components/Option/Option.types.js.map +1 -1
  132. package/lib-commonjs/components/Option/index.js +9 -8
  133. package/lib-commonjs/components/Option/index.js.map +1 -1
  134. package/lib-commonjs/components/Option/renderOption.js +13 -20
  135. package/lib-commonjs/components/Option/renderOption.js.map +1 -1
  136. package/lib-commonjs/components/Option/useOption.js +129 -131
  137. package/lib-commonjs/components/Option/useOption.js.map +1 -1
  138. package/lib-commonjs/components/Option/useOptionStyles.js +327 -140
  139. package/lib-commonjs/components/Option/useOptionStyles.js.map +1 -1
  140. package/lib-commonjs/components/OptionGroup/OptionGroup.js +19 -20
  141. package/lib-commonjs/components/OptionGroup/OptionGroup.js.map +1 -1
  142. package/lib-commonjs/components/OptionGroup/OptionGroup.types.js +3 -2
  143. package/lib-commonjs/components/OptionGroup/OptionGroup.types.js.map +1 -1
  144. package/lib-commonjs/components/OptionGroup/index.js +9 -8
  145. package/lib-commonjs/components/OptionGroup/index.js.map +1 -1
  146. package/lib-commonjs/components/OptionGroup/renderOptionGroup.js +13 -20
  147. package/lib-commonjs/components/OptionGroup/renderOptionGroup.js.map +1 -1
  148. package/lib-commonjs/components/OptionGroup/useOptionGroup.js +31 -38
  149. package/lib-commonjs/components/OptionGroup/useOptionGroup.js.map +1 -1
  150. package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.js +107 -53
  151. package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.js.map +1 -1
  152. package/lib-commonjs/contexts/ComboboxContext.js +30 -22
  153. package/lib-commonjs/contexts/ComboboxContext.js.map +1 -1
  154. package/lib-commonjs/contexts/ListboxContext.js +26 -18
  155. package/lib-commonjs/contexts/ListboxContext.js.map +1 -1
  156. package/lib-commonjs/contexts/useComboboxContextValues.js +23 -32
  157. package/lib-commonjs/contexts/useComboboxContextValues.js.map +1 -1
  158. package/lib-commonjs/contexts/useListboxContextValues.js +26 -32
  159. package/lib-commonjs/contexts/useListboxContextValues.js.map +1 -1
  160. package/lib-commonjs/index.js +53 -201
  161. package/lib-commonjs/index.js.map +1 -1
  162. package/lib-commonjs/utils/ComboboxBase.types.js +5 -2
  163. package/lib-commonjs/utils/ComboboxBase.types.js.map +1 -1
  164. package/lib-commonjs/utils/OptionCollection.types.js +3 -2
  165. package/lib-commonjs/utils/OptionCollection.types.js.map +1 -1
  166. package/lib-commonjs/utils/Selection.types.js +5 -2
  167. package/lib-commonjs/utils/Selection.types.js.map +1 -1
  168. package/lib-commonjs/utils/dropdownKeyActions.js +80 -85
  169. package/lib-commonjs/utils/dropdownKeyActions.js.map +1 -1
  170. package/lib-commonjs/utils/internalTokens.js +11 -8
  171. package/lib-commonjs/utils/internalTokens.js.map +1 -1
  172. package/lib-commonjs/utils/useComboboxBaseState.js +106 -108
  173. package/lib-commonjs/utils/useComboboxBaseState.js.map +1 -1
  174. package/lib-commonjs/utils/useComboboxPopup.js +33 -33
  175. package/lib-commonjs/utils/useComboboxPopup.js.map +1 -1
  176. package/lib-commonjs/utils/useOptionCollection.js +74 -71
  177. package/lib-commonjs/utils/useOptionCollection.js.map +1 -1
  178. package/lib-commonjs/utils/useScrollOptionsIntoView.js +35 -38
  179. package/lib-commonjs/utils/useScrollOptionsIntoView.js.map +1 -1
  180. package/lib-commonjs/utils/useSelection.js +66 -55
  181. package/lib-commonjs/utils/useSelection.js.map +1 -1
  182. package/lib-commonjs/utils/useTriggerListboxSlots.js +115 -129
  183. package/lib-commonjs/utils/useTriggerListboxSlots.js.map +1 -1
  184. package/package.json +14 -13
  185. package/lib-amd/Combobox.js +0 -6
  186. package/lib-amd/Combobox.js.map +0 -1
  187. package/lib-amd/ComboboxField.js +0 -6
  188. package/lib-amd/ComboboxField.js.map +0 -1
  189. package/lib-amd/Dropdown.js +0 -6
  190. package/lib-amd/Dropdown.js.map +0 -1
  191. package/lib-amd/Listbox.js +0 -6
  192. package/lib-amd/Listbox.js.map +0 -1
  193. package/lib-amd/Option.js +0 -6
  194. package/lib-amd/Option.js.map +0 -1
  195. package/lib-amd/OptionGroup.js +0 -6
  196. package/lib-amd/OptionGroup.js.map +0 -1
  197. package/lib-amd/components/Combobox/Combobox.js +0 -18
  198. package/lib-amd/components/Combobox/Combobox.js.map +0 -1
  199. package/lib-amd/components/Combobox/Combobox.types.js +0 -5
  200. package/lib-amd/components/Combobox/Combobox.types.js.map +0 -1
  201. package/lib-amd/components/Combobox/index.js +0 -10
  202. package/lib-amd/components/Combobox/index.js.map +0 -1
  203. package/lib-amd/components/Combobox/renderCombobox.js +0 -20
  204. package/lib-amd/components/Combobox/renderCombobox.js.map +0 -1
  205. package/lib-amd/components/Combobox/useCombobox.js +0 -204
  206. package/lib-amd/components/Combobox/useCombobox.js.map +0 -1
  207. package/lib-amd/components/Combobox/useComboboxStyles.js +0 -152
  208. package/lib-amd/components/Combobox/useComboboxStyles.js.map +0 -1
  209. package/lib-amd/components/ComboboxField/ComboboxField.js +0 -10
  210. package/lib-amd/components/ComboboxField/ComboboxField.js.map +0 -1
  211. package/lib-amd/components/ComboboxField/index.js +0 -6
  212. package/lib-amd/components/ComboboxField/index.js.map +0 -1
  213. package/lib-amd/components/Dropdown/Dropdown.js +0 -18
  214. package/lib-amd/components/Dropdown/Dropdown.js.map +0 -1
  215. package/lib-amd/components/Dropdown/Dropdown.types.js +0 -5
  216. package/lib-amd/components/Dropdown/Dropdown.types.js.map +0 -1
  217. package/lib-amd/components/Dropdown/index.js +0 -10
  218. package/lib-amd/components/Dropdown/index.js.map +0 -1
  219. package/lib-amd/components/Dropdown/renderDropdown.js +0 -21
  220. package/lib-amd/components/Dropdown/renderDropdown.js.map +0 -1
  221. package/lib-amd/components/Dropdown/useDropdown.js +0 -121
  222. package/lib-amd/components/Dropdown/useDropdown.js.map +0 -1
  223. package/lib-amd/components/Dropdown/useDropdownStyles.js +0 -127
  224. package/lib-amd/components/Dropdown/useDropdownStyles.js.map +0 -1
  225. package/lib-amd/components/Listbox/Listbox.js +0 -18
  226. package/lib-amd/components/Listbox/Listbox.js.map +0 -1
  227. package/lib-amd/components/Listbox/Listbox.types.js +0 -5
  228. package/lib-amd/components/Listbox/Listbox.types.js.map +0 -1
  229. package/lib-amd/components/Listbox/index.js +0 -10
  230. package/lib-amd/components/Listbox/index.js.map +0 -1
  231. package/lib-amd/components/Listbox/renderListbox.js +0 -15
  232. package/lib-amd/components/Listbox/renderListbox.js.map +0 -1
  233. package/lib-amd/components/Listbox/useListbox.js +0 -80
  234. package/lib-amd/components/Listbox/useListbox.js.map +0 -1
  235. package/lib-amd/components/Listbox/useListboxStyles.js +0 -24
  236. package/lib-amd/components/Listbox/useListboxStyles.js.map +0 -1
  237. package/lib-amd/components/Option/Option.js +0 -17
  238. package/lib-amd/components/Option/Option.js.map +0 -1
  239. package/lib-amd/components/Option/Option.types.js +0 -5
  240. package/lib-amd/components/Option/Option.types.js.map +0 -1
  241. package/lib-amd/components/Option/index.js +0 -10
  242. package/lib-amd/components/Option/index.js.map +0 -1
  243. package/lib-amd/components/Option/renderOption.js +0 -16
  244. package/lib-amd/components/Option/renderOption.js.map +0 -1
  245. package/lib-amd/components/Option/useOption.js +0 -112
  246. package/lib-amd/components/Option/useOption.js.map +0 -1
  247. package/lib-amd/components/Option/useOptionStyles.js +0 -73
  248. package/lib-amd/components/Option/useOptionStyles.js.map +0 -1
  249. package/lib-amd/components/OptionGroup/OptionGroup.js +0 -17
  250. package/lib-amd/components/OptionGroup/OptionGroup.js.map +0 -1
  251. package/lib-amd/components/OptionGroup/OptionGroup.types.js +0 -5
  252. package/lib-amd/components/OptionGroup/OptionGroup.types.js.map +0 -1
  253. package/lib-amd/components/OptionGroup/index.js +0 -10
  254. package/lib-amd/components/OptionGroup/index.js.map +0 -1
  255. package/lib-amd/components/OptionGroup/renderOptionGroup.js +0 -16
  256. package/lib-amd/components/OptionGroup/renderOptionGroup.js.map +0 -1
  257. package/lib-amd/components/OptionGroup/useOptionGroup.js +0 -33
  258. package/lib-amd/components/OptionGroup/useOptionGroup.js.map +0 -1
  259. package/lib-amd/components/OptionGroup/useOptionGroupStyles.js +0 -34
  260. package/lib-amd/components/OptionGroup/useOptionGroupStyles.js.map +0 -1
  261. package/lib-amd/contexts/ComboboxContext.js +0 -28
  262. package/lib-amd/contexts/ComboboxContext.js.map +0 -1
  263. package/lib-amd/contexts/ListboxContext.js +0 -23
  264. package/lib-amd/contexts/ListboxContext.js.map +0 -1
  265. package/lib-amd/contexts/useComboboxContextValues.js +0 -23
  266. package/lib-amd/contexts/useComboboxContextValues.js.map +0 -1
  267. package/lib-amd/contexts/useListboxContextValues.js +0 -24
  268. package/lib-amd/contexts/useListboxContextValues.js.map +0 -1
  269. package/lib-amd/index.js +0 -37
  270. package/lib-amd/index.js.map +0 -1
  271. package/lib-amd/utils/ComboboxBase.types.js +0 -5
  272. package/lib-amd/utils/ComboboxBase.types.js.map +0 -1
  273. package/lib-amd/utils/OptionCollection.types.js +0 -5
  274. package/lib-amd/utils/OptionCollection.types.js.map +0 -1
  275. package/lib-amd/utils/Selection.types.js +0 -5
  276. package/lib-amd/utils/Selection.types.js.map +0 -1
  277. package/lib-amd/utils/dropdownKeyActions.js +0 -85
  278. package/lib-amd/utils/dropdownKeyActions.js.map +0 -1
  279. package/lib-amd/utils/internalTokens.js +0 -11
  280. package/lib-amd/utils/internalTokens.js.map +0 -1
  281. package/lib-amd/utils/useComboboxBaseState.js +0 -83
  282. package/lib-amd/utils/useComboboxBaseState.js.map +0 -1
  283. package/lib-amd/utils/useComboboxPopup.js +0 -16
  284. package/lib-amd/utils/useComboboxPopup.js.map +0 -1
  285. package/lib-amd/utils/useOptionCollection.js +0 -69
  286. package/lib-amd/utils/useOptionCollection.js.map +0 -1
  287. package/lib-amd/utils/useScrollOptionsIntoView.js +0 -33
  288. package/lib-amd/utils/useScrollOptionsIntoView.js.map +0 -1
  289. package/lib-amd/utils/useSelection.js +0 -42
  290. package/lib-amd/utils/useSelection.js.map +0 -1
  291. package/lib-amd/utils/useTriggerListboxSlots.js +0 -104
  292. package/lib-amd/utils/useTriggerListboxSlots.js.map +0 -1
@@ -1,252 +1,226 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.useCombobox_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
9
- const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
10
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
- const dropdownKeyActions_1 = /*#__PURE__*/require("../../utils/dropdownKeyActions");
12
- const useComboboxBaseState_1 = /*#__PURE__*/require("../../utils/useComboboxBaseState");
13
- const useComboboxPopup_1 = /*#__PURE__*/require("../../utils/useComboboxPopup");
14
- const useTriggerListboxSlots_1 = /*#__PURE__*/require("../../utils/useTriggerListboxSlots");
15
- const Listbox_1 = /*#__PURE__*/require("../Listbox/Listbox");
16
- /**
17
- * Create the state required to render Combobox.
18
- *
19
- * The returned state can be modified with hooks such as useComboboxStyles_unstable,
20
- * before being passed to renderCombobox_unstable.
21
- *
22
- * @param props - props from this instance of Combobox
23
- * @param ref - reference to root HTMLElement of Combobox
24
- */
25
- const useCombobox_unstable = (props, ref) => {
26
- var _a, _b;
27
- const baseState = useComboboxBaseState_1.useComboboxBaseState({
28
- ...props,
29
- editable: true
30
- });
31
- const {
32
- activeOption,
33
- clearSelection,
34
- getIndexOfId,
35
- getOptionsMatchingText,
36
- hasFocus,
37
- open,
38
- selectOption,
39
- selectedOptions,
40
- setActiveOption,
41
- setFocusVisible,
42
- setOpen,
43
- setValue,
44
- value
45
- } = baseState;
46
- const {
47
- disabled,
48
- freeform,
49
- inlinePopup,
50
- multiselect
51
- } = props;
52
- const comboId = react_utilities_1.useId('combobox-');
53
- const {
54
- primary: triggerNativeProps,
55
- root: rootNativeProps
56
- } = react_utilities_1.getPartitionedNativeProps({
57
- props,
58
- primarySlotTagName: 'input',
59
- excludedPropNames: ['children', 'size']
60
- });
61
- const rootRef = React.useRef(null);
62
- const triggerRef = React.useRef(null);
63
- // NVDA and JAWS have bugs that suppress reading the input value text when aria-activedescendant is set
64
- // To prevent this, we clear the HTML attribute (but save the state) when a user presses left/right arrows
65
- // ref: https://github.com/microsoft/fluentui/issues/26359#issuecomment-1397759888
66
- const [hideActiveDescendant, setHideActiveDescendant] = React.useState(false);
67
- // calculate listbox width style based on trigger width
68
- const [popupDimensions, setPopupDimensions] = React.useState();
69
- React.useEffect(() => {
70
- var _a;
71
- // only recalculate width when opening
72
- if (open) {
73
- const width = `${(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth}px`;
74
- if (width !== (popupDimensions === null || popupDimensions === void 0 ? void 0 : popupDimensions.width)) {
75
- setPopupDimensions({
76
- width
77
- });
78
- }
79
- }
80
- }, [open, popupDimensions]);
81
- // set active option and selection based on typing
82
- const getOptionFromInput = inputValue => {
83
- var _a;
84
- const searchString = inputValue === null || inputValue === void 0 ? void 0 : inputValue.trim().toLowerCase();
85
- if (!searchString || searchString.length === 0) {
86
- return;
87
- }
88
- const matcher = optionText => optionText.toLowerCase().indexOf(searchString) === 0;
89
- const matches = getOptionsMatchingText(matcher);
90
- // return first matching option after the current active option, looping back to the top
91
- if (matches.length > 1 && activeOption) {
92
- const startIndex = getIndexOfId(activeOption.id);
93
- const nextMatch = matches.find(option => getIndexOfId(option.id) >= startIndex);
94
- return nextMatch !== null && nextMatch !== void 0 ? nextMatch : matches[0];
95
- }
96
- return (_a = matches[0]) !== null && _a !== void 0 ? _a : undefined;
97
- };
98
- /* Handle typed input */
99
- // reset any typed value when an option is selected
100
- baseState.selectOption = (ev, option) => {
101
- setValue(undefined);
102
- selectOption(ev, option);
103
- };
104
- const onTriggerBlur = ev => {
105
- // handle selection and updating value if freeform is false
106
- if (!baseState.open && !freeform) {
107
- // select matching option, if the value fully matches
108
- if (value && activeOption && value.trim().toLowerCase() === (activeOption === null || activeOption === void 0 ? void 0 : activeOption.text.toLowerCase())) {
109
- baseState.selectOption(ev, activeOption);
110
- }
111
- // reset typed value when the input loses focus while collapsed, unless freeform is true
112
- setValue(undefined);
113
- }
114
- };
115
- baseState.setOpen = (ev, newState) => {
116
- if (disabled) {
117
- return;
118
- }
119
- if (!newState && !freeform) {
120
- setValue(undefined);
121
- }
122
- setOpen(ev, newState);
123
- };
124
- // update value and active option based on input
125
- const onTriggerChange = ev => {
126
- const inputValue = ev.target.value;
127
- // update uncontrolled value
128
- baseState.setValue(inputValue);
129
- // handle updating active option based on input
130
- const matchingOption = getOptionFromInput(inputValue);
131
- setActiveOption(matchingOption);
132
- setFocusVisible(true);
133
- // clear selection for single-select if the input value no longer matches the selection
134
- if (!multiselect && selectedOptions.length === 1 && (inputValue.length < 1 || !matchingOption)) {
135
- clearSelection(ev);
136
- }
137
- };
138
- // open Combobox when typing
139
- const onTriggerKeyDown = ev => {
140
- if (!open && dropdownKeyActions_1.getDropdownActionFromKey(ev) === 'Type') {
141
- baseState.setOpen(ev, true);
142
- }
143
- // clear activedescendant when moving the text insertion cursor
144
- if (ev.key === keyboard_keys_1.ArrowLeft || ev.key === keyboard_keys_1.ArrowRight) {
145
- setHideActiveDescendant(true);
146
- } else {
147
- setHideActiveDescendant(false);
148
- }
149
- };
150
- // resolve input and listbox slot props
151
- let triggerSlot;
152
- let listboxSlot;
153
- triggerSlot = react_utilities_1.resolveShorthand(props.input, {
154
- required: true,
155
- defaultProps: {
156
- ref: react_utilities_1.useMergedRefs((_a = props.input) === null || _a === void 0 ? void 0 : _a.ref, triggerRef),
157
- type: 'text',
158
- value: value !== null && value !== void 0 ? value : '',
159
- ...triggerNativeProps
160
- }
161
- });
162
- triggerSlot.onChange = react_utilities_1.mergeCallbacks(triggerSlot.onChange, onTriggerChange);
163
- triggerSlot.onBlur = react_utilities_1.mergeCallbacks(triggerSlot.onBlur, onTriggerBlur);
164
- triggerSlot.onKeyDown = react_utilities_1.mergeCallbacks(triggerSlot.onKeyDown, onTriggerKeyDown);
165
- // only resolve listbox slot if needed
166
- listboxSlot = open || hasFocus ? react_utilities_1.resolveShorthand(props.listbox, {
167
- required: true,
168
- defaultProps: {
169
- children: props.children,
170
- style: popupDimensions
171
- }
172
- }) : undefined;
173
- [triggerSlot, listboxSlot] = useComboboxPopup_1.useComboboxPopup(props, triggerSlot, listboxSlot);
174
- [triggerSlot, listboxSlot] = useTriggerListboxSlots_1.useTriggerListboxSlots(props, baseState, ref, triggerSlot, listboxSlot);
175
- if (hideActiveDescendant) {
176
- triggerSlot['aria-activedescendant'] = undefined;
177
- }
178
- const state = {
179
- components: {
180
- root: 'div',
181
- input: 'input',
182
- expandIcon: 'span',
183
- listbox: Listbox_1.Listbox
184
- },
185
- root: react_utilities_1.resolveShorthand(props.root, {
186
- required: true,
187
- defaultProps: {
188
- 'aria-owns': !inlinePopup ? listboxSlot === null || listboxSlot === void 0 ? void 0 : listboxSlot.id : undefined,
189
- ...rootNativeProps
190
- }
191
- }),
192
- input: triggerSlot,
193
- listbox: listboxSlot,
194
- expandIcon: react_utilities_1.resolveShorthand(props.expandIcon, {
195
- required: true,
196
- defaultProps: {
197
- 'aria-expanded': open,
198
- children: React.createElement(react_icons_1.ChevronDownRegular, null),
199
- role: 'button'
200
- }
201
- }),
202
- ...baseState
203
- };
204
- state.root.ref = react_utilities_1.useMergedRefs(state.root.ref, rootRef);
205
- /* handle open/close + focus change when clicking expandIcon */
206
- const {
207
- onMouseDown: onIconMouseDown,
208
- onClick: onIconClick
209
- } = state.expandIcon || {};
210
- const onExpandIconMouseDown = react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(onIconMouseDown, () => {
211
- // do not dismiss on blur when closing via clicking the icon
212
- if (open) {
213
- baseState.ignoreNextBlur.current = true;
5
+ Object.defineProperty(exports, "useCombobox_unstable", {
6
+ enumerable: true,
7
+ get: ()=>useCombobox_unstable
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _keyboardKeys = require("@fluentui/keyboard-keys");
12
+ const _reactIcons = require("@fluentui/react-icons");
13
+ const _reactUtilities = require("@fluentui/react-utilities");
14
+ const _dropdownKeyActions = require("../../utils/dropdownKeyActions");
15
+ const _useComboboxBaseState = require("../../utils/useComboboxBaseState");
16
+ const _useComboboxPopup = require("../../utils/useComboboxPopup");
17
+ const _useTriggerListboxSlots = require("../../utils/useTriggerListboxSlots");
18
+ const _listbox = require("../Listbox/Listbox");
19
+ const useCombobox_unstable = (props, ref)=>{
20
+ var _props_input;
21
+ const baseState = (0, _useComboboxBaseState.useComboboxBaseState)({
22
+ ...props,
23
+ editable: true
24
+ });
25
+ const { activeOption , clearSelection , getIndexOfId , getOptionsMatchingText , hasFocus , open , selectOption , selectedOptions , setActiveOption , setFocusVisible , setOpen , setValue , value } = baseState;
26
+ const { disabled , freeform , inlinePopup , multiselect } = props;
27
+ const comboId = (0, _reactUtilities.useId)('combobox-');
28
+ const { primary: triggerNativeProps , root: rootNativeProps } = (0, _reactUtilities.getPartitionedNativeProps)({
29
+ props,
30
+ primarySlotTagName: 'input',
31
+ excludedPropNames: [
32
+ 'children',
33
+ 'size'
34
+ ]
35
+ });
36
+ const rootRef = _react.useRef(null);
37
+ const triggerRef = _react.useRef(null);
38
+ // NVDA and JAWS have bugs that suppress reading the input value text when aria-activedescendant is set
39
+ // To prevent this, we clear the HTML attribute (but save the state) when a user presses left/right arrows
40
+ // ref: https://github.com/microsoft/fluentui/issues/26359#issuecomment-1397759888
41
+ const [hideActiveDescendant, setHideActiveDescendant] = _react.useState(false);
42
+ // calculate listbox width style based on trigger width
43
+ const [popupDimensions, setPopupDimensions] = _react.useState();
44
+ _react.useEffect(()=>{
45
+ // only recalculate width when opening
46
+ if (open) {
47
+ var _rootRef_current;
48
+ const width = `${(_rootRef_current = rootRef.current) === null || _rootRef_current === void 0 ? void 0 : _rootRef_current.clientWidth}px`;
49
+ if (width !== (popupDimensions === null || popupDimensions === void 0 ? void 0 : popupDimensions.width)) {
50
+ setPopupDimensions({
51
+ width
52
+ });
53
+ }
54
+ }
55
+ }, [
56
+ open,
57
+ popupDimensions
58
+ ]);
59
+ // set active option and selection based on typing
60
+ const getOptionFromInput = (inputValue)=>{
61
+ const searchString = inputValue === null || inputValue === void 0 ? void 0 : inputValue.trim().toLowerCase();
62
+ if (!searchString || searchString.length === 0) {
63
+ return;
64
+ }
65
+ const matcher = (optionText)=>optionText.toLowerCase().indexOf(searchString) === 0;
66
+ const matches = getOptionsMatchingText(matcher);
67
+ // return first matching option after the current active option, looping back to the top
68
+ if (matches.length > 1 && activeOption) {
69
+ const startIndex = getIndexOfId(activeOption.id);
70
+ const nextMatch = matches.find((option)=>getIndexOfId(option.id) >= startIndex);
71
+ return nextMatch !== null && nextMatch !== void 0 ? nextMatch : matches[0];
72
+ }
73
+ var _matches_;
74
+ return (_matches_ = matches[0]) !== null && _matches_ !== void 0 ? _matches_ : undefined;
75
+ };
76
+ /* Handle typed input */ // reset any typed value when an option is selected
77
+ baseState.selectOption = (ev, option)=>{
78
+ setValue(undefined);
79
+ selectOption(ev, option);
80
+ };
81
+ const onTriggerBlur = (ev)=>{
82
+ // handle selection and updating value if freeform is false
83
+ if (!baseState.open && !freeform) {
84
+ // select matching option, if the value fully matches
85
+ if (value && activeOption && value.trim().toLowerCase() === (activeOption === null || activeOption === void 0 ? void 0 : activeOption.text.toLowerCase())) {
86
+ baseState.selectOption(ev, activeOption);
87
+ }
88
+ // reset typed value when the input loses focus while collapsed, unless freeform is true
89
+ setValue(undefined);
90
+ }
91
+ };
92
+ baseState.setOpen = (ev, newState)=>{
93
+ if (disabled) {
94
+ return;
95
+ }
96
+ if (!newState && !freeform) {
97
+ setValue(undefined);
98
+ }
99
+ setOpen(ev, newState);
100
+ };
101
+ // update value and active option based on input
102
+ const onTriggerChange = (ev)=>{
103
+ const inputValue = ev.target.value;
104
+ // update uncontrolled value
105
+ baseState.setValue(inputValue);
106
+ // handle updating active option based on input
107
+ const matchingOption = getOptionFromInput(inputValue);
108
+ setActiveOption(matchingOption);
109
+ setFocusVisible(true);
110
+ // clear selection for single-select if the input value no longer matches the selection
111
+ if (!multiselect && selectedOptions.length === 1 && (inputValue.length < 1 || !matchingOption)) {
112
+ clearSelection(ev);
113
+ }
114
+ };
115
+ // open Combobox when typing
116
+ const onTriggerKeyDown = (ev)=>{
117
+ if (!open && (0, _dropdownKeyActions.getDropdownActionFromKey)(ev) === 'Type') {
118
+ baseState.setOpen(ev, true);
119
+ }
120
+ // clear activedescendant when moving the text insertion cursor
121
+ if (ev.key === _keyboardKeys.ArrowLeft || ev.key === _keyboardKeys.ArrowRight) {
122
+ setHideActiveDescendant(true);
123
+ } else {
124
+ setHideActiveDescendant(false);
125
+ }
126
+ };
127
+ // resolve input and listbox slot props
128
+ let triggerSlot;
129
+ let listboxSlot;
130
+ triggerSlot = (0, _reactUtilities.resolveShorthand)(props.input, {
131
+ required: true,
132
+ defaultProps: {
133
+ ref: (0, _reactUtilities.useMergedRefs)((_props_input = props.input) === null || _props_input === void 0 ? void 0 : _props_input.ref, triggerRef),
134
+ type: 'text',
135
+ value: value !== null && value !== void 0 ? value : '',
136
+ ...triggerNativeProps
137
+ }
138
+ });
139
+ triggerSlot.onChange = (0, _reactUtilities.mergeCallbacks)(triggerSlot.onChange, onTriggerChange);
140
+ triggerSlot.onBlur = (0, _reactUtilities.mergeCallbacks)(triggerSlot.onBlur, onTriggerBlur);
141
+ triggerSlot.onKeyDown = (0, _reactUtilities.mergeCallbacks)(triggerSlot.onKeyDown, onTriggerKeyDown);
142
+ // only resolve listbox slot if needed
143
+ listboxSlot = open || hasFocus ? (0, _reactUtilities.resolveShorthand)(props.listbox, {
144
+ required: true,
145
+ defaultProps: {
146
+ children: props.children,
147
+ style: popupDimensions
148
+ }
149
+ }) : undefined;
150
+ [triggerSlot, listboxSlot] = (0, _useComboboxPopup.useComboboxPopup)(props, triggerSlot, listboxSlot);
151
+ [triggerSlot, listboxSlot] = (0, _useTriggerListboxSlots.useTriggerListboxSlots)(props, baseState, ref, triggerSlot, listboxSlot);
152
+ if (hideActiveDescendant) {
153
+ triggerSlot['aria-activedescendant'] = undefined;
214
154
  }
215
- }));
216
- const onExpandIconClick = react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(onIconClick, event => {
217
- var _a;
218
- // open and set focus
219
- state.setOpen(event, !state.open);
220
- (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
221
- // set focus visible=false, since this can only be done with the mouse/pointer
222
- setFocusVisible(false);
223
- }));
224
- if (state.expandIcon) {
225
- state.expandIcon.onMouseDown = onExpandIconMouseDown;
226
- state.expandIcon.onClick = onExpandIconClick;
227
- // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,
228
- // using the following steps:
229
- // 1. If there is an aria-label, it is "Open [aria-label]"
230
- // 2. If there is an aria-labelledby, it is "Open [aria-labelledby target]" (using aria-labelledby + ids)
231
- // 3. If there is no aria-label/ledby attr, it falls back to "Open"
232
- // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179
233
- const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];
234
- const defaultOpenString = 'Open'; // this is english-only since it is the fallback
235
- if (!hasExpandLabel) {
236
- if (props['aria-labelledby']) {
237
- const chevronId = (_b = state.expandIcon.id) !== null && _b !== void 0 ? _b : `${comboId}-chevron`;
238
- const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;
239
- state.expandIcon['aria-label'] = defaultOpenString;
240
- state.expandIcon.id = chevronId;
241
- state.expandIcon['aria-labelledby'] = chevronLabelledBy;
242
- } else if (props['aria-label']) {
243
- state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;
244
- } else {
245
- state.expandIcon['aria-label'] = defaultOpenString;
246
- }
155
+ const state = {
156
+ components: {
157
+ root: 'div',
158
+ input: 'input',
159
+ expandIcon: 'span',
160
+ listbox: _listbox.Listbox
161
+ },
162
+ root: (0, _reactUtilities.resolveShorthand)(props.root, {
163
+ required: true,
164
+ defaultProps: {
165
+ 'aria-owns': !inlinePopup ? listboxSlot === null || listboxSlot === void 0 ? void 0 : listboxSlot.id : undefined,
166
+ ...rootNativeProps
167
+ }
168
+ }),
169
+ input: triggerSlot,
170
+ listbox: listboxSlot,
171
+ expandIcon: (0, _reactUtilities.resolveShorthand)(props.expandIcon, {
172
+ required: true,
173
+ defaultProps: {
174
+ 'aria-expanded': open,
175
+ children: /*#__PURE__*/ _react.createElement(_reactIcons.ChevronDownRegular, null),
176
+ role: 'button'
177
+ }
178
+ }),
179
+ ...baseState
180
+ };
181
+ state.root.ref = (0, _reactUtilities.useMergedRefs)(state.root.ref, rootRef);
182
+ /* handle open/close + focus change when clicking expandIcon */ const { onMouseDown: onIconMouseDown , onClick: onIconClick } = state.expandIcon || {};
183
+ const onExpandIconMouseDown = (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(onIconMouseDown, ()=>{
184
+ // do not dismiss on blur when closing via clicking the icon
185
+ if (open) {
186
+ baseState.ignoreNextBlur.current = true;
187
+ }
188
+ }));
189
+ const onExpandIconClick = (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(onIconClick, (event)=>{
190
+ var _triggerRef_current;
191
+ // open and set focus
192
+ state.setOpen(event, !state.open);
193
+ (_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.focus();
194
+ // set focus visible=false, since this can only be done with the mouse/pointer
195
+ setFocusVisible(false);
196
+ }));
197
+ if (state.expandIcon) {
198
+ state.expandIcon.onMouseDown = onExpandIconMouseDown;
199
+ state.expandIcon.onClick = onExpandIconClick;
200
+ // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,
201
+ // using the following steps:
202
+ // 1. If there is an aria-label, it is "Open [aria-label]"
203
+ // 2. If there is an aria-labelledby, it is "Open [aria-labelledby target]" (using aria-labelledby + ids)
204
+ // 3. If there is no aria-label/ledby attr, it falls back to "Open"
205
+ // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179
206
+ const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];
207
+ const defaultOpenString = 'Open'; // this is english-only since it is the fallback
208
+ if (!hasExpandLabel) {
209
+ if (props['aria-labelledby']) {
210
+ var _state_expandIcon_id;
211
+ const chevronId = (_state_expandIcon_id = state.expandIcon.id) !== null && _state_expandIcon_id !== void 0 ? _state_expandIcon_id : `${comboId}-chevron`;
212
+ const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;
213
+ state.expandIcon['aria-label'] = defaultOpenString;
214
+ state.expandIcon.id = chevronId;
215
+ state.expandIcon['aria-labelledby'] = chevronLabelledBy;
216
+ } else if (props['aria-label']) {
217
+ state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;
218
+ } else {
219
+ state.expandIcon['aria-label'] = defaultOpenString;
220
+ }
221
+ }
247
222
  }
248
- }
249
- return state;
250
- };
251
- exports.useCombobox_unstable = useCombobox_unstable;
223
+ return state;
224
+ }; //# sourceMappingURL=useCombobox.js.map
225
+
252
226
  //# sourceMappingURL=useCombobox.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","keyboard_keys_1","react_icons_1","react_utilities_1","dropdownKeyActions_1","useComboboxBaseState_1","useComboboxPopup_1","useTriggerListboxSlots_1","Listbox_1","useCombobox_unstable","props","ref","baseState","useComboboxBaseState","editable","activeOption","clearSelection","getIndexOfId","getOptionsMatchingText","hasFocus","open","selectOption","selectedOptions","setActiveOption","setFocusVisible","setOpen","setValue","value","disabled","freeform","inlinePopup","multiselect","comboId","useId","primary","triggerNativeProps","root","rootNativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","rootRef","useRef","triggerRef","hideActiveDescendant","setHideActiveDescendant","useState","popupDimensions","setPopupDimensions","useEffect","width","_a","current","clientWidth","getOptionFromInput","inputValue","searchString","trim","toLowerCase","length","matcher","optionText","indexOf","matches","startIndex","id","nextMatch","find","option","undefined","ev","onTriggerBlur","text","newState","onTriggerChange","target","matchingOption","onTriggerKeyDown","getDropdownActionFromKey","key","ArrowLeft","ArrowRight","triggerSlot","listboxSlot","resolveShorthand","input","required","defaultProps","useMergedRefs","type","onChange","mergeCallbacks","onBlur","onKeyDown","listbox","children","style","useComboboxPopup","useTriggerListboxSlots","state","components","expandIcon","Listbox","createElement","ChevronDownRegular","role","onMouseDown","onIconMouseDown","onClick","onIconClick","onExpandIconMouseDown","useEventCallback","ignoreNextBlur","onExpandIconClick","event","focus","hasExpandLabel","defaultOpenString","chevronId","_b","chevronLabelledBy","exports"],"sources":["../src/packages/react-components/react-combobox/src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ArrowLeft, ArrowRight } from '@fluentui/keyboard-keys';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport {\n getPartitionedNativeProps,\n resolveShorthand,\n mergeCallbacks,\n useEventCallback,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey } from '../../utils/dropdownKeyActions';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPopup } from '../../utils/useComboboxPopup';\nimport { useTriggerListboxSlots } from '../../utils/useTriggerListboxSlots';\nimport { Listbox } from '../Listbox/Listbox';\nimport type { Slot } from '@fluentui/react-utilities';\nimport type { SelectionEvents } from '../../utils/Selection.types';\nimport type { OptionValue } from '../../utils/OptionCollection.types';\nimport type { ComboboxProps, ComboboxState } from './Combobox.types';\n\n/**\n * Create the state required to render Combobox.\n *\n * The returned state can be modified with hooks such as useComboboxStyles_unstable,\n * before being passed to renderCombobox_unstable.\n *\n * @param props - props from this instance of Combobox\n * @param ref - reference to root HTMLElement of Combobox\n */\nexport const useCombobox_unstable = (props: ComboboxProps, ref: React.Ref<HTMLInputElement>): ComboboxState => {\n const baseState = useComboboxBaseState({ ...props, editable: true });\n const {\n activeOption,\n clearSelection,\n getIndexOfId,\n getOptionsMatchingText,\n hasFocus,\n open,\n selectOption,\n selectedOptions,\n setActiveOption,\n setFocusVisible,\n setOpen,\n setValue,\n value,\n } = baseState;\n const { disabled, freeform, inlinePopup, multiselect } = props;\n const comboId = useId('combobox-');\n\n const { primary: triggerNativeProps, root: rootNativeProps } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['children', 'size'],\n });\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const triggerRef = React.useRef<HTMLInputElement>(null);\n\n // NVDA and JAWS have bugs that suppress reading the input value text when aria-activedescendant is set\n // To prevent this, we clear the HTML attribute (but save the state) when a user presses left/right arrows\n // ref: https://github.com/microsoft/fluentui/issues/26359#issuecomment-1397759888\n const [hideActiveDescendant, setHideActiveDescendant] = React.useState(false);\n\n // calculate listbox width style based on trigger width\n const [popupDimensions, setPopupDimensions] = React.useState<{ width: string }>();\n React.useEffect(() => {\n // only recalculate width when opening\n if (open) {\n const width = `${rootRef.current?.clientWidth}px`;\n if (width !== popupDimensions?.width) {\n setPopupDimensions({ width });\n }\n }\n }, [open, popupDimensions]);\n\n // set active option and selection based on typing\n const getOptionFromInput = (inputValue: string): OptionValue | undefined => {\n const searchString = inputValue?.trim().toLowerCase();\n\n if (!searchString || searchString.length === 0) {\n return;\n }\n\n const matcher = (optionText: string) => optionText.toLowerCase().indexOf(searchString) === 0;\n const matches = getOptionsMatchingText(matcher);\n\n // return first matching option after the current active option, looping back to the top\n if (matches.length > 1 && activeOption) {\n const startIndex = getIndexOfId(activeOption.id);\n const nextMatch = matches.find(option => getIndexOfId(option.id) >= startIndex);\n return nextMatch ?? matches[0];\n }\n\n return matches[0] ?? undefined;\n };\n\n /* Handle typed input */\n\n // reset any typed value when an option is selected\n baseState.selectOption = (ev: SelectionEvents, option: OptionValue) => {\n setValue(undefined);\n selectOption(ev, option);\n };\n\n const onTriggerBlur = (ev: React.FocusEvent<HTMLInputElement>) => {\n // handle selection and updating value if freeform is false\n if (!baseState.open && !freeform) {\n // select matching option, if the value fully matches\n if (value && activeOption && value.trim().toLowerCase() === activeOption?.text.toLowerCase()) {\n baseState.selectOption(ev, activeOption);\n }\n\n // reset typed value when the input loses focus while collapsed, unless freeform is true\n setValue(undefined);\n }\n };\n\n baseState.setOpen = (ev, newState: boolean) => {\n if (disabled) {\n return;\n }\n\n if (!newState && !freeform) {\n setValue(undefined);\n }\n\n setOpen(ev, newState);\n };\n\n // update value and active option based on input\n const onTriggerChange = (ev: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = ev.target.value;\n // update uncontrolled value\n baseState.setValue(inputValue);\n\n // handle updating active option based on input\n const matchingOption = getOptionFromInput(inputValue);\n setActiveOption(matchingOption);\n\n setFocusVisible(true);\n\n // clear selection for single-select if the input value no longer matches the selection\n if (!multiselect && selectedOptions.length === 1 && (inputValue.length < 1 || !matchingOption)) {\n clearSelection(ev);\n }\n };\n\n // open Combobox when typing\n const onTriggerKeyDown = (ev: React.KeyboardEvent<HTMLInputElement>) => {\n if (!open && getDropdownActionFromKey(ev) === 'Type') {\n baseState.setOpen(ev, true);\n }\n\n // clear activedescendant when moving the text insertion cursor\n if (ev.key === ArrowLeft || ev.key === ArrowRight) {\n setHideActiveDescendant(true);\n } else {\n setHideActiveDescendant(false);\n }\n };\n\n // resolve input and listbox slot props\n let triggerSlot: Slot<'input'>;\n let listboxSlot: Slot<typeof Listbox> | undefined;\n\n triggerSlot = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref: useMergedRefs(props.input?.ref, triggerRef),\n type: 'text',\n value: value ?? '',\n ...triggerNativeProps,\n },\n });\n\n triggerSlot.onChange = mergeCallbacks(triggerSlot.onChange, onTriggerChange);\n triggerSlot.onBlur = mergeCallbacks(triggerSlot.onBlur, onTriggerBlur);\n triggerSlot.onKeyDown = mergeCallbacks(triggerSlot.onKeyDown, onTriggerKeyDown);\n\n // only resolve listbox slot if needed\n listboxSlot =\n open || hasFocus\n ? resolveShorthand(props.listbox, {\n required: true,\n defaultProps: {\n children: props.children,\n style: popupDimensions,\n },\n })\n : undefined;\n\n [triggerSlot, listboxSlot] = useComboboxPopup(props, triggerSlot, listboxSlot);\n [triggerSlot, listboxSlot] = useTriggerListboxSlots(props, baseState, ref, triggerSlot, listboxSlot);\n\n if (hideActiveDescendant) {\n triggerSlot['aria-activedescendant'] = undefined;\n }\n\n const state: ComboboxState = {\n components: {\n root: 'div',\n input: 'input',\n expandIcon: 'span',\n listbox: Listbox,\n },\n root: resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n 'aria-owns': !inlinePopup ? listboxSlot?.id : undefined,\n ...rootNativeProps,\n },\n }),\n input: triggerSlot,\n listbox: listboxSlot,\n expandIcon: resolveShorthand(props.expandIcon, {\n required: true,\n defaultProps: {\n 'aria-expanded': open,\n children: <ChevronDownIcon />,\n role: 'button',\n },\n }),\n ...baseState,\n };\n\n state.root.ref = useMergedRefs(state.root.ref, rootRef);\n\n /* handle open/close + focus change when clicking expandIcon */\n const { onMouseDown: onIconMouseDown, onClick: onIconClick } = state.expandIcon || {};\n const onExpandIconMouseDown = useEventCallback(\n mergeCallbacks(onIconMouseDown, () => {\n // do not dismiss on blur when closing via clicking the icon\n if (open) {\n baseState.ignoreNextBlur.current = true;\n }\n }),\n );\n\n const onExpandIconClick = useEventCallback(\n mergeCallbacks(onIconClick, (event: React.MouseEvent<HTMLSpanElement>) => {\n // open and set focus\n state.setOpen(event, !state.open);\n triggerRef.current?.focus();\n\n // set focus visible=false, since this can only be done with the mouse/pointer\n setFocusVisible(false);\n }),\n );\n\n if (state.expandIcon) {\n state.expandIcon.onMouseDown = onExpandIconMouseDown;\n state.expandIcon.onClick = onExpandIconClick;\n\n // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,\n // using the following steps:\n // 1. If there is an aria-label, it is \"Open [aria-label]\"\n // 2. If there is an aria-labelledby, it is \"Open [aria-labelledby target]\" (using aria-labelledby + ids)\n // 3. If there is no aria-label/ledby attr, it falls back to \"Open\"\n // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179\n const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];\n const defaultOpenString = 'Open'; // this is english-only since it is the fallback\n if (!hasExpandLabel) {\n if (props['aria-labelledby']) {\n const chevronId = state.expandIcon.id ?? `${comboId}-chevron`;\n const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;\n\n state.expandIcon['aria-label'] = defaultOpenString;\n state.expandIcon.id = chevronId;\n state.expandIcon['aria-labelledby'] = chevronLabelledBy;\n } else if (props['aria-label']) {\n state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;\n } else {\n state.expandIcon['aria-label'] = defaultOpenString;\n }\n }\n }\n\n return state;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,eAAA,gBAAAD,OAAA;AACA,MAAAE,aAAA,gBAAAF,OAAA;AACA,MAAAG,iBAAA,gBAAAH,OAAA;AAQA,MAAAI,oBAAA,gBAAAJ,OAAA;AACA,MAAAK,sBAAA,gBAAAL,OAAA;AACA,MAAAM,kBAAA,gBAAAN,OAAA;AACA,MAAAO,wBAAA,gBAAAP,OAAA;AACA,MAAAQ,SAAA,gBAAAR,OAAA;AAMA;;;;;;;;;AASO,MAAMS,oBAAoB,GAAGA,CAACC,KAAoB,EAAEC,GAAgC,KAAmB;;EAC5G,MAAMC,SAAS,GAAGP,sBAAA,CAAAQ,oBAAoB,CAAC;IAAE,GAAGH,KAAK;IAAEI,QAAQ,EAAE;EAAI,CAAE,CAAC;EACpE,MAAM;IACJC,YAAY;IACZC,cAAc;IACdC,YAAY;IACZC,sBAAsB;IACtBC,QAAQ;IACRC,IAAI;IACJC,YAAY;IACZC,eAAe;IACfC,eAAe;IACfC,eAAe;IACfC,OAAO;IACPC,QAAQ;IACRC;EAAK,CACN,GAAGf,SAAS;EACb,MAAM;IAAEgB,QAAQ;IAAEC,QAAQ;IAAEC,WAAW;IAAEC;EAAW,CAAE,GAAGrB,KAAK;EAC9D,MAAMsB,OAAO,GAAG7B,iBAAA,CAAA8B,KAAK,CAAC,WAAW,CAAC;EAElC,MAAM;IAAEC,OAAO,EAAEC,kBAAkB;IAAEC,IAAI,EAAEC;EAAe,CAAE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,KAAK;AACd,CAAC;AAzPYsB,OAAA,CAAAhH,oBAAoB,GAAAA,oBAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Combobox/useCombobox.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowLeft, ArrowRight } from '@fluentui/keyboard-keys';\nimport { ChevronDownRegular as ChevronDownIcon } from '@fluentui/react-icons';\nimport { getPartitionedNativeProps, resolveShorthand, mergeCallbacks, useEventCallback, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport { getDropdownActionFromKey } from '../../utils/dropdownKeyActions';\nimport { useComboboxBaseState } from '../../utils/useComboboxBaseState';\nimport { useComboboxPopup } from '../../utils/useComboboxPopup';\nimport { useTriggerListboxSlots } from '../../utils/useTriggerListboxSlots';\nimport { Listbox } from '../Listbox/Listbox';\n/**\n * Create the state required to render Combobox.\n *\n * The returned state can be modified with hooks such as useComboboxStyles_unstable,\n * before being passed to renderCombobox_unstable.\n *\n * @param props - props from this instance of Combobox\n * @param ref - reference to root HTMLElement of Combobox\n */\nexport const useCombobox_unstable = (props, ref) => {\n var _props_input;\n const baseState = useComboboxBaseState({\n ...props,\n editable: true\n });\n const {\n activeOption,\n clearSelection,\n getIndexOfId,\n getOptionsMatchingText,\n hasFocus,\n open,\n selectOption,\n selectedOptions,\n setActiveOption,\n setFocusVisible,\n setOpen,\n setValue,\n value\n } = baseState;\n const {\n disabled,\n freeform,\n inlinePopup,\n multiselect\n } = props;\n const comboId = useId('combobox-');\n const {\n primary: triggerNativeProps,\n root: rootNativeProps\n } = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['children', 'size']\n });\n const rootRef = React.useRef(null);\n const triggerRef = React.useRef(null);\n // NVDA and JAWS have bugs that suppress reading the input value text when aria-activedescendant is set\n // To prevent this, we clear the HTML attribute (but save the state) when a user presses left/right arrows\n // ref: https://github.com/microsoft/fluentui/issues/26359#issuecomment-1397759888\n const [hideActiveDescendant, setHideActiveDescendant] = React.useState(false);\n // calculate listbox width style based on trigger width\n const [popupDimensions, setPopupDimensions] = React.useState();\n React.useEffect(() => {\n // only recalculate width when opening\n if (open) {\n var _rootRef_current;\n const width = `${(_rootRef_current = rootRef.current) === null || _rootRef_current === void 0 ? void 0 : _rootRef_current.clientWidth}px`;\n if (width !== (popupDimensions === null || popupDimensions === void 0 ? void 0 : popupDimensions.width)) {\n setPopupDimensions({\n width\n });\n }\n }\n }, [open, popupDimensions]);\n // set active option and selection based on typing\n const getOptionFromInput = inputValue => {\n const searchString = inputValue === null || inputValue === void 0 ? void 0 : inputValue.trim().toLowerCase();\n if (!searchString || searchString.length === 0) {\n return;\n }\n const matcher = optionText => optionText.toLowerCase().indexOf(searchString) === 0;\n const matches = getOptionsMatchingText(matcher);\n // return first matching option after the current active option, looping back to the top\n if (matches.length > 1 && activeOption) {\n const startIndex = getIndexOfId(activeOption.id);\n const nextMatch = matches.find(option => getIndexOfId(option.id) >= startIndex);\n return nextMatch !== null && nextMatch !== void 0 ? nextMatch : matches[0];\n }\n var _matches_;\n return (_matches_ = matches[0]) !== null && _matches_ !== void 0 ? _matches_ : undefined;\n };\n /* Handle typed input */ // reset any typed value when an option is selected\n baseState.selectOption = (ev, option) => {\n setValue(undefined);\n selectOption(ev, option);\n };\n const onTriggerBlur = ev => {\n // handle selection and updating value if freeform is false\n if (!baseState.open && !freeform) {\n // select matching option, if the value fully matches\n if (value && activeOption && value.trim().toLowerCase() === (activeOption === null || activeOption === void 0 ? void 0 : activeOption.text.toLowerCase())) {\n baseState.selectOption(ev, activeOption);\n }\n // reset typed value when the input loses focus while collapsed, unless freeform is true\n setValue(undefined);\n }\n };\n baseState.setOpen = (ev, newState) => {\n if (disabled) {\n return;\n }\n if (!newState && !freeform) {\n setValue(undefined);\n }\n setOpen(ev, newState);\n };\n // update value and active option based on input\n const onTriggerChange = ev => {\n const inputValue = ev.target.value;\n // update uncontrolled value\n baseState.setValue(inputValue);\n // handle updating active option based on input\n const matchingOption = getOptionFromInput(inputValue);\n setActiveOption(matchingOption);\n setFocusVisible(true);\n // clear selection for single-select if the input value no longer matches the selection\n if (!multiselect && selectedOptions.length === 1 && (inputValue.length < 1 || !matchingOption)) {\n clearSelection(ev);\n }\n };\n // open Combobox when typing\n const onTriggerKeyDown = ev => {\n if (!open && getDropdownActionFromKey(ev) === 'Type') {\n baseState.setOpen(ev, true);\n }\n // clear activedescendant when moving the text insertion cursor\n if (ev.key === ArrowLeft || ev.key === ArrowRight) {\n setHideActiveDescendant(true);\n } else {\n setHideActiveDescendant(false);\n }\n };\n // resolve input and listbox slot props\n let triggerSlot;\n let listboxSlot;\n triggerSlot = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref: useMergedRefs((_props_input = props.input) === null || _props_input === void 0 ? void 0 : _props_input.ref, triggerRef),\n type: 'text',\n value: value !== null && value !== void 0 ? value : '',\n ...triggerNativeProps\n }\n });\n triggerSlot.onChange = mergeCallbacks(triggerSlot.onChange, onTriggerChange);\n triggerSlot.onBlur = mergeCallbacks(triggerSlot.onBlur, onTriggerBlur);\n triggerSlot.onKeyDown = mergeCallbacks(triggerSlot.onKeyDown, onTriggerKeyDown);\n // only resolve listbox slot if needed\n listboxSlot = open || hasFocus ? resolveShorthand(props.listbox, {\n required: true,\n defaultProps: {\n children: props.children,\n style: popupDimensions\n }\n }) : undefined;\n [triggerSlot, listboxSlot] = useComboboxPopup(props, triggerSlot, listboxSlot);\n [triggerSlot, listboxSlot] = useTriggerListboxSlots(props, baseState, ref, triggerSlot, listboxSlot);\n if (hideActiveDescendant) {\n triggerSlot['aria-activedescendant'] = undefined;\n }\n const state = {\n components: {\n root: 'div',\n input: 'input',\n expandIcon: 'span',\n listbox: Listbox\n },\n root: resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n 'aria-owns': !inlinePopup ? listboxSlot === null || listboxSlot === void 0 ? void 0 : listboxSlot.id : undefined,\n ...rootNativeProps\n }\n }),\n input: triggerSlot,\n listbox: listboxSlot,\n expandIcon: resolveShorthand(props.expandIcon, {\n required: true,\n defaultProps: {\n 'aria-expanded': open,\n children: /*#__PURE__*/React.createElement(ChevronDownIcon, null),\n role: 'button'\n }\n }),\n ...baseState\n };\n state.root.ref = useMergedRefs(state.root.ref, rootRef);\n /* handle open/close + focus change when clicking expandIcon */\n const {\n onMouseDown: onIconMouseDown,\n onClick: onIconClick\n } = state.expandIcon || {};\n const onExpandIconMouseDown = useEventCallback(mergeCallbacks(onIconMouseDown, () => {\n // do not dismiss on blur when closing via clicking the icon\n if (open) {\n baseState.ignoreNextBlur.current = true;\n }\n }));\n const onExpandIconClick = useEventCallback(mergeCallbacks(onIconClick, event => {\n var _triggerRef_current;\n // open and set focus\n state.setOpen(event, !state.open);\n (_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.focus();\n // set focus visible=false, since this can only be done with the mouse/pointer\n setFocusVisible(false);\n }));\n if (state.expandIcon) {\n state.expandIcon.onMouseDown = onExpandIconMouseDown;\n state.expandIcon.onClick = onExpandIconClick;\n // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,\n // using the following steps:\n // 1. If there is an aria-label, it is \"Open [aria-label]\"\n // 2. If there is an aria-labelledby, it is \"Open [aria-labelledby target]\" (using aria-labelledby + ids)\n // 3. If there is no aria-label/ledby attr, it falls back to \"Open\"\n // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179\n const hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];\n const defaultOpenString = 'Open'; // this is english-only since it is the fallback\n if (!hasExpandLabel) {\n if (props['aria-labelledby']) {\n var _state_expandIcon_id;\n const chevronId = (_state_expandIcon_id = state.expandIcon.id) !== null && _state_expandIcon_id !== void 0 ? _state_expandIcon_id : `${comboId}-chevron`;\n const chevronLabelledBy = `${chevronId} ${state.input['aria-labelledby']}`;\n state.expandIcon['aria-label'] = defaultOpenString;\n state.expandIcon.id = chevronId;\n state.expandIcon['aria-labelledby'] = chevronLabelledBy;\n } else if (props['aria-label']) {\n state.expandIcon['aria-label'] = `${defaultOpenString} ${props['aria-label']}`;\n } else {\n state.expandIcon['aria-label'] = defaultOpenString;\n }\n }\n }\n return state;\n};\n//# sourceMappingURL=useCombobox.js.map"],"names":["useCombobox_unstable","props","ref","_props_input","baseState","useComboboxBaseState","editable","activeOption","clearSelection","getIndexOfId","getOptionsMatchingText","hasFocus","open","selectOption","selectedOptions","setActiveOption","setFocusVisible","setOpen","setValue","value","disabled","freeform","inlinePopup","multiselect","comboId","useId","primary","triggerNativeProps","root","rootNativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","rootRef","React","useRef","triggerRef","hideActiveDescendant","setHideActiveDescendant","useState","popupDimensions","setPopupDimensions","useEffect","_rootRef_current","width","current","clientWidth","getOptionFromInput","inputValue","searchString","trim","toLowerCase","length","matcher","optionText","indexOf","matches","startIndex","id","nextMatch","find","option","_matches_","undefined","ev","onTriggerBlur","text","newState","onTriggerChange","target","matchingOption","onTriggerKeyDown","getDropdownActionFromKey","key","ArrowLeft","ArrowRight","triggerSlot","listboxSlot","resolveShorthand","input","required","defaultProps","useMergedRefs","type","onChange","mergeCallbacks","onBlur","onKeyDown","listbox","children","style","useComboboxPopup","useTriggerListboxSlots","state","components","expandIcon","Listbox","createElement","ChevronDownIcon","role","onMouseDown","onIconMouseDown","onClick","onIconClick","onExpandIconMouseDown","useEventCallback","ignoreNextBlur","onExpandIconClick","event","_triggerRef_current","focus","hasExpandLabel","defaultOpenString","_state_expandIcon_id","chevronId","chevronLabelledBy"],"mappings":";;;;+BAkBaA;;aAAAA;;;6DAlBU;8BACe;4BACgB;gCAC8D;oCAC3E;sCACJ;kCACJ;wCACM;yBACf;AAUjB,MAAMA,uBAAuB,CAACC,OAAOC,MAAQ;IAClD,IAAIC;IACJ,MAAMC,YAAYC,IAAAA,0CAAoB,EAAC;QACrC,GAAGJ,KAAK;QACRK,UAAU,IAAI;IAChB;IACA,MAAM,EACJC,aAAY,EACZC,eAAc,EACdC,aAAY,EACZC,uBAAsB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