@abdellatifui/react 3.1.82 → 3.1.84

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/dist/nextgen.d.ts CHANGED
@@ -504,10 +504,16 @@ export declare interface MenuButtonProps extends ButtonProps {
504
504
  }>;
505
505
  }
506
506
 
507
- export declare const Model: default_2.ForwardRefExoticComponent<ModelProps_2 & default_2.RefAttributes<HTMLDivElement>>;
507
+ export declare const Model: default_2.ForwardRefExoticComponent<ModelProps_2 & default_2.RefAttributes<ModelHandle>>;
508
508
 
509
509
  export declare const ModelContext: Context< {}>;
510
510
 
511
+ declare interface ModelHandle {
512
+ open: () => void;
513
+ close: () => void;
514
+ readonly isOpen: boolean;
515
+ }
516
+
511
517
  export declare interface ModelProps extends ContainerProps {
512
518
  isOpen: boolean;
513
519
  onClose: () => void;
package/dist/nextgen.js CHANGED
@@ -14389,7 +14389,6 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14389
14389
  } = props;
14390
14390
  const networkMapRef = useRef();
14391
14391
  const mapApi = useRef({});
14392
- const deckRef = useRef();
14393
14392
  const [currentCoordinates, setCurrentCoordinates] = useState([]);
14394
14393
  const [_conns, setConns] = useState([]);
14395
14394
  const [_nodes, setNodes] = useState(nodes);
@@ -14762,7 +14761,6 @@ const NetworkMapComponent = forwardRef((props, ref) => {
14762
14761
  {
14763
14762
  layers: [...paths],
14764
14763
  onHover: handleHover,
14765
- ref: deckRef,
14766
14764
  onClick: (e) => {
14767
14765
  if (!(e == null ? void 0 : e.layer)) {
14768
14766
  setSelectedConn((prev2) => {
@@ -16333,29 +16331,33 @@ const Model = forwardRef((props, ref) => {
16333
16331
  hideOnContextMenu,
16334
16332
  blur = false
16335
16333
  } = props;
16336
- function handleClose() {
16334
+ const handleClose = useCallback(() => {
16337
16335
  setOpen(false);
16338
- }
16339
- function hanldeOpen() {
16336
+ }, []);
16337
+ const hanldeOpen = useCallback(() => {
16340
16338
  setOpen(true);
16341
- }
16339
+ }, []);
16340
+ useImperativeHandle(ref, () => ({
16341
+ open: hanldeOpen,
16342
+ close: handleClose,
16343
+ get isOpen() {
16344
+ return open;
16345
+ }
16346
+ }), [handleClose, hanldeOpen, open]);
16342
16347
  useEffect(() => {
16343
- if (ref.current) {
16344
- ref.current.open = hanldeOpen;
16345
- ref.current.close = handleClose;
16346
- ref.open = hanldeOpen;
16347
- ref.close = handleClose;
16348
- ref.current.isOpen = open;
16349
- if (open == true && !inline) {
16350
- setTimeout(() => {
16351
- const element = $(`#${id}`);
16352
- const element2 = document.getElementById(id);
16353
- const boundires = element2.getBoundingClientRect();
16354
- element.css("top", -boundires.y + "px");
16355
- }, 10);
16356
- }
16348
+ if (!open || inline) {
16349
+ return;
16357
16350
  }
16358
- }, [open, ref, id]);
16351
+ const element = document.getElementById(id);
16352
+ if (!element) {
16353
+ return;
16354
+ }
16355
+ const frame = window.requestAnimationFrame(() => {
16356
+ const boundaries = element.getBoundingClientRect();
16357
+ element.style.top = `${-boundaries.y}px`;
16358
+ });
16359
+ return () => window.cancelAnimationFrame(frame);
16360
+ }, [id, inline, open]);
16359
16361
  function handleWrapperClose(e) {
16360
16362
  if (e.target.classList.contains("custom-click-away") && bodyClick) {
16361
16363
  setOpen(false);
@@ -26545,3 +26547,4 @@ export {
26545
26547
  useStore,
26546
26548
  useVariable
26547
26549
  };
26550
+ //# sourceMappingURL=nextgen.js.map