@fluentui/react-combobox 9.0.0-beta.9 → 9.0.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 (302) hide show
  1. package/CHANGELOG.json +848 -1
  2. package/CHANGELOG.md +248 -2
  3. package/README.md +1 -3
  4. package/dist/index.d.ts +62 -11
  5. package/lib/Combobox.js.map +1 -1
  6. package/lib/ComboboxField.js +2 -0
  7. package/lib/ComboboxField.js.map +1 -0
  8. package/lib/Dropdown.js.map +1 -1
  9. package/lib/Listbox.js.map +1 -1
  10. package/lib/Option.js.map +1 -1
  11. package/lib/OptionGroup.js.map +1 -1
  12. package/lib/components/Combobox/Combobox.js +0 -1
  13. package/lib/components/Combobox/Combobox.js.map +1 -1
  14. package/lib/components/Combobox/Combobox.types.js.map +1 -1
  15. package/lib/components/Combobox/index.js.map +1 -1
  16. package/lib/components/Combobox/renderCombobox.js +10 -6
  17. package/lib/components/Combobox/renderCombobox.js.map +1 -1
  18. package/lib/components/Combobox/useCombobox.js +107 -70
  19. package/lib/components/Combobox/useCombobox.js.map +1 -1
  20. package/lib/components/Combobox/useComboboxStyles.js +246 -185
  21. package/lib/components/Combobox/useComboboxStyles.js.map +1 -1
  22. package/lib/components/ComboboxField/ComboboxField.js +8 -0
  23. package/lib/components/ComboboxField/ComboboxField.js.map +1 -0
  24. package/lib/components/ComboboxField/index.js +2 -0
  25. package/lib/components/ComboboxField/index.js.map +1 -0
  26. package/lib/components/Dropdown/Dropdown.js +0 -1
  27. package/lib/components/Dropdown/Dropdown.js.map +1 -1
  28. package/lib/components/Dropdown/Dropdown.types.js.map +1 -1
  29. package/lib/components/Dropdown/index.js.map +1 -1
  30. package/lib/components/Dropdown/renderDropdown.js +10 -6
  31. package/lib/components/Dropdown/renderDropdown.js.map +1 -1
  32. package/lib/components/Dropdown/useDropdown.js +25 -36
  33. package/lib/components/Dropdown/useDropdown.js.map +1 -1
  34. package/lib/components/Dropdown/useDropdownStyles.js +236 -176
  35. package/lib/components/Dropdown/useDropdownStyles.js.map +1 -1
  36. package/lib/components/Listbox/Listbox.js +0 -1
  37. package/lib/components/Listbox/Listbox.js.map +1 -1
  38. package/lib/components/Listbox/Listbox.types.js.map +1 -1
  39. package/lib/components/Listbox/index.js.map +1 -1
  40. package/lib/components/Listbox/renderListbox.js +2 -2
  41. package/lib/components/Listbox/renderListbox.js.map +1 -1
  42. package/lib/components/Listbox/useListbox.js +15 -17
  43. package/lib/components/Listbox/useListbox.js.map +1 -1
  44. package/lib/components/Listbox/useListboxStyles.js +16 -20
  45. package/lib/components/Listbox/useListboxStyles.js.map +1 -1
  46. package/lib/components/Option/Option.js +0 -1
  47. package/lib/components/Option/Option.js.map +1 -1
  48. package/lib/components/Option/Option.types.js.map +1 -1
  49. package/lib/components/Option/index.js.map +1 -1
  50. package/lib/components/Option/renderOption.js +4 -3
  51. package/lib/components/Option/renderOption.js.map +1 -1
  52. package/lib/components/Option/useOption.js +46 -39
  53. package/lib/components/Option/useOption.js.map +1 -1
  54. package/lib/components/Option/useOptionStyles.js +101 -79
  55. package/lib/components/Option/useOptionStyles.js.map +1 -1
  56. package/lib/components/OptionGroup/OptionGroup.js +0 -1
  57. package/lib/components/OptionGroup/OptionGroup.js.map +1 -1
  58. package/lib/components/OptionGroup/OptionGroup.types.js.map +1 -1
  59. package/lib/components/OptionGroup/index.js.map +1 -1
  60. package/lib/components/OptionGroup/renderOptionGroup.js +4 -3
  61. package/lib/components/OptionGroup/renderOptionGroup.js.map +1 -1
  62. package/lib/components/OptionGroup/useOptionGroup.js +0 -1
  63. package/lib/components/OptionGroup/useOptionGroup.js.map +1 -1
  64. package/lib/components/OptionGroup/useOptionGroupStyles.js +29 -34
  65. package/lib/components/OptionGroup/useOptionGroupStyles.js.map +1 -1
  66. package/lib/contexts/ComboboxContext.js +9 -11
  67. package/lib/contexts/ComboboxContext.js.map +1 -1
  68. package/lib/contexts/ListboxContext.js +7 -9
  69. package/lib/contexts/ListboxContext.js.map +1 -1
  70. package/lib/contexts/useComboboxContextValues.js.map +1 -1
  71. package/lib/contexts/useListboxContextValues.js +2 -2
  72. package/lib/contexts/useListboxContextValues.js.map +1 -1
  73. package/lib/index.js +6 -0
  74. package/lib/index.js.map +1 -1
  75. package/lib/utils/ComboboxBase.types.js.map +1 -1
  76. package/lib/utils/OptionCollection.types.js.map +1 -1
  77. package/lib/utils/Selection.types.js.map +1 -1
  78. package/lib/utils/dropdownKeyActions.js +12 -33
  79. package/lib/utils/dropdownKeyActions.js.map +1 -1
  80. package/lib/utils/internalTokens.js.map +1 -1
  81. package/lib/utils/useComboboxBaseState.js +29 -30
  82. package/lib/utils/useComboboxBaseState.js.map +1 -1
  83. package/lib/utils/useComboboxPopup.js +6 -4
  84. package/lib/utils/useComboboxPopup.js.map +1 -1
  85. package/lib/utils/useOptionCollection.js +13 -23
  86. package/lib/utils/useOptionCollection.js.map +1 -1
  87. package/lib/utils/useScrollOptionsIntoView.js +36 -0
  88. package/lib/utils/useScrollOptionsIntoView.js.map +1 -0
  89. package/lib/utils/useSelection.js +9 -12
  90. package/lib/utils/useSelection.js.map +1 -1
  91. package/lib/utils/useTriggerListboxSlots.js +34 -40
  92. package/lib/utils/useTriggerListboxSlots.js.map +1 -1
  93. package/lib-amd/Combobox.js +6 -0
  94. package/lib-amd/Combobox.js.map +1 -0
  95. package/lib-amd/ComboboxField.js +6 -0
  96. package/lib-amd/ComboboxField.js.map +1 -0
  97. package/lib-amd/Dropdown.js +6 -0
  98. package/lib-amd/Dropdown.js.map +1 -0
  99. package/lib-amd/Listbox.js +6 -0
  100. package/lib-amd/Listbox.js.map +1 -0
  101. package/lib-amd/Option.js +6 -0
  102. package/lib-amd/Option.js.map +1 -0
  103. package/lib-amd/OptionGroup.js +6 -0
  104. package/lib-amd/OptionGroup.js.map +1 -0
  105. package/lib-amd/components/Combobox/Combobox.js +16 -0
  106. package/lib-amd/components/Combobox/Combobox.js.map +1 -0
  107. package/lib-amd/components/Combobox/Combobox.types.js +5 -0
  108. package/lib-amd/components/Combobox/Combobox.types.js.map +1 -0
  109. package/lib-amd/components/Combobox/index.js +10 -0
  110. package/lib-amd/components/Combobox/index.js.map +1 -0
  111. package/lib-amd/components/Combobox/renderCombobox.js +20 -0
  112. package/lib-amd/components/Combobox/renderCombobox.js.map +1 -0
  113. package/lib-amd/components/Combobox/useCombobox.js +206 -0
  114. package/lib-amd/components/Combobox/useCombobox.js.map +1 -0
  115. package/lib-amd/components/Combobox/useComboboxStyles.js +152 -0
  116. package/lib-amd/components/Combobox/useComboboxStyles.js.map +1 -0
  117. package/lib-amd/components/ComboboxField/ComboboxField.js +10 -0
  118. package/lib-amd/components/ComboboxField/ComboboxField.js.map +1 -0
  119. package/lib-amd/components/ComboboxField/index.js +6 -0
  120. package/lib-amd/components/ComboboxField/index.js.map +1 -0
  121. package/lib-amd/components/Dropdown/Dropdown.js +16 -0
  122. package/lib-amd/components/Dropdown/Dropdown.js.map +1 -0
  123. package/lib-amd/components/Dropdown/Dropdown.types.js +5 -0
  124. package/lib-amd/components/Dropdown/Dropdown.types.js.map +1 -0
  125. package/lib-amd/components/Dropdown/index.js +10 -0
  126. package/lib-amd/components/Dropdown/index.js.map +1 -0
  127. package/lib-amd/components/Dropdown/renderDropdown.js +21 -0
  128. package/lib-amd/components/Dropdown/renderDropdown.js.map +1 -0
  129. package/lib-amd/components/Dropdown/useDropdown.js +121 -0
  130. package/lib-amd/components/Dropdown/useDropdown.js.map +1 -0
  131. package/lib-amd/components/Dropdown/useDropdownStyles.js +127 -0
  132. package/lib-amd/components/Dropdown/useDropdownStyles.js.map +1 -0
  133. package/lib-amd/components/Listbox/Listbox.js +16 -0
  134. package/lib-amd/components/Listbox/Listbox.js.map +1 -0
  135. package/lib-amd/components/Listbox/Listbox.types.js +5 -0
  136. package/lib-amd/components/Listbox/Listbox.types.js.map +1 -0
  137. package/lib-amd/components/Listbox/index.js +10 -0
  138. package/lib-amd/components/Listbox/index.js.map +1 -0
  139. package/lib-amd/components/Listbox/renderListbox.js +15 -0
  140. package/lib-amd/components/Listbox/renderListbox.js.map +1 -0
  141. package/lib-amd/components/Listbox/useListbox.js +80 -0
  142. package/lib-amd/components/Listbox/useListbox.js.map +1 -0
  143. package/lib-amd/components/Listbox/useListboxStyles.js +24 -0
  144. package/lib-amd/components/Listbox/useListboxStyles.js.map +1 -0
  145. package/lib-amd/components/Option/Option.js +15 -0
  146. package/lib-amd/components/Option/Option.js.map +1 -0
  147. package/lib-amd/components/Option/Option.types.js +5 -0
  148. package/lib-amd/components/Option/Option.types.js.map +1 -0
  149. package/lib-amd/components/Option/index.js +10 -0
  150. package/lib-amd/components/Option/index.js.map +1 -0
  151. package/lib-amd/components/Option/renderOption.js +16 -0
  152. package/lib-amd/components/Option/renderOption.js.map +1 -0
  153. package/lib-amd/components/Option/useOption.js +117 -0
  154. package/lib-amd/components/Option/useOption.js.map +1 -0
  155. package/lib-amd/components/Option/useOptionStyles.js +73 -0
  156. package/lib-amd/components/Option/useOptionStyles.js.map +1 -0
  157. package/lib-amd/components/OptionGroup/OptionGroup.js +15 -0
  158. package/lib-amd/components/OptionGroup/OptionGroup.js.map +1 -0
  159. package/lib-amd/components/OptionGroup/OptionGroup.types.js +5 -0
  160. package/lib-amd/components/OptionGroup/OptionGroup.types.js.map +1 -0
  161. package/lib-amd/components/OptionGroup/index.js +10 -0
  162. package/lib-amd/components/OptionGroup/index.js.map +1 -0
  163. package/lib-amd/components/OptionGroup/renderOptionGroup.js +16 -0
  164. package/lib-amd/components/OptionGroup/renderOptionGroup.js.map +1 -0
  165. package/lib-amd/components/OptionGroup/useOptionGroup.js +33 -0
  166. package/lib-amd/components/OptionGroup/useOptionGroup.js.map +1 -0
  167. package/lib-amd/components/OptionGroup/useOptionGroupStyles.js +34 -0
  168. package/lib-amd/components/OptionGroup/useOptionGroupStyles.js.map +1 -0
  169. package/lib-amd/contexts/ComboboxContext.js +28 -0
  170. package/lib-amd/contexts/ComboboxContext.js.map +1 -0
  171. package/lib-amd/contexts/ListboxContext.js +23 -0
  172. package/lib-amd/contexts/ListboxContext.js.map +1 -0
  173. package/lib-amd/contexts/useComboboxContextValues.js +23 -0
  174. package/lib-amd/contexts/useComboboxContextValues.js.map +1 -0
  175. package/lib-amd/contexts/useListboxContextValues.js +24 -0
  176. package/lib-amd/contexts/useListboxContextValues.js.map +1 -0
  177. package/lib-amd/index.js +37 -0
  178. package/lib-amd/index.js.map +1 -0
  179. package/lib-amd/utils/ComboboxBase.types.js +5 -0
  180. package/lib-amd/utils/ComboboxBase.types.js.map +1 -0
  181. package/lib-amd/utils/OptionCollection.types.js +5 -0
  182. package/lib-amd/utils/OptionCollection.types.js.map +1 -0
  183. package/lib-amd/utils/Selection.types.js +5 -0
  184. package/lib-amd/utils/Selection.types.js.map +1 -0
  185. package/lib-amd/utils/dropdownKeyActions.js +85 -0
  186. package/lib-amd/utils/dropdownKeyActions.js.map +1 -0
  187. package/lib-amd/utils/internalTokens.js +11 -0
  188. package/lib-amd/utils/internalTokens.js.map +1 -0
  189. package/lib-amd/utils/useComboboxBaseState.js +76 -0
  190. package/lib-amd/utils/useComboboxBaseState.js.map +1 -0
  191. package/lib-amd/utils/useComboboxPopup.js +16 -0
  192. package/lib-amd/utils/useComboboxPopup.js.map +1 -0
  193. package/lib-amd/utils/useOptionCollection.js +65 -0
  194. package/lib-amd/utils/useOptionCollection.js.map +1 -0
  195. package/lib-amd/utils/useScrollOptionsIntoView.js +33 -0
  196. package/lib-amd/utils/useScrollOptionsIntoView.js.map +1 -0
  197. package/lib-amd/utils/useSelection.js +42 -0
  198. package/lib-amd/utils/useSelection.js.map +1 -0
  199. package/lib-amd/utils/useTriggerListboxSlots.js +104 -0
  200. package/lib-amd/utils/useTriggerListboxSlots.js.map +1 -0
  201. package/lib-commonjs/Combobox.js +0 -2
  202. package/lib-commonjs/Combobox.js.map +1 -1
  203. package/lib-commonjs/ComboboxField.js +8 -0
  204. package/lib-commonjs/ComboboxField.js.map +1 -0
  205. package/lib-commonjs/Dropdown.js +0 -2
  206. package/lib-commonjs/Dropdown.js.map +1 -1
  207. package/lib-commonjs/Listbox.js +0 -2
  208. package/lib-commonjs/Listbox.js.map +1 -1
  209. package/lib-commonjs/Option.js +0 -2
  210. package/lib-commonjs/Option.js.map +1 -1
  211. package/lib-commonjs/OptionGroup.js +0 -2
  212. package/lib-commonjs/OptionGroup.js.map +1 -1
  213. package/lib-commonjs/components/Combobox/Combobox.js +0 -7
  214. package/lib-commonjs/components/Combobox/Combobox.js.map +1 -1
  215. package/lib-commonjs/components/Combobox/Combobox.types.js.map +1 -1
  216. package/lib-commonjs/components/Combobox/index.js +0 -6
  217. package/lib-commonjs/components/Combobox/index.js.map +1 -1
  218. package/lib-commonjs/components/Combobox/renderCombobox.js +10 -12
  219. package/lib-commonjs/components/Combobox/renderCombobox.js.map +1 -1
  220. package/lib-commonjs/components/Combobox/useCombobox.js +106 -78
  221. package/lib-commonjs/components/Combobox/useCombobox.js.map +1 -1
  222. package/lib-commonjs/components/Combobox/useComboboxStyles.js +245 -189
  223. package/lib-commonjs/components/Combobox/useComboboxStyles.js.map +1 -1
  224. package/lib-commonjs/components/ComboboxField/ComboboxField.js +14 -0
  225. package/lib-commonjs/components/ComboboxField/ComboboxField.js.map +1 -0
  226. package/lib-commonjs/components/ComboboxField/index.js +8 -0
  227. package/lib-commonjs/components/ComboboxField/index.js.map +1 -0
  228. package/lib-commonjs/components/Dropdown/Dropdown.js +0 -7
  229. package/lib-commonjs/components/Dropdown/Dropdown.js.map +1 -1
  230. package/lib-commonjs/components/Dropdown/Dropdown.types.js.map +1 -1
  231. package/lib-commonjs/components/Dropdown/index.js +0 -6
  232. package/lib-commonjs/components/Dropdown/index.js.map +1 -1
  233. package/lib-commonjs/components/Dropdown/renderDropdown.js +10 -12
  234. package/lib-commonjs/components/Dropdown/renderDropdown.js.map +1 -1
  235. package/lib-commonjs/components/Dropdown/useDropdown.js +25 -47
  236. package/lib-commonjs/components/Dropdown/useDropdown.js.map +1 -1
  237. package/lib-commonjs/components/Dropdown/useDropdownStyles.js +235 -180
  238. package/lib-commonjs/components/Dropdown/useDropdownStyles.js.map +1 -1
  239. package/lib-commonjs/components/Listbox/Listbox.js +0 -7
  240. package/lib-commonjs/components/Listbox/Listbox.js.map +1 -1
  241. package/lib-commonjs/components/Listbox/Listbox.types.js.map +1 -1
  242. package/lib-commonjs/components/Listbox/index.js +0 -6
  243. package/lib-commonjs/components/Listbox/index.js.map +1 -1
  244. package/lib-commonjs/components/Listbox/renderListbox.js +2 -7
  245. package/lib-commonjs/components/Listbox/renderListbox.js.map +1 -1
  246. package/lib-commonjs/components/Listbox/useListbox.js +14 -25
  247. package/lib-commonjs/components/Listbox/useListbox.js.map +1 -1
  248. package/lib-commonjs/components/Listbox/useListboxStyles.js +16 -24
  249. package/lib-commonjs/components/Listbox/useListboxStyles.js.map +1 -1
  250. package/lib-commonjs/components/Option/Option.js +0 -6
  251. package/lib-commonjs/components/Option/Option.js.map +1 -1
  252. package/lib-commonjs/components/Option/Option.types.js.map +1 -1
  253. package/lib-commonjs/components/Option/index.js +0 -6
  254. package/lib-commonjs/components/Option/index.js.map +1 -1
  255. package/lib-commonjs/components/Option/renderOption.js +4 -7
  256. package/lib-commonjs/components/Option/renderOption.js.map +1 -1
  257. package/lib-commonjs/components/Option/useOption.js +45 -45
  258. package/lib-commonjs/components/Option/useOption.js.map +1 -1
  259. package/lib-commonjs/components/Option/useOptionStyles.js +101 -83
  260. package/lib-commonjs/components/Option/useOptionStyles.js.map +1 -1
  261. package/lib-commonjs/components/OptionGroup/OptionGroup.js +0 -6
  262. package/lib-commonjs/components/OptionGroup/OptionGroup.js.map +1 -1
  263. package/lib-commonjs/components/OptionGroup/OptionGroup.types.js.map +1 -1
  264. package/lib-commonjs/components/OptionGroup/index.js +0 -6
  265. package/lib-commonjs/components/OptionGroup/index.js.map +1 -1
  266. package/lib-commonjs/components/OptionGroup/renderOptionGroup.js +4 -7
  267. package/lib-commonjs/components/OptionGroup/renderOptionGroup.js.map +1 -1
  268. package/lib-commonjs/components/OptionGroup/useOptionGroup.js +0 -4
  269. package/lib-commonjs/components/OptionGroup/useOptionGroup.js.map +1 -1
  270. package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.js +29 -38
  271. package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.js.map +1 -1
  272. package/lib-commonjs/contexts/ComboboxContext.js +10 -14
  273. package/lib-commonjs/contexts/ComboboxContext.js.map +1 -1
  274. package/lib-commonjs/contexts/ListboxContext.js +8 -12
  275. package/lib-commonjs/contexts/ListboxContext.js.map +1 -1
  276. package/lib-commonjs/contexts/useComboboxContextValues.js +0 -2
  277. package/lib-commonjs/contexts/useComboboxContextValues.js.map +1 -1
  278. package/lib-commonjs/contexts/useListboxContextValues.js +2 -6
  279. package/lib-commonjs/contexts/useListboxContextValues.js.map +1 -1
  280. package/lib-commonjs/index.js +43 -11
  281. package/lib-commonjs/index.js.map +1 -1
  282. package/lib-commonjs/utils/ComboboxBase.types.js.map +1 -1
  283. package/lib-commonjs/utils/OptionCollection.types.js.map +1 -1
  284. package/lib-commonjs/utils/Selection.types.js.map +1 -1
  285. package/lib-commonjs/utils/dropdownKeyActions.js +12 -37
  286. package/lib-commonjs/utils/dropdownKeyActions.js.map +1 -1
  287. package/lib-commonjs/utils/internalTokens.js.map +1 -1
  288. package/lib-commonjs/utils/useComboboxBaseState.js +29 -36
  289. package/lib-commonjs/utils/useComboboxBaseState.js.map +1 -1
  290. package/lib-commonjs/utils/useComboboxPopup.js +6 -8
  291. package/lib-commonjs/utils/useComboboxPopup.js.map +1 -1
  292. package/lib-commonjs/utils/useOptionCollection.js +13 -26
  293. package/lib-commonjs/utils/useOptionCollection.js.map +1 -1
  294. package/lib-commonjs/utils/useScrollOptionsIntoView.js +43 -0
  295. package/lib-commonjs/utils/useScrollOptionsIntoView.js.map +1 -0
  296. package/lib-commonjs/utils/useSelection.js +9 -15
  297. package/lib-commonjs/utils/useSelection.js.map +1 -1
  298. package/lib-commonjs/utils/useTriggerListboxSlots.js +33 -44
  299. package/lib-commonjs/utils/useTriggerListboxSlots.js.map +1 -1
  300. package/package.json +23 -22
  301. package/Spec-migration.md +0 -13
  302. package/Spec.md +0 -520
@@ -0,0 +1,206 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/keyboard-keys", "@fluentui/react-icons", "@fluentui/react-utilities", "../../utils/dropdownKeyActions", "../../utils/useComboboxBaseState", "../../utils/useComboboxPopup", "../../utils/useTriggerListboxSlots", "../Listbox/Listbox"], function (require, exports, tslib_1, React, keyboard_keys_1, react_icons_1, react_utilities_1, dropdownKeyActions_1, useComboboxBaseState_1, useComboboxPopup_1, useTriggerListboxSlots_1, Listbox_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useCombobox_unstable = void 0;
5
+ /**
6
+ * Create the state required to render Combobox.
7
+ *
8
+ * The returned state can be modified with hooks such as useComboboxStyles_unstable,
9
+ * before being passed to renderCombobox_unstable.
10
+ *
11
+ * @param props - props from this instance of Combobox
12
+ * @param ref - reference to root HTMLElement of Combobox
13
+ */
14
+ var useCombobox_unstable = function (props, ref) {
15
+ var _a, _b;
16
+ var _c, _d;
17
+ var baseState = useComboboxBaseState_1.useComboboxBaseState(tslib_1.__assign(tslib_1.__assign({}, props), { editable: true }));
18
+ var activeOption = baseState.activeOption, clearSelection = baseState.clearSelection, getIndexOfId = baseState.getIndexOfId, getOptionsMatchingText = baseState.getOptionsMatchingText, hasFocus = baseState.hasFocus, open = baseState.open, selectOption = baseState.selectOption, selectedOptions = baseState.selectedOptions, setActiveOption = baseState.setActiveOption, setFocusVisible = baseState.setFocusVisible, setOpen = baseState.setOpen, setValue = baseState.setValue, value = baseState.value;
19
+ var disabled = props.disabled, freeform = props.freeform, inlinePopup = props.inlinePopup, multiselect = props.multiselect;
20
+ var comboId = react_utilities_1.useId('combobox-');
21
+ var _e = react_utilities_1.getPartitionedNativeProps({
22
+ props: props,
23
+ primarySlotTagName: 'input',
24
+ excludedPropNames: ['children', 'size'],
25
+ }), triggerNativeProps = _e.primary, rootNativeProps = _e.root;
26
+ var rootRef = React.useRef(null);
27
+ var triggerRef = React.useRef(null);
28
+ // NVDA and JAWS have bugs that suppress reading the input value text when aria-activedescendant is set
29
+ // To prevent this, we clear the HTML attribute (but save the state) when a user presses left/right arrows
30
+ // ref: https://github.com/microsoft/fluentui/issues/26359#issuecomment-1397759888
31
+ var _f = React.useState(false), hideActiveDescendant = _f[0], setHideActiveDescendant = _f[1];
32
+ // calculate listbox width style based on trigger width
33
+ var _g = React.useState(), popupDimensions = _g[0], setPopupDimensions = _g[1];
34
+ React.useEffect(function () {
35
+ var _a;
36
+ // only recalculate width when opening
37
+ if (open) {
38
+ var width = ((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) + "px";
39
+ if (width !== (popupDimensions === null || popupDimensions === void 0 ? void 0 : popupDimensions.width)) {
40
+ setPopupDimensions({ width: width });
41
+ }
42
+ }
43
+ }, [open, popupDimensions]);
44
+ // set active option and selection based on typing
45
+ var getOptionFromInput = function (inputValue) {
46
+ var _a;
47
+ var searchString = inputValue === null || inputValue === void 0 ? void 0 : inputValue.trim().toLowerCase();
48
+ if (!searchString || searchString.length === 0) {
49
+ return;
50
+ }
51
+ var matcher = function (optionText) { return optionText.toLowerCase().indexOf(searchString) === 0; };
52
+ var matches = getOptionsMatchingText(matcher);
53
+ // return first matching option after the current active option, looping back to the top
54
+ if (matches.length > 1 && activeOption) {
55
+ var startIndex_1 = getIndexOfId(activeOption.id);
56
+ var nextMatch = matches.find(function (option) { return getIndexOfId(option.id) >= startIndex_1; });
57
+ return nextMatch !== null && nextMatch !== void 0 ? nextMatch : matches[0];
58
+ }
59
+ return (_a = matches[0]) !== null && _a !== void 0 ? _a : undefined;
60
+ };
61
+ /* Handle typed input */
62
+ // reset any typed value when an option is selected
63
+ baseState.selectOption = function (ev, option) {
64
+ setValue(undefined);
65
+ selectOption(ev, option);
66
+ };
67
+ var onTriggerBlur = function (ev) {
68
+ // handle selection and updating value if freeform is false
69
+ if (!baseState.open && !freeform) {
70
+ // select matching option, if the value fully matches
71
+ if (value && activeOption && value.trim().toLowerCase() === (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value.toLowerCase())) {
72
+ baseState.selectOption(ev, activeOption);
73
+ }
74
+ // reset typed value when the input loses focus while collapsed, unless freeform is true
75
+ setValue(undefined);
76
+ }
77
+ };
78
+ baseState.setOpen = function (ev, newState) {
79
+ if (disabled) {
80
+ return;
81
+ }
82
+ if (!newState && !freeform) {
83
+ setValue(undefined);
84
+ }
85
+ setOpen(ev, newState);
86
+ };
87
+ // update value and active option based on input
88
+ var onTriggerChange = function (ev) {
89
+ var inputValue = ev.target.value;
90
+ // update uncontrolled value
91
+ baseState.setValue(inputValue);
92
+ // handle updating active option based on input
93
+ var matchingOption = getOptionFromInput(inputValue);
94
+ setActiveOption(matchingOption);
95
+ setFocusVisible(true);
96
+ // clear selection for single-select if the input value no longer matches the selection
97
+ if (!multiselect &&
98
+ selectedOptions.length === 1 &&
99
+ (inputValue.length < 1 || selectedOptions[0].indexOf(inputValue) !== 0)) {
100
+ clearSelection(ev);
101
+ }
102
+ };
103
+ // open Combobox when typing
104
+ var onTriggerKeyDown = function (ev) {
105
+ if (!open && dropdownKeyActions_1.getDropdownActionFromKey(ev) === 'Type') {
106
+ baseState.setOpen(ev, true);
107
+ }
108
+ // clear activedescendant when moving the text insertion cursor
109
+ if (ev.key === keyboard_keys_1.ArrowLeft || ev.key === keyboard_keys_1.ArrowRight) {
110
+ setHideActiveDescendant(true);
111
+ }
112
+ else {
113
+ setHideActiveDescendant(false);
114
+ }
115
+ };
116
+ // resolve input and listbox slot props
117
+ var triggerSlot;
118
+ var listboxSlot;
119
+ triggerSlot = react_utilities_1.resolveShorthand(props.input, {
120
+ required: true,
121
+ defaultProps: tslib_1.__assign({ ref: react_utilities_1.useMergedRefs((_c = props.input) === null || _c === void 0 ? void 0 : _c.ref, triggerRef), type: 'text', value: value !== null && value !== void 0 ? value : '' }, triggerNativeProps),
122
+ });
123
+ triggerSlot.onChange = react_utilities_1.mergeCallbacks(triggerSlot.onChange, onTriggerChange);
124
+ triggerSlot.onBlur = react_utilities_1.mergeCallbacks(triggerSlot.onBlur, onTriggerBlur);
125
+ triggerSlot.onKeyDown = react_utilities_1.mergeCallbacks(triggerSlot.onKeyDown, onTriggerKeyDown);
126
+ // only resolve listbox slot if needed
127
+ listboxSlot =
128
+ open || hasFocus
129
+ ? react_utilities_1.resolveShorthand(props.listbox, {
130
+ required: true,
131
+ defaultProps: {
132
+ children: props.children,
133
+ style: popupDimensions,
134
+ },
135
+ })
136
+ : undefined;
137
+ _a = useComboboxPopup_1.useComboboxPopup(props, triggerSlot, listboxSlot), triggerSlot = _a[0], listboxSlot = _a[1];
138
+ _b = useTriggerListboxSlots_1.useTriggerListboxSlots(props, baseState, ref, triggerSlot, listboxSlot), triggerSlot = _b[0], listboxSlot = _b[1];
139
+ if (hideActiveDescendant) {
140
+ triggerSlot['aria-activedescendant'] = undefined;
141
+ }
142
+ var state = tslib_1.__assign({ components: {
143
+ root: 'div',
144
+ input: 'input',
145
+ expandIcon: 'span',
146
+ listbox: Listbox_1.Listbox,
147
+ }, root: react_utilities_1.resolveShorthand(props.root, {
148
+ required: true,
149
+ defaultProps: tslib_1.__assign({ 'aria-owns': !inlinePopup ? listboxSlot === null || listboxSlot === void 0 ? void 0 : listboxSlot.id : undefined }, rootNativeProps),
150
+ }), input: triggerSlot, listbox: listboxSlot, expandIcon: react_utilities_1.resolveShorthand(props.expandIcon, {
151
+ required: true,
152
+ defaultProps: {
153
+ 'aria-expanded': open,
154
+ children: React.createElement(react_icons_1.ChevronDownRegular, null),
155
+ role: 'button',
156
+ },
157
+ }) }, baseState);
158
+ state.root.ref = react_utilities_1.useMergedRefs(state.root.ref, rootRef);
159
+ /* handle open/close + focus change when clicking expandIcon */
160
+ var _h = state.expandIcon || {}, onIconMouseDown = _h.onMouseDown, onIconClick = _h.onClick;
161
+ var onExpandIconMouseDown = react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(onIconMouseDown, function () {
162
+ // do not dismiss on blur when closing via clicking the icon
163
+ if (open) {
164
+ baseState.ignoreNextBlur.current = true;
165
+ }
166
+ }));
167
+ var onExpandIconClick = react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(onIconClick, function (event) {
168
+ var _a;
169
+ // open and set focus
170
+ state.setOpen(event, !state.open);
171
+ (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
172
+ // set focus visible=false, since this can only be done with the mouse/pointer
173
+ setFocusVisible(false);
174
+ }));
175
+ if (state.expandIcon) {
176
+ state.expandIcon.onMouseDown = onExpandIconMouseDown;
177
+ state.expandIcon.onClick = onExpandIconClick;
178
+ // If there is no explicit aria-label, calculate default accName attribute for expandIcon button,
179
+ // using the following steps:
180
+ // 1. If there is an aria-label, it is "Open [aria-label]"
181
+ // 2. If there is an aria-labelledby, it is "Open [aria-labelledby target]" (using aria-labelledby + ids)
182
+ // 3. If there is no aria-label/ledby attr, it falls back to "Open"
183
+ // We can't fall back to a label/htmlFor name because of https://github.com/w3c/accname/issues/179
184
+ var hasExpandLabel = state.expandIcon['aria-label'] || state.expandIcon['aria-labelledby'];
185
+ var defaultOpenString = 'Open'; // this is english-only since it is the fallback
186
+ if (!hasExpandLabel) {
187
+ if (props['aria-labelledby']) {
188
+ var chevronId = (_d = state.expandIcon.id) !== null && _d !== void 0 ? _d : comboId + "-chevron";
189
+ var chevronLabelledBy = chevronId + " " + state.input['aria-labelledby'];
190
+ state.expandIcon['aria-label'] = defaultOpenString;
191
+ state.expandIcon.id = chevronId;
192
+ state.expandIcon['aria-labelledby'] = chevronLabelledBy;
193
+ }
194
+ else if (props['aria-label']) {
195
+ state.expandIcon['aria-label'] = defaultOpenString + " " + props['aria-label'];
196
+ }
197
+ else {
198
+ state.expandIcon['aria-label'] = defaultOpenString;
199
+ }
200
+ }
201
+ }
202
+ return state;
203
+ };
204
+ exports.useCombobox_unstable = useCombobox_unstable;
205
+ });
206
+ //# sourceMappingURL=useCombobox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCombobox.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/Combobox/useCombobox.tsx"],"names":[],"mappings":";;;;IAqBA;;;;;;;;OAQG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAAoB,EAAE,GAAgC;;;QACzF,IAAM,SAAS,GAAG,2CAAoB,uCAAM,KAAK,KAAE,QAAQ,EAAE,IAAI,IAAG,CAAC;QAEnE,IAAA,YAAY,GAaV,SAAS,aAbC,EACZ,cAAc,GAYZ,SAAS,eAZG,EACd,YAAY,GAWV,SAAS,aAXC,EACZ,sBAAsB,GAUpB,SAAS,uBAVW,EACtB,QAAQ,GASN,SAAS,SATH,EACR,IAAI,GAQF,SAAS,KARP,EACJ,YAAY,GAOV,SAAS,aAPC,EACZ,eAAe,GAMb,SAAS,gBANI,EACf,eAAe,GAKb,SAAS,gBALI,EACf,eAAe,GAIb,SAAS,gBAJI,EACf,OAAO,GAGL,SAAS,QAHJ,EACP,QAAQ,GAEN,SAAS,SAFH,EACR,KAAK,GACH,SAAS,MADN,CACO;QACN,IAAA,QAAQ,GAAyC,KAAK,SAA9C,EAAE,QAAQ,GAA+B,KAAK,SAApC,EAAE,WAAW,GAAkB,KAAK,YAAvB,EAAE,WAAW,GAAK,KAAK,YAAV,CAAW;QAC/D,IAAM,OAAO,GAAG,uBAAK,CAAC,WAAW,CAAC,CAAC;QAE7B,IAAA,KAAyD,2CAAyB,CAAC;YACvF,KAAK,OAAA;YACL,kBAAkB,EAAE,OAAO;YAC3B,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;SACxC,CAAC,EAJe,kBAAkB,aAAA,EAAQ,eAAe,UAIxD,CAAC;QAEH,IAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;QACnD,IAAM,UAAU,GAAG,KAAK,CAAC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O,GAAG,iBAAiB,CAAC;YAE7C,iGAAiG;YACjG,6BAA6B;YAC7B,0DAA0D;YAC1D,yGAAyG;YACzG,mEAAmE;YACnE,kGAAkG;YAClG,IAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;YAC7F,IAAM,iBAAiB,GAAG,MAAM,CAAC,CAAC,gDAAgD;YAClF,IAAI,CAAC,cAAc,EAAE;gBACnB,IAAI,KAAK,CAAC,iBAAiB,CAAC,EAAE;oBAC5B,IAAM,SAAS,GAAG,MAAA,KAAK,CAAC,UAAU,CAAC,EAAE,mCAAO,OAAO,aAAU,CAAC;oBAC9D,IAAM,iBAAiB,GAAM,SAAS,SAAI,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAG,CAAC;oBAE3E,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,iBAAiB,CAAC;oBACnD,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,SAAS,CAAC;oBAChC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;iBACzD;qBAAM,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE;oBAC9B,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,GAAM,iBAAiB,SAAI,KAAK,CAAC,YAAY,CAAG,CAAC;iBAChF;qBAAM;oBACL,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,iBAAiB,CAAC;iBACpD;aACF;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IA7PW,QAAA,oBAAoB,wBA6P/B","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?.value.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 (\n !multiselect &&\n selectedOptions.length === 1 &&\n (inputValue.length < 1 || selectedOptions[0].indexOf(inputValue) !== 0)\n ) {\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"]}
@@ -0,0 +1,152 @@
1
+ define(["require", "exports", "tslib", "@fluentui/react-theme", "@griffel/react", "../../utils/internalTokens"], function (require, exports, tslib_1, react_theme_1, react_1, internalTokens_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useComboboxStyles_unstable = exports.comboboxClassNames = void 0;
5
+ exports.comboboxClassNames = {
6
+ root: 'fui-Combobox',
7
+ input: 'fui-Combobox__input',
8
+ expandIcon: 'fui-Combobox__expandIcon',
9
+ listbox: 'fui-Combobox__listbox',
10
+ };
11
+ // Matches internal heights for Select and Input, but there are no theme variables for these
12
+ // field heights are 2px less than other controls, since the border is on the parent element.
13
+ var fieldHeights = {
14
+ small: '22px',
15
+ medium: '30px',
16
+ large: '38px',
17
+ };
18
+ /**
19
+ * Styles for Combobox
20
+ */
21
+ var useStyles = react_1.makeStyles({
22
+ root: tslib_1.__assign(tslib_1.__assign({ alignItems: 'center' }, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)), { boxSizing: 'border-box', columnGap: react_theme_1.tokens.spacingHorizontalXXS, display: 'inline-grid', gridTemplateColumns: '1fr auto', justifyContent: 'space-between', minWidth: '250px', position: 'relative',
23
+ // windows high contrast mode focus indicator
24
+ ':focus-within': {
25
+ outlineWidth: '2px',
26
+ outlineStyle: 'solid',
27
+ outlineColor: 'transparent',
28
+ },
29
+ // bottom focus border, shared with Input, Select, and SpinButton
30
+ '::after': tslib_1.__assign(tslib_1.__assign({ boxSizing: 'border-box', content: '""', position: 'absolute', left: '-1px', bottom: '-1px', right: '-1px', height: "max(2px, " + react_theme_1.tokens.borderRadiusMedium + ")", borderBottomLeftRadius: react_theme_1.tokens.borderRadiusMedium, borderBottomRightRadius: react_theme_1.tokens.borderRadiusMedium }, react_1.shorthands.borderBottom(react_theme_1.tokens.strokeWidthThick, 'solid', react_theme_1.tokens.colorCompoundBrandStroke)), { clipPath: 'inset(calc(100% - 2px) 0 0 0)', transform: 'scaleX(0)', transitionProperty: 'transform', transitionDuration: react_theme_1.tokens.durationUltraFast, transitionDelay: react_theme_1.tokens.curveAccelerateMid, '@media screen and (prefers-reduced-motion: reduce)': {
31
+ transitionDuration: '0.01ms',
32
+ transitionDelay: '0.01ms',
33
+ } }), ':focus-within::after': {
34
+ transform: 'scaleX(1)',
35
+ transitionProperty: 'transform',
36
+ transitionDuration: react_theme_1.tokens.durationNormal,
37
+ transitionDelay: react_theme_1.tokens.curveDecelerateMid,
38
+ '@media screen and (prefers-reduced-motion: reduce)': {
39
+ transitionDuration: '0.01ms',
40
+ transitionDelay: '0.01ms',
41
+ },
42
+ }, ':focus-within:active::after': {
43
+ borderBottomColor: react_theme_1.tokens.colorCompoundBrandStrokePressed,
44
+ } }),
45
+ listbox: tslib_1.__assign(tslib_1.__assign({ boxShadow: "" + react_theme_1.tokens.shadow16 }, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)), { maxHeight: '80vh' }),
46
+ listboxCollapsed: {
47
+ display: 'none',
48
+ },
49
+ // size variants
50
+ small: {
51
+ paddingRight: react_theme_1.tokens.spacingHorizontalSNudge,
52
+ },
53
+ medium: {
54
+ paddingRight: react_theme_1.tokens.spacingHorizontalMNudge,
55
+ },
56
+ large: {
57
+ columnGap: react_theme_1.tokens.spacingHorizontalSNudge,
58
+ paddingRight: react_theme_1.tokens.spacingHorizontalM,
59
+ },
60
+ // appearance variants
61
+ outline: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1 }, react_1.shorthands.border(react_theme_1.tokens.strokeWidthThin, 'solid', react_theme_1.tokens.colorNeutralStroke1)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
62
+ outlineInteractive: {
63
+ '&:hover': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Hover)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
64
+ '&:active': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Pressed)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
65
+ },
66
+ underline: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderBottom(react_theme_1.tokens.strokeWidthThin, 'solid', react_theme_1.tokens.colorNeutralStrokeAccessible)), react_1.shorthands.borderRadius(0)),
67
+ 'filled-lighter': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1 }, react_1.shorthands.border(react_theme_1.tokens.strokeWidthThin, 'solid', react_theme_1.tokens.colorTransparentStroke)),
68
+ 'filled-darker': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground3 }, react_1.shorthands.border(react_theme_1.tokens.strokeWidthThin, 'solid', react_theme_1.tokens.colorTransparentStroke)),
69
+ invalid: {
70
+ ':not(:focus-within),:hover:not(:focus-within)': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorPaletteRedBorder2)),
71
+ },
72
+ invalidUnderline: {
73
+ ':not(:focus-within),:hover:not(:focus-within)': {
74
+ borderBottomColor: react_theme_1.tokens.colorPaletteRedBorder2,
75
+ },
76
+ },
77
+ disabled: tslib_1.__assign(tslib_1.__assign({ cursor: 'not-allowed', backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { '@media (forced-colors: active)': tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')) }),
78
+ });
79
+ var useInputStyles = react_1.makeStyles({
80
+ input: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.border('0')), { color: react_theme_1.tokens.colorNeutralForeground1, fontFamily: react_theme_1.tokens.fontFamilyBase, '&:focus': {
81
+ outlineStyle: 'none',
82
+ }, '&::placeholder': {
83
+ color: react_theme_1.tokens.colorNeutralForeground4,
84
+ opacity: 1,
85
+ } }),
86
+ // size variants
87
+ small: tslib_1.__assign(tslib_1.__assign({ height: fieldHeights.small }, react_theme_1.typographyStyles.caption1), react_1.shorthands.padding(0, 0, 0, "calc(" + react_theme_1.tokens.spacingHorizontalSNudge + " + " + react_theme_1.tokens.spacingHorizontalXXS + ")")),
88
+ medium: tslib_1.__assign(tslib_1.__assign({ height: fieldHeights.medium }, react_theme_1.typographyStyles.body1), react_1.shorthands.padding(0, 0, 0, "calc(" + react_theme_1.tokens.spacingHorizontalMNudge + " + " + react_theme_1.tokens.spacingHorizontalXXS + ")")),
89
+ large: tslib_1.__assign(tslib_1.__assign({ height: fieldHeights.large }, react_theme_1.typographyStyles.body2), react_1.shorthands.padding(0, 0, 0, "calc(" + react_theme_1.tokens.spacingHorizontalM + " + " + react_theme_1.tokens.spacingHorizontalSNudge + ")")),
90
+ disabled: {
91
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
92
+ backgroundColor: react_theme_1.tokens.colorTransparentBackground,
93
+ cursor: 'not-allowed',
94
+ '::placeholder': {
95
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
96
+ },
97
+ },
98
+ });
99
+ var useIconStyles = react_1.makeStyles({
100
+ icon: {
101
+ boxSizing: 'border-box',
102
+ color: react_theme_1.tokens.colorNeutralStrokeAccessible,
103
+ cursor: 'pointer',
104
+ display: 'block',
105
+ fontSize: react_theme_1.tokens.fontSizeBase500,
106
+ // the SVG must have display: block for accurate positioning
107
+ // otherwise an extra inline space is inserted after the svg element
108
+ '& svg': {
109
+ display: 'block',
110
+ },
111
+ },
112
+ // icon size variants
113
+ small: {
114
+ fontSize: internalTokens_1.iconSizes.small,
115
+ marginLeft: react_theme_1.tokens.spacingHorizontalXXS,
116
+ },
117
+ medium: {
118
+ fontSize: internalTokens_1.iconSizes.medium,
119
+ marginLeft: react_theme_1.tokens.spacingHorizontalXXS,
120
+ },
121
+ large: {
122
+ fontSize: internalTokens_1.iconSizes.large,
123
+ marginLeft: react_theme_1.tokens.spacingHorizontalSNudge,
124
+ },
125
+ disabled: {
126
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
127
+ cursor: 'not-allowed',
128
+ },
129
+ });
130
+ /**
131
+ * Apply styling to the Combobox slots based on the state
132
+ */
133
+ var useComboboxStyles_unstable = function (state) {
134
+ var appearance = state.appearance, open = state.open, size = state.size;
135
+ var invalid = "" + state.input['aria-invalid'] === 'true';
136
+ var disabled = state.input.disabled;
137
+ var styles = useStyles();
138
+ var iconStyles = useIconStyles();
139
+ var inputStyles = useInputStyles();
140
+ state.root.className = react_1.mergeClasses(exports.comboboxClassNames.root, styles.root, styles[appearance], styles[size], !disabled && appearance === 'outline' && styles.outlineInteractive, invalid && appearance !== 'underline' && styles.invalid, invalid && appearance === 'underline' && styles.invalidUnderline, disabled && styles.disabled, state.root.className);
141
+ state.input.className = react_1.mergeClasses(exports.comboboxClassNames.input, inputStyles.input, inputStyles[size], disabled && inputStyles.disabled, state.input.className);
142
+ if (state.listbox) {
143
+ state.listbox.className = react_1.mergeClasses(exports.comboboxClassNames.listbox, styles.listbox, !open && styles.listboxCollapsed, state.listbox.className);
144
+ }
145
+ if (state.expandIcon) {
146
+ state.expandIcon.className = react_1.mergeClasses(exports.comboboxClassNames.expandIcon, iconStyles.icon, iconStyles[size], disabled && iconStyles.disabled, state.expandIcon.className);
147
+ }
148
+ return state;
149
+ };
150
+ exports.useComboboxStyles_unstable = useComboboxStyles_unstable;
151
+ });
152
+ //# sourceMappingURL=useComboboxStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComboboxStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/Combobox/useComboboxStyles.ts"],"names":[],"mappings":";;;;IAMa,QAAA,kBAAkB,GAAkC;QAC/D,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,qBAAqB;QAC5B,UAAU,EAAE,0BAA0B;QACtC,OAAO,EAAE,uBAAuB;KACjC,CAAC;IAEF,4FAA4F;IAC5F,6FAA6F;IAC7F,IAAM,YAAY,GAAG;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACd,CAAC;IAEF;;OAEG;IACH,IA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AK,EACjB,WAAW,CAAC,IAAI,CAAC,EACjB,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAChC,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;QAEF,IAAI,KAAK,CAAC,OAAO,EAAE;YACjB,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,oBAAY,CACpC,0BAAkB,CAAC,OAAO,EAC1B,MAAM,CAAC,OAAO,EACd,CAAC,IAAI,IAAI,MAAM,CAAC,gBAAgB,EAChC,KAAK,CAAC,OAAO,CAAC,SAAS,CACxB,CAAC;SACH;QAED,IAAI,KAAK,CAAC,UAAU,EAAE;YACpB,KAAK,CAAC,UAAU,CAAC,SAAS,GAAG,oBAAY,CACvC,0BAAkB,CAAC,UAAU,EAC7B,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,IAAI,CAAC,EAChB,QAAQ,IAAI,UAAU,CAAC,QAAQ,EAC/B,KAAK,CAAC,UAAU,CAAC,SAAS,CAC3B,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAhDW,QAAA,0BAA0B,8BAgDrC","sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { iconSizes } from '../../utils/internalTokens';\nimport type { ComboboxSlots, ComboboxState } from './Combobox.types';\n\nexport const comboboxClassNames: SlotClassNames<ComboboxSlots> = {\n root: 'fui-Combobox',\n input: 'fui-Combobox__input',\n expandIcon: 'fui-Combobox__expandIcon',\n listbox: 'fui-Combobox__listbox',\n};\n\n// Matches internal heights for Select and Input, but there are no theme variables for these\n// field heights are 2px less than other controls, since the border is on the parent element.\nconst fieldHeights = {\n small: '22px',\n medium: '30px',\n large: '38px',\n};\n\n/**\n * Styles for Combobox\n */\nconst useStyles = makeStyles({\n root: {\n alignItems: 'center',\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n boxSizing: 'border-box',\n columnGap: tokens.spacingHorizontalXXS,\n display: 'inline-grid',\n gridTemplateColumns: '1fr auto',\n justifyContent: 'space-between',\n minWidth: '250px',\n position: 'relative',\n\n // windows high contrast mode focus indicator\n ':focus-within': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: 'transparent',\n },\n\n // bottom focus border, shared with Input, Select, and SpinButton\n '::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n left: '-1px',\n bottom: '-1px',\n right: '-1px',\n height: `max(2px, ${tokens.borderRadiusMedium})`,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderBottomRightRadius: tokens.borderRadiusMedium,\n ...shorthands.borderBottom(tokens.strokeWidthThick, 'solid', tokens.colorCompoundBrandStroke),\n clipPath: 'inset(calc(100% - 2px) 0 0 0)',\n transform: 'scaleX(0)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationUltraFast,\n transitionDelay: tokens.curveAccelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within::after': {\n transform: 'scaleX(1)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationNormal,\n transitionDelay: tokens.curveDecelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within:active::after': {\n borderBottomColor: tokens.colorCompoundBrandStrokePressed,\n },\n },\n\n listbox: {\n boxShadow: `${tokens.shadow16}`,\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n maxHeight: '80vh',\n },\n\n listboxCollapsed: {\n display: 'none',\n },\n\n // size variants\n small: {\n paddingRight: tokens.spacingHorizontalSNudge,\n },\n medium: {\n paddingRight: tokens.spacingHorizontalMNudge,\n },\n large: {\n columnGap: tokens.spacingHorizontalSNudge,\n paddingRight: tokens.spacingHorizontalM,\n },\n\n // appearance variants\n outline: {\n backgroundColor: tokens.colorNeutralBackground1,\n ...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke1),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n\n outlineInteractive: {\n '&:hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n\n '&:active': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),\n ...shorthands.borderRadius(0),\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n ...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorTransparentStroke),\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n ...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorTransparentStroke),\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n invalidUnderline: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n borderBottomColor: tokens.colorPaletteRedBorder2,\n },\n },\n\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n input: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.border('0'),\n color: tokens.colorNeutralForeground1,\n fontFamily: tokens.fontFamilyBase,\n\n '&:focus': {\n outlineStyle: 'none',\n },\n\n '&::placeholder': {\n color: tokens.colorNeutralForeground4,\n opacity: 1,\n },\n },\n\n // size variants\n small: {\n height: fieldHeights.small,\n ...typographyStyles.caption1,\n ...shorthands.padding(0, 0, 0, `calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`),\n },\n medium: {\n height: fieldHeights.medium,\n ...typographyStyles.body1,\n ...shorthands.padding(0, 0, 0, `calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`),\n },\n large: {\n height: fieldHeights.large,\n ...typographyStyles.body2,\n ...shorthands.padding(0, 0, 0, `calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`),\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: tokens.colorTransparentBackground,\n cursor: 'not-allowed',\n '::placeholder': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useIconStyles = makeStyles({\n icon: {\n boxSizing: 'border-box',\n color: tokens.colorNeutralStrokeAccessible,\n cursor: 'pointer',\n display: 'block',\n fontSize: tokens.fontSizeBase500,\n\n // the SVG must have display: block for accurate positioning\n // otherwise an extra inline space is inserted after the svg element\n '& svg': {\n display: 'block',\n },\n },\n\n // icon size variants\n small: {\n fontSize: iconSizes.small,\n marginLeft: tokens.spacingHorizontalXXS,\n },\n medium: {\n fontSize: iconSizes.medium,\n marginLeft: tokens.spacingHorizontalXXS,\n },\n large: {\n fontSize: iconSizes.large,\n marginLeft: tokens.spacingHorizontalSNudge,\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n },\n});\n\n/**\n * Apply styling to the Combobox slots based on the state\n */\nexport const useComboboxStyles_unstable = (state: ComboboxState): ComboboxState => {\n const { appearance, open, size } = state;\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const disabled = state.input.disabled;\n const styles = useStyles();\n const iconStyles = useIconStyles();\n const inputStyles = useInputStyles();\n\n state.root.className = mergeClasses(\n comboboxClassNames.root,\n styles.root,\n styles[appearance],\n styles[size],\n !disabled && appearance === 'outline' && styles.outlineInteractive,\n invalid && appearance !== 'underline' && styles.invalid,\n invalid && appearance === 'underline' && styles.invalidUnderline,\n disabled && styles.disabled,\n state.root.className,\n );\n\n state.input.className = mergeClasses(\n comboboxClassNames.input,\n inputStyles.input,\n inputStyles[size],\n disabled && inputStyles.disabled,\n state.input.className,\n );\n\n if (state.listbox) {\n state.listbox.className = mergeClasses(\n comboboxClassNames.listbox,\n styles.listbox,\n !open && styles.listboxCollapsed,\n state.listbox.className,\n );\n }\n\n if (state.expandIcon) {\n state.expandIcon.className = mergeClasses(\n comboboxClassNames.expandIcon,\n iconStyles.icon,\n iconStyles[size],\n disabled && iconStyles.disabled,\n state.expandIcon.className,\n );\n }\n\n return state;\n};\n"]}
@@ -0,0 +1,10 @@
1
+ define(["require", "exports", "@fluentui/react-field", "../../Combobox"], function (require, exports, react_field_1, Combobox_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ComboboxField = exports.comboboxFieldClassNames = void 0;
5
+ /** @deprecated Use Field with Combobox: `<Field><Combobox /></Field>` */
6
+ exports.comboboxFieldClassNames = react_field_1.getDeprecatedFieldClassNames(Combobox_1.comboboxClassNames.root);
7
+ /** @deprecated Use Field with Combobox: `<Field><Combobox /></Field>` */
8
+ exports.ComboboxField = react_field_1.makeDeprecatedField(Combobox_1.Combobox);
9
+ });
10
+ //# sourceMappingURL=ComboboxField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboboxField.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/ComboboxField/ComboboxField.tsx"],"names":[],"mappings":";;;;IAOA,yEAAyE;IAC5D,QAAA,uBAAuB,GAAG,0CAA4B,CAAC,6BAAkB,CAAC,IAAI,CAAC,CAAC;IAC7F,yEAAyE;IAC5D,QAAA,aAAa,GAA4C,iCAAmB,CAAC,mBAAQ,CAAC,CAAC","sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { DeprecatedFieldProps, getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { Combobox, comboboxClassNames, ComboboxProps } from '../../Combobox';\n\n/** @deprecated Use Field with Combobox: `<Field><Combobox /></Field>` */\nexport type ComboboxFieldProps = DeprecatedFieldProps<ComboboxProps>;\n/** @deprecated Use Field with Combobox: `<Field><Combobox /></Field>` */\nexport const comboboxFieldClassNames = getDeprecatedFieldClassNames(comboboxClassNames.root);\n/** @deprecated Use Field with Combobox: `<Field><Combobox /></Field>` */\nexport const ComboboxField: ForwardRefComponent<ComboboxFieldProps> = makeDeprecatedField(Combobox);\n"]}
@@ -0,0 +1,6 @@
1
+ define(["require", "exports", "tslib", "./ComboboxField"], function (require, exports, tslib_1, ComboboxField_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(ComboboxField_1, exports);
5
+ });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/ComboboxField/index.ts"],"names":[],"mappings":";;;IAAA,+CAAgC","sourcesContent":["export * from './ComboboxField';\n"]}
@@ -0,0 +1,16 @@
1
+ define(["require", "exports", "react", "./useDropdown", "./renderDropdown", "./useDropdownStyles", "../../contexts/useComboboxContextValues"], function (require, exports, React, useDropdown_1, renderDropdown_1, useDropdownStyles_1, useComboboxContextValues_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Dropdown = void 0;
5
+ /**
6
+ * Dropdown component: a selection control that allows users to choose from a set of possible options
7
+ */
8
+ exports.Dropdown = React.forwardRef(function (props, ref) {
9
+ var state = useDropdown_1.useDropdown_unstable(props, ref);
10
+ var contextValues = useComboboxContextValues_1.useComboboxContextValues(state);
11
+ useDropdownStyles_1.useDropdownStyles_unstable(state);
12
+ return renderDropdown_1.renderDropdown_unstable(state, contextValues);
13
+ });
14
+ exports.Dropdown.displayName = 'Dropdown';
15
+ });
16
+ //# sourceMappingURL=Dropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IACU,QAAA,QAAQ,GAAuC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QACtF,IAAM,KAAK,GAAG,kCAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/C,IAAM,aAAa,GAAG,mDAAwB,CAAC,KAAK,CAAC,CAAC;QAEtD,8CAA0B,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,wCAAuB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import * as React from 'react';\nimport { useDropdown_unstable } from './useDropdown';\nimport { renderDropdown_unstable } from './renderDropdown';\nimport { useDropdownStyles_unstable } from './useDropdownStyles';\nimport type { DropdownProps } from './Dropdown.types';\nimport { useComboboxContextValues } from '../../contexts/useComboboxContextValues';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Dropdown component: a selection control that allows users to choose from a set of possible options\n */\nexport const Dropdown: ForwardRefComponent<DropdownProps> = React.forwardRef((props, ref) => {\n const state = useDropdown_unstable(props, ref);\n const contextValues = useComboboxContextValues(state);\n\n useDropdownStyles_unstable(state);\n return renderDropdown_unstable(state, contextValues);\n});\n\nDropdown.displayName = 'Dropdown';\n"]}
@@ -0,0 +1,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=Dropdown.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/Dropdown/Dropdown.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type {\n ComboboxBaseContextValues,\n ComboboxBaseOpenChangeData,\n ComboboxBaseOpenEvents,\n ComboboxBaseProps,\n ComboboxBaseState,\n} from '../../utils/ComboboxBase.types';\nimport { Listbox } from '../Listbox/Listbox';\n\nexport type DropdownSlots = {\n /* The root dropdown slot */\n root: NonNullable<Slot<'div'>>;\n\n /* The dropdown arrow icon */\n expandIcon: Slot<'span'>;\n\n /* The primary slot, the element with role=\"combobox\" */\n button: NonNullable<Slot<'button'>>;\n\n /* The dropdown listbox slot */\n listbox?: Slot<typeof Listbox>;\n};\n\n/**\n * Dropdown Props\n */\nexport type DropdownProps = ComponentProps<Partial<DropdownSlots>, 'button'> & ComboboxBaseProps;\n\n/**\n * State used in rendering Dropdown\n */\nexport type DropdownState = ComponentState<DropdownSlots> &\n ComboboxBaseState & {\n /* Whether the placeholder is currently displayed */\n placeholderVisible: boolean;\n };\n\n/* Export types defined in ComboboxBase */\nexport type DropdownContextValues = ComboboxBaseContextValues;\nexport type DropdownOpenEvents = ComboboxBaseOpenEvents;\nexport type DropdownOpenChangeData = ComboboxBaseOpenChangeData;\n"]}
@@ -0,0 +1,10 @@
1
+ define(["require", "exports", "tslib", "./Dropdown", "./Dropdown.types", "./renderDropdown", "./useDropdown", "./useDropdownStyles"], function (require, exports, tslib_1, Dropdown_1, Dropdown_types_1, renderDropdown_1, useDropdown_1, useDropdownStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(Dropdown_1, exports);
5
+ tslib_1.__exportStar(Dropdown_types_1, exports);
6
+ tslib_1.__exportStar(renderDropdown_1, exports);
7
+ tslib_1.__exportStar(useDropdown_1, exports);
8
+ tslib_1.__exportStar(useDropdownStyles_1, exports);
9
+ });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/Dropdown/index.ts"],"names":[],"mappings":";;;IAAA,0CAA2B;IAC3B,gDAAiC;IACjC,gDAAiC;IACjC,6CAA8B;IAC9B,mDAAoC","sourcesContent":["export * from './Dropdown';\nexport * from './Dropdown.types';\nexport * from './renderDropdown';\nexport * from './useDropdown';\nexport * from './useDropdownStyles';\n"]}
@@ -0,0 +1,21 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react-portal", "@fluentui/react-utilities", "../../contexts/ComboboxContext"], function (require, exports, tslib_1, React, react_portal_1, react_utilities_1, ComboboxContext_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderDropdown_unstable = void 0;
5
+ /**
6
+ * Render the final JSX of Dropdown
7
+ */
8
+ var renderDropdown_unstable = function (state, contextValues) {
9
+ var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
10
+ return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
11
+ React.createElement(ComboboxContext_1.ComboboxContext.Provider, { value: contextValues.combobox },
12
+ React.createElement(slots.button, tslib_1.__assign({}, slotProps.button),
13
+ slotProps.button.children,
14
+ slots.expandIcon && React.createElement(slots.expandIcon, tslib_1.__assign({}, slotProps.expandIcon))),
15
+ slots.listbox &&
16
+ (state.inlinePopup ? (React.createElement(slots.listbox, tslib_1.__assign({}, slotProps.listbox))) : (React.createElement(react_portal_1.Portal, null,
17
+ React.createElement(slots.listbox, tslib_1.__assign({}, slotProps.listbox))))))));
18
+ };
19
+ exports.renderDropdown_unstable = renderDropdown_unstable;
20
+ });
21
+ //# sourceMappingURL=renderDropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderDropdown.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-combobox/src/components/Dropdown/renderDropdown.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACI,IAAM,uBAAuB,GAAG,UAAC,KAAoB,EAAE,aAAoC;QAC1F,IAAA,KAAuB,0BAAQ,CAAgB,KAAK,CAAC,EAAnD,KAAK,WAAA,EAAE,SAAS,eAAmC,CAAC;QAE5D,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,iCAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,CAAC,QAAQ;gBACrD,oBAAC,KAAK,CAAC,MAAM,uBAAK,SAAS,CAAC,MAAM;oBAC/B,SAAS,CAAC,MAAM,CAAC,QAAQ;oBACzB,KAAK,CAAC,UAAU,IAAI,oBAAC,KAAK,CAAC,UAAU,uBAAK,SAAS,CAAC,UAAU,EAAI,CACtD;gBACd,KAAK,CAAC,OAAO;oBACZ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CACnB,oBAAC,KAAK,CAAC,OAAO,uBAAK,SAAS,CAAC,OAAO,EAAI,CACzC,CAAC,CAAC,CAAC,CACF,oBAAC,qBAAM;wBACL,oBAAC,KAAK,CAAC,OAAO,uBAAK,SAAS,CAAC,OAAO,EAAI,CACjC,CACV,CAAC,CACqB,CAChB,CACd,CAAC;IACJ,CAAC,CAAC;IArBW,QAAA,uBAAuB,2BAqBlC","sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { ComboboxContext } from '../../contexts/ComboboxContext';\nimport type { DropdownContextValues, DropdownState, DropdownSlots } from './Dropdown.types';\n\n/**\n * Render the final JSX of Dropdown\n */\nexport const renderDropdown_unstable = (state: DropdownState, contextValues: DropdownContextValues) => {\n const { slots, slotProps } = getSlots<DropdownSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <ComboboxContext.Provider value={contextValues.combobox}>\n <slots.button {...slotProps.button}>\n {slotProps.button.children}\n {slots.expandIcon && <slots.expandIcon {...slotProps.expandIcon} />}\n </slots.button>\n {slots.listbox &&\n (state.inlinePopup ? (\n <slots.listbox {...slotProps.listbox} />\n ) : (\n <Portal>\n <slots.listbox {...slotProps.listbox} />\n </Portal>\n ))}\n </ComboboxContext.Provider>\n </slots.root>\n );\n};\n"]}