@cronocode/react-box 1.3.2 → 1.3.3
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/components/dataGrid.d.ts +3 -5
- package/components/tooltip.d.ts +4 -0
- package/components/tooltip.mjs +28 -28
- package/package.json +1 -1
package/components/dataGrid.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export interface GridColumn<T extends {}> {
|
|
1
|
+
import { Grid } from './dataGridContract';
|
|
2
|
+
export default function useGrid<T extends {}>(data?: T[]): Grid<T>;
|
|
3
|
+
tends {}> {
|
|
6
4
|
key: keyof T;
|
|
7
5
|
}
|
|
8
6
|
export interface GridRow<T extends {}> {
|
package/components/tooltip.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { BoxPosition } from '../types';
|
|
|
3
3
|
interface Props extends BoxPosition {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
style?: React.ComponentProps<'div'>['style'];
|
|
6
|
+
onPositionChange?(position: {
|
|
7
|
+
top: number;
|
|
8
|
+
left: number;
|
|
9
|
+
}): void;
|
|
6
10
|
}
|
|
7
11
|
export default function Tooltip(props: Props): JSX.Element;
|
|
8
12
|
export {};
|
package/components/tooltip.mjs
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createPortal as
|
|
3
|
-
import
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { u as
|
|
1
|
+
import { jsxs as x, Fragment as b, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createPortal as E } from "react-dom";
|
|
3
|
+
import p from "../box.mjs";
|
|
4
|
+
import { useRef as L, useState as z, useCallback as l, useLayoutEffect as g } from "react";
|
|
5
|
+
import { u as C } from "../utils/utils.mjs";
|
|
6
6
|
import "../box.module.css.mjs";
|
|
7
7
|
import "../theme.mjs";
|
|
8
|
-
function
|
|
9
|
-
const { children:
|
|
10
|
-
const o = (
|
|
11
|
-
|
|
8
|
+
function P(c) {
|
|
9
|
+
const { children: d, onPositionChange: n } = c, e = L(null), [s, f] = z(), m = C(), w = l((r, t) => {
|
|
10
|
+
const o = (u) => {
|
|
11
|
+
u.target.contains(r) && t();
|
|
12
12
|
};
|
|
13
13
|
return document.addEventListener("scroll", o, { capture: !0 }), () => {
|
|
14
14
|
document.removeEventListener("scroll", o, { capture: !0 });
|
|
15
15
|
};
|
|
16
|
-
}, []), v =
|
|
17
|
-
const o = (
|
|
18
|
-
|
|
16
|
+
}, []), v = l((r, t) => {
|
|
17
|
+
const o = (u) => {
|
|
18
|
+
t();
|
|
19
19
|
};
|
|
20
20
|
return window.addEventListener("resize", o, { capture: !0 }), () => {
|
|
21
21
|
window.removeEventListener("resize", o, { capture: !0 });
|
|
22
22
|
};
|
|
23
|
-
}, []),
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
}, []), i = l((r) => () => {
|
|
24
|
+
const t = r.getBoundingClientRect();
|
|
25
|
+
f({ top: t.top + window.scrollY, left: t.left + window.scrollX }), n == null || n({ top: t.top + window.scrollY, left: t.left + window.scrollX });
|
|
26
26
|
}, []);
|
|
27
27
|
return g(() => {
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
const r =
|
|
28
|
+
if (e.current) {
|
|
29
|
+
i(e.current)();
|
|
30
|
+
const r = w(e.current, i(e.current)), t = v(e.current, i(e.current));
|
|
31
31
|
return () => {
|
|
32
|
-
r(),
|
|
32
|
+
r(), t();
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
}, []), /* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
35
|
+
}, []), /* @__PURE__ */ x(b, { children: [
|
|
36
|
+
/* @__PURE__ */ a(p, { ref: e, position: "absolute", top: 0, left: 0, ...c, children: void 0 }),
|
|
37
|
+
s && E(
|
|
38
|
+
/* @__PURE__ */ a(
|
|
39
|
+
p,
|
|
40
40
|
{
|
|
41
41
|
position: "absolute",
|
|
42
42
|
top: 0,
|
|
43
43
|
left: 0,
|
|
44
44
|
transition: "none",
|
|
45
|
-
style: { transform: `translate(${
|
|
46
|
-
children:
|
|
45
|
+
style: { transform: `translate(${s.left}px,${s.top}px)` },
|
|
46
|
+
children: d
|
|
47
47
|
}
|
|
48
48
|
),
|
|
49
|
-
|
|
49
|
+
m
|
|
50
50
|
)
|
|
51
51
|
] });
|
|
52
52
|
}
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
P as default
|
|
55
55
|
};
|