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.63 kB
{"version":3,"file":"suspense.cjs","names":["Suspense: FC<SuspenseProps>","useLoadingComponent","OriginalSuspense","styled"],"sources":["../../../../src/components/loading/suspense.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, SuspenseProps as OriginalSuspenseProps } from \"react\"\nimport type { HTMLStyledProps, LoadingScheme } from \"../../core\"\nimport type { LoadingProps } from \"./loading\"\nimport { Suspense as OriginalSuspense } from \"react\"\nimport { styled } from \"../../core\"\nimport { useLoadingComponent } from \"./use-loading-component\"\n\nexport interface SuspenseProps extends HTMLStyledProps, OriginalSuspenseProps {\n /**\n * The loading scheme.\n */\n loadingScheme?: LoadingScheme\n /**\n * The loading props.\n */\n loadingProps?: LoadingProps\n}\n\nexport const Suspense: FC<SuspenseProps> = ({\n name,\n children,\n fallback,\n loadingScheme = \"oval\",\n loadingProps,\n ...rest\n}) => {\n const Component = useLoadingComponent(loadingScheme)\n\n return (\n <OriginalSuspense\n name={name}\n fallback={\n fallback ?? (\n <styled.div boxSize=\"full\" display=\"center\" fontSize=\"6xl\" {...rest}>\n <Component fontSize=\"1em\" {...loadingProps} />\n </styled.div>\n )\n }\n >\n {children}\n </OriginalSuspense>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAaA,YAA+B,EAC1C,MACA,UACA,UACA,gBAAgB,QAChB,aACA,GAAG,WACC;CACJ,MAAM,YAAYC,kDAAoB,cAAc;AAEpD,QACE,2CAACC;EACO;EACN,UACE,YACE,2CAACC,uBAAO;GAAI,SAAQ;GAAO,SAAQ;GAAS,UAAS;GAAM,GAAI;aAC7D,2CAAC;IAAU,UAAS;IAAM,GAAI;KAAgB;IACnC;EAIhB;GACgB"}