@ionic/core 8.7.18 → 8.7.19-dev.11772655618.1af0949f

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 (587) hide show
  1. package/components/index.d.ts +2 -0
  2. package/components/index.js +1 -114
  3. package/components/ion-accordion-group.js +1 -268
  4. package/components/ion-accordion.js +1 -456
  5. package/components/ion-action-sheet.js +1 -6
  6. package/components/ion-alert.js +1 -6
  7. package/components/ion-app.js +1 -132
  8. package/components/ion-avatar.js +1 -41
  9. package/components/ion-back-button.js +1 -130
  10. package/components/ion-backdrop.js +1 -6
  11. package/components/ion-badge.js +1 -47
  12. package/components/ion-breadcrumb.js +1 -137
  13. package/components/ion-breadcrumbs.js +1 -164
  14. package/components/ion-button.js +1 -6
  15. package/components/ion-buttons.js +1 -6
  16. package/components/ion-card-content.js +1 -45
  17. package/components/ion-card-header.js +1 -56
  18. package/components/ion-card-subtitle.js +1 -48
  19. package/components/ion-card-title.js +1 -48
  20. package/components/ion-card.js +1 -107
  21. package/components/ion-checkbox.js +1 -6
  22. package/components/ion-chip.js +1 -66
  23. package/components/ion-col.js +1 -163
  24. package/components/ion-content.js +1 -6
  25. package/components/ion-datetime-button.js +1 -383
  26. package/components/ion-datetime.js +1 -2047
  27. package/components/ion-fab-button.js +1 -151
  28. package/components/ion-fab-list.js +1 -73
  29. package/components/ion-fab.js +1 -101
  30. package/components/ion-footer.js +1 -179
  31. package/components/ion-grid.js +1 -46
  32. package/components/ion-header.js +1 -6
  33. package/components/ion-icon.js +1 -6
  34. package/components/ion-img.js +1 -133
  35. package/components/ion-infinite-scroll-content.js +1 -69
  36. package/components/ion-infinite-scroll.js +1 -236
  37. package/components/ion-input-otp.js +1 -682
  38. package/components/ion-input-password-toggle.js +1 -128
  39. package/components/ion-input.js +1 -646
  40. package/components/ion-item-divider.js +1 -59
  41. package/components/ion-item-group.js +1 -46
  42. package/components/ion-item-option.js +1 -91
  43. package/components/ion-item-options.js +1 -73
  44. package/components/ion-item-sliding.js +1 -457
  45. package/components/ion-item.js +1 -6
  46. package/components/ion-label.js +1 -6
  47. package/components/ion-list-header.js +1 -6
  48. package/components/ion-list.js +1 -6
  49. package/components/ion-loading.js +1 -343
  50. package/components/ion-menu-button.js +1 -109
  51. package/components/ion-menu-toggle.js +1 -64
  52. package/components/ion-menu.js +1 -741
  53. package/components/ion-modal.js +1 -6
  54. package/components/ion-nav-link.js +1 -64
  55. package/components/ion-nav.js +1 -951
  56. package/components/ion-note.js +1 -47
  57. package/components/ion-picker-column-option.js +1 -6
  58. package/components/ion-picker-column.js +1 -6
  59. package/components/ion-picker-legacy-column.js +1 -6
  60. package/components/ion-picker-legacy.js +1 -342
  61. package/components/ion-picker.js +1 -6
  62. package/components/ion-popover.js +1 -6
  63. package/components/ion-progress-bar.js +1 -100
  64. package/components/ion-radio-group.js +1 -6
  65. package/components/ion-radio.js +1 -6
  66. package/components/ion-range.js +1 -844
  67. package/components/ion-refresher-content.js +1 -88
  68. package/components/ion-refresher.js +1 -750
  69. package/components/ion-reorder-group.js +1 -322
  70. package/components/ion-reorder.js +1 -60
  71. package/components/ion-ripple-effect.js +1 -6
  72. package/components/ion-route-redirect.js +1 -45
  73. package/components/ion-route.js +1 -74
  74. package/components/ion-router-link.js +1 -61
  75. package/components/ion-router-outlet.js +1 -226
  76. package/components/ion-router.js +1 -840
  77. package/components/ion-row.js +1 -36
  78. package/components/ion-searchbar.js +1 -540
  79. package/components/ion-segment-button.js +1 -173
  80. package/components/ion-segment-content.js +1 -35
  81. package/components/ion-segment-view.js +1 -142
  82. package/components/ion-segment.js +1 -602
  83. package/components/ion-select-modal.js +1 -6
  84. package/components/ion-select-option.js +1 -46
  85. package/components/ion-select-popover.js +1 -6
  86. package/components/ion-select.js +1 -1035
  87. package/components/ion-skeleton-text.js +1 -64
  88. package/components/ion-spinner.js +1 -6
  89. package/components/ion-split-pane.js +1 -190
  90. package/components/ion-tab-bar.js +1 -135
  91. package/components/ion-tab-button.js +1 -127
  92. package/components/ion-tab.js +1 -82
  93. package/components/ion-tabs.js +1 -204
  94. package/components/ion-text.js +1 -42
  95. package/components/ion-textarea.js +1 -554
  96. package/components/ion-thumbnail.js +1 -36
  97. package/components/ion-title.js +1 -6
  98. package/components/ion-toast.js +1 -938
  99. package/components/ion-toggle.js +1 -360
  100. package/components/ion-toolbar.js +1 -6
  101. package/components/p-1KVKSLu5.js +4 -0
  102. package/{dist/ionic/p-DUt5fQmA.js → components/p-9VcRUwdB.js} +1 -1
  103. package/components/p-ApmKVjaE.js +4 -0
  104. package/components/p-B-hirT0v.js +1 -35
  105. package/components/p-B6FQ0cKR.js +4 -0
  106. package/components/p-B6HaBl3o.js +4 -0
  107. package/components/p-B8b1Ukl9.js +4 -0
  108. package/components/p-BFxT89Wl.js +4 -0
  109. package/components/p-BJoMtgfR.js +4 -0
  110. package/components/p-BNAG-aVv.js +4 -0
  111. package/{dist/ionic/p-D-eFFUkA.js → components/p-BR3tZJmu.js} +1 -1
  112. package/{dist/ionic/p-D0dMcSkw.js → components/p-BS1TtEiJ.js} +1 -1
  113. package/components/p-BSB38Tek.js +4 -0
  114. package/components/p-BTEOs1at.js +1 -192
  115. package/components/p-BTeL5HCK.js +4 -0
  116. package/{dist/ionic/p-DbQ5QkTP.js → components/p-BUbsoBOV.js} +1 -1
  117. package/components/p-BVnB3eEn.js +4 -0
  118. package/components/p-BYDc3hSE.js +4 -0
  119. package/components/p-BagjAGC0.js +4 -0
  120. package/components/p-BegtE7nr.js +4 -0
  121. package/components/p-BgwEQWW6.js +4 -0
  122. package/components/p-Bk2zuNWT.js +4 -0
  123. package/components/p-BmVRXR1y.js +1 -72
  124. package/components/p-Bum_LjMh.js +4 -0
  125. package/components/p-BxwWvu-b.js +4 -0
  126. package/components/p-C4jPsTQa.js +4 -0
  127. package/components/p-C53feagD.js +1 -15
  128. package/{dist/ionic/p-CwgG81ZD.js → components/p-C59ryAuS.js} +1 -1
  129. package/components/p-C7AoMl7c.js +4 -0
  130. package/components/p-CBzELu-H.js +4 -0
  131. package/components/p-CDfQnFrd.js +4 -0
  132. package/components/p-CH0NYjKq.js +4 -0
  133. package/components/p-CIGNaXM1.js +1 -10
  134. package/components/p-CO7fmmxt.js +1 -29
  135. package/components/p-CU1SSH8_.js +4 -0
  136. package/components/p-CVF7ukTk.js +4 -0
  137. package/components/p-CgfaEEem.js +4 -0
  138. package/components/p-CgqKJg96.js +4 -0
  139. package/components/p-Cl0B-RWe.js +1 -452
  140. package/components/p-CneGxKsZ.js +4 -0
  141. package/components/p-CoA-aqGF.js +4 -0
  142. package/{dist/ionic/p-DdR6rpbR.js → components/p-Cq8cQ0NL.js} +1 -1
  143. package/components/p-Csw8xuz4.js +4 -0
  144. package/components/p-CtWGkNnJ.js +1 -162
  145. package/components/p-Cwv-vmkN.js +4 -0
  146. package/{dist/ionic/p-BYEqWnSg.js → components/p-Cy5XSfIk.js} +1 -1
  147. package/components/p-Cyxa_4PV.js +4 -0
  148. package/components/p-Cz5nLPGT.js +4 -0
  149. package/components/p-D13Eaw-8.js +1 -76
  150. package/components/p-D6NJwNJN.js +4 -0
  151. package/components/p-D6Ynv7Xh.js +1 -141
  152. package/components/p-DHsZWn1l.js +4 -0
  153. package/components/p-DJMZehmW.js +4 -0
  154. package/components/p-DJztqcrH.js +1 -14
  155. package/components/p-DYdpXONG.js +4 -0
  156. package/components/p-DgbT0exM.js +4 -0
  157. package/components/p-DiVJyqlX.js +1 -40
  158. package/components/p-Dtdm8lKC.js +1 -44
  159. package/components/p-YLXPWgVj.js +4 -0
  160. package/components/p-ZjP4CjeZ.js +1 -4
  161. package/{dist/ionic/p-DCv9sLH2.js → components/p-ak_d-z48.js} +1 -1
  162. package/components/p-cyNmxje6.js +1 -155
  163. package/components/p-fpbh6w3f.js +4 -0
  164. package/components/p-hHmYLOfE.js +1 -87
  165. package/components/p-kvaDs24J.js +4 -0
  166. package/components/p-vEbVo2hO.js +4 -0
  167. package/dist/cjs/{animation-Bt3H9L1C.js → animation-Dg4yiuR2.js} +1 -1
  168. package/dist/cjs/app-globals-CLI8xCmk.js +11 -0
  169. package/dist/cjs/{button-active-CMc8cD90.js → button-active-FscMI17-.js} +1 -1
  170. package/dist/cjs/{config-C5fsO43a.js → config-BukYi_pW.js} +1 -1
  171. package/dist/cjs/{data-JwZKaIQB.js → data-BYlBjkMU.js} +1 -1
  172. package/dist/cjs/{framework-delegate-DMJRBuDi.js → framework-delegate-CRgp8o_p.js} +1 -1
  173. package/dist/cjs/{hardware-back-button-VCK4V3mG.js → hardware-back-button-C4rMJ5uI.js} +1 -1
  174. package/dist/cjs/{helpers-DrTqNghc.js → helpers-CxTYJdbT.js} +1 -1
  175. package/dist/cjs/{index-094mMFB-.js → index-C845Ti6K.js} +4 -4
  176. package/dist/cjs/{index-DrMUZJj6.js → index-CFUwM5x_.js} +5 -5
  177. package/dist/cjs/{index-D6Wc6v08.js → index-CqT-2gKy.js} +503 -382
  178. package/dist/cjs/{index-CO6eryBo.js → index-MbaBbWXk.js} +2 -2
  179. package/dist/cjs/{index-C534ULug.js → index-YcSftOMz.js} +2 -2
  180. package/dist/cjs/index.cjs.js +12 -12
  181. package/dist/cjs/{input-shims-CuMghsQ-.js → input-shims-Dl5cnc_e.js} +3 -3
  182. package/dist/cjs/{input.utils-B_QROI2g.js → input.utils-DmeJ8dmo.js} +2 -2
  183. package/dist/cjs/ion-accordion_2.cjs.entry.js +23 -15
  184. package/dist/cjs/ion-action-sheet.cjs.entry.js +21 -15
  185. package/dist/cjs/ion-alert.cjs.entry.js +25 -17
  186. package/dist/cjs/ion-app_8.cjs.entry.js +48 -43
  187. package/dist/cjs/ion-avatar_3.cjs.entry.js +12 -12
  188. package/dist/cjs/ion-back-button.cjs.entry.js +7 -7
  189. package/dist/cjs/ion-backdrop.cjs.entry.js +6 -6
  190. package/dist/cjs/ion-breadcrumb_2.cjs.entry.js +20 -14
  191. package/dist/cjs/ion-button_2.cjs.entry.js +36 -18
  192. package/dist/cjs/ion-card_5.cjs.entry.js +23 -23
  193. package/dist/cjs/ion-checkbox.cjs.entry.js +7 -7
  194. package/dist/cjs/ion-chip.cjs.entry.js +6 -6
  195. package/dist/cjs/ion-col_3.cjs.entry.js +8 -8
  196. package/dist/cjs/ion-datetime-button.cjs.entry.js +8 -8
  197. package/dist/cjs/ion-datetime_3.cjs.entry.js +75 -46
  198. package/dist/cjs/ion-fab_3.cjs.entry.js +17 -13
  199. package/dist/cjs/ion-img.cjs.entry.js +8 -6
  200. package/dist/cjs/ion-infinite-scroll_2.cjs.entry.js +17 -13
  201. package/dist/cjs/ion-input-otp.cjs.entry.js +16 -10
  202. package/dist/cjs/ion-input-password-toggle.cjs.entry.js +9 -7
  203. package/dist/cjs/ion-input.cjs.entry.js +21 -13
  204. package/dist/cjs/ion-item-option_3.cjs.entry.js +19 -17
  205. package/dist/cjs/ion-item_8.cjs.entry.js +48 -42
  206. package/dist/cjs/ion-loading.cjs.entry.js +18 -14
  207. package/dist/cjs/ion-menu_3.cjs.entry.js +30 -22
  208. package/dist/cjs/ion-modal.cjs.entry.js +237 -59
  209. package/dist/cjs/ion-nav_2.cjs.entry.js +14 -10
  210. package/dist/cjs/ion-picker-column-option.cjs.entry.js +10 -8
  211. package/dist/cjs/ion-picker-column.cjs.entry.js +11 -7
  212. package/dist/cjs/ion-picker.cjs.entry.js +6 -6
  213. package/dist/cjs/ion-popover.cjs.entry.js +21 -15
  214. package/dist/cjs/ion-progress-bar.cjs.entry.js +7 -7
  215. package/dist/cjs/ion-radio_2.cjs.entry.js +17 -13
  216. package/dist/cjs/ion-range.cjs.entry.js +205 -57
  217. package/dist/cjs/ion-refresher_2.cjs.entry.js +45 -14
  218. package/dist/cjs/ion-reorder_2.cjs.entry.js +13 -11
  219. package/dist/cjs/ion-ripple-effect.cjs.entry.js +4 -4
  220. package/dist/cjs/ion-route_4.cjs.entry.js +20 -10
  221. package/dist/cjs/ion-searchbar.cjs.entry.js +22 -12
  222. package/dist/cjs/ion-segment-content.cjs.entry.js +3 -3
  223. package/dist/cjs/ion-segment-view.cjs.entry.js +13 -8
  224. package/dist/cjs/ion-segment_2.cjs.entry.js +26 -16
  225. package/dist/cjs/ion-select-modal.cjs.entry.js +17 -13
  226. package/dist/cjs/ion-select_3.cjs.entry.js +33 -24
  227. package/dist/cjs/ion-spinner.cjs.entry.js +4 -4
  228. package/dist/cjs/ion-split-pane.cjs.entry.js +15 -9
  229. package/dist/cjs/ion-tab-bar_2.cjs.entry.js +14 -12
  230. package/dist/cjs/ion-tab_2.cjs.entry.js +10 -8
  231. package/dist/cjs/ion-text.cjs.entry.js +4 -4
  232. package/dist/cjs/ion-textarea.cjs.entry.js +20 -14
  233. package/dist/cjs/ion-toast.cjs.entry.js +21 -15
  234. package/dist/cjs/ion-toggle.cjs.entry.js +10 -8
  235. package/dist/cjs/{ionic-global-HMVqOFGO.js → ionic-global-Bc3kJi1Z.js} +1 -1
  236. package/dist/cjs/ionic.cjs.js +5 -5
  237. package/dist/cjs/{ios.transition-BOt_uW73.js → ios.transition-trBiC95R.js} +4 -4
  238. package/dist/cjs/loader.cjs.js +4 -4
  239. package/dist/cjs/{md.transition-Dt968VXB.js → md.transition-CUQECuvD.js} +4 -4
  240. package/dist/cjs/{notch-controller-Bzqhjm4f.js → notch-controller-sD-lTpdc.js} +1 -1
  241. package/dist/cjs/{overlays-B2b-TTbl.js → overlays-C2jiBSNQ.js} +5 -5
  242. package/dist/cjs/{status-tap-g0sWWkXk.js → status-tap-CCJk5VgT.js} +3 -3
  243. package/dist/cjs/{swipe-back-BIayeNOD.js → swipe-back-BGhTQ1CU.js} +2 -2
  244. package/dist/collection/collection-manifest.json +2 -2
  245. package/dist/collection/components/accordion-group/accordion-group.js +4 -2
  246. package/dist/collection/components/action-sheet/action-sheet.js +20 -10
  247. package/dist/collection/components/alert/alert.js +24 -12
  248. package/dist/collection/components/back-button/back-button.js +4 -2
  249. package/dist/collection/components/badge/badge.js +2 -1
  250. package/dist/collection/components/breadcrumb/breadcrumb.js +8 -4
  251. package/dist/collection/components/breadcrumbs/breadcrumbs.js +4 -2
  252. package/dist/collection/components/button/button.js +6 -3
  253. package/dist/collection/components/card/card.js +6 -3
  254. package/dist/collection/components/card-header/card-header.js +2 -1
  255. package/dist/collection/components/card-subtitle/card-subtitle.js +2 -1
  256. package/dist/collection/components/card-title/card-title.js +2 -1
  257. package/dist/collection/components/checkbox/checkbox.js +4 -2
  258. package/dist/collection/components/chip/chip.js +2 -1
  259. package/dist/collection/components/content/content.js +12 -7
  260. package/dist/collection/components/datetime/datetime.js +43 -22
  261. package/dist/collection/components/datetime-button/datetime-button.js +2 -1
  262. package/dist/collection/components/fab-button/fab-button.js +6 -3
  263. package/dist/collection/components/infinite-scroll-content/infinite-scroll-content.js +4 -2
  264. package/dist/collection/components/input/input.js +11 -6
  265. package/dist/collection/components/input-otp/input-otp.js +8 -4
  266. package/dist/collection/components/input-password-toggle/input-password-toggle.js +4 -2
  267. package/dist/collection/components/item/item.js +10 -5
  268. package/dist/collection/components/item-divider/item-divider.js +7 -3
  269. package/dist/collection/components/item-option/item-option.js +6 -3
  270. package/dist/collection/components/item-options/item-options.js +2 -1
  271. package/dist/collection/components/item-sliding/item-sliding.js +2 -1
  272. package/dist/collection/components/label/label.js +6 -3
  273. package/dist/collection/components/list-header/list-header.js +6 -3
  274. package/dist/collection/components/loading/loading.js +22 -11
  275. package/dist/collection/components/menu/menu.js +10 -5
  276. package/dist/collection/components/menu-button/menu-button.js +2 -1
  277. package/dist/collection/components/modal/gestures/sheet.js +120 -12
  278. package/dist/collection/components/modal/gestures/swipe-to-close.js +54 -1
  279. package/dist/collection/components/modal/modal.js +127 -45
  280. package/dist/collection/components/nav/nav.js +89 -45
  281. package/dist/collection/components/nav-link/nav-link.js +9 -5
  282. package/dist/collection/components/note/note.js +2 -1
  283. package/dist/collection/components/picker/picker.js +2 -1
  284. package/dist/collection/components/picker-column/picker-column.js +6 -3
  285. package/dist/collection/components/picker-column-option/picker-column-option.js +2 -1
  286. package/dist/collection/components/picker-legacy/picker.js +24 -12
  287. package/dist/collection/components/picker-legacy-column/picker-column.js +4 -2
  288. package/dist/collection/components/popover/popover.js +33 -17
  289. package/dist/collection/components/progress-bar/progress-bar.js +2 -1
  290. package/dist/collection/components/radio/radio.js +2 -1
  291. package/dist/collection/components/radio-group/radio-group.js +6 -3
  292. package/dist/collection/components/range/range.js +214 -53
  293. package/dist/collection/components/refresher/refresher.js +73 -5
  294. package/dist/collection/components/refresher-content/refresher-content.js +8 -4
  295. package/dist/collection/components/reorder-group/reorder-group.js +6 -3
  296. package/dist/collection/components/route/route.js +4 -2
  297. package/dist/collection/components/router/router.js +10 -5
  298. package/dist/collection/components/router-link/router-link.js +6 -3
  299. package/dist/collection/components/router-outlet/router-outlet.js +18 -9
  300. package/dist/collection/components/searchbar/searchbar.js +11 -6
  301. package/dist/collection/components/segment/segment.js +10 -5
  302. package/dist/collection/components/segment-button/segment-button.js +4 -2
  303. package/dist/collection/components/segment-view/segment-view.ios.css +2 -1
  304. package/dist/collection/components/segment-view/segment-view.js +30 -4
  305. package/dist/collection/components/segment-view/segment-view.md.css +2 -1
  306. package/dist/collection/components/select/select.js +17 -8
  307. package/dist/collection/components/select-modal/select-modal.js +27 -2
  308. package/dist/collection/components/select-popover/select-popover.js +2 -1
  309. package/dist/collection/components/skeleton-text/skeleton-text.js +2 -1
  310. package/dist/collection/components/spinner/spinner.js +4 -2
  311. package/dist/collection/components/tab/tab.js +4 -2
  312. package/dist/collection/components/tab-bar/tab-bar.js +4 -2
  313. package/dist/collection/components/tab-button/tab-button.js +4 -2
  314. package/dist/collection/components/tabs/tabs.js +4 -2
  315. package/dist/collection/components/text/text.js +2 -1
  316. package/dist/collection/components/textarea/textarea.js +10 -7
  317. package/dist/collection/components/title/title.js +4 -2
  318. package/dist/collection/components/toast/toast.js +34 -17
  319. package/dist/collection/components/toggle/toggle.js +4 -2
  320. package/dist/collection/components/toolbar/toolbar.js +2 -1
  321. package/dist/docs.d.ts +37 -0
  322. package/dist/docs.json +1186 -389
  323. package/dist/esm/{animation-Dt8bGnA-.js → animation-CnGMT4ji.js} +1 -1
  324. package/dist/esm/app-globals-DhZjtldk.js +9 -0
  325. package/dist/esm/{button-active-L570Swow.js → button-active-BBx21brx.js} +1 -1
  326. package/dist/esm/{config-mCdtaoPe.js → config-TO1rZH52.js} +1 -1
  327. package/dist/esm/{data-DCORV9FH.js → data-B9iGR5YO.js} +1 -1
  328. package/dist/esm/{framework-delegate-BYawdMXj.js → framework-delegate-CyxE1S_P.js} +1 -1
  329. package/dist/esm/{hardware-back-button-CPLxO-Ev.js → hardware-back-button-CTe4XmL7.js} +1 -1
  330. package/dist/esm/{helpers-DEn3pfjm.js → helpers-Tl8jw6S2.js} +1 -1
  331. package/dist/esm/{index-r2D9DEro.js → index-B-hkiOUh.js} +4 -4
  332. package/dist/esm/{index-CvDIirVx.js → index-B2KwgBLx.js} +5 -5
  333. package/dist/esm/{index-ceb5RaMT.js → index-BtUdxPjv.js} +2 -2
  334. package/dist/esm/{index-C8IsBmNU.js → index-IGIE5vDm.js} +503 -382
  335. package/dist/esm/{index-Bs3kT4bc.js → index-hW6eNZ3o.js} +2 -2
  336. package/dist/esm/index.js +12 -12
  337. package/dist/esm/{input-shims-D6H3ZaWt.js → input-shims-AaDhOpKN.js} +3 -3
  338. package/dist/esm/{input.utils-DrvTa8gz.js → input.utils-Bxa_DQ7-.js} +2 -2
  339. package/dist/esm/ion-accordion_2.entry.js +23 -15
  340. package/dist/esm/ion-action-sheet.entry.js +21 -15
  341. package/dist/esm/ion-alert.entry.js +25 -17
  342. package/dist/esm/ion-app_8.entry.js +48 -43
  343. package/dist/esm/ion-avatar_3.entry.js +12 -12
  344. package/dist/esm/ion-back-button.entry.js +7 -7
  345. package/dist/esm/ion-backdrop.entry.js +6 -6
  346. package/dist/esm/ion-breadcrumb_2.entry.js +20 -14
  347. package/dist/esm/ion-button_2.entry.js +36 -18
  348. package/dist/esm/ion-card_5.entry.js +23 -23
  349. package/dist/esm/ion-checkbox.entry.js +7 -7
  350. package/dist/esm/ion-chip.entry.js +6 -6
  351. package/dist/esm/ion-col_3.entry.js +8 -8
  352. package/dist/esm/ion-datetime-button.entry.js +8 -8
  353. package/dist/esm/ion-datetime_3.entry.js +75 -46
  354. package/dist/esm/ion-fab_3.entry.js +17 -13
  355. package/dist/esm/ion-img.entry.js +8 -6
  356. package/dist/esm/ion-infinite-scroll_2.entry.js +17 -13
  357. package/dist/esm/ion-input-otp.entry.js +16 -10
  358. package/dist/esm/ion-input-password-toggle.entry.js +9 -7
  359. package/dist/esm/ion-input.entry.js +21 -13
  360. package/dist/esm/ion-item-option_3.entry.js +19 -17
  361. package/dist/esm/ion-item_8.entry.js +48 -42
  362. package/dist/esm/ion-loading.entry.js +18 -14
  363. package/dist/esm/ion-menu_3.entry.js +30 -22
  364. package/dist/esm/ion-modal.entry.js +237 -59
  365. package/dist/esm/ion-nav_2.entry.js +14 -10
  366. package/dist/esm/ion-picker-column-option.entry.js +10 -8
  367. package/dist/esm/ion-picker-column.entry.js +11 -7
  368. package/dist/esm/ion-picker.entry.js +6 -6
  369. package/dist/esm/ion-popover.entry.js +21 -15
  370. package/dist/esm/ion-progress-bar.entry.js +7 -7
  371. package/dist/esm/ion-radio_2.entry.js +17 -13
  372. package/dist/esm/ion-range.entry.js +205 -57
  373. package/dist/esm/ion-refresher_2.entry.js +45 -14
  374. package/dist/esm/ion-reorder_2.entry.js +13 -11
  375. package/dist/esm/ion-ripple-effect.entry.js +4 -4
  376. package/dist/esm/ion-route_4.entry.js +20 -10
  377. package/dist/esm/ion-searchbar.entry.js +22 -12
  378. package/dist/esm/ion-segment-content.entry.js +3 -3
  379. package/dist/esm/ion-segment-view.entry.js +13 -8
  380. package/dist/esm/ion-segment_2.entry.js +26 -16
  381. package/dist/esm/ion-select-modal.entry.js +17 -13
  382. package/dist/esm/ion-select_3.entry.js +33 -24
  383. package/dist/esm/ion-spinner.entry.js +4 -4
  384. package/dist/esm/ion-split-pane.entry.js +15 -9
  385. package/dist/esm/ion-tab-bar_2.entry.js +14 -12
  386. package/dist/esm/ion-tab_2.entry.js +10 -8
  387. package/dist/esm/ion-text.entry.js +4 -4
  388. package/dist/esm/ion-textarea.entry.js +20 -14
  389. package/dist/esm/ion-toast.entry.js +21 -15
  390. package/dist/esm/ion-toggle.entry.js +10 -8
  391. package/dist/esm/{ionic-global-CDrldh-5.js → ionic-global-DfbeLwcV.js} +1 -1
  392. package/dist/esm/ionic.js +6 -6
  393. package/dist/esm/{ios.transition-BDzw0_Hm.js → ios.transition--aMF-pDH.js} +4 -4
  394. package/dist/esm/loader.js +5 -5
  395. package/dist/esm/{md.transition-BzDYi3qq.js → md.transition-BEVbfm8j.js} +4 -4
  396. package/dist/esm/{notch-controller-BwelN_JM.js → notch-controller-DAcvKU57.js} +1 -1
  397. package/dist/esm/{overlays-D5YkFThA.js → overlays-F8GHPo-e.js} +5 -5
  398. package/dist/esm/{status-tap-5DQ7Fc4V.js → status-tap-BfJqFSLF.js} +3 -3
  399. package/dist/esm/{swipe-back-BKw2CAHc.js → swipe-back-BZBFwTQV.js} +2 -2
  400. package/dist/html.html-data.json +117 -109
  401. package/dist/ionic/index.esm.js +1 -1
  402. package/dist/ionic/ionic.esm.js +1 -1
  403. package/dist/ionic/p-031b76f7.entry.js +4 -0
  404. package/dist/ionic/p-045a6a42.entry.js +4 -0
  405. package/dist/ionic/p-07506134.entry.js +4 -0
  406. package/dist/ionic/p-084c25b2.entry.js +4 -0
  407. package/dist/ionic/p-0d8b5c38.entry.js +4 -0
  408. package/dist/ionic/p-16813ce7.entry.js +4 -0
  409. package/dist/ionic/p-16b65553.entry.js +4 -0
  410. package/dist/ionic/p-1b02923f.entry.js +4 -0
  411. package/dist/ionic/{p-5c8f7253.entry.js → p-1b169fb6.entry.js} +1 -1
  412. package/dist/ionic/{p-915b3e3d.entry.js → p-23fac490.entry.js} +1 -1
  413. package/dist/ionic/{p-b8551510.entry.js → p-294f4bb5.entry.js} +1 -1
  414. package/dist/ionic/p-2a68388b.entry.js +4 -0
  415. package/dist/ionic/p-2f5a8140.entry.js +4 -0
  416. package/dist/ionic/{p-49d06882.entry.js → p-301c43f8.entry.js} +1 -1
  417. package/dist/ionic/{p-79bd78f9.entry.js → p-370a60ee.entry.js} +1 -1
  418. package/dist/ionic/p-3e143d1d.entry.js +4 -0
  419. package/dist/ionic/p-4819b469.entry.js +4 -0
  420. package/dist/ionic/p-4dd5e8e0.entry.js +4 -0
  421. package/dist/ionic/p-51c11c47.entry.js +4 -0
  422. package/dist/ionic/p-53f750a5.entry.js +4 -0
  423. package/dist/ionic/{p-7cad388a.entry.js → p-6af16209.entry.js} +1 -1
  424. package/dist/ionic/{p-7f98e710.entry.js → p-6b701daa.entry.js} +1 -1
  425. package/dist/ionic/p-6b97f2a3.entry.js +4 -0
  426. package/dist/ionic/p-71e322f7.entry.js +4 -0
  427. package/dist/ionic/p-7620be24.entry.js +4 -0
  428. package/dist/ionic/p-771b27a5.entry.js +4 -0
  429. package/dist/ionic/{p-906bb44d.entry.js → p-7ca71c83.entry.js} +1 -1
  430. package/dist/ionic/{p-11aa58d6.entry.js → p-80cac7a2.entry.js} +1 -1
  431. package/dist/ionic/p-96a2e768.entry.js +4 -0
  432. package/dist/ionic/{p-582824c5.entry.js → p-9833cf63.entry.js} +1 -1
  433. package/dist/ionic/p-9cbc6f1f.entry.js +4 -0
  434. package/dist/ionic/p-9cdbabbb.entry.js +4 -0
  435. package/dist/ionic/p-9eac4eb1.entry.js +4 -0
  436. package/dist/ionic/{p-675b1a31.entry.js → p-9fae83d8.entry.js} +1 -1
  437. package/dist/ionic/p-B8xlpH8p.js +4 -0
  438. package/dist/ionic/{p-C7hRNDhM.js → p-BAt5H1ac.js} +1 -1
  439. package/dist/ionic/p-BW_TRJm8.js +4 -0
  440. package/dist/ionic/{p-DDb5r57F.js → p-Bum7H1fw.js} +1 -1
  441. package/dist/ionic/p-BvFYtOdE.js +4 -0
  442. package/dist/ionic/{p-Dc45iWE4.js → p-BxIcPWoV.js} +1 -1
  443. package/dist/ionic/p-C0JvVFMv.js +4 -0
  444. package/dist/ionic/{p-CTfR9YZG.js → p-CGmVTdWh.js} +1 -1
  445. package/dist/ionic/{p-BOVrCkpJ.js → p-CYbRmDdy.js} +1 -1
  446. package/dist/ionic/{p-MUoJJJwd.js → p-CYvM5g3q.js} +1 -1
  447. package/dist/ionic/p-CmFz1Mjc.js +4 -0
  448. package/dist/ionic/p-CtA-yJYy.js +4 -0
  449. package/dist/ionic/p-D8HJQ1qq.js +4 -0
  450. package/dist/ionic/{p-B0q1YL7N.js → p-DB_iPQC-.js} +1 -1
  451. package/dist/ionic/{p-DNcfiJwE.js → p-DLbbmF9h.js} +1 -1
  452. package/dist/ionic/p-DTPR1Wpn.js +4 -0
  453. package/dist/ionic/p-DjriolRs.js +4 -0
  454. package/dist/ionic/p-DtVZDHlS.js +4 -0
  455. package/dist/ionic/p-IGIE5vDm.js +5 -0
  456. package/dist/ionic/{p-BFvmZNyx.js → p-NFFyoJ4Q.js} +1 -1
  457. package/dist/ionic/p-a805674e.entry.js +4 -0
  458. package/dist/ionic/{p-da7d04cc.entry.js → p-a84f2d21.entry.js} +1 -1
  459. package/dist/ionic/p-aa47f46e.entry.js +4 -0
  460. package/dist/ionic/{p-2668188b.entry.js → p-b325a113.entry.js} +1 -1
  461. package/dist/ionic/{p-d1f54e28.entry.js → p-b440381f.entry.js} +1 -1
  462. package/dist/ionic/p-b6e0ff03.entry.js +4 -0
  463. package/dist/ionic/{p-6f37536a.entry.js → p-bcaa827e.entry.js} +1 -1
  464. package/dist/ionic/{p-fb0271ae.entry.js → p-c3cce9d8.entry.js} +1 -1
  465. package/dist/ionic/{p-b0a7585c.entry.js → p-ca31010f.entry.js} +1 -1
  466. package/dist/ionic/p-d4e8b473.entry.js +4 -0
  467. package/dist/ionic/{p-9575b654.entry.js → p-e663bc5a.entry.js} +1 -1
  468. package/dist/ionic/p-e6c5f060.entry.js +4 -0
  469. package/dist/ionic/{p-652318c3.entry.js → p-e6cedcd7.entry.js} +1 -1
  470. package/dist/ionic/{p-fbb00634.entry.js → p-e863ffe8.entry.js} +1 -1
  471. package/dist/ionic/{p-0ca0fe9c.entry.js → p-f2deaceb.entry.js} +1 -1
  472. package/dist/ionic/{p-ac4eb91d.entry.js → p-f5dfb9a3.entry.js} +1 -1
  473. package/dist/ionic/{p-bce86e56.entry.js → p-f8186550.entry.js} +1 -1
  474. package/dist/ionic/p-fdbc90d4.entry.js +4 -0
  475. package/dist/ionic/p-gbVXD275.js +4 -0
  476. package/dist/ionic/p-hNN3VvaC.js +4 -0
  477. package/dist/types/components/datetime/datetime.d.ts +10 -0
  478. package/dist/types/components/header/header.utils.d.ts +2 -1
  479. package/dist/types/components/item/item.d.ts +2 -0
  480. package/dist/types/components/item-divider/item-divider.d.ts +3 -0
  481. package/dist/types/components/item-option/item-option.d.ts +2 -0
  482. package/dist/types/components/list-header/list-header.d.ts +2 -0
  483. package/dist/types/components/modal/gestures/sheet.d.ts +2 -2
  484. package/dist/types/components/modal/gestures/swipe-to-close.d.ts +2 -2
  485. package/dist/types/components/modal/modal-interface.d.ts +25 -0
  486. package/dist/types/components/modal/modal.d.ts +22 -1
  487. package/dist/types/components/range/range-interface.d.ts +1 -0
  488. package/dist/types/components/range/range.d.ts +44 -4
  489. package/dist/types/components/refresher/refresher-interface.d.ts +7 -0
  490. package/dist/types/components/refresher/refresher.d.ts +16 -3
  491. package/dist/types/components/segment-view/segment-view.d.ts +4 -0
  492. package/dist/types/components/select/select.d.ts +3 -0
  493. package/dist/types/components/select-modal/select-modal.d.ts +4 -0
  494. package/dist/types/components.d.ts +964 -191
  495. package/dist/types/interface.d.ts +2 -2
  496. package/dist/types/stencil-public-runtime.d.ts +126 -14
  497. package/dist/types/utils/gesture/listener.d.ts +2 -1
  498. package/hydrate/index.d.ts +12 -0
  499. package/hydrate/index.js +5632 -1421
  500. package/hydrate/index.mjs +5631 -1422
  501. package/package.json +2 -2
  502. package/components/p-B25GjpND.js +0 -71
  503. package/components/p-BANeLH_G.js +0 -290
  504. package/components/p-BBFQmhcD.js +0 -59
  505. package/components/p-BC-awmYt.js +0 -306
  506. package/components/p-BHbOsu99.js +0 -501
  507. package/components/p-BTlwXR9e.js +0 -73
  508. package/components/p-BcazQttQ.js +0 -612
  509. package/components/p-BdGshsIJ.js +0 -226
  510. package/components/p-BfS7vSpC.js +0 -147
  511. package/components/p-BhRFCLuX.js +0 -675
  512. package/components/p-Bhnhnzjz.js +0 -75
  513. package/components/p-BmcqD0EN.js +0 -153
  514. package/components/p-Boi6hecl.js +0 -115
  515. package/components/p-Bt_moUyl.js +0 -232
  516. package/components/p-Bxl5etF4.js +0 -146
  517. package/components/p-ByjmWt3s.js +0 -139
  518. package/components/p-C04oPyjT.js +0 -54
  519. package/components/p-C6dkQWq2.js +0 -1626
  520. package/components/p-CFZWrvIQ.js +0 -194
  521. package/components/p-CIJwkzL6.js +0 -195
  522. package/components/p-CL12ApCQ.js +0 -820
  523. package/components/p-CXJR56Oq.js +0 -564
  524. package/components/p-Cdm3dKWf.js +0 -108
  525. package/components/p-CslsoGzv.js +0 -192
  526. package/components/p-Cyd00tgZ.js +0 -167
  527. package/components/p-CzAJ3ArC.js +0 -380
  528. package/components/p-CzW34QBh.js +0 -12
  529. package/components/p-D0zXRwcr.js +0 -196
  530. package/components/p-D5hF6rwn.js +0 -339
  531. package/components/p-D8eD2iBA.js +0 -67
  532. package/components/p-DGOrLIyS.js +0 -481
  533. package/components/p-DK2Bn1Mc.js +0 -305
  534. package/components/p-DKRQWlK2.js +0 -598
  535. package/components/p-DNDUsygf.js +0 -128
  536. package/components/p-DTWZF6wg.js +0 -418
  537. package/components/p-DWoUQeZ3.js +0 -3012
  538. package/components/p-DX0w75a9.js +0 -420
  539. package/components/p-Dt8zaCLQ.js +0 -92
  540. package/components/p-DyFBFrV7.js +0 -264
  541. package/components/p-DyHPCMyn.js +0 -39
  542. package/components/p-LgLeKTkH.js +0 -112
  543. package/components/p-NhiRFRn9.js +0 -50
  544. package/components/p-OuiHmXO5.js +0 -646
  545. package/components/p-Wro9IPHE.js +0 -459
  546. package/components/p-aIWC4ZEV.js +0 -305
  547. package/components/p-c-XJ9XhZ.js +0 -915
  548. package/components/p-fVuFT3Wd.js +0 -78
  549. package/components/p-iyo0Toaz.js +0 -2822
  550. package/components/p-l_lso3Zl.js +0 -140
  551. package/components/p-mQp4lwQD.js +0 -1638
  552. package/dist/cjs/app-globals-Ciccnk9_.js +0 -10
  553. package/dist/esm/app-globals-BDSf8fOA.js +0 -8
  554. package/dist/ionic/p-11518b31.entry.js +0 -4
  555. package/dist/ionic/p-221a3d8c.entry.js +0 -4
  556. package/dist/ionic/p-2ac254dc.entry.js +0 -4
  557. package/dist/ionic/p-2bd1ea35.entry.js +0 -4
  558. package/dist/ionic/p-30333874.entry.js +0 -4
  559. package/dist/ionic/p-31db96da.entry.js +0 -4
  560. package/dist/ionic/p-34642fa1.entry.js +0 -4
  561. package/dist/ionic/p-35696017.entry.js +0 -4
  562. package/dist/ionic/p-363d1209.entry.js +0 -4
  563. package/dist/ionic/p-46a38cfd.entry.js +0 -4
  564. package/dist/ionic/p-4eec1a5e.entry.js +0 -4
  565. package/dist/ionic/p-530fcd71.entry.js +0 -4
  566. package/dist/ionic/p-5d6fb6e3.entry.js +0 -4
  567. package/dist/ionic/p-66fbe052.entry.js +0 -4
  568. package/dist/ionic/p-7babec72.entry.js +0 -4
  569. package/dist/ionic/p-82d5bb3d.entry.js +0 -4
  570. package/dist/ionic/p-97eb0812.entry.js +0 -4
  571. package/dist/ionic/p-9b6d46f2.entry.js +0 -4
  572. package/dist/ionic/p-BKc55Xev.js +0 -4
  573. package/dist/ionic/p-Bmgaetn_.js +0 -4
  574. package/dist/ionic/p-C8IsBmNU.js +0 -5
  575. package/dist/ionic/p-CJxh_yLS.js +0 -4
  576. package/dist/ionic/p-DZRJwG4S.js +0 -4
  577. package/dist/ionic/p-a4a9f5ae.entry.js +0 -4
  578. package/dist/ionic/p-b0ebf9f8.entry.js +0 -4
  579. package/dist/ionic/p-be263062.entry.js +0 -4
  580. package/dist/ionic/p-c175d792.entry.js +0 -4
  581. package/dist/ionic/p-cc2a9936.entry.js +0 -4
  582. package/dist/ionic/p-cc45bcbc.entry.js +0 -4
  583. package/dist/ionic/p-d0a2a1ab.entry.js +0 -4
  584. package/dist/ionic/p-e4c57008.entry.js +0 -4
  585. package/dist/ionic/p-e5d6d0f0.entry.js +0 -4
  586. package/dist/ionic/p-f1dfee25.entry.js +0 -4
  587. package/dist/ionic/p-f9f7b9db.entry.js +0 -4
@@ -1,1638 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { f as printIonWarning } from './p-DWoUQeZ3.js';
5
-
6
- /**
7
- * Returns true if the selected day is equal to the reference day
8
- */
9
- const isSameDay = (baseParts, compareParts) => {
10
- return (baseParts.month === compareParts.month && baseParts.day === compareParts.day && baseParts.year === compareParts.year);
11
- };
12
- /**
13
- * Returns true is the selected day is before the reference day.
14
- */
15
- const isBefore = (baseParts, compareParts) => {
16
- return !!(baseParts.year < compareParts.year ||
17
- (baseParts.year === compareParts.year && baseParts.month < compareParts.month) ||
18
- (baseParts.year === compareParts.year &&
19
- baseParts.month === compareParts.month &&
20
- baseParts.day !== null &&
21
- baseParts.day < compareParts.day));
22
- };
23
- /**
24
- * Returns true is the selected day is after the reference day.
25
- */
26
- const isAfter = (baseParts, compareParts) => {
27
- return !!(baseParts.year > compareParts.year ||
28
- (baseParts.year === compareParts.year && baseParts.month > compareParts.month) ||
29
- (baseParts.year === compareParts.year &&
30
- baseParts.month === compareParts.month &&
31
- baseParts.day !== null &&
32
- baseParts.day > compareParts.day));
33
- };
34
- const warnIfValueOutOfBounds = (value, min, max) => {
35
- const valueArray = Array.isArray(value) ? value : [value];
36
- for (const val of valueArray) {
37
- if ((min !== undefined && isBefore(val, min)) || (max !== undefined && isAfter(val, max))) {
38
- printIonWarning('[ion-datetime] - The value provided to ion-datetime is out of bounds.\n\n' +
39
- `Min: ${JSON.stringify(min)}\n` +
40
- `Max: ${JSON.stringify(max)}\n` +
41
- `Value: ${JSON.stringify(value)}`);
42
- break;
43
- }
44
- }
45
- };
46
-
47
- /**
48
- * Determines if given year is a
49
- * leap year. Returns `true` if year
50
- * is a leap year. Returns `false`
51
- * otherwise.
52
- */
53
- const isLeapYear = (year) => {
54
- return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
55
- };
56
- /**
57
- * Determines the hour cycle for a user.
58
- * If the hour cycle is explicitly defined, just use that.
59
- * Otherwise, we try to derive it from either the specified
60
- * locale extension tags or from Intl.DateTimeFormat directly.
61
- */
62
- const getHourCycle = (locale, hourCycle) => {
63
- /**
64
- * If developer has explicitly enabled 24-hour time
65
- * then return early and do not look at the system default.
66
- */
67
- if (hourCycle !== undefined) {
68
- return hourCycle;
69
- }
70
- /**
71
- * If hourCycle was not specified, check the locale
72
- * that is set on the user's device. We first check the
73
- * Intl.DateTimeFormat hourCycle option as developers can encode this
74
- * option into the locale string. Example: `en-US-u-hc-h23`
75
- */
76
- const formatted = new Intl.DateTimeFormat(locale, { hour: 'numeric' });
77
- const options = formatted.resolvedOptions();
78
- if (options.hourCycle !== undefined) {
79
- return options.hourCycle;
80
- }
81
- /**
82
- * If hourCycle is not specified (either through lack
83
- * of browser support or locale information) then fall
84
- * back to this slower hourCycle check.
85
- */
86
- const date = new Date('5/18/2021 00:00');
87
- const parts = formatted.formatToParts(date);
88
- const hour = parts.find((p) => p.type === 'hour');
89
- if (!hour) {
90
- throw new Error('Hour value not found from DateTimeFormat');
91
- }
92
- /**
93
- * Midnight for h11 starts at 0:00am
94
- * Midnight for h12 starts at 12:00am
95
- * Midnight for h23 starts at 00:00
96
- * Midnight for h24 starts at 24:00
97
- */
98
- switch (hour.value) {
99
- case '0':
100
- return 'h11';
101
- case '12':
102
- return 'h12';
103
- case '00':
104
- return 'h23';
105
- case '24':
106
- return 'h24';
107
- default:
108
- throw new Error(`Invalid hour cycle "${hourCycle}"`);
109
- }
110
- };
111
- /**
112
- * Determine if the hour cycle uses a 24-hour format.
113
- * Returns true for h23 and h24. Returns false otherwise.
114
- * If you don't know the hourCycle, use getHourCycle above
115
- * and pass the result into this function.
116
- */
117
- const is24Hour = (hourCycle) => {
118
- return hourCycle === 'h23' || hourCycle === 'h24';
119
- };
120
- /**
121
- * Given a date object, returns the number
122
- * of days in that month.
123
- * Month value begin at 1, not 0.
124
- * i.e. January = month 1.
125
- */
126
- const getNumDaysInMonth = (month, year) => {
127
- return month === 4 || month === 6 || month === 9 || month === 11
128
- ? 30
129
- : month === 2
130
- ? isLeapYear(year)
131
- ? 29
132
- : 28
133
- : 31;
134
- };
135
- /**
136
- * Certain locales display month then year while
137
- * others display year then month.
138
- * We can use Intl.DateTimeFormat to determine
139
- * the ordering for each locale.
140
- * The formatOptions param can be used to customize
141
- * which pieces of a date to compare against the month
142
- * with. For example, some locales render dd/mm/yyyy
143
- * while others render mm/dd/yyyy. This function can be
144
- * used for variations of the same "month first" check.
145
- */
146
- const isMonthFirstLocale = (locale, formatOptions = {
147
- month: 'numeric',
148
- year: 'numeric',
149
- }) => {
150
- /**
151
- * By setting month and year we guarantee that only
152
- * month, year, and literal (slashes '/', for example)
153
- * values are included in the formatToParts results.
154
- *
155
- * The ordering of the parts will be determined by
156
- * the locale. So if the month is the first value,
157
- * then we know month should be shown first. If the
158
- * year is the first value, then we know year should be shown first.
159
- *
160
- * This ordering can be controlled by customizing the locale property.
161
- */
162
- const parts = new Intl.DateTimeFormat(locale, formatOptions).formatToParts(new Date());
163
- return parts[0].type === 'month';
164
- };
165
- /**
166
- * Determines if the given locale formats the day period (am/pm) to the
167
- * left or right of the hour.
168
- * @param locale The locale to check.
169
- * @returns `true` if the locale formats the day period to the left of the hour.
170
- */
171
- const isLocaleDayPeriodRTL = (locale) => {
172
- const parts = new Intl.DateTimeFormat(locale, { hour: 'numeric' }).formatToParts(new Date());
173
- return parts[0].type === 'dayPeriod';
174
- };
175
-
176
- const ISO_8601_REGEXP =
177
- // eslint-disable-next-line no-useless-escape
178
- /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
179
- // eslint-disable-next-line no-useless-escape
180
- const TIME_REGEXP = /^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
181
- /**
182
- * Use to convert a string of comma separated numbers or
183
- * an array of numbers, and clean up any user input
184
- */
185
- const convertToArrayOfNumbers = (input) => {
186
- if (input === undefined) {
187
- return;
188
- }
189
- let processedInput = input;
190
- if (typeof input === 'string') {
191
- // convert the string to an array of strings
192
- // auto remove any whitespace and [] characters
193
- processedInput = input.replace(/\[|\]|\s/g, '').split(',');
194
- }
195
- let values;
196
- if (Array.isArray(processedInput)) {
197
- // ensure each value is an actual number in the returned array
198
- values = processedInput.map((num) => parseInt(num, 10)).filter(isFinite);
199
- }
200
- else {
201
- values = [processedInput];
202
- }
203
- return values;
204
- };
205
- /**
206
- * Extracts date information
207
- * from a .calendar-day element
208
- * into DatetimeParts.
209
- */
210
- const getPartsFromCalendarDay = (el) => {
211
- return {
212
- month: parseInt(el.getAttribute('data-month'), 10),
213
- day: parseInt(el.getAttribute('data-day'), 10),
214
- year: parseInt(el.getAttribute('data-year'), 10),
215
- dayOfWeek: parseInt(el.getAttribute('data-day-of-week'), 10),
216
- };
217
- };
218
- function parseDate(val) {
219
- if (Array.isArray(val)) {
220
- const parsedArray = [];
221
- for (const valStr of val) {
222
- const parsedVal = parseDate(valStr);
223
- /**
224
- * If any of the values weren't parsed correctly, consider
225
- * the entire batch incorrect. This simplifies the type
226
- * signatures by having "undefined" be a general error case
227
- * instead of returning (Datetime | undefined)[], which is
228
- * harder for TS to perform type narrowing on.
229
- */
230
- if (!parsedVal) {
231
- return undefined;
232
- }
233
- parsedArray.push(parsedVal);
234
- }
235
- return parsedArray;
236
- }
237
- // manually parse IS0 cuz Date.parse cannot be trusted
238
- // ISO 8601 format: 1994-12-15T13:47:20Z
239
- let parse = null;
240
- if (val != null && val !== '') {
241
- // try parsing for just time first, HH:MM
242
- parse = TIME_REGEXP.exec(val);
243
- if (parse) {
244
- // adjust the array so it fits nicely with the datetime parse
245
- parse.unshift(undefined, undefined);
246
- parse[2] = parse[3] = undefined;
247
- }
248
- else {
249
- // try parsing for full ISO datetime
250
- parse = ISO_8601_REGEXP.exec(val);
251
- }
252
- }
253
- if (parse === null) {
254
- // wasn't able to parse the ISO datetime
255
- printIonWarning(`[ion-datetime] - Unable to parse date string: ${val}. Please provide a valid ISO 8601 datetime string.`);
256
- return undefined;
257
- }
258
- // ensure all the parse values exist with at least 0
259
- for (let i = 1; i < 8; i++) {
260
- parse[i] = parse[i] !== undefined ? parseInt(parse[i], 10) : undefined;
261
- }
262
- // can also get second and millisecond from parse[6] and parse[7] if needed
263
- return {
264
- year: parse[1],
265
- month: parse[2],
266
- day: parse[3],
267
- hour: parse[4],
268
- minute: parse[5],
269
- ampm: parse[4] < 12 ? 'am' : 'pm',
270
- };
271
- }
272
- const clampDate = (dateParts, minParts, maxParts) => {
273
- if (minParts && isBefore(dateParts, minParts)) {
274
- return minParts;
275
- }
276
- else if (maxParts && isAfter(dateParts, maxParts)) {
277
- return maxParts;
278
- }
279
- return dateParts;
280
- };
281
- /**
282
- * Parses an hour and returns if the value is in the morning (am) or afternoon (pm).
283
- * @param hour The hour to format, should be 0-23
284
- * @returns `pm` if the hour is greater than or equal to 12, `am` if less than 12.
285
- */
286
- const parseAmPm = (hour) => {
287
- return hour >= 12 ? 'pm' : 'am';
288
- };
289
- /**
290
- * Takes a max date string and creates a DatetimeParts
291
- * object, filling in any missing information.
292
- * For example, max="2012" would fill in the missing
293
- * month, day, hour, and minute information.
294
- */
295
- const parseMaxParts = (max, todayParts) => {
296
- const result = parseDate(max);
297
- /**
298
- * If min was not a valid date then return undefined.
299
- */
300
- if (result === undefined) {
301
- return;
302
- }
303
- const { month, day, year, hour, minute } = result;
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
- const yearValue = year !== null && year !== void 0 ? year : todayParts.year;
315
- const monthValue = month !== null && month !== void 0 ? month : 12;
316
- return {
317
- month: monthValue,
318
- day: day !== null && day !== void 0 ? day : getNumDaysInMonth(monthValue, yearValue),
319
- /**
320
- * Passing in "HH:mm" is a valid ISO-8601
321
- * string, so we just default to the current year
322
- * in this case.
323
- */
324
- year: yearValue,
325
- hour: hour !== null && hour !== void 0 ? hour : 23,
326
- minute: minute !== null && minute !== void 0 ? minute : 59,
327
- };
328
- };
329
- /**
330
- * Takes a min date string and creates a DatetimeParts
331
- * object, filling in any missing information.
332
- * For example, min="2012" would fill in the missing
333
- * month, day, hour, and minute information.
334
- */
335
- const parseMinParts = (min, todayParts) => {
336
- const result = parseDate(min);
337
- /**
338
- * If min was not a valid date then return undefined.
339
- */
340
- if (result === undefined) {
341
- return;
342
- }
343
- const { month, day, year, hour, minute } = result;
344
- /**
345
- * When passing in `max` or `min`, developers
346
- * can pass in any ISO-8601 string. This means
347
- * that not all of the date/time fields are defined.
348
- * For example, passing max="2012" is valid even though
349
- * there is no month, day, hour, or minute data.
350
- * However, all of this data is required when clamping the date
351
- * so that the correct initial value can be selected. As a result,
352
- * we need to fill in any omitted data with the min or max values.
353
- */
354
- return {
355
- month: month !== null && month !== void 0 ? month : 1,
356
- day: day !== null && day !== void 0 ? day : 1,
357
- /**
358
- * Passing in "HH:mm" is a valid ISO-8601
359
- * string, so we just default to the current year
360
- * in this case.
361
- */
362
- year: year !== null && year !== void 0 ? year : todayParts.year,
363
- hour: hour !== null && hour !== void 0 ? hour : 0,
364
- minute: minute !== null && minute !== void 0 ? minute : 0,
365
- };
366
- };
367
-
368
- const twoDigit = (val) => {
369
- return ('0' + (val !== undefined ? Math.abs(val) : '0')).slice(-2);
370
- };
371
- const fourDigit = (val) => {
372
- return ('000' + (val !== undefined ? Math.abs(val) : '0')).slice(-4);
373
- };
374
- function convertDataToISO(data) {
375
- if (Array.isArray(data)) {
376
- return data.map((parts) => convertDataToISO(parts));
377
- }
378
- // https://www.w3.org/TR/NOTE-datetime
379
- let rtn = '';
380
- if (data.year !== undefined) {
381
- // YYYY
382
- rtn = fourDigit(data.year);
383
- if (data.month !== undefined) {
384
- // YYYY-MM
385
- rtn += '-' + twoDigit(data.month);
386
- if (data.day !== undefined) {
387
- // YYYY-MM-DD
388
- rtn += '-' + twoDigit(data.day);
389
- if (data.hour !== undefined) {
390
- // YYYY-MM-DDTHH:mm:SS
391
- rtn += `T${twoDigit(data.hour)}:${twoDigit(data.minute)}:00`;
392
- }
393
- }
394
- }
395
- }
396
- else if (data.hour !== undefined) {
397
- // HH:mm
398
- rtn = twoDigit(data.hour) + ':' + twoDigit(data.minute);
399
- }
400
- return rtn;
401
- }
402
- /**
403
- * Converts an 12 hour value to 24 hours.
404
- */
405
- const convert12HourTo24Hour = (hour, ampm) => {
406
- if (ampm === undefined) {
407
- return hour;
408
- }
409
- /**
410
- * If AM and 12am
411
- * then return 00:00.
412
- * Otherwise just return
413
- * the hour since it is
414
- * already in 24 hour format.
415
- */
416
- if (ampm === 'am') {
417
- if (hour === 12) {
418
- return 0;
419
- }
420
- return hour;
421
- }
422
- /**
423
- * If PM and 12pm
424
- * just return 12:00
425
- * since it is already
426
- * in 24 hour format.
427
- * Otherwise add 12 hours
428
- * to the time.
429
- */
430
- if (hour === 12) {
431
- return 12;
432
- }
433
- return hour + 12;
434
- };
435
- const getStartOfWeek = (refParts) => {
436
- const { dayOfWeek } = refParts;
437
- if (dayOfWeek === null || dayOfWeek === undefined) {
438
- throw new Error('No day of week provided');
439
- }
440
- return subtractDays(refParts, dayOfWeek);
441
- };
442
- const getEndOfWeek = (refParts) => {
443
- const { dayOfWeek } = refParts;
444
- if (dayOfWeek === null || dayOfWeek === undefined) {
445
- throw new Error('No day of week provided');
446
- }
447
- return addDays(refParts, 6 - dayOfWeek);
448
- };
449
- const getNextDay = (refParts) => {
450
- return addDays(refParts, 1);
451
- };
452
- const getPreviousDay = (refParts) => {
453
- return subtractDays(refParts, 1);
454
- };
455
- const getPreviousWeek = (refParts) => {
456
- return subtractDays(refParts, 7);
457
- };
458
- const getNextWeek = (refParts) => {
459
- return addDays(refParts, 7);
460
- };
461
- /**
462
- * Given datetime parts, subtract
463
- * numDays from the date.
464
- * Returns a new DatetimeParts object
465
- * Currently can only go backward at most 1 month.
466
- */
467
- const subtractDays = (refParts, numDays) => {
468
- const { month, day, year } = refParts;
469
- if (day === null) {
470
- throw new Error('No day provided');
471
- }
472
- const workingParts = {
473
- month,
474
- day,
475
- year,
476
- };
477
- workingParts.day = day - numDays;
478
- /**
479
- * If wrapping to previous month
480
- * update days and decrement month
481
- */
482
- if (workingParts.day < 1) {
483
- workingParts.month -= 1;
484
- }
485
- /**
486
- * If moving to previous year, reset
487
- * month to December and decrement year
488
- */
489
- if (workingParts.month < 1) {
490
- workingParts.month = 12;
491
- workingParts.year -= 1;
492
- }
493
- /**
494
- * Determine how many days are in the current
495
- * month
496
- */
497
- if (workingParts.day < 1) {
498
- const daysInMonth = getNumDaysInMonth(workingParts.month, workingParts.year);
499
- /**
500
- * Take num days in month and add the
501
- * number of underflow days. This number will
502
- * be negative.
503
- * Example: 1 week before Jan 2, 2021 is
504
- * December 26, 2021 so:
505
- * 2 - 7 = -5
506
- * 31 + (-5) = 26
507
- */
508
- workingParts.day = daysInMonth + workingParts.day;
509
- }
510
- return workingParts;
511
- };
512
- /**
513
- * Given datetime parts, add
514
- * numDays to the date.
515
- * Returns a new DatetimeParts object
516
- * Currently can only go forward at most 1 month.
517
- */
518
- const addDays = (refParts, numDays) => {
519
- const { month, day, year } = refParts;
520
- if (day === null) {
521
- throw new Error('No day provided');
522
- }
523
- const workingParts = {
524
- month,
525
- day,
526
- year,
527
- };
528
- const daysInMonth = getNumDaysInMonth(month, year);
529
- workingParts.day = day + numDays;
530
- /**
531
- * If wrapping to next month
532
- * update days and increment month
533
- */
534
- if (workingParts.day > daysInMonth) {
535
- workingParts.day -= daysInMonth;
536
- workingParts.month += 1;
537
- }
538
- /**
539
- * If moving to next year, reset
540
- * month to January and increment year
541
- */
542
- if (workingParts.month > 12) {
543
- workingParts.month = 1;
544
- workingParts.year += 1;
545
- }
546
- return workingParts;
547
- };
548
- /**
549
- * Given DatetimeParts, generate the previous month.
550
- */
551
- const getPreviousMonth = (refParts) => {
552
- /**
553
- * If current month is January, wrap backwards
554
- * to December of the previous year.
555
- */
556
- const month = refParts.month === 1 ? 12 : refParts.month - 1;
557
- const year = refParts.month === 1 ? refParts.year - 1 : refParts.year;
558
- const numDaysInMonth = getNumDaysInMonth(month, year);
559
- const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
560
- return { month, year, day };
561
- };
562
- /**
563
- * Given DatetimeParts, generate the next month.
564
- */
565
- const getNextMonth = (refParts) => {
566
- /**
567
- * If current month is December, wrap forwards
568
- * to January of the next year.
569
- */
570
- const month = refParts.month === 12 ? 1 : refParts.month + 1;
571
- const year = refParts.month === 12 ? refParts.year + 1 : refParts.year;
572
- const numDaysInMonth = getNumDaysInMonth(month, year);
573
- const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
574
- return { month, year, day };
575
- };
576
- const changeYear = (refParts, yearDelta) => {
577
- const month = refParts.month;
578
- const year = refParts.year + yearDelta;
579
- const numDaysInMonth = getNumDaysInMonth(month, year);
580
- const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
581
- return { month, year, day };
582
- };
583
- /**
584
- * Given DatetimeParts, generate the previous year.
585
- */
586
- const getPreviousYear = (refParts) => {
587
- return changeYear(refParts, -1);
588
- };
589
- /**
590
- * Given DatetimeParts, generate the next year.
591
- */
592
- const getNextYear = (refParts) => {
593
- return changeYear(refParts, 1);
594
- };
595
- /**
596
- * If PM, then internal value should
597
- * be converted to 24-hr time.
598
- * Does not apply when public
599
- * values are already 24-hr time.
600
- */
601
- const getInternalHourValue = (hour, use24Hour, ampm) => {
602
- if (use24Hour) {
603
- return hour;
604
- }
605
- return convert12HourTo24Hour(hour, ampm);
606
- };
607
- /**
608
- * Unless otherwise stated, all month values are
609
- * 1 indexed instead of the typical 0 index in JS Date.
610
- * Example:
611
- * January = Month 0 when using JS Date
612
- * January = Month 1 when using this datetime util
613
- */
614
- /**
615
- * Given the current datetime parts and a new AM/PM value
616
- * calculate what the hour should be in 24-hour time format.
617
- * Used when toggling the AM/PM segment since we store our hours
618
- * in 24-hour time format internally.
619
- */
620
- const calculateHourFromAMPM = (currentParts, newAMPM) => {
621
- const { ampm: currentAMPM, hour } = currentParts;
622
- let newHour = hour;
623
- /**
624
- * If going from AM --> PM, need to update the
625
- *
626
- */
627
- if (currentAMPM === 'am' && newAMPM === 'pm') {
628
- newHour = convert12HourTo24Hour(newHour, 'pm');
629
- /**
630
- * If going from PM --> AM
631
- */
632
- }
633
- else if (currentAMPM === 'pm' && newAMPM === 'am') {
634
- newHour = Math.abs(newHour - 12);
635
- }
636
- return newHour;
637
- };
638
- /**
639
- * Updates parts to ensure that month and day
640
- * values are valid. For days that do not exist,
641
- * or are outside the min/max bounds, the closest
642
- * valid day is used.
643
- */
644
- const validateParts = (parts, minParts, maxParts) => {
645
- const { month, day, year } = parts;
646
- const partsCopy = clampDate(Object.assign({}, parts), minParts, maxParts);
647
- const numDays = getNumDaysInMonth(month, year);
648
- /**
649
- * If the max number of days
650
- * is greater than the day we want
651
- * to set, update the DatetimeParts
652
- * day field to be the max days.
653
- */
654
- if (day !== null && numDays < day) {
655
- partsCopy.day = numDays;
656
- }
657
- /**
658
- * If value is same day as min day,
659
- * make sure the time value is in bounds.
660
- */
661
- if (minParts !== undefined && isSameDay(partsCopy, minParts)) {
662
- /**
663
- * If the hour is out of bounds,
664
- * update both the hour and minute.
665
- * This is done so that the new time
666
- * is closest to what the user selected.
667
- */
668
- if (partsCopy.hour !== undefined && minParts.hour !== undefined) {
669
- if (partsCopy.hour < minParts.hour) {
670
- partsCopy.hour = minParts.hour;
671
- partsCopy.minute = minParts.minute;
672
- /**
673
- * If only the minute is out of bounds,
674
- * set it to the min minute.
675
- */
676
- }
677
- else if (partsCopy.hour === minParts.hour &&
678
- partsCopy.minute !== undefined &&
679
- minParts.minute !== undefined &&
680
- partsCopy.minute < minParts.minute) {
681
- partsCopy.minute = minParts.minute;
682
- }
683
- }
684
- }
685
- /**
686
- * If value is same day as max day,
687
- * make sure the time value is in bounds.
688
- */
689
- if (maxParts !== undefined && isSameDay(parts, maxParts)) {
690
- /**
691
- * If the hour is out of bounds,
692
- * update both the hour and minute.
693
- * This is done so that the new time
694
- * is closest to what the user selected.
695
- */
696
- if (partsCopy.hour !== undefined && maxParts.hour !== undefined) {
697
- if (partsCopy.hour > maxParts.hour) {
698
- partsCopy.hour = maxParts.hour;
699
- partsCopy.minute = maxParts.minute;
700
- /**
701
- * If only the minute is out of bounds,
702
- * set it to the max minute.
703
- */
704
- }
705
- else if (partsCopy.hour === maxParts.hour &&
706
- partsCopy.minute !== undefined &&
707
- maxParts.minute !== undefined &&
708
- partsCopy.minute > maxParts.minute) {
709
- partsCopy.minute = maxParts.minute;
710
- }
711
- }
712
- }
713
- return partsCopy;
714
- };
715
- /**
716
- * Returns the closest date to refParts
717
- * that also meets the constraints of
718
- * the *Values params.
719
- */
720
- const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
721
- const { hour, minute, day, month, year } = refParts;
722
- const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
723
- if (yearValues !== undefined) {
724
- // Filters out years that are out of the min/max bounds
725
- const filteredYears = yearValues.filter((year) => {
726
- if (minParts !== undefined && year < minParts.year) {
727
- return false;
728
- }
729
- if (maxParts !== undefined && year > maxParts.year) {
730
- return false;
731
- }
732
- return true;
733
- });
734
- copyParts.year = findClosestValue(year, filteredYears);
735
- }
736
- if (monthValues !== undefined) {
737
- // Filters out months that are out of the min/max bounds
738
- const filteredMonths = monthValues.filter((month) => {
739
- if (minParts !== undefined && copyParts.year === minParts.year && month < minParts.month) {
740
- return false;
741
- }
742
- if (maxParts !== undefined && copyParts.year === maxParts.year && month > maxParts.month) {
743
- return false;
744
- }
745
- return true;
746
- });
747
- copyParts.month = findClosestValue(month, filteredMonths);
748
- }
749
- // Day is nullable but cannot be undefined
750
- if (day !== null && dayValues !== undefined) {
751
- // Filters out days that are out of the min/max bounds
752
- const filteredDays = dayValues.filter((day) => {
753
- if (minParts !== undefined && isBefore(Object.assign(Object.assign({}, copyParts), { day }), minParts)) {
754
- return false;
755
- }
756
- if (maxParts !== undefined && isAfter(Object.assign(Object.assign({}, copyParts), { day }), maxParts)) {
757
- return false;
758
- }
759
- return true;
760
- });
761
- copyParts.day = findClosestValue(day, filteredDays);
762
- }
763
- if (hour !== undefined && hourValues !== undefined) {
764
- // Filters out hours that are out of the min/max bounds
765
- const filteredHours = hourValues.filter((hour) => {
766
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.hour) !== undefined && isSameDay(copyParts, minParts) && hour < minParts.hour) {
767
- return false;
768
- }
769
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.hour) !== undefined && isSameDay(copyParts, maxParts) && hour > maxParts.hour) {
770
- return false;
771
- }
772
- return true;
773
- });
774
- copyParts.hour = findClosestValue(hour, filteredHours);
775
- copyParts.ampm = parseAmPm(copyParts.hour);
776
- }
777
- if (minute !== undefined && minuteValues !== undefined) {
778
- // Filters out minutes that are out of the min/max bounds
779
- const filteredMinutes = minuteValues.filter((minute) => {
780
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.minute) !== undefined &&
781
- isSameDay(copyParts, minParts) &&
782
- copyParts.hour === minParts.hour &&
783
- minute < minParts.minute) {
784
- return false;
785
- }
786
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.minute) !== undefined &&
787
- isSameDay(copyParts, maxParts) &&
788
- copyParts.hour === maxParts.hour &&
789
- minute > maxParts.minute) {
790
- return false;
791
- }
792
- return true;
793
- });
794
- copyParts.minute = findClosestValue(minute, filteredMinutes);
795
- }
796
- return copyParts;
797
- };
798
- /**
799
- * Finds the value in "values" that is
800
- * numerically closest to "reference".
801
- * This function assumes that "values" is
802
- * already sorted in ascending order.
803
- * @param reference The reference number to use
804
- * when finding the closest value
805
- * @param values The allowed values that will be
806
- * searched to find the closest value to "reference"
807
- */
808
- const findClosestValue = (reference, values) => {
809
- let closestValue = values[0];
810
- let rank = Math.abs(closestValue - reference);
811
- for (let i = 1; i < values.length; i++) {
812
- const value = values[i];
813
- /**
814
- * This code prioritizes the first
815
- * closest result. Given two values
816
- * with the same distance from reference,
817
- * this code will prioritize the smaller of
818
- * the two values.
819
- */
820
- const valueRank = Math.abs(value - reference);
821
- if (valueRank < rank) {
822
- closestValue = value;
823
- rank = valueRank;
824
- }
825
- }
826
- return closestValue;
827
- };
828
-
829
- const getFormattedDayPeriod = (dayPeriod) => {
830
- if (dayPeriod === undefined) {
831
- return '';
832
- }
833
- return dayPeriod.toUpperCase();
834
- };
835
- /**
836
- * Including time zone options may lead to the rendered text showing a
837
- * different time from what was selected in the Datetime, which could cause
838
- * confusion.
839
- */
840
- const stripTimeZone = (formatOptions) => {
841
- return Object.assign(Object.assign({}, formatOptions), {
842
- /**
843
- * Setting the time zone to UTC ensures that the value shown is always the
844
- * same as what was selected and safeguards against older Safari bugs with
845
- * Intl.DateTimeFormat.
846
- */
847
- timeZone: 'UTC',
848
- /**
849
- * We do not want to display the time zone name
850
- */
851
- timeZoneName: undefined
852
- });
853
- };
854
- const getLocalizedTime = (locale, refParts, hourCycle, formatOptions = { hour: 'numeric', minute: 'numeric' }) => {
855
- const timeParts = {
856
- hour: refParts.hour,
857
- minute: refParts.minute,
858
- };
859
- if (timeParts.hour === undefined || timeParts.minute === undefined) {
860
- return 'Invalid Time';
861
- }
862
- return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, stripTimeZone(formatOptions)), {
863
- /**
864
- * We use hourCycle here instead of hour12 due to:
865
- * https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
866
- */
867
- hourCycle
868
- })).format(new Date(convertDataToISO(Object.assign({
869
- /**
870
- * JS uses a simplified ISO 8601 format which allows for
871
- * date-only formats and date-time formats, but not
872
- * time-only formats: https://tc39.es/ecma262/#sec-date-time-string-format
873
- * As a result, developers who only pass a time will get
874
- * an "Invalid Date" error. To account for this, we make sure that
875
- * year/day/month values are set when passing to new Date().
876
- * The Intl.DateTimeFormat call above only uses the hour/minute
877
- * values, so passing these date values should have no impact
878
- * on the time output.
879
- */
880
- year: 2023, day: 1, month: 1
881
- }, timeParts)) + 'Z'));
882
- };
883
- /**
884
- * Adds padding to a time value so
885
- * that it is always 2 digits.
886
- */
887
- const addTimePadding = (value) => {
888
- const valueToString = value.toString();
889
- if (valueToString.length > 1) {
890
- return valueToString;
891
- }
892
- return `0${valueToString}`;
893
- };
894
- /**
895
- * Formats 24 hour times so that
896
- * it always has 2 digits. For
897
- * 12 hour times it ensures that
898
- * hour 0 is formatted as '12'.
899
- */
900
- const getFormattedHour = (hour, hourCycle) => {
901
- /**
902
- * Midnight for h11 starts at 0:00am
903
- * Midnight for h12 starts at 12:00am
904
- * Midnight for h23 starts at 00:00
905
- * Midnight for h24 starts at 24:00
906
- */
907
- if (hour === 0) {
908
- switch (hourCycle) {
909
- case 'h11':
910
- return '0';
911
- case 'h12':
912
- return '12';
913
- case 'h23':
914
- return '00';
915
- case 'h24':
916
- return '24';
917
- default:
918
- throw new Error(`Invalid hour cycle "${hourCycle}"`);
919
- }
920
- }
921
- const use24Hour = is24Hour(hourCycle);
922
- /**
923
- * h23 and h24 use 24 hour times.
924
- */
925
- if (use24Hour) {
926
- return addTimePadding(hour);
927
- }
928
- return hour.toString();
929
- };
930
- /**
931
- * Generates an aria-label to be read by screen readers
932
- * given a local, a date, and whether or not that date is
933
- * today's date.
934
- */
935
- const generateDayAriaLabel = (locale, today, refParts) => {
936
- if (refParts.day === null) {
937
- return null;
938
- }
939
- /**
940
- * MM/DD/YYYY will return midnight in the user's timezone.
941
- */
942
- const date = getNormalizedDate(refParts);
943
- const labelString = new Intl.DateTimeFormat(locale, {
944
- weekday: 'long',
945
- month: 'long',
946
- day: 'numeric',
947
- timeZone: 'UTC',
948
- }).format(date);
949
- /**
950
- * If date is today, prepend "Today" so screen readers indicate
951
- * that the date is today.
952
- */
953
- return today ? `Today, ${labelString}` : labelString;
954
- };
955
- /**
956
- * Given a locale and a date object,
957
- * return a formatted string that includes
958
- * the month name and full year.
959
- * Example: May 2021
960
- */
961
- const getMonthAndYear = (locale, refParts) => {
962
- const date = getNormalizedDate(refParts);
963
- return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(date);
964
- };
965
- /**
966
- * Given a locale and a date object,
967
- * return a formatted string that includes
968
- * the numeric day.
969
- * Note: Some languages will add literal characters
970
- * to the end. This function removes those literals.
971
- * Example: 29
972
- */
973
- const getDay = (locale, refParts) => {
974
- return getLocalizedDateTimeParts(locale, refParts, { day: 'numeric' }).find((obj) => obj.type === 'day').value;
975
- };
976
- /**
977
- * Given a locale and a date object,
978
- * return a formatted string that includes
979
- * the numeric year.
980
- * Example: 2022
981
- */
982
- const getYear = (locale, refParts) => {
983
- return getLocalizedDateTime(locale, refParts, { year: 'numeric' });
984
- };
985
- /**
986
- * Given reference parts, return a JS Date object
987
- * with a normalized time.
988
- */
989
- const getNormalizedDate = (refParts) => {
990
- var _a, _b, _c;
991
- const timeString = refParts.hour !== undefined && refParts.minute !== undefined ? ` ${refParts.hour}:${refParts.minute}` : '';
992
- /**
993
- * We use / notation here for the date
994
- * so we do not need to do extra work and pad values with zeroes.
995
- * Values such as YYYY-MM are still valid, so
996
- * we add fallback values so we still get
997
- * a valid date otherwise we will pass in a string
998
- * like "//2023". Some browsers, such as Chrome, will
999
- * account for this and still return a valid date. However,
1000
- * this is not a consistent behavior across all browsers.
1001
- */
1002
- return new Date(`${(_a = refParts.month) !== null && _a !== void 0 ? _a : 1}/${(_b = refParts.day) !== null && _b !== void 0 ? _b : 1}/${(_c = refParts.year) !== null && _c !== void 0 ? _c : 2023}${timeString} GMT+0000`);
1003
- };
1004
- /**
1005
- * Given a locale, DatetimeParts, and options
1006
- * format the DatetimeParts according to the options
1007
- * and locale combination. This returns a string. If
1008
- * you want an array of the individual pieces
1009
- * that make up the localized date string, use
1010
- * getLocalizedDateTimeParts.
1011
- */
1012
- const getLocalizedDateTime = (locale, refParts, options) => {
1013
- const date = getNormalizedDate(refParts);
1014
- return getDateTimeFormat(locale, stripTimeZone(options)).format(date);
1015
- };
1016
- /**
1017
- * Given a locale, DatetimeParts, and options
1018
- * format the DatetimeParts according to the options
1019
- * and locale combination. This returns an array of
1020
- * each piece of the date.
1021
- */
1022
- const getLocalizedDateTimeParts = (locale, refParts, options) => {
1023
- const date = getNormalizedDate(refParts);
1024
- return getDateTimeFormat(locale, options).formatToParts(date);
1025
- };
1026
- /**
1027
- * Wrapper function for Intl.DateTimeFormat.
1028
- * Allows developers to apply an allowed format to DatetimeParts.
1029
- * This function also has built in safeguards for older browser bugs
1030
- * with Intl.DateTimeFormat.
1031
- */
1032
- const getDateTimeFormat = (locale, options) => {
1033
- return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, options), { timeZone: 'UTC' }));
1034
- };
1035
- /**
1036
- * Gets a localized version of "Today"
1037
- * Falls back to "Today" in English for
1038
- * browsers that do not support RelativeTimeFormat.
1039
- */
1040
- const getTodayLabel = (locale) => {
1041
- if ('RelativeTimeFormat' in Intl) {
1042
- const label = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }).format(0, 'day');
1043
- return label.charAt(0).toUpperCase() + label.slice(1);
1044
- }
1045
- else {
1046
- return 'Today';
1047
- }
1048
- };
1049
- /**
1050
- * When calling toISOString(), the browser
1051
- * will convert the date to UTC time by either adding
1052
- * or subtracting the time zone offset.
1053
- * To work around this, we need to either add
1054
- * or subtract the time zone offset to the Date
1055
- * object prior to calling toISOString().
1056
- * This allows us to get an ISO string
1057
- * that is in the user's time zone.
1058
- *
1059
- * Example:
1060
- * Time zone offset is 240
1061
- * Meaning: The browser needs to add 240 minutes
1062
- * to the Date object to get UTC time.
1063
- * What Ionic does: We subtract 240 minutes
1064
- * from the Date object. The browser then adds
1065
- * 240 minutes in toISOString(). The result
1066
- * is a time that is in the user's time zone
1067
- * and not UTC.
1068
- *
1069
- * Note: Some timezones include minute adjustments
1070
- * such as 30 or 45 minutes. This is why we use setMinutes
1071
- * instead of setHours.
1072
- * Example: India Standard Time
1073
- * Timezone offset: -330 = -5.5 hours.
1074
- *
1075
- * List of timezones with 30 and 45 minute timezones:
1076
- * https://www.timeanddate.com/time/time-zones-interesting.html
1077
- */
1078
- const removeDateTzOffset = (date) => {
1079
- const tzOffset = date.getTimezoneOffset();
1080
- date.setMinutes(date.getMinutes() - tzOffset);
1081
- return date;
1082
- };
1083
- const DATE_AM = removeDateTzOffset(new Date('2022T01:00'));
1084
- const DATE_PM = removeDateTzOffset(new Date('2022T13:00'));
1085
- /**
1086
- * Formats the locale's string representation of the day period (am/pm) for a given
1087
- * ref parts day period.
1088
- *
1089
- * @param locale The locale to format the day period in.
1090
- * @param value The date string, in ISO format.
1091
- * @returns The localized day period (am/pm) representation of the given value.
1092
- */
1093
- const getLocalizedDayPeriod = (locale, dayPeriod) => {
1094
- const date = dayPeriod === 'am' ? DATE_AM : DATE_PM;
1095
- const localizedDayPeriod = new Intl.DateTimeFormat(locale, {
1096
- hour: 'numeric',
1097
- timeZone: 'UTC',
1098
- })
1099
- .formatToParts(date)
1100
- .find((part) => part.type === 'dayPeriod');
1101
- if (localizedDayPeriod) {
1102
- return localizedDayPeriod.value;
1103
- }
1104
- return getFormattedDayPeriod(dayPeriod);
1105
- };
1106
- /**
1107
- * Formats the datetime's value to a string, for use in the native input.
1108
- *
1109
- * @param value The value to format, either an ISO string or an array thereof.
1110
- */
1111
- const formatValue = (value) => {
1112
- return Array.isArray(value) ? value.join(',') : value;
1113
- };
1114
-
1115
- /**
1116
- * Returns the current date as
1117
- * an ISO string in the user's
1118
- * time zone.
1119
- */
1120
- const getToday = () => {
1121
- /**
1122
- * ion-datetime intentionally does not
1123
- * parse time zones/do automatic time zone
1124
- * conversion when accepting user input.
1125
- * However when we get today's date string,
1126
- * we want it formatted relative to the user's
1127
- * time zone.
1128
- *
1129
- * When calling toISOString(), the browser
1130
- * will convert the date to UTC time by either adding
1131
- * or subtracting the time zone offset.
1132
- * To work around this, we need to either add
1133
- * or subtract the time zone offset to the Date
1134
- * object prior to calling toISOString().
1135
- * This allows us to get an ISO string
1136
- * that is in the user's time zone.
1137
- */
1138
- return removeDateTzOffset(new Date()).toISOString();
1139
- };
1140
- const minutes = [
1141
- 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,
1142
- 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,
1143
- ];
1144
- // h11 hour system uses 0-11. Midnight starts at 0:00am.
1145
- const hour11 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
1146
- // h12 hour system uses 0-12. Midnight starts at 12:00am.
1147
- const hour12 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
1148
- // h23 hour system uses 0-23. Midnight starts at 0:00.
1149
- 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];
1150
- // h24 hour system uses 1-24. Midnight starts at 24:00.
1151
- 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];
1152
- /**
1153
- * Given a locale and a mode,
1154
- * return an array with formatted days
1155
- * of the week. iOS should display days
1156
- * such as "Mon" or "Tue".
1157
- * MD should display days such as "M"
1158
- * or "T".
1159
- */
1160
- const getDaysOfWeek = (locale, mode, firstDayOfWeek = 0) => {
1161
- /**
1162
- * Nov 1st, 2020 starts on a Sunday.
1163
- * ion-datetime assumes weeks start on Sunday,
1164
- * but is configurable via `firstDayOfWeek`.
1165
- */
1166
- const weekdayFormat = mode === 'ios' ? 'short' : 'narrow';
1167
- const intl = new Intl.DateTimeFormat(locale, { weekday: weekdayFormat });
1168
- const startDate = new Date('11/01/2020');
1169
- const daysOfWeek = [];
1170
- /**
1171
- * For each day of the week,
1172
- * get the day name.
1173
- */
1174
- for (let i = firstDayOfWeek; i < firstDayOfWeek + 7; i++) {
1175
- const currentDate = new Date(startDate);
1176
- currentDate.setDate(currentDate.getDate() + i);
1177
- daysOfWeek.push(intl.format(currentDate));
1178
- }
1179
- return daysOfWeek;
1180
- };
1181
- /**
1182
- * Returns an array containing all of the
1183
- * days in a month for a given year. Values are
1184
- * aligned with a week calendar starting on
1185
- * the firstDayOfWeek value (Sunday by default)
1186
- * using null values.
1187
- */
1188
- const getDaysOfMonth = (month, year, firstDayOfWeek, showAdjacentDays = false) => {
1189
- const numDays = getNumDaysInMonth(month, year);
1190
- let previousNumDays; //previous month number of days
1191
- if (month === 1) {
1192
- // If the current month is January, the previous month should be December of the previous year.
1193
- previousNumDays = getNumDaysInMonth(12, year - 1);
1194
- }
1195
- else {
1196
- // Otherwise, the previous month should be the current month - 1 of the same year.
1197
- previousNumDays = getNumDaysInMonth(month - 1, year);
1198
- }
1199
- const firstOfMonth = new Date(`${month}/1/${year}`).getDay();
1200
- /**
1201
- * To get the first day of the month aligned on the correct
1202
- * day of the week, we need to determine how many "filler" days
1203
- * to generate. These filler days as empty/disabled buttons
1204
- * that fill the space of the days of the week before the first
1205
- * of the month.
1206
- *
1207
- * There are two cases here:
1208
- *
1209
- * 1. If firstOfMonth = 4, firstDayOfWeek = 0 then the offset
1210
- * is (4 - (0 + 1)) = 3. Since the offset loop goes from 0 to 3 inclusive,
1211
- * this will generate 4 filler days (0, 1, 2, 3), and then day of week 4 will have
1212
- * the first day of the month.
1213
- *
1214
- * 2. If firstOfMonth = 2, firstDayOfWeek = 4 then the offset
1215
- * is (6 - (4 - 2)) = 4. Since the offset loop goes from 0 to 4 inclusive,
1216
- * this will generate 5 filler days (0, 1, 2, 3, 4), and then day of week 5 will have
1217
- * the first day of the month.
1218
- */
1219
- const offset = firstOfMonth >= firstDayOfWeek ? firstOfMonth - (firstDayOfWeek + 1) : 6 - (firstDayOfWeek - firstOfMonth);
1220
- let days = [];
1221
- for (let i = 1; i <= numDays; i++) {
1222
- days.push({ day: i, dayOfWeek: (offset + i) % 7, isAdjacentDay: false });
1223
- }
1224
- if (showAdjacentDays) {
1225
- for (let i = 0; i <= offset; i++) {
1226
- // Using offset create previous month adjacent day, starting from last day
1227
- days = [{ day: previousNumDays - i, dayOfWeek: (previousNumDays - i) % 7, isAdjacentDay: true }, ...days];
1228
- }
1229
- // Calculate positiveOffset
1230
- // The calendar will display 42 days (6 rows of 7 columns)
1231
- // Knowing this the offset is 41 (we start at index 0)
1232
- // minus (the previous offset + the current month days)
1233
- const positiveOffset = 41 - (numDays + offset);
1234
- for (let i = 0; i < positiveOffset; i++) {
1235
- days.push({ day: i + 1, dayOfWeek: (numDays + offset + i) % 7, isAdjacentDay: true });
1236
- }
1237
- }
1238
- else {
1239
- for (let i = 0; i <= offset; i++) {
1240
- days = [{ day: null, dayOfWeek: null, isAdjacentDay: false }, ...days];
1241
- }
1242
- }
1243
- return days;
1244
- };
1245
- /**
1246
- * Returns an array of pre-defined hour
1247
- * values based on the provided hourCycle.
1248
- */
1249
- const getHourData = (hourCycle) => {
1250
- switch (hourCycle) {
1251
- case 'h11':
1252
- return hour11;
1253
- case 'h12':
1254
- return hour12;
1255
- case 'h23':
1256
- return hour23;
1257
- case 'h24':
1258
- return hour24;
1259
- default:
1260
- throw new Error(`Invalid hour cycle "${hourCycle}"`);
1261
- }
1262
- };
1263
- /**
1264
- * Given a local, reference datetime parts and option
1265
- * max/min bound datetime parts, calculate the acceptable
1266
- * hour and minute values according to the bounds and locale.
1267
- */
1268
- const generateTime = (locale, refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
1269
- const computedHourCycle = getHourCycle(locale, hourCycle);
1270
- const use24Hour = is24Hour(computedHourCycle);
1271
- let processedHours = getHourData(computedHourCycle);
1272
- let processedMinutes = minutes;
1273
- let isAMAllowed = true;
1274
- let isPMAllowed = true;
1275
- if (hourValues) {
1276
- processedHours = processedHours.filter((hour) => hourValues.includes(hour));
1277
- }
1278
- if (minuteValues) {
1279
- processedMinutes = processedMinutes.filter((minute) => minuteValues.includes(minute));
1280
- }
1281
- if (minParts) {
1282
- /**
1283
- * If ref day is the same as the
1284
- * minimum allowed day, filter hour/minute
1285
- * values according to min hour and minute.
1286
- */
1287
- if (isSameDay(refParts, minParts)) {
1288
- /**
1289
- * Users may not always set the hour/minute for
1290
- * min value (i.e. 2021-06-02) so we should allow
1291
- * all hours/minutes in that case.
1292
- */
1293
- if (minParts.hour !== undefined) {
1294
- processedHours = processedHours.filter((hour) => {
1295
- const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
1296
- return (use24Hour ? hour : convertedHour) >= minParts.hour;
1297
- });
1298
- isAMAllowed = minParts.hour < 13;
1299
- }
1300
- if (minParts.minute !== undefined) {
1301
- /**
1302
- * The minimum minute range should not be enforced when
1303
- * the hour is greater than the min hour.
1304
- *
1305
- * For example with a minimum range of 09:30, users
1306
- * should be able to select 10:00-10:29 and beyond.
1307
- */
1308
- let isPastMinHour = false;
1309
- if (minParts.hour !== undefined && refParts.hour !== undefined) {
1310
- if (refParts.hour > minParts.hour) {
1311
- isPastMinHour = true;
1312
- }
1313
- }
1314
- processedMinutes = processedMinutes.filter((minute) => {
1315
- if (isPastMinHour) {
1316
- return true;
1317
- }
1318
- return minute >= minParts.minute;
1319
- });
1320
- }
1321
- /**
1322
- * If ref day is before minimum
1323
- * day do not render any hours/minute values
1324
- */
1325
- }
1326
- else if (isBefore(refParts, minParts)) {
1327
- processedHours = [];
1328
- processedMinutes = [];
1329
- isAMAllowed = isPMAllowed = false;
1330
- }
1331
- }
1332
- if (maxParts) {
1333
- /**
1334
- * If ref day is the same as the
1335
- * maximum allowed day, filter hour/minute
1336
- * values according to max hour and minute.
1337
- */
1338
- if (isSameDay(refParts, maxParts)) {
1339
- /**
1340
- * Users may not always set the hour/minute for
1341
- * max value (i.e. 2021-06-02) so we should allow
1342
- * all hours/minutes in that case.
1343
- */
1344
- if (maxParts.hour !== undefined) {
1345
- processedHours = processedHours.filter((hour) => {
1346
- const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
1347
- return (use24Hour ? hour : convertedHour) <= maxParts.hour;
1348
- });
1349
- isPMAllowed = maxParts.hour >= 12;
1350
- }
1351
- if (maxParts.minute !== undefined && refParts.hour === maxParts.hour) {
1352
- // The available minutes should only be filtered when the hour is the same as the max hour.
1353
- // For example if the max hour is 10:30 and the current hour is 10:00,
1354
- // users should be able to select 00-30 minutes.
1355
- // If the current hour is 09:00, users should be able to select 00-60 minutes.
1356
- processedMinutes = processedMinutes.filter((minute) => minute <= maxParts.minute);
1357
- }
1358
- /**
1359
- * If ref day is after minimum
1360
- * day do not render any hours/minute values
1361
- */
1362
- }
1363
- else if (isAfter(refParts, maxParts)) {
1364
- processedHours = [];
1365
- processedMinutes = [];
1366
- isAMAllowed = isPMAllowed = false;
1367
- }
1368
- }
1369
- return {
1370
- hours: processedHours,
1371
- minutes: processedMinutes,
1372
- am: isAMAllowed,
1373
- pm: isPMAllowed,
1374
- };
1375
- };
1376
- /**
1377
- * Given DatetimeParts, generate the previous,
1378
- * current, and and next months.
1379
- */
1380
- const generateMonths = (refParts, forcedDate) => {
1381
- const current = { month: refParts.month, year: refParts.year, day: refParts.day };
1382
- /**
1383
- * If we're forcing a month to appear, and it's different from the current month,
1384
- * ensure it appears by replacing the next or previous month as appropriate.
1385
- */
1386
- if (forcedDate !== undefined && (refParts.month !== forcedDate.month || refParts.year !== forcedDate.year)) {
1387
- const forced = { month: forcedDate.month, year: forcedDate.year, day: forcedDate.day };
1388
- const forcedMonthIsBefore = isBefore(forced, current);
1389
- return forcedMonthIsBefore
1390
- ? [forced, current, getNextMonth(refParts)]
1391
- : [getPreviousMonth(refParts), current, forced];
1392
- }
1393
- return [getPreviousMonth(refParts), current, getNextMonth(refParts)];
1394
- };
1395
- const getMonthColumnData = (locale, refParts, minParts, maxParts, monthValues, formatOptions = {
1396
- month: 'long',
1397
- }) => {
1398
- const { year } = refParts;
1399
- const months = [];
1400
- if (monthValues !== undefined) {
1401
- let processedMonths = monthValues;
1402
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.month) !== undefined) {
1403
- processedMonths = processedMonths.filter((month) => month <= maxParts.month);
1404
- }
1405
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.month) !== undefined) {
1406
- processedMonths = processedMonths.filter((month) => month >= minParts.month);
1407
- }
1408
- processedMonths.forEach((processedMonth) => {
1409
- const date = new Date(`${processedMonth}/1/${year} GMT+0000`);
1410
- const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1411
- months.push({ text: monthString, value: processedMonth });
1412
- });
1413
- }
1414
- else {
1415
- const maxMonth = maxParts && maxParts.year === year ? maxParts.month : 12;
1416
- const minMonth = minParts && minParts.year === year ? minParts.month : 1;
1417
- for (let i = minMonth; i <= maxMonth; i++) {
1418
- /**
1419
- *
1420
- * There is a bug on iOS 14 where
1421
- * Intl.DateTimeFormat takes into account
1422
- * the local timezone offset when formatting dates.
1423
- *
1424
- * Forcing the timezone to 'UTC' fixes the issue. However,
1425
- * we should keep this workaround as it is safer. In the event
1426
- * this breaks in another browser, we will not be impacted
1427
- * because all dates will be interpreted in UTC.
1428
- *
1429
- * Example:
1430
- * new Intl.DateTimeFormat('en-US', { month: 'long' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "March"
1431
- * new Intl.DateTimeFormat('en-US', { month: 'long', timeZone: 'UTC' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "April"
1432
- *
1433
- * In certain timezones, iOS 14 shows the wrong
1434
- * date for .toUTCString(). To combat this, we
1435
- * force all of the timezones to GMT+0000 (UTC).
1436
- *
1437
- * Example:
1438
- * Time Zone: Central European Standard Time
1439
- * new Date('1/1/1992').toUTCString() // "Tue, 31 Dec 1991 23:00:00 GMT"
1440
- * new Date('1/1/1992 GMT+0000').toUTCString() // "Wed, 01 Jan 1992 00:00:00 GMT"
1441
- */
1442
- const date = new Date(`${i}/1/${year} GMT+0000`);
1443
- const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1444
- months.push({ text: monthString, value: i });
1445
- }
1446
- }
1447
- return months;
1448
- };
1449
- /**
1450
- * Returns information regarding
1451
- * selectable dates (i.e 1st, 2nd, 3rd, etc)
1452
- * within a reference month.
1453
- * @param locale The locale to format the date with
1454
- * @param refParts The reference month/year to generate dates for
1455
- * @param minParts The minimum bound on the date that can be returned
1456
- * @param maxParts The maximum bound on the date that can be returned
1457
- * @param dayValues The allowed date values
1458
- * @returns Date data to be used in ion-picker-column
1459
- */
1460
- const getDayColumnData = (locale, refParts, minParts, maxParts, dayValues, formatOptions = {
1461
- day: 'numeric',
1462
- }) => {
1463
- const { month, year } = refParts;
1464
- const days = [];
1465
- /**
1466
- * If we have max/min bounds that in the same
1467
- * month/year as the refParts, we should
1468
- * use the define day as the max/min day.
1469
- * Otherwise, fallback to the max/min days in a month.
1470
- */
1471
- const numDaysInMonth = getNumDaysInMonth(month, year);
1472
- 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
1473
- ? maxParts.day
1474
- : numDaysInMonth;
1475
- 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
1476
- ? minParts.day
1477
- : 1;
1478
- if (dayValues !== undefined) {
1479
- let processedDays = dayValues;
1480
- processedDays = processedDays.filter((day) => day >= minDay && day <= maxDay);
1481
- processedDays.forEach((processedDay) => {
1482
- const date = new Date(`${month}/${processedDay}/${year} GMT+0000`);
1483
- const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1484
- days.push({ text: dayString, value: processedDay });
1485
- });
1486
- }
1487
- else {
1488
- for (let i = minDay; i <= maxDay; i++) {
1489
- const date = new Date(`${month}/${i}/${year} GMT+0000`);
1490
- const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
1491
- days.push({ text: dayString, value: i });
1492
- }
1493
- }
1494
- return days;
1495
- };
1496
- const getYearColumnData = (locale, refParts, minParts, maxParts, yearValues) => {
1497
- var _a, _b;
1498
- let processedYears = [];
1499
- if (yearValues !== undefined) {
1500
- processedYears = yearValues;
1501
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== undefined) {
1502
- processedYears = processedYears.filter((year) => year <= maxParts.year);
1503
- }
1504
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.year) !== undefined) {
1505
- processedYears = processedYears.filter((year) => year >= minParts.year);
1506
- }
1507
- }
1508
- else {
1509
- const { year } = refParts;
1510
- const maxYear = (_a = maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== null && _a !== void 0 ? _a : year;
1511
- const minYear = (_b = minParts === null || minParts === void 0 ? void 0 : minParts.year) !== null && _b !== void 0 ? _b : year - 100;
1512
- for (let i = minYear; i <= maxYear; i++) {
1513
- processedYears.push(i);
1514
- }
1515
- }
1516
- return processedYears.map((year) => ({
1517
- text: getYear(locale, { year, month: refParts.month, day: refParts.day }),
1518
- value: year,
1519
- }));
1520
- };
1521
- /**
1522
- * Given a starting date and an upper bound,
1523
- * this functions returns an array of all
1524
- * month objects in that range.
1525
- */
1526
- const getAllMonthsInRange = (currentParts, maxParts) => {
1527
- if (currentParts.month === maxParts.month && currentParts.year === maxParts.year) {
1528
- return [currentParts];
1529
- }
1530
- return [currentParts, ...getAllMonthsInRange(getNextMonth(currentParts), maxParts)];
1531
- };
1532
- /**
1533
- * Creates and returns picker items
1534
- * that represent the days in a month.
1535
- * Example: "Thu, Jun 2"
1536
- */
1537
- const getCombinedDateColumnData = (locale, todayParts, minParts, maxParts, dayValues, monthValues) => {
1538
- let items = [];
1539
- let parts = [];
1540
- /**
1541
- * Get all month objects from the min date
1542
- * to the max date. Note: Do not use getMonthColumnData
1543
- * as that function only generates dates within a
1544
- * single year.
1545
- */
1546
- let months = getAllMonthsInRange(minParts, maxParts);
1547
- /**
1548
- * Filter out any disallowed month values.
1549
- */
1550
- if (monthValues) {
1551
- months = months.filter(({ month }) => monthValues.includes(month));
1552
- }
1553
- /**
1554
- * Get all of the days in the month.
1555
- * From there, generate an array where
1556
- * each item has the month, date, and day
1557
- * of work as the text.
1558
- */
1559
- months.forEach((monthObject) => {
1560
- const referenceMonth = { month: monthObject.month, day: null, year: monthObject.year };
1561
- const monthDays = getDayColumnData(locale, referenceMonth, minParts, maxParts, dayValues, {
1562
- month: 'short',
1563
- day: 'numeric',
1564
- weekday: 'short',
1565
- });
1566
- const dateParts = [];
1567
- const dateColumnItems = [];
1568
- monthDays.forEach((dayObject) => {
1569
- const isToday = isSameDay(Object.assign(Object.assign({}, referenceMonth), { day: dayObject.value }), todayParts);
1570
- /**
1571
- * Today's date should read as "Today" (localized)
1572
- * not the actual date string
1573
- */
1574
- dateColumnItems.push({
1575
- text: isToday ? getTodayLabel(locale) : dayObject.text,
1576
- value: `${referenceMonth.year}-${referenceMonth.month}-${dayObject.value}`,
1577
- });
1578
- /**
1579
- * When selecting a date in the wheel picker
1580
- * we need access to the raw datetime parts data.
1581
- * The picker column only accepts values of
1582
- * type string or number, so we need to return
1583
- * two sets of data: A data set to be passed
1584
- * to the picker column, and a data set to
1585
- * be used to reference the raw data when
1586
- * updating the picker column value.
1587
- */
1588
- dateParts.push({
1589
- month: referenceMonth.month,
1590
- year: referenceMonth.year,
1591
- day: dayObject.value,
1592
- });
1593
- });
1594
- parts = [...parts, ...dateParts];
1595
- items = [...items, ...dateColumnItems];
1596
- });
1597
- return {
1598
- parts,
1599
- items,
1600
- };
1601
- };
1602
- const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues) => {
1603
- const computedHourCycle = getHourCycle(locale, hourCycle);
1604
- const use24Hour = is24Hour(computedHourCycle);
1605
- const { hours, minutes, am, pm } = generateTime(locale, refParts, computedHourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues);
1606
- const hoursItems = hours.map((hour) => {
1607
- return {
1608
- text: getFormattedHour(hour, computedHourCycle),
1609
- value: getInternalHourValue(hour, use24Hour, refParts.ampm),
1610
- };
1611
- });
1612
- const minutesItems = minutes.map((minute) => {
1613
- return {
1614
- text: addTimePadding(minute),
1615
- value: minute,
1616
- };
1617
- });
1618
- const dayPeriodItems = [];
1619
- if (am && !use24Hour) {
1620
- dayPeriodItems.push({
1621
- text: getLocalizedDayPeriod(locale, 'am'),
1622
- value: 'am',
1623
- });
1624
- }
1625
- if (pm && !use24Hour) {
1626
- dayPeriodItems.push({
1627
- text: getLocalizedDayPeriod(locale, 'pm'),
1628
- value: 'pm',
1629
- });
1630
- }
1631
- return {
1632
- minutesData: minutesItems,
1633
- hoursData: hoursItems,
1634
- dayPeriodData: dayPeriodItems,
1635
- };
1636
- };
1637
-
1638
- export { getClosestValidDate as A, generateMonths as B, getNumDaysInMonth as C, getCombinedDateColumnData as D, getMonthColumnData as E, getDayColumnData as F, getYearColumnData as G, isMonthFirstLocale as H, getTimeColumnsData as I, isLocaleDayPeriodRTL as J, getDaysOfWeek as K, getMonthAndYear as L, getDaysOfMonth as M, getHourCycle as N, getLocalizedTime as O, getLocalizedDateTime as P, formatValue as Q, calculateHourFromAMPM as R, isAfter as a, getNextMonth as b, isSameDay as c, getDay as d, generateDayAriaLabel as e, getPartsFromCalendarDay as f, getPreviousMonth as g, getNextYear as h, isBefore as i, getPreviousYear as j, getEndOfWeek as k, getStartOfWeek as l, getPreviousDay as m, getNextDay as n, getPreviousWeek as o, getNextWeek as p, parseMinParts as q, parseMaxParts as r, parseDate as s, parseAmPm as t, clampDate as u, validateParts as v, warnIfValueOutOfBounds as w, convertToArrayOfNumbers as x, convertDataToISO as y, getToday as z };