@react-aria/autocomplete 3.0.0-nightly.4555 → 3.0.0-nightly.4558

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/import.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import {mergeProps as $fgZRc$mergeProps} from "@react-aria/utils";
2
- import {useComboBox as $fgZRc$useComboBox} from "@react-aria/combobox";
3
- import {useSearchField as $fgZRc$useSearchField} from "@react-aria/searchfield";
1
+ import {useSearchAutocomplete as $c04f11f368135585$export$da7ade746446be1f} from "./useSearchAutocomplete.mjs";
4
2
 
5
3
  /*
6
4
  * Copyright 2021 Adobe. All rights reserved.
@@ -12,68 +10,8 @@ import {useSearchField as $fgZRc$useSearchField} from "@react-aria/searchfield";
12
10
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
11
  * OF ANY KIND, either express or implied. See the License for the specific language
14
12
  * governing permissions and limitations under the License.
15
- */ /*
16
- * Copyright 2020 Adobe. All rights reserved.
17
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
- * you may not use this file except in compliance with the License. You may obtain a copy
19
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software distributed under
22
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
23
- * OF ANY KIND, either express or implied. See the License for the specific language
24
- * governing permissions and limitations under the License.
25
13
  */
26
14
 
27
15
 
28
- function $c04f11f368135585$export$da7ade746446be1f(props, state) {
29
- let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
30
- let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $fgZRc$useSearchField)({
31
- ...otherProps,
32
- value: state.inputValue,
33
- onChange: state.setInputValue,
34
- autoComplete: "off",
35
- onClear: ()=>{
36
- state.setInputValue("");
37
- if (onClear) onClear();
38
- },
39
- onSubmit: (value)=>{
40
- // Prevent submission from search field if menu item was selected
41
- if (state.selectionManager.focusedKey === null) onSubmit(value, null);
42
- },
43
- onKeyDown: onKeyDown,
44
- onKeyUp: onKeyUp
45
- }, {
46
- value: state.inputValue,
47
- setValue: state.setInputValue
48
- }, inputRef);
49
- let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $fgZRc$useComboBox)({
50
- ...otherProps,
51
- keyboardDelegate: keyboardDelegate,
52
- popoverRef: popoverRef,
53
- listBoxRef: listBoxRef,
54
- inputRef: inputRef,
55
- onFocus: undefined,
56
- onFocusChange: undefined,
57
- onBlur: undefined,
58
- onKeyDown: undefined,
59
- onKeyUp: undefined,
60
- isInvalid: isInvalid,
61
- validationState: validationState,
62
- validationBehavior: validationBehavior,
63
- isRequired: isRequired,
64
- validate: undefined
65
- }, state);
66
- return {
67
- labelProps: labelProps,
68
- inputProps: (0, $fgZRc$mergeProps)(inputProps, comboBoxInputProps),
69
- listBoxProps: listBoxProps,
70
- clearButtonProps: clearButtonProps,
71
- ...validation
72
- };
73
- }
74
-
75
-
76
-
77
-
78
16
  export {$c04f11f368135585$export$da7ade746446be1f as useSearchAutocomplete};
79
17
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,13 +1,11 @@
1
- var $kDrMH$reactariautils = require("@react-aria/utils");
2
- var $kDrMH$reactariacombobox = require("@react-aria/combobox");
3
- var $kDrMH$reactariasearchfield = require("@react-aria/searchfield");
1
+ var $3c40871f8cc2eb01$exports = require("./useSearchAutocomplete.main.js");
4
2
 
5
3
 
6
4
  function $parcel$export(e, n, v, s) {
7
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
6
  }
9
7
 
10
- $parcel$export(module.exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$export$da7ade746446be1f);
8
+ $parcel$export(module.exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$exports.useSearchAutocomplete);
11
9
  /*
12
10
  * Copyright 2021 Adobe. All rights reserved.
13
11
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -18,67 +16,7 @@ $parcel$export(module.exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$
18
16
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
17
  * OF ANY KIND, either express or implied. See the License for the specific language
20
18
  * governing permissions and limitations under the License.
21
- */ /*
22
- * Copyright 2020 Adobe. All rights reserved.
23
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
24
- * you may not use this file except in compliance with the License. You may obtain a copy
25
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
26
- *
27
- * Unless required by applicable law or agreed to in writing, software distributed under
28
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
29
- * OF ANY KIND, either express or implied. See the License for the specific language
30
- * governing permissions and limitations under the License.
31
19
  */
32
20
 
33
21
 
34
- function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
35
- let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
36
- let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $kDrMH$reactariasearchfield.useSearchField)({
37
- ...otherProps,
38
- value: state.inputValue,
39
- onChange: state.setInputValue,
40
- autoComplete: "off",
41
- onClear: ()=>{
42
- state.setInputValue("");
43
- if (onClear) onClear();
44
- },
45
- onSubmit: (value)=>{
46
- // Prevent submission from search field if menu item was selected
47
- if (state.selectionManager.focusedKey === null) onSubmit(value, null);
48
- },
49
- onKeyDown: onKeyDown,
50
- onKeyUp: onKeyUp
51
- }, {
52
- value: state.inputValue,
53
- setValue: state.setInputValue
54
- }, inputRef);
55
- let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $kDrMH$reactariacombobox.useComboBox)({
56
- ...otherProps,
57
- keyboardDelegate: keyboardDelegate,
58
- popoverRef: popoverRef,
59
- listBoxRef: listBoxRef,
60
- inputRef: inputRef,
61
- onFocus: undefined,
62
- onFocusChange: undefined,
63
- onBlur: undefined,
64
- onKeyDown: undefined,
65
- onKeyUp: undefined,
66
- isInvalid: isInvalid,
67
- validationState: validationState,
68
- validationBehavior: validationBehavior,
69
- isRequired: isRequired,
70
- validate: undefined
71
- }, state);
72
- return {
73
- labelProps: labelProps,
74
- inputProps: (0, $kDrMH$reactariautils.mergeProps)(inputProps, comboBoxInputProps),
75
- listBoxProps: listBoxProps,
76
- clearButtonProps: clearButtonProps,
77
- ...validation
78
- };
79
- }
80
-
81
-
82
-
83
-
84
22
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;AA4CM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,YAChB,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,0CAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,oCAAU,EACxF;QACE,GAAG,UAAU;0BACb;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,gCAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF;;CDlHC","sources":["packages/@react-aria/autocomplete/src/index.ts","packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nexport {useSearchAutocomplete} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteOptions, SearchAutocompleteAria} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\n","/*\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search autocomplete component.\n * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the search autocomplete.\n * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.\n */\nexport function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/autocomplete/src/index.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nexport {useSearchAutocomplete} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteOptions, SearchAutocompleteAria} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,6 +1,4 @@
1
- import {mergeProps as $fgZRc$mergeProps} from "@react-aria/utils";
2
- import {useComboBox as $fgZRc$useComboBox} from "@react-aria/combobox";
3
- import {useSearchField as $fgZRc$useSearchField} from "@react-aria/searchfield";
1
+ import {useSearchAutocomplete as $c04f11f368135585$export$da7ade746446be1f} from "./useSearchAutocomplete.module.js";
4
2
 
5
3
  /*
6
4
  * Copyright 2021 Adobe. All rights reserved.
@@ -12,68 +10,8 @@ import {useSearchField as $fgZRc$useSearchField} from "@react-aria/searchfield";
12
10
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
11
  * OF ANY KIND, either express or implied. See the License for the specific language
14
12
  * governing permissions and limitations under the License.
15
- */ /*
16
- * Copyright 2020 Adobe. All rights reserved.
17
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
- * you may not use this file except in compliance with the License. You may obtain a copy
19
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software distributed under
22
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
23
- * OF ANY KIND, either express or implied. See the License for the specific language
24
- * governing permissions and limitations under the License.
25
13
  */
26
14
 
27
15
 
28
- function $c04f11f368135585$export$da7ade746446be1f(props, state) {
29
- let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
30
- let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $fgZRc$useSearchField)({
31
- ...otherProps,
32
- value: state.inputValue,
33
- onChange: state.setInputValue,
34
- autoComplete: "off",
35
- onClear: ()=>{
36
- state.setInputValue("");
37
- if (onClear) onClear();
38
- },
39
- onSubmit: (value)=>{
40
- // Prevent submission from search field if menu item was selected
41
- if (state.selectionManager.focusedKey === null) onSubmit(value, null);
42
- },
43
- onKeyDown: onKeyDown,
44
- onKeyUp: onKeyUp
45
- }, {
46
- value: state.inputValue,
47
- setValue: state.setInputValue
48
- }, inputRef);
49
- let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $fgZRc$useComboBox)({
50
- ...otherProps,
51
- keyboardDelegate: keyboardDelegate,
52
- popoverRef: popoverRef,
53
- listBoxRef: listBoxRef,
54
- inputRef: inputRef,
55
- onFocus: undefined,
56
- onFocusChange: undefined,
57
- onBlur: undefined,
58
- onKeyDown: undefined,
59
- onKeyUp: undefined,
60
- isInvalid: isInvalid,
61
- validationState: validationState,
62
- validationBehavior: validationBehavior,
63
- isRequired: isRequired,
64
- validate: undefined
65
- }, state);
66
- return {
67
- labelProps: labelProps,
68
- inputProps: (0, $fgZRc$mergeProps)(inputProps, comboBoxInputProps),
69
- listBoxProps: listBoxProps,
70
- clearButtonProps: clearButtonProps,
71
- ...validation
72
- };
73
- }
74
-
75
-
76
-
77
-
78
16
  export {$c04f11f368135585$export$da7ade746446be1f as useSearchAutocomplete};
79
17
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;AA4CM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,YAChB,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,kBAAU,EACxF;QACE,GAAG,UAAU;0BACb;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,iBAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF;;CDlHC","sources":["packages/@react-aria/autocomplete/src/index.ts","packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nexport {useSearchAutocomplete} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteOptions, SearchAutocompleteAria} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\n","/*\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search autocomplete component.\n * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the search autocomplete.\n * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.\n */\nexport function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/autocomplete/src/index.ts"],"sourcesContent":["/*\n * Copyright 2021 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 */\nexport {useSearchAutocomplete} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteOptions, SearchAutocompleteAria} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,72 @@
1
+ var $2rg0a$reactariautils = require("@react-aria/utils");
2
+ var $2rg0a$reactariacombobox = require("@react-aria/combobox");
3
+ var $2rg0a$reactariasearchfield = require("@react-aria/searchfield");
4
+
5
+
6
+ function $parcel$export(e, n, v, s) {
7
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
+ }
9
+
10
+ $parcel$export(module.exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$export$da7ade746446be1f);
11
+ /*
12
+ * Copyright 2020 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+
24
+ function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
25
+ let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
26
+ let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $2rg0a$reactariasearchfield.useSearchField)({
27
+ ...otherProps,
28
+ value: state.inputValue,
29
+ onChange: state.setInputValue,
30
+ autoComplete: "off",
31
+ onClear: ()=>{
32
+ state.setInputValue("");
33
+ if (onClear) onClear();
34
+ },
35
+ onSubmit: (value)=>{
36
+ // Prevent submission from search field if menu item was selected
37
+ if (state.selectionManager.focusedKey === null) onSubmit(value, null);
38
+ },
39
+ onKeyDown: onKeyDown,
40
+ onKeyUp: onKeyUp
41
+ }, {
42
+ value: state.inputValue,
43
+ setValue: state.setInputValue
44
+ }, inputRef);
45
+ let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $2rg0a$reactariacombobox.useComboBox)({
46
+ ...otherProps,
47
+ keyboardDelegate: keyboardDelegate,
48
+ popoverRef: popoverRef,
49
+ listBoxRef: listBoxRef,
50
+ inputRef: inputRef,
51
+ onFocus: undefined,
52
+ onFocusChange: undefined,
53
+ onBlur: undefined,
54
+ onKeyDown: undefined,
55
+ onKeyUp: undefined,
56
+ isInvalid: isInvalid,
57
+ validationState: validationState,
58
+ validationBehavior: validationBehavior,
59
+ isRequired: isRequired,
60
+ validate: undefined
61
+ }, state);
62
+ return {
63
+ labelProps: labelProps,
64
+ inputProps: (0, $2rg0a$reactariautils.mergeProps)(inputProps, comboBoxInputProps),
65
+ listBoxProps: listBoxProps,
66
+ clearButtonProps: clearButtonProps,
67
+ ...validation
68
+ };
69
+ }
70
+
71
+
72
+ //# sourceMappingURL=useSearchAutocomplete.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA4CM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,YAChB,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,0CAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,oCAAU,EACxF;QACE,GAAG,UAAU;0BACb;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,gCAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search autocomplete component.\n * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the search autocomplete.\n * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.\n */\nexport function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchAutocomplete.main.js.map"}
@@ -0,0 +1,67 @@
1
+ import {mergeProps as $3Hzop$mergeProps} from "@react-aria/utils";
2
+ import {useComboBox as $3Hzop$useComboBox} from "@react-aria/combobox";
3
+ import {useSearchField as $3Hzop$useSearchField} from "@react-aria/searchfield";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ function $c04f11f368135585$export$da7ade746446be1f(props, state) {
19
+ let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
20
+ let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $3Hzop$useSearchField)({
21
+ ...otherProps,
22
+ value: state.inputValue,
23
+ onChange: state.setInputValue,
24
+ autoComplete: "off",
25
+ onClear: ()=>{
26
+ state.setInputValue("");
27
+ if (onClear) onClear();
28
+ },
29
+ onSubmit: (value)=>{
30
+ // Prevent submission from search field if menu item was selected
31
+ if (state.selectionManager.focusedKey === null) onSubmit(value, null);
32
+ },
33
+ onKeyDown: onKeyDown,
34
+ onKeyUp: onKeyUp
35
+ }, {
36
+ value: state.inputValue,
37
+ setValue: state.setInputValue
38
+ }, inputRef);
39
+ let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $3Hzop$useComboBox)({
40
+ ...otherProps,
41
+ keyboardDelegate: keyboardDelegate,
42
+ popoverRef: popoverRef,
43
+ listBoxRef: listBoxRef,
44
+ inputRef: inputRef,
45
+ onFocus: undefined,
46
+ onFocusChange: undefined,
47
+ onBlur: undefined,
48
+ onKeyDown: undefined,
49
+ onKeyUp: undefined,
50
+ isInvalid: isInvalid,
51
+ validationState: validationState,
52
+ validationBehavior: validationBehavior,
53
+ isRequired: isRequired,
54
+ validate: undefined
55
+ }, state);
56
+ return {
57
+ labelProps: labelProps,
58
+ inputProps: (0, $3Hzop$mergeProps)(inputProps, comboBoxInputProps),
59
+ listBoxProps: listBoxProps,
60
+ clearButtonProps: clearButtonProps,
61
+ ...validation
62
+ };
63
+ }
64
+
65
+
66
+ export {$c04f11f368135585$export$da7ade746446be1f as useSearchAutocomplete};
67
+ //# sourceMappingURL=useSearchAutocomplete.mjs.map
@@ -0,0 +1,67 @@
1
+ import {mergeProps as $3Hzop$mergeProps} from "@react-aria/utils";
2
+ import {useComboBox as $3Hzop$useComboBox} from "@react-aria/combobox";
3
+ import {useSearchField as $3Hzop$useSearchField} from "@react-aria/searchfield";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ function $c04f11f368135585$export$da7ade746446be1f(props, state) {
19
+ let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
20
+ let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $3Hzop$useSearchField)({
21
+ ...otherProps,
22
+ value: state.inputValue,
23
+ onChange: state.setInputValue,
24
+ autoComplete: "off",
25
+ onClear: ()=>{
26
+ state.setInputValue("");
27
+ if (onClear) onClear();
28
+ },
29
+ onSubmit: (value)=>{
30
+ // Prevent submission from search field if menu item was selected
31
+ if (state.selectionManager.focusedKey === null) onSubmit(value, null);
32
+ },
33
+ onKeyDown: onKeyDown,
34
+ onKeyUp: onKeyUp
35
+ }, {
36
+ value: state.inputValue,
37
+ setValue: state.setInputValue
38
+ }, inputRef);
39
+ let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $3Hzop$useComboBox)({
40
+ ...otherProps,
41
+ keyboardDelegate: keyboardDelegate,
42
+ popoverRef: popoverRef,
43
+ listBoxRef: listBoxRef,
44
+ inputRef: inputRef,
45
+ onFocus: undefined,
46
+ onFocusChange: undefined,
47
+ onBlur: undefined,
48
+ onKeyDown: undefined,
49
+ onKeyUp: undefined,
50
+ isInvalid: isInvalid,
51
+ validationState: validationState,
52
+ validationBehavior: validationBehavior,
53
+ isRequired: isRequired,
54
+ validate: undefined
55
+ }, state);
56
+ return {
57
+ labelProps: labelProps,
58
+ inputProps: (0, $3Hzop$mergeProps)(inputProps, comboBoxInputProps),
59
+ listBoxProps: listBoxProps,
60
+ clearButtonProps: clearButtonProps,
61
+ ...validation
62
+ };
63
+ }
64
+
65
+
66
+ export {$c04f11f368135585$export$da7ade746446be1f as useSearchAutocomplete};
67
+ //# sourceMappingURL=useSearchAutocomplete.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA4CM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,YAChB,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,kBAAU,EACxF;QACE,GAAG,UAAU;0BACb;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,iBAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search autocomplete component.\n * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the search autocomplete.\n * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.\n */\nexport function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchAutocomplete.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/autocomplete",
3
- "version": "3.0.0-nightly.4555+81162ea39",
3
+ "version": "3.0.0-nightly.4558+c5e4b3701",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,14 +22,14 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/combobox": "3.8.5-nightly.4555+81162ea39",
26
- "@react-aria/listbox": "3.11.6-nightly.4555+81162ea39",
27
- "@react-aria/searchfield": "3.0.0-nightly.2843+81162ea39",
28
- "@react-aria/utils": "3.0.0-nightly.2843+81162ea39",
29
- "@react-stately/combobox": "3.8.3-nightly.4555+81162ea39",
30
- "@react-types/autocomplete": "3.0.0-nightly.4555+81162ea39",
31
- "@react-types/button": "3.9.3-nightly.4555+81162ea39",
32
- "@react-types/shared": "3.0.0-nightly.2843+81162ea39",
25
+ "@react-aria/combobox": "3.8.5-nightly.4558+c5e4b3701",
26
+ "@react-aria/listbox": "3.11.6-nightly.4558+c5e4b3701",
27
+ "@react-aria/searchfield": "3.0.0-nightly.2846+c5e4b3701",
28
+ "@react-aria/utils": "3.0.0-nightly.2846+c5e4b3701",
29
+ "@react-stately/combobox": "3.8.3-nightly.4558+c5e4b3701",
30
+ "@react-types/autocomplete": "3.0.0-nightly.4558+c5e4b3701",
31
+ "@react-types/button": "3.9.3-nightly.4558+c5e4b3701",
32
+ "@react-types/shared": "3.0.0-nightly.2846+c5e4b3701",
33
33
  "@swc/helpers": "^0.5.0"
34
34
  },
35
35
  "peerDependencies": {
@@ -39,5 +39,5 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "81162ea392926d06ec3d25c228e6f9b6b5479d59"
42
+ "gitHead": "c5e4b3701fdb89eb551f1b3697ac253f06ef68fa"
43
43
  }