@mindbill/react 0.42.2 → 0.42.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/dist/index.js CHANGED
@@ -5393,16 +5393,18 @@ function useBillLifecycle({
5393
5393
  }
5394
5394
  function LifecycleDialog({ children, title, wide = false, onClose }) {
5395
5395
  const dialog = useRef5(null);
5396
+ const onCloseRef = useRef5(onClose);
5397
+ onCloseRef.current = onClose;
5396
5398
  useEffect9(() => {
5397
5399
  const previous = document.activeElement;
5398
5400
  dialog.current?.focus();
5399
- const onKeyDown = (event) => event.key === "Escape" && onClose();
5401
+ const onKeyDown = (event) => event.key === "Escape" && onCloseRef.current();
5400
5402
  document.addEventListener("keydown", onKeyDown);
5401
5403
  return () => {
5402
5404
  document.removeEventListener("keydown", onKeyDown);
5403
5405
  previous?.focus();
5404
5406
  };
5405
- }, [onClose]);
5407
+ }, []);
5406
5408
  return /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs14("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
5407
5409
  /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
5408
5410
  children