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