@react-spectrum/combobox 3.0.0-beta.0 → 3.0.0-nightly-641446f65-240905

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 (242) hide show
  1. package/dist/ComboBox.main.js +293 -0
  2. package/dist/ComboBox.main.js.map +1 -0
  3. package/dist/ComboBox.mjs +288 -0
  4. package/dist/ComboBox.module.js +288 -0
  5. package/dist/ComboBox.module.js.map +1 -0
  6. package/dist/MobileComboBox.main.js +419 -0
  7. package/dist/MobileComboBox.main.js.map +1 -0
  8. package/dist/MobileComboBox.mjs +414 -0
  9. package/dist/MobileComboBox.module.js +414 -0
  10. package/dist/MobileComboBox.module.js.map +1 -0
  11. package/dist/ar-AE.main.js +9 -0
  12. package/dist/ar-AE.main.js.map +1 -0
  13. package/dist/ar-AE.mjs +11 -0
  14. package/dist/ar-AE.module.js +11 -0
  15. package/dist/ar-AE.module.js.map +1 -0
  16. package/dist/bg-BG.main.js +9 -0
  17. package/dist/bg-BG.main.js.map +1 -0
  18. package/dist/bg-BG.mjs +11 -0
  19. package/dist/bg-BG.module.js +11 -0
  20. package/dist/bg-BG.module.js.map +1 -0
  21. package/dist/button_vars_css.main.js +122 -0
  22. package/dist/button_vars_css.main.js.map +1 -0
  23. package/dist/button_vars_css.mjs +124 -0
  24. package/dist/button_vars_css.module.js +124 -0
  25. package/dist/button_vars_css.module.js.map +1 -0
  26. package/dist/combobox.4bcd8cdb.css +50 -0
  27. package/dist/combobox.4bcd8cdb.css.map +1 -0
  28. package/dist/combobox_css.main.js +35 -0
  29. package/dist/combobox_css.main.js.map +1 -0
  30. package/dist/combobox_css.mjs +37 -0
  31. package/dist/combobox_css.module.js +37 -0
  32. package/dist/combobox_css.module.js.map +1 -0
  33. package/dist/cs-CZ.main.js +9 -0
  34. package/dist/cs-CZ.main.js.map +1 -0
  35. package/dist/cs-CZ.mjs +11 -0
  36. package/dist/cs-CZ.module.js +11 -0
  37. package/dist/cs-CZ.module.js.map +1 -0
  38. package/dist/da-DK.main.js +9 -0
  39. package/dist/da-DK.main.js.map +1 -0
  40. package/dist/da-DK.mjs +11 -0
  41. package/dist/da-DK.module.js +11 -0
  42. package/dist/da-DK.module.js.map +1 -0
  43. package/dist/de-DE.main.js +9 -0
  44. package/dist/de-DE.main.js.map +1 -0
  45. package/dist/de-DE.mjs +11 -0
  46. package/dist/de-DE.module.js +11 -0
  47. package/dist/de-DE.module.js.map +1 -0
  48. package/dist/el-GR.main.js +9 -0
  49. package/dist/el-GR.main.js.map +1 -0
  50. package/dist/el-GR.mjs +11 -0
  51. package/dist/el-GR.module.js +11 -0
  52. package/dist/el-GR.module.js.map +1 -0
  53. package/dist/en-US.main.js +9 -0
  54. package/dist/en-US.main.js.map +1 -0
  55. package/dist/en-US.mjs +11 -0
  56. package/dist/en-US.module.js +11 -0
  57. package/dist/en-US.module.js.map +1 -0
  58. package/dist/es-ES.main.js +9 -0
  59. package/dist/es-ES.main.js.map +1 -0
  60. package/dist/es-ES.mjs +11 -0
  61. package/dist/es-ES.module.js +11 -0
  62. package/dist/es-ES.module.js.map +1 -0
  63. package/dist/et-EE.main.js +9 -0
  64. package/dist/et-EE.main.js.map +1 -0
  65. package/dist/et-EE.mjs +11 -0
  66. package/dist/et-EE.module.js +11 -0
  67. package/dist/et-EE.module.js.map +1 -0
  68. package/dist/fi-FI.main.js +9 -0
  69. package/dist/fi-FI.main.js.map +1 -0
  70. package/dist/fi-FI.mjs +11 -0
  71. package/dist/fi-FI.module.js +11 -0
  72. package/dist/fi-FI.module.js.map +1 -0
  73. package/dist/fieldlabel_vars_css.main.js +95 -0
  74. package/dist/fieldlabel_vars_css.main.js.map +1 -0
  75. package/dist/fieldlabel_vars_css.mjs +97 -0
  76. package/dist/fieldlabel_vars_css.module.js +97 -0
  77. package/dist/fieldlabel_vars_css.module.js.map +1 -0
  78. package/dist/fr-FR.main.js +9 -0
  79. package/dist/fr-FR.main.js.map +1 -0
  80. package/dist/fr-FR.mjs +11 -0
  81. package/dist/fr-FR.module.js +11 -0
  82. package/dist/fr-FR.module.js.map +1 -0
  83. package/dist/he-IL.main.js +9 -0
  84. package/dist/he-IL.main.js.map +1 -0
  85. package/dist/he-IL.mjs +11 -0
  86. package/dist/he-IL.module.js +11 -0
  87. package/dist/he-IL.module.js.map +1 -0
  88. package/dist/hr-HR.main.js +9 -0
  89. package/dist/hr-HR.main.js.map +1 -0
  90. package/dist/hr-HR.mjs +11 -0
  91. package/dist/hr-HR.module.js +11 -0
  92. package/dist/hr-HR.module.js.map +1 -0
  93. package/dist/hu-HU.main.js +9 -0
  94. package/dist/hu-HU.main.js.map +1 -0
  95. package/dist/hu-HU.mjs +11 -0
  96. package/dist/hu-HU.module.js +11 -0
  97. package/dist/hu-HU.module.js.map +1 -0
  98. package/dist/import.mjs +20 -0
  99. package/dist/inputgroup_vars_css.main.js +86 -0
  100. package/dist/inputgroup_vars_css.main.js.map +1 -0
  101. package/dist/inputgroup_vars_css.mjs +88 -0
  102. package/dist/inputgroup_vars_css.module.js +88 -0
  103. package/dist/inputgroup_vars_css.module.js.map +1 -0
  104. package/dist/intlStrings.main.js +108 -0
  105. package/dist/intlStrings.main.js.map +1 -0
  106. package/dist/intlStrings.mjs +110 -0
  107. package/dist/intlStrings.module.js +110 -0
  108. package/dist/intlStrings.module.js.map +1 -0
  109. package/dist/it-IT.main.js +9 -0
  110. package/dist/it-IT.main.js.map +1 -0
  111. package/dist/it-IT.mjs +11 -0
  112. package/dist/it-IT.module.js +11 -0
  113. package/dist/it-IT.module.js.map +1 -0
  114. package/dist/ja-JP.main.js +9 -0
  115. package/dist/ja-JP.main.js.map +1 -0
  116. package/dist/ja-JP.mjs +11 -0
  117. package/dist/ja-JP.module.js +11 -0
  118. package/dist/ja-JP.module.js.map +1 -0
  119. package/dist/ko-KR.main.js +9 -0
  120. package/dist/ko-KR.main.js.map +1 -0
  121. package/dist/ko-KR.mjs +11 -0
  122. package/dist/ko-KR.module.js +11 -0
  123. package/dist/ko-KR.module.js.map +1 -0
  124. package/dist/lt-LT.main.js +9 -0
  125. package/dist/lt-LT.main.js.map +1 -0
  126. package/dist/lt-LT.mjs +11 -0
  127. package/dist/lt-LT.module.js +11 -0
  128. package/dist/lt-LT.module.js.map +1 -0
  129. package/dist/lv-LV.main.js +9 -0
  130. package/dist/lv-LV.main.js.map +1 -0
  131. package/dist/lv-LV.mjs +11 -0
  132. package/dist/lv-LV.module.js +11 -0
  133. package/dist/lv-LV.module.js.map +1 -0
  134. package/dist/main.js +18 -978
  135. package/dist/main.js.map +1 -1
  136. package/dist/module.js +14 -885
  137. package/dist/module.js.map +1 -1
  138. package/dist/nb-NO.main.js +9 -0
  139. package/dist/nb-NO.main.js.map +1 -0
  140. package/dist/nb-NO.mjs +11 -0
  141. package/dist/nb-NO.module.js +11 -0
  142. package/dist/nb-NO.module.js.map +1 -0
  143. package/dist/nl-NL.main.js +9 -0
  144. package/dist/nl-NL.main.js.map +1 -0
  145. package/dist/nl-NL.mjs +11 -0
  146. package/dist/nl-NL.module.js +11 -0
  147. package/dist/nl-NL.module.js.map +1 -0
  148. package/dist/pl-PL.main.js +9 -0
  149. package/dist/pl-PL.main.js.map +1 -0
  150. package/dist/pl-PL.mjs +11 -0
  151. package/dist/pl-PL.module.js +11 -0
  152. package/dist/pl-PL.module.js.map +1 -0
  153. package/dist/pt-BR.main.js +9 -0
  154. package/dist/pt-BR.main.js.map +1 -0
  155. package/dist/pt-BR.mjs +11 -0
  156. package/dist/pt-BR.module.js +11 -0
  157. package/dist/pt-BR.module.js.map +1 -0
  158. package/dist/pt-PT.main.js +9 -0
  159. package/dist/pt-PT.main.js.map +1 -0
  160. package/dist/pt-PT.mjs +11 -0
  161. package/dist/pt-PT.module.js +11 -0
  162. package/dist/pt-PT.module.js.map +1 -0
  163. package/dist/ro-RO.main.js +9 -0
  164. package/dist/ro-RO.main.js.map +1 -0
  165. package/dist/ro-RO.mjs +11 -0
  166. package/dist/ro-RO.module.js +11 -0
  167. package/dist/ro-RO.module.js.map +1 -0
  168. package/dist/ru-RU.main.js +9 -0
  169. package/dist/ru-RU.main.js.map +1 -0
  170. package/dist/ru-RU.mjs +11 -0
  171. package/dist/ru-RU.module.js +11 -0
  172. package/dist/ru-RU.module.js.map +1 -0
  173. package/dist/search_vars_css.main.js +53 -0
  174. package/dist/search_vars_css.main.js.map +1 -0
  175. package/dist/search_vars_css.mjs +55 -0
  176. package/dist/search_vars_css.module.js +55 -0
  177. package/dist/search_vars_css.module.js.map +1 -0
  178. package/dist/sk-SK.main.js +9 -0
  179. package/dist/sk-SK.main.js.map +1 -0
  180. package/dist/sk-SK.mjs +11 -0
  181. package/dist/sk-SK.module.js +11 -0
  182. package/dist/sk-SK.module.js.map +1 -0
  183. package/dist/sl-SI.main.js +9 -0
  184. package/dist/sl-SI.main.js.map +1 -0
  185. package/dist/sl-SI.mjs +11 -0
  186. package/dist/sl-SI.module.js +11 -0
  187. package/dist/sl-SI.module.js.map +1 -0
  188. package/dist/sr-SP.main.js +9 -0
  189. package/dist/sr-SP.main.js.map +1 -0
  190. package/dist/sr-SP.mjs +11 -0
  191. package/dist/sr-SP.module.js +11 -0
  192. package/dist/sr-SP.module.js.map +1 -0
  193. package/dist/sv-SE.main.js +9 -0
  194. package/dist/sv-SE.main.js.map +1 -0
  195. package/dist/sv-SE.mjs +11 -0
  196. package/dist/sv-SE.module.js +11 -0
  197. package/dist/sv-SE.module.js.map +1 -0
  198. package/dist/textfield_vars_css.main.js +74 -0
  199. package/dist/textfield_vars_css.main.js.map +1 -0
  200. package/dist/textfield_vars_css.mjs +76 -0
  201. package/dist/textfield_vars_css.module.js +76 -0
  202. package/dist/textfield_vars_css.module.js.map +1 -0
  203. package/dist/tr-TR.main.js +9 -0
  204. package/dist/tr-TR.main.js.map +1 -0
  205. package/dist/tr-TR.mjs +11 -0
  206. package/dist/tr-TR.module.js +11 -0
  207. package/dist/tr-TR.module.js.map +1 -0
  208. package/dist/types.d.ts +5 -4
  209. package/dist/types.d.ts.map +1 -1
  210. package/dist/uk-UA.main.js +9 -0
  211. package/dist/uk-UA.main.js.map +1 -0
  212. package/dist/uk-UA.mjs +11 -0
  213. package/dist/uk-UA.module.js +11 -0
  214. package/dist/uk-UA.module.js.map +1 -0
  215. package/dist/vars.0bdfee79.css +223 -0
  216. package/dist/vars.0bdfee79.css.map +1 -0
  217. package/dist/vars.25f9ddd3.css +550 -0
  218. package/dist/vars.25f9ddd3.css.map +1 -0
  219. package/dist/vars.80834be2.css +271 -0
  220. package/dist/vars.80834be2.css.map +1 -0
  221. package/dist/vars.963b3e04.css +649 -0
  222. package/dist/vars.963b3e04.css.map +1 -0
  223. package/dist/vars.d0b434fc.css +1645 -0
  224. package/dist/vars.d0b434fc.css.map +1 -0
  225. package/dist/zh-CN.main.js +9 -0
  226. package/dist/zh-CN.main.js.map +1 -0
  227. package/dist/zh-CN.mjs +11 -0
  228. package/dist/zh-CN.module.js +11 -0
  229. package/dist/zh-CN.module.js.map +1 -0
  230. package/dist/zh-TW.main.js +9 -0
  231. package/dist/zh-TW.main.js.map +1 -0
  232. package/dist/zh-TW.mjs +11 -0
  233. package/dist/zh-TW.module.js +11 -0
  234. package/dist/zh-TW.module.js.map +1 -0
  235. package/package.json +36 -30
  236. package/src/ComboBox.tsx +78 -51
  237. package/src/MobileComboBox.tsx +124 -53
  238. package/src/combobox.css +5 -5
  239. package/src/index.ts +2 -1
  240. package/LICENSE +0 -201
  241. package/dist/main.css +0 -2
  242. package/dist/main.css.map +0 -1
@@ -0,0 +1,293 @@
1
+ require("./combobox.4bcd8cdb.css");
2
+ var $41fae9390a5a37fa$exports = require("./combobox_css.main.js");
3
+ var $9e627d9ac6346a53$exports = require("./intlStrings.main.js");
4
+ var $e514018f82d1b067$exports = require("./MobileComboBox.main.js");
5
+ require("./vars.963b3e04.css");
6
+ var $2f86633ce5b04f1e$exports = require("./inputgroup_vars_css.main.js");
7
+ require("./vars.25f9ddd3.css");
8
+ var $40cb3a00c193680f$exports = require("./textfield_vars_css.main.js");
9
+ var $XxzjX$spectrumiconsuiChevronDownMedium = require("@spectrum-icons/ui/ChevronDownMedium");
10
+ var $XxzjX$reactspectrumutils = require("@react-spectrum/utils");
11
+ var $XxzjX$reactspectrumlabel = require("@react-spectrum/label");
12
+ var $XxzjX$reactspectrumbutton = require("@react-spectrum/button");
13
+ var $XxzjX$reactariafocus = require("@react-aria/focus");
14
+ var $XxzjX$reactspectrumlistbox = require("@react-spectrum/listbox");
15
+ var $XxzjX$reactspectrumoverlays = require("@react-spectrum/overlays");
16
+ var $XxzjX$reactariainteractions = require("@react-aria/interactions");
17
+ var $XxzjX$reactspectrumprogress = require("@react-spectrum/progress");
18
+ var $XxzjX$react = require("react");
19
+ var $XxzjX$reactspectrumtextfield = require("@react-spectrum/textfield");
20
+ var $XxzjX$reactariacombobox = require("@react-aria/combobox");
21
+ var $XxzjX$reactstatelycombobox = require("@react-stately/combobox");
22
+ var $XxzjX$reactariai18n = require("@react-aria/i18n");
23
+ var $XxzjX$reactspectrumform = require("@react-spectrum/form");
24
+ var $XxzjX$reactariautils = require("@react-aria/utils");
25
+ var $XxzjX$reactspectrumprovider = require("@react-spectrum/provider");
26
+
27
+
28
+ function $parcel$interopDefault(a) {
29
+ return a && a.__esModule ? a.default : a;
30
+ }
31
+
32
+ function $parcel$export(e, n, v, s) {
33
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
34
+ }
35
+
36
+ $parcel$export(module.exports, "ComboBox", () => $e4f518eb9b010873$export$72b9695b8216309a);
37
+ /*
38
+ * Copyright 2020 Adobe. All rights reserved.
39
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
40
+ * you may not use this file except in compliance with the License. You may obtain a copy
41
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
42
+ *
43
+ * Unless required by applicable law or agreed to in writing, software distributed under
44
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
45
+ * OF ANY KIND, either express or implied. See the License for the specific language
46
+ * governing permissions and limitations under the License.
47
+ */
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+ function $e4f518eb9b010873$var$ComboBox(props, ref) {
70
+ props = (0, $XxzjX$reactspectrumprovider.useProviderProps)(props);
71
+ props = (0, $XxzjX$reactspectrumform.useFormProps)(props);
72
+ if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/ComboBox.html#help-text');
73
+ let isMobile = (0, $XxzjX$reactspectrumutils.useIsMobileDevice)();
74
+ if (isMobile) // menuTrigger=focus/manual don't apply to mobile combobox
75
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $e514018f82d1b067$exports.MobileComboBox), {
76
+ ...props,
77
+ menuTrigger: "input",
78
+ ref: ref
79
+ });
80
+ else return /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement($e4f518eb9b010873$var$ComboBoxBase, {
81
+ ...props,
82
+ ref: ref
83
+ });
84
+ }
85
+ const $e4f518eb9b010873$var$ComboBoxBase = /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).forwardRef(function ComboBoxBase(props, ref) {
86
+ let { menuTrigger: menuTrigger = 'input', shouldFlip: shouldFlip = true, direction: direction = 'bottom', align: align = 'start', isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, allowsCustomValue: allowsCustomValue, menuWidth: customMenuWidth, name: name, formValue: formValue = 'text' } = props;
87
+ if (allowsCustomValue) formValue = 'text';
88
+ let stringFormatter = (0, $XxzjX$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($9e627d9ac6346a53$exports))), '@react-spectrum/combobox');
89
+ let isAsync = loadingState != null;
90
+ let popoverRef = (0, $XxzjX$react.useRef)(undefined);
91
+ let unwrappedPopoverRef = (0, $XxzjX$reactspectrumutils.useUnwrapDOMRef)(popoverRef);
92
+ let buttonRef = (0, $XxzjX$react.useRef)(undefined);
93
+ let unwrappedButtonRef = (0, $XxzjX$reactspectrumutils.useUnwrapDOMRef)(buttonRef);
94
+ let listBoxRef = (0, $XxzjX$react.useRef)(undefined);
95
+ let inputRef = (0, $XxzjX$react.useRef)(undefined);
96
+ // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
97
+ let inputGroupRef = (0, $XxzjX$react.useRef)(undefined);
98
+ let domRef = (0, $XxzjX$reactspectrumutils.useFocusableRef)(ref, inputRef);
99
+ let { contains: contains } = (0, $XxzjX$reactariai18n.useFilter)({
100
+ sensitivity: 'base'
101
+ });
102
+ let state = (0, $XxzjX$reactstatelycombobox.useComboBoxState)({
103
+ ...props,
104
+ defaultFilter: contains,
105
+ allowsEmptyCollection: isAsync
106
+ });
107
+ let layout = (0, $XxzjX$reactspectrumlistbox.useListBoxLayout)();
108
+ let { buttonProps: buttonProps, inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $XxzjX$reactariacombobox.useComboBox)({
109
+ ...props,
110
+ layoutDelegate: layout,
111
+ buttonRef: unwrappedButtonRef,
112
+ popoverRef: unwrappedPopoverRef,
113
+ listBoxRef: listBoxRef,
114
+ inputRef: inputRef,
115
+ menuTrigger: menuTrigger,
116
+ name: formValue === 'text' ? name : undefined
117
+ }, state);
118
+ // Measure the width of the inputfield and the button to inform the width of the menu (below).
119
+ let [menuWidth, setMenuWidth] = (0, $XxzjX$react.useState)(null);
120
+ let { scale: scale } = (0, $XxzjX$reactspectrumprovider.useProvider)();
121
+ let onResize = (0, $XxzjX$react.useCallback)(()=>{
122
+ if (unwrappedButtonRef.current && inputRef.current) {
123
+ let buttonWidth = unwrappedButtonRef.current.offsetWidth;
124
+ let inputWidth = inputRef.current.offsetWidth;
125
+ setMenuWidth(buttonWidth + inputWidth);
126
+ }
127
+ }, [
128
+ unwrappedButtonRef,
129
+ inputRef,
130
+ setMenuWidth
131
+ ]);
132
+ (0, $XxzjX$reactspectrumutils.useResizeObserver)({
133
+ ref: domRef,
134
+ onResize: onResize
135
+ });
136
+ (0, $XxzjX$reactariautils.useLayoutEffect)(onResize, [
137
+ scale,
138
+ onResize
139
+ ]);
140
+ let width = isQuiet ? null : menuWidth;
141
+ let style = {
142
+ width: customMenuWidth ? (0, $XxzjX$reactspectrumutils.dimensionValue)(customMenuWidth) : width,
143
+ minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
144
+ };
145
+ var _state_selectedKey;
146
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, ($parcel$interopDefault($XxzjX$react))).Fragment, null, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactspectrumlabel.Field), {
147
+ ...props,
148
+ descriptionProps: descriptionProps,
149
+ errorMessageProps: errorMessageProps,
150
+ isInvalid: isInvalid,
151
+ validationErrors: validationErrors,
152
+ validationDetails: validationDetails,
153
+ labelProps: labelProps,
154
+ ref: domRef
155
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement($e4f518eb9b010873$var$ComboBoxInput, {
156
+ ...props,
157
+ isOpen: state.isOpen,
158
+ loadingState: loadingState,
159
+ inputProps: inputProps,
160
+ inputRef: inputRef,
161
+ triggerProps: buttonProps,
162
+ triggerRef: buttonRef,
163
+ validationState: props.validationState || (isInvalid ? 'invalid' : null),
164
+ ref: inputGroupRef
165
+ })), name && formValue === 'key' && /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement("input", {
166
+ type: "hidden",
167
+ name: name,
168
+ value: (_state_selectedKey = state.selectedKey) !== null && _state_selectedKey !== void 0 ? _state_selectedKey : ''
169
+ }), /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactspectrumoverlays.Popover), {
170
+ state: state,
171
+ UNSAFE_style: style,
172
+ UNSAFE_className: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-popover', {
173
+ 'spectrum-InputGroup-popover--quiet': isQuiet
174
+ }),
175
+ ref: popoverRef,
176
+ triggerRef: inputGroupRef,
177
+ scrollRef: listBoxRef,
178
+ placement: `${direction} ${align}`,
179
+ hideArrow: true,
180
+ isNonModal: true,
181
+ shouldFlip: shouldFlip
182
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactspectrumlistbox.ListBoxBase), {
183
+ ...listBoxProps,
184
+ ref: listBoxRef,
185
+ disallowEmptySelection: true,
186
+ autoFocus: state.focusStrategy,
187
+ shouldSelectOnPressUp: true,
188
+ focusOnPointerEnter: true,
189
+ layout: layout,
190
+ state: state,
191
+ shouldUseVirtualFocus: true,
192
+ isLoading: loadingState === 'loading' || loadingState === 'loadingMore',
193
+ showLoadingSpinner: loadingState === 'loadingMore',
194
+ onLoadMore: onLoadMore,
195
+ renderEmptyState: ()=>isAsync && /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement("span", {
196
+ className: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'no-results')
197
+ }, loadingState === 'loading' ? stringFormatter.format('loading') : stringFormatter.format('noResults'))
198
+ })));
199
+ });
200
+ const $e4f518eb9b010873$var$ComboBoxInput = /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).forwardRef(function ComboBoxInput(props, ref) {
201
+ let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, inputProps: inputProps, inputRef: inputRef, triggerProps: triggerProps, triggerRef: triggerRef, autoFocus: autoFocus, style: style, className: className, loadingState: loadingState, isOpen: isOpen, menuTrigger: menuTrigger } = props;
202
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $XxzjX$reactariainteractions.useHover)({});
203
+ let stringFormatter = (0, $XxzjX$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($9e627d9ac6346a53$exports))), '@react-spectrum/combobox');
204
+ let timeout = (0, $XxzjX$react.useRef)(null);
205
+ let [showLoading, setShowLoading] = (0, $XxzjX$react.useState)(false);
206
+ let loadingCircle = /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactspectrumprogress.ProgressCircle), {
207
+ "aria-label": stringFormatter.format('loading'),
208
+ size: "S",
209
+ isIndeterminate: true,
210
+ UNSAFE_className: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-circleLoader', (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-input-circleLoader'))
211
+ });
212
+ let isLoading = loadingState === 'loading' || loadingState === 'filtering';
213
+ let inputValue = inputProps.value;
214
+ let lastInputValue = (0, $XxzjX$react.useRef)(inputValue);
215
+ (0, $XxzjX$react.useEffect)(()=>{
216
+ if (isLoading && !showLoading) {
217
+ if (timeout.current === null) timeout.current = setTimeout(()=>{
218
+ setShowLoading(true);
219
+ }, 500);
220
+ // If user is typing, clear the timer and restart since it is a new request
221
+ if (inputValue !== lastInputValue.current) {
222
+ clearTimeout(timeout.current);
223
+ timeout.current = setTimeout(()=>{
224
+ setShowLoading(true);
225
+ }, 500);
226
+ }
227
+ } else if (!isLoading) {
228
+ // If loading is no longer happening, clear any timers and hide the loading circle
229
+ setShowLoading(false);
230
+ clearTimeout(timeout.current);
231
+ timeout.current = null;
232
+ }
233
+ lastInputValue.current = inputValue;
234
+ }, [
235
+ isLoading,
236
+ showLoading,
237
+ inputValue
238
+ ]);
239
+ (0, $XxzjX$react.useEffect)(()=>{
240
+ return ()=>{
241
+ clearTimeout(timeout.current);
242
+ timeout.current = null;
243
+ };
244
+ }, []);
245
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactariafocus.FocusRing), {
246
+ within: true,
247
+ isTextInput: true,
248
+ focusClass: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'is-focused'),
249
+ focusRingClass: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'focus-ring'),
250
+ autoFocus: autoFocus
251
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement("div", {
252
+ ...hoverProps,
253
+ ref: ref,
254
+ style: style,
255
+ className: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup', {
256
+ 'spectrum-InputGroup--quiet': isQuiet,
257
+ 'is-disabled': isDisabled,
258
+ 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
259
+ 'is-hovered': isHovered
260
+ }, className)
261
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactspectrumtextfield.TextFieldBase), {
262
+ inputProps: inputProps,
263
+ inputRef: inputRef,
264
+ UNSAFE_className: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-field'),
265
+ inputClassName: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-input'),
266
+ validationIconClassName: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-input-validationIcon'),
267
+ isDisabled: isDisabled,
268
+ isQuiet: isQuiet,
269
+ validationState: validationState,
270
+ // loading circle should only be displayed if menu is open, if menuTrigger is "manual", or first time load (to stop circle from showing up when user selects an option)
271
+ // TODO: add special case for completionMode: complete as well
272
+ isLoading: showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'),
273
+ loadingIndicator: loadingState != null && loadingCircle,
274
+ disableFocusRing: true
275
+ }), /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactariainteractions.PressResponder), {
276
+ preventFocusOnPress: true,
277
+ isPressed: isOpen
278
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactspectrumbutton.FieldButton), {
279
+ ...triggerProps,
280
+ ref: triggerRef,
281
+ UNSAFE_className: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-FieldButton'),
282
+ isQuiet: isQuiet,
283
+ validationState: validationState
284
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, ($parcel$interopDefault($XxzjX$spectrumiconsuiChevronDownMedium))), {
285
+ UNSAFE_className: (0, $XxzjX$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-Dropdown-chevron')
286
+ })))));
287
+ });
288
+ /**
289
+ * ComboBoxes combine a text entry with a picker menu, allowing users to filter longer lists to only the selections matching a query.
290
+ */ const $e4f518eb9b010873$export$72b9695b8216309a = /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).forwardRef($e4f518eb9b010873$var$ComboBox);
291
+
292
+
293
+ //# sourceMappingURL=ComboBox.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AA4CD,SAAS,+BAA2B,KAA+B,EAAE,GAA8B;IACjG,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IAErB,IAAI,MAAM,WAAW,EACnB,QAAQ,IAAI,CAAC;IAGf,IAAI,WAAW,CAAA,G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U;QACd,KAAK;QACL,OAAO;QACP,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,uBACA;YACE,8BAA8B;YAC9B,eAAe;YACf,gCAAgC,oBAAoB,aAAa,CAAC;YAClE,cAAc;QAChB,GACA;qBAGJ,0DAAC,CAAA,GAAA,2CAAY;QACX,YAAY;QACZ,UAAU;QACV,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,gBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,yBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,YAAY;QACZ,SAAS;QACT,iBAAiB;QACjB,uKAAuK;QACvK,8DAA8D;QAC9D,WAAW,eAAgB,CAAA,UAAU,gBAAgB,YAAY,iBAAiB,SAAQ;QAC1F,kBAAkB,gBAAgB,QAAQ;QAC1C,kBAAA;sBACF,0DAAC,CAAA,GAAA,2CAAa;QAAE,qBAAA;QAAoB,WAAW;qBAC7C,0DAAC,CAAA,GAAA,sCAAU;QACR,GAAG,YAAY;QAChB,KAAK;QACL,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,SAAS;QACT,iBAAiB;qBACjB,0DAAC,CAAA,GAAA,iEAAgB;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAMpE;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/combobox/src/ComboBox.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport ChevronDownMedium from '@spectrum-icons/ui/ChevronDownMedium';\nimport {\n classNames,\n dimensionValue,\n useFocusableRef,\n useIsMobileDevice,\n useResizeObserver,\n useUnwrapDOMRef\n} from '@react-spectrum/utils';\nimport comboboxStyles from './combobox.css';\nimport {DOMRefValue, FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {FocusRing} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListBoxBase, useListBoxLayout} from '@react-spectrum/listbox';\nimport {MobileComboBox} from './MobileComboBox';\nimport {Popover} from '@react-spectrum/overlays';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {\n InputHTMLAttributes,\n ReactElement,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {SpectrumComboBoxProps} from '@react-types/combobox';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TextFieldBase} from '@react-spectrum/textfield';\nimport textfieldStyles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useComboBoxState} from '@react-stately/combobox';\nimport {useFilter, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider, useProviderProps} from '@react-spectrum/provider';\n\nfunction ComboBox<T extends object>(props: SpectrumComboBoxProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n if (props.placeholder) {\n console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/ComboBox.html#help-text');\n }\n\n let isMobile = useIsMobileDevice();\n if (isMobile) {\n // menuTrigger=focus/manual don't apply to mobile combobox\n return <MobileComboBox {...props} menuTrigger=\"input\" ref={ref} />;\n } else {\n return <ComboBoxBase {...props} ref={ref} />;\n }\n}\n\nconst ComboBoxBase = React.forwardRef(function ComboBoxBase<T extends object>(props: SpectrumComboBoxProps<T>, ref: FocusableRef<HTMLElement>) {\n let {\n menuTrigger = 'input',\n shouldFlip = true,\n direction = 'bottom',\n align = 'start',\n isQuiet,\n loadingState,\n onLoadMore,\n allowsCustomValue,\n menuWidth: customMenuWidth,\n name,\n formValue = 'text'\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n let isAsync = loadingState != null;\n let popoverRef = useRef<DOMRefValue<HTMLDivElement>>(undefined);\n let unwrappedPopoverRef = useUnwrapDOMRef(popoverRef);\n let buttonRef = useRef<FocusableRefValue<HTMLElement>>(undefined);\n let unwrappedButtonRef = useUnwrapDOMRef(buttonRef);\n let listBoxRef = useRef(undefined);\n let inputRef = useRef<HTMLInputElement>(undefined);\n // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.\n let inputGroupRef = useRef<HTMLDivElement>(undefined);\n let domRef = useFocusableRef(ref, inputRef);\n\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState(\n {\n ...props,\n defaultFilter: contains,\n allowsEmptyCollection: isAsync\n }\n );\n let layout = useListBoxLayout();\n\n let {buttonProps, inputProps, listBoxProps, labelProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useComboBox(\n {\n ...props,\n layoutDelegate: layout,\n buttonRef: unwrappedButtonRef,\n popoverRef: unwrappedPopoverRef,\n listBoxRef,\n inputRef: inputRef,\n menuTrigger,\n name: formValue === 'text' ? name : undefined\n },\n state\n );\n\n // Measure the width of the inputfield and the button to inform the width of the menu (below).\n let [menuWidth, setMenuWidth] = useState(null);\n let {scale} = useProvider();\n\n let onResize = useCallback(() => {\n if (unwrappedButtonRef.current && inputRef.current) {\n let buttonWidth = unwrappedButtonRef.current.offsetWidth;\n let inputWidth = inputRef.current.offsetWidth;\n setMenuWidth(buttonWidth + inputWidth);\n }\n }, [unwrappedButtonRef, inputRef, setMenuWidth]);\n\n useResizeObserver({\n ref: domRef,\n onResize: onResize\n });\n\n useLayoutEffect(onResize, [scale, onResize]);\n\n let width = isQuiet ? null : menuWidth;\n let style = {\n width: customMenuWidth ? dimensionValue(customMenuWidth) : width,\n minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth\n };\n\n return (\n <>\n <Field\n {...props}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n labelProps={labelProps}\n ref={domRef}>\n <ComboBoxInput\n {...props}\n isOpen={state.isOpen}\n loadingState={loadingState}\n inputProps={inputProps}\n inputRef={inputRef}\n triggerProps={buttonProps}\n triggerRef={buttonRef}\n validationState={props.validationState || (isInvalid ? 'invalid' : null)}\n ref={inputGroupRef} />\n </Field>\n {name && formValue === 'key' && <input type=\"hidden\" name={name} value={state.selectedKey ?? ''} />}\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {'spectrum-InputGroup-popover--quiet': isQuiet})}\n ref={popoverRef}\n triggerRef={inputGroupRef}\n scrollRef={listBoxRef}\n placement={`${direction} ${align}`}\n hideArrow\n isNonModal\n shouldFlip={shouldFlip}>\n <ListBoxBase\n {...listBoxProps}\n ref={listBoxRef}\n disallowEmptySelection\n autoFocus={state.focusStrategy}\n shouldSelectOnPressUp\n focusOnPointerEnter\n layout={layout}\n state={state}\n shouldUseVirtualFocus\n isLoading={loadingState === 'loading' || loadingState === 'loadingMore'}\n showLoadingSpinner={loadingState === 'loadingMore'}\n onLoadMore={onLoadMore}\n renderEmptyState={() => isAsync && (\n <span className={classNames(comboboxStyles, 'no-results')}>\n {loadingState === 'loading' ? stringFormatter.format('loading') : stringFormatter.format('noResults')}\n </span>\n )} />\n </Popover>\n </>\n );\n});\n\ninterface ComboBoxInputProps extends SpectrumComboBoxProps<unknown> {\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>,\n triggerProps: AriaButtonProps,\n triggerRef: RefObject<FocusableRefValue<HTMLElement> | null>,\n style?: React.CSSProperties,\n className?: string,\n isOpen?: boolean\n}\n\nconst ComboBoxInput = React.forwardRef(function ComboBoxInput(props: ComboBoxInputProps, ref: RefObject<HTMLElement | null>) {\n let {\n isQuiet,\n isDisabled,\n validationState,\n inputProps,\n inputRef,\n triggerProps,\n triggerRef,\n autoFocus,\n style,\n className,\n loadingState,\n isOpen,\n menuTrigger\n } = props;\n let {hoverProps, isHovered} = useHover({});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n let timeout = useRef(null);\n let [showLoading, setShowLoading] = useState(false);\n\n let loadingCircle = (\n <ProgressCircle\n aria-label={stringFormatter.format('loading')}\n size=\"S\"\n isIndeterminate\n UNSAFE_className={classNames(\n textfieldStyles,\n 'spectrum-Textfield-circleLoader',\n classNames(\n styles,\n 'spectrum-InputGroup-input-circleLoader'\n )\n )} />\n );\n\n let isLoading = loadingState === 'loading' || loadingState === 'filtering';\n let inputValue = inputProps.value;\n let lastInputValue = useRef(inputValue);\n useEffect(() => {\n if (isLoading && !showLoading) {\n if (timeout.current === null) {\n timeout.current = setTimeout(() => {\n setShowLoading(true);\n }, 500);\n }\n\n // If user is typing, clear the timer and restart since it is a new request\n if (inputValue !== lastInputValue.current) {\n clearTimeout(timeout.current);\n timeout.current = setTimeout(() => {\n setShowLoading(true);\n }, 500);\n }\n } else if (!isLoading) {\n // If loading is no longer happening, clear any timers and hide the loading circle\n setShowLoading(false);\n clearTimeout(timeout.current);\n timeout.current = null;\n }\n\n lastInputValue.current = inputValue;\n }, [isLoading, showLoading, inputValue]);\n\n useEffect(() => {\n return () => {\n clearTimeout(timeout.current);\n timeout.current = null;\n };\n }, []);\n\n return (\n (<FocusRing\n within\n isTextInput\n focusClass={classNames(styles, 'is-focused')}\n focusRingClass={classNames(styles, 'focus-ring')}\n autoFocus={autoFocus}>\n <div\n {...hoverProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n style={style}\n className={\n classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'is-disabled': isDisabled,\n 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,\n 'is-hovered': isHovered\n },\n className\n )\n }>\n <TextFieldBase\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-InputGroup-field'\n )\n }\n inputClassName={\n classNames(\n styles,\n 'spectrum-InputGroup-input'\n )\n }\n validationIconClassName={\n classNames(\n styles,\n 'spectrum-InputGroup-input-validationIcon'\n )\n }\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n // loading circle should only be displayed if menu is open, if menuTrigger is \"manual\", or first time load (to stop circle from showing up when user selects an option)\n // TODO: add special case for completionMode: complete as well\n isLoading={showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')}\n loadingIndicator={loadingState != null && loadingCircle}\n disableFocusRing />\n <PressResponder preventFocusOnPress isPressed={isOpen}>\n <FieldButton\n {...triggerProps}\n ref={triggerRef}\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-FieldButton'\n )\n }\n isQuiet={isQuiet}\n validationState={validationState}>\n <ChevronDownMedium UNSAFE_className={classNames(styles, 'spectrum-Dropdown-chevron')} />\n </FieldButton>\n </PressResponder>\n </div>\n </FocusRing>)\n );\n});\n\n/**\n * ComboBoxes combine a text entry with a picker menu, allowing users to filter longer lists to only the selections matching a query.\n */\nconst _ComboBox = React.forwardRef(ComboBox) as <T>(props: SpectrumComboBoxProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_ComboBox as ComboBox};\n"],"names":[],"version":3,"file":"ComboBox.main.js.map"}
@@ -0,0 +1,288 @@
1
+ import "./combobox.4bcd8cdb.css";
2
+ import $c3ZYr$combobox_cssmodulejs from "./combobox_css.mjs";
3
+ import $c3ZYr$intlStringsmodulejs from "./intlStrings.mjs";
4
+ import {MobileComboBox as $a1ae4cad4496428f$export$7637df911c069b4d} from "./MobileComboBox.mjs";
5
+ import "./vars.963b3e04.css";
6
+ import $c3ZYr$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.mjs";
7
+ import "./vars.25f9ddd3.css";
8
+ import $c3ZYr$textfield_vars_cssmodulejs from "./textfield_vars_css.mjs";
9
+ import $c3ZYr$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
10
+ import {useIsMobileDevice as $c3ZYr$useIsMobileDevice, useUnwrapDOMRef as $c3ZYr$useUnwrapDOMRef, useFocusableRef as $c3ZYr$useFocusableRef, useResizeObserver as $c3ZYr$useResizeObserver, dimensionValue as $c3ZYr$dimensionValue, classNames as $c3ZYr$classNames} from "@react-spectrum/utils";
11
+ import {Field as $c3ZYr$Field} from "@react-spectrum/label";
12
+ import {FieldButton as $c3ZYr$FieldButton} from "@react-spectrum/button";
13
+ import {FocusRing as $c3ZYr$FocusRing} from "@react-aria/focus";
14
+ import {useListBoxLayout as $c3ZYr$useListBoxLayout, ListBoxBase as $c3ZYr$ListBoxBase} from "@react-spectrum/listbox";
15
+ import {Popover as $c3ZYr$Popover} from "@react-spectrum/overlays";
16
+ import {useHover as $c3ZYr$useHover, PressResponder as $c3ZYr$PressResponder} from "@react-aria/interactions";
17
+ import {ProgressCircle as $c3ZYr$ProgressCircle} from "@react-spectrum/progress";
18
+ import $c3ZYr$react, {useRef as $c3ZYr$useRef, useState as $c3ZYr$useState, useCallback as $c3ZYr$useCallback, useEffect as $c3ZYr$useEffect} from "react";
19
+ import {TextFieldBase as $c3ZYr$TextFieldBase} from "@react-spectrum/textfield";
20
+ import {useComboBox as $c3ZYr$useComboBox} from "@react-aria/combobox";
21
+ import {useComboBoxState as $c3ZYr$useComboBoxState} from "@react-stately/combobox";
22
+ import {useLocalizedStringFormatter as $c3ZYr$useLocalizedStringFormatter, useFilter as $c3ZYr$useFilter} from "@react-aria/i18n";
23
+ import {useFormProps as $c3ZYr$useFormProps} from "@react-spectrum/form";
24
+ import {useLayoutEffect as $c3ZYr$useLayoutEffect} from "@react-aria/utils";
25
+ import {useProviderProps as $c3ZYr$useProviderProps, useProvider as $c3ZYr$useProvider} from "@react-spectrum/provider";
26
+
27
+
28
+ function $parcel$interopDefault(a) {
29
+ return a && a.__esModule ? a.default : a;
30
+ }
31
+ /*
32
+ * Copyright 2020 Adobe. All rights reserved.
33
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
34
+ * you may not use this file except in compliance with the License. You may obtain a copy
35
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing, software distributed under
38
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
39
+ * OF ANY KIND, either express or implied. See the License for the specific language
40
+ * governing permissions and limitations under the License.
41
+ */
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ function $2289f375e813f187$var$ComboBox(props, ref) {
64
+ props = (0, $c3ZYr$useProviderProps)(props);
65
+ props = (0, $c3ZYr$useFormProps)(props);
66
+ if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/ComboBox.html#help-text');
67
+ let isMobile = (0, $c3ZYr$useIsMobileDevice)();
68
+ if (isMobile) // menuTrigger=focus/manual don't apply to mobile combobox
69
+ return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $a1ae4cad4496428f$export$7637df911c069b4d), {
70
+ ...props,
71
+ menuTrigger: "input",
72
+ ref: ref
73
+ });
74
+ else return /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxBase, {
75
+ ...props,
76
+ ref: ref
77
+ });
78
+ }
79
+ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBoxBase(props, ref) {
80
+ let { menuTrigger: menuTrigger = 'input', shouldFlip: shouldFlip = true, direction: direction = 'bottom', align: align = 'start', isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, allowsCustomValue: allowsCustomValue, menuWidth: customMenuWidth, name: name, formValue: formValue = 'text' } = props;
81
+ if (allowsCustomValue) formValue = 'text';
82
+ let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
83
+ let isAsync = loadingState != null;
84
+ let popoverRef = (0, $c3ZYr$useRef)(undefined);
85
+ let unwrappedPopoverRef = (0, $c3ZYr$useUnwrapDOMRef)(popoverRef);
86
+ let buttonRef = (0, $c3ZYr$useRef)(undefined);
87
+ let unwrappedButtonRef = (0, $c3ZYr$useUnwrapDOMRef)(buttonRef);
88
+ let listBoxRef = (0, $c3ZYr$useRef)(undefined);
89
+ let inputRef = (0, $c3ZYr$useRef)(undefined);
90
+ // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
91
+ let inputGroupRef = (0, $c3ZYr$useRef)(undefined);
92
+ let domRef = (0, $c3ZYr$useFocusableRef)(ref, inputRef);
93
+ let { contains: contains } = (0, $c3ZYr$useFilter)({
94
+ sensitivity: 'base'
95
+ });
96
+ let state = (0, $c3ZYr$useComboBoxState)({
97
+ ...props,
98
+ defaultFilter: contains,
99
+ allowsEmptyCollection: isAsync
100
+ });
101
+ let layout = (0, $c3ZYr$useListBoxLayout)();
102
+ let { buttonProps: buttonProps, inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $c3ZYr$useComboBox)({
103
+ ...props,
104
+ layoutDelegate: layout,
105
+ buttonRef: unwrappedButtonRef,
106
+ popoverRef: unwrappedPopoverRef,
107
+ listBoxRef: listBoxRef,
108
+ inputRef: inputRef,
109
+ menuTrigger: menuTrigger,
110
+ name: formValue === 'text' ? name : undefined
111
+ }, state);
112
+ // Measure the width of the inputfield and the button to inform the width of the menu (below).
113
+ let [menuWidth, setMenuWidth] = (0, $c3ZYr$useState)(null);
114
+ let { scale: scale } = (0, $c3ZYr$useProvider)();
115
+ let onResize = (0, $c3ZYr$useCallback)(()=>{
116
+ if (unwrappedButtonRef.current && inputRef.current) {
117
+ let buttonWidth = unwrappedButtonRef.current.offsetWidth;
118
+ let inputWidth = inputRef.current.offsetWidth;
119
+ setMenuWidth(buttonWidth + inputWidth);
120
+ }
121
+ }, [
122
+ unwrappedButtonRef,
123
+ inputRef,
124
+ setMenuWidth
125
+ ]);
126
+ (0, $c3ZYr$useResizeObserver)({
127
+ ref: domRef,
128
+ onResize: onResize
129
+ });
130
+ (0, $c3ZYr$useLayoutEffect)(onResize, [
131
+ scale,
132
+ onResize
133
+ ]);
134
+ let width = isQuiet ? null : menuWidth;
135
+ let style = {
136
+ width: customMenuWidth ? (0, $c3ZYr$dimensionValue)(customMenuWidth) : width,
137
+ minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
138
+ };
139
+ var _state_selectedKey;
140
+ return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$react).Fragment, null, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Field), {
141
+ ...props,
142
+ descriptionProps: descriptionProps,
143
+ errorMessageProps: errorMessageProps,
144
+ isInvalid: isInvalid,
145
+ validationErrors: validationErrors,
146
+ validationDetails: validationDetails,
147
+ labelProps: labelProps,
148
+ ref: domRef
149
+ }, /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxInput, {
150
+ ...props,
151
+ isOpen: state.isOpen,
152
+ loadingState: loadingState,
153
+ inputProps: inputProps,
154
+ inputRef: inputRef,
155
+ triggerProps: buttonProps,
156
+ triggerRef: buttonRef,
157
+ validationState: props.validationState || (isInvalid ? 'invalid' : null),
158
+ ref: inputGroupRef
159
+ })), name && formValue === 'key' && /*#__PURE__*/ (0, $c3ZYr$react).createElement("input", {
160
+ type: "hidden",
161
+ name: name,
162
+ value: (_state_selectedKey = state.selectedKey) !== null && _state_selectedKey !== void 0 ? _state_selectedKey : ''
163
+ }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Popover), {
164
+ state: state,
165
+ UNSAFE_style: style,
166
+ UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-popover', {
167
+ 'spectrum-InputGroup-popover--quiet': isQuiet
168
+ }),
169
+ ref: popoverRef,
170
+ triggerRef: inputGroupRef,
171
+ scrollRef: listBoxRef,
172
+ placement: `${direction} ${align}`,
173
+ hideArrow: true,
174
+ isNonModal: true,
175
+ shouldFlip: shouldFlip
176
+ }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$ListBoxBase), {
177
+ ...listBoxProps,
178
+ ref: listBoxRef,
179
+ disallowEmptySelection: true,
180
+ autoFocus: state.focusStrategy,
181
+ shouldSelectOnPressUp: true,
182
+ focusOnPointerEnter: true,
183
+ layout: layout,
184
+ state: state,
185
+ shouldUseVirtualFocus: true,
186
+ isLoading: loadingState === 'loading' || loadingState === 'loadingMore',
187
+ showLoadingSpinner: loadingState === 'loadingMore',
188
+ onLoadMore: onLoadMore,
189
+ renderEmptyState: ()=>isAsync && /*#__PURE__*/ (0, $c3ZYr$react).createElement("span", {
190
+ className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$combobox_cssmodulejs))), 'no-results')
191
+ }, loadingState === 'loading' ? stringFormatter.format('loading') : stringFormatter.format('noResults'))
192
+ })));
193
+ });
194
+ const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBoxInput(props, ref) {
195
+ let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, inputProps: inputProps, inputRef: inputRef, triggerProps: triggerProps, triggerRef: triggerRef, autoFocus: autoFocus, style: style, className: className, loadingState: loadingState, isOpen: isOpen, menuTrigger: menuTrigger } = props;
196
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $c3ZYr$useHover)({});
197
+ let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
198
+ let timeout = (0, $c3ZYr$useRef)(null);
199
+ let [showLoading, setShowLoading] = (0, $c3ZYr$useState)(false);
200
+ let loadingCircle = /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$ProgressCircle), {
201
+ "aria-label": stringFormatter.format('loading'),
202
+ size: "S",
203
+ isIndeterminate: true,
204
+ UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$textfield_vars_cssmodulejs))), 'spectrum-Textfield-circleLoader', (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-circleLoader'))
205
+ });
206
+ let isLoading = loadingState === 'loading' || loadingState === 'filtering';
207
+ let inputValue = inputProps.value;
208
+ let lastInputValue = (0, $c3ZYr$useRef)(inputValue);
209
+ (0, $c3ZYr$useEffect)(()=>{
210
+ if (isLoading && !showLoading) {
211
+ if (timeout.current === null) timeout.current = setTimeout(()=>{
212
+ setShowLoading(true);
213
+ }, 500);
214
+ // If user is typing, clear the timer and restart since it is a new request
215
+ if (inputValue !== lastInputValue.current) {
216
+ clearTimeout(timeout.current);
217
+ timeout.current = setTimeout(()=>{
218
+ setShowLoading(true);
219
+ }, 500);
220
+ }
221
+ } else if (!isLoading) {
222
+ // If loading is no longer happening, clear any timers and hide the loading circle
223
+ setShowLoading(false);
224
+ clearTimeout(timeout.current);
225
+ timeout.current = null;
226
+ }
227
+ lastInputValue.current = inputValue;
228
+ }, [
229
+ isLoading,
230
+ showLoading,
231
+ inputValue
232
+ ]);
233
+ (0, $c3ZYr$useEffect)(()=>{
234
+ return ()=>{
235
+ clearTimeout(timeout.current);
236
+ timeout.current = null;
237
+ };
238
+ }, []);
239
+ return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$FocusRing), {
240
+ within: true,
241
+ isTextInput: true,
242
+ focusClass: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'is-focused'),
243
+ focusRingClass: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'focus-ring'),
244
+ autoFocus: autoFocus
245
+ }, /*#__PURE__*/ (0, $c3ZYr$react).createElement("div", {
246
+ ...hoverProps,
247
+ ref: ref,
248
+ style: style,
249
+ className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup', {
250
+ 'spectrum-InputGroup--quiet': isQuiet,
251
+ 'is-disabled': isDisabled,
252
+ 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
253
+ 'is-hovered': isHovered
254
+ }, className)
255
+ }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$TextFieldBase), {
256
+ inputProps: inputProps,
257
+ inputRef: inputRef,
258
+ UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'),
259
+ inputClassName: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input'),
260
+ validationIconClassName: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-validationIcon'),
261
+ isDisabled: isDisabled,
262
+ isQuiet: isQuiet,
263
+ validationState: validationState,
264
+ // loading circle should only be displayed if menu is open, if menuTrigger is "manual", or first time load (to stop circle from showing up when user selects an option)
265
+ // TODO: add special case for completionMode: complete as well
266
+ isLoading: showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'),
267
+ loadingIndicator: loadingState != null && loadingCircle,
268
+ disableFocusRing: true
269
+ }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$PressResponder), {
270
+ preventFocusOnPress: true,
271
+ isPressed: isOpen
272
+ }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$FieldButton), {
273
+ ...triggerProps,
274
+ ref: triggerRef,
275
+ UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-FieldButton'),
276
+ isQuiet: isQuiet,
277
+ validationState: validationState
278
+ }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$spectrumiconsuiChevronDownMedium), {
279
+ UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-Dropdown-chevron')
280
+ })))));
281
+ });
282
+ /**
283
+ * ComboBoxes combine a text entry with a picker menu, allowing users to filter longer lists to only the selections matching a query.
284
+ */ const $2289f375e813f187$export$72b9695b8216309a = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef($2289f375e813f187$var$ComboBox);
285
+
286
+
287
+ export {$2289f375e813f187$export$72b9695b8216309a as ComboBox};
288
+ //# sourceMappingURL=ComboBox.module.js.map