UNPKG

baseui

Version:

A React Component library implementing the Base design language

27 lines (23 loc) 670 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parsePopperOffset = parsePopperOffset; exports.toPopperPlacement = toPopperPlacement; /* Copyright (c) Uber Technologies, Inc. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. */ function toPopperPlacement(placement) { return placement.replace(/(Top|Left)$/, '-start').replace(/(Right|Bottom)$/, '-end'); } /** * Takes the offset passed from popper.js and normalizes it */ function parsePopperOffset(offset) { return { top: Math.floor(offset.top || 0), left: Math.floor(offset.left || 0) }; }