UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 1.09 kB
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/base-ui/Popover/context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, memo, type ReactNode, use } from 'react';\n\nexport type PopoverContextValue = {\n close: () => void;\n};\n\nconst noop =\n process.env.NODE_ENV === 'production'\n ? () => void 0\n : () => {\n throw new Error('usePopoverContext must be used within a PopoverProvider');\n };\n\nexport const PopoverContext = createContext<PopoverContextValue>({\n close: noop,\n});\n\nexport const PopoverProvider = memo<{ children: ReactNode; value: PopoverContextValue }>(\n ({ children, value }) => {\n return <PopoverContext value={value}>{children}</PopoverContext>;\n },\n);\n\nexport const usePopoverContext = () => {\n return use(PopoverContext);\n};\n"],"mappings":";;;AAeA,MAAa,iBAAiB,cAAmC,EAC/D,OAPA,QAAQ,IAAI,aAAa,qBACf,KAAK,UACL;CACJ,MAAM,IAAI,MAAM,yDAAyD;AAC3E,EAIN,CAAC;AAED,MAAa,kBAAkB,MAC5B,EAAE,UAAU,YAAY;CACvB,OAAO,oBAAC,gBAAD;EAAuB;EAAQ;CAAyB,CAAA;AACjE,CACF;AAEA,MAAa,0BAA0B;CACrC,OAAO,IAAI,cAAc;AAC3B"}