{"version":3,"file":"Provider.js","names":["createContext","use","ListDrawerContext","ListDrawerContextProvider","children","rest","_jsx","value","isInDrawer","Boolean","drawerSlug","useListDrawerContext","context","Error"],"sources":["../../../src/elements/ListDrawer/Provider.tsx"],"sourcesContent":["import type { CollectionSlug, Data, ListQuery } from 'payload'\n\nimport { createContext, use } from 'react'\n\nimport type { useSelection } from '../../providers/Selection/index.js'\nimport type { UseDocumentDrawer } from '../DocumentDrawer/types.js'\nimport type { Option } from '../ReactSelect/index.js'\n\nexport type ListDrawerContextProps = {\n readonly allowCreate?: boolean\n readonly createNewDrawerSlug?: string\n readonly DocumentDrawerToggler?: ReturnType[1]\n readonly drawerSlug?: string\n readonly enabledCollections?: CollectionSlug[]\n readonly onBulkSelect?: (selected: ReturnType['selected']) => void\n readonly onQueryChange?: (query: ListQuery) => void\n readonly onSelect?: (args: {\n collectionSlug: CollectionSlug\n doc: Data\n /**\n * @deprecated\n * The `docID` property is deprecated and will be removed in the next major version of Payload.\n * Use `doc.id` instead.\n */\n docID: string\n }) => void\n readonly selectedOption?: Option\n readonly setSelectedOption?: (option: Option) => void\n}\n\nexport type ListDrawerContextType = {\n readonly isInDrawer: boolean\n /**\n * When called, will either refresh the list view with its currently selected collection.\n * If an collection slug is provided, will use that instead of the currently selected one.\n */\n readonly refresh: (collectionSlug?: CollectionSlug) => Promise\n} & ListDrawerContextProps\n\nexport const ListDrawerContext = createContext({} as ListDrawerContextType)\n\nexport const ListDrawerContextProvider: React.FC<\n {\n children: React.ReactNode\n refresh: ListDrawerContextType['refresh']\n } & ListDrawerContextProps\n> = ({ children, ...rest }) => {\n return (\n \n {children}\n \n )\n}\n\nexport const useListDrawerContext = (): ListDrawerContextType => {\n const context = use(ListDrawerContext)\n\n if (!context) {\n throw new Error('useListDrawerContext must be used within a ListDrawerContextProvider')\n }\n\n return context\n}\n"],"mappings":";AAEA,SAASA,aAAa,EAAEC,GAAG,QAAQ;AAqCnC,OAAO,MAAMC,iBAAA,gBAAoBF,aAAA,CAAc,CAAC;AAEhD,OAAO,MAAMG,yBAAA,GAKTA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAA,CAAM;EACxB,oBACEC,IAAA,CAACJ,iBAAA;IAAkBK,KAAA,EAAO;MAAEC,UAAA,EAAYC,OAAA,CAAQJ,IAAA,CAAKK,UAAU;MAAG,GAAGL;IAAK;cACvED;;AAGP;AAEA,OAAO,MAAMO,oBAAA,GAAuBA,CAAA;EAClC,MAAMC,OAAA,GAAUX,GAAA,CAAIC,iBAAA;EAEpB,IAAI,CAACU,OAAA,EAAS;IACZ,MAAM,IAAIC,KAAA,CAAM;EAClB;EAEA,OAAOD,OAAA;AACT","ignoreList":[]}