@ionic/core 7.4.4-dev.11696956070.1faa3cfe → 7.4.4-dev.11699471770.1b7273c4
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/alert.js +8 -0
- package/components/checkbox.js +0 -3
- package/components/data.js +96 -22
- package/components/haptic.js +1 -0
- package/components/index.js +1 -0
- package/components/ion-datetime-button.js +4 -4
- package/components/ion-datetime.js +3 -3
- package/components/ion-nav.js +1 -0
- package/components/ion-router.js +3 -0
- package/components/ion-select.js +1 -1
- package/components/ion-toast.js +157 -13
- package/components/ion-toggle.js +0 -3
- package/components/ios.transition.js +1 -0
- package/components/overlays.js +1 -0
- package/components/radio-group.js +1 -1
- package/components/radio.js +1 -4
- package/dist/cjs/{button-active-c358e83c.js → button-active-f2147e85.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-fa649bd8.js → index-33d2809c.js} +2 -2
- package/dist/cjs/index.cjs.js +6 -4
- package/dist/cjs/ion-action-sheet.cjs.entry.js +3 -3
- package/dist/cjs/ion-alert.cjs.entry.js +11 -3
- package/dist/cjs/ion-app_8.cjs.entry.js +1 -1
- package/dist/cjs/ion-checkbox.cjs.entry.js +0 -3
- 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 +2 -1
- 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-radio_2.cjs.entry.js +2 -5
- 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 +2 -2
- package/dist/cjs/ion-toast.cjs.entry.js +174 -32
- package/dist/cjs/ion-toggle.cjs.entry.js +1 -4
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/{ios.transition-4195d10d.js → ios.transition-8ddf91e6.js} +2 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{md.transition-0713f667.js → md.transition-44ff8566.js} +1 -1
- package/dist/cjs/{overlays-efc9d511.js → overlays-9cab437c.js} +1 -0
- package/dist/collection/components/alert/alert.js +8 -0
- package/dist/collection/components/alert/test/a11y/alert.e2e.js +11 -0
- package/dist/collection/components/checkbox/checkbox.js +0 -3
- 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.js +1 -0
- package/dist/collection/components/radio/radio.js +1 -4
- package/dist/collection/components/radio-group/radio-group.js +1 -1
- package/dist/collection/components/router/router.js +2 -0
- package/dist/collection/components/router/utils/path.js +1 -0
- package/dist/collection/components/select/select.js +1 -1
- package/dist/collection/components/toast/animations/ios.enter.js +2 -3
- package/dist/collection/components/toast/animations/ios.leave.js +2 -3
- package/dist/collection/components/toast/animations/md.enter.js +2 -3
- package/dist/collection/components/toast/animations/utils.js +85 -0
- package/dist/collection/components/toast/test/position-anchor/toast.e2e.js +45 -0
- package/dist/collection/components/toast/toast.js +98 -9
- package/dist/collection/components/toggle/toggle.js +0 -3
- package/dist/collection/index.js +1 -0
- 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 +73 -10
- package/dist/esm/{button-active-7180a130.js → button-active-3dd473a1.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-0b0dd67c.js → index-6e10cd02.js} +2 -2
- package/dist/esm/index.js +5 -4
- package/dist/esm/ion-action-sheet.entry.js +3 -3
- package/dist/esm/ion-alert.entry.js +11 -3
- package/dist/esm/ion-app_8.entry.js +1 -1
- package/dist/esm/ion-checkbox.entry.js +0 -3
- 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 +2 -1
- package/dist/esm/ion-picker-column-internal.entry.js +1 -1
- package/dist/esm/ion-popover.entry.js +2 -2
- package/dist/esm/ion-radio_2.entry.js +2 -5
- 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 +2 -2
- package/dist/esm/ion-toast.entry.js +157 -15
- package/dist/esm/ion-toggle.entry.js +1 -4
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/{ios.transition-875ba2ea.js → ios.transition-6707a3a1.js} +2 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{md.transition-54c79f72.js → md.transition-957964fd.js} +1 -1
- package/dist/esm/{overlays-84621c0a.js → overlays-753933fc.js} +1 -0
- package/dist/esm-es5/{button-active-7180a130.js → button-active-3dd473a1.js} +1 -1
- package/dist/esm-es5/data-44d9e816.js +4 -0
- package/dist/esm-es5/{index-0b0dd67c.js → index-6e10cd02.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-checkbox.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-radio_2.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-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-875ba2ea.js → ios.transition-6707a3a1.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{md.transition-54c79f72.js → md.transition-957964fd.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-2134558d.entry.js → p-0023e6eb.entry.js} +1 -1
- package/dist/ionic/{p-0dcdf480.system.entry.js → p-00f709ca.system.entry.js} +1 -1
- package/dist/ionic/{p-2330af92.system.entry.js → p-037e2738.system.entry.js} +1 -1
- package/dist/ionic/{p-678f37d7.entry.js → p-03f7e3cc.entry.js} +1 -1
- package/dist/ionic/{p-8c17d825.js → p-0d198537.js} +1 -1
- package/dist/ionic/p-100ea813.system.entry.js +4 -0
- package/dist/ionic/{p-f4267847.system.entry.js → p-10fcb3a3.system.entry.js} +1 -1
- package/dist/ionic/{p-00d3814a.system.entry.js → p-14fd96a2.system.entry.js} +1 -1
- package/dist/ionic/p-17240d90.js +4 -0
- package/dist/ionic/{p-af39c1c5.js → p-1d9b39f3.js} +1 -1
- package/dist/ionic/{p-a1528344.entry.js → p-2acea831.entry.js} +1 -1
- package/dist/ionic/{p-cd075e75.system.entry.js → p-2c9e9915.system.entry.js} +1 -1
- package/dist/ionic/{p-979dc719.entry.js → p-44fa0a61.entry.js} +1 -1
- package/dist/ionic/p-469d6a98.entry.js +4 -0
- package/dist/ionic/p-4965f2d7.entry.js +4 -0
- package/dist/ionic/p-520789c2.js +4 -0
- package/dist/ionic/{p-24952f8a.system.entry.js → p-5cafe439.system.entry.js} +1 -1
- package/dist/ionic/{p-eaa58d23.entry.js → p-60dee335.entry.js} +1 -1
- package/dist/ionic/p-68b405cc.entry.js +4 -0
- package/dist/ionic/p-73eba881.system.js +1 -1
- package/dist/ionic/{p-0c7d0167.system.entry.js → p-7520e873.system.entry.js} +1 -1
- package/dist/ionic/{p-df951755.system.entry.js → p-88a1a4fe.system.entry.js} +1 -1
- package/dist/ionic/{p-0fc8a522.system.entry.js → p-8957b1de.system.entry.js} +1 -1
- package/dist/ionic/{p-9e6bf328.system.js → p-90012797.system.js} +1 -1
- package/dist/ionic/{p-4c274938.entry.js → p-93c4333b.entry.js} +1 -1
- package/dist/ionic/{p-a8403bed.system.entry.js → p-9736406a.system.entry.js} +1 -1
- package/dist/ionic/{p-0e070fbe.entry.js → p-9b796813.entry.js} +1 -1
- package/dist/ionic/p-9bd70bd2.entry.js +4 -0
- package/dist/ionic/{p-2062958e.js → p-9dbc208c.js} +1 -1
- package/dist/ionic/{p-52e5f8f0.system.entry.js → p-a157df46.system.entry.js} +1 -1
- package/dist/ionic/{p-a6c52452.entry.js → p-a7361c85.entry.js} +1 -1
- package/dist/ionic/{p-d511de89.system.entry.js → p-aa4b083c.system.entry.js} +1 -1
- package/dist/ionic/p-aae05032.entry.js +4 -0
- package/dist/ionic/{p-e92068d4.system.entry.js → p-ae8121f5.system.entry.js} +1 -1
- package/dist/ionic/{p-d17638e9.system.js → p-b25a96b7.system.js} +1 -1
- package/dist/ionic/{p-53d4606a.entry.js → p-b4f14d9e.entry.js} +1 -1
- package/dist/ionic/p-b8c3f071.system.js +4 -0
- package/dist/ionic/p-b92d3bf2.system.js +4 -0
- package/dist/ionic/{p-ab37db48.entry.js → p-be02d76a.entry.js} +1 -1
- package/dist/ionic/{p-7061fa75.system.entry.js → p-c215a78a.system.entry.js} +1 -1
- package/dist/ionic/{p-67e21699.entry.js → p-c42d0ea3.entry.js} +1 -1
- package/dist/ionic/{p-32eaa293.entry.js → p-cb16123b.entry.js} +1 -1
- package/dist/ionic/p-d0d59328.entry.js +4 -0
- package/dist/ionic/{p-b7258ddb.system.js → p-e0f66356.system.js} +1 -1
- package/dist/ionic/{p-f1c2678b.system.entry.js → p-e62d80e5.system.entry.js} +1 -1
- package/dist/ionic/{p-3d278648.system.entry.js → p-e690be9f.system.entry.js} +1 -1
- package/dist/ionic/{p-7c901810.system.js → p-ec25d547.system.js} +1 -1
- package/dist/ionic/{p-77b9d68a.system.entry.js → p-fe268c4d.system.entry.js} +1 -1
- 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/toast/animations/ios.enter.d.ts +2 -1
- package/dist/types/components/toast/animations/ios.leave.d.ts +2 -2
- package/dist/types/components/toast/animations/md.enter.d.ts +2 -1
- package/dist/types/components/toast/animations/utils.d.ts +18 -0
- package/dist/types/components/toast/toast-interface.d.ts +11 -0
- package/dist/types/components/toast/toast.d.ts +21 -1
- package/dist/types/components.d.ts +16 -8
- package/dist/types/index.d.ts +1 -0
- package/hydrate/index.js +274 -51
- package/package.json +4 -5
- package/dist/esm-es5/data-009dbf15.js +0 -4
- package/dist/ionic/p-07c816fb.entry.js +0 -4
- package/dist/ionic/p-15278928.entry.js +0 -4
- package/dist/ionic/p-44ef7224.system.js +0 -4
- package/dist/ionic/p-63b4ef44.system.entry.js +0 -4
- package/dist/ionic/p-775f3749.entry.js +0 -4
- package/dist/ionic/p-77872abc.entry.js +0 -4
- package/dist/ionic/p-7cfd253c.js +0 -4
- package/dist/ionic/p-8b33cfef.entry.js +0 -4
- package/dist/ionic/p-c5395981.js +0 -4
- package/dist/ionic/p-c9524896.system.js +0 -4
- package/dist/ionic/p-d055bba9.entry.js +0 -4
- /package/dist/esm-es5/{haptic-6447af60.js → haptic-1243b917.js} +0 -0
- /package/dist/esm-es5/{overlays-84621c0a.js → overlays-753933fc.js} +0 -0
- /package/dist/ionic/{p-c8ec0d79.system.js → p-82c72668.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
- /package/dist/ionic/{p-68a3da51.js → p-ee8881d0.js} +0 -0
package/components/alert.js
CHANGED
|
@@ -166,6 +166,14 @@ const Alert = /*@__PURE__*/ proxyCustomElement(class Alert extends HTMLElement {
|
|
|
166
166
|
}
|
|
167
167
|
onKeydown(ev) {
|
|
168
168
|
const inputTypes = new Set(this.processedInputs.map((i) => i.type));
|
|
169
|
+
/**
|
|
170
|
+
* Based on keyboard navigation requirements, the
|
|
171
|
+
* checkbox should not respond to the enter keydown event.
|
|
172
|
+
*/
|
|
173
|
+
if (inputTypes.has('checkbox') && ev.key === 'Enter') {
|
|
174
|
+
ev.preventDefault();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
169
177
|
// The only inputs we want to navigate between using arrow keys are the radios
|
|
170
178
|
// ignore the keydown event if it is not on a radio button
|
|
171
179
|
if (!inputTypes.has('radio') ||
|
package/components/checkbox.js
CHANGED
package/components/data.js
CHANGED
|
@@ -53,13 +53,19 @@ const warnIfValueOutOfBounds = (value, min, max) => {
|
|
|
53
53
|
const isLeapYear = (year) => {
|
|
54
54
|
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Determines the hour cycle for a user.
|
|
58
|
+
* If the hour cycle is explicitly defined, just use that.
|
|
59
|
+
* Otherwise, we try to derive it from either the specified
|
|
60
|
+
* locale extension tags or from Intl.DateTimeFormat directly.
|
|
61
|
+
*/
|
|
62
|
+
const getHourCycle = (locale, hourCycle) => {
|
|
57
63
|
/**
|
|
58
|
-
* If developer has explicitly enabled
|
|
64
|
+
* If developer has explicitly enabled 24-hour time
|
|
59
65
|
* then return early and do not look at the system default.
|
|
60
66
|
*/
|
|
61
67
|
if (hourCycle !== undefined) {
|
|
62
|
-
return hourCycle
|
|
68
|
+
return hourCycle;
|
|
63
69
|
}
|
|
64
70
|
/**
|
|
65
71
|
* If hourCycle was not specified, check the locale
|
|
@@ -70,7 +76,7 @@ const is24Hour = (locale, hourCycle) => {
|
|
|
70
76
|
const formatted = new Intl.DateTimeFormat(locale, { hour: 'numeric' });
|
|
71
77
|
const options = formatted.resolvedOptions();
|
|
72
78
|
if (options.hourCycle !== undefined) {
|
|
73
|
-
return options.hourCycle
|
|
79
|
+
return options.hourCycle;
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* If hourCycle is not specified (either through lack
|
|
@@ -83,7 +89,33 @@ const is24Hour = (locale, hourCycle) => {
|
|
|
83
89
|
if (!hour) {
|
|
84
90
|
throw new Error('Hour value not found from DateTimeFormat');
|
|
85
91
|
}
|
|
86
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Midnight for h11 starts at 0:00am
|
|
94
|
+
* Midnight for h12 starts at 12:00am
|
|
95
|
+
* Midnight for h23 starts at 00:00
|
|
96
|
+
* Midnight for h24 starts at 24:00
|
|
97
|
+
*/
|
|
98
|
+
switch (hour.value) {
|
|
99
|
+
case '0':
|
|
100
|
+
return 'h11';
|
|
101
|
+
case '12':
|
|
102
|
+
return 'h12';
|
|
103
|
+
case '00':
|
|
104
|
+
return 'h23';
|
|
105
|
+
case '24':
|
|
106
|
+
return 'h24';
|
|
107
|
+
default:
|
|
108
|
+
throw new Error(`Invalid hour cycle "${hourCycle}"`);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Determine if the hour cycle uses a 24-hour format.
|
|
113
|
+
* Returns true for h23 and h24. Returns false otherwise.
|
|
114
|
+
* If you don't know the hourCycle, use getHourCycle above
|
|
115
|
+
* and pass the result into this function.
|
|
116
|
+
*/
|
|
117
|
+
const is24Hour = (hourCycle) => {
|
|
118
|
+
return hourCycle === 'h23' || hourCycle === 'h24';
|
|
87
119
|
};
|
|
88
120
|
/**
|
|
89
121
|
* Given a date object, returns the number
|
|
@@ -750,7 +782,7 @@ const getFormattedDayPeriod = (dayPeriod) => {
|
|
|
750
782
|
}
|
|
751
783
|
return dayPeriod.toUpperCase();
|
|
752
784
|
};
|
|
753
|
-
const getLocalizedTime = (locale, refParts,
|
|
785
|
+
const getLocalizedTime = (locale, refParts, hourCycle) => {
|
|
754
786
|
const timeParts = {
|
|
755
787
|
hour: refParts.hour,
|
|
756
788
|
minute: refParts.minute,
|
|
@@ -772,7 +804,7 @@ const getLocalizedTime = (locale, refParts, use24Hour) => {
|
|
|
772
804
|
* We use hourCycle here instead of hour12 due to:
|
|
773
805
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
|
|
774
806
|
*/
|
|
775
|
-
hourCycle
|
|
807
|
+
hourCycle,
|
|
776
808
|
/**
|
|
777
809
|
* Setting Z at the end indicates that this
|
|
778
810
|
* date string is in the UTC time zone. This
|
|
@@ -810,17 +842,33 @@ const addTimePadding = (value) => {
|
|
|
810
842
|
* 12 hour times it ensures that
|
|
811
843
|
* hour 0 is formatted as '12'.
|
|
812
844
|
*/
|
|
813
|
-
const getFormattedHour = (hour,
|
|
814
|
-
if (use24Hour) {
|
|
815
|
-
return addTimePadding(hour);
|
|
816
|
-
}
|
|
845
|
+
const getFormattedHour = (hour, hourCycle) => {
|
|
817
846
|
/**
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
847
|
+
* Midnight for h11 starts at 0:00am
|
|
848
|
+
* Midnight for h12 starts at 12:00am
|
|
849
|
+
* Midnight for h23 starts at 00:00
|
|
850
|
+
* Midnight for h24 starts at 24:00
|
|
821
851
|
*/
|
|
822
852
|
if (hour === 0) {
|
|
823
|
-
|
|
853
|
+
switch (hourCycle) {
|
|
854
|
+
case 'h11':
|
|
855
|
+
return '0';
|
|
856
|
+
case 'h12':
|
|
857
|
+
return '12';
|
|
858
|
+
case 'h23':
|
|
859
|
+
return '00';
|
|
860
|
+
case 'h24':
|
|
861
|
+
return '24';
|
|
862
|
+
default:
|
|
863
|
+
throw new Error(`Invalid hour cycle "${hourCycle}"`);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const use24Hour = is24Hour(hourCycle);
|
|
867
|
+
/**
|
|
868
|
+
* h23 and h24 use 24 hour times.
|
|
869
|
+
*/
|
|
870
|
+
if (use24Hour) {
|
|
871
|
+
return addTimePadding(hour);
|
|
824
872
|
}
|
|
825
873
|
return hour.toString();
|
|
826
874
|
};
|
|
@@ -1055,8 +1103,14 @@ const minutes = [
|
|
|
1055
1103
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
|
1056
1104
|
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
|
1057
1105
|
];
|
|
1106
|
+
// h11 hour system uses 0-11. Midnight starts at 0:00am.
|
|
1107
|
+
const hour11 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
1108
|
+
// h12 hour system uses 0-12. Midnight starts at 12:00am.
|
|
1058
1109
|
const hour12 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
1110
|
+
// h23 hour system uses 0-23. Midnight starts at 0:00.
|
|
1059
1111
|
const hour23 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
|
|
1112
|
+
// h24 hour system uses 1-24. Midnight starts at 24:00.
|
|
1113
|
+
const hour24 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0];
|
|
1060
1114
|
/**
|
|
1061
1115
|
* Given a locale and a mode,
|
|
1062
1116
|
* return an array with formatted days
|
|
@@ -1125,14 +1179,33 @@ const getDaysOfMonth = (month, year, firstDayOfWeek) => {
|
|
|
1125
1179
|
}
|
|
1126
1180
|
return days;
|
|
1127
1181
|
};
|
|
1182
|
+
/**
|
|
1183
|
+
* Returns an array of pre-defined hour
|
|
1184
|
+
* values based on the provided hourCycle.
|
|
1185
|
+
*/
|
|
1186
|
+
const getHourData = (hourCycle) => {
|
|
1187
|
+
switch (hourCycle) {
|
|
1188
|
+
case 'h11':
|
|
1189
|
+
return hour11;
|
|
1190
|
+
case 'h12':
|
|
1191
|
+
return hour12;
|
|
1192
|
+
case 'h23':
|
|
1193
|
+
return hour23;
|
|
1194
|
+
case 'h24':
|
|
1195
|
+
return hour24;
|
|
1196
|
+
default:
|
|
1197
|
+
throw new Error(`Invalid hour cycle "${hourCycle}"`);
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1128
1200
|
/**
|
|
1129
1201
|
* Given a local, reference datetime parts and option
|
|
1130
1202
|
* max/min bound datetime parts, calculate the acceptable
|
|
1131
1203
|
* hour and minute values according to the bounds and locale.
|
|
1132
1204
|
*/
|
|
1133
|
-
const generateTime = (refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1205
|
+
const generateTime = (locale, refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
|
|
1206
|
+
const computedHourCycle = getHourCycle(locale, hourCycle);
|
|
1207
|
+
const use24Hour = is24Hour(computedHourCycle);
|
|
1208
|
+
let processedHours = getHourData(computedHourCycle);
|
|
1136
1209
|
let processedMinutes = minutes;
|
|
1137
1210
|
let isAMAllowed = true;
|
|
1138
1211
|
let isPMAllowed = true;
|
|
@@ -1464,11 +1537,12 @@ const getCombinedDateColumnData = (locale, todayParts, minParts, maxParts, dayVa
|
|
|
1464
1537
|
};
|
|
1465
1538
|
};
|
|
1466
1539
|
const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues) => {
|
|
1467
|
-
const
|
|
1468
|
-
const
|
|
1540
|
+
const computedHourCycle = getHourCycle(locale, hourCycle);
|
|
1541
|
+
const use24Hour = is24Hour(computedHourCycle);
|
|
1542
|
+
const { hours, minutes, am, pm } = generateTime(locale, refParts, computedHourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues);
|
|
1469
1543
|
const hoursItems = hours.map((hour) => {
|
|
1470
1544
|
return {
|
|
1471
|
-
text: getFormattedHour(hour,
|
|
1545
|
+
text: getFormattedHour(hour, computedHourCycle),
|
|
1472
1546
|
value: getInternalHourValue(hour, use24Hour, refParts.ampm),
|
|
1473
1547
|
};
|
|
1474
1548
|
});
|
|
@@ -1498,4 +1572,4 @@ const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, all
|
|
|
1498
1572
|
};
|
|
1499
1573
|
};
|
|
1500
1574
|
|
|
1501
|
-
export { getDayColumnData as A, getYearColumnData as B, isMonthFirstLocale as C, getTimeColumnsData as D, isLocaleDayPeriodRTL as E, getMonthAndYear as F, getDaysOfWeek as G, getDaysOfMonth as H, generateMonths as I,
|
|
1575
|
+
export { getDayColumnData as A, getYearColumnData as B, isMonthFirstLocale as C, getTimeColumnsData as D, isLocaleDayPeriodRTL as E, getMonthAndYear as F, getDaysOfWeek as G, getDaysOfMonth as H, generateMonths as I, getHourCycle as J, getLocalizedTime as K, getMonthAndDay as L, formatValue as M, getNextYear as N, getPreviousYear as O, clampDate as P, parseAmPm as Q, calculateHourFromAMPM as R, getLocalizedDateTime as S, getMonthDayAndYear as T, getDay as a, isAfter as b, isSameDay as c, getPreviousMonth as d, getNextMonth as e, getPartsFromCalendarDay as f, generateDayAriaLabel as g, getEndOfWeek as h, isBefore as i, getStartOfWeek as j, getPreviousDay as k, getNextDay as l, getPreviousWeek as m, getNextWeek as n, parseMaxParts as o, parseMinParts as p, parseDate as q, convertToArrayOfNumbers as r, convertDataToISO as s, getToday as t, getClosestValidDate as u, validateParts as v, warnIfValueOutOfBounds as w, getNumDaysInMonth as x, getCombinedDateColumnData as y, getMonthColumnData as z };
|
package/components/haptic.js
CHANGED
|
@@ -76,6 +76,7 @@ const HapticEngine = {
|
|
|
76
76
|
* if the browser does not support the Vibrate API.
|
|
77
77
|
*/
|
|
78
78
|
if ((capacitor === null || capacitor === void 0 ? void 0 : capacitor.getPlatform()) === 'web') {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
79
80
|
return typeof navigator !== 'undefined' && navigator.vibrate !== undefined;
|
|
80
81
|
}
|
|
81
82
|
return true;
|
package/components/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { createGesture } from './index3.js';
|
|
|
11
11
|
export { g as getPlatforms, i as initialize, a as isPlatform } from './ionic-global.js';
|
|
12
12
|
export { c as componentOnReady } from './helpers.js';
|
|
13
13
|
export { I as IonicSafeString, g as getMode, s as setupConfig } from './config.js';
|
|
14
|
+
export { o as openURL } from './theme.js';
|
|
14
15
|
export { m as menuController } from './index4.js';
|
|
15
16
|
export { b as actionSheetController, a as alertController, l as loadingController, m as modalController, p as pickerController, c as popoverController, t as toastController } from './overlays.js';
|
|
16
17
|
|
|
@@ -6,7 +6,7 @@ import { a as addEventListener, c as componentOnReady } from './helpers.js';
|
|
|
6
6
|
import { a as printIonError } from './index6.js';
|
|
7
7
|
import { c as createColorClasses } from './theme.js';
|
|
8
8
|
import { b as getIonMode } from './ionic-global.js';
|
|
9
|
-
import { q as parseDate, t as getToday, J as
|
|
9
|
+
import { q as parseDate, t as getToday, J as getHourCycle, S as getLocalizedDateTime, F as getMonthAndYear, K as getLocalizedTime, T as getMonthDayAndYear } from './data.js';
|
|
10
10
|
import { d as defineCustomElement$2 } from './ripple-effect.js';
|
|
11
11
|
|
|
12
12
|
const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";
|
|
@@ -63,13 +63,13 @@ const DatetimeButton = /*@__PURE__*/ proxyCustomElement(class DatetimeButton ext
|
|
|
63
63
|
* warning in the console.
|
|
64
64
|
*/
|
|
65
65
|
const firstParsedDatetime = parsedDatetimes[0];
|
|
66
|
-
const
|
|
66
|
+
const computedHourCycle = getHourCycle(locale, hourCycle);
|
|
67
67
|
this.dateText = this.timeText = undefined;
|
|
68
68
|
switch (datetimePresentation) {
|
|
69
69
|
case 'date-time':
|
|
70
70
|
case 'time-date':
|
|
71
71
|
const dateText = getMonthDayAndYear(locale, firstParsedDatetime);
|
|
72
|
-
const timeText = getLocalizedTime(locale, firstParsedDatetime,
|
|
72
|
+
const timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle);
|
|
73
73
|
if (preferWheel) {
|
|
74
74
|
this.dateText = `${dateText} ${timeText}`;
|
|
75
75
|
}
|
|
@@ -96,7 +96,7 @@ const DatetimeButton = /*@__PURE__*/ proxyCustomElement(class DatetimeButton ext
|
|
|
96
96
|
}
|
|
97
97
|
break;
|
|
98
98
|
case 'time':
|
|
99
|
-
this.timeText = getLocalizedTime(locale, firstParsedDatetime,
|
|
99
|
+
this.timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle);
|
|
100
100
|
break;
|
|
101
101
|
case 'month-year':
|
|
102
102
|
this.dateText = getMonthAndYear(locale, firstParsedDatetime);
|
|
@@ -9,7 +9,7 @@ import { i as isRTL } from './dir.js';
|
|
|
9
9
|
import { c as createColorClasses } from './theme.js';
|
|
10
10
|
import { a as chevronBack, f as chevronForward, c as chevronDown, g as caretUpSharp, h as caretDownSharp } from './index7.js';
|
|
11
11
|
import { b as getIonMode } from './ionic-global.js';
|
|
12
|
-
import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getEndOfWeek, j as getStartOfWeek, k as getPreviousDay, l as getNextDay, m as getPreviousWeek, n as getNextWeek, p as parseMinParts, o as parseMaxParts, q as parseDate, w as warnIfValueOutOfBounds, r as convertToArrayOfNumbers, s as convertDataToISO, t as getToday, u as getClosestValidDate, x as getNumDaysInMonth, y as getCombinedDateColumnData, z as getMonthColumnData, A as getDayColumnData, B as getYearColumnData, C as isMonthFirstLocale, D as getTimeColumnsData, E as isLocaleDayPeriodRTL, F as getMonthAndYear, G as getDaysOfWeek, H as getDaysOfMonth, I as generateMonths, J as
|
|
12
|
+
import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getEndOfWeek, j as getStartOfWeek, k as getPreviousDay, l as getNextDay, m as getPreviousWeek, n as getNextWeek, p as parseMinParts, o as parseMaxParts, q as parseDate, w as warnIfValueOutOfBounds, r as convertToArrayOfNumbers, s as convertDataToISO, t as getToday, u as getClosestValidDate, x as getNumDaysInMonth, y as getCombinedDateColumnData, z as getMonthColumnData, A as getDayColumnData, B as getYearColumnData, C as isMonthFirstLocale, D as getTimeColumnsData, E as isLocaleDayPeriodRTL, F as getMonthAndYear, G as getDaysOfWeek, H as getDaysOfMonth, I as generateMonths, J as getHourCycle, K as getLocalizedTime, L as getMonthAndDay, M as formatValue, N as getNextYear, O as getPreviousYear, P as clampDate, Q as parseAmPm, R as calculateHourFromAMPM } from './data.js';
|
|
13
13
|
import { d as defineCustomElement$c } from './backdrop.js';
|
|
14
14
|
import { d as defineCustomElement$b } from './button.js';
|
|
15
15
|
import { d as defineCustomElement$a } from './buttons.js';
|
|
@@ -1533,7 +1533,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1533
1533
|
}
|
|
1534
1534
|
renderTimeOverlay() {
|
|
1535
1535
|
const { hourCycle, isTimePopoverOpen, locale } = this;
|
|
1536
|
-
const
|
|
1536
|
+
const computedHourCycle = getHourCycle(locale, hourCycle);
|
|
1537
1537
|
const activePart = this.getActivePartsWithFallback();
|
|
1538
1538
|
return [
|
|
1539
1539
|
h("div", { class: "time-header" }, this.renderTimeLabel()),
|
|
@@ -1552,7 +1552,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1552
1552
|
await popoverRef.onWillDismiss();
|
|
1553
1553
|
this.isTimePopoverOpen = false;
|
|
1554
1554
|
}
|
|
1555
|
-
} }, getLocalizedTime(locale, activePart,
|
|
1555
|
+
} }, getLocalizedTime(locale, activePart, computedHourCycle)),
|
|
1556
1556
|
h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
|
|
1557
1557
|
/**
|
|
1558
1558
|
* Intersection Observers do not consistently fire between Blink and Webkit
|
package/components/ion-nav.js
CHANGED
|
@@ -746,6 +746,7 @@ const Nav = /*@__PURE__*/ proxyCustomElement(class Nav extends HTMLElement {
|
|
|
746
746
|
: undefined;
|
|
747
747
|
const mode = getIonMode(this);
|
|
748
748
|
const enteringEl = enteringView.element;
|
|
749
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
749
750
|
const leavingEl = leavingView && leavingView.element;
|
|
750
751
|
const animationOpts = Object.assign(Object.assign({ mode, showGoBack: this.canGoBackSync(enteringView), baseEl: this.el, progressCallback, animated: this.animated && config.getBoolean('animated', true), enteringEl,
|
|
751
752
|
leavingEl }, opts), { animationBuilder: opts.animationBuilder || this.animation || config.get('navAnimation') });
|
package/components/ion-router.js
CHANGED
|
@@ -44,6 +44,7 @@ const chainToSegments = (chain) => {
|
|
|
44
44
|
for (const route of chain) {
|
|
45
45
|
for (const segment of route.segments) {
|
|
46
46
|
if (segment[0] === ':') {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
47
48
|
const param = route.params && route.params[segment.slice(1)];
|
|
48
49
|
if (!param) {
|
|
49
50
|
return null;
|
|
@@ -740,12 +741,14 @@ const Router = /*@__PURE__*/ proxyCustomElement(class Router extends HTMLElement
|
|
|
740
741
|
}
|
|
741
742
|
const routes = readRoutes(this.el);
|
|
742
743
|
const fromChain = findChainForSegments(from, routes);
|
|
744
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
743
745
|
const beforeLeaveHook = fromChain && fromChain[fromChain.length - 1].beforeLeave;
|
|
744
746
|
const canLeave = beforeLeaveHook ? await beforeLeaveHook() : true;
|
|
745
747
|
if (canLeave === false || typeof canLeave === 'object') {
|
|
746
748
|
return canLeave;
|
|
747
749
|
}
|
|
748
750
|
const toChain = findChainForSegments(to, routes);
|
|
751
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
749
752
|
const beforeEnterHook = toChain && toChain[toChain.length - 1].beforeEnter;
|
|
750
753
|
return beforeEnterHook ? beforeEnterHook() : true;
|
|
751
754
|
}
|
package/components/ion-select.js
CHANGED
|
@@ -626,7 +626,7 @@ Developers can use the "legacy" property to continue using the legacy form marku
|
|
|
626
626
|
}
|
|
627
627
|
renderListbox() {
|
|
628
628
|
const { disabled, inputId, isExpanded } = this;
|
|
629
|
-
return (h("button", { disabled: disabled, id: inputId, "aria-label": this.ariaLabel, "aria-haspopup": "
|
|
629
|
+
return (h("button", { disabled: disabled, id: inputId, "aria-label": this.ariaLabel, "aria-haspopup": "dialog", "aria-expanded": `${isExpanded}`, onFocus: this.onFocus, onBlur: this.onBlur, ref: (focusEl) => (this.focusEl = focusEl) }));
|
|
630
630
|
}
|
|
631
631
|
render() {
|
|
632
632
|
const { legacyFormController } = this;
|
package/components/ion-toast.js
CHANGED
|
@@ -10,19 +10,19 @@ import { d as createDelegateController, e as createTriggerController, i as isCan
|
|
|
10
10
|
import { g as getClassMap, c as createColorClasses } from './theme.js';
|
|
11
11
|
import { c as config, b as getIonMode } from './ionic-global.js';
|
|
12
12
|
import { c as createAnimation } from './animation.js';
|
|
13
|
+
import { w as win } from './index5.js';
|
|
13
14
|
import { d as defineCustomElement$3 } from './icon.js';
|
|
14
15
|
import { d as defineCustomElement$2 } from './ripple-effect.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* iOS Toast Enter Animation
|
|
18
19
|
*/
|
|
19
|
-
const iosEnterAnimation = (baseEl,
|
|
20
|
+
const iosEnterAnimation = (baseEl, opts) => {
|
|
20
21
|
const baseAnimation = createAnimation();
|
|
21
22
|
const wrapperAnimation = createAnimation();
|
|
23
|
+
const { position, top, bottom } = opts;
|
|
22
24
|
const root = getElementRoot(baseEl);
|
|
23
25
|
const wrapperEl = root.querySelector('.toast-wrapper');
|
|
24
|
-
const bottom = `calc(-10px - var(--ion-safe-area-bottom, 0px))`;
|
|
25
|
-
const top = `calc(10px + var(--ion-safe-area-top, 0px))`;
|
|
26
26
|
wrapperAnimation.addElement(wrapperEl);
|
|
27
27
|
switch (position) {
|
|
28
28
|
case 'top':
|
|
@@ -43,13 +43,12 @@ const iosEnterAnimation = (baseEl, position) => {
|
|
|
43
43
|
/**
|
|
44
44
|
* iOS Toast Leave Animation
|
|
45
45
|
*/
|
|
46
|
-
const iosLeaveAnimation = (baseEl,
|
|
46
|
+
const iosLeaveAnimation = (baseEl, opts) => {
|
|
47
47
|
const baseAnimation = createAnimation();
|
|
48
48
|
const wrapperAnimation = createAnimation();
|
|
49
|
+
const { position, top, bottom } = opts;
|
|
49
50
|
const root = getElementRoot(baseEl);
|
|
50
51
|
const wrapperEl = root.querySelector('.toast-wrapper');
|
|
51
|
-
const bottom = `calc(-10px - var(--ion-safe-area-bottom, 0px))`;
|
|
52
|
-
const top = `calc(10px + var(--ion-safe-area-top, 0px))`;
|
|
53
52
|
wrapperAnimation.addElement(wrapperEl);
|
|
54
53
|
switch (position) {
|
|
55
54
|
case 'top':
|
|
@@ -68,13 +67,12 @@ const iosLeaveAnimation = (baseEl, position) => {
|
|
|
68
67
|
/**
|
|
69
68
|
* MD Toast Enter Animation
|
|
70
69
|
*/
|
|
71
|
-
const mdEnterAnimation = (baseEl,
|
|
70
|
+
const mdEnterAnimation = (baseEl, opts) => {
|
|
72
71
|
const baseAnimation = createAnimation();
|
|
73
72
|
const wrapperAnimation = createAnimation();
|
|
73
|
+
const { position, top, bottom } = opts;
|
|
74
74
|
const root = getElementRoot(baseEl);
|
|
75
75
|
const wrapperEl = root.querySelector('.toast-wrapper');
|
|
76
|
-
const bottom = `calc(8px + var(--ion-safe-area-bottom, 0px))`;
|
|
77
|
-
const top = `calc(8px + var(--ion-safe-area-top, 0px))`;
|
|
78
76
|
wrapperAnimation.addElement(wrapperEl);
|
|
79
77
|
switch (position) {
|
|
80
78
|
case 'top':
|
|
@@ -106,6 +104,87 @@ const mdLeaveAnimation = (baseEl) => {
|
|
|
106
104
|
return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(300).addAnimation(wrapperAnimation);
|
|
107
105
|
};
|
|
108
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Calculate the CSS top and bottom position of the toast, to be used
|
|
109
|
+
* as starting points for the animation keyframes.
|
|
110
|
+
*
|
|
111
|
+
* Note that MD animates bottom-positioned toasts using style.bottom,
|
|
112
|
+
* which calculates from the bottom edge of the screen, while iOS uses
|
|
113
|
+
* translateY, which calculates from the top edge of the screen. This
|
|
114
|
+
* is why the bottom calculates differ slightly between modes.
|
|
115
|
+
*
|
|
116
|
+
* @param position The value of the toast's position prop.
|
|
117
|
+
* @param positionAnchor The element the toast should be anchored to,
|
|
118
|
+
* if applicable.
|
|
119
|
+
* @param mode The toast component's mode (md, ios, etc).
|
|
120
|
+
* @param toast A reference to the toast element itself.
|
|
121
|
+
*/
|
|
122
|
+
function getAnimationPosition(position, positionAnchor, mode, toast) {
|
|
123
|
+
/**
|
|
124
|
+
* Start with a predefined offset from the edge the toast will be
|
|
125
|
+
* positioned relative to, whether on the screen or anchor element.
|
|
126
|
+
*/
|
|
127
|
+
let offset;
|
|
128
|
+
if (mode === 'md') {
|
|
129
|
+
offset = 8;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
offset = position === 'top' ? 10 : -10;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* If positionAnchor is defined, add in the distance from the target
|
|
136
|
+
* screen edge to the target anchor edge. For position="top", the
|
|
137
|
+
* bottom anchor edge is targeted. For position="bottom", the top
|
|
138
|
+
* anchor edge is targeted.
|
|
139
|
+
*/
|
|
140
|
+
if (positionAnchor && win) {
|
|
141
|
+
warnIfAnchorIsHidden(positionAnchor, toast);
|
|
142
|
+
const box = positionAnchor.getBoundingClientRect();
|
|
143
|
+
if (position === 'top') {
|
|
144
|
+
offset += box.bottom;
|
|
145
|
+
}
|
|
146
|
+
else if (position === 'bottom') {
|
|
147
|
+
/**
|
|
148
|
+
* Just box.top is the distance from the top edge of the screen
|
|
149
|
+
* to the top edge of the anchor. We want to calculate from the
|
|
150
|
+
* bottom edge of the screen instead.
|
|
151
|
+
*/
|
|
152
|
+
if (mode === 'md') {
|
|
153
|
+
offset += win.innerHeight - box.top;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
offset -= win.innerHeight - box.top;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* We don't include safe area here because that should already be
|
|
161
|
+
* accounted for when checking the position of the anchor.
|
|
162
|
+
*/
|
|
163
|
+
return {
|
|
164
|
+
top: `${offset}px`,
|
|
165
|
+
bottom: `${offset}px`,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
return {
|
|
170
|
+
top: `calc(${offset}px + var(--ion-safe-area-top, 0px))`,
|
|
171
|
+
bottom: mode === 'md'
|
|
172
|
+
? `calc(${offset}px + var(--ion-safe-area-bottom, 0px))`
|
|
173
|
+
: `calc(${offset}px - var(--ion-safe-area-bottom, 0px))`,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* If the anchor element is hidden, getBoundingClientRect()
|
|
179
|
+
* will return all 0s for it, which can cause unexpected
|
|
180
|
+
* results in the position calculation when animating.
|
|
181
|
+
*/
|
|
182
|
+
function warnIfAnchorIsHidden(positionAnchor, toast) {
|
|
183
|
+
if (positionAnchor.offsetParent === null) {
|
|
184
|
+
printIonWarning('The positionAnchor element for ion-toast was found in the DOM, but appears to be hidden. This may lead to unexpected positioning of the toast.', toast);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
109
188
|
const toastIosCss = ":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}@supports (inset-inline-start: 0){:host{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host{left:0}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host:dir(rtl){left:unset;right:unset;right:0}}}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{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)}@supports (inset-inline-start: 0){.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}}@supports not (inset-inline-start: 0){.toast-wrapper{left:var(--start);right:var(--end)}:host-context([dir=rtl]) .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}[dir=rtl] .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}@supports selector(:dir(rtl)){.toast-wrapper:dir(rtl){left:unset;right:unset;left:var(--end);right:var(--start)}}}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;pointer-events:auto;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.toast-layout-baseline .toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-layout-stacked .toast-button-group{-ms-flex-pack:end;justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-50, #f2f2f2);--border-radius:14px;--button-color:var(--ion-color-primary, #3880ff);--color:var(--ion-color-step-850, #262626);--max-width:700px;--start:10px;--end:10px;font-size:14px}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;z-index:10}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.toast-translucent) .toast-wrapper{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}:host(.ion-color.toast-translucent) .toast-wrapper{background:rgba(var(--ion-color-base-rgb), 0.8)}}.toast-wrapper.toast-top{-webkit-transform:translate3d(0, -100%, 0);transform:translate3d(0, -100%, 0);top:0}.toast-wrapper.toast-middle{opacity:0.01}.toast-wrapper.toast-bottom{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);bottom:0}.toast-content{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:15px;padding-bottom:15px}.toast-header{margin-bottom:2px;font-weight:500}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;height:44px;-webkit-transition:background-color, opacity 100ms linear;transition:background-color, opacity 100ms linear;border:0;background-color:transparent;font-family:var(--ion-font-family);font-size:17px;font-weight:500;overflow:hidden}.toast-button.ion-activated{opacity:0.4}@media (any-hover: hover){.toast-button:hover{opacity:0.6}}";
|
|
110
189
|
|
|
111
190
|
const toastMdCss = ":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}@supports (inset-inline-start: 0){:host{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host{left:0}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host:dir(rtl){left:unset;right:unset;right:0}}}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{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)}@supports (inset-inline-start: 0){.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}}@supports not (inset-inline-start: 0){.toast-wrapper{left:var(--start);right:var(--end)}:host-context([dir=rtl]) .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}[dir=rtl] .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}@supports selector(:dir(rtl)){.toast-wrapper:dir(rtl){left:unset;right:unset;left:var(--end);right:var(--start)}}}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;pointer-events:auto;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.toast-layout-baseline .toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-layout-stacked .toast-button-group{-ms-flex-pack:end;justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-800, #333333);--border-radius:4px;--box-shadow:0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);--button-color:var(--ion-color-primary, #3880ff);--color:var(--ion-color-step-50, #f2f2f2);--max-width:700px;--start:8px;--end:8px;font-size:14px}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;opacity:0.01;z-index:10}.toast-content{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:14px;padding-bottom:14px}.toast-header{margin-bottom:2px;font-weight:500;line-height:20px}.toast-message{line-height:20px}.toast-layout-baseline .toast-button-group-start{-webkit-margin-start:8px;margin-inline-start:8px}.toast-layout-stacked .toast-button-group-start{-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px}.toast-layout-baseline .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px}.toast-layout-stacked .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px;margin-bottom:8px}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;position:relative;background-color:transparent;font-family:var(--ion-font-family);font-size:14px;font-weight:500;letter-spacing:0.84px;text-transform:uppercase;overflow:hidden}.toast-button-cancel{color:var(--ion-color-step-100, #e6e6e6)}.toast-button-icon-only{border-radius:50%;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px;padding-top:9px;padding-bottom:9px;width:36px;height:36px}@media (any-hover: hover){.toast-button:hover{background-color:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.08)}.toast-button-cancel:hover{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.08)}}";
|
|
@@ -149,6 +228,7 @@ const Toast = /*@__PURE__*/ proxyCustomElement(class Toast extends HTMLElement {
|
|
|
149
228
|
this.message = undefined;
|
|
150
229
|
this.keyboardClose = false;
|
|
151
230
|
this.position = 'bottom';
|
|
231
|
+
this.positionAnchor = undefined;
|
|
152
232
|
this.buttons = undefined;
|
|
153
233
|
this.translucent = false;
|
|
154
234
|
this.animated = true;
|
|
@@ -196,7 +276,19 @@ const Toast = /*@__PURE__*/ proxyCustomElement(class Toast extends HTMLElement {
|
|
|
196
276
|
async present() {
|
|
197
277
|
const unlock = await this.lockController.lock();
|
|
198
278
|
await this.delegateController.attachViewToDom();
|
|
199
|
-
|
|
279
|
+
const { el, position } = this;
|
|
280
|
+
const anchor = this.getAnchorElement();
|
|
281
|
+
const animationPosition = getAnimationPosition(position, anchor, getIonMode(this), el);
|
|
282
|
+
/**
|
|
283
|
+
* Cache the calculated position of the toast, so we can re-use it
|
|
284
|
+
* in the dismiss animation.
|
|
285
|
+
*/
|
|
286
|
+
this.lastPresentedPosition = animationPosition;
|
|
287
|
+
await present(this, 'toastEnter', iosEnterAnimation, mdEnterAnimation, {
|
|
288
|
+
position,
|
|
289
|
+
top: animationPosition.top,
|
|
290
|
+
bottom: animationPosition.bottom,
|
|
291
|
+
});
|
|
200
292
|
/**
|
|
201
293
|
* Content is revealed to screen readers after
|
|
202
294
|
* the transition to avoid jank since this
|
|
@@ -218,15 +310,28 @@ const Toast = /*@__PURE__*/ proxyCustomElement(class Toast extends HTMLElement {
|
|
|
218
310
|
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
|
|
219
311
|
*/
|
|
220
312
|
async dismiss(data, role) {
|
|
313
|
+
var _a, _b;
|
|
221
314
|
const unlock = await this.lockController.lock();
|
|
222
|
-
|
|
223
|
-
|
|
315
|
+
const { durationTimeout, position, lastPresentedPosition } = this;
|
|
316
|
+
if (durationTimeout) {
|
|
317
|
+
clearTimeout(durationTimeout);
|
|
224
318
|
}
|
|
225
|
-
const dismissed = await dismiss(this, data, role, 'toastLeave', iosLeaveAnimation, mdLeaveAnimation,
|
|
319
|
+
const dismissed = await dismiss(this, data, role, 'toastLeave', iosLeaveAnimation, mdLeaveAnimation,
|
|
320
|
+
/**
|
|
321
|
+
* Fetch the cached position that was calculated back in the present
|
|
322
|
+
* animation. We always want to animate the dismiss from the same
|
|
323
|
+
* position the present stopped at, so the animation looks continuous.
|
|
324
|
+
*/
|
|
325
|
+
{
|
|
326
|
+
position,
|
|
327
|
+
top: (_a = lastPresentedPosition === null || lastPresentedPosition === void 0 ? void 0 : lastPresentedPosition.top) !== null && _a !== void 0 ? _a : '',
|
|
328
|
+
bottom: (_b = lastPresentedPosition === null || lastPresentedPosition === void 0 ? void 0 : lastPresentedPosition.bottom) !== null && _b !== void 0 ? _b : '',
|
|
329
|
+
});
|
|
226
330
|
if (dismissed) {
|
|
227
331
|
this.delegateController.removeViewFromDom();
|
|
228
332
|
this.revealContentToScreenReader = false;
|
|
229
333
|
}
|
|
334
|
+
this.lastPresentedPosition = undefined;
|
|
230
335
|
unlock();
|
|
231
336
|
return dismissed;
|
|
232
337
|
}
|
|
@@ -250,6 +355,44 @@ const Toast = /*@__PURE__*/ proxyCustomElement(class Toast extends HTMLElement {
|
|
|
250
355
|
: [];
|
|
251
356
|
return buttons;
|
|
252
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Returns the element specified by the positionAnchor prop,
|
|
360
|
+
* or undefined if prop's value is an ID string and the element
|
|
361
|
+
* is not found in the DOM.
|
|
362
|
+
*/
|
|
363
|
+
getAnchorElement() {
|
|
364
|
+
const { position, positionAnchor, el } = this;
|
|
365
|
+
/**
|
|
366
|
+
* If positionAnchor is undefined then
|
|
367
|
+
* no anchor should be used when presenting the toast.
|
|
368
|
+
*/
|
|
369
|
+
if (positionAnchor === undefined) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (position === 'middle' && positionAnchor !== undefined) {
|
|
373
|
+
printIonWarning('The positionAnchor property is ignored when using position="middle".', this.el);
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
if (typeof positionAnchor === 'string') {
|
|
377
|
+
/**
|
|
378
|
+
* If the anchor is defined as an ID, find the element.
|
|
379
|
+
* We do this on every present so the toast doesn't need
|
|
380
|
+
* to account for the surrounding DOM changing since the
|
|
381
|
+
* last time it was presented.
|
|
382
|
+
*/
|
|
383
|
+
const foundEl = document.getElementById(positionAnchor);
|
|
384
|
+
if (foundEl === null) {
|
|
385
|
+
printIonWarning(`An anchor element with an ID of "${positionAnchor}" was not found in the DOM.`, el);
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
return foundEl;
|
|
389
|
+
}
|
|
390
|
+
if (positionAnchor instanceof HTMLElement) {
|
|
391
|
+
return positionAnchor;
|
|
392
|
+
}
|
|
393
|
+
printIonWarning('Invalid positionAnchor value:', positionAnchor, el);
|
|
394
|
+
return undefined;
|
|
395
|
+
}
|
|
253
396
|
async buttonClick(button) {
|
|
254
397
|
const role = button.role;
|
|
255
398
|
if (isCancel(role)) {
|
|
@@ -354,6 +497,7 @@ const Toast = /*@__PURE__*/ proxyCustomElement(class Toast extends HTMLElement {
|
|
|
354
497
|
"message": [1],
|
|
355
498
|
"keyboardClose": [4, "keyboard-close"],
|
|
356
499
|
"position": [1],
|
|
500
|
+
"positionAnchor": [1, "position-anchor"],
|
|
357
501
|
"buttons": [16],
|
|
358
502
|
"translucent": [4],
|
|
359
503
|
"animated": [4],
|
package/components/ion-toggle.js
CHANGED
|
@@ -203,6 +203,7 @@ const iosTransitionAnimation = (navEl, opts) => {
|
|
|
203
203
|
.easing(opts.easing || EASING)
|
|
204
204
|
.fill('both')
|
|
205
205
|
.beforeRemoveClass('ion-page-invisible');
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
206
207
|
if (leavingEl && navEl !== null && navEl !== undefined) {
|
|
207
208
|
const navDecorAnimation = createAnimation();
|
|
208
209
|
navDecorAnimation.addElement(navEl);
|
package/components/overlays.js
CHANGED
|
@@ -68,6 +68,7 @@ const setOverlayId = (el) => {
|
|
|
68
68
|
return el.id;
|
|
69
69
|
};
|
|
70
70
|
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);
|