@trackunit/react-modal 2.1.43 → 2.1.44-alpha-6a85feaada3.0
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/index.cjs.js +0 -18
- package/index.esm.js +1 -19
- package/package.json +6 -6
- package/src/modal/utils/useSheetToCardCleanup.d.ts +0 -8
package/index.cjs.js
CHANGED
|
@@ -217,23 +217,6 @@ const useModalFooterBorder = (rootRef, { footerClass = "border-t", enabled = tru
|
|
|
217
217
|
});
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
-
/**
|
|
221
|
-
* Calls onCloseComplete when the modal transitions from sheet→card mode while
|
|
222
|
-
* already closed. This handles the race where the Sheet unmounts before its
|
|
223
|
-
* transitionend fires (viewport widens mid-close), which would otherwise leave
|
|
224
|
-
* pendingCloseModalRef armed and trigger the safety-timeout Sentry report.
|
|
225
|
-
*/
|
|
226
|
-
function useSheetToCardCleanup(mode, isOpen, onCloseComplete) {
|
|
227
|
-
const prevModeRef = react.useRef(mode);
|
|
228
|
-
react.useEffect(() => {
|
|
229
|
-
const prevMode = prevModeRef.current;
|
|
230
|
-
prevModeRef.current = mode;
|
|
231
|
-
if (prevMode === "sheet" && mode === "card" && !isOpen) {
|
|
232
|
-
onCloseComplete();
|
|
233
|
-
}
|
|
234
|
-
}, [mode, isOpen, onCloseComplete]);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
220
|
/** Scale factor per modal depth level (5% smaller per level back) */
|
|
238
221
|
const SCALE_FACTOR_PER_LEVEL = 0.05;
|
|
239
222
|
/** Maximum number of stacked modals visible behind the frontmost one. */
|
|
@@ -334,7 +317,6 @@ const Modal = ({ children, container, dismiss, isOpen, mode, requestClose, role
|
|
|
334
317
|
}
|
|
335
318
|
},
|
|
336
319
|
});
|
|
337
|
-
useSheetToCardCleanup(mode, isOpen, onCloseComplete);
|
|
338
320
|
const stackScale = 1 - Math.min(depthFromFront, MAX_VISIBLE_STACK_BEHIND) * SCALE_FACTOR_PER_LEVEL;
|
|
339
321
|
const sheetContainerStyle = react.useMemo(() => {
|
|
340
322
|
const style = {
|
package/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useNamespaceTranslation, registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
3
|
import { useMergeRefs, FloatingFocusManager, FloatingOverlay, useFloating, shift, autoUpdate, useDismiss, useInteractions } from '@floating-ui/react';
|
|
4
4
|
import { useOverflowBorder, useSheetSnap, useWatch, Card, Portal, Sheet, Button, Heading, Text, IconButton, Icon, useContainerBreakpoints, useViewportBreakpoints, useTimeout, SHEET_TRANSITION_DURATION_MS } from '@trackunit/react-components';
|
|
5
|
-
import { useRef,
|
|
5
|
+
import { useRef, useCallback, useState, useReducer, useMemo, forwardRef, useId, useSyncExternalStore, useLayoutEffect, useContext, useEffect } from 'react';
|
|
6
6
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
7
7
|
import { ModalDialogContext, ErrorHandlingContext } from '@trackunit/react-core-contexts-api';
|
|
8
8
|
|
|
@@ -215,23 +215,6 @@ const useModalFooterBorder = (rootRef, { footerClass = "border-t", enabled = tru
|
|
|
215
215
|
});
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
-
/**
|
|
219
|
-
* Calls onCloseComplete when the modal transitions from sheet→card mode while
|
|
220
|
-
* already closed. This handles the race where the Sheet unmounts before its
|
|
221
|
-
* transitionend fires (viewport widens mid-close), which would otherwise leave
|
|
222
|
-
* pendingCloseModalRef armed and trigger the safety-timeout Sentry report.
|
|
223
|
-
*/
|
|
224
|
-
function useSheetToCardCleanup(mode, isOpen, onCloseComplete) {
|
|
225
|
-
const prevModeRef = useRef(mode);
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
const prevMode = prevModeRef.current;
|
|
228
|
-
prevModeRef.current = mode;
|
|
229
|
-
if (prevMode === "sheet" && mode === "card" && !isOpen) {
|
|
230
|
-
onCloseComplete();
|
|
231
|
-
}
|
|
232
|
-
}, [mode, isOpen, onCloseComplete]);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
218
|
/** Scale factor per modal depth level (5% smaller per level back) */
|
|
236
219
|
const SCALE_FACTOR_PER_LEVEL = 0.05;
|
|
237
220
|
/** Maximum number of stacked modals visible behind the frontmost one. */
|
|
@@ -332,7 +315,6 @@ const Modal = ({ children, container, dismiss, isOpen, mode, requestClose, role
|
|
|
332
315
|
}
|
|
333
316
|
},
|
|
334
317
|
});
|
|
335
|
-
useSheetToCardCleanup(mode, isOpen, onCloseComplete);
|
|
336
318
|
const stackScale = 1 - Math.min(depthFromFront, MAX_VISIBLE_STACK_BEHIND) * SCALE_FACTOR_PER_LEVEL;
|
|
337
319
|
const sheetContainerStyle = useMemo(() => {
|
|
338
320
|
const style = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-modal",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.44-alpha-6a85feaada3.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@floating-ui/react": "^0.26.25",
|
|
11
|
-
"@trackunit/react-components": "2.1.
|
|
12
|
-
"@trackunit/css-class-variance-utilities": "1.13.
|
|
13
|
-
"@trackunit/shared-utils": "1.15.
|
|
11
|
+
"@trackunit/react-components": "2.1.40-alpha-6a85feaada3.0",
|
|
12
|
+
"@trackunit/css-class-variance-utilities": "1.13.44-alpha-6a85feaada3.0",
|
|
13
|
+
"@trackunit/shared-utils": "1.15.44-alpha-6a85feaada3.0",
|
|
14
14
|
"@floating-ui/react-dom": "2.1.2",
|
|
15
|
-
"@trackunit/react-core-contexts-api": "1.17.
|
|
16
|
-
"@trackunit/i18n-library-translation": "2.0.
|
|
15
|
+
"@trackunit/react-core-contexts-api": "1.17.48-alpha-6a85feaada3.0",
|
|
16
|
+
"@trackunit/i18n-library-translation": "2.0.41-alpha-6a85feaada3.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@tanstack/react-router": "^1.114.29",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ModalMode } from "../useModal";
|
|
2
|
-
/**
|
|
3
|
-
* Calls onCloseComplete when the modal transitions from sheet→card mode while
|
|
4
|
-
* already closed. This handles the race where the Sheet unmounts before its
|
|
5
|
-
* transitionend fires (viewport widens mid-close), which would otherwise leave
|
|
6
|
-
* pendingCloseModalRef armed and trigger the safety-timeout Sentry report.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useSheetToCardCleanup(mode: ModalMode, isOpen: boolean, onCloseComplete: () => void): void;
|