@kakadu/components 3.10.1 → 3.11.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.
|
@@ -11,9 +11,10 @@ type SkeletonProperties = {
|
|
|
11
11
|
readonly isAnimated?: boolean;
|
|
12
12
|
} & HTMLAttributes<HTMLDivElement>;
|
|
13
13
|
export declare function SkeletonInstance({ label, width, height, className, children, isAnimated, ...parameters }: SkeletonProperties): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export default function Skeleton({ label, lines, isAnimated, }: {
|
|
14
|
+
export default function Skeleton({ label, lines, isDeterministic, isAnimated, }: {
|
|
15
15
|
readonly label?: string;
|
|
16
16
|
readonly lines?: number;
|
|
17
|
+
readonly isDeterministic?: boolean;
|
|
17
18
|
readonly isAnimated?: boolean;
|
|
18
19
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
19
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),x=require("react"),l=require("@kuma-ui/core");function c(o,e,{minimum:t,maximum:s}){const a=o*374761393+e*668265263+2147483647,u=Math.imul(a,1274126177),r=s-t+1;return t+Math.abs(u)%r}function i({label:o,width:e,height:t,className:s,children:a,isAnimated:u=!0,...r}){return n.jsxRuntimeExports.jsx("span",{...r,"aria-label":o,className:l.cx("kakadu-components-4254676273",u&&"kakadu-components-574297718",s),style:{width:e,height:t},children:a??n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:" "})})}const m="kakadu-components-3140855657";function h({label:o,lines:e=1,isDeterministic:t=!1,isAnimated:s=!0}){const a=x.useMemo(()=>{const u=[];if(e<=1)return u;for(let r=1;r<e;r+=1)u.push(n.jsxRuntimeExports.jsx(i,{"aria-hidden":!0,width:t?`${c(r,e,{minimum:90,maximum:100})}%`:"100%",height:"1em",isAnimated:s,className:m},r));return u},[e,t,s]);return e<1?null:e===1?n.jsxRuntimeExports.jsx(i,{"aria-busy":!0,label:o,width:"100%",height:"1em",isAnimated:s,role:"status",className:m}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[a,n.jsxRuntimeExports.jsx(i,{"aria-busy":!0,label:o,width:t?`${c(e,e,{minimum:50,maximum:60})}%`:"60%",height:"1em",isAnimated:s,role:"status",className:m})]})}exports.SkeletonInstance=i;exports.default=h;exports.getDeterministicSkeletonWidth=c;
|
|
@@ -1,48 +1,55 @@
|
|
|
1
1
|
import { j as s } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { cx as
|
|
4
|
-
function
|
|
2
|
+
import { useMemo as l } from "react";
|
|
3
|
+
import { cx as i } from "@kuma-ui/core";
|
|
4
|
+
function h(o, t, {
|
|
5
5
|
minimum: e,
|
|
6
|
-
maximum:
|
|
6
|
+
maximum: r
|
|
7
7
|
}) {
|
|
8
|
-
const
|
|
9
|
-
return e + Math.abs(n) %
|
|
8
|
+
const u = o * 374761393 + t * 668265263 + 2147483647, n = Math.imul(u, 1274126177), a = r - e + 1;
|
|
9
|
+
return e + Math.abs(n) % a;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
label:
|
|
11
|
+
function m({
|
|
12
|
+
label: o,
|
|
13
13
|
width: t,
|
|
14
14
|
height: e,
|
|
15
|
-
className:
|
|
16
|
-
children:
|
|
15
|
+
className: r,
|
|
16
|
+
children: u,
|
|
17
17
|
isAnimated: n = !0,
|
|
18
|
-
...
|
|
18
|
+
...a
|
|
19
19
|
}) {
|
|
20
|
-
return /* @__PURE__ */ s.jsx("span", { ...
|
|
20
|
+
return /* @__PURE__ */ s.jsx("span", { ...a, "aria-label": o, className: i("kakadu-components-4254676273", n && "kakadu-components-574297718", r), style: {
|
|
21
21
|
width: t,
|
|
22
22
|
height: e
|
|
23
|
-
}, children:
|
|
23
|
+
}, children: u ?? /* @__PURE__ */ s.jsx(s.Fragment, { children: " " }) });
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
function
|
|
27
|
-
label:
|
|
25
|
+
const c = "kakadu-components-3140855657";
|
|
26
|
+
function k({
|
|
27
|
+
label: o,
|
|
28
28
|
lines: t = 1,
|
|
29
|
-
|
|
29
|
+
isDeterministic: e = !1,
|
|
30
|
+
isAnimated: r = !0
|
|
30
31
|
}) {
|
|
31
|
-
const
|
|
32
|
-
const
|
|
32
|
+
const u = l(() => {
|
|
33
|
+
const n = [];
|
|
33
34
|
if (t <= 1)
|
|
34
|
-
return
|
|
35
|
-
for (let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
return n;
|
|
36
|
+
for (let a = 1; a < t; a += 1)
|
|
37
|
+
n.push(/* @__PURE__ */ s.jsx(m, { "aria-hidden": !0, width: e ? `${h(a, t, {
|
|
38
|
+
minimum: 90,
|
|
39
|
+
maximum: 100
|
|
40
|
+
})}%` : "100%", height: "1em", isAnimated: r, className: c }, a));
|
|
41
|
+
return n;
|
|
42
|
+
}, [t, e, r]);
|
|
43
|
+
return t < 1 ? null : t === 1 ? /* @__PURE__ */ s.jsx(m, { "aria-busy": !0, label: o, width: "100%", height: "1em", isAnimated: r, role: "status", className: c }) : /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
44
|
+
u,
|
|
45
|
+
/* @__PURE__ */ s.jsx(m, { "aria-busy": !0, label: o, width: e ? `${h(t, t, {
|
|
46
|
+
minimum: 50,
|
|
47
|
+
maximum: 60
|
|
48
|
+
})}%` : "60%", height: "1em", isAnimated: r, role: "status", className: c })
|
|
42
49
|
] });
|
|
43
50
|
}
|
|
44
51
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
m as SkeletonInstance,
|
|
53
|
+
k as default,
|
|
54
|
+
h as getDeterministicSkeletonWidth
|
|
48
55
|
};
|