@react-aria/autocomplete 3.0.0-alpha.6 → 3.0.0-alpha.9

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/main.js CHANGED
@@ -2,28 +2,11 @@ var $kDrMH$reactariautils = require("@react-aria/utils");
2
2
  var $kDrMH$reactariacombobox = require("@react-aria/combobox");
3
3
  var $kDrMH$reactariasearchfield = require("@react-aria/searchfield");
4
4
 
5
- function $parcel$exportWildcard(dest, source) {
6
- Object.keys(source).forEach(function(key) {
7
- if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
8
- return;
9
- }
10
-
11
- Object.defineProperty(dest, key, {
12
- enumerable: true,
13
- get: function get() {
14
- return source[key];
15
- }
16
- });
17
- });
18
-
19
- return dest;
20
- }
21
5
  function $parcel$export(e, n, v, s) {
22
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
23
7
  }
24
- var $3c40871f8cc2eb01$exports = {};
25
8
 
26
- $parcel$export($3c40871f8cc2eb01$exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$export$da7ade746446be1f);
9
+ $parcel$export(module.exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$export$da7ade746446be1f);
27
10
 
28
11
 
29
12
 
@@ -63,7 +46,6 @@ function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
63
46
  }
64
47
 
65
48
 
66
- $parcel$exportWildcard(module.exports, $3c40871f8cc2eb01$exports);
67
49
 
68
50
 
69
51
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;SCkDgB,yCAAqB,CAAI,KAAqC,EAAE,KAAuB,EAA6B,CAAC;IACnI,GAAG,CAAC,CAAC,aACH,UAAU,aACV,QAAQ,eACR,UAAU,qBACV,gBAAgB,aAChB,QAAQ,OAAS,CAAC;IAAA,CAAC,EACrB,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,CAAC,aAAA,UAAU,qBAAE,gBAAgB,EAAA,CAAC,GAAG,0CAAc,CAAC,CAAC;WAChD,KAAK;QACR,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;QAC7B,YAAY,EAAE,CAAK;QACnB,OAAO,MAAQ,KAAK,CAAC,aAAa,CAAC,CAAE;;QACrC,QAAQ,GAAG,KAAK,GAAK,CAAC;YACpB,EAAiE,AAAjE,+DAAiE;YACjE,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,QAAQ,CAAC,KAAK,EAAE,IAAI;QAExB,CAAC;IACH,CAAC,EAAE,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;IAC/B,CAAC,EAAE,QAAQ;IAGX,GAAG,CAAC,CAAC,eAAA,YAAY,eAAE,UAAU,GAAE,UAAU,EAAE,kBAAkB,EAAA,CAAC,GAAG,oCAAW,CAC1E,CAAC;WACI,KAAK;0BACR,gBAAgB;oBAChB,UAAU;oBACV,UAAU;kBACV,QAAQ;QACR,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;IACnB,CAAC,EACD,KAAK;IAGP,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,gCAAU,CAAC,UAAU,EAAE,kBAAkB;sBACrD,YAAY;0BACZ,gBAAgB;IAClB,CAAC;AACH,CAAC","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 */\n\nexport * from './useSearchAutocomplete';\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 {ComboBoxState} from '@react-stately/combobox';\nimport {HTMLAttributes, InputHTMLAttributes, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {SearchAutocompleteProps} from '@react-types/autocomplete';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\ninterface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<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\ninterface SearchAutocompleteAria<T> {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\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}\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: AriaSearchAutocompleteProps<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {}\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...props,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => state.setInputValue(''),\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 }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n \n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps} = useComboBox(\n {\n ...props,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onBlur: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;SCmDgB,yCAAqB,CAAI,KAAqC,EAAE,KAAuB,EAA6B,CAAC;IACnI,GAAG,CAAC,CAAC,aACH,UAAU,aACV,QAAQ,eACR,UAAU,qBACV,gBAAgB,aAChB,QAAQ,OAAS,CAAC;IAAA,CAAC,EACrB,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,CAAC,aAAA,UAAU,qBAAE,gBAAgB,EAAA,CAAC,GAAG,0CAAc,CAAC,CAAC;WAChD,KAAK;QACR,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;QAC7B,YAAY,EAAE,CAAK;QACnB,OAAO,MAAQ,KAAK,CAAC,aAAa,CAAC,CAAE;;QACrC,QAAQ,GAAG,KAAK,GAAK,CAAC;YACpB,EAAiE,AAAjE,+DAAiE;YACjE,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,QAAQ,CAAC,KAAK,EAAE,IAAI;QAExB,CAAC;IACH,CAAC,EAAE,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;IAC/B,CAAC,EAAE,QAAQ;IAGX,GAAG,CAAC,CAAC,eAAA,YAAY,eAAE,UAAU,GAAE,UAAU,EAAE,kBAAkB,EAAA,CAAC,GAAG,oCAAW,CAC1E,CAAC;WACI,KAAK;0BACR,gBAAgB;oBAChB,UAAU;oBACV,UAAU;kBACV,QAAQ;QACR,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;IACnB,CAAC,EACD,KAAK;IAGP,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,gCAAU,CAAC,UAAU,EAAE,kBAAkB;sBACrD,YAAY;0BACZ,gBAAgB;IAClB,CAAC;AACH,CAAC","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 {AriaSearchAutocompleteProps, SearchAutocompleteAria} from './useSearchAutocomplete';\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 {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {SearchAutocompleteProps} from '@react-types/autocomplete';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<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\nexport interface SearchAutocompleteAria<T> {\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}\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: AriaSearchAutocompleteProps<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {}\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...props,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => state.setInputValue(''),\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 }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n \n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps} = useComboBox(\n {\n ...props,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onBlur: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -2,12 +2,6 @@ import {mergeProps as $fgZRc$mergeProps} from "@react-aria/utils";
2
2
  import {useComboBox as $fgZRc$useComboBox} from "@react-aria/combobox";
3
3
  import {useSearchField as $fgZRc$useSearchField} from "@react-aria/searchfield";
4
4
 
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
- var $c04f11f368135585$exports = {};
9
-
10
- $parcel$export($c04f11f368135585$exports, "useSearchAutocomplete", () => $c04f11f368135585$export$da7ade746446be1f);
11
5
 
12
6
 
13
7
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;SCkDgB,yCAAqB,CAAI,KAAqC,EAAE,KAAuB,EAA6B,CAAC;IACnI,GAAG,CAAC,CAAC,aACH,UAAU,aACV,QAAQ,eACR,UAAU,qBACV,gBAAgB,aAChB,QAAQ,OAAS,CAAC;IAAA,CAAC,EACrB,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,CAAC,aAAA,UAAU,qBAAE,gBAAgB,EAAA,CAAC,GAAG,qBAAc,CAAC,CAAC;WAChD,KAAK;QACR,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;QAC7B,YAAY,EAAE,CAAK;QACnB,OAAO,MAAQ,KAAK,CAAC,aAAa,CAAC,CAAE;;QACrC,QAAQ,GAAG,KAAK,GAAK,CAAC;YACpB,EAAiE,AAAjE,+DAAiE;YACjE,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,QAAQ,CAAC,KAAK,EAAE,IAAI;QAExB,CAAC;IACH,CAAC,EAAE,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;IAC/B,CAAC,EAAE,QAAQ;IAGX,GAAG,CAAC,CAAC,eAAA,YAAY,eAAE,UAAU,GAAE,UAAU,EAAE,kBAAkB,EAAA,CAAC,GAAG,kBAAW,CAC1E,CAAC;WACI,KAAK;0BACR,gBAAgB;oBAChB,UAAU;oBACV,UAAU;kBACV,QAAQ;QACR,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;IACnB,CAAC,EACD,KAAK;IAGP,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,iBAAU,CAAC,UAAU,EAAE,kBAAkB;sBACrD,YAAY;0BACZ,gBAAgB;IAClB,CAAC;AACH,CAAC","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 */\n\nexport * from './useSearchAutocomplete';\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 {ComboBoxState} from '@react-stately/combobox';\nimport {HTMLAttributes, InputHTMLAttributes, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {SearchAutocompleteProps} from '@react-types/autocomplete';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\ninterface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<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\ninterface SearchAutocompleteAria<T> {\n /** Props for the label element. */\n labelProps: HTMLAttributes<HTMLElement>,\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}\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: AriaSearchAutocompleteProps<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {}\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...props,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => state.setInputValue(''),\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 }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n \n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps} = useComboBox(\n {\n ...props,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onBlur: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;SCmDgB,yCAAqB,CAAI,KAAqC,EAAE,KAAuB,EAA6B,CAAC;IACnI,GAAG,CAAC,CAAC,aACH,UAAU,aACV,QAAQ,eACR,UAAU,qBACV,gBAAgB,aAChB,QAAQ,OAAS,CAAC;IAAA,CAAC,EACrB,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,CAAC,aAAA,UAAU,qBAAE,gBAAgB,EAAA,CAAC,GAAG,qBAAc,CAAC,CAAC;WAChD,KAAK;QACR,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;QAC7B,YAAY,EAAE,CAAK;QACnB,OAAO,MAAQ,KAAK,CAAC,aAAa,CAAC,CAAE;;QACrC,QAAQ,GAAG,KAAK,GAAK,CAAC;YACpB,EAAiE,AAAjE,+DAAiE;YACjE,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,QAAQ,CAAC,KAAK,EAAE,IAAI;QAExB,CAAC;IACH,CAAC,EAAE,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,UAAU;QACvB,QAAQ,EAAE,KAAK,CAAC,aAAa;IAC/B,CAAC,EAAE,QAAQ;IAGX,GAAG,CAAC,CAAC,eAAA,YAAY,eAAE,UAAU,GAAE,UAAU,EAAE,kBAAkB,EAAA,CAAC,GAAG,kBAAW,CAC1E,CAAC;WACI,KAAK;0BACR,gBAAgB;oBAChB,UAAU;oBACV,UAAU;kBACV,QAAQ;QACR,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;IACnB,CAAC,EACD,KAAK;IAGP,MAAM,CAAC,CAAC;oBACN,UAAU;QACV,UAAU,EAAE,iBAAU,CAAC,UAAU,EAAE,kBAAkB;sBACrD,YAAY;0BACZ,gBAAgB;IAClB,CAAC;AACH,CAAC","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 {AriaSearchAutocompleteProps, SearchAutocompleteAria} from './useSearchAutocomplete';\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 {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {SearchAutocompleteProps} from '@react-types/autocomplete';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<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\nexport interface SearchAutocompleteAria<T> {\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}\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: AriaSearchAutocompleteProps<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {}\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...props,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => state.setInputValue(''),\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 }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n \n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps} = useComboBox(\n {\n ...props,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onBlur: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { AriaButtonProps } from "@react-types/button";
2
2
  import { AriaListBoxOptions } from "@react-aria/listbox";
3
3
  import { ComboBoxState } from "@react-stately/combobox";
4
- import { HTMLAttributes, InputHTMLAttributes, RefObject } from "react";
5
- import { KeyboardDelegate } from "@react-types/shared";
4
+ import { DOMAttributes, KeyboardDelegate } from "@react-types/shared";
5
+ import { InputHTMLAttributes, RefObject } from "react";
6
6
  import { SearchAutocompleteProps } from "@react-types/autocomplete";
7
- interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T> {
7
+ export interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T> {
8
8
  /** The ref for the input element. */
9
9
  inputRef: RefObject<HTMLInputElement>;
10
10
  /** The ref for the list box popover. */
@@ -14,9 +14,9 @@ interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T> {
14
14
  /** An optional keyboard delegate implementation, to override the default. */
15
15
  keyboardDelegate?: KeyboardDelegate;
16
16
  }
17
- interface SearchAutocompleteAria<T> {
17
+ export interface SearchAutocompleteAria<T> {
18
18
  /** Props for the label element. */
19
- labelProps: HTMLAttributes<HTMLElement>;
19
+ labelProps: DOMAttributes;
20
20
  /** Props for the search input element. */
21
21
  inputProps: InputHTMLAttributes<HTMLInputElement>;
22
22
  /** Props for the list box, to be passed to [useListBox](useListBox.html). */
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAsBA,sCAAsC,CAAC,CAAE,SAAQ,wBAAwB,CAAC,CAAC;IACzE,qCAAqC;IACrC,QAAQ,EAAE,UAAU,gBAAgB,CAAC,CAAC;IACtC,wCAAwC;IACxC,UAAU,EAAE,UAAU,cAAc,CAAC,CAAC;IACtC,gCAAgC;IAChC,UAAU,EAAE,UAAU,WAAW,CAAC,CAAC;IACnC,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAED,iCAAiC,CAAC;IAChC,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,0CAA0C;IAC1C,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,6EAA6E;IAC7E,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACpC,iDAAiD;IACjD,gBAAgB,EAAE,eAAe,CAAA;CAClC;AAED;;;;;GAKG;AACH,sCAAsC,CAAC,EAAE,KAAK,EAAE,4BAA4B,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CA8ClI","sources":["packages/@react-aria/autocomplete/src/packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts","packages/@react-aria/autocomplete/src/packages/@react-aria/autocomplete/src/index.ts","packages/@react-aria/autocomplete/src/index.ts"],"sourcesContent":[null,null,"/*\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 */\n\nexport * from './useSearchAutocomplete';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;;AAuBA,6CAA6C,CAAC,CAAE,SAAQ,wBAAwB,CAAC,CAAC;IAChF,qCAAqC;IACrC,QAAQ,EAAE,UAAU,gBAAgB,CAAC,CAAC;IACtC,wCAAwC;IACxC,UAAU,EAAE,UAAU,cAAc,CAAC,CAAC;IACtC,gCAAgC;IAChC,UAAU,EAAE,UAAU,WAAW,CAAC,CAAC;IACnC,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAED,wCAAwC,CAAC;IACvC,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,0CAA0C;IAC1C,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,6EAA6E;IAC7E,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACpC,iDAAiD;IACjD,gBAAgB,EAAE,eAAe,CAAA;CAClC;AAED;;;;;GAKG;AACH,sCAAsC,CAAC,EAAE,KAAK,EAAE,4BAA4B,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CA8ClI","sources":["packages/@react-aria/autocomplete/src/packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts","packages/@react-aria/autocomplete/src/packages/@react-aria/autocomplete/src/index.ts","packages/@react-aria/autocomplete/src/index.ts"],"sourcesContent":[null,null,"/*\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 {AriaSearchAutocompleteProps, SearchAutocompleteAria} from './useSearchAutocomplete';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/autocomplete",
3
- "version": "3.0.0-alpha.6",
3
+ "version": "3.0.0-alpha.9",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,29 +18,29 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/combobox": "^3.2.6",
22
- "@react-aria/i18n": "^3.3.9",
23
- "@react-aria/listbox": "^3.4.5",
24
- "@react-aria/live-announcer": "^3.0.6",
25
- "@react-aria/menu": "^3.4.4",
26
- "@react-aria/overlays": "^3.8.2",
27
- "@react-aria/searchfield": "^3.2.7",
28
- "@react-aria/selection": "^3.8.2",
29
- "@react-aria/textfield": "^3.5.5",
30
- "@react-aria/utils": "^3.12.0",
31
- "@react-stately/collections": "^3.3.8",
32
- "@react-stately/combobox": "^3.0.5",
33
- "@react-types/autocomplete": "3.0.0-alpha.4",
34
- "@react-types/button": "^3.4.5",
35
- "@react-types/combobox": "^3.4.0",
36
- "@react-types/searchfield": "^3.2.0",
37
- "@react-types/shared": "^3.12.0"
21
+ "@react-aria/combobox": "^3.4.0",
22
+ "@react-aria/i18n": "^3.5.0",
23
+ "@react-aria/listbox": "^3.6.0",
24
+ "@react-aria/live-announcer": "^3.1.1",
25
+ "@react-aria/menu": "^3.6.0",
26
+ "@react-aria/overlays": "^3.10.0",
27
+ "@react-aria/searchfield": "^3.4.0",
28
+ "@react-aria/selection": "^3.10.0",
29
+ "@react-aria/textfield": "^3.7.0",
30
+ "@react-aria/utils": "^3.13.2",
31
+ "@react-stately/collections": "^3.4.2",
32
+ "@react-stately/combobox": "^3.2.0",
33
+ "@react-types/autocomplete": "3.0.0-alpha.7",
34
+ "@react-types/button": "^3.6.0",
35
+ "@react-types/combobox": "^3.5.2",
36
+ "@react-types/searchfield": "^3.3.2",
37
+ "@react-types/shared": "^3.14.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "react": "^16.8.0 || ^17.0.0-rc.1"
40
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "6a503b715e0dbbf92038cd7f08b1bcdde4c78e82"
45
+ "gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
46
46
  }
package/src/index.ts CHANGED
@@ -9,5 +9,5 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
-
13
- export * from './useSearchAutocomplete';
12
+ export {useSearchAutocomplete} from './useSearchAutocomplete';
13
+ export type {AriaSearchAutocompleteProps, SearchAutocompleteAria} from './useSearchAutocomplete';
@@ -13,14 +13,15 @@
13
13
  import {AriaButtonProps} from '@react-types/button';
14
14
  import {AriaListBoxOptions} from '@react-aria/listbox';
15
15
  import {ComboBoxState} from '@react-stately/combobox';
16
- import {HTMLAttributes, InputHTMLAttributes, RefObject} from 'react';
16
+ import {DOMAttributes} from '@react-types/shared';
17
+ import {InputHTMLAttributes, RefObject} from 'react';
17
18
  import {KeyboardDelegate} from '@react-types/shared';
18
19
  import {mergeProps} from '@react-aria/utils';
19
20
  import {SearchAutocompleteProps} from '@react-types/autocomplete';
20
21
  import {useComboBox} from '@react-aria/combobox';
21
22
  import {useSearchField} from '@react-aria/searchfield';
22
23
 
23
- interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T> {
24
+ export interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T> {
24
25
  /** The ref for the input element. */
25
26
  inputRef: RefObject<HTMLInputElement>,
26
27
  /** The ref for the list box popover. */
@@ -31,9 +32,9 @@ interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T> {
31
32
  keyboardDelegate?: KeyboardDelegate
32
33
  }
33
34
 
34
- interface SearchAutocompleteAria<T> {
35
+ export interface SearchAutocompleteAria<T> {
35
36
  /** Props for the label element. */
36
- labelProps: HTMLAttributes<HTMLElement>,
37
+ labelProps: DOMAttributes,
37
38
  /** Props for the search input element. */
38
39
  inputProps: InputHTMLAttributes<HTMLInputElement>,
39
40
  /** Props for the list box, to be passed to [useListBox](useListBox.html). */