@ionic/core 7.4.2-dev.11695832397.13fa6703 → 7.4.2-dev.11695927273.1323de22
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/data.js +96 -22
- package/components/haptic.js +1 -0
- package/components/ion-content.js +5 -51
- package/components/ion-datetime-button.js +4 -4
- package/components/ion-datetime.js +3 -3
- package/components/ion-nav.js +2 -1
- package/components/ion-router-outlet.js +1 -1
- package/components/ion-router.js +3 -0
- package/components/ion-tab-bar.js +0 -4
- package/components/ion-toast.js +117 -11
- package/components/ios.transition.js +1 -0
- package/components/overlays.js +1 -0
- package/css/core.css +1 -0
- package/css/core.css.map +1 -1
- package/css/ionic.bundle.css +1 -1
- package/css/ionic.bundle.css.map +1 -1
- package/dist/cjs/{button-active-32f15660.js → button-active-19cc8cae.js} +1 -1
- package/dist/cjs/{data-db832785.js → data-c8d21093.js} +96 -22
- package/dist/cjs/{haptic-c5f6b4d5.js → haptic-678abc9f.js} +1 -0
- package/dist/cjs/{index-b183138a.js → index-77d4b2e7.js} +2 -2
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/ion-action-sheet.cjs.entry.js +3 -3
- package/dist/cjs/ion-alert.cjs.entry.js +3 -3
- package/dist/cjs/ion-app_8.cjs.entry.js +5 -51
- package/dist/cjs/ion-datetime-button.cjs.entry.js +4 -4
- package/dist/cjs/ion-datetime_3.cjs.entry.js +5 -5
- 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 +2 -2
- package/dist/cjs/ion-nav_2.cjs.entry.js +3 -2
- package/dist/cjs/ion-picker-column-internal.cjs.entry.js +1 -1
- package/dist/cjs/ion-popover.cjs.entry.js +2 -2
- package/dist/cjs/ion-refresher_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-reorder_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-route_4.cjs.entry.js +3 -0
- package/dist/cjs/ion-select_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-tab-bar_2.cjs.entry.js +0 -4
- package/dist/cjs/ion-toast.cjs.entry.js +136 -32
- package/dist/cjs/ion-toggle.cjs.entry.js +1 -1
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/{ios.transition-4b93903d.js → ios.transition-458ee399.js} +2 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{md.transition-79f3a215.js → md.transition-3423dd44.js} +1 -1
- package/dist/cjs/{overlays-d3a13e61.js → overlays-817dca17.js} +1 -0
- package/dist/collection/components/content/content.js +10 -50
- package/dist/collection/components/datetime/datetime.js +12 -6
- package/dist/collection/components/datetime/test/hour-cycle/datetime.e2e.js +14 -0
- package/dist/collection/components/datetime/utils/data.js +33 -7
- package/dist/collection/components/datetime/utils/format.js +27 -10
- package/dist/collection/components/datetime/utils/helpers.js +37 -5
- package/dist/collection/components/datetime-button/datetime-button.js +4 -4
- package/dist/collection/components/nav/nav.css +1 -0
- package/dist/collection/components/nav/nav.js +1 -0
- package/dist/collection/components/router/router.js +2 -0
- package/dist/collection/components/router/utils/path.js +1 -0
- package/dist/collection/components/router-outlet/router-outlet.css +1 -0
- package/dist/collection/components/tab-bar/tab-bar.js +0 -21
- package/dist/collection/components/toast/animations/ios.enter.js +40 -3
- package/dist/collection/components/toast/animations/ios.leave.js +8 -4
- package/dist/collection/components/toast/animations/md.enter.js +41 -3
- package/dist/collection/components/toast/test/position-anchor/toast.e2e.js +45 -0
- package/dist/collection/components/toast/toast.js +61 -6
- package/dist/collection/utils/native/haptic.js +1 -0
- package/dist/collection/utils/overlays.js +1 -0
- package/dist/collection/utils/transition/ios.transition.js +1 -0
- package/dist/docs.json +83 -10
- package/dist/esm/{button-active-513e9fff.js → button-active-d2346892.js} +1 -1
- package/dist/esm/{data-009dbf15.js → data-44d9e816.js} +96 -22
- package/dist/esm/{haptic-6447af60.js → haptic-1243b917.js} +1 -0
- package/dist/esm/{index-87684bba.js → index-dac72b4c.js} +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/ion-action-sheet.entry.js +3 -3
- package/dist/esm/ion-alert.entry.js +3 -3
- package/dist/esm/ion-app_8.entry.js +6 -52
- package/dist/esm/ion-datetime-button.entry.js +4 -4
- package/dist/esm/ion-datetime_3.entry.js +5 -5
- 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 +2 -2
- package/dist/esm/ion-nav_2.entry.js +3 -2
- package/dist/esm/ion-picker-column-internal.entry.js +1 -1
- package/dist/esm/ion-popover.entry.js +2 -2
- package/dist/esm/ion-refresher_2.entry.js +1 -1
- package/dist/esm/ion-reorder_2.entry.js +1 -1
- package/dist/esm/ion-route_4.entry.js +3 -0
- package/dist/esm/ion-select_3.entry.js +1 -1
- package/dist/esm/ion-tab-bar_2.entry.js +0 -4
- package/dist/esm/ion-toast.entry.js +117 -13
- package/dist/esm/ion-toggle.entry.js +1 -1
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/{ios.transition-81e1aed6.js → ios.transition-991c1a56.js} +2 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{md.transition-5becd8b5.js → md.transition-fb443521.js} +1 -1
- package/dist/esm/{overlays-8fc6656c.js → overlays-e064e499.js} +1 -0
- package/dist/esm-es5/{button-active-513e9fff.js → button-active-d2346892.js} +1 -1
- package/dist/esm-es5/data-44d9e816.js +4 -0
- package/dist/esm-es5/{index-87684bba.js → index-dac72b4c.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
- package/dist/esm-es5/ion-alert.entry.js +1 -1
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-loading.entry.js +1 -1
- package/dist/esm-es5/ion-menu_3.entry.js +1 -1
- package/dist/esm-es5/ion-modal.entry.js +1 -1
- package/dist/esm-es5/ion-nav_2.entry.js +1 -1
- package/dist/esm-es5/ion-picker-column-internal.entry.js +1 -1
- package/dist/esm-es5/ion-popover.entry.js +1 -1
- package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
- package/dist/esm-es5/ion-reorder_2.entry.js +1 -1
- package/dist/esm-es5/ion-select_3.entry.js +1 -1
- package/dist/esm-es5/ion-tab-bar_2.entry.js +1 -1
- package/dist/esm-es5/ion-toast.entry.js +1 -1
- package/dist/esm-es5/ion-toggle.entry.js +1 -1
- package/dist/esm-es5/ionic.js +1 -1
- package/dist/esm-es5/{ios.transition-81e1aed6.js → ios.transition-991c1a56.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{md.transition-5becd8b5.js → md.transition-fb443521.js} +1 -1
- package/dist/html.html-data.json +11 -1
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-37456282.system.entry.js → p-06116432.system.entry.js} +1 -1
- package/dist/ionic/{p-270aa06b.entry.js → p-14dec15f.entry.js} +1 -1
- package/dist/ionic/{p-60838ce3.system.entry.js → p-161a6465.system.entry.js} +1 -1
- package/dist/ionic/p-17240d90.js +4 -0
- package/dist/ionic/{p-a6d8476b.system.entry.js → p-17e6836b.system.entry.js} +1 -1
- package/dist/ionic/p-1f448082.system.entry.js +4 -0
- package/dist/ionic/{p-972763df.js → p-2b70878e.js} +1 -1
- package/dist/ionic/{p-13a91505.entry.js → p-2d74ee51.entry.js} +1 -1
- package/dist/ionic/{p-f8f60fbf.entry.js → p-2dac36bf.entry.js} +1 -1
- package/dist/ionic/{p-c5729044.system.entry.js → p-2df840d9.system.entry.js} +1 -1
- package/dist/ionic/{p-de676d36.system.entry.js → p-2ffbf4bc.system.entry.js} +1 -1
- package/dist/ionic/{p-4616f20a.system.entry.js → p-30bd5385.system.entry.js} +1 -1
- package/dist/ionic/{p-00aed720.system.js → p-315dd3f8.system.js} +1 -1
- package/dist/ionic/{p-b098f738.system.js → p-35d1c3bb.system.js} +1 -1
- package/dist/ionic/p-3ae2faf0.entry.js +4 -0
- package/dist/ionic/{p-08c5b9f4.system.entry.js → p-3b1a8994.system.entry.js} +1 -1
- package/dist/ionic/p-419b8565.entry.js +4 -0
- package/dist/ionic/{p-82da795c.system.entry.js → p-420da334.system.entry.js} +1 -1
- package/dist/ionic/{p-73f50e29.system.js → p-48393630.system.js} +1 -1
- package/dist/ionic/{p-918d5f19.system.js → p-4cf29e23.system.js} +1 -1
- package/dist/ionic/p-50b11c2b.system.entry.js +4 -0
- package/dist/ionic/{p-53bbd357.system.entry.js → p-5d522814.system.entry.js} +1 -1
- package/dist/ionic/p-5e84b718.system.entry.js +4 -0
- package/dist/ionic/{p-3730f493.entry.js → p-62f05fd2.entry.js} +1 -1
- package/dist/ionic/p-674e6f0c.js +4 -0
- package/dist/ionic/p-6edbc09b.system.js +1 -1
- package/dist/ionic/{p-5e2dc8e0.js → p-716fbba9.js} +1 -1
- package/dist/ionic/{p-f920f5ca.entry.js → p-7779d376.entry.js} +1 -1
- package/dist/ionic/{p-a720dc73.entry.js → p-78f204ee.entry.js} +1 -1
- package/dist/ionic/p-86e73df8.system.entry.js +4 -0
- package/dist/ionic/{p-7129d04e.entry.js → p-8a26eaba.entry.js} +1 -1
- package/dist/ionic/{p-d8b2c214.entry.js → p-974cbc3a.entry.js} +1 -1
- package/dist/ionic/{p-90d892fd.entry.js → p-990aaa2f.entry.js} +1 -1
- package/dist/ionic/{p-8fdd4a2f.system.js → p-9eb5455c.system.js} +1 -1
- package/dist/ionic/{p-4912b933.entry.js → p-a27a6256.entry.js} +1 -1
- package/dist/ionic/{p-b95fd3c6.entry.js → p-b61cf76c.entry.js} +1 -1
- package/dist/ionic/{p-ee6d9730.entry.js → p-b7dad585.entry.js} +1 -1
- package/dist/ionic/p-b8c3f071.system.js +4 -0
- package/dist/ionic/{p-40e16caa.system.entry.js → p-be337735.system.entry.js} +1 -1
- package/dist/ionic/p-c44645f2.entry.js +4 -0
- package/dist/ionic/{p-c7fca267.entry.js → p-c8251e8c.entry.js} +1 -1
- package/dist/ionic/p-d6dcbd7c.js +4 -0
- package/dist/ionic/{p-65a4c12f.system.entry.js → p-ec3fa33b.system.entry.js} +1 -1
- package/dist/ionic/{p-7e46b6ab.entry.js → p-f180d2b6.entry.js} +1 -1
- package/dist/ionic/{p-4a1ac160.system.entry.js → p-f767d6b4.system.entry.js} +1 -1
- package/dist/ionic/{p-63a73b69.system.entry.js → p-f7f6af24.system.entry.js} +1 -1
- package/dist/types/components/content/content.d.ts +1 -2
- package/dist/types/components/datetime/datetime-interface.d.ts +1 -0
- package/dist/types/components/datetime/datetime.d.ts +2 -2
- package/dist/types/components/datetime/utils/data.d.ts +3 -3
- package/dist/types/components/datetime/utils/format.d.ts +3 -3
- package/dist/types/components/datetime/utils/helpers.d.ts +15 -1
- package/dist/types/components/tab-bar/tab-bar.d.ts +0 -8
- package/dist/types/components/toast/animations/ios.enter.d.ts +2 -1
- package/dist/types/components/toast/animations/md.enter.d.ts +2 -1
- package/dist/types/components/toast/toast-interface.d.ts +6 -0
- package/dist/types/components/toast/toast.d.ts +9 -1
- package/dist/types/components.d.ts +16 -8
- package/hydrate/index.js +229 -93
- package/package.json +4 -5
- package/dist/esm-es5/data-009dbf15.js +0 -4
- package/dist/ionic/p-1a36bf45.system.entry.js +0 -4
- package/dist/ionic/p-1f6ac05b.system.entry.js +0 -4
- package/dist/ionic/p-27614d55.entry.js +0 -4
- package/dist/ionic/p-3c0b06ef.system.entry.js +0 -4
- package/dist/ionic/p-44ef7224.system.js +0 -4
- package/dist/ionic/p-5e0cf844.system.entry.js +0 -4
- package/dist/ionic/p-67c441fa.entry.js +0 -4
- package/dist/ionic/p-72a1cbc7.js +0 -4
- package/dist/ionic/p-78a293a5.js +0 -4
- package/dist/ionic/p-7cfd253c.js +0 -4
- package/dist/ionic/p-875a2dce.entry.js +0 -4
- /package/dist/esm-es5/{haptic-6447af60.js → haptic-1243b917.js} +0 -0
- /package/dist/esm-es5/{overlays-8fc6656c.js → overlays-e064e499.js} +0 -0
- /package/dist/ionic/{p-f9015336.js → p-3faf56ab.js} +0 -0
- /package/dist/ionic/{p-7a3caa4e.system.js → p-40bd36f3.system.js} +0 -0
- /package/dist/ionic/{p-14d7b7e2.system.js → p-b4b4bb29.system.js} +0 -0
- /package/dist/ionic/{p-bb6f38ed.js → p-b923f3d7.js} +0 -0
|
@@ -38,6 +38,7 @@ export const chainToSegments = (chain) => {
|
|
|
38
38
|
for (const route of chain) {
|
|
39
39
|
for (const segment of route.segments) {
|
|
40
40
|
if (segment[0] === ':') {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
41
42
|
const param = route.params && route.params[segment.slice(1)];
|
|
42
43
|
if (!param) {
|
|
43
44
|
return null;
|
|
@@ -44,9 +44,6 @@ export class TabBar {
|
|
|
44
44
|
this.keyboardCtrl.destroy();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
componentDidLoad() {
|
|
48
|
-
this.ionTabBarLoaded.emit();
|
|
49
|
-
}
|
|
50
47
|
render() {
|
|
51
48
|
const { color, translucent, keyboardVisible } = this;
|
|
52
49
|
const mode = getIonMode(this);
|
|
@@ -163,24 +160,6 @@ export class TabBar {
|
|
|
163
160
|
}
|
|
164
161
|
}
|
|
165
162
|
}
|
|
166
|
-
}, {
|
|
167
|
-
"method": "ionTabBarLoaded",
|
|
168
|
-
"name": "ionTabBarLoaded",
|
|
169
|
-
"bubbles": true,
|
|
170
|
-
"cancelable": true,
|
|
171
|
-
"composed": true,
|
|
172
|
-
"docs": {
|
|
173
|
-
"tags": [{
|
|
174
|
-
"name": "internal",
|
|
175
|
-
"text": "This event is used in IonContent to correctly\ncalculate the fullscreen content offsets\nwhen IonTabBar is used."
|
|
176
|
-
}],
|
|
177
|
-
"text": ""
|
|
178
|
-
},
|
|
179
|
-
"complexType": {
|
|
180
|
-
"original": "void",
|
|
181
|
-
"resolved": "void",
|
|
182
|
-
"references": {}
|
|
183
|
-
}
|
|
184
163
|
}];
|
|
185
164
|
}
|
|
186
165
|
static get elementRef() { return "el"; }
|
|
@@ -2,17 +2,54 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { createAnimation } from "../../../utils/animation/animation";
|
|
5
|
+
import { win } from "../../../utils/browser/index";
|
|
5
6
|
import { getElementRoot } from "../../../utils/helpers";
|
|
6
7
|
/**
|
|
7
8
|
* iOS Toast Enter Animation
|
|
8
9
|
*/
|
|
9
|
-
export const iosEnterAnimation = (baseEl,
|
|
10
|
+
export const iosEnterAnimation = (baseEl, opts) => {
|
|
10
11
|
const baseAnimation = createAnimation();
|
|
11
12
|
const wrapperAnimation = createAnimation();
|
|
13
|
+
const { position, positionAnchor } = opts;
|
|
12
14
|
const root = getElementRoot(baseEl);
|
|
13
15
|
const wrapperEl = root.querySelector('.toast-wrapper');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Start with a predefined offset from the edge the toast will be
|
|
18
|
+
* positioned relative to. By default, this will be the top edge
|
|
19
|
+
* of the screen.
|
|
20
|
+
*/
|
|
21
|
+
let offset = position === 'top' ? 10 : -10;
|
|
22
|
+
let top, bottom;
|
|
23
|
+
/**
|
|
24
|
+
* If positionAnchor is defined, add in the distance from the top
|
|
25
|
+
* of the screen to the target anchor edge. For position="top", the
|
|
26
|
+
* bottom anchor edge is targeted. For position="bottom", the top
|
|
27
|
+
* anchor edge is targeted.
|
|
28
|
+
*/
|
|
29
|
+
if (positionAnchor && win) {
|
|
30
|
+
const box = positionAnchor.getBoundingClientRect();
|
|
31
|
+
if (position === 'top') {
|
|
32
|
+
offset += box.bottom;
|
|
33
|
+
}
|
|
34
|
+
else if (position === 'bottom') {
|
|
35
|
+
/**
|
|
36
|
+
* Just box.top is the distance from the top edge of the screen
|
|
37
|
+
* to the top edge of the anchor. We want to calculate from the
|
|
38
|
+
* bottom edge of the screen instead.
|
|
39
|
+
*/
|
|
40
|
+
offset -= win.innerHeight - box.top;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* We don't include safe area here because that should already be
|
|
44
|
+
* accounted for when checking the position of the anchor.
|
|
45
|
+
*/
|
|
46
|
+
top = `${offset}px`;
|
|
47
|
+
bottom = `${offset}px`;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
top = `calc(${offset}px + var(--ion-safe-area-top, 0px))`;
|
|
51
|
+
bottom = `calc(${offset}px - var(--ion-safe-area-bottom, 0px))`;
|
|
52
|
+
}
|
|
16
53
|
wrapperAnimation.addElement(wrapperEl);
|
|
17
54
|
switch (position) {
|
|
18
55
|
case 'top':
|
|
@@ -11,18 +11,22 @@ export const iosLeaveAnimation = (baseEl, position) => {
|
|
|
11
11
|
const wrapperAnimation = createAnimation();
|
|
12
12
|
const root = getElementRoot(baseEl);
|
|
13
13
|
const wrapperEl = root.querySelector('.toast-wrapper');
|
|
14
|
-
const bottom = `calc(-10px - var(--ion-safe-area-bottom, 0px))`;
|
|
15
|
-
const top = `calc(10px + var(--ion-safe-area-top, 0px))`;
|
|
16
14
|
wrapperAnimation.addElement(wrapperEl);
|
|
15
|
+
/**
|
|
16
|
+
* For top/bottom positions, we use to() instead of fromTo() so that if
|
|
17
|
+
* the positionAnchor prop was used, we don't need to recalculate the
|
|
18
|
+
* toast and/or anchor's position and duplicate work from the enter
|
|
19
|
+
* animation.
|
|
20
|
+
*/
|
|
17
21
|
switch (position) {
|
|
18
22
|
case 'top':
|
|
19
|
-
wrapperAnimation.
|
|
23
|
+
wrapperAnimation.to('transform', 'translateY(-100%)');
|
|
20
24
|
break;
|
|
21
25
|
case 'middle':
|
|
22
26
|
wrapperAnimation.fromTo('opacity', 0.99, 0);
|
|
23
27
|
break;
|
|
24
28
|
default:
|
|
25
|
-
wrapperAnimation.
|
|
29
|
+
wrapperAnimation.to('transform', 'translateY(100%)');
|
|
26
30
|
break;
|
|
27
31
|
}
|
|
28
32
|
return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(300).addAnimation(wrapperAnimation);
|
|
@@ -2,17 +2,55 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { createAnimation } from "../../../utils/animation/animation";
|
|
5
|
+
import { win } from "../../../utils/browser/index";
|
|
5
6
|
import { getElementRoot } from "../../../utils/helpers";
|
|
6
7
|
/**
|
|
7
8
|
* MD Toast Enter Animation
|
|
8
9
|
*/
|
|
9
|
-
export const mdEnterAnimation = (baseEl,
|
|
10
|
+
export const mdEnterAnimation = (baseEl, opts) => {
|
|
10
11
|
const baseAnimation = createAnimation();
|
|
11
12
|
const wrapperAnimation = createAnimation();
|
|
13
|
+
const { position, positionAnchor } = opts;
|
|
12
14
|
const root = getElementRoot(baseEl);
|
|
13
15
|
const wrapperEl = root.querySelector('.toast-wrapper');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Start with a predefined offset from the edge the toast will be
|
|
18
|
+
* positioned relative to. By default, this will be the top edge
|
|
19
|
+
* of the screen for position="top", or the bottom edge for
|
|
20
|
+
* position="bottom".
|
|
21
|
+
*/
|
|
22
|
+
let offset = 8;
|
|
23
|
+
let top, bottom;
|
|
24
|
+
/**
|
|
25
|
+
* If positionAnchor is defined, add in the distance from the target
|
|
26
|
+
* screen edge to the target anchor edge. For position="top", the
|
|
27
|
+
* bottom anchor edge is targeted. For position="bottom", the top
|
|
28
|
+
* anchor edge is targeted.
|
|
29
|
+
*/
|
|
30
|
+
if (positionAnchor && win) {
|
|
31
|
+
const box = positionAnchor.getBoundingClientRect();
|
|
32
|
+
if (position === 'top') {
|
|
33
|
+
offset += box.bottom;
|
|
34
|
+
}
|
|
35
|
+
else if (position === 'bottom') {
|
|
36
|
+
/**
|
|
37
|
+
* Just box.top is the distance from the top edge of the screen
|
|
38
|
+
* to the top edge of the anchor. We want to calculate from the
|
|
39
|
+
* bottom edge of the screen instead.
|
|
40
|
+
*/
|
|
41
|
+
offset += win.innerHeight - box.top;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* We don't include safe area here because that should already be
|
|
45
|
+
* accounted for when checking the position of the anchor.
|
|
46
|
+
*/
|
|
47
|
+
top = `${offset}px`;
|
|
48
|
+
bottom = `${offset}px`;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
top = `calc(${offset}px + var(--ion-safe-area-top, 0px))`;
|
|
52
|
+
bottom = `calc(${offset}px + var(--ion-safe-area-bottom, 0px))`;
|
|
53
|
+
}
|
|
16
54
|
wrapperAnimation.addElement(wrapperEl);
|
|
17
55
|
switch (position) {
|
|
18
56
|
case 'top':
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { expect } from "@playwright/test";
|
|
5
|
+
import { configs, test } from "../../../../utils/test/playwright/index";
|
|
6
|
+
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
|
7
|
+
test.describe(title('toast: positionAnchor'), () => {
|
|
8
|
+
test.beforeEach(async ({ page }) => {
|
|
9
|
+
await page.goto('/src/components/toast/test/position-anchor', config);
|
|
10
|
+
/**
|
|
11
|
+
* We need to screenshot the whole page to ensure the toasts are positioned
|
|
12
|
+
* correctly, but we don't need much extra white space between the header
|
|
13
|
+
* and footer.
|
|
14
|
+
*/
|
|
15
|
+
await page.setViewportSize({
|
|
16
|
+
width: 425,
|
|
17
|
+
height: 425,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
test('should place top-position toast underneath anchor', async ({ page }) => {
|
|
21
|
+
const ionToastDidPresent = await page.spyOnEvent('ionToastDidPresent');
|
|
22
|
+
await page.click('#headerAnchor');
|
|
23
|
+
await ionToastDidPresent.next();
|
|
24
|
+
await expect(page).toHaveScreenshot(screenshot(`toast-header-anchor`));
|
|
25
|
+
});
|
|
26
|
+
test('should place bottom-position toast above anchor', async ({ page }) => {
|
|
27
|
+
const ionToastDidPresent = await page.spyOnEvent('ionToastDidPresent');
|
|
28
|
+
await page.click('#footerAnchor');
|
|
29
|
+
await ionToastDidPresent.next();
|
|
30
|
+
await expect(page).toHaveScreenshot(screenshot(`toast-footer-anchor`));
|
|
31
|
+
});
|
|
32
|
+
test('should ignore anchor for middle-position toast', async ({ page }) => {
|
|
33
|
+
const ionToastDidPresent = await page.spyOnEvent('ionToastDidPresent');
|
|
34
|
+
await page.click('#middleAnchor');
|
|
35
|
+
await ionToastDidPresent.next();
|
|
36
|
+
await expect(page).toHaveScreenshot(screenshot(`toast-middle-anchor`));
|
|
37
|
+
});
|
|
38
|
+
test('should correctly anchor toast when using an element reference', async ({ page }) => {
|
|
39
|
+
const ionToastDidPresent = await page.spyOnEvent('ionToastDidPresent');
|
|
40
|
+
await page.click('#headerElAnchor');
|
|
41
|
+
await ionToastDidPresent.next();
|
|
42
|
+
await expect(page).toHaveScreenshot(screenshot(`toast-header-el-anchor`));
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -54,6 +54,7 @@ export class Toast {
|
|
|
54
54
|
this.message = undefined;
|
|
55
55
|
this.keyboardClose = false;
|
|
56
56
|
this.position = 'bottom';
|
|
57
|
+
this.positionAnchor = undefined;
|
|
57
58
|
this.buttons = undefined;
|
|
58
59
|
this.translucent = false;
|
|
59
60
|
this.animated = true;
|
|
@@ -101,7 +102,33 @@ export class Toast {
|
|
|
101
102
|
async present() {
|
|
102
103
|
const unlock = await this.lockController.lock();
|
|
103
104
|
await this.delegateController.attachViewToDom();
|
|
104
|
-
|
|
105
|
+
const { position, positionAnchor } = this;
|
|
106
|
+
let anchor;
|
|
107
|
+
if (position === 'middle' && positionAnchor !== undefined) {
|
|
108
|
+
printIonWarning('The positionAnchor property is ignored when using position="middle".', this.el);
|
|
109
|
+
}
|
|
110
|
+
else if (typeof positionAnchor === 'string') {
|
|
111
|
+
/**
|
|
112
|
+
* If the anchor is defined as an ID, find the element.
|
|
113
|
+
* We do this on every present so the toast doesn't need
|
|
114
|
+
* to account for the surrounding DOM changing since the
|
|
115
|
+
* last time it was presented.
|
|
116
|
+
*/
|
|
117
|
+
const foundEl = document.getElementById(positionAnchor);
|
|
118
|
+
if (foundEl === null) {
|
|
119
|
+
printIonWarning(`An anchor element with an ID of ${positionAnchor} was not found in the DOM.`, this.el);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
anchor = foundEl;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
anchor = positionAnchor;
|
|
127
|
+
}
|
|
128
|
+
await present(this, 'toastEnter', iosEnterAnimation, mdEnterAnimation, {
|
|
129
|
+
position,
|
|
130
|
+
positionAnchor: anchor,
|
|
131
|
+
});
|
|
105
132
|
/**
|
|
106
133
|
* Content is revealed to screen readers after
|
|
107
134
|
* the transition to avoid jank since this
|
|
@@ -517,12 +544,34 @@ export class Toast {
|
|
|
517
544
|
"optional": false,
|
|
518
545
|
"docs": {
|
|
519
546
|
"tags": [],
|
|
520
|
-
"text": "The position of the toast on the screen."
|
|
547
|
+
"text": "The starting position of the toast on the screen. Can be tweaked further\nusing the `positionAnchor` property."
|
|
521
548
|
},
|
|
522
549
|
"attribute": "position",
|
|
523
550
|
"reflect": false,
|
|
524
551
|
"defaultValue": "'bottom'"
|
|
525
552
|
},
|
|
553
|
+
"positionAnchor": {
|
|
554
|
+
"type": "string",
|
|
555
|
+
"mutable": false,
|
|
556
|
+
"complexType": {
|
|
557
|
+
"original": "HTMLElement | string",
|
|
558
|
+
"resolved": "HTMLElement | string | undefined",
|
|
559
|
+
"references": {
|
|
560
|
+
"HTMLElement": {
|
|
561
|
+
"location": "global",
|
|
562
|
+
"id": "global::HTMLElement"
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
"required": false,
|
|
567
|
+
"optional": true,
|
|
568
|
+
"docs": {
|
|
569
|
+
"tags": [],
|
|
570
|
+
"text": "The element to anchor the toast's position to. Can be set as a direct reference\nor the ID of the element. With `position=\"bottom\"`, the toast will sit above the\nchosen element. With `position=\"top\"`, the toast will sit below the chosen element.\nWith `position=\"middle\"`, the value of `positionAnchor` is ignored."
|
|
571
|
+
},
|
|
572
|
+
"attribute": "position-anchor",
|
|
573
|
+
"reflect": false
|
|
574
|
+
},
|
|
526
575
|
"buttons": {
|
|
527
576
|
"type": "unknown",
|
|
528
577
|
"mutable": false,
|
|
@@ -812,9 +861,14 @@ export class Toast {
|
|
|
812
861
|
"location": "global",
|
|
813
862
|
"id": "global::Promise"
|
|
814
863
|
},
|
|
815
|
-
"
|
|
864
|
+
"HTMLElement": {
|
|
816
865
|
"location": "global",
|
|
817
|
-
"id": "global::
|
|
866
|
+
"id": "global::HTMLElement"
|
|
867
|
+
},
|
|
868
|
+
"ToastPresentOptions": {
|
|
869
|
+
"location": "import",
|
|
870
|
+
"path": "./toast-interface",
|
|
871
|
+
"id": "src/components/toast/toast-interface.ts::ToastPresentOptions"
|
|
818
872
|
}
|
|
819
873
|
},
|
|
820
874
|
"return": "Promise<void>"
|
|
@@ -846,8 +900,9 @@ export class Toast {
|
|
|
846
900
|
"id": "global::Promise"
|
|
847
901
|
},
|
|
848
902
|
"ToastDismissOptions": {
|
|
849
|
-
"location": "
|
|
850
|
-
"
|
|
903
|
+
"location": "import",
|
|
904
|
+
"path": "./toast-interface",
|
|
905
|
+
"id": "src/components/toast/toast-interface.ts::ToastDismissOptions"
|
|
851
906
|
}
|
|
852
907
|
},
|
|
853
908
|
"return": "Promise<boolean>"
|
|
@@ -75,6 +75,7 @@ const HapticEngine = {
|
|
|
75
75
|
* if the browser does not support the Vibrate API.
|
|
76
76
|
*/
|
|
77
77
|
if ((capacitor === null || capacitor === void 0 ? void 0 : capacitor.getPlatform()) === 'web') {
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
78
79
|
return typeof navigator !== 'undefined' && navigator.vibrate !== undefined;
|
|
79
80
|
}
|
|
80
81
|
return true;
|
|
@@ -68,6 +68,7 @@ export const setOverlayId = (el) => {
|
|
|
68
68
|
return el.id;
|
|
69
69
|
};
|
|
70
70
|
export const createOverlay = (tagName, opts) => {
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
71
72
|
if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined') {
|
|
72
73
|
return window.customElements.whenDefined(tagName).then(() => {
|
|
73
74
|
const element = document.createElement(tagName);
|
|
@@ -202,6 +202,7 @@ export const iosTransitionAnimation = (navEl, opts) => {
|
|
|
202
202
|
.easing(opts.easing || EASING)
|
|
203
203
|
.fill('both')
|
|
204
204
|
.beforeRemoveClass('ion-page-invisible');
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
205
206
|
if (leavingEl && navEl !== null && navEl !== undefined) {
|
|
206
207
|
const navDecorAnimation = createAnimation();
|
|
207
208
|
navDecorAnimation.addElement(navEl);
|
package/dist/docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2023-09-
|
|
2
|
+
"timestamp": "2023-09-28T18:57:10",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.3.0",
|
|
@@ -6714,6 +6714,12 @@
|
|
|
6714
6714
|
}
|
|
6715
6715
|
],
|
|
6716
6716
|
"listeners": [
|
|
6717
|
+
{
|
|
6718
|
+
"event": "appload",
|
|
6719
|
+
"target": "window",
|
|
6720
|
+
"capture": false,
|
|
6721
|
+
"passive": false
|
|
6722
|
+
},
|
|
6717
6723
|
{
|
|
6718
6724
|
"event": "resize",
|
|
6719
6725
|
"target": "window",
|
|
@@ -7102,11 +7108,17 @@
|
|
|
7102
7108
|
},
|
|
7103
7109
|
{
|
|
7104
7110
|
"name": "hourCycle",
|
|
7105
|
-
"type": "\"h12\" | \"h23\" | undefined",
|
|
7111
|
+
"type": "\"h11\" | \"h12\" | \"h23\" | \"h24\" | undefined",
|
|
7106
7112
|
"complexType": {
|
|
7107
|
-
"original": "
|
|
7108
|
-
"resolved": "\"h12\" | \"h23\" | undefined",
|
|
7109
|
-
"references": {
|
|
7113
|
+
"original": "DatetimeHourCycle",
|
|
7114
|
+
"resolved": "\"h11\" | \"h12\" | \"h23\" | \"h24\" | undefined",
|
|
7115
|
+
"references": {
|
|
7116
|
+
"DatetimeHourCycle": {
|
|
7117
|
+
"location": "import",
|
|
7118
|
+
"path": "./datetime-interface",
|
|
7119
|
+
"id": "src/components/datetime/datetime-interface.ts::DatetimeHourCycle"
|
|
7120
|
+
}
|
|
7121
|
+
}
|
|
7110
7122
|
},
|
|
7111
7123
|
"mutable": false,
|
|
7112
7124
|
"attr": "hour-cycle",
|
|
@@ -7114,6 +7126,10 @@
|
|
|
7114
7126
|
"docs": "The hour cycle of the `ion-datetime`. If no value is set, this is\nspecified by the current locale.",
|
|
7115
7127
|
"docsTags": [],
|
|
7116
7128
|
"values": [
|
|
7129
|
+
{
|
|
7130
|
+
"value": "h11",
|
|
7131
|
+
"type": "string"
|
|
7132
|
+
},
|
|
7117
7133
|
{
|
|
7118
7134
|
"value": "h12",
|
|
7119
7135
|
"type": "string"
|
|
@@ -7122,6 +7138,10 @@
|
|
|
7122
7138
|
"value": "h23",
|
|
7123
7139
|
"type": "string"
|
|
7124
7140
|
},
|
|
7141
|
+
{
|
|
7142
|
+
"value": "h24",
|
|
7143
|
+
"type": "string"
|
|
7144
|
+
},
|
|
7125
7145
|
{
|
|
7126
7146
|
"type": "undefined"
|
|
7127
7147
|
}
|
|
@@ -27719,7 +27739,7 @@
|
|
|
27719
27739
|
"mutable": false,
|
|
27720
27740
|
"attr": "position",
|
|
27721
27741
|
"reflectToAttr": false,
|
|
27722
|
-
"docs": "The position of the toast on the screen.",
|
|
27742
|
+
"docs": "The starting position of the toast on the screen. Can be tweaked further\nusing the `positionAnchor` property.",
|
|
27723
27743
|
"docsTags": [],
|
|
27724
27744
|
"default": "'bottom'",
|
|
27725
27745
|
"values": [
|
|
@@ -27739,6 +27759,38 @@
|
|
|
27739
27759
|
"optional": false,
|
|
27740
27760
|
"required": false
|
|
27741
27761
|
},
|
|
27762
|
+
{
|
|
27763
|
+
"name": "positionAnchor",
|
|
27764
|
+
"type": "HTMLElement | string | undefined",
|
|
27765
|
+
"complexType": {
|
|
27766
|
+
"original": "HTMLElement | string",
|
|
27767
|
+
"resolved": "HTMLElement | string | undefined",
|
|
27768
|
+
"references": {
|
|
27769
|
+
"HTMLElement": {
|
|
27770
|
+
"location": "global",
|
|
27771
|
+
"id": "global::HTMLElement"
|
|
27772
|
+
}
|
|
27773
|
+
}
|
|
27774
|
+
},
|
|
27775
|
+
"mutable": false,
|
|
27776
|
+
"attr": "position-anchor",
|
|
27777
|
+
"reflectToAttr": false,
|
|
27778
|
+
"docs": "The element to anchor the toast's position to. Can be set as a direct reference\nor the ID of the element. With `position=\"bottom\"`, the toast will sit above the\nchosen element. With `position=\"top\"`, the toast will sit below the chosen element.\nWith `position=\"middle\"`, the value of `positionAnchor` is ignored.",
|
|
27779
|
+
"docsTags": [],
|
|
27780
|
+
"values": [
|
|
27781
|
+
{
|
|
27782
|
+
"type": "HTMLElement"
|
|
27783
|
+
},
|
|
27784
|
+
{
|
|
27785
|
+
"type": "string"
|
|
27786
|
+
},
|
|
27787
|
+
{
|
|
27788
|
+
"type": "undefined"
|
|
27789
|
+
}
|
|
27790
|
+
],
|
|
27791
|
+
"optional": true,
|
|
27792
|
+
"required": false
|
|
27793
|
+
},
|
|
27742
27794
|
{
|
|
27743
27795
|
"name": "translucent",
|
|
27744
27796
|
"type": "boolean",
|
|
@@ -27821,8 +27873,9 @@
|
|
|
27821
27873
|
"id": "global::Promise"
|
|
27822
27874
|
},
|
|
27823
27875
|
"ToastDismissOptions": {
|
|
27824
|
-
"location": "
|
|
27825
|
-
"
|
|
27876
|
+
"location": "import",
|
|
27877
|
+
"path": "./toast-interface",
|
|
27878
|
+
"id": "src/components/toast/toast-interface.ts::ToastDismissOptions"
|
|
27826
27879
|
}
|
|
27827
27880
|
},
|
|
27828
27881
|
"return": "Promise<boolean>"
|
|
@@ -27917,9 +27970,14 @@
|
|
|
27917
27970
|
"location": "global",
|
|
27918
27971
|
"id": "global::Promise"
|
|
27919
27972
|
},
|
|
27920
|
-
"
|
|
27973
|
+
"HTMLElement": {
|
|
27921
27974
|
"location": "global",
|
|
27922
|
-
"id": "global::
|
|
27975
|
+
"id": "global::HTMLElement"
|
|
27976
|
+
},
|
|
27977
|
+
"ToastPresentOptions": {
|
|
27978
|
+
"location": "import",
|
|
27979
|
+
"path": "./toast-interface",
|
|
27980
|
+
"id": "src/components/toast/toast-interface.ts::ToastPresentOptions"
|
|
27923
27981
|
}
|
|
27924
27982
|
},
|
|
27925
27983
|
"return": "Promise<void>"
|
|
@@ -28995,6 +29053,11 @@
|
|
|
28995
29053
|
"docstring": "",
|
|
28996
29054
|
"path": "src/components/datetime/datetime-interface.ts"
|
|
28997
29055
|
},
|
|
29056
|
+
"src/components/datetime/datetime-interface.ts::DatetimeHourCycle": {
|
|
29057
|
+
"declaration": "export type DatetimeHourCycle = 'h11' | 'h12' | 'h23' | 'h24';",
|
|
29058
|
+
"docstring": "",
|
|
29059
|
+
"path": "src/components/datetime/datetime-interface.ts"
|
|
29060
|
+
},
|
|
28998
29061
|
"src/components/datetime/datetime-interface.ts::DatetimeChangeEventDetail": {
|
|
28999
29062
|
"declaration": "export interface DatetimeChangeEventDetail {\n value?: string | string[] | null;\n}",
|
|
29000
29063
|
"docstring": "",
|
|
@@ -29290,6 +29353,16 @@
|
|
|
29290
29353
|
"docstring": "",
|
|
29291
29354
|
"path": "src/components/toast/toast-interface.ts"
|
|
29292
29355
|
},
|
|
29356
|
+
"src/components/toast/toast-interface.ts::ToastPresentOptions": {
|
|
29357
|
+
"declaration": "export interface ToastPresentOptions {\n position: ToastPosition;\n positionAnchor?: HTMLElement;\n}",
|
|
29358
|
+
"docstring": "",
|
|
29359
|
+
"path": "src/components/toast/toast-interface.ts"
|
|
29360
|
+
},
|
|
29361
|
+
"src/components/toast/toast-interface.ts::ToastDismissOptions": {
|
|
29362
|
+
"declaration": "export type ToastPosition = 'top' | 'bottom' | 'middle';",
|
|
29363
|
+
"docstring": "",
|
|
29364
|
+
"path": "src/components/toast/toast-interface.ts"
|
|
29365
|
+
},
|
|
29293
29366
|
"src/components/toggle/toggle-interface.ts::ToggleChangeEventDetail": {
|
|
29294
29367
|
"declaration": "export interface ToggleChangeEventDetail<T = any> {\n value: T;\n checked: boolean;\n}",
|
|
29295
29368
|
"docstring": "",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { w as writeTask } from './index-2d388930.js';
|
|
5
|
-
import { h as hapticSelectionEnd, a as hapticSelectionStart, b as hapticSelectionChanged } from './haptic-
|
|
5
|
+
import { h as hapticSelectionEnd, a as hapticSelectionStart, b as hapticSelectionChanged } from './haptic-1243b917.js';
|
|
6
6
|
import { createGesture } from './index-ff313b19.js';
|
|
7
7
|
|
|
8
8
|
const createButtonActiveGesture = (el, isButton) => {
|