@skel-ui/react 0.1.1 → 0.1.2
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/dist/cjs/index.js +17 -11
- package/dist/esm/index.js +17 -11
- package/dist/styles.css +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -32,26 +32,32 @@ __export(src_exports, {
|
|
|
32
32
|
generatePlaceholder: () => generatePlaceholder
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_react = __toESM(require("react"));
|
|
36
37
|
const IsLoadingContext = import_react.default.createContext(false);
|
|
37
38
|
function Root({ as, isLoading = true, children, ...rest }) {
|
|
38
39
|
const Component = as || "div";
|
|
39
|
-
return
|
|
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
41
|
}
|
|
41
42
|
function Item({ as, color, radius, children, ...rest }) {
|
|
42
43
|
const isLoading = import_react.default.useContext(IsLoadingContext);
|
|
43
44
|
const component = as || "p";
|
|
44
45
|
const Component = typeof component === "string" ? component : isLoading ? "div" : component;
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
Component,
|
|
48
|
+
{
|
|
49
|
+
...rest,
|
|
50
|
+
style: {
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
...rest.style,
|
|
53
|
+
"--skel-ui-color": color,
|
|
54
|
+
"--skel-ui-radius": radius
|
|
55
|
+
},
|
|
56
|
+
"data-loading": isLoading,
|
|
57
|
+
"data-skel-item": true,
|
|
58
|
+
children: isLoading ? "\u200C" : typeof children === "function" ? children() : children
|
|
59
|
+
}
|
|
60
|
+
);
|
|
55
61
|
}
|
|
56
62
|
function generatePlaceholder(length, primary) {
|
|
57
63
|
return Array(length).fill(null).map((_, index) => ({ [primary]: `id-${index}` }));
|
package/dist/esm/index.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
const IsLoadingContext = React.createContext(false);
|
|
3
4
|
function Root({ as, isLoading = true, children, ...rest }) {
|
|
4
5
|
const Component = as || "div";
|
|
5
|
-
return
|
|
6
|
+
return /* @__PURE__ */ jsx(IsLoadingContext.Provider, { value: isLoading, children: /* @__PURE__ */ jsx(Component, { ...rest, "data-loading": isLoading, children }) });
|
|
6
7
|
}
|
|
7
8
|
function Item({ as, color, radius, children, ...rest }) {
|
|
8
9
|
const isLoading = React.useContext(IsLoadingContext);
|
|
9
10
|
const component = as || "p";
|
|
10
11
|
const Component = typeof component === "string" ? component : isLoading ? "div" : component;
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Component,
|
|
14
|
+
{
|
|
15
|
+
...rest,
|
|
16
|
+
style: {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
...rest.style,
|
|
19
|
+
"--skel-ui-color": color,
|
|
20
|
+
"--skel-ui-radius": radius
|
|
21
|
+
},
|
|
22
|
+
"data-loading": isLoading,
|
|
23
|
+
"data-skel-item": true,
|
|
24
|
+
children: isLoading ? "\u200C" : typeof children === "function" ? children() : children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
21
27
|
}
|
|
22
28
|
function generatePlaceholder(length, primary) {
|
|
23
29
|
return Array(length).fill(null).map((_, index) => ({ [primary]: `id-${index}` }));
|
package/dist/styles.css
CHANGED
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.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Next era of skeleton loading for React",
|
|
7
7
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@storybook/test": "^8.3.3",
|
|
50
50
|
"@types/react": "^18.3.9",
|
|
51
51
|
"@types/react-dom": "^18.0.10",
|
|
52
|
-
"esbuild": "^0.
|
|
52
|
+
"esbuild": "^0.24.0",
|
|
53
53
|
"react": "^17.0.0",
|
|
54
54
|
"react-dom": "^17.0.0",
|
|
55
55
|
"storybook": "^8.3.3",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"build": "rm -rf dist && pnpm build:dts && pnpm build:css && pnpm build:esm && pnpm build:cjs",
|
|
67
67
|
"build:dts": "tsc -p tsconfig.build.json --outDir dist",
|
|
68
68
|
"build:css": "esbuild src/styles.css --outdir=dist",
|
|
69
|
-
"build:esm": "esbuild src/*.ts* --format=esm --outdir=dist/esm",
|
|
70
|
-
"build:cjs": "esbuild src/*.ts* --format=cjs --outdir=dist/cjs"
|
|
69
|
+
"build:esm": "esbuild src/*.ts* --jsx=automatic --format=esm --outdir=dist/esm",
|
|
70
|
+
"build:cjs": "esbuild src/*.ts* --jsx=automatic --format=cjs --outdir=dist/cjs"
|
|
71
71
|
}
|
|
72
72
|
}
|