@react-aria/autocomplete 3.0.0-alpha.1 → 3.0.0-alpha.4

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
@@ -1,72 +1,69 @@
1
- var {
2
- useSearchField
3
- } = require("@react-aria/searchfield");
1
+ var $kDrMH$reactariautils = require("@react-aria/utils");
2
+ var $kDrMH$reactariacombobox = require("@react-aria/combobox");
3
+ var $kDrMH$reactariasearchfield = require("@react-aria/searchfield");
4
4
 
5
- var {
6
- useComboBox
7
- } = require("@react-aria/combobox");
8
-
9
- var {
10
- mergeProps
11
- } = require("@react-aria/utils");
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
+ }
12
10
 
13
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
11
+ Object.defineProperty(dest, key, {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return source[key];
15
+ }
16
+ });
17
+ });
14
18
 
15
- function $parcel$interopDefault(a) {
16
- return a && a.__esModule ? a.default : a;
19
+ return dest;
17
20
  }
21
+ function $parcel$export(e, n, v, s) {
22
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
23
+ }
24
+ var $3c40871f8cc2eb01$exports = {};
18
25
 
19
- /**
20
- * Provides the behavior and accessibility implementation for a search autocomplete component.
21
- * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.
22
- * @param props - Props for the search autocomplete.
23
- * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.
24
- */
25
- function useSearchAutocomplete(props, state) {
26
- let {
27
- popoverRef,
28
- inputRef,
29
- listBoxRef,
30
- keyboardDelegate,
31
- onSubmit: _onSubmit = () => {}
32
- } = props;
33
- let {
34
- inputProps,
35
- clearButtonProps
36
- } = useSearchField(_babelRuntimeHelpersExtends({}, props, {
37
- value: state.inputValue,
38
- onChange: state.setInputValue,
39
- autoComplete: 'off',
40
- onClear: () => state.setInputValue(''),
41
- onSubmit: value => {
42
- // Prevent submission from search field if menu item was selected
43
- if (state.selectionManager.focusedKey === null) {
44
- _onSubmit(value, null);
45
- }
46
- }
47
- }), {
48
- value: state.inputValue,
49
- setValue: state.setInputValue
50
- }, inputRef);
51
- let {
52
- listBoxProps,
53
- labelProps,
54
- inputProps: comboBoxInputProps
55
- } = useComboBox(_babelRuntimeHelpersExtends({}, props, {
56
- keyboardDelegate,
57
- popoverRef,
58
- listBoxRef,
59
- inputRef,
60
- onFocus: undefined,
61
- onBlur: undefined
62
- }), state);
63
- return {
64
- labelProps,
65
- inputProps: mergeProps(inputProps, comboBoxInputProps),
66
- listBoxProps,
67
- clearButtonProps
68
- };
26
+ $parcel$export($3c40871f8cc2eb01$exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$export$da7ade746446be1f);
27
+
28
+
29
+
30
+ function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
31
+ let { popoverRef: popoverRef , inputRef: inputRef , listBoxRef: listBoxRef , keyboardDelegate: keyboardDelegate , onSubmit: onSubmit = ()=>{
32
+ } } = props;
33
+ let { inputProps: inputProps , clearButtonProps: clearButtonProps } = $kDrMH$reactariasearchfield.useSearchField({
34
+ ...props,
35
+ value: state.inputValue,
36
+ onChange: state.setInputValue,
37
+ autoComplete: 'off',
38
+ onClear: ()=>state.setInputValue('')
39
+ ,
40
+ onSubmit: (value)=>{
41
+ // Prevent submission from search field if menu item was selected
42
+ if (state.selectionManager.focusedKey === null) onSubmit(value, null);
43
+ }
44
+ }, {
45
+ value: state.inputValue,
46
+ setValue: state.setInputValue
47
+ }, inputRef);
48
+ let { listBoxProps: listBoxProps , labelProps: labelProps , inputProps: comboBoxInputProps } = $kDrMH$reactariacombobox.useComboBox({
49
+ ...props,
50
+ keyboardDelegate: keyboardDelegate,
51
+ popoverRef: popoverRef,
52
+ listBoxRef: listBoxRef,
53
+ inputRef: inputRef,
54
+ onFocus: undefined,
55
+ onBlur: undefined
56
+ }, state);
57
+ return {
58
+ labelProps: labelProps,
59
+ inputProps: $kDrMH$reactariautils.mergeProps(inputProps, comboBoxInputProps),
60
+ listBoxProps: listBoxProps,
61
+ clearButtonProps: clearButtonProps
62
+ };
69
63
  }
70
64
 
71
- exports.useSearchAutocomplete = useSearchAutocomplete;
65
+
66
+ $parcel$exportWildcard(module.exports, $3c40871f8cc2eb01$exports);
67
+
68
+
72
69
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;AC0CD;;;;;;AAMO,SAASG,qBAAT,CAAkCC,KAAlC,EAAyEC,KAAzE,EAA6H;AAClI,MAAI;AACFC,IAAAA,UADE;AAEFC,IAAAA,QAFE;AAGFC,IAAAA,UAHE;AAIFC,IAAAA,gBAJE;AAKFC,IAAAA,QAAQ,EAARA,SAAQ,GAAG,MAAM,CAAE;AALjB,MAMAN,KANJ;AAQA,MAAI;AAACO,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAAiCC,cAAc,iCAC9CT,KAD8C;AAEjDU,IAAAA,KAAK,EAAET,KAAK,CAACU,UAFoC;AAGjDC,IAAAA,QAAQ,EAAEX,KAAK,CAACY,aAHiC;AAIjDC,IAAAA,YAAY,EAAE,KAJmC;AAKjDC,IAAAA,OAAO,EAAE,MAAMd,KAAK,CAACY,aAAN,CAAoB,EAApB,CALkC;AAMjDP,IAAAA,QAAQ,EAAGI,KAAD,IAAW;AACnB;AACA,UAAIT,KAAK,CAACe,gBAAN,CAAuBC,UAAvB,KAAsC,IAA1C,EAAgD;AAC9CX,QAAAA,SAAQ,CAACI,KAAD,EAAQ,IAAR,CAAR;AACD;AACF;AAXgD,MAYhD;AACDA,IAAAA,KAAK,EAAET,KAAK,CAACU,UADZ;AAEDO,IAAAA,QAAQ,EAAEjB,KAAK,CAACY;AAFf,GAZgD,EAehDV,QAfgD,CAAnD;AAkBA,MAAI;AAACgB,IAAAA,YAAD;AAAeC,IAAAA,UAAf;AAA2Bb,IAAAA,UAAU,EAAEc;AAAvC,MAA6DC,WAAW,iCAErEtB,KAFqE;AAGxEK,IAAAA,gBAHwE;AAIxEH,IAAAA,UAJwE;AAKxEE,IAAAA,UALwE;AAMxED,IAAAA,QANwE;AAOxEoB,IAAAA,OAAO,EAAEC,SAP+D;AAQxEC,IAAAA,MAAM,EAAED;AARgE,MAU1EvB,KAV0E,CAA5E;AAaA,SAAO;AACLmB,IAAAA,UADK;AAELb,IAAAA,UAAU,EAAEmB,UAAU,CAACnB,UAAD,EAAac,kBAAb,CAFjB;AAGLF,IAAAA,YAHK;AAILX,IAAAA;AAJK,GAAP;AAMD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\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":["$parcel$interopDefault","a","__esModule","default","useSearchAutocomplete","props","state","popoverRef","inputRef","listBoxRef","keyboardDelegate","onSubmit","inputProps","clearButtonProps","useSearchField","value","inputValue","onChange","setInputValue","autoComplete","onClear","selectionManager","focusedKey","setValue","listBoxProps","labelProps","comboBoxInputProps","useComboBox","onFocus","undefined","onBlur","mergeProps"],"version":3,"file":"main.js.map"}
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"}
package/dist/module.js CHANGED
@@ -1,57 +1,53 @@
1
- import { useSearchField } from "@react-aria/searchfield";
2
- import { useComboBox } from "@react-aria/combobox";
3
- import { mergeProps } from "@react-aria/utils";
4
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
5
-
6
- /**
7
- * Provides the behavior and accessibility implementation for a search autocomplete component.
8
- * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.
9
- * @param props - Props for the search autocomplete.
10
- * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.
11
- */
12
- export function useSearchAutocomplete(props, state) {
13
- let {
14
- popoverRef,
15
- inputRef,
16
- listBoxRef,
17
- keyboardDelegate,
18
- onSubmit: _onSubmit = () => {}
19
- } = props;
20
- let {
21
- inputProps,
22
- clearButtonProps
23
- } = useSearchField(_babelRuntimeHelpersEsmExtends({}, props, {
24
- value: state.inputValue,
25
- onChange: state.setInputValue,
26
- autoComplete: 'off',
27
- onClear: () => state.setInputValue(''),
28
- onSubmit: value => {
29
- // Prevent submission from search field if menu item was selected
30
- if (state.selectionManager.focusedKey === null) {
31
- _onSubmit(value, null);
32
- }
33
- }
34
- }), {
35
- value: state.inputValue,
36
- setValue: state.setInputValue
37
- }, inputRef);
38
- let {
39
- listBoxProps,
40
- labelProps,
41
- inputProps: comboBoxInputProps
42
- } = useComboBox(_babelRuntimeHelpersEsmExtends({}, props, {
43
- keyboardDelegate,
44
- popoverRef,
45
- listBoxRef,
46
- inputRef,
47
- onFocus: undefined,
48
- onBlur: undefined
49
- }), state);
50
- return {
51
- labelProps,
52
- inputProps: mergeProps(inputProps, comboBoxInputProps),
53
- listBoxProps,
54
- clearButtonProps
55
- };
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";
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
+
12
+
13
+
14
+ function $c04f11f368135585$export$da7ade746446be1f(props, state) {
15
+ let { popoverRef: popoverRef , inputRef: inputRef , listBoxRef: listBoxRef , keyboardDelegate: keyboardDelegate , onSubmit: onSubmit = ()=>{
16
+ } } = props;
17
+ let { inputProps: inputProps , clearButtonProps: clearButtonProps } = $fgZRc$useSearchField({
18
+ ...props,
19
+ value: state.inputValue,
20
+ onChange: state.setInputValue,
21
+ autoComplete: 'off',
22
+ onClear: ()=>state.setInputValue('')
23
+ ,
24
+ onSubmit: (value)=>{
25
+ // Prevent submission from search field if menu item was selected
26
+ if (state.selectionManager.focusedKey === null) onSubmit(value, null);
27
+ }
28
+ }, {
29
+ value: state.inputValue,
30
+ setValue: state.setInputValue
31
+ }, inputRef);
32
+ let { listBoxProps: listBoxProps , labelProps: labelProps , inputProps: comboBoxInputProps } = $fgZRc$useComboBox({
33
+ ...props,
34
+ keyboardDelegate: keyboardDelegate,
35
+ popoverRef: popoverRef,
36
+ listBoxRef: listBoxRef,
37
+ inputRef: inputRef,
38
+ onFocus: undefined,
39
+ onBlur: undefined
40
+ }, state);
41
+ return {
42
+ labelProps: labelProps,
43
+ inputProps: $fgZRc$mergeProps(inputProps, comboBoxInputProps),
44
+ listBoxProps: listBoxProps,
45
+ clearButtonProps: clearButtonProps
46
+ };
56
47
  }
48
+
49
+
50
+
51
+
52
+ export {$c04f11f368135585$export$da7ade746446be1f as useSearchAutocomplete};
57
53
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;AA4CA;;;;;;OAMO,SAASA,qBAAT,CAAkCC,KAAlC,EAAyEC,KAAzE,EAA6H;AAClI,MAAI;AACFC,IAAAA,UADE;AAEFC,IAAAA,QAFE;AAGFC,IAAAA,UAHE;AAIFC,IAAAA,gBAJE;AAKFC,IAAAA,QAAQ,EAARA,SAAQ,GAAG,MAAM,CAAE;AALjB,MAMAN,KANJ;AAQA,MAAI;AAACO,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAAiCC,cAAc,oCAC9CT,KAD8C;AAEjDU,IAAAA,KAAK,EAAET,KAAK,CAACU,UAFoC;AAGjDC,IAAAA,QAAQ,EAAEX,KAAK,CAACY,aAHiC;AAIjDC,IAAAA,YAAY,EAAE,KAJmC;AAKjDC,IAAAA,OAAO,EAAE,MAAMd,KAAK,CAACY,aAAN,CAAoB,EAApB,CALkC;AAMjDP,IAAAA,QAAQ,EAAGI,KAAD,IAAW;AACnB;AACA,UAAIT,KAAK,CAACe,gBAAN,CAAuBC,UAAvB,KAAsC,IAA1C,EAAgD;AAC9CX,QAAAA,SAAQ,CAACI,KAAD,EAAQ,IAAR,CAAR;AACD;AACF;AAXgD,MAYhD;AACDA,IAAAA,KAAK,EAAET,KAAK,CAACU,UADZ;AAEDO,IAAAA,QAAQ,EAAEjB,KAAK,CAACY;AAFf,GAZgD,EAehDV,QAfgD,CAAnD;AAkBA,MAAI;AAACgB,IAAAA,YAAD;AAAeC,IAAAA,UAAf;AAA2Bb,IAAAA,UAAU,EAAEc;AAAvC,MAA6DC,WAAW,oCAErEtB,KAFqE;AAGxEK,IAAAA,gBAHwE;AAIxEH,IAAAA,UAJwE;AAKxEE,IAAAA,UALwE;AAMxED,IAAAA,QANwE;AAOxEoB,IAAAA,OAAO,EAAEC,SAP+D;AAQxEC,IAAAA,MAAM,EAAED;AARgE,MAU1EvB,KAV0E,CAA5E;AAaA,SAAO;AACLmB,IAAAA,UADK;AAELb,IAAAA,UAAU,EAAEmB,UAAU,CAACnB,UAAD,EAAac,kBAAb,CAFjB;AAGLF,IAAAA,YAHK;AAILX,IAAAA;AAJK,GAAP;AAMD","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 {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":["useSearchAutocomplete","props","state","popoverRef","inputRef","listBoxRef","keyboardDelegate","onSubmit","inputProps","clearButtonProps","useSearchField","value","inputValue","onChange","setInputValue","autoComplete","onClear","selectionManager","focusedKey","setValue","listBoxProps","labelProps","comboBoxInputProps","useComboBox","onFocus","undefined","onBlur","mergeProps"],"version":3,"file":"module.js.map"}
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 +1 @@
1
- {"mappings":"A;A;A;A;A;A;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;A;A;A;A;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"],"sourcesContent":[null,null],"names":[],"version":3,"file":"types.d.ts.map"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/autocomplete",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.4",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,23 +18,23 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/combobox": "^3.2.0",
22
- "@react-aria/i18n": "^3.3.3",
23
- "@react-aria/listbox": "^3.4.0",
24
- "@react-aria/live-announcer": "^3.0.1",
25
- "@react-aria/menu": "^3.3.0",
26
- "@react-aria/overlays": "^3.7.3",
27
- "@react-aria/searchfield": "^3.2.1",
28
- "@react-aria/selection": "^3.7.0",
29
- "@react-aria/textfield": "^3.5.0",
30
- "@react-aria/utils": "^3.10.0",
31
- "@react-stately/collections": "^3.3.4",
32
- "@react-stately/combobox": "^3.0.1",
33
- "@react-types/autocomplete": "3.0.0-alpha.0",
34
- "@react-types/button": "^3.4.1",
35
- "@react-types/combobox": "^3.2.0",
36
- "@react-types/searchfield": "^3.1.2",
37
- "@react-types/shared": "^3.10.0"
21
+ "@react-aria/combobox": "^3.2.4",
22
+ "@react-aria/i18n": "^3.3.7",
23
+ "@react-aria/listbox": "^3.4.3",
24
+ "@react-aria/live-announcer": "^3.0.4",
25
+ "@react-aria/menu": "^3.4.2",
26
+ "@react-aria/overlays": "^3.8.0",
27
+ "@react-aria/searchfield": "^3.2.5",
28
+ "@react-aria/selection": "^3.8.0",
29
+ "@react-aria/textfield": "^3.5.3",
30
+ "@react-aria/utils": "^3.11.3",
31
+ "@react-stately/collections": "^3.3.7",
32
+ "@react-stately/combobox": "^3.0.4",
33
+ "@react-types/autocomplete": "3.0.0-alpha.3",
34
+ "@react-types/button": "^3.4.4",
35
+ "@react-types/combobox": "^3.3.0",
36
+ "@react-types/searchfield": "^3.1.5",
37
+ "@react-types/shared": "^3.11.2"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": "^16.8.0 || ^17.0.0-rc.1"
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "896eabe5521a0349a675c4773ed7629addd4b8c4"
45
+ "gitHead": "ed8d8d984c2f7f2c31e8b18795b97858a95e4729"
46
46
  }