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