{"version":3,"sources":["../../src/helpers/lazier.ts"],"names":[],"mappings":";;;AAAA,SAAS,YAAgD;AAiBlD,IAAM,SAAS,CACpB,eAGA,eAC2B;AAC3B,SAAO,KAAK,MAAM;AAChB,WAAO,cAAc,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,OAAO,YAAY,EAAE;AAAA,EAC3E,CAAC;AACH","sourcesContent":["import { lazy, ComponentType, LazyExoticComponent } from 'react';\n\n/**\n * ### Summary\n * A function that modifies react lazy to allow for named exports\n *\n * ### Example\n * ```typescript\n * const ExampleUI = lazier(() => import('./exampleui/ExampleUI'), 'ExampleUI');\n * ```\n *\n * @category Helpers\n *\n * @param importFactory a callback that imports e.g. () => import('./exampleui/ExampleUI')\n * @param importName the named export you want to import.\n * @returns\n */\nexport const lazier = <T extends ComponentType<any>>(\n  importFactory: () => Promise<{\n    [name: string]: T;\n  }>,\n  importName: string\n): LazyExoticComponent<T> => {\n  return lazy(() => {\n    return importFactory().then((module) => ({ default: module[importName] }));\n  });\n};\n"]}