@react-spectrum/autocomplete 3.0.0-alpha.31 → 3.0.0-alpha.33
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.
- package/dist/MobileSearchAutocomplete.main.js +86 -86
- package/dist/MobileSearchAutocomplete.main.js.map +1 -1
- package/dist/MobileSearchAutocomplete.mjs +87 -87
- package/dist/MobileSearchAutocomplete.module.js +86 -86
- package/dist/MobileSearchAutocomplete.module.js.map +1 -1
- package/dist/SearchAutocomplete.main.js +37 -36
- package/dist/SearchAutocomplete.main.js.map +1 -1
- package/dist/SearchAutocomplete.mjs +38 -37
- package/dist/SearchAutocomplete.module.js +37 -36
- package/dist/SearchAutocomplete.module.js.map +1 -1
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/inputgroup_vars_css.mjs +1 -1
- package/dist/intlStrings.mjs +1 -1
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/search_vars_css.mjs +1 -1
- package/dist/searchautocomplete_css.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/textfield_vars_css.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/{vars.5653edea.css → vars.f9e74788.css} +2 -1
- package/dist/vars.f9e74788.css.map +1 -0
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +28 -28
- package/src/MobileSearchAutocomplete.tsx +2 -2
- package/src/SearchAutocomplete.tsx +7 -6
- package/dist/vars.5653edea.css.map +0 -1
|
@@ -5,7 +5,7 @@ require("./vars.31879241.css");
|
|
|
5
5
|
var $1e139f06a0a4b696$exports = require("./search_vars_css.main.js");
|
|
6
6
|
require("./vars.936671cd.css");
|
|
7
7
|
var $2f86633ce5b04f1e$exports = require("./inputgroup_vars_css.main.js");
|
|
8
|
-
require("./vars.
|
|
8
|
+
require("./vars.f9e74788.css");
|
|
9
9
|
var $40cb3a00c193680f$exports = require("./textfield_vars_css.main.js");
|
|
10
10
|
var $56uON$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
|
|
11
11
|
var $56uON$spectrumiconsuiCheckmarkMedium = require("@spectrum-icons/ui/CheckmarkMedium");
|
|
@@ -83,7 +83,7 @@ function $a9f98e219df0b64d$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
83
83
|
props = (0, $56uON$reactspectrumprovider.useProviderProps)(props);
|
|
84
84
|
let { isQuiet: isQuiet, isDisabled: isDisabled, isRequired: isRequired, validationBehavior: validationBehavior, validate: validate, name: name, isReadOnly: isReadOnly, onSubmit: onSubmit = ()=>{} } = props;
|
|
85
85
|
let { contains: contains } = (0, $56uON$reactariai18n.useFilter)({
|
|
86
|
-
sensitivity:
|
|
86
|
+
sensitivity: 'base'
|
|
87
87
|
});
|
|
88
88
|
let state = (0, $56uON$reactstatelycombobox.useComboBoxState)({
|
|
89
89
|
...props,
|
|
@@ -104,7 +104,7 @@ function $a9f98e219df0b64d$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
104
104
|
let buttonRef = (0, $56uON$react.useRef)(null);
|
|
105
105
|
let domRef = (0, $56uON$reactspectrumutils.useFocusableRef)(ref, buttonRef);
|
|
106
106
|
let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $56uON$reactariaoverlays.useOverlayTrigger)({
|
|
107
|
-
type:
|
|
107
|
+
type: 'listbox'
|
|
108
108
|
}, state, buttonRef);
|
|
109
109
|
let inputRef = (0, $56uON$react.useRef)(null);
|
|
110
110
|
(0, $56uON$reactariaform.useFormValidation)({
|
|
@@ -115,12 +115,12 @@ function $a9f98e219df0b64d$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
115
115
|
}
|
|
116
116
|
}, state, inputRef);
|
|
117
117
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
118
|
-
let validationState = props.validationState || (isInvalid ?
|
|
118
|
+
let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);
|
|
119
119
|
var _props_errorMessage;
|
|
120
|
-
let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(
|
|
120
|
+
let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(' ');
|
|
121
121
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $56uON$reactarialabel.useField)({
|
|
122
122
|
...props,
|
|
123
|
-
labelElementType:
|
|
123
|
+
labelElementType: 'span',
|
|
124
124
|
isInvalid: isInvalid,
|
|
125
125
|
errorMessage: errorMessage
|
|
126
126
|
});
|
|
@@ -128,18 +128,18 @@ function $a9f98e219df0b64d$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
128
128
|
labelProps.onClick = ()=>{
|
|
129
129
|
if (!props.isDisabled && buttonRef.current) {
|
|
130
130
|
buttonRef.current.focus();
|
|
131
|
-
(0, $56uON$reactariainteractions.setInteractionModality)(
|
|
131
|
+
(0, $56uON$reactariainteractions.setInteractionModality)('keyboard');
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
let inputProps = {
|
|
135
|
-
type:
|
|
135
|
+
type: 'hidden',
|
|
136
136
|
name: name,
|
|
137
137
|
value: state.inputValue
|
|
138
138
|
};
|
|
139
|
-
if (validationBehavior ===
|
|
139
|
+
if (validationBehavior === 'native') {
|
|
140
140
|
// Use a hidden <input type="text"> rather than <input type="hidden">
|
|
141
141
|
// so that an empty value blocks HTML form submission when the field is required.
|
|
142
|
-
inputProps.type =
|
|
142
|
+
inputProps.type = 'text';
|
|
143
143
|
inputProps.hidden = true;
|
|
144
144
|
inputProps.required = isRequired;
|
|
145
145
|
// Ignore react warning.
|
|
@@ -169,9 +169,9 @@ function $a9f98e219df0b64d$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
169
169
|
isPlaceholder: !state.inputValue,
|
|
170
170
|
validationState: validationState,
|
|
171
171
|
inputValue: state.inputValue,
|
|
172
|
-
clearInput: ()=>state.setInputValue(
|
|
173
|
-
onPress: ()=>!isReadOnly && state.open(null,
|
|
174
|
-
}, state.inputValue || props.placeholder ||
|
|
172
|
+
clearInput: ()=>state.setInputValue(''),
|
|
173
|
+
onPress: ()=>!isReadOnly && state.open(null, 'manual')
|
|
174
|
+
}, state.inputValue || props.placeholder || '')), /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement("input", {
|
|
175
175
|
...inputProps,
|
|
176
176
|
ref: inputRef
|
|
177
177
|
}), /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactspectrumoverlays.Tray), {
|
|
@@ -193,16 +193,16 @@ const $a9f98e219df0b64d$var$SearchAutocompleteButton = /*#__PURE__*/ (0, ($parce
|
|
|
193
193
|
"data-testid": "searchicon"
|
|
194
194
|
});
|
|
195
195
|
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;
|
|
196
|
-
let stringFormatter = (0, $56uON$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($e32120882142a69f$exports))),
|
|
196
|
+
let stringFormatter = (0, $56uON$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($e32120882142a69f$exports))), '@react-spectrum/autocomplete');
|
|
197
197
|
let valueId = (0, $56uON$reactariautils.useId)();
|
|
198
198
|
let invalidId = (0, $56uON$reactariautils.useId)();
|
|
199
|
-
let validationIcon = validationState ===
|
|
199
|
+
let validationIcon = validationState === 'invalid' ? /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, ($parcel$interopDefault($56uON$spectrumiconsuiAlertMedium))), {
|
|
200
200
|
id: invalidId,
|
|
201
|
-
"aria-label": stringFormatter.format(
|
|
201
|
+
"aria-label": stringFormatter.format('invalid')
|
|
202
202
|
}) : /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, ($parcel$interopDefault($56uON$spectrumiconsuiCheckmarkMedium))), null);
|
|
203
203
|
if (icon) icon = /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).cloneElement(icon, {
|
|
204
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
|
205
|
-
size:
|
|
204
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-icon'),
|
|
205
|
+
size: 'S'
|
|
206
206
|
});
|
|
207
207
|
let clearButton = /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactspectrumbutton.ClearButton), {
|
|
208
208
|
onPress: (e)=>{
|
|
@@ -211,25 +211,25 @@ const $a9f98e219df0b64d$var$SearchAutocompleteButton = /*#__PURE__*/ (0, ($parce
|
|
|
211
211
|
props === null || props === void 0 ? void 0 : (_props_onPress = props.onPress) === null || _props_onPress === void 0 ? void 0 : _props_onPress.call(props, e);
|
|
212
212
|
},
|
|
213
213
|
preventFocus: true,
|
|
214
|
-
"aria-label": stringFormatter.format(
|
|
214
|
+
"aria-label": stringFormatter.format('clear'),
|
|
215
215
|
excludeFromTabOrder: true,
|
|
216
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
216
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-ClearButton'),
|
|
217
217
|
isDisabled: isDisabled
|
|
218
218
|
});
|
|
219
219
|
let validation = /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).cloneElement(validationIcon, {
|
|
220
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
|
220
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-validationIcon', (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-input-validationIcon'), (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-validationIcon'))
|
|
221
221
|
});
|
|
222
222
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $56uON$reactariainteractions.useHover)({});
|
|
223
223
|
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $56uON$reactariafocus.useFocusRing)();
|
|
224
224
|
let { buttonProps: buttonProps } = (0, $56uON$reactariabutton.useButton)({
|
|
225
225
|
...props,
|
|
226
|
-
|
|
227
|
-
props[
|
|
228
|
-
props[
|
|
226
|
+
'aria-labelledby': [
|
|
227
|
+
props['aria-labelledby'],
|
|
228
|
+
props['aria-label'] && !props['aria-labelledby'] ? props.id : null,
|
|
229
229
|
valueId,
|
|
230
|
-
validationState ===
|
|
231
|
-
].filter(Boolean).join(
|
|
232
|
-
elementType:
|
|
230
|
+
validationState === 'invalid' ? invalidId : null
|
|
231
|
+
].filter(Boolean).join(' '),
|
|
232
|
+
elementType: 'div'
|
|
233
233
|
}, ref);
|
|
234
234
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement("div", {
|
|
235
235
|
...(0, $56uON$reactariautils.mergeProps)(hoverProps, focusProps, buttonProps),
|
|
@@ -237,40 +237,40 @@ const $a9f98e219df0b64d$var$SearchAutocompleteButton = /*#__PURE__*/ (0, ($parce
|
|
|
237
237
|
ref: ref,
|
|
238
238
|
style: {
|
|
239
239
|
...style,
|
|
240
|
-
outline:
|
|
240
|
+
outline: 'none'
|
|
241
241
|
},
|
|
242
|
-
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))),
|
|
242
|
+
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup', {
|
|
243
|
+
'spectrum-InputGroup--quiet': isQuiet,
|
|
244
|
+
'is-disabled': isDisabled,
|
|
245
|
+
'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
|
|
246
|
+
'is-hovered': isHovered,
|
|
247
|
+
'is-focused': isFocused,
|
|
248
|
+
'focus-ring': isFocusVisible
|
|
249
|
+
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))), 'searchautocomplete', 'mobile-searchautocomplete'), className)
|
|
250
250
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement("div", {
|
|
251
|
-
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}), (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))),
|
|
251
|
+
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield', {
|
|
252
|
+
'spectrum-Textfield--invalid': validationState === 'invalid' && !isDisabled,
|
|
253
|
+
'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,
|
|
254
|
+
'spectrum-Textfield--quiet': isQuiet
|
|
255
|
+
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search', 'spectrum-Search--loadable', {
|
|
256
|
+
'is-disabled': isDisabled,
|
|
257
|
+
'is-quiet': isQuiet,
|
|
258
|
+
'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,
|
|
259
|
+
'spectrum-Search--valid': validationState === 'valid' && !isDisabled
|
|
260
|
+
}), (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($2f86633ce5b04f1e$exports))), 'spectrum-InputGroup-field'))
|
|
261
261
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement("div", {
|
|
262
|
-
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
262
|
+
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-input', {
|
|
263
|
+
'spectrum-Textfield-inputIcon': !!icon,
|
|
264
|
+
'is-hovered': isHovered,
|
|
265
|
+
'is-placeholder': isPlaceholder,
|
|
266
|
+
'is-disabled': isDisabled,
|
|
267
|
+
'is-quiet': isQuiet,
|
|
268
|
+
'is-focused': isFocused
|
|
269
|
+
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-input'), (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))), 'mobile-input'))
|
|
270
270
|
}, icon, /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement("span", {
|
|
271
271
|
id: valueId,
|
|
272
|
-
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))),
|
|
273
|
-
}, children)), validationState && !isDisabled ? validation : null, (inputValue !==
|
|
272
|
+
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))), 'mobile-value')
|
|
273
|
+
}, children)), validationState && !isDisabled ? validation : null, (inputValue !== '' || validationState != null) && !isReadOnly && clearButton));
|
|
274
274
|
});
|
|
275
275
|
function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
276
276
|
let searchIcon = /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, ($parcel$interopDefault($56uON$spectrumiconsuiMagnifier))), {
|
|
@@ -283,12 +283,12 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
283
283
|
let inputRef = (0, $56uON$react.useRef)(null);
|
|
284
284
|
let popoverRef = (0, $56uON$react.useRef)(null);
|
|
285
285
|
let listBoxRef = (0, $56uON$react.useRef)(null);
|
|
286
|
-
let isLoading = loadingState ===
|
|
287
|
-
let layout = (0, $56uON$reactspectrumlistbox.useListBoxLayout)(
|
|
288
|
-
let stringFormatter = (0, $56uON$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($e32120882142a69f$exports))),
|
|
286
|
+
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
287
|
+
let layout = (0, $56uON$reactspectrumlistbox.useListBoxLayout)();
|
|
288
|
+
let stringFormatter = (0, $56uON$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($e32120882142a69f$exports))), '@react-spectrum/autocomplete');
|
|
289
289
|
let { inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, clearButtonProps: clearButtonProps } = (0, $56uON$reactariaautocomplete.useSearchAutocomplete)({
|
|
290
290
|
...props,
|
|
291
|
-
|
|
291
|
+
layoutDelegate: layout,
|
|
292
292
|
popoverRef: popoverRef,
|
|
293
293
|
listBoxRef: listBoxRef,
|
|
294
294
|
inputRef: inputRef,
|
|
@@ -306,29 +306,29 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
306
306
|
if (!state.isOpen && state.isFocused) state.setFocused(false);
|
|
307
307
|
});
|
|
308
308
|
let { dialogProps: dialogProps } = (0, $56uON$reactariadialog.useDialog)({
|
|
309
|
-
|
|
309
|
+
'aria-labelledby': (0, $56uON$reactariautils.useId)(labelProps.id)
|
|
310
310
|
}, popoverRef);
|
|
311
311
|
// Override the role of the input to "searchbox" instead of "combobox".
|
|
312
312
|
// Since the listbox is always visible, the combobox role doesn't really give us anything.
|
|
313
313
|
// VoiceOver on iOS reads "double tap to collapse" when focused on the input rather than
|
|
314
314
|
// "double tap to edit text", as with a textbox or searchbox. We'd like double tapping to
|
|
315
315
|
// open the virtual keyboard rather than closing the tray.
|
|
316
|
-
inputProps.role =
|
|
317
|
-
inputProps[
|
|
316
|
+
inputProps.role = 'searchbox';
|
|
317
|
+
inputProps['aria-haspopup'] = 'listbox';
|
|
318
318
|
delete inputProps.onTouchEnd;
|
|
319
319
|
let clearButton = /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactspectrumbutton.ClearButton), {
|
|
320
320
|
...clearButtonProps,
|
|
321
321
|
preventFocus: true,
|
|
322
|
-
"aria-label": stringFormatter.format(
|
|
322
|
+
"aria-label": stringFormatter.format('clear'),
|
|
323
323
|
excludeFromTabOrder: true,
|
|
324
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
324
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-ClearButton'),
|
|
325
325
|
isDisabled: isDisabled
|
|
326
326
|
});
|
|
327
327
|
let loadingCircle = /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactspectrumprogress.ProgressCircle), {
|
|
328
|
-
"aria-label": stringFormatter.format(
|
|
328
|
+
"aria-label": stringFormatter.format('loading'),
|
|
329
329
|
size: "S",
|
|
330
330
|
isIndeterminate: true,
|
|
331
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
331
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-circleLoader', (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-circleLoader'))
|
|
332
332
|
});
|
|
333
333
|
// Close the software keyboard on scroll to give the user a bigger area to scroll.
|
|
334
334
|
// But only do this if scrolling with touch, otherwise it can cause issues with touch
|
|
@@ -351,7 +351,7 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
351
351
|
let inputValue = inputProps.value;
|
|
352
352
|
let lastInputValue = (0, $56uON$react.useRef)(inputValue);
|
|
353
353
|
(0, $56uON$react.useEffect)(()=>{
|
|
354
|
-
if (loadingState ===
|
|
354
|
+
if (loadingState === 'filtering' && !showLoading) {
|
|
355
355
|
if (timeout.current === null) timeout.current = setTimeout(()=>{
|
|
356
356
|
setShowLoading(true);
|
|
357
357
|
}, 500);
|
|
@@ -362,7 +362,7 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
362
362
|
setShowLoading(true);
|
|
363
363
|
}, 500);
|
|
364
364
|
}
|
|
365
|
-
} else if (loadingState !==
|
|
365
|
+
} else if (loadingState !== 'filtering') {
|
|
366
366
|
// If loading is no longer happening, clear any timers and hide the loading circle
|
|
367
367
|
setShowLoading(false);
|
|
368
368
|
if (timeout.current !== null) {
|
|
@@ -378,7 +378,7 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
378
378
|
]);
|
|
379
379
|
let onKeyDown = (e)=>{
|
|
380
380
|
// Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options
|
|
381
|
-
if (e.key ===
|
|
381
|
+
if (e.key === 'Enter' && state.selectionManager.focusedKey == null) {
|
|
382
382
|
var _popoverRef_current;
|
|
383
383
|
(_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
|
|
384
384
|
if (onClose) onClose();
|
|
@@ -386,8 +386,8 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
386
386
|
} else if (inputProps.onKeyDown) inputProps.onKeyDown(e);
|
|
387
387
|
};
|
|
388
388
|
if (icon) icon = /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).cloneElement(icon, {
|
|
389
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
|
390
|
-
size:
|
|
389
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-icon'),
|
|
390
|
+
size: 'S'
|
|
391
391
|
});
|
|
392
392
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactariafocus.FocusScope), {
|
|
393
393
|
restoreFocus: true,
|
|
@@ -395,7 +395,7 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
395
395
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement("div", {
|
|
396
396
|
...(0, $56uON$reactariautils.mergeProps)(overlayProps, dialogProps),
|
|
397
397
|
ref: popoverRef,
|
|
398
|
-
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))),
|
|
398
|
+
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))), 'tray-dialog')
|
|
399
399
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactariaoverlays.DismissButton), {
|
|
400
400
|
onDismiss: onClose
|
|
401
401
|
}), /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactspectrumtextfield.TextFieldBase), {
|
|
@@ -407,19 +407,19 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
407
407
|
},
|
|
408
408
|
inputRef: inputRef,
|
|
409
409
|
isDisabled: isDisabled,
|
|
410
|
-
isLoading: showLoading && loadingState ===
|
|
410
|
+
isLoading: showLoading && loadingState === 'filtering',
|
|
411
411
|
loadingIndicator: loadingState != null ? loadingCircle : undefined,
|
|
412
412
|
validationState: validationState,
|
|
413
|
-
wrapperChildren: (state.inputValue !==
|
|
413
|
+
wrapperChildren: (state.inputValue !== '' || loadingState === 'filtering' || validationState != null) && !props.isReadOnly ? clearButton : undefined,
|
|
414
414
|
icon: icon,
|
|
415
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))),
|
|
419
|
-
|
|
415
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search', 'spectrum-Textfield', 'spectrum-Search--loadable', {
|
|
416
|
+
'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,
|
|
417
|
+
'spectrum-Search--valid': validationState === 'valid' && !isDisabled
|
|
418
|
+
}, (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))), 'tray-textfield', {
|
|
419
|
+
'has-label': !!props.label
|
|
420
420
|
})),
|
|
421
|
-
inputClassName: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
422
|
-
validationIconClassName: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))),
|
|
421
|
+
inputClassName: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-input'),
|
|
422
|
+
validationIconClassName: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($1e139f06a0a4b696$exports))), 'spectrum-Search-validationIcon')
|
|
423
423
|
}), /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement((0, $56uON$reactspectrumlistbox.ListBoxBase), {
|
|
424
424
|
...listBoxProps,
|
|
425
425
|
domProps: {
|
|
@@ -432,10 +432,10 @@ function $a9f98e219df0b64d$var$SearchAutocompleteTray(props) {
|
|
|
432
432
|
layout: layout,
|
|
433
433
|
state: state,
|
|
434
434
|
shouldUseVirtualFocus: true,
|
|
435
|
-
renderEmptyState: ()=>loadingState !==
|
|
436
|
-
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))),
|
|
437
|
-
}, stringFormatter.format(
|
|
438
|
-
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))),
|
|
435
|
+
renderEmptyState: ()=>loadingState !== 'loading' && /*#__PURE__*/ (0, ($parcel$interopDefault($56uON$react))).createElement("span", {
|
|
436
|
+
className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))), 'no-results')
|
|
437
|
+
}, stringFormatter.format('noResults')),
|
|
438
|
+
UNSAFE_className: (0, $56uON$reactspectrumutils.classNames)((0, ($parcel$interopDefault($83da5c2df967875d$exports))), 'tray-listbox'),
|
|
439
439
|
ref: listBoxRef,
|
|
440
440
|
onScroll: onScroll,
|
|
441
441
|
onLoadMore: onLoadMore,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CD,SAAS,gDAA4C,KAAyC,EAAE,GAA8B;IAC5H,QAAQ,CAAA,GAAA,6CAAe,EAAE;IAEzB,IAAI,WACF,OAAO,cACP,UAAU,cACV,UAAU,sBACV,kBAAkB,YAClB,QAAQ,QACR,IAAI,cACJ,UAAU,YACV,WAAW,KAAO,GACnB,GAAG;IAEJ,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,GAAA,8BAAQ,EAAE;QAAC,aAAa;IAAM;IAC/C,IAAI,QAAQ,CAAA,GAAA,4CAAe,EAAE;QAC3B,GAAG,KAAK;QACR,eAAe;QACf,uBAAuB;QACvB,gGAAgG;QAChG,uHAAuH;QACvH,wFAAwF;QACxF,mBAAmB;QACnB,mBAAmB;QACnB,mBAAmB,CAAC,MAAQ,QAAQ,QAAQ,SAAS,MAAM;QAC3D,aAAa;QACb,oBAAoB;QACpB,UAAU,CAAA,GAAA,wBAAU,EAAE,CAAA,IAAK,qBAAA,+B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,GAAA,sCAAY;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, 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 {setInteractionModality, useHover} from '@react-aria/interactions';\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 _MobileSearchAutocomplete<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.inputValue, 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(_MobileSearchAutocomplete) 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(state, isLoading);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n\n let {inputProps, listBoxProps, labelProps, clearButtonProps} = useSearchAutocomplete<T>(\n {\n ...props,\n keyboardDelegate: 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.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CD,SAAS,gDAA4C,KAAyC,EAAE,GAA8B;IAC5H,QAAQ,CAAA,GAAA,6CAAe,EAAE;IAEzB,IAAI,WACF,OAAO,cACP,UAAU,cACV,UAAU,sBACV,kBAAkB,YAClB,QAAQ,QACR,IAAI,cACJ,UAAU,YACV,WAAW,KAAO,GACnB,GAAG;IAEJ,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,GAAA,8BAAQ,EAAE;QAAC,aAAa;IAAM;IAC/C,IAAI,QAAQ,CAAA,GAAA,4CAAe,EAAE;QAC3B,GAAG,KAAK;QACR,eAAe;QACf,uBAAuB;QACvB,gGAAgG;QAChG,uHAAuH;QACvH,wFAAwF;QACxF,mBAAmB;QACnB,mBAAmB;QACnB,mBAAmB,CAAC,MAAQ,QAAQ,QAAQ,SAAS,MAAM;QAC3D,aAAa;QACb,oBAAoB;QACpB,UAAU,CAAA,GAAA,wBAAU,EAAE,CAAA,IAAK,qBAAA,+BAAA,SAAW,EAAE,UAAU,GAAG;YAAC;SAAS;IACjE;IAEA,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAkB;IACvC,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE,KAAK;IAClC,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,0CAAgB,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ACZ,WAAW,eAAe,iBAAiB;QAC3C,kBAAkB,gBAAgB,OAAO,gBAAgB;QACzD,iBAAiB;QACjB,iBAAiB,AAAC,AAAC,CAAA,MAAM,UAAU,KAAK,MAAM,iBAAiB,eAAe,mBAAmB,IAAG,KAAM,CAAC,MAAM,UAAU,GAAI,cAAc;QAC7I,MAAM;QACN,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,mDAAuB,GACvB,kBACA;YACE,aAAa,CAAC,CAAC,MAAM,KAAK;QAC5B;QAIN,gBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAW,GACX;QAGJ,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,mDAAuB,GAAG;eACnD,gBAAgB,MAAM,CAAC;QAG5B,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAuB,GACvB;QAGJ,KAAK;QACL,UAAU;QACV,YAAY;QACZ,WAAW;sBACb,0DAAC,CAAA,GAAA,sCAAY;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, 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 {setInteractionModality, useHover} from '@react-aria/interactions';\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 _MobileSearchAutocomplete<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.inputValue, 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(_MobileSearchAutocomplete) 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.main.js.map"}
|