@react-spectrum/autocomplete 3.0.0-alpha.22 → 3.0.0-alpha.24

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/module.js CHANGED
@@ -3,16 +3,17 @@ import {Item as $dc667e3abdbeb6b2$re_export$Item, Section as $dc667e3abdbeb6b2$r
3
3
  import {useIsMobileDevice as $aQREU$useIsMobileDevice, useUnwrapDOMRef as $aQREU$useUnwrapDOMRef, useFocusableRef as $aQREU$useFocusableRef, useResizeObserver as $aQREU$useResizeObserver, classNames as $aQREU$classNames} from "@react-spectrum/utils";
4
4
  import {ClearButton as $aQREU$ClearButton} from "@react-spectrum/button";
5
5
  import {Field as $aQREU$Field} from "@react-spectrum/label";
6
- import {useLayoutEffect as $aQREU$useLayoutEffect, filterDOMProps as $aQREU$filterDOMProps, mergeProps as $aQREU$mergeProps, useId as $aQREU$useId} from "@react-aria/utils";
6
+ import {useLayoutEffect as $aQREU$useLayoutEffect, filterDOMProps as $aQREU$filterDOMProps, useFormReset as $aQREU$useFormReset, mergeProps as $aQREU$mergeProps, useId as $aQREU$useId} from "@react-aria/utils";
7
7
  import {FocusRing as $aQREU$FocusRing, useFocusRing as $aQREU$useFocusRing, focusSafely as $aQREU$focusSafely, FocusScope as $aQREU$FocusScope} from "@react-aria/focus";
8
8
  import {useListBoxLayout as $aQREU$useListBoxLayout, ListBoxBase as $aQREU$ListBoxBase} from "@react-spectrum/listbox";
9
9
  import $aQREU$spectrumiconsuiMagnifier from "@spectrum-icons/ui/Magnifier";
10
10
  import {Popover as $aQREU$Popover, Tray as $aQREU$Tray} from "@react-spectrum/overlays";
11
11
  import {ProgressCircle as $aQREU$ProgressCircle} from "@react-spectrum/progress";
12
- import $aQREU$react, {useRef as $aQREU$useRef, useState as $aQREU$useState, useCallback as $aQREU$useCallback, useEffect as $aQREU$useEffect, forwardRef as $aQREU$forwardRef} from "react";
12
+ import $aQREU$react, {useRef as $aQREU$useRef, useCallback as $aQREU$useCallback, useState as $aQREU$useState, useEffect as $aQREU$useEffect, forwardRef as $aQREU$forwardRef} from "react";
13
13
  import {TextFieldBase as $aQREU$TextFieldBase} from "@react-spectrum/textfield";
14
14
  import {useComboBoxState as $aQREU$useComboBoxState} from "@react-stately/combobox";
15
15
  import {useLocalizedStringFormatter as $aQREU$useLocalizedStringFormatter, useFilter as $aQREU$useFilter} from "@react-aria/i18n";
16
+ import {useFormProps as $aQREU$useFormProps} from "@react-spectrum/form";
16
17
  import {useHover as $aQREU$useHover, setInteractionModality as $aQREU$setInteractionModality} from "@react-aria/interactions";
17
18
  import {useProviderProps as $aQREU$useProviderProps, useProvider as $aQREU$useProvider} from "@react-spectrum/provider";
18
19
  import {useSearchAutocomplete as $aQREU$useSearchAutocomplete} from "@react-aria/autocomplete";
@@ -21,11 +22,14 @@ import $aQREU$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkM
21
22
  import {useOverlayTrigger as $aQREU$useOverlayTrigger, DismissButton as $aQREU$DismissButton} from "@react-aria/overlays";
22
23
  import {useButton as $aQREU$useButton} from "@react-aria/button";
23
24
  import {useDialog as $aQREU$useDialog} from "@react-aria/dialog";
24
- import {useLabel as $aQREU$useLabel} from "@react-aria/label";
25
+ import {useField as $aQREU$useField} from "@react-aria/label";
26
+ import {useFormValidation as $aQREU$useFormValidation} from "@react-aria/form";
27
+
25
28
 
26
29
  function $parcel$interopDefault(a) {
27
30
  return a && a.__esModule ? a.default : a;
28
31
  }
32
+
29
33
  function $parcel$export(e, n, v, s) {
30
34
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31
35
  }
@@ -58,28 +62,28 @@ function $parcel$export(e, n, v, s) {
58
62
  var $67773d1975e0a845$exports = {};
59
63
  var $024cf3aa492e9082$exports = {};
60
64
  $024cf3aa492e9082$exports = {
61
- "clear": `مسح`,
62
- "invalid": `(غير صالح)`,
63
- "loading": `جارٍ التحميل...`,
64
- "noResults": `لا توجد نتائج`
65
+ "clear": `\u{645}\u{633}\u{62D}`,
66
+ "invalid": `(\u{63A}\u{64A}\u{631} \u{635}\u{627}\u{644}\u{62D})`,
67
+ "loading": `\u{62C}\u{627}\u{631}\u{64D} \u{627}\u{644}\u{62A}\u{62D}\u{645}\u{64A}\u{644}...`,
68
+ "noResults": `\u{644}\u{627} \u{62A}\u{648}\u{62C}\u{62F} \u{646}\u{62A}\u{627}\u{626}\u{62C}`
65
69
  };
66
70
 
67
71
 
68
72
  var $b1478ef78bbb453c$exports = {};
69
73
  $b1478ef78bbb453c$exports = {
70
- "clear": `Изчисти`,
71
- "invalid": `(невалиден)`,
72
- "loading": `Зареждане...`,
73
- "noResults": `Няма резултати`
74
+ "clear": `\u{418}\u{437}\u{447}\u{438}\u{441}\u{442}\u{438}`,
75
+ "invalid": `(\u{43D}\u{435}\u{432}\u{430}\u{43B}\u{438}\u{434}\u{435}\u{43D})`,
76
+ "loading": `\u{417}\u{430}\u{440}\u{435}\u{436}\u{434}\u{430}\u{43D}\u{435}...`,
77
+ "noResults": `\u{41D}\u{44F}\u{43C}\u{430} \u{440}\u{435}\u{437}\u{443}\u{43B}\u{442}\u{430}\u{442}\u{438}`
74
78
  };
75
79
 
76
80
 
77
81
  var $a460b76408fa2c12$exports = {};
78
82
  $a460b76408fa2c12$exports = {
79
83
  "clear": `Vymazat`,
80
- "invalid": `(neplatné)`,
81
- "loading": `Načítání...`,
82
- "noResults": `Žádné výsledky`
84
+ "invalid": `(neplatn\xe9)`,
85
+ "loading": `Na\u{10D}\xedt\xe1n\xed...`,
86
+ "noResults": `\u{17D}\xe1dn\xe9 v\xfdsledky`
83
87
  };
84
88
 
85
89
 
@@ -87,15 +91,15 @@ var $e9e48f3945b54c4e$exports = {};
87
91
  $e9e48f3945b54c4e$exports = {
88
92
  "clear": `Ryd`,
89
93
  "invalid": `(ugyldig)`,
90
- "loading": `Indlæser...`,
94
+ "loading": `Indl\xe6ser...`,
91
95
  "noResults": `Ingen resultater`
92
96
  };
93
97
 
94
98
 
95
99
  var $51a37bbbb04b8d4b$exports = {};
96
100
  $51a37bbbb04b8d4b$exports = {
97
- "clear": `Löschen`,
98
- "invalid": `(ungültig)`,
101
+ "clear": `L\xf6schen`,
102
+ "invalid": `(ung\xfcltig)`,
99
103
  "loading": `Wird geladen...`,
100
104
  "noResults": `Keine Ergebnisse`
101
105
  };
@@ -103,10 +107,10 @@ $51a37bbbb04b8d4b$exports = {
103
107
 
104
108
  var $a9652db54e8c657c$exports = {};
105
109
  $a9652db54e8c657c$exports = {
106
- "clear": `Καθαρισμός`,
107
- "invalid": `(δεν ισχύει)`,
108
- "loading": `Φόρτωση...`,
109
- "noResults": `Χωρίς αποτέλεσμα`
110
+ "clear": `\u{39A}\u{3B1}\u{3B8}\u{3B1}\u{3C1}\u{3B9}\u{3C3}\u{3BC}\u{3CC}\u{3C2}`,
111
+ "invalid": `(\u{3B4}\u{3B5}\u{3BD} \u{3B9}\u{3C3}\u{3C7}\u{3CD}\u{3B5}\u{3B9})`,
112
+ "loading": `\u{3A6}\u{3CC}\u{3C1}\u{3C4}\u{3C9}\u{3C3}\u{3B7}...`,
113
+ "noResults": `\u{3A7}\u{3C9}\u{3C1}\u{3AF}\u{3C2} \u{3B1}\u{3C0}\u{3BF}\u{3C4}\u{3AD}\u{3BB}\u{3B5}\u{3C3}\u{3BC}\u{3B1}`
110
114
  };
111
115
 
112
116
 
@@ -122,7 +126,7 @@ $9d3fddee794c9b57$exports = {
122
126
  var $d19a882e0e4cfd8a$exports = {};
123
127
  $d19a882e0e4cfd8a$exports = {
124
128
  "clear": `Borrar`,
125
- "invalid": `(no válido)`,
129
+ "invalid": `(no v\xe1lido)`,
126
130
  "loading": `Cargando...`,
127
131
  "noResults": `Sin resultados`
128
132
  };
@@ -140,7 +144,7 @@ $f163759b67478eb6$exports = {
140
144
  var $b156937eefa4b1b2$exports = {};
141
145
  $b156937eefa4b1b2$exports = {
142
146
  "clear": `Kirkas`,
143
- "invalid": `(epäkelpo)`,
147
+ "invalid": `(ep\xe4kelpo)`,
144
148
  "loading": `Ladataan...`,
145
149
  "noResults": `Ei tuloksia`
146
150
  };
@@ -150,35 +154,35 @@ var $21aacec2a5f4c61f$exports = {};
150
154
  $21aacec2a5f4c61f$exports = {
151
155
  "clear": `Effacer`,
152
156
  "invalid": `(non valide)`,
153
- "loading": `Chargement en cours…`,
154
- "noResults": `Aucun résultat`
157
+ "loading": `Chargement en cours\u{2026}`,
158
+ "noResults": `Aucun r\xe9sultat`
155
159
  };
156
160
 
157
161
 
158
162
  var $a0cc323ab22de2bd$exports = {};
159
163
  $a0cc323ab22de2bd$exports = {
160
- "clear": `נקה`,
161
- "invalid": `(לא חוקי)`,
162
- "loading": `טוען...`,
163
- "noResults": `אין תוצאות`
164
+ "clear": `\u{5E0}\u{5E7}\u{5D4}`,
165
+ "invalid": `(\u{5DC}\u{5D0} \u{5D7}\u{5D5}\u{5E7}\u{5D9})`,
166
+ "loading": `\u{5D8}\u{5D5}\u{5E2}\u{5DF}...`,
167
+ "noResults": `\u{5D0}\u{5D9}\u{5DF} \u{5EA}\u{5D5}\u{5E6}\u{5D0}\u{5D5}\u{5EA}`
164
168
  };
165
169
 
166
170
 
167
171
  var $4b1559eab8beeaf7$exports = {};
168
172
  $4b1559eab8beeaf7$exports = {
169
- "clear": `Izbriši`,
170
- "invalid": `(nevažeće)`,
171
- "loading": `Učitavam...`,
173
+ "clear": `Izbri\u{161}i`,
174
+ "invalid": `(neva\u{17E}e\u{107}e)`,
175
+ "loading": `U\u{10D}itavam...`,
172
176
  "noResults": `Nema rezultata`
173
177
  };
174
178
 
175
179
 
176
180
  var $4dab4b9205a1a185$exports = {};
177
181
  $4dab4b9205a1a185$exports = {
178
- "clear": `Törlés`,
179
- "invalid": `(érvénytelen)`,
180
- "loading": `Betöltés folyamatban…`,
181
- "noResults": `Nincsenek találatok`
182
+ "clear": `T\xf6rl\xe9s`,
183
+ "invalid": `(\xe9rv\xe9nytelen)`,
184
+ "loading": `Bet\xf6lt\xe9s folyamatban\u{2026}`,
185
+ "noResults": `Nincsenek tal\xe1latok`
182
186
  };
183
187
 
184
188
 
@@ -193,43 +197,43 @@ $e68bbe47073afa8a$exports = {
193
197
 
194
198
  var $88667c729de33c42$exports = {};
195
199
  $88667c729de33c42$exports = {
196
- "clear": `クリア`,
197
- "invalid": `(無効)`,
198
- "loading": `読み込み中...`,
199
- "noResults": `結果なし`
200
+ "clear": `\u{30AF}\u{30EA}\u{30A2}`,
201
+ "invalid": `(\u{7121}\u{52B9})`,
202
+ "loading": `\u{8AAD}\u{307F}\u{8FBC}\u{307F}\u{4E2D}...`,
203
+ "noResults": `\u{7D50}\u{679C}\u{306A}\u{3057}`
200
204
  };
201
205
 
202
206
 
203
207
  var $4c3197bb97515799$exports = {};
204
208
  $4c3197bb97515799$exports = {
205
- "clear": `지우기`,
206
- "invalid": `(유효하지 않음)`,
207
- "loading": `로드 중...`,
208
- "noResults": `결과 없음`
209
+ "clear": `\u{C9C0}\u{C6B0}\u{AE30}`,
210
+ "invalid": `(\u{C720}\u{D6A8}\u{D558}\u{C9C0} \u{C54A}\u{C74C})`,
211
+ "loading": `\u{B85C}\u{B4DC} \u{C911}...`,
212
+ "noResults": `\u{ACB0}\u{ACFC} \u{C5C6}\u{C74C}`
209
213
  };
210
214
 
211
215
 
212
216
  var $cd50f414bffb1f7a$exports = {};
213
217
  $cd50f414bffb1f7a$exports = {
214
- "clear": `Išvalyti`,
218
+ "clear": `I\u{161}valyti`,
215
219
  "invalid": `(netinkama)`,
216
- "loading": keliama...`,
217
- "noResults": `Rezultatų nėra`
220
+ "loading": `\u{12E}keliama...`,
221
+ "noResults": `Rezultat\u{173} n\u{117}ra`
218
222
  };
219
223
 
220
224
 
221
225
  var $0d7f84ef3916515f$exports = {};
222
226
  $0d7f84ef3916515f$exports = {
223
- "clear": `Notīrīt`,
224
- "invalid": `(nederīgs)`,
225
- "loading": `Notiek ielāde...`,
226
- "noResults": `Nav rezultātu`
227
+ "clear": `Not\u{12B}r\u{12B}t`,
228
+ "invalid": `(neder\u{12B}gs)`,
229
+ "loading": `Notiek iel\u{101}de...`,
230
+ "noResults": `Nav rezult\u{101}tu`
227
231
  };
228
232
 
229
233
 
230
234
  var $f1a58baeabc47396$exports = {};
231
235
  $f1a58baeabc47396$exports = {
232
- "clear": `Tøm`,
236
+ "clear": `T\xf8m`,
233
237
  "invalid": `(ugyldig)`,
234
238
  "loading": `Laster inn...`,
235
239
  "noResults": `Ingen resultater`
@@ -247,17 +251,17 @@ $a3dd9e27853292c1$exports = {
247
251
 
248
252
  var $6e8413d536bb66ca$exports = {};
249
253
  $6e8413d536bb66ca$exports = {
250
- "clear": `Wyczyść`,
251
- "invalid": `(nieprawidłowy)`,
254
+ "clear": `Wyczy\u{15B}\u{107}`,
255
+ "invalid": `(nieprawid\u{142}owy)`,
252
256
  "loading": `Wczytywanie...`,
253
- "noResults": `Brak wyników`
257
+ "noResults": `Brak wynik\xf3w`
254
258
  };
255
259
 
256
260
 
257
261
  var $bdf278414a496664$exports = {};
258
262
  $bdf278414a496664$exports = {
259
263
  "clear": `Limpar`,
260
- "invalid": `(inválido)`,
264
+ "invalid": `(inv\xe1lido)`,
261
265
  "loading": `Carregando...`,
262
266
  "noResults": `Nenhum resultado`
263
267
  };
@@ -266,7 +270,7 @@ $bdf278414a496664$exports = {
266
270
  var $53a7cad14ed21164$exports = {};
267
271
  $53a7cad14ed21164$exports = {
268
272
  "clear": `Limpar`,
269
- "invalid": `(inválido)`,
273
+ "invalid": `(inv\xe1lido)`,
270
274
  "loading": `A carregar...`,
271
275
  "noResults": `Sem resultados`
272
276
  };
@@ -276,32 +280,32 @@ var $f503546cf2f6f1ae$exports = {};
276
280
  $f503546cf2f6f1ae$exports = {
277
281
  "clear": `Golire`,
278
282
  "invalid": `(nevalid)`,
279
- "loading": `Se încarcă...`,
283
+ "loading": `Se \xeencarc\u{103}...`,
280
284
  "noResults": `Niciun rezultat`
281
285
  };
282
286
 
283
287
 
284
288
  var $9c0df9313a851b51$exports = {};
285
289
  $9c0df9313a851b51$exports = {
286
- "clear": `Очистить`,
287
- "invalid": `(недействительно)`,
288
- "loading": `Загрузка...`,
289
- "noResults": `Результаты отсутствуют`
290
+ "clear": `\u{41E}\u{447}\u{438}\u{441}\u{442}\u{438}\u{442}\u{44C}`,
291
+ "invalid": `(\u{43D}\u{435}\u{434}\u{435}\u{439}\u{441}\u{442}\u{432}\u{438}\u{442}\u{435}\u{43B}\u{44C}\u{43D}\u{43E})`,
292
+ "loading": `\u{417}\u{430}\u{433}\u{440}\u{443}\u{437}\u{43A}\u{430}...`,
293
+ "noResults": `\u{420}\u{435}\u{437}\u{443}\u{43B}\u{44C}\u{442}\u{430}\u{442}\u{44B} \u{43E}\u{442}\u{441}\u{443}\u{442}\u{441}\u{442}\u{432}\u{443}\u{44E}\u{442}`
290
294
  };
291
295
 
292
296
 
293
297
  var $ff7d7295476e23aa$exports = {};
294
298
  $ff7d7295476e23aa$exports = {
295
- "clear": `Vymazať`,
296
- "invalid": `(neplatné)`,
297
- "loading": `Načítava sa...`,
298
- "noResults": iadne výsledky`
299
+ "clear": `Vymaza\u{165}`,
300
+ "invalid": `(neplatn\xe9)`,
301
+ "loading": `Na\u{10D}\xedtava sa...`,
302
+ "noResults": `\u{17D}iadne v\xfdsledky`
299
303
  };
300
304
 
301
305
 
302
306
  var $9a2e91f09cf7ad62$exports = {};
303
307
  $9a2e91f09cf7ad62$exports = {
304
- "clear": `Pobrišite`,
308
+ "clear": `Pobri\u{161}ite`,
305
309
  "invalid": `(neveljavno)`,
306
310
  "loading": `Nalaganje...`,
307
311
  "noResults": `Ni rezultatov`
@@ -310,9 +314,9 @@ $9a2e91f09cf7ad62$exports = {
310
314
 
311
315
  var $15b314371291c45e$exports = {};
312
316
  $15b314371291c45e$exports = {
313
- "clear": `Izbriši`,
314
- "invalid": `(nevažeće)`,
315
- "loading": `Učitavam...`,
317
+ "clear": `Izbri\u{161}i`,
318
+ "invalid": `(neva\u{17E}e\u{107}e)`,
319
+ "loading": `U\u{10D}itavam...`,
316
320
  "noResults": `Nema rezultata`
317
321
  };
318
322
 
@@ -321,7 +325,7 @@ var $1582d77a65bc529b$exports = {};
321
325
  $1582d77a65bc529b$exports = {
322
326
  "clear": `Rensa`,
323
327
  "invalid": `(ogiltigt)`,
324
- "loading": `Läser in...`,
328
+ "loading": `L\xe4ser in...`,
325
329
  "noResults": `Inga resultat`
326
330
  };
327
331
 
@@ -329,36 +333,36 @@ $1582d77a65bc529b$exports = {
329
333
  var $c43996bbf6a84066$exports = {};
330
334
  $c43996bbf6a84066$exports = {
331
335
  "clear": `Temizle`,
332
- "invalid": `(geçersiz)`,
333
- "loading": `Yükleniyor...`,
334
- "noResults": `Sonuç yok`
336
+ "invalid": `(ge\xe7ersiz)`,
337
+ "loading": `Y\xfckleniyor...`,
338
+ "noResults": `Sonu\xe7 yok`
335
339
  };
336
340
 
337
341
 
338
342
  var $f0ebecaa2c26d7b6$exports = {};
339
343
  $f0ebecaa2c26d7b6$exports = {
340
- "clear": `Очистити`,
341
- "invalid": `(недійсне)`,
342
- "loading": `Завантаження...`,
343
- "noResults": `Результатів немає`
344
+ "clear": `\u{41E}\u{447}\u{438}\u{441}\u{442}\u{438}\u{442}\u{438}`,
345
+ "invalid": `(\u{43D}\u{435}\u{434}\u{456}\u{439}\u{441}\u{43D}\u{435})`,
346
+ "loading": `\u{417}\u{430}\u{432}\u{430}\u{43D}\u{442}\u{430}\u{436}\u{435}\u{43D}\u{43D}\u{44F}...`,
347
+ "noResults": `\u{420}\u{435}\u{437}\u{443}\u{43B}\u{44C}\u{442}\u{430}\u{442}\u{456}\u{432} \u{43D}\u{435}\u{43C}\u{430}\u{454}`
344
348
  };
345
349
 
346
350
 
347
351
  var $0d8545e67578a6e4$exports = {};
348
352
  $0d8545e67578a6e4$exports = {
349
- "clear": `清除`,
350
- "invalid": `(无效)`,
351
- "loading": `正在加载...`,
352
- "noResults": `无结果`
353
+ "clear": `\u{6E05}\u{9664}`,
354
+ "invalid": `\u{FF08}\u{65E0}\u{6548}\u{FF09}`,
355
+ "loading": `\u{6B63}\u{5728}\u{52A0}\u{8F7D}...`,
356
+ "noResults": `\u{65E0}\u{7ED3}\u{679C}`
353
357
  };
354
358
 
355
359
 
356
360
  var $5a75571ed7cb75fa$exports = {};
357
361
  $5a75571ed7cb75fa$exports = {
358
- "clear": `清除`,
359
- "invalid": `(無效)`,
360
- "loading": `正在載入...`,
361
- "noResults": `無任何結果`
362
+ "clear": `\u{6E05}\u{9664}`,
363
+ "invalid": `(\u{7121}\u{6548})`,
364
+ "loading": `\u{6B63}\u{5728}\u{8F09}\u{5165}...`,
365
+ "noResults": `\u{7121}\u{4EFB}\u{4F55}\u{7D50}\u{679C}`
362
366
  };
363
367
 
364
368
 
@@ -670,9 +674,10 @@ $c14528ddc146317f$export$9fcb3d6af94a9d12 = `YO3Nla_spectrum-Textfield-wrapper--
670
674
 
671
675
 
672
676
 
677
+
673
678
  function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
674
679
  props = (0, $aQREU$useProviderProps)(props);
675
- let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, isReadOnly: isReadOnly, onSubmit: onSubmit = ()=>{} } = props;
680
+ let { isQuiet: isQuiet, isDisabled: isDisabled, isRequired: isRequired, validationBehavior: validationBehavior, validate: validate, name: name, isReadOnly: isReadOnly, onSubmit: onSubmit = ()=>{} } = props;
676
681
  let { contains: contains } = (0, $aQREU$useFilter)({
677
682
  sensitivity: "base"
678
683
  });
@@ -687,16 +692,33 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
687
692
  allowsCustomValue: true,
688
693
  onSelectionChange: (key)=>key !== null && onSubmit(null, key),
689
694
  selectedKey: undefined,
690
- defaultSelectedKey: undefined
695
+ defaultSelectedKey: undefined,
696
+ validate: (0, $aQREU$useCallback)((v)=>validate === null || validate === void 0 ? void 0 : validate(v.inputValue), [
697
+ validate
698
+ ])
691
699
  });
692
700
  let buttonRef = (0, $aQREU$useRef)(null);
693
701
  let domRef = (0, $aQREU$useFocusableRef)(ref, buttonRef);
694
702
  let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $aQREU$useOverlayTrigger)({
695
703
  type: "listbox"
696
704
  }, state, buttonRef);
697
- let { labelProps: labelProps, fieldProps: fieldProps } = (0, $aQREU$useLabel)({
705
+ let inputRef = (0, $aQREU$useRef)(null);
706
+ (0, $aQREU$useFormValidation)({
698
707
  ...props,
699
- labelElementType: "span"
708
+ focus: ()=>{
709
+ var _buttonRef_current;
710
+ return (_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.focus();
711
+ }
712
+ }, state, inputRef);
713
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
714
+ let validationState = props.validationState || (isInvalid ? "invalid" : undefined);
715
+ var _props_errorMessage;
716
+ let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(" ");
717
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $aQREU$useField)({
718
+ ...props,
719
+ labelElementType: "span",
720
+ isInvalid: isInvalid,
721
+ errorMessage: errorMessage
700
722
  });
701
723
  // Focus the button and show focus ring when clicking on the label
702
724
  labelProps.onClick = ()=>{
@@ -705,9 +727,29 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
705
727
  (0, $aQREU$setInteractionModality)("keyboard");
706
728
  }
707
729
  };
730
+ let inputProps = {
731
+ type: "hidden",
732
+ name: name,
733
+ value: state.inputValue
734
+ };
735
+ if (validationBehavior === "native") {
736
+ // Use a hidden <input type="text"> rather than <input type="hidden">
737
+ // so that an empty value blocks HTML form submission when the field is required.
738
+ inputProps.type = "text";
739
+ inputProps.hidden = true;
740
+ inputProps.required = isRequired;
741
+ // Ignore react warning.
742
+ inputProps.onChange = ()=>{};
743
+ }
744
+ (0, $aQREU$useFormReset)(inputRef, state.inputValue, state.setInputValue);
708
745
  return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$react).Fragment, null, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Field), {
709
746
  ...props,
710
747
  labelProps: labelProps,
748
+ descriptionProps: descriptionProps,
749
+ errorMessageProps: errorMessageProps,
750
+ isInvalid: isInvalid,
751
+ validationErrors: validationErrors,
752
+ validationDetails: validationDetails,
711
753
  elementType: "span",
712
754
  ref: domRef,
713
755
  includeNecessityIndicatorInAccessibilityName: true
@@ -725,7 +767,10 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
725
767
  inputValue: state.inputValue,
726
768
  clearInput: ()=>state.setInputValue(""),
727
769
  onPress: ()=>!isReadOnly && state.open(null, "manual")
728
- }, state.inputValue || props.placeholder || "")), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Tray), {
770
+ }, state.inputValue || props.placeholder || "")), /*#__PURE__*/ (0, $aQREU$react).createElement("input", {
771
+ ...inputProps,
772
+ ref: inputRef
773
+ }), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Tray), {
729
774
  state: state,
730
775
  isFixedHeight: true,
731
776
  ...overlayProps
@@ -842,19 +887,20 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
842
887
  keyboardDelegate: layout,
843
888
  popoverRef: popoverRef,
844
889
  listBoxRef: listBoxRef,
845
- inputRef: inputRef
890
+ inputRef: inputRef,
891
+ // Handled outside the tray.
892
+ name: undefined
846
893
  }, state);
847
894
  (0, $aQREU$react).useEffect(()=>{
848
895
  if (inputRef.current) (0, $aQREU$focusSafely)(inputRef.current);
849
- // When the tray unmounts, set state.isFocused (i.e. the tray input's focus tracker) to false.
896
+ }, []);
897
+ (0, $aQREU$react).useEffect(()=>{
898
+ // When the tray closes, set state.isFocused (i.e. the tray input's focus tracker) to false.
850
899
  // This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay
851
900
  // (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to "contain")
852
901
  // Have to do this manually since React doesn't call onBlur when a component is unmounted: https://github.com/facebook/react/issues/12363
853
- return ()=>{
854
- state.setFocused(false);
855
- };
856
- // eslint-disable-next-line react-hooks/exhaustive-deps
857
- }, []);
902
+ if (!state.isOpen && state.isFocused) state.setFocused(false);
903
+ });
858
904
  let { dialogProps: dialogProps } = (0, $aQREU$useDialog)({
859
905
  "aria-labelledby": (0, $aQREU$useId)(labelProps.id)
860
906
  }, popoverRef);
@@ -1009,8 +1055,10 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
1009
1055
 
1010
1056
 
1011
1057
 
1058
+
1012
1059
  function $f3f3b62273a2d260$var$SearchAutocomplete(props, ref) {
1013
1060
  props = (0, $aQREU$useProviderProps)(props);
1061
+ props = (0, $aQREU$useFormProps)(props);
1014
1062
  if (props.placeholder) console.warn("Placeholders are deprecated due to accessibility issues. Please use help text instead.");
1015
1063
  let isMobile = (0, $aQREU$useIsMobileDevice)();
1016
1064
  if (isMobile) // menuTrigger=focus/manual don't apply to mobile searchwithin
@@ -1026,7 +1074,7 @@ function $f3f3b62273a2d260$var$SearchAutocomplete(props, ref) {
1026
1074
  }
1027
1075
  function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
1028
1076
  props = (0, $aQREU$useProviderProps)(props);
1029
- let { menuTrigger: menuTrigger = "input", shouldFlip: shouldFlip = true, direction: direction = "bottom", isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, onSubmit: onSubmit = ()=>{} } = props;
1077
+ let { menuTrigger: menuTrigger = "input", shouldFlip: shouldFlip = true, direction: direction = "bottom", isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, onSubmit: onSubmit = ()=>{}, validate: validate } = props;
1030
1078
  let stringFormatter = (0, $aQREU$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($67773d1975e0a845$exports))));
1031
1079
  let isAsync = loadingState != null;
1032
1080
  let popoverRef = (0, $aQREU$useRef)(null);
@@ -1044,10 +1092,13 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
1044
1092
  allowsCustomValue: true,
1045
1093
  onSelectionChange: (key)=>key !== null && onSubmit(null, key),
1046
1094
  selectedKey: undefined,
1047
- defaultSelectedKey: undefined
1095
+ defaultSelectedKey: undefined,
1096
+ validate: (0, $aQREU$useCallback)((v)=>validate === null || validate === void 0 ? void 0 : validate(v.inputValue), [
1097
+ validate
1098
+ ])
1048
1099
  });
1049
1100
  let layout = (0, $aQREU$useListBoxLayout)(state, loadingState === "loadingMore");
1050
- let { inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, clearButtonProps: clearButtonProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $aQREU$useSearchAutocomplete)({
1101
+ let { inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, clearButtonProps: clearButtonProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $aQREU$useSearchAutocomplete)({
1051
1102
  ...props,
1052
1103
  keyboardDelegate: layout,
1053
1104
  popoverRef: unwrappedPopoverRef,
@@ -1084,6 +1135,9 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
1084
1135
  descriptionProps: descriptionProps,
1085
1136
  errorMessageProps: errorMessageProps,
1086
1137
  labelProps: labelProps,
1138
+ isInvalid: isInvalid,
1139
+ validationErrors: validationErrors,
1140
+ validationDetails: validationDetails,
1087
1141
  ref: domRef
1088
1142
  }, /*#__PURE__*/ (0, $aQREU$react).createElement($f3f3b62273a2d260$var$SearchAutocompleteInput, {
1089
1143
  ...props,
@@ -1091,7 +1145,8 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
1091
1145
  loadingState: loadingState,
1092
1146
  inputProps: inputProps,
1093
1147
  inputRef: inputRef,
1094
- clearButtonProps: clearButtonProps
1148
+ clearButtonProps: clearButtonProps,
1149
+ validationState: props.validationState || (isInvalid ? "invalid" : undefined)
1095
1150
  })), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Popover), {
1096
1151
  state: state,
1097
1152
  UNSAFE_style: style,