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