mimir-ui-kit 1.38.1 → 1.38.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,19 @@
1
- import { useRef as x, useEffect as a } from "react";
2
- import { BLOCK_WIDTH as f } from "./constants.js";
3
- const H = (d) => {
1
+ import { useRef as x, useEffect as w } from "react";
2
+ import { BLOCK_WIDTH as r } from "./constants.js";
3
+ const H = (a) => {
4
4
  const t = x(null);
5
- return a(() => {
6
- var o, r, s, c, l, u;
7
- const h = window.innerHeight, y = window.innerWidth;
5
+ return w(() => {
6
+ var o, c, s, l, u, p;
7
+ const d = window.innerHeight, h = window.innerWidth;
8
8
  if (t.current !== null) {
9
- const w = ((r = (o = t == null ? void 0 : t.current) == null ? void 0 : o.parentElement) == null ? void 0 : r.offsetWidth) ?? 0, p = ((c = (s = t == null ? void 0 : t.current) == null ? void 0 : s.parentElement) == null ? void 0 : c.offsetHeight) ?? 0, n = (u = (l = t == null ? void 0 : t.current) == null ? void 0 : l.parentElement) == null ? void 0 : u.getBoundingClientRect(), i = t.current.offsetHeight;
10
- if (h < n.y + i + p ? n.y - i > 0 ? t.current.style.top = -i + "px" : t.current.style.position = "fixed" : t.current.style.top = p + "px", y < n.x + f) {
11
- const e = w - f;
12
- n.x - e < 0 ? t.current.style.left = (e < 0 ? e / 2 : e) + "px" : t.current.style.left = -e + "px";
9
+ const y = ((c = (o = t == null ? void 0 : t.current) == null ? void 0 : o.parentElement) == null ? void 0 : c.offsetWidth) ?? 0, f = ((l = (s = t == null ? void 0 : t.current) == null ? void 0 : s.parentElement) == null ? void 0 : l.offsetHeight) ?? 0, n = (p = (u = t == null ? void 0 : t.current) == null ? void 0 : u.parentElement) == null ? void 0 : p.getBoundingClientRect(), i = t.current.offsetHeight;
10
+ if (h < n.x + r) {
11
+ const e = y - r;
12
+ n.x - Math.abs(e) < 0 ? t.current.style.left = (e < 0 ? e / 2 : e) + "px" : t.current.style.left = e + "px";
13
13
  }
14
- t.current.style.opacity = "1";
14
+ d < n.y + i + f ? n.y - i > 0 ? t.current.style.top = -i + "px" : (t.current.style.position = "fixed", t.current.style.top = `calc(50vh - ${i / 2}px)`, t.current.style.left = `calc(50vw - ${r / 2}px)`) : t.current.style.top = f + "px", t.current.style.opacity = "1";
15
15
  }
16
- }, [d]), t;
16
+ }, [a]), t;
17
17
  };
18
18
  export {
19
19
  H as useDatePickerPosition
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.38.1",
4
+ "version": "1.38.2",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {