@skel-ui/react 0.3.0 → 0.4.0-alpha.875bb65
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/README.md +2 -2
- package/dist/cjs/index.js +5 -12
- package/dist/esm/index.js +5 -12
- package/dist/index.d.ts +3 -3
- package/dist/styles.css +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Now you are ready to develop your UI.
|
|
|
24
24
|
|
|
25
25
|
```jsx
|
|
26
26
|
import Skel from "@skel-ui/react";
|
|
27
|
-
import Image from "next/
|
|
27
|
+
import Image from "next/image";
|
|
28
28
|
|
|
29
29
|
function Profile() {
|
|
30
30
|
const { user, isLoading } = useProfile();
|
|
@@ -50,7 +50,7 @@ Customize the default color and border-radius of skeleton using css variables.
|
|
|
50
50
|
|
|
51
51
|
```css title="global.css"
|
|
52
52
|
:root {
|
|
53
|
-
--skel-ui-
|
|
53
|
+
--skel-ui-color1: #cbd5e1;
|
|
54
54
|
--skel-ui-radius: 0.5rem;
|
|
55
55
|
}
|
|
56
56
|
```
|
package/dist/cjs/index.js
CHANGED
|
@@ -37,17 +37,9 @@ var import_react = __toESM(require("react"));
|
|
|
37
37
|
const IsLoadingContext = import_react.default.createContext(false);
|
|
38
38
|
function Root({ as, isLoading = true, children, ...rest }) {
|
|
39
39
|
const Component = as || "div";
|
|
40
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IsLoadingContext.Provider, { value: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...rest, "data-loading": isLoading, children }) });
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IsLoadingContext.Provider, { value: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...rest, "aria-hidden": isLoading, "data-loading": isLoading, children }) });
|
|
41
41
|
}
|
|
42
|
-
function Item({
|
|
43
|
-
as,
|
|
44
|
-
color,
|
|
45
|
-
width,
|
|
46
|
-
height,
|
|
47
|
-
radius,
|
|
48
|
-
children,
|
|
49
|
-
...rest
|
|
50
|
-
}) {
|
|
42
|
+
function Item({ as, sw, sh, color, radius, children, ...rest }) {
|
|
51
43
|
const isLoading = import_react.default.useContext(IsLoadingContext);
|
|
52
44
|
const component = as || "p";
|
|
53
45
|
const Component = typeof component === "string" ? component : isLoading ? "div" : component;
|
|
@@ -57,10 +49,11 @@ function Item({
|
|
|
57
49
|
...rest,
|
|
58
50
|
style: {
|
|
59
51
|
...rest.style,
|
|
60
|
-
"--skel-ui-width":
|
|
61
|
-
"--skel-ui-height":
|
|
52
|
+
"--skel-ui-width": sw,
|
|
53
|
+
"--skel-ui-height": sh,
|
|
62
54
|
"--skel-ui-radius": radius
|
|
63
55
|
},
|
|
56
|
+
"aria-hidden": isLoading,
|
|
64
57
|
"data-loading": isLoading,
|
|
65
58
|
"data-skel-item": true,
|
|
66
59
|
children: isLoading ? " \u200C " : typeof children === "function" ? children() : children
|
package/dist/esm/index.js
CHANGED
|
@@ -3,17 +3,9 @@ import React from "react";
|
|
|
3
3
|
const IsLoadingContext = React.createContext(false);
|
|
4
4
|
function Root({ as, isLoading = true, children, ...rest }) {
|
|
5
5
|
const Component = as || "div";
|
|
6
|
-
return /* @__PURE__ */ jsx(IsLoadingContext.Provider, { value: isLoading, children: /* @__PURE__ */ jsx(Component, { ...rest, "data-loading": isLoading, children }) });
|
|
6
|
+
return /* @__PURE__ */ jsx(IsLoadingContext.Provider, { value: isLoading, children: /* @__PURE__ */ jsx(Component, { ...rest, "aria-hidden": isLoading, "data-loading": isLoading, children }) });
|
|
7
7
|
}
|
|
8
|
-
function Item({
|
|
9
|
-
as,
|
|
10
|
-
color,
|
|
11
|
-
width,
|
|
12
|
-
height,
|
|
13
|
-
radius,
|
|
14
|
-
children,
|
|
15
|
-
...rest
|
|
16
|
-
}) {
|
|
8
|
+
function Item({ as, sw, sh, color, radius, children, ...rest }) {
|
|
17
9
|
const isLoading = React.useContext(IsLoadingContext);
|
|
18
10
|
const component = as || "p";
|
|
19
11
|
const Component = typeof component === "string" ? component : isLoading ? "div" : component;
|
|
@@ -23,10 +15,11 @@ function Item({
|
|
|
23
15
|
...rest,
|
|
24
16
|
style: {
|
|
25
17
|
...rest.style,
|
|
26
|
-
"--skel-ui-width":
|
|
27
|
-
"--skel-ui-height":
|
|
18
|
+
"--skel-ui-width": sw,
|
|
19
|
+
"--skel-ui-height": sh,
|
|
28
20
|
"--skel-ui-radius": radius
|
|
29
21
|
},
|
|
22
|
+
"aria-hidden": isLoading,
|
|
30
23
|
"data-loading": isLoading,
|
|
31
24
|
"data-skel-item": true,
|
|
32
25
|
children: isLoading ? " \u200C " : typeof children === "function" ? children() : children
|
package/dist/index.d.ts
CHANGED
|
@@ -7,13 +7,13 @@ type RootProps<T extends React.ElementType = "div"> = {
|
|
|
7
7
|
} & HTMLProps<T>;
|
|
8
8
|
type ItemProps<T extends React.ElementType = "p"> = {
|
|
9
9
|
as?: T;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
sw?: string;
|
|
11
|
+
sh?: string;
|
|
12
12
|
radius?: string;
|
|
13
13
|
children?: React.ReactNode | (() => React.ReactNode);
|
|
14
14
|
} & HTMLProps<T>;
|
|
15
15
|
declare function Root<T extends React.ElementType = "div">({ as, isLoading, children, ...rest }: RootProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
declare function Item<T extends React.ElementType = "p">({ as,
|
|
16
|
+
declare function Item<T extends React.ElementType = "p">({ as, sw, sh, color, radius, children, ...rest }: ItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export declare function generatePlaceholder<T = {
|
|
18
18
|
[k: string]: unknown;
|
|
19
19
|
}>(length: number, primary: string): T[];
|
package/dist/styles.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--skel-ui-
|
|
3
|
-
--skel-ui-
|
|
2
|
+
--skel-ui-color1: #cbd5e1;
|
|
3
|
+
--skel-ui-color2: #f1f0f0;
|
|
4
4
|
--skel-ui-radius: 0.25rem;
|
|
5
5
|
}
|
|
6
6
|
[data-skel-item][data-loading=true] {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
background:
|
|
9
9
|
linear-gradient(
|
|
10
10
|
to right,
|
|
11
|
-
var(--skel-ui-
|
|
12
|
-
var(--skel-ui-
|
|
13
|
-
var(--skel-ui-
|
|
11
|
+
var(--skel-ui-color1) 33%,
|
|
12
|
+
var(--skel-ui-color2),
|
|
13
|
+
var(--skel-ui-color1) 66%);
|
|
14
14
|
background-size: 300%;
|
|
15
15
|
width: var(--skel-ui-width);
|
|
16
16
|
height: var(--skel-ui-height);
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
user-select: none !important;
|
|
20
20
|
pointer-events: none !important;
|
|
21
21
|
}
|
|
22
|
-
.skel-ui-
|
|
22
|
+
.skel-ui-pulse [data-skel-item][data-loading=true] {
|
|
23
23
|
animation: skel-ui-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
|
|
24
|
-
background-color: var(--skel-ui-
|
|
24
|
+
background-color: var(--skel-ui-color1) !important;
|
|
25
25
|
}
|
|
26
26
|
@keyframes skel-ui-pulse {
|
|
27
27
|
0% {
|
|
28
28
|
opacity: 1;
|
|
29
29
|
}
|
|
30
30
|
50% {
|
|
31
|
-
opacity: 0.
|
|
31
|
+
opacity: 0.25;
|
|
32
32
|
}
|
|
33
33
|
100% {
|
|
34
34
|
opacity: 1;
|