44 clamp ,
55 contains ,
66 getBoundingClientRect ,
7+ getDirection ,
78 getDocumentElement ,
89 getNodeName ,
910 getOffsetParent ,
@@ -58,7 +59,7 @@ const getAlignmentFromPlacement = (
5859const getAlignmentSidesFromPlacement = (
5960 placement : Placement ,
6061 elementRects : ElementRects ,
61- isRtl : boolean ,
62+ isRTL : boolean ,
6263) : { mainSide : Side ; crossSide : Side } => {
6364 const alignment = getAlignmentFromPlacement ( placement ) ;
6465 const mainAxis = getMainAxisFromPlacement ( placement ) ;
@@ -75,7 +76,7 @@ const getAlignmentSidesFromPlacement = (
7576
7677 let mainSide : Side =
7778 mainAxis === "x"
78- ? alignment === ( isRtl ? "end" : "start" )
79+ ? alignment === ( isRTL ? "end" : "start" )
7980 ? "right"
8081 : "left"
8182 : alignment === "start"
@@ -434,9 +435,10 @@ const calcCoordinatesFromPlacement = (args: {
434435 elements : Elements ;
435436 elementRects : ElementRects ;
436437 strategy : Strategy ;
437- isRtl : boolean ;
438+ isRTL : boolean ;
438439} ) : Coordinates => {
439- const { placement, offset, elementRects, elements, strategy, isRtl } = args ;
440+ const { placement, offset, elementRects, elements, strategy, isRTL } = args ;
441+
440442 const { anchorRect, popperRect } = elementRects ;
441443
442444 const commonX = anchorRect . x + ( anchorRect . width - popperRect . width ) / 2 ;
@@ -473,10 +475,10 @@ const calcCoordinatesFromPlacement = (args: {
473475
474476 switch ( alignment ) {
475477 case "start" :
476- coordinates [ mainAxis ] -= commonAlign * ( isRtl && isVertical ? - 1 : 1 ) ;
478+ coordinates [ mainAxis ] -= commonAlign * ( isRTL && isVertical ? - 1 : 1 ) ;
477479 break ;
478480 case "end" :
479- coordinates [ mainAxis ] += commonAlign * ( isRtl && isVertical ? - 1 : 1 ) ;
481+ coordinates [ mainAxis ] += commonAlign * ( isRTL && isVertical ? - 1 : 1 ) ;
480482 break ;
481483 default :
482484 }
@@ -513,7 +515,7 @@ const calcCoordinatesFromPlacement = (args: {
513515 let crossAxisCoef = 1 ;
514516
515517 if ( alignment === "end" ) crossAxisCoef = - 1 ;
516- if ( isRtl && isVertical ) crossAxisCoef *= - 1 ;
518+ if ( isRTL && isVertical ) crossAxisCoef *= - 1 ;
517519
518520 let mainAxisOffset = 0 ;
519521 let crossAxisOffset = 0 ;
@@ -550,11 +552,11 @@ export const suppressViewportOverflow = (
550552 args : {
551553 placement : Placement ;
552554 elementRects : ElementRects ;
553- isRtl : boolean ;
555+ isRTL : boolean ;
554556 overflow : ComputationMiddlewareArgs [ "overflow" ] ;
555557 } ,
556558) => {
557- const { overflow, placement, elementRects, isRtl } = args ;
559+ const { overflow, placement, elementRects, isRTL : isRTL } = args ;
558560 const alignment = getAlignmentFromPlacement ( placement ) ;
559561
560562 const _getOppositeAlignment = ( placement : Placement ) =>
@@ -601,7 +603,7 @@ export const suppressViewportOverflow = (
601603 const { mainSide, crossSide } = getAlignmentSidesFromPlacement (
602604 currentPlacement ,
603605 elementRects ,
604- isRtl ,
606+ isRTL ,
605607 ) ;
606608
607609 const currentOverflows = [
@@ -659,7 +661,6 @@ export const computePosition = (
659661) : ComputationResult => {
660662 const {
661663 strategy,
662- isRtl,
663664 autoPlacement,
664665 offset,
665666 placement : initialPlacement ,
@@ -672,8 +673,10 @@ export const computePosition = (
672673 const elements : Elements = { anchorElement, popperElement } ;
673674 const elementRects = getElementRects ( elements , strategy ) ;
674675
676+ const isRTL = getDirection ( elements . popperElement ) === "rtl" ;
677+
675678 let { x, y } = calcCoordinatesFromPlacement ( {
676- isRtl ,
679+ isRTL ,
677680 offset,
678681 strategy,
679682 elements,
@@ -710,7 +713,7 @@ export const computePosition = (
710713 elementRects,
711714 placement,
712715 overflow,
713- isRtl ,
716+ isRTL ,
714717 } ) ;
715718 }
716719
@@ -731,7 +734,7 @@ export const computePosition = (
731734 placement = result . placement ?? placement ;
732735
733736 const coords = calcCoordinatesFromPlacement ( {
734- isRtl ,
737+ isRTL ,
735738 offset,
736739 strategy,
737740 elements,
0 commit comments