@react-aria/autocomplete 3.0.0-nightly.3830 → 3.0.0-nightly.3832

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
@@ -27,7 +27,7 @@ import {useSearchField as $fgZRc$useSearchField} from "@react-aria/searchfield";
27
27
 
28
28
  function $c04f11f368135585$export$da7ade746446be1f(props, state) {
29
29
  let { popoverRef: popoverRef , inputRef: inputRef , listBoxRef: listBoxRef , keyboardDelegate: keyboardDelegate , onSubmit: onSubmit = ()=>{} , onClear: onClear } = props;
30
- let { inputProps: inputProps , clearButtonProps: clearButtonProps } = (0, $fgZRc$useSearchField)({
30
+ let { inputProps: inputProps , clearButtonProps: clearButtonProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = (0, $fgZRc$useSearchField)({
31
31
  ...props,
32
32
  value: state.inputValue,
33
33
  onChange: state.setInputValue,
@@ -57,7 +57,9 @@ function $c04f11f368135585$export$da7ade746446be1f(props, state) {
57
57
  labelProps: labelProps,
58
58
  inputProps: (0, $fgZRc$mergeProps)(inputProps, comboBoxInputProps),
59
59
  listBoxProps: listBoxProps,
60
- clearButtonProps: clearButtonProps
60
+ clearButtonProps: clearButtonProps,
61
+ descriptionProps: descriptionProps,
62
+ errorMessageProps: errorMessageProps
61
63
  };
62
64
  }
63
65
 
package/dist/main.js CHANGED
@@ -32,7 +32,7 @@ $parcel$export(module.exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$
32
32
 
33
33
  function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
34
34
  let { popoverRef: popoverRef , inputRef: inputRef , listBoxRef: listBoxRef , keyboardDelegate: keyboardDelegate , onSubmit: onSubmit = ()=>{} , onClear: onClear } = props;
35
- let { inputProps: inputProps , clearButtonProps: clearButtonProps } = (0, $kDrMH$reactariasearchfield.useSearchField)({
35
+ let { inputProps: inputProps , clearButtonProps: clearButtonProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = (0, $kDrMH$reactariasearchfield.useSearchField)({
36
36
  ...props,
37
37
  value: state.inputValue,
38
38
  onChange: state.setInputValue,
@@ -62,7 +62,9 @@ function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
62
62
  labelProps: labelProps,
63
63
  inputProps: (0, $kDrMH$reactariautils.mergeProps)(inputProps, comboBoxInputProps),
64
64
  listBoxProps: listBoxProps,
65
- clearButtonProps: clearButtonProps
65
+ clearButtonProps: clearButtonProps,
66
+ descriptionProps: descriptionProps,
67
+ errorMessageProps: errorMessageProps
66
68
  };
67
69
  }
68
70
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AAsCO,SAAS,0CAAyB,KAAuC,EAAE,KAAuB,EAA6B;IACpI,IAAI,cACF,WAAU,YACV,SAAQ,cACR,WAAU,oBACV,iBAAgB,YAChB,WAAW,IAAM,CAAC,aAClB,QAAO,EACR,GAAG;IAEJ,IAAI,cAAC,WAAU,oBAAE,iBAAgB,EAAC,GAAG,CAAA,GAAA,0CAAc,AAAD,EAAE;QAClD,GAAG,KAAK;QACR,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS,IAAM;YACb,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC,QAAU;YACnB,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,SAAS,OAAO,IAAI;QAExB;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,aAAY,cAAE,WAAU,EAAE,YAAY,mBAAkB,EAAC,GAAG,CAAA,GAAA,oCAAU,EACzE;QACE,GAAG,KAAK;0BACR;oBACA;oBACA;kBACA;QACA,SAAS;QACT,QAAQ;IACV,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,gCAAU,AAAD,EAAE,YAAY;sBACnC;0BACA;IACF;AACF;;CD5FC,GACD","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} 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> {\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\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 } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...props,\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 }, {\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":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AA0CO,SAAS,0CAAyB,KAAuC,EAAE,KAAuB,EAA6B;IACpI,IAAI,cACF,WAAU,YACV,SAAQ,cACR,WAAU,oBACV,iBAAgB,YAChB,WAAW,IAAM,CAAC,aAClB,QAAO,EACR,GAAG;IAEJ,IAAI,cAAC,WAAU,oBAAE,iBAAgB,oBAAE,iBAAgB,qBAAE,kBAAiB,EAAC,GAAG,CAAA,GAAA,0CAAa,EAAE;QACvF,GAAG,KAAK;QACR,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS,IAAM;YACb,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC,QAAU;YACnB,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,SAAS,OAAO,IAAI;QAExB;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,aAAY,cAAE,WAAU,EAAE,YAAY,mBAAkB,EAAC,GAAG,CAAA,GAAA,oCAAU,EACzE;QACE,GAAG,KAAK;0BACR;oBACA;oBACA;kBACA;QACA,SAAS;QACT,QAAQ;IACV,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,gCAAU,AAAD,EAAE,YAAY;sBACnC;0BACA;0BACA;2BACA;IACF;AACF;;CDlGC,GACD","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} 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> {\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 } = props;\n\n let {inputProps, clearButtonProps, descriptionProps, errorMessageProps} = useSearchField({\n ...props,\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 }, {\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 descriptionProps,\n errorMessageProps\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -27,7 +27,7 @@ import {useSearchField as $fgZRc$useSearchField} from "@react-aria/searchfield";
27
27
 
28
28
  function $c04f11f368135585$export$da7ade746446be1f(props, state) {
29
29
  let { popoverRef: popoverRef , inputRef: inputRef , listBoxRef: listBoxRef , keyboardDelegate: keyboardDelegate , onSubmit: onSubmit = ()=>{} , onClear: onClear } = props;
30
- let { inputProps: inputProps , clearButtonProps: clearButtonProps } = (0, $fgZRc$useSearchField)({
30
+ let { inputProps: inputProps , clearButtonProps: clearButtonProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = (0, $fgZRc$useSearchField)({
31
31
  ...props,
32
32
  value: state.inputValue,
33
33
  onChange: state.setInputValue,
@@ -57,7 +57,9 @@ function $c04f11f368135585$export$da7ade746446be1f(props, state) {
57
57
  labelProps: labelProps,
58
58
  inputProps: (0, $fgZRc$mergeProps)(inputProps, comboBoxInputProps),
59
59
  listBoxProps: listBoxProps,
60
- clearButtonProps: clearButtonProps
60
+ clearButtonProps: clearButtonProps,
61
+ descriptionProps: descriptionProps,
62
+ errorMessageProps: errorMessageProps
61
63
  };
62
64
  }
63
65
 
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AAsCO,SAAS,0CAAyB,KAAuC,EAAE,KAAuB,EAA6B;IACpI,IAAI,cACF,WAAU,YACV,SAAQ,cACR,WAAU,oBACV,iBAAgB,YAChB,WAAW,IAAM,CAAC,aAClB,QAAO,EACR,GAAG;IAEJ,IAAI,cAAC,WAAU,oBAAE,iBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAc,AAAD,EAAE;QAClD,GAAG,KAAK;QACR,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS,IAAM;YACb,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC,QAAU;YACnB,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,SAAS,OAAO,IAAI;QAExB;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,aAAY,cAAE,WAAU,EAAE,YAAY,mBAAkB,EAAC,GAAG,CAAA,GAAA,kBAAU,EACzE;QACE,GAAG,KAAK;0BACR;oBACA;oBACA;kBACA;QACA,SAAS;QACT,QAAQ;IACV,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,iBAAU,AAAD,EAAE,YAAY;sBACnC;0BACA;IACF;AACF;;CD5FC,GACD","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} 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> {\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\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 } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...props,\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 }, {\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":";;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AA0CO,SAAS,0CAAyB,KAAuC,EAAE,KAAuB,EAA6B;IACpI,IAAI,cACF,WAAU,YACV,SAAQ,cACR,WAAU,oBACV,iBAAgB,YAChB,WAAW,IAAM,CAAC,aAClB,QAAO,EACR,GAAG;IAEJ,IAAI,cAAC,WAAU,oBAAE,iBAAgB,oBAAE,iBAAgB,qBAAE,kBAAiB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACvF,GAAG,KAAK;QACR,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS,IAAM;YACb,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC,QAAU;YACnB,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,IAAI,EAC5C,SAAS,OAAO,IAAI;QAExB;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,aAAY,cAAE,WAAU,EAAE,YAAY,mBAAkB,EAAC,GAAG,CAAA,GAAA,kBAAU,EACzE;QACE,GAAG,KAAK;0BACR;oBACA;oBACA;kBACA;QACA,SAAS;QACT,QAAQ;IACV,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,iBAAU,AAAD,EAAE,YAAY;sBACnC;0BACA;0BACA;2BACA;IACF;AACF;;CDlGC,GACD","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} 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> {\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 } = props;\n\n let {inputProps, clearButtonProps, descriptionProps, errorMessageProps} = useSearchField({\n ...props,\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 }, {\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 descriptionProps,\n errorMessageProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -13,6 +13,10 @@ export interface SearchAutocompleteAria<T> {
13
13
  listBoxProps: AriaListBoxOptions<T>;
14
14
  /** Props for the search input's clear button. */
15
15
  clearButtonProps: AriaButtonProps;
16
+ /** Props for the search autocomplete description element, if any. */
17
+ descriptionProps: DOMAttributes;
18
+ /** Props for the search autocomplete error message element, if any. */
19
+ errorMessageProps: DOMAttributes;
16
20
  }
17
21
  export interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {
18
22
  /** The ref for the input element. */
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAsBA,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,+CAA+C,CAAC,CAAE,SAAQ,4BAA4B,CAAC,CAAC;IACtF,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;;;;;GAKG;AACH,sCAAsC,CAAC,EAAE,KAAK,EAAE,8BAA8B,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAoDpI;ACzFD,YAAY,EAAC,2BAA2B,EAAC,MAAM,2BAA2B,CAAC","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 {AriaSearchAutocompleteOptions, SearchAutocompleteAria} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;;AAsBA,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,CAAC;IAClC,qEAAqE;IACrE,gBAAgB,EAAE,aAAa,CAAC;IAChC,uEAAuE;IACvE,iBAAiB,EAAE,aAAa,CAAA;CACjC;AAED,+CAA+C,CAAC,CAAE,SAAQ,4BAA4B,CAAC,CAAC;IACtF,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;;;;;GAKG;AACH,sCAAsC,CAAC,EAAE,KAAK,EAAE,8BAA8B,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAsDpI;AC/FD,YAAY,EAAC,2BAA2B,EAAC,MAAM,2BAA2B,CAAC","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 {AriaSearchAutocompleteOptions, SearchAutocompleteAria} from './useSearchAutocomplete';\nexport type {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\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-nightly.3830+23c3a91e7",
3
+ "version": "3.0.0-nightly.3832+9f4ddd3eb",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,23 +22,23 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/combobox": "3.6.1-nightly.3830+23c3a91e7",
26
- "@react-aria/i18n": "3.0.0-nightly.2130+23c3a91e7",
27
- "@react-aria/listbox": "3.9.1-nightly.3830+23c3a91e7",
28
- "@react-aria/live-announcer": "3.0.0-nightly.2130+23c3a91e7",
29
- "@react-aria/menu": "3.9.1-nightly.3830+23c3a91e7",
30
- "@react-aria/overlays": "3.0.0-nightly.2130+23c3a91e7",
31
- "@react-aria/searchfield": "3.0.0-nightly.2130+23c3a91e7",
32
- "@react-aria/selection": "3.0.0-nightly.2130+23c3a91e7",
33
- "@react-aria/textfield": "3.0.0-nightly.2130+23c3a91e7",
34
- "@react-aria/utils": "3.0.0-nightly.2130+23c3a91e7",
35
- "@react-stately/collections": "3.0.0-nightly.2130+23c3a91e7",
36
- "@react-stately/combobox": "3.5.1-nightly.3830+23c3a91e7",
37
- "@react-types/autocomplete": "3.0.0-nightly.3830+23c3a91e7",
38
- "@react-types/button": "3.7.3-nightly.3830+23c3a91e7",
39
- "@react-types/combobox": "3.6.2-nightly.3830+23c3a91e7",
40
- "@react-types/searchfield": "3.0.0-nightly.2130+23c3a91e7",
41
- "@react-types/shared": "3.0.0-nightly.2130+23c3a91e7",
25
+ "@react-aria/combobox": "3.6.1-nightly.3832+9f4ddd3eb",
26
+ "@react-aria/i18n": "3.0.0-nightly.2132+9f4ddd3eb",
27
+ "@react-aria/listbox": "3.9.1-nightly.3832+9f4ddd3eb",
28
+ "@react-aria/live-announcer": "3.0.0-nightly.2132+9f4ddd3eb",
29
+ "@react-aria/menu": "3.9.1-nightly.3832+9f4ddd3eb",
30
+ "@react-aria/overlays": "3.0.0-nightly.2132+9f4ddd3eb",
31
+ "@react-aria/searchfield": "3.0.0-nightly.2132+9f4ddd3eb",
32
+ "@react-aria/selection": "3.0.0-nightly.2132+9f4ddd3eb",
33
+ "@react-aria/textfield": "3.0.0-nightly.2132+9f4ddd3eb",
34
+ "@react-aria/utils": "3.0.0-nightly.2132+9f4ddd3eb",
35
+ "@react-stately/collections": "3.0.0-nightly.2132+9f4ddd3eb",
36
+ "@react-stately/combobox": "3.5.1-nightly.3832+9f4ddd3eb",
37
+ "@react-types/autocomplete": "3.0.0-nightly.3832+9f4ddd3eb",
38
+ "@react-types/button": "3.7.3-nightly.3832+9f4ddd3eb",
39
+ "@react-types/combobox": "3.6.2-nightly.3832+9f4ddd3eb",
40
+ "@react-types/searchfield": "3.0.0-nightly.2132+9f4ddd3eb",
41
+ "@react-types/shared": "3.0.0-nightly.2132+9f4ddd3eb",
42
42
  "@swc/helpers": "^0.4.14"
43
43
  },
44
44
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "23c3a91e7b87952f07da9da115188bd2abd99d77"
50
+ "gitHead": "9f4ddd3eb54740a9b6facfb3c42c39d7be380082"
51
51
  }
@@ -28,7 +28,11 @@ export interface SearchAutocompleteAria<T> {
28
28
  /** Props for the list box, to be passed to [useListBox](useListBox.html). */
29
29
  listBoxProps: AriaListBoxOptions<T>,
30
30
  /** Props for the search input's clear button. */
31
- clearButtonProps: AriaButtonProps
31
+ clearButtonProps: AriaButtonProps,
32
+ /** Props for the search autocomplete description element, if any. */
33
+ descriptionProps: DOMAttributes,
34
+ /** Props for the search autocomplete error message element, if any. */
35
+ errorMessageProps: DOMAttributes
32
36
  }
33
37
 
34
38
  export interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {
@@ -58,7 +62,7 @@ export function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>
58
62
  onClear
59
63
  } = props;
60
64
 
61
- let {inputProps, clearButtonProps} = useSearchField({
65
+ let {inputProps, clearButtonProps, descriptionProps, errorMessageProps} = useSearchField({
62
66
  ...props,
63
67
  value: state.inputValue,
64
68
  onChange: state.setInputValue,
@@ -98,6 +102,8 @@ export function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>
98
102
  labelProps,
99
103
  inputProps: mergeProps(inputProps, comboBoxInputProps),
100
104
  listBoxProps,
101
- clearButtonProps
105
+ clearButtonProps,
106
+ descriptionProps,
107
+ errorMessageProps
102
108
  };
103
109
  }