UNPKG

@tapcart/app-studio-components

Version:

A library for accessing global components across different environments with a consistent API

27 lines (26 loc) 991 B
import React from 'react'; export type ComponentMap = Record<string, React.ComponentType<any>>; /** * Hook to access global components * @returns Record of available components */ export declare function useComponents(): ComponentMap; /** * Provider component that makes components available to children */ export interface ComponentProviderProps { /** React children */ children: React.ReactNode; /** Map of component names to component implementations */ componentSource: ComponentMap; } /** * Provider component that makes components available via useComponents hook */ export declare function ComponentProvider({ children, componentSource }: ComponentProviderProps): React.ReactElement; /** * Helper function to create a component source from a map of components * @param components Map of component names to component implementations * @returns Component source object */ export declare function createComponentSource(components: ComponentMap): ComponentMap;