Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
@@ -0,0 +1,22 @@
import { fromFloatingUIPlacement } from './fromFloatingUIPlacement';
/**
* Shim to transform offset values from this library to Floating UI
* @param rawOffset Offset from this library
* @returns An offset value compatible with Floating UI
*/ export function getFloatingUIOffset(rawOffset) {
if (!rawOffset) {
return rawOffset;
}
if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {
return rawOffset;
}
return ({ rects: { floating, reference }, placement })=>{
const { position, alignment } = fromFloatingUIPlacement(placement);
return rawOffset({
positionedRect: floating,
targetRect: reference,
position,
alignment
});
};
}