@trackunit/react-drawer 0.3.23 → 0.3.26
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 +5 -7
- package/index.esm.js +4 -6
- package/package.json +2 -3
package/index.cjs.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
var usePortal = require('react-useportal');
|
|
7
5
|
var reactComponents = require('@trackunit/react-components');
|
|
6
|
+
var react = require('react');
|
|
8
7
|
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
9
8
|
var reactSwipeable = require('react-swipeable');
|
|
10
9
|
|
|
@@ -97,13 +96,13 @@ const cvaOverlayContainer = cssClassVarianceUtilities.cvaMerge([
|
|
|
97
96
|
], {
|
|
98
97
|
variants: {
|
|
99
98
|
open: {
|
|
100
|
-
true: "z-
|
|
99
|
+
true: "z-overlay opacity-100",
|
|
101
100
|
false: "z-hidden pointer-events-none opacity-0",
|
|
102
101
|
},
|
|
103
102
|
},
|
|
104
103
|
});
|
|
105
104
|
|
|
106
|
-
const cvaDrawer = cssClassVarianceUtilities.cvaMerge(["z-
|
|
105
|
+
const cvaDrawer = cssClassVarianceUtilities.cvaMerge(["z-overlay", "pointer-events-auto", "absolute", "flex-col", "transition-all", "duration-500", "ease-in-out"], {
|
|
107
106
|
variants: {
|
|
108
107
|
position: {
|
|
109
108
|
left: ["left-0", "top-0", "h-full", "w-fit"],
|
|
@@ -187,8 +186,7 @@ const NOOP$1 = () => void 0;
|
|
|
187
186
|
*/
|
|
188
187
|
const Drawer = react.forwardRef(({ open = false, // Default to closed
|
|
189
188
|
onClose = NOOP$1, hasOverlay = true, position = DEFAULT_POSITION, children, dataTestId, className, renderInPortal = false, keepMountedWhenClosed = false, containerClassName, ...others }, ref) => {
|
|
190
|
-
const { isSm } = reactComponents.
|
|
191
|
-
const { Portal } = usePortal();
|
|
189
|
+
const { isSm } = reactComponents.useViewportBreakpoints();
|
|
192
190
|
const shouldUsePortal = !isSm || renderInPortal;
|
|
193
191
|
const [shouldRender, setShouldRender] = react.useState(open);
|
|
194
192
|
const [mode, setMode] = react.useState(open ? "open" : "closed");
|
|
@@ -214,7 +212,7 @@ onClose = NOOP$1, hasOverlay = true, position = DEFAULT_POSITION, children, data
|
|
|
214
212
|
position: position,
|
|
215
213
|
className,
|
|
216
214
|
}), "data-testid": dataTestId, onTransitionEnd: handleAnimationEnd, ref: ref, ...others, children: jsxRuntime.jsx("div", { className: cvaDrawerContent({ position }), children: children }) })] }));
|
|
217
|
-
return shouldUsePortal ? jsxRuntime.jsx(Portal, { children: content }) : content;
|
|
215
|
+
return shouldUsePortal ? jsxRuntime.jsx(reactComponents.Portal, { children: content }) : content;
|
|
218
216
|
});
|
|
219
217
|
Drawer.displayName = "Drawer";
|
|
220
218
|
|
package/index.esm.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
|
+
import { useViewportBreakpoints, Portal, Icon, useGeometry } from '@trackunit/react-components';
|
|
3
4
|
import { useEffect, forwardRef, useState, useCallback, useRef, useImperativeHandle, useMemo } from 'react';
|
|
4
|
-
import usePortal from 'react-useportal';
|
|
5
|
-
import { useViewportSize, Icon, useGeometry } from '@trackunit/react-components';
|
|
6
5
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
7
6
|
import { useSwipeable } from 'react-swipeable';
|
|
8
7
|
|
|
@@ -95,13 +94,13 @@ const cvaOverlayContainer = cvaMerge([
|
|
|
95
94
|
], {
|
|
96
95
|
variants: {
|
|
97
96
|
open: {
|
|
98
|
-
true: "z-
|
|
97
|
+
true: "z-overlay opacity-100",
|
|
99
98
|
false: "z-hidden pointer-events-none opacity-0",
|
|
100
99
|
},
|
|
101
100
|
},
|
|
102
101
|
});
|
|
103
102
|
|
|
104
|
-
const cvaDrawer = cvaMerge(["z-
|
|
103
|
+
const cvaDrawer = cvaMerge(["z-overlay", "pointer-events-auto", "absolute", "flex-col", "transition-all", "duration-500", "ease-in-out"], {
|
|
105
104
|
variants: {
|
|
106
105
|
position: {
|
|
107
106
|
left: ["left-0", "top-0", "h-full", "w-fit"],
|
|
@@ -185,8 +184,7 @@ const NOOP$1 = () => void 0;
|
|
|
185
184
|
*/
|
|
186
185
|
const Drawer = forwardRef(({ open = false, // Default to closed
|
|
187
186
|
onClose = NOOP$1, hasOverlay = true, position = DEFAULT_POSITION, children, dataTestId, className, renderInPortal = false, keepMountedWhenClosed = false, containerClassName, ...others }, ref) => {
|
|
188
|
-
const { isSm } =
|
|
189
|
-
const { Portal } = usePortal();
|
|
187
|
+
const { isSm } = useViewportBreakpoints();
|
|
190
188
|
const shouldUsePortal = !isSm || renderInPortal;
|
|
191
189
|
const [shouldRender, setShouldRender] = useState(open);
|
|
192
190
|
const [mode, setMode] = useState(open ? "open" : "closed");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-drawer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.26",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"@trackunit/i18n-library-translation": "*",
|
|
13
13
|
"@trackunit/ui-icons": "*",
|
|
14
14
|
"react": "18.3.1",
|
|
15
|
-
"react-swipeable": "^7.0.1"
|
|
16
|
-
"react-useportal": "1.0.18"
|
|
15
|
+
"react-swipeable": "^7.0.1"
|
|
17
16
|
},
|
|
18
17
|
"module": "./index.esm.js",
|
|
19
18
|
"main": "./index.cjs.js",
|