@kakadu/components 5.0.6 → 5.0.7
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.
|
@@ -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 m=require("../jsx-runtime-BB_1_6y_.js"),s=require("react"),v=require("@kuma-ui/core"),y=require("../hooks/use-is-in-view.js");function b({id:n,x:o,y:i,onEnd:r}){return s.useEffect(()=>{const t=setTimeout(()=>{r(n)},370);return()=>{clearTimeout(t)}},[r,n]),m.jsxRuntimeExports.jsx("div",{style:{top:i,left:o},className:"kakadu-components-3828473824"})}function g({isActive:n=!0,size:o=150,className:i,...r}){const t=s.useRef(null),u=y.default(t),[w,c]=s.useState([]);s.useEffect(()=>{if(!n||!u){c([]);return}const e=l=>{if(t.current){const d=t.current.getBoundingClientRect(),{clientX:a,clientY:f}=l,{left:x,right:k,top:p,bottom:E}=d;a>x&&a<k&&f>p&&f<E&&c(R=>[...R,{id:Date.now()+Math.random()*1e3,x:a-x,y:f-p}])}};return window.addEventListener("pointerdown",e),()=>{window.removeEventListener("pointerdown",e)}},[n,u]);const j=s.useCallback(e=>{c(l=>l.filter(d=>d.id!==e))},[]);return m.jsxRuntimeExports.jsx("div",{...r,ref:t,style:{"--size":`${o}px`},className:v.cx("kakadu-components-4189236582",i),children:u?w.map(e=>m.jsxRuntimeExports.jsx(b,{id:e.id,x:e.x,y:e.y,onEnd:j},e.id)):null})}exports.default=g;
|
|
@@ -1,63 +1,66 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cx as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { j as m } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { useRef as R, useState as h, useEffect as x, useCallback as v } from "react";
|
|
3
|
+
import { cx as C } from "@kuma-ui/core";
|
|
4
|
+
import b from "../hooks/use-is-in-view.mjs";
|
|
5
|
+
function g({
|
|
6
|
+
id: n,
|
|
6
7
|
x: r,
|
|
7
8
|
y: s,
|
|
8
9
|
onEnd: o
|
|
9
10
|
}) {
|
|
10
|
-
return
|
|
11
|
-
const
|
|
12
|
-
o(
|
|
11
|
+
return x(() => {
|
|
12
|
+
const t = setTimeout(() => {
|
|
13
|
+
o(n);
|
|
13
14
|
}, 370);
|
|
14
15
|
return () => {
|
|
15
|
-
clearTimeout(
|
|
16
|
+
clearTimeout(t);
|
|
16
17
|
};
|
|
17
|
-
}, [o,
|
|
18
|
+
}, [o, n]), /* @__PURE__ */ m.jsx("div", { style: {
|
|
18
19
|
top: s,
|
|
19
20
|
left: r
|
|
20
21
|
}, className: "kakadu-components-3828473824" });
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
isActive:
|
|
23
|
+
function V({
|
|
24
|
+
isActive: n = !0,
|
|
24
25
|
size: r = 150,
|
|
25
26
|
className: s,
|
|
26
27
|
...o
|
|
27
28
|
}) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
if (!
|
|
29
|
+
const t = R(null), i = b(t), [w, c] = h([]);
|
|
30
|
+
x(() => {
|
|
31
|
+
if (!n || !i) {
|
|
32
|
+
c([]);
|
|
31
33
|
return;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
}
|
|
35
|
+
const e = (u) => {
|
|
36
|
+
if (t.current) {
|
|
37
|
+
const l = t.current.getBoundingClientRect(), {
|
|
38
|
+
clientX: a,
|
|
39
|
+
clientY: d
|
|
40
|
+
} = u, {
|
|
41
|
+
left: f,
|
|
42
|
+
right: j,
|
|
43
|
+
top: p,
|
|
44
|
+
bottom: y
|
|
45
|
+
} = l;
|
|
46
|
+
a > f && a < j && d > p && d < y && c((E) => [...E, {
|
|
44
47
|
id: Date.now() + Math.random() * 1e3,
|
|
45
|
-
x:
|
|
46
|
-
y:
|
|
48
|
+
x: a - f,
|
|
49
|
+
y: d - p
|
|
47
50
|
}]);
|
|
48
51
|
}
|
|
49
52
|
};
|
|
50
53
|
return window.addEventListener("pointerdown", e), () => {
|
|
51
54
|
window.removeEventListener("pointerdown", e);
|
|
52
55
|
};
|
|
53
|
-
}, [
|
|
54
|
-
const k =
|
|
55
|
-
|
|
56
|
+
}, [n, i]);
|
|
57
|
+
const k = v((e) => {
|
|
58
|
+
c((u) => u.filter((l) => l.id !== e));
|
|
56
59
|
}, []);
|
|
57
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ m.jsx("div", { ...o, ref: t, style: {
|
|
58
61
|
"--size": `${r}px`
|
|
59
|
-
}, className:
|
|
62
|
+
}, className: C("kakadu-components-4189236582", s), children: i ? w.map((e) => /* @__PURE__ */ m.jsx(g, { id: e.id, x: e.x, y: e.y, onEnd: k }, e.id)) : null });
|
|
60
63
|
}
|
|
61
64
|
export {
|
|
62
|
-
|
|
65
|
+
V as default
|
|
63
66
|
};
|
|
@@ -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 x=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),k=require("@kuma-ui/core"),$=require("../hooks/use-is-in-view.js"),I="kakadu-components-2608453841";function V({isActive:l=!0,size:E=200,className:g,...b}){const s=t.useRef(null),o=$.default(s),n=t.useRef(null),[j,r]=t.useState(!1),[u,S]=t.useState();return t.useEffect(()=>{if(!l||!o){r(!1);return}const a=s.current;if(!a)return;n.current||(n.current=a.parentElement);const e=n.current;if(!e)return;const m=d=>{const q=d.target;if(!e.contains(q))return;const y=e.getBoundingClientRect(),{clientX:i,clientY:c}=d,{left:v,right:L,top:p,bottom:R}=y;i>v&&i<L&&c>p&&c<R&&(r(!0),S([i-v,c-p]))},f=()=>{r(!1)};return e.addEventListener("mousemove",m),e.addEventListener("mouseleave",f),()=>{e.removeEventListener("mousemove",m),e.removeEventListener("mouseleave",f)}},[l,o]),x.jsxRuntimeExports.jsx("div",{...b,ref:s,className:k.cx("kakadu-components-1237006455",g),children:u&&o?x.jsxRuntimeExports.jsx("div",{style:{"--size":`${E}px`,"--offset-x":`${u[0]}px`,"--offset-y":`${u[1]}px`},className:k.cx("kakadu-components-611160091",j&&"kakadu-components-3627966847")}):null})}exports.default=V;exports.normalBlendStyles=I;
|
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cx as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { j as v } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { useRef as x, useState as k, useEffect as w } from "react";
|
|
3
|
+
import { cx as E } from "@kuma-ui/core";
|
|
4
|
+
import B from "../hooks/use-is-in-view.mjs";
|
|
5
|
+
const C = "kakadu-components-2608453841";
|
|
6
|
+
function G({
|
|
7
|
+
isActive: a = !0,
|
|
8
|
+
size: g = 200,
|
|
9
|
+
className: L,
|
|
10
|
+
...b
|
|
10
11
|
}) {
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
if (!
|
|
14
|
-
|
|
12
|
+
const n = x(null), s = B(n), t = x(null), [j, o] = k(!1), [r, I] = k();
|
|
13
|
+
return w(() => {
|
|
14
|
+
if (!a || !s) {
|
|
15
|
+
o(!1);
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
18
|
+
const c = n.current;
|
|
19
|
+
if (!c)
|
|
19
20
|
return;
|
|
20
|
-
t.current || (t.current =
|
|
21
|
+
t.current || (t.current = c.parentElement);
|
|
21
22
|
const e = t.current;
|
|
22
23
|
if (!e)
|
|
23
24
|
return;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
if (!e.contains(
|
|
25
|
+
const l = (f) => {
|
|
26
|
+
const V = f.target;
|
|
27
|
+
if (!e.contains(V))
|
|
27
28
|
return;
|
|
28
|
-
const
|
|
29
|
-
clientX:
|
|
30
|
-
clientY:
|
|
31
|
-
} =
|
|
32
|
-
left:
|
|
33
|
-
right:
|
|
34
|
-
top:
|
|
35
|
-
bottom:
|
|
36
|
-
} =
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
29
|
+
const y = e.getBoundingClientRect(), {
|
|
30
|
+
clientX: i,
|
|
31
|
+
clientY: u
|
|
32
|
+
} = f, {
|
|
33
|
+
left: d,
|
|
34
|
+
right: $,
|
|
35
|
+
top: p,
|
|
36
|
+
bottom: h
|
|
37
|
+
} = y;
|
|
38
|
+
i > d && i < $ && u > p && u < h && (o(!0), I([i - d, u - p]));
|
|
39
|
+
}, m = () => {
|
|
40
|
+
o(!1);
|
|
40
41
|
};
|
|
41
|
-
return e.addEventListener("mousemove",
|
|
42
|
-
e.removeEventListener("mousemove",
|
|
42
|
+
return e.addEventListener("mousemove", l), e.addEventListener("mouseleave", m), () => {
|
|
43
|
+
e.removeEventListener("mousemove", l), e.removeEventListener("mouseleave", m);
|
|
43
44
|
};
|
|
44
|
-
}, [
|
|
45
|
-
"--size": `${
|
|
46
|
-
"--offset-x": `${
|
|
47
|
-
"--offset-y": `${
|
|
48
|
-
}, className:
|
|
45
|
+
}, [a, s]), /* @__PURE__ */ v.jsx("div", { ...b, ref: n, className: E("kakadu-components-1237006455", L), children: r && s ? /* @__PURE__ */ v.jsx("div", { style: {
|
|
46
|
+
"--size": `${g}px`,
|
|
47
|
+
"--offset-x": `${r[0]}px`,
|
|
48
|
+
"--offset-y": `${r[1]}px`
|
|
49
|
+
}, className: E("kakadu-components-611160091", j && "kakadu-components-3627966847") }) : null });
|
|
49
50
|
}
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
G as default,
|
|
53
|
+
C as normalBlendStyles
|
|
53
54
|
};
|