17782: Disabling typechecking for some common Field component usage.
[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: DOMRect = {
10         x: position.x,
11         y: position.y,
12         toJSON: () => '',
13         left: position.x,
14         right: position.x,
15         top: position.y,
16         bottom: position.y,
17         width: 0,
18         height: 0
19     };
20     el.getBoundingClientRect = () => clientRect;
21     return el;
22 };
23
24 export const DefaultTransformOrigin: PopoverOrigin = {
25     vertical: "top",
26     horizontal: "right",
27 };