@ionic/core 7.4.2-dev.11695831341.191bdf12 → 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.
Files changed (192) hide show
  1. package/components/data.js +96 -22
  2. package/components/haptic.js +1 -0
  3. package/components/ion-content.js +5 -51
  4. package/components/ion-datetime-button.js +4 -4
  5. package/components/ion-datetime.js +3 -3
  6. package/components/ion-nav.js +1 -0
  7. package/components/ion-router.js +3 -0
  8. package/components/ion-tab-bar.js +0 -4
  9. package/components/ion-toast.js +117 -11
  10. package/components/ios.transition.js +1 -0
  11. package/components/overlays.js +1 -0
  12. package/dist/cjs/{button-active-32f15660.js → button-active-19cc8cae.js} +1 -1
  13. package/dist/cjs/{data-db832785.js → data-c8d21093.js} +96 -22
  14. package/dist/cjs/{haptic-c5f6b4d5.js → haptic-678abc9f.js} +1 -0
  15. package/dist/cjs/{index-b183138a.js → index-77d4b2e7.js} +2 -2
  16. package/dist/cjs/index.cjs.js +4 -4
  17. package/dist/cjs/ion-action-sheet.cjs.entry.js +3 -3
  18. package/dist/cjs/ion-alert.cjs.entry.js +3 -3
  19. package/dist/cjs/ion-app_8.cjs.entry.js +4 -50
  20. package/dist/cjs/ion-datetime-button.cjs.entry.js +4 -4
  21. package/dist/cjs/ion-datetime_3.cjs.entry.js +5 -5
  22. package/dist/cjs/ion-loading.cjs.entry.js +1 -1
  23. package/dist/cjs/ion-menu_3.cjs.entry.js +1 -1
  24. package/dist/cjs/ion-modal.cjs.entry.js +2 -2
  25. package/dist/cjs/ion-nav_2.cjs.entry.js +2 -1
  26. package/dist/cjs/ion-picker-column-internal.cjs.entry.js +1 -1
  27. package/dist/cjs/ion-popover.cjs.entry.js +2 -2
  28. package/dist/cjs/ion-refresher_2.cjs.entry.js +1 -1
  29. package/dist/cjs/ion-reorder_2.cjs.entry.js +1 -1
  30. package/dist/cjs/ion-route_4.cjs.entry.js +3 -0
  31. package/dist/cjs/ion-select_3.cjs.entry.js +1 -1
  32. package/dist/cjs/ion-tab-bar_2.cjs.entry.js +0 -4
  33. package/dist/cjs/ion-toast.cjs.entry.js +136 -32
  34. package/dist/cjs/ion-toggle.cjs.entry.js +1 -1
  35. package/dist/cjs/ionic.cjs.js +1 -1
  36. package/dist/cjs/{ios.transition-4b93903d.js → ios.transition-458ee399.js} +2 -1
  37. package/dist/cjs/loader.cjs.js +1 -1
  38. package/dist/cjs/{md.transition-79f3a215.js → md.transition-3423dd44.js} +1 -1
  39. package/dist/cjs/{overlays-d3a13e61.js → overlays-817dca17.js} +1 -0
  40. package/dist/collection/components/content/content.js +10 -50
  41. package/dist/collection/components/datetime/datetime.js +12 -6
  42. package/dist/collection/components/datetime/test/hour-cycle/datetime.e2e.js +14 -0
  43. package/dist/collection/components/datetime/utils/data.js +33 -7
  44. package/dist/collection/components/datetime/utils/format.js +27 -10
  45. package/dist/collection/components/datetime/utils/helpers.js +37 -5
  46. package/dist/collection/components/datetime-button/datetime-button.js +4 -4
  47. package/dist/collection/components/nav/nav.js +1 -0
  48. package/dist/collection/components/router/router.js +2 -0
  49. package/dist/collection/components/router/utils/path.js +1 -0
  50. package/dist/collection/components/tab-bar/tab-bar.js +0 -21
  51. package/dist/collection/components/toast/animations/ios.enter.js +40 -3
  52. package/dist/collection/components/toast/animations/ios.leave.js +8 -4
  53. package/dist/collection/components/toast/animations/md.enter.js +41 -3
  54. package/dist/collection/components/toast/test/position-anchor/toast.e2e.js +45 -0
  55. package/dist/collection/components/toast/toast.js +61 -6
  56. package/dist/collection/utils/native/haptic.js +1 -0
  57. package/dist/collection/utils/overlays.js +1 -0
  58. package/dist/collection/utils/transition/ios.transition.js +1 -0
  59. package/dist/docs.json +83 -10
  60. package/dist/esm/{button-active-513e9fff.js → button-active-d2346892.js} +1 -1
  61. package/dist/esm/{data-009dbf15.js → data-44d9e816.js} +96 -22
  62. package/dist/esm/{haptic-6447af60.js → haptic-1243b917.js} +1 -0
  63. package/dist/esm/{index-87684bba.js → index-dac72b4c.js} +2 -2
  64. package/dist/esm/index.js +4 -4
  65. package/dist/esm/ion-action-sheet.entry.js +3 -3
  66. package/dist/esm/ion-alert.entry.js +3 -3
  67. package/dist/esm/ion-app_8.entry.js +5 -51
  68. package/dist/esm/ion-datetime-button.entry.js +4 -4
  69. package/dist/esm/ion-datetime_3.entry.js +5 -5
  70. package/dist/esm/ion-loading.entry.js +1 -1
  71. package/dist/esm/ion-menu_3.entry.js +1 -1
  72. package/dist/esm/ion-modal.entry.js +2 -2
  73. package/dist/esm/ion-nav_2.entry.js +2 -1
  74. package/dist/esm/ion-picker-column-internal.entry.js +1 -1
  75. package/dist/esm/ion-popover.entry.js +2 -2
  76. package/dist/esm/ion-refresher_2.entry.js +1 -1
  77. package/dist/esm/ion-reorder_2.entry.js +1 -1
  78. package/dist/esm/ion-route_4.entry.js +3 -0
  79. package/dist/esm/ion-select_3.entry.js +1 -1
  80. package/dist/esm/ion-tab-bar_2.entry.js +0 -4
  81. package/dist/esm/ion-toast.entry.js +117 -13
  82. package/dist/esm/ion-toggle.entry.js +1 -1
  83. package/dist/esm/ionic.js +1 -1
  84. package/dist/esm/{ios.transition-81e1aed6.js → ios.transition-991c1a56.js} +2 -1
  85. package/dist/esm/loader.js +1 -1
  86. package/dist/esm/{md.transition-5becd8b5.js → md.transition-fb443521.js} +1 -1
  87. package/dist/esm/{overlays-8fc6656c.js → overlays-e064e499.js} +1 -0
  88. package/dist/esm-es5/{button-active-513e9fff.js → button-active-d2346892.js} +1 -1
  89. package/dist/esm-es5/data-44d9e816.js +4 -0
  90. package/dist/esm-es5/{index-87684bba.js → index-dac72b4c.js} +1 -1
  91. package/dist/esm-es5/index.js +1 -1
  92. package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
  93. package/dist/esm-es5/ion-alert.entry.js +1 -1
  94. package/dist/esm-es5/ion-app_8.entry.js +1 -1
  95. package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
  96. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  97. package/dist/esm-es5/ion-loading.entry.js +1 -1
  98. package/dist/esm-es5/ion-menu_3.entry.js +1 -1
  99. package/dist/esm-es5/ion-modal.entry.js +1 -1
  100. package/dist/esm-es5/ion-nav_2.entry.js +1 -1
  101. package/dist/esm-es5/ion-picker-column-internal.entry.js +1 -1
  102. package/dist/esm-es5/ion-popover.entry.js +1 -1
  103. package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
  104. package/dist/esm-es5/ion-reorder_2.entry.js +1 -1
  105. package/dist/esm-es5/ion-select_3.entry.js +1 -1
  106. package/dist/esm-es5/ion-tab-bar_2.entry.js +1 -1
  107. package/dist/esm-es5/ion-toast.entry.js +1 -1
  108. package/dist/esm-es5/ion-toggle.entry.js +1 -1
  109. package/dist/esm-es5/ionic.js +1 -1
  110. package/dist/esm-es5/{ios.transition-81e1aed6.js → ios.transition-991c1a56.js} +1 -1
  111. package/dist/esm-es5/loader.js +1 -1
  112. package/dist/esm-es5/{md.transition-5becd8b5.js → md.transition-fb443521.js} +1 -1
  113. package/dist/html.html-data.json +11 -1
  114. package/dist/ionic/index.esm.js +1 -1
  115. package/dist/ionic/ionic.esm.js +1 -1
  116. package/dist/ionic/{p-37456282.system.entry.js → p-06116432.system.entry.js} +1 -1
  117. package/dist/ionic/{p-270aa06b.entry.js → p-14dec15f.entry.js} +1 -1
  118. package/dist/ionic/{p-60838ce3.system.entry.js → p-161a6465.system.entry.js} +1 -1
  119. package/dist/ionic/p-17240d90.js +4 -0
  120. package/dist/ionic/{p-a6d8476b.system.entry.js → p-17e6836b.system.entry.js} +1 -1
  121. package/dist/ionic/p-1f448082.system.entry.js +4 -0
  122. package/dist/ionic/{p-972763df.js → p-2b70878e.js} +1 -1
  123. package/dist/ionic/{p-13a91505.entry.js → p-2d74ee51.entry.js} +1 -1
  124. package/dist/ionic/{p-bf9b1560.entry.js → p-2dac36bf.entry.js} +1 -1
  125. package/dist/ionic/{p-c5729044.system.entry.js → p-2df840d9.system.entry.js} +1 -1
  126. package/dist/ionic/{p-de676d36.system.entry.js → p-2ffbf4bc.system.entry.js} +1 -1
  127. package/dist/ionic/{p-4616f20a.system.entry.js → p-30bd5385.system.entry.js} +1 -1
  128. package/dist/ionic/{p-00aed720.system.js → p-315dd3f8.system.js} +1 -1
  129. package/dist/ionic/{p-b098f738.system.js → p-35d1c3bb.system.js} +1 -1
  130. package/dist/ionic/p-3ae2faf0.entry.js +4 -0
  131. package/dist/ionic/{p-08c5b9f4.system.entry.js → p-3b1a8994.system.entry.js} +1 -1
  132. package/dist/ionic/p-419b8565.entry.js +4 -0
  133. package/dist/ionic/{p-82da795c.system.entry.js → p-420da334.system.entry.js} +1 -1
  134. package/dist/ionic/{p-73f50e29.system.js → p-48393630.system.js} +1 -1
  135. package/dist/ionic/{p-918d5f19.system.js → p-4cf29e23.system.js} +1 -1
  136. package/dist/ionic/p-50b11c2b.system.entry.js +4 -0
  137. package/dist/ionic/{p-53bbd357.system.entry.js → p-5d522814.system.entry.js} +1 -1
  138. package/dist/ionic/p-5e84b718.system.entry.js +4 -0
  139. package/dist/ionic/{p-3730f493.entry.js → p-62f05fd2.entry.js} +1 -1
  140. package/dist/ionic/p-674e6f0c.js +4 -0
  141. package/dist/ionic/p-6edbc09b.system.js +1 -1
  142. package/dist/ionic/{p-5e2dc8e0.js → p-716fbba9.js} +1 -1
  143. package/dist/ionic/{p-f920f5ca.entry.js → p-7779d376.entry.js} +1 -1
  144. package/dist/ionic/{p-a720dc73.entry.js → p-78f204ee.entry.js} +1 -1
  145. package/dist/ionic/{p-6bc9c436.system.entry.js → p-86e73df8.system.entry.js} +1 -1
  146. package/dist/ionic/{p-7129d04e.entry.js → p-8a26eaba.entry.js} +1 -1
  147. package/dist/ionic/{p-d8b2c214.entry.js → p-974cbc3a.entry.js} +1 -1
  148. package/dist/ionic/{p-90d892fd.entry.js → p-990aaa2f.entry.js} +1 -1
  149. package/dist/ionic/{p-8fdd4a2f.system.js → p-9eb5455c.system.js} +1 -1
  150. package/dist/ionic/{p-4912b933.entry.js → p-a27a6256.entry.js} +1 -1
  151. package/dist/ionic/{p-b95fd3c6.entry.js → p-b61cf76c.entry.js} +1 -1
  152. package/dist/ionic/{p-ee6d9730.entry.js → p-b7dad585.entry.js} +1 -1
  153. package/dist/ionic/p-b8c3f071.system.js +4 -0
  154. package/dist/ionic/{p-40e16caa.system.entry.js → p-be337735.system.entry.js} +1 -1
  155. package/dist/ionic/p-c44645f2.entry.js +4 -0
  156. package/dist/ionic/{p-c7fca267.entry.js → p-c8251e8c.entry.js} +1 -1
  157. package/dist/ionic/p-d6dcbd7c.js +4 -0
  158. package/dist/ionic/{p-65a4c12f.system.entry.js → p-ec3fa33b.system.entry.js} +1 -1
  159. package/dist/ionic/{p-7e46b6ab.entry.js → p-f180d2b6.entry.js} +1 -1
  160. package/dist/ionic/{p-4a1ac160.system.entry.js → p-f767d6b4.system.entry.js} +1 -1
  161. package/dist/ionic/{p-63a73b69.system.entry.js → p-f7f6af24.system.entry.js} +1 -1
  162. package/dist/types/components/content/content.d.ts +1 -2
  163. package/dist/types/components/datetime/datetime-interface.d.ts +1 -0
  164. package/dist/types/components/datetime/datetime.d.ts +2 -2
  165. package/dist/types/components/datetime/utils/data.d.ts +3 -3
  166. package/dist/types/components/datetime/utils/format.d.ts +3 -3
  167. package/dist/types/components/datetime/utils/helpers.d.ts +15 -1
  168. package/dist/types/components/tab-bar/tab-bar.d.ts +0 -8
  169. package/dist/types/components/toast/animations/ios.enter.d.ts +2 -1
  170. package/dist/types/components/toast/animations/md.enter.d.ts +2 -1
  171. package/dist/types/components/toast/toast-interface.d.ts +6 -0
  172. package/dist/types/components/toast/toast.d.ts +9 -1
  173. package/dist/types/components.d.ts +16 -8
  174. package/hydrate/index.js +227 -91
  175. package/package.json +4 -5
  176. package/dist/esm-es5/data-009dbf15.js +0 -4
  177. package/dist/ionic/p-1a36bf45.system.entry.js +0 -4
  178. package/dist/ionic/p-1f6ac05b.system.entry.js +0 -4
  179. package/dist/ionic/p-27614d55.entry.js +0 -4
  180. package/dist/ionic/p-36bfb18c.system.entry.js +0 -4
  181. package/dist/ionic/p-44ef7224.system.js +0 -4
  182. package/dist/ionic/p-67c441fa.entry.js +0 -4
  183. package/dist/ionic/p-72a1cbc7.js +0 -4
  184. package/dist/ionic/p-78a293a5.js +0 -4
  185. package/dist/ionic/p-7cfd253c.js +0 -4
  186. package/dist/ionic/p-ec78a7bf.entry.js +0 -4
  187. /package/dist/esm-es5/{haptic-6447af60.js → haptic-1243b917.js} +0 -0
  188. /package/dist/esm-es5/{overlays-8fc6656c.js → overlays-e064e499.js} +0 -0
  189. /package/dist/ionic/{p-f9015336.js → p-3faf56ab.js} +0 -0
  190. /package/dist/ionic/{p-7a3caa4e.system.js → p-40bd36f3.system.js} +0 -0
  191. /package/dist/ionic/{p-14d7b7e2.system.js → p-b4b4bb29.system.js} +0 -0
  192. /package/dist/ionic/{p-bb6f38ed.js → p-b923f3d7.js} +0 -0
package/hydrate/index.js CHANGED
@@ -7149,6 +7149,7 @@ const HapticEngine = {
7149
7149
  * if the browser does not support the Vibrate API.
7150
7150
  */
7151
7151
  if ((capacitor === null || capacitor === void 0 ? void 0 : capacitor.getPlatform()) === 'web') {
7152
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
7152
7153
  return typeof navigator !== 'undefined' && navigator.vibrate !== undefined;
7153
7154
  }
7154
7155
  return true;
@@ -8218,6 +8219,7 @@ const setOverlayId = (el) => {
8218
8219
  return el.id;
8219
8220
  };
8220
8221
  const createOverlay = (tagName, opts) => {
8222
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
8221
8223
  if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined') {
8222
8224
  return window.customElements.whenDefined(tagName).then(() => {
8223
8225
  const element = document.createElement(tagName);
@@ -12503,7 +12505,6 @@ class Content {
12503
12505
  this.cBottom = -1;
12504
12506
  this.isMainContent = true;
12505
12507
  this.resizeTimeout = null;
12506
- this.tabsElement = null;
12507
12508
  // Detail is used in a hot loop in the scroll event, by allocating it here
12508
12509
  // V8 will be able to inline any read/write to it since it's a monomorphic class.
12509
12510
  // https://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.html
@@ -12534,57 +12535,12 @@ class Content {
12534
12535
  }
12535
12536
  connectedCallback() {
12536
12537
  this.isMainContent = this.el.closest('ion-menu, ion-popover, ion-modal') === null;
12537
- /**
12538
- * The fullscreen content offsets need to be
12539
- * computed after the tab bar has loaded. Since
12540
- * lazy evaluation means components are not hydrated
12541
- * at the same time, we need to wait for the ionTabBarLoaded
12542
- * event to fire. This does not impact dist-custom-elements
12543
- * because there is no hydration there.
12544
- */
12545
- if (hasLazyBuild(this.el)) {
12546
- /**
12547
- * We need to cache the reference to the tabs.
12548
- * If just the content is unmounted then we won't
12549
- * be able to query for the closest tabs on disconnectedCallback
12550
- * since the content has been removed from the DOM tree.
12551
- */
12552
- const closestTabs = (this.tabsElement = this.el.closest('ion-tabs'));
12553
- if (closestTabs !== null) {
12554
- /**
12555
- * When adding and removing the event listener
12556
- * we need to make sure we pass the same function reference
12557
- * otherwise the event listener will not be removed properly.
12558
- * We can't only pass `this.resize` because "this" in the function
12559
- * context becomes a reference to IonTabs instead of IonContent.
12560
- *
12561
- * Additionally, we listen for ionTabBarLoaded on the IonTabs
12562
- * instance rather than the IonTabBar instance. It's possible for
12563
- * a tab bar to be conditionally rendered/mounted. Since ionTabBarLoaded
12564
- * bubbles, we can catch any instances of child tab bars loading by listening
12565
- * on IonTabs.
12566
- */
12567
- this.tabsLoadCallback = () => this.resize();
12568
- closestTabs.addEventListener('ionTabBarLoaded', this.tabsLoadCallback);
12569
- }
12570
- }
12571
12538
  }
12572
12539
  disconnectedCallback() {
12573
12540
  this.onScrollEnd();
12574
- if (hasLazyBuild(this.el)) {
12575
- /**
12576
- * The event listener and tabs caches need to
12577
- * be cleared otherwise this will create a memory
12578
- * leak where the IonTabs instance can never be
12579
- * garbage collected.
12580
- */
12581
- const { tabsElement, tabsLoadCallback } = this;
12582
- if (tabsElement !== null && tabsLoadCallback !== undefined) {
12583
- tabsElement.removeEventListener('ionTabBarLoaded', tabsLoadCallback);
12584
- }
12585
- this.tabsElement = null;
12586
- this.tabsLoadCallback = undefined;
12587
- }
12541
+ }
12542
+ onAppLoad() {
12543
+ this.resize();
12588
12544
  }
12589
12545
  /**
12590
12546
  * Rotating certain devices can update
@@ -12831,7 +12787,7 @@ class Content {
12831
12787
  "scrollByPoint": [64],
12832
12788
  "scrollToPoint": [64]
12833
12789
  },
12834
- "$listeners$": [[9, "resize", "onResize"]],
12790
+ "$listeners$": [[8, "appload", "onAppLoad"], [9, "resize", "onResize"]],
12835
12791
  "$lazyBundleId$": "-",
12836
12792
  "$attrsToReflect$": [["color", "color"]]
12837
12793
  }; }
@@ -13013,13 +12969,19 @@ const warnIfValueOutOfBounds = (value, min, max) => {
13013
12969
  const isLeapYear = (year) => {
13014
12970
  return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
13015
12971
  };
13016
- const is24Hour = (locale, hourCycle) => {
12972
+ /**
12973
+ * Determines the hour cycle for a user.
12974
+ * If the hour cycle is explicitly defined, just use that.
12975
+ * Otherwise, we try to derive it from either the specified
12976
+ * locale extension tags or from Intl.DateTimeFormat directly.
12977
+ */
12978
+ const getHourCycle = (locale, hourCycle) => {
13017
12979
  /**
13018
- * If developer has explicitly enabled h23 time
12980
+ * If developer has explicitly enabled 24-hour time
13019
12981
  * then return early and do not look at the system default.
13020
12982
  */
13021
12983
  if (hourCycle !== undefined) {
13022
- return hourCycle === 'h23';
12984
+ return hourCycle;
13023
12985
  }
13024
12986
  /**
13025
12987
  * If hourCycle was not specified, check the locale
@@ -13030,7 +12992,7 @@ const is24Hour = (locale, hourCycle) => {
13030
12992
  const formatted = new Intl.DateTimeFormat(locale, { hour: 'numeric' });
13031
12993
  const options = formatted.resolvedOptions();
13032
12994
  if (options.hourCycle !== undefined) {
13033
- return options.hourCycle === 'h23';
12995
+ return options.hourCycle;
13034
12996
  }
13035
12997
  /**
13036
12998
  * If hourCycle is not specified (either through lack
@@ -13043,7 +13005,33 @@ const is24Hour = (locale, hourCycle) => {
13043
13005
  if (!hour) {
13044
13006
  throw new Error('Hour value not found from DateTimeFormat');
13045
13007
  }
13046
- return hour.value === '00';
13008
+ /**
13009
+ * Midnight for h11 starts at 0:00am
13010
+ * Midnight for h12 starts at 12:00am
13011
+ * Midnight for h23 starts at 00:00
13012
+ * Midnight for h24 starts at 24:00
13013
+ */
13014
+ switch (hour.value) {
13015
+ case '0':
13016
+ return 'h11';
13017
+ case '12':
13018
+ return 'h12';
13019
+ case '00':
13020
+ return 'h23';
13021
+ case '24':
13022
+ return 'h24';
13023
+ default:
13024
+ throw new Error(`Invalid hour cycle "${hourCycle}"`);
13025
+ }
13026
+ };
13027
+ /**
13028
+ * Determine if the hour cycle uses a 24-hour format.
13029
+ * Returns true for h23 and h24. Returns false otherwise.
13030
+ * If you don't know the hourCycle, use getHourCycle above
13031
+ * and pass the result into this function.
13032
+ */
13033
+ const is24Hour = (hourCycle) => {
13034
+ return hourCycle === 'h23' || hourCycle === 'h24';
13047
13035
  };
13048
13036
  /**
13049
13037
  * Given a date object, returns the number
@@ -13710,7 +13698,7 @@ const getFormattedDayPeriod = (dayPeriod) => {
13710
13698
  }
13711
13699
  return dayPeriod.toUpperCase();
13712
13700
  };
13713
- const getLocalizedTime = (locale, refParts, use24Hour) => {
13701
+ const getLocalizedTime = (locale, refParts, hourCycle) => {
13714
13702
  const timeParts = {
13715
13703
  hour: refParts.hour,
13716
13704
  minute: refParts.minute,
@@ -13732,7 +13720,7 @@ const getLocalizedTime = (locale, refParts, use24Hour) => {
13732
13720
  * We use hourCycle here instead of hour12 due to:
13733
13721
  * https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
13734
13722
  */
13735
- hourCycle: use24Hour ? 'h23' : 'h12',
13723
+ hourCycle,
13736
13724
  /**
13737
13725
  * Setting Z at the end indicates that this
13738
13726
  * date string is in the UTC time zone. This
@@ -13770,17 +13758,33 @@ const addTimePadding = (value) => {
13770
13758
  * 12 hour times it ensures that
13771
13759
  * hour 0 is formatted as '12'.
13772
13760
  */
13773
- const getFormattedHour = (hour, use24Hour) => {
13774
- if (use24Hour) {
13775
- return addTimePadding(hour);
13776
- }
13761
+ const getFormattedHour = (hour, hourCycle) => {
13777
13762
  /**
13778
- * If using 12 hour
13779
- * format, make sure hour
13780
- * 0 is formatted as '12'.
13763
+ * Midnight for h11 starts at 0:00am
13764
+ * Midnight for h12 starts at 12:00am
13765
+ * Midnight for h23 starts at 00:00
13766
+ * Midnight for h24 starts at 24:00
13781
13767
  */
13782
13768
  if (hour === 0) {
13783
- return '12';
13769
+ switch (hourCycle) {
13770
+ case 'h11':
13771
+ return '0';
13772
+ case 'h12':
13773
+ return '12';
13774
+ case 'h23':
13775
+ return '00';
13776
+ case 'h24':
13777
+ return '24';
13778
+ default:
13779
+ throw new Error(`Invalid hour cycle "${hourCycle}"`);
13780
+ }
13781
+ }
13782
+ const use24Hour = is24Hour(hourCycle);
13783
+ /**
13784
+ * h23 and h24 use 24 hour times.
13785
+ */
13786
+ if (use24Hour) {
13787
+ return addTimePadding(hour);
13784
13788
  }
13785
13789
  return hour.toString();
13786
13790
  };
@@ -14015,8 +14019,14 @@ const minutes = [
14015
14019
  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,
14016
14020
  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,
14017
14021
  ];
14022
+ // h11 hour system uses 0-11. Midnight starts at 0:00am.
14023
+ const hour11 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
14024
+ // h12 hour system uses 0-12. Midnight starts at 12:00am.
14018
14025
  const hour12 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
14026
+ // h23 hour system uses 0-23. Midnight starts at 0:00.
14019
14027
  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];
14028
+ // h24 hour system uses 1-24. Midnight starts at 24:00.
14029
+ 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];
14020
14030
  /**
14021
14031
  * Given a locale and a mode,
14022
14032
  * return an array with formatted days
@@ -14085,14 +14095,33 @@ const getDaysOfMonth = (month, year, firstDayOfWeek) => {
14085
14095
  }
14086
14096
  return days;
14087
14097
  };
14098
+ /**
14099
+ * Returns an array of pre-defined hour
14100
+ * values based on the provided hourCycle.
14101
+ */
14102
+ const getHourData = (hourCycle) => {
14103
+ switch (hourCycle) {
14104
+ case 'h11':
14105
+ return hour11;
14106
+ case 'h12':
14107
+ return hour12;
14108
+ case 'h23':
14109
+ return hour23;
14110
+ case 'h24':
14111
+ return hour24;
14112
+ default:
14113
+ throw new Error(`Invalid hour cycle "${hourCycle}"`);
14114
+ }
14115
+ };
14088
14116
  /**
14089
14117
  * Given a local, reference datetime parts and option
14090
14118
  * max/min bound datetime parts, calculate the acceptable
14091
14119
  * hour and minute values according to the bounds and locale.
14092
14120
  */
14093
- const generateTime = (refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
14094
- const use24Hour = hourCycle === 'h23';
14095
- let processedHours = use24Hour ? hour23 : hour12;
14121
+ const generateTime = (locale, refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
14122
+ const computedHourCycle = getHourCycle(locale, hourCycle);
14123
+ const use24Hour = is24Hour(computedHourCycle);
14124
+ let processedHours = getHourData(computedHourCycle);
14096
14125
  let processedMinutes = minutes;
14097
14126
  let isAMAllowed = true;
14098
14127
  let isPMAllowed = true;
@@ -14424,11 +14453,12 @@ const getCombinedDateColumnData = (locale, todayParts, minParts, maxParts, dayVa
14424
14453
  };
14425
14454
  };
14426
14455
  const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues) => {
14427
- const use24Hour = is24Hour(locale, hourCycle);
14428
- const { hours, minutes, am, pm } = generateTime(refParts, use24Hour ? 'h23' : 'h12', minParts, maxParts, allowedHourValues, allowedMinuteValues);
14456
+ const computedHourCycle = getHourCycle(locale, hourCycle);
14457
+ const use24Hour = is24Hour(computedHourCycle);
14458
+ const { hours, minutes, am, pm } = generateTime(locale, refParts, computedHourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues);
14429
14459
  const hoursItems = hours.map((hour) => {
14430
14460
  return {
14431
- text: getFormattedHour(hour, use24Hour),
14461
+ text: getFormattedHour(hour, computedHourCycle),
14432
14462
  value: getInternalHourValue(hour, use24Hour, refParts.ampm),
14433
14463
  };
14434
14464
  });
@@ -15991,7 +16021,7 @@ class Datetime {
15991
16021
  }
15992
16022
  renderTimeOverlay() {
15993
16023
  const { hourCycle, isTimePopoverOpen, locale } = this;
15994
- const use24Hour = is24Hour(locale, hourCycle);
16024
+ const computedHourCycle = getHourCycle(locale, hourCycle);
15995
16025
  const activePart = this.getActivePartsWithFallback();
15996
16026
  return [
15997
16027
  hAsync("div", { class: "time-header" }, this.renderTimeLabel()),
@@ -16010,7 +16040,7 @@ class Datetime {
16010
16040
  await popoverRef.onWillDismiss();
16011
16041
  this.isTimePopoverOpen = false;
16012
16042
  }
16013
- } }, getLocalizedTime(locale, activePart, use24Hour)),
16043
+ } }, getLocalizedTime(locale, activePart, computedHourCycle)),
16014
16044
  hAsync("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
16015
16045
  /**
16016
16046
  * Intersection Observers do not consistently fire between Blink and Webkit
@@ -16275,13 +16305,13 @@ class DatetimeButton {
16275
16305
  * warning in the console.
16276
16306
  */
16277
16307
  const firstParsedDatetime = parsedDatetimes[0];
16278
- const use24Hour = is24Hour(locale, hourCycle);
16308
+ const computedHourCycle = getHourCycle(locale, hourCycle);
16279
16309
  this.dateText = this.timeText = undefined;
16280
16310
  switch (datetimePresentation) {
16281
16311
  case 'date-time':
16282
16312
  case 'time-date':
16283
16313
  const dateText = getMonthDayAndYear(locale, firstParsedDatetime);
16284
- const timeText = getLocalizedTime(locale, firstParsedDatetime, use24Hour);
16314
+ const timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle);
16285
16315
  if (preferWheel) {
16286
16316
  this.dateText = `${dateText} ${timeText}`;
16287
16317
  }
@@ -16308,7 +16338,7 @@ class DatetimeButton {
16308
16338
  }
16309
16339
  break;
16310
16340
  case 'time':
16311
- this.timeText = getLocalizedTime(locale, firstParsedDatetime, use24Hour);
16341
+ this.timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle);
16312
16342
  break;
16313
16343
  case 'month-year':
16314
16344
  this.dateText = getMonthAndYear(locale, firstParsedDatetime);
@@ -23891,6 +23921,7 @@ class Nav {
23891
23921
  : undefined;
23892
23922
  const mode = getIonMode$1(this);
23893
23923
  const enteringEl = enteringView.element;
23924
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
23894
23925
  const leavingEl = leavingView && leavingView.element;
23895
23926
  const animationOpts = Object.assign(Object.assign({ mode, showGoBack: this.canGoBackSync(enteringView), baseEl: this.el, progressCallback, animated: this.animated && config.getBoolean('animated', true), enteringEl,
23896
23927
  leavingEl }, opts), { animationBuilder: opts.animationBuilder || this.animation || config.get('navAnimation') });
@@ -29648,6 +29679,7 @@ const chainToSegments = (chain) => {
29648
29679
  for (const route of chain) {
29649
29680
  for (const segment of route.segments) {
29650
29681
  if (segment[0] === ':') {
29682
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
29651
29683
  const param = route.params && route.params[segment.slice(1)];
29652
29684
  if (!param) {
29653
29685
  return null;
@@ -30343,12 +30375,14 @@ class Router {
30343
30375
  }
30344
30376
  const routes = readRoutes(this.el);
30345
30377
  const fromChain = findChainForSegments(from, routes);
30378
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
30346
30379
  const beforeLeaveHook = fromChain && fromChain[fromChain.length - 1].beforeLeave;
30347
30380
  const canLeave = beforeLeaveHook ? await beforeLeaveHook() : true;
30348
30381
  if (canLeave === false || typeof canLeave === 'object') {
30349
30382
  return canLeave;
30350
30383
  }
30351
30384
  const toChain = findChainForSegments(to, routes);
30385
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
30352
30386
  const beforeEnterHook = toChain && toChain[toChain.length - 1].beforeEnter;
30353
30387
  return beforeEnterHook ? beforeEnterHook() : true;
30354
30388
  }
@@ -32757,7 +32791,6 @@ class TabBar {
32757
32791
  constructor(hostRef) {
32758
32792
  registerInstance(this, hostRef);
32759
32793
  this.ionTabBarChanged = createEvent(this, "ionTabBarChanged", 7);
32760
- this.ionTabBarLoaded = createEvent(this, "ionTabBarLoaded", 7);
32761
32794
  this.keyboardCtrl = null;
32762
32795
  this.keyboardVisible = false;
32763
32796
  this.color = undefined;
@@ -32792,9 +32825,6 @@ class TabBar {
32792
32825
  this.keyboardCtrl.destroy();
32793
32826
  }
32794
32827
  }
32795
- componentDidLoad() {
32796
- this.ionTabBarLoaded.emit();
32797
- }
32798
32828
  render() {
32799
32829
  const { color, translucent, keyboardVisible } = this;
32800
32830
  const mode = getIonMode$1(this);
@@ -33574,13 +33604,49 @@ class Thumbnail {
33574
33604
  /**
33575
33605
  * iOS Toast Enter Animation
33576
33606
  */
33577
- const iosEnterAnimation = (baseEl, position) => {
33607
+ const iosEnterAnimation = (baseEl, opts) => {
33578
33608
  const baseAnimation = createAnimation();
33579
33609
  const wrapperAnimation = createAnimation();
33610
+ const { position, positionAnchor } = opts;
33580
33611
  const root = getElementRoot(baseEl);
33581
33612
  const wrapperEl = root.querySelector('.toast-wrapper');
33582
- const bottom = `calc(-10px - var(--ion-safe-area-bottom, 0px))`;
33583
- const top = `calc(10px + var(--ion-safe-area-top, 0px))`;
33613
+ /**
33614
+ * Start with a predefined offset from the edge the toast will be
33615
+ * positioned relative to. By default, this will be the top edge
33616
+ * of the screen.
33617
+ */
33618
+ let offset = position === 'top' ? 10 : -10;
33619
+ let top, bottom;
33620
+ /**
33621
+ * If positionAnchor is defined, add in the distance from the top
33622
+ * of the screen to the target anchor edge. For position="top", the
33623
+ * bottom anchor edge is targeted. For position="bottom", the top
33624
+ * anchor edge is targeted.
33625
+ */
33626
+ if (positionAnchor && win$1) {
33627
+ const box = positionAnchor.getBoundingClientRect();
33628
+ if (position === 'top') {
33629
+ offset += box.bottom;
33630
+ }
33631
+ else if (position === 'bottom') {
33632
+ /**
33633
+ * Just box.top is the distance from the top edge of the screen
33634
+ * to the top edge of the anchor. We want to calculate from the
33635
+ * bottom edge of the screen instead.
33636
+ */
33637
+ offset -= win$1.innerHeight - box.top;
33638
+ }
33639
+ /**
33640
+ * We don't include safe area here because that should already be
33641
+ * accounted for when checking the position of the anchor.
33642
+ */
33643
+ top = `${offset}px`;
33644
+ bottom = `${offset}px`;
33645
+ }
33646
+ else {
33647
+ top = `calc(${offset}px + var(--ion-safe-area-top, 0px))`;
33648
+ bottom = `calc(${offset}px - var(--ion-safe-area-bottom, 0px))`;
33649
+ }
33584
33650
  wrapperAnimation.addElement(wrapperEl);
33585
33651
  switch (position) {
33586
33652
  case 'top':
@@ -33606,18 +33672,22 @@ const iosLeaveAnimation = (baseEl, position) => {
33606
33672
  const wrapperAnimation = createAnimation();
33607
33673
  const root = getElementRoot(baseEl);
33608
33674
  const wrapperEl = root.querySelector('.toast-wrapper');
33609
- const bottom = `calc(-10px - var(--ion-safe-area-bottom, 0px))`;
33610
- const top = `calc(10px + var(--ion-safe-area-top, 0px))`;
33611
33675
  wrapperAnimation.addElement(wrapperEl);
33676
+ /**
33677
+ * For top/bottom positions, we use to() instead of fromTo() so that if
33678
+ * the positionAnchor prop was used, we don't need to recalculate the
33679
+ * toast and/or anchor's position and duplicate work from the enter
33680
+ * animation.
33681
+ */
33612
33682
  switch (position) {
33613
33683
  case 'top':
33614
- wrapperAnimation.fromTo('transform', `translateY(${top})`, 'translateY(-100%)');
33684
+ wrapperAnimation.to('transform', 'translateY(-100%)');
33615
33685
  break;
33616
33686
  case 'middle':
33617
33687
  wrapperAnimation.fromTo('opacity', 0.99, 0);
33618
33688
  break;
33619
33689
  default:
33620
- wrapperAnimation.fromTo('transform', `translateY(${bottom})`, 'translateY(100%)');
33690
+ wrapperAnimation.to('transform', 'translateY(100%)');
33621
33691
  break;
33622
33692
  }
33623
33693
  return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(300).addAnimation(wrapperAnimation);
@@ -33626,13 +33696,50 @@ const iosLeaveAnimation = (baseEl, position) => {
33626
33696
  /**
33627
33697
  * MD Toast Enter Animation
33628
33698
  */
33629
- const mdEnterAnimation = (baseEl, position) => {
33699
+ const mdEnterAnimation = (baseEl, opts) => {
33630
33700
  const baseAnimation = createAnimation();
33631
33701
  const wrapperAnimation = createAnimation();
33702
+ const { position, positionAnchor } = opts;
33632
33703
  const root = getElementRoot(baseEl);
33633
33704
  const wrapperEl = root.querySelector('.toast-wrapper');
33634
- const bottom = `calc(8px + var(--ion-safe-area-bottom, 0px))`;
33635
- const top = `calc(8px + var(--ion-safe-area-top, 0px))`;
33705
+ /**
33706
+ * Start with a predefined offset from the edge the toast will be
33707
+ * positioned relative to. By default, this will be the top edge
33708
+ * of the screen for position="top", or the bottom edge for
33709
+ * position="bottom".
33710
+ */
33711
+ let offset = 8;
33712
+ let top, bottom;
33713
+ /**
33714
+ * If positionAnchor is defined, add in the distance from the target
33715
+ * screen edge to the target anchor edge. For position="top", the
33716
+ * bottom anchor edge is targeted. For position="bottom", the top
33717
+ * anchor edge is targeted.
33718
+ */
33719
+ if (positionAnchor && win$1) {
33720
+ const box = positionAnchor.getBoundingClientRect();
33721
+ if (position === 'top') {
33722
+ offset += box.bottom;
33723
+ }
33724
+ else if (position === 'bottom') {
33725
+ /**
33726
+ * Just box.top is the distance from the top edge of the screen
33727
+ * to the top edge of the anchor. We want to calculate from the
33728
+ * bottom edge of the screen instead.
33729
+ */
33730
+ offset += win$1.innerHeight - box.top;
33731
+ }
33732
+ /**
33733
+ * We don't include safe area here because that should already be
33734
+ * accounted for when checking the position of the anchor.
33735
+ */
33736
+ top = `${offset}px`;
33737
+ bottom = `${offset}px`;
33738
+ }
33739
+ else {
33740
+ top = `calc(${offset}px + var(--ion-safe-area-top, 0px))`;
33741
+ bottom = `calc(${offset}px + var(--ion-safe-area-bottom, 0px))`;
33742
+ }
33636
33743
  wrapperAnimation.addElement(wrapperEl);
33637
33744
  switch (position) {
33638
33745
  case 'top':
@@ -33716,6 +33823,7 @@ class Toast {
33716
33823
  this.message = undefined;
33717
33824
  this.keyboardClose = false;
33718
33825
  this.position = 'bottom';
33826
+ this.positionAnchor = undefined;
33719
33827
  this.buttons = undefined;
33720
33828
  this.translucent = false;
33721
33829
  this.animated = true;
@@ -33763,7 +33871,33 @@ class Toast {
33763
33871
  async present() {
33764
33872
  const unlock = await this.lockController.lock();
33765
33873
  await this.delegateController.attachViewToDom();
33766
- await present(this, 'toastEnter', iosEnterAnimation, mdEnterAnimation, this.position);
33874
+ const { position, positionAnchor } = this;
33875
+ let anchor;
33876
+ if (position === 'middle' && positionAnchor !== undefined) {
33877
+ printIonWarning('The positionAnchor property is ignored when using position="middle".', this.el);
33878
+ }
33879
+ else if (typeof positionAnchor === 'string') {
33880
+ /**
33881
+ * If the anchor is defined as an ID, find the element.
33882
+ * We do this on every present so the toast doesn't need
33883
+ * to account for the surrounding DOM changing since the
33884
+ * last time it was presented.
33885
+ */
33886
+ const foundEl = document.getElementById(positionAnchor);
33887
+ if (foundEl === null) {
33888
+ printIonWarning(`An anchor element with an ID of ${positionAnchor} was not found in the DOM.`, this.el);
33889
+ }
33890
+ else {
33891
+ anchor = foundEl;
33892
+ }
33893
+ }
33894
+ else {
33895
+ anchor = positionAnchor;
33896
+ }
33897
+ await present(this, 'toastEnter', iosEnterAnimation, mdEnterAnimation, {
33898
+ position,
33899
+ positionAnchor: anchor,
33900
+ });
33767
33901
  /**
33768
33902
  * Content is revealed to screen readers after
33769
33903
  * the transition to avoid jank since this
@@ -33924,6 +34058,7 @@ class Toast {
33924
34058
  "message": [1],
33925
34059
  "keyboardClose": [4, "keyboard-close"],
33926
34060
  "position": [1],
34061
+ "positionAnchor": [1, "position-anchor"],
33927
34062
  "buttons": [16],
33928
34063
  "translucent": [4],
33929
34064
  "animated": [4],
@@ -34641,6 +34776,7 @@ const iosTransitionAnimation = (navEl, opts) => {
34641
34776
  .easing(opts.easing || EASING)
34642
34777
  .fill('both')
34643
34778
  .beforeRemoveClass('ion-page-invisible');
34779
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
34644
34780
  if (leavingEl && navEl !== null && navEl !== undefined) {
34645
34781
  const navDecorAnimation = createAnimation();
34646
34782
  navDecorAnimation.addElement(navEl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/core",
3
- "version": "7.4.2-dev.11695831341.191bdf12",
3
+ "version": "7.4.2-dev.11695927273.1323de22",
4
4
  "description": "Base components for Ionic",
5
5
  "keywords": [
6
6
  "ionic",
@@ -53,8 +53,8 @@
53
53
  "@stencil/vue-output-target": "^0.8.6",
54
54
  "@types/jest": "^27.5.2",
55
55
  "@types/node": "^14.6.0",
56
- "@typescript-eslint/eslint-plugin": "^5.17.0",
57
- "@typescript-eslint/parser": "^5.17.0",
56
+ "@typescript-eslint/eslint-plugin": "^6.7.2",
57
+ "@typescript-eslint/parser": "^6.7.2",
58
58
  "clean-css-cli": "^5.6.1",
59
59
  "domino": "^2.1.6",
60
60
  "eslint": "^7.32.0",
@@ -69,8 +69,7 @@
69
69
  "sass": "^1.26.10",
70
70
  "serve": "^14.0.1",
71
71
  "stylelint": "^13.13.1",
72
- "stylelint-order": "^4.1.0",
73
- "typescript": "^4.0.5"
72
+ "stylelint-order": "^4.1.0"
74
73
  },
75
74
  "scripts": {
76
75
  "build": "npm run clean && npm run build.css && stencil build --es5 --docs-json dist/docs.json",
@@ -1,4 +0,0 @@
1
- import{__spreadArray}from"tslib";
2
- /*!
3
- * (C) Ionic http://ionicframework.com - MIT License
4
- */import{p as printIonWarning}from"./index-595d62c9.js";var isSameDay=function(e,a){return e.month===a.month&&e.day===a.day&&e.year===a.year};var isBefore=function(e,a){return!!(e.year<a.year||e.year===a.year&&e.month<a.month||e.year===a.year&&e.month===a.month&&e.day!==null&&e.day<a.day)};var isAfter=function(e,a){return!!(e.year>a.year||e.year===a.year&&e.month>a.month||e.year===a.year&&e.month===a.month&&e.day!==null&&e.day>a.day)};var warnIfValueOutOfBounds=function(e,a,r){var t=Array.isArray(e)?e:[e];for(var n=0,o=t;n<o.length;n++){var i=o[n];if(a!==undefined&&isBefore(i,a)||r!==undefined&&isAfter(i,r)){printIonWarning("The value provided to ion-datetime is out of bounds.\n\n"+"Min: ".concat(JSON.stringify(a),"\n")+"Max: ".concat(JSON.stringify(r),"\n")+"Value: ".concat(JSON.stringify(e)));break}}};var isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0};var is24Hour=function(e,a){if(a!==undefined){return a==="h23"}var r=new Intl.DateTimeFormat(e,{hour:"numeric"});var t=r.resolvedOptions();if(t.hourCycle!==undefined){return t.hourCycle==="h23"}var n=new Date("5/18/2021 00:00");var o=r.formatToParts(n);var i=o.find((function(e){return e.type==="hour"}));if(!i){throw new Error("Hour value not found from DateTimeFormat")}return i.value==="00"};var getNumDaysInMonth=function(e,a){return e===4||e===6||e===9||e===11?30:e===2?isLeapYear(a)?29:28:31};var isMonthFirstLocale=function(e,a){if(a===void 0){a={month:"numeric",year:"numeric"}}var r=new Intl.DateTimeFormat(e,a).formatToParts(new Date);return r[0].type==="month"};var isLocaleDayPeriodRTL=function(e){var a=new Intl.DateTimeFormat(e,{hour:"numeric"}).formatToParts(new Date);return a[0].type==="dayPeriod"};var ISO_8601_REGEXP=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;var TIME_REGEXP=/^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;var convertToArrayOfNumbers=function(e){if(e===undefined){return}var a=e;if(typeof e==="string"){a=e.replace(/\[|\]|\s/g,"").split(",")}var r;if(Array.isArray(a)){r=a.map((function(e){return parseInt(e,10)})).filter(isFinite)}else{r=[a]}return r};var getPartsFromCalendarDay=function(e){return{month:parseInt(e.getAttribute("data-month"),10),day:parseInt(e.getAttribute("data-day"),10),year:parseInt(e.getAttribute("data-year"),10),dayOfWeek:parseInt(e.getAttribute("data-day-of-week"),10)}};function parseDate(e){if(Array.isArray(e)){var a=[];for(var r=0,t=e;r<t.length;r++){var n=t[r];var o=parseDate(n);if(!o){return undefined}a.push(o)}return a}var i=null;if(e!=null&&e!==""){i=TIME_REGEXP.exec(e);if(i){i.unshift(undefined,undefined);i[2]=i[3]=undefined}else{i=ISO_8601_REGEXP.exec(e)}}if(i===null){printIonWarning("Unable to parse date string: ".concat(e,". Please provide a valid ISO 8601 datetime string."));return undefined}for(var u=1;u<8;u++){i[u]=i[u]!==undefined?parseInt(i[u],10):undefined}return{year:i[1],month:i[2],day:i[3],hour:i[4],minute:i[5],ampm:i[4]<12?"am":"pm"}}var clampDate=function(e,a,r){if(a&&isBefore(e,a)){return a}else if(r&&isAfter(e,r)){return r}return e};var parseAmPm=function(e){return e>=12?"pm":"am"};var parseMaxParts=function(e,a){var r=parseDate(e);if(r===undefined){return}var t=r.month,n=r.day,o=r.year,i=r.hour,u=r.minute;var d=o!==null&&o!==void 0?o:a.year;var f=t!==null&&t!==void 0?t:12;return{month:f,day:n!==null&&n!==void 0?n:getNumDaysInMonth(f,d),year:d,hour:i!==null&&i!==void 0?i:23,minute:u!==null&&u!==void 0?u:59}};var parseMinParts=function(e,a){var r=parseDate(e);if(r===undefined){return}var t=r.month,n=r.day,o=r.year,i=r.hour,u=r.minute;return{month:t!==null&&t!==void 0?t:1,day:n!==null&&n!==void 0?n:1,year:o!==null&&o!==void 0?o:a.year,hour:i!==null&&i!==void 0?i:0,minute:u!==null&&u!==void 0?u:0}};var twoDigit=function(e){return("0"+(e!==undefined?Math.abs(e):"0")).slice(-2)};var fourDigit=function(e){return("000"+(e!==undefined?Math.abs(e):"0")).slice(-4)};function convertDataToISO(e){if(Array.isArray(e)){return e.map((function(e){return convertDataToISO(e)}))}var a="";if(e.year!==undefined){a=fourDigit(e.year);if(e.month!==undefined){a+="-"+twoDigit(e.month);if(e.day!==undefined){a+="-"+twoDigit(e.day);if(e.hour!==undefined){a+="T".concat(twoDigit(e.hour),":").concat(twoDigit(e.minute),":00")}}}}else if(e.hour!==undefined){a=twoDigit(e.hour)+":"+twoDigit(e.minute)}return a}var convert12HourTo24Hour=function(e,a){if(a===undefined){return e}if(a==="am"){if(e===12){return 0}return e}if(e===12){return 12}return e+12};var getStartOfWeek=function(e){var a=e.dayOfWeek;if(a===null||a===undefined){throw new Error("No day of week provided")}return subtractDays(e,a)};var getEndOfWeek=function(e){var a=e.dayOfWeek;if(a===null||a===undefined){throw new Error("No day of week provided")}return addDays(e,6-a)};var getNextDay=function(e){return addDays(e,1)};var getPreviousDay=function(e){return subtractDays(e,1)};var getPreviousWeek=function(e){return subtractDays(e,7)};var getNextWeek=function(e){return addDays(e,7)};var subtractDays=function(e,a){var r=e.month,t=e.day,n=e.year;if(t===null){throw new Error("No day provided")}var o={month:r,day:t,year:n};o.day=t-a;if(o.day<1){o.month-=1}if(o.month<1){o.month=12;o.year-=1}if(o.day<1){var i=getNumDaysInMonth(o.month,o.year);o.day=i+o.day}return o};var addDays=function(e,a){var r=e.month,t=e.day,n=e.year;if(t===null){throw new Error("No day provided")}var o={month:r,day:t,year:n};var i=getNumDaysInMonth(r,n);o.day=t+a;if(o.day>i){o.day-=i;o.month+=1}if(o.month>12){o.month=1;o.year+=1}return o};var getPreviousMonth=function(e){var a=e.month===1?12:e.month-1;var r=e.month===1?e.year-1:e.year;var t=getNumDaysInMonth(a,r);var n=t<e.day?t:e.day;return{month:a,year:r,day:n}};var getNextMonth=function(e){var a=e.month===12?1:e.month+1;var r=e.month===12?e.year+1:e.year;var t=getNumDaysInMonth(a,r);var n=t<e.day?t:e.day;return{month:a,year:r,day:n}};var changeYear=function(e,a){var r=e.month;var t=e.year+a;var n=getNumDaysInMonth(r,t);var o=n<e.day?n:e.day;return{month:r,year:t,day:o}};var getPreviousYear=function(e){return changeYear(e,-1)};var getNextYear=function(e){return changeYear(e,1)};var getInternalHourValue=function(e,a,r){if(a){return e}return convert12HourTo24Hour(e,r)};var calculateHourFromAMPM=function(e,a){var r=e.ampm,t=e.hour;var n=t;if(r==="am"&&a==="pm"){n=convert12HourTo24Hour(n,"pm")}else if(r==="pm"&&a==="am"){n=Math.abs(n-12)}return n};var validateParts=function(e,a,r){var t=e.month,n=e.day,o=e.year;var i=clampDate(Object.assign({},e),a,r);var u=getNumDaysInMonth(t,o);if(n!==null&&u<n){i.day=u}if(a!==undefined&&isSameDay(i,a)){if(i.hour!==undefined&&a.hour!==undefined){if(i.hour<a.hour){i.hour=a.hour;i.minute=a.minute}else if(i.hour===a.hour&&i.minute!==undefined&&a.minute!==undefined&&i.minute<a.minute){i.minute=a.minute}}}if(r!==undefined&&isSameDay(e,r)){if(i.hour!==undefined&&r.hour!==undefined){if(i.hour>r.hour){i.hour=r.hour;i.minute=r.minute}else if(i.hour===r.hour&&i.minute!==undefined&&r.minute!==undefined&&i.minute>r.minute){i.minute=r.minute}}}return i};var getClosestValidDate=function(e,a,r,t,n,o){var i=e.hour,u=e.minute,d=e.day,f=e.month,m=e.year;var s=Object.assign(Object.assign({},e),{dayOfWeek:undefined});if(a!==undefined){s.month=findClosestValue(f,a)}if(d!==null&&r!==undefined){s.day=findClosestValue(d,r)}if(t!==undefined){s.year=findClosestValue(m,t)}if(i!==undefined&&n!==undefined){s.hour=findClosestValue(i,n);s.ampm=parseAmPm(s.hour)}if(u!==undefined&&o!==undefined){s.minute=findClosestValue(u,o)}return s};var findClosestValue=function(e,a){var r=a[0];var t=Math.abs(r-e);for(var n=1;n<a.length;n++){var o=a[n];var i=Math.abs(o-e);if(i<t){r=o;t=i}}return r};var getFormattedDayPeriod=function(e){if(e===undefined){return""}return e.toUpperCase()};var getLocalizedTime=function(e,a,r){var t={hour:a.hour,minute:a.minute};if(t.hour===undefined||t.minute===undefined){return"Invalid Time"}return new Intl.DateTimeFormat(e,{hour:"numeric",minute:"numeric",timeZone:"UTC",hourCycle:r?"h23":"h12"}).format(new Date(convertDataToISO(Object.assign({year:2023,day:1,month:1},t))+"Z"))};var addTimePadding=function(e){var a=e.toString();if(a.length>1){return a}return"0".concat(a)};var getFormattedHour=function(e,a){if(a){return addTimePadding(e)}if(e===0){return"12"}return e.toString()};var generateDayAriaLabel=function(e,a,r){if(r.day===null){return null}var t=getNormalizedDate(r);var n=new Intl.DateTimeFormat(e,{weekday:"long",month:"long",day:"numeric",timeZone:"UTC"}).format(t);return a?"Today, ".concat(n):n};var getMonthAndDay=function(e,a){var r=getNormalizedDate(a);return new Intl.DateTimeFormat(e,{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"}).format(r)};var getMonthAndYear=function(e,a){var r=getNormalizedDate(a);return new Intl.DateTimeFormat(e,{month:"long",year:"numeric",timeZone:"UTC"}).format(r)};var getMonthDayAndYear=function(e,a){return getLocalizedDateTime(e,a,{month:"short",day:"numeric",year:"numeric"})};var getDay=function(e,a){return getLocalizedDateTimeParts(e,a,{day:"numeric"}).find((function(e){return e.type==="day"})).value};var getYear=function(e,a){return getLocalizedDateTime(e,a,{year:"numeric"})};var getNormalizedDate=function(e){var a,r,t;var n=e.hour!==undefined&&e.minute!==undefined?" ".concat(e.hour,":").concat(e.minute):"";return new Date("".concat((a=e.month)!==null&&a!==void 0?a:1,"/").concat((r=e.day)!==null&&r!==void 0?r:1,"/").concat((t=e.year)!==null&&t!==void 0?t:2023).concat(n," GMT+0000"))};var getLocalizedDateTime=function(e,a,r){var t=getNormalizedDate(a);return getDateTimeFormat(e,r).format(t)};var getLocalizedDateTimeParts=function(e,a,r){var t=getNormalizedDate(a);return getDateTimeFormat(e,r).formatToParts(t)};var getDateTimeFormat=function(e,a){return new Intl.DateTimeFormat(e,Object.assign(Object.assign({},a),{timeZone:"UTC"}))};var getTodayLabel=function(e){if("RelativeTimeFormat"in Intl){var a=new Intl.RelativeTimeFormat(e,{numeric:"auto"}).format(0,"day");return a.charAt(0).toUpperCase()+a.slice(1)}else{return"Today"}};var removeDateTzOffset=function(e){var a=e.getTimezoneOffset();e.setMinutes(e.getMinutes()-a);return e};var DATE_AM=removeDateTzOffset(new Date("2022T01:00"));var DATE_PM=removeDateTzOffset(new Date("2022T13:00"));var getLocalizedDayPeriod=function(e,a){var r=a==="am"?DATE_AM:DATE_PM;var t=new Intl.DateTimeFormat(e,{hour:"numeric",timeZone:"UTC"}).formatToParts(r).find((function(e){return e.type==="dayPeriod"}));if(t){return t.value}return getFormattedDayPeriod(a)};var formatValue=function(e){return Array.isArray(e)?e.join(","):e};var getToday=function(){return removeDateTzOffset(new Date).toISOString()};var minutes=[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,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];var hour12=[0,1,2,3,4,5,6,7,8,9,10,11];var 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];var getDaysOfWeek=function(e,a,r){if(r===void 0){r=0}var t=a==="ios"?"short":"narrow";var n=new Intl.DateTimeFormat(e,{weekday:t});var o=new Date("11/01/2020");var i=[];for(var u=r;u<r+7;u++){var d=new Date(o);d.setDate(d.getDate()+u);i.push(n.format(d))}return i};var getDaysOfMonth=function(e,a,r){var t=getNumDaysInMonth(e,a);var n=new Date("".concat(e,"/1/").concat(a)).getDay();var o=n>=r?n-(r+1):6-(r-n);var i=[];for(var u=1;u<=t;u++){i.push({day:u,dayOfWeek:(o+u)%7})}for(var u=0;u<=o;u++){i=__spreadArray([{day:null,dayOfWeek:null}],i,true)}return i};var generateTime=function(e,a,r,t,n,o){if(a===void 0){a="h12"}var i=a==="h23";var u=i?hour23:hour12;var d=minutes;var f=true;var m=true;if(n){u=u.filter((function(e){return n.includes(e)}))}if(o){d=d.filter((function(e){return o.includes(e)}))}if(r){if(isSameDay(e,r)){if(r.hour!==undefined){u=u.filter((function(a){var t=e.ampm==="pm"?(a+12)%24:a;return(i?a:t)>=r.hour}));f=r.hour<13}if(r.minute!==undefined){var s=false;if(r.hour!==undefined&&e.hour!==undefined){if(e.hour>r.hour){s=true}}d=d.filter((function(e){if(s){return true}return e>=r.minute}))}}else if(isBefore(e,r)){u=[];d=[];f=m=false}}if(t){if(isSameDay(e,t)){if(t.hour!==undefined){u=u.filter((function(a){var r=e.ampm==="pm"?(a+12)%24:a;return(i?a:r)<=t.hour}));m=t.hour>=12}if(t.minute!==undefined&&e.hour===t.hour){d=d.filter((function(e){return e<=t.minute}))}}else if(isAfter(e,t)){u=[];d=[];f=m=false}}return{hours:u,minutes:d,am:f,pm:m}};var generateMonths=function(e,a){var r={month:e.month,year:e.year,day:e.day};if(a!==undefined&&(e.month!==a.month||e.year!==a.year)){var t={month:a.month,year:a.year,day:a.day};var n=isBefore(t,r);return n?[t,r,getNextMonth(e)]:[getPreviousMonth(e),r,t]}return[getPreviousMonth(e),r,getNextMonth(e)]};var getMonthColumnData=function(e,a,r,t,n,o){if(o===void 0){o={month:"long"}}var i=a.year;var u=[];if(n!==undefined){var d=n;if((t===null||t===void 0?void 0:t.month)!==undefined){d=d.filter((function(e){return e<=t.month}))}if((r===null||r===void 0?void 0:r.month)!==undefined){d=d.filter((function(e){return e>=r.month}))}d.forEach((function(a){var r=new Date("".concat(a,"/1/").concat(i," GMT+0000"));var t=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(r);u.push({text:t,value:a})}))}else{var f=t&&t.year===i?t.month:12;var m=r&&r.year===i?r.month:1;for(var s=m;s<=f;s++){var v=new Date("".concat(s,"/1/").concat(i," GMT+0000"));var y=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(v);u.push({text:y,value:s})}}return u};var getDayColumnData=function(e,a,r,t,n,o){if(o===void 0){o={day:"numeric"}}var i=a.month,u=a.year;var d=[];var f=getNumDaysInMonth(i,u);var m=(t===null||t===void 0?void 0:t.day)!==null&&(t===null||t===void 0?void 0:t.day)!==undefined&&t.year===u&&t.month===i?t.day:f;var s=(r===null||r===void 0?void 0:r.day)!==null&&(r===null||r===void 0?void 0:r.day)!==undefined&&r.year===u&&r.month===i?r.day:1;if(n!==undefined){var v=n;v=v.filter((function(e){return e>=s&&e<=m}));v.forEach((function(a){var r=new Date("".concat(i,"/").concat(a,"/").concat(u," GMT+0000"));var t=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(r);d.push({text:t,value:a})}))}else{for(var y=s;y<=m;y++){var l=new Date("".concat(i,"/").concat(y,"/").concat(u," GMT+0000"));var c=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(l);d.push({text:c,value:y})}}return d};var getYearColumnData=function(e,a,r,t,n){var o,i;var u=[];if(n!==undefined){u=n;if((t===null||t===void 0?void 0:t.year)!==undefined){u=u.filter((function(e){return e<=t.year}))}if((r===null||r===void 0?void 0:r.year)!==undefined){u=u.filter((function(e){return e>=r.year}))}}else{var d=a.year;var f=(o=t===null||t===void 0?void 0:t.year)!==null&&o!==void 0?o:d;var m=(i=r===null||r===void 0?void 0:r.year)!==null&&i!==void 0?i:d-100;for(var s=m;s<=f;s++){u.push(s)}}return u.map((function(r){return{text:getYear(e,{year:r,month:a.month,day:a.day}),value:r}}))};var getAllMonthsInRange=function(e,a){if(e.month===a.month&&e.year===a.year){return[e]}return __spreadArray([e],getAllMonthsInRange(getNextMonth(e),a),true)};var getCombinedDateColumnData=function(e,a,r,t,n,o){var i=[];var u=[];var d=getAllMonthsInRange(r,t);if(o){d=d.filter((function(e){var a=e.month;return o.includes(a)}))}d.forEach((function(o){var d={month:o.month,day:null,year:o.year};var f=getDayColumnData(e,d,r,t,n,{month:"short",day:"numeric",weekday:"short"});var m=[];var s=[];f.forEach((function(r){var t=isSameDay(Object.assign(Object.assign({},d),{day:r.value}),a);s.push({text:t?getTodayLabel(e):r.text,value:"".concat(d.year,"-").concat(d.month,"-").concat(r.value)});m.push({month:d.month,year:d.year,day:r.value})}));u=__spreadArray(__spreadArray([],u,true),m,true);i=__spreadArray(__spreadArray([],i,true),s,true)}));return{parts:u,items:i}};var getTimeColumnsData=function(e,a,r,t,n,o,i){var u=is24Hour(e,r);var d=generateTime(a,u?"h23":"h12",t,n,o,i),f=d.hours,m=d.minutes,s=d.am,v=d.pm;var y=f.map((function(e){return{text:getFormattedHour(e,u),value:getInternalHourValue(e,u,a.ampm)}}));var l=m.map((function(e){return{text:addTimePadding(e),value:e}}));var c=[];if(s&&!u){c.push({text:getLocalizedDayPeriod(e,"am"),value:"am"})}if(v&&!u){c.push({text:getLocalizedDayPeriod(e,"pm"),value:"pm"})}return{minutesData:l,hoursData:y,dayPeriodData:c}};export{getDayColumnData as A,getYearColumnData as B,isMonthFirstLocale as C,getTimeColumnsData as D,isLocaleDayPeriodRTL as E,getDaysOfWeek as F,getMonthAndYear as G,getDaysOfMonth as H,generateMonths as I,is24Hour 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};