@xwadex/fesd-next 0.3.44-beta.30 → 0.3.44-beta.31

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,7 +1,6 @@
1
1
  export interface PropsTypes {
2
2
  defaultPosX?: number;
3
3
  defaultPosY?: number;
4
- active?: boolean;
5
4
  children: React.ReactNode;
6
5
  }
7
6
  declare const DragBoxsBase: (props: PropsTypes) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { memo, useCallback, useId, useState } from "react";
3
+ import { memo, useCallback, useEffect, useId, useState } from "react";
4
4
  import { createPortal } from "react-dom";
5
5
  import { DndContext } from "@dnd-kit/core";
6
6
  import { DragBoxsContext } from "./dragBoxsContext";
7
- import { useEffectLeave, useEffectOne } from "../../hooks/index.js";
8
7
  const DragBoxsBase = (props) => {
9
- const { defaultPosX = 0, defaultPosY = 0, active, children } = props;
8
+ const { defaultPosX = 0, defaultPosY = 0, children } = props;
10
9
  const id = useId();
11
10
  const [isMounded, setMounded] = useState(false);
12
11
  const [positions, setPositions] = useState({
@@ -57,14 +56,12 @@ const DragBoxsBase = (props) => {
57
56
  if (target)
58
57
  setPositions((prev) => resizeNextPositions(target, prev));
59
58
  }, []);
60
- useEffectOne(() => {
59
+ useEffect(() => {
61
60
  setMounded(true);
62
61
  window.addEventListener("resize", resizeEvent);
63
- });
64
- useEffectLeave(() => {
65
- window.removeEventListener("resize", resizeEvent);
66
- });
67
- return (_jsx(_Fragment, { children: isMounded && active
62
+ return () => window.removeEventListener("resize", resizeEvent);
63
+ }, []);
64
+ return (_jsx(_Fragment, { children: isMounded
68
65
  ? createPortal(_jsx(DndContext, { onDragEnd: dragEndEvent, modifiers: [dragModifiers], children: _jsx(DragBoxsContext, { value: { id, positions }, children: _jsx("div", { "data-components": "dragboxs-root", children: children }) }) }), document.body)
69
66
  : null }));
70
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwadex/fesd-next",
3
- "version": "0.3.44-beta.30",
3
+ "version": "0.3.44-beta.31",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",