@dataloop-ai/components 0.19.170 → 0.19.171
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.
package/package.json
CHANGED
|
@@ -41,7 +41,7 @@ const horizontalPos = {
|
|
|
41
41
|
const positions = ['left', 'middle', 'right']
|
|
42
42
|
|
|
43
43
|
positions.forEach((pos) => {
|
|
44
|
-
(horizontalPos as { [key: string]: string })[`${pos}#ltr`] = pos
|
|
44
|
+
;(horizontalPos as { [key: string]: string })[`${pos}#ltr`] = pos
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
interface AnchorProps {
|
|
@@ -81,7 +81,7 @@ export function parsePosition(pos: string): ParsedPosition {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export function getAnchorProps(el: HTMLElement, offset
|
|
84
|
+
export function getAnchorProps(el: HTMLElement, offset?: number[]) {
|
|
85
85
|
let { top, left, right, bottom, width, height } = el.getBoundingClientRect()
|
|
86
86
|
|
|
87
87
|
if (offset) {
|
|
@@ -101,8 +101,8 @@ export function getAnchorProps(el: HTMLElement, offset: number[]) {
|
|
|
101
101
|
bottom,
|
|
102
102
|
width,
|
|
103
103
|
height,
|
|
104
|
-
middle: left + (right - left) / 2 + offset[0] ?? 0,
|
|
105
|
-
center: top + (bottom - top) / 2 + offset[1] ?? 0
|
|
104
|
+
middle: left + (right - left) / 2 + offset?.[0] ?? 0,
|
|
105
|
+
center: top + (bottom - top) / 2 + offset?.[1] ?? 0
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|