@ionic/core 8.8.19 → 8.8.20-dev.11787158518.168a2fea

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