@pod-os/elements 0.7.0 → 0.7.1-2196a40.0

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 (409) hide show
  1. package/dist/cjs/{animation-5840e4df.js → animation-9bea118f.js} +115 -84
  2. package/dist/cjs/{app-globals-1aedd05c.js → app-globals-6352043e.js} +1 -1
  3. package/dist/cjs/{cubic-bezier-dcb7bfef.js → cubic-bezier-0b702a31.js} +13 -12
  4. package/dist/cjs/data-0c9489d7.js +1510 -0
  5. package/dist/cjs/dir-011f46ea.js +20 -0
  6. package/dist/cjs/elements.cjs.js +4 -4
  7. package/dist/cjs/focus-visible-2624ec15.js +76 -0
  8. package/dist/cjs/framework-delegate-437c0645.js +119 -0
  9. package/dist/cjs/{gesture-controller-fbbe9a65.js → gesture-controller-00a6b02f.js} +6 -2
  10. package/dist/cjs/{haptic-09e73337.js → haptic-7358cb0b.js} +37 -8
  11. package/dist/cjs/{hardware-back-button-01027575.js → hardware-back-button-25372ec7.js} +11 -8
  12. package/dist/cjs/{helpers-398ced09.js → helpers-cb08f5ae.js} +115 -15
  13. package/dist/cjs/{index-2067b305.js → index-1b07c737.js} +35 -24
  14. package/dist/cjs/{index-68ae43d2.js → index-2dc3637c.js} +34 -28
  15. package/dist/cjs/index-57b9fa9e.js +30 -0
  16. package/dist/cjs/{index-d01d9183.js → index-643851c6.js} +34 -19
  17. package/dist/cjs/index-731691ca.js +48 -0
  18. package/dist/cjs/{index-6bbae9b1.js → index-7d56774d.js} +12 -8
  19. package/dist/cjs/index-9fca5d6f.js +140 -0
  20. package/dist/cjs/index-b2a479e4.js +38 -0
  21. package/dist/cjs/{index-b4a9ece2.js → index-eaa0d16e.js} +7 -0
  22. package/dist/cjs/{tap-click-f24cb477.js → index-ed2ce04f.js} +37 -19
  23. package/dist/cjs/{input-shims-e959d9e2.js → input-shims-427999f7.js} +89 -38
  24. package/dist/cjs/ion-accordion-group.cjs.entry.js +205 -0
  25. package/dist/cjs/ion-accordion.cjs.entry.js +336 -0
  26. package/dist/cjs/ion-action-sheet_3.cjs.entry.js +865 -0
  27. package/dist/cjs/{ion-app_45.cjs.entry.js → ion-app_46.cjs.entry.js} +1694 -1406
  28. package/dist/cjs/ion-avatar.cjs.entry.js +2 -2
  29. package/dist/cjs/ion-back-button.cjs.entry.js +12 -11
  30. package/dist/cjs/ion-backdrop.cjs.entry.js +4 -4
  31. package/dist/cjs/ion-breadcrumb.cjs.entry.js +101 -0
  32. package/dist/cjs/ion-breadcrumbs.cjs.entry.js +133 -0
  33. package/dist/cjs/ion-buttons_3.cjs.entry.js +793 -0
  34. package/dist/cjs/ion-card-subtitle.cjs.entry.js +4 -4
  35. package/dist/cjs/{ion-list-header_3.cjs.entry.js → ion-checkbox_4.cjs.entry.js} +124 -23
  36. package/dist/cjs/ion-chip.cjs.entry.js +5 -10
  37. package/dist/cjs/ion-datetime-button.cjs.entry.js +346 -0
  38. package/dist/cjs/ion-datetime.cjs.entry.js +1548 -856
  39. package/dist/cjs/ion-fab-button.cjs.entry.js +26 -9
  40. package/dist/cjs/ion-fab-list.cjs.entry.js +4 -4
  41. package/dist/cjs/ion-fab.cjs.entry.js +15 -13
  42. package/dist/cjs/ion-img.cjs.entry.js +28 -4
  43. package/dist/cjs/ion-infinite-scroll-content.cjs.entry.js +5 -5
  44. package/dist/cjs/ion-infinite-scroll.cjs.entry.js +13 -13
  45. package/dist/cjs/ion-input.cjs.entry.js +57 -23
  46. package/dist/cjs/ion-item-option.cjs.entry.js +8 -8
  47. package/dist/cjs/ion-item-options.cjs.entry.js +5 -5
  48. package/dist/cjs/ion-item-sliding.cjs.entry.js +59 -63
  49. package/dist/cjs/ion-loading.cjs.entry.js +37 -36
  50. package/dist/cjs/ion-menu-button.cjs.entry.js +14 -12
  51. package/dist/cjs/ion-menu-toggle.cjs.entry.js +8 -7
  52. package/dist/cjs/ion-menu.cjs.entry.js +71 -57
  53. package/dist/cjs/ion-modal.cjs.entry.js +1384 -154
  54. package/dist/cjs/ion-nav-link.cjs.entry.js +5 -2
  55. package/dist/cjs/ion-nav.cjs.entry.js +177 -171
  56. package/dist/cjs/ion-picker-column.cjs.entry.js +25 -27
  57. package/dist/cjs/ion-picker.cjs.entry.js +22 -17
  58. package/dist/cjs/ion-popover.cjs.entry.js +1208 -182
  59. package/dist/cjs/ion-range.cjs.entry.js +137 -57
  60. package/dist/cjs/ion-refresher-content.cjs.entry.js +7 -12
  61. package/dist/cjs/ion-refresher.cjs.entry.js +150 -148
  62. package/dist/cjs/ion-reorder-group.cjs.entry.js +42 -35
  63. package/dist/cjs/ion-reorder.cjs.entry.js +5 -4
  64. package/dist/cjs/ion-route-redirect.cjs.entry.js +1 -1
  65. package/dist/cjs/ion-route.cjs.entry.js +1 -1
  66. package/dist/cjs/ion-router-link.cjs.entry.js +5 -5
  67. package/dist/cjs/ion-router-outlet.cjs.entry.js +24 -20
  68. package/dist/cjs/ion-router.cjs.entry.js +291 -194
  69. package/dist/cjs/ion-segment-button.cjs.entry.js +10 -17
  70. package/dist/cjs/ion-segment.cjs.entry.js +119 -26
  71. package/dist/cjs/ion-select-option.cjs.entry.js +3 -3
  72. package/dist/cjs/ion-select.cjs.entry.js +113 -78
  73. package/dist/cjs/ion-slide.cjs.entry.js +3 -3
  74. package/dist/cjs/ion-slides.cjs.entry.js +26 -27
  75. package/dist/cjs/ion-spinner.cjs.entry.js +10 -9
  76. package/dist/cjs/ion-split-pane.cjs.entry.js +16 -12
  77. package/dist/cjs/ion-tab-bar.cjs.entry.js +16 -23
  78. package/dist/cjs/ion-tab-button.cjs.entry.js +6 -6
  79. package/dist/cjs/ion-tab.cjs.entry.js +4 -4
  80. package/dist/cjs/ion-tabs.cjs.entry.js +4 -5
  81. package/dist/cjs/ion-text.cjs.entry.js +3 -3
  82. package/dist/cjs/ion-textarea.cjs.entry.js +31 -29
  83. package/dist/cjs/ion-thumbnail.cjs.entry.js +2 -2
  84. package/dist/cjs/ion-toast.cjs.entry.js +49 -59
  85. package/dist/cjs/ion-toggle.cjs.entry.js +41 -22
  86. package/dist/cjs/ion-virtual-scroll.cjs.entry.js +39 -31
  87. package/dist/cjs/{ionic-global-56e10eb5.js → ionic-global-f2d95fd3.js} +112 -93
  88. package/dist/cjs/{ios.transition-32e4623d.js → ios.transition-0f31ec9a.js} +78 -53
  89. package/dist/cjs/{keyboard-9e8103e4.js → keyboard-79afcba2.js} +6 -3
  90. package/dist/cjs/keyboard-controller-a934d106.js +42 -0
  91. package/dist/cjs/loader.cjs.js +4 -4
  92. package/dist/cjs/{md.transition-169c54f0.js → md.transition-d2a33a23.js} +15 -17
  93. package/dist/cjs/{menu-toggle-util-087678e0.js → menu-toggle-util-0a43ff7c.js} +5 -2
  94. package/dist/cjs/{overlays-49fe9ba7.js → overlays-65c716aa.js} +187 -71
  95. package/dist/cjs/spinner-configs-cd0abbeb.js +147 -0
  96. package/dist/cjs/{status-tap-ada894ff.js → status-tap-beaa3a71.js} +10 -5
  97. package/dist/cjs/{swipe-back-c4a778df.js → swipe-back-666ea8e6.js} +34 -15
  98. package/dist/cjs/test-component.cjs.entry.js +1 -1
  99. package/dist/cjs/{theme-2259d0f5.js → theme-fc63803b.js} +9 -5
  100. package/dist/collection/collection-manifest.json +7 -0
  101. package/dist/custom-elements/index.js +12689 -4785
  102. package/dist/custom-elements/{tap-click.js → index2.js} +36 -18
  103. package/dist/custom-elements/input-shims.js +87 -38
  104. package/dist/custom-elements/ios.transition.js +74 -50
  105. package/dist/custom-elements/md.transition.js +11 -14
  106. package/dist/custom-elements/status-tap.js +7 -4
  107. package/dist/custom-elements/swipe-back.js +31 -13
  108. package/dist/elements/elements.css +1 -1
  109. package/dist/elements/elements.esm.js +1 -1
  110. package/dist/elements/p-0268cbd3.entry.js +7 -0
  111. package/dist/elements/p-0587332d.entry.js +1 -0
  112. package/dist/elements/{p-cfc0e54d.js → p-0991c811.js} +3 -0
  113. package/dist/elements/p-0a69a563.entry.js +1 -0
  114. package/dist/elements/p-0b95be17.entry.js +1 -0
  115. package/dist/elements/p-0d284fe0.entry.js +1 -0
  116. package/dist/elements/p-0fd77b33.entry.js +1 -0
  117. package/dist/elements/p-120dec2b.entry.js +1 -0
  118. package/dist/elements/p-12880671.entry.js +1 -0
  119. package/dist/elements/p-14ccd586.entry.js +1 -0
  120. package/dist/elements/{p-83d45051.entry.js → p-14df6ac0.entry.js} +1 -1
  121. package/dist/elements/{p-e860be6a.entry.js → p-17079f06.entry.js} +1 -1
  122. package/dist/elements/p-19e4a688.js +4 -0
  123. package/dist/elements/p-1afc4eb4.js +4 -0
  124. package/dist/elements/p-1beaf6bf.js +4 -0
  125. package/dist/elements/p-1d1c6a6f.entry.js +1 -0
  126. package/dist/elements/{p-31d30e42.entry.js → p-1d98f84b.entry.js} +1 -1
  127. package/dist/elements/p-278ca4c9.js +4 -0
  128. package/dist/elements/p-27f5629c.entry.js +1 -0
  129. package/dist/elements/p-29c0f03f.js +4 -0
  130. package/dist/elements/p-2da59aca.js +4 -0
  131. package/dist/elements/p-3152143f.js +4 -0
  132. package/dist/elements/p-343ff720.entry.js +7 -0
  133. package/dist/elements/p-36d4c9a8.js +4 -0
  134. package/dist/elements/p-3a30dfb2.entry.js +1 -0
  135. package/dist/elements/p-3c013bf1.entry.js +1 -0
  136. package/dist/elements/{p-74ba1e42.entry.js → p-3c318da5.entry.js} +1 -1
  137. package/dist/elements/p-3cee3222.entry.js +1 -0
  138. package/dist/elements/p-480b3c4f.entry.js +1 -0
  139. package/dist/elements/p-4e9d8f18.entry.js +1 -0
  140. package/dist/elements/p-53e23176.js +2 -0
  141. package/dist/elements/p-548524f3.js +4 -0
  142. package/dist/elements/p-5739fa41.entry.js +1 -0
  143. package/dist/elements/p-5808c505.js +1 -0
  144. package/dist/elements/p-58a8cc2a.js +4 -0
  145. package/dist/elements/p-6035415e.entry.js +1 -0
  146. package/dist/elements/p-60eeae90.js +4 -0
  147. package/dist/elements/p-610b03ff.entry.js +4 -0
  148. package/dist/elements/p-67777478.entry.js +1 -0
  149. package/dist/elements/p-6ab826e1.entry.js +1 -0
  150. package/dist/elements/p-6f5a2827.entry.js +1 -0
  151. package/dist/elements/p-779676c5.entry.js +1 -0
  152. package/dist/elements/p-7916ecc5.entry.js +1 -0
  153. package/dist/elements/p-79f06b80.entry.js +1 -0
  154. package/dist/elements/p-7b5991c1.entry.js +1 -0
  155. package/dist/elements/p-7d0def79.js +5 -0
  156. package/dist/elements/p-8112afea.js +4 -0
  157. package/dist/elements/p-83678d7d.entry.js +4 -0
  158. package/dist/elements/p-87e45c94.entry.js +1 -0
  159. package/dist/elements/p-8da6a31e.entry.js +1 -0
  160. package/dist/elements/p-8f80768f.entry.js +4 -0
  161. package/dist/elements/p-8fe0433b.js +4 -0
  162. package/dist/elements/{p-4cb27b48.entry.js → p-9147d82b.entry.js} +1 -1
  163. package/dist/elements/p-97abb434.entry.js +1 -0
  164. package/dist/elements/p-98497a4b.entry.js +1 -0
  165. package/dist/elements/p-9c719139.js +4 -0
  166. package/dist/elements/p-9ca37332.js +4 -0
  167. package/dist/elements/{p-37de7110.js → p-9d48def2.js} +3 -0
  168. package/dist/elements/p-a79a6ad9.entry.js +79 -0
  169. package/dist/elements/p-a805f2f9.entry.js +1 -0
  170. package/dist/elements/p-a86a5bfa.entry.js +1 -0
  171. package/dist/elements/{p-9c1dbe52.entry.js → p-ac34eab7.entry.js} +1 -1
  172. package/dist/elements/p-ad366eab.entry.js +4 -0
  173. package/dist/elements/p-aef3a931.js +7 -0
  174. package/dist/elements/p-b0537eb3.entry.js +1 -0
  175. package/dist/elements/p-b337f3b8.js +4 -0
  176. package/dist/elements/p-b34bf73f.entry.js +7 -0
  177. package/dist/elements/p-b41e66f0.entry.js +1 -0
  178. package/dist/elements/p-b47e7091.entry.js +1 -0
  179. package/dist/elements/p-b840320e.js +4 -0
  180. package/dist/elements/p-b934ac5d.entry.js +1 -0
  181. package/dist/elements/p-b98314e0.entry.js +4 -0
  182. package/dist/elements/p-bd12806f.entry.js +1 -0
  183. package/dist/elements/p-c16d38d5.js +4 -0
  184. package/dist/elements/p-c84205a3.js +4 -0
  185. package/dist/elements/{p-06675ac7.entry.js → p-cbe318f8.entry.js} +1 -1
  186. package/dist/elements/p-cfed7395.js +4 -0
  187. package/dist/elements/p-d22a1dc7.entry.js +7 -0
  188. package/dist/elements/p-d3e75c94.entry.js +1 -0
  189. package/dist/elements/p-d8f6d3ce.entry.js +14 -0
  190. package/dist/elements/p-d9880221.entry.js +4 -0
  191. package/dist/elements/p-da5db8fb.entry.js +1 -0
  192. package/dist/elements/{p-91fe653f.js → p-dcc6b03c.js} +3 -0
  193. package/dist/elements/{p-305e246c.entry.js → p-dd846020.entry.js} +1 -1
  194. package/dist/elements/p-df240b2a.entry.js +4 -0
  195. package/dist/elements/p-dffd8689.js +4 -0
  196. package/dist/elements/p-e495a095.js +4 -0
  197. package/dist/elements/p-e5fc7d42.entry.js +1 -0
  198. package/dist/elements/{p-aaa8393e.entry.js → p-eb137e9d.entry.js} +1 -1
  199. package/dist/elements/p-f4e54a17.js +7 -0
  200. package/dist/elements/p-f67d0717.entry.js +1 -0
  201. package/dist/elements/p-f7f4c640.js +1 -0
  202. package/dist/elements/p-f851b91a.js +4 -0
  203. package/dist/elements/p-fb27ee76.entry.js +1 -0
  204. package/dist/elements/p-fbddca35.entry.js +1 -0
  205. package/dist/elements/p-fc1df8e0.entry.js +7 -0
  206. package/dist/elements/p-fdac5f3a.js +4 -0
  207. package/dist/esm/{animation-fe6ed422.js → animation-801a007a.js} +115 -84
  208. package/dist/esm/{app-globals-27d92837.js → app-globals-05a3abfb.js} +1 -1
  209. package/dist/esm/{cubic-bezier-108b8579.js → cubic-bezier-538b6253.js} +13 -12
  210. package/dist/esm/data-62c81c24.js +1463 -0
  211. package/dist/esm/dir-defb16c6.js +18 -0
  212. package/dist/esm/elements.js +4 -4
  213. package/dist/esm/focus-visible-78d55799.js +74 -0
  214. package/dist/esm/framework-delegate-7e2b767b.js +115 -0
  215. package/dist/esm/{gesture-controller-8f35af24.js → gesture-controller-c466ff14.js} +6 -2
  216. package/dist/esm/{haptic-c424e670.js → haptic-e7d5ef4d.js} +38 -9
  217. package/dist/esm/{hardware-back-button-bb4c578a.js → hardware-back-button-242191a7.js} +11 -8
  218. package/dist/esm/{helpers-44e3bd9f.js → helpers-aeff219b.js} +113 -16
  219. package/dist/esm/index-0dbaca1a.js +28 -0
  220. package/dist/esm/index-1f3d8582.js +34 -0
  221. package/dist/esm/{index-97199683.js → index-2be9a18b.js} +34 -28
  222. package/dist/esm/{index-8d682224.js → index-51e4a829.js} +12 -8
  223. package/dist/esm/{index-8a463a85.js → index-6048aed6.js} +35 -24
  224. package/dist/esm/index-65ecd543.js +25 -0
  225. package/dist/esm/{tap-click-a7e55ef5.js → index-b212db1c.js} +37 -19
  226. package/dist/esm/{index-e4deec27.js → index-cb938ffb.js} +7 -1
  227. package/dist/esm/{index-3a1bd803.js → index-d39eb62b.js} +35 -20
  228. package/dist/esm/index-ebf7f059.js +128 -0
  229. package/dist/esm/{input-shims-3b48722f.js → input-shims-8a389148.js} +89 -38
  230. package/dist/esm/ion-accordion-group.entry.js +201 -0
  231. package/dist/esm/ion-accordion.entry.js +332 -0
  232. package/dist/esm/ion-action-sheet_3.entry.js +859 -0
  233. package/dist/esm/{ion-app_45.entry.js → ion-app_46.entry.js} +1694 -1407
  234. package/dist/esm/ion-avatar.entry.js +2 -2
  235. package/dist/esm/ion-back-button.entry.js +12 -11
  236. package/dist/esm/ion-backdrop.entry.js +4 -4
  237. package/dist/esm/ion-breadcrumb.entry.js +97 -0
  238. package/dist/esm/ion-breadcrumbs.entry.js +129 -0
  239. package/dist/esm/ion-buttons_3.entry.js +787 -0
  240. package/dist/esm/ion-card-subtitle.entry.js +4 -4
  241. package/dist/esm/{ion-list-header_3.entry.js → ion-checkbox_4.entry.js} +124 -24
  242. package/dist/esm/ion-chip.entry.js +5 -10
  243. package/dist/esm/ion-datetime-button.entry.js +342 -0
  244. package/dist/esm/ion-datetime.entry.js +1548 -856
  245. package/dist/esm/ion-fab-button.entry.js +26 -9
  246. package/dist/esm/ion-fab-list.entry.js +4 -4
  247. package/dist/esm/ion-fab.entry.js +15 -13
  248. package/dist/esm/ion-img.entry.js +28 -4
  249. package/dist/esm/ion-infinite-scroll-content.entry.js +5 -5
  250. package/dist/esm/ion-infinite-scroll.entry.js +13 -13
  251. package/dist/esm/ion-input.entry.js +57 -23
  252. package/dist/esm/ion-item-option.entry.js +8 -8
  253. package/dist/esm/ion-item-options.entry.js +5 -5
  254. package/dist/esm/ion-item-sliding.entry.js +59 -63
  255. package/dist/esm/ion-loading.entry.js +37 -36
  256. package/dist/esm/ion-menu-button.entry.js +14 -12
  257. package/dist/esm/ion-menu-toggle.entry.js +8 -7
  258. package/dist/esm/ion-menu.entry.js +71 -57
  259. package/dist/esm/ion-modal.entry.js +1375 -145
  260. package/dist/esm/ion-nav-link.entry.js +5 -2
  261. package/dist/esm/ion-nav.entry.js +177 -171
  262. package/dist/esm/ion-picker-column.entry.js +25 -27
  263. package/dist/esm/ion-picker.entry.js +22 -17
  264. package/dist/esm/ion-popover.entry.js +1208 -182
  265. package/dist/esm/ion-range.entry.js +137 -57
  266. package/dist/esm/ion-refresher-content.entry.js +7 -12
  267. package/dist/esm/ion-refresher.entry.js +149 -147
  268. package/dist/esm/ion-reorder-group.entry.js +42 -35
  269. package/dist/esm/ion-reorder.entry.js +5 -4
  270. package/dist/esm/ion-route-redirect.entry.js +1 -1
  271. package/dist/esm/ion-route.entry.js +1 -1
  272. package/dist/esm/ion-router-link.entry.js +5 -5
  273. package/dist/esm/ion-router-outlet.entry.js +24 -20
  274. package/dist/esm/ion-router.entry.js +291 -194
  275. package/dist/esm/ion-segment-button.entry.js +10 -17
  276. package/dist/esm/ion-segment.entry.js +119 -26
  277. package/dist/esm/ion-select-option.entry.js +3 -3
  278. package/dist/esm/ion-select.entry.js +113 -78
  279. package/dist/esm/ion-slide.entry.js +3 -3
  280. package/dist/esm/ion-slides.entry.js +26 -27
  281. package/dist/esm/ion-spinner.entry.js +10 -9
  282. package/dist/esm/ion-split-pane.entry.js +16 -12
  283. package/dist/esm/ion-tab-bar.entry.js +16 -23
  284. package/dist/esm/ion-tab-button.entry.js +6 -6
  285. package/dist/esm/ion-tab.entry.js +4 -4
  286. package/dist/esm/ion-tabs.entry.js +4 -5
  287. package/dist/esm/ion-text.entry.js +3 -3
  288. package/dist/esm/ion-textarea.entry.js +31 -29
  289. package/dist/esm/ion-thumbnail.entry.js +2 -2
  290. package/dist/esm/ion-toast.entry.js +49 -59
  291. package/dist/esm/ion-toggle.entry.js +41 -22
  292. package/dist/esm/ion-virtual-scroll.entry.js +39 -31
  293. package/dist/esm/{ionic-global-2e28f7c7.js → ionic-global-6cd57191.js} +112 -93
  294. package/dist/esm/{ios.transition-a783e3cd.js → ios.transition-bbd952f2.js} +78 -53
  295. package/dist/{custom-elements/keyboard.js → esm/keyboard-413afe04.js} +6 -3
  296. package/dist/esm/keyboard-controller-33693bc2.js +40 -0
  297. package/dist/esm/loader.js +4 -4
  298. package/dist/esm/{md.transition-5a4a8c82.js → md.transition-5170a6d3.js} +15 -17
  299. package/dist/esm/{menu-toggle-util-562dfc9c.js → menu-toggle-util-82bf888a.js} +5 -2
  300. package/dist/esm/{overlays-fc9a0625.js → overlays-0c7f05e1.js} +186 -71
  301. package/dist/esm/spinner-configs-cbcd1f62.js +145 -0
  302. package/dist/esm/{status-tap-69e62ad6.js → status-tap-ad757b8a.js} +10 -5
  303. package/dist/esm/swipe-back-7ef22876.js +69 -0
  304. package/dist/esm/test-component.entry.js +1 -1
  305. package/dist/esm/{theme-d21826a7.js → theme-7cf2cab0.js} +9 -5
  306. package/package.json +4 -5
  307. package/LICENSE +0 -21
  308. package/dist/cjs/button-active-c14dab31.js +0 -66
  309. package/dist/cjs/focus-visible-16c98640.js +0 -45
  310. package/dist/cjs/framework-delegate-c45292a3.js +0 -37
  311. package/dist/cjs/ion-action-sheet.cjs.entry.js +0 -265
  312. package/dist/cjs/ion-alert.cjs.entry.js +0 -456
  313. package/dist/cjs/ion-buttons.cjs.entry.js +0 -42
  314. package/dist/cjs/ion-checkbox.cjs.entry.js +0 -117
  315. package/dist/cjs/ion-note.cjs.entry.js +0 -29
  316. package/dist/cjs/ion-select-popover.cjs.entry.js +0 -35
  317. package/dist/cjs/spinner-configs-fb16b986.js +0 -112
  318. package/dist/custom-elements/focus-visible.js +0 -43
  319. package/dist/elements/p-03bda390.js +0 -1
  320. package/dist/elements/p-0be044f1.entry.js +0 -1
  321. package/dist/elements/p-119c7c6c.entry.js +0 -1
  322. package/dist/elements/p-14c7c3ea.entry.js +0 -1
  323. package/dist/elements/p-1d4a2c61.js +0 -1
  324. package/dist/elements/p-1d894ac4.entry.js +0 -1
  325. package/dist/elements/p-1dafa1ce.entry.js +0 -1
  326. package/dist/elements/p-23b89ccb.entry.js +0 -1
  327. package/dist/elements/p-2c03b9ab.entry.js +0 -1
  328. package/dist/elements/p-346985f2.js +0 -1
  329. package/dist/elements/p-360f1c62.entry.js +0 -1
  330. package/dist/elements/p-373e1f25.entry.js +0 -1
  331. package/dist/elements/p-40547acb.entry.js +0 -1
  332. package/dist/elements/p-40b68014.entry.js +0 -1
  333. package/dist/elements/p-42e4f702.entry.js +0 -1
  334. package/dist/elements/p-489807e5.js +0 -1
  335. package/dist/elements/p-4ad72d54.entry.js +0 -1
  336. package/dist/elements/p-4cca7b5e.entry.js +0 -1
  337. package/dist/elements/p-4f24d306.js +0 -1
  338. package/dist/elements/p-519d6a53.entry.js +0 -1
  339. package/dist/elements/p-536e8e52.entry.js +0 -1
  340. package/dist/elements/p-599bb53f.entry.js +0 -1
  341. package/dist/elements/p-5eb7a546.js +0 -1
  342. package/dist/elements/p-60df2bed.entry.js +0 -1
  343. package/dist/elements/p-65133e33.js +0 -1
  344. package/dist/elements/p-6693fce8.js +0 -1
  345. package/dist/elements/p-689bdcc1.entry.js +0 -1
  346. package/dist/elements/p-70713b3d.entry.js +0 -1
  347. package/dist/elements/p-707d5d76.js +0 -1
  348. package/dist/elements/p-7212b7f2.js +0 -1
  349. package/dist/elements/p-73992898.entry.js +0 -1
  350. package/dist/elements/p-792c1e0f.entry.js +0 -1
  351. package/dist/elements/p-7e5300af.js +0 -2
  352. package/dist/elements/p-8068987c.entry.js +0 -1
  353. package/dist/elements/p-83accf46.entry.js +0 -1
  354. package/dist/elements/p-86635d06.entry.js +0 -1
  355. package/dist/elements/p-874c2b44.js +0 -1
  356. package/dist/elements/p-89c12ce8.entry.js +0 -1
  357. package/dist/elements/p-8bcba3f7.entry.js +0 -1
  358. package/dist/elements/p-8c759f51.entry.js +0 -1
  359. package/dist/elements/p-8f945e6b.entry.js +0 -1
  360. package/dist/elements/p-9300ab6a.js +0 -1
  361. package/dist/elements/p-93cacd51.entry.js +0 -1
  362. package/dist/elements/p-9408d0b4.entry.js +0 -1
  363. package/dist/elements/p-98c79eda.js +0 -1
  364. package/dist/elements/p-99f8abed.js +0 -1
  365. package/dist/elements/p-9ca7e079.js +0 -1
  366. package/dist/elements/p-a4648b74.entry.js +0 -1
  367. package/dist/elements/p-aab0f63c.js +0 -1
  368. package/dist/elements/p-ad4e2295.entry.js +0 -1
  369. package/dist/elements/p-afb8f7d5.entry.js +0 -1
  370. package/dist/elements/p-b055ec44.js +0 -1
  371. package/dist/elements/p-b078d63b.entry.js +0 -1
  372. package/dist/elements/p-b3460325.entry.js +0 -1
  373. package/dist/elements/p-b5406b58.entry.js +0 -1
  374. package/dist/elements/p-b5ef0c91.entry.js +0 -1
  375. package/dist/elements/p-b6ba623e.entry.js +0 -1
  376. package/dist/elements/p-b9926d8b.entry.js +0 -1
  377. package/dist/elements/p-bfd4cfcd.entry.js +0 -1
  378. package/dist/elements/p-c08dd7d0.entry.js +0 -1
  379. package/dist/elements/p-c0db9c51.entry.js +0 -1
  380. package/dist/elements/p-c1e7fbfb.js +0 -1
  381. package/dist/elements/p-ca69d6c9.js +0 -1
  382. package/dist/elements/p-cc4cb1ac.entry.js +0 -1
  383. package/dist/elements/p-cf8a7031.entry.js +0 -1
  384. package/dist/elements/p-cff82b6f.js +0 -1
  385. package/dist/elements/p-d01009b8.entry.js +0 -67
  386. package/dist/elements/p-d6d1e65f.entry.js +0 -1
  387. package/dist/elements/p-d9462b66.entry.js +0 -1
  388. package/dist/elements/p-e2e0fee9.entry.js +0 -1
  389. package/dist/elements/p-e642b266.entry.js +0 -1
  390. package/dist/elements/p-e953934f.entry.js +0 -1
  391. package/dist/elements/p-f0474f46.js +0 -1
  392. package/dist/elements/p-f10a94f6.entry.js +0 -1
  393. package/dist/elements/p-f2426182.entry.js +0 -1
  394. package/dist/elements/p-f327fd21.js +0 -1
  395. package/dist/elements/p-f84987ee.js +0 -1
  396. package/dist/elements/p-f8a3367d.entry.js +0 -1
  397. package/dist/esm/button-active-fd9d6d91.js +0 -64
  398. package/dist/esm/focus-visible-edb28f19.js +0 -43
  399. package/dist/esm/framework-delegate-9cd8048f.js +0 -34
  400. package/dist/esm/ion-action-sheet.entry.js +0 -261
  401. package/dist/esm/ion-alert.entry.js +0 -452
  402. package/dist/esm/ion-buttons.entry.js +0 -38
  403. package/dist/esm/ion-checkbox.entry.js +0 -113
  404. package/dist/esm/ion-note.entry.js +0 -25
  405. package/dist/esm/ion-select-popover.entry.js +0 -31
  406. package/dist/esm/keyboard-e6abcb80.js +0 -125
  407. package/dist/esm/spinner-configs-aaf2a1a9.js +0 -110
  408. package/dist/esm/swipe-back-d84cfc8a.js +0 -50
  409. package/readme.md +0 -55
@@ -0,0 +1,1510 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-b2a479e4.js');
4
+
5
+ /*!
6
+ * (C) Ionic http://ionicframework.com - MIT License
7
+ */
8
+ /**
9
+ * Returns true if the selected day is equal to the reference day
10
+ */
11
+ const isSameDay = (baseParts, compareParts) => {
12
+ return (baseParts.month === compareParts.month && baseParts.day === compareParts.day && baseParts.year === compareParts.year);
13
+ };
14
+ /**
15
+ * Returns true is the selected day is before the reference day.
16
+ */
17
+ const isBefore = (baseParts, compareParts) => {
18
+ return !!(baseParts.year < compareParts.year ||
19
+ (baseParts.year === compareParts.year && baseParts.month < compareParts.month) ||
20
+ (baseParts.year === compareParts.year &&
21
+ baseParts.month === compareParts.month &&
22
+ baseParts.day !== null &&
23
+ baseParts.day < compareParts.day));
24
+ };
25
+ /**
26
+ * Returns true is the selected day is after the reference day.
27
+ */
28
+ const isAfter = (baseParts, compareParts) => {
29
+ return !!(baseParts.year > compareParts.year ||
30
+ (baseParts.year === compareParts.year && baseParts.month > compareParts.month) ||
31
+ (baseParts.year === compareParts.year &&
32
+ baseParts.month === compareParts.month &&
33
+ baseParts.day !== null &&
34
+ baseParts.day > compareParts.day));
35
+ };
36
+ const warnIfValueOutOfBounds = (value, min, max) => {
37
+ const valueArray = Array.isArray(value) ? value : [value];
38
+ for (const val of valueArray) {
39
+ if ((min !== undefined && isBefore(val, min)) || (max !== undefined && isAfter(val, max))) {
40
+ index.printIonWarning('The value provided to ion-datetime is out of bounds.\n\n' +
41
+ `Min: ${JSON.stringify(min)}\n` +
42
+ `Max: ${JSON.stringify(max)}\n` +
43
+ `Value: ${JSON.stringify(value)}`);
44
+ break;
45
+ }
46
+ }
47
+ };
48
+
49
+ /*!
50
+ * (C) Ionic http://ionicframework.com - MIT License
51
+ */
52
+ /**
53
+ * Determines if given year is a
54
+ * leap year. Returns `true` if year
55
+ * is a leap year. Returns `false`
56
+ * otherwise.
57
+ */
58
+ const isLeapYear = (year) => {
59
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
60
+ };
61
+ const is24Hour = (locale, hourCycle) => {
62
+ /**
63
+ * If developer has explicitly enabled h23 time
64
+ * then return early and do not look at the system default.
65
+ */
66
+ if (hourCycle !== undefined) {
67
+ return hourCycle === 'h23';
68
+ }
69
+ /**
70
+ * If hourCycle was not specified, check the locale
71
+ * that is set on the user's device. We first check the
72
+ * Intl.DateTimeFormat hourCycle option as developers can encode this
73
+ * option into the locale string. Example: `en-US-u-hc-h23`
74
+ */
75
+ const formatted = new Intl.DateTimeFormat(locale, { hour: 'numeric' });
76
+ const options = formatted.resolvedOptions();
77
+ if (options.hourCycle !== undefined) {
78
+ return options.hourCycle === 'h23';
79
+ }
80
+ /**
81
+ * If hourCycle is not specified (either through lack
82
+ * of browser support or locale information) then fall
83
+ * back to this slower hourCycle check.
84
+ */
85
+ const date = new Date('5/18/2021 00:00');
86
+ const parts = formatted.formatToParts(date);
87
+ const hour = parts.find((p) => p.type === 'hour');
88
+ if (!hour) {
89
+ throw new Error('Hour value not found from DateTimeFormat');
90
+ }
91
+ return hour.value === '00';
92
+ };
93
+ /**
94
+ * Given a date object, returns the number
95
+ * of days in that month.
96
+ * Month value begin at 1, not 0.
97
+ * i.e. January = month 1.
98
+ */
99
+ const getNumDaysInMonth = (month, year) => {
100
+ return month === 4 || month === 6 || month === 9 || month === 11
101
+ ? 30
102
+ : month === 2
103
+ ? isLeapYear(year)
104
+ ? 29
105
+ : 28
106
+ : 31;
107
+ };
108
+ /**
109
+ * Certain locales display month then year while
110
+ * others display year then month.
111
+ * We can use Intl.DateTimeFormat to determine
112
+ * the ordering for each locale.
113
+ * The formatOptions param can be used to customize
114
+ * which pieces of a date to compare against the month
115
+ * with. For example, some locales render dd/mm/yyyy
116
+ * while others render mm/dd/yyyy. This function can be
117
+ * used for variations of the same "month first" check.
118
+ */
119
+ const isMonthFirstLocale = (locale, formatOptions = {
120
+ month: 'numeric',
121
+ year: 'numeric',
122
+ }) => {
123
+ /**
124
+ * By setting month and year we guarantee that only
125
+ * month, year, and literal (slashes '/', for example)
126
+ * values are included in the formatToParts results.
127
+ *
128
+ * The ordering of the parts will be determined by
129
+ * the locale. So if the month is the first value,
130
+ * then we know month should be shown first. If the
131
+ * year is the first value, then we know year should be shown first.
132
+ *
133
+ * This ordering can be controlled by customizing the locale property.
134
+ */
135
+ const parts = new Intl.DateTimeFormat(locale, formatOptions).formatToParts(new Date());
136
+ return parts[0].type === 'month';
137
+ };
138
+ /**
139
+ * Determines if the given locale formats the day period (am/pm) to the
140
+ * left or right of the hour.
141
+ * @param locale The locale to check.
142
+ * @returns `true` if the locale formats the day period to the left of the hour.
143
+ */
144
+ const isLocaleDayPeriodRTL = (locale) => {
145
+ const parts = new Intl.DateTimeFormat(locale, { hour: 'numeric' }).formatToParts(new Date());
146
+ return parts[0].type === 'dayPeriod';
147
+ };
148
+
149
+ /*!
150
+ * (C) Ionic http://ionicframework.com - MIT License
151
+ */
152
+ const ISO_8601_REGEXP =
153
+ // eslint-disable-next-line no-useless-escape
154
+ /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
155
+ // eslint-disable-next-line no-useless-escape
156
+ const TIME_REGEXP = /^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
157
+ /**
158
+ * Use to convert a string of comma separated numbers or
159
+ * an array of numbers, and clean up any user input
160
+ */
161
+ const convertToArrayOfNumbers = (input) => {
162
+ if (input === undefined) {
163
+ return;
164
+ }
165
+ let processedInput = input;
166
+ if (typeof input === 'string') {
167
+ // convert the string to an array of strings
168
+ // auto remove any whitespace and [] characters
169
+ processedInput = input.replace(/\[|\]|\s/g, '').split(',');
170
+ }
171
+ let values;
172
+ if (Array.isArray(processedInput)) {
173
+ // ensure each value is an actual number in the returned array
174
+ values = processedInput.map((num) => parseInt(num, 10)).filter(isFinite);
175
+ }
176
+ else {
177
+ values = [processedInput];
178
+ }
179
+ return values;
180
+ };
181
+ /**
182
+ * Extracts date information
183
+ * from a .calendar-day element
184
+ * into DatetimeParts.
185
+ */
186
+ const getPartsFromCalendarDay = (el) => {
187
+ return {
188
+ month: parseInt(el.getAttribute('data-month'), 10),
189
+ day: parseInt(el.getAttribute('data-day'), 10),
190
+ year: parseInt(el.getAttribute('data-year'), 10),
191
+ dayOfWeek: parseInt(el.getAttribute('data-day-of-week'), 10),
192
+ };
193
+ };
194
+ function parseDate(val) {
195
+ if (Array.isArray(val)) {
196
+ return val.map((valStr) => parseDate(valStr));
197
+ }
198
+ // manually parse IS0 cuz Date.parse cannot be trusted
199
+ // ISO 8601 format: 1994-12-15T13:47:20Z
200
+ let parse = null;
201
+ if (val != null && val !== '') {
202
+ // try parsing for just time first, HH:MM
203
+ parse = TIME_REGEXP.exec(val);
204
+ if (parse) {
205
+ // adjust the array so it fits nicely with the datetime parse
206
+ parse.unshift(undefined, undefined);
207
+ parse[2] = parse[3] = undefined;
208
+ }
209
+ else {
210
+ // try parsing for full ISO datetime
211
+ parse = ISO_8601_REGEXP.exec(val);
212
+ }
213
+ }
214
+ if (parse === null) {
215
+ // wasn't able to parse the ISO datetime
216
+ return undefined;
217
+ }
218
+ // ensure all the parse values exist with at least 0
219
+ for (let i = 1; i < 8; i++) {
220
+ parse[i] = parse[i] !== undefined ? parseInt(parse[i], 10) : undefined;
221
+ }
222
+ let tzOffset = 0;
223
+ if (parse[9] && parse[10]) {
224
+ // hours
225
+ tzOffset = parseInt(parse[10], 10) * 60;
226
+ if (parse[11]) {
227
+ // minutes
228
+ tzOffset += parseInt(parse[11], 10);
229
+ }
230
+ if (parse[9] === '-') {
231
+ // + or -
232
+ tzOffset *= -1;
233
+ }
234
+ }
235
+ // can also get second and millisecond from parse[6] and parse[7] if needed
236
+ return {
237
+ year: parse[1],
238
+ month: parse[2],
239
+ day: parse[3],
240
+ hour: parse[4],
241
+ minute: parse[5],
242
+ tzOffset,
243
+ ampm: parse[4] < 12 ? 'am' : 'pm',
244
+ };
245
+ }
246
+ const clampDate = (dateParts, minParts, maxParts) => {
247
+ if (minParts && isBefore(dateParts, minParts)) {
248
+ return minParts;
249
+ }
250
+ else if (maxParts && isAfter(dateParts, maxParts)) {
251
+ return maxParts;
252
+ }
253
+ return dateParts;
254
+ };
255
+ /**
256
+ * Parses an hour and returns if the value is in the morning (am) or afternoon (pm).
257
+ * @param hour The hour to format, should be 0-23
258
+ * @returns `pm` if the hour is greater than or equal to 12, `am` if less than 12.
259
+ */
260
+ const parseAmPm = (hour) => {
261
+ return hour >= 12 ? 'pm' : 'am';
262
+ };
263
+ /**
264
+ * Takes a max date string and creates a DatetimeParts
265
+ * object, filling in any missing information.
266
+ * For example, max="2012" would fill in the missing
267
+ * month, day, hour, and minute information.
268
+ */
269
+ const parseMaxParts = (max, todayParts) => {
270
+ const { month, day, year, hour, minute } = parseDate(max);
271
+ /**
272
+ * When passing in `max` or `min`, developers
273
+ * can pass in any ISO-8601 string. This means
274
+ * that not all of the date/time fields are defined.
275
+ * For example, passing max="2012" is valid even though
276
+ * there is no month, day, hour, or minute data.
277
+ * However, all of this data is required when clamping the date
278
+ * so that the correct initial value can be selected. As a result,
279
+ * we need to fill in any omitted data with the min or max values.
280
+ */
281
+ const yearValue = year !== null && year !== void 0 ? year : todayParts.year;
282
+ const monthValue = month !== null && month !== void 0 ? month : 12;
283
+ return {
284
+ month: monthValue,
285
+ day: day !== null && day !== void 0 ? day : getNumDaysInMonth(monthValue, yearValue),
286
+ /**
287
+ * Passing in "HH:mm" is a valid ISO-8601
288
+ * string, so we just default to the current year
289
+ * in this case.
290
+ */
291
+ year: yearValue,
292
+ hour: hour !== null && hour !== void 0 ? hour : 23,
293
+ minute: minute !== null && minute !== void 0 ? minute : 59,
294
+ };
295
+ };
296
+ /**
297
+ * Takes a min date string and creates a DatetimeParts
298
+ * object, filling in any missing information.
299
+ * For example, min="2012" would fill in the missing
300
+ * month, day, hour, and minute information.
301
+ */
302
+ const parseMinParts = (min, todayParts) => {
303
+ const { month, day, year, hour, minute } = parseDate(min);
304
+ /**
305
+ * When passing in `max` or `min`, developers
306
+ * can pass in any ISO-8601 string. This means
307
+ * that not all of the date/time fields are defined.
308
+ * For example, passing max="2012" is valid even though
309
+ * there is no month, day, hour, or minute data.
310
+ * However, all of this data is required when clamping the date
311
+ * so that the correct initial value can be selected. As a result,
312
+ * we need to fill in any omitted data with the min or max values.
313
+ */
314
+ return {
315
+ month: month !== null && month !== void 0 ? month : 1,
316
+ day: day !== null && day !== void 0 ? day : 1,
317
+ /**
318
+ * Passing in "HH:mm" is a valid ISO-8601
319
+ * string, so we just default to the current year
320
+ * in this case.
321
+ */
322
+ year: year !== null && year !== void 0 ? year : todayParts.year,
323
+ hour: hour !== null && hour !== void 0 ? hour : 0,
324
+ minute: minute !== null && minute !== void 0 ? minute : 0,
325
+ };
326
+ };
327
+
328
+ /*!
329
+ * (C) Ionic http://ionicframework.com - MIT License
330
+ */
331
+ const twoDigit = (val) => {
332
+ return ('0' + (val !== undefined ? Math.abs(val) : '0')).slice(-2);
333
+ };
334
+ const fourDigit = (val) => {
335
+ return ('000' + (val !== undefined ? Math.abs(val) : '0')).slice(-4);
336
+ };
337
+ function convertDataToISO(data) {
338
+ if (Array.isArray(data)) {
339
+ return data.map((parts) => convertDataToISO(parts));
340
+ }
341
+ // https://www.w3.org/TR/NOTE-datetime
342
+ let rtn = '';
343
+ if (data.year !== undefined) {
344
+ // YYYY
345
+ rtn = fourDigit(data.year);
346
+ if (data.month !== undefined) {
347
+ // YYYY-MM
348
+ rtn += '-' + twoDigit(data.month);
349
+ if (data.day !== undefined) {
350
+ // YYYY-MM-DD
351
+ rtn += '-' + twoDigit(data.day);
352
+ if (data.hour !== undefined) {
353
+ // YYYY-MM-DDTHH:mm:SS
354
+ rtn += `T${twoDigit(data.hour)}:${twoDigit(data.minute)}:00`;
355
+ if (data.tzOffset === undefined) {
356
+ // YYYY-MM-DDTHH:mm:SSZ
357
+ rtn += 'Z';
358
+ }
359
+ else {
360
+ // YYYY-MM-DDTHH:mm:SS+/-HH:mm
361
+ rtn +=
362
+ (data.tzOffset > 0 ? '+' : '-') +
363
+ twoDigit(Math.floor(Math.abs(data.tzOffset / 60))) +
364
+ ':' +
365
+ twoDigit(data.tzOffset % 60);
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+ else if (data.hour !== undefined) {
372
+ // HH:mm
373
+ rtn = twoDigit(data.hour) + ':' + twoDigit(data.minute);
374
+ }
375
+ return rtn;
376
+ }
377
+ /**
378
+ * Converts an 12 hour value to 24 hours.
379
+ */
380
+ const convert12HourTo24Hour = (hour, ampm) => {
381
+ if (ampm === undefined) {
382
+ return hour;
383
+ }
384
+ /**
385
+ * If AM and 12am
386
+ * then return 00:00.
387
+ * Otherwise just return
388
+ * the hour since it is
389
+ * already in 24 hour format.
390
+ */
391
+ if (ampm === 'am') {
392
+ if (hour === 12) {
393
+ return 0;
394
+ }
395
+ return hour;
396
+ }
397
+ /**
398
+ * If PM and 12pm
399
+ * just return 12:00
400
+ * since it is already
401
+ * in 24 hour format.
402
+ * Otherwise add 12 hours
403
+ * to the time.
404
+ */
405
+ if (hour === 12) {
406
+ return 12;
407
+ }
408
+ return hour + 12;
409
+ };
410
+ const getStartOfWeek = (refParts) => {
411
+ const { dayOfWeek } = refParts;
412
+ if (dayOfWeek === null || dayOfWeek === undefined) {
413
+ throw new Error('No day of week provided');
414
+ }
415
+ return subtractDays(refParts, dayOfWeek);
416
+ };
417
+ const getEndOfWeek = (refParts) => {
418
+ const { dayOfWeek } = refParts;
419
+ if (dayOfWeek === null || dayOfWeek === undefined) {
420
+ throw new Error('No day of week provided');
421
+ }
422
+ return addDays(refParts, 6 - dayOfWeek);
423
+ };
424
+ const getNextDay = (refParts) => {
425
+ return addDays(refParts, 1);
426
+ };
427
+ const getPreviousDay = (refParts) => {
428
+ return subtractDays(refParts, 1);
429
+ };
430
+ const getPreviousWeek = (refParts) => {
431
+ return subtractDays(refParts, 7);
432
+ };
433
+ const getNextWeek = (refParts) => {
434
+ return addDays(refParts, 7);
435
+ };
436
+ /**
437
+ * Given datetime parts, subtract
438
+ * numDays from the date.
439
+ * Returns a new DatetimeParts object
440
+ * Currently can only go backward at most 1 month.
441
+ */
442
+ const subtractDays = (refParts, numDays) => {
443
+ const { month, day, year } = refParts;
444
+ if (day === null) {
445
+ throw new Error('No day provided');
446
+ }
447
+ const workingParts = {
448
+ month,
449
+ day,
450
+ year,
451
+ };
452
+ workingParts.day = day - numDays;
453
+ /**
454
+ * If wrapping to previous month
455
+ * update days and decrement month
456
+ */
457
+ if (workingParts.day < 1) {
458
+ workingParts.month -= 1;
459
+ }
460
+ /**
461
+ * If moving to previous year, reset
462
+ * month to December and decrement year
463
+ */
464
+ if (workingParts.month < 1) {
465
+ workingParts.month = 12;
466
+ workingParts.year -= 1;
467
+ }
468
+ /**
469
+ * Determine how many days are in the current
470
+ * month
471
+ */
472
+ if (workingParts.day < 1) {
473
+ const daysInMonth = getNumDaysInMonth(workingParts.month, workingParts.year);
474
+ /**
475
+ * Take num days in month and add the
476
+ * number of underflow days. This number will
477
+ * be negative.
478
+ * Example: 1 week before Jan 2, 2021 is
479
+ * December 26, 2021 so:
480
+ * 2 - 7 = -5
481
+ * 31 + (-5) = 26
482
+ */
483
+ workingParts.day = daysInMonth + workingParts.day;
484
+ }
485
+ return workingParts;
486
+ };
487
+ /**
488
+ * Given datetime parts, add
489
+ * numDays to the date.
490
+ * Returns a new DatetimeParts object
491
+ * Currently can only go forward at most 1 month.
492
+ */
493
+ const addDays = (refParts, numDays) => {
494
+ const { month, day, year } = refParts;
495
+ if (day === null) {
496
+ throw new Error('No day provided');
497
+ }
498
+ const workingParts = {
499
+ month,
500
+ day,
501
+ year,
502
+ };
503
+ const daysInMonth = getNumDaysInMonth(month, year);
504
+ workingParts.day = day + numDays;
505
+ /**
506
+ * If wrapping to next month
507
+ * update days and increment month
508
+ */
509
+ if (workingParts.day > daysInMonth) {
510
+ workingParts.day -= daysInMonth;
511
+ workingParts.month += 1;
512
+ }
513
+ /**
514
+ * If moving to next year, reset
515
+ * month to January and increment year
516
+ */
517
+ if (workingParts.month > 12) {
518
+ workingParts.month = 1;
519
+ workingParts.year += 1;
520
+ }
521
+ return workingParts;
522
+ };
523
+ /**
524
+ * Given DatetimeParts, generate the previous month.
525
+ */
526
+ const getPreviousMonth = (refParts) => {
527
+ /**
528
+ * If current month is January, wrap backwards
529
+ * to December of the previous year.
530
+ */
531
+ const month = refParts.month === 1 ? 12 : refParts.month - 1;
532
+ const year = refParts.month === 1 ? refParts.year - 1 : refParts.year;
533
+ const numDaysInMonth = getNumDaysInMonth(month, year);
534
+ const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
535
+ return { month, year, day };
536
+ };
537
+ /**
538
+ * Given DatetimeParts, generate the next month.
539
+ */
540
+ const getNextMonth = (refParts) => {
541
+ /**
542
+ * If current month is December, wrap forwards
543
+ * to January of the next year.
544
+ */
545
+ const month = refParts.month === 12 ? 1 : refParts.month + 1;
546
+ const year = refParts.month === 12 ? refParts.year + 1 : refParts.year;
547
+ const numDaysInMonth = getNumDaysInMonth(month, year);
548
+ const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
549
+ return { month, year, day };
550
+ };
551
+ const changeYear = (refParts, yearDelta) => {
552
+ const month = refParts.month;
553
+ const year = refParts.year + yearDelta;
554
+ const numDaysInMonth = getNumDaysInMonth(month, year);
555
+ const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
556
+ return { month, year, day };
557
+ };
558
+ /**
559
+ * Given DatetimeParts, generate the previous year.
560
+ */
561
+ const getPreviousYear = (refParts) => {
562
+ return changeYear(refParts, -1);
563
+ };
564
+ /**
565
+ * Given DatetimeParts, generate the next year.
566
+ */
567
+ const getNextYear = (refParts) => {
568
+ return changeYear(refParts, 1);
569
+ };
570
+ /**
571
+ * If PM, then internal value should
572
+ * be converted to 24-hr time.
573
+ * Does not apply when public
574
+ * values are already 24-hr time.
575
+ */
576
+ const getInternalHourValue = (hour, use24Hour, ampm) => {
577
+ if (use24Hour) {
578
+ return hour;
579
+ }
580
+ return convert12HourTo24Hour(hour, ampm);
581
+ };
582
+ /**
583
+ * Unless otherwise stated, all month values are
584
+ * 1 indexed instead of the typical 0 index in JS Date.
585
+ * Example:
586
+ * January = Month 0 when using JS Date
587
+ * January = Month 1 when using this datetime util
588
+ */
589
+ /**
590
+ * Given the current datetime parts and a new AM/PM value
591
+ * calculate what the hour should be in 24-hour time format.
592
+ * Used when toggling the AM/PM segment since we store our hours
593
+ * in 24-hour time format internally.
594
+ */
595
+ const calculateHourFromAMPM = (currentParts, newAMPM) => {
596
+ const { ampm: currentAMPM, hour } = currentParts;
597
+ let newHour = hour;
598
+ /**
599
+ * If going from AM --> PM, need to update the
600
+ *
601
+ */
602
+ if (currentAMPM === 'am' && newAMPM === 'pm') {
603
+ newHour = convert12HourTo24Hour(newHour, 'pm');
604
+ /**
605
+ * If going from PM --> AM
606
+ */
607
+ }
608
+ else if (currentAMPM === 'pm' && newAMPM === 'am') {
609
+ newHour = Math.abs(newHour - 12);
610
+ }
611
+ return newHour;
612
+ };
613
+ /**
614
+ * Updates parts to ensure that month and day
615
+ * values are valid. For days that do not exist,
616
+ * the closest valid day is used.
617
+ */
618
+ const validateParts = (parts, minParts, maxParts) => {
619
+ const { month, day, year } = parts;
620
+ const partsCopy = Object.assign({}, parts);
621
+ const numDays = getNumDaysInMonth(month, year);
622
+ /**
623
+ * If the max number of days
624
+ * is greater than the day we want
625
+ * to set, update the DatetimeParts
626
+ * day field to be the max days.
627
+ */
628
+ if (day !== null && numDays < day) {
629
+ partsCopy.day = numDays;
630
+ }
631
+ /**
632
+ * If value is same day as min day,
633
+ * make sure the time value is in bounds.
634
+ */
635
+ if (minParts !== undefined && isSameDay(partsCopy, minParts)) {
636
+ /**
637
+ * If the hour is out of bounds,
638
+ * update both the hour and minute.
639
+ * This is done so that the new time
640
+ * is closest to what the user selected.
641
+ */
642
+ if (partsCopy.hour !== undefined && minParts.hour !== undefined) {
643
+ if (partsCopy.hour < minParts.hour) {
644
+ partsCopy.hour = minParts.hour;
645
+ partsCopy.minute = minParts.minute;
646
+ /**
647
+ * If only the minute is out of bounds,
648
+ * set it to the min minute.
649
+ */
650
+ }
651
+ else if (partsCopy.hour === minParts.hour &&
652
+ partsCopy.minute !== undefined &&
653
+ minParts.minute !== undefined &&
654
+ partsCopy.minute < minParts.minute) {
655
+ partsCopy.minute = minParts.minute;
656
+ }
657
+ }
658
+ }
659
+ /**
660
+ * If value is same day as max day,
661
+ * make sure the time value is in bounds.
662
+ */
663
+ if (maxParts !== undefined && isSameDay(parts, maxParts)) {
664
+ /**
665
+ * If the hour is out of bounds,
666
+ * update both the hour and minute.
667
+ * This is done so that the new time
668
+ * is closest to what the user selected.
669
+ */
670
+ if (partsCopy.hour !== undefined && maxParts.hour !== undefined) {
671
+ if (partsCopy.hour > maxParts.hour) {
672
+ partsCopy.hour = maxParts.hour;
673
+ partsCopy.minute = maxParts.minute;
674
+ /**
675
+ * If only the minute is out of bounds,
676
+ * set it to the max minute.
677
+ */
678
+ }
679
+ else if (partsCopy.hour === maxParts.hour &&
680
+ partsCopy.minute !== undefined &&
681
+ maxParts.minute !== undefined &&
682
+ partsCopy.minute > maxParts.minute) {
683
+ partsCopy.minute = maxParts.minute;
684
+ }
685
+ }
686
+ }
687
+ return partsCopy;
688
+ };
689
+ /**
690
+ * Returns the closest date to refParts
691
+ * that also meets the constraints of
692
+ * the *Values params.
693
+ * @param refParts The reference date
694
+ * @param monthValues The allowed month values
695
+ * @param dayValues The allowed day (of the month) values
696
+ * @param yearValues The allowed year values
697
+ * @param hourValues The allowed hour values
698
+ * @param minuteValues The allowed minute values
699
+ */
700
+ const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
701
+ const { hour, minute, day, month, year } = refParts;
702
+ const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
703
+ if (monthValues !== undefined) {
704
+ copyParts.month = findClosestValue(month, monthValues);
705
+ }
706
+ // Day is nullable but cannot be undefined
707
+ if (day !== null && dayValues !== undefined) {
708
+ copyParts.day = findClosestValue(day, dayValues);
709
+ }
710
+ if (yearValues !== undefined) {
711
+ copyParts.year = findClosestValue(year, yearValues);
712
+ }
713
+ if (hour !== undefined && hourValues !== undefined) {
714
+ copyParts.hour = findClosestValue(hour, hourValues);
715
+ copyParts.ampm = parseAmPm(copyParts.hour);
716
+ }
717
+ if (minute !== undefined && minuteValues !== undefined) {
718
+ copyParts.minute = findClosestValue(minute, minuteValues);
719
+ }
720
+ return copyParts;
721
+ };
722
+ /**
723
+ * Finds the value in "values" that is
724
+ * numerically closest to "reference".
725
+ * This function assumes that "values" is
726
+ * already sorted in ascending order.
727
+ * @param reference The reference number to use
728
+ * when finding the closest value
729
+ * @param values The allowed values that will be
730
+ * searched to find the closest value to "reference"
731
+ */
732
+ const findClosestValue = (reference, values) => {
733
+ let closestValue = values[0];
734
+ let rank = Math.abs(closestValue - reference);
735
+ for (let i = 1; i < values.length; i++) {
736
+ const value = values[i];
737
+ /**
738
+ * This code prioritizes the first
739
+ * closest result. Given two values
740
+ * with the same distance from reference,
741
+ * this code will prioritize the smaller of
742
+ * the two values.
743
+ */
744
+ const valueRank = Math.abs(value - reference);
745
+ if (valueRank < rank) {
746
+ closestValue = value;
747
+ rank = valueRank;
748
+ }
749
+ }
750
+ return closestValue;
751
+ };
752
+
753
+ /*!
754
+ * (C) Ionic http://ionicframework.com - MIT License
755
+ */
756
+ const getFormattedDayPeriod = (dayPeriod) => {
757
+ if (dayPeriod === undefined) {
758
+ return '';
759
+ }
760
+ return dayPeriod.toUpperCase();
761
+ };
762
+ const getLocalizedTime = (locale, refParts, use24Hour) => {
763
+ if (refParts.hour === undefined || refParts.minute === undefined) {
764
+ return 'Invalid Time';
765
+ }
766
+ return new Intl.DateTimeFormat(locale, {
767
+ hour: 'numeric',
768
+ minute: 'numeric',
769
+ timeZone: 'UTC',
770
+ /**
771
+ * We use hourCycle here instead of hour12 due to:
772
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
773
+ */
774
+ hourCycle: use24Hour ? 'h23' : 'h12',
775
+ }).format(new Date(convertDataToISO(Object.assign(Object.assign({}, refParts), {
776
+ // TODO: FW-1831 will remove the need to manually set the tzOffset to undefined
777
+ tzOffset: undefined
778
+ }))));
779
+ };
780
+ /**
781
+ * Adds padding to a time value so
782
+ * that it is always 2 digits.
783
+ */
784
+ const addTimePadding = (value) => {
785
+ const valueToString = value.toString();
786
+ if (valueToString.length > 1) {
787
+ return valueToString;
788
+ }
789
+ return `0${valueToString}`;
790
+ };
791
+ /**
792
+ * Formats 24 hour times so that
793
+ * it always has 2 digits. For
794
+ * 12 hour times it ensures that
795
+ * hour 0 is formatted as '12'.
796
+ */
797
+ const getFormattedHour = (hour, use24Hour) => {
798
+ if (use24Hour) {
799
+ return addTimePadding(hour);
800
+ }
801
+ /**
802
+ * If using 12 hour
803
+ * format, make sure hour
804
+ * 0 is formatted as '12'.
805
+ */
806
+ if (hour === 0) {
807
+ return '12';
808
+ }
809
+ return hour.toString();
810
+ };
811
+ /**
812
+ * Generates an aria-label to be read by screen readers
813
+ * given a local, a date, and whether or not that date is
814
+ * today's date.
815
+ */
816
+ const generateDayAriaLabel = (locale, today, refParts) => {
817
+ if (refParts.day === null) {
818
+ return null;
819
+ }
820
+ /**
821
+ * MM/DD/YYYY will return midnight in the user's timezone.
822
+ */
823
+ const date = new Date(`${refParts.month}/${refParts.day}/${refParts.year} GMT+0000`);
824
+ const labelString = new Intl.DateTimeFormat(locale, {
825
+ weekday: 'long',
826
+ month: 'long',
827
+ day: 'numeric',
828
+ timeZone: 'UTC',
829
+ }).format(date);
830
+ /**
831
+ * If date is today, prepend "Today" so screen readers indicate
832
+ * that the date is today.
833
+ */
834
+ return today ? `Today, ${labelString}` : labelString;
835
+ };
836
+ /**
837
+ * Gets the day of the week, month, and day
838
+ * Used for the header in MD mode.
839
+ */
840
+ const getMonthAndDay = (locale, refParts) => {
841
+ const date = new Date(`${refParts.month}/${refParts.day}/${refParts.year} GMT+0000`);
842
+ return new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' }).format(date);
843
+ };
844
+ /**
845
+ * Given a locale and a date object,
846
+ * return a formatted string that includes
847
+ * the month name and full year.
848
+ * Example: May 2021
849
+ */
850
+ const getMonthAndYear = (locale, refParts) => {
851
+ const date = new Date(`${refParts.month}/${refParts.day}/${refParts.year} GMT+0000`);
852
+ return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(date);
853
+ };
854
+ /**
855
+ * Given a locale and a date object,
856
+ * return a formatted string that includes
857
+ * the short month, numeric day, and full year.
858
+ * Example: Apr 22, 2021
859
+ */
860
+ const getMonthDayAndYear = (locale, refParts) => {
861
+ return getLocalizedDateTime(locale, refParts, { month: 'short', day: 'numeric', year: 'numeric' });
862
+ };
863
+ /**
864
+ * Given a locale and a date object,
865
+ * return a formatted string that includes
866
+ * the numeric day.
867
+ * Note: Some languages will add literal characters
868
+ * to the end. This function removes those literals.
869
+ * Example: 29
870
+ */
871
+ const getDay = (locale, refParts) => {
872
+ return getLocalizedDateTimeParts(locale, refParts, { day: 'numeric' }).find((obj) => obj.type === 'day').value;
873
+ };
874
+ /**
875
+ * Given a locale and a date object,
876
+ * return a formatted string that includes
877
+ * the numeric year.
878
+ * Example: 2022
879
+ */
880
+ const getYear = (locale, refParts) => {
881
+ return getLocalizedDateTime(locale, refParts, { year: 'numeric' });
882
+ };
883
+ const getNormalizedDate = (refParts) => {
884
+ const timeString = refParts.hour !== undefined && refParts.minute !== undefined ? ` ${refParts.hour}:${refParts.minute}` : '';
885
+ return new Date(`${refParts.month}/${refParts.day}/${refParts.year}${timeString} GMT+0000`);
886
+ };
887
+ /**
888
+ * Given a locale, DatetimeParts, and options
889
+ * format the DatetimeParts according to the options
890
+ * and locale combination. This returns a string. If
891
+ * you want an array of the individual pieces
892
+ * that make up the localized date string, use
893
+ * getLocalizedDateTimeParts.
894
+ */
895
+ const getLocalizedDateTime = (locale, refParts, options) => {
896
+ const date = getNormalizedDate(refParts);
897
+ return getDateTimeFormat(locale, options).format(date);
898
+ };
899
+ /**
900
+ * Given a locale, DatetimeParts, and options
901
+ * format the DatetimeParts according to the options
902
+ * and locale combination. This returns an array of
903
+ * each piece of the date.
904
+ */
905
+ const getLocalizedDateTimeParts = (locale, refParts, options) => {
906
+ const date = getNormalizedDate(refParts);
907
+ return getDateTimeFormat(locale, options).formatToParts(date);
908
+ };
909
+ /**
910
+ * Wrapper function for Intl.DateTimeFormat.
911
+ * Allows developers to apply an allowed format to DatetimeParts.
912
+ * This function also has built in safeguards for older browser bugs
913
+ * with Intl.DateTimeFormat.
914
+ */
915
+ const getDateTimeFormat = (locale, options) => {
916
+ return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, options), { timeZone: 'UTC' }));
917
+ };
918
+ /**
919
+ * Gets a localized version of "Today"
920
+ * Falls back to "Today" in English for
921
+ * browsers that do not support RelativeTimeFormat.
922
+ */
923
+ const getTodayLabel = (locale) => {
924
+ if ('RelativeTimeFormat' in Intl) {
925
+ const label = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }).format(0, 'day');
926
+ return label.charAt(0).toUpperCase() + label.slice(1);
927
+ }
928
+ else {
929
+ return 'Today';
930
+ }
931
+ };
932
+ /**
933
+ * When calling toISOString(), the browser
934
+ * will convert the date to UTC time by either adding
935
+ * or subtracting the time zone offset.
936
+ * To work around this, we need to either add
937
+ * or subtract the time zone offset to the Date
938
+ * object prior to calling toISOString().
939
+ * This allows us to get an ISO string
940
+ * that is in the user's time zone.
941
+ *
942
+ * Example:
943
+ * Time zone offset is 240
944
+ * Meaning: The browser needs to add 240 minutes
945
+ * to the Date object to get UTC time.
946
+ * What Ionic does: We subtract 240 minutes
947
+ * from the Date object. The browser then adds
948
+ * 240 minutes in toISOString(). The result
949
+ * is a time that is in the user's time zone
950
+ * and not UTC.
951
+ *
952
+ * Note: Some timezones include minute adjustments
953
+ * such as 30 or 45 minutes. This is why we use setMinutes
954
+ * instead of setHours.
955
+ * Example: India Standard Time
956
+ * Timezone offset: -330 = -5.5 hours.
957
+ *
958
+ * List of timezones with 30 and 45 minute timezones:
959
+ * https://www.timeanddate.com/time/time-zones-interesting.html
960
+ */
961
+ const removeDateTzOffset = (date) => {
962
+ const tzOffset = date.getTimezoneOffset();
963
+ date.setMinutes(date.getMinutes() - tzOffset);
964
+ return date;
965
+ };
966
+ const DATE_AM = removeDateTzOffset(new Date('2022T01:00'));
967
+ const DATE_PM = removeDateTzOffset(new Date('2022T13:00'));
968
+ /**
969
+ * Formats the locale's string representation of the day period (am/pm) for a given
970
+ * ref parts day period.
971
+ *
972
+ * @param locale The locale to format the day period in.
973
+ * @param value The date string, in ISO format.
974
+ * @returns The localized day period (am/pm) representation of the given value.
975
+ */
976
+ const getLocalizedDayPeriod = (locale, dayPeriod) => {
977
+ const date = dayPeriod === 'am' ? DATE_AM : DATE_PM;
978
+ const localizedDayPeriod = new Intl.DateTimeFormat(locale, {
979
+ hour: 'numeric',
980
+ timeZone: 'UTC',
981
+ })
982
+ .formatToParts(date)
983
+ .find((part) => part.type === 'dayPeriod');
984
+ if (localizedDayPeriod) {
985
+ return localizedDayPeriod.value;
986
+ }
987
+ return getFormattedDayPeriod(dayPeriod);
988
+ };
989
+ /**
990
+ * Formats the datetime's value to a string, for use in the native input.
991
+ *
992
+ * @param value The value to format, either an ISO string or an array thereof.
993
+ */
994
+ const formatValue = (value) => {
995
+ return Array.isArray(value) ? value.join(',') : value;
996
+ };
997
+
998
+ /*!
999
+ * (C) Ionic http://ionicframework.com - MIT License
1000
+ */
1001
+ /**
1002
+ * Returns the current date as
1003
+ * an ISO string in the user's
1004
+ * time zone.
1005
+ */
1006
+ const getToday = () => {
1007
+ /**
1008
+ * ion-datetime intentionally does not
1009
+ * parse time zones/do automatic time zone
1010
+ * conversion when accepting user input.
1011
+ * However when we get today's date string,
1012
+ * we want it formatted relative to the user's
1013
+ * time zone.
1014
+ *
1015
+ * When calling toISOString(), the browser
1016
+ * will convert the date to UTC time by either adding
1017
+ * or subtracting the time zone offset.
1018
+ * To work around this, we need to either add
1019
+ * or subtract the time zone offset to the Date
1020
+ * object prior to calling toISOString().
1021
+ * This allows us to get an ISO string
1022
+ * that is in the user's time zone.
1023
+ */
1024
+ return removeDateTzOffset(new Date()).toISOString();
1025
+ };
1026
+ const minutes = [
1027
+ 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,
1028
+ 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,
1029
+ ];
1030
+ const hour12 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
1031
+ 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];
1032
+ /**
1033
+ * Given a locale and a mode,
1034
+ * return an array with formatted days
1035
+ * of the week. iOS should display days
1036
+ * such as "Mon" or "Tue".
1037
+ * MD should display days such as "M"
1038
+ * or "T".
1039
+ */
1040
+ const getDaysOfWeek = (locale, mode, firstDayOfWeek = 0) => {
1041
+ /**
1042
+ * Nov 1st, 2020 starts on a Sunday.
1043
+ * ion-datetime assumes weeks start on Sunday,
1044
+ * but is configurable via `firstDayOfWeek`.
1045
+ */
1046
+ const weekdayFormat = mode === 'ios' ? 'short' : 'narrow';
1047
+ const intl = new Intl.DateTimeFormat(locale, { weekday: weekdayFormat });
1048
+ const startDate = new Date('11/01/2020');
1049
+ const daysOfWeek = [];
1050
+ /**
1051
+ * For each day of the week,
1052
+ * get the day name.
1053
+ */
1054
+ for (let i = firstDayOfWeek; i < firstDayOfWeek + 7; i++) {
1055
+ const currentDate = new Date(startDate);
1056
+ currentDate.setDate(currentDate.getDate() + i);
1057
+ daysOfWeek.push(intl.format(currentDate));
1058
+ }
1059
+ return daysOfWeek;
1060
+ };
1061
+ /**
1062
+ * Returns an array containing all of the
1063
+ * days in a month for a given year. Values are
1064
+ * aligned with a week calendar starting on
1065
+ * the firstDayOfWeek value (Sunday by default)
1066
+ * using null values.
1067
+ */
1068
+ const getDaysOfMonth = (month, year, firstDayOfWeek) => {
1069
+ const numDays = getNumDaysInMonth(month, year);
1070
+ const firstOfMonth = new Date(`${month}/1/${year}`).getDay();
1071
+ /**
1072
+ * To get the first day of the month aligned on the correct
1073
+ * day of the week, we need to determine how many "filler" days
1074
+ * to generate. These filler days as empty/disabled buttons
1075
+ * that fill the space of the days of the week before the first
1076
+ * of the month.
1077
+ *
1078
+ * There are two cases here:
1079
+ *
1080
+ * 1. If firstOfMonth = 4, firstDayOfWeek = 0 then the offset
1081
+ * is (4 - (0 + 1)) = 3. Since the offset loop goes from 0 to 3 inclusive,
1082
+ * this will generate 4 filler days (0, 1, 2, 3), and then day of week 4 will have
1083
+ * the first day of the month.
1084
+ *
1085
+ * 2. If firstOfMonth = 2, firstDayOfWeek = 4 then the offset
1086
+ * is (6 - (4 - 2)) = 4. Since the offset loop goes from 0 to 4 inclusive,
1087
+ * this will generate 5 filler days (0, 1, 2, 3, 4), and then day of week 5 will have
1088
+ * the first day of the month.
1089
+ */
1090
+ const offset = firstOfMonth >= firstDayOfWeek ? firstOfMonth - (firstDayOfWeek + 1) : 6 - (firstDayOfWeek - firstOfMonth);
1091
+ let days = [];
1092
+ for (let i = 1; i <= numDays; i++) {
1093
+ days.push({ day: i, dayOfWeek: (offset + i) % 7 });
1094
+ }
1095
+ for (let i = 0; i <= offset; i++) {
1096
+ days = [{ day: null, dayOfWeek: null }, ...days];
1097
+ }
1098
+ return days;
1099
+ };
1100
+ /**
1101
+ * Given a local, reference datetime parts and option
1102
+ * max/min bound datetime parts, calculate the acceptable
1103
+ * hour and minute values according to the bounds and locale.
1104
+ */
1105
+ const generateTime = (refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
1106
+ const use24Hour = hourCycle === 'h23';
1107
+ let processedHours = use24Hour ? hour23 : hour12;
1108
+ let processedMinutes = minutes;
1109
+ let isAMAllowed = true;
1110
+ let isPMAllowed = true;
1111
+ if (hourValues) {
1112
+ processedHours = processedHours.filter((hour) => hourValues.includes(hour));
1113
+ }
1114
+ if (minuteValues) {
1115
+ processedMinutes = processedMinutes.filter((minute) => minuteValues.includes(minute));
1116
+ }
1117
+ if (minParts) {
1118
+ /**
1119
+ * If ref day is the same as the
1120
+ * minimum allowed day, filter hour/minute
1121
+ * values according to min hour and minute.
1122
+ */
1123
+ if (isSameDay(refParts, minParts)) {
1124
+ /**
1125
+ * Users may not always set the hour/minute for
1126
+ * min value (i.e. 2021-06-02) so we should allow
1127
+ * all hours/minutes in that case.
1128
+ */
1129
+ if (minParts.hour !== undefined) {
1130
+ processedHours = processedHours.filter((hour) => {
1131
+ const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
1132
+ return (use24Hour ? hour : convertedHour) >= minParts.hour;
1133
+ });
1134
+ isAMAllowed = minParts.hour < 13;
1135
+ }
1136
+ if (minParts.minute !== undefined) {
1137
+ /**
1138
+ * The minimum minute range should not be enforced when
1139
+ * the hour is greater than the min hour.
1140
+ *
1141
+ * For example with a minimum range of 09:30, users
1142
+ * should be able to select 10:00-10:29 and beyond.
1143
+ */
1144
+ let isPastMinHour = false;
1145
+ if (minParts.hour !== undefined && refParts.hour !== undefined) {
1146
+ if (refParts.hour > minParts.hour) {
1147
+ isPastMinHour = true;
1148
+ }
1149
+ }
1150
+ processedMinutes = processedMinutes.filter((minute) => {
1151
+ if (isPastMinHour) {
1152
+ return true;
1153
+ }
1154
+ return minute >= minParts.minute;
1155
+ });
1156
+ }
1157
+ /**
1158
+ * If ref day is before minimum
1159
+ * day do not render any hours/minute values
1160
+ */
1161
+ }
1162
+ else if (isBefore(refParts, minParts)) {
1163
+ processedHours = [];
1164
+ processedMinutes = [];
1165
+ isAMAllowed = isPMAllowed = false;
1166
+ }
1167
+ }
1168
+ if (maxParts) {
1169
+ /**
1170
+ * If ref day is the same as the
1171
+ * maximum allowed day, filter hour/minute
1172
+ * values according to max hour and minute.
1173
+ */
1174
+ if (isSameDay(refParts, maxParts)) {
1175
+ /**
1176
+ * Users may not always set the hour/minute for
1177
+ * max value (i.e. 2021-06-02) so we should allow
1178
+ * all hours/minutes in that case.
1179
+ */
1180
+ if (maxParts.hour !== undefined) {
1181
+ processedHours = processedHours.filter((hour) => {
1182
+ const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
1183
+ return (use24Hour ? hour : convertedHour) <= maxParts.hour;
1184
+ });
1185
+ isPMAllowed = maxParts.hour >= 12;
1186
+ }
1187
+ if (maxParts.minute !== undefined && refParts.hour === maxParts.hour) {
1188
+ // The available minutes should only be filtered when the hour is the same as the max hour.
1189
+ // For example if the max hour is 10:30 and the current hour is 10:00,
1190
+ // users should be able to select 00-30 minutes.
1191
+ // If the current hour is 09:00, users should be able to select 00-60 minutes.
1192
+ processedMinutes = processedMinutes.filter((minute) => minute <= maxParts.minute);
1193
+ }
1194
+ /**
1195
+ * If ref day is after minimum
1196
+ * day do not render any hours/minute values
1197
+ */
1198
+ }
1199
+ else if (isAfter(refParts, maxParts)) {
1200
+ processedHours = [];
1201
+ processedMinutes = [];
1202
+ isAMAllowed = isPMAllowed = false;
1203
+ }
1204
+ }
1205
+ return {
1206
+ hours: processedHours,
1207
+ minutes: processedMinutes,
1208
+ am: isAMAllowed,
1209
+ pm: isPMAllowed,
1210
+ };
1211
+ };
1212
+ /**
1213
+ * Given DatetimeParts, generate the previous,
1214
+ * current, and and next months.
1215
+ */
1216
+ const generateMonths = (refParts) => {
1217
+ return [
1218
+ getPreviousMonth(refParts),
1219
+ { month: refParts.month, year: refParts.year, day: refParts.day },
1220
+ getNextMonth(refParts),
1221
+ ];
1222
+ };
1223
+ const getMonthColumnData = (locale, refParts, minParts, maxParts, monthValues, formatOptions = {
1224
+ month: 'long',
1225
+ }) => {
1226
+ const { year } = refParts;
1227
+ const months = [];
1228
+ if (monthValues !== undefined) {
1229
+ let processedMonths = monthValues;
1230
+ if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.month) !== undefined) {
1231
+ processedMonths = processedMonths.filter((month) => month <= maxParts.month);
1232
+ }
1233
+ if ((minParts === null || minParts === void 0 ? void 0 : minParts.month) !== undefined) {
1234
+ processedMonths = processedMonths.filter((month) => month >= minParts.month);
1235
+ }
1236
+ processedMonths.forEach((processedMonth) => {
1237
+ const date = new Date(`${processedMonth}/1/${year} GMT+0000`);
1238
+ const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1239
+ months.push({ text: monthString, value: processedMonth });
1240
+ });
1241
+ }
1242
+ else {
1243
+ const maxMonth = maxParts && maxParts.year === year ? maxParts.month : 12;
1244
+ const minMonth = minParts && minParts.year === year ? minParts.month : 1;
1245
+ for (let i = minMonth; i <= maxMonth; i++) {
1246
+ /**
1247
+ *
1248
+ * There is a bug on iOS 14 where
1249
+ * Intl.DateTimeFormat takes into account
1250
+ * the local timezone offset when formatting dates.
1251
+ *
1252
+ * Forcing the timezone to 'UTC' fixes the issue. However,
1253
+ * we should keep this workaround as it is safer. In the event
1254
+ * this breaks in another browser, we will not be impacted
1255
+ * because all dates will be interpreted in UTC.
1256
+ *
1257
+ * Example:
1258
+ * new Intl.DateTimeFormat('en-US', { month: 'long' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "March"
1259
+ * new Intl.DateTimeFormat('en-US', { month: 'long', timeZone: 'UTC' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "April"
1260
+ *
1261
+ * In certain timezones, iOS 14 shows the wrong
1262
+ * date for .toUTCString(). To combat this, we
1263
+ * force all of the timezones to GMT+0000 (UTC).
1264
+ *
1265
+ * Example:
1266
+ * Time Zone: Central European Standard Time
1267
+ * new Date('1/1/1992').toUTCString() // "Tue, 31 Dec 1991 23:00:00 GMT"
1268
+ * new Date('1/1/1992 GMT+0000').toUTCString() // "Wed, 01 Jan 1992 00:00:00 GMT"
1269
+ */
1270
+ const date = new Date(`${i}/1/${year} GMT+0000`);
1271
+ const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1272
+ months.push({ text: monthString, value: i });
1273
+ }
1274
+ }
1275
+ return months;
1276
+ };
1277
+ /**
1278
+ * Returns information regarding
1279
+ * selectable dates (i.e 1st, 2nd, 3rd, etc)
1280
+ * within a reference month.
1281
+ * @param locale The locale to format the date with
1282
+ * @param refParts The reference month/year to generate dates for
1283
+ * @param minParts The minimum bound on the date that can be returned
1284
+ * @param maxParts The maximum bound on the date that can be returned
1285
+ * @param dayValues The allowed date values
1286
+ * @returns Date data to be used in ion-picker-column-internal
1287
+ */
1288
+ const getDayColumnData = (locale, refParts, minParts, maxParts, dayValues, formatOptions = {
1289
+ day: 'numeric',
1290
+ }) => {
1291
+ const { month, year } = refParts;
1292
+ const days = [];
1293
+ /**
1294
+ * If we have max/min bounds that in the same
1295
+ * month/year as the refParts, we should
1296
+ * use the define day as the max/min day.
1297
+ * Otherwise, fallback to the max/min days in a month.
1298
+ */
1299
+ const numDaysInMonth = getNumDaysInMonth(month, year);
1300
+ const maxDay = (maxParts === null || maxParts === void 0 ? void 0 : maxParts.day) !== null && (maxParts === null || maxParts === void 0 ? void 0 : maxParts.day) !== undefined && maxParts.year === year && maxParts.month === month
1301
+ ? maxParts.day
1302
+ : numDaysInMonth;
1303
+ const minDay = (minParts === null || minParts === void 0 ? void 0 : minParts.day) !== null && (minParts === null || minParts === void 0 ? void 0 : minParts.day) !== undefined && minParts.year === year && minParts.month === month
1304
+ ? minParts.day
1305
+ : 1;
1306
+ if (dayValues !== undefined) {
1307
+ let processedDays = dayValues;
1308
+ processedDays = processedDays.filter((day) => day >= minDay && day <= maxDay);
1309
+ processedDays.forEach((processedDay) => {
1310
+ const date = new Date(`${month}/${processedDay}/${year} GMT+0000`);
1311
+ const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1312
+ days.push({ text: dayString, value: processedDay });
1313
+ });
1314
+ }
1315
+ else {
1316
+ for (let i = minDay; i <= maxDay; i++) {
1317
+ const date = new Date(`${month}/${i}/${year} GMT+0000`);
1318
+ const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1319
+ days.push({ text: dayString, value: i });
1320
+ }
1321
+ }
1322
+ return days;
1323
+ };
1324
+ const getYearColumnData = (locale, refParts, minParts, maxParts, yearValues) => {
1325
+ var _a, _b;
1326
+ let processedYears = [];
1327
+ if (yearValues !== undefined) {
1328
+ processedYears = yearValues;
1329
+ if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== undefined) {
1330
+ processedYears = processedYears.filter((year) => year <= maxParts.year);
1331
+ }
1332
+ if ((minParts === null || minParts === void 0 ? void 0 : minParts.year) !== undefined) {
1333
+ processedYears = processedYears.filter((year) => year >= minParts.year);
1334
+ }
1335
+ }
1336
+ else {
1337
+ const { year } = refParts;
1338
+ const maxYear = (_a = maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== null && _a !== void 0 ? _a : year;
1339
+ const minYear = (_b = minParts === null || minParts === void 0 ? void 0 : minParts.year) !== null && _b !== void 0 ? _b : year - 100;
1340
+ for (let i = maxYear; i >= minYear; i--) {
1341
+ processedYears.push(i);
1342
+ }
1343
+ }
1344
+ return processedYears.map((year) => ({
1345
+ text: getYear(locale, { year, month: refParts.month, day: refParts.day }),
1346
+ value: year,
1347
+ }));
1348
+ };
1349
+ /**
1350
+ * Given a starting date and an upper bound,
1351
+ * this functions returns an array of all
1352
+ * month objects in that range.
1353
+ */
1354
+ const getAllMonthsInRange = (currentParts, maxParts) => {
1355
+ if (currentParts.month === maxParts.month && currentParts.year === maxParts.year) {
1356
+ return [currentParts];
1357
+ }
1358
+ return [currentParts, ...getAllMonthsInRange(getNextMonth(currentParts), maxParts)];
1359
+ };
1360
+ /**
1361
+ * Creates and returns picker items
1362
+ * that represent the days in a month.
1363
+ * Example: "Thu, Jun 2"
1364
+ */
1365
+ const getCombinedDateColumnData = (locale, todayParts, minParts, maxParts, dayValues, monthValues) => {
1366
+ let items = [];
1367
+ let parts = [];
1368
+ /**
1369
+ * Get all month objects from the min date
1370
+ * to the max date. Note: Do not use getMonthColumnData
1371
+ * as that function only generates dates within a
1372
+ * single year.
1373
+ */
1374
+ let months = getAllMonthsInRange(minParts, maxParts);
1375
+ /**
1376
+ * Filter out any disallowed month values.
1377
+ */
1378
+ if (monthValues) {
1379
+ months = months.filter(({ month }) => monthValues.includes(month));
1380
+ }
1381
+ /**
1382
+ * Get all of the days in the month.
1383
+ * From there, generate an array where
1384
+ * each item has the month, date, and day
1385
+ * of work as the text.
1386
+ */
1387
+ months.forEach((monthObject) => {
1388
+ const referenceMonth = { month: monthObject.month, day: null, year: monthObject.year };
1389
+ const monthDays = getDayColumnData(locale, referenceMonth, minParts, maxParts, dayValues, {
1390
+ month: 'short',
1391
+ day: 'numeric',
1392
+ weekday: 'short',
1393
+ });
1394
+ const dateParts = [];
1395
+ const dateColumnItems = [];
1396
+ monthDays.forEach((dayObject) => {
1397
+ const isToday = isSameDay(Object.assign(Object.assign({}, referenceMonth), { day: dayObject.value }), todayParts);
1398
+ /**
1399
+ * Today's date should read as "Today" (localized)
1400
+ * not the actual date string
1401
+ */
1402
+ dateColumnItems.push({
1403
+ text: isToday ? getTodayLabel(locale) : dayObject.text,
1404
+ value: `${referenceMonth.year}-${referenceMonth.month}-${dayObject.value}`,
1405
+ });
1406
+ /**
1407
+ * When selecting a date in the wheel picker
1408
+ * we need access to the raw datetime parts data.
1409
+ * The picker column only accepts values of
1410
+ * type string or number, so we need to return
1411
+ * two sets of data: A data set to be passed
1412
+ * to the picker column, and a data set to
1413
+ * be used to reference the raw data when
1414
+ * updating the picker column value.
1415
+ */
1416
+ dateParts.push({
1417
+ month: referenceMonth.month,
1418
+ year: referenceMonth.year,
1419
+ day: dayObject.value,
1420
+ });
1421
+ });
1422
+ parts = [...parts, ...dateParts];
1423
+ items = [...items, ...dateColumnItems];
1424
+ });
1425
+ return {
1426
+ parts,
1427
+ items,
1428
+ };
1429
+ };
1430
+ const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues) => {
1431
+ const use24Hour = is24Hour(locale, hourCycle);
1432
+ const { hours, minutes, am, pm } = generateTime(refParts, use24Hour ? 'h23' : 'h12', minParts, maxParts, allowedHourValues, allowedMinuteValues);
1433
+ const hoursItems = hours.map((hour) => {
1434
+ return {
1435
+ text: getFormattedHour(hour, use24Hour),
1436
+ value: getInternalHourValue(hour, use24Hour, refParts.ampm),
1437
+ };
1438
+ });
1439
+ const minutesItems = minutes.map((minute) => {
1440
+ return {
1441
+ text: addTimePadding(minute),
1442
+ value: minute,
1443
+ };
1444
+ });
1445
+ const dayPeriodItems = [];
1446
+ if (am && !use24Hour) {
1447
+ dayPeriodItems.push({
1448
+ text: getLocalizedDayPeriod(locale, 'am'),
1449
+ value: 'am',
1450
+ });
1451
+ }
1452
+ if (pm && !use24Hour) {
1453
+ dayPeriodItems.push({
1454
+ text: getLocalizedDayPeriod(locale, 'pm'),
1455
+ value: 'pm',
1456
+ });
1457
+ }
1458
+ return {
1459
+ minutesData: minutesItems,
1460
+ hoursData: hoursItems,
1461
+ dayPeriodData: dayPeriodItems,
1462
+ };
1463
+ };
1464
+
1465
+ exports.calculateHourFromAMPM = calculateHourFromAMPM;
1466
+ exports.clampDate = clampDate;
1467
+ exports.convertDataToISO = convertDataToISO;
1468
+ exports.convertToArrayOfNumbers = convertToArrayOfNumbers;
1469
+ exports.formatValue = formatValue;
1470
+ exports.generateDayAriaLabel = generateDayAriaLabel;
1471
+ exports.generateMonths = generateMonths;
1472
+ exports.getClosestValidDate = getClosestValidDate;
1473
+ exports.getCombinedDateColumnData = getCombinedDateColumnData;
1474
+ exports.getDay = getDay;
1475
+ exports.getDayColumnData = getDayColumnData;
1476
+ exports.getDaysOfMonth = getDaysOfMonth;
1477
+ exports.getDaysOfWeek = getDaysOfWeek;
1478
+ exports.getEndOfWeek = getEndOfWeek;
1479
+ exports.getLocalizedDateTime = getLocalizedDateTime;
1480
+ exports.getLocalizedTime = getLocalizedTime;
1481
+ exports.getMonthAndDay = getMonthAndDay;
1482
+ exports.getMonthAndYear = getMonthAndYear;
1483
+ exports.getMonthColumnData = getMonthColumnData;
1484
+ exports.getMonthDayAndYear = getMonthDayAndYear;
1485
+ exports.getNextDay = getNextDay;
1486
+ exports.getNextMonth = getNextMonth;
1487
+ exports.getNextWeek = getNextWeek;
1488
+ exports.getNextYear = getNextYear;
1489
+ exports.getNumDaysInMonth = getNumDaysInMonth;
1490
+ exports.getPartsFromCalendarDay = getPartsFromCalendarDay;
1491
+ exports.getPreviousDay = getPreviousDay;
1492
+ exports.getPreviousMonth = getPreviousMonth;
1493
+ exports.getPreviousWeek = getPreviousWeek;
1494
+ exports.getPreviousYear = getPreviousYear;
1495
+ exports.getStartOfWeek = getStartOfWeek;
1496
+ exports.getTimeColumnsData = getTimeColumnsData;
1497
+ exports.getToday = getToday;
1498
+ exports.getYearColumnData = getYearColumnData;
1499
+ exports.is24Hour = is24Hour;
1500
+ exports.isAfter = isAfter;
1501
+ exports.isBefore = isBefore;
1502
+ exports.isLocaleDayPeriodRTL = isLocaleDayPeriodRTL;
1503
+ exports.isMonthFirstLocale = isMonthFirstLocale;
1504
+ exports.isSameDay = isSameDay;
1505
+ exports.parseAmPm = parseAmPm;
1506
+ exports.parseDate = parseDate;
1507
+ exports.parseMaxParts = parseMaxParts;
1508
+ exports.parseMinParts = parseMinParts;
1509
+ exports.validateParts = validateParts;
1510
+ exports.warnIfValueOutOfBounds = warnIfValueOutOfBounds;