{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAWM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAwD;AAChG,MAAM,0DAA2B,CAAA,GAAA,oBAAY,EAA4B;AAgBzE,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAAoE;AACpH,MAAM,0DAAoB,CAAA,GAAA,oBAAY,EAA0D;AAKhG,SAAS,0CAA+B,KAA2B;IACxE,IAAI,MAAM,CAAA,GAAA,yCAAgB,EAAE,2CAAqB,MAAM,IAAI;IAC3D,QAAQ,CAAA,GAAA,iBAAS,EAAE,KAAK;IACxB,IAAI,UAAC,MAAM,yBAAE,qBAAqB,EAAC,GAAG;IACtC,IAAI,QAAQ,CAAA,GAAA,2BAAmB,EAAE;IACjC,IAAI,WAAW,CAAA,GAAA,aAAK,EAA2B;IAC/C,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAe;IACxC,IAAI,cACF,UAAU,mBACV,eAAe,EACf,eAAe,mBAAmB,EAClC,QAAQ,QAAQ,EACjB,GAAG,CAAA,GAAA,sBAAc,EAAE;QAClB,GAAG,CAAA,GAAA,yCAAmB,EAAE,MAAM;gBAC9B;+BACA;kBACA;uBACA;IACF,GAAG;IAEH,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAA0B;aAAM;YACjC;gBAAC;gBAAmB;oBAClB,GAAG,UAAU;oBACb,KAAK;gBACP;aAAE;YACF;gBAAC;gBAA6B;oBAC5B,GAAG,eAAe;oBAClB,QAAQ;oBACR,KAAK;gBACP;aAAE;SACH;OACA,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Autocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaAutocompleteProps, useAutocomplete} from 'react-aria/useAutocomplete';\nimport {AriaLabelingProps, DOMProps, FocusableElement, FocusEvents, KeyboardEvents, Node, ValueBase} from '@react-types/shared';\nimport {AriaTextFieldProps} from 'react-aria/useTextField';\nimport {AutocompleteState, useAutocompleteState} from 'react-stately/private/autocomplete/useAutocompleteState';\nimport {ContextValue, Provider, removeDataAttributes, SlotProps, SlottedContextValue, useSlottedContext} from './utils';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, JSX, useRef} from 'react';\n\nexport interface AutocompleteProps<T = object> extends AriaAutocompleteProps<T>, SlotProps {}\nexport const AutocompleteContext = createContext<SlottedContextValue<Partial<AutocompleteProps<any>>>>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\n\nexport interface SelectableCollectionContextValue<T> extends DOMProps, AriaLabelingProps {\n  filter?: (nodeTextValue: string, node: Node<T>) => boolean,\n  /** Whether the collection items should use virtual focus instead of being focused directly. */\n  shouldUseVirtualFocus?: boolean,\n  /** Whether typeahead is disabled. */\n  disallowTypeAhead?: boolean\n}\ninterface FieldInputContextValue<T = FocusableElement> extends\n  DOMProps,\n  FocusEvents<T>,\n  KeyboardEvents,\n  Pick<ValueBase<string>, 'onChange' | 'value'>,\n  Pick<AriaTextFieldProps, 'enterKeyHint' | 'aria-controls' | 'aria-autocomplete' | 'aria-activedescendant' | 'spellCheck' | 'autoCorrect' | 'autoComplete'> {}\n\nexport const SelectableCollectionContext = createContext<ContextValue<SelectableCollectionContextValue<any>, HTMLElement>>(null);\nexport const FieldInputContext = createContext<ContextValue<FieldInputContextValue, FocusableElement>>(null);\n\n/**\n * An autocomplete allows users to search or filter a list of suggestions.\n */\nexport function Autocomplete<T extends object>(props: AutocompleteProps<T>): JSX.Element {\n  let ctx = useSlottedContext(AutocompleteContext, props.slot);\n  props = mergeProps(ctx, props);\n  let {filter, disableAutoFocusFirst} = props;\n  let state = useAutocompleteState(props);\n  let inputRef = useRef<HTMLInputElement | null>(null);\n  let collectionRef = useRef<HTMLElement>(null);\n  let {\n    inputProps,\n    collectionProps,\n    collectionRef: mergedCollectionRef,\n    filter: filterFn\n  } = useAutocomplete({\n    ...removeDataAttributes(props),\n    filter,\n    disableAutoFocusFirst,\n    inputRef,\n    collectionRef\n  }, state);\n\n  return (\n    <Provider\n      values={[\n        [AutocompleteStateContext, state],\n        [FieldInputContext, {\n          ...inputProps,\n          ref: inputRef\n        }],\n        [SelectableCollectionContext, {\n          ...collectionProps,\n          filter: filterFn,\n          ref: mergedCollectionRef\n        }]\n      ]}>\n      {props.children}\n    </Provider>\n  );\n};\n"],"names":[],"version":3,"file":"Autocomplete.mjs.map"}