@xwadex/fesd-next 0.3.44-beta.36 → 0.3.44-beta.38

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.
@@ -7,7 +7,7 @@ type PropsTypes<T extends React.ElementType = "div"> = AsPropsTypes<T, {
7
7
  defaultHeight?: number;
8
8
  className?: string;
9
9
  handlerClassName?: string;
10
- resizeStore?: boolean;
10
+ isResizeStore?: boolean;
11
11
  resizeStoreKey?: string;
12
12
  resizeStoreValue?: ResizeTypes;
13
13
  } & DragResizePropsTypes>;
@@ -5,14 +5,14 @@ import { useDragResize, useCookies } from "../../hooks/index.js";
5
5
  import { DragResizeContext } from "./dragResizeContext";
6
6
  import { cn } from "../../utils/index.js";
7
7
  const DragResizeBase = (props) => {
8
- const { as, children, defaultWidth, defaultHeight, className, handlerClassName, resizeStore = true, resizeStoreKey, resizeStoreValue, active = true, direction = "horizontal", minWidth = 500, maxWidth = 950, onInit, onResizeStart, onResizing, onResizeEnd, ...othersProps } = props;
8
+ const { as, children, defaultWidth, defaultHeight, className, handlerClassName, resizeStoreKey, resizeStoreValue, isResizeStore = true, active = true, direction = "horizontal", minWidth = 500, maxWidth = 950, onInit, onResizeStart, onResizing, onResizeEnd, ...othersProps } = props;
9
9
  const RootComponent = as || "div";
10
10
  const [isActive, setActive] = useState(active);
11
- const { setCookies, deleteCookies } = useCookies();
12
- const isCookieStore = useMemo(() => resizeStore
11
+ const { setCookies, deleteCookies, getCookies } = useCookies();
12
+ const isCookieStore = useMemo(() => isResizeStore
13
13
  && resizeStoreKey
14
14
  && resizeStoreKey !== ""
15
- ? true : false, [resizeStore, resizeStoreKey]);
15
+ ? true : false, [isResizeStore, resizeStoreKey]);
16
16
  const resizeDefauleStyles = useMemo(() => {
17
17
  if (!isCookieStore || !resizeStoreValue)
18
18
  return {
@@ -29,8 +29,13 @@ const DragResizeBase = (props) => {
29
29
  onResizeEnd?.(size);
30
30
  if (!isCookieStore)
31
31
  return;
32
- setCookies(resizeStoreKey, JSON.stringify(size));
33
- }, [isCookieStore, onResizeEnd, resizeStore]);
32
+ const resizeCookies = getCookies("dragResize");
33
+ const resizeStores = resizeCookies ? JSON.parse(resizeCookies) : {};
34
+ const resizeStoreName = resizeStoreKey;
35
+ resizeStores[resizeStoreName] = {};
36
+ resizeStores[resizeStoreName] = { ...size };
37
+ setCookies("dragResize", JSON.stringify(resizeStores));
38
+ }, [isCookieStore, onResizeEnd, isResizeStore]);
34
39
  //Hooks
35
40
  const { dragRef, resizeRef } = useDragResize({
36
41
  active: isActive,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwadex/fesd-next",
3
- "version": "0.3.44-beta.36",
3
+ "version": "0.3.44-beta.38",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",