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