@tap-payments/os-micro-frontend-shared 0.1.33-test.4 → 0.1.33-test.5
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.
|
@@ -3,9 +3,8 @@ import { memo, useMemo, useState, useRef, useEffect } from 'react';
|
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
4
|
import { Resizable } from 're-resizable';
|
|
5
5
|
import { APP_WINDOW_Z_INDEX, FOOTER_HEIGHT, HEADER_HEIGHT } from '../../constants/index.js';
|
|
6
|
-
import { contentStyle, ContentWrapper,
|
|
6
|
+
import { contentStyle, ContentWrapper, initialStyle, resizableMainStyle, AppContainerWrapper, AppContainerContainer } from './style';
|
|
7
7
|
function WindowWrapper({ children, id, onResize, isMaximized, isMinimized, dragControls, onClick, options: { width, height, minHeight, minWidth, maxHeight, maxWidth, order, openOrder = 1 }, }) {
|
|
8
|
-
var _a, _b;
|
|
9
8
|
const [isDrag, setIsDrag] = useState(true);
|
|
10
9
|
const modalRef = useRef(null);
|
|
11
10
|
const constraintsRef = useRef(null);
|
|
@@ -20,15 +19,6 @@ function WindowWrapper({ children, id, onResize, isMaximized, isMinimized, dragC
|
|
|
20
19
|
const resizableStyle = useMemo(() => (Object.assign(Object.assign(Object.assign({}, resizableMainStyle), { maxWidth: width, borderRadius: !isMaximized ? 12 : '0 !important' }), (!isMaximized && {
|
|
21
20
|
top: 0,
|
|
22
21
|
}))), [isMaximized, width]);
|
|
23
|
-
const dragConstraints = useMemo(() => {
|
|
24
|
-
var _a, _b, _c, _d;
|
|
25
|
-
return ({
|
|
26
|
-
top: 0,
|
|
27
|
-
left: 0,
|
|
28
|
-
right: window.innerWidth - ((_b = (_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) !== null && _b !== void 0 ? _b : 0) - 10,
|
|
29
|
-
bottom: window.innerHeight - ((_d = (_c = modalRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0) - 10,
|
|
30
|
-
});
|
|
31
|
-
}, [(_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth, (_b = modalRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight]);
|
|
32
22
|
useEffect(() => {
|
|
33
23
|
var _a;
|
|
34
24
|
(_a = resizableRef.current) === null || _a === void 0 ? void 0 : _a.updateSize({
|
|
@@ -36,7 +26,7 @@ function WindowWrapper({ children, id, onResize, isMaximized, isMinimized, dragC
|
|
|
36
26
|
height: isMaximized ? '100vh' : '100%',
|
|
37
27
|
});
|
|
38
28
|
}, [isMaximized]);
|
|
39
|
-
return (_jsx(AppContainerWrapper, Object.assign({ id: "app-container-wrapper", "data-testid": "AppContainerWrapper" }, { children: _jsx(AppContainerContainer, Object.assign({ "data-testid": "AppContainerContainer" }, { children: _jsx(motion.div, Object.assign({ id: "app-content", "data-add-id": id, "data-testid": "AppContent", ref: constraintsRef, initial:
|
|
29
|
+
return (_jsx(AppContainerWrapper, Object.assign({ id: "app-container-wrapper", "data-testid": "AppContainerWrapper" }, { children: _jsx(AppContainerContainer, Object.assign({ "data-testid": "AppContainerContainer" }, { children: _jsx(motion.div, Object.assign({ id: "app-content", "data-add-id": id, "data-testid": "AppContent", ref: constraintsRef, initial: initialStyle }, { children: _jsx(ContentWrapper, Object.assign({ id: "content-wrapper", drag: !isMaximized && isDrag, dragMomentum: false, dragConstraints: constraintsRef, onDragStart: onClick, onDragEnter: onClick, onClick: onClick, dragControls: dragControls, dragListener: false, style: Object.assign(Object.assign(Object.assign({}, (order && {
|
|
40
30
|
zIndex: Number(order) + APP_WINDOW_Z_INDEX,
|
|
41
31
|
})), contentStyle), { height }), initial: Object.assign({ marginInline: 'auto', scale: 0, left: 0 }, (!isMaximized && {
|
|
42
32
|
left: 48 * (openOrder - 1),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
export declare const resizableMainStyle: CSSProperties;
|
|
3
3
|
export declare const contentStyle: CSSProperties;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const initialStyle: any;
|
|
5
5
|
export declare const ContentWrapper: import("@emotion/styled").StyledComponent<{
|
|
6
6
|
hidden?: boolean | undefined;
|
|
7
7
|
id?: string | undefined;
|
|
@@ -19,7 +19,7 @@ export const contentStyle = {
|
|
|
19
19
|
overflow: 'visible',
|
|
20
20
|
borderRadius: '12px',
|
|
21
21
|
};
|
|
22
|
-
export const
|
|
22
|
+
export const initialStyle = {
|
|
23
23
|
width: 'inherit',
|
|
24
24
|
height: 'inherit',
|
|
25
25
|
gridRowStart: 1,
|
|
@@ -30,15 +30,24 @@ export const initalStyle = {
|
|
|
30
30
|
};
|
|
31
31
|
export const ContentWrapper = styled(motion.div, {
|
|
32
32
|
shouldForwardProp: (props) => props !== 'maximized',
|
|
33
|
-
})(({ maximized }) => (Object.assign({ overflow: 'hidden', display: 'flex', flexDirection: 'column',
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
})(({ maximized }) => (Object.assign({ overflow: 'hidden', display: 'flex', flexDirection: 'column', zIndex: 1, position: 'fixed', top: 0, left: 0 }, (maximized
|
|
34
|
+
? {
|
|
35
|
+
width: '100vw',
|
|
36
|
+
height: '100vh',
|
|
37
|
+
borderRadius: 0,
|
|
38
|
+
transform: 'translate(0,0) !important',
|
|
39
|
+
}
|
|
40
|
+
: {
|
|
41
|
+
width: 'auto',
|
|
42
|
+
height: 'auto',
|
|
43
|
+
borderRadius: 12,
|
|
44
|
+
}))));
|
|
36
45
|
export const AppContainerWrapper = styled(Box)(() => ({
|
|
37
46
|
flexGrow: 1,
|
|
38
47
|
}));
|
|
39
48
|
export const AppContainerContainer = styled(motion.div)(() => ({
|
|
40
|
-
width: '
|
|
41
|
-
height: '
|
|
49
|
+
width: '100vw',
|
|
50
|
+
height: '100vh',
|
|
42
51
|
overflow: 'hidden',
|
|
43
52
|
flexGrow: 1,
|
|
44
53
|
position: 'relative',
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.33-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.33-test.5",
|
|
5
|
+
"testVersion": 5,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|