flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 1.19 kB
Source Map (JSON)
{"version":3,"file":"DropdownContext.mjs","sources":["../../../../src/components/Dropdown/DropdownContext.tsx"],"sourcesContent":["\"use client\";\n\nimport type { useInteractions } from \"@floating-ui/react\";\nimport { createContext, useContext } from \"react\";\nimport type { FlowbiteDropdownTheme } from \"./Dropdown\";\n\ntype DropdownContext = {\n theme: FlowbiteDropdownTheme;\n activeIndex: number | null;\n dismissOnClick?: boolean;\n getItemProps: ReturnType<typeof useInteractions>[\"getItemProps\"];\n handleSelect: (index: number | null) => void;\n};\n\nexport const DropdownContext = createContext<DropdownContext | undefined>(undefined);\n\nexport function useDropdownContext(): DropdownContext {\n const context = useContext(DropdownContext);\n\n if (!context) {\n throw new Error(\"useDropdownContext should be used within the DropdownContext provider!\");\n }\n\n return context;\n}\n"],"names":[],"mappings":";;AAGY,MAAC,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,EAAE;AAC9C,SAAS,kBAAkB,GAAG;AACrC,EAAE,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAC9C,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;AAC9F,GAAG;AACH,EAAE,OAAO,OAAO,CAAC;AACjB;;;;"}