@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 @@ import "./vars.31879241.css";
|
|
|
5
5
|
import $9yRST$search_vars_cssmodulejs from "./search_vars_css.mjs";
|
|
6
6
|
import "./vars.936671cd.css";
|
|
7
7
|
import $9yRST$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.mjs";
|
|
8
|
-
import "./vars.
|
|
8
|
+
import "./vars.f9e74788.css";
|
|
9
9
|
import $9yRST$textfield_vars_cssmodulejs from "./textfield_vars_css.mjs";
|
|
10
10
|
import $9yRST$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
|
11
11
|
import $9yRST$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
|
@@ -77,7 +77,7 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
77
77
|
props = (0, $9yRST$useProviderProps)(props);
|
|
78
78
|
let { isQuiet: isQuiet, isDisabled: isDisabled, isRequired: isRequired, validationBehavior: validationBehavior, validate: validate, name: name, isReadOnly: isReadOnly, onSubmit: onSubmit = ()=>{} } = props;
|
|
79
79
|
let { contains: contains } = (0, $9yRST$useFilter)({
|
|
80
|
-
sensitivity:
|
|
80
|
+
sensitivity: 'base'
|
|
81
81
|
});
|
|
82
82
|
let state = (0, $9yRST$useComboBoxState)({
|
|
83
83
|
...props,
|
|
@@ -98,7 +98,7 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
98
98
|
let buttonRef = (0, $9yRST$useRef)(null);
|
|
99
99
|
let domRef = (0, $9yRST$useFocusableRef)(ref, buttonRef);
|
|
100
100
|
let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $9yRST$useOverlayTrigger)({
|
|
101
|
-
type:
|
|
101
|
+
type: 'listbox'
|
|
102
102
|
}, state, buttonRef);
|
|
103
103
|
let inputRef = (0, $9yRST$useRef)(null);
|
|
104
104
|
(0, $9yRST$useFormValidation)({
|
|
@@ -109,12 +109,12 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
109
109
|
}
|
|
110
110
|
}, state, inputRef);
|
|
111
111
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
112
|
-
let validationState = props.validationState || (isInvalid ?
|
|
112
|
+
let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);
|
|
113
113
|
var _props_errorMessage;
|
|
114
|
-
let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(
|
|
114
|
+
let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(' ');
|
|
115
115
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $9yRST$useField)({
|
|
116
116
|
...props,
|
|
117
|
-
labelElementType:
|
|
117
|
+
labelElementType: 'span',
|
|
118
118
|
isInvalid: isInvalid,
|
|
119
119
|
errorMessage: errorMessage
|
|
120
120
|
});
|
|
@@ -122,18 +122,18 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
122
122
|
labelProps.onClick = ()=>{
|
|
123
123
|
if (!props.isDisabled && buttonRef.current) {
|
|
124
124
|
buttonRef.current.focus();
|
|
125
|
-
(0, $9yRST$setInteractionModality)(
|
|
125
|
+
(0, $9yRST$setInteractionModality)('keyboard');
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
let inputProps = {
|
|
129
|
-
type:
|
|
129
|
+
type: 'hidden',
|
|
130
130
|
name: name,
|
|
131
131
|
value: state.inputValue
|
|
132
132
|
};
|
|
133
|
-
if (validationBehavior ===
|
|
133
|
+
if (validationBehavior === 'native') {
|
|
134
134
|
// Use a hidden <input type="text"> rather than <input type="hidden">
|
|
135
135
|
// so that an empty value blocks HTML form submission when the field is required.
|
|
136
|
-
inputProps.type =
|
|
136
|
+
inputProps.type = 'text';
|
|
137
137
|
inputProps.hidden = true;
|
|
138
138
|
inputProps.required = isRequired;
|
|
139
139
|
// Ignore react warning.
|
|
@@ -163,9 +163,9 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
163
163
|
isPlaceholder: !state.inputValue,
|
|
164
164
|
validationState: validationState,
|
|
165
165
|
inputValue: state.inputValue,
|
|
166
|
-
clearInput: ()=>state.setInputValue(
|
|
167
|
-
onPress: ()=>!isReadOnly && state.open(null,
|
|
168
|
-
}, state.inputValue || props.placeholder ||
|
|
166
|
+
clearInput: ()=>state.setInputValue(''),
|
|
167
|
+
onPress: ()=>!isReadOnly && state.open(null, 'manual')
|
|
168
|
+
}, state.inputValue || props.placeholder || '')), /*#__PURE__*/ (0, $9yRST$react).createElement("input", {
|
|
169
169
|
...inputProps,
|
|
170
170
|
ref: inputRef
|
|
171
171
|
}), /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$Tray), {
|
|
@@ -187,16 +187,16 @@ const $c940f54e16bafef5$var$SearchAutocompleteButton = /*#__PURE__*/ (0, $9yRST$
|
|
|
187
187
|
"data-testid": "searchicon"
|
|
188
188
|
});
|
|
189
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))),
|
|
190
|
+
let stringFormatter = (0, $9yRST$useLocalizedStringFormatter)((0, ($parcel$interopDefault($9yRST$intlStringsmodulejs))), '@react-spectrum/autocomplete');
|
|
191
191
|
let valueId = (0, $9yRST$useId)();
|
|
192
192
|
let invalidId = (0, $9yRST$useId)();
|
|
193
|
-
let validationIcon = validationState ===
|
|
193
|
+
let validationIcon = validationState === 'invalid' ? /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$spectrumiconsuiAlertMedium), {
|
|
194
194
|
id: invalidId,
|
|
195
|
-
"aria-label": stringFormatter.format(
|
|
195
|
+
"aria-label": stringFormatter.format('invalid')
|
|
196
196
|
}) : /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$spectrumiconsuiCheckmarkMedium), null);
|
|
197
197
|
if (icon) icon = /*#__PURE__*/ (0, $9yRST$react).cloneElement(icon, {
|
|
198
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))),
|
|
199
|
-
size:
|
|
198
|
+
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield-icon'),
|
|
199
|
+
size: 'S'
|
|
200
200
|
});
|
|
201
201
|
let clearButton = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ClearButton), {
|
|
202
202
|
onPress: (e)=>{
|
|
@@ -205,25 +205,25 @@ const $c940f54e16bafef5$var$SearchAutocompleteButton = /*#__PURE__*/ (0, $9yRST$
|
|
|
205
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
206
|
},
|
|
207
207
|
preventFocus: true,
|
|
208
|
-
"aria-label": stringFormatter.format(
|
|
208
|
+
"aria-label": stringFormatter.format('clear'),
|
|
209
209
|
excludeFromTabOrder: true,
|
|
210
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
210
|
+
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-ClearButton'),
|
|
211
211
|
isDisabled: isDisabled
|
|
212
212
|
});
|
|
213
213
|
let validation = /*#__PURE__*/ (0, $9yRST$react).cloneElement(validationIcon, {
|
|
214
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))),
|
|
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
215
|
});
|
|
216
216
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $9yRST$useHover)({});
|
|
217
217
|
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $9yRST$useFocusRing)();
|
|
218
218
|
let { buttonProps: buttonProps } = (0, $9yRST$useButton)({
|
|
219
219
|
...props,
|
|
220
|
-
|
|
221
|
-
props[
|
|
222
|
-
props[
|
|
220
|
+
'aria-labelledby': [
|
|
221
|
+
props['aria-labelledby'],
|
|
222
|
+
props['aria-label'] && !props['aria-labelledby'] ? props.id : null,
|
|
223
223
|
valueId,
|
|
224
|
-
validationState ===
|
|
225
|
-
].filter(Boolean).join(
|
|
226
|
-
elementType:
|
|
224
|
+
validationState === 'invalid' ? invalidId : null
|
|
225
|
+
].filter(Boolean).join(' '),
|
|
226
|
+
elementType: 'div'
|
|
227
227
|
}, ref);
|
|
228
228
|
return /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
|
|
229
229
|
...(0, $9yRST$mergeProps)(hoverProps, focusProps, buttonProps),
|
|
@@ -231,40 +231,40 @@ const $c940f54e16bafef5$var$SearchAutocompleteButton = /*#__PURE__*/ (0, $9yRST$
|
|
|
231
231
|
ref: ref,
|
|
232
232
|
style: {
|
|
233
233
|
...style,
|
|
234
|
-
outline:
|
|
234
|
+
outline: 'none'
|
|
235
235
|
},
|
|
236
|
-
className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$inputgroup_vars_cssmodulejs))),
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))),
|
|
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
244
|
}, /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
|
|
245
|
-
className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))),
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}), (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$inputgroup_vars_cssmodulejs))),
|
|
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
255
|
}, /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
|
|
256
|
-
className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))),
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
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
264
|
}, icon, /*#__PURE__*/ (0, $9yRST$react).createElement("span", {
|
|
265
265
|
id: valueId,
|
|
266
|
-
className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))),
|
|
267
|
-
}, children)), validationState && !isDisabled ? validation : null, (inputValue !==
|
|
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
268
|
});
|
|
269
269
|
function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
270
270
|
let searchIcon = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$spectrumiconsuiMagnifier), {
|
|
@@ -277,12 +277,12 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
277
277
|
let inputRef = (0, $9yRST$useRef)(null);
|
|
278
278
|
let popoverRef = (0, $9yRST$useRef)(null);
|
|
279
279
|
let listBoxRef = (0, $9yRST$useRef)(null);
|
|
280
|
-
let isLoading = loadingState ===
|
|
281
|
-
let layout = (0, $9yRST$useListBoxLayout)(
|
|
282
|
-
let stringFormatter = (0, $9yRST$useLocalizedStringFormatter)((0, ($parcel$interopDefault($9yRST$intlStringsmodulejs))),
|
|
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
283
|
let { inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, clearButtonProps: clearButtonProps } = (0, $9yRST$useSearchAutocomplete)({
|
|
284
284
|
...props,
|
|
285
|
-
|
|
285
|
+
layoutDelegate: layout,
|
|
286
286
|
popoverRef: popoverRef,
|
|
287
287
|
listBoxRef: listBoxRef,
|
|
288
288
|
inputRef: inputRef,
|
|
@@ -300,29 +300,29 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
300
300
|
if (!state.isOpen && state.isFocused) state.setFocused(false);
|
|
301
301
|
});
|
|
302
302
|
let { dialogProps: dialogProps } = (0, $9yRST$useDialog)({
|
|
303
|
-
|
|
303
|
+
'aria-labelledby': (0, $9yRST$useId)(labelProps.id)
|
|
304
304
|
}, popoverRef);
|
|
305
305
|
// Override the role of the input to "searchbox" instead of "combobox".
|
|
306
306
|
// Since the listbox is always visible, the combobox role doesn't really give us anything.
|
|
307
307
|
// VoiceOver on iOS reads "double tap to collapse" when focused on the input rather than
|
|
308
308
|
// "double tap to edit text", as with a textbox or searchbox. We'd like double tapping to
|
|
309
309
|
// open the virtual keyboard rather than closing the tray.
|
|
310
|
-
inputProps.role =
|
|
311
|
-
inputProps[
|
|
310
|
+
inputProps.role = 'searchbox';
|
|
311
|
+
inputProps['aria-haspopup'] = 'listbox';
|
|
312
312
|
delete inputProps.onTouchEnd;
|
|
313
313
|
let clearButton = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ClearButton), {
|
|
314
314
|
...clearButtonProps,
|
|
315
315
|
preventFocus: true,
|
|
316
|
-
"aria-label": stringFormatter.format(
|
|
316
|
+
"aria-label": stringFormatter.format('clear'),
|
|
317
317
|
excludeFromTabOrder: true,
|
|
318
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
318
|
+
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))), 'spectrum-ClearButton'),
|
|
319
319
|
isDisabled: isDisabled
|
|
320
320
|
});
|
|
321
321
|
let loadingCircle = /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ProgressCircle), {
|
|
322
|
-
"aria-label": stringFormatter.format(
|
|
322
|
+
"aria-label": stringFormatter.format('loading'),
|
|
323
323
|
size: "S",
|
|
324
324
|
isIndeterminate: true,
|
|
325
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
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
326
|
});
|
|
327
327
|
// Close the software keyboard on scroll to give the user a bigger area to scroll.
|
|
328
328
|
// But only do this if scrolling with touch, otherwise it can cause issues with touch
|
|
@@ -345,7 +345,7 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
345
345
|
let inputValue = inputProps.value;
|
|
346
346
|
let lastInputValue = (0, $9yRST$useRef)(inputValue);
|
|
347
347
|
(0, $9yRST$useEffect)(()=>{
|
|
348
|
-
if (loadingState ===
|
|
348
|
+
if (loadingState === 'filtering' && !showLoading) {
|
|
349
349
|
if (timeout.current === null) timeout.current = setTimeout(()=>{
|
|
350
350
|
setShowLoading(true);
|
|
351
351
|
}, 500);
|
|
@@ -356,7 +356,7 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
356
356
|
setShowLoading(true);
|
|
357
357
|
}, 500);
|
|
358
358
|
}
|
|
359
|
-
} else if (loadingState !==
|
|
359
|
+
} else if (loadingState !== 'filtering') {
|
|
360
360
|
// If loading is no longer happening, clear any timers and hide the loading circle
|
|
361
361
|
setShowLoading(false);
|
|
362
362
|
if (timeout.current !== null) {
|
|
@@ -372,7 +372,7 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
372
372
|
]);
|
|
373
373
|
let onKeyDown = (e)=>{
|
|
374
374
|
// Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options
|
|
375
|
-
if (e.key ===
|
|
375
|
+
if (e.key === 'Enter' && state.selectionManager.focusedKey == null) {
|
|
376
376
|
var _popoverRef_current;
|
|
377
377
|
(_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
|
|
378
378
|
if (onClose) onClose();
|
|
@@ -380,8 +380,8 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
380
380
|
} else if (inputProps.onKeyDown) inputProps.onKeyDown(e);
|
|
381
381
|
};
|
|
382
382
|
if (icon) icon = /*#__PURE__*/ (0, $9yRST$react).cloneElement(icon, {
|
|
383
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))),
|
|
384
|
-
size:
|
|
383
|
+
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$textfield_vars_cssmodulejs))), 'spectrum-Textfield-icon'),
|
|
384
|
+
size: 'S'
|
|
385
385
|
});
|
|
386
386
|
return /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$FocusScope), {
|
|
387
387
|
restoreFocus: true,
|
|
@@ -389,7 +389,7 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
389
389
|
}, /*#__PURE__*/ (0, $9yRST$react).createElement("div", {
|
|
390
390
|
...(0, $9yRST$mergeProps)(overlayProps, dialogProps),
|
|
391
391
|
ref: popoverRef,
|
|
392
|
-
className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))),
|
|
392
|
+
className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))), 'tray-dialog')
|
|
393
393
|
}, /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$DismissButton), {
|
|
394
394
|
onDismiss: onClose
|
|
395
395
|
}), /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$TextFieldBase), {
|
|
@@ -401,19 +401,19 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
401
401
|
},
|
|
402
402
|
inputRef: inputRef,
|
|
403
403
|
isDisabled: isDisabled,
|
|
404
|
-
isLoading: showLoading && loadingState ===
|
|
404
|
+
isLoading: showLoading && loadingState === 'filtering',
|
|
405
405
|
loadingIndicator: loadingState != null ? loadingCircle : undefined,
|
|
406
406
|
validationState: validationState,
|
|
407
|
-
wrapperChildren: (state.inputValue !==
|
|
407
|
+
wrapperChildren: (state.inputValue !== '' || loadingState === 'filtering' || validationState != null) && !props.isReadOnly ? clearButton : undefined,
|
|
408
408
|
icon: icon,
|
|
409
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}, (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))),
|
|
413
|
-
|
|
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
414
|
})),
|
|
415
|
-
inputClassName: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
416
|
-
validationIconClassName: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$search_vars_cssmodulejs))),
|
|
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
417
|
}), /*#__PURE__*/ (0, $9yRST$react).createElement((0, $9yRST$ListBoxBase), {
|
|
418
418
|
...listBoxProps,
|
|
419
419
|
domProps: {
|
|
@@ -426,10 +426,10 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
426
426
|
layout: layout,
|
|
427
427
|
state: state,
|
|
428
428
|
shouldUseVirtualFocus: true,
|
|
429
|
-
renderEmptyState: ()=>loadingState !==
|
|
430
|
-
className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))),
|
|
431
|
-
}, stringFormatter.format(
|
|
432
|
-
UNSAFE_className: (0, $9yRST$classNames)((0, ($parcel$interopDefault($9yRST$searchautocomplete_cssmodulejs))),
|
|
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
433
|
ref: listBoxRef,
|
|
434
434
|
onScroll: onScroll,
|
|
435
435
|
onLoadMore: onLoadMore,
|
|
@@ -441,4 +441,4 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
441
441
|
|
|
442
442
|
|
|
443
443
|
export {$c940f54e16bafef5$export$e7a90f7d6b078162 as MobileSearchAutocomplete};
|
|
444
|
-
//# sourceMappingURL=MobileSearchAutocomplete.
|
|
444
|
+
//# sourceMappingURL=MobileSearchAutocomplete.module.js.map
|