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