1- import { createAnimation , isPlatform } from '@ionic/core' ;
1+ import { createAnimation } from '@ionic/core' ;
22import type { Animation } from '@ionic/core/dist/types/utils/animation/animation-interface' ;
33import { getElementRoot } from '../../utils' ;
4- import { calculateWindowAdjustment , getArrowDimensions , getPopoverDimensions , getPopoverPosition , shouldShowArrow } from '../utils' ;
4+ import { calculateWindowAdjustment , getPopoverDimensions , getPopoverPosition } from '../utils' ;
55
66const POPOVER_IOS_BODY_PADDING = 5 ;
77export const POPOVER_IOS_BODY_MARGIN = 8 ;
@@ -19,11 +19,9 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
1919
2020 const root = getElementRoot ( baseEl ) ;
2121 const contentEl = root . querySelector ( '.popover-content' ) as HTMLElement ;
22- const arrowEl = root . querySelector ( '.popover-arrow' ) as HTMLElement | null ;
2322
2423 const referenceSizeEl = trigger || ev ?. detail ?. ionShadowTarget || ev ?. target ;
2524 const { contentWidth, contentHeight } = getPopoverDimensions ( size , contentEl , referenceSizeEl ) ;
26- const { arrowWidth, arrowHeight } = getArrowDimensions ( arrowEl ) ;
2725
2826 const isReplace = ( ( ) : boolean => {
2927 if ( ! [ 'ion-button' , 'ion-buttons' ] . includes ( referenceSizeEl . localName ) ) {
@@ -42,43 +40,27 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
4240 originY : 'top' ,
4341 } ;
4442
45- const results = getPopoverPosition (
46- isRTL ,
47- contentWidth ,
48- contentHeight ,
49- arrowWidth ,
50- arrowHeight ,
51- reference ,
52- side ,
53- align ,
54- defaultPosition ,
55- trigger ,
56- ev ,
57- ) ;
43+ const results = getPopoverPosition ( isRTL , contentWidth , contentHeight , reference , side , align , defaultPosition , trigger , ev ) ;
5844
5945 const padding = size === 'cover' ? 0 : POPOVER_IOS_BODY_PADDING ;
6046 const margin = size === 'cover' ? 0 : 25 ;
6147
62- const { originX, originY, top, left, bottom, checkSafeAreaLeft, checkSafeAreaRight, arrowTop, arrowLeft, addPopoverBottomClass } =
63- calculateWindowAdjustment (
64- side ,
65- results . top ,
66- results . left ,
67- padding ,
68- bodyWidth ,
69- bodyHeight ,
70- contentWidth ,
71- contentHeight ,
72- margin ,
73- results . originX ,
74- results . originY ,
75- results . referenceCoordinates ,
76- results . arrowTop ,
77- results . arrowLeft ,
78- arrowHeight ,
79- referenceSizeEl . getBoundingClientRect ( ) ,
80- isReplace ,
81- ) ;
48+ const { originX, originY, top, left, bottom, checkSafeAreaLeft, checkSafeAreaRight, addPopoverBottomClass } = calculateWindowAdjustment (
49+ side ,
50+ results . top ,
51+ results . left ,
52+ padding ,
53+ bodyWidth ,
54+ bodyHeight ,
55+ contentWidth ,
56+ contentHeight ,
57+ margin ,
58+ results . originX ,
59+ results . originY ,
60+ results . referenceCoordinates ,
61+ referenceSizeEl . getBoundingClientRect ( ) ,
62+ isReplace ,
63+ ) ;
8264
8365 const baseAnimation = createAnimation ( ) ;
8466 const backdropAnimation = createAnimation ( ) ;
@@ -97,13 +79,12 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
9779
9880 // In Chromium, if the wrapper animates, the backdrop filter doesn't work.
9981 // The Chromium team stated that this behavior is expected and not a bug. The element animating opacity creates a backdrop root for the backdrop-filter.
100- // To get around this, instead of animating the wrapper, animate both the arrow and content.
82+ // To get around this, instead of animating the wrapper, animate content.
10183 // https://bugs.chromium.org/p/chromium/issues/detail?id=1148826
10284 contentAnimation
10385 . easing ( 'cubic-bezier(0, 1, 0.22, 1)' )
10486 . delay ( 100 )
10587 . duration ( 400 )
106- . addElement ( root . querySelector ( '.popover-arrow' ) ! )
10788 . addElement ( root . querySelector ( '.popover-content' ) ! )
10889 . beforeStyles ( { 'transform-origin' : `${ originY } ${ originX } ` } )
10990 . beforeAddWrite ( ( ) => {
@@ -114,7 +95,6 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
11495 } )
11596 . fromTo ( 'transform' , 'scale(0)' , 'scale(1)' )
11697 . fromTo ( 'opacity' , 0.01 , 1 ) ;
117- // TODO(FW-4376) Ensure that arrow also blurs when translucent
11898
11999 if ( isReplace ) {
120100 targetAnimation
@@ -159,18 +139,6 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
159139 contentEl . style . setProperty ( 'top' , `calc(${ top } px + var(--offset-y, 0))` ) ;
160140 contentEl . style . setProperty ( 'left' , `calc(${ leftValue } + var(--offset-x, 0))` ) ;
161141 contentEl . style . setProperty ( 'transform-origin' , `${ originY } ${ originX } ` ) ;
162-
163- if ( arrowEl !== null ) {
164- const didAdjustBounds = results . top !== top || results . left !== left ;
165- const showArrow = shouldShowArrow ( side , didAdjustBounds , ev , trigger ) ;
166-
167- if ( showArrow ) {
168- arrowEl . style . setProperty ( 'top' , `calc(${ arrowTop } px + var(--offset-y, 0))` ) ;
169- arrowEl . style . setProperty ( 'left' , `calc(${ arrowLeft } px + var(--offset-x, 0))` ) ;
170- } else {
171- arrowEl . style . setProperty ( 'display' , 'none' ) ;
172- }
173- }
174142 } )
175143 . addAnimation ( [ backdropAnimation , contentAnimation , targetAnimation ] ) ;
176144} ;
0 commit comments