UNPKG

@transkripid/flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS - Transkrip.id fork

1 lines 1.12 kB
{"version":3,"file":"ToastContext.mjs","sources":["../../../src/components/Toast/ToastContext.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport type { FlowbiteToastTheme } from './Toast';\n\nexport type Duration = 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000;\n\ntype ToastContext = {\n theme: FlowbiteToastTheme;\n duration?: Duration;\n isClosed?: boolean;\n isRemoved?: boolean;\n setIsClosed: (isClosed: boolean) => void;\n setIsRemoved: (isRemoved: boolean) => void;\n};\n\nexport const ToastContext = createContext<ToastContext | undefined>(undefined);\n\nexport function useToastContext(): ToastContext {\n const context = useContext(ToastContext);\n\n if (!context) {\n throw new Error('useToastContext should be used within the ToastContext provider!');\n }\n\n return context;\n}\n"],"names":["ToastContext","createContext","undefined","useToastContext","context","useContext","Error"],"mappings":";AAgBaA,MAAAA,IAAeC,EAAwCC,MAAS;AAEtE,SAAAC,IAAA;AACLC,QAAAA,IAAgBC,EAAAL,CAAuB;AAAE,MAAA,CAEpCI;AAAOE,UAAAA,IAAAA,MACM,kEAAkE;AAG7EF,SAAAA;AAAO;"}