@ionic/core 8.6.4-nightly.20250708 → 8.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/modal.js +282 -9
- package/dist/cjs/ion-modal.cjs.entry.js +281 -8
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/modal/animations/ios.enter.js +2 -2
- package/dist/collection/components/modal/animations/ios.leave.js +2 -2
- package/dist/collection/components/modal/animations/ios.transition.js +162 -0
- package/dist/collection/components/modal/modal.js +140 -6
- package/dist/collection/utils/test/playwright/page/utils/set-content.js +20 -2
- package/dist/docs.json +9 -2
- package/dist/esm/ion-modal.entry.js +282 -9
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-5c88e4c6.entry.js +4 -0
- package/dist/types/components/modal/animations/ios.transition.d.ts +14 -0
- package/dist/types/components/modal/modal.d.ts +9 -0
- package/dist/types/utils/test/playwright/playwright-declarations.d.ts +5 -0
- package/hydrate/index.js +282 -9
- package/hydrate/index.mjs +282 -9
- package/package.json +1 -1
- package/dist/ionic/p-9e32212d.entry.js +0 -4
package/hydrate/index.mjs
CHANGED
|
@@ -21216,7 +21216,7 @@ const iosEnterAnimation$3 = (baseEl, opts) => {
|
|
|
21216
21216
|
baseAnimation.addAnimation(contentAnimation);
|
|
21217
21217
|
}
|
|
21218
21218
|
if (presentingEl) {
|
|
21219
|
-
const
|
|
21219
|
+
const isPortrait = window.innerWidth < 768;
|
|
21220
21220
|
const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
21221
21221
|
const presentingElRoot = getElementRoot(presentingEl);
|
|
21222
21222
|
const presentingAnimation = createAnimation().beforeStyles({
|
|
@@ -21225,7 +21225,7 @@ const iosEnterAnimation$3 = (baseEl, opts) => {
|
|
|
21225
21225
|
overflow: 'hidden',
|
|
21226
21226
|
});
|
|
21227
21227
|
const bodyEl = document.body;
|
|
21228
|
-
if (
|
|
21228
|
+
if (isPortrait) {
|
|
21229
21229
|
/**
|
|
21230
21230
|
* Fallback for browsers that does not support `max()` (ex: Firefox)
|
|
21231
21231
|
* No need to worry about statusbar padding since engines like Gecko
|
|
@@ -21303,7 +21303,7 @@ const iosLeaveAnimation$3 = (baseEl, opts, duration = 500) => {
|
|
|
21303
21303
|
.duration(duration)
|
|
21304
21304
|
.addAnimation(wrapperAnimation);
|
|
21305
21305
|
if (presentingEl) {
|
|
21306
|
-
const
|
|
21306
|
+
const isPortrait = window.innerWidth < 768;
|
|
21307
21307
|
const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
21308
21308
|
const presentingElRoot = getElementRoot(presentingEl);
|
|
21309
21309
|
const presentingAnimation = createAnimation()
|
|
@@ -21321,7 +21321,7 @@ const iosLeaveAnimation$3 = (baseEl, opts, duration = 500) => {
|
|
|
21321
21321
|
}
|
|
21322
21322
|
});
|
|
21323
21323
|
const bodyEl = document.body;
|
|
21324
|
-
if (
|
|
21324
|
+
if (isPortrait) {
|
|
21325
21325
|
const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
|
|
21326
21326
|
const modalTransform = hasCardModal ? '-10px' : transformOffset;
|
|
21327
21327
|
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
@@ -21368,6 +21368,163 @@ const iosLeaveAnimation$3 = (baseEl, opts, duration = 500) => {
|
|
|
21368
21368
|
return baseAnimation;
|
|
21369
21369
|
};
|
|
21370
21370
|
|
|
21371
|
+
/**
|
|
21372
|
+
* Transition animation from portrait view to landscape view
|
|
21373
|
+
* This handles the case where a card modal is open in portrait view
|
|
21374
|
+
* and the user switches to landscape view
|
|
21375
|
+
*/
|
|
21376
|
+
const portraitToLandscapeTransition = (baseEl, opts, duration = 300) => {
|
|
21377
|
+
const { presentingEl } = opts;
|
|
21378
|
+
if (!presentingEl) {
|
|
21379
|
+
// No transition needed for non-card modals
|
|
21380
|
+
return createAnimation('portrait-to-landscape-transition');
|
|
21381
|
+
}
|
|
21382
|
+
const presentingElIsCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
21383
|
+
const presentingElRoot = getElementRoot(presentingEl);
|
|
21384
|
+
const bodyEl = document.body;
|
|
21385
|
+
const baseAnimation = createAnimation('portrait-to-landscape-transition')
|
|
21386
|
+
.addElement(baseEl)
|
|
21387
|
+
.easing('cubic-bezier(0.32,0.72,0,1)')
|
|
21388
|
+
.duration(duration);
|
|
21389
|
+
const presentingAnimation = createAnimation().beforeStyles({
|
|
21390
|
+
transform: 'translateY(0)',
|
|
21391
|
+
'transform-origin': 'top center',
|
|
21392
|
+
overflow: 'hidden',
|
|
21393
|
+
});
|
|
21394
|
+
if (!presentingElIsCardModal) {
|
|
21395
|
+
// The presenting element is not a card modal, so we do not
|
|
21396
|
+
// need to care about layering and modal-specific styles.
|
|
21397
|
+
const root = getElementRoot(baseEl);
|
|
21398
|
+
const wrapperAnimation = createAnimation()
|
|
21399
|
+
.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow'))
|
|
21400
|
+
.fromTo('opacity', '1', '1'); // Keep wrapper visible in landscape
|
|
21401
|
+
const backdropAnimation = createAnimation()
|
|
21402
|
+
.addElement(root.querySelector('ion-backdrop'))
|
|
21403
|
+
.fromTo('opacity', 'var(--backdrop-opacity)', 'var(--backdrop-opacity)'); // Keep backdrop visible
|
|
21404
|
+
// Animate presentingEl from portrait state back to normal
|
|
21405
|
+
const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
|
|
21406
|
+
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
21407
|
+
const fromTransform = `translateY(${transformOffset}) scale(${toPresentingScale})`;
|
|
21408
|
+
presentingAnimation
|
|
21409
|
+
.addElement(presentingEl)
|
|
21410
|
+
.afterStyles({
|
|
21411
|
+
transform: 'translateY(0px) scale(1)',
|
|
21412
|
+
'border-radius': '0px',
|
|
21413
|
+
})
|
|
21414
|
+
.beforeAddWrite(() => bodyEl.style.setProperty('background-color', ''))
|
|
21415
|
+
.fromTo('transform', fromTransform, 'translateY(0px) scale(1)')
|
|
21416
|
+
.fromTo('filter', 'contrast(0.85)', 'contrast(1)')
|
|
21417
|
+
.fromTo('border-radius', '10px 10px 0 0', '0px');
|
|
21418
|
+
baseAnimation.addAnimation([presentingAnimation, wrapperAnimation, backdropAnimation]);
|
|
21419
|
+
}
|
|
21420
|
+
else {
|
|
21421
|
+
// The presenting element is a card modal, so we do
|
|
21422
|
+
// need to care about layering and modal-specific styles.
|
|
21423
|
+
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
21424
|
+
const fromTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
21425
|
+
const toTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
21426
|
+
presentingAnimation
|
|
21427
|
+
.addElement(presentingElRoot.querySelector('.modal-wrapper'))
|
|
21428
|
+
.afterStyles({
|
|
21429
|
+
transform: toTransform,
|
|
21430
|
+
})
|
|
21431
|
+
.fromTo('transform', fromTransform, toTransform)
|
|
21432
|
+
.fromTo('filter', 'contrast(0.85)', 'contrast(0.85)'); // Keep same contrast for card
|
|
21433
|
+
const shadowAnimation = createAnimation()
|
|
21434
|
+
.addElement(presentingElRoot.querySelector('.modal-shadow'))
|
|
21435
|
+
.afterStyles({
|
|
21436
|
+
transform: toTransform,
|
|
21437
|
+
})
|
|
21438
|
+
.fromTo('opacity', '0', '0') // Shadow stays hidden in landscape for card modals
|
|
21439
|
+
.fromTo('transform', fromTransform, toTransform);
|
|
21440
|
+
baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
|
|
21441
|
+
}
|
|
21442
|
+
return baseAnimation;
|
|
21443
|
+
};
|
|
21444
|
+
/**
|
|
21445
|
+
* Transition animation from landscape view to portrait view
|
|
21446
|
+
* This handles the case where a card modal is open in landscape view
|
|
21447
|
+
* and the user switches to portrait view
|
|
21448
|
+
*/
|
|
21449
|
+
const landscapeToPortraitTransition = (baseEl, opts, duration = 300) => {
|
|
21450
|
+
const { presentingEl } = opts;
|
|
21451
|
+
if (!presentingEl) {
|
|
21452
|
+
// No transition needed for non-card modals
|
|
21453
|
+
return createAnimation('landscape-to-portrait-transition');
|
|
21454
|
+
}
|
|
21455
|
+
const presentingElIsCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
21456
|
+
const presentingElRoot = getElementRoot(presentingEl);
|
|
21457
|
+
const bodyEl = document.body;
|
|
21458
|
+
const baseAnimation = createAnimation('landscape-to-portrait-transition')
|
|
21459
|
+
.addElement(baseEl)
|
|
21460
|
+
.easing('cubic-bezier(0.32,0.72,0,1)')
|
|
21461
|
+
.duration(duration);
|
|
21462
|
+
const presentingAnimation = createAnimation().beforeStyles({
|
|
21463
|
+
transform: 'translateY(0)',
|
|
21464
|
+
'transform-origin': 'top center',
|
|
21465
|
+
overflow: 'hidden',
|
|
21466
|
+
});
|
|
21467
|
+
if (!presentingElIsCardModal) {
|
|
21468
|
+
// The presenting element is not a card modal, so we do not
|
|
21469
|
+
// need to care about layering and modal-specific styles.
|
|
21470
|
+
const root = getElementRoot(baseEl);
|
|
21471
|
+
const wrapperAnimation = createAnimation()
|
|
21472
|
+
.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow'))
|
|
21473
|
+
.fromTo('opacity', '1', '1'); // Keep wrapper visible
|
|
21474
|
+
const backdropAnimation = createAnimation()
|
|
21475
|
+
.addElement(root.querySelector('ion-backdrop'))
|
|
21476
|
+
.fromTo('opacity', 'var(--backdrop-opacity)', 'var(--backdrop-opacity)'); // Keep backdrop visible
|
|
21477
|
+
// Animate presentingEl from normal state to portrait state
|
|
21478
|
+
const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
|
|
21479
|
+
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
21480
|
+
const toTransform = `translateY(${transformOffset}) scale(${toPresentingScale})`;
|
|
21481
|
+
presentingAnimation
|
|
21482
|
+
.addElement(presentingEl)
|
|
21483
|
+
.beforeStyles({
|
|
21484
|
+
transform: 'translateY(0px) scale(1)',
|
|
21485
|
+
'transform-origin': 'top center',
|
|
21486
|
+
overflow: 'hidden',
|
|
21487
|
+
})
|
|
21488
|
+
.afterStyles({
|
|
21489
|
+
transform: toTransform,
|
|
21490
|
+
'border-radius': '10px 10px 0 0',
|
|
21491
|
+
filter: 'contrast(0.85)',
|
|
21492
|
+
overflow: 'hidden',
|
|
21493
|
+
'transform-origin': 'top center',
|
|
21494
|
+
})
|
|
21495
|
+
.beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
|
|
21496
|
+
.keyframes([
|
|
21497
|
+
{ offset: 0, transform: 'translateY(0px) scale(1)', filter: 'contrast(1)', borderRadius: '0px' },
|
|
21498
|
+
{ offset: 0.2, transform: 'translateY(0px) scale(1)', filter: 'contrast(1)', borderRadius: '10px 10px 0 0' },
|
|
21499
|
+
{ offset: 1, transform: toTransform, filter: 'contrast(0.85)', borderRadius: '10px 10px 0 0' },
|
|
21500
|
+
]);
|
|
21501
|
+
baseAnimation.addAnimation([presentingAnimation, wrapperAnimation, backdropAnimation]);
|
|
21502
|
+
}
|
|
21503
|
+
else {
|
|
21504
|
+
// The presenting element is also a card modal, so we need
|
|
21505
|
+
// to handle layering and modal-specific styles.
|
|
21506
|
+
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
21507
|
+
const fromTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
21508
|
+
const toTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
21509
|
+
presentingAnimation
|
|
21510
|
+
.addElement(presentingElRoot.querySelector('.modal-wrapper'))
|
|
21511
|
+
.afterStyles({
|
|
21512
|
+
transform: toTransform,
|
|
21513
|
+
})
|
|
21514
|
+
.fromTo('transform', fromTransform, toTransform)
|
|
21515
|
+
.fromTo('filter', 'contrast(0.85)', 'contrast(0.85)'); // Keep same contrast for card
|
|
21516
|
+
const shadowAnimation = createAnimation()
|
|
21517
|
+
.addElement(presentingElRoot.querySelector('.modal-shadow'))
|
|
21518
|
+
.afterStyles({
|
|
21519
|
+
transform: toTransform,
|
|
21520
|
+
})
|
|
21521
|
+
.fromTo('opacity', '0', '0') // Shadow stays hidden
|
|
21522
|
+
.fromTo('transform', fromTransform, toTransform);
|
|
21523
|
+
baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
|
|
21524
|
+
}
|
|
21525
|
+
return baseAnimation;
|
|
21526
|
+
};
|
|
21527
|
+
|
|
21371
21528
|
const createEnterAnimation = () => {
|
|
21372
21529
|
const backdropAnimation = createAnimation()
|
|
21373
21530
|
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
@@ -22147,6 +22304,16 @@ class Modal {
|
|
|
22147
22304
|
triggerController.addClickListener(el, trigger);
|
|
22148
22305
|
}
|
|
22149
22306
|
}
|
|
22307
|
+
onWindowResize() {
|
|
22308
|
+
// Only handle resize for iOS card modals when no custom animations are provided
|
|
22309
|
+
if (getIonMode$1(this) !== 'ios' || !this.presentingElement || this.enterAnimation || this.leaveAnimation) {
|
|
22310
|
+
return;
|
|
22311
|
+
}
|
|
22312
|
+
clearTimeout(this.resizeTimeout);
|
|
22313
|
+
this.resizeTimeout = setTimeout(() => {
|
|
22314
|
+
this.handleViewTransition();
|
|
22315
|
+
}, 50); // Debounce to avoid excessive calls during active resizing
|
|
22316
|
+
}
|
|
22150
22317
|
breakpointsChanged(breakpoints) {
|
|
22151
22318
|
if (breakpoints !== undefined) {
|
|
22152
22319
|
this.sortedBreakpoints = breakpoints.sort((a, b) => a - b);
|
|
@@ -22159,6 +22326,7 @@ class Modal {
|
|
|
22159
22326
|
}
|
|
22160
22327
|
disconnectedCallback() {
|
|
22161
22328
|
this.triggerController.removeClickListener();
|
|
22329
|
+
this.cleanupViewTransitionListener();
|
|
22162
22330
|
}
|
|
22163
22331
|
componentWillLoad() {
|
|
22164
22332
|
var _a;
|
|
@@ -22369,6 +22537,8 @@ class Modal {
|
|
|
22369
22537
|
else if (hasCardModal) {
|
|
22370
22538
|
this.initSwipeToClose();
|
|
22371
22539
|
}
|
|
22540
|
+
// Initialize view transition listener for iOS card modals
|
|
22541
|
+
this.initViewTransitionListener();
|
|
22372
22542
|
unlock();
|
|
22373
22543
|
}
|
|
22374
22544
|
initSwipeToClose() {
|
|
@@ -22522,6 +22692,7 @@ class Modal {
|
|
|
22522
22692
|
if (this.gesture) {
|
|
22523
22693
|
this.gesture.destroy();
|
|
22524
22694
|
}
|
|
22695
|
+
this.cleanupViewTransitionListener();
|
|
22525
22696
|
}
|
|
22526
22697
|
this.currentBreakpoint = undefined;
|
|
22527
22698
|
this.animation = undefined;
|
|
@@ -22597,6 +22768,108 @@ class Modal {
|
|
|
22597
22768
|
await this.setCurrentBreakpoint(nextBreakpoint);
|
|
22598
22769
|
return true;
|
|
22599
22770
|
}
|
|
22771
|
+
initViewTransitionListener() {
|
|
22772
|
+
// Only enable for iOS card modals when no custom animations are provided
|
|
22773
|
+
if (getIonMode$1(this) !== 'ios' || !this.presentingElement || this.enterAnimation || this.leaveAnimation) {
|
|
22774
|
+
return;
|
|
22775
|
+
}
|
|
22776
|
+
// Set initial view state
|
|
22777
|
+
this.currentViewIsPortrait = window.innerWidth < 768;
|
|
22778
|
+
}
|
|
22779
|
+
handleViewTransition() {
|
|
22780
|
+
const isPortrait = window.innerWidth < 768;
|
|
22781
|
+
// Only transition if view state actually changed
|
|
22782
|
+
if (this.currentViewIsPortrait === isPortrait) {
|
|
22783
|
+
return;
|
|
22784
|
+
}
|
|
22785
|
+
// Cancel any ongoing transition animation
|
|
22786
|
+
if (this.viewTransitionAnimation) {
|
|
22787
|
+
this.viewTransitionAnimation.destroy();
|
|
22788
|
+
this.viewTransitionAnimation = undefined;
|
|
22789
|
+
}
|
|
22790
|
+
const { presentingElement } = this;
|
|
22791
|
+
if (!presentingElement) {
|
|
22792
|
+
return;
|
|
22793
|
+
}
|
|
22794
|
+
// Create transition animation
|
|
22795
|
+
let transitionAnimation;
|
|
22796
|
+
if (this.currentViewIsPortrait && !isPortrait) {
|
|
22797
|
+
// Portrait to landscape transition
|
|
22798
|
+
transitionAnimation = portraitToLandscapeTransition(this.el, {
|
|
22799
|
+
presentingEl: presentingElement});
|
|
22800
|
+
}
|
|
22801
|
+
else {
|
|
22802
|
+
// Landscape to portrait transition
|
|
22803
|
+
transitionAnimation = landscapeToPortraitTransition(this.el, {
|
|
22804
|
+
presentingEl: presentingElement});
|
|
22805
|
+
}
|
|
22806
|
+
// Update state and play animation
|
|
22807
|
+
this.currentViewIsPortrait = isPortrait;
|
|
22808
|
+
this.viewTransitionAnimation = transitionAnimation;
|
|
22809
|
+
transitionAnimation.play().then(() => {
|
|
22810
|
+
this.viewTransitionAnimation = undefined;
|
|
22811
|
+
// After orientation transition, recreate the swipe-to-close gesture
|
|
22812
|
+
// with updated animation that reflects the new presenting element state
|
|
22813
|
+
this.reinitSwipeToClose();
|
|
22814
|
+
});
|
|
22815
|
+
}
|
|
22816
|
+
cleanupViewTransitionListener() {
|
|
22817
|
+
// Clear any pending resize timeout
|
|
22818
|
+
if (this.resizeTimeout) {
|
|
22819
|
+
clearTimeout(this.resizeTimeout);
|
|
22820
|
+
this.resizeTimeout = undefined;
|
|
22821
|
+
}
|
|
22822
|
+
if (this.viewTransitionAnimation) {
|
|
22823
|
+
this.viewTransitionAnimation.destroy();
|
|
22824
|
+
this.viewTransitionAnimation = undefined;
|
|
22825
|
+
}
|
|
22826
|
+
}
|
|
22827
|
+
reinitSwipeToClose() {
|
|
22828
|
+
// Only reinitialize if we have a presenting element and are on iOS
|
|
22829
|
+
if (getIonMode$1(this) !== 'ios' || !this.presentingElement) {
|
|
22830
|
+
return;
|
|
22831
|
+
}
|
|
22832
|
+
// Clean up existing gesture and animation
|
|
22833
|
+
if (this.gesture) {
|
|
22834
|
+
this.gesture.destroy();
|
|
22835
|
+
this.gesture = undefined;
|
|
22836
|
+
}
|
|
22837
|
+
if (this.animation) {
|
|
22838
|
+
// Properly end the progress-based animation at initial state before destroying
|
|
22839
|
+
// to avoid leaving modal in intermediate swipe position
|
|
22840
|
+
this.animation.progressEnd(0, 0, 0);
|
|
22841
|
+
this.animation.destroy();
|
|
22842
|
+
this.animation = undefined;
|
|
22843
|
+
}
|
|
22844
|
+
// Force the modal back to the correct position or it could end up
|
|
22845
|
+
// in a weird state after destroying the animation
|
|
22846
|
+
raf(() => {
|
|
22847
|
+
this.ensureCorrectModalPosition();
|
|
22848
|
+
this.initSwipeToClose();
|
|
22849
|
+
});
|
|
22850
|
+
}
|
|
22851
|
+
ensureCorrectModalPosition() {
|
|
22852
|
+
const { el, presentingElement } = this;
|
|
22853
|
+
const root = getElementRoot(el);
|
|
22854
|
+
const wrapperEl = root.querySelector('.modal-wrapper');
|
|
22855
|
+
if (wrapperEl) {
|
|
22856
|
+
wrapperEl.style.transform = 'translateY(0vh)';
|
|
22857
|
+
wrapperEl.style.opacity = '1';
|
|
22858
|
+
}
|
|
22859
|
+
if (presentingElement) {
|
|
22860
|
+
const isPortrait = window.innerWidth < 768;
|
|
22861
|
+
if (isPortrait) {
|
|
22862
|
+
const transformOffset = !CSS.supports('width', 'max(0px, 1px)')
|
|
22863
|
+
? '30px'
|
|
22864
|
+
: 'max(30px, var(--ion-safe-area-top))';
|
|
22865
|
+
const scale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
22866
|
+
presentingElement.style.transform = `translateY(${transformOffset}) scale(${scale})`;
|
|
22867
|
+
}
|
|
22868
|
+
else {
|
|
22869
|
+
presentingElement.style.transform = 'translateY(0px) scale(1)';
|
|
22870
|
+
}
|
|
22871
|
+
}
|
|
22872
|
+
}
|
|
22600
22873
|
render() {
|
|
22601
22874
|
const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap, expandToScroll, } = this;
|
|
22602
22875
|
const showHandle = handle !== false && isSheetModal;
|
|
@@ -22604,20 +22877,20 @@ class Modal {
|
|
|
22604
22877
|
const isCardModal = presentingElement !== undefined && mode === 'ios';
|
|
22605
22878
|
const isHandleCycle = handleBehavior === 'cycle';
|
|
22606
22879
|
const isSheetModalWithHandle = isSheetModal && showHandle;
|
|
22607
|
-
return (hAsync(Host, Object.assign({ key: '
|
|
22880
|
+
return (hAsync(Host, Object.assign({ key: '1980fa23331381c568a2be8091d888e09754fc52', "no-router": true,
|
|
22608
22881
|
// Allow the modal to be navigable when the handle is focusable
|
|
22609
22882
|
tabIndex: isHandleCycle && isSheetModalWithHandle ? 0 : -1 }, htmlAttributes, { style: {
|
|
22610
22883
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
22611
|
-
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, 'overlay-hidden': true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle, onFocus: this.onModalFocus }), hAsync("ion-backdrop", { key: '
|
|
22884
|
+
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, 'overlay-hidden': true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle, onFocus: this.onModalFocus }), hAsync("ion-backdrop", { key: 'ba94b055c064e2907eabbe6d7a43cb52adff1048', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && hAsync("div", { key: '991f47859250d2143275ebb9b0b01a6ea8c491c0', class: "modal-shadow" }), hAsync("div", Object.assign({ key: '02ecf8ac6a5bdb309ff993cc74a3911e99502a89',
|
|
22612
22885
|
/*
|
|
22613
22886
|
role and aria-modal must be used on the
|
|
22614
22887
|
same element. They must also be set inside the
|
|
22615
22888
|
shadow DOM otherwise ion-button will not be highlighted
|
|
22616
22889
|
when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
|
|
22617
22890
|
*/
|
|
22618
|
-
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (hAsync("button", { key: '
|
|
22891
|
+
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (hAsync("button", { key: '0180a4d6952e41bfd736272d1a49d47d86ca7fef', class: "modal-handle",
|
|
22619
22892
|
// Prevents the handle from receiving keyboard focus when it does not cycle
|
|
22620
|
-
tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle", ref: (el) => (this.dragHandleEl = el) })), hAsync("slot", { key: '
|
|
22893
|
+
tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle", ref: (el) => (this.dragHandleEl = el) })), hAsync("slot", { key: 'd062f330675f730ad70c23267baed200ca9b43b0' }))));
|
|
22621
22894
|
}
|
|
22622
22895
|
get el() { return getElement(this); }
|
|
22623
22896
|
static get watchers() { return {
|
|
@@ -22665,7 +22938,7 @@ class Modal {
|
|
|
22665
22938
|
"setCurrentBreakpoint": [64],
|
|
22666
22939
|
"getCurrentBreakpoint": [64]
|
|
22667
22940
|
},
|
|
22668
|
-
"$listeners$":
|
|
22941
|
+
"$listeners$": [[9, "resize", "onWindowResize"]],
|
|
22669
22942
|
"$lazyBundleId$": "-",
|
|
22670
22943
|
"$attrsToReflect$": []
|
|
22671
22944
|
}; }
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
-
*/
|
|
4
|
-
import{r as t,d as o,m as i,w as a,e,l as r,h as n,j as s,k as d}from"./p-B_U9CtaY.js";import{f as h,i as p,d as l,r as c,a as m,p as f}from"./p-QwEXyOze.js";import{C as b,a as u,d as w}from"./p-BhLqfMrf.js";import{e as x,g as v,r as g,b as k,h as y}from"./p-Do-uqmtX.js";import{c as A}from"./p-B-hirT0v.js";import{g as B}from"./p-CIGNaXM1.js";import{G as D,O as Y,F as E,e as S,B as j,j as C,k as M,f as T,g as O,h as $}from"./p-aIxOGKys.js";import{g as P}from"./p-DiVJyqlX.js";import{e as I,w as R}from"./p-BROiNJRB.js";import{KEYBOARD_DID_OPEN as z}from"./p-9eeaBrnk.js";import{c as W}from"./p-bNmY-WfR.js";import{g as L}from"./p-hHmYLOfE.js";import{createGesture as H}from"./p-Cl0B-RWe.js";import{w as N}from"./p-ZjP4CjeZ.js";import"./p-DzH0J0yi.js";import"./p-BTEOs1at.js";import"./p-D13Eaw-8.js";var F;!function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"}(F||(F={}));const K={getEngine(){const t=B();if(null==t?void 0:t.isPluginAvailable("StatusBar"))return t.Plugins.StatusBar},setStyle(t){const o=this.getEngine();o&&o.setStyle(t)},getStyle:async function(){const t=this.getEngine();if(!t)return F.Default;const{style:o}=await t.getInfo();return o}},Z=(t,o)=>{if(1===o)return 0;const i=1/(1-o);return t*i+-o*i},G=()=>{!N||N.innerWidth>=768||K.setStyle({style:F.Dark})},V=(t=F.Default)=>{!N||N.innerWidth>=768||K.setStyle({style:t})},_=async(t,o)=>{"function"==typeof t.canDismiss&&await t.canDismiss(void 0,D)&&(o.isRunning()?o.onFinish((()=>{t.dismiss(void 0,"handler")}),{oneTimeCallback:!0}):t.dismiss(void 0,"handler"))},X=t=>.00255275*2.71828**(-14.9619*t)-1.00255*2.71828**(-.0380968*t)+1,q=.915,J=(t,o)=>x(400,t/Math.abs(1.1*o),500),U=t=>{const{currentBreakpoint:o,backdropBreakpoint:i,expandToScroll:a}=t,e=void 0===i||i<o,r=e?`calc(var(--backdrop-opacity) * ${o})`:"0",n=W("backdropAnimation").fromTo("opacity",0,r);return e&&n.beforeStyles({"pointer-events":"none"}).afterClearStyles(["pointer-events"]),{wrapperAnimation:W("wrapperAnimation").keyframes([{offset:0,opacity:1,transform:"translateY(100%)"},{offset:1,opacity:1,transform:`translateY(${100-100*o}%)`}]),backdropAnimation:n,contentAnimation:a?void 0:W("contentAnimation").keyframes([{offset:0,opacity:1,maxHeight:100*(1-o)+"%"},{offset:1,opacity:1,maxHeight:100*o+"%"}])}},Q=t=>{const{currentBreakpoint:o,backdropBreakpoint:i}=t,a=`calc(var(--backdrop-opacity) * ${Z(o,i)})`,e=[{offset:0,opacity:a},{offset:1,opacity:0}],r=[{offset:0,opacity:a},{offset:i,opacity:0},{offset:1,opacity:0}],n=W("backdropAnimation").keyframes(0!==i?r:e);return{wrapperAnimation:W("wrapperAnimation").keyframes([{offset:0,opacity:1,transform:`translateY(${100-100*o}%)`},{offset:1,opacity:1,transform:"translateY(100%)"}]),backdropAnimation:n}},tt=(t,o)=>{const{presentingEl:i,currentBreakpoint:a,expandToScroll:e}=o,r=v(t),{wrapperAnimation:n,backdropAnimation:s,contentAnimation:d}=void 0!==a?U(o):{backdropAnimation:W().fromTo("opacity",.01,"var(--backdrop-opacity)").beforeStyles({"pointer-events":"none"}).afterClearStyles(["pointer-events"]),wrapperAnimation:W().fromTo("transform","translateY(100vh)","translateY(0vh)"),contentAnimation:void 0};s.addElement(r.querySelector("ion-backdrop")),n.addElement(r.querySelectorAll(".modal-wrapper, .modal-shadow")).beforeStyles({opacity:1}),!e&&(null==d||d.addElement(t.querySelector(".ion-page")));const h=W("entering-base").addElement(t).easing("cubic-bezier(0.32,0.72,0,1)").duration(500).addAnimation([n]);if(d&&h.addAnimation(d),i){const t=window.innerWidth<768,o="ION-MODAL"===i.tagName&&void 0!==i.presentingElement,a=v(i),e=W().beforeStyles({transform:"translateY(0)","transform-origin":"top center",overflow:"hidden"}),r=document.body;if(t){const t=CSS.supports("width","max(0px, 1px)")?"max(30px, var(--ion-safe-area-top))":"30px",a=`translateY(${o?"-10px":t}) scale(0.915)`;e.afterStyles({transform:a}).beforeAddWrite((()=>r.style.setProperty("background-color","black"))).addElement(i).keyframes([{offset:0,filter:"contrast(1)",transform:"translateY(0px) scale(1)",borderRadius:"0px"},{offset:1,filter:"contrast(0.85)",transform:a,borderRadius:"10px 10px 0 0"}]),h.addAnimation(e)}else if(h.addAnimation(s),o){const t=`translateY(-10px) scale(${o?q:1})`;e.afterStyles({transform:t}).addElement(a.querySelector(".modal-wrapper")).keyframes([{offset:0,filter:"contrast(1)",transform:"translateY(0) scale(1)"},{offset:1,filter:"contrast(0.85)",transform:t}]);const i=W().afterStyles({transform:t}).addElement(a.querySelector(".modal-shadow")).keyframes([{offset:0,opacity:"1",transform:"translateY(0) scale(1)"},{offset:1,opacity:"0",transform:t}]);h.addAnimation([e,i])}else n.fromTo("opacity","0","1")}else h.addAnimation(s);return h},ot=(t,o,i=500)=>{const{presentingEl:a,currentBreakpoint:e}=o,r=v(t),{wrapperAnimation:n,backdropAnimation:s}=void 0!==e?Q(o):{backdropAnimation:W().fromTo("opacity","var(--backdrop-opacity)",0),wrapperAnimation:W().fromTo("transform","translateY(0vh)","translateY(100vh)")};s.addElement(r.querySelector("ion-backdrop")),n.addElement(r.querySelectorAll(".modal-wrapper, .modal-shadow")).beforeStyles({opacity:1});const d=W("leaving-base").addElement(t).easing("cubic-bezier(0.32,0.72,0,1)").duration(i).addAnimation(n);if(a){const t=window.innerWidth<768,o="ION-MODAL"===a.tagName&&void 0!==a.presentingElement,i=v(a),e=W().beforeClearStyles(["transform"]).afterClearStyles(["transform"]).onFinish((t=>{1===t&&(a.style.setProperty("overflow",""),Array.from(r.querySelectorAll("ion-modal:not(.overlay-hidden)")).filter((t=>void 0!==t.presentingElement)).length<=1&&r.style.setProperty("background-color",""))})),r=document.body;if(t){const t=CSS.supports("width","max(0px, 1px)")?"max(30px, var(--ion-safe-area-top))":"30px",i=`translateY(${o?"-10px":t}) scale(0.915)`;e.addElement(a).keyframes([{offset:0,filter:"contrast(0.85)",transform:i,borderRadius:"10px 10px 0 0"},{offset:1,filter:"contrast(1)",transform:"translateY(0px) scale(1)",borderRadius:"0px"}]),d.addAnimation(e)}else if(d.addAnimation(s),o){const t=`translateY(-10px) scale(${o?q:1})`;e.addElement(i.querySelector(".modal-wrapper")).afterStyles({transform:"translate3d(0, 0, 0)"}).keyframes([{offset:0,filter:"contrast(0.85)",transform:t},{offset:1,filter:"contrast(1)",transform:"translateY(0) scale(1)"}]);const a=W().addElement(i.querySelector(".modal-shadow")).afterStyles({transform:"translateY(0) scale(1)"}).keyframes([{offset:0,opacity:"0",transform:t},{offset:1,opacity:"1",transform:"translateY(0) scale(1)"}]);d.addAnimation([e,a])}else n.fromTo("opacity","1","0")}else d.addAnimation(s);return d},it=(t,o)=>{const{currentBreakpoint:i,expandToScroll:a}=o,e=v(t),{wrapperAnimation:r,backdropAnimation:n,contentAnimation:s}=void 0!==i?U(o):{backdropAnimation:W().fromTo("opacity",.01,"var(--backdrop-opacity)").beforeStyles({"pointer-events":"none"}).afterClearStyles(["pointer-events"]),wrapperAnimation:W().keyframes([{offset:0,opacity:.01,transform:"translateY(40px)"},{offset:1,opacity:1,transform:"translateY(0px)"}]),contentAnimation:void 0};n.addElement(e.querySelector("ion-backdrop")),r.addElement(e.querySelector(".modal-wrapper")),!a&&(null==s||s.addElement(t.querySelector(".ion-page")));const d=W().addElement(t).easing("cubic-bezier(0.36,0.66,0.04,1)").duration(280).addAnimation([n,r]);return s&&d.addAnimation(s),d},at=(t,o)=>{const{currentBreakpoint:i}=o,a=v(t),{wrapperAnimation:e,backdropAnimation:r}=void 0!==i?Q(o):{backdropAnimation:W().fromTo("opacity","var(--backdrop-opacity)",0),wrapperAnimation:W().keyframes([{offset:0,opacity:.99,transform:"translateY(0px)"},{offset:1,opacity:0,transform:"translateY(40px)"}])};return r.addElement(a.querySelector("ion-backdrop")),e.addElement(a.querySelector(".modal-wrapper")),W().easing("cubic-bezier(0.47,0,0.745,0.715)").duration(200).addAnimation([r,e])},et=class{constructor(i){t(this,i),this.didPresent=o(this,"ionModalDidPresent",7),this.willPresent=o(this,"ionModalWillPresent",7),this.willDismiss=o(this,"ionModalWillDismiss",7),this.didDismiss=o(this,"ionModalDidDismiss",7),this.ionBreakpointDidChange=o(this,"ionBreakpointDidChange",7),this.didPresentShorthand=o(this,"didPresent",7),this.willPresentShorthand=o(this,"willPresent",7),this.willDismissShorthand=o(this,"willDismiss",7),this.didDismissShorthand=o(this,"didDismiss",7),this.ionMount=o(this,"ionMount",7),this.lockController=A(),this.triggerController=S(),this.coreDelegate=b(),this.isSheetModal=!1,this.inheritedAttributes={},this.inline=!1,this.gestureAnimationDismissing=!1,this.presented=!1,this.hasController=!1,this.keyboardClose=!0,this.expandToScroll=!0,this.backdropBreakpoint=0,this.handleBehavior="none",this.backdropDismiss=!0,this.showBackdrop=!0,this.animated=!0,this.isOpen=!1,this.keepContentsMounted=!1,this.focusTrap=!0,this.canDismiss=!0,this.onHandleClick=()=>{const{sheetTransition:t,handleBehavior:o}=this;"cycle"===o&&void 0===t&&this.moveToNextBreakpoint()},this.onBackdropTap=()=>{const{sheetTransition:t}=this;void 0===t&&this.dismiss(void 0,j)},this.onLifecycle=t=>{const o=this.usersElement,i=rt[t.type];if(o&&i){const a=new CustomEvent(i,{bubbles:!1,cancelable:!1,detail:t.detail});o.dispatchEvent(a)}},this.onModalFocus=t=>{const{dragHandleEl:o,el:i}=this;t.target===i&&o&&-1!==o.tabIndex&&o.focus()}}onIsOpenChange(t,o){!0===t&&!1===o?this.present():!1===t&&!0===o&&this.dismiss()}triggerChanged(){const{trigger:t,el:o,triggerController:i}=this;t&&i.addClickListener(o,t)}breakpointsChanged(t){void 0!==t&&(this.sortedBreakpoints=t.sort(((t,o)=>t-o)))}connectedCallback(){const{el:t}=this;C(t),this.triggerChanged()}disconnectedCallback(){this.triggerController.removeClickListener()}componentWillLoad(){var t;const{breakpoints:o,initialBreakpoint:a,el:e,htmlAttributes:r}=this,n=this.isSheetModal=void 0!==o&&void 0!==a,s=["aria-label","role"];this.inheritedAttributes=k(e,s),void 0!==r&&s.forEach((t=>{r[t]&&(this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:r[t]}),delete r[t])})),n&&(this.currentBreakpoint=this.initialBreakpoint),void 0===o||void 0===a||o.includes(a)||i("[ion-modal] - Your breakpoints array must include the initialBreakpoint value."),(null===(t=this.htmlAttributes)||void 0===t?void 0:t.id)||M(this.el)}componentDidLoad(){!0===this.isOpen&&g((()=>this.present())),this.breakpointsChanged(this.breakpoints),this.triggerChanged()}getDelegate(t=!1){if(this.workingDelegate&&!t)return{delegate:this.workingDelegate,inline:this.inline};const o=this.inline=null!==this.el.parentNode&&!this.hasController;return{inline:o,delegate:this.workingDelegate=o?this.delegate||this.coreDelegate:this.delegate}}async checkCanDismiss(t,o){const{canDismiss:i}=this;return"function"==typeof i?i(t,o):i}async present(){const t=await this.lockController.lock();if(this.presented)return void t();const{presentingElement:o,el:i}=this;this.currentBreakpoint=this.initialBreakpoint;const{inline:r,delegate:n}=this.getDelegate(!0);this.ionMount.emit(),this.usersElement=await u(n,i,this.component,["ion-page"],this.componentProps,r),y(i)?await I(this.usersElement):this.keepContentsMounted||await R(),a((()=>this.el.classList.add("show-modal")));const s=void 0!==o;s&&"ios"===e(this)&&(this.statusBarStyle=await K.getStyle(),G()),await T(this,"modalEnter",tt,it,{presentingEl:o,currentBreakpoint:this.initialBreakpoint,backdropBreakpoint:this.backdropBreakpoint,expandToScroll:this.expandToScroll}),"undefined"!=typeof window&&(this.keyboardOpenCallback=()=>{this.gesture&&(this.gesture.enable(!1),g((()=>{this.gesture&&this.gesture.enable(!0)})))},window.addEventListener(z,this.keyboardOpenCallback)),this.isSheetModal?this.initSheetGesture():s&&this.initSwipeToClose(),t()}initSwipeToClose(){var t;if("ios"!==e(this))return;const{el:o}=this,i=this.leaveAnimation||r.get("modalLeave",ot),a=this.animation=i(o,{presentingEl:this.presentingElement,expandToScroll:this.expandToScroll});if(!m(o))return void f(o);const n=null!==(t=this.statusBarStyle)&&void 0!==t?t:F.Default;this.gesture=((t,o,i,a)=>{const e=.5,r=t.offsetHeight;let n=!1,s=!1,d=null,m=null,f=!0,b=0;const u=H({el:t,gestureName:"modalSwipeToClose",gesturePriority:Y,direction:"y",threshold:10,canStart:t=>{const o=t.event.target;if(null===o||!o.closest)return!0;if(d=h(o),d){if(p(d)){const t=v(d);m=t.querySelector(".inner-scroll")}else m=d;return!d.querySelector("ion-refresher")&&0===m.scrollTop}return null===o.closest("ion-footer")},onStart:i=>{const{deltaY:a}=i;f=!d||!p(d)||d.scrollY,s=void 0!==t.canDismiss&&!0!==t.canDismiss,a>0&&d&&l(d),o.progressStart(!0,n?1:0)},onMove:t=>{const{deltaY:a}=t;a>0&&d&&l(d);const n=t.deltaY/r,h=n>=0&&s,p=h?.2:.9999,c=h?X(n/p):n,m=x(1e-4,c,p);o.progressStep(m),m>=e&&b<e?V(i):m<e&&b>=e&&G(),b=m},onEnd:i=>{const h=i.velocityY,p=i.deltaY/r,l=p>=0&&s,m=l?.2:.9999,b=l?X(p/m):p,w=x(1e-4,b,m),v=!l&&(i.deltaY+1e3*h)/r>=e;let g=v?-.001:.001;v?(o.easing("cubic-bezier(0.32, 0.72, 0, 1)"),g+=L([0,0],[.32,.72],[0,1],[1,1],w)[0]):(o.easing("cubic-bezier(1, 0, 0.68, 0.28)"),g+=L([0,0],[1,0],[.68,.28],[1,1],w)[0]);const k=J(v?p*r:(1-w)*r,h);n=v,u.enable(!1),d&&c(d,f),o.onFinish((()=>{v||u.enable(!0)})).progressEnd(v?1:0,g,k),l&&w>m/4?_(t,o):v&&a()}});return u})(o,a,n,(()=>{this.gestureAnimationDismissing=!0,V(this.statusBarStyle),this.animation.onFinish((async()=>{await this.dismiss(void 0,D),this.gestureAnimationDismissing=!1}))})),this.gesture.enable(!0)}initSheetGesture(){const{wrapperEl:t,initialBreakpoint:o,backdropBreakpoint:i}=this;if(!t||void 0===o)return;const a=this.enterAnimation||r.get("modalEnter",tt),e=this.animation=a(this.el,{presentingEl:this.presentingElement,currentBreakpoint:o,backdropBreakpoint:i,expandToScroll:this.expandToScroll});e.progressStart(!0,1);const{gesture:n,moveSheetToBreakpoint:s}=((t,o,i,a,e,r,n=[],s,d,l,c)=>{const m={WRAPPER_KEYFRAMES:[{offset:0,transform:"translateY(0%)"},{offset:1,transform:"translateY(100%)"}],BACKDROP_KEYFRAMES:0!==e?[{offset:0,opacity:"var(--backdrop-opacity)"},{offset:1-e,opacity:0},{offset:1,opacity:0}]:[{offset:0,opacity:"var(--backdrop-opacity)"},{offset:1,opacity:.01}],CONTENT_KEYFRAMES:[{offset:0,maxHeight:"100%"},{offset:1,maxHeight:"0%"}]},f=t.querySelector("ion-content"),b=i.clientHeight;let u=a,w=0,k=!1,y=null,A=null,B=null,D=null;const Y=n[n.length-1],S=n[0],j=r.childAnimations.find((t=>"wrapperAnimation"===t.id)),C=r.childAnimations.find((t=>"backdropAnimation"===t.id)),M=r.childAnimations.find((t=>"contentAnimation"===t.id)),T=()=>{t.style.setProperty("pointer-events","auto"),o.style.setProperty("pointer-events","auto"),t.classList.remove(E)},O=()=>{t.style.setProperty("pointer-events","none"),o.style.setProperty("pointer-events","none"),t.classList.add(E)},$=o=>{if(!A&&(A=Array.from(t.querySelectorAll("ion-footer")),!A.length))return;const i=t.querySelector(".ion-page");if(D=o,"stationary"===o)A.forEach((t=>{t.classList.remove("modal-footer-moving"),t.style.removeProperty("position"),t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("top"),t.style.removeProperty("left"),null==i||i.style.removeProperty("padding-bottom"),null==i||i.appendChild(t)}));else{let o=0;A.forEach(((i,a)=>{const e=i.getBoundingClientRect(),r=document.body.getBoundingClientRect();o+=i.clientHeight;const n=e.top-r.top,s=e.left-r.left;if(i.style.setProperty("--pinned-width",`${i.clientWidth}px`),i.style.setProperty("--pinned-height",`${i.clientHeight}px`),i.style.setProperty("--pinned-top",`${n}px`),i.style.setProperty("--pinned-left",`${s}px`),0===a){B=n;const o=t.querySelector("ion-header");o&&(B-=o.clientHeight)}})),A.forEach((t=>{null==i||i.style.setProperty("padding-bottom",`${o}px`),t.classList.add("modal-footer-moving"),t.style.setProperty("position","absolute"),t.style.setProperty("width","var(--pinned-width)"),t.style.setProperty("height","var(--pinned-height)"),t.style.setProperty("top","var(--pinned-top)"),t.style.setProperty("left","var(--pinned-left)"),document.body.appendChild(t)}))}};j&&C&&(j.keyframes([...m.WRAPPER_KEYFRAMES]),C.keyframes([...m.BACKDROP_KEYFRAMES]),null==M||M.keyframes([...m.CONTENT_KEYFRAMES]),r.progressStart(!0,1-u),u>e?T():O()),f&&u!==Y&&s&&(f.scrollY=!1);const P=o=>{const{breakpoint:i,canDismiss:a,breakpointOffset:d,animated:h}=o,p=a&&0===i,b=p?u:i,w=0!==b;return u=0,j&&C&&(j.keyframes([{offset:0,transform:`translateY(${100*d}%)`},{offset:1,transform:`translateY(${100*(1-b)}%)`}]),C.keyframes([{offset:0,opacity:`calc(var(--backdrop-opacity) * ${Z(1-d,e)})`},{offset:1,opacity:`calc(var(--backdrop-opacity) * ${Z(b,e)})`}]),M&&M.keyframes([{offset:0,maxHeight:100*(1-d)+"%"},{offset:1,maxHeight:100*b+"%"}]),r.progressStep(0)),I.enable(!1),p?_(t,r):w||l(),!f||b!==n[n.length-1]&&s||(f.scrollY=!0),s||0!==b||$("stationary"),new Promise((t=>{r.onFinish((()=>{w?(s||$("stationary"),j&&C?g((()=>{j.keyframes([...m.WRAPPER_KEYFRAMES]),C.keyframes([...m.BACKDROP_KEYFRAMES]),null==M||M.keyframes([...m.CONTENT_KEYFRAMES]),r.progressStart(!0,1-b),u=b,c(u),u>e?T():O(),I.enable(!0),t()})):(I.enable(!0),t())):t()}),{oneTimeCallback:!0}).progressEnd(1,0,h?500:0)}))},I=H({el:i,gestureName:"modalSheet",gesturePriority:40,direction:"y",threshold:10,canStart:t=>{const o=h(t.event.target);if(u=d(),!s&&o)return 0===(p(o)?v(o).querySelector(".inner-scroll"):o).scrollTop;if(1===u&&o){const t=p(o)?v(o).querySelector(".inner-scroll"):o;return!o.querySelector("ion-refresher")&&0===t.scrollTop}return!0},onStart:o=>{if(k=void 0!==t.canDismiss&&!0!==t.canDismiss&&0===S,!s){const t=h(o.event.target);y=t&&p(t)?v(t).querySelector(".inner-scroll"):t}s||$("moving"),o.deltaY>0&&f&&(f.scrollY=!1),g((()=>{t.focus()})),r.progressStart(!0,1-u)},onMove:t=>{if(s||null===B||null===D||(t.currentY>=B&&"moving"===D?$("stationary"):t.currentY<B&&"stationary"===D&&$("moving")),!s&&t.deltaY<=0&&y)return;t.deltaY>0&&f&&(f.scrollY=!1);const o=n.length>1?1-n[1]:void 0,i=1-u+t.deltaY/b,a=void 0!==o&&i>=o&&k,e=a?.95:.9999,d=a&&void 0!==o?o+X((i-o)/(e-o)):i;w=x(1e-4,d,e),r.progressStep(w)},onEnd:t=>{if(!s&&t.deltaY<=0&&y&&y.scrollTop>0)return void $("stationary");const o=u-(t.deltaY+350*t.velocityY)/b,i=n.reduce(((t,i)=>Math.abs(i-o)<Math.abs(t-o)?i:t));P({breakpoint:i,breakpointOffset:w,canDismiss:k,animated:!0})}});return{gesture:I,moveSheetToBreakpoint:P}})(this.el,this.backdropEl,t,o,i,e,this.sortedBreakpoints,this.expandToScroll,(()=>{var t;return null!==(t=this.currentBreakpoint)&&void 0!==t?t:0}),(()=>this.sheetOnDismiss()),(t=>{this.currentBreakpoint!==t&&(this.currentBreakpoint=t,this.ionBreakpointDidChange.emit({breakpoint:t}))}));this.gesture=n,this.moveSheetToBreakpoint=s,this.gesture.enable(!0)}sheetOnDismiss(){this.gestureAnimationDismissing=!0,this.animation.onFinish((async()=>{this.currentBreakpoint=0,this.ionBreakpointDidChange.emit({breakpoint:this.currentBreakpoint}),await this.dismiss(void 0,D),this.gestureAnimationDismissing=!1}))}async dismiss(t,o){var i;if(this.gestureAnimationDismissing&&o!==D)return!1;const r=await this.lockController.lock();if("handler"!==o&&!await this.checkCanDismiss(t,o))return r(),!1;const{presentingElement:n}=this;void 0!==n&&"ios"===e(this)&&V(this.statusBarStyle),"undefined"!=typeof window&&this.keyboardOpenCallback&&(window.removeEventListener(z,this.keyboardOpenCallback),this.keyboardOpenCallback=void 0);const s=await O(this,t,o,"modalLeave",ot,at,{presentingEl:n,currentBreakpoint:null!==(i=this.currentBreakpoint)&&void 0!==i?i:this.initialBreakpoint,backdropBreakpoint:this.backdropBreakpoint,expandToScroll:this.expandToScroll});if(s){const{delegate:t}=this.getDelegate();await w(t,this.usersElement),a((()=>this.el.classList.remove("show-modal"))),this.animation&&this.animation.destroy(),this.gesture&&this.gesture.destroy()}return this.currentBreakpoint=void 0,this.animation=void 0,r(),s}onDidDismiss(){return $(this.el,"ionModalDidDismiss")}onWillDismiss(){return $(this.el,"ionModalWillDismiss")}async setCurrentBreakpoint(t){if(!this.isSheetModal)return void i("[ion-modal] - setCurrentBreakpoint is only supported on sheet modals.");if(!this.breakpoints.includes(t))return void i(`[ion-modal] - Attempted to set invalid breakpoint value ${t}. Please double check that the breakpoint value is part of your defined breakpoints.`);const{currentBreakpoint:o,moveSheetToBreakpoint:a,canDismiss:e,breakpoints:r,animated:n}=this;o!==t&&a&&(this.sheetTransition=a({breakpoint:t,breakpointOffset:1-o,canDismiss:void 0!==e&&!0!==e&&0===r[0],animated:n}),await this.sheetTransition,this.sheetTransition=void 0)}async getCurrentBreakpoint(){return this.currentBreakpoint}async moveToNextBreakpoint(){const{breakpoints:t,currentBreakpoint:o}=this;if(!t||null==o)return!1;const i=t.filter((t=>0!==t)),a=i.indexOf(o),e=i[(a+1)%i.length];return await this.setCurrentBreakpoint(e),!0}render(){const{handle:t,isSheetModal:o,presentingElement:i,htmlAttributes:a,handleBehavior:r,inheritedAttributes:d,focusTrap:h,expandToScroll:p}=this,l=!1!==t&&o,c=e(this),m=void 0!==i&&"ios"===c,f="cycle"===r;return n(s,Object.assign({key:"8add05bb43a2cdb5e3cf180147d31eb85a018fe0","no-router":!0,tabIndex:f&&o&&l?0:-1},a,{style:{zIndex:`${2e4+this.overlayIndex}`},class:Object.assign({[c]:!0,"modal-default":!m&&!o,"modal-card":m,"modal-sheet":o,"modal-no-expand-scroll":o&&!p,"overlay-hidden":!0,[E]:!1===h},P(this.cssClass)),onIonBackdropTap:this.onBackdropTap,onIonModalDidPresent:this.onLifecycle,onIonModalWillPresent:this.onLifecycle,onIonModalWillDismiss:this.onLifecycle,onIonModalDidDismiss:this.onLifecycle,onFocus:this.onModalFocus}),n("ion-backdrop",{key:"90a6605a9564a699d6f66cf71cf6b506796a2963",ref:t=>this.backdropEl=t,visible:this.showBackdrop,tappable:this.backdropDismiss,part:"backdrop"}),"ios"===c&&n("div",{key:"a97d071395333bf803c0a9347bda000cf7500d8d",class:"modal-shadow"}),n("div",Object.assign({key:"e7b7985c7414a13e3ba8dcecf497b76e92edf53e",role:"dialog"},d,{"aria-modal":"true",class:"modal-wrapper ion-overlay-wrapper",part:"content",ref:t=>this.wrapperEl=t}),l&&n("button",{key:"8258b65570b11a8ee9c9df2537d6419cd2e34536",class:"modal-handle",tabIndex:f?0:-1,"aria-label":"Activate to adjust the size of the dialog overlaying the screen",onClick:f?this.onHandleClick:void 0,part:"handle",ref:t=>this.dragHandleEl=t}),n("slot",{key:"394370d0ed03ee03152f8f8abae7ff7664ca5c13"})))}get el(){return d(this)}static get watchers(){return{isOpen:["onIsOpenChange"],trigger:["triggerChanged"]}}},rt={ionModalDidPresent:"ionViewDidEnter",ionModalWillPresent:"ionViewWillEnter",ionModalWillDismiss:"ionViewWillLeave",ionModalDidDismiss:"ionViewDidLeave"};et.style={ios:':host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:""}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.4)}:host(.modal-card),:host(.modal-sheet){--border-radius:10px}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:10px}}.modal-wrapper{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0)}@media screen and (max-width: 767px){@supports (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - max(30px, var(--ion-safe-area-top)) - 10px)}}@supports not (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - 40px)}}:host(.modal-card) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}:host(.modal-card){--backdrop-opacity:0;--width:100%;-ms-flex-align:end;align-items:flex-end}:host(.modal-card) .modal-shadow{display:none}:host(.modal-card) ion-backdrop{pointer-events:none}}@media screen and (min-width: 768px){:host(.modal-card){--width:calc(100% - 120px);--height:calc(100% - (120px + var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));--max-width:720px;--max-height:1000px;--backdrop-opacity:0;--box-shadow:0px 0px 30px 10px rgba(0, 0, 0, 0.1);-webkit-transition:all 0.5s ease-in-out;transition:all 0.5s ease-in-out}:host(.modal-card) .modal-wrapper{-webkit-box-shadow:none;box-shadow:none}:host(.modal-card) .modal-shadow{-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}}:host(.modal-sheet) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}',md:':host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:""}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:2px;--box-shadow:0 28px 48px rgba(0, 0, 0, 0.4)}}.modal-wrapper{-webkit-transform:translate3d(0, 40px, 0);transform:translate3d(0, 40px, 0);opacity:0.01}'};export{et as ion_modal}
|