UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

1 lines 1.23 kB
{"version":3,"file":"use-loading-component.cjs","names":["Loading"],"sources":["../../../../src/components/loading/use-loading-component.ts"],"sourcesContent":["import type { Component } from \"../../core\"\nimport { useMemo } from \"react\"\nimport { isString, toPascalCase } from \"../../utils\"\nimport { Loading } from \"./\"\n\nexport const useLoadingComponent = (\n scheme: Loading.Scheme,\n): Component<\"svg\", Loading.Props> => {\n const Component = useMemo(\n () =>\n Loading[toPascalCase(scheme) as keyof typeof Loading] as Component<\n \"svg\",\n Loading.Props\n >,\n [scheme],\n )\n\n return Component\n}\n\nexport const getLoadingComponent = (\n scheme: Loading.Scheme,\n): Component<\"svg\", Loading.Props> => {\n return Loading[toPascalCase(scheme) as keyof typeof Loading] as Component<\n \"svg\",\n Loading.Props\n >\n}\n\nexport const isLoadingScheme = (scheme: any): scheme is Loading.Scheme => {\n return isString(scheme) && toPascalCase(scheme) in Loading\n}\n"],"mappings":";;;;;;;AAKA,MAAa,uBACX,WACoC;AAUpC,iCAPIA,wFAAqB,OAAO,GAI9B,CAAC,OAAO,CACT;;AAKH,MAAa,uBACX,WACoC;AACpC,QAAOA,wFAAqB,OAAO;;AAMrC,MAAa,mBAAmB,WAA0C;AACxE,wDAAgB,OAAO,wDAAiB,OAAO,IAAIA"}