UNPKG

@liveblocks/react-ui

Version:

A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.

44 lines (40 loc) 1.02 kB
"use client"; import { jsx } from 'react/jsx-runtime'; import { createContext, useContext, useMemo } from 'react'; const defaultComponents = { Anchor: "a" }; const ComponentsContext = createContext( void 0 ); function useComponents(components) { const contextComponents = useContext(ComponentsContext); return useMemo( () => ({ ...defaultComponents, ...contextComponents, ...components }), [contextComponents, components] ); } function ComponentsProvider({ children, components: providerComponents }) { const contextComponents = useContext(ComponentsContext); const components = useMemo( () => ({ ...defaultComponents, ...contextComponents, ...providerComponents }), [contextComponents, providerComponents] ); return /* @__PURE__ */ jsx(ComponentsContext.Provider, { value: components, children }); } export { ComponentsContext, ComponentsProvider, defaultComponents, useComponents }; //# sourceMappingURL=components.js.map