@grucloud/bau-ui 0.48.0 → 0.49.0
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.
- package/package.json +4 -4
- package/skeleton/index.d.ts +10 -0
- package/skeleton/index.js +1 -0
- package/skeleton/skeleton.js +63 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grucloud/bau-ui",
|
|
3
3
|
"description": "Components library built with Bau",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.49.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD",
|
|
7
7
|
"keywords": [
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"directory": "bau-ui"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@grucloud/bau": "^0.
|
|
24
|
-
"@grucloud/bau-css": "^0.
|
|
23
|
+
"@grucloud/bau": "^0.49.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.49.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "e2ae7c556efa95e6c178f948d139ec889bc3e413"
|
|
30
30
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/skeleton" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type SkeletonProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<SkeletonProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./skeleton";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
|
|
4
|
+
export default function (context, options = {}) {
|
|
5
|
+
const { bau, css, keyframes } = context;
|
|
6
|
+
const { div } = bau.tags;
|
|
7
|
+
|
|
8
|
+
const opacityKeyFrame = keyframes`
|
|
9
|
+
0% {
|
|
10
|
+
transform: translateX(-100%);
|
|
11
|
+
}
|
|
12
|
+
50% {
|
|
13
|
+
transform: translateX(100%);
|
|
14
|
+
}
|
|
15
|
+
100% {
|
|
16
|
+
transform: translateX(100%);
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const className = css`
|
|
21
|
+
background-color: var(--color-emphasis-200);
|
|
22
|
+
position: relative;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
&::after {
|
|
25
|
+
animation: 2s linear 0.5s infinite normal none running ${opacityKeyFrame};
|
|
26
|
+
background: linear-gradient(
|
|
27
|
+
90deg,
|
|
28
|
+
transparent,
|
|
29
|
+
rgba(255, 255, 255, 0.4),
|
|
30
|
+
transparent
|
|
31
|
+
);
|
|
32
|
+
content: "";
|
|
33
|
+
position: absolute;
|
|
34
|
+
transform: translateX(-100%);
|
|
35
|
+
inset: 0px;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
return function Skeleton(...args) {
|
|
40
|
+
let [
|
|
41
|
+
{
|
|
42
|
+
size = options.size ?? "md",
|
|
43
|
+
variant = options.variant ?? "plain",
|
|
44
|
+
color = options.color ?? "neutral",
|
|
45
|
+
...props
|
|
46
|
+
},
|
|
47
|
+
...children
|
|
48
|
+
] = toPropsAndChildren(args);
|
|
49
|
+
return div(
|
|
50
|
+
{
|
|
51
|
+
...props,
|
|
52
|
+
class: classNames(
|
|
53
|
+
"skeleton",
|
|
54
|
+
size,
|
|
55
|
+
className,
|
|
56
|
+
options?.class,
|
|
57
|
+
props?.class
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
...children
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
}
|