@react-spectrum/autocomplete 3.0.0-alpha.52 → 3.0.0-alpha.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/dist/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/MobileSearchAutocomplete.main.js +0 -449
  10. package/dist/MobileSearchAutocomplete.main.js.map +0 -1
  11. package/dist/MobileSearchAutocomplete.mjs +0 -444
  12. package/dist/MobileSearchAutocomplete.module.js +0 -444
  13. package/dist/MobileSearchAutocomplete.module.js.map +0 -1
  14. package/dist/SearchAutocomplete.main.js +0 -305
  15. package/dist/SearchAutocomplete.main.js.map +0 -1
  16. package/dist/SearchAutocomplete.mjs +0 -300
  17. package/dist/SearchAutocomplete.module.js +0 -300
  18. package/dist/SearchAutocomplete.module.js.map +0 -1
  19. package/dist/ar-AE.main.js +0 -9
  20. package/dist/ar-AE.main.js.map +0 -1
  21. package/dist/ar-AE.mjs +0 -11
  22. package/dist/ar-AE.module.js +0 -11
  23. package/dist/ar-AE.module.js.map +0 -1
  24. package/dist/autocomplete.02db68b2.css +0 -55
  25. package/dist/autocomplete.02db68b2.css.map +0 -1
  26. package/dist/autocomplete.102c5c14.css +0 -223
  27. package/dist/autocomplete.102c5c14.css.map +0 -1
  28. package/dist/autocomplete.30e64bfb.css +0 -550
  29. package/dist/autocomplete.30e64bfb.css.map +0 -1
  30. package/dist/autocomplete.c4adfff6.css +0 -649
  31. package/dist/autocomplete.c4adfff6.css.map +0 -1
  32. package/dist/bg-BG.main.js +0 -9
  33. package/dist/bg-BG.main.js.map +0 -1
  34. package/dist/bg-BG.mjs +0 -11
  35. package/dist/bg-BG.module.js +0 -11
  36. package/dist/bg-BG.module.js.map +0 -1
  37. package/dist/cs-CZ.main.js +0 -9
  38. package/dist/cs-CZ.main.js.map +0 -1
  39. package/dist/cs-CZ.mjs +0 -11
  40. package/dist/cs-CZ.module.js +0 -11
  41. package/dist/cs-CZ.module.js.map +0 -1
  42. package/dist/da-DK.main.js +0 -9
  43. package/dist/da-DK.main.js.map +0 -1
  44. package/dist/da-DK.mjs +0 -11
  45. package/dist/da-DK.module.js +0 -11
  46. package/dist/da-DK.module.js.map +0 -1
  47. package/dist/de-DE.main.js +0 -9
  48. package/dist/de-DE.main.js.map +0 -1
  49. package/dist/de-DE.mjs +0 -11
  50. package/dist/de-DE.module.js +0 -11
  51. package/dist/de-DE.module.js.map +0 -1
  52. package/dist/el-GR.main.js +0 -9
  53. package/dist/el-GR.main.js.map +0 -1
  54. package/dist/el-GR.mjs +0 -11
  55. package/dist/el-GR.module.js +0 -11
  56. package/dist/el-GR.module.js.map +0 -1
  57. package/dist/en-US.main.js +0 -9
  58. package/dist/en-US.main.js.map +0 -1
  59. package/dist/en-US.mjs +0 -11
  60. package/dist/en-US.module.js +0 -11
  61. package/dist/en-US.module.js.map +0 -1
  62. package/dist/es-ES.main.js +0 -9
  63. package/dist/es-ES.main.js.map +0 -1
  64. package/dist/es-ES.mjs +0 -11
  65. package/dist/es-ES.module.js +0 -11
  66. package/dist/es-ES.module.js.map +0 -1
  67. package/dist/et-EE.main.js +0 -9
  68. package/dist/et-EE.main.js.map +0 -1
  69. package/dist/et-EE.mjs +0 -11
  70. package/dist/et-EE.module.js +0 -11
  71. package/dist/et-EE.module.js.map +0 -1
  72. package/dist/fi-FI.main.js +0 -9
  73. package/dist/fi-FI.main.js.map +0 -1
  74. package/dist/fi-FI.mjs +0 -11
  75. package/dist/fi-FI.module.js +0 -11
  76. package/dist/fi-FI.module.js.map +0 -1
  77. package/dist/fr-FR.main.js +0 -9
  78. package/dist/fr-FR.main.js.map +0 -1
  79. package/dist/fr-FR.mjs +0 -11
  80. package/dist/fr-FR.module.js +0 -11
  81. package/dist/fr-FR.module.js.map +0 -1
  82. package/dist/he-IL.main.js +0 -9
  83. package/dist/he-IL.main.js.map +0 -1
  84. package/dist/he-IL.mjs +0 -11
  85. package/dist/he-IL.module.js +0 -11
  86. package/dist/he-IL.module.js.map +0 -1
  87. package/dist/hr-HR.main.js +0 -9
  88. package/dist/hr-HR.main.js.map +0 -1
  89. package/dist/hr-HR.mjs +0 -11
  90. package/dist/hr-HR.module.js +0 -11
  91. package/dist/hr-HR.module.js.map +0 -1
  92. package/dist/hu-HU.main.js +0 -9
  93. package/dist/hu-HU.main.js.map +0 -1
  94. package/dist/hu-HU.mjs +0 -11
  95. package/dist/hu-HU.module.js +0 -11
  96. package/dist/hu-HU.module.js.map +0 -1
  97. package/dist/inputgroup_vars_css.main.js +0 -86
  98. package/dist/inputgroup_vars_css.main.js.map +0 -1
  99. package/dist/inputgroup_vars_css.mjs +0 -88
  100. package/dist/inputgroup_vars_css.module.js +0 -88
  101. package/dist/inputgroup_vars_css.module.js.map +0 -1
  102. package/dist/intlStrings.main.js +0 -108
  103. package/dist/intlStrings.main.js.map +0 -1
  104. package/dist/intlStrings.mjs +0 -110
  105. package/dist/intlStrings.module.js +0 -110
  106. package/dist/intlStrings.module.js.map +0 -1
  107. package/dist/it-IT.main.js +0 -9
  108. package/dist/it-IT.main.js.map +0 -1
  109. package/dist/it-IT.mjs +0 -11
  110. package/dist/it-IT.module.js +0 -11
  111. package/dist/it-IT.module.js.map +0 -1
  112. package/dist/ja-JP.main.js +0 -9
  113. package/dist/ja-JP.main.js.map +0 -1
  114. package/dist/ja-JP.mjs +0 -11
  115. package/dist/ja-JP.module.js +0 -11
  116. package/dist/ja-JP.module.js.map +0 -1
  117. package/dist/ko-KR.main.js +0 -9
  118. package/dist/ko-KR.main.js.map +0 -1
  119. package/dist/ko-KR.mjs +0 -11
  120. package/dist/ko-KR.module.js +0 -11
  121. package/dist/ko-KR.module.js.map +0 -1
  122. package/dist/lt-LT.main.js +0 -9
  123. package/dist/lt-LT.main.js.map +0 -1
  124. package/dist/lt-LT.mjs +0 -11
  125. package/dist/lt-LT.module.js +0 -11
  126. package/dist/lt-LT.module.js.map +0 -1
  127. package/dist/lv-LV.main.js +0 -9
  128. package/dist/lv-LV.main.js.map +0 -1
  129. package/dist/lv-LV.mjs +0 -11
  130. package/dist/lv-LV.module.js +0 -11
  131. package/dist/lv-LV.module.js.map +0 -1
  132. package/dist/nb-NO.main.js +0 -9
  133. package/dist/nb-NO.main.js.map +0 -1
  134. package/dist/nb-NO.mjs +0 -11
  135. package/dist/nb-NO.module.js +0 -11
  136. package/dist/nb-NO.module.js.map +0 -1
  137. package/dist/nl-NL.main.js +0 -9
  138. package/dist/nl-NL.main.js.map +0 -1
  139. package/dist/nl-NL.mjs +0 -11
  140. package/dist/nl-NL.module.js +0 -11
  141. package/dist/nl-NL.module.js.map +0 -1
  142. package/dist/pl-PL.main.js +0 -9
  143. package/dist/pl-PL.main.js.map +0 -1
  144. package/dist/pl-PL.mjs +0 -11
  145. package/dist/pl-PL.module.js +0 -11
  146. package/dist/pl-PL.module.js.map +0 -1
  147. package/dist/pt-BR.main.js +0 -9
  148. package/dist/pt-BR.main.js.map +0 -1
  149. package/dist/pt-BR.mjs +0 -11
  150. package/dist/pt-BR.module.js +0 -11
  151. package/dist/pt-BR.module.js.map +0 -1
  152. package/dist/pt-PT.main.js +0 -9
  153. package/dist/pt-PT.main.js.map +0 -1
  154. package/dist/pt-PT.mjs +0 -11
  155. package/dist/pt-PT.module.js +0 -11
  156. package/dist/pt-PT.module.js.map +0 -1
  157. package/dist/ro-RO.main.js +0 -9
  158. package/dist/ro-RO.main.js.map +0 -1
  159. package/dist/ro-RO.mjs +0 -11
  160. package/dist/ro-RO.module.js +0 -11
  161. package/dist/ro-RO.module.js.map +0 -1
  162. package/dist/ru-RU.main.js +0 -9
  163. package/dist/ru-RU.main.js.map +0 -1
  164. package/dist/ru-RU.mjs +0 -11
  165. package/dist/ru-RU.module.js +0 -11
  166. package/dist/ru-RU.module.js.map +0 -1
  167. package/dist/search_vars_css.main.js +0 -53
  168. package/dist/search_vars_css.main.js.map +0 -1
  169. package/dist/search_vars_css.mjs +0 -55
  170. package/dist/search_vars_css.module.js +0 -55
  171. package/dist/search_vars_css.module.js.map +0 -1
  172. package/dist/searchautocomplete_css.main.js +0 -38
  173. package/dist/searchautocomplete_css.main.js.map +0 -1
  174. package/dist/searchautocomplete_css.mjs +0 -40
  175. package/dist/searchautocomplete_css.module.js +0 -40
  176. package/dist/searchautocomplete_css.module.js.map +0 -1
  177. package/dist/sk-SK.main.js +0 -9
  178. package/dist/sk-SK.main.js.map +0 -1
  179. package/dist/sk-SK.mjs +0 -11
  180. package/dist/sk-SK.module.js +0 -11
  181. package/dist/sk-SK.module.js.map +0 -1
  182. package/dist/sl-SI.main.js +0 -9
  183. package/dist/sl-SI.main.js.map +0 -1
  184. package/dist/sl-SI.mjs +0 -11
  185. package/dist/sl-SI.module.js +0 -11
  186. package/dist/sl-SI.module.js.map +0 -1
  187. package/dist/sr-SP.main.js +0 -9
  188. package/dist/sr-SP.main.js.map +0 -1
  189. package/dist/sr-SP.mjs +0 -11
  190. package/dist/sr-SP.module.js +0 -11
  191. package/dist/sr-SP.module.js.map +0 -1
  192. package/dist/sv-SE.main.js +0 -9
  193. package/dist/sv-SE.main.js.map +0 -1
  194. package/dist/sv-SE.mjs +0 -11
  195. package/dist/sv-SE.module.js +0 -11
  196. package/dist/sv-SE.module.js.map +0 -1
  197. package/dist/textfield_vars_css.main.js +0 -74
  198. package/dist/textfield_vars_css.main.js.map +0 -1
  199. package/dist/textfield_vars_css.mjs +0 -76
  200. package/dist/textfield_vars_css.module.js +0 -76
  201. package/dist/textfield_vars_css.module.js.map +0 -1
  202. package/dist/tr-TR.main.js +0 -9
  203. package/dist/tr-TR.main.js.map +0 -1
  204. package/dist/tr-TR.mjs +0 -11
  205. package/dist/tr-TR.module.js +0 -11
  206. package/dist/tr-TR.module.js.map +0 -1
  207. package/dist/types.d.ts +0 -13
  208. package/dist/types.d.ts.map +0 -1
  209. package/dist/uk-UA.main.js +0 -9
  210. package/dist/uk-UA.main.js.map +0 -1
  211. package/dist/uk-UA.mjs +0 -11
  212. package/dist/uk-UA.module.js +0 -11
  213. package/dist/uk-UA.module.js.map +0 -1
  214. package/dist/zh-CN.main.js +0 -9
  215. package/dist/zh-CN.main.js.map +0 -1
  216. package/dist/zh-CN.mjs +0 -11
  217. package/dist/zh-CN.module.js +0 -11
  218. package/dist/zh-CN.module.js.map +0 -1
  219. package/dist/zh-TW.main.js +0 -9
  220. package/dist/zh-TW.main.js.map +0 -1
  221. package/dist/zh-TW.mjs +0 -11
  222. package/dist/zh-TW.module.js +0 -11
  223. package/dist/zh-TW.module.js.map +0 -1
  224. package/src/MobileSearchAutocomplete.tsx +0 -632
  225. package/src/SearchAutocomplete.tsx +0 -382
  226. package/src/searchautocomplete.css +0 -71
@@ -1,444 +0,0 @@
1
- import $9yRST$intlStringsmodulejs from "./intlStrings.module.js";
2
- import "./autocomplete.02db68b2.css";
3
- import $9yRST$searchautocomplete_cssmodulejs from "./searchautocomplete_css.module.js";
4
- import "./autocomplete.102c5c14.css";
5
- import $9yRST$search_vars_cssmodulejs from "./search_vars_css.module.js";
6
- import "./autocomplete.c4adfff6.css";
7
- import $9yRST$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.module.js";
8
- import "./autocomplete.30e64bfb.css";
9
- import $9yRST$textfield_vars_cssmodulejs from "./textfield_vars_css.module.js";
10
- import $9yRST$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
11
- import $9yRST$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
12
- import {useFocusableRef as $9yRST$useFocusableRef, classNames as $9yRST$classNames} from "@react-spectrum/utils";
13
- import {ClearButton as $9yRST$ClearButton} from "@react-spectrum/button";
14
- import {useComboBoxState as $9yRST$useComboBoxState} from "@react-stately/combobox";
15
- import {useOverlayTrigger as $9yRST$useOverlayTrigger, DismissButton as $9yRST$DismissButton} from "@react-aria/overlays";
16
- import {Field as $9yRST$Field} from "@react-spectrum/label";
17
- import {setInteractionModality as $9yRST$setInteractionModality, useHover as $9yRST$useHover, focusSafely as $9yRST$focusSafely} from "@react-aria/interactions";
18
- import {useFocusRing as $9yRST$useFocusRing, FocusScope as $9yRST$FocusScope} from "@react-aria/focus";
19
- import {useListBoxLayout as $9yRST$useListBoxLayout, ListBoxBase as $9yRST$ListBoxBase} from "@react-spectrum/listbox";
20
- import $9yRST$spectrumiconsuiMagnifier from "@spectrum-icons/ui/Magnifier";
21
- import {useFormReset as $9yRST$useFormReset, mergeProps as $9yRST$mergeProps, useId as $9yRST$useId} from "@react-aria/utils";
22
- import {ProgressCircle as $9yRST$ProgressCircle} from "@react-spectrum/progress";
23
- import $9yRST$react, {useCallback as $9yRST$useCallback, useRef as $9yRST$useRef, useState as $9yRST$useState, useEffect as $9yRST$useEffect} from "react";
24
- import {TextFieldBase as $9yRST$TextFieldBase} from "@react-spectrum/textfield";
25
- import {Tray as $9yRST$Tray} from "@react-spectrum/overlays";
26
- import {useButton as $9yRST$useButton} from "@react-aria/button";
27
- import {useDialog as $9yRST$useDialog} from "@react-aria/dialog";
28
- import {useField as $9yRST$useField} from "@react-aria/label";
29
- import {useFilter as $9yRST$useFilter, useLocalizedStringFormatter as $9yRST$useLocalizedStringFormatter} from "@react-aria/i18n";
30
- import {useFormValidation as $9yRST$useFormValidation} from "@react-aria/form";
31
- import {useProviderProps as $9yRST$useProviderProps} from "@react-spectrum/provider";
32
- import {useSearchAutocomplete as $9yRST$useSearchAutocomplete} from "@react-aria/autocomplete";
33
-
34
-
35
- function $parcel$interopDefault(a) {
36
- return a && a.__esModule ? a.default : a;
37
- }
38
- /*
39
- * Copyright 2020 Adobe. All rights reserved.
40
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
41
- * you may not use this file except in compliance with the License. You may obtain a copy
42
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
43
- *
44
- * Unless required by applicable law or agreed to in writing, software distributed under
45
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
46
- * OF ANY KIND, either express or implied. See the License for the specific language
47
- * governing permissions and limitations under the License.
48
- */
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
- function $c940f54e16bafef5$var$ForwardMobileSearchAutocomplete(props, ref) {
77
- props = (0, $9yRST$useProviderProps)(props);
78
- let { isQuiet: isQuiet, isDisabled: isDisabled, isRequired: isRequired, validationBehavior: validationBehavior, validate: validate, name: name, isReadOnly: isReadOnly, onSubmit: onSubmit = ()=>{} } = props;
79
- let { contains: contains } = (0, $9yRST$useFilter)({
80
- sensitivity: 'base'
81
- });
82
- let state = (0, $9yRST$useComboBoxState)({
83
- ...props,
84
- defaultFilter: contains,
85
- allowsEmptyCollection: true,
86
- // Needs to be false here otherwise we double up on commitSelection/commitCustomValue calls when
87
- // user taps on underlay (i.e. initial tap will call setFocused(false) -> commitSelection/commitCustomValue via onBlur,
88
- // then the closing of the tray will call setFocused(false) again due to cleanup effect)
89
- shouldCloseOnBlur: false,
90
- allowsCustomValue: true,
91
- onSelectionChange: (key)=>key !== null && onSubmit(null, key),
92
- selectedKey: undefined,
93
- defaultSelectedKey: undefined,
94
- validate: (0, $9yRST$useCallback)((v)=>validate === null || validate === void 0 ? void 0 : validate(v.inputValue), [
95
- validate
96
- ])
97
- });
98
- let buttonRef = (0, $9yRST$useRef)(null);
99
- let domRef = (0, $9yRST$useFocusableRef)(ref, buttonRef);
100
- let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $9yRST$useOverlayTrigger)({
101
- type: 'listbox'
102
- }, state, buttonRef);
103
- let inputRef = (0, $9yRST$useRef)(null);
104
- (0, $9yRST$useFormValidation)({
105
- ...props,
106
- focus: ()=>{
107
- var _buttonRef_current;
108
- return (_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.focus();
109
- }
110
- }, state, inputRef);
111
- let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
112
- let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);
113
- var _props_errorMessage;
114
- let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(' ');
115
- let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $9yRST$useField)({
116
- ...props,
117
- labelElementType: 'span',
118
- isInvalid: isInvalid,
119
- errorMessage: errorMessage
120
- });
121
- // Focus the button and show focus ring when clicking on the label
122
- labelProps.onClick = ()=>{
123
- if (!props.isDisabled && buttonRef.current) {
124
- buttonRef.current.focus();
125
- (0, $9yRST$setInteractionModality)('keyboard');
126
- }
127
- };
128
- let inputProps = {
129
- type: 'hidden',
130
- name: name,
131
- value: state.inputValue
132
- };
133
- if (validationBehavior === 'native') {
134
- // Use a hidden <input type="text"> rather than <input type="hidden">
135
- // so that an empty value blocks HTML form submission when the field is required.
136
- inputProps.type = 'text';
137
- inputProps.hidden = true;
138
- inputProps.required = isRequired;
139
- // Ignore react warning.
140
- inputProps.onChange = ()=>{};
141
- }
142
- (0, $9yRST$useFormReset)(inputRef, state.defaultInputValue, state.setInputValue);
143
- return /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$react).Fragment, null, /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$Field), {
144
- ...props,
145
- labelProps: labelProps,
146
- descriptionProps: descriptionProps,
147
- errorMessageProps: errorMessageProps,
148
- isInvalid: isInvalid,
149
- validationErrors: validationErrors,
150
- validationDetails: validationDetails,
151
- elementType: "span",
152
- ref: domRef,
153
- includeNecessityIndicatorInAccessibilityName: true
154
- }, /*#__PURE__*/ (0, $9yRST$react).createElement($c940f54e16bafef5$var$SearchAutocompleteButton, {
155
- ...(0, $9yRST$mergeProps)(triggerProps, fieldProps, {
156
- autoFocus: props.autoFocus,
157
- icon: props.icon
158
- }),
159
- ref: buttonRef,
160
- isQuiet: isQuiet,
161
- isDisabled: isDisabled,
162
- isReadOnly: isReadOnly,
163
- isPlaceholder: !state.inputValue,
164
- validationState: validationState,
165
- inputValue: state.inputValue,
166
- clearInput: ()=>state.setInputValue(''),
167
- onPress: ()=>!isReadOnly && state.open(null, 'manual')
168
- }, state.inputValue || props.placeholder || '')), /*#__PURE__*/ (0, $9yRST$react).createElement("input", {
169
- ...inputProps,
170
- ref: inputRef
171
- }), /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$Tray), {
172
- state: state,
173
- isFixedHeight: true,
174
- ...overlayProps
175
- }, /*#__PURE__*/ (0, $9yRST$react).createElement($c940f54e16bafef5$var$SearchAutocompleteTray, {
176
- ...props,
177
- onClose: state.close,
178
- overlayProps: overlayProps,
179
- state: state
180
- })));
181
- }
182
- let $c940f54e16bafef5$export$e7a90f7d6b078162 = /*#__PURE__*/ (0, $9yRST$react).forwardRef($c940f54e16bafef5$var$ForwardMobileSearchAutocomplete);
183
- // any type is because we don't want to call useObjectRef because this is an internal component and we know
184
- // we are always passing an object ref
185
- const $c940f54e16bafef5$var$SearchAutocompleteButton = /*#__PURE__*/ (0, $9yRST$react).forwardRef(function SearchAutocompleteButton(props, ref) {
186
- let searchIcon = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$spectrumiconsuiMagnifier), {
187
- "data-testid": "searchicon"
188
- });
189
- let { icon: icon = searchIcon, isQuiet: isQuiet, isDisabled: isDisabled, isReadOnly: isReadOnly, isPlaceholder: isPlaceholder, validationState: validationState, inputValue: inputValue, clearInput: clearInput, children: children, style: style, className: className } = props;
190
- let stringFormatter = (0, $9yRST$useLocalizedStringFormatter)((0, ($parcel$interopDefault($9yRST$intlStringsmodulejs))), '@react-spectrum/autocomplete');
191
- let valueId = (0, $9yRST$useId)();
192
- let invalidId = (0, $9yRST$useId)();
193
- let validationIcon = validationState === 'invalid' ? /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$spectrumiconsuiAlertMedium), {
194
- id: invalidId,
195
- "aria-label": stringFormatter.format('invalid')
196
- }) : /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$spectrumiconsuiCheckmarkMedium), null);
197
- if (icon) icon = /*#__PURE__*/ (0, $9yRST$react).cloneElement(icon, {
198
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield-icon'),
199
- size: 'S'
200
- });
201
- let clearButton = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ClearButton), {
202
- onPress: (e)=>{
203
- var _props_onPress;
204
- clearInput === null || clearInput === void 0 ? void 0 : clearInput();
205
- props === null || props === void 0 ? void 0 : (_props_onPress = props.onPress) === null || _props_onPress === void 0 ? void 0 : _props_onPress.call(props, e);
206
- },
207
- preventFocus: true,
208
- "aria-label": stringFormatter.format('clear'),
209
- excludeFromTabOrder: true,
210
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-ClearButton'),
211
- isDisabled: isDisabled
212
- });
213
- let validation = /*#__PURE__*/ (0, $9yRST$react).cloneElement(validationIcon, {
214
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield-validationIcon', (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-validationIcon'), (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-Search-validationIcon'))
215
- });
216
- let { hoverProps: hoverProps, isHovered: isHovered } = (0, $9yRST$useHover)({});
217
- let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $9yRST$useFocusRing)();
218
- let { buttonProps: buttonProps } = (0, $9yRST$useButton)({
219
- ...props,
220
- 'aria-labelledby': [
221
- props['aria-labelledby'],
222
- props['aria-label'] && !props['aria-labelledby'] ? props.id : null,
223
- valueId,
224
- validationState === 'invalid' ? invalidId : null
225
- ].filter(Boolean).join(' '),
226
- elementType: 'div'
227
- }, ref);
228
- return /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
229
- ...(0, $9yRST$mergeProps)(hoverProps, focusProps, buttonProps),
230
- "aria-haspopup": "dialog",
231
- ref: ref,
232
- style: {
233
- ...style,
234
- outline: 'none'
235
- },
236
- className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup', {
237
- 'spectrum-InputGroup--quiet': isQuiet,
238
- 'is-disabled': isDisabled,
239
- 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
240
- 'is-hovered': isHovered,
241
- 'is-focused': isFocused,
242
- 'focus-ring': isFocusVisible
243
- }, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'searchautocomplete', 'mobile-searchautocomplete'), className)
244
- }, /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
245
- className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield', {
246
- 'spectrum-Textfield--invalid': validationState === 'invalid' && !isDisabled,
247
- 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,
248
- 'spectrum-Textfield--quiet': isQuiet
249
- }, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-Search', 'spectrum-Search--loadable', {
250
- 'is-disabled': isDisabled,
251
- 'is-quiet': isQuiet,
252
- 'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,
253
- 'spectrum-Search--valid': validationState === 'valid' && !isDisabled
254
- }), (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'))
255
- }, /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
256
- className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield-input', {
257
- 'spectrum-Textfield-inputIcon': !!icon,
258
- 'is-hovered': isHovered,
259
- 'is-placeholder': isPlaceholder,
260
- 'is-disabled': isDisabled,
261
- 'is-quiet': isQuiet,
262
- 'is-focused': isFocused
263
- }, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-Search-input'), (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'mobile-input'))
264
- }, icon, /*#__PURE__*/ (0, $9yRST$react).createElement("span", {
265
- id: valueId,
266
- className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'mobile-value')
267
- }, children)), validationState && !isDisabled ? validation : null, (inputValue !== '' || validationState != null) && !isReadOnly && clearButton));
268
- });
269
- function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
270
- let searchIcon = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$spectrumiconsuiMagnifier), {
271
- "data-testid": "searchicon"
272
- });
273
- let { state: // completionMode = 'suggest',
274
- state, icon: icon = searchIcon, isDisabled: isDisabled, validationState: validationState, label: label, overlayProps: overlayProps, loadingState: loadingState, onLoadMore: onLoadMore, onClose: onClose, onSubmit: onSubmit } = props;
275
- let timeout = (0, $9yRST$useRef)(null);
276
- let [showLoading, setShowLoading] = (0, $9yRST$useState)(false);
277
- let inputRef = (0, $9yRST$useRef)(null);
278
- let popoverRef = (0, $9yRST$useRef)(null);
279
- let listBoxRef = (0, $9yRST$useRef)(null);
280
- let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
281
- let layout = (0, $9yRST$useListBoxLayout)();
282
- let stringFormatter = (0, $9yRST$useLocalizedStringFormatter)((0, ($parcel$interopDefault($9yRST$intlStringsmodulejs))), '@react-spectrum/autocomplete');
283
- let { inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, clearButtonProps: clearButtonProps } = (0, $9yRST$useSearchAutocomplete)({
284
- ...props,
285
- layoutDelegate: layout,
286
- popoverRef: popoverRef,
287
- listBoxRef: listBoxRef,
288
- inputRef: inputRef,
289
- // Handled outside the tray.
290
- name: undefined
291
- }, state);
292
- (0, $9yRST$react).useEffect(()=>{
293
- if (inputRef.current) (0, $9yRST$focusSafely)(inputRef.current);
294
- }, []);
295
- (0, $9yRST$react).useEffect(()=>{
296
- // When the tray closes, set state.isFocused (i.e. the tray input's focus tracker) to false.
297
- // This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay
298
- // (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to "contain")
299
- // Have to do this manually since React doesn't call onBlur when a component is unmounted: https://github.com/facebook/react/issues/12363
300
- if (!state.isOpen && state.isFocused) state.setFocused(false);
301
- });
302
- let { dialogProps: dialogProps } = (0, $9yRST$useDialog)({
303
- 'aria-labelledby': (0, $9yRST$useId)(labelProps.id)
304
- }, popoverRef);
305
- // Override the role of the input to "searchbox" instead of "combobox".
306
- // Since the listbox is always visible, the combobox role doesn't really give us anything.
307
- // VoiceOver on iOS reads "double tap to collapse" when focused on the input rather than
308
- // "double tap to edit text", as with a textbox or searchbox. We'd like double tapping to
309
- // open the virtual keyboard rather than closing the tray.
310
- inputProps.role = 'searchbox';
311
- inputProps['aria-haspopup'] = 'listbox';
312
- delete inputProps.onTouchEnd;
313
- let clearButton = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ClearButton), {
314
- ...clearButtonProps,
315
- preventFocus: true,
316
- "aria-label": stringFormatter.format('clear'),
317
- excludeFromTabOrder: true,
318
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-ClearButton'),
319
- isDisabled: isDisabled
320
- });
321
- let loadingCircle = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ProgressCircle), {
322
- "aria-label": stringFormatter.format('loading'),
323
- size: "S",
324
- isIndeterminate: true,
325
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-Search-circleLoader', (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield-circleLoader'))
326
- });
327
- // Close the software keyboard on scroll to give the user a bigger area to scroll.
328
- // But only do this if scrolling with touch, otherwise it can cause issues with touch
329
- // screen readers.
330
- let isTouchDown = (0, $9yRST$useRef)(false);
331
- let onTouchStart = ()=>{
332
- isTouchDown.current = true;
333
- };
334
- let onTouchEnd = ()=>{
335
- isTouchDown.current = false;
336
- };
337
- let onScroll = (0, $9yRST$useCallback)(()=>{
338
- if (!inputRef.current || document.activeElement !== inputRef.current || !isTouchDown.current) return;
339
- if (popoverRef.current) popoverRef.current.focus();
340
- }, [
341
- inputRef,
342
- popoverRef,
343
- isTouchDown
344
- ]);
345
- let inputValue = inputProps.value;
346
- let lastInputValue = (0, $9yRST$useRef)(inputValue);
347
- (0, $9yRST$useEffect)(()=>{
348
- if (loadingState === 'filtering' && !showLoading) {
349
- if (timeout.current === null) timeout.current = setTimeout(()=>{
350
- setShowLoading(true);
351
- }, 500);
352
- // If user is typing, clear the timer and restart since it is a new request
353
- if (inputValue !== lastInputValue.current) {
354
- clearTimeout(timeout.current);
355
- timeout.current = setTimeout(()=>{
356
- setShowLoading(true);
357
- }, 500);
358
- }
359
- } else if (loadingState !== 'filtering') {
360
- // If loading is no longer happening, clear any timers and hide the loading circle
361
- setShowLoading(false);
362
- if (timeout.current !== null) {
363
- clearTimeout(timeout.current);
364
- timeout.current = null;
365
- }
366
- }
367
- lastInputValue.current = inputValue;
368
- }, [
369
- loadingState,
370
- inputValue,
371
- showLoading
372
- ]);
373
- let onKeyDown = (e)=>{
374
- // Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options
375
- if (e.key === 'Enter' && state.selectionManager.focusedKey == null) {
376
- var _popoverRef_current;
377
- (_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
378
- if (onClose) onClose();
379
- if (onSubmit) onSubmit(inputValue == null ? null : inputValue.toString(), null);
380
- } else if (inputProps.onKeyDown) inputProps.onKeyDown(e);
381
- };
382
- if (icon) icon = /*#__PURE__*/ (0, $9yRST$react).cloneElement(icon, {
383
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield-icon'),
384
- size: 'S'
385
- });
386
- return /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$FocusScope), {
387
- restoreFocus: true,
388
- contain: true
389
- }, /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
390
- ...(0, $9yRST$mergeProps)(overlayProps, dialogProps),
391
- ref: popoverRef,
392
- className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'tray-dialog')
393
- }, /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$DismissButton), {
394
- onDismiss: onClose
395
- }), /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$TextFieldBase), {
396
- label: label,
397
- labelProps: labelProps,
398
- inputProps: {
399
- ...inputProps,
400
- onKeyDown: onKeyDown
401
- },
402
- inputRef: inputRef,
403
- isDisabled: isDisabled,
404
- isLoading: showLoading && loadingState === 'filtering',
405
- loadingIndicator: loadingState != null ? loadingCircle : undefined,
406
- validationState: validationState,
407
- wrapperChildren: (state.inputValue !== '' || loadingState === 'filtering' || validationState != null) && !props.isReadOnly ? clearButton : undefined,
408
- icon: icon,
409
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-Search', 'spectrum-Textfield', 'spectrum-Search--loadable', {
410
- 'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,
411
- 'spectrum-Search--valid': validationState === 'valid' && !isDisabled
412
- }, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'tray-textfield', {
413
- 'has-label': !!props.label
414
- })),
415
- inputClassName: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-Search-input'),
416
- validationIconClassName: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-Search-validationIcon')
417
- }), /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ListBoxBase), {
418
- ...listBoxProps,
419
- domProps: {
420
- onTouchStart: onTouchStart,
421
- onTouchEnd: onTouchEnd
422
- },
423
- disallowEmptySelection: true,
424
- shouldSelectOnPressUp: true,
425
- focusOnPointerEnter: true,
426
- layout: layout,
427
- state: state,
428
- shouldUseVirtualFocus: true,
429
- renderEmptyState: ()=>loadingState !== 'loading' && /*#__PURE__*/ (0, $9yRST$react).createElement("span", {
430
- className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'no-results')
431
- }, stringFormatter.format('noResults')),
432
- UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'tray-listbox'),
433
- ref: listBoxRef,
434
- onScroll: onScroll,
435
- onLoadMore: onLoadMore,
436
- isLoading: isLoading
437
- }), /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$DismissButton), {
438
- onDismiss: onClose
439
- })));
440
- }
441
-
442
-
443
- export {$c940f54e16bafef5$export$e7a90f7d6b078162 as MobileSearchAutocomplete};
444
- //# sourceMappingURL=MobileSearchAutocomplete.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4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AK;QAC5B;QAIN,gBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,wDAAW,GACX;QAGJ,yBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,wDAAW,GACX;sBAGN,gCAAC,CAAA,GAAA,kBAAU;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,gCAAC;gBAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,+DAAuB,GAAG;eACnD,gBAAgB,MAAM,CAAC;QAG5B,kBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,+DAAuB,GACvB;QAGJ,KAAK;QACL,UAAU;QACV,YAAY;QACZ,WAAW;sBACb,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW;;AAIlC","sources":["packages/@react-spectrum/autocomplete/src/MobileSearchAutocomplete.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 CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, useFocusableRef} from '@react-spectrum/utils';\nimport {ClearButton} from '@react-spectrum/button';\nimport {ComboBoxState, useComboBoxState} from '@react-stately/combobox';\nimport {DismissButton, useOverlayTrigger} from '@react-aria/overlays';\nimport {Field} from '@react-spectrum/label';\nimport {FocusableRef, ValidationState} from '@react-types/shared';\nimport {focusSafely, setInteractionModality, useHover} from '@react-aria/interactions';\nimport {FocusScope, useFocusRing} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListBoxBase, useListBoxLayout} from '@react-spectrum/listbox';\nimport Magnifier from '@spectrum-icons/ui/Magnifier';\nimport {mergeProps, useFormReset, useId} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {\n HTMLAttributes,\n InputHTMLAttributes,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport searchAutocompleteStyles from './searchautocomplete.css';\nimport searchStyles from '@adobe/spectrum-css-temp/components/search/vars.css';\nimport {SpectrumSearchAutocompleteProps} from '@react-types/autocomplete';\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 {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';\nimport {useSearchAutocomplete} from '@react-aria/autocomplete';\n\nfunction ForwardMobileSearchAutocomplete<T extends object>(props: SpectrumSearchAutocompleteProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n\n let {\n isQuiet,\n isDisabled,\n isRequired,\n validationBehavior,\n validate,\n name,\n isReadOnly,\n onSubmit = () => {}\n } = props;\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 allowsCustomValue: true,\n onSelectionChange: (key) => key !== null && onSubmit(null, key),\n selectedKey: undefined,\n defaultSelectedKey: undefined,\n validate: useCallback(v => validate?.(v.inputValue), [validate])\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 && buttonRef.current) {\n buttonRef.current.focus();\n setInteractionModality('keyboard');\n }\n };\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name,\n value: state.inputValue\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(inputRef, state.defaultInputValue, state.setInputValue);\n\n return (\n <>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n elementType=\"span\"\n ref={domRef}\n includeNecessityIndicatorInAccessibilityName>\n <SearchAutocompleteButton\n {...mergeProps(triggerProps, fieldProps, {autoFocus: props.autoFocus, icon: props.icon})}\n ref={buttonRef}\n isQuiet={isQuiet}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isPlaceholder={!state.inputValue}\n validationState={validationState}\n inputValue={state.inputValue}\n clearInput={() => state.setInputValue('')}\n onPress={() => !isReadOnly && state.open(null, 'manual')}>\n {state.inputValue || props.placeholder || ''}\n </SearchAutocompleteButton>\n </Field>\n <input {...inputProps} ref={inputRef} />\n <Tray state={state} isFixedHeight {...overlayProps}>\n <SearchAutocompleteTray\n {...props}\n onClose={state.close}\n overlayProps={overlayProps}\n state={state} />\n </Tray>\n </>\n );\n}\n\nexport let MobileSearchAutocomplete = React.forwardRef(ForwardMobileSearchAutocomplete) as <T>(props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n\n\ninterface SearchAutocompleteButtonProps extends AriaButtonProps {\n icon?: ReactElement | null,\n isQuiet?: boolean,\n isDisabled?: boolean,\n isReadOnly?: boolean,\n isPlaceholder?: boolean,\n validationState?: ValidationState,\n inputValue?: string,\n clearInput?: () => void,\n children?: ReactNode,\n style?: React.CSSProperties,\n className?: string\n}\n\n// any type is because we don't want to call useObjectRef because this is an internal component and we know\n// we are always passing an object ref\nconst SearchAutocompleteButton = React.forwardRef(function SearchAutocompleteButton(props: SearchAutocompleteButtonProps, ref: any) {\n let searchIcon = (\n <Magnifier data-testid=\"searchicon\" />\n );\n\n let {\n icon = searchIcon,\n isQuiet,\n isDisabled,\n isReadOnly,\n isPlaceholder,\n validationState,\n inputValue,\n clearInput,\n children,\n style,\n className\n} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n let valueId = useId();\n let invalidId = useId();\n let validationIcon = validationState === 'invalid'\n ? <AlertMedium id={invalidId} aria-label={stringFormatter.format('invalid')} />\n : <CheckmarkMedium />;\n\n if (icon) {\n icon = React.cloneElement(icon, {\n UNSAFE_className: classNames(\n textfieldStyles,\n 'spectrum-Textfield-icon'\n ),\n size: 'S'\n });\n }\n\n let clearButton = (\n <ClearButton\n onPress={(e) => {\n clearInput?.();\n props?.onPress?.(e);\n }}\n preventFocus\n aria-label={stringFormatter.format('clear')}\n excludeFromTabOrder\n UNSAFE_className={\n classNames(\n searchStyles,\n 'spectrum-ClearButton'\n )\n }\n isDisabled={isDisabled} />\n );\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 classNames(\n searchStyles,\n 'spectrum-Search-validationIcon'\n )\n )\n });\n\n let {hoverProps, isHovered} = useHover({});\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let {buttonProps} = 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 ].filter(Boolean).join(' '),\n elementType: 'div'\n }, ref);\n\n return (\n <div\n {...mergeProps(hoverProps, focusProps, buttonProps)}\n aria-haspopup=\"dialog\"\n ref={ref}\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 'is-focused': isFocused,\n 'focus-ring': isFocusVisible\n },\n classNames(\n searchAutocompleteStyles,\n 'searchautocomplete',\n 'mobile-searchautocomplete'\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 searchStyles,\n 'spectrum-Search',\n 'spectrum-Search--loadable',\n {\n 'is-disabled': isDisabled,\n 'is-quiet': isQuiet,\n 'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,\n 'spectrum-Search--valid': validationState === 'valid' && !isDisabled\n }\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 'spectrum-Textfield-inputIcon': !!icon,\n 'is-hovered': isHovered,\n 'is-placeholder': isPlaceholder,\n 'is-disabled': isDisabled,\n 'is-quiet': isQuiet,\n 'is-focused': isFocused\n },\n classNames(\n searchStyles,\n 'spectrum-Search-input'\n ),\n classNames(\n searchAutocompleteStyles,\n 'mobile-input'\n )\n )\n }>\n {icon}\n <span\n id={valueId}\n className={\n classNames(\n searchAutocompleteStyles,\n 'mobile-value'\n )\n }>\n {children}\n </span>\n </div>\n {validationState && !isDisabled ? validation : null}\n {(inputValue !== '' || validationState != null) && !isReadOnly && clearButton}\n </div>\n </div>\n );\n});\n\ninterface SearchAutocompleteTrayProps<T> extends SpectrumSearchAutocompleteProps<T> {\n state: ComboBoxState<T>,\n overlayProps: HTMLAttributes<HTMLElement>,\n loadingIndicator?: ReactElement,\n onClose: () => void\n}\n\nfunction SearchAutocompleteTray<T>(props: SearchAutocompleteTrayProps<T>) {\n let searchIcon = (\n <Magnifier data-testid=\"searchicon\" />\n );\n\n let {\n // completionMode = 'suggest',\n state,\n icon = searchIcon,\n isDisabled,\n validationState,\n label,\n overlayProps,\n loadingState,\n onLoadMore,\n onClose,\n onSubmit\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 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/autocomplete');\n\n let {inputProps, listBoxProps, labelProps, clearButtonProps} = useSearchAutocomplete<T>(\n {\n ...props,\n layoutDelegate: layout,\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 inputProps.role = 'searchbox';\n inputProps['aria-haspopup'] = 'listbox';\n delete inputProps.onTouchEnd;\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n aria-label={stringFormatter.format('clear')}\n excludeFromTabOrder\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 || document.activeElement !== inputRef.current || !isTouchDown.current) {\n return;\n }\n\n if (popoverRef.current) {\n popoverRef.current.focus();\n }\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 !== null) {\n clearTimeout(timeout.current);\n timeout.current = null;\n }\n }\n\n lastInputValue.current = inputValue;\n }, [loadingState, inputValue, showLoading]);\n\n let onKeyDown = (e) => {\n // Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options\n if (e.key === 'Enter' && state.selectionManager.focusedKey == null) {\n popoverRef.current?.focus();\n if (onClose) {\n onClose();\n }\n if (onSubmit) {\n onSubmit(inputValue == null ? null : inputValue.toString(), null);\n }\n } else {\n if (inputProps.onKeyDown) {\n inputProps.onKeyDown(e);\n }\n }\n };\n\n if (icon) {\n icon = React.cloneElement(icon, {\n UNSAFE_className: classNames(\n textfieldStyles,\n 'spectrum-Textfield-icon'\n ),\n size: 'S'\n });\n }\n\n return (\n <FocusScope restoreFocus contain>\n <div\n {...mergeProps(overlayProps, dialogProps)}\n ref={popoverRef}\n className={\n classNames(\n searchAutocompleteStyles,\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 wrapperChildren={((state.inputValue !== '' || loadingState === 'filtering' || validationState != null) && !props.isReadOnly) ? clearButton : undefined}\n icon={icon}\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 searchAutocompleteStyles,\n 'tray-textfield',\n {\n 'has-label': !!props.label\n }\n )\n )\n }\n inputClassName={\n classNames(\n searchStyles,\n 'spectrum-Search-input'\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(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )}\n UNSAFE_className={\n classNames(\n searchAutocompleteStyles,\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":"MobileSearchAutocomplete.module.js.map"}