@pod-os/elements 0.7.1-92705ee.0 → 0.7.1-a71f01c.0

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 (634) hide show
  1. package/dist/cjs/{animation-5840e4df.js → animation-9bea118f.js} +115 -84
  2. package/dist/cjs/{app-globals-1aedd05c.js → app-globals-6352043e.js} +1 -1
  3. package/dist/cjs/{cubic-bezier-dcb7bfef.js → cubic-bezier-0b702a31.js} +13 -12
  4. package/dist/cjs/data-0c9489d7.js +1510 -0
  5. package/dist/cjs/dir-011f46ea.js +20 -0
  6. package/dist/cjs/elements.cjs.js +5 -5
  7. package/dist/cjs/focus-visible-2624ec15.js +76 -0
  8. package/dist/cjs/framework-delegate-437c0645.js +119 -0
  9. package/dist/cjs/{gesture-controller-fbbe9a65.js → gesture-controller-00a6b02f.js} +6 -2
  10. package/dist/cjs/{haptic-09e73337.js → haptic-7358cb0b.js} +37 -8
  11. package/dist/cjs/{hardware-back-button-01027575.js → hardware-back-button-25372ec7.js} +11 -8
  12. package/dist/cjs/{helpers-398ced09.js → helpers-cb08f5ae.js} +115 -15
  13. package/dist/cjs/{index-2067b305.js → index-1b07c737.js} +35 -24
  14. package/dist/cjs/{index-68ae43d2.js → index-2dc3637c.js} +34 -28
  15. package/dist/cjs/index-57b9fa9e.js +30 -0
  16. package/dist/cjs/{index-d01d9183.js → index-643851c6.js} +34 -19
  17. package/dist/cjs/index-731691ca.js +48 -0
  18. package/dist/cjs/{index-6bbae9b1.js → index-7d56774d.js} +12 -8
  19. package/dist/cjs/index-9fca5d6f.js +140 -0
  20. package/dist/cjs/index-b2a479e4.js +38 -0
  21. package/dist/cjs/{index-b4a9ece2.js → index-eaa0d16e.js} +7 -0
  22. package/dist/cjs/{tap-click-f24cb477.js → index-ed2ce04f.js} +37 -19
  23. package/dist/cjs/{input-shims-e959d9e2.js → input-shims-427999f7.js} +89 -38
  24. package/dist/cjs/ion-accordion-group.cjs.entry.js +205 -0
  25. package/dist/cjs/ion-accordion.cjs.entry.js +336 -0
  26. package/dist/cjs/ion-action-sheet_3.cjs.entry.js +865 -0
  27. package/dist/cjs/{ion-app_45.cjs.entry.js → ion-app_46.cjs.entry.js} +1906 -1492
  28. package/dist/cjs/ion-avatar.cjs.entry.js +2 -2
  29. package/dist/cjs/ion-back-button.cjs.entry.js +12 -11
  30. package/dist/cjs/ion-backdrop.cjs.entry.js +4 -4
  31. package/dist/cjs/ion-breadcrumb.cjs.entry.js +101 -0
  32. package/dist/cjs/ion-breadcrumbs.cjs.entry.js +137 -0
  33. package/dist/cjs/ion-buttons_3.cjs.entry.js +799 -0
  34. package/dist/cjs/ion-card-subtitle.cjs.entry.js +4 -4
  35. package/dist/cjs/{ion-list-header_3.cjs.entry.js → ion-checkbox_4.cjs.entry.js} +124 -23
  36. package/dist/cjs/ion-chip.cjs.entry.js +5 -10
  37. package/dist/cjs/ion-datetime-button.cjs.entry.js +346 -0
  38. package/dist/cjs/ion-datetime.cjs.entry.js +1548 -856
  39. package/dist/cjs/ion-fab-button.cjs.entry.js +26 -9
  40. package/dist/cjs/ion-fab-list.cjs.entry.js +4 -4
  41. package/dist/cjs/ion-fab.cjs.entry.js +15 -13
  42. package/dist/cjs/ion-img.cjs.entry.js +28 -4
  43. package/dist/cjs/ion-infinite-scroll-content.cjs.entry.js +5 -5
  44. package/dist/cjs/ion-infinite-scroll.cjs.entry.js +13 -13
  45. package/dist/cjs/ion-input.cjs.entry.js +57 -23
  46. package/dist/cjs/ion-item-option.cjs.entry.js +8 -8
  47. package/dist/cjs/ion-item-options.cjs.entry.js +5 -5
  48. package/dist/cjs/ion-item-sliding.cjs.entry.js +59 -63
  49. package/dist/cjs/ion-loading.cjs.entry.js +38 -37
  50. package/dist/cjs/ion-menu-button.cjs.entry.js +14 -12
  51. package/dist/cjs/ion-menu-toggle.cjs.entry.js +8 -7
  52. package/dist/cjs/ion-menu.cjs.entry.js +71 -57
  53. package/dist/cjs/ion-modal.cjs.entry.js +1386 -156
  54. package/dist/cjs/ion-nav-link.cjs.entry.js +5 -2
  55. package/dist/cjs/ion-nav.cjs.entry.js +177 -171
  56. package/dist/cjs/ion-picker-column.cjs.entry.js +25 -27
  57. package/dist/cjs/ion-picker.cjs.entry.js +22 -17
  58. package/dist/cjs/ion-popover.cjs.entry.js +1208 -182
  59. package/dist/cjs/ion-range.cjs.entry.js +137 -57
  60. package/dist/cjs/ion-refresher-content.cjs.entry.js +7 -12
  61. package/dist/cjs/ion-refresher.cjs.entry.js +150 -148
  62. package/dist/cjs/ion-reorder-group.cjs.entry.js +42 -35
  63. package/dist/cjs/ion-reorder.cjs.entry.js +5 -4
  64. package/dist/cjs/ion-route-redirect.cjs.entry.js +1 -1
  65. package/dist/cjs/ion-route.cjs.entry.js +1 -1
  66. package/dist/cjs/ion-router-link.cjs.entry.js +5 -5
  67. package/dist/cjs/ion-router-outlet.cjs.entry.js +24 -20
  68. package/dist/cjs/ion-router.cjs.entry.js +291 -194
  69. package/dist/cjs/ion-segment-button.cjs.entry.js +10 -17
  70. package/dist/cjs/ion-segment.cjs.entry.js +127 -26
  71. package/dist/cjs/ion-select-option.cjs.entry.js +3 -3
  72. package/dist/cjs/ion-select.cjs.entry.js +113 -78
  73. package/dist/cjs/ion-slide.cjs.entry.js +3 -3
  74. package/dist/cjs/ion-slides.cjs.entry.js +26 -27
  75. package/dist/cjs/ion-spinner.cjs.entry.js +10 -9
  76. package/dist/cjs/ion-split-pane.cjs.entry.js +16 -12
  77. package/dist/cjs/ion-tab-bar.cjs.entry.js +16 -23
  78. package/dist/cjs/ion-tab-button.cjs.entry.js +6 -6
  79. package/dist/cjs/ion-tab.cjs.entry.js +4 -4
  80. package/dist/cjs/ion-tabs.cjs.entry.js +4 -5
  81. package/dist/cjs/ion-text.cjs.entry.js +3 -3
  82. package/dist/cjs/ion-textarea.cjs.entry.js +31 -29
  83. package/dist/cjs/ion-thumbnail.cjs.entry.js +2 -2
  84. package/dist/cjs/ion-toast.cjs.entry.js +50 -60
  85. package/dist/cjs/ion-toggle.cjs.entry.js +41 -22
  86. package/dist/cjs/ion-virtual-scroll.cjs.entry.js +39 -31
  87. package/dist/cjs/{ionic-global-56e10eb5.js → ionic-global-f2d95fd3.js} +112 -93
  88. package/dist/cjs/{ios.transition-32e4623d.js → ios.transition-0f31ec9a.js} +78 -53
  89. package/dist/cjs/{keyboard-9e8103e4.js → keyboard-79afcba2.js} +6 -3
  90. package/dist/cjs/keyboard-controller-a934d106.js +42 -0
  91. package/dist/cjs/loader.cjs.js +5 -5
  92. package/dist/cjs/{md.transition-169c54f0.js → md.transition-d2a33a23.js} +15 -17
  93. package/dist/cjs/{menu-toggle-util-087678e0.js → menu-toggle-util-0a43ff7c.js} +5 -2
  94. package/dist/cjs/{overlays-49fe9ba7.js → overlays-f7d24abf.js} +190 -72
  95. package/dist/cjs/spinner-configs-cd0abbeb.js +147 -0
  96. package/dist/cjs/{status-tap-ada894ff.js → status-tap-beaa3a71.js} +10 -5
  97. package/dist/cjs/{swipe-back-c4a778df.js → swipe-back-666ea8e6.js} +34 -15
  98. package/dist/cjs/{theme-2259d0f5.js → theme-fc63803b.js} +9 -5
  99. package/dist/collection/collection-manifest.json +10 -4
  100. package/dist/collection/components/pos-rich-link/pos-rich-link.js +1 -1
  101. package/dist/components/ResourceAware.js +5 -0
  102. package/dist/components/action-sheet.js +309 -0
  103. package/dist/{esm/ion-alert.entry.js → components/alert.js} +150 -105
  104. package/dist/{esm/animation-fe6ed422.js → components/animation.js} +115 -84
  105. package/dist/components/app.js +112 -0
  106. package/dist/components/backdrop.js +82 -0
  107. package/dist/components/badge.js +42 -0
  108. package/dist/{esm/button-active-fd9d6d91.js → components/button-active.js} +9 -6
  109. package/dist/components/button.js +207 -0
  110. package/dist/{esm/ion-buttons.entry.js → components/buttons.js} +28 -12
  111. package/dist/components/card-content.js +40 -0
  112. package/dist/components/card-header.js +51 -0
  113. package/dist/components/card-title.js +43 -0
  114. package/dist/components/card.js +102 -0
  115. package/dist/{esm/ion-checkbox.entry.js → components/checkbox.js} +42 -24
  116. package/dist/components/col.js +161 -0
  117. package/dist/components/content.js +356 -0
  118. package/dist/{esm/cubic-bezier-108b8579.js → components/cubic-bezier.js} +13 -12
  119. package/dist/components/data.js +1463 -0
  120. package/dist/components/dir.js +18 -0
  121. package/dist/components/focus-visible.js +74 -0
  122. package/dist/components/footer.js +149 -0
  123. package/dist/components/framework-delegate.js +115 -0
  124. package/dist/{esm/gesture-controller-8f35af24.js → components/gesture-controller.js} +6 -2
  125. package/dist/components/grid.js +41 -0
  126. package/dist/{esm/haptic-c424e670.js → components/haptic.js} +38 -9
  127. package/dist/{esm/hardware-back-button-bb4c578a.js → components/hardware-back-button.js} +11 -8
  128. package/dist/components/header.js +360 -0
  129. package/dist/{esm/helpers-44e3bd9f.js → components/helpers.js} +113 -16
  130. package/dist/components/icon.js +367 -0
  131. package/dist/components/index.d.ts +41 -0
  132. package/dist/components/index.js +123 -0
  133. package/dist/components/index10.js +28 -0
  134. package/dist/{esm/tap-click-a7e55ef5.js → components/index11.js} +37 -19
  135. package/dist/components/index2.js +25 -0
  136. package/dist/{esm/index-8d682224.js → components/index3.js} +12 -8
  137. package/dist/components/index4.js +34 -0
  138. package/dist/components/index5.js +128 -0
  139. package/dist/{esm/index-97199683.js → components/index6.js} +34 -28
  140. package/dist/{esm/index-8a463a85.js → components/index7.js} +35 -24
  141. package/dist/{custom-elements/index.js → components/index8.js} +1049 -20945
  142. package/dist/{esm/index-3a1bd803.js → components/index9.js} +35 -20
  143. package/dist/{custom-elements → components}/input-shims.js +88 -38
  144. package/dist/components/ion-accordion-group.js +228 -0
  145. package/dist/components/ion-accordion.js +365 -0
  146. package/dist/components/ion-action-sheet.js +6 -0
  147. package/dist/components/ion-alert.js +6 -0
  148. package/dist/components/ion-app.js +6 -0
  149. package/dist/components/ion-avatar.js +39 -0
  150. package/dist/components/ion-back-button.js +128 -0
  151. package/dist/components/ion-backdrop.js +6 -0
  152. package/dist/components/ion-badge.js +6 -0
  153. package/dist/components/ion-breadcrumb.js +135 -0
  154. package/dist/components/ion-breadcrumbs.js +158 -0
  155. package/dist/components/ion-button.js +6 -0
  156. package/dist/components/ion-buttons.js +6 -0
  157. package/dist/components/ion-card-content.js +6 -0
  158. package/dist/components/ion-card-header.js +6 -0
  159. package/dist/components/ion-card-subtitle.js +46 -0
  160. package/dist/components/ion-card-title.js +6 -0
  161. package/dist/components/ion-card.js +6 -0
  162. package/dist/components/ion-checkbox.js +6 -0
  163. package/dist/components/ion-chip.js +59 -0
  164. package/dist/components/ion-col.js +6 -0
  165. package/dist/components/ion-content.js +6 -0
  166. package/dist/components/ion-datetime-button.js +375 -0
  167. package/dist/components/ion-datetime.js +1802 -0
  168. package/dist/components/ion-fab-button.js +149 -0
  169. package/dist/components/ion-fab-list.js +62 -0
  170. package/dist/components/ion-fab.js +97 -0
  171. package/dist/components/ion-footer.js +6 -0
  172. package/dist/components/ion-grid.js +6 -0
  173. package/dist/components/ion-header.js +6 -0
  174. package/dist/components/ion-icon.js +6 -0
  175. package/dist/components/ion-img.js +120 -0
  176. package/dist/components/ion-infinite-scroll-content.js +59 -0
  177. package/dist/components/ion-infinite-scroll.js +223 -0
  178. package/dist/components/ion-input.js +352 -0
  179. package/dist/components/ion-item-divider.js +6 -0
  180. package/dist/components/ion-item-group.js +6 -0
  181. package/dist/components/ion-item-option.js +89 -0
  182. package/dist/components/ion-item-options.js +63 -0
  183. package/dist/components/ion-item-sliding.js +419 -0
  184. package/dist/components/ion-item.js +6 -0
  185. package/dist/components/ion-label.js +6 -0
  186. package/dist/components/ion-list-header.js +6 -0
  187. package/dist/components/ion-list.js +6 -0
  188. package/dist/components/ion-loading.js +256 -0
  189. package/dist/components/ion-menu-button.js +107 -0
  190. package/dist/components/ion-menu-toggle.js +62 -0
  191. package/dist/components/ion-menu.js +611 -0
  192. package/dist/components/ion-modal.js +1765 -0
  193. package/dist/components/ion-nav-link.js +65 -0
  194. package/dist/components/ion-nav.js +905 -0
  195. package/dist/components/ion-note.js +6 -0
  196. package/dist/components/ion-picker-column-internal.js +6 -0
  197. package/dist/components/ion-picker-column.js +6 -0
  198. package/dist/components/ion-picker-internal.js +6 -0
  199. package/dist/components/ion-picker.js +263 -0
  200. package/dist/components/ion-popover.js +6 -0
  201. package/dist/components/ion-progress-bar.js +6 -0
  202. package/dist/components/ion-radio-group.js +6 -0
  203. package/dist/components/ion-radio.js +6 -0
  204. package/dist/components/ion-range.js +550 -0
  205. package/dist/components/ion-refresher-content.js +64 -0
  206. package/dist/components/ion-refresher.js +826 -0
  207. package/dist/components/ion-reorder-group.js +303 -0
  208. package/dist/components/ion-reorder.js +58 -0
  209. package/dist/components/ion-ripple-effect.js +6 -0
  210. package/dist/components/ion-route-redirect.js +40 -0
  211. package/dist/components/ion-route.js +68 -0
  212. package/dist/components/ion-router-link.js +59 -0
  213. package/dist/components/ion-router-outlet.js +223 -0
  214. package/dist/components/ion-router.js +852 -0
  215. package/dist/components/ion-row.js +6 -0
  216. package/dist/components/ion-searchbar.js +6 -0
  217. package/dist/components/ion-segment-button.js +128 -0
  218. package/dist/components/ion-segment.js +463 -0
  219. package/dist/components/ion-select-option.js +44 -0
  220. package/dist/components/ion-select-popover.js +6 -0
  221. package/dist/components/ion-select.js +596 -0
  222. package/dist/components/ion-skeleton-text.js +6 -0
  223. package/dist/components/ion-slide.js +38 -0
  224. package/dist/components/ion-slides.js +423 -0
  225. package/dist/components/ion-spinner.js +6 -0
  226. package/dist/components/ion-split-pane.js +179 -0
  227. package/dist/components/ion-tab-bar.js +86 -0
  228. package/dist/components/ion-tab-button.js +132 -0
  229. package/dist/components/ion-tab.js +86 -0
  230. package/dist/components/ion-tabs.js +176 -0
  231. package/dist/components/ion-text.js +40 -0
  232. package/dist/components/ion-textarea.js +287 -0
  233. package/dist/components/ion-thumbnail.js +34 -0
  234. package/dist/components/ion-title.js +6 -0
  235. package/dist/components/ion-toast.js +317 -0
  236. package/dist/components/ion-toggle.js +207 -0
  237. package/dist/components/ion-toolbar.js +6 -0
  238. package/dist/components/ion-virtual-scroll.js +588 -0
  239. package/dist/components/ionic-global.js +226 -0
  240. package/dist/{custom-elements → components}/ios.transition.js +75 -50
  241. package/dist/components/item-divider.js +54 -0
  242. package/dist/components/item-group.js +41 -0
  243. package/dist/components/item.js +323 -0
  244. package/dist/components/keyboard-controller.js +40 -0
  245. package/dist/{custom-elements → components}/keyboard.js +6 -3
  246. package/dist/components/label.js +95 -0
  247. package/dist/components/list-header.js +45 -0
  248. package/dist/components/list.js +66 -0
  249. package/dist/{custom-elements → components}/md.transition.js +12 -14
  250. package/dist/{esm/menu-toggle-util-562dfc9c.js → components/menu-toggle-util.js} +5 -2
  251. package/dist/components/note.js +42 -0
  252. package/dist/{esm/overlays-fc9a0625.js → components/overlays.js} +188 -72
  253. package/dist/components/picker-column-internal.js +315 -0
  254. package/dist/components/picker-column.js +343 -0
  255. package/dist/components/picker-internal.js +486 -0
  256. package/dist/components/popover.js +1440 -0
  257. package/dist/components/pos-app-browser.d.ts +11 -0
  258. package/dist/components/pos-app-browser.js +299 -0
  259. package/dist/components/pos-app-generic.d.ts +11 -0
  260. package/dist/components/pos-app-generic.js +6 -0
  261. package/dist/components/pos-app-generic2.js +194 -0
  262. package/dist/components/pos-app-image-viewer.d.ts +11 -0
  263. package/dist/components/pos-app-image-viewer.js +6 -0
  264. package/dist/components/pos-app-image-viewer2.js +162 -0
  265. package/dist/components/pos-app-rdf-document.d.ts +11 -0
  266. package/dist/components/pos-app-rdf-document.js +6 -0
  267. package/dist/components/pos-app-rdf-document2.js +170 -0
  268. package/dist/components/pos-app.d.ts +11 -0
  269. package/dist/components/pos-app.js +6 -0
  270. package/dist/components/pos-app2.js +53 -0
  271. package/dist/components/pos-description.d.ts +11 -0
  272. package/dist/components/pos-description.js +6 -0
  273. package/dist/components/pos-description2.js +38 -0
  274. package/dist/components/pos-image.d.ts +11 -0
  275. package/dist/components/pos-image.js +6 -0
  276. package/dist/components/pos-image2.js +117 -0
  277. package/dist/components/pos-label.d.ts +11 -0
  278. package/dist/components/pos-label.js +6 -0
  279. package/dist/components/pos-label2.js +38 -0
  280. package/dist/components/pos-literals.d.ts +11 -0
  281. package/dist/components/pos-literals.js +6 -0
  282. package/dist/components/pos-literals2.js +87 -0
  283. package/dist/components/pos-login.d.ts +11 -0
  284. package/dist/components/pos-login.js +6 -0
  285. package/dist/components/pos-login2.js +120 -0
  286. package/dist/components/pos-navigation-bar.d.ts +11 -0
  287. package/dist/components/pos-navigation-bar.js +6 -0
  288. package/dist/components/pos-navigation-bar2.js +52 -0
  289. package/dist/components/pos-picture.d.ts +11 -0
  290. package/dist/components/pos-picture.js +6 -0
  291. package/dist/components/pos-picture2.js +62 -0
  292. package/dist/components/pos-relations.d.ts +11 -0
  293. package/dist/components/pos-relations.js +6 -0
  294. package/dist/components/pos-relations2.js +135 -0
  295. package/dist/components/pos-resource.d.ts +11 -0
  296. package/dist/components/pos-resource.js +6 -0
  297. package/dist/components/pos-resource2.js +126 -0
  298. package/dist/components/pos-reverse-relations.d.ts +11 -0
  299. package/dist/components/pos-reverse-relations.js +6 -0
  300. package/dist/components/pos-reverse-relations2.js +135 -0
  301. package/dist/components/pos-rich-link.d.ts +11 -0
  302. package/dist/components/pos-rich-link.js +6 -0
  303. package/dist/components/pos-rich-link2.js +106 -0
  304. package/dist/components/pos-router.d.ts +11 -0
  305. package/dist/components/pos-router.js +6 -0
  306. package/dist/components/pos-router2.js +813 -0
  307. package/dist/components/pos-subjects.d.ts +11 -0
  308. package/dist/components/pos-subjects.js +6 -0
  309. package/dist/components/pos-subjects2.js +125 -0
  310. package/dist/components/pos-type-badges.d.ts +11 -0
  311. package/dist/components/pos-type-badges.js +6 -0
  312. package/dist/components/pos-type-badges2.js +69 -0
  313. package/dist/components/pos-type-router.d.ts +11 -0
  314. package/dist/components/pos-type-router.js +6 -0
  315. package/dist/components/pos-type-router2.js +241 -0
  316. package/dist/components/progress-bar.js +91 -0
  317. package/dist/components/radio-group.js +139 -0
  318. package/dist/components/radio.js +135 -0
  319. package/dist/components/ripple-effect.js +107 -0
  320. package/dist/components/row.js +31 -0
  321. package/dist/components/searchbar.js +412 -0
  322. package/dist/components/select-popover.js +174 -0
  323. package/dist/components/session.js +202 -0
  324. package/dist/components/skeleton-text.js +46 -0
  325. package/dist/components/spinner.js +224 -0
  326. package/dist/{custom-elements → components}/status-tap.js +8 -4
  327. package/dist/{custom-elements → components}/swipe-back.js +33 -13
  328. package/dist/{custom-elements → components}/swiper.bundle.js +0 -0
  329. package/dist/{esm/theme-d21826a7.js → components/theme.js} +9 -5
  330. package/dist/components/title.js +66 -0
  331. package/dist/components/toolbar.js +87 -0
  332. package/dist/elements/elements.css +1 -1
  333. package/dist/elements/elements.esm.js +1 -1
  334. package/dist/elements/p-00f19b1d.js +4 -0
  335. package/dist/elements/p-0587332d.entry.js +1 -0
  336. package/dist/elements/p-07f54139.entry.js +7 -0
  337. package/dist/elements/{p-cfc0e54d.js → p-0991c811.js} +3 -0
  338. package/dist/elements/p-0a69a563.entry.js +1 -0
  339. package/dist/elements/p-0d284fe0.entry.js +1 -0
  340. package/dist/elements/p-116437b0.entry.js +13 -0
  341. package/dist/elements/p-12880671.entry.js +1 -0
  342. package/dist/elements/p-14ccd586.entry.js +1 -0
  343. package/dist/elements/{p-83d45051.entry.js → p-14df6ac0.entry.js} +1 -1
  344. package/dist/elements/{p-e860be6a.entry.js → p-17079f06.entry.js} +1 -1
  345. package/dist/elements/p-19e4a688.js +4 -0
  346. package/dist/elements/p-1afc4eb4.js +4 -0
  347. package/dist/elements/p-1beaf6bf.js +4 -0
  348. package/dist/elements/p-1d1c6a6f.entry.js +1 -0
  349. package/dist/elements/{p-31d30e42.entry.js → p-1d98f84b.entry.js} +1 -1
  350. package/dist/elements/p-1e617706.entry.js +7 -0
  351. package/dist/elements/p-278ca4c9.js +4 -0
  352. package/dist/elements/p-27f5629c.entry.js +1 -0
  353. package/dist/elements/p-29c0f03f.js +4 -0
  354. package/dist/elements/p-2a629468.entry.js +4 -0
  355. package/dist/elements/p-2da59aca.js +4 -0
  356. package/dist/elements/p-3152143f.js +4 -0
  357. package/dist/elements/p-343ff720.entry.js +7 -0
  358. package/dist/elements/p-36d4c9a8.js +4 -0
  359. package/dist/elements/p-3a30dfb2.entry.js +1 -0
  360. package/dist/elements/p-3c013bf1.entry.js +1 -0
  361. package/dist/elements/{p-74ba1e42.entry.js → p-3c318da5.entry.js} +1 -1
  362. package/dist/elements/p-3cee3222.entry.js +1 -0
  363. package/dist/elements/p-3d0f59af.entry.js +7 -0
  364. package/dist/elements/p-41cb5688.entry.js +1 -0
  365. package/dist/elements/p-480b3c4f.entry.js +1 -0
  366. package/dist/elements/p-4e9d8f18.entry.js +1 -0
  367. package/dist/elements/p-53e23176.js +2 -0
  368. package/dist/elements/p-548524f3.js +4 -0
  369. package/dist/elements/p-5739fa41.entry.js +1 -0
  370. package/dist/elements/p-5808c505.js +1 -0
  371. package/dist/elements/p-58a8cc2a.js +4 -0
  372. package/dist/elements/p-6035415e.entry.js +1 -0
  373. package/dist/elements/p-60eeae90.js +4 -0
  374. package/dist/elements/p-667550a9.entry.js +14 -0
  375. package/dist/elements/p-67777478.entry.js +1 -0
  376. package/dist/elements/p-6ab826e1.entry.js +1 -0
  377. package/dist/elements/p-6f5a2827.entry.js +1 -0
  378. package/dist/elements/p-7916ecc5.entry.js +1 -0
  379. package/dist/elements/p-79f06b80.entry.js +1 -0
  380. package/dist/elements/p-7d0def79.js +5 -0
  381. package/dist/elements/p-8112afea.js +4 -0
  382. package/dist/elements/p-83678d7d.entry.js +4 -0
  383. package/dist/elements/p-87e45c94.entry.js +1 -0
  384. package/dist/elements/p-8f80768f.entry.js +4 -0
  385. package/dist/elements/p-8fe0433b.js +4 -0
  386. package/dist/elements/{p-4cb27b48.entry.js → p-9147d82b.entry.js} +1 -1
  387. package/dist/elements/p-96aeb07a.entry.js +1 -0
  388. package/dist/elements/p-97abb434.entry.js +1 -0
  389. package/dist/elements/p-98497a4b.entry.js +1 -0
  390. package/dist/elements/p-9c719139.js +4 -0
  391. package/dist/elements/p-9ca37332.js +4 -0
  392. package/dist/elements/{p-37de7110.js → p-9d48def2.js} +3 -0
  393. package/dist/elements/p-a805f2f9.entry.js +1 -0
  394. package/dist/elements/p-a86a5bfa.entry.js +1 -0
  395. package/dist/elements/{p-9c1dbe52.entry.js → p-ac34eab7.entry.js} +1 -1
  396. package/dist/elements/p-ad366eab.entry.js +4 -0
  397. package/dist/elements/p-aef3a931.js +7 -0
  398. package/dist/elements/p-b0537eb3.entry.js +1 -0
  399. package/dist/elements/p-b41e66f0.entry.js +1 -0
  400. package/dist/elements/p-b47e7091.entry.js +1 -0
  401. package/dist/elements/p-b840320e.js +4 -0
  402. package/dist/elements/p-b934ac5d.entry.js +1 -0
  403. package/dist/elements/p-bc63f4b6.entry.js +1 -0
  404. package/dist/elements/p-bd12806f.entry.js +1 -0
  405. package/dist/elements/p-bf90022d.entry.js +4 -0
  406. package/dist/elements/p-c16d38d5.js +4 -0
  407. package/dist/elements/p-c84205a3.js +4 -0
  408. package/dist/elements/{p-06675ac7.entry.js → p-cbe318f8.entry.js} +1 -1
  409. package/dist/elements/p-cfed7395.js +4 -0
  410. package/dist/elements/p-d3e75c94.entry.js +1 -0
  411. package/dist/elements/p-d8e7ebf4.entry.js +7 -0
  412. package/dist/elements/p-d9880221.entry.js +4 -0
  413. package/dist/elements/p-da5db8fb.entry.js +1 -0
  414. package/dist/elements/{p-91fe653f.js → p-dcc6b03c.js} +3 -0
  415. package/dist/elements/{p-305e246c.entry.js → p-dd846020.entry.js} +1 -1
  416. package/dist/elements/p-dffd8689.js +4 -0
  417. package/dist/elements/p-e3bcb6e8.entry.js +1 -0
  418. package/dist/elements/p-e495a095.js +4 -0
  419. package/dist/elements/p-e59d9789.entry.js +1 -0
  420. package/dist/elements/p-e5fc7d42.entry.js +1 -0
  421. package/dist/elements/{p-aaa8393e.entry.js → p-eb137e9d.entry.js} +1 -1
  422. package/dist/elements/p-f4e54a17.js +7 -0
  423. package/dist/elements/p-f67d0717.entry.js +1 -0
  424. package/dist/elements/p-f7f4c640.js +1 -0
  425. package/dist/elements/p-f851b91a.js +4 -0
  426. package/dist/elements/p-fb27ee76.entry.js +1 -0
  427. package/dist/elements/p-fbddca35.entry.js +1 -0
  428. package/dist/elements/p-fdac5f3a.js +4 -0
  429. package/dist/elements/p-feb0cea8.entry.js +4 -0
  430. package/dist/esm/animation-801a007a.js +986 -0
  431. package/dist/esm/{app-globals-27d92837.js → app-globals-05a3abfb.js} +1 -1
  432. package/dist/esm/cubic-bezier-538b6253.js +90 -0
  433. package/dist/esm/data-62c81c24.js +1463 -0
  434. package/dist/esm/dir-defb16c6.js +18 -0
  435. package/dist/esm/elements.js +5 -5
  436. package/dist/esm/focus-visible-78d55799.js +74 -0
  437. package/dist/esm/framework-delegate-7e2b767b.js +115 -0
  438. package/dist/esm/gesture-controller-c466ff14.js +195 -0
  439. package/dist/esm/haptic-e7d5ef4d.js +135 -0
  440. package/dist/esm/hardware-back-button-242191a7.js +71 -0
  441. package/dist/esm/helpers-aeff219b.js +410 -0
  442. package/dist/esm/index-0dbaca1a.js +28 -0
  443. package/dist/esm/index-1f3d8582.js +34 -0
  444. package/dist/esm/index-2be9a18b.js +312 -0
  445. package/dist/esm/index-51e4a829.js +137 -0
  446. package/dist/esm/index-6048aed6.js +224 -0
  447. package/dist/esm/index-65ecd543.js +25 -0
  448. package/dist/{custom-elements/tap-click.js → esm/index-b212db1c.js} +37 -19
  449. package/dist/esm/{index-e4deec27.js → index-cb938ffb.js} +7 -1
  450. package/dist/esm/index-d39eb62b.js +463 -0
  451. package/dist/esm/index-ebf7f059.js +128 -0
  452. package/dist/esm/{input-shims-3b48722f.js → input-shims-8a389148.js} +89 -38
  453. package/dist/esm/ion-accordion-group.entry.js +201 -0
  454. package/dist/esm/ion-accordion.entry.js +332 -0
  455. package/dist/esm/ion-action-sheet_3.entry.js +859 -0
  456. package/dist/esm/{ion-app_45.entry.js → ion-app_46.entry.js} +1906 -1493
  457. package/dist/esm/ion-avatar.entry.js +2 -2
  458. package/dist/esm/ion-back-button.entry.js +12 -11
  459. package/dist/esm/ion-backdrop.entry.js +4 -4
  460. package/dist/esm/ion-breadcrumb.entry.js +97 -0
  461. package/dist/esm/ion-breadcrumbs.entry.js +133 -0
  462. package/dist/esm/ion-buttons_3.entry.js +793 -0
  463. package/dist/esm/ion-card-subtitle.entry.js +4 -4
  464. package/dist/esm/{ion-list-header_3.entry.js → ion-checkbox_4.entry.js} +124 -24
  465. package/dist/esm/ion-chip.entry.js +5 -10
  466. package/dist/esm/ion-datetime-button.entry.js +342 -0
  467. package/dist/esm/ion-datetime.entry.js +1548 -856
  468. package/dist/esm/ion-fab-button.entry.js +26 -9
  469. package/dist/esm/ion-fab-list.entry.js +4 -4
  470. package/dist/esm/ion-fab.entry.js +15 -13
  471. package/dist/esm/ion-img.entry.js +28 -4
  472. package/dist/esm/ion-infinite-scroll-content.entry.js +5 -5
  473. package/dist/esm/ion-infinite-scroll.entry.js +13 -13
  474. package/dist/esm/ion-input.entry.js +57 -23
  475. package/dist/esm/ion-item-option.entry.js +8 -8
  476. package/dist/esm/ion-item-options.entry.js +5 -5
  477. package/dist/esm/ion-item-sliding.entry.js +59 -63
  478. package/dist/esm/ion-loading.entry.js +38 -37
  479. package/dist/esm/ion-menu-button.entry.js +14 -12
  480. package/dist/esm/ion-menu-toggle.entry.js +8 -7
  481. package/dist/esm/ion-menu.entry.js +71 -57
  482. package/dist/esm/ion-modal.entry.js +1377 -147
  483. package/dist/esm/ion-nav-link.entry.js +5 -2
  484. package/dist/esm/ion-nav.entry.js +177 -171
  485. package/dist/esm/ion-picker-column.entry.js +25 -27
  486. package/dist/esm/ion-picker.entry.js +22 -17
  487. package/dist/esm/ion-popover.entry.js +1208 -182
  488. package/dist/esm/ion-range.entry.js +137 -57
  489. package/dist/esm/ion-refresher-content.entry.js +7 -12
  490. package/dist/esm/ion-refresher.entry.js +149 -147
  491. package/dist/esm/ion-reorder-group.entry.js +42 -35
  492. package/dist/esm/ion-reorder.entry.js +5 -4
  493. package/dist/esm/ion-route-redirect.entry.js +1 -1
  494. package/dist/esm/ion-route.entry.js +1 -1
  495. package/dist/esm/ion-router-link.entry.js +5 -5
  496. package/dist/esm/ion-router-outlet.entry.js +24 -20
  497. package/dist/esm/ion-router.entry.js +291 -194
  498. package/dist/esm/ion-segment-button.entry.js +10 -17
  499. package/dist/esm/ion-segment.entry.js +127 -26
  500. package/dist/esm/ion-select-option.entry.js +3 -3
  501. package/dist/esm/ion-select.entry.js +113 -78
  502. package/dist/esm/ion-slide.entry.js +3 -3
  503. package/dist/esm/ion-slides.entry.js +26 -27
  504. package/dist/esm/ion-spinner.entry.js +10 -9
  505. package/dist/esm/ion-split-pane.entry.js +16 -12
  506. package/dist/esm/ion-tab-bar.entry.js +16 -23
  507. package/dist/esm/ion-tab-button.entry.js +6 -6
  508. package/dist/esm/ion-tab.entry.js +4 -4
  509. package/dist/esm/ion-tabs.entry.js +4 -5
  510. package/dist/esm/ion-text.entry.js +3 -3
  511. package/dist/esm/ion-textarea.entry.js +31 -29
  512. package/dist/esm/ion-thumbnail.entry.js +2 -2
  513. package/dist/esm/ion-toast.entry.js +50 -60
  514. package/dist/esm/ion-toggle.entry.js +41 -22
  515. package/dist/esm/ion-virtual-scroll.entry.js +39 -31
  516. package/dist/esm/{ionic-global-2e28f7c7.js → ionic-global-6cd57191.js} +112 -93
  517. package/dist/esm/{ios.transition-a783e3cd.js → ios.transition-bbd952f2.js} +78 -53
  518. package/dist/esm/{keyboard-e6abcb80.js → keyboard-413afe04.js} +6 -3
  519. package/dist/esm/keyboard-controller-33693bc2.js +40 -0
  520. package/dist/esm/loader.js +5 -5
  521. package/dist/esm/{md.transition-5a4a8c82.js → md.transition-5170a6d3.js} +15 -17
  522. package/dist/esm/menu-toggle-util-82bf888a.js +12 -0
  523. package/dist/esm/overlays-bd4abb68.js +502 -0
  524. package/dist/esm/spinner-configs-cbcd1f62.js +145 -0
  525. package/dist/esm/{status-tap-69e62ad6.js → status-tap-ad757b8a.js} +10 -5
  526. package/dist/esm/swipe-back-7ef22876.js +69 -0
  527. package/dist/esm/theme-7cf2cab0.js +43 -0
  528. package/dist/types/components.d.ts +0 -13
  529. package/package.json +7 -8
  530. package/dist/cjs/button-active-c14dab31.js +0 -66
  531. package/dist/cjs/focus-visible-16c98640.js +0 -45
  532. package/dist/cjs/framework-delegate-c45292a3.js +0 -37
  533. package/dist/cjs/ion-action-sheet.cjs.entry.js +0 -265
  534. package/dist/cjs/ion-alert.cjs.entry.js +0 -456
  535. package/dist/cjs/ion-buttons.cjs.entry.js +0 -42
  536. package/dist/cjs/ion-checkbox.cjs.entry.js +0 -117
  537. package/dist/cjs/ion-note.cjs.entry.js +0 -29
  538. package/dist/cjs/ion-select-popover.cjs.entry.js +0 -35
  539. package/dist/cjs/spinner-configs-fb16b986.js +0 -112
  540. package/dist/cjs/test-component.cjs.entry.js +0 -13
  541. package/dist/collection/test/TestComponent.js +0 -3
  542. package/dist/collection/test/mockPodOS.js +0 -35
  543. package/dist/collection/test/renderFunctionalComponent.js +0 -8
  544. package/dist/custom-elements/focus-visible.js +0 -43
  545. package/dist/custom-elements/index.d.ts +0 -165
  546. package/dist/elements/p-03bda390.js +0 -1
  547. package/dist/elements/p-0be044f1.entry.js +0 -1
  548. package/dist/elements/p-119c7c6c.entry.js +0 -1
  549. package/dist/elements/p-14c7c3ea.entry.js +0 -1
  550. package/dist/elements/p-1d4a2c61.js +0 -1
  551. package/dist/elements/p-1d894ac4.entry.js +0 -1
  552. package/dist/elements/p-1dafa1ce.entry.js +0 -1
  553. package/dist/elements/p-23b89ccb.entry.js +0 -1
  554. package/dist/elements/p-2c03b9ab.entry.js +0 -1
  555. package/dist/elements/p-346985f2.js +0 -1
  556. package/dist/elements/p-360f1c62.entry.js +0 -1
  557. package/dist/elements/p-373e1f25.entry.js +0 -1
  558. package/dist/elements/p-40547acb.entry.js +0 -1
  559. package/dist/elements/p-40b68014.entry.js +0 -1
  560. package/dist/elements/p-42e4f702.entry.js +0 -1
  561. package/dist/elements/p-489807e5.js +0 -1
  562. package/dist/elements/p-4ad72d54.entry.js +0 -1
  563. package/dist/elements/p-4cca7b5e.entry.js +0 -1
  564. package/dist/elements/p-4f24d306.js +0 -1
  565. package/dist/elements/p-519d6a53.entry.js +0 -1
  566. package/dist/elements/p-536e8e52.entry.js +0 -1
  567. package/dist/elements/p-599bb53f.entry.js +0 -1
  568. package/dist/elements/p-5eb7a546.js +0 -1
  569. package/dist/elements/p-60df2bed.entry.js +0 -1
  570. package/dist/elements/p-65133e33.js +0 -1
  571. package/dist/elements/p-6693fce8.js +0 -1
  572. package/dist/elements/p-689bdcc1.entry.js +0 -1
  573. package/dist/elements/p-70713b3d.entry.js +0 -1
  574. package/dist/elements/p-707d5d76.js +0 -1
  575. package/dist/elements/p-7212b7f2.js +0 -1
  576. package/dist/elements/p-73992898.entry.js +0 -1
  577. package/dist/elements/p-792c1e0f.entry.js +0 -1
  578. package/dist/elements/p-7e5300af.js +0 -2
  579. package/dist/elements/p-8068987c.entry.js +0 -1
  580. package/dist/elements/p-83accf46.entry.js +0 -1
  581. package/dist/elements/p-86635d06.entry.js +0 -1
  582. package/dist/elements/p-874c2b44.js +0 -1
  583. package/dist/elements/p-89c12ce8.entry.js +0 -1
  584. package/dist/elements/p-8bcba3f7.entry.js +0 -1
  585. package/dist/elements/p-8c759f51.entry.js +0 -1
  586. package/dist/elements/p-8f945e6b.entry.js +0 -1
  587. package/dist/elements/p-9300ab6a.js +0 -1
  588. package/dist/elements/p-93cacd51.entry.js +0 -1
  589. package/dist/elements/p-9408d0b4.entry.js +0 -1
  590. package/dist/elements/p-98c79eda.js +0 -1
  591. package/dist/elements/p-99f8abed.js +0 -1
  592. package/dist/elements/p-9ca7e079.js +0 -1
  593. package/dist/elements/p-a4648b74.entry.js +0 -1
  594. package/dist/elements/p-aab0f63c.js +0 -1
  595. package/dist/elements/p-ad4e2295.entry.js +0 -1
  596. package/dist/elements/p-afb8f7d5.entry.js +0 -1
  597. package/dist/elements/p-b055ec44.js +0 -1
  598. package/dist/elements/p-b078d63b.entry.js +0 -1
  599. package/dist/elements/p-b3460325.entry.js +0 -1
  600. package/dist/elements/p-b5406b58.entry.js +0 -1
  601. package/dist/elements/p-b5ef0c91.entry.js +0 -1
  602. package/dist/elements/p-b6ba623e.entry.js +0 -1
  603. package/dist/elements/p-b9926d8b.entry.js +0 -1
  604. package/dist/elements/p-bfd4cfcd.entry.js +0 -1
  605. package/dist/elements/p-c08dd7d0.entry.js +0 -1
  606. package/dist/elements/p-c0db9c51.entry.js +0 -1
  607. package/dist/elements/p-c1e7fbfb.js +0 -1
  608. package/dist/elements/p-ca69d6c9.js +0 -1
  609. package/dist/elements/p-cc4cb1ac.entry.js +0 -1
  610. package/dist/elements/p-cf8a7031.entry.js +0 -1
  611. package/dist/elements/p-cff82b6f.js +0 -1
  612. package/dist/elements/p-d01009b8.entry.js +0 -67
  613. package/dist/elements/p-d6d1e65f.entry.js +0 -1
  614. package/dist/elements/p-d9462b66.entry.js +0 -1
  615. package/dist/elements/p-e2e0fee9.entry.js +0 -1
  616. package/dist/elements/p-e642b266.entry.js +0 -1
  617. package/dist/elements/p-e953934f.entry.js +0 -1
  618. package/dist/elements/p-f0474f46.js +0 -1
  619. package/dist/elements/p-f10a94f6.entry.js +0 -1
  620. package/dist/elements/p-f2426182.entry.js +0 -1
  621. package/dist/elements/p-f327fd21.js +0 -1
  622. package/dist/elements/p-f84987ee.js +0 -1
  623. package/dist/elements/p-f8a3367d.entry.js +0 -1
  624. package/dist/esm/focus-visible-edb28f19.js +0 -43
  625. package/dist/esm/framework-delegate-9cd8048f.js +0 -34
  626. package/dist/esm/ion-action-sheet.entry.js +0 -261
  627. package/dist/esm/ion-note.entry.js +0 -25
  628. package/dist/esm/ion-select-popover.entry.js +0 -31
  629. package/dist/esm/spinner-configs-aaf2a1a9.js +0 -110
  630. package/dist/esm/swipe-back-d84cfc8a.js +0 -50
  631. package/dist/esm/test-component.entry.js +0 -9
  632. package/dist/types/test/TestComponent.d.ts +0 -2
  633. package/dist/types/test/mockPodOS.d.ts +0 -11
  634. package/dist/types/test/renderFunctionalComponent.d.ts +0 -1
@@ -2,571 +2,159 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b4a9ece2.js');
6
- const ionicGlobal = require('./ionic-global-56e10eb5.js');
7
- const helpers = require('./helpers-398ced09.js');
8
- const overlays = require('./overlays-49fe9ba7.js');
9
- const theme = require('./theme-2259d0f5.js');
10
- require('./hardware-back-button-01027575.js');
5
+ const index = require('./index-eaa0d16e.js');
6
+ const index$2 = require('./index-731691ca.js');
7
+ const ionicGlobal = require('./ionic-global-f2d95fd3.js');
8
+ const focusVisible = require('./focus-visible-2624ec15.js');
9
+ const helpers = require('./helpers-cb08f5ae.js');
10
+ const index$1 = require('./index-b2a479e4.js');
11
+ const dir = require('./dir-011f46ea.js');
12
+ const theme = require('./theme-fc63803b.js');
13
+ const data = require('./data-0c9489d7.js');
11
14
 
12
- /**
13
- * Gets a date value given a format
14
- * Defaults to the current date if
15
- * no date given
15
+ /*!
16
+ * (C) Ionic http://ionicframework.com - MIT License
16
17
  */
17
- const getDateValue = (date, format) => {
18
- const getValue = getValueFromFormat(date, format);
19
- if (getValue !== undefined) {
20
- if (format === FORMAT_A || format === FORMAT_a) {
21
- date.ampm = getValue;
22
- }
23
- return getValue;
24
- }
25
- const defaultDate = parseDate(new Date().toISOString());
26
- return getValueFromFormat(defaultDate, format);
27
- };
28
- const renderDatetime = (template, value, locale) => {
29
- if (value === undefined) {
30
- return undefined;
31
- }
32
- const tokens = [];
33
- let hasText = false;
34
- FORMAT_KEYS.forEach((format, index) => {
35
- if (template.indexOf(format.f) > -1) {
36
- const token = '{' + index + '}';
37
- const text = renderTextFormat(format.f, value[format.k], value, locale);
38
- if (!hasText && text !== undefined && value[format.k] != null) {
39
- hasText = true;
40
- }
41
- tokens.push(token, text || '');
42
- template = template.replace(format.f, token);
43
- }
44
- });
45
- if (!hasText) {
46
- return undefined;
47
- }
48
- for (let i = 0; i < tokens.length; i += 2) {
49
- template = template.replace(tokens[i], tokens[i + 1]);
50
- }
51
- return template;
52
- };
53
- const renderTextFormat = (format, value, date, locale) => {
54
- if ((format === FORMAT_DDDD || format === FORMAT_DDD)) {
55
- try {
56
- value = (new Date(date.year, date.month - 1, date.day)).getDay();
57
- if (format === FORMAT_DDDD) {
58
- return (locale.dayNames ? locale.dayNames : DAY_NAMES)[value];
59
- }
60
- return (locale.dayShortNames ? locale.dayShortNames : DAY_SHORT_NAMES)[value];
61
- }
62
- catch (e) {
63
- // ignore
64
- }
65
- return undefined;
66
- }
67
- if (format === FORMAT_A) {
68
- return date !== undefined && date.hour !== undefined
69
- ? (date.hour < 12 ? 'AM' : 'PM')
70
- : value ? value.toUpperCase() : '';
71
- }
72
- if (format === FORMAT_a) {
73
- return date !== undefined && date.hour !== undefined
74
- ? (date.hour < 12 ? 'am' : 'pm')
75
- : value || '';
76
- }
77
- if (value == null) {
78
- return '';
79
- }
80
- if (format === FORMAT_YY || format === FORMAT_MM ||
81
- format === FORMAT_DD || format === FORMAT_HH ||
82
- format === FORMAT_mm || format === FORMAT_ss) {
83
- return twoDigit(value);
84
- }
85
- if (format === FORMAT_YYYY) {
86
- return fourDigit(value);
87
- }
88
- if (format === FORMAT_MMMM) {
89
- return (locale.monthNames ? locale.monthNames : MONTH_NAMES)[value - 1];
90
- }
91
- if (format === FORMAT_MMM) {
92
- return (locale.monthShortNames ? locale.monthShortNames : MONTH_SHORT_NAMES)[value - 1];
93
- }
94
- if (format === FORMAT_hh || format === FORMAT_h) {
95
- if (value === 0) {
96
- return '12';
97
- }
98
- if (value > 12) {
99
- value -= 12;
100
- }
101
- if (format === FORMAT_hh && value < 10) {
102
- return ('0' + value);
103
- }
104
- }
105
- return value.toString();
106
- };
107
- const dateValueRange = (format, min, max) => {
108
- const opts = [];
109
- if (format === FORMAT_YYYY || format === FORMAT_YY) {
110
- // year
111
- if (max.year === undefined || min.year === undefined) {
112
- throw new Error('min and max year is undefined');
113
- }
114
- for (let i = max.year; i >= min.year; i--) {
115
- opts.push(i);
116
- }
117
- }
118
- else if (format === FORMAT_MMMM || format === FORMAT_MMM ||
119
- format === FORMAT_MM || format === FORMAT_M ||
120
- format === FORMAT_hh || format === FORMAT_h) {
121
- // month or 12-hour
122
- for (let i = 1; i < 13; i++) {
123
- opts.push(i);
124
- }
18
+ const isYearDisabled = (refYear, minParts, maxParts) => {
19
+ if (minParts && minParts.year > refYear) {
20
+ return true;
125
21
  }
126
- else if (format === FORMAT_DDDD || format === FORMAT_DDD ||
127
- format === FORMAT_DD || format === FORMAT_D) {
128
- // day
129
- for (let i = 1; i < 32; i++) {
130
- opts.push(i);
131
- }
22
+ if (maxParts && maxParts.year < refYear) {
23
+ return true;
132
24
  }
133
- else if (format === FORMAT_HH || format === FORMAT_H) {
134
- // 24-hour
135
- for (let i = 0; i < 24; i++) {
136
- opts.push(i);
137
- }
138
- }
139
- else if (format === FORMAT_mm || format === FORMAT_m) {
140
- // minutes
141
- for (let i = 0; i < 60; i++) {
142
- opts.push(i);
143
- }
144
- }
145
- else if (format === FORMAT_ss || format === FORMAT_s) {
146
- // seconds
147
- for (let i = 0; i < 60; i++) {
148
- opts.push(i);
149
- }
150
- }
151
- else if (format === FORMAT_A || format === FORMAT_a) {
152
- // AM/PM
153
- opts.push('am', 'pm');
154
- }
155
- return opts;
156
- };
157
- const dateSortValue = (year, month, day, hour = 0, minute = 0) => {
158
- return parseInt(`1${fourDigit(year)}${twoDigit(month)}${twoDigit(day)}${twoDigit(hour)}${twoDigit(minute)}`, 10);
159
- };
160
- const dateDataSortValue = (data) => {
161
- return dateSortValue(data.year, data.month, data.day, data.hour, data.minute);
162
- };
163
- const daysInMonth = (month, year) => {
164
- return (month === 4 || month === 6 || month === 9 || month === 11) ? 30 : (month === 2) ? isLeapYear(year) ? 29 : 28 : 31;
165
- };
166
- const isLeapYear = (year) => {
167
- return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
168
- };
169
- const ISO_8601_REGEXP = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
170
- const TIME_REGEXP = /^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
171
- const parseDate = (val) => {
172
- // manually parse IS0 cuz Date.parse cannot be trusted
173
- // ISO 8601 format: 1994-12-15T13:47:20Z
174
- let parse = null;
175
- if (val != null && val !== '') {
176
- // try parsing for just time first, HH:MM
177
- parse = TIME_REGEXP.exec(val);
178
- if (parse) {
179
- // adjust the array so it fits nicely with the datetime parse
180
- parse.unshift(undefined, undefined);
181
- parse[2] = parse[3] = undefined;
182
- }
183
- else {
184
- // try parsing for full ISO datetime
185
- parse = ISO_8601_REGEXP.exec(val);
186
- }
187
- }
188
- if (parse === null) {
189
- // wasn't able to parse the ISO datetime
190
- return undefined;
191
- }
192
- // ensure all the parse values exist with at least 0
193
- for (let i = 1; i < 8; i++) {
194
- parse[i] = parse[i] !== undefined ? parseInt(parse[i], 10) : undefined;
195
- }
196
- let tzOffset = 0;
197
- if (parse[9] && parse[10]) {
198
- // hours
199
- tzOffset = parseInt(parse[10], 10) * 60;
200
- if (parse[11]) {
201
- // minutes
202
- tzOffset += parseInt(parse[11], 10);
203
- }
204
- if (parse[9] === '-') {
205
- // + or -
206
- tzOffset *= -1;
207
- }
208
- }
209
- return {
210
- year: parse[1],
211
- month: parse[2],
212
- day: parse[3],
213
- hour: parse[4],
214
- minute: parse[5],
215
- second: parse[6],
216
- millisecond: parse[7],
217
- tzOffset,
218
- };
25
+ return false;
219
26
  };
220
27
  /**
221
- * Converts a valid UTC datetime string to JS Date time object.
222
- * By default uses the users local timezone, but an optional
223
- * timezone can be provided.
224
- * Note: This is not meant for time strings
225
- * such as "01:47"
28
+ * Returns true if a given day should
29
+ * not be interactive according to its value,
30
+ * or the max/min dates.
226
31
  */
227
- const getDateTime = (dateString = '', timeZone = '') => {
32
+ const isDayDisabled = (refParts, minParts, maxParts, dayValues) => {
228
33
  /**
229
- * If user passed in undefined
230
- * or null, convert it to the
231
- * empty string since the rest
232
- * of this functions expects
233
- * a string
34
+ * If this is a filler date (i.e. padding)
35
+ * then the date is disabled.
234
36
  */
235
- if (dateString === undefined || dateString === null) {
236
- dateString = '';
37
+ if (refParts.day === null) {
38
+ return true;
237
39
  }
238
40
  /**
239
- * Ensures that YYYY-MM-DD, YYYY-MM,
240
- * YYYY-DD, YYYY, etc does not get affected
241
- * by timezones and stays on the day/month
242
- * that the user provided
41
+ * If user passed in a list of acceptable day values
42
+ * check to make sure that the date we are looking
43
+ * at is in this array.
243
44
  */
244
- if (dateString.length === 10 ||
245
- dateString.length === 7 ||
246
- dateString.length === 4) {
247
- dateString += ' ';
248
- }
249
- const date = (typeof dateString === 'string' && dateString.length > 0) ? new Date(dateString) : new Date();
250
- const localDateTime = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
251
- if (timeZone && timeZone.length > 0) {
252
- return new Date(date.getTime() - getTimezoneOffset(localDateTime, timeZone));
45
+ if (dayValues !== undefined && !dayValues.includes(refParts.day)) {
46
+ return true;
253
47
  }
254
- return localDateTime;
255
- };
256
- const getTimezoneOffset = (localDate, timeZone) => {
257
- const utcDateTime = new Date(localDate.toLocaleString('en-US', { timeZone: 'utc' }));
258
- const tzDateTime = new Date(localDate.toLocaleString('en-US', { timeZone }));
259
- return utcDateTime.getTime() - tzDateTime.getTime();
260
- };
261
- const updateDate = (existingData, newData, displayTimezone) => {
262
- if (!newData || typeof newData === 'string') {
263
- const dateTime = getDateTime(newData, displayTimezone);
264
- if (!Number.isNaN(dateTime.getTime())) {
265
- newData = dateTime.toISOString();
266
- }
267
- }
268
- if (newData && newData !== '') {
269
- if (typeof newData === 'string') {
270
- // new date is a string, and hopefully in the ISO format
271
- // convert it to our DatetimeData if a valid ISO
272
- newData = parseDate(newData);
273
- if (newData) {
274
- // successfully parsed the ISO string to our DatetimeData
275
- Object.assign(existingData, newData);
276
- return true;
277
- }
278
- }
279
- else if ((newData.year || newData.hour || newData.month || newData.day || newData.minute || newData.second)) {
280
- // newData is from the datetime picker's selected values
281
- // update the existing datetimeValue with the new values
282
- if (newData.ampm !== undefined && newData.hour !== undefined) {
283
- // change the value of the hour based on whether or not it is am or pm
284
- // if the meridiem is pm and equal to 12, it remains 12
285
- // otherwise we add 12 to the hour value
286
- // if the meridiem is am and equal to 12, we change it to 0
287
- // otherwise we use its current hour value
288
- // for example: 8 pm becomes 20, 12 am becomes 0, 4 am becomes 4
289
- newData.hour.value = (newData.ampm.value === 'pm')
290
- ? (newData.hour.value === 12 ? 12 : newData.hour.value + 12)
291
- : (newData.hour.value === 12 ? 0 : newData.hour.value);
292
- }
293
- // merge new values from the picker's selection
294
- // to the existing DatetimeData values
295
- for (const key of Object.keys(newData)) {
296
- existingData[key] = newData[key].value;
297
- }
298
- return true;
299
- }
300
- else if (newData.ampm) {
301
- // Even though in the picker column hour values are between 1 and 12, the hour value is actually normalized
302
- // to [0, 23] interval. Because of this when changing between AM and PM we have to update the hour so it points
303
- // to the correct HH hour
304
- newData.hour = {
305
- value: newData.hour
306
- ? newData.hour.value
307
- : (newData.ampm.value === 'pm'
308
- ? (existingData.hour < 12 ? existingData.hour + 12 : existingData.hour)
309
- : (existingData.hour >= 12 ? existingData.hour - 12 : existingData.hour))
310
- };
311
- existingData['hour'] = newData['hour'].value;
312
- existingData['ampm'] = newData['ampm'].value;
313
- return true;
314
- }
315
- // eww, invalid data
316
- console.warn(`Error parsing date: "${newData}". Please provide a valid ISO 8601 datetime format: https://www.w3.org/TR/NOTE-datetime`);
48
+ /**
49
+ * Given a min date, perform the following
50
+ * checks. If any of them are true, then the
51
+ * day should be disabled:
52
+ * 1. Is the current year < the min allowed year?
53
+ * 2. Is the current year === min allowed year,
54
+ * but the current month < the min allowed month?
55
+ * 3. Is the current year === min allowed year, the
56
+ * current month === min allow month, but the current
57
+ * day < the min allowed day?
58
+ */
59
+ if (minParts && data.isBefore(refParts, minParts)) {
60
+ return true;
317
61
  }
318
- else {
319
- // blank data, clear everything out
320
- for (const k in existingData) {
321
- if (existingData.hasOwnProperty(k)) {
322
- delete existingData[k];
323
- }
324
- }
62
+ /**
63
+ * Given a max date, perform the following
64
+ * checks. If any of them are true, then the
65
+ * day should be disabled:
66
+ * 1. Is the current year > the max allowed year?
67
+ * 2. Is the current year === max allowed year,
68
+ * but the current month > the max allowed month?
69
+ * 3. Is the current year === max allowed year, the
70
+ * current month === max allow month, but the current
71
+ * day > the max allowed day?
72
+ */
73
+ if (maxParts && data.isAfter(refParts, maxParts)) {
74
+ return true;
325
75
  }
76
+ /**
77
+ * If none of these checks
78
+ * passed then the date should
79
+ * be interactive.
80
+ */
326
81
  return false;
327
82
  };
328
- const parseTemplate = (template) => {
329
- const formats = [];
330
- template = template.replace(/[^\w\s]/gi, ' ');
331
- FORMAT_KEYS.forEach(format => {
332
- if (format.f.length > 1 && template.indexOf(format.f) > -1 && template.indexOf(format.f + format.f.charAt(0)) < 0) {
333
- template = template.replace(format.f, ' ' + format.f + ' ');
334
- }
335
- });
336
- const words = template.split(' ').filter(w => w.length > 0);
337
- words.forEach((word, i) => {
338
- FORMAT_KEYS.forEach(format => {
339
- if (word === format.f) {
340
- if (word === FORMAT_A || word === FORMAT_a) {
341
- // this format is an am/pm format, so it's an "a" or "A"
342
- if ((formats.indexOf(FORMAT_h) < 0 && formats.indexOf(FORMAT_hh) < 0) ||
343
- VALID_AMPM_PREFIX.indexOf(words[i - 1]) === -1) {
344
- // template does not already have a 12-hour format
345
- // or this am/pm format doesn't have a hour, minute, or second format immediately before it
346
- // so do not treat this word "a" or "A" as the am/pm format
347
- return;
348
- }
349
- }
350
- formats.push(word);
351
- }
352
- });
353
- });
354
- return formats;
355
- };
356
- const getValueFromFormat = (date, format) => {
357
- if (format === FORMAT_A || format === FORMAT_a) {
358
- return (date.hour < 12 ? 'am' : 'pm');
359
- }
360
- if (format === FORMAT_hh || format === FORMAT_h) {
361
- return (date.hour > 12 ? date.hour - 12 : (date.hour === 0 ? 12 : date.hour));
362
- }
363
- return date[convertFormatToKey(format)];
364
- };
365
- const convertFormatToKey = (format) => {
366
- for (const k in FORMAT_KEYS) {
367
- if (FORMAT_KEYS[k].f === format) {
368
- return FORMAT_KEYS[k].k;
369
- }
370
- }
371
- return undefined;
372
- };
373
- const convertDataToISO = (data) => {
374
- // https://www.w3.org/TR/NOTE-datetime
375
- let rtn = '';
376
- if (data.year !== undefined) {
377
- // YYYY
378
- rtn = fourDigit(data.year);
379
- if (data.month !== undefined) {
380
- // YYYY-MM
381
- rtn += '-' + twoDigit(data.month);
382
- if (data.day !== undefined) {
383
- // YYYY-MM-DD
384
- rtn += '-' + twoDigit(data.day);
385
- if (data.hour !== undefined) {
386
- // YYYY-MM-DDTHH:mm:SS
387
- rtn += `T${twoDigit(data.hour)}:${twoDigit(data.minute)}:${twoDigit(data.second)}`;
388
- if (data.millisecond > 0) {
389
- // YYYY-MM-DDTHH:mm:SS.SSS
390
- rtn += '.' + threeDigit(data.millisecond);
391
- }
392
- if (data.tzOffset === undefined) {
393
- // YYYY-MM-DDTHH:mm:SSZ
394
- rtn += 'Z';
395
- }
396
- else {
397
- // YYYY-MM-DDTHH:mm:SS+/-HH:mm
398
- rtn += (data.tzOffset > 0 ? '+' : '-') + twoDigit(Math.floor(Math.abs(data.tzOffset / 60))) + ':' + twoDigit(data.tzOffset % 60);
399
- }
400
- }
401
- }
402
- }
403
- }
404
- else if (data.hour !== undefined) {
405
- // HH:mm
406
- rtn = twoDigit(data.hour) + ':' + twoDigit(data.minute);
407
- if (data.second !== undefined) {
408
- // HH:mm:SS
409
- rtn += ':' + twoDigit(data.second);
410
- if (data.millisecond !== undefined) {
411
- // HH:mm:SS.SSS
412
- rtn += '.' + threeDigit(data.millisecond);
413
- }
414
- }
415
- }
416
- return rtn;
83
+ /**
84
+ * Given a locale, a date, the selected date(s), and today's date,
85
+ * generate the state for a given calendar day button.
86
+ */
87
+ const getCalendarDayState = (locale, refParts, activeParts, todayParts, minParts, maxParts, dayValues) => {
88
+ /**
89
+ * activeParts signals what day(s) are currently selected in the datetime.
90
+ * If multiple="true", this will be an array, but the logic in this util
91
+ * is the same whether we have one selected day or many because we're only
92
+ * calculating the state for one button. So, we treat a single activeParts value
93
+ * the same as an array of length one.
94
+ */
95
+ const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
96
+ /**
97
+ * The day button is active if it is selected, or in other words, if refParts
98
+ * matches at least one selected date.
99
+ */
100
+ const isActive = activePartsArray.find((parts) => data.isSameDay(refParts, parts)) !== undefined;
101
+ const isToday = data.isSameDay(refParts, todayParts);
102
+ const disabled = isDayDisabled(refParts, minParts, maxParts, dayValues);
103
+ /**
104
+ * Note that we always return one object regardless of whether activeParts
105
+ * was an array, since we pare down to one value for isActive.
106
+ */
107
+ return {
108
+ disabled,
109
+ isActive,
110
+ isToday,
111
+ ariaSelected: isActive ? 'true' : null,
112
+ ariaLabel: data.generateDayAriaLabel(locale, isToday, refParts),
113
+ text: refParts.day != null ? data.getDay(locale, refParts) : null,
114
+ };
417
115
  };
418
116
  /**
419
- * Use to convert a string of comma separated strings or
420
- * an array of strings, and clean up any user input
117
+ * Returns `true` if the month is disabled given the
118
+ * current date value and min/max date constraints.
421
119
  */
422
- const convertToArrayOfStrings = (input, type) => {
423
- if (input == null) {
424
- return undefined;
425
- }
426
- if (typeof input === 'string') {
427
- // convert the string to an array of strings
428
- // auto remove any [] characters
429
- input = input.replace(/\[|\]/g, '').split(',');
120
+ const isMonthDisabled = (refParts, { minParts, maxParts, }) => {
121
+ // If the year is disabled then the month is disabled.
122
+ if (isYearDisabled(refParts.year, minParts, maxParts)) {
123
+ return true;
430
124
  }
431
- let values;
432
- if (Array.isArray(input)) {
433
- // trim up each string value
434
- values = input.map(val => val.toString().trim());
125
+ // If the date value is before the min date, then the month is disabled.
126
+ // If the date value is after the max date, then the month is disabled.
127
+ if ((minParts && data.isBefore(refParts, minParts)) || (maxParts && data.isAfter(refParts, maxParts))) {
128
+ return true;
435
129
  }
436
- if (values === undefined || values.length === 0) {
437
- console.warn(`Invalid "${type}Names". Must be an array of strings, or a comma separated string.`);
438
- }
439
- return values;
130
+ return false;
440
131
  };
441
132
  /**
442
- * Use to convert a string of comma separated numbers or
443
- * an array of numbers, and clean up any user input
133
+ * Given a working date, an optional minimum date range,
134
+ * and an optional maximum date range; determine if the
135
+ * previous navigation button is disabled.
444
136
  */
445
- const convertToArrayOfNumbers = (input, type) => {
446
- if (typeof input === 'string') {
447
- // convert the string to an array of strings
448
- // auto remove any whitespace and [] characters
449
- input = input.replace(/\[|\]|\s/g, '').split(',');
450
- }
451
- let values;
452
- if (Array.isArray(input)) {
453
- // ensure each value is an actual number in the returned array
454
- values = input
455
- .map((num) => parseInt(num, 10))
456
- .filter(isFinite);
457
- }
458
- else {
459
- values = [input];
460
- }
461
- if (values.length === 0) {
462
- console.warn(`Invalid "${type}Values". Must be an array of numbers, or a comma separated string of numbers.`);
463
- }
464
- return values;
465
- };
466
- const twoDigit = (val) => {
467
- return ('0' + (val !== undefined ? Math.abs(val) : '0')).slice(-2);
468
- };
469
- const threeDigit = (val) => {
470
- return ('00' + (val !== undefined ? Math.abs(val) : '0')).slice(-3);
137
+ const isPrevMonthDisabled = (refParts, minParts, maxParts) => {
138
+ const prevMonth = Object.assign(Object.assign({}, data.getPreviousMonth(refParts)), { day: null });
139
+ return isMonthDisabled(prevMonth, {
140
+ minParts,
141
+ maxParts,
142
+ });
471
143
  };
472
- const fourDigit = (val) => {
473
- return ('000' + (val !== undefined ? Math.abs(val) : '0')).slice(-4);
144
+ /**
145
+ * Given a working date and a maximum date range,
146
+ * determine if the next navigation button is disabled.
147
+ */
148
+ const isNextMonthDisabled = (refParts, maxParts) => {
149
+ const nextMonth = Object.assign(Object.assign({}, data.getNextMonth(refParts)), { day: null });
150
+ return isMonthDisabled(nextMonth, {
151
+ maxParts,
152
+ });
474
153
  };
475
- const FORMAT_YYYY = 'YYYY';
476
- const FORMAT_YY = 'YY';
477
- const FORMAT_MMMM = 'MMMM';
478
- const FORMAT_MMM = 'MMM';
479
- const FORMAT_MM = 'MM';
480
- const FORMAT_M = 'M';
481
- const FORMAT_DDDD = 'DDDD';
482
- const FORMAT_DDD = 'DDD';
483
- const FORMAT_DD = 'DD';
484
- const FORMAT_D = 'D';
485
- const FORMAT_HH = 'HH';
486
- const FORMAT_H = 'H';
487
- const FORMAT_hh = 'hh';
488
- const FORMAT_h = 'h';
489
- const FORMAT_mm = 'mm';
490
- const FORMAT_m = 'm';
491
- const FORMAT_ss = 'ss';
492
- const FORMAT_s = 's';
493
- const FORMAT_A = 'A';
494
- const FORMAT_a = 'a';
495
- const FORMAT_KEYS = [
496
- { f: FORMAT_YYYY, k: 'year' },
497
- { f: FORMAT_MMMM, k: 'month' },
498
- { f: FORMAT_DDDD, k: 'day' },
499
- { f: FORMAT_MMM, k: 'month' },
500
- { f: FORMAT_DDD, k: 'day' },
501
- { f: FORMAT_YY, k: 'year' },
502
- { f: FORMAT_MM, k: 'month' },
503
- { f: FORMAT_DD, k: 'day' },
504
- { f: FORMAT_HH, k: 'hour' },
505
- { f: FORMAT_hh, k: 'hour' },
506
- { f: FORMAT_mm, k: 'minute' },
507
- { f: FORMAT_ss, k: 'second' },
508
- { f: FORMAT_M, k: 'month' },
509
- { f: FORMAT_D, k: 'day' },
510
- { f: FORMAT_H, k: 'hour' },
511
- { f: FORMAT_h, k: 'hour' },
512
- { f: FORMAT_m, k: 'minute' },
513
- { f: FORMAT_s, k: 'second' },
514
- { f: FORMAT_A, k: 'ampm' },
515
- { f: FORMAT_a, k: 'ampm' },
516
- ];
517
- const DAY_NAMES = [
518
- 'Sunday',
519
- 'Monday',
520
- 'Tuesday',
521
- 'Wednesday',
522
- 'Thursday',
523
- 'Friday',
524
- 'Saturday',
525
- ];
526
- const DAY_SHORT_NAMES = [
527
- 'Sun',
528
- 'Mon',
529
- 'Tue',
530
- 'Wed',
531
- 'Thu',
532
- 'Fri',
533
- 'Sat',
534
- ];
535
- const MONTH_NAMES = [
536
- 'January',
537
- 'February',
538
- 'March',
539
- 'April',
540
- 'May',
541
- 'June',
542
- 'July',
543
- 'August',
544
- 'September',
545
- 'October',
546
- 'November',
547
- 'December',
548
- ];
549
- const MONTH_SHORT_NAMES = [
550
- 'Jan',
551
- 'Feb',
552
- 'Mar',
553
- 'Apr',
554
- 'May',
555
- 'Jun',
556
- 'Jul',
557
- 'Aug',
558
- 'Sep',
559
- 'Oct',
560
- 'Nov',
561
- 'Dec',
562
- ];
563
- const VALID_AMPM_PREFIX = [
564
- FORMAT_hh, FORMAT_h, FORMAT_mm, FORMAT_m, FORMAT_ss, FORMAT_s
565
- ];
566
154
 
567
- const datetimeIosCss = ":host{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;min-width:16px;min-height:1.2em;font-family:var(--ion-font-family, inherit);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;z-index:2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static}:host(.datetime-placeholder){color:var(--placeholder-color)}:host(.datetime-disabled){opacity:0.3;pointer-events:none}:host(.datetime-readonly){pointer-events:none}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none}[dir=rtl] button,:host-context([dir=rtl]) button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.datetime-text{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;flex:1;min-height:inherit;direction:ltr;overflow:inherit}[dir=rtl] .datetime-text,:host-context([dir=rtl]) .datetime-text{direction:rtl}:host{--placeholder-color:var(--ion-color-step-400, #999999);--padding-top:10px;--padding-end:10px;--padding-bottom:10px;--padding-start:20px}";
155
+ const datetimeIosCss = ":host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}ion-picker-column-internal{min-width:26px}: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: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{order:3;text-align:end}:host .wheel-order-year-first .month-column{order:2;text-align:end}:host .wheel-order-year-first .year-column{order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:flex;flex:1 1 auto;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:flex}@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)){: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{left:-99999px;position:absolute;visibility:hidden;pointer-events:none}:host-context([dir=rtl]):host(.show-month-and-year) .calendar-next-prev,:host-context([dir=rtl]).show-month-and-year .calendar-next-prev,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-days-of-week,:host-context([dir=rtl]).show-month-and-year .calendar-days-of-week,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-body,:host-context([dir=rtl]).show-month-and-year .calendar-body,:host-context([dir=rtl]):host(.show-month-and-year) .datetime-time,:host-context([dir=rtl]).show-month-and-year .datetime-time{left:unset;right:unset;right:-99999px}}@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)){: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-readonly),:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled){opacity:0.4}: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:flex;justify-content:space-between}:host .calendar-action-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{--background:translucent}:host .calendar-action-buttons ion-item ion-label{display:flex;align-items:center}:host .calendar-action-buttons ion-item ion-icon{padding-left:4px;padding-right:0;padding-top:0;padding-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-action-buttons ion-item ion-icon{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0}}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}:host .calendar-body{display:flex;flex-grow:1;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{scroll-snap-align:start;scroll-snap-stop:always;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{padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;display:flex;position:relative;align-items:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;appearance:none;z-index:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{padding-left:unset;padding-right:unset;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px}}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{margin-left:unset;margin-right:unset;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px}}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}:host .calendar-day:after{border-radius:32px;padding-left:4px;padding-right:4px;padding-top:4px;padding-bottom:4px;position:absolute;top:50%;left:50%;width:32px;height:32px;transform:translate(-50%, -50%);content:\" \";z-index:-1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day:after{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px}}:host .datetime-time{display:flex;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:flex;align-items:center}:host .time-body{border-radius:8px;padding-left:12px;padding-right:12px;padding-top:6px;padding-bottom:6px;display:flex;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .time-body{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons ion-item{--color:var(--ion-color-base)}:host{--background:var(--ion-color-light, #ffffff);--background-rgb:var(--ion-color-light-rgb);--title-color:var(--ion-color-step-600, #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{padding-left:16px;padding-right:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, #cccccc);font-size:14px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-header{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}:host .calendar-action-buttons ion-item{--padding-start:16px;--background-hover:transparent;--background-activated:transparent;font-size:16px;font-weight:600}:host .calendar-action-buttons ion-item ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:0}: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{padding-left:8px;padding-right:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, #b3b3b3);font-size:12px;font-weight:600;line-height:24px;text-transform:uppercase}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-days-of-week{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}:host .calendar-body .calendar-month .calendar-month-grid{padding-left:8px;padding-right:8px;padding-top:8px;padding-bottom:8px;height:calc(100% - 16px)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-body .calendar-month .calendar-month-grid{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}:host .calendar-day{font-size:20px}:host .calendar-day:after{opacity:0.2}:host .calendar-day:focus:after{background:var(--ion-color-base)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-base);font-weight:600}:host .calendar-day.calendar-day-active:after{background:var(--ion-color-base)}:host .calendar-day.calendar-day-today.calendar-day-active{color:var(--ion-color-contrast)}:host .calendar-day.calendar-day-today.calendar-day-active:after{background:var(--ion-color-base);opacity:1}:host .datetime-time{padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:16px;font-size:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-time{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{padding-left:8px;padding-right:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, #cccccc)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-buttons{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:flex;align-items:center;justify-content:space-between}:host .datetime-action-buttons{width:100%}";
568
156
 
569
- const datetimeMdCss = ":host{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;min-width:16px;min-height:1.2em;font-family:var(--ion-font-family, inherit);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;z-index:2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static}:host(.datetime-placeholder){color:var(--placeholder-color)}:host(.datetime-disabled){opacity:0.3;pointer-events:none}:host(.datetime-readonly){pointer-events:none}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none}[dir=rtl] button,:host-context([dir=rtl]) button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.datetime-text{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;flex:1;min-height:inherit;direction:ltr;overflow:inherit}[dir=rtl] .datetime-text,:host-context([dir=rtl]) .datetime-text{direction:rtl}:host{--placeholder-color:var(--ion-placeholder-color, var(--ion-color-step-400, #999999));--padding-top:10px;--padding-end:0;--padding-bottom:11px;--padding-start:16px}";
157
+ const datetimeMdCss = ":host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}ion-picker-column-internal{min-width:26px}: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: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{order:3;text-align:end}:host .wheel-order-year-first .month-column{order:2;text-align:end}:host .wheel-order-year-first .year-column{order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:flex;flex:1 1 auto;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:flex}@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)){: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{left:-99999px;position:absolute;visibility:hidden;pointer-events:none}:host-context([dir=rtl]):host(.show-month-and-year) .calendar-next-prev,:host-context([dir=rtl]).show-month-and-year .calendar-next-prev,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-days-of-week,:host-context([dir=rtl]).show-month-and-year .calendar-days-of-week,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-body,:host-context([dir=rtl]).show-month-and-year .calendar-body,:host-context([dir=rtl]):host(.show-month-and-year) .datetime-time,:host-context([dir=rtl]).show-month-and-year .datetime-time{left:unset;right:unset;right:-99999px}}@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)){: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-readonly),:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled){opacity:0.4}: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:flex;justify-content:space-between}:host .calendar-action-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{--background:translucent}:host .calendar-action-buttons ion-item ion-label{display:flex;align-items:center}:host .calendar-action-buttons ion-item ion-icon{padding-left:4px;padding-right:0;padding-top:0;padding-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-action-buttons ion-item ion-icon{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0}}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}:host .calendar-body{display:flex;flex-grow:1;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{scroll-snap-align:start;scroll-snap-stop:always;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{padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;display:flex;position:relative;align-items:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;appearance:none;z-index:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{padding-left:unset;padding-right:unset;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px}}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{margin-left:unset;margin-right:unset;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px}}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}:host .calendar-day:after{border-radius:32px;padding-left:4px;padding-right:4px;padding-top:4px;padding-bottom:4px;position:absolute;top:50%;left:50%;width:32px;height:32px;transform:translate(-50%, -50%);content:\" \";z-index:-1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day:after{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px}}:host .datetime-time{display:flex;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:flex;align-items:center}:host .time-body{border-radius:8px;padding-left:12px;padding-right:12px;padding-top:6px;padding-bottom:6px;display:flex;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .time-body{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons ion-item{--color:var(--ion-color-base)}:host{--background:var(--ion-color-step-100, #ffffff);--title-color:var(--ion-color-contrast)}:host .datetime-header{padding-left:20px;padding-right:20px;padding-top:20px;padding-bottom:20px;background:var(--ion-color-base);color:var(--title-color)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-header{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}:host .datetime-header .datetime-title{font-size:12px;text-transform:uppercase}:host .datetime-header .datetime-selected-date{margin-top:30px;font-size:34px}:host .datetime-calendar .calendar-action-buttons ion-item{--padding-start:20px}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{color:var(--ion-color-step-650, #595959)}:host .calendar-days-of-week{padding-left:10px;padding-right:10px;padding-top:0px;padding-bottom:0px;color:var(--ion-color-step-500, gray);font-size:14px;line-height:36px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-days-of-week{padding-left:unset;padding-right:unset;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}}:host .calendar-body .calendar-month .calendar-month-grid{padding-left:10px;padding-right:10px;padding-top:4px;padding-bottom:4px;grid-template-rows:repeat(6, 1fr)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-body .calendar-month .calendar-month-grid{padding-left:unset;padding-right:unset;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}}:host .calendar-day{padding-left:0px;padding-right:0;padding-top:13px;padding-bottom:13px;font-size:14px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{padding-left:unset;padding-right:unset;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0;padding-inline-end:0}}:host .calendar-day:focus:after{background:rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-today:after{border:1px solid var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-contrast)}:host .calendar-day.calendar-day-active:after{border:1px solid var(--ion-color-base);background:var(--ion-color-base)}:host .datetime-time{padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-time{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host .time-header{color:var(--ion-color-step-650, #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{padding-left:10px;padding-right:10px;padding-top:10px;padding-bottom:10px;display:flex;align-items:center;justify-content:flex-end}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-buttons{padding-left:unset;padding-right:unset;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}}:host .datetime-view-buttons ion-button{color:var(--ion-color-step-800, #333333)}";
570
158
 
571
159
  const Datetime = class {
572
160
  constructor(hostRef) {
@@ -576,12 +164,32 @@ const Datetime = class {
576
164
  this.ionFocus = index.createEvent(this, "ionFocus", 7);
577
165
  this.ionBlur = index.createEvent(this, "ionBlur", 7);
578
166
  this.ionStyle = index.createEvent(this, "ionStyle", 7);
167
+ this.ionRender = index.createEvent(this, "ionRender", 7);
579
168
  this.inputId = `ion-dt-${datetimeIds++}`;
580
- this.locale = {};
581
- this.datetimeMin = {};
582
- this.datetimeMax = {};
583
- this.datetimeValue = {};
584
- this.isExpanded = false;
169
+ this.prevPresentation = null;
170
+ /**
171
+ * Duplicate reference to `activeParts` that does not trigger a re-render of the component.
172
+ * Allows caching an instance of the `activeParts` in between render cycles.
173
+ */
174
+ this.activePartsClone = [];
175
+ this.showMonthAndYear = false;
176
+ this.activeParts = [];
177
+ this.workingParts = {
178
+ month: 5,
179
+ day: 28,
180
+ year: 2021,
181
+ hour: 13,
182
+ minute: 52,
183
+ ampm: 'pm',
184
+ };
185
+ this.isPresented = false;
186
+ this.isTimePopoverOpen = false;
187
+ /**
188
+ * The color to use from your application's color palette.
189
+ * Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
190
+ * For more information on colors, see [theming](/docs/theming/basics).
191
+ */
192
+ this.color = 'primary';
585
193
  /**
586
194
  * The name of the control, which is submitted with the form data.
587
195
  */
@@ -595,13 +203,13 @@ const Datetime = class {
595
203
  */
596
204
  this.readonly = false;
597
205
  /**
598
- * The display format of the date and time as text that shows
599
- * within the item. When the `pickerFormat` input is not used, then the
600
- * `displayFormat` is used for both display the formatted text, and determining
601
- * the datetime picker's columns. See the `pickerFormat` input description for
602
- * more info. Defaults to `MMM D, YYYY`.
206
+ * Which values you want to select. `'date'` will show
207
+ * a calendar picker to select the month, day, and year. `'time'`
208
+ * will show a time picker to select the hour, minute, and (optionally)
209
+ * AM/PM. `'date-time'` will show the date picker first and time picker second.
210
+ * `'time-date'` will show the time picker first and date picker second.
603
211
  */
604
- this.displayFormat = 'MMM D, YYYY';
212
+ this.presentation = 'date-time';
605
213
  /**
606
214
  * The text to display on the picker's cancel button.
607
215
  */
@@ -610,9 +218,527 @@ const Datetime = class {
610
218
  * The text to display on the picker's "Done" button.
611
219
  */
612
220
  this.doneText = 'Done';
613
- this.onClick = () => {
614
- this.setFocus();
615
- this.open();
221
+ /**
222
+ * The text to display on the picker's "Clear" button.
223
+ */
224
+ this.clearText = 'Clear';
225
+ /**
226
+ * The locale to use for `ion-datetime`. This
227
+ * impacts month and day name formatting.
228
+ * The `'default'` value refers to the default
229
+ * locale set by your device.
230
+ */
231
+ this.locale = 'default';
232
+ /**
233
+ * The first day of the week to use for `ion-datetime`. The
234
+ * default value is `0` and represents Sunday.
235
+ */
236
+ this.firstDayOfWeek = 0;
237
+ /**
238
+ * If `true`, multiple dates can be selected at once. Only
239
+ * applies to `presentation="date"` and `preferWheel="false"`.
240
+ */
241
+ this.multiple = false;
242
+ /**
243
+ * If `true`, a header will be shown above the calendar
244
+ * picker. This will include both the slotted title, and
245
+ * the selected date.
246
+ */
247
+ this.showDefaultTitle = false;
248
+ /**
249
+ * If `true`, the default "Cancel" and "OK" buttons
250
+ * will be rendered at the bottom of the `ion-datetime`
251
+ * component. Developers can also use the `button` slot
252
+ * if they want to customize these buttons. If custom
253
+ * buttons are set in the `button` slot then the
254
+ * default buttons will not be rendered.
255
+ */
256
+ this.showDefaultButtons = false;
257
+ /**
258
+ * If `true`, a "Clear" button will be rendered alongside
259
+ * the default "Cancel" and "OK" buttons at the bottom of the `ion-datetime`
260
+ * component. Developers can also use the `button` slot
261
+ * if they want to customize these buttons. If custom
262
+ * buttons are set in the `button` slot then the
263
+ * default buttons will not be rendered.
264
+ */
265
+ this.showClearButton = false;
266
+ /**
267
+ * If `true`, the default "Time" label will be rendered
268
+ * for the time selector of the `ion-datetime` component.
269
+ * Developers can also use the `time-label` slot
270
+ * if they want to customize this label. If a custom
271
+ * label is set in the `time-label` slot then the
272
+ * default label will not be rendered.
273
+ */
274
+ this.showDefaultTimeLabel = true;
275
+ /**
276
+ * If `cover`, the `ion-datetime` will expand to cover the full width of its container.
277
+ * If `fixed`, the `ion-datetime` will have a fixed width.
278
+ */
279
+ this.size = 'fixed';
280
+ /**
281
+ * If `true`, a wheel picker will be rendered instead of a calendar grid
282
+ * where possible. If `false`, a calendar grid will be rendered instead of
283
+ * a wheel picker where possible.
284
+ *
285
+ * A wheel picker can be rendered instead of a grid when `presentation` is
286
+ * one of the following values: `'date'`, `'date-time'`, or `'time-date'`.
287
+ *
288
+ * A wheel picker will always be rendered regardless of
289
+ * the `preferWheel` value when `presentation` is one of the following values:
290
+ * `'time'`, `'month'`, `'month-year'`, or `'year'`.
291
+ */
292
+ this.preferWheel = false;
293
+ /**
294
+ * Returns the DatetimePart interface
295
+ * to use when rendering an initial set of
296
+ * data. This should be used when rendering an
297
+ * interface in an environment where the `value`
298
+ * may not be set. This function works
299
+ * by returning the first selected date in
300
+ * "activePartsClone" and then falling back to
301
+ * defaultParts if no active date is selected.
302
+ */
303
+ this.getActivePartsWithFallback = () => {
304
+ var _a;
305
+ const { defaultParts } = this;
306
+ return (_a = this.getActivePart()) !== null && _a !== void 0 ? _a : defaultParts;
307
+ };
308
+ this.getActivePart = () => {
309
+ const { activePartsClone } = this;
310
+ return Array.isArray(activePartsClone) ? activePartsClone[0] : activePartsClone;
311
+ };
312
+ this.closeParentOverlay = () => {
313
+ const popoverOrModal = this.el.closest('ion-modal, ion-popover');
314
+ if (popoverOrModal) {
315
+ popoverOrModal.dismiss();
316
+ }
317
+ };
318
+ this.setWorkingParts = (parts) => {
319
+ this.workingParts = Object.assign({}, parts);
320
+ };
321
+ this.setActiveParts = (parts, removeDate = false) => {
322
+ const { multiple, minParts, maxParts, activePartsClone } = this;
323
+ /**
324
+ * When setting the active parts, it is possible
325
+ * to set invalid data. For example,
326
+ * when updating January 31 to February,
327
+ * February 31 does not exist. As a result
328
+ * we need to validate the active parts and
329
+ * ensure that we are only setting valid dates.
330
+ * Additionally, we need to update the working parts
331
+ * too in the event that the validated parts are different.
332
+ */
333
+ const validatedParts = data.validateParts(parts, minParts, maxParts);
334
+ this.setWorkingParts(validatedParts);
335
+ if (multiple) {
336
+ /**
337
+ * We read from activePartsClone here because valueChanged() only updates that,
338
+ * so it's the more reliable source of truth. If we read from activeParts, then
339
+ * if you click July 1, manually set the value to July 2, and then click July 3,
340
+ * the new value would be [July 1, July 3], ignoring the value set.
341
+ *
342
+ * We can then pass the new value to activeParts (rather than activePartsClone)
343
+ * since the clone will be updated automatically by activePartsChanged().
344
+ */
345
+ const activePartsArray = Array.isArray(activePartsClone) ? activePartsClone : [activePartsClone];
346
+ if (removeDate) {
347
+ this.activeParts = activePartsArray.filter((p) => !data.isSameDay(p, validatedParts));
348
+ }
349
+ else {
350
+ this.activeParts = [...activePartsArray, validatedParts];
351
+ }
352
+ }
353
+ else {
354
+ this.activeParts = Object.assign({}, validatedParts);
355
+ }
356
+ const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
357
+ if (hasSlottedButtons || this.showDefaultButtons) {
358
+ return;
359
+ }
360
+ this.confirm();
361
+ };
362
+ this.initializeKeyboardListeners = () => {
363
+ const calendarBodyRef = this.calendarBodyRef;
364
+ if (!calendarBodyRef) {
365
+ return;
366
+ }
367
+ const root = this.el.shadowRoot;
368
+ /**
369
+ * Get a reference to the month
370
+ * element we are currently viewing.
371
+ */
372
+ const currentMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(2)');
373
+ /**
374
+ * When focusing the calendar body, we want to pass focus
375
+ * to the working day, but other days should
376
+ * only be accessible using the arrow keys. Pressing
377
+ * Tab should jump between bodies of selectable content.
378
+ */
379
+ const checkCalendarBodyFocus = (ev) => {
380
+ var _a;
381
+ const record = ev[0];
382
+ /**
383
+ * If calendar body was already focused
384
+ * when this fired or if the calendar body
385
+ * if not currently focused, we should not re-focus
386
+ * the inner day.
387
+ */
388
+ if (((_a = record.oldValue) === null || _a === void 0 ? void 0 : _a.includes('ion-focused')) || !calendarBodyRef.classList.contains('ion-focused')) {
389
+ return;
390
+ }
391
+ this.focusWorkingDay(currentMonth);
392
+ };
393
+ const mo = new MutationObserver(checkCalendarBodyFocus);
394
+ mo.observe(calendarBodyRef, { attributeFilter: ['class'], attributeOldValue: true });
395
+ this.destroyKeyboardMO = () => {
396
+ mo === null || mo === void 0 ? void 0 : mo.disconnect();
397
+ };
398
+ /**
399
+ * We must use keydown not keyup as we want
400
+ * to prevent scrolling when using the arrow keys.
401
+ */
402
+ calendarBodyRef.addEventListener('keydown', (ev) => {
403
+ const activeElement = root.activeElement;
404
+ if (!activeElement || !activeElement.classList.contains('calendar-day')) {
405
+ return;
406
+ }
407
+ const parts = data.getPartsFromCalendarDay(activeElement);
408
+ let partsToFocus;
409
+ switch (ev.key) {
410
+ case 'ArrowDown':
411
+ ev.preventDefault();
412
+ partsToFocus = data.getNextWeek(parts);
413
+ break;
414
+ case 'ArrowUp':
415
+ ev.preventDefault();
416
+ partsToFocus = data.getPreviousWeek(parts);
417
+ break;
418
+ case 'ArrowRight':
419
+ ev.preventDefault();
420
+ partsToFocus = data.getNextDay(parts);
421
+ break;
422
+ case 'ArrowLeft':
423
+ ev.preventDefault();
424
+ partsToFocus = data.getPreviousDay(parts);
425
+ break;
426
+ case 'Home':
427
+ ev.preventDefault();
428
+ partsToFocus = data.getStartOfWeek(parts);
429
+ break;
430
+ case 'End':
431
+ ev.preventDefault();
432
+ partsToFocus = data.getEndOfWeek(parts);
433
+ break;
434
+ case 'PageUp':
435
+ ev.preventDefault();
436
+ partsToFocus = ev.shiftKey ? data.getPreviousYear(parts) : data.getPreviousMonth(parts);
437
+ break;
438
+ case 'PageDown':
439
+ ev.preventDefault();
440
+ partsToFocus = ev.shiftKey ? data.getNextYear(parts) : data.getNextMonth(parts);
441
+ break;
442
+ /**
443
+ * Do not preventDefault here
444
+ * as we do not want to override other
445
+ * browser defaults such as pressing Enter/Space
446
+ * to select a day.
447
+ */
448
+ default:
449
+ return;
450
+ }
451
+ /**
452
+ * If the day we want to move focus to is
453
+ * disabled, do not do anything.
454
+ */
455
+ if (isDayDisabled(partsToFocus, this.minParts, this.maxParts)) {
456
+ return;
457
+ }
458
+ this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), partsToFocus));
459
+ /**
460
+ * Give view a chance to re-render
461
+ * then move focus to the new working day
462
+ */
463
+ requestAnimationFrame(() => this.focusWorkingDay(currentMonth));
464
+ });
465
+ };
466
+ this.focusWorkingDay = (currentMonth) => {
467
+ /**
468
+ * Get the number of padding days so
469
+ * we know how much to offset our next selector by
470
+ * to grab the correct calenday-day element.
471
+ */
472
+ const padding = currentMonth.querySelectorAll('.calendar-day-padding');
473
+ const { day } = this.workingParts;
474
+ if (day === null) {
475
+ return;
476
+ }
477
+ /**
478
+ * Get the calendar day element
479
+ * and focus it.
480
+ */
481
+ const dayEl = currentMonth.querySelector(`.calendar-day:nth-of-type(${padding.length + day})`);
482
+ if (dayEl) {
483
+ dayEl.focus();
484
+ }
485
+ };
486
+ this.processMinParts = () => {
487
+ const { min, defaultParts } = this;
488
+ if (min === undefined) {
489
+ this.minParts = undefined;
490
+ return;
491
+ }
492
+ this.minParts = data.parseMinParts(min, defaultParts);
493
+ };
494
+ this.processMaxParts = () => {
495
+ const { max, defaultParts } = this;
496
+ if (max === undefined) {
497
+ this.maxParts = undefined;
498
+ return;
499
+ }
500
+ this.maxParts = data.parseMaxParts(max, defaultParts);
501
+ };
502
+ this.initializeCalendarListener = () => {
503
+ const calendarBodyRef = this.calendarBodyRef;
504
+ if (!calendarBodyRef) {
505
+ return;
506
+ }
507
+ /**
508
+ * For performance reasons, we only render 3
509
+ * months at a time: The current month, the previous
510
+ * month, and the next month. We have a scroll listener
511
+ * on the calendar body to append/prepend new months.
512
+ *
513
+ * We can do this because Stencil is smart enough to not
514
+ * re-create the .calendar-month containers, but rather
515
+ * update the content within those containers.
516
+ *
517
+ * As an added bonus, WebKit has some troubles with
518
+ * scroll-snap-stop: always, so not rendering all of
519
+ * the months in a row allows us to mostly sidestep
520
+ * that issue.
521
+ */
522
+ const months = calendarBodyRef.querySelectorAll('.calendar-month');
523
+ const startMonth = months[0];
524
+ const workingMonth = months[1];
525
+ const endMonth = months[2];
526
+ const mode = ionicGlobal.getIonMode(this);
527
+ const needsiOSRubberBandFix = mode === 'ios' && typeof navigator !== 'undefined' && navigator.maxTouchPoints > 1;
528
+ /**
529
+ * Before setting up the scroll listener,
530
+ * scroll the middle month into view.
531
+ * scrollIntoView() will scroll entire page
532
+ * if element is not in viewport. Use scrollLeft instead.
533
+ */
534
+ index.writeTask(() => {
535
+ calendarBodyRef.scrollLeft = startMonth.clientWidth * (dir.isRTL(this.el) ? -1 : 1);
536
+ const getChangedMonth = (parts) => {
537
+ const box = calendarBodyRef.getBoundingClientRect();
538
+ const root = this.el.shadowRoot;
539
+ /**
540
+ * Get the element that is in the center of the calendar body.
541
+ * This will be an element inside of the active month.
542
+ */
543
+ const elementAtCenter = root.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2);
544
+ /**
545
+ * If there is no element then the
546
+ * component may be re-rendering on a slow device.
547
+ */
548
+ if (!elementAtCenter)
549
+ return;
550
+ const month = elementAtCenter.closest('.calendar-month');
551
+ if (!month)
552
+ return;
553
+ /**
554
+ * The edge of the month must be lined up with
555
+ * the edge of the calendar body in order for
556
+ * the component to update. Otherwise, it
557
+ * may be the case that the user has paused their
558
+ * swipe or the browser has not finished snapping yet.
559
+ * Rather than check if the x values are equal,
560
+ * we give it a tolerance of 2px to account for
561
+ * sub pixel rendering.
562
+ */
563
+ const monthBox = month.getBoundingClientRect();
564
+ if (Math.abs(monthBox.x - box.x) > 2)
565
+ return;
566
+ /**
567
+ * From here, we can determine if the start
568
+ * month or the end month was scrolled into view.
569
+ * If no month was changed, then we can return from
570
+ * the scroll callback early.
571
+ */
572
+ if (month === startMonth) {
573
+ return data.getPreviousMonth(parts);
574
+ }
575
+ else if (month === endMonth) {
576
+ return data.getNextMonth(parts);
577
+ }
578
+ else {
579
+ return;
580
+ }
581
+ };
582
+ const updateActiveMonth = () => {
583
+ if (needsiOSRubberBandFix) {
584
+ calendarBodyRef.style.removeProperty('pointer-events');
585
+ appliediOSRubberBandFix = false;
586
+ }
587
+ /**
588
+ * If the month did not change
589
+ * then we can return early.
590
+ */
591
+ const newDate = getChangedMonth(this.workingParts);
592
+ if (!newDate)
593
+ return;
594
+ const { month, day, year } = newDate;
595
+ if (isMonthDisabled({ month, year, day: null }, {
596
+ minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
597
+ maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
598
+ })) {
599
+ return;
600
+ }
601
+ /**
602
+ * Prevent scrolling for other browsers
603
+ * to give the DOM time to update and the container
604
+ * time to properly snap.
605
+ */
606
+ calendarBodyRef.style.setProperty('overflow', 'hidden');
607
+ /**
608
+ * Use a writeTask here to ensure
609
+ * that the state is updated and the
610
+ * correct month is scrolled into view
611
+ * in the same frame. This is not
612
+ * typically a problem on newer devices
613
+ * but older/slower device may have a flicker
614
+ * if we did not do this.
615
+ */
616
+ index.writeTask(() => {
617
+ this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month, day: day, year }));
618
+ calendarBodyRef.scrollLeft = workingMonth.clientWidth * (dir.isRTL(this.el) ? -1 : 1);
619
+ calendarBodyRef.style.removeProperty('overflow');
620
+ });
621
+ };
622
+ /**
623
+ * When the container finishes scrolling we
624
+ * need to update the DOM with the selected month.
625
+ */
626
+ let scrollTimeout;
627
+ /**
628
+ * We do not want to attempt to set pointer-events
629
+ * multiple times within a single swipe gesture as
630
+ * that adds unnecessary work to the main thread.
631
+ */
632
+ let appliediOSRubberBandFix = false;
633
+ const scrollCallback = () => {
634
+ if (scrollTimeout) {
635
+ clearTimeout(scrollTimeout);
636
+ }
637
+ /**
638
+ * On iOS it is possible to quickly rubber band
639
+ * the scroll area before the scroll timeout has fired.
640
+ * This results in users reaching the end of the scrollable
641
+ * container before the DOM has updated.
642
+ * By setting `pointer-events: none` we can ensure that
643
+ * subsequent swipes do not happen while the container
644
+ * is snapping.
645
+ */
646
+ if (!appliediOSRubberBandFix && needsiOSRubberBandFix) {
647
+ calendarBodyRef.style.setProperty('pointer-events', 'none');
648
+ appliediOSRubberBandFix = true;
649
+ }
650
+ // Wait ~3 frames
651
+ scrollTimeout = setTimeout(updateActiveMonth, 50);
652
+ };
653
+ calendarBodyRef.addEventListener('scroll', scrollCallback);
654
+ this.destroyCalendarListener = () => {
655
+ calendarBodyRef.removeEventListener('scroll', scrollCallback);
656
+ };
657
+ });
658
+ };
659
+ /**
660
+ * Clean up all listeners except for the overlay
661
+ * listener. This is so that we can re-create the listeners
662
+ * if the datetime has been hidden/presented by a modal or popover.
663
+ */
664
+ this.destroyInteractionListeners = () => {
665
+ const { destroyCalendarListener, destroyKeyboardMO } = this;
666
+ if (destroyCalendarListener !== undefined) {
667
+ destroyCalendarListener();
668
+ }
669
+ if (destroyKeyboardMO !== undefined) {
670
+ destroyKeyboardMO();
671
+ }
672
+ };
673
+ this.processValue = (value) => {
674
+ /**
675
+ * TODO FW-2646 remove value !== ''
676
+ */
677
+ const hasValue = value !== '' && value !== null && value !== undefined;
678
+ let valueToProcess = hasValue ? data.parseDate(value) : this.defaultParts;
679
+ const { minParts, maxParts, multiple } = this;
680
+ if (!multiple && Array.isArray(value)) {
681
+ this.value = value[0];
682
+ valueToProcess = valueToProcess[0];
683
+ }
684
+ /**
685
+ * Datetime should only warn of out of bounds values
686
+ * if set by the user. If the `value` is undefined,
687
+ * we will default to today's date which may be out
688
+ * of bounds. In this case, the warning makes it look
689
+ * like the developer did something wrong which is
690
+ * not true.
691
+ */
692
+ if (hasValue) {
693
+ data.warnIfValueOutOfBounds(valueToProcess, minParts, maxParts);
694
+ }
695
+ /**
696
+ * If there are multiple values, pick an arbitrary one to clamp to. This way,
697
+ * if the values are across months, we always show at least one of them. Note
698
+ * that the values don't necessarily have to be in order.
699
+ */
700
+ const singleValue = Array.isArray(valueToProcess) ? valueToProcess[0] : valueToProcess;
701
+ const { month, day, year, hour, minute, tzOffset } = data.clampDate(singleValue, minParts, maxParts);
702
+ const ampm = data.parseAmPm(hour);
703
+ this.setWorkingParts({
704
+ month,
705
+ day,
706
+ year,
707
+ hour,
708
+ minute,
709
+ tzOffset,
710
+ ampm,
711
+ });
712
+ /**
713
+ * Since `activeParts` indicates a value that
714
+ * been explicitly selected either by the
715
+ * user or the app, only update `activeParts`
716
+ * if the `value` property is set.
717
+ */
718
+ if (hasValue) {
719
+ if (Array.isArray(valueToProcess)) {
720
+ this.activeParts = [...valueToProcess];
721
+ }
722
+ else {
723
+ this.activeParts = {
724
+ month,
725
+ day,
726
+ year,
727
+ hour,
728
+ minute,
729
+ tzOffset,
730
+ ampm,
731
+ };
732
+ }
733
+ }
734
+ else {
735
+ /**
736
+ * Reset the active parts if the value is not set.
737
+ * This will clear the selected calendar day when
738
+ * performing a clear action or using the reset() method.
739
+ */
740
+ this.activeParts = [];
741
+ }
616
742
  };
617
743
  this.onFocus = () => {
618
744
  this.ionFocus.emit();
@@ -620,370 +746,936 @@ const Datetime = class {
620
746
  this.onBlur = () => {
621
747
  this.ionBlur.emit();
622
748
  };
749
+ this.hasValue = () => {
750
+ return this.value != null && this.value !== '';
751
+ };
752
+ this.nextMonth = () => {
753
+ const calendarBodyRef = this.calendarBodyRef;
754
+ if (!calendarBodyRef) {
755
+ return;
756
+ }
757
+ const nextMonth = calendarBodyRef.querySelector('.calendar-month:last-of-type');
758
+ if (!nextMonth) {
759
+ return;
760
+ }
761
+ const left = nextMonth.offsetWidth * 2;
762
+ calendarBodyRef.scrollTo({
763
+ top: 0,
764
+ left: left * (dir.isRTL(this.el) ? -1 : 1),
765
+ behavior: 'smooth',
766
+ });
767
+ };
768
+ this.prevMonth = () => {
769
+ const calendarBodyRef = this.calendarBodyRef;
770
+ if (!calendarBodyRef) {
771
+ return;
772
+ }
773
+ const prevMonth = calendarBodyRef.querySelector('.calendar-month:first-of-type');
774
+ if (!prevMonth) {
775
+ return;
776
+ }
777
+ calendarBodyRef.scrollTo({
778
+ top: 0,
779
+ left: 0,
780
+ behavior: 'smooth',
781
+ });
782
+ };
783
+ this.toggleMonthAndYearView = () => {
784
+ this.showMonthAndYear = !this.showMonthAndYear;
785
+ };
623
786
  }
624
787
  disabledChanged() {
625
788
  this.emitStyle();
626
789
  }
790
+ minChanged() {
791
+ this.processMinParts();
792
+ }
793
+ maxChanged() {
794
+ this.processMaxParts();
795
+ }
796
+ yearValuesChanged() {
797
+ this.parsedYearValues = data.convertToArrayOfNumbers(this.yearValues);
798
+ }
799
+ monthValuesChanged() {
800
+ this.parsedMonthValues = data.convertToArrayOfNumbers(this.monthValues);
801
+ }
802
+ dayValuesChanged() {
803
+ this.parsedDayValues = data.convertToArrayOfNumbers(this.dayValues);
804
+ }
805
+ hourValuesChanged() {
806
+ this.parsedHourValues = data.convertToArrayOfNumbers(this.hourValues);
807
+ }
808
+ minuteValuesChanged() {
809
+ this.parsedMinuteValues = data.convertToArrayOfNumbers(this.minuteValues);
810
+ }
811
+ activePartsChanged() {
812
+ this.activePartsClone = this.activeParts;
813
+ }
627
814
  /**
628
815
  * Update the datetime value when the value changes
629
816
  */
630
817
  valueChanged() {
631
- this.updateDatetimeValue(this.value);
818
+ const { value, minParts, maxParts, workingParts, multiple } = this;
819
+ if (this.hasValue()) {
820
+ if (!multiple && Array.isArray(value)) {
821
+ this.value = value[0];
822
+ return; // setting this.value will trigger re-run of this function
823
+ }
824
+ /**
825
+ * Clones the value of the `activeParts` to the private clone, to update
826
+ * the date display on the current render cycle without causing another render.
827
+ *
828
+ * This allows us to update the current value's date/time display without
829
+ * refocusing or shifting the user's display (leaves the user in place).
830
+ */
831
+ const valueDateParts = data.parseDate(value);
832
+ if (valueDateParts) {
833
+ data.warnIfValueOutOfBounds(valueDateParts, minParts, maxParts);
834
+ if (Array.isArray(valueDateParts)) {
835
+ this.activePartsClone = [...valueDateParts];
836
+ }
837
+ else {
838
+ const { month, day, year, hour, minute } = valueDateParts;
839
+ const ampm = hour != null ? (hour >= 12 ? 'pm' : 'am') : undefined;
840
+ this.activePartsClone = Object.assign(Object.assign({}, this.activeParts), { month,
841
+ day,
842
+ year,
843
+ hour,
844
+ minute,
845
+ ampm });
846
+ /**
847
+ * The working parts am/pm value must be updated when the value changes, to
848
+ * ensure the time picker hour column values are generated correctly.
849
+ *
850
+ * Note that we don't need to do this if valueDateParts is an array, since
851
+ * multiple="true" does not apply to time pickers.
852
+ */
853
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm }));
854
+ }
855
+ }
856
+ else {
857
+ index$1.printIonWarning(`Unable to parse date string: ${value}. Please provide a valid ISO 8601 datetime string.`);
858
+ }
859
+ }
632
860
  this.emitStyle();
633
- this.ionChange.emit({
634
- value: this.value
635
- });
861
+ this.ionChange.emit({ value });
636
862
  }
637
- componentWillLoad() {
638
- // first see if locale names were provided in the inputs
639
- // then check to see if they're in the config
640
- // if neither were provided then it will use default English names
641
- this.locale = {
642
- // this.locale[type] = convertToArrayOfStrings((this[type] ? this[type] : this.config.get(type), type);
643
- monthNames: convertToArrayOfStrings(this.monthNames, 'monthNames'),
644
- monthShortNames: convertToArrayOfStrings(this.monthShortNames, 'monthShortNames'),
645
- dayNames: convertToArrayOfStrings(this.dayNames, 'dayNames'),
646
- dayShortNames: convertToArrayOfStrings(this.dayShortNames, 'dayShortNames')
863
+ /**
864
+ * Confirms the selected datetime value, updates the
865
+ * `value` property, and optionally closes the popover
866
+ * or modal that the datetime was presented in.
867
+ */
868
+ async confirm(closeOverlay = false) {
869
+ const { isCalendarPicker, activeParts } = this;
870
+ /**
871
+ * We only update the value if the presentation is not a calendar picker.
872
+ */
873
+ if (activeParts !== undefined || !isCalendarPicker) {
874
+ const activePartsIsArray = Array.isArray(activeParts);
875
+ if (activePartsIsArray && activeParts.length === 0) {
876
+ this.value = undefined;
877
+ }
878
+ else {
879
+ /**
880
+ * Prevent convertDataToISO from doing any
881
+ * kind of transformation based on timezone
882
+ * This cancels out any change it attempts to make
883
+ *
884
+ * Important: Take the timezone offset based on
885
+ * the date that is currently selected, otherwise
886
+ * there can be 1 hr difference when dealing w/ DST
887
+ */
888
+ if (activePartsIsArray) {
889
+ const dates = data.convertDataToISO(activeParts).map((str) => new Date(str));
890
+ for (let i = 0; i < dates.length; i++) {
891
+ activeParts[i].tzOffset = dates[i].getTimezoneOffset() * -1;
892
+ }
893
+ }
894
+ else {
895
+ const date = new Date(data.convertDataToISO(activeParts));
896
+ activeParts.tzOffset = date.getTimezoneOffset() * -1;
897
+ }
898
+ this.value = data.convertDataToISO(activeParts);
899
+ }
900
+ }
901
+ if (closeOverlay) {
902
+ this.closeParentOverlay();
903
+ }
904
+ }
905
+ /**
906
+ * Resets the internal state of the datetime but does not update the value.
907
+ * Passing a valid ISO-8601 string will reset the state of the component to the provided date.
908
+ * If no value is provided, the internal state will be reset to the clamped value of the min, max and today.
909
+ */
910
+ async reset(startDate) {
911
+ this.processValue(startDate);
912
+ }
913
+ /**
914
+ * Emits the ionCancel event and
915
+ * optionally closes the popover
916
+ * or modal that the datetime was
917
+ * presented in.
918
+ */
919
+ async cancel(closeOverlay = false) {
920
+ this.ionCancel.emit();
921
+ if (closeOverlay) {
922
+ this.closeParentOverlay();
923
+ }
924
+ }
925
+ get isCalendarPicker() {
926
+ const { presentation } = this;
927
+ return presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
928
+ }
929
+ connectedCallback() {
930
+ this.clearFocusVisible = focusVisible.startFocusVisible(this.el).destroy;
931
+ }
932
+ disconnectedCallback() {
933
+ if (this.clearFocusVisible) {
934
+ this.clearFocusVisible();
935
+ this.clearFocusVisible = undefined;
936
+ }
937
+ }
938
+ initializeListeners() {
939
+ this.initializeCalendarListener();
940
+ this.initializeKeyboardListeners();
941
+ }
942
+ componentDidLoad() {
943
+ /**
944
+ * If a scrollable element is hidden using `display: none`,
945
+ * it will not have a scroll height meaning we cannot scroll elements
946
+ * into view. As a result, we will need to wait for the datetime to become
947
+ * visible if used inside of a modal or a popover otherwise the scrollable
948
+ * areas will not have the correct values snapped into place.
949
+ */
950
+ const visibleCallback = (entries) => {
951
+ const ev = entries[0];
952
+ if (!ev.isIntersecting) {
953
+ return;
954
+ }
955
+ this.initializeListeners();
956
+ /**
957
+ * TODO FW-2793: Datetime needs a frame to ensure that it
958
+ * can properly scroll contents into view. As a result
959
+ * we hide the scrollable content until after that frame
960
+ * so users do not see the content quickly shifting. The downside
961
+ * is that the content will pop into view a frame after. Maybe there
962
+ * is a better way to handle this?
963
+ */
964
+ index.writeTask(() => {
965
+ this.el.classList.add('datetime-ready');
966
+ });
647
967
  };
648
- this.updateDatetimeValue(this.value);
649
- this.emitStyle();
968
+ const visibleIO = new IntersectionObserver(visibleCallback, { threshold: 0.01 });
969
+ /**
970
+ * Use raf to avoid a race condition between the component loading and
971
+ * its display animation starting (such as when shown in a modal). This
972
+ * could cause the datetime to start at a visibility of 0, erroneously
973
+ * triggering the `hiddenIO` observer below.
974
+ */
975
+ helpers.raf(() => visibleIO === null || visibleIO === void 0 ? void 0 : visibleIO.observe(this.el));
976
+ /**
977
+ * We need to clean up listeners when the datetime is hidden
978
+ * in a popover/modal so that we can properly scroll containers
979
+ * back into view if they are re-presented. When the datetime is hidden
980
+ * the scroll areas have scroll widths/heights of 0px, so any snapping
981
+ * we did originally has been lost.
982
+ */
983
+ const hiddenCallback = (entries) => {
984
+ const ev = entries[0];
985
+ if (ev.isIntersecting) {
986
+ return;
987
+ }
988
+ this.destroyInteractionListeners();
989
+ /**
990
+ * When datetime is hidden, we need to make sure that
991
+ * the month/year picker is closed. Otherwise,
992
+ * it will be open when the datetime re-appears
993
+ * and the scroll area of the calendar grid will be 0.
994
+ * As a result, the wrong month will be shown.
995
+ */
996
+ this.showMonthAndYear = false;
997
+ index.writeTask(() => {
998
+ this.el.classList.remove('datetime-ready');
999
+ });
1000
+ };
1001
+ const hiddenIO = new IntersectionObserver(hiddenCallback, { threshold: 0 });
1002
+ helpers.raf(() => hiddenIO === null || hiddenIO === void 0 ? void 0 : hiddenIO.observe(this.el));
1003
+ /**
1004
+ * Datetime uses Ionic components that emit
1005
+ * ionFocus and ionBlur. These events are
1006
+ * composed meaning they will cross
1007
+ * the shadow dom boundary. We need to
1008
+ * stop propagation on these events otherwise
1009
+ * developers will see 2 ionFocus or 2 ionBlur
1010
+ * events at a time.
1011
+ */
1012
+ const root = helpers.getElementRoot(this.el);
1013
+ root.addEventListener('ionFocus', (ev) => ev.stopPropagation());
1014
+ root.addEventListener('ionBlur', (ev) => ev.stopPropagation());
650
1015
  }
651
1016
  /**
652
- * Opens the datetime overlay.
1017
+ * When the presentation is changed, all calendar content is recreated,
1018
+ * so we need to re-init behavior with the new elements.
653
1019
  */
654
- async open() {
655
- if (this.disabled || this.isExpanded) {
1020
+ componentDidRender() {
1021
+ const { presentation, prevPresentation, calendarBodyRef, minParts, preferWheel } = this;
1022
+ /**
1023
+ * TODO(FW-2165)
1024
+ * Remove this when https://bugs.webkit.org/show_bug.cgi?id=235960 is fixed.
1025
+ * When using `min`, we add `scroll-snap-align: none`
1026
+ * to the disabled month so that users cannot scroll to it.
1027
+ * This triggers a bug in WebKit where the scroll position is reset.
1028
+ * Since the month change logic is handled by a scroll listener,
1029
+ * this causes the month to change leading to `scroll-snap-align`
1030
+ * changing again, thus changing the scroll position again and causing
1031
+ * an infinite loop.
1032
+ * This issue only applies to the calendar grid, so we can disable
1033
+ * it if the calendar grid is not being used.
1034
+ */
1035
+ const hasCalendarGrid = !preferWheel && ['date-time', 'time-date', 'date'].includes(presentation);
1036
+ if (minParts !== undefined && hasCalendarGrid && calendarBodyRef) {
1037
+ const workingMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(1)');
1038
+ if (workingMonth) {
1039
+ calendarBodyRef.scrollLeft = workingMonth.clientWidth * (dir.isRTL(this.el) ? -1 : 1);
1040
+ }
1041
+ }
1042
+ if (prevPresentation === null) {
1043
+ this.prevPresentation = presentation;
656
1044
  return;
657
1045
  }
658
- const pickerOptions = this.generatePickerOptions();
659
- const picker = await overlays.pickerController.create(pickerOptions);
660
- this.isExpanded = true;
661
- picker.onDidDismiss().then(() => {
662
- this.isExpanded = false;
663
- this.setFocus();
1046
+ if (presentation === prevPresentation) {
1047
+ return;
1048
+ }
1049
+ this.prevPresentation = presentation;
1050
+ this.destroyInteractionListeners();
1051
+ this.initializeListeners();
1052
+ /**
1053
+ * The month/year picker from the date interface
1054
+ * should be closed as it is not available in non-date
1055
+ * interfaces.
1056
+ */
1057
+ this.showMonthAndYear = false;
1058
+ helpers.raf(() => {
1059
+ this.ionRender.emit();
664
1060
  });
665
- helpers.addEventListener(picker, 'ionPickerColChange', async (event) => {
666
- const data = event.detail;
667
- const colSelectedIndex = data.selectedIndex;
668
- const colOptions = data.options;
669
- const changeData = {};
670
- changeData[data.name] = {
671
- value: colOptions[colSelectedIndex].value
672
- };
673
- if (data.name !== 'ampm' && this.datetimeValue.ampm !== undefined) {
674
- changeData['ampm'] = {
675
- value: this.datetimeValue.ampm
676
- };
1061
+ }
1062
+ componentWillLoad() {
1063
+ const { el, multiple, presentation, preferWheel } = this;
1064
+ if (multiple) {
1065
+ if (presentation !== 'date') {
1066
+ index$1.printIonWarning('Multiple date selection is only supported for presentation="date".', el);
677
1067
  }
678
- this.updateDatetimeValue(changeData);
679
- picker.columns = this.generateColumns();
680
- });
681
- await picker.present();
1068
+ if (preferWheel) {
1069
+ index$1.printIonWarning('Multiple date selection is not supported with preferWheel="true".', el);
1070
+ }
1071
+ }
1072
+ this.processMinParts();
1073
+ this.processMaxParts();
1074
+ const hourValues = (this.parsedHourValues = data.convertToArrayOfNumbers(this.hourValues));
1075
+ const minuteValues = (this.parsedMinuteValues = data.convertToArrayOfNumbers(this.minuteValues));
1076
+ const monthValues = (this.parsedMonthValues = data.convertToArrayOfNumbers(this.monthValues));
1077
+ const yearValues = (this.parsedYearValues = data.convertToArrayOfNumbers(this.yearValues));
1078
+ const dayValues = (this.parsedDayValues = data.convertToArrayOfNumbers(this.dayValues));
1079
+ const todayParts = (this.todayParts = data.parseDate(data.getToday()));
1080
+ this.defaultParts = data.getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
1081
+ this.processValue(this.value);
1082
+ this.emitStyle();
682
1083
  }
683
1084
  emitStyle() {
684
1085
  this.ionStyle.emit({
685
- 'interactive': true,
686
- 'datetime': true,
687
- 'has-placeholder': this.placeholder != null,
688
- 'has-value': this.hasValue(),
1086
+ interactive: true,
1087
+ datetime: true,
689
1088
  'interactive-disabled': this.disabled,
690
1089
  });
691
1090
  }
692
- updateDatetimeValue(value) {
693
- updateDate(this.datetimeValue, value, this.displayTimezone);
694
- }
695
- generatePickerOptions() {
696
- const mode = ionicGlobal.getIonMode(this);
697
- this.locale = {
698
- monthNames: convertToArrayOfStrings(this.monthNames, 'monthNames'),
699
- monthShortNames: convertToArrayOfStrings(this.monthShortNames, 'monthShortNames'),
700
- dayNames: convertToArrayOfStrings(this.dayNames, 'dayNames'),
701
- dayShortNames: convertToArrayOfStrings(this.dayShortNames, 'dayShortNames')
1091
+ /**
1092
+ * Universal render methods
1093
+ * These are pieces of datetime that
1094
+ * are rendered independently of presentation.
1095
+ */
1096
+ renderFooter() {
1097
+ const { showDefaultButtons, showClearButton } = this;
1098
+ const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
1099
+ if (!hasSlottedButtons && !showDefaultButtons && !showClearButton) {
1100
+ return;
1101
+ }
1102
+ const clearButtonClick = () => {
1103
+ this.reset();
1104
+ this.value = undefined;
702
1105
  };
703
- const pickerOptions = Object.assign(Object.assign({ mode }, this.pickerOptions), { columns: this.generateColumns() });
704
- // If the user has not passed in picker buttons,
705
- // add a cancel and ok button to the picker
706
- const buttons = pickerOptions.buttons;
707
- if (!buttons || buttons.length === 0) {
708
- pickerOptions.buttons = [
709
- {
710
- text: this.cancelText,
711
- role: 'cancel',
712
- handler: () => {
713
- this.updateDatetimeValue(this.value);
714
- this.ionCancel.emit();
715
- }
716
- },
717
- {
718
- text: this.doneText,
719
- handler: (data) => {
720
- this.updateDatetimeValue(data);
721
- /**
722
- * Prevent convertDataToISO from doing any
723
- * kind of transformation based on timezone
724
- * This cancels out any change it attempts to make
725
- *
726
- * Important: Take the timezone offset based on
727
- * the date that is currently selected, otherwise
728
- * there can be 1 hr difference when dealing w/ DST
729
- */
730
- const date = new Date(convertDataToISO(this.datetimeValue));
731
- // If a custom display timezone is provided, use that tzOffset value instead
732
- this.datetimeValue.tzOffset = (this.displayTimezone !== undefined && this.displayTimezone.length > 0)
733
- ? ((getTimezoneOffset(date, this.displayTimezone)) / 1000 / 60) * -1
734
- : date.getTimezoneOffset() * -1;
735
- this.value = convertDataToISO(this.datetimeValue);
736
- }
1106
+ /**
1107
+ * By default we render two buttons:
1108
+ * Cancel - Dismisses the datetime and
1109
+ * does not update the `value` prop.
1110
+ * OK - Dismisses the datetime and
1111
+ * updates the `value` prop.
1112
+ */
1113
+ return (index.h("div", { class: "datetime-footer" }, index.h("div", { class: "datetime-buttons" }, index.h("div", { class: {
1114
+ ['datetime-action-buttons']: true,
1115
+ ['has-clear-button']: this.showClearButton,
1116
+ } }, 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) }, this.cancelText)), index.h("div", null, showClearButton && (index.h("ion-button", { id: "clear-button", color: this.color, onClick: () => clearButtonClick() }, this.clearText)), showDefaultButtons && (index.h("ion-button", { id: "confirm-button", color: this.color, onClick: () => this.confirm(true) }, this.doneText)))))))));
1117
+ }
1118
+ /**
1119
+ * Wheel picker render methods
1120
+ */
1121
+ renderWheelPicker(forcePresentation = this.presentation) {
1122
+ /**
1123
+ * If presentation="time-date" we switch the
1124
+ * order of the render array here instead of
1125
+ * manually reordering each date/time picker
1126
+ * column with CSS. This allows for additional
1127
+ * flexibility if we need to render subsets
1128
+ * of the date/time data or do additional ordering
1129
+ * within the child render functions.
1130
+ */
1131
+ const renderArray = forcePresentation === 'time-date'
1132
+ ? [this.renderTimePickerColumns(forcePresentation), this.renderDatePickerColumns(forcePresentation)]
1133
+ : [this.renderDatePickerColumns(forcePresentation), this.renderTimePickerColumns(forcePresentation)];
1134
+ return index.h("ion-picker-internal", null, renderArray);
1135
+ }
1136
+ renderDatePickerColumns(forcePresentation) {
1137
+ return forcePresentation === 'date-time' || forcePresentation === 'time-date'
1138
+ ? this.renderCombinedDatePickerColumn()
1139
+ : this.renderIndividualDatePickerColumns(forcePresentation);
1140
+ }
1141
+ renderCombinedDatePickerColumn() {
1142
+ const { defaultParts, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
1143
+ const activePart = this.getActivePartsWithFallback();
1144
+ /**
1145
+ * By default, generate a range of 3 months:
1146
+ * Previous month, current month, and next month
1147
+ */
1148
+ const monthsToRender = data.generateMonths(workingParts);
1149
+ const lastMonth = monthsToRender[monthsToRender.length - 1];
1150
+ /**
1151
+ * Ensure that users can select the entire window of dates.
1152
+ */
1153
+ monthsToRender[0].day = 1;
1154
+ lastMonth.day = data.getNumDaysInMonth(lastMonth.month, lastMonth.year);
1155
+ /**
1156
+ * Narrow the dates rendered based on min/max dates (if any).
1157
+ * The `min` date is used if the min is after the generated min month.
1158
+ * The `max` date is used if the max is before the generated max month.
1159
+ * This ensures that the sliding window always stays at 3 months
1160
+ * but still allows future dates to be lazily rendered based on any min/max
1161
+ * constraints.
1162
+ */
1163
+ const min = minParts !== undefined && data.isAfter(minParts, monthsToRender[0]) ? minParts : monthsToRender[0];
1164
+ const max = maxParts !== undefined && data.isBefore(maxParts, lastMonth) ? maxParts : lastMonth;
1165
+ const result = data.getCombinedDateColumnData(locale, todayParts, min, max, this.parsedDayValues, this.parsedMonthValues);
1166
+ let items = result.items;
1167
+ const parts = result.parts;
1168
+ if (isDateEnabled) {
1169
+ items = items.map((itemObject, index) => {
1170
+ const referenceParts = parts[index];
1171
+ let disabled;
1172
+ try {
1173
+ /**
1174
+ * The `isDateEnabled` implementation is try-catch wrapped
1175
+ * to prevent exceptions in the user's function from
1176
+ * interrupting the calendar rendering.
1177
+ */
1178
+ disabled = !isDateEnabled(data.convertDataToISO(referenceParts));
1179
+ }
1180
+ catch (e) {
1181
+ index$1.printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
737
1182
  }
1183
+ return Object.assign(Object.assign({}, itemObject), { disabled });
1184
+ });
1185
+ }
1186
+ /**
1187
+ * If we have selected a day already, then default the column
1188
+ * to that value. Otherwise, set it to the default date.
1189
+ */
1190
+ const todayString = workingParts.day !== null
1191
+ ? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
1192
+ : `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
1193
+ return (index.h("ion-picker-column-internal", { class: "date-column", color: this.color, items: items, value: todayString, onIonChange: (ev) => {
1194
+ // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1195
+ // Due to a Safari 14 issue we need to destroy
1196
+ // the scroll listener before we update state
1197
+ // and trigger a re-render.
1198
+ if (this.destroyCalendarListener) {
1199
+ this.destroyCalendarListener();
1200
+ }
1201
+ const { value } = ev.detail;
1202
+ const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
1203
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
1204
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), findPart));
1205
+ // We can re-attach the scroll listener after
1206
+ // the working parts have been updated.
1207
+ this.initializeCalendarListener();
1208
+ ev.stopPropagation();
1209
+ } }));
1210
+ }
1211
+ renderIndividualDatePickerColumns(forcePresentation) {
1212
+ const { workingParts, isDateEnabled } = this;
1213
+ const shouldRenderMonths = forcePresentation !== 'year' && forcePresentation !== 'time';
1214
+ const months = shouldRenderMonths
1215
+ ? data.getMonthColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedMonthValues)
1216
+ : [];
1217
+ const shouldRenderDays = forcePresentation === 'date';
1218
+ let days = shouldRenderDays
1219
+ ? data.getDayColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedDayValues)
1220
+ : [];
1221
+ if (isDateEnabled) {
1222
+ days = days.map((dayObject) => {
1223
+ const { value } = dayObject;
1224
+ const valueNum = typeof value === 'string' ? parseInt(value) : value;
1225
+ const referenceParts = {
1226
+ month: workingParts.month,
1227
+ day: valueNum,
1228
+ year: workingParts.year,
1229
+ };
1230
+ let disabled;
1231
+ try {
1232
+ /**
1233
+ * The `isDateEnabled` implementation is try-catch wrapped
1234
+ * to prevent exceptions in the user's function from
1235
+ * interrupting the calendar rendering.
1236
+ */
1237
+ disabled = !isDateEnabled(data.convertDataToISO(referenceParts));
1238
+ }
1239
+ catch (e) {
1240
+ index$1.printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
1241
+ }
1242
+ return Object.assign(Object.assign({}, dayObject), { disabled });
1243
+ });
1244
+ }
1245
+ const shouldRenderYears = forcePresentation !== 'month' && forcePresentation !== 'time';
1246
+ const years = shouldRenderYears
1247
+ ? data.getYearColumnData(this.locale, this.defaultParts, this.minParts, this.maxParts, this.parsedYearValues)
1248
+ : [];
1249
+ /**
1250
+ * Certain locales show the day before the month.
1251
+ */
1252
+ const showMonthFirst = data.isMonthFirstLocale(this.locale, { month: 'numeric', day: 'numeric' });
1253
+ let renderArray = [];
1254
+ if (showMonthFirst) {
1255
+ renderArray = [
1256
+ this.renderMonthPickerColumn(months),
1257
+ this.renderDayPickerColumn(days),
1258
+ this.renderYearPickerColumn(years),
738
1259
  ];
739
1260
  }
740
- return pickerOptions;
1261
+ else {
1262
+ renderArray = [
1263
+ this.renderDayPickerColumn(days),
1264
+ this.renderMonthPickerColumn(months),
1265
+ this.renderYearPickerColumn(years),
1266
+ ];
1267
+ }
1268
+ return renderArray;
741
1269
  }
742
- generateColumns() {
743
- // if a picker format wasn't provided, then fallback
744
- // to use the display format
745
- let template = this.pickerFormat || this.displayFormat || DEFAULT_FORMAT;
746
- if (template.length === 0) {
1270
+ renderDayPickerColumn(days) {
1271
+ var _a;
1272
+ if (days.length === 0) {
747
1273
  return [];
748
1274
  }
749
- // make sure we've got up to date sizing information
750
- this.calcMinMax();
751
- // does not support selecting by day name
752
- // automatically remove any day name formats
753
- template = template.replace('DDDD', '{~}').replace('DDD', '{~}');
754
- if (template.indexOf('D') === -1) {
755
- // there is not a day in the template
756
- // replace the day name with a numeric one if it exists
757
- template = template.replace('{~}', 'D');
758
- }
759
- // make sure no day name replacer is left in the string
760
- template = template.replace(/{~}/g, '');
761
- // parse apart the given template into an array of "formats"
762
- const columns = parseTemplate(template).map((format) => {
763
- // loop through each format in the template
764
- // create a new picker column to build up with data
765
- const key = convertFormatToKey(format);
766
- let values;
767
- // check if they have exact values to use for this date part
768
- // otherwise use the default date part values
769
- const self = this;
770
- values = self[key + 'Values']
771
- ? convertToArrayOfNumbers(self[key + 'Values'], key)
772
- : dateValueRange(format, this.datetimeMin, this.datetimeMax);
773
- const colOptions = values.map(val => {
774
- return {
775
- value: val,
776
- text: renderTextFormat(format, val, undefined, this.locale),
777
- };
778
- });
779
- // cool, we've loaded up the columns with options
780
- // preselect the option for this column
781
- const optValue = getDateValue(this.datetimeValue, format);
782
- const selectedIndex = colOptions.findIndex(opt => opt.value === optValue);
783
- return {
784
- name: key,
785
- selectedIndex: selectedIndex >= 0 ? selectedIndex : 0,
786
- options: colOptions
787
- };
788
- });
789
- // Normalize min/max
790
- const min = this.datetimeMin;
791
- const max = this.datetimeMax;
792
- ['month', 'day', 'hour', 'minute']
793
- .filter(name => !columns.find(column => column.name === name))
794
- .forEach(name => {
795
- min[name] = 0;
796
- max[name] = 0;
797
- });
798
- return this.validateColumns(divyColumns(columns));
799
- }
800
- validateColumns(columns) {
801
- const today = new Date();
802
- const minCompareVal = dateDataSortValue(this.datetimeMin);
803
- const maxCompareVal = dateDataSortValue(this.datetimeMax);
804
- const yearCol = columns.find(c => c.name === 'year');
805
- let selectedYear = today.getFullYear();
806
- if (yearCol) {
807
- // default to the first value if the current year doesn't exist in the options
808
- if (!yearCol.options.find(col => col.value === today.getFullYear())) {
809
- selectedYear = yearCol.options[0].value;
810
- }
811
- const selectedIndex = yearCol.selectedIndex;
812
- if (selectedIndex !== undefined) {
813
- const yearOpt = yearCol.options[selectedIndex];
814
- if (yearOpt) {
815
- // they have a selected year value
816
- selectedYear = yearOpt.value;
1275
+ const { workingParts } = this;
1276
+ const activePart = this.getActivePartsWithFallback();
1277
+ return (index.h("ion-picker-column-internal", { class: "day-column", color: this.color, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
1278
+ // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1279
+ // Due to a Safari 14 issue we need to destroy
1280
+ // the scroll listener before we update state
1281
+ // and trigger a re-render.
1282
+ if (this.destroyCalendarListener) {
1283
+ this.destroyCalendarListener();
817
1284
  }
818
- }
1285
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
1286
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
1287
+ // We can re-attach the scroll listener after
1288
+ // the working parts have been updated.
1289
+ this.initializeCalendarListener();
1290
+ ev.stopPropagation();
1291
+ } }));
1292
+ }
1293
+ renderMonthPickerColumn(months) {
1294
+ if (months.length === 0) {
1295
+ return [];
819
1296
  }
820
- const selectedMonth = this.validateColumn(columns, 'month', 1, minCompareVal, maxCompareVal, [selectedYear, 0, 0, 0, 0], [selectedYear, 12, 31, 23, 59]);
821
- const numDaysInMonth = daysInMonth(selectedMonth, selectedYear);
822
- const selectedDay = this.validateColumn(columns, 'day', 2, minCompareVal, maxCompareVal, [selectedYear, selectedMonth, 0, 0, 0], [selectedYear, selectedMonth, numDaysInMonth, 23, 59]);
823
- const selectedHour = this.validateColumn(columns, 'hour', 3, minCompareVal, maxCompareVal, [selectedYear, selectedMonth, selectedDay, 0, 0], [selectedYear, selectedMonth, selectedDay, 23, 59]);
824
- this.validateColumn(columns, 'minute', 4, minCompareVal, maxCompareVal, [selectedYear, selectedMonth, selectedDay, selectedHour, 0], [selectedYear, selectedMonth, selectedDay, selectedHour, 59]);
825
- return columns;
826
- }
827
- calcMinMax() {
828
- const todaysYear = new Date().getFullYear();
829
- if (this.yearValues !== undefined) {
830
- const years = convertToArrayOfNumbers(this.yearValues, 'year');
831
- if (this.min === undefined) {
832
- this.min = Math.min(...years).toString();
833
- }
834
- if (this.max === undefined) {
835
- this.max = Math.max(...years).toString();
836
- }
1297
+ const { workingParts } = this;
1298
+ const activePart = this.getActivePartsWithFallback();
1299
+ return (index.h("ion-picker-column-internal", { class: "month-column", color: this.color, items: months, value: workingParts.month, onIonChange: (ev) => {
1300
+ // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1301
+ // Due to a Safari 14 issue we need to destroy
1302
+ // the scroll listener before we update state
1303
+ // and trigger a re-render.
1304
+ if (this.destroyCalendarListener) {
1305
+ this.destroyCalendarListener();
1306
+ }
1307
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
1308
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
1309
+ // We can re-attach the scroll listener after
1310
+ // the working parts have been updated.
1311
+ this.initializeCalendarListener();
1312
+ ev.stopPropagation();
1313
+ } }));
1314
+ }
1315
+ renderYearPickerColumn(years) {
1316
+ if (years.length === 0) {
1317
+ return [];
837
1318
  }
838
- else {
839
- if (this.min === undefined) {
840
- this.min = (todaysYear - 100).toString();
841
- }
842
- if (this.max === undefined) {
843
- this.max = todaysYear.toString();
844
- }
1319
+ const { workingParts } = this;
1320
+ const activePart = this.getActivePartsWithFallback();
1321
+ return (index.h("ion-picker-column-internal", { class: "year-column", color: this.color, items: years, value: workingParts.year, onIonChange: (ev) => {
1322
+ // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1323
+ // Due to a Safari 14 issue we need to destroy
1324
+ // the scroll listener before we update state
1325
+ // and trigger a re-render.
1326
+ if (this.destroyCalendarListener) {
1327
+ this.destroyCalendarListener();
1328
+ }
1329
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
1330
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), { year: ev.detail.value }));
1331
+ // We can re-attach the scroll listener after
1332
+ // the working parts have been updated.
1333
+ this.initializeCalendarListener();
1334
+ ev.stopPropagation();
1335
+ } }));
1336
+ }
1337
+ renderTimePickerColumns(forcePresentation) {
1338
+ if (['date', 'month', 'month-year', 'year'].includes(forcePresentation)) {
1339
+ return [];
845
1340
  }
846
- const min = this.datetimeMin = parseDate(this.min);
847
- const max = this.datetimeMax = parseDate(this.max);
848
- min.year = min.year || todaysYear;
849
- max.year = max.year || todaysYear;
850
- min.month = min.month || 1;
851
- max.month = max.month || 12;
852
- min.day = min.day || 1;
853
- max.day = max.day || 31;
854
- min.hour = min.hour || 0;
855
- max.hour = max.hour === undefined ? 23 : max.hour;
856
- min.minute = min.minute || 0;
857
- max.minute = max.minute === undefined ? 59 : max.minute;
858
- min.second = min.second || 0;
859
- max.second = max.second === undefined ? 59 : max.second;
860
- // Ensure min/max constraints
861
- if (min.year > max.year) {
862
- console.error('min.year > max.year');
863
- min.year = max.year - 100;
1341
+ /**
1342
+ * If a user has not selected a date,
1343
+ * then we should show all times. If the
1344
+ * user has selected a date (even if it has
1345
+ * not been confirmed yet), we should apply
1346
+ * the max and min restrictions so that the
1347
+ * time picker shows values that are
1348
+ * appropriate for the selected date.
1349
+ */
1350
+ const activePart = this.getActivePart();
1351
+ const userHasSelectedDate = activePart !== undefined;
1352
+ const { hoursData, minutesData, dayPeriodData } = data.getTimeColumnsData(this.locale, this.workingParts, this.hourCycle, userHasSelectedDate ? this.minParts : undefined, userHasSelectedDate ? this.maxParts : undefined, this.parsedHourValues, this.parsedMinuteValues);
1353
+ return [
1354
+ this.renderHourPickerColumn(hoursData),
1355
+ this.renderMinutePickerColumn(minutesData),
1356
+ this.renderDayPeriodPickerColumn(dayPeriodData),
1357
+ ];
1358
+ }
1359
+ renderHourPickerColumn(hoursData) {
1360
+ const { workingParts } = this;
1361
+ if (hoursData.length === 0)
1362
+ return [];
1363
+ const activePart = this.getActivePartsWithFallback();
1364
+ return (index.h("ion-picker-column-internal", { color: this.color, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
1365
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
1366
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
1367
+ ev.stopPropagation();
1368
+ } }));
1369
+ }
1370
+ renderMinutePickerColumn(minutesData) {
1371
+ const { workingParts } = this;
1372
+ if (minutesData.length === 0)
1373
+ return [];
1374
+ const activePart = this.getActivePartsWithFallback();
1375
+ return (index.h("ion-picker-column-internal", { color: this.color, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
1376
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
1377
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
1378
+ ev.stopPropagation();
1379
+ } }));
1380
+ }
1381
+ renderDayPeriodPickerColumn(dayPeriodData) {
1382
+ const { workingParts } = this;
1383
+ if (dayPeriodData.length === 0) {
1384
+ return [];
864
1385
  }
865
- if (min.year === max.year) {
866
- if (min.month > max.month) {
867
- console.error('min.month > max.month');
868
- min.month = 1;
869
- }
870
- else if (min.month === max.month && min.day > max.day) {
871
- console.error('min.day > max.day');
872
- min.day = 1;
1386
+ const activePart = this.getActivePartsWithFallback();
1387
+ const isDayPeriodRTL = data.isLocaleDayPeriodRTL(this.locale);
1388
+ return (index.h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
1389
+ const hour = data.calculateHourFromAMPM(workingParts, ev.detail.value);
1390
+ this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
1391
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
1392
+ ev.stopPropagation();
1393
+ } }));
1394
+ }
1395
+ renderWheelView(forcePresentation) {
1396
+ const { locale } = this;
1397
+ const showMonthFirst = data.isMonthFirstLocale(locale);
1398
+ const columnOrder = showMonthFirst ? 'month-first' : 'year-first';
1399
+ return (index.h("div", { class: {
1400
+ [`wheel-order-${columnOrder}`]: true,
1401
+ } }, this.renderWheelPicker(forcePresentation)));
1402
+ }
1403
+ /**
1404
+ * Grid Render Methods
1405
+ */
1406
+ renderCalendarHeader(mode) {
1407
+ const expandedIcon = mode === 'ios' ? index$2.chevronDown : index$2.caretUpSharp;
1408
+ const collapsedIcon = mode === 'ios' ? index$2.chevronForward : index$2.caretDownSharp;
1409
+ const prevMonthDisabled = isPrevMonthDisabled(this.workingParts, this.minParts, this.maxParts);
1410
+ const nextMonthDisabled = isNextMonthDisabled(this.workingParts, this.maxParts);
1411
+ // don't use the inheritAttributes util because it removes dir from the host, and we still need that
1412
+ const hostDir = this.el.getAttribute('dir') || undefined;
1413
+ return (index.h("div", { class: "calendar-header" }, index.h("div", { class: "calendar-action-buttons" }, index.h("div", { class: "calendar-month-year" }, index.h("ion-item", { button: true, detail: false, lines: "none", onClick: () => this.toggleMonthAndYearView() }, index.h("ion-label", null, data.getMonthAndYear(this.locale, this.workingParts), ' ', index.h("ion-icon", { "aria-hidden": "true", icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false, flipRtl: true })))), 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() }, index.h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: index$2.chevronBack, lazy: false, flipRtl: true })), index.h("ion-button", { "aria-label": "next month", disabled: nextMonthDisabled, onClick: () => this.nextMonth() }, index.h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: index$2.chevronForward, lazy: false, flipRtl: true }))))), index.h("div", { class: "calendar-days-of-week" }, data.getDaysOfWeek(this.locale, mode, this.firstDayOfWeek % 7).map((d) => {
1414
+ return index.h("div", { class: "day-of-week" }, d);
1415
+ }))));
1416
+ }
1417
+ renderMonth(month, year) {
1418
+ const yearAllowed = this.parsedYearValues === undefined || this.parsedYearValues.includes(year);
1419
+ const monthAllowed = this.parsedMonthValues === undefined || this.parsedMonthValues.includes(month);
1420
+ const isCalMonthDisabled = !yearAllowed || !monthAllowed;
1421
+ const swipeDisabled = isMonthDisabled({
1422
+ month,
1423
+ year,
1424
+ day: null,
1425
+ }, {
1426
+ // The day is not used when checking if a month is disabled.
1427
+ // Users should be able to access the min or max month, even if the
1428
+ // min/max date is out of bounds (e.g. min is set to Feb 15, Feb should not be disabled).
1429
+ minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
1430
+ maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
1431
+ });
1432
+ // The working month should never have swipe disabled.
1433
+ // Otherwise the CSS scroll snap will not work and the user
1434
+ // can free-scroll the calendar.
1435
+ const isWorkingMonth = this.workingParts.month === month && this.workingParts.year === year;
1436
+ const activePart = this.getActivePartsWithFallback();
1437
+ return (index.h("div", { "aria-hidden": !isWorkingMonth ? 'true' : null, class: {
1438
+ 'calendar-month': true,
1439
+ // Prevents scroll snap swipe gestures for months outside of the min/max bounds
1440
+ 'calendar-month-disabled': !isWorkingMonth && swipeDisabled,
1441
+ } }, index.h("div", { class: "calendar-month-grid" }, data.getDaysOfMonth(month, year, this.firstDayOfWeek % 7).map((dateObject, index$2) => {
1442
+ const { day, dayOfWeek } = dateObject;
1443
+ const { isDateEnabled, multiple } = this;
1444
+ const referenceParts = { month, day, year };
1445
+ const { isActive, isToday, ariaLabel, ariaSelected, disabled, text } = getCalendarDayState(this.locale, referenceParts, this.activePartsClone, this.todayParts, this.minParts, this.maxParts, this.parsedDayValues);
1446
+ let isCalDayDisabled = isCalMonthDisabled || disabled;
1447
+ if (!isCalDayDisabled && isDateEnabled !== undefined) {
1448
+ try {
1449
+ /**
1450
+ * The `isDateEnabled` implementation is try-catch wrapped
1451
+ * to prevent exceptions in the user's function from
1452
+ * interrupting the calendar rendering.
1453
+ */
1454
+ isCalDayDisabled = !isDateEnabled(data.convertDataToISO(referenceParts));
1455
+ }
1456
+ catch (e) {
1457
+ index$1.printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
1458
+ }
873
1459
  }
874
- }
1460
+ return (index.h("button", { tabindex: "-1", "data-day": day, "data-month": month, "data-year": year, "data-index": index$2, "data-day-of-week": dayOfWeek, disabled: isCalDayDisabled, class: {
1461
+ 'calendar-day-padding': day === null,
1462
+ 'calendar-day': true,
1463
+ 'calendar-day-active': isActive,
1464
+ 'calendar-day-today': isToday,
1465
+ }, "aria-selected": ariaSelected, "aria-label": ariaLabel, onClick: () => {
1466
+ if (day === null) {
1467
+ return;
1468
+ }
1469
+ this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month,
1470
+ day,
1471
+ year }));
1472
+ // multiple only needs date info, so we can wipe out other fields like time
1473
+ if (multiple) {
1474
+ this.setActiveParts({
1475
+ month,
1476
+ day,
1477
+ year,
1478
+ }, isActive);
1479
+ }
1480
+ else {
1481
+ this.setActiveParts(Object.assign(Object.assign({}, activePart), { month,
1482
+ day,
1483
+ year }));
1484
+ }
1485
+ } }, text));
1486
+ }))));
1487
+ }
1488
+ renderCalendarBody() {
1489
+ return (index.h("div", { class: "calendar-body ion-focusable", ref: (el) => (this.calendarBodyRef = el), tabindex: "0" }, data.generateMonths(this.workingParts).map(({ month, year }) => {
1490
+ return this.renderMonth(month, year);
1491
+ })));
875
1492
  }
876
- validateColumn(columns, name, index, min, max, lowerBounds, upperBounds) {
877
- const column = columns.find(c => c.name === name);
878
- if (!column) {
879
- return 0;
1493
+ renderCalendar(mode) {
1494
+ return (index.h("div", { class: "datetime-calendar", key: "datetime-calendar" }, this.renderCalendarHeader(mode), this.renderCalendarBody()));
1495
+ }
1496
+ renderTimeLabel() {
1497
+ const hasSlottedTimeLabel = this.el.querySelector('[slot="time-label"]') !== null;
1498
+ if (!hasSlottedTimeLabel && !this.showDefaultTimeLabel) {
1499
+ return;
880
1500
  }
881
- const lb = lowerBounds.slice();
882
- const ub = upperBounds.slice();
883
- const options = column.options;
884
- let indexMin = options.length - 1;
885
- let indexMax = 0;
886
- for (let i = 0; i < options.length; i++) {
887
- const opts = options[i];
888
- const value = opts.value;
889
- lb[index] = opts.value;
890
- ub[index] = opts.value;
891
- const disabled = opts.disabled = (value < lowerBounds[index] ||
892
- value > upperBounds[index] ||
893
- dateSortValue(ub[0], ub[1], ub[2], ub[3], ub[4]) < min ||
894
- dateSortValue(lb[0], lb[1], lb[2], lb[3], lb[4]) > max);
895
- if (!disabled) {
896
- indexMin = Math.min(indexMin, i);
897
- indexMax = Math.max(indexMax, i);
1501
+ return index.h("slot", { name: "time-label" }, "Time");
1502
+ }
1503
+ renderTimeOverlay() {
1504
+ const use24Hour = data.is24Hour(this.locale, this.hourCycle);
1505
+ const activePart = this.getActivePartsWithFallback();
1506
+ return [
1507
+ index.h("div", { class: "time-header" }, this.renderTimeLabel()),
1508
+ index.h("button", { class: {
1509
+ 'time-body': true,
1510
+ 'time-body-active': this.isTimePopoverOpen,
1511
+ }, "aria-expanded": "false", "aria-haspopup": "true", onClick: async (ev) => {
1512
+ const { popoverRef } = this;
1513
+ if (popoverRef) {
1514
+ this.isTimePopoverOpen = true;
1515
+ popoverRef.present(new CustomEvent('ionShadowTarget', {
1516
+ detail: {
1517
+ ionShadowTarget: ev.target,
1518
+ },
1519
+ }));
1520
+ await popoverRef.onWillDismiss();
1521
+ this.isTimePopoverOpen = false;
1522
+ }
1523
+ } }, data.getLocalizedTime(this.locale, activePart, use24Hour)),
1524
+ index.h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
1525
+ /**
1526
+ * Intersection Observers do not consistently fire between Blink and Webkit
1527
+ * when toggling the visibility of the popover and trying to scroll the picker
1528
+ * column to the correct time value.
1529
+ *
1530
+ * This will correctly scroll the element position to the correct time value,
1531
+ * before the popover is fully presented.
1532
+ */
1533
+ const cols = ev.target.querySelectorAll('ion-picker-column-internal');
1534
+ // TODO (FW-615): Potentially remove this when intersection observers are fixed in picker column
1535
+ cols.forEach((col) => col.scrollActiveItemIntoView());
1536
+ }, style: {
1537
+ '--offset-y': '-10px',
1538
+ '--min-width': 'fit-content',
1539
+ },
1540
+ // Allow native browser keyboard events to support up/down/home/end key
1541
+ // navigation within the time picker.
1542
+ keyboardEvents: true, ref: (el) => (this.popoverRef = el) }, this.renderWheelPicker('time')),
1543
+ ];
1544
+ }
1545
+ getHeaderSelectedDateText() {
1546
+ const { activeParts, multiple, titleSelectedDatesFormatter } = this;
1547
+ const isArray = Array.isArray(activeParts);
1548
+ let headerText;
1549
+ if (multiple && isArray && activeParts.length !== 1) {
1550
+ headerText = `${activeParts.length} days`; // default/fallback for multiple selection
1551
+ if (titleSelectedDatesFormatter !== undefined) {
1552
+ try {
1553
+ headerText = titleSelectedDatesFormatter(data.convertDataToISO(activeParts));
1554
+ }
1555
+ catch (e) {
1556
+ index$1.printIonError('Exception in provided `titleSelectedDatesFormatter`: ', e);
1557
+ }
898
1558
  }
899
1559
  }
900
- const selectedIndex = column.selectedIndex = helpers.clamp(indexMin, column.selectedIndex, indexMax);
901
- const opt = column.options[selectedIndex];
902
- if (opt) {
903
- return opt.value;
1560
+ else {
1561
+ // for exactly 1 day selected (multiple set or not), show a formatted version of that
1562
+ headerText = data.getMonthAndDay(this.locale, this.getActivePartsWithFallback());
904
1563
  }
905
- return 0;
906
- }
907
- get text() {
908
- // create the text of the formatted data
909
- const template = this.displayFormat || this.pickerFormat || DEFAULT_FORMAT;
910
- if (this.value === undefined ||
911
- this.value === null ||
912
- this.value.length === 0) {
1564
+ return headerText;
1565
+ }
1566
+ renderCalendarViewHeader(showExpandedHeader = true) {
1567
+ const hasSlottedTitle = this.el.querySelector('[slot="title"]') !== null;
1568
+ if (!hasSlottedTitle && !this.showDefaultTitle) {
913
1569
  return;
914
1570
  }
915
- return renderDatetime(template, this.datetimeValue, this.locale);
1571
+ return (index.h("div", { class: "datetime-header" }, index.h("div", { class: "datetime-title" }, index.h("slot", { name: "title" }, "Select Date")), showExpandedHeader && index.h("div", { class: "datetime-selected-date" }, this.getHeaderSelectedDateText())));
1572
+ }
1573
+ /**
1574
+ * Render time picker inside of datetime.
1575
+ * Do not pass color prop to segment on
1576
+ * iOS mode. MD segment has been customized and
1577
+ * should take on the color prop, but iOS
1578
+ * should just be the default segment.
1579
+ */
1580
+ renderTime() {
1581
+ const { presentation } = this;
1582
+ const timeOnlyPresentation = presentation === 'time';
1583
+ return (index.h("div", { class: "datetime-time" }, timeOnlyPresentation ? this.renderWheelPicker() : this.renderTimeOverlay()));
916
1584
  }
917
- hasValue() {
918
- return this.text !== undefined;
1585
+ /**
1586
+ * Renders the month/year picker that is
1587
+ * displayed on the calendar grid.
1588
+ * The .datetime-year class has additional
1589
+ * styles that let us show/hide the
1590
+ * picker when the user clicks on the
1591
+ * toggle in the calendar header.
1592
+ */
1593
+ renderCalendarViewMonthYearPicker() {
1594
+ return index.h("div", { class: "datetime-year" }, this.renderWheelView('month-year'));
919
1595
  }
920
- setFocus() {
921
- if (this.buttonEl) {
922
- this.buttonEl.focus();
1596
+ /**
1597
+ * Render entry point
1598
+ * All presentation types are rendered from here.
1599
+ */
1600
+ renderDatetime(mode) {
1601
+ const { presentation, preferWheel } = this;
1602
+ /**
1603
+ * Certain presentation types have separate grid and wheel displays.
1604
+ * If preferWheel is true then we should show a wheel picker instead.
1605
+ */
1606
+ const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1607
+ if (preferWheel && hasWheelVariant) {
1608
+ return [this.renderCalendarViewHeader(false), this.renderWheelView(), this.renderFooter()];
1609
+ }
1610
+ switch (presentation) {
1611
+ case 'date-time':
1612
+ return [
1613
+ this.renderCalendarViewHeader(),
1614
+ this.renderCalendar(mode),
1615
+ this.renderCalendarViewMonthYearPicker(),
1616
+ this.renderTime(),
1617
+ this.renderFooter(),
1618
+ ];
1619
+ case 'time-date':
1620
+ return [
1621
+ this.renderCalendarViewHeader(),
1622
+ this.renderTime(),
1623
+ this.renderCalendar(mode),
1624
+ this.renderCalendarViewMonthYearPicker(),
1625
+ this.renderFooter(),
1626
+ ];
1627
+ case 'time':
1628
+ return [this.renderTime(), this.renderFooter()];
1629
+ case 'month':
1630
+ case 'month-year':
1631
+ case 'year':
1632
+ return [this.renderWheelView(), this.renderFooter()];
1633
+ default:
1634
+ return [
1635
+ this.renderCalendarViewHeader(),
1636
+ this.renderCalendar(mode),
1637
+ this.renderCalendarViewMonthYearPicker(),
1638
+ this.renderFooter(),
1639
+ ];
923
1640
  }
924
1641
  }
925
1642
  render() {
926
- const { inputId, text, disabled, readonly, isExpanded, el, placeholder } = this;
1643
+ const { name, value, disabled, el, color, isPresented, readonly, showMonthAndYear, preferWheel, presentation, size, } = this;
927
1644
  const mode = ionicGlobal.getIonMode(this);
928
- const labelId = inputId + '-lbl';
929
- const label = helpers.findItemLabel(el);
930
- const addPlaceholderClass = (text === undefined && placeholder != null) ? true : false;
931
- // If selected text has been passed in, use that first
932
- // otherwise use the placeholder
933
- const datetimeText = text === undefined
934
- ? (placeholder != null ? placeholder : '')
935
- : text;
936
- const datetimeTextPart = text === undefined
937
- ? (placeholder != null ? 'placeholder' : undefined)
938
- : 'text';
939
- if (label) {
940
- label.id = labelId;
941
- }
942
- helpers.renderHiddenInput(true, el, this.name, this.value, this.disabled);
943
- return (index.h(index.Host, { onClick: this.onClick, "aria-disabled": disabled ? 'true' : null, "aria-expanded": `${isExpanded}`, "aria-haspopup": "true", "aria-labelledby": label ? labelId : null, class: {
1645
+ const isMonthAndYearPresentation = presentation === 'year' || presentation === 'month' || presentation === 'month-year';
1646
+ const shouldShowMonthAndYear = showMonthAndYear || isMonthAndYearPresentation;
1647
+ const monthYearPickerOpen = showMonthAndYear && !isMonthAndYearPresentation;
1648
+ const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1649
+ const hasWheelVariant = hasDatePresentation && preferWheel;
1650
+ const hasGrid = hasDatePresentation && !preferWheel;
1651
+ helpers.renderHiddenInput(true, el, name, data.formatValue(value), disabled);
1652
+ return (index.h(index.Host, { "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
944
1653
  [mode]: true,
945
- 'datetime-disabled': disabled,
946
- 'datetime-readonly': readonly,
947
- 'datetime-placeholder': addPlaceholderClass,
948
- 'in-item': theme.hostContext('ion-item', el)
949
- } }, index.h("div", { class: "datetime-text", part: datetimeTextPart }, datetimeText), index.h("button", { type: "button", onFocus: this.onFocus, onBlur: this.onBlur, disabled: this.disabled, ref: btnEl => this.buttonEl = btnEl })));
1654
+ ['datetime-presented']: isPresented,
1655
+ ['datetime-readonly']: readonly,
1656
+ ['datetime-disabled']: disabled,
1657
+ 'show-month-and-year': shouldShowMonthAndYear,
1658
+ 'month-year-picker-open': monthYearPickerOpen,
1659
+ [`datetime-presentation-${presentation}`]: true,
1660
+ [`datetime-size-${size}`]: true,
1661
+ [`datetime-prefer-wheel`]: hasWheelVariant,
1662
+ [`datetime-grid`]: hasGrid,
1663
+ })) }, this.renderDatetime(mode)));
950
1664
  }
951
1665
  get el() { return index.getElement(this); }
952
1666
  static get watchers() { return {
953
1667
  "disabled": ["disabledChanged"],
1668
+ "min": ["minChanged"],
1669
+ "max": ["maxChanged"],
1670
+ "yearValues": ["yearValuesChanged"],
1671
+ "monthValues": ["monthValuesChanged"],
1672
+ "dayValues": ["dayValuesChanged"],
1673
+ "hourValues": ["hourValuesChanged"],
1674
+ "minuteValues": ["minuteValuesChanged"],
1675
+ "activeParts": ["activePartsChanged"],
954
1676
  "value": ["valueChanged"]
955
1677
  }; }
956
1678
  };
957
- const divyColumns = (columns) => {
958
- const columnsWidth = [];
959
- let col;
960
- let width;
961
- for (let i = 0; i < columns.length; i++) {
962
- col = columns[i];
963
- columnsWidth.push(0);
964
- for (const option of col.options) {
965
- width = option.text.length;
966
- if (width > columnsWidth[i]) {
967
- columnsWidth[i] = width;
968
- }
969
- }
970
- }
971
- if (columnsWidth.length === 2) {
972
- width = Math.max(columnsWidth[0], columnsWidth[1]);
973
- columns[0].align = 'right';
974
- columns[1].align = 'left';
975
- columns[0].optionsWidth = columns[1].optionsWidth = `${width * 17}px`;
976
- }
977
- else if (columnsWidth.length === 3) {
978
- width = Math.max(columnsWidth[0], columnsWidth[2]);
979
- columns[0].align = 'right';
980
- columns[1].columnWidth = `${columnsWidth[1] * 17}px`;
981
- columns[0].optionsWidth = columns[2].optionsWidth = `${width * 17}px`;
982
- columns[2].align = 'left';
983
- }
984
- return columns;
985
- };
986
- const DEFAULT_FORMAT = 'MMM D, YYYY';
987
1679
  let datetimeIds = 0;
988
1680
  Datetime.style = {
989
1681
  ios: datetimeIosCss,