import { Placement } from "@popperjs/core" ; import { PopoverPosition } from "@blueprintjs/core" ; param position export function positionToPlacement ( position ) { switch ( position ) { case PopoverPosition . TOP_LEFT : return "top-start" ; case PopoverPosition . TOP : return "top" ; case PopoverPosition . TOP_RIGHT : return "top-end" ; case PopoverPosition . RIGHT_TOP : return "right-start" ; case PopoverPosition . RIGHT : return "right" ; case PopoverPosition . RIGHT_BOTTOM : return "right-end" ; case PopoverPosition . BOTTOM_RIGHT : return "bottom-end" ; case PopoverPosition . BOTTOM : return "bottom" ; case PopoverPosition . BOTTOM_LEFT : return "bottom-start" ; case PopoverPosition . LEFT_BOTTOM : return "left-end" ; case PopoverPosition . LEFT : return "left" ; case PopoverPosition . LEFT_TOP : return "left-start" ; case "auto" : case "auto-start" : case "auto-end" : return position ; default : return assertNever ( position ) ; } } function assertNever ( x ) { throw new Error ( "Unexpected position: " + x ) ; }