singularity-components 0.1.132 → 0.1.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { BaseImageProps } from '../providers/ImageContext.js';
|
|
3
|
+
import 'react';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
type Props = {
|
|
6
|
+
showDefaultImage?: boolean;
|
|
7
|
+
} & BaseImageProps;
|
|
8
|
+
declare function UiImage({ showDefaultImage, ...props }: Props): react_jsx_runtime.JSX.Element;
|
|
5
9
|
|
|
6
10
|
export { UiImage };
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
4
|
import {
|
|
5
5
|
DefaultImage,
|
|
6
6
|
useImage
|
|
7
7
|
} from "../providers/ImageContext";
|
|
8
|
-
|
|
8
|
+
import { Skeleton } from "./skeleton/skeleton";
|
|
9
|
+
function UiImage({ showDefaultImage = true, ...props }) {
|
|
9
10
|
const [isClient, setIsClient] = useState(false);
|
|
10
11
|
const ImageComponent = useImage();
|
|
11
12
|
useEffect(() => {
|
|
12
13
|
setIsClient(true);
|
|
13
14
|
}, []);
|
|
14
15
|
if (!isClient) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
if (showDefaultImage) {
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
DefaultImage,
|
|
19
|
+
{
|
|
20
|
+
src: props.src,
|
|
21
|
+
alt: props.alt,
|
|
22
|
+
className: props.className
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
} else {
|
|
26
|
+
return /* @__PURE__ */ jsx(Skeleton, {});
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
return /* @__PURE__ */ jsx(ImageComponent, { ...props });
|
|
25
|
-
}
|
|
30
|
+
}
|
|
26
31
|
export {
|
|
27
32
|
UiImage
|
|
28
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/primitives/ui-image.tsx"],"sourcesContent":["\"use client\";\r\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/components/primitives/ui-image.tsx"],"sourcesContent":["\"use client\";\r\nimport { useEffect, useState } from \"react\";\r\nimport {\r\n DefaultImage,\r\n useImage,\r\n type BaseImageProps,\r\n} from \"../providers/ImageContext\";\r\nimport { Skeleton } from \"./skeleton/skeleton\";\r\n\r\ntype Props = {\r\n showDefaultImage?: boolean;\r\n} & BaseImageProps;\r\n\r\nexport function UiImage({ showDefaultImage = true, ...props }: Props) {\r\n const [isClient, setIsClient] = useState(false);\r\n const ImageComponent = useImage();\r\n\r\n useEffect(() => {\r\n setIsClient(true);\r\n }, []);\r\n\r\n if (!isClient) {\r\n if (showDefaultImage) {\r\n return (\r\n <DefaultImage\r\n src={props.src}\r\n alt={props.alt}\r\n className={props.className}\r\n />\r\n );\r\n } else {\r\n return <Skeleton />;\r\n }\r\n }\r\n\r\n return <ImageComponent {...props} />;\r\n}\r\n"],"mappings":";AAwBQ;AAvBR,SAAS,WAAW,gBAAgB;AACpC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,gBAAgB;AAMlB,SAAS,QAAQ,EAAE,mBAAmB,MAAM,GAAG,MAAM,GAAU;AACpE,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,iBAAiB,SAAS;AAEhC,YAAU,MAAM;AACd,gBAAY,IAAI;AAAA,EAClB,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC,UAAU;AACb,QAAI,kBAAkB;AACpB,aACE;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,MAAM;AAAA,UACX,KAAK,MAAM;AAAA,UACX,WAAW,MAAM;AAAA;AAAA,MACnB;AAAA,IAEJ,OAAO;AACL,aAAO,oBAAC,YAAS;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,oBAAC,kBAAgB,GAAG,OAAO;AACpC;","names":[]}
|