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