@ionic/core 8.8.4-dev.11776710869.1a81ced2 → 8.8.4-dev.11776868665.169e5ee1
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/index.js +1 -1
- package/components/ion-action-sheet.js +1 -1
- package/components/ion-alert.js +1 -1
- package/components/ion-datetime.js +1 -1
- package/components/ion-loading.js +1 -1
- package/components/ion-menu.js +1 -1
- package/components/ion-modal.js +1 -1
- package/components/ion-picker-legacy.js +1 -1
- package/components/ion-popover.js +1 -1
- package/components/ion-select-modal.js +1 -1
- package/components/ion-select-popover.js +1 -1
- package/components/ion-select.js +1 -1
- package/components/ion-tab-bar.js +1 -1
- package/components/ion-toast.js +1 -1
- package/components/{p-9o5mMwql.js → p-BAJR2rtd.js} +1 -1
- package/components/p-CtiqM786.js +4 -0
- package/components/p-D1bKIW7n.js +4 -0
- package/components/{p-Ch9P0ikq.js → p-DWhesBL8.js} +1 -1
- package/components/{p-C7nyAr3p.js → p-DbmwH3zj.js} +1 -1
- package/components/{p-B6czg-mf.js → p-DlHXJAF8.js} +1 -1
- package/components/{p-BGHaEUgp.js → p-qx-oKGQ-.js} +1 -1
- package/css/core.css +1 -1
- package/css/core.css.map +1 -1
- package/css/ionic/bundle.ionic.css +1 -1
- package/css/ionic/bundle.ionic.css.map +1 -1
- package/css/ionic/core.ionic.css +1 -1
- package/css/ionic/core.ionic.css.map +1 -1
- package/css/ionic/global.bundle.ionic.css.map +1 -1
- package/css/ionic/link.ionic.css.map +1 -1
- package/css/ionic/typography.ionic.css.map +1 -1
- package/css/ionic.bundle.css +1 -1
- package/css/ionic.bundle.css.map +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/ion-action-sheet.cjs.entry.js +1 -1
- package/dist/cjs/ion-alert.cjs.entry.js +1 -1
- package/dist/cjs/ion-datetime_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-loading.cjs.entry.js +1 -1
- package/dist/cjs/ion-menu_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-modal.cjs.entry.js +177 -80
- package/dist/cjs/ion-popover.cjs.entry.js +4 -4
- package/dist/cjs/ion-select-modal.cjs.entry.js +1 -1
- package/dist/cjs/ion-select_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-tab-bar_2.cjs.entry.js +74 -4
- package/dist/cjs/ion-toast.cjs.entry.js +4 -4
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{overlays-Dhoy6v_5.js → overlays-Hci_7vw_.js} +8 -4
- package/dist/collection/components/modal/animations/ionic.enter.js +40 -0
- package/dist/collection/components/modal/animations/ionic.leave.js +28 -0
- package/dist/collection/components/modal/gestures/sheet.js +72 -10
- package/dist/collection/components/modal/modal.ionic.css +1 -1
- package/dist/collection/components/modal/modal.js +6 -5
- package/dist/collection/components/popover/popover.js +3 -3
- package/dist/collection/components/tab-bar/tab-bar.ionic.css +17 -0
- package/dist/collection/components/tab-bar/tab-bar.js +96 -5
- package/dist/collection/components/toast/toast.js +3 -3
- package/dist/collection/utils/overlays.js +9 -5
- package/dist/docs.json +30 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/ion-action-sheet.entry.js +1 -1
- package/dist/esm/ion-alert.entry.js +1 -1
- package/dist/esm/ion-datetime_3.entry.js +1 -1
- package/dist/esm/ion-loading.entry.js +1 -1
- package/dist/esm/ion-menu_3.entry.js +1 -1
- package/dist/esm/ion-modal.entry.js +178 -81
- package/dist/esm/ion-popover.entry.js +4 -4
- package/dist/esm/ion-select-modal.entry.js +1 -1
- package/dist/esm/ion-select_3.entry.js +1 -1
- package/dist/esm/ion-tab-bar_2.entry.js +75 -5
- package/dist/esm/ion-toast.entry.js +4 -4
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{overlays-CvFHfO3y.js → overlays-rwDDzEs4.js} +9 -5
- package/dist/html.html-data.json +4 -0
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-9ca814ab.entry.js → p-092e92b0.entry.js} +1 -1
- package/dist/ionic/p-09338ca0.entry.js +4 -0
- package/dist/ionic/p-228b6a9c.entry.js +4 -0
- package/dist/ionic/p-49c92227.entry.js +4 -0
- package/dist/ionic/{p-6be2b2d3.entry.js → p-4ce731be.entry.js} +1 -1
- package/dist/ionic/p-575d972f.entry.js +4 -0
- package/dist/ionic/{p-b27ae20f.entry.js → p-5b7eaf60.entry.js} +1 -1
- package/dist/ionic/{p-06de164d.entry.js → p-79ae0425.entry.js} +1 -1
- package/dist/ionic/{p-6bffc700.entry.js → p-7fd3311f.entry.js} +1 -1
- package/dist/ionic/p-C4uUM9DM.js +4 -0
- package/dist/ionic/{p-15ea9223.entry.js → p-b8b20b7e.entry.js} +1 -1
- package/dist/ionic/p-e45be51f.entry.js +4 -0
- package/dist/types/components/modal/animations/ionic.enter.d.ts +6 -0
- package/dist/types/components/modal/animations/ionic.leave.d.ts +6 -0
- package/dist/types/components/modal/gestures/sheet.d.ts +1 -1
- package/dist/types/components/tab-bar/tab-bar.d.ts +15 -0
- package/dist/types/components.d.ts +11 -0
- package/dist/types/utils/overlays.d.ts +1 -1
- package/hydrate/index.js +266 -94
- package/hydrate/index.mjs +266 -94
- package/package.json +2 -2
- package/components/p-GytrfCp8.js +0 -4
- package/components/p-ZeIAjDcZ.js +0 -4
- package/dist/ionic/p-3884bfa4.entry.js +0 -4
- package/dist/ionic/p-4b0f5ffd.entry.js +0 -4
- package/dist/ionic/p-57aeb097.entry.js +0 -4
- package/dist/ionic/p-BYtS2rae.js +0 -4
- package/dist/ionic/p-e9d6ce67.entry.js +0 -4
- package/dist/ionic/p-ef0c281a.entry.js +0 -4
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import { r as registerInstance, c as createEvent, f as printIonWarning, w as writeTask, e as config, h, d as Host, g as getElement } from './index-Omi_TcwW.js';
|
|
5
5
|
import { f as findClosestIonContent, i as isIonContent, d as disableContentScrollY, r as resetContentScrollY, a as findIonContent, p as printIonContentErrorMsg } from './index-BmkLokUL.js';
|
|
6
6
|
import { C as CoreDelegate, a as attachComponent, d as detachComponent } from './framework-delegate-CjVwn_KZ.js';
|
|
7
|
-
import {
|
|
7
|
+
import { g as getElementRoot, e as clamp, r as raf, b as inheritAttributes, h as hasLazyBuild } from './helpers-Do7zwvM1.js';
|
|
8
8
|
import { c as createLockController } from './lock-controller-B-hirT0v.js';
|
|
9
9
|
import { g as getCapacitor } from './capacitor-C4lYa1nV.js';
|
|
10
|
-
import { G as GESTURE, O as OVERLAY_GESTURE_PRIORITY, F as FOCUS_TRAP_DISABLE_CLASS, e as createTriggerController, B as BACKDROP, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod } from './overlays-
|
|
10
|
+
import { G as GESTURE, O as OVERLAY_GESTURE_PRIORITY, F as FOCUS_TRAP_DISABLE_CLASS, e as createTriggerController, B as BACKDROP, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod } from './overlays-rwDDzEs4.js';
|
|
11
11
|
import { g as getClassMap } from './theme-DaJxRxSQ.js';
|
|
12
12
|
import { e as deepReady, w as waitForMount } from './index-CGthURny.js';
|
|
13
13
|
import { w as win, b as getIonMode, c as getIonTheme } from './ionic-global-CAZb-5i-.js';
|
|
@@ -126,6 +126,104 @@ const setCardStatusBarDefault = (defaultStyle = Style.Default) => {
|
|
|
126
126
|
StatusBar.setStyle({ style: defaultStyle });
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
const createSheetEnterAnimation = (opts) => {
|
|
130
|
+
const { currentBreakpoint, backdropBreakpoint, expandToScroll, staticBackdropOpacity } = opts;
|
|
131
|
+
/**
|
|
132
|
+
* If the backdropBreakpoint is undefined, then the backdrop
|
|
133
|
+
* should always fade in. If the backdropBreakpoint came before the
|
|
134
|
+
* current breakpoint, then the backdrop should be fading in.
|
|
135
|
+
*/
|
|
136
|
+
const shouldShowBackdrop = backdropBreakpoint === undefined || backdropBreakpoint < currentBreakpoint;
|
|
137
|
+
let initialBackdrop = '0';
|
|
138
|
+
if (staticBackdropOpacity) {
|
|
139
|
+
initialBackdrop = 'calc(var(--backdrop-opacity)';
|
|
140
|
+
}
|
|
141
|
+
else if (shouldShowBackdrop) {
|
|
142
|
+
initialBackdrop = `calc(var(--backdrop-opacity) * ${currentBreakpoint})`;
|
|
143
|
+
}
|
|
144
|
+
const backdropAnimation = createAnimation('backdropAnimation').fromTo('opacity', 0, initialBackdrop);
|
|
145
|
+
if (shouldShowBackdrop) {
|
|
146
|
+
backdropAnimation
|
|
147
|
+
.beforeStyles({
|
|
148
|
+
'pointer-events': 'none',
|
|
149
|
+
})
|
|
150
|
+
.afterClearStyles(['pointer-events']);
|
|
151
|
+
}
|
|
152
|
+
const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
|
|
153
|
+
{ offset: 0, opacity: 1, transform: 'translateY(100%)' },
|
|
154
|
+
{ offset: 1, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
155
|
+
]);
|
|
156
|
+
/**
|
|
157
|
+
* This allows the content to be scrollable at any breakpoint.
|
|
158
|
+
*/
|
|
159
|
+
const contentAnimation = !expandToScroll
|
|
160
|
+
? createAnimation('contentAnimation').keyframes([
|
|
161
|
+
{ offset: 0, opacity: 1, maxHeight: `${(1 - currentBreakpoint) * 100}%` },
|
|
162
|
+
{ offset: 1, opacity: 1, maxHeight: `${currentBreakpoint * 100}%` },
|
|
163
|
+
])
|
|
164
|
+
: undefined;
|
|
165
|
+
return { wrapperAnimation, backdropAnimation, contentAnimation };
|
|
166
|
+
};
|
|
167
|
+
const createSheetLeaveAnimation = (opts) => {
|
|
168
|
+
const { currentBreakpoint, backdropBreakpoint } = opts;
|
|
169
|
+
/**
|
|
170
|
+
* Backdrop does not always fade in from 0 to 1 if backdropBreakpoint
|
|
171
|
+
* is defined, so we need to account for that offset by figuring out
|
|
172
|
+
* what the current backdrop value should be.
|
|
173
|
+
*/
|
|
174
|
+
const backdropValue = `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(currentBreakpoint, backdropBreakpoint)})`;
|
|
175
|
+
const defaultBackdrop = [
|
|
176
|
+
{ offset: 0, opacity: backdropValue },
|
|
177
|
+
{ offset: 1, opacity: 0 },
|
|
178
|
+
];
|
|
179
|
+
const customBackdrop = [
|
|
180
|
+
{ offset: 0, opacity: backdropValue },
|
|
181
|
+
{ offset: backdropBreakpoint, opacity: 0 },
|
|
182
|
+
{ offset: 1, opacity: 0 },
|
|
183
|
+
];
|
|
184
|
+
const backdropAnimation = createAnimation('backdropAnimation').keyframes(backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop);
|
|
185
|
+
const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
|
|
186
|
+
{ offset: 0, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
187
|
+
{ offset: 1, opacity: 1, transform: `translateY(100%)` },
|
|
188
|
+
]);
|
|
189
|
+
return { wrapperAnimation, backdropAnimation };
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const createEnterAnimation$2 = () => {
|
|
193
|
+
const backdropAnimation = createAnimation()
|
|
194
|
+
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
195
|
+
.beforeStyles({
|
|
196
|
+
'pointer-events': 'none',
|
|
197
|
+
})
|
|
198
|
+
.afterClearStyles(['pointer-events']);
|
|
199
|
+
const wrapperAnimation = createAnimation().keyframes([
|
|
200
|
+
{ offset: 0, opacity: 0.01, transform: 'translateY(40px)' },
|
|
201
|
+
{ offset: 1, opacity: 1, transform: `translateY(0px)` },
|
|
202
|
+
]);
|
|
203
|
+
return { backdropAnimation, wrapperAnimation, contentAnimation: undefined };
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Ionic Modal Enter Animation
|
|
207
|
+
*/
|
|
208
|
+
const ionicEnterAnimation = (baseEl, opts) => {
|
|
209
|
+
const { currentBreakpoint, expandToScroll } = opts;
|
|
210
|
+
const root = getElementRoot(baseEl);
|
|
211
|
+
const { wrapperAnimation, backdropAnimation, contentAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation$2();
|
|
212
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
213
|
+
wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
|
|
214
|
+
// The content animation is only added if scrolling is enabled for
|
|
215
|
+
// all the breakpoints.
|
|
216
|
+
!expandToScroll && (contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.addElement(baseEl.querySelector('.ion-page')));
|
|
217
|
+
backdropAnimation.duration(300).easing('ease-out');
|
|
218
|
+
wrapperAnimation.duration(400).easing('cubic-bezier(0.32, 0.68, 0, 1)');
|
|
219
|
+
contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.duration(400).easing('cubic-bezier(0.32, 0.68, 0, 1)');
|
|
220
|
+
const baseAnimation = createAnimation().addElement(baseEl).addAnimation([backdropAnimation, wrapperAnimation]);
|
|
221
|
+
if (contentAnimation) {
|
|
222
|
+
baseAnimation.addAnimation(contentAnimation);
|
|
223
|
+
}
|
|
224
|
+
return baseAnimation;
|
|
225
|
+
};
|
|
226
|
+
|
|
129
227
|
const handleCanDismiss = async (el, animation) => {
|
|
130
228
|
/**
|
|
131
229
|
* If canDismiss is not a function
|
|
@@ -552,69 +650,6 @@ const calculateProgress = (el, deltaY) => {
|
|
|
552
650
|
return Math.max(0, Math.min(1, roundedProgress));
|
|
553
651
|
};
|
|
554
652
|
|
|
555
|
-
const createSheetEnterAnimation = (opts) => {
|
|
556
|
-
const { currentBreakpoint, backdropBreakpoint, expandToScroll, staticBackdropOpacity } = opts;
|
|
557
|
-
/**
|
|
558
|
-
* If the backdropBreakpoint is undefined, then the backdrop
|
|
559
|
-
* should always fade in. If the backdropBreakpoint came before the
|
|
560
|
-
* current breakpoint, then the backdrop should be fading in.
|
|
561
|
-
*/
|
|
562
|
-
const shouldShowBackdrop = backdropBreakpoint === undefined || backdropBreakpoint < currentBreakpoint;
|
|
563
|
-
let initialBackdrop = '0';
|
|
564
|
-
if (staticBackdropOpacity) {
|
|
565
|
-
initialBackdrop = 'calc(var(--backdrop-opacity)';
|
|
566
|
-
}
|
|
567
|
-
else if (shouldShowBackdrop) {
|
|
568
|
-
initialBackdrop = `calc(var(--backdrop-opacity) * ${currentBreakpoint})`;
|
|
569
|
-
}
|
|
570
|
-
const backdropAnimation = createAnimation('backdropAnimation').fromTo('opacity', 0, initialBackdrop);
|
|
571
|
-
if (shouldShowBackdrop) {
|
|
572
|
-
backdropAnimation
|
|
573
|
-
.beforeStyles({
|
|
574
|
-
'pointer-events': 'none',
|
|
575
|
-
})
|
|
576
|
-
.afterClearStyles(['pointer-events']);
|
|
577
|
-
}
|
|
578
|
-
const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
|
|
579
|
-
{ offset: 0, opacity: 1, transform: 'translateY(100%)' },
|
|
580
|
-
{ offset: 1, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
581
|
-
]);
|
|
582
|
-
/**
|
|
583
|
-
* This allows the content to be scrollable at any breakpoint.
|
|
584
|
-
*/
|
|
585
|
-
const contentAnimation = !expandToScroll
|
|
586
|
-
? createAnimation('contentAnimation').keyframes([
|
|
587
|
-
{ offset: 0, opacity: 1, maxHeight: `${(1 - currentBreakpoint) * 100}%` },
|
|
588
|
-
{ offset: 1, opacity: 1, maxHeight: `${currentBreakpoint * 100}%` },
|
|
589
|
-
])
|
|
590
|
-
: undefined;
|
|
591
|
-
return { wrapperAnimation, backdropAnimation, contentAnimation };
|
|
592
|
-
};
|
|
593
|
-
const createSheetLeaveAnimation = (opts) => {
|
|
594
|
-
const { currentBreakpoint, backdropBreakpoint } = opts;
|
|
595
|
-
/**
|
|
596
|
-
* Backdrop does not always fade in from 0 to 1 if backdropBreakpoint
|
|
597
|
-
* is defined, so we need to account for that offset by figuring out
|
|
598
|
-
* what the current backdrop value should be.
|
|
599
|
-
*/
|
|
600
|
-
const backdropValue = `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(currentBreakpoint, backdropBreakpoint)})`;
|
|
601
|
-
const defaultBackdrop = [
|
|
602
|
-
{ offset: 0, opacity: backdropValue },
|
|
603
|
-
{ offset: 1, opacity: 0 },
|
|
604
|
-
];
|
|
605
|
-
const customBackdrop = [
|
|
606
|
-
{ offset: 0, opacity: backdropValue },
|
|
607
|
-
{ offset: backdropBreakpoint, opacity: 0 },
|
|
608
|
-
{ offset: 1, opacity: 0 },
|
|
609
|
-
];
|
|
610
|
-
const backdropAnimation = createAnimation('backdropAnimation').keyframes(backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop);
|
|
611
|
-
const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
|
|
612
|
-
{ offset: 0, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
613
|
-
{ offset: 1, opacity: 1, transform: `translateY(100%)` },
|
|
614
|
-
]);
|
|
615
|
-
return { wrapperAnimation, backdropAnimation };
|
|
616
|
-
};
|
|
617
|
-
|
|
618
653
|
const createEnterAnimation$1 = () => {
|
|
619
654
|
const backdropAnimation = createAnimation()
|
|
620
655
|
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
@@ -1005,16 +1040,16 @@ const mdLeaveAnimation = (baseEl, opts) => {
|
|
|
1005
1040
|
return baseAnimation;
|
|
1006
1041
|
};
|
|
1007
1042
|
|
|
1008
|
-
const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], expandToScroll, getCurrentBreakpoint, onDismiss, onBreakpointChange,
|
|
1043
|
+
const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], expandToScroll, getCurrentBreakpoint, onDismiss, onBreakpointChange, usePhysicsBasedGesture, onDragStart, onDragMove, onDragEnd) => {
|
|
1009
1044
|
// Defaults for the sheet swipe animation
|
|
1010
1045
|
const defaultBackdrop = [
|
|
1011
1046
|
{ offset: 0, opacity: 'var(--backdrop-opacity)' },
|
|
1012
|
-
{ offset: 1, opacity:
|
|
1047
|
+
{ offset: 1, opacity: usePhysicsBasedGesture ? 'var(--backdrop-opacity)' : 0.01 },
|
|
1013
1048
|
];
|
|
1014
1049
|
const customBackdrop = [
|
|
1015
1050
|
{ offset: 0, opacity: 'var(--backdrop-opacity)' },
|
|
1016
|
-
{ offset: 1 - backdropBreakpoint, opacity:
|
|
1017
|
-
{ offset: 1, opacity:
|
|
1051
|
+
{ offset: 1 - backdropBreakpoint, opacity: usePhysicsBasedGesture ? 'var(--backdrop-opacity)' : 0 },
|
|
1052
|
+
{ offset: 1, opacity: usePhysicsBasedGesture ? 'var(--backdrop-opacity)' : 0 },
|
|
1018
1053
|
];
|
|
1019
1054
|
const SheetDefaults = {
|
|
1020
1055
|
WRAPPER_KEYFRAMES: [
|
|
@@ -1337,7 +1372,9 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1337
1372
|
: step;
|
|
1338
1373
|
offset = clamp(0.0001, processedStep, maxStep);
|
|
1339
1374
|
animation.progressStep(offset);
|
|
1340
|
-
const snapBreakpoint =
|
|
1375
|
+
const snapBreakpoint = usePhysicsBasedGesture
|
|
1376
|
+
? calculateVelocitySnapBreakpoint(detail.deltaY, detail.velocityY, detail.currentY)
|
|
1377
|
+
: calculatePositionSnapBreakpoint(detail.deltaY);
|
|
1341
1378
|
const eventDetail = {
|
|
1342
1379
|
currentY: detail.currentY,
|
|
1343
1380
|
deltaY: detail.deltaY,
|
|
@@ -1348,7 +1385,9 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1348
1385
|
onDragMove(eventDetail);
|
|
1349
1386
|
};
|
|
1350
1387
|
const onEnd = (detail) => {
|
|
1351
|
-
const snapBreakpoint =
|
|
1388
|
+
const snapBreakpoint = usePhysicsBasedGesture
|
|
1389
|
+
? calculateVelocitySnapBreakpoint(detail.deltaY, detail.velocityY, detail.currentY)
|
|
1390
|
+
: calculatePositionSnapBreakpoint(detail.deltaY);
|
|
1352
1391
|
const eventDetail = {
|
|
1353
1392
|
currentY: detail.currentY,
|
|
1354
1393
|
deltaY: detail.deltaY,
|
|
@@ -1395,6 +1434,14 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1395
1434
|
*/
|
|
1396
1435
|
const shouldPreventDismiss = canDismiss && breakpoint === 0;
|
|
1397
1436
|
const snapToBreakpoint = shouldPreventDismiss ? currentBreakpoint : breakpoint;
|
|
1437
|
+
/**
|
|
1438
|
+
* Detect snap-back behavior: when the snap target is the same as the current breakpoint,
|
|
1439
|
+
* the user released before crossing the threshold to a new breakpoint.
|
|
1440
|
+
* Apply different timing and easing for snap-back vs. snap-to-new.
|
|
1441
|
+
*/
|
|
1442
|
+
const isSnapBack = snapToBreakpoint === currentBreakpoint;
|
|
1443
|
+
const duration = usePhysicsBasedGesture ? (isSnapBack ? 300 : 400) : 500;
|
|
1444
|
+
const easing = isSnapBack ? 'cubic-bezier(0.34, 1.4, 0.64, 1)' : 'cubic-bezier(0.32, 0.68, 0, 1)';
|
|
1398
1445
|
const shouldRemainOpen = snapToBreakpoint !== 0;
|
|
1399
1446
|
currentBreakpoint = 0;
|
|
1400
1447
|
/**
|
|
@@ -1409,13 +1456,13 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1409
1456
|
backdropAnimation.keyframes([
|
|
1410
1457
|
{
|
|
1411
1458
|
offset: 0,
|
|
1412
|
-
opacity:
|
|
1459
|
+
opacity: usePhysicsBasedGesture
|
|
1413
1460
|
? 'var(--backdrop-opacity)'
|
|
1414
1461
|
: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(1 - breakpointOffset, backdropBreakpoint)})`,
|
|
1415
1462
|
},
|
|
1416
1463
|
{
|
|
1417
1464
|
offset: 1,
|
|
1418
|
-
opacity:
|
|
1465
|
+
opacity: usePhysicsBasedGesture
|
|
1419
1466
|
? 'var(--backdrop-opacity)'
|
|
1420
1467
|
: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(snapToBreakpoint, backdropBreakpoint)})`,
|
|
1421
1468
|
},
|
|
@@ -1435,6 +1482,12 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1435
1482
|
}
|
|
1436
1483
|
animation.progressStep(0);
|
|
1437
1484
|
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Apply the appropriate easing curve for this snap behavior.
|
|
1487
|
+
*/
|
|
1488
|
+
if (usePhysicsBasedGesture) {
|
|
1489
|
+
animation.easing(easing);
|
|
1490
|
+
}
|
|
1438
1491
|
/**
|
|
1439
1492
|
* Gesture should remain disabled until the
|
|
1440
1493
|
* snapping animation completes.
|
|
@@ -1524,7 +1577,7 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1524
1577
|
* be added every time onEnd runs.
|
|
1525
1578
|
*/
|
|
1526
1579
|
}, { oneTimeCallback: true })
|
|
1527
|
-
.progressEnd(1, 0, animated ?
|
|
1580
|
+
.progressEnd(1, 0, animated ? duration : 0);
|
|
1528
1581
|
});
|
|
1529
1582
|
};
|
|
1530
1583
|
/**
|
|
@@ -1535,7 +1588,7 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1535
1588
|
* @param deltaY The change in Y position since the gesture started.
|
|
1536
1589
|
* @returns The snap breakpoint value.
|
|
1537
1590
|
*/
|
|
1538
|
-
const
|
|
1591
|
+
const calculatePositionSnapBreakpoint = (deltaY) => {
|
|
1539
1592
|
/**
|
|
1540
1593
|
* Calculates the real-time vertical position of the modal.
|
|
1541
1594
|
* We combine the wrapper's current bounding box position with the
|
|
@@ -1555,6 +1608,50 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1555
1608
|
});
|
|
1556
1609
|
return snapBreakpoint;
|
|
1557
1610
|
};
|
|
1611
|
+
/**
|
|
1612
|
+
* Calculates the snap breakpoint using velocity-based logic.
|
|
1613
|
+
* This provides a more intuitive and responsive sheet behavior for the Ionic theme.
|
|
1614
|
+
*
|
|
1615
|
+
* Rules:
|
|
1616
|
+
* 1. Fast downward flick (> 500 px/s) always dismisses, regardless of position
|
|
1617
|
+
* 2. Fast upward flick (> 400 px/s) snaps to the next breakpoint above
|
|
1618
|
+
* 3. If dragged 40% below current snap point without fast upward flick, dismisses
|
|
1619
|
+
* 4. Otherwise, falls back to position-based snap (closest breakpoint)
|
|
1620
|
+
*
|
|
1621
|
+
* @param deltaY The change in Y position since gesture started
|
|
1622
|
+
* @param velocityY The velocity in pixels per millisecond
|
|
1623
|
+
* @param currentY The current Y position of the gesture
|
|
1624
|
+
* @returns The snap breakpoint value
|
|
1625
|
+
*/
|
|
1626
|
+
const calculateVelocitySnapBreakpoint = (deltaY, velocityY, currentY) => {
|
|
1627
|
+
// Convert velocity from px/ms to px/s for easier threshold comparison
|
|
1628
|
+
const velocityYPerSecond = velocityY * 1000;
|
|
1629
|
+
// Calculate current progress (0 = fully closed, 1 = fully expanded)
|
|
1630
|
+
const currentProgress = calculateProgress(currentY);
|
|
1631
|
+
// Rule 1: Fast downward flick always dismisses
|
|
1632
|
+
if (velocityYPerSecond > 500) {
|
|
1633
|
+
return minBreakpoint;
|
|
1634
|
+
}
|
|
1635
|
+
// Rule 2: Fast upward flick moves to next breakpoint above
|
|
1636
|
+
if (velocityYPerSecond < -400) {
|
|
1637
|
+
// Find next breakpoint above current position
|
|
1638
|
+
const nextBreakpoint = breakpoints.find((bp) => bp > currentProgress);
|
|
1639
|
+
// If no breakpoint above, stay at max breakpoint
|
|
1640
|
+
return nextBreakpoint !== null && nextBreakpoint !== void 0 ? nextBreakpoint : maxBreakpoint;
|
|
1641
|
+
}
|
|
1642
|
+
// Rule 3: 40% dismissal rule (only if not flicking up and 0 breakpoint exists)
|
|
1643
|
+
if (minBreakpoint === 0 && currentBreakpoint > 0) {
|
|
1644
|
+
// Calculate how far we've moved below the current snap point
|
|
1645
|
+
const distanceBelowSnap = currentBreakpoint - currentProgress;
|
|
1646
|
+
const percentageBelowSnap = distanceBelowSnap / currentBreakpoint;
|
|
1647
|
+
// If dragged more than 40% below and not flicking up, dismiss
|
|
1648
|
+
if (percentageBelowSnap > 0.4 && velocityYPerSecond <= 400) {
|
|
1649
|
+
return 0;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
// Rule 4: Fallback to position-based snap (existing logic)
|
|
1653
|
+
return calculatePositionSnapBreakpoint(deltaY);
|
|
1654
|
+
};
|
|
1558
1655
|
/**
|
|
1559
1656
|
* Calculates the progress of the swipe gesture.
|
|
1560
1657
|
*
|
|
@@ -1803,7 +1900,7 @@ const clearSafeAreaOverrides = (hostEl) => {
|
|
|
1803
1900
|
hostEl.style.removeProperty('--ion-safe-area-right');
|
|
1804
1901
|
};
|
|
1805
1902
|
|
|
1806
|
-
const modalIonicCss = () => `:host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-width:0;--border-style:none;--border-color:transparent;--box-shadow:none;right:0;left: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;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}.modal-handle{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;cursor:pointer;z-index:11}.modal-handle::before{position:absolute;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:""}: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{--background:var(--token-bg-surface-default, var(--token-primitives-base-white, #ffffff));--box-shadow:var(--token-elevation-3, 0px 2px 7px 0px rgba(0, 0, 0, 0.05), 0px 6px 32px 0px rgba(0, 0, 0, 0.16));--backdrop-opacity:
|
|
1903
|
+
const modalIonicCss = () => `:host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-width:0;--border-style:none;--border-color:transparent;--box-shadow:none;right:0;left: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;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}.modal-handle{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;cursor:pointer;z-index:11}.modal-handle::before{position:absolute;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:""}: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{--background:var(--token-bg-surface-default, var(--token-primitives-base-white, #ffffff));--box-shadow:var(--token-elevation-3, 0px 2px 7px 0px rgba(0, 0, 0, 0.05), 0px 6px 32px 0px rgba(0, 0, 0, 0.16));--backdrop-opacity:0.7;color:var(--token-text-default, var(--token-primitives-neutral-1200, #242424))}:host(.modal-round){--border-radius:var(--token-border-radius-1000, var(--token-scale-1000, 40px))}:host(.modal-soft){--border-radius:var(--token-border-radius-400, var(--token-scale-400, 16px))}:host(.modal-rectangular){--border-radius:var(--token-border-radius-0, var(--token-scale-0, 0px))}:host(.select-modal.modal-default){--max-height:45%;--max-width:calc(100% - (var(--token-space-400, var(--token-scale-400, 16px)) * 2));--min-height:340px}.modal-handle{right:0px;left:0px;top:var(--token-space-300, var(--token-scale-300, 12px));border-radius:var(--token-border-radius-100, var(--token-scale-100, 4px));width:var(--token-scale-1100, 44px);height:var(--token-scale-100, 4px);background-color:var(--token-primitives-neutral-300, #e0e0e0)}.modal-handle::before{-webkit-padding-start:var(--token-space-100, var(--token-scale-100, 4px));padding-inline-start:var(--token-space-100, var(--token-scale-100, 4px));-webkit-padding-end:var(--token-space-100, var(--token-scale-100, 4px));padding-inline-end:var(--token-space-100, var(--token-scale-100, 4px));padding-top:var(--token-space-100, var(--token-scale-100, 4px));padding-bottom:var(--token-space-100, var(--token-scale-100, 4px))}: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}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + var(--token-scale-250, 10px)))}`;
|
|
1807
1904
|
|
|
1808
1905
|
const modalIosCss = () => `:host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-width:0;--border-style:none;--border-color:transparent;--box-shadow:none;right:0;left: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;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}.modal-handle{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;cursor:pointer;z-index:11}.modal-handle::before{position:absolute;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:""}: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{--background:var(--ion-background-color, #fff);--border-radius:0;--backdrop-opacity:0;color:var(--ion-text-color, #000)}@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{right:0px;left:0px;top:5px;border-radius:8px;width:36px;height:5px;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be))}.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;width:36px;height:5px}:host(.modal-sheet){--height:calc(100% - (var(--ion-modal-offset-top, 0px) + 10px))}: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}`;
|
|
1809
1906
|
|
|
@@ -2243,7 +2340,7 @@ const Modal = class {
|
|
|
2243
2340
|
this.statusBarStyle = await StatusBar.getStyle();
|
|
2244
2341
|
setCardStatusBarDark();
|
|
2245
2342
|
}
|
|
2246
|
-
await present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, {
|
|
2343
|
+
await present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, ionicEnterAnimation, {
|
|
2247
2344
|
presentingEl: presentingElement,
|
|
2248
2345
|
currentBreakpoint: this.initialBreakpoint,
|
|
2249
2346
|
backdropBreakpoint: this.backdropBreakpoint,
|
|
@@ -2930,20 +3027,20 @@ const Modal = class {
|
|
|
2930
3027
|
const isHandleCycle = handleBehavior === 'cycle';
|
|
2931
3028
|
const shape = this.getShape();
|
|
2932
3029
|
const isSheetModalWithHandle = isSheetModal && showHandle;
|
|
2933
|
-
return (h(Host, Object.assign({ key: '
|
|
3030
|
+
return (h(Host, Object.assign({ key: '3011c8f49c1ccb6c20c01db35b59fe4f6e22ec01', "no-router": true,
|
|
2934
3031
|
// Allow the modal to be navigable when the handle is focusable
|
|
2935
3032
|
tabIndex: isHandleCycle && isSheetModalWithHandle ? 0 : -1 }, htmlAttributes, { style: {
|
|
2936
3033
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
2937
|
-
}, class: Object.assign({ [theme]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-${shape}`]: shape !== undefined, [`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 }), h("ion-backdrop", { key: '
|
|
3034
|
+
}, class: Object.assign({ [theme]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-${shape}`]: shape !== undefined, [`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 }), h("ion-backdrop", { key: 'ab99fb4ff1b335b06d5676890012dfe3cd1a1a01', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), theme === 'ios' && h("div", { key: '95d4c79c4455c6a5ae6d581fa9dfaabdbee8c567', class: "modal-shadow" }), h("div", Object.assign({ key: '2d7d2406cdb986c69ef52708d33eca67d8a877f8',
|
|
2938
3035
|
/*
|
|
2939
3036
|
role and aria-modal must be used on the
|
|
2940
3037
|
same element. They must also be set inside the
|
|
2941
3038
|
shadow DOM otherwise ion-button will not be highlighted
|
|
2942
3039
|
when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
|
|
2943
3040
|
*/
|
|
2944
|
-
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: '
|
|
3041
|
+
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: 'ccec8bfc314763bd6dd868b69fbfdc085f5957c9', class: "modal-handle",
|
|
2945
3042
|
// Prevents the handle from receiving keyboard focus when it does not cycle
|
|
2946
|
-
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) })), h("slot", { key: '
|
|
3043
|
+
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) })), h("slot", { key: '38469e3447b46983783627d697e12cadcef614fa', onSlotchange: this.onSlotChange }))));
|
|
2947
3044
|
}
|
|
2948
3045
|
get el() { return getElement(this); }
|
|
2949
3046
|
static get watchers() { return {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { r as registerInstance, c as createEvent, f as printIonWarning, h, d as Host, g as getElement } from './index-Omi_TcwW.js';
|
|
5
|
-
import { B as BACKDROP, j as prepareOverlay, k as setOverlayId, f as present, n as focusFirstDescendant, g as dismiss, h as eventMethod, F as FOCUS_TRAP_DISABLE_CLASS } from './overlays-
|
|
5
|
+
import { B as BACKDROP, j as prepareOverlay, k as setOverlayId, f as present, n as focusFirstDescendant, g as dismiss, h as eventMethod, F as FOCUS_TRAP_DISABLE_CLASS } from './overlays-rwDDzEs4.js';
|
|
6
6
|
import { C as CoreDelegate, a as attachComponent, d as detachComponent } from './framework-delegate-CjVwn_KZ.js';
|
|
7
7
|
import { g as getElementRoot, r as raf, f as addEventListener, h as hasLazyBuild } from './helpers-Do7zwvM1.js';
|
|
8
8
|
import { c as createLockController } from './lock-controller-B-hirT0v.js';
|
|
@@ -1434,7 +1434,7 @@ const Popover = class {
|
|
|
1434
1434
|
else if (!this.keepContentsMounted) {
|
|
1435
1435
|
await waitForMount();
|
|
1436
1436
|
}
|
|
1437
|
-
await present(this, 'popoverEnter', iosEnterAnimation, mdEnterAnimation, {
|
|
1437
|
+
await present(this, 'popoverEnter', iosEnterAnimation, mdEnterAnimation, undefined, {
|
|
1438
1438
|
event: event || this.event,
|
|
1439
1439
|
size: this.size,
|
|
1440
1440
|
trigger: this.triggerEl,
|
|
@@ -1543,9 +1543,9 @@ const Popover = class {
|
|
|
1543
1543
|
const { onLifecycle, parentPopover, dismissOnSelect, side, arrow, htmlAttributes, focusTrap } = this;
|
|
1544
1544
|
const desktop = isPlatform('desktop');
|
|
1545
1545
|
const enableArrow = arrow && !parentPopover;
|
|
1546
|
-
return (h(Host, Object.assign({ key: '
|
|
1546
|
+
return (h(Host, Object.assign({ key: 'ba8801218aa8543eae0e8e2c57fbd0d4fbb2c8ff', "aria-modal": "true", "no-router": true, tabindex: "-1" }, htmlAttributes, { style: {
|
|
1547
1547
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
1548
|
-
}, class: Object.assign(Object.assign({}, getClassMap(this.cssClass)), { [theme]: true, 'popover-translucent': this.translucent, 'overlay-hidden': true, 'popover-desktop': desktop, [`popover-side-${side}`]: true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false, 'popover-nested': !!parentPopover }), onIonPopoverDidPresent: onLifecycle, onIonPopoverWillPresent: onLifecycle, onIonPopoverWillDismiss: onLifecycle, onIonPopoverDidDismiss: onLifecycle, onIonBackdropTap: this.onBackdropTap }), !parentPopover && h("ion-backdrop", { key: '
|
|
1548
|
+
}, class: Object.assign(Object.assign({}, getClassMap(this.cssClass)), { [theme]: true, 'popover-translucent': this.translucent, 'overlay-hidden': true, 'popover-desktop': desktop, [`popover-side-${side}`]: true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false, 'popover-nested': !!parentPopover }), onIonPopoverDidPresent: onLifecycle, onIonPopoverWillPresent: onLifecycle, onIonPopoverWillDismiss: onLifecycle, onIonPopoverDidDismiss: onLifecycle, onIonBackdropTap: this.onBackdropTap }), !parentPopover && h("ion-backdrop", { key: '0301c9a9ed70cf34445e89484cd4145dc98f3d4c', tappable: this.backdropDismiss, visible: this.showBackdrop, part: "backdrop" }), h("div", { key: 'd017b8cda9eb474cf990222c90539697308a1c8f', class: "popover-wrapper ion-overlay-wrapper", onClick: dismissOnSelect ? () => this.dismiss() : undefined }, enableArrow && h("div", { key: 'fdf8ec2e98a29bfa3e26788e4a432ff402800202', class: "popover-arrow", part: "arrow" }), h("div", { key: '9498eace0a68daf39e7c0580ca46e33a9791f62c', class: "popover-content", part: "content" }, h("slot", { key: '0f10c7e335d2f4f75e10d7fde5244c3dd5ae0bb4' })))));
|
|
1549
1549
|
}
|
|
1550
1550
|
get el() { return getElement(this); }
|
|
1551
1551
|
static get watchers() { return {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { r as registerInstance, h, i as forceUpdate, d as Host, g as getElement } from './index-Omi_TcwW.js';
|
|
5
5
|
import { c as getIonTheme, b as getIonMode } from './ionic-global-CAZb-5i-.js';
|
|
6
6
|
import { x as xSvg } from './x-BDqjX7Z_.js';
|
|
7
|
-
import { s as safeCall } from './overlays-
|
|
7
|
+
import { s as safeCall } from './overlays-rwDDzEs4.js';
|
|
8
8
|
import { h as hostContext, g as getClassMap } from './theme-DaJxRxSQ.js';
|
|
9
9
|
import { b as closeSharp, z as closeOutline } from './index-D2tu5BUg.js';
|
|
10
10
|
import './helpers-Do7zwvM1.js';
|
|
@@ -7,7 +7,7 @@ import { c as createNotchController } from './notch-controller-DiBq57w8.js';
|
|
|
7
7
|
import { i as isOptionSelected, c as compareOptions } from './compare-with-utils-sObYyvOy.js';
|
|
8
8
|
import { c as checkInvalidState } from './validity-BjW8SOqw.js';
|
|
9
9
|
import { b as inheritAttributes, a as renderHiddenInput, o as focusVisibleElement } from './helpers-Do7zwvM1.js';
|
|
10
|
-
import { c as popoverController, b as actionSheetController, a as alertController, m as modalController, s as safeCall } from './overlays-
|
|
10
|
+
import { c as popoverController, b as actionSheetController, a as alertController, m as modalController, s as safeCall } from './overlays-rwDDzEs4.js';
|
|
11
11
|
import { i as isRTL } from './dir-C53feagD.js';
|
|
12
12
|
import { h as hostContext, c as createColorClasses, g as getClassMap } from './theme-DaJxRxSQ.js';
|
|
13
13
|
import { w as watchForOptions } from './watch-options-Dtdm8lKC.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, c as createEvent, h, d as Host, g as getElement, e as config } from './index-Omi_TcwW.js';
|
|
4
|
+
import { r as registerInstance, c as createEvent, a as readTask, w as writeTask, h, d as Host, g as getElement, e as config } from './index-Omi_TcwW.js';
|
|
5
|
+
import { a as findIonContent, g as getScrollElement } from './index-BmkLokUL.js';
|
|
5
6
|
import { c as createKeyboardController } from './keyboard-controller-CAc33ylR.js';
|
|
6
7
|
import { c as createColorClasses } from './theme-DaJxRxSQ.js';
|
|
7
8
|
import { c as getIonTheme, b as getIonMode } from './ionic-global-CAZb-5i-.js';
|
|
@@ -10,7 +11,7 @@ import './keyboard-Cpw6xVLJ.js';
|
|
|
10
11
|
import './capacitor-C4lYa1nV.js';
|
|
11
12
|
import './focus-visible-vXpMhGrs.js';
|
|
12
13
|
|
|
13
|
-
const tabBarIonicCss = () => `:host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-top:var(--border);background:var(--background);color:var(--color);text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:content-box !important;box-sizing:content-box !important}:host(.ion-color) ::slotted(ion-tab-button.ion-focused),:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:var(--background-focused)}:host(.tab-bar-translucent) ::slotted(ion-tab-button){background:transparent}:host([slot=top]){border-top:0;border-bottom:var(--border)}:host(.tab-bar-hidden){display:none !important}:host(.tab-bar-full){width:auto;contain:strict;padding-bottom:var(--ion-safe-area-bottom, 0);padding-right:var(--ion-safe-area-right);padding-left:var(--ion-safe-area-left);}:host([slot=top].tab-bar-full){padding-top:var(--ion-safe-area-top, 0);padding-bottom:0}:host{--background:var(--ion-tab-bar-background, var(--token-bg-surface-default, var(--token-primitives-base-white, #ffffff)));--background-activated:var(--ion-tab-bar-background-activated, var(--token-bg-select-default, var(--token-semantics-primary-100, var(--token-primitives-blue-100, #e9ecfc))));--background-focused:var(--ion-tab-bar-background-focused, transparent);--border:var(--token-border-size-0, var(--token-scale-0, 0px)) var(--token-border-style-solid, solid) var(--ion-tab-bar-border-color, transparent);--color:var(--ion-tab-bar-color, var(--token-primitives-neutral-800, #626262));--color-selected:var(--ion-tab-bar-color-selected, var(--token-text-primary, var(--token-semantics-primary-900, var(--token-primitives-blue-900, #0d4bc3))));-ms-flex-pack:unset;justify-content:unset;max-width:100%;min-height:calc(var(--token-scale-1400, 56px) - var(--token-space-100, var(--token-scale-100, 4px)) * 2);gap:var(--token-space-300, var(--token-scale-300, 12px));-webkit-box-shadow:var(--token-elevation-2, 0px 1px 5px 0px rgba(0, 0, 0, 0.05), 0px 8px 25px 0px rgba(0, 0, 0, 0.08));box-shadow:var(--token-elevation-2, 0px 1px 5px 0px rgba(0, 0, 0, 0.05), 0px 8px 25px 0px rgba(0, 0, 0, 0.08));overflow:auto hidden;z-index:10}:host(.tab-bar-full){padding-top:var(--token-space-100, var(--token-scale-100, 4px));padding-bottom:calc(var(--token-space-100, var(--token-scale-100, 4px)) + var(--ion-safe-area-bottom, 0));padding-right:calc(var(--token-space-400, var(--token-scale-400, 16px)) + var(--ion-safe-area-right, 0));padding-left:calc(var(--token-space-400, var(--token-scale-400, 16px)) + var(--ion-safe-area-left, 0));}:host([slot=top].tab-bar-full){padding-top:calc(var(--token-space-100, var(--token-scale-100, 4px)) + var(--ion-safe-area-top, 0));padding-bottom:var(--token-space-100, var(--token-scale-100, 4px))}:host(.tab-bar-compact){-webkit-padding-start:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-padding-end:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-end:var(--token-space-400, var(--token-scale-400, 16px));padding-top:var(--token-space-100, var(--token-scale-100, 4px));padding-bottom:var(--token-space-100, var(--token-scale-100, 4px));position:absolute;-ms-flex-item-align:center;align-self:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;contain:content}:host([slot=top].tab-bar-compact){top:calc(var(--token-space-100, var(--token-scale-100, 4px)) + var(--ion-safe-area-top, 0))}:host([slot=bottom].tab-bar-compact){bottom:calc(var(--token-space-400, var(--token-scale-400, 16px)) + var(--ion-safe-area-bottom, 0))}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.tab-bar-translucent){--background:rgba(255, 255, 255, 0.6);-webkit-backdrop-filter:var(--tab-bar-backdrop-filter, blur(12px));backdrop-filter:var(--tab-bar-backdrop-filter, blur(12px))}:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){--background:transparent}}:host(.tab-bar-soft){border-radius:var(--token-border-radius-400, var(--token-scale-400, 16px))}:host(.tab-bar-round){border-radius:var(--token-border-radius-full, 999px)}:host(.tab-bar-rectangular){border-radius:var(--token-border-radius-0, var(--token-scale-0, 0px))}`;
|
|
14
|
+
const tabBarIonicCss = () => `:host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-top:var(--border);background:var(--background);color:var(--color);text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:content-box !important;box-sizing:content-box !important}:host(.ion-color) ::slotted(ion-tab-button.ion-focused),:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:var(--background-focused)}:host(.tab-bar-translucent) ::slotted(ion-tab-button){background:transparent}:host([slot=top]){border-top:0;border-bottom:var(--border)}:host(.tab-bar-hidden){display:none !important}:host(.tab-bar-full){width:auto;contain:strict;padding-bottom:var(--ion-safe-area-bottom, 0);padding-right:var(--ion-safe-area-right);padding-left:var(--ion-safe-area-left);}:host([slot=top].tab-bar-full){padding-top:var(--ion-safe-area-top, 0);padding-bottom:0}:host{--background:var(--ion-tab-bar-background, var(--token-bg-surface-default, var(--token-primitives-base-white, #ffffff)));--background-activated:var(--ion-tab-bar-background-activated, var(--token-bg-select-default, var(--token-semantics-primary-100, var(--token-primitives-blue-100, #e9ecfc))));--background-focused:var(--ion-tab-bar-background-focused, transparent);--border:var(--token-border-size-0, var(--token-scale-0, 0px)) var(--token-border-style-solid, solid) var(--ion-tab-bar-border-color, transparent);--color:var(--ion-tab-bar-color, var(--token-primitives-neutral-800, #626262));--color-selected:var(--ion-tab-bar-color-selected, var(--token-text-primary, var(--token-semantics-primary-900, var(--token-primitives-blue-900, #0d4bc3))));-ms-flex-pack:unset;justify-content:unset;max-width:100%;min-height:calc(var(--token-scale-1400, 56px) - var(--token-space-100, var(--token-scale-100, 4px)) * 2);gap:var(--token-space-300, var(--token-scale-300, 12px));-webkit-box-shadow:var(--token-elevation-2, 0px 1px 5px 0px rgba(0, 0, 0, 0.05), 0px 8px 25px 0px rgba(0, 0, 0, 0.08));box-shadow:var(--token-elevation-2, 0px 1px 5px 0px rgba(0, 0, 0, 0.05), 0px 8px 25px 0px rgba(0, 0, 0, 0.08));overflow:auto hidden;z-index:10}:host(.tab-bar-full){padding-top:var(--token-space-100, var(--token-scale-100, 4px));padding-bottom:calc(var(--token-space-100, var(--token-scale-100, 4px)) + var(--ion-safe-area-bottom, 0));padding-right:calc(var(--token-space-400, var(--token-scale-400, 16px)) + var(--ion-safe-area-right, 0));padding-left:calc(var(--token-space-400, var(--token-scale-400, 16px)) + var(--ion-safe-area-left, 0));}:host([slot=top].tab-bar-full){padding-top:calc(var(--token-space-100, var(--token-scale-100, 4px)) + var(--ion-safe-area-top, 0));padding-bottom:var(--token-space-100, var(--token-scale-100, 4px))}:host(.tab-bar-compact){-webkit-padding-start:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-padding-end:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-end:var(--token-space-400, var(--token-scale-400, 16px));padding-top:var(--token-space-100, var(--token-scale-100, 4px));padding-bottom:var(--token-space-100, var(--token-scale-100, 4px));position:absolute;-ms-flex-item-align:center;align-self:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;-webkit-transform:translateX(-50%);transform:translateX(-50%);contain:content}:host(.tab-bar-compact){inset-inline-start:50%}:host([slot=top].tab-bar-compact){top:calc(var(--token-space-100, var(--token-scale-100, 4px)) + var(--ion-safe-area-top, 0))}:host([slot=bottom].tab-bar-compact){bottom:calc(var(--token-space-400, var(--token-scale-400, 16px)) + var(--ion-safe-area-bottom, 0))}:host(.tab-bar-hide-on-scroll){-webkit-transition:-webkit-transform var(--token-transition-time-200, 200ms) var(--token-transition-curve-spring, cubic-bezier(0.16, 1, 0.3, 1));transition:-webkit-transform var(--token-transition-time-200, 200ms) var(--token-transition-curve-spring, cubic-bezier(0.16, 1, 0.3, 1));transition:transform var(--token-transition-time-200, 200ms) var(--token-transition-curve-spring, cubic-bezier(0.16, 1, 0.3, 1));transition:transform var(--token-transition-time-200, 200ms) var(--token-transition-curve-spring, cubic-bezier(0.16, 1, 0.3, 1)), -webkit-transform var(--token-transition-time-200, 200ms) var(--token-transition-curve-spring, cubic-bezier(0.16, 1, 0.3, 1))}:host(.tab-bar-scroll-hidden){-webkit-transform:translateY(calc(100% + var(--ion-safe-area-bottom, 0) + var(--token-space-1000, var(--token-scale-1000, 40px)))) translateX(-50%);transform:translateY(calc(100% + var(--ion-safe-area-bottom, 0) + var(--token-space-1000, var(--token-scale-1000, 40px)))) translateX(-50%);-webkit-transition:-webkit-transform var(--token-transition-time-350, 350ms) var(--token-transition-curve-base, cubic-bezier(0.4, 0, 1, 1));transition:-webkit-transform var(--token-transition-time-350, 350ms) var(--token-transition-curve-base, cubic-bezier(0.4, 0, 1, 1));transition:transform var(--token-transition-time-350, 350ms) var(--token-transition-curve-base, cubic-bezier(0.4, 0, 1, 1));transition:transform var(--token-transition-time-350, 350ms) var(--token-transition-curve-base, cubic-bezier(0.4, 0, 1, 1)), -webkit-transform var(--token-transition-time-350, 350ms) var(--token-transition-curve-base, cubic-bezier(0.4, 0, 1, 1))}:host([slot=top].tab-bar-scroll-hidden){-webkit-transform:translateY(-100%) translateX(-50%);transform:translateY(-100%) translateX(-50%)}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.tab-bar-translucent){--background:rgba(255, 255, 255, 0.6);-webkit-backdrop-filter:var(--tab-bar-backdrop-filter, blur(12px));backdrop-filter:var(--tab-bar-backdrop-filter, blur(12px))}:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){--background:transparent}}:host(.tab-bar-soft){border-radius:var(--token-border-radius-400, var(--token-scale-400, 16px))}:host(.tab-bar-round){border-radius:var(--token-border-radius-full, 999px)}:host(.tab-bar-rectangular){border-radius:var(--token-border-radius-0, var(--token-scale-0, 0px))}`;
|
|
14
15
|
|
|
15
16
|
const tabBarIosCss = () => `:host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-top:var(--border);background:var(--background);color:var(--color);text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:content-box !important;box-sizing:content-box !important}:host(.ion-color) ::slotted(ion-tab-button.ion-focused),:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:var(--background-focused)}:host(.tab-bar-translucent) ::slotted(ion-tab-button){background:transparent}:host([slot=top]){border-top:0;border-bottom:var(--border)}:host(.tab-bar-hidden){display:none !important}:host(.tab-bar-full){width:auto;contain:strict;padding-bottom:var(--ion-safe-area-bottom, 0);padding-right:var(--ion-safe-area-right);padding-left:var(--ion-safe-area-left);}:host([slot=top].tab-bar-full){padding-top:var(--ion-safe-area-top, 0);padding-bottom:0}:host{z-index:10}:host(.ion-color) ::slotted(ion-tab-button){--background-focused:var(--ion-color-shade);--color-selected:var(--ion-color-contrast)}:host(.ion-color) ::slotted(.tab-selected){color:var(--ion-color-contrast)}:host(.ion-color),:host(.ion-color) ::slotted(ion-tab-button){color:rgba(var(--ion-color-contrast-rgb), 0.7)}:host(.ion-color),:host(.ion-color) ::slotted(ion-tab-button){background:var(--ion-color-base)}:host{--background:var(--ion-tab-bar-background, var(--ion-color-step-50, var(--ion-background-color-step-50, #f7f7f7)));--background-focused:var(--ion-tab-bar-background-focused, #e0e0e0);--border:0.55px solid var(--ion-tab-bar-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.2)))));--color:var(--ion-tab-bar-color, var(--ion-color-step-600, var(--ion-text-color-step-400, #666666)));--color-selected:var(--ion-tab-bar-color-selected, var(--ion-color-primary, #0054e9));height:50px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.tab-bar-translucent){--background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(210%) blur(20px);backdrop-filter:saturate(210%) blur(20px)}:host(.ion-color.tab-bar-translucent){background:rgba(var(--ion-color-base-rgb), 0.8)}:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.6)}}`;
|
|
16
17
|
|
|
@@ -24,7 +25,16 @@ const TabBar = class {
|
|
|
24
25
|
this.keyboardCtrl = null;
|
|
25
26
|
this.keyboardCtrlPromise = null;
|
|
26
27
|
this.didLoad = false;
|
|
28
|
+
this.lastScrollTop = 0;
|
|
29
|
+
this.scrollDirectionChangeTop = 0;
|
|
27
30
|
this.keyboardVisible = false;
|
|
31
|
+
this.scrollHidden = false;
|
|
32
|
+
/**
|
|
33
|
+
* If `true`, the tab bar will be hidden when the user scrolls down
|
|
34
|
+
* and shown when the user scrolls up.
|
|
35
|
+
* Only applies when the theme is `"ionic"` and `expand` is `"compact"`.
|
|
36
|
+
*/
|
|
37
|
+
this.hideOnScroll = false;
|
|
28
38
|
/**
|
|
29
39
|
* If `true`, the tab bar will be translucent.
|
|
30
40
|
* Only applies when the theme is `"ios"` and the device supports
|
|
@@ -66,6 +76,7 @@ const TabBar = class {
|
|
|
66
76
|
tab: this.selectedTab,
|
|
67
77
|
});
|
|
68
78
|
}
|
|
79
|
+
this.setupHideOnScroll();
|
|
69
80
|
}
|
|
70
81
|
async connectedCallback() {
|
|
71
82
|
const promise = createKeyboardController(async (keyboardOpen, waitForResize) => {
|
|
@@ -103,6 +114,63 @@ const TabBar = class {
|
|
|
103
114
|
this.keyboardCtrl.destroy();
|
|
104
115
|
this.keyboardCtrl = null;
|
|
105
116
|
}
|
|
117
|
+
this.destroyHideOnScroll();
|
|
118
|
+
}
|
|
119
|
+
setupHideOnScroll() {
|
|
120
|
+
var _a;
|
|
121
|
+
const theme = getIonTheme(this);
|
|
122
|
+
if (theme !== 'ionic' || !this.hideOnScroll || this.expand !== 'compact') {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const footerEl = this.el.closest('ion-footer');
|
|
126
|
+
const pageEl = (_a = footerEl === null || footerEl === void 0 ? void 0 : footerEl.closest('ion-page, .ion-page')) !== null && _a !== void 0 ? _a : this.el.closest('ion-page, .ion-page');
|
|
127
|
+
const contentEl = pageEl ? findIonContent(pageEl) : null;
|
|
128
|
+
if (!contentEl) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.initScrollListener(contentEl);
|
|
132
|
+
}
|
|
133
|
+
async initScrollListener(contentEl) {
|
|
134
|
+
const scrollEl = (this.scrollEl = await getScrollElement(contentEl));
|
|
135
|
+
this.contentScrollCallback = () => {
|
|
136
|
+
readTask(() => {
|
|
137
|
+
const scrollTop = scrollEl.scrollTop;
|
|
138
|
+
const shouldHide = this.checkScrollStatus(scrollTop);
|
|
139
|
+
if (shouldHide !== this.scrollHidden) {
|
|
140
|
+
writeTask(() => {
|
|
141
|
+
this.scrollHidden = shouldHide;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
this.lastScrollTop = scrollTop;
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
scrollEl.addEventListener('scroll', this.contentScrollCallback, { passive: true });
|
|
148
|
+
}
|
|
149
|
+
destroyHideOnScroll() {
|
|
150
|
+
if (this.scrollEl && this.contentScrollCallback) {
|
|
151
|
+
this.scrollEl.removeEventListener('scroll', this.contentScrollCallback);
|
|
152
|
+
this.contentScrollCallback = undefined;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
checkScrollStatus(scrollTop) {
|
|
156
|
+
// Always visible within the first 80px of scroll
|
|
157
|
+
const visibleZone = 80;
|
|
158
|
+
// Hides after 60px of continuous downward scrolling only, when scrolling up threashold should be 0px
|
|
159
|
+
const scrollThresholdHide = 60;
|
|
160
|
+
if (scrollTop <= visibleZone) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
const isScrollingDown = scrollTop > this.lastScrollTop;
|
|
164
|
+
const wasScrollingDown = this.lastScrollTop > this.scrollDirectionChangeTop;
|
|
165
|
+
if (isScrollingDown !== wasScrollingDown) {
|
|
166
|
+
this.scrollDirectionChangeTop = this.lastScrollTop;
|
|
167
|
+
}
|
|
168
|
+
const delta = Math.abs(scrollTop - this.scrollDirectionChangeTop);
|
|
169
|
+
const threshold = isScrollingDown ? scrollThresholdHide : 0;
|
|
170
|
+
if (delta < threshold) {
|
|
171
|
+
return this.scrollHidden;
|
|
172
|
+
}
|
|
173
|
+
return isScrollingDown;
|
|
106
174
|
}
|
|
107
175
|
getShape() {
|
|
108
176
|
const theme = getIonTheme(this);
|
|
@@ -117,17 +185,19 @@ const TabBar = class {
|
|
|
117
185
|
return shape;
|
|
118
186
|
}
|
|
119
187
|
render() {
|
|
120
|
-
const { color, translucent, keyboardVisible, expand } = this;
|
|
188
|
+
const { color, translucent, keyboardVisible, scrollHidden, expand, hideOnScroll } = this;
|
|
121
189
|
const theme = getIonTheme(this);
|
|
122
190
|
const shape = this.getShape();
|
|
123
191
|
const shouldHide = keyboardVisible && this.el.getAttribute('slot') !== 'top';
|
|
124
|
-
return (h(Host, { key: '
|
|
192
|
+
return (h(Host, { key: '7a91bb00ad289d94d34271bdecefb7221c093fd6', role: "tablist", "aria-hidden": shouldHide ? 'true' : null, class: createColorClasses(color, {
|
|
125
193
|
[theme]: true,
|
|
126
194
|
'tab-bar-translucent': translucent,
|
|
127
195
|
'tab-bar-hidden': shouldHide,
|
|
196
|
+
'tab-bar-hide-on-scroll': hideOnScroll,
|
|
197
|
+
'tab-bar-scroll-hidden': scrollHidden,
|
|
128
198
|
[`tab-bar-${expand}`]: true,
|
|
129
199
|
[`tab-bar-${shape}`]: shape !== undefined,
|
|
130
|
-
}) }, h("slot", { key: '
|
|
200
|
+
}) }, h("slot", { key: '96ad10c451a6ae1e2b7c48d94d0f158fb8cde1dc' })));
|
|
131
201
|
}
|
|
132
202
|
get el() { return getElement(this); }
|
|
133
203
|
static get watchers() { return {
|