16052: Upgrades webpack-dev-server's version requested by react-scripts-ts.
[arvados-workbench2.git] / src / components / popover / helpers.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { PopoverOrigin } from "@material-ui/core/Popover";
6
7 export const createAnchorAt = (position: {x: number, y: number}) => {
8     const el = document.createElement('div');
9     const clientRect = {
10         left: position.x,
11         right: position.x,
12         top: position.y,
13         bottom: position.y,
14         width: 0,
15         height: 0
16     };
17     el.getBoundingClientRect = () => clientRect;
18     return el;
19 };
20
21 export const DefaultTransformOrigin: PopoverOrigin = {
22     vertical: "top",
23     horizontal: "right",
24 };