@tap-payments/os-micro-frontend-shared 0.1.75 → 0.1.76
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AppWindowProviderProps } from './type';
|
|
2
|
-
export declare function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth }: AppWindowProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth, initialPosition, }: AppWindowProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,13 +4,14 @@ import { useWindowDimensions } from '../../../hooks/index.js';
|
|
|
4
4
|
import { AppWindowContext } from './context';
|
|
5
5
|
const DEFAULT_VIEWER_WIDTH = 555;
|
|
6
6
|
const DEFAULT_VIEWER_HEIGHT = 545;
|
|
7
|
-
export function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth }) {
|
|
7
|
+
export function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth, initialPosition, }) {
|
|
8
|
+
var _a, _b;
|
|
8
9
|
const { height, width } = useWindowDimensions();
|
|
9
10
|
const viewerDefaultWidth = defaultWindowWidth || DEFAULT_VIEWER_WIDTH;
|
|
10
11
|
const viewerDefaultHeight = defaultWindowHeight || DEFAULT_VIEWER_HEIGHT;
|
|
11
12
|
const [position, setPosition] = useState({
|
|
12
|
-
x: width / 2 + viewerDefaultWidth / 2,
|
|
13
|
-
y: height / 2 - viewerDefaultHeight / 2,
|
|
13
|
+
x: (_a = initialPosition === null || initialPosition === void 0 ? void 0 : initialPosition.x) !== null && _a !== void 0 ? _a : width / 2 + viewerDefaultWidth / 2,
|
|
14
|
+
y: (_b = initialPosition === null || initialPosition === void 0 ? void 0 : initialPosition.y) !== null && _b !== void 0 ? _b : height / 2 - viewerDefaultHeight / 2,
|
|
14
15
|
});
|
|
15
16
|
const [isMaximized, setIsMaximized] = useState(false);
|
|
16
17
|
const [isResized, setIsResized] = useState(false);
|
|
@@ -6,6 +6,10 @@ export interface AppWindowProviderProps {
|
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
defaultWindowWidth?: number;
|
|
8
8
|
defaultWindowHeight?: number;
|
|
9
|
+
initialPosition?: {
|
|
10
|
+
x?: number | null;
|
|
11
|
+
y?: number | null;
|
|
12
|
+
};
|
|
9
13
|
}
|
|
10
14
|
export interface AppWindowContextProps {
|
|
11
15
|
position: {
|
package/package.json
CHANGED