@skel-ui/react 0.1.2 → 0.3.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/README.md +1 -1
- package/dist/cjs/index.js +13 -5
- package/dist/esm/index.js +13 -5
- package/dist/index.d.ts +4 -3
- package/dist/styles.css +27 -4
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Each `Skel.Item` will have a `data-loading` attribute that is set to `"true"` wh
|
|
|
63
63
|
width: 5rem;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/* This style will be applied after loading is
|
|
66
|
+
/* This style will be applied after loading is done. */
|
|
67
67
|
.user-email[data-loading="false"]:hover {
|
|
68
68
|
background: #f97316;
|
|
69
69
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -39,7 +39,15 @@ function Root({ as, isLoading = true, children, ...rest }) {
|
|
|
39
39
|
const Component = as || "div";
|
|
40
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 }) });
|
|
41
41
|
}
|
|
42
|
-
function Item({
|
|
42
|
+
function Item({
|
|
43
|
+
as,
|
|
44
|
+
color,
|
|
45
|
+
width,
|
|
46
|
+
height,
|
|
47
|
+
radius,
|
|
48
|
+
children,
|
|
49
|
+
...rest
|
|
50
|
+
}) {
|
|
43
51
|
const isLoading = import_react.default.useContext(IsLoadingContext);
|
|
44
52
|
const component = as || "p";
|
|
45
53
|
const Component = typeof component === "string" ? component : isLoading ? "div" : component;
|
|
@@ -48,19 +56,19 @@ function Item({ as, color, radius, children, ...rest }) {
|
|
|
48
56
|
{
|
|
49
57
|
...rest,
|
|
50
58
|
style: {
|
|
51
|
-
// @ts-ignore
|
|
52
59
|
...rest.style,
|
|
53
|
-
"--skel-ui-
|
|
60
|
+
"--skel-ui-width": width,
|
|
61
|
+
"--skel-ui-height": height,
|
|
54
62
|
"--skel-ui-radius": radius
|
|
55
63
|
},
|
|
56
64
|
"data-loading": isLoading,
|
|
57
65
|
"data-skel-item": true,
|
|
58
|
-
children: isLoading ? "\u200C" : typeof children === "function" ? children() : children
|
|
66
|
+
children: isLoading ? " \u200C " : typeof children === "function" ? children() : children
|
|
59
67
|
}
|
|
60
68
|
);
|
|
61
69
|
}
|
|
62
70
|
function generatePlaceholder(length, primary) {
|
|
63
|
-
return Array(length).fill(null).map((_, index) => ({ [primary]: `id-${index}` }));
|
|
71
|
+
return Array(length).fill(null).map((_, index) => ({ [primary]: `skel-ui-id-${index}` }));
|
|
64
72
|
}
|
|
65
73
|
const Skel = { Root, Item };
|
|
66
74
|
var src_default = Skel;
|
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,15 @@ function Root({ as, isLoading = true, children, ...rest }) {
|
|
|
5
5
|
const Component = as || "div";
|
|
6
6
|
return /* @__PURE__ */ jsx(IsLoadingContext.Provider, { value: isLoading, children: /* @__PURE__ */ jsx(Component, { ...rest, "data-loading": isLoading, children }) });
|
|
7
7
|
}
|
|
8
|
-
function Item({
|
|
8
|
+
function Item({
|
|
9
|
+
as,
|
|
10
|
+
color,
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
radius,
|
|
14
|
+
children,
|
|
15
|
+
...rest
|
|
16
|
+
}) {
|
|
9
17
|
const isLoading = React.useContext(IsLoadingContext);
|
|
10
18
|
const component = as || "p";
|
|
11
19
|
const Component = typeof component === "string" ? component : isLoading ? "div" : component;
|
|
@@ -14,19 +22,19 @@ function Item({ as, color, radius, children, ...rest }) {
|
|
|
14
22
|
{
|
|
15
23
|
...rest,
|
|
16
24
|
style: {
|
|
17
|
-
// @ts-ignore
|
|
18
25
|
...rest.style,
|
|
19
|
-
"--skel-ui-
|
|
26
|
+
"--skel-ui-width": width,
|
|
27
|
+
"--skel-ui-height": height,
|
|
20
28
|
"--skel-ui-radius": radius
|
|
21
29
|
},
|
|
22
30
|
"data-loading": isLoading,
|
|
23
31
|
"data-skel-item": true,
|
|
24
|
-
children: isLoading ? "\u200C" : typeof children === "function" ? children() : children
|
|
32
|
+
children: isLoading ? " \u200C " : typeof children === "function" ? children() : children
|
|
25
33
|
}
|
|
26
34
|
);
|
|
27
35
|
}
|
|
28
36
|
function generatePlaceholder(length, primary) {
|
|
29
|
-
return Array(length).fill(null).map((_, index) => ({ [primary]: `id-${index}` }));
|
|
37
|
+
return Array(length).fill(null).map((_, index) => ({ [primary]: `skel-ui-id-${index}` }));
|
|
30
38
|
}
|
|
31
39
|
const Skel = { Root, Item };
|
|
32
40
|
var src_default = Skel;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,12 +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
|
-
|
|
10
|
+
width?: string;
|
|
11
|
+
height?: string;
|
|
11
12
|
radius?: string;
|
|
12
13
|
children?: React.ReactNode | (() => React.ReactNode);
|
|
13
14
|
} & HTMLProps<T>;
|
|
14
|
-
declare function Root<T extends React.ElementType = "div">({ as, isLoading, children, ...rest }: RootProps<T>):
|
|
15
|
-
declare function Item<T extends React.ElementType = "p">({ as, color, radius, children, ...rest }: ItemProps<T>):
|
|
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, color, width, height, radius, children, ...rest }: ItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export declare function generatePlaceholder<T = {
|
|
17
18
|
[k: string]: unknown;
|
|
18
19
|
}>(length: number, primary: string): T[];
|
package/dist/styles.css
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--skel-ui-color: #cbd5e1;
|
|
3
|
+
--skel-ui-shimmer: #f1f0f0;
|
|
3
4
|
--skel-ui-radius: 0.25rem;
|
|
4
5
|
}
|
|
5
6
|
[data-skel-item][data-loading=true] {
|
|
7
|
+
animation: skel-ui-shimmer 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
|
|
8
|
+
background:
|
|
9
|
+
linear-gradient(
|
|
10
|
+
to right,
|
|
11
|
+
var(--skel-ui-color) 33%,
|
|
12
|
+
var(--skel-ui-shimmer),
|
|
13
|
+
var(--skel-ui-color) 66%);
|
|
14
|
+
background-size: 300%;
|
|
15
|
+
width: var(--skel-ui-width);
|
|
16
|
+
height: var(--skel-ui-height);
|
|
6
17
|
border-radius: var(--skel-ui-radius);
|
|
7
|
-
background-color: var(--skel-ui-color) !important;
|
|
8
|
-
color: transparent !important;
|
|
9
18
|
cursor: default !important;
|
|
10
19
|
user-select: none !important;
|
|
11
20
|
pointer-events: none !important;
|
|
12
|
-
|
|
21
|
+
}
|
|
22
|
+
.skel-ui-pluse [data-skel-item][data-loading=true] {
|
|
23
|
+
animation: skel-ui-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
|
|
24
|
+
background-color: var(--skel-ui-color) !important;
|
|
13
25
|
}
|
|
14
26
|
@keyframes skel-ui-pulse {
|
|
15
27
|
0% {
|
|
16
28
|
opacity: 1;
|
|
17
29
|
}
|
|
18
|
-
|
|
30
|
+
50% {
|
|
19
31
|
opacity: 0.5;
|
|
20
32
|
}
|
|
33
|
+
100% {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
@keyframes skel-ui-shimmer {
|
|
38
|
+
0% {
|
|
39
|
+
background-position: 100%;
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
background-position: 0%;
|
|
43
|
+
}
|
|
21
44
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skel-ui/react",
|
|
3
3
|
"author": "https://github.com/sudoaugustin",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Next era of skeleton loading for React",
|
|
7
7
|
"files": [
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"import": "./dist/esm/tailwind.js",
|
|
28
28
|
"require": "./dist/cjs/tailwind.js"
|
|
29
29
|
},
|
|
30
|
-
"./styles.css": "./dist/styles.css"
|
|
30
|
+
"./styles.css": "./dist/styles.css",
|
|
31
|
+
"./$components": "./stories/components/index.tsx"
|
|
31
32
|
},
|
|
32
33
|
"bugs": {
|
|
33
34
|
"url": "https://github.com/sudoaugustin/skel-ui/issues"
|
|
@@ -39,21 +40,21 @@
|
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@chromatic-com/storybook": "^1.9.0",
|
|
42
|
-
"@
|
|
43
|
-
"@storybook/addon-
|
|
44
|
-
"@storybook/addon-
|
|
45
|
-
"@storybook/addon-
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/
|
|
48
|
-
"@storybook/react
|
|
49
|
-
"@storybook/
|
|
50
|
-
"@
|
|
51
|
-
"@types/react
|
|
43
|
+
"@heroicons/react": "^2.1.5",
|
|
44
|
+
"@storybook/addon-essentials": "^8.3.4",
|
|
45
|
+
"@storybook/addon-interactions": "^8.3.4",
|
|
46
|
+
"@storybook/addon-links": "^8.3.4",
|
|
47
|
+
"@storybook/addon-onboarding": "^8.3.4",
|
|
48
|
+
"@storybook/blocks": "^8.3.4",
|
|
49
|
+
"@storybook/react": "^8.3.4",
|
|
50
|
+
"@storybook/react-vite": "^8.3.4",
|
|
51
|
+
"@storybook/test": "^8.3.4",
|
|
52
|
+
"@types/react": "^18.2.0",
|
|
53
|
+
"@types/react-dom": "^18.2.0",
|
|
52
54
|
"esbuild": "^0.24.0",
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
55
|
-
"storybook": "^8.3.
|
|
56
|
-
"swr": "^2.2.5",
|
|
55
|
+
"react": "^18.3.1",
|
|
56
|
+
"react-dom": "^18.3.1",
|
|
57
|
+
"storybook": "^8.3.4",
|
|
57
58
|
"tailwindcss": "^3.4.13",
|
|
58
59
|
"typescript": "^5.6.2"
|
|
59
60
|
},
|