@tap-payments/os-micro-frontend-shared 0.1.33-test.5 → 0.1.33-test.6

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,7 +3,7 @@ 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, initialStyle, resizableMainStyle, AppContainerWrapper, AppContainerContainer } from './style';
6
+ import { contentStyle, ContentWrapper, initalStyle, 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
8
  const [isDrag, setIsDrag] = useState(true);
9
9
  const modalRef = useRef(null);
@@ -19,14 +19,23 @@ function WindowWrapper({ children, id, onResize, isMaximized, isMinimized, dragC
19
19
  const resizableStyle = useMemo(() => (Object.assign(Object.assign(Object.assign({}, resizableMainStyle), { maxWidth: width, borderRadius: !isMaximized ? 12 : '0 !important' }), (!isMaximized && {
20
20
  top: 0,
21
21
  }))), [isMaximized, width]);
22
+ const dragConstraints = useMemo(() => {
23
+ var _a, _b, _c, _d, _e, _f, _g;
24
+ return ({
25
+ right: Number((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) + Number((_b = modalRef.current) === null || _b === void 0 ? void 0 : _b.offsetLeft) - 10,
26
+ left: -(Number((_c = modalRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) + Number((_d = modalRef.current) === null || _d === void 0 ? void 0 : _d.offsetLeft) - 10),
27
+ top: -(Number((_e = modalRef.current) === null || _e === void 0 ? void 0 : _e.clientHeight) + Number((_f = constraintsRef.current) === null || _f === void 0 ? void 0 : _f.offsetTop) - 10),
28
+ bottom: window.innerHeight - Number((_g = modalRef.current) === null || _g === void 0 ? void 0 : _g.offsetHeight) - 10,
29
+ });
30
+ }, []);
22
31
  useEffect(() => {
23
32
  var _a;
24
33
  (_a = resizableRef.current) === null || _a === void 0 ? void 0 : _a.updateSize({
25
34
  width: isMaximized ? '100vw' : width,
26
35
  height: isMaximized ? '100vh' : '100%',
27
36
  });
28
- }, [isMaximized]);
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 && {
37
+ }, [isMaximized, width]);
38
+ 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: initalStyle }, { children: _jsx(ContentWrapper, Object.assign({ id: "content-wrapper", drag: !isMaximized && isDrag, dragMomentum: false, dragConstraints: dragConstraints, onDragStart: onClick, onDragEnter: onClick, onClick: onClick, dragControls: dragControls, dragListener: false, style: Object.assign(Object.assign(Object.assign({}, (order && {
30
39
  zIndex: Number(order) + APP_WINDOW_Z_INDEX,
31
40
  })), contentStyle), { height }), initial: Object.assign({ marginInline: 'auto', scale: 0, left: 0 }, (!isMaximized && {
32
41
  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 initialStyle: any;
4
+ export declare const initalStyle: 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 initialStyle = {
22
+ export const initalStyle = {
23
23
  width: 'inherit',
24
24
  height: 'inherit',
25
25
  gridRowStart: 1,
@@ -30,24 +30,15 @@ export const initialStyle = {
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', 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
- }))));
33
+ })(({ maximized }) => (Object.assign({ overflow: 'hidden', display: 'flex', flexDirection: 'column', width: '100%', height: '100%', zIndex: 1, borderRadius: '12px' }, (maximized && {
34
+ transform: 'translate(0,0) !important',
35
+ }))));
45
36
  export const AppContainerWrapper = styled(Box)(() => ({
46
37
  flexGrow: 1,
47
38
  }));
48
39
  export const AppContainerContainer = styled(motion.div)(() => ({
49
- width: '100vw',
50
- height: '100vh',
40
+ width: 'inherit',
41
+ height: '100%',
51
42
  overflow: 'hidden',
52
43
  flexGrow: 1,
53
44
  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",
5
- "testVersion": 5,
4
+ "version": "0.1.33-test.6",
5
+ "testVersion": 6,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",