@react-aria/autocomplete 3.0.0-nightly.4674 → 3.0.0-nightly.4683

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/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import { AriaButtonProps } from "@react-types/button";
2
2
  import { AriaListBoxOptions } from "@react-aria/listbox";
3
3
  import { AriaSearchAutocompleteProps } from "@react-types/autocomplete";
4
4
  import { ComboBoxState } from "@react-stately/combobox";
5
- import { DOMAttributes, KeyboardDelegate, ValidationResult } from "@react-types/shared";
5
+ import { DOMAttributes, KeyboardDelegate, LayoutDelegate, ValidationResult } from "@react-types/shared";
6
6
  import { InputHTMLAttributes, RefObject } from "react";
7
7
  export interface SearchAutocompleteAria<T> extends ValidationResult {
8
8
  /** Props for the label element. */
@@ -20,13 +20,19 @@ export interface SearchAutocompleteAria<T> extends ValidationResult {
20
20
  }
21
21
  export interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {
22
22
  /** The ref for the input element. */
23
- inputRef: RefObject<HTMLInputElement>;
23
+ inputRef: RefObject<HTMLInputElement | null>;
24
24
  /** The ref for the list box popover. */
25
- popoverRef: RefObject<HTMLDivElement>;
25
+ popoverRef: RefObject<HTMLDivElement | null>;
26
26
  /** The ref for the list box. */
27
- listBoxRef: RefObject<HTMLElement>;
27
+ listBoxRef: RefObject<HTMLElement | null>;
28
28
  /** An optional keyboard delegate implementation, to override the default. */
29
29
  keyboardDelegate?: KeyboardDelegate;
30
+ /**
31
+ * A delegate object that provides layout information for items in the collection.
32
+ * By default this uses the DOM, but this can be overridden to implement things like
33
+ * virtualized scrolling.
34
+ */
35
+ layoutDelegate?: LayoutDelegate;
30
36
  }
31
37
  /**
32
38
  * Provides the behavior and accessibility implementation for a search autocomplete component.
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAsBA,wCAAwC,CAAC,CAAE,SAAQ,gBAAgB;IACjE,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,CAsEpI;AC/GD,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,CAAE,SAAQ,gBAAgB;IACjE,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,GAAG,IAAI,CAAC,CAAC;IAC7C,wCAAwC;IACxC,UAAU,EAAE,UAAU,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C,gCAAgC;IAChC,UAAU,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,CAAC;IAC1C,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC;AAED;;;;;GAKG;AACH,sCAAsC,CAAC,EAAE,KAAK,EAAE,8BAA8B,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAwEpI;ACvHD,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"}
@@ -22,7 +22,7 @@ $parcel$export(module.exports, "useSearchAutocomplete", () => $3c40871f8cc2eb01$
22
22
 
23
23
 
24
24
  function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
25
- let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
25
+ let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, layoutDelegate: layoutDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
26
26
  let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $2rg0a$reactariasearchfield.useSearchField)({
27
27
  ...otherProps,
28
28
  value: state.inputValue,
@@ -45,6 +45,7 @@ function $3c40871f8cc2eb01$export$da7ade746446be1f(props, state) {
45
45
  let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $2rg0a$reactariacombobox.useComboBox)({
46
46
  ...otherProps,
47
47
  keyboardDelegate: keyboardDelegate,
48
+ layoutDelegate: layoutDelegate,
48
49
  popoverRef: popoverRef,
49
50
  listBoxRef: listBoxRef,
50
51
  inputRef: inputRef,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA4CM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,YAChB,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,0CAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,oCAAU,EACxF;QACE,GAAG,UAAU;0BACb;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,gCAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search autocomplete component.\n * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the search autocomplete.\n * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.\n */\nexport function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchAutocomplete.main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAkDM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,kBAChB,cAAc,YACd,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,0CAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,oCAAU,EACxF;QACE,GAAG,UAAU;0BACb;wBACA;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,gCAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, LayoutDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement | null>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement | null>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement | null>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate\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 layoutDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n layoutDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchAutocomplete.main.js.map"}
@@ -16,7 +16,7 @@ import {useSearchField as $3Hzop$useSearchField} from "@react-aria/searchfield";
16
16
 
17
17
 
18
18
  function $c04f11f368135585$export$da7ade746446be1f(props, state) {
19
- let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
19
+ let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, layoutDelegate: layoutDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
20
20
  let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $3Hzop$useSearchField)({
21
21
  ...otherProps,
22
22
  value: state.inputValue,
@@ -39,6 +39,7 @@ function $c04f11f368135585$export$da7ade746446be1f(props, state) {
39
39
  let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $3Hzop$useComboBox)({
40
40
  ...otherProps,
41
41
  keyboardDelegate: keyboardDelegate,
42
+ layoutDelegate: layoutDelegate,
42
43
  popoverRef: popoverRef,
43
44
  listBoxRef: listBoxRef,
44
45
  inputRef: inputRef,
@@ -16,7 +16,7 @@ import {useSearchField as $3Hzop$useSearchField} from "@react-aria/searchfield";
16
16
 
17
17
 
18
18
  function $c04f11f368135585$export$da7ade746446be1f(props, state) {
19
- let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
19
+ let { popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, layoutDelegate: layoutDelegate, onSubmit: onSubmit = ()=>{}, onClear: onClear, onKeyDown: onKeyDown, onKeyUp: onKeyUp, isInvalid: isInvalid, validationState: validationState, validationBehavior: validationBehavior, isRequired: isRequired, ...otherProps } = props;
20
20
  let { inputProps: inputProps, clearButtonProps: clearButtonProps } = (0, $3Hzop$useSearchField)({
21
21
  ...otherProps,
22
22
  value: state.inputValue,
@@ -39,6 +39,7 @@ function $c04f11f368135585$export$da7ade746446be1f(props, state) {
39
39
  let { listBoxProps: listBoxProps, labelProps: labelProps, inputProps: comboBoxInputProps, ...validation } = (0, $3Hzop$useComboBox)({
40
40
  ...otherProps,
41
41
  keyboardDelegate: keyboardDelegate,
42
+ layoutDelegate: layoutDelegate,
42
43
  popoverRef: popoverRef,
43
44
  listBoxRef: listBoxRef,
44
45
  inputRef: inputRef,
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA4CM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,YAChB,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,kBAAU,EACxF;QACE,GAAG,UAAU;0BACb;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,iBAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search autocomplete component.\n * A search autocomplete combines a combobox with a searchfield, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the search autocomplete.\n * @param state - State for the search autocomplete, as returned by `useSearchAutocomplete`.\n */\nexport function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>, state: ComboBoxState<T>): SearchAutocompleteAria<T> {\n let {\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchAutocomplete.module.js.map"}
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAkDM,SAAS,0CAAyB,KAAuC,EAAE,KAAuB;IACvG,IAAI,cACF,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,kBAChB,cAAc,YACd,WAAW,KAAO,YAClB,OAAO,aACP,SAAS,WACT,OAAO,aACP,SAAS,mBACT,eAAe,sBACf,kBAAkB,cAClB,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAC,UAAU,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QAClD,GAAG,UAAU;QACb,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;QAC7B,cAAc;QACd,SAAS;YACP,MAAM,aAAa,CAAC;YACpB,IAAI,SACF;QAEJ;QACA,UAAU,CAAC;YACT,iEAAiE;YACjE,IAAI,MAAM,gBAAgB,CAAC,UAAU,KAAK,MACxC,SAAS,OAAO;QAEpB;mBACA;iBACA;IACF,GAAG;QACD,OAAO,MAAM,UAAU;QACvB,UAAU,MAAM,aAAa;IAC/B,GAAG;IAGH,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAE,YAAY,kBAAkB,EAAE,GAAG,YAAW,GAAG,CAAA,GAAA,kBAAU,EACxF;QACE,GAAG,UAAU;0BACb;wBACA;oBACA;oBACA;kBACA;QACA,SAAS;QACT,eAAe;QACf,QAAQ;QACR,WAAW;QACX,SAAS;mBACT;yBACA;4BACA;oBACA;QACA,UAAU;IACZ,GACA;IAGF,OAAO;oBACL;QACA,YAAY,CAAA,GAAA,iBAAS,EAAE,YAAY;sBACnC;0BACA;QACA,GAAG,UAAU;IACf;AACF","sources":["packages/@react-aria/autocomplete/src/useSearchAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaListBoxOptions} from '@react-aria/listbox';\nimport {AriaSearchAutocompleteProps} from '@react-types/autocomplete';\nimport {ComboBoxState} from '@react-stately/combobox';\nimport {DOMAttributes, KeyboardDelegate, LayoutDelegate, ValidationResult} from '@react-types/shared';\nimport {InputHTMLAttributes, RefObject} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useSearchField} from '@react-aria/searchfield';\n\nexport interface SearchAutocompleteAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the search input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to [useListBox](useListBox.html). */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the search input's clear button. */\n clearButtonProps: AriaButtonProps,\n /** Props for the search autocomplete description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the search autocomplete error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\nexport interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement | null>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<HTMLDivElement | null>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement | null>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate\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 layoutDelegate,\n onSubmit = () => {},\n onClear,\n onKeyDown,\n onKeyUp,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n ...otherProps\n } = props;\n\n let {inputProps, clearButtonProps} = useSearchField({\n ...otherProps,\n value: state.inputValue,\n onChange: state.setInputValue,\n autoComplete: 'off',\n onClear: () => {\n state.setInputValue('');\n if (onClear) {\n onClear();\n }\n },\n onSubmit: (value) => {\n // Prevent submission from search field if menu item was selected\n if (state.selectionManager.focusedKey === null) {\n onSubmit(value, null);\n }\n },\n onKeyDown,\n onKeyUp\n }, {\n value: state.inputValue,\n setValue: state.setInputValue\n }, inputRef);\n\n\n let {listBoxProps, labelProps, inputProps: comboBoxInputProps, ...validation} = useComboBox(\n {\n ...otherProps,\n keyboardDelegate,\n layoutDelegate,\n popoverRef,\n listBoxRef,\n inputRef,\n onFocus: undefined,\n onFocusChange: undefined,\n onBlur: undefined,\n onKeyDown: undefined,\n onKeyUp: undefined,\n isInvalid,\n validationState,\n validationBehavior,\n isRequired,\n validate: undefined\n },\n state\n );\n\n return {\n labelProps,\n inputProps: mergeProps(inputProps, comboBoxInputProps),\n listBoxProps,\n clearButtonProps,\n ...validation\n };\n}\n"],"names":[],"version":3,"file":"useSearchAutocomplete.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/autocomplete",
3
- "version": "3.0.0-nightly.4674+59136f78e",
3
+ "version": "3.0.0-nightly.4683+4e3af379e",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,22 +22,22 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/combobox": "3.9.2-nightly.4674+59136f78e",
26
- "@react-aria/listbox": "3.12.2-nightly.4674+59136f78e",
27
- "@react-aria/searchfield": "3.0.0-nightly.2962+59136f78e",
28
- "@react-aria/utils": "3.0.0-nightly.2962+59136f78e",
29
- "@react-stately/combobox": "3.8.5-nightly.4674+59136f78e",
30
- "@react-types/autocomplete": "3.0.0-nightly.4674+59136f78e",
31
- "@react-types/button": "3.9.5-nightly.4674+59136f78e",
32
- "@react-types/shared": "3.0.0-nightly.2962+59136f78e",
25
+ "@react-aria/combobox": "3.9.2-nightly.4683+4e3af379e",
26
+ "@react-aria/listbox": "3.12.2-nightly.4683+4e3af379e",
27
+ "@react-aria/searchfield": "3.0.0-nightly.2971+4e3af379e",
28
+ "@react-aria/utils": "3.0.0-nightly.2971+4e3af379e",
29
+ "@react-stately/combobox": "3.8.5-nightly.4683+4e3af379e",
30
+ "@react-types/autocomplete": "3.0.0-nightly.4683+4e3af379e",
31
+ "@react-types/button": "3.9.5-nightly.4683+4e3af379e",
32
+ "@react-types/shared": "3.0.0-nightly.2971+4e3af379e",
33
33
  "@swc/helpers": "^0.5.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
37
- "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
36
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
37
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "59136f78e853e97bb4067a1268750c9f85900bf6"
42
+ "gitHead": "4e3af379e569faac3b374e0ed5a98b2a19cd92c3"
43
43
  }
@@ -14,7 +14,7 @@ import {AriaButtonProps} from '@react-types/button';
14
14
  import {AriaListBoxOptions} from '@react-aria/listbox';
15
15
  import {AriaSearchAutocompleteProps} from '@react-types/autocomplete';
16
16
  import {ComboBoxState} from '@react-stately/combobox';
17
- import {DOMAttributes, KeyboardDelegate, ValidationResult} from '@react-types/shared';
17
+ import {DOMAttributes, KeyboardDelegate, LayoutDelegate, ValidationResult} from '@react-types/shared';
18
18
  import {InputHTMLAttributes, RefObject} from 'react';
19
19
  import {mergeProps} from '@react-aria/utils';
20
20
  import {useComboBox} from '@react-aria/combobox';
@@ -37,13 +37,19 @@ export interface SearchAutocompleteAria<T> extends ValidationResult {
37
37
 
38
38
  export interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {
39
39
  /** The ref for the input element. */
40
- inputRef: RefObject<HTMLInputElement>,
40
+ inputRef: RefObject<HTMLInputElement | null>,
41
41
  /** The ref for the list box popover. */
42
- popoverRef: RefObject<HTMLDivElement>,
42
+ popoverRef: RefObject<HTMLDivElement | null>,
43
43
  /** The ref for the list box. */
44
- listBoxRef: RefObject<HTMLElement>,
44
+ listBoxRef: RefObject<HTMLElement | null>,
45
45
  /** An optional keyboard delegate implementation, to override the default. */
46
- keyboardDelegate?: KeyboardDelegate
46
+ keyboardDelegate?: KeyboardDelegate,
47
+ /**
48
+ * A delegate object that provides layout information for items in the collection.
49
+ * By default this uses the DOM, but this can be overridden to implement things like
50
+ * virtualized scrolling.
51
+ */
52
+ layoutDelegate?: LayoutDelegate
47
53
  }
48
54
 
49
55
  /**
@@ -58,6 +64,7 @@ export function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>
58
64
  inputRef,
59
65
  listBoxRef,
60
66
  keyboardDelegate,
67
+ layoutDelegate,
61
68
  onSubmit = () => {},
62
69
  onClear,
63
70
  onKeyDown,
@@ -98,6 +105,7 @@ export function useSearchAutocomplete<T>(props: AriaSearchAutocompleteOptions<T>
98
105
  {
99
106
  ...otherProps,
100
107
  keyboardDelegate,
108
+ layoutDelegate,
101
109
  popoverRef,
102
110
  listBoxRef,
103
111
  inputRef,