flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 1.26 kB
Source Map (JSON)
{"version":3,"file":"DropdownContext.cjs","sources":["../../../src/components/Dropdown/DropdownContext.tsx"],"sourcesContent":["\"use client\";\n\nimport type { useInteractions } from \"@floating-ui/react\";\nimport { createContext, useContext } from \"react\";\nimport type { ThemingProps } from \"../../types\";\nimport type { DropdownTheme } from \"./Dropdown\";\n\nexport interface DropdownContextValue extends ThemingProps<DropdownTheme> {\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<DropdownContextValue | undefined>(undefined);\n\nexport function useDropdownContext(): DropdownContextValue {\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":["createContext","useContext"],"mappings":";;;;AAGY,MAAC,eAAe,GAAGA,mBAAa,CAAC,MAAM;AAC5C,SAAS,kBAAkB,GAAG;AACrC,EAAE,MAAM,OAAO,GAAGC,gBAAU,CAAC,eAAe,CAAC;AAC7C,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC;AAC7F;AACA,EAAE,OAAO,OAAO;AAChB;;;;;"}