@ionic/core 8.8.17 → 8.8.18-dev.11786108988.1fd94742

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 (782) hide show
  1. package/components/index.js +1 -1
  2. package/components/ion-accordion-group.js +1 -1
  3. package/components/ion-accordion.js +1 -1
  4. package/components/ion-action-sheet.js +1 -1
  5. package/components/ion-alert.js +1 -1
  6. package/components/ion-app.js +1 -1
  7. package/components/ion-avatar.js +1 -1
  8. package/components/ion-back-button.js +1 -1
  9. package/components/ion-backdrop.js +1 -1
  10. package/components/ion-badge.js +1 -1
  11. package/components/ion-breadcrumb.js +1 -1
  12. package/components/ion-breadcrumbs.js +1 -1
  13. package/components/ion-button.js +1 -1
  14. package/components/ion-buttons.js +1 -1
  15. package/components/ion-card-content.js +1 -1
  16. package/components/ion-card-header.js +1 -1
  17. package/components/ion-card-subtitle.js +1 -1
  18. package/components/ion-card-title.js +1 -1
  19. package/components/ion-card.js +1 -1
  20. package/components/ion-checkbox.js +1 -1
  21. package/components/ion-chip.js +1 -1
  22. package/components/ion-col.js +1 -1
  23. package/components/ion-content.js +1 -1
  24. package/components/ion-datetime-button.js +1 -1
  25. package/components/ion-datetime.js +1 -1
  26. package/components/ion-fab-button.js +1 -1
  27. package/components/ion-fab-list.js +1 -1
  28. package/components/ion-fab.js +1 -1
  29. package/components/ion-footer.js +1 -1
  30. package/components/ion-grid.js +1 -1
  31. package/components/ion-header.js +1 -1
  32. package/components/ion-icon.js +1 -1
  33. package/components/ion-img.js +1 -1
  34. package/components/ion-infinite-scroll-content.js +1 -1
  35. package/components/ion-infinite-scroll.js +1 -1
  36. package/components/ion-input-otp.js +1 -1
  37. package/components/ion-input-password-toggle.js +1 -1
  38. package/components/ion-input.js +1 -1
  39. package/components/ion-item-divider.js +1 -1
  40. package/components/ion-item-group.js +1 -1
  41. package/components/ion-item-option.js +1 -1
  42. package/components/ion-item-options.js +1 -1
  43. package/components/ion-item-sliding.js +1 -1
  44. package/components/ion-item.js +1 -1
  45. package/components/ion-label.js +1 -1
  46. package/components/ion-list-header.js +1 -1
  47. package/components/ion-list.js +1 -1
  48. package/components/ion-loading.js +1 -1
  49. package/components/ion-menu-button.js +1 -1
  50. package/components/ion-menu-toggle.js +1 -1
  51. package/components/ion-menu.js +1 -1
  52. package/components/ion-modal.js +1 -1
  53. package/components/ion-nav-link.js +1 -1
  54. package/components/ion-nav.js +1 -1
  55. package/components/ion-note.js +1 -1
  56. package/components/ion-picker-column-option.js +1 -1
  57. package/components/ion-picker-column.js +1 -1
  58. package/components/ion-picker.js +1 -1
  59. package/components/ion-popover.js +1 -1
  60. package/components/ion-progress-bar.js +1 -1
  61. package/components/ion-radio-group.js +1 -1
  62. package/components/ion-radio.js +1 -1
  63. package/components/ion-range.js +1 -1
  64. package/components/ion-refresher-content.js +1 -1
  65. package/components/ion-refresher.js +1 -1
  66. package/components/ion-reorder-group.js +1 -1
  67. package/components/ion-reorder.js +1 -1
  68. package/components/ion-ripple-effect.js +1 -1
  69. package/components/ion-route-redirect.js +1 -1
  70. package/components/ion-route.js +1 -1
  71. package/components/ion-router-link.js +1 -1
  72. package/components/ion-router-outlet.js +1 -1
  73. package/components/ion-router.js +1 -1
  74. package/components/ion-row.js +1 -1
  75. package/components/ion-searchbar.js +1 -1
  76. package/components/ion-segment-button.js +1 -1
  77. package/components/ion-segment-content.js +1 -1
  78. package/components/ion-segment-view.js +1 -1
  79. package/components/ion-segment.js +1 -1
  80. package/components/ion-select-modal.js +1 -1
  81. package/components/ion-select-option.js +1 -1
  82. package/components/ion-select-popover.js +1 -1
  83. package/components/ion-select.js +1 -1
  84. package/components/ion-skeleton-text.js +1 -1
  85. package/components/ion-spinner.js +1 -1
  86. package/components/ion-split-pane.js +1 -1
  87. package/components/ion-tab-bar.js +1 -1
  88. package/components/ion-tab-button.js +1 -1
  89. package/components/ion-tab.js +1 -1
  90. package/components/ion-tabs.js +1 -1
  91. package/components/ion-text.js +1 -1
  92. package/components/ion-textarea.js +1 -1
  93. package/components/ion-thumbnail.js +1 -1
  94. package/components/ion-title.js +1 -1
  95. package/components/ion-toast.js +1 -1
  96. package/components/ion-toggle.js +1 -1
  97. package/components/ion-toolbar.js +1 -1
  98. package/components/p-0tt0PTAe.js +4 -0
  99. package/components/p-3dKnMgX5.js +4 -0
  100. package/components/p-6e_5igwn.js +4 -0
  101. package/components/{p--JUspHvy.js → p-AqD_wmvU.js} +1 -1
  102. package/components/p-B-FxiyeI.js +4 -0
  103. package/components/p-B4COLbAV.js +4 -0
  104. package/components/p-B9zzUBwR.js +4 -0
  105. package/components/p-BFU7kgcj.js +4 -0
  106. package/components/p-BMPN55of.js +4 -0
  107. package/components/p-BPbRjpb2.js +4 -0
  108. package/components/p-BSQPZ79H.js +4 -0
  109. package/{dist/ionic/p-KjNvRoEp.js → components/p-BXQ7upSC.js} +1 -1
  110. package/components/p-BhamHSw3.js +4 -0
  111. package/components/p-BrXE0XUu.js +4 -0
  112. package/components/p-Bv7Rqz3Z.js +4 -0
  113. package/components/p-Bw7MMRH7.js +4 -0
  114. package/components/p-C-X5vb8f.js +4 -0
  115. package/components/p-C117Majq.js +4 -0
  116. package/components/{p-ChIZKXUu.js → p-C6JOi8wS.js} +1 -1
  117. package/components/p-CCVPk59A.js +4 -0
  118. package/components/p-CEW4RXZO.js +4 -0
  119. package/components/p-CKMc290p.js +4 -0
  120. package/components/{p-BkKAANMJ.js → p-CO5nI-BZ.js} +1 -1
  121. package/components/p-COQ_7Wwc.js +4 -0
  122. package/components/p-CQbh6Be_.js +4 -0
  123. package/components/p-CQtcj8t7.js +4 -0
  124. package/components/p-Cap9bvqr.js +4 -0
  125. package/components/p-CdP7ze2J.js +4 -0
  126. package/components/p-CfyJ_Ogc.js +4 -0
  127. package/components/p-ChWC4-vA.js +4 -0
  128. package/components/p-CmKf4pgI.js +4 -0
  129. package/components/p-CqYSqB9_.js +4 -0
  130. package/{dist/ionic/p-DC3RagnA.js → components/p-Cwsd9bue.js} +1 -1
  131. package/components/{p-D3xo7hqU.js → p-D0pL_HuH.js} +1 -1
  132. package/components/p-D0xd6h3Q.js +4 -0
  133. package/components/p-D28LaDuR.js +4 -0
  134. package/components/p-D7-vHX0A.js +4 -0
  135. package/components/p-D9KqizZs.js +4 -0
  136. package/components/p-DIZE3CVV.js +4 -0
  137. package/components/p-DL8rd5jo.js +4 -0
  138. package/components/p-DRcApg6F.js +4 -0
  139. package/components/p-DTTnwMiS.js +4 -0
  140. package/components/p-DWCzVL3Y.js +4 -0
  141. package/components/p-DYmrV1HT.js +4 -0
  142. package/components/{p-DqLB8yFQ.js → p-Dcu-SAJG.js} +1 -1
  143. package/components/p-DnINLmwC.js +4 -0
  144. package/components/{p-DRugphUN.js → p-DsNz6_gM.js} +1 -1
  145. package/components/p-DtiuiOTk.js +4 -0
  146. package/components/p-DunYzubP.js +4 -0
  147. package/components/p-DwcSJ9u1.js +4 -0
  148. package/components/p-QCPSB1bo.js +4 -0
  149. package/components/p-RvtofbHn.js +4 -0
  150. package/components/p-TXPDHL13.js +4 -0
  151. package/components/p-WOFp6fXj.js +4 -0
  152. package/components/p-byZM6qHV.js +4 -0
  153. package/components/{p-C_hpsif8.js → p-ltNYIRmI.js} +1 -1
  154. package/components/p-miSGCTAU.js +4 -0
  155. package/components/p-mpdX3emm.js +4 -0
  156. package/components/p-nvqVLrWC.js +4 -0
  157. package/components/p-qiWM96Sz.js +4 -0
  158. package/components/p-vlF0Bcfd.js +4 -0
  159. package/dist/cjs/{animation-BJq0kcy2.js → animation-D5WDBRvT.js} +4 -4
  160. package/dist/cjs/{app-globals-BlqrqKTN.js → app-globals-C2s3Cbal.js} +1 -1
  161. package/dist/cjs/{button-active-0mPOKmV2.js → button-active-CXI2TseG.js} +3 -3
  162. package/dist/cjs/config-CjUbvdPW.js +36 -0
  163. package/dist/cjs/{dir-Cn0z1rJH.js → dir-Brx7VkvP.js} +1 -1
  164. package/dist/cjs/{format-PxvGiOik.js → format-ZfKtcdit.js} +40 -30
  165. package/dist/cjs/{framework-delegate-BtICZDHr.js → framework-delegate-Bdvk3JQO.js} +5 -7
  166. package/dist/cjs/{gesture-controller-dtqlP_q4.js → gesture-controller-BDUH7687.js} +15 -8
  167. package/dist/cjs/{haptic-ClPPQ_PS.js → haptic-Ch-X4gRx.js} +2 -3
  168. package/dist/cjs/{hardware-back-button-iUuF_76h.js → hardware-back-button-zr8zeYaH.js} +4 -4
  169. package/dist/cjs/{helpers-Cv23MFHM.js → helpers-DURh1XdY.js} +3 -3
  170. package/dist/cjs/{index-aC4x3Fk3.js → index-B7sCu6vN.js} +6 -7
  171. package/dist/cjs/{index-CIrkNXqJ.js → index-BnhnwL1o.js} +2 -2
  172. package/dist/cjs/{index-D81eLYUM.js → index-Btdix80K.js} +2 -2
  173. package/dist/cjs/{index-Ct7gcRif.js → index-CAThePqm.js} +4 -6
  174. package/dist/cjs/index-DhSx3VvD.js +429 -0
  175. package/dist/cjs/{index-BERfRao3.js → index-DsoHs7Ly.js} +5 -5
  176. package/dist/cjs/{index-CAvQ7Tka.js → index-P1nQxrpZ.js} +10 -4
  177. package/dist/cjs/{index-DqmRDbxg.js → index-wOmugbdg.js} +1 -1
  178. package/dist/cjs/index.cjs.js +18 -18
  179. package/dist/cjs/{input-shims-CFLg7uzj.js → input-shims-CPbWb84M.js} +9 -11
  180. package/dist/cjs/{input.utils-DetjmtH2.js → input.utils-CkASW3mE.js} +3 -4
  181. package/dist/cjs/ion-accordion_2.cjs.entry.js +368 -340
  182. package/dist/cjs/ion-action-sheet.cjs.entry.js +187 -76
  183. package/dist/cjs/ion-alert.cjs.entry.js +273 -111
  184. package/dist/cjs/ion-app_8.cjs.entry.js +306 -190
  185. package/dist/cjs/ion-avatar_3.cjs.entry.js +10 -4
  186. package/dist/cjs/ion-back-button.cjs.entry.js +47 -23
  187. package/dist/cjs/ion-backdrop.cjs.entry.js +18 -14
  188. package/dist/cjs/ion-breadcrumb_2.cjs.entry.js +199 -121
  189. package/dist/cjs/ion-button_2.cjs.entry.js +138 -66
  190. package/dist/cjs/ion-card_5.cjs.entry.js +82 -30
  191. package/dist/cjs/ion-checkbox.cjs.entry.js +152 -101
  192. package/dist/cjs/ion-chip.cjs.entry.js +17 -11
  193. package/dist/cjs/ion-col_3.cjs.entry.js +134 -10
  194. package/dist/cjs/ion-datetime-button.cjs.entry.js +253 -241
  195. package/dist/cjs/ion-datetime.cjs.entry.js +2767 -0
  196. package/dist/cjs/ion-fab_3.cjs.entry.js +139 -81
  197. package/dist/cjs/ion-img.cjs.entry.js +34 -12
  198. package/dist/cjs/ion-infinite-scroll_2.cjs.entry.js +100 -72
  199. package/dist/cjs/ion-input-otp.cjs.entry.js +433 -370
  200. package/dist/cjs/ion-input-password-toggle.cjs.entry.js +33 -19
  201. package/dist/cjs/ion-input.cjs.entry.js +314 -168
  202. package/dist/cjs/ion-item-option_3.cjs.entry.js +91 -51
  203. package/dist/cjs/ion-item_8.cjs.entry.js +181 -82
  204. package/dist/cjs/ion-loading.cjs.entry.js +146 -60
  205. package/dist/cjs/ion-menu_3.cjs.entry.js +163 -101
  206. package/dist/cjs/ion-modal.cjs.entry.js +418 -251
  207. package/dist/cjs/ion-nav_2.cjs.entry.js +100 -157
  208. package/dist/cjs/ion-picker-column-option.cjs.entry.js +37 -33
  209. package/dist/cjs/ion-picker-column.cjs.entry.js +417 -405
  210. package/dist/cjs/ion-picker.cjs.entry.js +401 -392
  211. package/dist/cjs/ion-popover.cjs.entry.js +319 -205
  212. package/dist/cjs/ion-progress-bar.cjs.entry.js +31 -25
  213. package/dist/cjs/ion-radio_2.cjs.entry.js +206 -133
  214. package/dist/cjs/ion-range.cjs.entry.js +302 -237
  215. package/dist/cjs/ion-refresher_2.cjs.entry.js +165 -93
  216. package/dist/cjs/ion-reorder_2.cjs.entry.js +53 -23
  217. package/dist/cjs/ion-ripple-effect.cjs.entry.js +14 -14
  218. package/dist/cjs/ion-route_4.cjs.entry.js +175 -71
  219. package/dist/cjs/ion-searchbar.cjs.entry.js +291 -200
  220. package/dist/cjs/ion-segment-content.cjs.entry.js +2 -2
  221. package/dist/cjs/ion-segment-view.cjs.entry.js +28 -17
  222. package/dist/cjs/ion-segment_2.cjs.entry.js +169 -126
  223. package/dist/cjs/ion-select-modal.cjs.entry.js +104 -48
  224. package/dist/cjs/ion-select_3.cjs.entry.js +759 -214
  225. package/dist/cjs/ion-spinner.cjs.entry.js +24 -10
  226. package/dist/cjs/ion-split-pane.cjs.entry.js +29 -16
  227. package/dist/cjs/ion-tab-bar_2.cjs.entry.js +100 -41
  228. package/dist/cjs/ion-tab_2.cjs.entry.js +53 -27
  229. package/dist/cjs/ion-text.cjs.entry.js +11 -5
  230. package/dist/cjs/ion-textarea.cjs.entry.js +263 -144
  231. package/dist/cjs/ion-toast.cjs.entry.js +236 -117
  232. package/dist/cjs/ion-toggle.cjs.entry.js +175 -122
  233. package/dist/cjs/{ionic-global-B-cA6LkY.js → ionic-global-dMut1Czp.js} +13 -8
  234. package/dist/cjs/ionic.cjs.js +4 -4
  235. package/dist/cjs/{ios.transition-BOSWOaiK.js → ios.transition-CeaFa0y2.js} +13 -17
  236. package/dist/cjs/{item-multiple-inputs-D-gyg57c.js → item-multiple-inputs-HQO5Iy9I.js} +1 -1
  237. package/dist/cjs/{keyboard-hHzlEQpk.js → keyboard-Cix5TVkD.js} +2 -2
  238. package/dist/cjs/{keyboard-UuAS4D_9.js → keyboard-cHxZlTyz.js} +2 -2
  239. package/dist/cjs/{keyboard-controller-GXBiBRKS.js → keyboard-controller-PtZoN2GS.js} +6 -6
  240. package/dist/cjs/loader.cjs.js +4 -4
  241. package/dist/cjs/{md.transition-B8-wBZqt.js → md.transition-D4Q5jny7.js} +7 -8
  242. package/dist/cjs/{notch-controller-18PzRGXd.js → notch-controller-fMfidI-7.js} +1 -1
  243. package/dist/cjs/overlay-control-label-D2sdL2O8.js +50 -0
  244. package/dist/cjs/{overlays-DdtIYQUH.js → overlays-C2qrqpHm.js} +48 -33
  245. package/dist/cjs/select-option-render-Dh16lTnA.js +123 -0
  246. package/dist/cjs/{status-tap-BXX8H8_Y.js → status-tap-CgjQ-6jq.js} +3 -3
  247. package/dist/cjs/{swipe-back-C0GCB18x.js → swipe-back-CmfRYdWQ.js} +5 -5
  248. package/dist/cjs/{theme-CeDs6Hcv.js → theme-Bw0rpaNN.js} +6 -1
  249. package/dist/collection/collection-manifest.json +6 -10
  250. package/dist/collection/components/accordion/accordion.js +315 -312
  251. package/dist/collection/components/accordion-group/accordion-group.js +48 -25
  252. package/dist/collection/components/action-sheet/action-sheet.ios.css +228 -2
  253. package/dist/collection/components/action-sheet/action-sheet.js +173 -64
  254. package/dist/collection/components/action-sheet/action-sheet.md.css +174 -2
  255. package/dist/collection/components/action-sheet/test/basic/fixture.js +3 -0
  256. package/dist/collection/components/alert/alert.ios.css +279 -10
  257. package/dist/collection/components/alert/alert.js +257 -97
  258. package/dist/collection/components/alert/alert.md.css +268 -20
  259. package/dist/collection/components/app/app.js +3 -0
  260. package/dist/collection/components/back-button/back-button.js +42 -19
  261. package/dist/collection/components/backdrop/backdrop.js +16 -14
  262. package/dist/collection/components/badge/badge.js +6 -0
  263. package/dist/collection/components/breadcrumb/breadcrumb.js +91 -30
  264. package/dist/collection/components/breadcrumbs/breadcrumbs.js +103 -88
  265. package/dist/collection/components/button/button.js +132 -61
  266. package/dist/collection/components/buttons/buttons.js +13 -15
  267. package/dist/collection/components/card/card.js +54 -21
  268. package/dist/collection/components/card-header/card-header.js +12 -8
  269. package/dist/collection/components/card-subtitle/card-subtitle.js +6 -0
  270. package/dist/collection/components/card-title/card-title.js +6 -0
  271. package/dist/collection/components/checkbox/checkbox.js +147 -97
  272. package/dist/collection/components/chip/chip.js +14 -10
  273. package/dist/collection/components/col/col.js +127 -3
  274. package/dist/collection/components/content/content.js +92 -64
  275. package/dist/collection/components/datetime/datetime.ios.css +42 -2
  276. package/dist/collection/components/datetime/datetime.js +1038 -803
  277. package/dist/collection/components/datetime/datetime.md.css +42 -1
  278. package/dist/collection/components/datetime/utils/data.js +13 -14
  279. package/dist/collection/components/datetime/utils/format.js +21 -11
  280. package/dist/collection/components/datetime/utils/manipulation.js +8 -8
  281. package/dist/collection/components/datetime/utils/parse.js +10 -10
  282. package/dist/collection/components/datetime/utils/state.js +8 -2
  283. package/dist/collection/components/datetime/utils/validate.js +4 -5
  284. package/dist/collection/components/datetime-button/datetime-button.ios.css +5 -0
  285. package/dist/collection/components/datetime-button/datetime-button.js +247 -237
  286. package/dist/collection/components/datetime-button/datetime-button.md.css +5 -0
  287. package/dist/collection/components/fab/fab.js +20 -13
  288. package/dist/collection/components/fab-button/fab-button.js +104 -55
  289. package/dist/collection/components/fab-list/fab-list.js +10 -11
  290. package/dist/collection/components/footer/footer.js +50 -44
  291. package/dist/collection/components/grid/grid.js +4 -6
  292. package/dist/collection/components/header/header.js +35 -25
  293. package/dist/collection/components/img/img.js +34 -10
  294. package/dist/collection/components/infinite-scroll/infinite-scroll.js +73 -66
  295. package/dist/collection/components/infinite-scroll-content/infinite-scroll-content.js +20 -3
  296. package/dist/collection/components/input/input.ios.css +1 -2
  297. package/dist/collection/components/input/input.js +309 -164
  298. package/dist/collection/components/input/input.md.css +1 -2
  299. package/dist/collection/components/input-otp/input-otp.js +428 -366
  300. package/dist/collection/components/input-password-toggle/input-password-toggle.js +29 -16
  301. package/dist/collection/components/item/item.js +99 -53
  302. package/dist/collection/components/item-divider/item-divider.js +15 -10
  303. package/dist/collection/components/item-option/item-option.js +49 -21
  304. package/dist/collection/components/item-options/item-options.js +10 -7
  305. package/dist/collection/components/item-sliding/item-sliding.js +26 -20
  306. package/dist/collection/components/label/label.js +24 -4
  307. package/dist/collection/components/list/list.js +10 -7
  308. package/dist/collection/components/list-header/list-header.js +10 -0
  309. package/dist/collection/components/loading/loading.js +135 -51
  310. package/dist/collection/components/menu/menu.js +101 -59
  311. package/dist/collection/components/menu-button/menu-button.js +29 -20
  312. package/dist/collection/components/menu-toggle/menu-toggle.js +20 -13
  313. package/dist/collection/components/modal/animations/ios.enter.js +1 -1
  314. package/dist/collection/components/modal/animations/md.enter.js +1 -1
  315. package/dist/collection/components/modal/gestures/sheet.js +6 -7
  316. package/dist/collection/components/modal/gestures/swipe-to-close.js +1 -2
  317. package/dist/collection/components/modal/modal.js +393 -224
  318. package/dist/collection/components/modal/safe-area-utils.js +4 -5
  319. package/dist/collection/components/modal/test/fixtures.js +3 -0
  320. package/dist/collection/components/nav/nav.js +69 -247
  321. package/dist/collection/components/nav/view-controller.js +7 -1
  322. package/dist/collection/components/nav-link/nav-link.js +20 -9
  323. package/dist/collection/components/note/note.js +6 -0
  324. package/dist/collection/components/picker/picker.js +398 -390
  325. package/dist/collection/components/picker-column/picker-column.css +3 -0
  326. package/dist/collection/components/picker-column/picker-column.js +414 -404
  327. package/dist/collection/components/picker-column-option/picker-column-option.js +33 -31
  328. package/dist/collection/components/picker-column-option/picker-column-option.md.css +6 -1
  329. package/dist/collection/components/popover/animations/ios.enter.js +1 -2
  330. package/dist/collection/components/popover/animations/md.enter.js +1 -2
  331. package/dist/collection/components/popover/popover.ios.css +15 -0
  332. package/dist/collection/components/popover/popover.js +302 -185
  333. package/dist/collection/components/popover/popover.md.css +15 -0
  334. package/dist/collection/components/popover/test/fixture.js +1 -0
  335. package/dist/collection/components/popover/utils.js +4 -6
  336. package/dist/collection/components/progress-bar/progress-bar.js +27 -23
  337. package/dist/collection/components/radio/radio.js +102 -66
  338. package/dist/collection/components/radio-group/radio-group.js +100 -65
  339. package/dist/collection/components/radio-group/test/fixtures.js +2 -0
  340. package/dist/collection/components/range/range.js +296 -232
  341. package/dist/collection/components/refresher/refresher.js +110 -78
  342. package/dist/collection/components/refresher-content/refresher-content.js +41 -4
  343. package/dist/collection/components/reorder/reorder.js +2 -1
  344. package/dist/collection/components/reorder-group/reorder-group.js +44 -15
  345. package/dist/collection/components/ripple-effect/ripple-effect.js +12 -13
  346. package/dist/collection/components/route/route.js +39 -10
  347. package/dist/collection/components/route-redirect/route-redirect.js +31 -0
  348. package/dist/collection/components/router/router.js +37 -33
  349. package/dist/collection/components/router/utils/dom.js +25 -7
  350. package/dist/collection/components/router/utils/matching.js +7 -9
  351. package/dist/collection/components/router/utils/parser.js +1 -1
  352. package/dist/collection/components/router/utils/path.js +0 -1
  353. package/dist/collection/components/router-link/router-link.js +37 -12
  354. package/dist/collection/components/router-outlet/router-outlet.js +82 -21
  355. package/dist/collection/components/row/row.js +1 -1
  356. package/dist/collection/components/searchbar/searchbar.js +289 -199
  357. package/dist/collection/components/segment/segment.js +120 -85
  358. package/dist/collection/components/segment-button/segment-button.js +43 -37
  359. package/dist/collection/components/segment-content/segment-content.js +1 -1
  360. package/dist/collection/components/segment-view/segment-view.js +26 -16
  361. package/dist/collection/components/select/select.ios.css +33 -0
  362. package/dist/collection/components/select/select.js +597 -166
  363. package/dist/collection/components/select/select.md.css +33 -0
  364. package/dist/collection/components/select-modal/select-modal.ios.css +218 -0
  365. package/dist/collection/components/select-modal/select-modal.js +92 -38
  366. package/dist/collection/components/select-modal/select-modal.md.css +164 -0
  367. package/dist/collection/components/select-modal/test/fixtures.js +8 -1
  368. package/dist/collection/components/select-option/select-option.js +110 -9
  369. package/dist/collection/components/select-popover/select-popover.ios.css +218 -0
  370. package/dist/collection/components/select-popover/select-popover.js +103 -36
  371. package/dist/collection/components/select-popover/select-popover.md.css +164 -0
  372. package/dist/collection/components/select-popover/test/fixtures.js +8 -1
  373. package/dist/collection/components/skeleton-text/skeleton-text.js +12 -8
  374. package/dist/collection/components/spinner/spinner.js +21 -9
  375. package/dist/collection/components/split-pane/split-pane.js +27 -15
  376. package/dist/collection/components/tab/tab.js +17 -6
  377. package/dist/collection/components/tab-bar/tab-bar.js +32 -14
  378. package/dist/collection/components/tab-button/tab-button.js +62 -23
  379. package/dist/collection/components/tabs/tabs.js +33 -20
  380. package/dist/collection/components/text/text.js +8 -2
  381. package/dist/collection/components/textarea/textarea.js +257 -139
  382. package/dist/collection/components/thumbnail/thumbnail.js +1 -1
  383. package/dist/collection/components/title/title.js +18 -2
  384. package/dist/collection/components/toast/toast.js +223 -106
  385. package/dist/collection/components/toggle/toggle.js +167 -115
  386. package/dist/collection/components/toolbar/toolbar.js +15 -7
  387. package/dist/collection/global/config.js +4 -6
  388. package/dist/collection/global/ionic-global.js +8 -2
  389. package/dist/collection/index.js +1 -1
  390. package/dist/collection/utils/animation/animation.js +3 -3
  391. package/dist/collection/utils/config.js +5 -4
  392. package/dist/collection/utils/focus-controller/index.js +1 -1
  393. package/dist/collection/utils/focus-trap.js +3 -3
  394. package/dist/collection/utils/framework-delegate.js +4 -6
  395. package/dist/collection/utils/gesture/gesture-controller.js +15 -8
  396. package/dist/collection/utils/gesture/index.js +10 -2
  397. package/dist/collection/utils/gesture/listener.js +1 -1
  398. package/dist/collection/utils/hardware-back-button.js +3 -3
  399. package/dist/collection/utils/helpers.js +2 -2
  400. package/dist/collection/utils/input-shims/hacks/scroll-assist.js +4 -5
  401. package/dist/collection/utils/input-shims/hacks/scroll-data.js +1 -2
  402. package/dist/collection/utils/keyboard/keyboard-controller.js +5 -5
  403. package/dist/collection/utils/keyboard/keyboard.js +1 -1
  404. package/dist/collection/utils/menu-controller/index.js +1 -2
  405. package/dist/collection/utils/native/haptic.js +2 -3
  406. package/dist/collection/utils/native/keyboard.js +2 -2
  407. package/dist/collection/utils/native/status-bar.js +1 -1
  408. package/dist/collection/utils/overlay-control-label.js +45 -0
  409. package/dist/collection/utils/overlays.js +38 -23
  410. package/dist/collection/utils/platform.js +4 -5
  411. package/dist/collection/utils/rtl/dir.js +1 -1
  412. package/dist/collection/utils/sanitization/index.js +276 -20
  413. package/dist/collection/utils/select-option-render.js +118 -0
  414. package/dist/collection/utils/slot-mutation-controller.js +1 -2
  415. package/dist/collection/utils/test/playwright/apply-keyboard-focus.js +1 -1
  416. package/dist/collection/utils/test/playwright/drag-element.js +2 -3
  417. package/dist/collection/utils/test/playwright/generator.js +3 -4
  418. package/dist/collection/utils/test/playwright/page/event-spy.js +11 -12
  419. package/dist/collection/utils/test/playwright/page/utils/goto.js +4 -5
  420. package/dist/collection/utils/test/playwright/page/utils/set-content.js +1 -1
  421. package/dist/collection/utils/test/playwright/page/utils/set-ion-viewport.js +2 -3
  422. package/dist/collection/utils/test/press-keys.js +10 -17
  423. package/dist/collection/utils/theme.js +6 -1
  424. package/dist/collection/utils/transition/ios.transition.js +9 -13
  425. package/dist/collection/utils/transition/md.transition.js +3 -4
  426. package/dist/docs.json +556 -1272
  427. package/dist/esm/{animation-DLJpuoEz.js → animation-CVK55yMY.js} +4 -4
  428. package/dist/esm/{app-globals-D0C5S4hU.js → app-globals-Bk1_t4sH.js} +1 -1
  429. package/dist/esm/{button-active-BSpTQmS9.js → button-active-CdCqmeT0.js} +3 -3
  430. package/dist/esm/config-DWCzVL3Y.js +32 -0
  431. package/dist/esm/{dir-C53feagD.js → dir-B-FxiyeI.js} +1 -1
  432. package/dist/esm/{format-CAmvpAez.js → format-sMi4BZ_l.js} +41 -31
  433. package/dist/esm/{framework-delegate-FnPGymXL.js → framework-delegate-BfAlKlW5.js} +5 -7
  434. package/dist/esm/{gesture-controller-BTEOs1at.js → gesture-controller-TXPDHL13.js} +15 -8
  435. package/dist/esm/{haptic-DzAMWJuk.js → haptic-Cq4UAeka.js} +2 -3
  436. package/dist/esm/{hardware-back-button-B93Gru0Y.js → hardware-back-button-DcHMMB9j.js} +4 -4
  437. package/dist/esm/{helpers-HEqiOzXb.js → helpers-BPcITY5s.js} +3 -3
  438. package/dist/esm/{index-BRHzoo00.js → index-B9GsUd2c.js} +2 -2
  439. package/dist/esm/{index-DV3sJJW8.js → index-BvabGprD.js} +2 -2
  440. package/dist/esm/{index-tcQvqkiX.js → index-D1CQtpUN.js} +5 -7
  441. package/dist/esm/index-DDa8edAS.js +424 -0
  442. package/dist/esm/{index-MEDq2S8l.js → index-DcUt1pPn.js} +2 -2
  443. package/dist/esm/{index-CfgBF1SE.js → index-DppOcPFQ.js} +10 -4
  444. package/dist/esm/{index-B_dQk_WE.js → index-DqVqy_Cy.js} +5 -5
  445. package/dist/esm/{index-Q6UPU0Ay.js → index-ks-BjikL.js} +6 -7
  446. package/dist/esm/index.js +16 -15
  447. package/dist/esm/{input-shims-D10mwcw1.js → input-shims-C1dCKVMO.js} +9 -11
  448. package/dist/esm/{input.utils-Y6NgW8bw.js → input.utils-Dd5xwlP6.js} +3 -4
  449. package/dist/esm/ion-accordion_2.entry.js +368 -340
  450. package/dist/esm/ion-action-sheet.entry.js +187 -76
  451. package/dist/esm/ion-alert.entry.js +272 -110
  452. package/dist/esm/ion-app_8.entry.js +306 -190
  453. package/dist/esm/ion-avatar_3.entry.js +10 -4
  454. package/dist/esm/ion-back-button.entry.js +47 -23
  455. package/dist/esm/ion-backdrop.entry.js +18 -14
  456. package/dist/esm/ion-breadcrumb_2.entry.js +199 -121
  457. package/dist/esm/ion-button_2.entry.js +138 -66
  458. package/dist/esm/ion-card_5.entry.js +82 -30
  459. package/dist/esm/ion-checkbox.entry.js +152 -101
  460. package/dist/esm/ion-chip.entry.js +17 -11
  461. package/dist/esm/ion-col_3.entry.js +134 -10
  462. package/dist/esm/ion-datetime-button.entry.js +253 -241
  463. package/dist/esm/ion-datetime.entry.js +2765 -0
  464. package/dist/esm/ion-fab_3.entry.js +139 -81
  465. package/dist/esm/ion-img.entry.js +34 -12
  466. package/dist/esm/ion-infinite-scroll_2.entry.js +99 -71
  467. package/dist/esm/ion-input-otp.entry.js +433 -370
  468. package/dist/esm/ion-input-password-toggle.entry.js +33 -19
  469. package/dist/esm/ion-input.entry.js +314 -168
  470. package/dist/esm/ion-item-option_3.entry.js +91 -51
  471. package/dist/esm/ion-item_8.entry.js +181 -82
  472. package/dist/esm/ion-loading.entry.js +145 -59
  473. package/dist/esm/ion-menu_3.entry.js +163 -101
  474. package/dist/esm/ion-modal.entry.js +418 -251
  475. package/dist/esm/ion-nav_2.entry.js +100 -157
  476. package/dist/esm/ion-picker-column-option.entry.js +37 -33
  477. package/dist/esm/ion-picker-column.entry.js +417 -405
  478. package/dist/esm/ion-picker.entry.js +401 -392
  479. package/dist/esm/ion-popover.entry.js +319 -205
  480. package/dist/esm/ion-progress-bar.entry.js +31 -25
  481. package/dist/esm/ion-radio_2.entry.js +206 -133
  482. package/dist/esm/ion-range.entry.js +302 -237
  483. package/dist/esm/ion-refresher_2.entry.js +163 -91
  484. package/dist/esm/ion-reorder_2.entry.js +53 -23
  485. package/dist/esm/ion-ripple-effect.entry.js +14 -14
  486. package/dist/esm/ion-route_4.entry.js +175 -71
  487. package/dist/esm/ion-searchbar.entry.js +291 -200
  488. package/dist/esm/ion-segment-content.entry.js +2 -2
  489. package/dist/esm/ion-segment-view.entry.js +28 -17
  490. package/dist/esm/ion-segment_2.entry.js +169 -126
  491. package/dist/esm/ion-select-modal.entry.js +104 -48
  492. package/dist/esm/ion-select_3.entry.js +760 -215
  493. package/dist/esm/ion-spinner.entry.js +24 -10
  494. package/dist/esm/ion-split-pane.entry.js +29 -16
  495. package/dist/esm/ion-tab-bar_2.entry.js +100 -41
  496. package/dist/esm/ion-tab_2.entry.js +53 -27
  497. package/dist/esm/ion-text.entry.js +11 -5
  498. package/dist/esm/ion-textarea.entry.js +263 -144
  499. package/dist/esm/ion-toast.entry.js +235 -116
  500. package/dist/esm/ion-toggle.entry.js +175 -122
  501. package/dist/esm/{ionic-global-Cp_eT4sZ.js → ionic-global-5bZ91kOL.js} +13 -8
  502. package/dist/esm/ionic.js +5 -5
  503. package/dist/esm/{ios.transition-ClFrsIrS.js → ios.transition-OcwIGkv9.js} +13 -17
  504. package/dist/esm/{item-multiple-inputs-DlNuqNJm.js → item-multiple-inputs-ifd3ZrqY.js} +1 -1
  505. package/dist/esm/{keyboard-ywgs5efA.js → keyboard-Cj8mLJeq.js} +2 -2
  506. package/dist/esm/{keyboard-CUw4ekVy.js → keyboard-DAF8GNJ9.js} +2 -2
  507. package/dist/esm/{keyboard-controller-BaaVITYt.js → keyboard-controller-DEwoa1ev.js} +6 -6
  508. package/dist/esm/loader.js +5 -5
  509. package/dist/esm/{md.transition-D0msQmzI.js → md.transition-BetdF0bc.js} +7 -8
  510. package/dist/esm/{notch-controller-DKDjU_O7.js → notch-controller-DBSn-Uat.js} +1 -1
  511. package/dist/esm/overlay-control-label-BSQPZ79H.js +47 -0
  512. package/dist/esm/{overlays-Dg0q2_tJ.js → overlays-DUzb9CQf.js} +48 -33
  513. package/dist/esm/select-option-render-DsW8svRr.js +121 -0
  514. package/dist/esm/{status-tap-Kan2W7sh.js → status-tap-C-wNhea0.js} +3 -3
  515. package/dist/esm/{swipe-back-DQ1q5MgD.js → swipe-back-D6YSgAn7.js} +5 -5
  516. package/dist/esm/{theme-DiVJyqlX.js → theme-byZM6qHV.js} +6 -1
  517. package/dist/html.html-data.json +52 -80
  518. package/dist/ionic/index.esm.js +1 -1
  519. package/dist/ionic/ionic.esm.js +1 -1
  520. package/dist/ionic/p-01eaee58.entry.js +4 -0
  521. package/dist/ionic/p-0c567140.entry.js +4 -0
  522. package/dist/ionic/p-105bb794.entry.js +4 -0
  523. package/dist/ionic/p-10d55bb6.entry.js +4 -0
  524. package/dist/ionic/p-173a87d8.entry.js +4 -0
  525. package/dist/ionic/p-178da672.entry.js +4 -0
  526. package/dist/ionic/p-1ead2857.entry.js +4 -0
  527. package/dist/ionic/p-224e2464.entry.js +4 -0
  528. package/dist/ionic/p-2268e718.entry.js +4 -0
  529. package/dist/ionic/p-2b5283f3.entry.js +4 -0
  530. package/dist/ionic/p-2b6decac.entry.js +4 -0
  531. package/dist/ionic/p-2da5d9c6.entry.js +4 -0
  532. package/dist/ionic/p-31890acd.entry.js +4 -0
  533. package/dist/ionic/p-34ef7425.entry.js +4 -0
  534. package/dist/ionic/p-34f7c1d8.entry.js +4 -0
  535. package/dist/ionic/p-3b1e6fa4.entry.js +4 -0
  536. package/dist/ionic/p-42fefd2c.entry.js +4 -0
  537. package/dist/ionic/p-440cd489.entry.js +4 -0
  538. package/dist/ionic/{p-aaeedb6b.entry.js → p-460da491.entry.js} +1 -1
  539. package/dist/ionic/p-53f680e8.entry.js +4 -0
  540. package/dist/ionic/p-57ba508f.entry.js +4 -0
  541. package/dist/ionic/p-599e5a75.entry.js +4 -0
  542. package/dist/ionic/p-5f670a9e.entry.js +4 -0
  543. package/dist/ionic/p-63502088.entry.js +4 -0
  544. package/dist/ionic/p-6e6bf45d.entry.js +4 -0
  545. package/dist/ionic/p-6f0b6a48.entry.js +4 -0
  546. package/dist/ionic/p-7438c462.entry.js +4 -0
  547. package/dist/ionic/p-747716e7.entry.js +4 -0
  548. package/dist/ionic/p-7759fcaf.entry.js +4 -0
  549. package/dist/ionic/p-7a8338e2.entry.js +4 -0
  550. package/dist/ionic/p-80f9f1dc.entry.js +4 -0
  551. package/dist/ionic/p-83ff4dcb.entry.js +4 -0
  552. package/dist/ionic/p-86f03895.entry.js +4 -0
  553. package/dist/ionic/p-87b8d70e.entry.js +4 -0
  554. package/dist/ionic/p-888236bf.entry.js +4 -0
  555. package/dist/ionic/p-8a92ca23.entry.js +4 -0
  556. package/dist/ionic/p-8c9af4ad.entry.js +4 -0
  557. package/dist/ionic/p-9669f546.entry.js +4 -0
  558. package/dist/ionic/p-9bcd8b74.entry.js +4 -0
  559. package/dist/ionic/p-B-FxiyeI.js +4 -0
  560. package/dist/ionic/p-B2trYd8K.js +4 -0
  561. package/dist/ionic/p-BMPN55of.js +4 -0
  562. package/dist/ionic/{p-DIuEbVLu.js → p-BNKr91bi.js} +1 -1
  563. package/dist/ionic/p-BSQPZ79H.js +4 -0
  564. package/dist/ionic/p-BSzG1VcX.js +4 -0
  565. package/dist/ionic/p-BVgBHS96.js +4 -0
  566. package/dist/ionic/p-BX2IOAqC.js +4 -0
  567. package/dist/ionic/p-BhamHSw3.js +4 -0
  568. package/dist/ionic/p-BufXJ_A8.js +4 -0
  569. package/dist/ionic/{p-DV3sJJW8.js → p-BvabGprD.js} +1 -1
  570. package/dist/ionic/p-C73UOs4m.js +4 -0
  571. package/{components/p-B-JJgYSG.js → dist/ionic/p-CHpEzg-o.js} +1 -1
  572. package/dist/ionic/p-CUSwMljM.js +4 -0
  573. package/dist/ionic/p-CeOSrSdu.js +4 -0
  574. package/dist/ionic/p-CfkB7_FV.js +4 -0
  575. package/dist/ionic/p-CmKf4pgI.js +4 -0
  576. package/dist/ionic/p-CnM-CMw7.js +4 -0
  577. package/dist/ionic/p-D1CQtpUN.js +5 -0
  578. package/dist/ionic/p-D5t_-oMk.js +4 -0
  579. package/dist/ionic/p-DVYb1IVZ.js +4 -0
  580. package/dist/ionic/p-DWCzVL3Y.js +4 -0
  581. package/dist/ionic/p-DfJ-SVJf.js +4 -0
  582. package/dist/ionic/p-DmXrLsoD.js +4 -0
  583. package/dist/ionic/p-DtLHAMFW.js +4 -0
  584. package/dist/ionic/p-Dtlob2JL.js +4 -0
  585. package/dist/ionic/p-F7ipfyOA.js +4 -0
  586. package/dist/ionic/{p-DoJvtrbw.js → p-I9ETXg5W.js} +1 -1
  587. package/dist/ionic/{p-Wk5HzclC.js → p-IaXd5VMv.js} +1 -1
  588. package/dist/ionic/p-T71k3C35.js +4 -0
  589. package/dist/ionic/p-TXPDHL13.js +4 -0
  590. package/dist/ionic/p-aL0G45tD.js +4 -0
  591. package/dist/ionic/p-acbb97c3.entry.js +4 -0
  592. package/dist/ionic/p-aeb85531.entry.js +4 -0
  593. package/dist/ionic/p-b157f80d.entry.js +4 -0
  594. package/dist/ionic/p-b158de5d.entry.js +4 -0
  595. package/dist/ionic/{p-c6e49f3f.entry.js → p-b40c9715.entry.js} +1 -1
  596. package/dist/ionic/p-b852101e.entry.js +4 -0
  597. package/dist/ionic/p-byZM6qHV.js +4 -0
  598. package/dist/ionic/p-c0d81bee.entry.js +4 -0
  599. package/dist/ionic/p-c8a327fb.entry.js +4 -0
  600. package/dist/ionic/p-d42ae99f.entry.js +4 -0
  601. package/dist/ionic/p-d47ff529.entry.js +4 -0
  602. package/dist/ionic/p-eHi73fGE.js +4 -0
  603. package/dist/ionic/p-eeabce92.entry.js +4 -0
  604. package/dist/ionic/p-efc66d77.entry.js +4 -0
  605. package/dist/ionic/p-f6d203dc.entry.js +4 -0
  606. package/dist/ionic/p-u2a770LZ.js +4 -0
  607. package/dist/types/components/img/img.d.ts +2 -0
  608. package/dist/types/components/input/input.d.ts +1 -1
  609. package/dist/types/components/modal/modal.d.ts +11 -4
  610. package/dist/types/components/nav/nav-interface.d.ts +0 -1
  611. package/dist/types/components/nav/nav.d.ts +2 -22
  612. package/dist/types/components/route/route.d.ts +1 -1
  613. package/dist/types/components/router-outlet/router-outlet.d.ts +7 -0
  614. package/dist/types/components/searchbar/searchbar.d.ts +1 -1
  615. package/dist/types/components/select/select-interface.d.ts +31 -0
  616. package/dist/types/components/select/select.d.ts +18 -0
  617. package/dist/types/components/select-option/select-option.d.ts +42 -1
  618. package/dist/types/components.d.ts +74 -311
  619. package/dist/types/index.d.ts +1 -1
  620. package/dist/types/interface.d.ts +0 -1
  621. package/dist/types/utils/config.d.ts +0 -8
  622. package/dist/types/utils/overlay-control-label.d.ts +32 -0
  623. package/dist/types/utils/overlays.d.ts +11 -9
  624. package/dist/types/utils/sanitization/index.d.ts +58 -2
  625. package/dist/types/utils/select-option-render.d.ts +53 -0
  626. package/dist/types/utils/test/playwright/playwright-page.d.ts +1 -1
  627. package/dist/types/utils/test/playwright/testExpect.d.ts +1 -1
  628. package/hydrate/index.js +10278 -7052
  629. package/hydrate/index.mjs +10278 -7052
  630. package/package.json +54 -11
  631. package/components/ion-picker-legacy-column.d.ts +0 -11
  632. package/components/ion-picker-legacy-column.js +0 -4
  633. package/components/ion-picker-legacy.d.ts +0 -11
  634. package/components/ion-picker-legacy.js +0 -4
  635. package/components/p-A3O24YmY.js +0 -4
  636. package/components/p-ABkNVeU9.js +0 -4
  637. package/components/p-B9jFTlwE.js +0 -4
  638. package/components/p-BLmJ0zRm.js +0 -4
  639. package/components/p-BMI53wYL.js +0 -4
  640. package/components/p-BSEgsdFI.js +0 -4
  641. package/components/p-BTEOs1at.js +0 -4
  642. package/components/p-BlIAuGv2.js +0 -4
  643. package/components/p-Bnsn6KaP.js +0 -4
  644. package/components/p-BsBCoGa-.js +0 -4
  645. package/components/p-Bz0dSlXZ.js +0 -4
  646. package/components/p-C53feagD.js +0 -4
  647. package/components/p-CHqRYvYm.js +0 -4
  648. package/components/p-CQGnMY3n.js +0 -4
  649. package/components/p-CSZf8_j0.js +0 -4
  650. package/components/p-C_xFdyXe.js +0 -4
  651. package/components/p-Cf2jSDS8.js +0 -4
  652. package/components/p-Cfx4M1Bn.js +0 -4
  653. package/components/p-CkMSOsFF.js +0 -4
  654. package/components/p-Cl0B-RWe.js +0 -4
  655. package/components/p-CmR5uXej.js +0 -4
  656. package/components/p-CsNJ1ULL.js +0 -4
  657. package/components/p-CtWGkNnJ.js +0 -4
  658. package/components/p-CzCbeKys.js +0 -4
  659. package/components/p-D-aHdMxW.js +0 -4
  660. package/components/p-D0d8qTwj.js +0 -4
  661. package/components/p-D13Eaw-8.js +0 -4
  662. package/components/p-D6Ynv7Xh.js +0 -4
  663. package/components/p-DCnGU1fF.js +0 -4
  664. package/components/p-DGvrK8dD.js +0 -4
  665. package/components/p-DHTSTb52.js +0 -4
  666. package/components/p-DJZp0KTQ.js +0 -4
  667. package/components/p-DOFCbuQR.js +0 -4
  668. package/components/p-DV5mPYQS.js +0 -4
  669. package/components/p-DWkAgceV.js +0 -4
  670. package/components/p-DiVJyqlX.js +0 -4
  671. package/components/p-DqZAXv2t.js +0 -4
  672. package/components/p-KEFO0w3i.js +0 -4
  673. package/components/p-Osve4qkc.js +0 -4
  674. package/components/p-SLS1rDZM.js +0 -4
  675. package/components/p-VWbRkLT7.js +0 -4
  676. package/components/p-aJ6PBUvj.js +0 -4
  677. package/components/p-cyNmxje6.js +0 -4
  678. package/components/p-gAg0kXZp.js +0 -4
  679. package/components/p-j5IxBIan.js +0 -4
  680. package/components/p-k_E4tX5Z.js +0 -4
  681. package/components/p-oD4kcBRX.js +0 -4
  682. package/components/p-rCa2eL0j.js +0 -4
  683. package/components/p-scxfI1Dd.js +0 -4
  684. package/components/p-sijaAIYG.js +0 -4
  685. package/components/p-yzCsOZE2.js +0 -4
  686. package/dist/cjs/config-xninhj0J.js +0 -201
  687. package/dist/cjs/ion-datetime_3.cjs.entry.js +0 -3164
  688. package/dist/collection/components/picker-legacy/animations/ios.enter.js +0 -27
  689. package/dist/collection/components/picker-legacy/animations/ios.leave.js +0 -23
  690. package/dist/collection/components/picker-legacy/picker-interface.js +0 -1
  691. package/dist/collection/components/picker-legacy/picker.ios.css +0 -300
  692. package/dist/collection/components/picker-legacy/picker.js +0 -890
  693. package/dist/collection/components/picker-legacy/picker.md.css +0 -287
  694. package/dist/collection/components/picker-legacy-column/picker-column.ios.css +0 -231
  695. package/dist/collection/components/picker-legacy-column/picker-column.js +0 -422
  696. package/dist/collection/components/picker-legacy-column/picker-column.md.css +0 -222
  697. package/dist/collection/components/picker-legacy-column/test/test.utils.js +0 -43
  698. package/dist/esm/config-DQCONYYp.js +0 -195
  699. package/dist/esm/ion-datetime_3.entry.js +0 -3160
  700. package/dist/ionic/p-01f81ea5.entry.js +0 -4
  701. package/dist/ionic/p-06c232a4.entry.js +0 -4
  702. package/dist/ionic/p-0dc33652.entry.js +0 -4
  703. package/dist/ionic/p-0fa9c382.entry.js +0 -4
  704. package/dist/ionic/p-10e833ef.entry.js +0 -4
  705. package/dist/ionic/p-20b1a044.entry.js +0 -4
  706. package/dist/ionic/p-21eb76d5.entry.js +0 -4
  707. package/dist/ionic/p-27d30585.entry.js +0 -4
  708. package/dist/ionic/p-2a05aa64.entry.js +0 -4
  709. package/dist/ionic/p-2b204c59.entry.js +0 -4
  710. package/dist/ionic/p-2bb2cb18.entry.js +0 -4
  711. package/dist/ionic/p-2fa58e80.entry.js +0 -4
  712. package/dist/ionic/p-3353c229.entry.js +0 -4
  713. package/dist/ionic/p-34586ead.entry.js +0 -4
  714. package/dist/ionic/p-37e720da.entry.js +0 -4
  715. package/dist/ionic/p-390ca786.entry.js +0 -4
  716. package/dist/ionic/p-3ae5f277.entry.js +0 -4
  717. package/dist/ionic/p-4654ae1c.entry.js +0 -4
  718. package/dist/ionic/p-4745f534.entry.js +0 -4
  719. package/dist/ionic/p-4858af1f.entry.js +0 -4
  720. package/dist/ionic/p-485fda23.entry.js +0 -4
  721. package/dist/ionic/p-4ac4f3d6.entry.js +0 -4
  722. package/dist/ionic/p-4baa5b82.entry.js +0 -4
  723. package/dist/ionic/p-4e92a11f.entry.js +0 -4
  724. package/dist/ionic/p-5018dfc8.entry.js +0 -4
  725. package/dist/ionic/p-50e1194a.entry.js +0 -4
  726. package/dist/ionic/p-5d1da0a2.entry.js +0 -4
  727. package/dist/ionic/p-5eb8e86d.entry.js +0 -4
  728. package/dist/ionic/p-65ebdf1b.entry.js +0 -4
  729. package/dist/ionic/p-75dc25ba.entry.js +0 -4
  730. package/dist/ionic/p-7c319341.entry.js +0 -4
  731. package/dist/ionic/p-829367ed.entry.js +0 -4
  732. package/dist/ionic/p-84d5ce05.entry.js +0 -4
  733. package/dist/ionic/p-874b4bd8.entry.js +0 -4
  734. package/dist/ionic/p-8eb8ee76.entry.js +0 -4
  735. package/dist/ionic/p-8fce95d5.entry.js +0 -4
  736. package/dist/ionic/p-9eeaBrnk.js +0 -4
  737. package/dist/ionic/p-9f1103ce.entry.js +0 -4
  738. package/dist/ionic/p-9f9db3a2.entry.js +0 -4
  739. package/dist/ionic/p-BGqMS-oh.js +0 -4
  740. package/dist/ionic/p-BTEOs1at.js +0 -4
  741. package/dist/ionic/p-BUFIpxKM.js +0 -4
  742. package/dist/ionic/p-C0eMdTCW.js +0 -4
  743. package/dist/ionic/p-C53feagD.js +0 -4
  744. package/dist/ionic/p-CFlfIb2g.js +0 -4
  745. package/dist/ionic/p-CKvCXMs9.js +0 -4
  746. package/dist/ionic/p-Cl0B-RWe.js +0 -4
  747. package/dist/ionic/p-CtWGkNnJ.js +0 -4
  748. package/dist/ionic/p-Cx3IXROA.js +0 -4
  749. package/dist/ionic/p-D-3ycHmd.js +0 -4
  750. package/dist/ionic/p-D13Eaw-8.js +0 -4
  751. package/dist/ionic/p-D4uTWt4-.js +0 -4
  752. package/dist/ionic/p-DSG2s2Eb.js +0 -4
  753. package/dist/ionic/p-Dfbt-q2k.js +0 -4
  754. package/dist/ionic/p-DiVJyqlX.js +0 -4
  755. package/dist/ionic/p-DqN5EA2O.js +0 -4
  756. package/dist/ionic/p-DzWaWHGc.js +0 -4
  757. package/dist/ionic/p-Nqf6uvGh.js +0 -4
  758. package/dist/ionic/p-SNAkTDfm.js +0 -4
  759. package/dist/ionic/p-VAemlbDS.js +0 -4
  760. package/dist/ionic/p-a3bdcae6.entry.js +0 -4
  761. package/dist/ionic/p-ad306193.entry.js +0 -4
  762. package/dist/ionic/p-b6a7397c.entry.js +0 -4
  763. package/dist/ionic/p-c0fb8edd.entry.js +0 -4
  764. package/dist/ionic/p-c38b648e.entry.js +0 -4
  765. package/dist/ionic/p-c4d8641b.entry.js +0 -4
  766. package/dist/ionic/p-ca2ab74d.entry.js +0 -4
  767. package/dist/ionic/p-d889ff6d.entry.js +0 -4
  768. package/dist/ionic/p-dfa8d673.entry.js +0 -4
  769. package/dist/ionic/p-e0be05c5.entry.js +0 -4
  770. package/dist/ionic/p-ef4c3bee.entry.js +0 -4
  771. package/dist/ionic/p-f386f6ae.entry.js +0 -4
  772. package/dist/ionic/p-mjKAFv89.js +0 -4
  773. package/dist/ionic/p-tcQvqkiX.js +0 -5
  774. package/dist/ionic/p-viFHDgRs.js +0 -4
  775. package/dist/ionic/p-xWb6fgfq.js +0 -4
  776. package/dist/types/components/picker-legacy/animations/ios.enter.d.ts +0 -5
  777. package/dist/types/components/picker-legacy/animations/ios.leave.d.ts +0 -5
  778. package/dist/types/components/picker-legacy/picker-interface.d.ts +0 -52
  779. package/dist/types/components/picker-legacy/picker.d.ts +0 -158
  780. package/dist/types/components/picker-legacy-column/picker-column.d.ts +0 -46
  781. package/dist/types/components/picker-legacy-column/test/test.utils.d.ts +0 -9
  782. /package/components/{p-CO7fmmxt.js → p-LpMHEu3v.js} +0 -0
@@ -0,0 +1,2765 @@
1
+ /*!
2
+ * (C) Ionic http://ionicframework.com - MIT License
3
+ */
4
+ import { j as printIonError, f as printIonWarning, r as registerInstance, c as createEvent, g as getElement, w as writeTask, e as config, h, d as Host } from './index-D1CQtpUN.js';
5
+ import { startFocusVisible } from './focus-visible-BmVRXR1y.js';
6
+ import { r as raf, g as getElementRoot, a as renderHiddenInput } from './helpers-BPcITY5s.js';
7
+ import { F as FOCUS_TRAP_DISABLE_CLASS } from './overlays-DUzb9CQf.js';
8
+ import { i as isRTL } from './dir-B-FxiyeI.js';
9
+ import { c as createColorClasses } from './theme-byZM6qHV.js';
10
+ import { b as chevronDown, d as caretUpSharp, e as chevronForward, f as caretDownSharp, c as chevronBack } from './index-BvabGprD.js';
11
+ import { b as getIonMode } from './ionic-global-5bZ91kOL.js';
12
+ import { r as removeDateTzOffset, g as getNextMonth, a as getPreviousMonth, b as getTodayLabel, c as getYear, d as getHourCycle, e as getInternalHourValue, f as getFormattedHour, h as addTimePadding, i as getLocalizedDayPeriod, j as isBefore, k as isSameDay, l as isAfter, m as is24Hour, n as getNumDaysInMonth, o as getDay, p as generateDayAriaLabel, q as convertToArrayOfNumbers, s as convertDataToISO, v as validateParts, t as getPartsFromCalendarDay, u as getNextYear, w as getPreviousYear, x as getEndOfWeek, y as getStartOfWeek, z as getPreviousDay, A as getNextDay, B as getPreviousWeek, C as getNextWeek, D as parseMinParts, E as parseMaxParts, F as parseDate, G as warnIfValueOutOfBounds, H as parseAmPm, I as clampDate, J as getClosestValidDate, K as isMonthFirstLocale, L as isLocaleDayPeriodRTL, M as calculateHourFromAMPM, N as getMonthAndYear, O as getLocalizedTime, P as getLocalizedDateTime, Q as formatValue } from './format-sMi4BZ_l.js';
13
+ import './index-ZjP4CjeZ.js';
14
+ import './hardware-back-button-DcHMMB9j.js';
15
+ import './framework-delegate-BfAlKlW5.js';
16
+ import './gesture-controller-TXPDHL13.js';
17
+
18
+ /**
19
+ * Returns the current date as
20
+ * an ISO string in the user's
21
+ * time zone.
22
+ */
23
+ const getToday = () => {
24
+ /**
25
+ * ion-datetime intentionally does not
26
+ * parse time zones/do automatic time zone
27
+ * conversion when accepting user input.
28
+ * However when we get today's date string,
29
+ * we want it formatted relative to the user's
30
+ * time zone.
31
+ *
32
+ * When calling toISOString(), the browser
33
+ * will convert the date to UTC time by either adding
34
+ * or subtracting the time zone offset.
35
+ * To work around this, we need to either add
36
+ * or subtract the time zone offset to the Date
37
+ * object prior to calling toISOString().
38
+ * This allows us to get an ISO string
39
+ * that is in the user's time zone.
40
+ */
41
+ return removeDateTzOffset(new Date()).toISOString();
42
+ };
43
+ const minutes = [
44
+ 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,
45
+ 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,
46
+ ];
47
+ // h11 hour system uses 0-11. Midnight starts at 0:00am.
48
+ const hour11 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
49
+ // h12 hour system uses 0-12. Midnight starts at 12:00am.
50
+ const hour12 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
51
+ // h23 hour system uses 0-23. Midnight starts at 0:00.
52
+ 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];
53
+ // h24 hour system uses 1-24. Midnight starts at 24:00.
54
+ 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];
55
+ /**
56
+ * Given a locale and a mode,
57
+ * return an array with formatted days
58
+ * of the week. iOS should display days
59
+ * such as "Mon" or "Tue".
60
+ * MD should display days such as "M"
61
+ * or "T".
62
+ */
63
+ const getDaysOfWeek = (locale, mode, firstDayOfWeek = 0) => {
64
+ /**
65
+ * Nov 1st, 2020 starts on a Sunday.
66
+ * ion-datetime assumes weeks start on Sunday,
67
+ * but is configurable via `firstDayOfWeek`.
68
+ */
69
+ const weekdayFormat = mode === 'ios' ? 'short' : 'narrow';
70
+ const intl = new Intl.DateTimeFormat(locale, { weekday: weekdayFormat });
71
+ const startDate = new Date('11/01/2020');
72
+ const daysOfWeek = [];
73
+ /**
74
+ * For each day of the week,
75
+ * get the day name.
76
+ */
77
+ for (let i = firstDayOfWeek; i < firstDayOfWeek + 7; i++) {
78
+ const currentDate = new Date(startDate);
79
+ currentDate.setDate(currentDate.getDate() + i);
80
+ daysOfWeek.push(intl.format(currentDate));
81
+ }
82
+ return daysOfWeek;
83
+ };
84
+ /**
85
+ * Returns an array containing all of the
86
+ * days in a month for a given year. Values are
87
+ * aligned with a week calendar starting on
88
+ * the firstDayOfWeek value (Sunday by default)
89
+ * using null values.
90
+ */
91
+ const getDaysOfMonth = (month, year, firstDayOfWeek, showAdjacentDays = false) => {
92
+ const numDays = getNumDaysInMonth(month, year);
93
+ let previousNumDays; //previous month number of days
94
+ if (month === 1) {
95
+ // If the current month is January, the previous month should be December of the previous year.
96
+ previousNumDays = getNumDaysInMonth(12, year - 1);
97
+ }
98
+ else {
99
+ // Otherwise, the previous month should be the current month - 1 of the same year.
100
+ previousNumDays = getNumDaysInMonth(month - 1, year);
101
+ }
102
+ const firstOfMonth = new Date(`${month}/1/${year}`).getDay();
103
+ /**
104
+ * To get the first day of the month aligned on the correct
105
+ * day of the week, we need to determine how many "filler" days
106
+ * to generate. These filler days as empty/disabled buttons
107
+ * that fill the space of the days of the week before the first
108
+ * of the month.
109
+ *
110
+ * There are two cases here:
111
+ *
112
+ * 1. If firstOfMonth = 4, firstDayOfWeek = 0 then the offset
113
+ * is (4 - (0 + 1)) = 3. Since the offset loop goes from 0 to 3 inclusive,
114
+ * this will generate 4 filler days (0, 1, 2, 3), and then day of week 4 will have
115
+ * the first day of the month.
116
+ *
117
+ * 2. If firstOfMonth = 2, firstDayOfWeek = 4 then the offset
118
+ * is (6 - (4 - 2)) = 4. Since the offset loop goes from 0 to 4 inclusive,
119
+ * this will generate 5 filler days (0, 1, 2, 3, 4), and then day of week 5 will have
120
+ * the first day of the month.
121
+ */
122
+ const offset = firstOfMonth >= firstDayOfWeek ? firstOfMonth - (firstDayOfWeek + 1) : 6 - (firstDayOfWeek - firstOfMonth);
123
+ let days = [];
124
+ for (let i = 1; i <= numDays; i++) {
125
+ days.push({ day: i, dayOfWeek: (offset + i) % 7, isAdjacentDay: false });
126
+ }
127
+ if (showAdjacentDays) {
128
+ for (let i = 0; i <= offset; i++) {
129
+ // Using offset create previous month adjacent day, starting from last day
130
+ days = [{ day: previousNumDays - i, dayOfWeek: (previousNumDays - i) % 7, isAdjacentDay: true }, ...days];
131
+ }
132
+ // Calculate positiveOffset
133
+ // The calendar will display 42 days (6 rows of 7 columns)
134
+ // Knowing this the offset is 41 (we start at index 0)
135
+ // minus (the previous offset + the current month days)
136
+ const positiveOffset = 41 - (numDays + offset);
137
+ for (let i = 0; i < positiveOffset; i++) {
138
+ days.push({ day: i + 1, dayOfWeek: (numDays + offset + i) % 7, isAdjacentDay: true });
139
+ }
140
+ }
141
+ else {
142
+ for (let i = 0; i <= offset; i++) {
143
+ days = [{ day: null, dayOfWeek: null, isAdjacentDay: false }, ...days];
144
+ }
145
+ }
146
+ return days;
147
+ };
148
+ /**
149
+ * Returns an array of pre-defined hour
150
+ * values based on the provided hourCycle.
151
+ */
152
+ const getHourData = (hourCycle) => {
153
+ switch (hourCycle) {
154
+ case 'h11':
155
+ return hour11;
156
+ case 'h12':
157
+ return hour12;
158
+ case 'h23':
159
+ return hour23;
160
+ case 'h24':
161
+ return hour24;
162
+ default:
163
+ throw new Error(`Invalid hour cycle "${hourCycle}"`);
164
+ }
165
+ };
166
+ /**
167
+ * Given a local, reference datetime parts and option
168
+ * max/min bound datetime parts, calculate the acceptable
169
+ * hour and minute values according to the bounds and locale.
170
+ */
171
+ const generateTime = (locale, refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
172
+ const computedHourCycle = getHourCycle(locale, hourCycle);
173
+ const use24Hour = is24Hour(computedHourCycle);
174
+ let processedHours = getHourData(computedHourCycle);
175
+ let processedMinutes = minutes;
176
+ let isAMAllowed = true;
177
+ let isPMAllowed = true;
178
+ if (hourValues) {
179
+ processedHours = processedHours.filter((hour) => hourValues.includes(hour));
180
+ }
181
+ if (minuteValues) {
182
+ processedMinutes = processedMinutes.filter((minute) => minuteValues.includes(minute));
183
+ }
184
+ if (minParts) {
185
+ /**
186
+ * If ref day is the same as the
187
+ * minimum allowed day, filter hour/minute
188
+ * values according to min hour and minute.
189
+ */
190
+ if (isSameDay(refParts, minParts)) {
191
+ /**
192
+ * Users may not always set the hour/minute for
193
+ * min value (i.e. 2021-06-02) so we should allow
194
+ * all hours/minutes in that case.
195
+ */
196
+ if (minParts.hour !== undefined) {
197
+ processedHours = processedHours.filter((hour) => {
198
+ const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
199
+ return (use24Hour ? hour : convertedHour) >= minParts.hour;
200
+ });
201
+ isAMAllowed = minParts.hour < 13;
202
+ }
203
+ if (minParts.minute !== undefined) {
204
+ /**
205
+ * The minimum minute range should not be enforced when
206
+ * the hour is greater than the min hour.
207
+ *
208
+ * For example with a minimum range of 09:30, users
209
+ * should be able to select 10:00-10:29 and beyond.
210
+ */
211
+ let isPastMinHour = false;
212
+ if (minParts.hour !== undefined && refParts.hour !== undefined) {
213
+ if (refParts.hour > minParts.hour) {
214
+ isPastMinHour = true;
215
+ }
216
+ }
217
+ processedMinutes = processedMinutes.filter((minute) => {
218
+ if (isPastMinHour) {
219
+ return true;
220
+ }
221
+ return minute >= minParts.minute;
222
+ });
223
+ }
224
+ /**
225
+ * If ref day is before minimum
226
+ * day do not render any hours/minute values
227
+ */
228
+ }
229
+ else if (isBefore(refParts, minParts)) {
230
+ processedHours = [];
231
+ processedMinutes = [];
232
+ isAMAllowed = isPMAllowed = false;
233
+ }
234
+ }
235
+ if (maxParts) {
236
+ /**
237
+ * If ref day is the same as the
238
+ * maximum allowed day, filter hour/minute
239
+ * values according to max hour and minute.
240
+ */
241
+ if (isSameDay(refParts, maxParts)) {
242
+ /**
243
+ * Users may not always set the hour/minute for
244
+ * max value (i.e. 2021-06-02) so we should allow
245
+ * all hours/minutes in that case.
246
+ */
247
+ if (maxParts.hour !== undefined) {
248
+ processedHours = processedHours.filter((hour) => {
249
+ const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
250
+ return (use24Hour ? hour : convertedHour) <= maxParts.hour;
251
+ });
252
+ isPMAllowed = maxParts.hour >= 12;
253
+ }
254
+ if (maxParts.minute !== undefined && refParts.hour === maxParts.hour) {
255
+ // The available minutes should only be filtered when the hour is the same as the max hour.
256
+ // For example if the max hour is 10:30 and the current hour is 10:00,
257
+ // users should be able to select 00-30 minutes.
258
+ // If the current hour is 09:00, users should be able to select 00-60 minutes.
259
+ processedMinutes = processedMinutes.filter((minute) => minute <= maxParts.minute);
260
+ }
261
+ /**
262
+ * If ref day is after minimum
263
+ * day do not render any hours/minute values
264
+ */
265
+ }
266
+ else if (isAfter(refParts, maxParts)) {
267
+ processedHours = [];
268
+ processedMinutes = [];
269
+ isAMAllowed = isPMAllowed = false;
270
+ }
271
+ }
272
+ return {
273
+ hours: processedHours,
274
+ minutes: processedMinutes,
275
+ am: isAMAllowed,
276
+ pm: isPMAllowed,
277
+ };
278
+ };
279
+ /**
280
+ * Given DatetimeParts, generate the previous,
281
+ * current, and and next months.
282
+ */
283
+ const generateMonths = (refParts, forcedDate) => {
284
+ const current = { month: refParts.month, year: refParts.year, day: refParts.day };
285
+ /**
286
+ * If we're forcing a month to appear, and it's different from the current month,
287
+ * ensure it appears by replacing the next or previous month as appropriate.
288
+ */
289
+ if (forcedDate !== undefined && (refParts.month !== forcedDate.month || refParts.year !== forcedDate.year)) {
290
+ const forced = { month: forcedDate.month, year: forcedDate.year, day: forcedDate.day };
291
+ const forcedMonthIsBefore = isBefore(forced, current);
292
+ return forcedMonthIsBefore
293
+ ? [forced, current, getNextMonth(refParts)]
294
+ : [getPreviousMonth(refParts), current, forced];
295
+ }
296
+ return [getPreviousMonth(refParts), current, getNextMonth(refParts)];
297
+ };
298
+ const getMonthColumnData = (locale, refParts, minParts, maxParts, monthValues, formatOptions = {
299
+ month: 'long',
300
+ }) => {
301
+ const { year } = refParts;
302
+ const months = [];
303
+ if (monthValues !== undefined) {
304
+ let processedMonths = monthValues;
305
+ if (maxParts?.month !== undefined) {
306
+ processedMonths = processedMonths.filter((month) => month <= maxParts.month);
307
+ }
308
+ if (minParts?.month !== undefined) {
309
+ processedMonths = processedMonths.filter((month) => month >= minParts.month);
310
+ }
311
+ processedMonths.forEach((processedMonth) => {
312
+ const date = new Date(`${processedMonth}/1/${year} GMT+0000`);
313
+ const monthString = new Intl.DateTimeFormat(locale, { ...formatOptions, timeZone: 'UTC' }).format(date);
314
+ months.push({ text: monthString, value: processedMonth });
315
+ });
316
+ }
317
+ else {
318
+ const maxMonth = maxParts && maxParts.year === year ? maxParts.month : 12;
319
+ const minMonth = minParts && minParts.year === year ? minParts.month : 1;
320
+ for (let i = minMonth; i <= maxMonth; i++) {
321
+ /**
322
+ *
323
+ * There is a bug on iOS 14 where
324
+ * Intl.DateTimeFormat takes into account
325
+ * the local timezone offset when formatting dates.
326
+ *
327
+ * Forcing the timezone to 'UTC' fixes the issue. However,
328
+ * we should keep this workaround as it is safer. In the event
329
+ * this breaks in another browser, we will not be impacted
330
+ * because all dates will be interpreted in UTC.
331
+ *
332
+ * Example:
333
+ * new Intl.DateTimeFormat('en-US', { month: 'long' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "March"
334
+ * new Intl.DateTimeFormat('en-US', { month: 'long', timeZone: 'UTC' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "April"
335
+ *
336
+ * In certain timezones, iOS 14 shows the wrong
337
+ * date for .toUTCString(). To combat this, we
338
+ * force all of the timezones to GMT+0000 (UTC).
339
+ *
340
+ * Example:
341
+ * Time Zone: Central European Standard Time
342
+ * new Date('1/1/1992').toUTCString() // "Tue, 31 Dec 1991 23:00:00 GMT"
343
+ * new Date('1/1/1992 GMT+0000').toUTCString() // "Wed, 01 Jan 1992 00:00:00 GMT"
344
+ */
345
+ const date = new Date(`${i}/1/${year} GMT+0000`);
346
+ const monthString = new Intl.DateTimeFormat(locale, { ...formatOptions, timeZone: 'UTC' }).format(date);
347
+ months.push({ text: monthString, value: i });
348
+ }
349
+ }
350
+ return months;
351
+ };
352
+ /**
353
+ * Returns information regarding
354
+ * selectable dates (i.e 1st, 2nd, 3rd, etc)
355
+ * within a reference month.
356
+ * @param locale The locale to format the date with
357
+ * @param refParts The reference month/year to generate dates for
358
+ * @param minParts The minimum bound on the date that can be returned
359
+ * @param maxParts The maximum bound on the date that can be returned
360
+ * @param dayValues The allowed date values
361
+ * @returns Date data to be used in ion-picker-column
362
+ */
363
+ const getDayColumnData = (locale, refParts, minParts, maxParts, dayValues, formatOptions = {
364
+ day: 'numeric',
365
+ }) => {
366
+ const { month, year } = refParts;
367
+ const days = [];
368
+ /**
369
+ * If we have max/min bounds that in the same
370
+ * month/year as the refParts, we should
371
+ * use the define day as the max/min day.
372
+ * Otherwise, fallback to the max/min days in a month.
373
+ */
374
+ const numDaysInMonth = getNumDaysInMonth(month, year);
375
+ const maxDay = maxParts?.day !== null && maxParts?.day !== undefined && maxParts.year === year && maxParts.month === month
376
+ ? maxParts.day
377
+ : numDaysInMonth;
378
+ const minDay = minParts?.day !== null && minParts?.day !== undefined && minParts.year === year && minParts.month === month
379
+ ? minParts.day
380
+ : 1;
381
+ if (dayValues !== undefined) {
382
+ let processedDays = dayValues;
383
+ processedDays = processedDays.filter((day) => day >= minDay && day <= maxDay);
384
+ processedDays.forEach((processedDay) => {
385
+ const date = new Date(`${month}/${processedDay}/${year} GMT+0000`);
386
+ const dayString = new Intl.DateTimeFormat(locale, { ...formatOptions, timeZone: 'UTC' }).format(date);
387
+ days.push({ text: dayString, value: processedDay });
388
+ });
389
+ }
390
+ else {
391
+ for (let i = minDay; i <= maxDay; i++) {
392
+ const date = new Date(`${month}/${i}/${year} GMT+0000`);
393
+ const dayString = new Intl.DateTimeFormat(locale, { ...formatOptions, timeZone: 'UTC' }).format(date);
394
+ days.push({ text: dayString, value: i });
395
+ }
396
+ }
397
+ return days;
398
+ };
399
+ const getYearColumnData = (locale, refParts, minParts, maxParts, yearValues) => {
400
+ let processedYears = [];
401
+ if (yearValues !== undefined) {
402
+ processedYears = yearValues;
403
+ if (maxParts?.year !== undefined) {
404
+ processedYears = processedYears.filter((year) => year <= maxParts.year);
405
+ }
406
+ if (minParts?.year !== undefined) {
407
+ processedYears = processedYears.filter((year) => year >= minParts.year);
408
+ }
409
+ }
410
+ else {
411
+ const { year } = refParts;
412
+ const maxYear = maxParts?.year ?? year;
413
+ const minYear = minParts?.year ?? year - 100;
414
+ for (let i = minYear; i <= maxYear; i++) {
415
+ processedYears.push(i);
416
+ }
417
+ }
418
+ return processedYears.map((year) => ({
419
+ text: getYear(locale, { year, month: refParts.month, day: refParts.day }),
420
+ value: year,
421
+ }));
422
+ };
423
+ /**
424
+ * Given a starting date and an upper bound,
425
+ * this functions returns an array of all
426
+ * month objects in that range.
427
+ */
428
+ const getAllMonthsInRange = (currentParts, maxParts) => {
429
+ if (currentParts.month === maxParts.month && currentParts.year === maxParts.year) {
430
+ return [currentParts];
431
+ }
432
+ return [currentParts, ...getAllMonthsInRange(getNextMonth(currentParts), maxParts)];
433
+ };
434
+ /**
435
+ * Creates and returns picker items
436
+ * that represent the days in a month.
437
+ * Example: "Thu, Jun 2"
438
+ */
439
+ const getCombinedDateColumnData = (locale, todayParts, minParts, maxParts, dayValues, monthValues) => {
440
+ let items = [];
441
+ let parts = [];
442
+ /**
443
+ * Get all month objects from the min date
444
+ * to the max date. Note: Do not use getMonthColumnData
445
+ * as that function only generates dates within a
446
+ * single year.
447
+ */
448
+ let months = getAllMonthsInRange(minParts, maxParts);
449
+ /**
450
+ * Filter out any disallowed month values.
451
+ */
452
+ if (monthValues) {
453
+ months = months.filter(({ month }) => monthValues.includes(month));
454
+ }
455
+ /**
456
+ * Get all of the days in the month.
457
+ * From there, generate an array where
458
+ * each item has the month, date, and day
459
+ * of work as the text.
460
+ */
461
+ months.forEach((monthObject) => {
462
+ const referenceMonth = { month: monthObject.month, day: null, year: monthObject.year };
463
+ const monthDays = getDayColumnData(locale, referenceMonth, minParts, maxParts, dayValues, {
464
+ month: 'short',
465
+ day: 'numeric',
466
+ weekday: 'short',
467
+ });
468
+ const dateParts = [];
469
+ const dateColumnItems = [];
470
+ monthDays.forEach((dayObject) => {
471
+ const isToday = isSameDay({ ...referenceMonth, day: dayObject.value }, todayParts);
472
+ /**
473
+ * Today's date should read as "Today" (localized)
474
+ * not the actual date string
475
+ */
476
+ dateColumnItems.push({
477
+ text: isToday ? getTodayLabel(locale) : dayObject.text,
478
+ value: `${referenceMonth.year}-${referenceMonth.month}-${dayObject.value}`,
479
+ });
480
+ /**
481
+ * When selecting a date in the wheel picker
482
+ * we need access to the raw datetime parts data.
483
+ * The picker column only accepts values of
484
+ * type string or number, so we need to return
485
+ * two sets of data: A data set to be passed
486
+ * to the picker column, and a data set to
487
+ * be used to reference the raw data when
488
+ * updating the picker column value.
489
+ */
490
+ dateParts.push({
491
+ month: referenceMonth.month,
492
+ year: referenceMonth.year,
493
+ day: dayObject.value,
494
+ });
495
+ });
496
+ parts = [...parts, ...dateParts];
497
+ items = [...items, ...dateColumnItems];
498
+ });
499
+ return {
500
+ parts,
501
+ items,
502
+ };
503
+ };
504
+ const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues) => {
505
+ const computedHourCycle = getHourCycle(locale, hourCycle);
506
+ const use24Hour = is24Hour(computedHourCycle);
507
+ const { hours, minutes, am, pm } = generateTime(locale, refParts, computedHourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues);
508
+ const hoursItems = hours.map((hour) => {
509
+ return {
510
+ text: getFormattedHour(hour, computedHourCycle),
511
+ value: getInternalHourValue(hour, use24Hour, refParts.ampm),
512
+ };
513
+ });
514
+ const minutesItems = minutes.map((minute) => {
515
+ return {
516
+ text: addTimePadding(minute),
517
+ value: minute,
518
+ };
519
+ });
520
+ const dayPeriodItems = [];
521
+ if (am && !use24Hour) {
522
+ dayPeriodItems.push({
523
+ text: getLocalizedDayPeriod(locale, 'am'),
524
+ value: 'am',
525
+ });
526
+ }
527
+ if (pm && !use24Hour) {
528
+ dayPeriodItems.push({
529
+ text: getLocalizedDayPeriod(locale, 'pm'),
530
+ value: 'pm',
531
+ });
532
+ }
533
+ return {
534
+ minutesData: minutesItems,
535
+ hoursData: hoursItems,
536
+ dayPeriodData: dayPeriodItems,
537
+ };
538
+ };
539
+
540
+ const isYearDisabled = (refYear, minParts, maxParts) => {
541
+ if (minParts && minParts.year > refYear) {
542
+ return true;
543
+ }
544
+ if (maxParts && maxParts.year < refYear) {
545
+ return true;
546
+ }
547
+ return false;
548
+ };
549
+ /**
550
+ * Returns true if a given day should
551
+ * not be interactive according to its value,
552
+ * or the max/min dates.
553
+ */
554
+ const isDayDisabled = (refParts, minParts, maxParts, dayValues) => {
555
+ /**
556
+ * If this is a filler date (i.e. padding)
557
+ * then the date is disabled.
558
+ */
559
+ if (refParts.day === null) {
560
+ return true;
561
+ }
562
+ /**
563
+ * If user passed in a list of acceptable day values
564
+ * check to make sure that the date we are looking
565
+ * at is in this array.
566
+ */
567
+ if (dayValues !== undefined && !dayValues.includes(refParts.day)) {
568
+ return true;
569
+ }
570
+ /**
571
+ * Given a min date, perform the following
572
+ * checks. If any of them are true, then the
573
+ * day should be disabled:
574
+ * 1. Is the current year < the min allowed year?
575
+ * 2. Is the current year === min allowed year,
576
+ * but the current month < the min allowed month?
577
+ * 3. Is the current year === min allowed year, the
578
+ * current month === min allow month, but the current
579
+ * day < the min allowed day?
580
+ */
581
+ if (minParts && isBefore(refParts, minParts)) {
582
+ return true;
583
+ }
584
+ /**
585
+ * Given a max date, perform the following
586
+ * checks. If any of them are true, then the
587
+ * day should be disabled:
588
+ * 1. Is the current year > the max allowed year?
589
+ * 2. Is the current year === max allowed year,
590
+ * but the current month > the max allowed month?
591
+ * 3. Is the current year === max allowed year, the
592
+ * current month === max allow month, but the current
593
+ * day > the max allowed day?
594
+ */
595
+ if (maxParts && isAfter(refParts, maxParts)) {
596
+ return true;
597
+ }
598
+ /**
599
+ * If none of these checks
600
+ * passed then the date should
601
+ * be interactive.
602
+ */
603
+ return false;
604
+ };
605
+ /**
606
+ * Given a locale, a date, the selected date(s), and today's date,
607
+ * generate the state for a given calendar day button.
608
+ */
609
+ const getCalendarDayState = (locale, refParts, activeParts, todayParts, minParts, maxParts, dayValues) => {
610
+ /**
611
+ * activeParts signals what day(s) are currently selected in the datetime.
612
+ * If multiple="true", this will be an array, but the logic in this util
613
+ * is the same whether we have one selected day or many because we're only
614
+ * calculating the state for one button. So, we treat a single activeParts value
615
+ * the same as an array of length one.
616
+ */
617
+ const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
618
+ /**
619
+ * The day button is active if it is selected, or in other words, if refParts
620
+ * matches at least one selected date.
621
+ */
622
+ const isActive = activePartsArray.find((parts) => isSameDay(refParts, parts)) !== undefined;
623
+ const isToday = isSameDay(refParts, todayParts);
624
+ const disabled = isDayDisabled(refParts, minParts, maxParts, dayValues);
625
+ /**
626
+ * Note that we always return one object regardless of whether activeParts
627
+ * was an array, since we pare down to one value for isActive.
628
+ */
629
+ return {
630
+ disabled,
631
+ isActive,
632
+ isToday,
633
+ ariaSelected: isActive ? 'true' : null,
634
+ ariaLabel: generateDayAriaLabel(locale, isToday, refParts),
635
+ text: refParts.day != null ? getDay(locale, refParts) : null,
636
+ };
637
+ };
638
+ /**
639
+ * Returns `true` if the month is disabled given the
640
+ * current date value and min/max date constraints.
641
+ */
642
+ const isMonthDisabled = (refParts, { minParts, maxParts, }) => {
643
+ // If the year is disabled then the month is disabled.
644
+ if (isYearDisabled(refParts.year, minParts, maxParts)) {
645
+ return true;
646
+ }
647
+ // If the date value is before the min date, then the month is disabled.
648
+ // If the date value is after the max date, then the month is disabled.
649
+ if ((minParts && isBefore(refParts, minParts)) || (maxParts && isAfter(refParts, maxParts))) {
650
+ return true;
651
+ }
652
+ return false;
653
+ };
654
+ /**
655
+ * Given a working date, an optional minimum date range,
656
+ * and an optional maximum date range; determine if the
657
+ * previous navigation button is disabled.
658
+ */
659
+ const isPrevMonthDisabled = (refParts, minParts, maxParts) => {
660
+ const prevMonth = {
661
+ ...getPreviousMonth(refParts),
662
+ day: null,
663
+ };
664
+ return isMonthDisabled(prevMonth, {
665
+ minParts,
666
+ maxParts,
667
+ });
668
+ };
669
+ /**
670
+ * Given a working date and a maximum date range,
671
+ * determine if the next navigation button is disabled.
672
+ */
673
+ const isNextMonthDisabled = (refParts, maxParts) => {
674
+ const nextMonth = {
675
+ ...getNextMonth(refParts),
676
+ day: null,
677
+ };
678
+ return isMonthDisabled(nextMonth, {
679
+ maxParts,
680
+ });
681
+ };
682
+ /**
683
+ * Given the value of the highlightedDates property
684
+ * and an ISO string, return the styles to use for
685
+ * that date, or undefined if none are found.
686
+ */
687
+ const getHighlightStyles = (highlightedDates, dateIsoString, el) => {
688
+ if (Array.isArray(highlightedDates)) {
689
+ const dateStringWithoutTime = dateIsoString.split('T')[0];
690
+ const matchingHighlight = highlightedDates.find((hd) => hd.date === dateStringWithoutTime);
691
+ if (matchingHighlight) {
692
+ return {
693
+ textColor: matchingHighlight.textColor,
694
+ backgroundColor: matchingHighlight.backgroundColor,
695
+ border: matchingHighlight.border,
696
+ };
697
+ }
698
+ }
699
+ else {
700
+ /**
701
+ * Wrap in a try-catch to prevent exceptions in the user's function
702
+ * from interrupting the calendar's rendering.
703
+ */
704
+ try {
705
+ return highlightedDates(dateIsoString);
706
+ }
707
+ catch (e) {
708
+ printIonError('[ion-datetime] - Exception thrown from provided `highlightedDates` callback. Please check your function and try again.', el, e);
709
+ }
710
+ }
711
+ return undefined;
712
+ };
713
+
714
+ /**
715
+ * If a time zone is provided in the format options, the rendered text could
716
+ * differ from what was selected in the Datetime, which could cause
717
+ * confusion.
718
+ */
719
+ const warnIfTimeZoneProvided = (el, formatOptions) => {
720
+ if (formatOptions?.date?.timeZone ||
721
+ formatOptions?.date?.timeZoneName ||
722
+ formatOptions?.time?.timeZone ||
723
+ formatOptions?.time?.timeZoneName) {
724
+ printIonWarning('[ion-datetime] - "timeZone" and "timeZoneName" are not supported in "formatOptions".', el);
725
+ }
726
+ };
727
+ const checkForPresentationFormatMismatch = (el, presentation, formatOptions) => {
728
+ // formatOptions is not required
729
+ if (!formatOptions)
730
+ return;
731
+ // If formatOptions is provided, the date and/or time objects are required, depending on the presentation
732
+ switch (presentation) {
733
+ case 'date':
734
+ case 'month-year':
735
+ case 'month':
736
+ case 'year':
737
+ if (formatOptions.date === undefined) {
738
+ printIonWarning(`[ion-datetime] - The '${presentation}' presentation requires a date object in formatOptions.`, el);
739
+ }
740
+ break;
741
+ case 'time':
742
+ if (formatOptions.time === undefined) {
743
+ printIonWarning(`[ion-datetime] - The 'time' presentation requires a time object in formatOptions.`, el);
744
+ }
745
+ break;
746
+ case 'date-time':
747
+ case 'time-date':
748
+ if (formatOptions.date === undefined && formatOptions.time === undefined) {
749
+ printIonWarning(`[ion-datetime] - The '${presentation}' presentation requires either a date or time object (or both) in formatOptions.`, el);
750
+ }
751
+ break;
752
+ }
753
+ };
754
+
755
+ const datetimeIosCss = () => `:host{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{-ms-flex-order:3;order:3;text-align:end}:host .wheel-order-year-first .month-column{-ms-flex-order:2;order:2;text-align:end}:host .wheel-order-year-first .year-column{-ms-flex-order:1;order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-flow:column;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:-ms-flexbox;display:flex}:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .datetime-action-buttons ion-button{--color:var(--ion-color-primary, #0054e9)}.datetime-action-buttons .datetime-action-buttons-container{display:-ms-flexbox;display:flex}:host .calendar-action-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .calendar-action-buttons ion-button{--background:transparent}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:not(.calendar-day-adjacent-day):focus{background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.2)}:host(.ion-color) .calendar-day:not(.calendar-day-adjacent-day):focus{background:rgba(var(--ion-color-base-rgb), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-flexbox;display:flex;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host .time-body-active{color:var(--ion-color-primary, #0054e9)}:host(.ion-color) .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-primary, #0054e9)}:host(.ion-color.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-base)}.calendar-month-year{min-width:0}.calendar-month-year-toggle{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;position:relative;border:0;outline:none;background:transparent;cursor:pointer;z-index:1}.calendar-month-year-toggle::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;-webkit-transition:opacity 15ms linear, background-color 15ms linear;transition:opacity 15ms linear, background-color 15ms linear;z-index:-1}.calendar-month-year-toggle.ion-focused::after{background:currentColor}.calendar-month-year-toggle:disabled{opacity:0.3;pointer-events:none}.calendar-month-year-toggle ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;-ms-flex-negative:0;flex-shrink:0}.calendar-month-year-toggle #toggle-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center}ion-picker{--highlight-background:var(--wheel-highlight-background);--highlight-border-radius:var(--wheel-highlight-border-radius);--fade-background-rgb:var(--wheel-fade-background-rgb)}:host{--background:var(--ion-color-light, #f4f5f8);--background-rgb:var(--ion-color-light-rgb, 244, 245, 248);--title-color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),:host(.datetime-presentation-date:not(.datetime-prefer-wheel)){min-height:350px}:host .datetime-header{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, var(--ion-background-color-step-200, #cccccc));font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}.calendar-month-year-toggle{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;min-height:44px;font-size:min(1rem, 25.6px);font-weight:600}.calendar-month-year-toggle.ion-focused::after{opacity:0.15}.calendar-month-year-toggle #toggle-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:10px;margin-bottom:10px}:host .calendar-action-buttons .calendar-month-year-toggle ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-primary, #0054e9)}:host(.ion-color) .calendar-action-buttons .calendar-month-year-toggle ion-icon,:host(.ion-color) .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{-ms-flex-align:stretch;align-items:stretch;height:100%}:host .calendar-action-buttons ion-buttons ion-button{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host .calendar-days-of-week{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, var(--ion-text-color-step-700, #b3b3b3));font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;-ms-flex-align:center;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.2);font-size:min(1.375rem, 35.2px)}:host(.ion-color) .calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2)}:host .calendar-day.calendar-day-today{color:var(--ion-color-primary, #0054e9)}:host(.ion-color) .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active,:host .calendar-day.calendar-day-adjacent-day.calendar-day-active{color:var(--ion-color-primary, #0054e9);font-weight:600}:host(.ion-color) .calendar-day.calendar-day-active,:host(.ion-color) .calendar-day.calendar-day-adjacent-day.calendar-day-active{color:var(--ion-color-base)}:host .calendar-day.calendar-day-today.calendar-day-active{background:var(--ion-color-primary, #0054e9);color:var(--ion-color-primary-contrast, #fff)}:host(.ion-color) .calendar-day.calendar-day-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .calendar-day.calendar-day-adjacent-day{color:var(--ion-color-step-300, var(--ion-text-color-step-700, #b3b3b3))}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, var(--ion-background-color-step-200, #cccccc))}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}:host .datetime-action-buttons{width:100%}`;
756
+
757
+ const datetimeMdCss = () => `:host{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{-ms-flex-order:3;order:3;text-align:end}:host .wheel-order-year-first .month-column{-ms-flex-order:2;order:2;text-align:end}:host .wheel-order-year-first .year-column{-ms-flex-order:1;order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-flow:column;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:-ms-flexbox;display:flex}:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .datetime-action-buttons ion-button{--color:var(--ion-color-primary, #0054e9)}.datetime-action-buttons .datetime-action-buttons-container{display:-ms-flexbox;display:flex}:host .calendar-action-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .calendar-action-buttons ion-button{--background:transparent}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:not(.calendar-day-adjacent-day):focus{background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.2)}:host(.ion-color) .calendar-day:not(.calendar-day-adjacent-day):focus{background:rgba(var(--ion-color-base-rgb), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-flexbox;display:flex;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host .time-body-active{color:var(--ion-color-primary, #0054e9)}:host(.ion-color) .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-primary, #0054e9)}:host(.ion-color.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-base)}.calendar-month-year{min-width:0}.calendar-month-year-toggle{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;position:relative;border:0;outline:none;background:transparent;cursor:pointer;z-index:1}.calendar-month-year-toggle::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;-webkit-transition:opacity 15ms linear, background-color 15ms linear;transition:opacity 15ms linear, background-color 15ms linear;z-index:-1}.calendar-month-year-toggle.ion-focused::after{background:currentColor}.calendar-month-year-toggle:disabled{opacity:0.3;pointer-events:none}.calendar-month-year-toggle ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;-ms-flex-negative:0;flex-shrink:0}.calendar-month-year-toggle #toggle-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center}ion-picker{--highlight-background:var(--wheel-highlight-background);--highlight-border-radius:var(--wheel-highlight-border-radius);--fade-background-rgb:var(--wheel-fade-background-rgb)}:host{--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #ffffff));--title-color:var(--ion-color-primary-contrast, #fff)}:host(.ion-color){--title-color:var(--ion-color-contrast)}:host .datetime-header{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:20px;padding-bottom:20px;background:var(--ion-color-primary, #0054e9);color:var(--title-color)}:host(.ion-color) .datetime-header{background:var(--ion-color-base)}:host .datetime-header .datetime-title{font-size:0.75rem;text-transform:uppercase}:host .datetime-header .datetime-selected-date{margin-top:30px;font-size:2.125rem}:host .calendar-action-buttons ion-button{--color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959))}.calendar-month-year-toggle{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:12px;padding-bottom:12px;min-height:48px;background:transparent;color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959));z-index:1}.calendar-month-year-toggle.ion-focused::after{opacity:0.04}.calendar-month-year-toggle ion-ripple-effect{color:currentColor}@media (any-hover: hover){.calendar-month-year-toggle.ion-activatable:not(.ion-focused):hover::after{background:currentColor;opacity:0.04}}:host .calendar-days-of-week{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:0px;padding-bottom:0px;color:var(--ion-color-step-500, var(--ion-text-color-step-500, gray));font-size:0.875rem;line-height:36px}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:4px;padding-bottom:4px;grid-template-rows:repeat(6, 1fr)}:host .calendar-day{width:42px;min-width:42px;height:42px;font-size:0.875rem}:host .calendar-day.calendar-day-today{border:1px solid var(--ion-color-primary, #0054e9);color:var(--ion-color-primary, #0054e9)}:host(.ion-color) .calendar-day.calendar-day-today{border:1px solid var(--ion-color-base);color:var(--ion-color-base)}:host .calendar-day.calendar-day-active,:host .calendar-day.calendar-day-adjacent-day.calendar-day-active{color:var(--ion-color-primary-contrast, #fff)}:host(.ion-color) .calendar-day.calendar-day-active,:host(.ion-color) .calendar-day.calendar-day-adjacent-day.calendar-day-active{color:var(--ion-color-contrast)}.calendar-day.calendar-day-active,.calendar-day.calendar-day-active:focus{border:1px solid var(--ion-color-primary, #0054e9);background:var(--ion-color-primary, #0054e9)}:host(.ion-color) .calendar-day.calendar-day-active,:host(.ion-color) .calendar-day.calendar-day-active:focus{border:1px solid var(--ion-color-base);background:var(--ion-color-base)}:host .calendar-day.calendar-day-adjacent-day{color:var(--ion-color-step-500, var(--ion-text-color-step-500, gray))}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:8px}:host .time-header{color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959))}:host(.datetime-presentation-month) .datetime-year,:host(.datetime-presentation-year) .datetime-year,:host(.datetime-presentation-month-year) .datetime-year{margin-top:20px;margin-bottom:20px}:host .datetime-buttons{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:10px;padding-bottom:10px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}`;
758
+
759
+ const Datetime = class {
760
+ constructor(hostRef) {
761
+ registerInstance(this, hostRef);
762
+ this.ionCancel = createEvent(this, "ionCancel", 7);
763
+ this.ionChange = createEvent(this, "ionChange", 7);
764
+ this.ionValueChange = createEvent(this, "ionValueChange", 7);
765
+ this.ionFocus = createEvent(this, "ionFocus", 7);
766
+ this.ionBlur = createEvent(this, "ionBlur", 7);
767
+ this.ionStyle = createEvent(this, "ionStyle", 7);
768
+ this.ionRender = createEvent(this, "ionRender", 7);
769
+ }
770
+ inputId = `ion-dt-${datetimeIds++}`;
771
+ calendarBodyRef;
772
+ popoverRef;
773
+ intersectionTrackerRef;
774
+ clearFocusVisible;
775
+ parsedMinuteValues;
776
+ parsedHourValues;
777
+ parsedMonthValues;
778
+ parsedYearValues;
779
+ parsedDayValues;
780
+ destroyCalendarListener;
781
+ destroyKeyboardMO;
782
+ // TODO(FW-2832): types (DatetimeParts causes some errors that need untangling)
783
+ minParts;
784
+ maxParts;
785
+ todayParts;
786
+ defaultParts;
787
+ loadTimeout;
788
+ /**
789
+ * Set true only by `visibleCallback`. Lets `hiddenCallback` ignore the
790
+ * synthetic "not intersecting" entry IntersectionObserver fires on
791
+ * `observe()` when the host mounts offscreen.
792
+ */
793
+ hasBeenIntersecting = false;
794
+ prevPresentation = null;
795
+ resolveForceDateScrolling;
796
+ showMonthAndYear = false;
797
+ activeParts = [];
798
+ workingParts = {
799
+ month: 5,
800
+ day: 28,
801
+ year: 2021,
802
+ hour: 13,
803
+ minute: 52,
804
+ ampm: 'pm',
805
+ isAdjacentDay: false,
806
+ };
807
+ get el() { return getElement(this); }
808
+ isTimePopoverOpen = false;
809
+ /**
810
+ * When defined, will force the datetime to render the month
811
+ * containing the specified date. Currently, this should only
812
+ * be used to enable immediately auto-scrolling to the new month,
813
+ * and should then be reset to undefined once the transition is
814
+ * finished and the forced month is now in view.
815
+ *
816
+ * Applies to grid-style datetimes only.
817
+ */
818
+ forceRenderDate;
819
+ /**
820
+ * The color to use from your application's color palette.
821
+ * Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
822
+ * For more information on colors, see [theming](/docs/theming/basics).
823
+ */
824
+ color;
825
+ /**
826
+ * The name of the control, which is submitted with the form data.
827
+ */
828
+ name = this.inputId;
829
+ /**
830
+ * If `true`, the user cannot interact with the datetime.
831
+ */
832
+ disabled = false;
833
+ /**
834
+ * Formatting options for dates and times.
835
+ * Should include a 'date' and/or 'time' object, each of which is of type [Intl.DateTimeFormatOptions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options).
836
+ *
837
+ */
838
+ formatOptions;
839
+ formatOptionsChanged() {
840
+ const { el, formatOptions, presentation } = this;
841
+ checkForPresentationFormatMismatch(el, presentation, formatOptions);
842
+ warnIfTimeZoneProvided(el, formatOptions);
843
+ }
844
+ /**
845
+ * If `true`, the datetime appears normal but the selected date cannot be changed.
846
+ */
847
+ readonly = false;
848
+ /**
849
+ * Returns if an individual date (calendar day) is enabled or disabled.
850
+ *
851
+ * If `true`, the day will be enabled/interactive.
852
+ * If `false`, the day will be disabled/non-interactive.
853
+ *
854
+ * The function accepts an ISO 8601 date string of a given day.
855
+ * By default, all days are enabled. Developers can use this function
856
+ * to write custom logic to disable certain days.
857
+ *
858
+ * The function is called for each rendered calendar day, for the previous, current and next month.
859
+ * Custom implementations should be optimized for performance to avoid jank.
860
+ */
861
+ isDateEnabled;
862
+ /**
863
+ * If `true`, the datetime calendar displays a six-week (42-day) layout,
864
+ * including days from the previous and next months to fill the grid.
865
+ * These adjacent days are selectable unless disabled.
866
+ */
867
+ showAdjacentDays = false;
868
+ disabledChanged() {
869
+ this.emitStyle();
870
+ }
871
+ /**
872
+ * The minimum datetime allowed. Value must be a date string
873
+ * following the
874
+ * [ISO 8601 datetime format standard](https://www.w3.org/TR/NOTE-datetime),
875
+ * such as `1996-12-19`. The format does not have to be specific to an exact
876
+ * datetime. For example, the minimum could just be the year, such as `1994`.
877
+ * Defaults to the beginning of the year, 100 years ago from today.
878
+ */
879
+ min;
880
+ minChanged() {
881
+ this.processMinParts();
882
+ }
883
+ /**
884
+ * The maximum datetime allowed. Value must be a date string
885
+ * following the
886
+ * [ISO 8601 datetime format standard](https://www.w3.org/TR/NOTE-datetime),
887
+ * `1996-12-19`. The format does not have to be specific to an exact
888
+ * datetime. For example, the maximum could just be the year, such as `1994`.
889
+ * Defaults to the end of this year.
890
+ */
891
+ max;
892
+ maxChanged() {
893
+ this.processMaxParts();
894
+ }
895
+ /**
896
+ * Which values you want to select. `"date"` will show
897
+ * a calendar picker to select the month, day, and year. `"time"`
898
+ * will show a time picker to select the hour, minute, and (optionally)
899
+ * AM/PM. `"date-time"` will show the date picker first and time picker second.
900
+ * `"time-date"` will show the time picker first and date picker second.
901
+ */
902
+ presentation = 'date-time';
903
+ presentationChanged() {
904
+ const { el, formatOptions, presentation } = this;
905
+ checkForPresentationFormatMismatch(el, presentation, formatOptions);
906
+ }
907
+ get isGridStyle() {
908
+ const { presentation, preferWheel } = this;
909
+ const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
910
+ return hasDatePresentation && !preferWheel;
911
+ }
912
+ /**
913
+ * The text to display on the picker's cancel button.
914
+ */
915
+ cancelText = 'Cancel';
916
+ /**
917
+ * The text to display on the picker's "Done" button.
918
+ */
919
+ doneText = 'Done';
920
+ /**
921
+ * The text to display on the picker's "Clear" button.
922
+ */
923
+ clearText = 'Clear';
924
+ /**
925
+ * Values used to create the list of selectable years. By default
926
+ * the year values range between the `min` and `max` datetime inputs. However, to
927
+ * control exactly which years to display, the `yearValues` input can take a number, an array
928
+ * of numbers, or string of comma separated numbers. For example, to show upcoming and
929
+ * recent leap years, then this input's value would be `yearValues="2008,2012,2016,2020,2024"`.
930
+ */
931
+ yearValues;
932
+ yearValuesChanged() {
933
+ this.parsedYearValues = convertToArrayOfNumbers(this.yearValues);
934
+ }
935
+ /**
936
+ * Values used to create the list of selectable months. By default
937
+ * the month values range from `1` to `12`. However, to control exactly which months to
938
+ * display, the `monthValues` input can take a number, an array of numbers, or a string of
939
+ * comma separated numbers. For example, if only summer months should be shown, then this
940
+ * input value would be `monthValues="6,7,8"`. Note that month numbers do *not* have a
941
+ * zero-based index, meaning January's value is `1`, and December's is `12`.
942
+ */
943
+ monthValues;
944
+ monthValuesChanged() {
945
+ this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues);
946
+ }
947
+ /**
948
+ * Values used to create the list of selectable days. By default
949
+ * every day is shown for the given month. However, to control exactly which days of
950
+ * the month to display, the `dayValues` input can take a number, an array of numbers, or
951
+ * a string of comma separated numbers. Note that even if the array days have an invalid
952
+ * number for the selected month, like `31` in February, it will correctly not show
953
+ * days which are not valid for the selected month.
954
+ */
955
+ dayValues;
956
+ dayValuesChanged() {
957
+ this.parsedDayValues = convertToArrayOfNumbers(this.dayValues);
958
+ }
959
+ /**
960
+ * Values used to create the list of selectable hours. By default
961
+ * the hour values range from `0` to `23` for 24-hour, or `1` to `12` for 12-hour. However,
962
+ * to control exactly which hours to display, the `hourValues` input can take a number, an
963
+ * array of numbers, or a string of comma separated numbers.
964
+ */
965
+ hourValues;
966
+ hourValuesChanged() {
967
+ this.parsedHourValues = convertToArrayOfNumbers(this.hourValues);
968
+ }
969
+ /**
970
+ * Values used to create the list of selectable minutes. By default
971
+ * the minutes range from `0` to `59`. However, to control exactly which minutes to display,
972
+ * the `minuteValues` input can take a number, an array of numbers, or a string of comma
973
+ * separated numbers. For example, if the minute selections should only be every 15 minutes,
974
+ * then this input value would be `minuteValues="0,15,30,45"`.
975
+ */
976
+ minuteValues;
977
+ minuteValuesChanged() {
978
+ this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues);
979
+ }
980
+ /**
981
+ * The locale to use for `ion-datetime`. This
982
+ * impacts month and day name formatting.
983
+ * The `"default"` value refers to the default
984
+ * locale set by your device.
985
+ */
986
+ locale = 'default';
987
+ /**
988
+ * The first day of the week to use for `ion-datetime`. The
989
+ * default value is `0` and represents Sunday.
990
+ */
991
+ firstDayOfWeek = 0;
992
+ /**
993
+ * A callback used to format the header text that shows how many
994
+ * dates are selected. Only used if there are 0 or more than 1
995
+ * selected (i.e. unused for exactly 1). By default, the header
996
+ * text is set to "numberOfDates days".
997
+ *
998
+ * See https://ionicframework.com/docs/troubleshooting/runtime#accessing-this
999
+ * if you need to access `this` from within the callback.
1000
+ */
1001
+ titleSelectedDatesFormatter;
1002
+ /**
1003
+ * If `true`, multiple dates can be selected at once. Only
1004
+ * applies to `presentation="date"` and `preferWheel="false"`.
1005
+ */
1006
+ multiple = false;
1007
+ /**
1008
+ * Used to apply custom text and background colors to specific dates.
1009
+ *
1010
+ * Can be either an array of objects containing ISO strings and colors,
1011
+ * or a callback that receives an ISO string and returns the colors.
1012
+ *
1013
+ * Only applies to the `date`, `date-time`, and `time-date` presentations,
1014
+ * with `preferWheel="false"`.
1015
+ */
1016
+ highlightedDates;
1017
+ /**
1018
+ * The value of the datetime as a valid ISO 8601 datetime string.
1019
+ * This should be an array of strings only when `multiple="true"`.
1020
+ */
1021
+ value;
1022
+ /**
1023
+ * Update the datetime value when the value changes
1024
+ */
1025
+ async valueChanged() {
1026
+ const { value } = this;
1027
+ if (this.hasValue()) {
1028
+ this.processValue(value);
1029
+ }
1030
+ this.emitStyle();
1031
+ this.ionValueChange.emit({ value });
1032
+ }
1033
+ /**
1034
+ * If `true`, a header will be shown above the calendar
1035
+ * picker. This will include both the slotted title, and
1036
+ * the selected date.
1037
+ */
1038
+ showDefaultTitle = false;
1039
+ /**
1040
+ * If `true`, the default "Cancel" and "OK" buttons
1041
+ * will be rendered at the bottom of the `ion-datetime`
1042
+ * component. Developers can also use the `button` slot
1043
+ * if they want to customize these buttons. If custom
1044
+ * buttons are set in the `button` slot then the
1045
+ * default buttons will not be rendered.
1046
+ */
1047
+ showDefaultButtons = false;
1048
+ /**
1049
+ * If `true`, a "Clear" button will be rendered alongside
1050
+ * the default "Cancel" and "OK" buttons at the bottom of the `ion-datetime`
1051
+ * component. Developers can also use the `button` slot
1052
+ * if they want to customize these buttons. If custom
1053
+ * buttons are set in the `button` slot then the
1054
+ * default buttons will not be rendered.
1055
+ */
1056
+ showClearButton = false;
1057
+ /**
1058
+ * If `true`, the default "Time" label will be rendered
1059
+ * for the time selector of the `ion-datetime` component.
1060
+ * Developers can also use the `time-label` slot
1061
+ * if they want to customize this label. If a custom
1062
+ * label is set in the `time-label` slot then the
1063
+ * default label will not be rendered.
1064
+ */
1065
+ showDefaultTimeLabel = true;
1066
+ /**
1067
+ * The hour cycle of the `ion-datetime`. If no value is set, this is
1068
+ * specified by the current locale.
1069
+ */
1070
+ hourCycle;
1071
+ /**
1072
+ * If `cover`, the `ion-datetime` will expand to cover the full width of its container.
1073
+ * If `fixed`, the `ion-datetime` will have a fixed width.
1074
+ */
1075
+ size = 'fixed';
1076
+ /**
1077
+ * If `true`, a wheel picker will be rendered instead of a calendar grid
1078
+ * where possible. If `false`, a calendar grid will be rendered instead of
1079
+ * a wheel picker where possible.
1080
+ *
1081
+ * A wheel picker can be rendered instead of a grid when `presentation` is
1082
+ * one of the following values: `"date"`, `"date-time"`, or `"time-date"`.
1083
+ *
1084
+ * A wheel picker will always be rendered regardless of
1085
+ * the `preferWheel` value when `presentation` is one of the following values:
1086
+ * `"time"`, `"month"`, `"month-year"`, or `"year"`.
1087
+ */
1088
+ preferWheel = false;
1089
+ /**
1090
+ * Emitted when the datetime selection was cancelled.
1091
+ */
1092
+ ionCancel;
1093
+ /**
1094
+ * Emitted when the value (selected date) has changed.
1095
+ *
1096
+ * This event will not emit when programmatically setting the `value` property.
1097
+ */
1098
+ ionChange;
1099
+ /**
1100
+ * Emitted when the value property has changed.
1101
+ * This is used to ensure that ion-datetime-button can respond
1102
+ * to any value property changes.
1103
+ * @internal
1104
+ */
1105
+ ionValueChange;
1106
+ /**
1107
+ * Emitted when the datetime has focus.
1108
+ */
1109
+ ionFocus;
1110
+ /**
1111
+ * Emitted when the datetime loses focus.
1112
+ */
1113
+ ionBlur;
1114
+ /**
1115
+ * Emitted when the styles change.
1116
+ * @internal
1117
+ */
1118
+ ionStyle;
1119
+ /**
1120
+ * Emitted when componentDidRender is fired.
1121
+ * @internal
1122
+ */
1123
+ ionRender;
1124
+ /**
1125
+ * Confirms the selected datetime value, updates the
1126
+ * `value` property, and optionally closes the popover
1127
+ * or modal that the datetime was presented in.
1128
+ *
1129
+ * @param closeOverlay If `true`, closes the parent overlay. Defaults to `false`.
1130
+ */
1131
+ async confirm(closeOverlay = false) {
1132
+ const { isCalendarPicker, activeParts, preferWheel, workingParts } = this;
1133
+ /**
1134
+ * We only update the value if the presentation is not a calendar picker.
1135
+ */
1136
+ if (activeParts !== undefined || !isCalendarPicker) {
1137
+ const activePartsIsArray = Array.isArray(activeParts);
1138
+ if (activePartsIsArray && activeParts.length === 0) {
1139
+ if (preferWheel) {
1140
+ /**
1141
+ * If the datetime is using a wheel picker, but the
1142
+ * active parts are empty, then the user has confirmed the
1143
+ * initial value (working parts) presented to them.
1144
+ */
1145
+ this.setValue(convertDataToISO(workingParts));
1146
+ }
1147
+ else {
1148
+ this.setValue(undefined);
1149
+ }
1150
+ }
1151
+ else {
1152
+ this.setValue(convertDataToISO(activeParts));
1153
+ }
1154
+ }
1155
+ if (closeOverlay) {
1156
+ this.closeParentOverlay(CONFIRM_ROLE);
1157
+ }
1158
+ }
1159
+ /**
1160
+ * Resets the internal state of the datetime but does not update the value.
1161
+ * Passing a valid ISO-8601 string will reset the state of the component to the provided date.
1162
+ * If no value is provided, the internal state will be reset to the clamped value of the min, max and today.
1163
+ *
1164
+ * @param startDate A valid [ISO-8601 string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format) to reset the datetime state to.
1165
+ */
1166
+ async reset(startDate) {
1167
+ this.processValue(startDate);
1168
+ }
1169
+ /**
1170
+ * Emits the ionCancel event and
1171
+ * optionally closes the popover
1172
+ * or modal that the datetime was
1173
+ * presented in.
1174
+ *
1175
+ * @param closeOverlay If `true`, closes the parent overlay. Defaults to `false`.
1176
+ */
1177
+ async cancel(closeOverlay = false) {
1178
+ this.ionCancel.emit();
1179
+ if (closeOverlay) {
1180
+ this.closeParentOverlay(CANCEL_ROLE);
1181
+ }
1182
+ }
1183
+ /**
1184
+ * Returns the default parts the datetime falls back to when no value is set:
1185
+ * today's date and time snapped to the closest value allowed by the
1186
+ * component's constraints (`min`, `max`, and the `*Values` props).
1187
+ *
1188
+ * @internal
1189
+ */
1190
+ async getDefaultPart() {
1191
+ return this.defaultParts;
1192
+ }
1193
+ warnIfIncorrectValueUsage = () => {
1194
+ const { multiple, value } = this;
1195
+ if (!multiple && Array.isArray(value)) {
1196
+ /**
1197
+ * We do some processing on the `value` array so
1198
+ * that it looks more like an array when logged to
1199
+ * the console.
1200
+ * Example given ['a', 'b']
1201
+ * Default toString() behavior: a,b
1202
+ * Custom behavior: ['a', 'b']
1203
+ */
1204
+ printIonWarning(`[ion-datetime] - An array of values was passed, but multiple is "false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
1205
+
1206
+ Value Passed: [${value.map((v) => `'${v}'`).join(', ')}]
1207
+ `, this.el);
1208
+ }
1209
+ };
1210
+ setValue = (value) => {
1211
+ this.value = value;
1212
+ this.ionChange.emit({ value });
1213
+ };
1214
+ /**
1215
+ * Returns the DatetimePart interface
1216
+ * to use when rendering an initial set of
1217
+ * data. This should be used when rendering an
1218
+ * interface in an environment where the `value`
1219
+ * may not be set. This function works
1220
+ * by returning the first selected date and then
1221
+ * falling back to defaultParts if no active date
1222
+ * is selected.
1223
+ */
1224
+ getActivePartsWithFallback = () => {
1225
+ const { defaultParts } = this;
1226
+ return this.getActivePart() ?? defaultParts;
1227
+ };
1228
+ getActivePart = () => {
1229
+ const { activeParts } = this;
1230
+ return Array.isArray(activeParts) ? activeParts[0] : activeParts;
1231
+ };
1232
+ closeParentOverlay = (role) => {
1233
+ const popoverOrModal = this.el.closest('ion-modal, ion-popover');
1234
+ if (popoverOrModal) {
1235
+ popoverOrModal.dismiss(undefined, role);
1236
+ }
1237
+ };
1238
+ setWorkingParts = (parts) => {
1239
+ this.workingParts = {
1240
+ ...parts,
1241
+ };
1242
+ };
1243
+ setActiveParts = (parts, removeDate = false) => {
1244
+ /** if the datetime component is in readonly mode,
1245
+ * allow browsing of the calendar without changing
1246
+ * the set value
1247
+ */
1248
+ if (this.readonly) {
1249
+ return;
1250
+ }
1251
+ const { multiple, minParts, maxParts, activeParts } = this;
1252
+ /**
1253
+ * When setting the active parts, it is possible
1254
+ * to set invalid data. For example,
1255
+ * when updating January 31 to February,
1256
+ * February 31 does not exist. As a result
1257
+ * we need to validate the active parts and
1258
+ * ensure that we are only setting valid dates.
1259
+ * Additionally, we need to update the working parts
1260
+ * too in the event that the validated parts are different.
1261
+ */
1262
+ const validatedParts = validateParts(parts, minParts, maxParts);
1263
+ this.setWorkingParts(validatedParts);
1264
+ if (multiple) {
1265
+ const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
1266
+ if (removeDate) {
1267
+ this.activeParts = activePartsArray.filter((p) => !isSameDay(p, validatedParts));
1268
+ }
1269
+ else {
1270
+ this.activeParts = [...activePartsArray, validatedParts];
1271
+ }
1272
+ }
1273
+ else {
1274
+ this.activeParts = {
1275
+ ...validatedParts,
1276
+ };
1277
+ }
1278
+ const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
1279
+ if (hasSlottedButtons || this.showDefaultButtons) {
1280
+ return;
1281
+ }
1282
+ this.confirm();
1283
+ };
1284
+ get isCalendarPicker() {
1285
+ const { presentation } = this;
1286
+ return presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1287
+ }
1288
+ initializeKeyboardListeners = () => {
1289
+ const calendarBodyRef = this.calendarBodyRef;
1290
+ if (!calendarBodyRef) {
1291
+ return;
1292
+ }
1293
+ const root = this.el.shadowRoot;
1294
+ /**
1295
+ * Get a reference to the month
1296
+ * element we are currently viewing.
1297
+ */
1298
+ const currentMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(2)');
1299
+ /**
1300
+ * When focusing the calendar body, we want to pass focus
1301
+ * to the working day, but other days should
1302
+ * only be accessible using the arrow keys. Pressing
1303
+ * Tab should jump between bodies of selectable content.
1304
+ */
1305
+ const checkCalendarBodyFocus = (ev) => {
1306
+ const record = ev[0];
1307
+ /**
1308
+ * If calendar body was already focused
1309
+ * when this fired or if the calendar body
1310
+ * if not currently focused, we should not re-focus
1311
+ * the inner day.
1312
+ */
1313
+ if (record.oldValue?.includes('ion-focused') || !calendarBodyRef.classList.contains('ion-focused')) {
1314
+ return;
1315
+ }
1316
+ this.focusWorkingDay(currentMonth);
1317
+ };
1318
+ const mo = new MutationObserver(checkCalendarBodyFocus);
1319
+ mo.observe(calendarBodyRef, { attributeFilter: ['class'], attributeOldValue: true });
1320
+ this.destroyKeyboardMO = () => {
1321
+ mo?.disconnect();
1322
+ };
1323
+ /**
1324
+ * We must use keydown not keyup as we want
1325
+ * to prevent scrolling when using the arrow keys.
1326
+ */
1327
+ calendarBodyRef.addEventListener('keydown', (ev) => {
1328
+ const activeElement = root.activeElement;
1329
+ if (!activeElement || !activeElement.classList.contains('calendar-day')) {
1330
+ return;
1331
+ }
1332
+ const parts = getPartsFromCalendarDay(activeElement);
1333
+ let partsToFocus;
1334
+ switch (ev.key) {
1335
+ case 'ArrowDown':
1336
+ ev.preventDefault();
1337
+ partsToFocus = getNextWeek(parts);
1338
+ break;
1339
+ case 'ArrowUp':
1340
+ ev.preventDefault();
1341
+ partsToFocus = getPreviousWeek(parts);
1342
+ break;
1343
+ case 'ArrowRight':
1344
+ ev.preventDefault();
1345
+ partsToFocus = getNextDay(parts);
1346
+ break;
1347
+ case 'ArrowLeft':
1348
+ ev.preventDefault();
1349
+ partsToFocus = getPreviousDay(parts);
1350
+ break;
1351
+ case 'Home':
1352
+ ev.preventDefault();
1353
+ partsToFocus = getStartOfWeek(parts);
1354
+ break;
1355
+ case 'End':
1356
+ ev.preventDefault();
1357
+ partsToFocus = getEndOfWeek(parts);
1358
+ break;
1359
+ case 'PageUp':
1360
+ ev.preventDefault();
1361
+ partsToFocus = ev.shiftKey ? getPreviousYear(parts) : getPreviousMonth(parts);
1362
+ break;
1363
+ case 'PageDown':
1364
+ ev.preventDefault();
1365
+ partsToFocus = ev.shiftKey ? getNextYear(parts) : getNextMonth(parts);
1366
+ break;
1367
+ /**
1368
+ * Do not preventDefault here
1369
+ * as we do not want to override other
1370
+ * browser defaults such as pressing Enter/Space
1371
+ * to select a day.
1372
+ */
1373
+ default:
1374
+ return;
1375
+ }
1376
+ /**
1377
+ * If the day we want to move focus to is
1378
+ * disabled, do not do anything.
1379
+ */
1380
+ if (isDayDisabled(partsToFocus, this.minParts, this.maxParts)) {
1381
+ return;
1382
+ }
1383
+ this.setWorkingParts({
1384
+ ...this.workingParts,
1385
+ ...partsToFocus,
1386
+ });
1387
+ /**
1388
+ * Give view a chance to re-render
1389
+ * then move focus to the new working day
1390
+ */
1391
+ requestAnimationFrame(() => this.focusWorkingDay(currentMonth));
1392
+ });
1393
+ };
1394
+ focusWorkingDay = (currentMonth) => {
1395
+ /**
1396
+ * Get the number of offset days so
1397
+ * we know how much to offset our next selector by
1398
+ * to grab the correct calendar-day element.
1399
+ */
1400
+ const { day, month, year } = this.workingParts;
1401
+ const firstOfMonth = new Date(`${month}/1/${year}`).getDay();
1402
+ const offset = firstOfMonth >= this.firstDayOfWeek
1403
+ ? firstOfMonth - this.firstDayOfWeek
1404
+ : 7 - (this.firstDayOfWeek - firstOfMonth);
1405
+ if (day === null) {
1406
+ return;
1407
+ }
1408
+ /**
1409
+ * Get the calendar day element
1410
+ * and focus it.
1411
+ */
1412
+ const dayEl = currentMonth.querySelector(`.calendar-day-wrapper:nth-of-type(${offset + day}) .calendar-day`);
1413
+ if (dayEl) {
1414
+ dayEl.focus();
1415
+ }
1416
+ };
1417
+ processMinParts = () => {
1418
+ const { min, defaultParts } = this;
1419
+ if (min === undefined) {
1420
+ this.minParts = undefined;
1421
+ return;
1422
+ }
1423
+ this.minParts = parseMinParts(min, defaultParts);
1424
+ };
1425
+ processMaxParts = () => {
1426
+ const { max, defaultParts } = this;
1427
+ if (max === undefined) {
1428
+ this.maxParts = undefined;
1429
+ return;
1430
+ }
1431
+ this.maxParts = parseMaxParts(max, defaultParts);
1432
+ };
1433
+ initializeCalendarListener = () => {
1434
+ const calendarBodyRef = this.calendarBodyRef;
1435
+ if (!calendarBodyRef) {
1436
+ return;
1437
+ }
1438
+ /**
1439
+ * For performance reasons, we only render 3
1440
+ * months at a time: The current month, the previous
1441
+ * month, and the next month. We have a scroll listener
1442
+ * on the calendar body to append/prepend new months.
1443
+ *
1444
+ * We can do this because Stencil is smart enough to not
1445
+ * re-create the .calendar-month containers, but rather
1446
+ * update the content within those containers.
1447
+ *
1448
+ * As an added bonus, WebKit has some troubles with
1449
+ * scroll-snap-stop: always, so not rendering all of
1450
+ * the months in a row allows us to mostly sidestep
1451
+ * that issue.
1452
+ */
1453
+ const months = calendarBodyRef.querySelectorAll('.calendar-month');
1454
+ const startMonth = months[0];
1455
+ const workingMonth = months[1];
1456
+ const endMonth = months[2];
1457
+ const mode = getIonMode(this);
1458
+ const needsiOSRubberBandFix = mode === 'ios' && typeof navigator !== 'undefined' && navigator.maxTouchPoints > 1;
1459
+ /**
1460
+ * Before setting up the scroll listener,
1461
+ * scroll the middle month into view.
1462
+ * scrollIntoView() will scroll entire page
1463
+ * if element is not in viewport. Use scrollLeft instead.
1464
+ */
1465
+ writeTask(() => {
1466
+ calendarBodyRef.scrollLeft = startMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
1467
+ const getChangedMonth = (parts) => {
1468
+ const box = calendarBodyRef.getBoundingClientRect();
1469
+ /**
1470
+ * If the current scroll position is all the way to the left
1471
+ * then we have scrolled to the previous month.
1472
+ * Otherwise, assume that we have scrolled to the next
1473
+ * month. We have a tolerance of 2px to account for
1474
+ * sub pixel rendering.
1475
+ *
1476
+ * Check below the next line ensures that we did not
1477
+ * swipe and abort (i.e. we swiped but we are still on the current month).
1478
+ */
1479
+ const condition = isRTL(this.el) ? calendarBodyRef.scrollLeft >= -2 : calendarBodyRef.scrollLeft <= 2;
1480
+ const month = condition ? startMonth : endMonth;
1481
+ /**
1482
+ * The edge of the month must be lined up with
1483
+ * the edge of the calendar body in order for
1484
+ * the component to update. Otherwise, it
1485
+ * may be the case that the user has paused their
1486
+ * swipe or the browser has not finished snapping yet.
1487
+ * Rather than check if the x values are equal,
1488
+ * we give it a tolerance of 2px to account for
1489
+ * sub pixel rendering.
1490
+ */
1491
+ const monthBox = month.getBoundingClientRect();
1492
+ if (Math.abs(monthBox.x - box.x) > 2)
1493
+ return;
1494
+ /**
1495
+ * If we're force-rendering a month, assume we've
1496
+ * scrolled to that and return it.
1497
+ *
1498
+ * If forceRenderDate is ever used in a context where the
1499
+ * forced month is not immediately auto-scrolled to, this
1500
+ * should be updated to also check whether `month` has the
1501
+ * same month and year as the forced date.
1502
+ */
1503
+ const { forceRenderDate } = this;
1504
+ if (forceRenderDate !== undefined) {
1505
+ return { month: forceRenderDate.month, year: forceRenderDate.year, day: forceRenderDate.day };
1506
+ }
1507
+ /**
1508
+ * From here, we can determine if the start
1509
+ * month or the end month was scrolled into view.
1510
+ * If no month was changed, then we can return from
1511
+ * the scroll callback early.
1512
+ */
1513
+ if (month === startMonth) {
1514
+ return getPreviousMonth(parts);
1515
+ }
1516
+ else if (month === endMonth) {
1517
+ return getNextMonth(parts);
1518
+ }
1519
+ else {
1520
+ return;
1521
+ }
1522
+ };
1523
+ const updateActiveMonth = () => {
1524
+ if (needsiOSRubberBandFix) {
1525
+ calendarBodyRef.style.removeProperty('pointer-events');
1526
+ appliediOSRubberBandFix = false;
1527
+ }
1528
+ /**
1529
+ * If the month did not change
1530
+ * then we can return early.
1531
+ */
1532
+ const newDate = getChangedMonth(this.workingParts);
1533
+ if (!newDate)
1534
+ return;
1535
+ const { month, day, year } = newDate;
1536
+ if (isMonthDisabled({ month, year, day: null }, {
1537
+ minParts: { ...this.minParts, day: null },
1538
+ maxParts: { ...this.maxParts, day: null },
1539
+ })) {
1540
+ return;
1541
+ }
1542
+ /**
1543
+ * Prevent scrolling for other browsers
1544
+ * to give the DOM time to update and the container
1545
+ * time to properly snap.
1546
+ */
1547
+ calendarBodyRef.style.setProperty('overflow', 'hidden');
1548
+ /**
1549
+ * Use a writeTask here to ensure
1550
+ * that the state is updated and the
1551
+ * correct month is scrolled into view
1552
+ * in the same frame. This is not
1553
+ * typically a problem on newer devices
1554
+ * but older/slower device may have a flicker
1555
+ * if we did not do this.
1556
+ */
1557
+ writeTask(() => {
1558
+ this.setWorkingParts({
1559
+ ...this.workingParts,
1560
+ month,
1561
+ day: day,
1562
+ year,
1563
+ });
1564
+ calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
1565
+ calendarBodyRef.style.removeProperty('overflow');
1566
+ if (this.resolveForceDateScrolling) {
1567
+ this.resolveForceDateScrolling();
1568
+ }
1569
+ const activeEl = this.el.shadowRoot.activeElement;
1570
+ if (activeEl && activeEl.classList.contains('calendar-day')) {
1571
+ activeEl.closest('.calendar-body')?.focus();
1572
+ }
1573
+ });
1574
+ };
1575
+ /**
1576
+ * When the container finishes scrolling we
1577
+ * need to update the DOM with the selected month.
1578
+ */
1579
+ let scrollTimeout;
1580
+ /**
1581
+ * We do not want to attempt to set pointer-events
1582
+ * multiple times within a single swipe gesture as
1583
+ * that adds unnecessary work to the main thread.
1584
+ */
1585
+ let appliediOSRubberBandFix = false;
1586
+ const scrollCallback = () => {
1587
+ if (scrollTimeout) {
1588
+ clearTimeout(scrollTimeout);
1589
+ }
1590
+ /**
1591
+ * On iOS it is possible to quickly rubber band
1592
+ * the scroll area before the scroll timeout has fired.
1593
+ * This results in users reaching the end of the scrollable
1594
+ * container before the DOM has updated.
1595
+ * By setting `pointer-events: none` we can ensure that
1596
+ * subsequent swipes do not happen while the container
1597
+ * is snapping.
1598
+ */
1599
+ if (!appliediOSRubberBandFix && needsiOSRubberBandFix) {
1600
+ calendarBodyRef.style.setProperty('pointer-events', 'none');
1601
+ appliediOSRubberBandFix = true;
1602
+ }
1603
+ // Wait ~3 frames
1604
+ scrollTimeout = setTimeout(updateActiveMonth, 50);
1605
+ };
1606
+ calendarBodyRef.addEventListener('scroll', scrollCallback);
1607
+ this.destroyCalendarListener = () => {
1608
+ calendarBodyRef.removeEventListener('scroll', scrollCallback);
1609
+ };
1610
+ });
1611
+ };
1612
+ connectedCallback() {
1613
+ this.clearFocusVisible = startFocusVisible(this.el).destroy;
1614
+ this.loadTimeout = setTimeout(() => {
1615
+ this.ensureReadyIfVisible();
1616
+ }, 100);
1617
+ }
1618
+ disconnectedCallback() {
1619
+ if (this.clearFocusVisible) {
1620
+ this.clearFocusVisible();
1621
+ this.clearFocusVisible = undefined;
1622
+ }
1623
+ this.loadTimeoutCleanup();
1624
+ this.hasBeenIntersecting = false;
1625
+ }
1626
+ /**
1627
+ * Clean up all listeners except for the overlay
1628
+ * listener. This is so that we can re-create the listeners
1629
+ * if the datetime has been hidden/presented by a modal or popover.
1630
+ */
1631
+ destroyInteractionListeners = () => {
1632
+ const { destroyCalendarListener, destroyKeyboardMO } = this;
1633
+ if (destroyCalendarListener !== undefined) {
1634
+ destroyCalendarListener();
1635
+ }
1636
+ if (destroyKeyboardMO !== undefined) {
1637
+ destroyKeyboardMO();
1638
+ }
1639
+ };
1640
+ initializeListeners() {
1641
+ this.initializeCalendarListener();
1642
+ this.initializeKeyboardListeners();
1643
+ }
1644
+ /**
1645
+ * TODO(FW-6931): Remove this fallback upon solving the root cause
1646
+ * Fallback to ensure the datetime becomes ready even if
1647
+ * IntersectionObserver never reports it as intersecting.
1648
+ *
1649
+ * This is primarily used in environments where the observer
1650
+ * might not fire as expected, such as when running under
1651
+ * synthetic tests that stub IntersectionObserver.
1652
+ */
1653
+ ensureReadyIfVisible = () => {
1654
+ if (this.el.classList.contains('datetime-ready')) {
1655
+ return;
1656
+ }
1657
+ const rect = this.el.getBoundingClientRect();
1658
+ if (rect.width === 0 || rect.height === 0) {
1659
+ return;
1660
+ }
1661
+ this.markReady();
1662
+ };
1663
+ markReady = () => {
1664
+ if (this.el.classList.contains('datetime-ready')) {
1665
+ return;
1666
+ }
1667
+ this.initializeListeners();
1668
+ /**
1669
+ * TODO FW-2793: Datetime needs a frame to ensure that it
1670
+ * can properly scroll contents into view. As a result
1671
+ * we hide the scrollable content until after that frame
1672
+ * so users do not see the content quickly shifting. The downside
1673
+ * is that the content will pop into view a frame after. Maybe there
1674
+ * is a better way to handle this?
1675
+ */
1676
+ writeTask(() => {
1677
+ this.el.classList.add('datetime-ready');
1678
+ });
1679
+ };
1680
+ loadTimeoutCleanup = () => {
1681
+ if (this.loadTimeout) {
1682
+ clearTimeout(this.loadTimeout);
1683
+ this.loadTimeout = undefined;
1684
+ }
1685
+ };
1686
+ componentDidLoad() {
1687
+ const { el, intersectionTrackerRef } = this;
1688
+ /**
1689
+ * If a scrollable element is hidden using `display: none`,
1690
+ * it will not have a scroll height meaning we cannot scroll elements
1691
+ * into view. As a result, we will need to wait for the datetime to become
1692
+ * visible if used inside of a modal or a popover otherwise the scrollable
1693
+ * areas will not have the correct values snapped into place.
1694
+ */
1695
+ const visibleCallback = (entries) => {
1696
+ const ev = entries[0];
1697
+ if (!ev.isIntersecting) {
1698
+ return;
1699
+ }
1700
+ this.hasBeenIntersecting = true;
1701
+ this.markReady();
1702
+ };
1703
+ const visibleIO = new IntersectionObserver(visibleCallback, { threshold: 0.01, root: el });
1704
+ /**
1705
+ * Use raf to avoid a race condition between the component loading and
1706
+ * its display animation starting (such as when shown in a modal). This
1707
+ * could cause the datetime to start at a visibility of 0, erroneously
1708
+ * triggering the `hiddenIO` observer below.
1709
+ */
1710
+ raf(() => visibleIO?.observe(intersectionTrackerRef));
1711
+ /**
1712
+ * TODO(FW-6931): Remove this fallback upon solving the root cause
1713
+ * Fallback: If IntersectionObserver never reports that the
1714
+ * datetime is visible but the host clearly has layout, ensure
1715
+ * we still initialize listeners and mark the component as ready.
1716
+ *
1717
+ * We schedule this after everything has had a chance to run.
1718
+ *
1719
+ * We also clean up the load timeout to ensure that we don't have multiple timeouts running.
1720
+ */
1721
+ this.loadTimeoutCleanup();
1722
+ this.loadTimeout = setTimeout(() => {
1723
+ this.ensureReadyIfVisible();
1724
+ }, 100);
1725
+ /**
1726
+ * We need to clean up listeners when the datetime is hidden
1727
+ * in a popover/modal so that we can properly scroll containers
1728
+ * back into view if they are re-presented. When the datetime is hidden
1729
+ * the scroll areas have scroll widths/heights of 0px, so any snapping
1730
+ * we did originally has been lost.
1731
+ */
1732
+ const hiddenCallback = (entries) => {
1733
+ const ev = entries[0];
1734
+ if (ev.isIntersecting) {
1735
+ return;
1736
+ }
1737
+ // Ignore the initial "not intersecting" entry IntersectionObserver fires on observe().
1738
+ if (!this.hasBeenIntersecting) {
1739
+ return;
1740
+ }
1741
+ this.hasBeenIntersecting = false;
1742
+ this.destroyInteractionListeners();
1743
+ /**
1744
+ * When datetime is hidden, we need to make sure that
1745
+ * the month/year picker is closed. Otherwise,
1746
+ * it will be open when the datetime re-appears
1747
+ * and the scroll area of the calendar grid will be 0.
1748
+ * As a result, the wrong month will be shown.
1749
+ */
1750
+ this.showMonthAndYear = false;
1751
+ writeTask(() => {
1752
+ this.el.classList.remove('datetime-ready');
1753
+ });
1754
+ };
1755
+ const hiddenIO = new IntersectionObserver(hiddenCallback, { threshold: 0, root: el });
1756
+ raf(() => hiddenIO?.observe(intersectionTrackerRef));
1757
+ /**
1758
+ * Datetime uses Ionic components that emit
1759
+ * ionFocus and ionBlur. These events are
1760
+ * composed meaning they will cross
1761
+ * the shadow dom boundary. We need to
1762
+ * stop propagation on these events otherwise
1763
+ * developers will see 2 ionFocus or 2 ionBlur
1764
+ * events at a time.
1765
+ */
1766
+ const root = getElementRoot(this.el);
1767
+ root.addEventListener('ionFocus', (ev) => ev.stopPropagation());
1768
+ root.addEventListener('ionBlur', (ev) => ev.stopPropagation());
1769
+ }
1770
+ /**
1771
+ * When the presentation is changed, all calendar content is recreated,
1772
+ * so we need to re-init behavior with the new elements.
1773
+ */
1774
+ componentDidRender() {
1775
+ const { presentation, prevPresentation, calendarBodyRef, minParts, preferWheel, forceRenderDate } = this;
1776
+ /**
1777
+ * TODO(FW-2165)
1778
+ * Remove this when https://bugs.webkit.org/show_bug.cgi?id=235960 is fixed.
1779
+ * When using `min`, we add `scroll-snap-align: none`
1780
+ * to the disabled month so that users cannot scroll to it.
1781
+ * This triggers a bug in WebKit where the scroll position is reset.
1782
+ * Since the month change logic is handled by a scroll listener,
1783
+ * this causes the month to change leading to `scroll-snap-align`
1784
+ * changing again, thus changing the scroll position again and causing
1785
+ * an infinite loop.
1786
+ * This issue only applies to the calendar grid, so we can disable
1787
+ * it if the calendar grid is not being used.
1788
+ */
1789
+ const hasCalendarGrid = !preferWheel && ['date-time', 'time-date', 'date'].includes(presentation);
1790
+ if (minParts !== undefined && hasCalendarGrid && calendarBodyRef) {
1791
+ const workingMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(1)');
1792
+ /**
1793
+ * We need to make sure the datetime is not in the process
1794
+ * of scrolling to a new datetime value if the value
1795
+ * is updated programmatically.
1796
+ * Otherwise, the datetime will appear to not scroll at all because
1797
+ * we are resetting the scroll position to the center of the view.
1798
+ * Prior to the datetime's value being updated programmatically,
1799
+ * the calendarBodyRef is scrolled such that the middle month is centered
1800
+ * in the view. The below code updates the scroll position so the middle
1801
+ * month is also centered in the view. Since the scroll position did not change,
1802
+ * the scroll callback in this file does not fire,
1803
+ * and the resolveForceDateScrolling promise never resolves.
1804
+ */
1805
+ if (workingMonth && forceRenderDate === undefined) {
1806
+ calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
1807
+ }
1808
+ }
1809
+ if (prevPresentation === null) {
1810
+ this.prevPresentation = presentation;
1811
+ return;
1812
+ }
1813
+ if (presentation === prevPresentation) {
1814
+ return;
1815
+ }
1816
+ this.prevPresentation = presentation;
1817
+ this.destroyInteractionListeners();
1818
+ this.initializeListeners();
1819
+ /**
1820
+ * The month/year picker from the date interface
1821
+ * should be closed as it is not available in non-date
1822
+ * interfaces.
1823
+ */
1824
+ this.showMonthAndYear = false;
1825
+ raf(() => {
1826
+ this.ionRender.emit();
1827
+ });
1828
+ }
1829
+ processValue = (value) => {
1830
+ const hasValue = value !== null && value !== undefined && value !== '' && (!Array.isArray(value) || value.length > 0);
1831
+ const valueToProcess = hasValue ? parseDate(value) : this.defaultParts;
1832
+ const { minParts, maxParts, workingParts, el } = this;
1833
+ this.warnIfIncorrectValueUsage();
1834
+ /**
1835
+ * Return early if the value wasn't parsed correctly, such as
1836
+ * if an improperly formatted date string was provided.
1837
+ */
1838
+ if (!valueToProcess) {
1839
+ return;
1840
+ }
1841
+ /**
1842
+ * Datetime should only warn of out of bounds values
1843
+ * if set by the user. If the `value` is undefined,
1844
+ * we will default to today's date which may be out
1845
+ * of bounds. In this case, the warning makes it look
1846
+ * like the developer did something wrong which is
1847
+ * not true.
1848
+ */
1849
+ if (hasValue) {
1850
+ warnIfValueOutOfBounds(valueToProcess, minParts, maxParts);
1851
+ }
1852
+ /**
1853
+ * If there are multiple values, clamp to the last one.
1854
+ * This is because the last value is the one that the user
1855
+ * has most recently interacted with.
1856
+ */
1857
+ const singleValue = Array.isArray(valueToProcess) ? valueToProcess[valueToProcess.length - 1] : valueToProcess;
1858
+ const targetValue = clampDate(singleValue, minParts, maxParts);
1859
+ const { month, day, year, hour, minute } = targetValue;
1860
+ const ampm = parseAmPm(hour);
1861
+ /**
1862
+ * Since `activeParts` indicates a value that been explicitly selected
1863
+ * either by the user or the app, only update `activeParts` if the
1864
+ * `value` property is set.
1865
+ */
1866
+ if (hasValue) {
1867
+ if (Array.isArray(valueToProcess)) {
1868
+ this.activeParts = [...valueToProcess];
1869
+ }
1870
+ else {
1871
+ this.activeParts = {
1872
+ month,
1873
+ day,
1874
+ year,
1875
+ hour,
1876
+ minute,
1877
+ ampm,
1878
+ };
1879
+ }
1880
+ }
1881
+ else {
1882
+ /**
1883
+ * Reset the active parts if the value is not set.
1884
+ * This will clear the selected calendar day when
1885
+ * performing a clear action or using the reset() method.
1886
+ */
1887
+ this.activeParts = [];
1888
+ }
1889
+ const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
1890
+ const bodyIsVisible = el.classList.contains('datetime-ready');
1891
+ const { isGridStyle, showMonthAndYear } = this;
1892
+ if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
1893
+ /**
1894
+ * Only animate if:
1895
+ * 1. We're using grid style (wheel style pickers should just jump to new value)
1896
+ * 2. The month and/or year actually changed, and both are defined (otherwise there's nothing to animate to)
1897
+ * 3. The calendar body is visible (prevents animation when in collapsed datetime-button, for example)
1898
+ * 4. The month/year picker is not open (since you wouldn't see the animation anyway)
1899
+ */
1900
+ this.animateToDate(targetValue);
1901
+ }
1902
+ else {
1903
+ this.setWorkingParts({
1904
+ month,
1905
+ day,
1906
+ year,
1907
+ hour,
1908
+ minute,
1909
+ ampm,
1910
+ });
1911
+ }
1912
+ };
1913
+ animateToDate = async (targetValue) => {
1914
+ const { workingParts } = this;
1915
+ /**
1916
+ * Tell other render functions that we need to force the
1917
+ * target month to appear in place of the actual next/prev month.
1918
+ * Because this is a State variable, a rerender will be triggered
1919
+ * automatically, updating the rendered months.
1920
+ */
1921
+ this.forceRenderDate = targetValue;
1922
+ /**
1923
+ * Flag that we've started scrolling to the forced date.
1924
+ * The resolve function will be called by the datetime's
1925
+ * scroll listener when it's done updating everything.
1926
+ * This is a replacement for making prev/nextMonth async,
1927
+ * since the logic we're waiting on is in a listener.
1928
+ */
1929
+ const forceDateScrollingPromise = new Promise((resolve) => {
1930
+ this.resolveForceDateScrolling = resolve;
1931
+ });
1932
+ /**
1933
+ * Animate smoothly to the forced month. This will also update
1934
+ * workingParts and correct the surrounding months for us.
1935
+ */
1936
+ const targetMonthIsBefore = isBefore(targetValue, workingParts);
1937
+ targetMonthIsBefore ? this.prevMonth() : this.nextMonth();
1938
+ await forceDateScrollingPromise;
1939
+ this.resolveForceDateScrolling = undefined;
1940
+ this.forceRenderDate = undefined;
1941
+ };
1942
+ componentWillLoad() {
1943
+ const { el, formatOptions, highlightedDates, multiple, presentation, preferWheel } = this;
1944
+ if (multiple) {
1945
+ if (presentation !== 'date') {
1946
+ printIonWarning('[ion-datetime] - Multiple date selection is only supported for presentation="date".', el);
1947
+ }
1948
+ if (preferWheel) {
1949
+ printIonWarning('[ion-datetime] - Multiple date selection is not supported with preferWheel="true".', el);
1950
+ }
1951
+ }
1952
+ if (highlightedDates !== undefined) {
1953
+ if (presentation !== 'date' && presentation !== 'date-time' && presentation !== 'time-date') {
1954
+ printIonWarning('[ion-datetime] - The highlightedDates property is only supported with the date, date-time, and time-date presentations.', el);
1955
+ }
1956
+ if (preferWheel) {
1957
+ printIonWarning('[ion-datetime] - The highlightedDates property is not supported with preferWheel="true".', el);
1958
+ }
1959
+ }
1960
+ if (formatOptions) {
1961
+ checkForPresentationFormatMismatch(el, presentation, formatOptions);
1962
+ warnIfTimeZoneProvided(el, formatOptions);
1963
+ }
1964
+ const hourValues = (this.parsedHourValues = convertToArrayOfNumbers(this.hourValues));
1965
+ const minuteValues = (this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues));
1966
+ const monthValues = (this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues));
1967
+ const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
1968
+ const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
1969
+ const todayParts = (this.todayParts = parseDate(getToday()));
1970
+ this.processMinParts();
1971
+ this.processMaxParts();
1972
+ this.defaultParts = getClosestValidDate({
1973
+ refParts: todayParts,
1974
+ monthValues,
1975
+ dayValues,
1976
+ yearValues,
1977
+ hourValues,
1978
+ minuteValues,
1979
+ minParts: this.minParts,
1980
+ maxParts: this.maxParts,
1981
+ });
1982
+ this.processValue(this.value);
1983
+ this.emitStyle();
1984
+ }
1985
+ emitStyle() {
1986
+ this.ionStyle.emit({
1987
+ interactive: true,
1988
+ datetime: true,
1989
+ 'interactive-disabled': this.disabled,
1990
+ });
1991
+ }
1992
+ onFocus = () => {
1993
+ this.ionFocus.emit();
1994
+ };
1995
+ onBlur = () => {
1996
+ this.ionBlur.emit();
1997
+ };
1998
+ hasValue = () => {
1999
+ return this.value != null;
2000
+ };
2001
+ nextMonth = () => {
2002
+ const calendarBodyRef = this.calendarBodyRef;
2003
+ if (!calendarBodyRef) {
2004
+ return;
2005
+ }
2006
+ const nextMonth = calendarBodyRef.querySelector('.calendar-month:last-of-type');
2007
+ if (!nextMonth) {
2008
+ return;
2009
+ }
2010
+ const left = nextMonth.offsetWidth * 2;
2011
+ const scrollMode = config.getBoolean('animated', true) ? 'smooth' : 'instant';
2012
+ calendarBodyRef.scrollTo({
2013
+ top: 0,
2014
+ left: left * (isRTL(this.el) ? -1 : 1),
2015
+ behavior: scrollMode,
2016
+ });
2017
+ };
2018
+ prevMonth = () => {
2019
+ const calendarBodyRef = this.calendarBodyRef;
2020
+ if (!calendarBodyRef) {
2021
+ return;
2022
+ }
2023
+ const prevMonth = calendarBodyRef.querySelector('.calendar-month:first-of-type');
2024
+ if (!prevMonth) {
2025
+ return;
2026
+ }
2027
+ const left = prevMonth.offsetWidth * 2;
2028
+ const scrollMode = config.getBoolean('animated', true) ? 'smooth' : 'instant';
2029
+ calendarBodyRef.scrollTo({
2030
+ top: 0,
2031
+ left: left * (isRTL(this.el) ? 1 : -1),
2032
+ behavior: scrollMode,
2033
+ });
2034
+ };
2035
+ toggleMonthAndYearView = () => {
2036
+ this.showMonthAndYear = !this.showMonthAndYear;
2037
+ };
2038
+ /**
2039
+ * Universal render methods
2040
+ * These are pieces of datetime that
2041
+ * are rendered independently of presentation.
2042
+ */
2043
+ renderFooter() {
2044
+ const { disabled, readonly, showDefaultButtons, showClearButton } = this;
2045
+ /**
2046
+ * The cancel, clear, and confirm buttons
2047
+ * should not be interactive if the datetime
2048
+ * is disabled or readonly.
2049
+ */
2050
+ const isButtonDisabled = disabled || readonly;
2051
+ const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
2052
+ if (!hasSlottedButtons && !showDefaultButtons && !showClearButton) {
2053
+ return;
2054
+ }
2055
+ const clearButtonClick = () => {
2056
+ this.reset();
2057
+ this.setValue(undefined);
2058
+ };
2059
+ /**
2060
+ * By default we render two buttons:
2061
+ * Cancel - Dismisses the datetime and
2062
+ * does not update the `value` prop.
2063
+ * OK - Dismisses the datetime and
2064
+ * updates the `value` prop.
2065
+ */
2066
+ return (h("div", { class: "datetime-footer" }, h("div", { class: "datetime-buttons" }, h("div", { class: {
2067
+ ['datetime-action-buttons']: true,
2068
+ ['has-clear-button']: this.showClearButton,
2069
+ } }, h("slot", { name: "buttons" }, h("ion-buttons", null, showDefaultButtons && (h("ion-button", { id: "cancel-button", color: this.color, onClick: () => this.cancel(true), disabled: isButtonDisabled }, this.cancelText)), h("div", { class: "datetime-action-buttons-container" }, showClearButton && (h("ion-button", { id: "clear-button", color: this.color, onClick: () => clearButtonClick(), disabled: isButtonDisabled }, this.clearText)), showDefaultButtons && (h("ion-button", { id: "confirm-button", color: this.color, onClick: () => this.confirm(true), disabled: isButtonDisabled }, this.doneText)))))))));
2070
+ }
2071
+ /**
2072
+ * Wheel picker render methods
2073
+ */
2074
+ renderWheelPicker(forcePresentation = this.presentation) {
2075
+ /**
2076
+ * If presentation="time-date" we switch the
2077
+ * order of the render array here instead of
2078
+ * manually reordering each date/time picker
2079
+ * column with CSS. This allows for additional
2080
+ * flexibility if we need to render subsets
2081
+ * of the date/time data or do additional ordering
2082
+ * within the child render functions.
2083
+ */
2084
+ const renderArray = forcePresentation === 'time-date'
2085
+ ? [this.renderTimePickerColumns(forcePresentation), this.renderDatePickerColumns(forcePresentation)]
2086
+ : [this.renderDatePickerColumns(forcePresentation), this.renderTimePickerColumns(forcePresentation)];
2087
+ return h("ion-picker", { class: FOCUS_TRAP_DISABLE_CLASS }, renderArray);
2088
+ }
2089
+ renderDatePickerColumns(forcePresentation) {
2090
+ return forcePresentation === 'date-time' || forcePresentation === 'time-date'
2091
+ ? this.renderCombinedDatePickerColumn()
2092
+ : this.renderIndividualDatePickerColumns(forcePresentation);
2093
+ }
2094
+ renderCombinedDatePickerColumn() {
2095
+ const { defaultParts, disabled, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
2096
+ const activePart = this.getActivePartsWithFallback();
2097
+ /**
2098
+ * By default, generate a range of 3 months:
2099
+ * Previous month, current month, and next month
2100
+ */
2101
+ const monthsToRender = generateMonths(workingParts);
2102
+ const lastMonth = monthsToRender[monthsToRender.length - 1];
2103
+ /**
2104
+ * Ensure that users can select the entire window of dates.
2105
+ */
2106
+ monthsToRender[0].day = 1;
2107
+ lastMonth.day = getNumDaysInMonth(lastMonth.month, lastMonth.year);
2108
+ /**
2109
+ * Narrow the dates rendered based on min/max dates (if any).
2110
+ * The `min` date is used if the min is after the generated min month.
2111
+ * The `max` date is used if the max is before the generated max month.
2112
+ * This ensures that the sliding window always stays at 3 months
2113
+ * but still allows future dates to be lazily rendered based on any min/max
2114
+ * constraints.
2115
+ */
2116
+ const min = minParts !== undefined && isAfter(minParts, monthsToRender[0]) ? minParts : monthsToRender[0];
2117
+ const max = maxParts !== undefined && isBefore(maxParts, lastMonth) ? maxParts : lastMonth;
2118
+ const result = getCombinedDateColumnData(locale, todayParts, min, max, this.parsedDayValues, this.parsedMonthValues);
2119
+ let items = result.items;
2120
+ const parts = result.parts;
2121
+ if (isDateEnabled) {
2122
+ items = items.map((itemObject, index) => {
2123
+ const referenceParts = parts[index];
2124
+ let disabled;
2125
+ try {
2126
+ /**
2127
+ * The `isDateEnabled` implementation is try-catch wrapped
2128
+ * to prevent exceptions in the user's function from
2129
+ * interrupting the calendar rendering.
2130
+ */
2131
+ disabled = !isDateEnabled(convertDataToISO(referenceParts));
2132
+ }
2133
+ catch (e) {
2134
+ printIonError('[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
2135
+ }
2136
+ return {
2137
+ ...itemObject,
2138
+ disabled,
2139
+ };
2140
+ });
2141
+ }
2142
+ /**
2143
+ * If we have selected a day already, then default the column
2144
+ * to that value. Otherwise, set it to the default date.
2145
+ */
2146
+ const todayString = workingParts.day !== null
2147
+ ? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
2148
+ : `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
2149
+ return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
2150
+ const { value } = ev.detail;
2151
+ const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
2152
+ this.setWorkingParts({
2153
+ ...workingParts,
2154
+ ...findPart,
2155
+ });
2156
+ this.setActiveParts({
2157
+ ...activePart,
2158
+ ...findPart,
2159
+ });
2160
+ ev.stopPropagation();
2161
+ } }, items.map((item) => (h("ion-picker-column-option", { color: this.color, part: item.value === todayString ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: item.value, disabled: item.disabled, value: item.value }, item.text)))));
2162
+ }
2163
+ renderIndividualDatePickerColumns(forcePresentation) {
2164
+ const { workingParts, isDateEnabled } = this;
2165
+ const shouldRenderMonths = forcePresentation !== 'year' && forcePresentation !== 'time';
2166
+ const months = shouldRenderMonths
2167
+ ? getMonthColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedMonthValues)
2168
+ : [];
2169
+ const shouldRenderDays = forcePresentation === 'date';
2170
+ let days = shouldRenderDays
2171
+ ? getDayColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedDayValues)
2172
+ : [];
2173
+ if (isDateEnabled) {
2174
+ days = days.map((dayObject) => {
2175
+ const { value } = dayObject;
2176
+ const valueNum = typeof value === 'string' ? parseInt(value) : value;
2177
+ const referenceParts = {
2178
+ month: workingParts.month,
2179
+ day: valueNum,
2180
+ year: workingParts.year,
2181
+ };
2182
+ let disabled;
2183
+ try {
2184
+ /**
2185
+ * The `isDateEnabled` implementation is try-catch wrapped
2186
+ * to prevent exceptions in the user's function from
2187
+ * interrupting the calendar rendering.
2188
+ */
2189
+ disabled = !isDateEnabled(convertDataToISO(referenceParts));
2190
+ }
2191
+ catch (e) {
2192
+ printIonError('[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
2193
+ }
2194
+ return {
2195
+ ...dayObject,
2196
+ disabled,
2197
+ };
2198
+ });
2199
+ }
2200
+ const shouldRenderYears = forcePresentation !== 'month' && forcePresentation !== 'time';
2201
+ const years = shouldRenderYears
2202
+ ? getYearColumnData(this.locale, this.defaultParts, this.minParts, this.maxParts, this.parsedYearValues)
2203
+ : [];
2204
+ /**
2205
+ * Certain locales show the day before the month.
2206
+ */
2207
+ const showMonthFirst = isMonthFirstLocale(this.locale, { month: 'numeric', day: 'numeric' });
2208
+ let renderArray = [];
2209
+ if (showMonthFirst) {
2210
+ renderArray = [
2211
+ this.renderMonthPickerColumn(months),
2212
+ this.renderDayPickerColumn(days),
2213
+ this.renderYearPickerColumn(years),
2214
+ ];
2215
+ }
2216
+ else {
2217
+ renderArray = [
2218
+ this.renderDayPickerColumn(days),
2219
+ this.renderMonthPickerColumn(months),
2220
+ this.renderYearPickerColumn(years),
2221
+ ];
2222
+ }
2223
+ return renderArray;
2224
+ }
2225
+ renderDayPickerColumn(days) {
2226
+ if (days.length === 0) {
2227
+ return [];
2228
+ }
2229
+ const { disabled, workingParts } = this;
2230
+ const activePart = this.getActivePartsWithFallback();
2231
+ const pickerColumnValue = (workingParts.day !== null ? workingParts.day : this.defaultParts.day) ?? undefined;
2232
+ return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
2233
+ this.setWorkingParts({
2234
+ ...workingParts,
2235
+ day: ev.detail.value,
2236
+ });
2237
+ this.setActiveParts({
2238
+ ...activePart,
2239
+ day: ev.detail.value,
2240
+ });
2241
+ ev.stopPropagation();
2242
+ } }, days.map((day) => (h("ion-picker-column-option", { color: this.color, part: day.value === pickerColumnValue ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: day.value, disabled: day.disabled, value: day.value }, day.text)))));
2243
+ }
2244
+ renderMonthPickerColumn(months) {
2245
+ if (months.length === 0) {
2246
+ return [];
2247
+ }
2248
+ const { disabled, workingParts } = this;
2249
+ const activePart = this.getActivePartsWithFallback();
2250
+ return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
2251
+ this.setWorkingParts({
2252
+ ...workingParts,
2253
+ month: ev.detail.value,
2254
+ });
2255
+ // Month wheel is navigation-only in multi-select mode as a fix for https://github.com/ionic-team/ionic-framework/issues/29673
2256
+ if (!this.multiple) {
2257
+ this.setActiveParts({
2258
+ ...activePart,
2259
+ month: ev.detail.value,
2260
+ });
2261
+ }
2262
+ ev.stopPropagation();
2263
+ } }, months.map((month) => (h("ion-picker-column-option", { color: this.color, part: month.value === workingParts.month ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: month.value, disabled: month.disabled, value: month.value }, month.text)))));
2264
+ }
2265
+ renderYearPickerColumn(years) {
2266
+ if (years.length === 0) {
2267
+ return [];
2268
+ }
2269
+ const { disabled, workingParts } = this;
2270
+ const activePart = this.getActivePartsWithFallback();
2271
+ return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
2272
+ this.setWorkingParts({
2273
+ ...workingParts,
2274
+ year: ev.detail.value,
2275
+ });
2276
+ // Year wheel is navigation-only in multi-select mode as a fix for https://github.com/ionic-team/ionic-framework/issues/29673
2277
+ if (!this.multiple) {
2278
+ this.setActiveParts({
2279
+ ...activePart,
2280
+ year: ev.detail.value,
2281
+ });
2282
+ }
2283
+ ev.stopPropagation();
2284
+ } }, years.map((year) => (h("ion-picker-column-option", { color: this.color, part: year.value === workingParts.year ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: year.value, disabled: year.disabled, value: year.value }, year.text)))));
2285
+ }
2286
+ renderTimePickerColumns(forcePresentation) {
2287
+ if (['date', 'month', 'month-year', 'year'].includes(forcePresentation)) {
2288
+ return [];
2289
+ }
2290
+ /**
2291
+ * If a user has not selected a date,
2292
+ * then we should show all times. If the
2293
+ * user has selected a date (even if it has
2294
+ * not been confirmed yet), we should apply
2295
+ * the max and min restrictions so that the
2296
+ * time picker shows values that are
2297
+ * appropriate for the selected date.
2298
+ */
2299
+ const activePart = this.getActivePart();
2300
+ const userHasSelectedDate = activePart !== undefined;
2301
+ const { hoursData, minutesData, dayPeriodData } = getTimeColumnsData(this.locale, this.workingParts, this.hourCycle, userHasSelectedDate ? this.minParts : undefined, userHasSelectedDate ? this.maxParts : undefined, this.parsedHourValues, this.parsedMinuteValues);
2302
+ return [
2303
+ this.renderHourPickerColumn(hoursData),
2304
+ this.renderMinutePickerColumn(minutesData),
2305
+ this.renderDayPeriodPickerColumn(dayPeriodData),
2306
+ ];
2307
+ }
2308
+ renderHourPickerColumn(hoursData) {
2309
+ const { disabled, workingParts } = this;
2310
+ if (hoursData.length === 0)
2311
+ return [];
2312
+ const activePart = this.getActivePartsWithFallback();
2313
+ return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
2314
+ this.setWorkingParts({
2315
+ ...workingParts,
2316
+ hour: ev.detail.value,
2317
+ });
2318
+ this.setActiveParts({
2319
+ ...this.getActivePartsWithFallback(),
2320
+ hour: ev.detail.value,
2321
+ });
2322
+ ev.stopPropagation();
2323
+ } }, hoursData.map((hour) => (h("ion-picker-column-option", { color: this.color, part: hour.value === activePart.hour ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: hour.value, disabled: hour.disabled, value: hour.value }, hour.text)))));
2324
+ }
2325
+ renderMinutePickerColumn(minutesData) {
2326
+ const { disabled, workingParts } = this;
2327
+ if (minutesData.length === 0)
2328
+ return [];
2329
+ const activePart = this.getActivePartsWithFallback();
2330
+ return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
2331
+ this.setWorkingParts({
2332
+ ...workingParts,
2333
+ minute: ev.detail.value,
2334
+ });
2335
+ this.setActiveParts({
2336
+ ...this.getActivePartsWithFallback(),
2337
+ minute: ev.detail.value,
2338
+ });
2339
+ ev.stopPropagation();
2340
+ } }, minutesData.map((minute) => (h("ion-picker-column-option", { color: this.color, part: minute.value === activePart.minute ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: minute.value, disabled: minute.disabled, value: minute.value }, minute.text)))));
2341
+ }
2342
+ renderDayPeriodPickerColumn(dayPeriodData) {
2343
+ const { disabled, workingParts } = this;
2344
+ if (dayPeriodData.length === 0) {
2345
+ return [];
2346
+ }
2347
+ const activePart = this.getActivePartsWithFallback();
2348
+ const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
2349
+ return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
2350
+ const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
2351
+ this.setWorkingParts({
2352
+ ...workingParts,
2353
+ ampm: ev.detail.value,
2354
+ hour,
2355
+ });
2356
+ this.setActiveParts({
2357
+ ...this.getActivePartsWithFallback(),
2358
+ ampm: ev.detail.value,
2359
+ hour,
2360
+ });
2361
+ ev.stopPropagation();
2362
+ } }, dayPeriodData.map((dayPeriod) => (h("ion-picker-column-option", { color: this.color, part: dayPeriod.value === activePart.ampm ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: dayPeriod.value, disabled: dayPeriod.disabled, value: dayPeriod.value }, dayPeriod.text)))));
2363
+ }
2364
+ renderWheelView(forcePresentation) {
2365
+ const { locale } = this;
2366
+ const showMonthFirst = isMonthFirstLocale(locale);
2367
+ const columnOrder = showMonthFirst ? 'month-first' : 'year-first';
2368
+ return (h("div", { class: {
2369
+ [`wheel-order-${columnOrder}`]: true,
2370
+ } }, this.renderWheelPicker(forcePresentation)));
2371
+ }
2372
+ /**
2373
+ * Grid Render Methods
2374
+ */
2375
+ renderCalendarHeader(mode) {
2376
+ const { disabled } = this;
2377
+ const expandedIcon = mode === 'ios' ? chevronDown : caretUpSharp;
2378
+ const collapsedIcon = mode === 'ios' ? chevronForward : caretDownSharp;
2379
+ const prevMonthDisabled = disabled || isPrevMonthDisabled(this.workingParts, this.minParts, this.maxParts);
2380
+ const nextMonthDisabled = disabled || isNextMonthDisabled(this.workingParts, this.maxParts);
2381
+ // don't use the inheritAttributes util because it removes dir from the host, and we still need that
2382
+ const hostDir = this.el.getAttribute('dir') || undefined;
2383
+ return (h("div", { class: "calendar-header", part: "calendar-header" }, h("div", { class: "calendar-action-buttons" }, h("div", { class: "calendar-month-year" }, h("button", { class: {
2384
+ 'calendar-month-year-toggle': true,
2385
+ 'ion-activatable': true,
2386
+ 'ion-focusable': true,
2387
+ }, part: "month-year-button", disabled: disabled, "aria-label": this.showMonthAndYear ? 'Hide year picker' : 'Show year picker', onClick: () => this.toggleMonthAndYearView() }, h("span", { id: "toggle-wrapper" }, getMonthAndYear(this.locale, this.workingParts), h("ion-icon", { "aria-hidden": "true", icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false, flipRtl: true })), mode === 'md' && h("ion-ripple-effect", null))), h("div", { class: "calendar-next-prev" }, h("ion-buttons", null, h("ion-button", { "aria-label": "Previous month", disabled: prevMonthDisabled, onClick: () => this.prevMonth(), part: "navigation-button previous-button" }, h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronBack, lazy: false, flipRtl: true })), h("ion-button", { "aria-label": "Next month", disabled: nextMonthDisabled, onClick: () => this.nextMonth(), part: "navigation-button next-button" }, h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronForward, lazy: false, flipRtl: true }))))), h("div", { class: "calendar-days-of-week", "aria-hidden": "true", part: "calendar-days-of-week" }, getDaysOfWeek(this.locale, mode, this.firstDayOfWeek % 7).map((d) => {
2388
+ return h("div", { class: "day-of-week" }, d);
2389
+ }))));
2390
+ }
2391
+ renderMonth(month, year) {
2392
+ const { disabled, readonly } = this;
2393
+ const yearAllowed = this.parsedYearValues === undefined || this.parsedYearValues.includes(year);
2394
+ const monthAllowed = this.parsedMonthValues === undefined || this.parsedMonthValues.includes(month);
2395
+ const isCalMonthDisabled = !yearAllowed || !monthAllowed;
2396
+ const isDatetimeDisabled = disabled || readonly;
2397
+ const swipeDisabled = disabled ||
2398
+ isMonthDisabled({
2399
+ month,
2400
+ year,
2401
+ day: null,
2402
+ }, {
2403
+ // The day is not used when checking if a month is disabled.
2404
+ // Users should be able to access the min or max month, even if the
2405
+ // min/max date is out of bounds (e.g. min is set to Feb 15, Feb should not be disabled).
2406
+ minParts: { ...this.minParts, day: null },
2407
+ maxParts: { ...this.maxParts, day: null },
2408
+ });
2409
+ // The working month should never have swipe disabled.
2410
+ // Otherwise the CSS scroll snap will not work and the user
2411
+ // can free-scroll the calendar.
2412
+ const isWorkingMonth = this.workingParts.month === month && this.workingParts.year === year;
2413
+ const activePart = this.getActivePartsWithFallback();
2414
+ return (h("div", { "aria-hidden": !isWorkingMonth ? 'true' : null, class: {
2415
+ 'calendar-month': true,
2416
+ // Prevents scroll snap swipe gestures for months outside of the min/max bounds
2417
+ 'calendar-month-disabled': !isWorkingMonth && swipeDisabled,
2418
+ } }, h("div", { class: "calendar-month-grid" }, getDaysOfMonth(month, year, this.firstDayOfWeek % 7, this.showAdjacentDays).map((dateObject, index) => {
2419
+ const { day, dayOfWeek, isAdjacentDay } = dateObject;
2420
+ const { el, highlightedDates, isDateEnabled, multiple, showAdjacentDays } = this;
2421
+ let _month = month;
2422
+ let _year = year;
2423
+ if (showAdjacentDays && isAdjacentDay && day !== null) {
2424
+ if (day > 20) {
2425
+ // Leading with the adjacent day from the previous month
2426
+ // if its a adjacent day and is higher than '20' (last week even in feb)
2427
+ if (month === 1) {
2428
+ _year = year - 1;
2429
+ _month = 12;
2430
+ }
2431
+ else {
2432
+ _month = month - 1;
2433
+ }
2434
+ }
2435
+ else if (day < 15) {
2436
+ // Leading with the adjacent day from the next month
2437
+ // if its a adjacent day and is lower than '15' (first two weeks)
2438
+ if (month === 12) {
2439
+ _year = year + 1;
2440
+ _month = 1;
2441
+ }
2442
+ else {
2443
+ _month = month + 1;
2444
+ }
2445
+ }
2446
+ }
2447
+ const referenceParts = { month: _month, day, year: _year, isAdjacentDay };
2448
+ const isCalendarPadding = day === null;
2449
+ const { isActive, isToday, ariaLabel, ariaSelected, disabled: isDayDisabled, text, } = getCalendarDayState(this.locale, referenceParts, this.activeParts, this.todayParts, this.minParts, this.maxParts, this.parsedDayValues);
2450
+ const dateIsoString = convertDataToISO(referenceParts);
2451
+ let isCalDayDisabled = isCalMonthDisabled || isDayDisabled;
2452
+ if (!isCalDayDisabled && isDateEnabled !== undefined) {
2453
+ try {
2454
+ /**
2455
+ * The `isDateEnabled` implementation is try-catch wrapped
2456
+ * to prevent exceptions in the user's function from
2457
+ * interrupting the calendar rendering.
2458
+ */
2459
+ isCalDayDisabled = !isDateEnabled(dateIsoString);
2460
+ }
2461
+ catch (e) {
2462
+ printIonError('[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', el, e);
2463
+ }
2464
+ }
2465
+ /**
2466
+ * Some days are constrained through max & min or allowed dates
2467
+ * and also disabled because the component is readonly or disabled.
2468
+ * These need to be displayed differently.
2469
+ */
2470
+ const isCalDayConstrained = isCalDayDisabled && isDatetimeDisabled;
2471
+ const isButtonDisabled = isCalDayDisabled || isDatetimeDisabled;
2472
+ let dateStyle = undefined;
2473
+ /**
2474
+ * Custom highlight styles should not override the style for selected dates,
2475
+ * nor apply to "filler days" at the start of the grid.
2476
+ */
2477
+ if (highlightedDates !== undefined && !isActive && day !== null && !isAdjacentDay) {
2478
+ dateStyle = getHighlightStyles(highlightedDates, dateIsoString, el);
2479
+ }
2480
+ let dateParts = undefined;
2481
+ // "Filler days" at the beginning of the grid should not get the calendar day
2482
+ // CSS parts added to them
2483
+ if (!isCalendarPadding && !isAdjacentDay) {
2484
+ dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}${isCalDayDisabled ? ' disabled' : ''}`;
2485
+ }
2486
+ else if (isAdjacentDay) {
2487
+ dateParts = `calendar-day${isCalDayDisabled ? ' disabled' : ''}`;
2488
+ }
2489
+ return (h("div", { class: "calendar-day-wrapper" }, h("button", {
2490
+ // We need to use !important for the inline styles here because
2491
+ // otherwise the CSS shadow parts will override these styles.
2492
+ // See https://github.com/WICG/webcomponents/issues/847
2493
+ // Both the CSS shadow parts and highlightedDates styles are
2494
+ // provided by the developer, but highlightedDates styles should
2495
+ // always take priority.
2496
+ ref: (el) => {
2497
+ if (el) {
2498
+ el.style.setProperty('color', `${dateStyle ? dateStyle.textColor : ''}`, 'important');
2499
+ el.style.setProperty('background-color', `${dateStyle ? dateStyle.backgroundColor : ''}`, 'important');
2500
+ el.style.setProperty('border', `${dateStyle ? dateStyle.border : ''}`, 'important');
2501
+ }
2502
+ }, tabindex: "-1", "data-day": day, "data-month": _month, "data-year": _year, "data-index": index, "data-day-of-week": dayOfWeek, disabled: isButtonDisabled, class: {
2503
+ 'calendar-day-padding': isCalendarPadding,
2504
+ 'calendar-day': true,
2505
+ 'calendar-day-active': isActive,
2506
+ 'calendar-day-constrained': isCalDayConstrained,
2507
+ 'calendar-day-today': isToday,
2508
+ 'calendar-day-adjacent-day': isAdjacentDay,
2509
+ }, part: dateParts, "aria-hidden": isCalendarPadding ? 'true' : null, "aria-selected": ariaSelected, "aria-label": ariaLabel, onClick: () => {
2510
+ if (isCalendarPadding) {
2511
+ return;
2512
+ }
2513
+ if (isAdjacentDay) {
2514
+ // The user selected a day outside the current month. Ignore this button, as the month will be re-rendered.
2515
+ this.el.blur();
2516
+ this.activeParts = { ...activePart, ...referenceParts };
2517
+ this.animateToDate(referenceParts);
2518
+ this.confirm();
2519
+ }
2520
+ else {
2521
+ this.setWorkingParts({
2522
+ ...this.workingParts,
2523
+ ...referenceParts,
2524
+ });
2525
+ // Multiple only needs date info so we can wipe out other fields like time.
2526
+ if (multiple) {
2527
+ this.setActiveParts(referenceParts, isActive);
2528
+ }
2529
+ else {
2530
+ this.setActiveParts({
2531
+ ...activePart,
2532
+ ...referenceParts,
2533
+ });
2534
+ }
2535
+ }
2536
+ }
2537
+ }, text)));
2538
+ }))));
2539
+ }
2540
+ renderCalendarBody() {
2541
+ return (h("div", { class: "calendar-body ion-focusable", ref: (el) => (this.calendarBodyRef = el), tabindex: "0" }, generateMonths(this.workingParts, this.forceRenderDate).map(({ month, year }) => {
2542
+ return this.renderMonth(month, year);
2543
+ })));
2544
+ }
2545
+ renderCalendar(mode) {
2546
+ return (h("div", { class: "datetime-calendar", key: "datetime-calendar" }, this.renderCalendarHeader(mode), this.renderCalendarBody()));
2547
+ }
2548
+ renderTimeLabel() {
2549
+ const hasSlottedTimeLabel = this.el.querySelector('[slot="time-label"]') !== null;
2550
+ if (!hasSlottedTimeLabel && !this.showDefaultTimeLabel) {
2551
+ return;
2552
+ }
2553
+ return h("slot", { name: "time-label" }, "Time");
2554
+ }
2555
+ renderTimeOverlay() {
2556
+ const { disabled, hourCycle, isTimePopoverOpen, locale, formatOptions } = this;
2557
+ const computedHourCycle = getHourCycle(locale, hourCycle);
2558
+ const activePart = this.getActivePartsWithFallback();
2559
+ return [
2560
+ h("div", { class: "time-header" }, this.renderTimeLabel()),
2561
+ h("button", { class: {
2562
+ 'time-body': true,
2563
+ 'time-body-active': isTimePopoverOpen,
2564
+ }, part: `time-button${isTimePopoverOpen ? ' active' : ''}`, "aria-expanded": "false", "aria-haspopup": "true", disabled: disabled, onClick: async (ev) => {
2565
+ const { popoverRef } = this;
2566
+ if (popoverRef) {
2567
+ this.isTimePopoverOpen = true;
2568
+ popoverRef.present(new CustomEvent('ionShadowTarget', {
2569
+ detail: {
2570
+ ionShadowTarget: ev.target,
2571
+ },
2572
+ }));
2573
+ await popoverRef.onWillDismiss();
2574
+ this.isTimePopoverOpen = false;
2575
+ }
2576
+ } }, getLocalizedTime(locale, activePart, computedHourCycle, formatOptions?.time)),
2577
+ h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
2578
+ /**
2579
+ * Intersection Observers do not consistently fire between Blink and Webkit
2580
+ * when toggling the visibility of the popover and trying to scroll the picker
2581
+ * column to the correct time value.
2582
+ *
2583
+ * This will correctly scroll the element position to the correct time value,
2584
+ * before the popover is fully presented.
2585
+ */
2586
+ const cols = ev.target.querySelectorAll('ion-picker-column');
2587
+ // TODO (FW-615): Potentially remove this when intersection observers are fixed in picker column
2588
+ cols.forEach((col) => col.scrollActiveItemIntoView());
2589
+ }, style: {
2590
+ '--offset-y': '-10px',
2591
+ '--min-width': 'fit-content',
2592
+ },
2593
+ // Allow native browser keyboard events to support up/down/home/end key
2594
+ // navigation within the time picker.
2595
+ keyboardEvents: true, ref: (el) => (this.popoverRef = el) }, this.renderWheelPicker('time')),
2596
+ ];
2597
+ }
2598
+ getHeaderSelectedDateText() {
2599
+ const { activeParts, formatOptions, multiple, titleSelectedDatesFormatter } = this;
2600
+ const isArray = Array.isArray(activeParts);
2601
+ let headerText;
2602
+ if (multiple && isArray && activeParts.length !== 1) {
2603
+ headerText = `${activeParts.length} days`; // default/fallback for multiple selection
2604
+ if (titleSelectedDatesFormatter !== undefined) {
2605
+ try {
2606
+ headerText = titleSelectedDatesFormatter(convertDataToISO(activeParts));
2607
+ }
2608
+ catch (e) {
2609
+ printIonError('[ion-datetime] - Exception in provided `titleSelectedDatesFormatter`:', e);
2610
+ }
2611
+ }
2612
+ }
2613
+ else {
2614
+ // for exactly 1 day selected (multiple set or not), show a formatted version of that
2615
+ headerText = getLocalizedDateTime(this.locale, this.getActivePartsWithFallback(), formatOptions?.date ?? { weekday: 'short', month: 'short', day: 'numeric' });
2616
+ }
2617
+ return headerText;
2618
+ }
2619
+ renderHeader(showExpandedHeader = true) {
2620
+ const hasSlottedTitle = this.el.querySelector('[slot="title"]') !== null;
2621
+ if (!hasSlottedTitle && !this.showDefaultTitle) {
2622
+ return;
2623
+ }
2624
+ return (h("div", { class: "datetime-header", part: "datetime-header" }, h("div", { class: "datetime-title", part: "datetime-title" }, h("slot", { name: "title" }, "Select Date")), showExpandedHeader && (h("div", { class: "datetime-selected-date", part: "datetime-selected-date" }, this.getHeaderSelectedDateText()))));
2625
+ }
2626
+ /**
2627
+ * Render time picker inside of datetime.
2628
+ * Do not pass color prop to segment on
2629
+ * iOS mode. MD segment has been customized and
2630
+ * should take on the color prop, but iOS
2631
+ * should just be the default segment.
2632
+ */
2633
+ renderTime() {
2634
+ const { presentation } = this;
2635
+ const timeOnlyPresentation = presentation === 'time';
2636
+ return (h("div", { class: "datetime-time" }, timeOnlyPresentation ? this.renderWheelPicker() : this.renderTimeOverlay()));
2637
+ }
2638
+ /**
2639
+ * Renders the month/year picker that is
2640
+ * displayed on the calendar grid.
2641
+ * The .datetime-year class has additional
2642
+ * styles that let us show/hide the
2643
+ * picker when the user clicks on the
2644
+ * toggle in the calendar header.
2645
+ */
2646
+ renderCalendarViewMonthYearPicker() {
2647
+ return h("div", { class: "datetime-year" }, this.renderWheelView('month-year'));
2648
+ }
2649
+ /**
2650
+ * Render entry point
2651
+ * All presentation types are rendered from here.
2652
+ */
2653
+ renderDatetime(mode) {
2654
+ const { presentation, preferWheel } = this;
2655
+ /**
2656
+ * Certain presentation types have separate grid and wheel displays.
2657
+ * If preferWheel is true then we should show a wheel picker instead.
2658
+ */
2659
+ const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
2660
+ if (preferWheel && hasWheelVariant) {
2661
+ return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
2662
+ }
2663
+ switch (presentation) {
2664
+ case 'date-time':
2665
+ return [
2666
+ this.renderHeader(),
2667
+ this.renderCalendar(mode),
2668
+ this.renderCalendarViewMonthYearPicker(),
2669
+ this.renderTime(),
2670
+ this.renderFooter(),
2671
+ ];
2672
+ case 'time-date':
2673
+ return [
2674
+ this.renderHeader(),
2675
+ this.renderTime(),
2676
+ this.renderCalendar(mode),
2677
+ this.renderCalendarViewMonthYearPicker(),
2678
+ this.renderFooter(),
2679
+ ];
2680
+ case 'time':
2681
+ return [this.renderHeader(false), this.renderTime(), this.renderFooter()];
2682
+ case 'month':
2683
+ case 'month-year':
2684
+ case 'year':
2685
+ return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
2686
+ default:
2687
+ return [
2688
+ this.renderHeader(),
2689
+ this.renderCalendar(mode),
2690
+ this.renderCalendarViewMonthYearPicker(),
2691
+ this.renderFooter(),
2692
+ ];
2693
+ }
2694
+ }
2695
+ render() {
2696
+ const { name, value, disabled, el, color, readonly, showMonthAndYear, preferWheel, presentation, size, isGridStyle, } = this;
2697
+ const mode = getIonMode(this);
2698
+ const isMonthAndYearPresentation = presentation === 'year' || presentation === 'month' || presentation === 'month-year';
2699
+ const shouldShowMonthAndYear = showMonthAndYear || isMonthAndYearPresentation;
2700
+ const monthYearPickerOpen = showMonthAndYear && !isMonthAndYearPresentation;
2701
+ const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
2702
+ const hasWheelVariant = hasDatePresentation && preferWheel;
2703
+ renderHiddenInput(true, el, name, formatValue(value), disabled);
2704
+ return (h(Host, { key: '79b906669d3e0d9ff356421a5f571d5cf12b6793', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: {
2705
+ ...createColorClasses(color, {
2706
+ [mode]: true,
2707
+ ['datetime-readonly']: readonly,
2708
+ ['datetime-disabled']: disabled,
2709
+ 'show-month-and-year': shouldShowMonthAndYear,
2710
+ 'month-year-picker-open': monthYearPickerOpen,
2711
+ [`datetime-presentation-${presentation}`]: true,
2712
+ [`datetime-size-${size}`]: true,
2713
+ [`datetime-prefer-wheel`]: hasWheelVariant,
2714
+ [`datetime-grid`]: isGridStyle,
2715
+ }),
2716
+ } }, h("div", { key: 'e29ce6edd79f3efb8f7cc4a81bb543d580e5f4c6', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
2717
+ }
2718
+ static get watchers() { return {
2719
+ "formatOptions": [{
2720
+ "formatOptionsChanged": 0
2721
+ }],
2722
+ "disabled": [{
2723
+ "disabledChanged": 0
2724
+ }],
2725
+ "min": [{
2726
+ "minChanged": 0
2727
+ }],
2728
+ "max": [{
2729
+ "maxChanged": 0
2730
+ }],
2731
+ "presentation": [{
2732
+ "presentationChanged": 0
2733
+ }],
2734
+ "yearValues": [{
2735
+ "yearValuesChanged": 0
2736
+ }],
2737
+ "monthValues": [{
2738
+ "monthValuesChanged": 0
2739
+ }],
2740
+ "dayValues": [{
2741
+ "dayValuesChanged": 0
2742
+ }],
2743
+ "hourValues": [{
2744
+ "hourValuesChanged": 0
2745
+ }],
2746
+ "minuteValues": [{
2747
+ "minuteValuesChanged": 0
2748
+ }],
2749
+ "value": [{
2750
+ "valueChanged": 0
2751
+ }]
2752
+ }; }
2753
+ };
2754
+ let datetimeIds = 0;
2755
+ const CANCEL_ROLE = 'datetime-cancel';
2756
+ const CONFIRM_ROLE = 'datetime-confirm';
2757
+ const WHEEL_PART = 'wheel';
2758
+ const WHEEL_ITEM_PART = 'wheel-item';
2759
+ const WHEEL_ITEM_ACTIVE_PART = `active`;
2760
+ Datetime.style = {
2761
+ ios: datetimeIosCss(),
2762
+ md: datetimeMdCss()
2763
+ };
2764
+
2765
+ export { Datetime as ion_datetime };