@canvas-components/react-components 0.3.10 → 0.3.11

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.d.cts CHANGED
@@ -430,7 +430,7 @@ interface ReactModalProps {
430
430
  bodyStyle?: CSSProperties;
431
431
  /** 遮罩样式。 */
432
432
  maskStyle?: CSSProperties;
433
- /** 指定 Modal 挂载容器。 */
433
+ /** 指定 Modal 挂载容器;默认使用当前浏览器全屏节点,否则使用 document.body。 */
434
434
  getContainer?: HTMLElement | (() => HTMLElement);
435
435
  }
436
436
  /**
package/dist/index.d.ts CHANGED
@@ -430,7 +430,7 @@ interface ReactModalProps {
430
430
  bodyStyle?: CSSProperties;
431
431
  /** 遮罩样式。 */
432
432
  maskStyle?: CSSProperties;
433
- /** 指定 Modal 挂载容器。 */
433
+ /** 指定 Modal 挂载容器;默认使用当前浏览器全屏节点,否则使用 document.body。 */
434
434
  getContainer?: HTMLElement | (() => HTMLElement);
435
435
  }
436
436
  /**
package/dist/index.js CHANGED
@@ -5413,6 +5413,7 @@ function ReactModal(props) {
5413
5413
  const [innerFullscreen, setInnerFullscreen] = useState(defaultFullscreen);
5414
5414
  const [innerConfirmLoading, setInnerConfirmLoading] = useState(false);
5415
5415
  const [dragOffset, setDragOffset] = useState({ x: 0, y: 0 });
5416
+ const [, setFullscreenRevision] = useState(0);
5416
5417
  const panelRef = useRef(null);
5417
5418
  const dragRef = useRef(null);
5418
5419
  const restoreFocusRef = useRef(null);
@@ -5425,6 +5426,16 @@ function ReactModal(props) {
5425
5426
  const mergedFullscreen = controlledFullscreen ? Boolean(fullscreen) : innerFullscreen;
5426
5427
  const mergedConfirmLoading = confirmLoading ?? innerConfirmLoading;
5427
5428
  const hasTitle = title !== null && title !== void 0 && title !== false;
5429
+ useEffect(() => {
5430
+ if (!transition.rendered || typeof document === "undefined") return;
5431
+ const handleFullscreenChange = () => {
5432
+ setFullscreenRevision((revision) => revision + 1);
5433
+ };
5434
+ document.addEventListener("fullscreenchange", handleFullscreenChange);
5435
+ return () => {
5436
+ document.removeEventListener("fullscreenchange", handleFullscreenChange);
5437
+ };
5438
+ }, [transition.rendered]);
5428
5439
  useEffect(() => {
5429
5440
  if (previousOpenRef.current === open) {
5430
5441
  return;
@@ -5735,7 +5746,9 @@ function resolveContainer(getContainer) {
5735
5746
  if (typeof document === "undefined") {
5736
5747
  return null;
5737
5748
  }
5738
- return typeof getContainer === "function" ? getContainer() : getContainer ?? document.body;
5749
+ if (typeof getContainer === "function") return getContainer();
5750
+ if (getContainer) return getContainer;
5751
+ return document.fullscreenElement instanceof HTMLElement ? document.fullscreenElement : document.body;
5739
5752
  }
5740
5753
  function trapFocus(event, panel) {
5741
5754
  if (!panel) {