@react-spectrum/combobox 3.16.7 → 3.17.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 (240) hide show
  1. package/dist/import.mjs +5 -3
  2. package/dist/main.js +7 -5
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +5 -3
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +4 -0
  7. package/package.json +14 -49
  8. package/src/index.ts +5 -3
  9. package/dist/ComboBox.main.js +0 -305
  10. package/dist/ComboBox.main.js.map +0 -1
  11. package/dist/ComboBox.mjs +0 -300
  12. package/dist/ComboBox.module.js +0 -300
  13. package/dist/ComboBox.module.js.map +0 -1
  14. package/dist/MobileComboBox.main.js +0 -432
  15. package/dist/MobileComboBox.main.js.map +0 -1
  16. package/dist/MobileComboBox.mjs +0 -427
  17. package/dist/MobileComboBox.module.js +0 -427
  18. package/dist/MobileComboBox.module.js.map +0 -1
  19. package/dist/ar-AE.main.js +0 -10
  20. package/dist/ar-AE.main.js.map +0 -1
  21. package/dist/ar-AE.mjs +0 -12
  22. package/dist/ar-AE.module.js +0 -12
  23. package/dist/ar-AE.module.js.map +0 -1
  24. package/dist/bg-BG.main.js +0 -10
  25. package/dist/bg-BG.main.js.map +0 -1
  26. package/dist/bg-BG.mjs +0 -12
  27. package/dist/bg-BG.module.js +0 -12
  28. package/dist/bg-BG.module.js.map +0 -1
  29. package/dist/button_vars_css.main.js +0 -125
  30. package/dist/button_vars_css.main.js.map +0 -1
  31. package/dist/button_vars_css.mjs +0 -127
  32. package/dist/button_vars_css.module.js +0 -127
  33. package/dist/button_vars_css.module.js.map +0 -1
  34. package/dist/combobox.1c1869da.css +0 -50
  35. package/dist/combobox.1c1869da.css.map +0 -1
  36. package/dist/combobox.32e7c48f.css +0 -550
  37. package/dist/combobox.32e7c48f.css.map +0 -1
  38. package/dist/combobox.8958325b.css +0 -1669
  39. package/dist/combobox.8958325b.css.map +0 -1
  40. package/dist/combobox.a38acc5c.css +0 -649
  41. package/dist/combobox.a38acc5c.css.map +0 -1
  42. package/dist/combobox.cab3a9ff.css +0 -271
  43. package/dist/combobox.cab3a9ff.css.map +0 -1
  44. package/dist/combobox.cce0a74c.css +0 -223
  45. package/dist/combobox.cce0a74c.css.map +0 -1
  46. package/dist/combobox_css.main.js +0 -35
  47. package/dist/combobox_css.main.js.map +0 -1
  48. package/dist/combobox_css.mjs +0 -37
  49. package/dist/combobox_css.module.js +0 -37
  50. package/dist/combobox_css.module.js.map +0 -1
  51. package/dist/cs-CZ.main.js +0 -10
  52. package/dist/cs-CZ.main.js.map +0 -1
  53. package/dist/cs-CZ.mjs +0 -12
  54. package/dist/cs-CZ.module.js +0 -12
  55. package/dist/cs-CZ.module.js.map +0 -1
  56. package/dist/da-DK.main.js +0 -10
  57. package/dist/da-DK.main.js.map +0 -1
  58. package/dist/da-DK.mjs +0 -12
  59. package/dist/da-DK.module.js +0 -12
  60. package/dist/da-DK.module.js.map +0 -1
  61. package/dist/de-DE.main.js +0 -10
  62. package/dist/de-DE.main.js.map +0 -1
  63. package/dist/de-DE.mjs +0 -12
  64. package/dist/de-DE.module.js +0 -12
  65. package/dist/de-DE.module.js.map +0 -1
  66. package/dist/el-GR.main.js +0 -10
  67. package/dist/el-GR.main.js.map +0 -1
  68. package/dist/el-GR.mjs +0 -12
  69. package/dist/el-GR.module.js +0 -12
  70. package/dist/el-GR.module.js.map +0 -1
  71. package/dist/en-US.main.js +0 -10
  72. package/dist/en-US.main.js.map +0 -1
  73. package/dist/en-US.mjs +0 -12
  74. package/dist/en-US.module.js +0 -12
  75. package/dist/en-US.module.js.map +0 -1
  76. package/dist/es-ES.main.js +0 -10
  77. package/dist/es-ES.main.js.map +0 -1
  78. package/dist/es-ES.mjs +0 -12
  79. package/dist/es-ES.module.js +0 -12
  80. package/dist/es-ES.module.js.map +0 -1
  81. package/dist/et-EE.main.js +0 -10
  82. package/dist/et-EE.main.js.map +0 -1
  83. package/dist/et-EE.mjs +0 -12
  84. package/dist/et-EE.module.js +0 -12
  85. package/dist/et-EE.module.js.map +0 -1
  86. package/dist/fi-FI.main.js +0 -10
  87. package/dist/fi-FI.main.js.map +0 -1
  88. package/dist/fi-FI.mjs +0 -12
  89. package/dist/fi-FI.module.js +0 -12
  90. package/dist/fi-FI.module.js.map +0 -1
  91. package/dist/fieldlabel_vars_css.main.js +0 -95
  92. package/dist/fieldlabel_vars_css.main.js.map +0 -1
  93. package/dist/fieldlabel_vars_css.mjs +0 -97
  94. package/dist/fieldlabel_vars_css.module.js +0 -97
  95. package/dist/fieldlabel_vars_css.module.js.map +0 -1
  96. package/dist/fr-FR.main.js +0 -10
  97. package/dist/fr-FR.main.js.map +0 -1
  98. package/dist/fr-FR.mjs +0 -12
  99. package/dist/fr-FR.module.js +0 -12
  100. package/dist/fr-FR.module.js.map +0 -1
  101. package/dist/he-IL.main.js +0 -10
  102. package/dist/he-IL.main.js.map +0 -1
  103. package/dist/he-IL.mjs +0 -12
  104. package/dist/he-IL.module.js +0 -12
  105. package/dist/he-IL.module.js.map +0 -1
  106. package/dist/hr-HR.main.js +0 -10
  107. package/dist/hr-HR.main.js.map +0 -1
  108. package/dist/hr-HR.mjs +0 -12
  109. package/dist/hr-HR.module.js +0 -12
  110. package/dist/hr-HR.module.js.map +0 -1
  111. package/dist/hu-HU.main.js +0 -10
  112. package/dist/hu-HU.main.js.map +0 -1
  113. package/dist/hu-HU.mjs +0 -12
  114. package/dist/hu-HU.module.js +0 -12
  115. package/dist/hu-HU.module.js.map +0 -1
  116. package/dist/inputgroup_vars_css.main.js +0 -86
  117. package/dist/inputgroup_vars_css.main.js.map +0 -1
  118. package/dist/inputgroup_vars_css.mjs +0 -88
  119. package/dist/inputgroup_vars_css.module.js +0 -88
  120. package/dist/inputgroup_vars_css.module.js.map +0 -1
  121. package/dist/intlStrings.main.js +0 -108
  122. package/dist/intlStrings.main.js.map +0 -1
  123. package/dist/intlStrings.mjs +0 -110
  124. package/dist/intlStrings.module.js +0 -110
  125. package/dist/intlStrings.module.js.map +0 -1
  126. package/dist/it-IT.main.js +0 -10
  127. package/dist/it-IT.main.js.map +0 -1
  128. package/dist/it-IT.mjs +0 -12
  129. package/dist/it-IT.module.js +0 -12
  130. package/dist/it-IT.module.js.map +0 -1
  131. package/dist/ja-JP.main.js +0 -10
  132. package/dist/ja-JP.main.js.map +0 -1
  133. package/dist/ja-JP.mjs +0 -12
  134. package/dist/ja-JP.module.js +0 -12
  135. package/dist/ja-JP.module.js.map +0 -1
  136. package/dist/ko-KR.main.js +0 -10
  137. package/dist/ko-KR.main.js.map +0 -1
  138. package/dist/ko-KR.mjs +0 -12
  139. package/dist/ko-KR.module.js +0 -12
  140. package/dist/ko-KR.module.js.map +0 -1
  141. package/dist/lt-LT.main.js +0 -10
  142. package/dist/lt-LT.main.js.map +0 -1
  143. package/dist/lt-LT.mjs +0 -12
  144. package/dist/lt-LT.module.js +0 -12
  145. package/dist/lt-LT.module.js.map +0 -1
  146. package/dist/lv-LV.main.js +0 -10
  147. package/dist/lv-LV.main.js.map +0 -1
  148. package/dist/lv-LV.mjs +0 -12
  149. package/dist/lv-LV.module.js +0 -12
  150. package/dist/lv-LV.module.js.map +0 -1
  151. package/dist/nb-NO.main.js +0 -10
  152. package/dist/nb-NO.main.js.map +0 -1
  153. package/dist/nb-NO.mjs +0 -12
  154. package/dist/nb-NO.module.js +0 -12
  155. package/dist/nb-NO.module.js.map +0 -1
  156. package/dist/nl-NL.main.js +0 -10
  157. package/dist/nl-NL.main.js.map +0 -1
  158. package/dist/nl-NL.mjs +0 -12
  159. package/dist/nl-NL.module.js +0 -12
  160. package/dist/nl-NL.module.js.map +0 -1
  161. package/dist/pl-PL.main.js +0 -10
  162. package/dist/pl-PL.main.js.map +0 -1
  163. package/dist/pl-PL.mjs +0 -12
  164. package/dist/pl-PL.module.js +0 -12
  165. package/dist/pl-PL.module.js.map +0 -1
  166. package/dist/pt-BR.main.js +0 -10
  167. package/dist/pt-BR.main.js.map +0 -1
  168. package/dist/pt-BR.mjs +0 -12
  169. package/dist/pt-BR.module.js +0 -12
  170. package/dist/pt-BR.module.js.map +0 -1
  171. package/dist/pt-PT.main.js +0 -10
  172. package/dist/pt-PT.main.js.map +0 -1
  173. package/dist/pt-PT.mjs +0 -12
  174. package/dist/pt-PT.module.js +0 -12
  175. package/dist/pt-PT.module.js.map +0 -1
  176. package/dist/ro-RO.main.js +0 -10
  177. package/dist/ro-RO.main.js.map +0 -1
  178. package/dist/ro-RO.mjs +0 -12
  179. package/dist/ro-RO.module.js +0 -12
  180. package/dist/ro-RO.module.js.map +0 -1
  181. package/dist/ru-RU.main.js +0 -10
  182. package/dist/ru-RU.main.js.map +0 -1
  183. package/dist/ru-RU.mjs +0 -12
  184. package/dist/ru-RU.module.js +0 -12
  185. package/dist/ru-RU.module.js.map +0 -1
  186. package/dist/search_vars_css.main.js +0 -53
  187. package/dist/search_vars_css.main.js.map +0 -1
  188. package/dist/search_vars_css.mjs +0 -55
  189. package/dist/search_vars_css.module.js +0 -55
  190. package/dist/search_vars_css.module.js.map +0 -1
  191. package/dist/sk-SK.main.js +0 -10
  192. package/dist/sk-SK.main.js.map +0 -1
  193. package/dist/sk-SK.mjs +0 -12
  194. package/dist/sk-SK.module.js +0 -12
  195. package/dist/sk-SK.module.js.map +0 -1
  196. package/dist/sl-SI.main.js +0 -10
  197. package/dist/sl-SI.main.js.map +0 -1
  198. package/dist/sl-SI.mjs +0 -12
  199. package/dist/sl-SI.module.js +0 -12
  200. package/dist/sl-SI.module.js.map +0 -1
  201. package/dist/sr-SP.main.js +0 -10
  202. package/dist/sr-SP.main.js.map +0 -1
  203. package/dist/sr-SP.mjs +0 -12
  204. package/dist/sr-SP.module.js +0 -12
  205. package/dist/sr-SP.module.js.map +0 -1
  206. package/dist/sv-SE.main.js +0 -10
  207. package/dist/sv-SE.main.js.map +0 -1
  208. package/dist/sv-SE.mjs +0 -12
  209. package/dist/sv-SE.module.js +0 -12
  210. package/dist/sv-SE.module.js.map +0 -1
  211. package/dist/textfield_vars_css.main.js +0 -74
  212. package/dist/textfield_vars_css.main.js.map +0 -1
  213. package/dist/textfield_vars_css.mjs +0 -76
  214. package/dist/textfield_vars_css.module.js +0 -76
  215. package/dist/textfield_vars_css.module.js.map +0 -1
  216. package/dist/tr-TR.main.js +0 -10
  217. package/dist/tr-TR.main.js.map +0 -1
  218. package/dist/tr-TR.mjs +0 -12
  219. package/dist/tr-TR.module.js +0 -12
  220. package/dist/tr-TR.module.js.map +0 -1
  221. package/dist/types.d.ts +0 -13
  222. package/dist/types.d.ts.map +0 -1
  223. package/dist/uk-UA.main.js +0 -10
  224. package/dist/uk-UA.main.js.map +0 -1
  225. package/dist/uk-UA.mjs +0 -12
  226. package/dist/uk-UA.module.js +0 -12
  227. package/dist/uk-UA.module.js.map +0 -1
  228. package/dist/zh-CN.main.js +0 -10
  229. package/dist/zh-CN.main.js.map +0 -1
  230. package/dist/zh-CN.mjs +0 -12
  231. package/dist/zh-CN.module.js +0 -12
  232. package/dist/zh-CN.module.js.map +0 -1
  233. package/dist/zh-TW.main.js +0 -10
  234. package/dist/zh-TW.main.js.map +0 -1
  235. package/dist/zh-TW.mjs +0 -12
  236. package/dist/zh-TW.module.js +0 -12
  237. package/dist/zh-TW.module.js.map +0 -1
  238. package/src/ComboBox.tsx +0 -376
  239. package/src/MobileComboBox.tsx +0 -571
  240. package/src/combobox.css +0 -65
@@ -1,432 +0,0 @@
1
- require("./combobox.8958325b.css");
2
- var $afc5a4514aca2340$exports = require("./button_vars_css.main.js");
3
- require("./combobox.1c1869da.css");
4
- var $41fae9390a5a37fa$exports = require("./combobox_css.main.js");
5
- var $9e627d9ac6346a53$exports = require("./intlStrings.main.js");
6
- require("./combobox.cab3a9ff.css");
7
- var $eb2fc0ee655eff6b$exports = require("./fieldlabel_vars_css.main.js");
8
- require("./combobox.cce0a74c.css");
9
- var $1e139f06a0a4b696$exports = require("./search_vars_css.main.js");
10
- require("./combobox.a38acc5c.css");
11
- var $2f86633ce5b04f1e$exports = require("./inputgroup_vars_css.main.js");
12
- require("./combobox.32e7c48f.css");
13
- var $40cb3a00c193680f$exports = require("./textfield_vars_css.main.js");
14
- var $iKVNA$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
15
- var $iKVNA$spectrumiconsuiCheckmarkMedium = require("@spectrum-icons/ui/CheckmarkMedium");
16
- var $iKVNA$spectrumiconsuiChevronDownMedium = require("@spectrum-icons/ui/ChevronDownMedium");
17
- var $iKVNA$reactspectrumutils = require("@react-spectrum/utils");
18
- var $iKVNA$reactspectrumbutton = require("@react-spectrum/button");
19
- var $iKVNA$reactstatelycombobox = require("@react-stately/combobox");
20
- var $iKVNA$reactariaoverlays = require("@react-aria/overlays");
21
- var $iKVNA$reactspectrumlabel = require("@react-spectrum/label");
22
- var $iKVNA$reactariafocus = require("@react-aria/focus");
23
- var $iKVNA$reactariainteractions = require("@react-aria/interactions");
24
- var $iKVNA$reactariautils = require("@react-aria/utils");
25
- var $iKVNA$reactspectrumlistbox = require("@react-spectrum/listbox");
26
- var $iKVNA$reactspectrumprogress = require("@react-spectrum/progress");
27
- var $iKVNA$react = require("react");
28
- var $iKVNA$reactspectrumtextfield = require("@react-spectrum/textfield");
29
- var $iKVNA$reactspectrumoverlays = require("@react-spectrum/overlays");
30
- var $iKVNA$reactariabutton = require("@react-aria/button");
31
- var $iKVNA$reactariacombobox = require("@react-aria/combobox");
32
- var $iKVNA$reactariadialog = require("@react-aria/dialog");
33
- var $iKVNA$reactarialabel = require("@react-aria/label");
34
- var $iKVNA$reactariai18n = require("@react-aria/i18n");
35
- var $iKVNA$reactariaform = require("@react-aria/form");
36
- var $iKVNA$reactspectrumprovider = require("@react-spectrum/provider");
37
-
38
-
39
- function $parcel$interopDefault(a) {
40
- return a && a.__esModule ? a.default : a;
41
- }
42
-
43
- function $parcel$export(e, n, v, s) {
44
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
45
- }
46
-
47
- $parcel$export(module.exports, "MobileComboBox", () => $e514018f82d1b067$export$7637df911c069b4d);
48
- /*
49
- * Copyright 2020 Adobe. All rights reserved.
50
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
51
- * you may not use this file except in compliance with the License. You may obtain a copy
52
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
53
- *
54
- * Unless required by applicable law or agreed to in writing, software distributed under
55
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
56
- * OF ANY KIND, either express or implied. See the License for the specific language
57
- * governing permissions and limitations under the License.
58
- */
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
- const $e514018f82d1b067$export$7637df911c069b4d = /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).forwardRef(function MobileComboBox(props, ref) {
89
- props = (0, $iKVNA$reactspectrumprovider.useProviderProps)(props);
90
- let { isQuiet: isQuiet, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, validationBehavior: validationBehavior, name: name, formValue: formValue = 'text', allowsCustomValue: allowsCustomValue } = props;
91
- if (allowsCustomValue) formValue = 'text';
92
- let { contains: contains } = (0, $iKVNA$reactariai18n.useFilter)({
93
- sensitivity: 'base'
94
- });
95
- let state = (0, $iKVNA$reactstatelycombobox.useComboBoxState)({
96
- ...props,
97
- defaultFilter: contains,
98
- allowsEmptyCollection: true,
99
- // Needs to be false here otherwise we double up on commitSelection/commitCustomValue calls when
100
- // user taps on underlay (i.e. initial tap will call setFocused(false) -> commitSelection/commitCustomValue via onBlur,
101
- // then the closing of the tray will call setFocused(false) again due to cleanup effect)
102
- shouldCloseOnBlur: false
103
- });
104
- let buttonRef = (0, $iKVNA$react.useRef)(null);
105
- let domRef = (0, $iKVNA$reactspectrumutils.useFocusableRef)(ref, buttonRef);
106
- let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $iKVNA$reactariaoverlays.useOverlayTrigger)({
107
- type: 'listbox'
108
- }, state, buttonRef);
109
- let inputRef = (0, $iKVNA$react.useRef)(null);
110
- (0, $iKVNA$reactariaform.useFormValidation)({
111
- ...props,
112
- focus: ()=>{
113
- var _buttonRef_current;
114
- return (_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.focus();
115
- }
116
- }, state, inputRef);
117
- let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
118
- let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);
119
- var _props_errorMessage;
120
- let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(' ');
121
- let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $iKVNA$reactarialabel.useField)({
122
- ...props,
123
- labelElementType: 'span',
124
- isInvalid: isInvalid,
125
- errorMessage: errorMessage
126
- });
127
- // Focus the button and show focus ring when clicking on the label
128
- labelProps.onClick = ()=>{
129
- if (!props.isDisabled) {
130
- var _buttonRef_current;
131
- (_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.focus();
132
- (0, $iKVNA$reactariainteractions.setInteractionModality)('keyboard');
133
- }
134
- };
135
- let inputProps = {
136
- type: 'hidden',
137
- name: name,
138
- value: formValue === 'text' ? state.inputValue : String(state.selectedKey)
139
- };
140
- if (validationBehavior === 'native') {
141
- // Use a hidden <input type="text"> rather than <input type="hidden">
142
- // so that an empty value blocks HTML form submission when the field is required.
143
- inputProps.type = 'text';
144
- inputProps.hidden = true;
145
- inputProps.required = isRequired;
146
- // Ignore react warning.
147
- inputProps.onChange = ()=>{};
148
- }
149
- (0, $iKVNA$reactariautils.useFormReset)(inputRef, formValue === 'text' ? state.defaultInputValue : state.defaultSelectedKey, formValue === 'text' ? state.setInputValue : state.setSelectedKey);
150
- return /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, ($parcel$interopDefault($iKVNA$react))).Fragment, null, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactspectrumlabel.Field), {
151
- ...props,
152
- labelProps: labelProps,
153
- descriptionProps: descriptionProps,
154
- errorMessageProps: errorMessageProps,
155
- validationState: validationState,
156
- isInvalid: isInvalid,
157
- validationErrors: validationErrors,
158
- validationDetails: validationDetails,
159
- elementType: "span",
160
- ref: domRef,
161
- includeNecessityIndicatorInAccessibilityName: true
162
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement($e514018f82d1b067$export$adfa0abcd5972f7e, {
163
- ...(0, $iKVNA$reactariautils.mergeProps)(triggerProps, fieldProps, {
164
- autoFocus: props.autoFocus
165
- }),
166
- ref: buttonRef,
167
- isQuiet: isQuiet,
168
- isDisabled: isDisabled,
169
- isPlaceholder: !state.inputValue,
170
- validationState: validationState,
171
- onPress: ()=>!isReadOnly && state.open(null, 'manual')
172
- }, state.inputValue || props.placeholder || '')), /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("input", {
173
- ...inputProps,
174
- ref: inputRef
175
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactspectrumoverlays.Tray), {
176
- state: state,
177
- isFixedHeight: true,
178
- ...overlayProps
179
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement($e514018f82d1b067$var$ComboBoxTray, {
180
- ...props,
181
- onClose: state.close,
182
- overlayProps: overlayProps,
183
- state: state
184
- })));
185
- });
186
- const $e514018f82d1b067$export$adfa0abcd5972f7e = /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).forwardRef(function ComboBoxButton(props, ref) {
187
- let { isQuiet: isQuiet, isDisabled: isDisabled, isPlaceholder: isPlaceholder, validationState: validationState, children: children, style: style, className: className } = props;
188
- let stringFormatter = (0, $iKVNA$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($9e627d9ac6346a53$exports))), '@react-spectrum/combobox');
189
- let valueId = (0, $iKVNA$reactariautils.useId)();
190
- let invalidId = (0, $iKVNA$reactariautils.useId)();
191
- let validId = (0, $iKVNA$reactariautils.useId)();
192
- let validationIcon = validationState === 'invalid' ? /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, ($parcel$interopDefault($iKVNA$spectrumiconsuiAlertMedium))), {
193
- id: invalidId,
194
- "aria-label": stringFormatter.format('invalid')
195
- }) : /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, ($parcel$interopDefault($iKVNA$spectrumiconsuiCheckmarkMedium))), {
196
- id: validId,
197
- "aria-label": stringFormatter.format('valid')
198
- });
199
- let validation = /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).cloneElement(validationIcon, {
200
- UNSAFE_className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-validationIcon', (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-input-validationIcon'))
201
- });
202
- let objRef = (0, $iKVNA$reactariautils.useObjectRef)(ref);
203
- let { hoverProps: hoverProps, isHovered: isHovered } = (0, $iKVNA$reactariainteractions.useHover)({});
204
- let { buttonProps: buttonProps, isPressed: isPressed } = (0, $iKVNA$reactariabutton.useButton)({
205
- ...props,
206
- 'aria-labelledby': [
207
- props['aria-labelledby'],
208
- props['aria-label'] && !props['aria-labelledby'] ? props.id : null,
209
- valueId,
210
- validationState === 'invalid' ? invalidId : null,
211
- validationState === 'valid' ? validId : null
212
- ].filter(Boolean).join(' '),
213
- elementType: 'div'
214
- }, objRef);
215
- return /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactariafocus.FocusRing), {
216
- focusClass: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'is-focused'),
217
- focusRingClass: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'focus-ring')
218
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("div", {
219
- ...(0, $iKVNA$reactariautils.mergeProps)(hoverProps, buttonProps),
220
- "aria-haspopup": "dialog",
221
- ref: objRef,
222
- style: {
223
- ...style,
224
- outline: 'none'
225
- },
226
- className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup', {
227
- 'spectrum-InputGroup--quiet': isQuiet,
228
- 'is-disabled': isDisabled,
229
- 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
230
- 'is-hovered': isHovered
231
- }, (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'mobile-combobox'), className)
232
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("div", {
233
- className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield', {
234
- 'spectrum-Textfield--invalid': validationState === 'invalid' && !isDisabled,
235
- 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,
236
- 'spectrum-Textfield--quiet': isQuiet
237
- }, (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-field'))
238
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("div", {
239
- className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-input', {
240
- 'is-hovered': isHovered,
241
- 'is-placeholder': isPlaceholder,
242
- 'is-disabled': isDisabled
243
- }, (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-input', (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), 'spectrum-Field-field')), (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'mobile-input'))
244
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("span", {
245
- id: valueId,
246
- className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'mobile-value')
247
- }, children)), validationState && !isDisabled ? validation : null), /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("div", {
248
- className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($afc5a4514aca2340$exports))), 'spectrum-FieldButton', {
249
- 'spectrum-FieldButton--quiet': isQuiet,
250
- 'is-active': isPressed,
251
- 'is-disabled': isDisabled,
252
- 'spectrum-FieldButton--invalid': validationState === 'invalid' && !isDisabled,
253
- 'is-hovered': isHovered
254
- }, (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-FieldButton'))
255
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, ($parcel$interopDefault($iKVNA$spectrumiconsuiChevronDownMedium))), {
256
- UNSAFE_className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-Dropdown-chevron')
257
- }))));
258
- });
259
- function $e514018f82d1b067$var$ComboBoxTray(props) {
260
- let { state: // completionMode = 'suggest',
261
- state, isDisabled: isDisabled, validationState: validationState, label: label, overlayProps: overlayProps, loadingState: loadingState, onLoadMore: onLoadMore, onClose: onClose } = props;
262
- let timeout = (0, $iKVNA$react.useRef)(null);
263
- let [showLoading, setShowLoading] = (0, $iKVNA$react.useState)(false);
264
- let inputRef = (0, $iKVNA$react.useRef)(null);
265
- let buttonRef = (0, $iKVNA$react.useRef)(null);
266
- let popoverRef = (0, $iKVNA$react.useRef)(null);
267
- let listBoxRef = (0, $iKVNA$react.useRef)(null);
268
- let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
269
- let layout = (0, $iKVNA$reactspectrumlistbox.useListBoxLayout)();
270
- let stringFormatter = (0, $iKVNA$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($9e627d9ac6346a53$exports))), '@react-spectrum/combobox');
271
- let { inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps } = (0, $iKVNA$reactariacombobox.useComboBox)({
272
- ...props,
273
- // completionMode,
274
- layoutDelegate: layout,
275
- buttonRef: (0, $iKVNA$reactspectrumutils.unwrapDOMRef)(buttonRef),
276
- popoverRef: popoverRef,
277
- listBoxRef: listBoxRef,
278
- inputRef: inputRef,
279
- // Handled outside the tray.
280
- name: undefined
281
- }, state);
282
- (0, ($parcel$interopDefault($iKVNA$react))).useEffect(()=>{
283
- if (inputRef.current) (0, $iKVNA$reactariainteractions.focusSafely)(inputRef.current);
284
- }, []);
285
- (0, ($parcel$interopDefault($iKVNA$react))).useEffect(()=>{
286
- // When the tray closes, set state.isFocused (i.e. the tray input's focus tracker) to false.
287
- // This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay
288
- // (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to "contain")
289
- // Have to do this manually since React doesn't call onBlur when a component is unmounted: https://github.com/facebook/react/issues/12363
290
- if (!state.isOpen && state.isFocused) state.setFocused(false);
291
- });
292
- let { dialogProps: dialogProps } = (0, $iKVNA$reactariadialog.useDialog)({
293
- 'aria-labelledby': (0, $iKVNA$reactariautils.useId)(labelProps.id)
294
- }, popoverRef);
295
- // Override the role of the input to "searchbox" instead of "combobox".
296
- // Since the listbox is always visible, the combobox role doesn't really give us anything.
297
- // VoiceOver on iOS reads "double tap to collapse" when focused on the input rather than
298
- // "double tap to edit text", as with a textbox or searchbox. We'd like double tapping to
299
- // open the virtual keyboard rather than closing the tray.
300
- // Unlike "combobox", "aria-expanded" is not a valid attribute on "searchbox".
301
- inputProps.role = 'searchbox';
302
- inputProps['aria-haspopup'] = 'listbox';
303
- delete inputProps['aria-expanded'];
304
- delete inputProps.onTouchEnd;
305
- let clearButton = /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactspectrumbutton.ClearButton), {
306
- preventFocus: true,
307
- "aria-label": stringFormatter.format('clear'),
308
- excludeFromTabOrder: true,
309
- onPress: ()=>{
310
- var _inputRef_current;
311
- state.setInputValue('');
312
- (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
313
- },
314
- UNSAFE_className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-ClearButton'),
315
- isDisabled: isDisabled
316
- });
317
- let loadingCircle = /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactspectrumprogress.ProgressCircle), {
318
- "aria-label": stringFormatter.format('loading'),
319
- size: "S",
320
- isIndeterminate: true,
321
- UNSAFE_className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-circleLoader', (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-circleLoader'))
322
- });
323
- // Close the software keyboard on scroll to give the user a bigger area to scroll.
324
- // But only do this if scrolling with touch, otherwise it can cause issues with touch
325
- // screen readers.
326
- let isTouchDown = (0, $iKVNA$react.useRef)(false);
327
- let onTouchStart = ()=>{
328
- isTouchDown.current = true;
329
- };
330
- let onTouchEnd = ()=>{
331
- isTouchDown.current = false;
332
- };
333
- let onScroll = (0, $iKVNA$react.useCallback)(()=>{
334
- var _popoverRef_current;
335
- if (!inputRef.current || (0, $iKVNA$reactariautils.getActiveElement)() !== inputRef.current || !isTouchDown.current) return;
336
- (_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
337
- }, [
338
- inputRef,
339
- popoverRef,
340
- isTouchDown
341
- ]);
342
- let inputValue = inputProps.value;
343
- let lastInputValue = (0, $iKVNA$react.useRef)(inputValue);
344
- (0, $iKVNA$react.useEffect)(()=>{
345
- if (loadingState === 'filtering' && !showLoading) {
346
- if (timeout.current === null) timeout.current = setTimeout(()=>{
347
- setShowLoading(true);
348
- }, 500);
349
- // If user is typing, clear the timer and restart since it is a new request
350
- if (inputValue !== lastInputValue.current) {
351
- clearTimeout(timeout.current);
352
- timeout.current = setTimeout(()=>{
353
- setShowLoading(true);
354
- }, 500);
355
- }
356
- } else if (loadingState !== 'filtering') {
357
- // If loading is no longer happening, clear any timers and hide the loading circle
358
- setShowLoading(false);
359
- if (timeout.current) clearTimeout(timeout.current);
360
- timeout.current = null;
361
- }
362
- lastInputValue.current = inputValue;
363
- }, [
364
- loadingState,
365
- inputValue,
366
- showLoading
367
- ]);
368
- let onKeyDown = (e)=>{
369
- var _popoverRef_current, _inputProps_onKeyDown;
370
- // Close virtual keyboard if user hits Enter w/o any focused options
371
- if (e.key === 'Enter' && state.selectionManager.focusedKey == null) (_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
372
- else (_inputProps_onKeyDown = inputProps.onKeyDown) === null || _inputProps_onKeyDown === void 0 ? void 0 : _inputProps_onKeyDown.call(inputProps, e);
373
- };
374
- return /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactariafocus.FocusScope), {
375
- restoreFocus: true,
376
- contain: true
377
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("div", {
378
- ...(0, $iKVNA$reactariautils.mergeProps)(overlayProps, dialogProps),
379
- ref: popoverRef,
380
- className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'tray-dialog')
381
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactariaoverlays.DismissButton), {
382
- onDismiss: onClose
383
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactspectrumtextfield.TextFieldBase), {
384
- label: label,
385
- labelProps: labelProps,
386
- inputProps: {
387
- ...inputProps,
388
- onKeyDown: onKeyDown
389
- },
390
- inputRef: inputRef,
391
- isDisabled: isDisabled,
392
- isLoading: showLoading && loadingState === 'filtering',
393
- loadingIndicator: loadingState != null ? loadingCircle : undefined,
394
- validationState: validationState,
395
- labelAlign: "start",
396
- labelPosition: "top",
397
- wrapperChildren: (state.inputValue !== '' || loadingState === 'filtering' || validationState != null) && !props.isReadOnly ? clearButton : undefined,
398
- UNSAFE_className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search', 'spectrum-Textfield', 'spectrum-Search--loadable', {
399
- 'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,
400
- 'spectrum-Search--valid': validationState === 'valid' && !isDisabled
401
- }, (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'tray-textfield', {
402
- 'has-label': !!props.label
403
- })),
404
- inputClassName: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'tray-textfield-input', (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-input')),
405
- validationIconClassName: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-validationIcon')
406
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactspectrumlistbox.ListBoxBase), {
407
- ...listBoxProps,
408
- domProps: {
409
- onTouchStart: onTouchStart,
410
- onTouchEnd: onTouchEnd
411
- },
412
- disallowEmptySelection: true,
413
- shouldSelectOnPressUp: true,
414
- focusOnPointerEnter: true,
415
- layout: layout,
416
- state: state,
417
- shouldUseVirtualFocus: true,
418
- renderEmptyState: ()=>loadingState !== 'loading' && /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement("span", {
419
- className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'no-results')
420
- }, stringFormatter.format('noResults')),
421
- UNSAFE_className: (0, $iKVNA$reactspectrumutils.classNames)((0, ($parcel$interopDefault($41fae9390a5a37fa$exports))), 'tray-listbox'),
422
- ref: listBoxRef,
423
- onScroll: onScroll,
424
- onLoadMore: onLoadMore,
425
- isLoading: isLoading
426
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($iKVNA$react))).createElement((0, $iKVNA$reactariaoverlays.DismissButton), {
427
- onDismiss: onClose
428
- })));
429
- }
430
-
431
-
432
- //# sourceMappingURL=MobileComboBox.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCM,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,eAAe,KAAiC,EAAE,GAA8B;IACtI,QAAQ,CAAA,GAAA,6CAAe,EAAE;IAEzB,IAAI,WACF,OAAO,cACP,UAAU,cACV,UAAU,cACV,UAAU,sBACV,kBAAkB,QAClB,IAAI,aACJ,YAAY,2BACZ,iBAAiB,EAClB,GAAG;IACJ,IAAI,mBACF,YAAY;IAGd,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,GAAA,8BAAQ,EAAE;QAAC,aAAa;IAAM;IAC/C,IAAI,QAAQ,CAAA,GAAA,4CAAe,EAAE;Q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AU,GAAG,cAAc;QAC3I,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAW,GACX,mBACA,sBACA,6BACA;YACE,4BAA4B,oBAAoB,aAAa,CAAC;YAC9D,0BAA0B,oBAAoB,WAAW,CAAC;QAC5D,GACA,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAa,GACb,kBACA;YACE,aAAa,CAAC,CAAC,MAAM,KAAK;QAC5B;QAIN,gBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAa,GACb,wBACA,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAW,GACX;QAIN,yBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAW,GACX;sBAGN,0DAAC,CAAA,GAAA,uCAAU;QACR,GAAG,YAAY;QAChB,UAAU;0BAAC;wBAAc;QAAU;QACnC,wBAAA;QACA,uBAAA;QACA,qBAAA;QACA,QAAQ;QACR,OAAO;QACP,uBAAA;QACA,kBAAkB,IAAM,iBAAiB,2BACvC,0DAAC;gBAAK,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAa,GAAG;eACzC,gBAAgB,MAAM,CAAC;QAG5B,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAa,GACb;QAGJ,KAAK;QACL,UAAU;QACV,YAAY;QACZ,WAAW;sBACb,0DAAC,CAAA,GAAA,sCAAY;QAAE,WAAW;;AAIlC","sources":["packages/@react-spectrum/combobox/src/MobileComboBox.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {AriaButtonProps} from '@react-types/button';\nimport buttonStyles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport ChevronDownMedium from '@spectrum-icons/ui/ChevronDownMedium';\nimport {classNames, unwrapDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {ClearButton} from '@react-spectrum/button';\nimport {ComboBoxState, useComboBoxState} from '@react-stately/combobox';\nimport comboboxStyles from './combobox.css';\nimport {DismissButton, useOverlayTrigger} from '@react-aria/overlays';\nimport {Field} from '@react-spectrum/label';\nimport {FocusableRef, FocusableRefValue, ValidationState} from '@react-types/shared';\nimport {FocusRing, FocusScope} from '@react-aria/focus';\nimport {focusSafely, setInteractionModality, useHover} from '@react-aria/interactions';\nimport {getActiveElement, mergeProps, useFormReset, useId, useObjectRef} from '@react-aria/utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {ListBoxBase, useListBoxLayout} from '@react-spectrum/listbox';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {ForwardedRef, HTMLAttributes, InputHTMLAttributes, ReactElement, ReactNode, useCallback, useEffect, useRef, useState} from 'react';\nimport searchStyles from '@adobe/spectrum-css-temp/components/search/vars.css';\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 {Tray} from '@react-spectrum/overlays';\nimport {useButton} from '@react-aria/button';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useDialog} from '@react-aria/dialog';\nimport {useField} from '@react-aria/label';\nimport {useFilter, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useFormValidation} from '@react-aria/form';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nexport const MobileComboBox = React.forwardRef(function MobileComboBox(props: SpectrumComboBoxProps<any>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n\n let {\n isQuiet,\n isDisabled,\n isReadOnly,\n isRequired,\n validationBehavior,\n name,\n formValue = 'text',\n allowsCustomValue\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState({\n ...props,\n defaultFilter: contains,\n allowsEmptyCollection: true,\n // Needs to be false here otherwise we double up on commitSelection/commitCustomValue calls when\n // user taps on underlay (i.e. initial tap will call setFocused(false) -> commitSelection/commitCustomValue via onBlur,\n // then the closing of the tray will call setFocused(false) again due to cleanup effect)\n shouldCloseOnBlur: false\n });\n\n let buttonRef = useRef<HTMLDivElement>(null);\n let domRef = useFocusableRef(ref, buttonRef);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'listbox'}, state, buttonRef);\n\n let inputRef = useRef<HTMLInputElement>(null);\n useFormValidation({\n ...props,\n focus: () => buttonRef.current?.focus()\n }, state, inputRef);\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);\n let errorMessage = props.errorMessage ?? validationErrors.join(' ');\n\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage\n });\n\n // Focus the button and show focus ring when clicking on the label\n labelProps.onClick = () => {\n if (!props.isDisabled) {\n buttonRef.current?.focus();\n setInteractionModality('keyboard');\n }\n };\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name,\n value: formValue === 'text' ? state.inputValue : String(state.selectedKey)\n };\n\n if (validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n useFormReset<any>(\n inputRef,\n formValue === 'text' ? state.defaultInputValue : state.defaultSelectedKey,\n formValue === 'text' ? state.setInputValue : state.setSelectedKey\n );\n\n return (\n <>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n validationState={validationState}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n elementType=\"span\"\n ref={domRef}\n includeNecessityIndicatorInAccessibilityName>\n <ComboBoxButton\n {...mergeProps(triggerProps, fieldProps, {autoFocus: props.autoFocus})}\n ref={buttonRef}\n isQuiet={isQuiet}\n isDisabled={isDisabled}\n isPlaceholder={!state.inputValue}\n validationState={validationState}\n onPress={() => !isReadOnly && state.open(null, 'manual')}>\n {state.inputValue || props.placeholder || ''}\n </ComboBoxButton>\n </Field>\n <input {...inputProps} ref={inputRef} />\n <Tray state={state} isFixedHeight {...overlayProps}>\n <ComboBoxTray\n {...props}\n onClose={state.close}\n overlayProps={overlayProps}\n state={state} />\n </Tray>\n </>\n );\n});\n\ninterface ComboBoxButtonProps extends AriaButtonProps {\n isQuiet?: boolean,\n isDisabled?: boolean,\n isPlaceholder?: boolean,\n validationState?: ValidationState,\n children?: ReactNode,\n style?: React.CSSProperties,\n className?: string\n}\n\nexport const ComboBoxButton = React.forwardRef(function ComboBoxButton(props: ComboBoxButtonProps, ref: ForwardedRef<HTMLDivElement>) {\n let {\n isQuiet,\n isDisabled,\n isPlaceholder,\n validationState,\n children,\n style,\n className\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n let valueId = useId();\n let invalidId = useId();\n let validId = useId();\n let validationIcon = validationState === 'invalid'\n ? <AlertMedium id={invalidId} aria-label={stringFormatter.format('invalid')} />\n : <CheckmarkMedium id={validId} aria-label={stringFormatter.format('valid')} />;\n\n let validation = React.cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n textfieldStyles,\n 'spectrum-Textfield-validationIcon',\n classNames(\n styles,\n 'spectrum-InputGroup-input-validationIcon'\n )\n )\n });\n\n let objRef = useObjectRef(ref);\n let {hoverProps, isHovered} = useHover({});\n let {buttonProps, isPressed} = useButton({\n ...props,\n 'aria-labelledby': [\n props['aria-labelledby'],\n props['aria-label'] && !props['aria-labelledby'] ? props.id : null,\n valueId,\n validationState === 'invalid' ? invalidId : null,\n validationState === 'valid' ? validId : null\n ].filter(Boolean).join(' '),\n elementType: 'div'\n }, objRef);\n\n return (\n (<FocusRing\n focusClass={classNames(styles, 'is-focused')}\n focusRingClass={classNames(styles, 'focus-ring')}>\n <div\n {...mergeProps(hoverProps, buttonProps)}\n aria-haspopup=\"dialog\"\n ref={objRef}\n style={{...style, outline: 'none'}}\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 classNames(\n comboboxStyles,\n 'mobile-combobox'\n ),\n className\n )\n }>\n <div\n className={\n classNames(\n textfieldStyles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': validationState === 'invalid' && !isDisabled,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--quiet': isQuiet\n },\n classNames(\n styles,\n 'spectrum-InputGroup-field'\n )\n )\n }>\n <div\n className={\n classNames(\n textfieldStyles,\n 'spectrum-Textfield-input',\n {\n 'is-hovered': isHovered,\n 'is-placeholder': isPlaceholder,\n 'is-disabled': isDisabled\n },\n classNames(\n styles,\n 'spectrum-InputGroup-input',\n classNames(labelStyles, 'spectrum-Field-field')\n ),\n classNames(\n comboboxStyles,\n 'mobile-input'\n )\n )\n }>\n <span\n id={valueId}\n className={\n classNames(\n comboboxStyles,\n 'mobile-value'\n )\n }>\n {children}\n </span>\n </div>\n {validationState && !isDisabled ? validation : null}\n </div>\n <div\n className={\n classNames(\n buttonStyles,\n 'spectrum-FieldButton',\n {\n 'spectrum-FieldButton--quiet': isQuiet,\n 'is-active': isPressed,\n 'is-disabled': isDisabled,\n 'spectrum-FieldButton--invalid': validationState === 'invalid' && !isDisabled,\n 'is-hovered': isHovered\n },\n classNames(\n styles,\n 'spectrum-FieldButton'\n )\n )\n }>\n <ChevronDownMedium UNSAFE_className={classNames(styles, 'spectrum-Dropdown-chevron')} />\n </div>\n </div>\n </FocusRing>)\n );\n});\n\ninterface ComboBoxTrayProps extends SpectrumComboBoxProps<any> {\n state: ComboBoxState<any>,\n overlayProps: HTMLAttributes<HTMLElement>,\n loadingIndicator?: ReactElement,\n onClose: () => void\n}\n\nfunction ComboBoxTray(props: ComboBoxTrayProps) {\n let {\n // completionMode = 'suggest',\n state,\n isDisabled,\n validationState,\n label,\n overlayProps,\n loadingState,\n onLoadMore,\n onClose\n } = props;\n\n let timeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let [showLoading, setShowLoading] = useState(false);\n let inputRef = useRef<HTMLInputElement>(null);\n let buttonRef = useRef<FocusableRefValue<HTMLElement>>(null);\n let popoverRef = useRef<HTMLDivElement>(null);\n let listBoxRef = useRef<HTMLDivElement>(null);\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n let layout = useListBoxLayout();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n\n let {inputProps, listBoxProps, labelProps} = useComboBox(\n {\n ...props,\n // completionMode,\n layoutDelegate: layout,\n buttonRef: unwrapDOMRef(buttonRef),\n popoverRef: popoverRef,\n listBoxRef,\n inputRef,\n // Handled outside the tray.\n name: undefined\n },\n state\n );\n\n React.useEffect(() => {\n if (inputRef.current) {\n focusSafely(inputRef.current);\n }\n }, []);\n\n React.useEffect(() => {\n // When the tray closes, set state.isFocused (i.e. the tray input's focus tracker) to false.\n // This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay\n // (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to \"contain\")\n // Have to do this manually since React doesn't call onBlur when a component is unmounted: https://github.com/facebook/react/issues/12363\n if (!state.isOpen && state.isFocused) {\n state.setFocused(false);\n }\n });\n\n let {dialogProps} = useDialog({\n 'aria-labelledby': useId(labelProps.id)\n }, popoverRef);\n\n // Override the role of the input to \"searchbox\" instead of \"combobox\".\n // Since the listbox is always visible, the combobox role doesn't really give us anything.\n // VoiceOver on iOS reads \"double tap to collapse\" when focused on the input rather than\n // \"double tap to edit text\", as with a textbox or searchbox. We'd like double tapping to\n // open the virtual keyboard rather than closing the tray.\n // Unlike \"combobox\", \"aria-expanded\" is not a valid attribute on \"searchbox\".\n inputProps.role = 'searchbox';\n inputProps['aria-haspopup'] = 'listbox';\n delete inputProps['aria-expanded'];\n delete inputProps.onTouchEnd;\n\n let clearButton = (\n <ClearButton\n preventFocus\n aria-label={stringFormatter.format('clear')}\n excludeFromTabOrder\n onPress={() => {\n state.setInputValue('');\n inputRef.current?.focus();\n }}\n UNSAFE_className={\n classNames(\n searchStyles,\n 'spectrum-ClearButton'\n )\n }\n isDisabled={isDisabled} />\n );\n\n let loadingCircle = (\n <ProgressCircle\n aria-label={stringFormatter.format('loading')}\n size=\"S\"\n isIndeterminate\n UNSAFE_className={classNames(\n searchStyles,\n 'spectrum-Search-circleLoader',\n classNames(\n textfieldStyles,\n 'spectrum-Textfield-circleLoader'\n )\n )} />\n );\n\n // Close the software keyboard on scroll to give the user a bigger area to scroll.\n // But only do this if scrolling with touch, otherwise it can cause issues with touch\n // screen readers.\n let isTouchDown = useRef(false);\n let onTouchStart = () => {\n isTouchDown.current = true;\n };\n\n let onTouchEnd = () => {\n isTouchDown.current = false;\n };\n\n let onScroll = useCallback(() => {\n if (!inputRef.current || getActiveElement() !== inputRef.current || !isTouchDown.current) {\n return;\n }\n\n popoverRef.current?.focus();\n }, [inputRef, popoverRef, isTouchDown]);\n\n let inputValue = inputProps.value;\n let lastInputValue = useRef(inputValue);\n useEffect(() => {\n if (loadingState === 'filtering' && !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 (loadingState !== 'filtering') {\n // If loading is no longer happening, clear any timers and hide the loading circle\n setShowLoading(false);\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n timeout.current = null;\n }\n\n lastInputValue.current = inputValue;\n }, [loadingState, inputValue, showLoading]);\n\n let onKeyDown = (e) => {\n // Close virtual keyboard if user hits Enter w/o any focused options\n if (e.key === 'Enter' && state.selectionManager.focusedKey == null) {\n popoverRef.current?.focus();\n } else {\n inputProps.onKeyDown?.(e);\n }\n };\n\n return (\n <FocusScope restoreFocus contain>\n <div\n {...mergeProps(overlayProps, dialogProps)}\n ref={popoverRef}\n className={\n classNames(\n comboboxStyles,\n 'tray-dialog'\n )\n }>\n <DismissButton onDismiss={onClose} />\n <TextFieldBase\n label={label}\n labelProps={labelProps}\n inputProps={{...inputProps, onKeyDown}}\n inputRef={inputRef}\n isDisabled={isDisabled}\n isLoading={showLoading && loadingState === 'filtering'}\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n validationState={validationState}\n labelAlign=\"start\"\n labelPosition=\"top\"\n wrapperChildren={(state.inputValue !== '' || loadingState === 'filtering' || validationState != null) && !props.isReadOnly ? clearButton : undefined}\n UNSAFE_className={\n classNames(\n searchStyles,\n 'spectrum-Search',\n 'spectrum-Textfield',\n 'spectrum-Search--loadable',\n {\n 'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,\n 'spectrum-Search--valid': validationState === 'valid' && !isDisabled\n },\n classNames(\n comboboxStyles,\n 'tray-textfield',\n {\n 'has-label': !!props.label\n }\n )\n )\n }\n inputClassName={\n classNames(\n comboboxStyles,\n 'tray-textfield-input',\n classNames(\n searchStyles,\n 'spectrum-Search-input'\n )\n )\n }\n validationIconClassName={\n classNames(\n searchStyles,\n 'spectrum-Search-validationIcon'\n )\n } />\n <ListBoxBase\n {...listBoxProps}\n domProps={{onTouchStart, onTouchEnd}}\n disallowEmptySelection\n shouldSelectOnPressUp\n focusOnPointerEnter\n layout={layout}\n state={state}\n shouldUseVirtualFocus\n renderEmptyState={() => loadingState !== 'loading' && (\n <span className={classNames(comboboxStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )}\n UNSAFE_className={\n classNames(\n comboboxStyles,\n 'tray-listbox'\n )\n }\n ref={listBoxRef}\n onScroll={onScroll}\n onLoadMore={onLoadMore}\n isLoading={isLoading} />\n <DismissButton onDismiss={onClose} />\n </div>\n </FocusScope>\n );\n}\n"],"names":[],"version":3,"file":"MobileComboBox.main.js.map"}