{"version":3,"file":"SearchContext.mjs","names":[],"sources":["../../../../src/components/Search/SearchContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport type { SearchController } from 'stream-chat';\nimport type { SearchProps } from './Search';\nimport { requireContext } from '../../context/requireContext';\n\nexport type SearchContextValue = {\n  searchController: SearchController;\n  containerRef: React.RefObject<HTMLDivElement | null>;\n  filterButtonsContainerRef: React.RefObject<HTMLDivElement | null>;\n} & Pick<SearchProps, 'disabled' | 'inputProps' | 'placeholder'> &\n  Required<Pick<SearchProps, 'exitSearchOnInputBlur' | 'directMessagingChannelType'>>;\n\nexport const SearchContext = createContext<SearchContextValue | undefined>(undefined);\n\n/** Provides the search state to the components rendered inside `Search`. */\nexport const SearchContextProvider = ({\n  children,\n  value,\n}: PropsWithChildren<{\n  value: SearchContextValue;\n}>) => (\n  <SearchContext.Provider value={value as unknown as SearchContextValue}>\n    {children}\n  </SearchContext.Provider>\n);\n\nexport const useSearchContext = () =>\n  requireContext(useContext(SearchContext), 'useSearchContext', 'SearchContextProvider');\n"],"mappings":";;;;AAaA,IAAa,gBAAgB,cAA8C,KAAA,CAAS;;AAGpF,IAAa,yBAAyB,EACpC,UACA,YAIA,oBAAC,cAAc,UAAf;CAA+B;CAC5B;AACqB,CAAA;AAG1B,IAAa,yBACX,eAAe,WAAW,aAAa,GAAG,oBAAoB,uBAAuB"}