{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA6BM,MAAM,0DACX,CAAA,GAAA,0BAAY,EAAwD;AAC/D,MAAM,0DAA2B,CAAA,GAAA,0BAAY,EAA4B;AA0BzE,MAAM,0DACX,CAAA,GAAA,0BAAY,EAAoE;AAC3E,MAAM,0DACX,CAAA,GAAA,0BAAY,EAA0D;AAKjE,SAAS,0CAAgB,KAA2B;IACzD,IAAI,MAAM,CAAA,GAAA,2CAAgB,EAAE,2CAAqB,MAAM,IAAI;IAC3D,QAAQ,CAAA,GAAA,qCAAS,EAAE,KAAK;IACxB,IAAI,UAAC,MAAM,yBAAE,qBAAqB,EAAC,GAAG;IACtC,IAAI,QAAQ,CAAA,GAAA,+EAAmB,EAAE;IACjC,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA2B;IAC/C,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAe;IACxC,IAAI,cACF,UAAU,mBACV,eAAe,EACf,eAAe,mBAAmB,EAClC,QAAQ,QAAQ,EACjB,GAAG,CAAA,GAAA,+CAAc,EAChB;QACE,GAAG,CAAA,GAAA,8CAAmB,EAAE,MAAM;gBAC9B;+BACA;kBACA;uBACA;IACF,GACA;IAGF,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAA0B;aAAM;YACjC;gBACE;gBACA;oBACE,GAAG,UAAU;oBACb,KAAK;gBACP;aACD;YACD;gBACE;gBACA;oBACE,GAAG,eAAe;oBAClB,QAAQ;oBACR,KAAK;gBACP;aACD;SACF;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 {\n  AriaLabelingProps,\n  DOMProps,\n  FocusableElement,\n  FocusEvents,\n  KeyboardEvents,\n  Node,\n  ValueBase\n} from '@react-types/shared';\nimport {AriaTextFieldProps} from 'react-aria/useTextField';\nimport {\n  AutocompleteState,\n  useAutocompleteState\n} from 'react-stately/private/autocomplete/useAutocompleteState';\nimport {\n  ContextValue,\n  Provider,\n  removeDataAttributes,\n  SlotProps,\n  SlottedContextValue,\n  useSlottedContext\n} 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 =\n  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>\n  extends\n    DOMProps,\n    FocusEvents<T>,\n    KeyboardEvents,\n    Pick<ValueBase<string>, 'onChange' | 'value'>,\n    Pick<\n      AriaTextFieldProps,\n      | 'enterKeyHint'\n      | 'aria-controls'\n      | 'aria-autocomplete'\n      | 'aria-activedescendant'\n      | 'spellCheck'\n      | 'autoCorrect'\n      | 'autoComplete'\n    > {}\n\nexport const SelectableCollectionContext =\n  createContext<ContextValue<SelectableCollectionContextValue<any>, HTMLElement>>(null);\nexport const FieldInputContext =\n  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>(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    {\n      ...removeDataAttributes(props),\n      filter,\n      disableAutoFocusFirst,\n      inputRef,\n      collectionRef\n    },\n    state\n  );\n\n  return (\n    <Provider\n      values={[\n        [AutocompleteStateContext, state],\n        [\n          FieldInputContext,\n          {\n            ...inputProps,\n            ref: inputRef\n          }\n        ],\n        [\n          SelectableCollectionContext,\n          {\n            ...collectionProps,\n            filter: filterFn,\n            ref: mergedCollectionRef\n          }\n        ]\n      ]}>\n      {props.children}\n    </Provider>\n  );\n}\n"],"names":[],"version":3,"file":"Autocomplete.cjs.map"}