@syscore/ui-library 2.0.0-beta-publish-workflow-beta.24 → 2.0.0-beta-publish-workflow-beta.25
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,12 +1,30 @@
|
|
|
1
1
|
import { cn } from "@/lib/utils";
|
|
2
2
|
|
|
3
|
+
export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Exact width: px when a number, any CSS length when a string (e.g. "60%"). Omit to fill the parent. */
|
|
5
|
+
width?: number | string;
|
|
6
|
+
/** Exact height: px when a number, any CSS length when a string. Omit for the "text" shape's 1-line default. */
|
|
7
|
+
height?: number | string;
|
|
8
|
+
/** "text" (default, a line of copy) | "circle" (avatar/icon) | "rect" (image/media block) */
|
|
9
|
+
shape?: "text" | "circle" | "rect";
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
function Skeleton({
|
|
4
13
|
className,
|
|
14
|
+
width,
|
|
15
|
+
height,
|
|
16
|
+
shape = "text",
|
|
17
|
+
style,
|
|
5
18
|
...props
|
|
6
|
-
}:
|
|
19
|
+
}: SkeletonProps) {
|
|
7
20
|
return (
|
|
8
21
|
<div
|
|
9
|
-
className={cn("skeleton", className)}
|
|
22
|
+
className={cn("skeleton", `skeleton--${shape}`, className)}
|
|
23
|
+
style={{
|
|
24
|
+
...style,
|
|
25
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
26
|
+
height: typeof height === "number" ? `${height}px` : height,
|
|
27
|
+
}}
|
|
10
28
|
{...props}
|
|
11
29
|
/>
|
|
12
30
|
);
|
package/client/global.css
CHANGED
|
@@ -1660,11 +1660,25 @@ body {
|
|
|
1660
1660
|
|
|
1661
1661
|
/* Skeleton Styles */
|
|
1662
1662
|
.skeleton {
|
|
1663
|
+
display: block;
|
|
1664
|
+
width: 100%;
|
|
1663
1665
|
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
1664
|
-
border-radius: calc(var(--radius-md, 8px));
|
|
1665
1666
|
background-color: hsl(var(--muted));
|
|
1666
1667
|
}
|
|
1667
1668
|
|
|
1669
|
+
.skeleton--text {
|
|
1670
|
+
height: 1em;
|
|
1671
|
+
border-radius: calc(var(--radius-sm, 4px));
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
.skeleton--rect {
|
|
1675
|
+
border-radius: calc(var(--radius-md, 8px));
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
.skeleton--circle {
|
|
1679
|
+
border-radius: 9999px;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1668
1682
|
@keyframes pulse {
|
|
1669
1683
|
0%,
|
|
1670
1684
|
100% {
|
|
@@ -2,12 +2,21 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from "../../lib/utils.js";
|
|
3
3
|
function Skeleton({
|
|
4
4
|
className,
|
|
5
|
+
width,
|
|
6
|
+
height,
|
|
7
|
+
shape = "text",
|
|
8
|
+
style,
|
|
5
9
|
...props
|
|
6
10
|
}) {
|
|
7
11
|
return /* @__PURE__ */ jsx(
|
|
8
12
|
"div",
|
|
9
13
|
{
|
|
10
|
-
className: cn("skeleton", className),
|
|
14
|
+
className: cn("skeleton", `skeleton--${shape}`, className),
|
|
15
|
+
style: {
|
|
16
|
+
...style,
|
|
17
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
18
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
19
|
+
},
|
|
11
20
|
...props
|
|
12
21
|
}
|
|
13
22
|
);
|