@watermarkinsights/ripple 3.27.0 → 3.27.1

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 (277) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{chartFunctions-b2e0cb4e.js → chartFunctions-42cfb4d3.js} +596 -596
  3. package/dist/cjs/{functions-9807717e.js → functions-85c3c557.js} +498 -498
  4. package/dist/cjs/{global-42a24725.js → global-9982752f.js} +72 -72
  5. package/dist/cjs/{http-service-9e8c4dd5.js → http-service-494d81de.js} +49 -49
  6. package/dist/cjs/{interfaces-30a74c1f.js → interfaces-a3338581.js} +29 -29
  7. package/dist/cjs/{intl-526c75ec.js → intl-1c36fe38.js} +131 -131
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/priv-chart-popover.cjs.entry.js +91 -91
  10. package/dist/cjs/priv-datepicker.cjs.entry.js +657 -657
  11. package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
  12. package/dist/cjs/priv-navigator-item.cjs.entry.js +23 -23
  13. package/dist/cjs/ripple.cjs.js +1 -1
  14. package/dist/cjs/wm-action-menu_2.cjs.entry.js +334 -334
  15. package/dist/cjs/wm-button.cjs.entry.js +189 -189
  16. package/dist/cjs/wm-chart-slice.cjs.entry.js +18 -18
  17. package/dist/cjs/wm-chart.cjs.entry.js +183 -183
  18. package/dist/cjs/wm-datepicker.cjs.entry.js +263 -263
  19. package/dist/cjs/wm-file-list.cjs.entry.js +35 -35
  20. package/dist/cjs/wm-file.cjs.entry.js +181 -181
  21. package/dist/cjs/wm-input.cjs.entry.js +136 -136
  22. package/dist/cjs/wm-modal-footer.cjs.entry.js +33 -33
  23. package/dist/cjs/wm-modal-header.cjs.entry.js +32 -32
  24. package/dist/cjs/wm-modal.cjs.entry.js +152 -152
  25. package/dist/cjs/wm-navigation_3.cjs.entry.js +186 -186
  26. package/dist/cjs/wm-navigator.cjs.entry.js +264 -264
  27. package/dist/cjs/wm-network-uploader.cjs.entry.js +465 -465
  28. package/dist/cjs/wm-option_2.cjs.entry.js +768 -768
  29. package/dist/cjs/wm-pagination.cjs.entry.js +179 -179
  30. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +155 -155
  31. package/dist/cjs/wm-search.cjs.entry.js +184 -184
  32. package/dist/cjs/wm-snackbar.cjs.entry.js +134 -134
  33. package/dist/cjs/wm-tab-item_3.cjs.entry.js +264 -264
  34. package/dist/cjs/wm-tag-input-row.cjs.entry.js +14 -14
  35. package/dist/cjs/wm-tag-input.cjs.entry.js +948 -941
  36. package/dist/cjs/wm-timepicker.cjs.entry.js +385 -385
  37. package/dist/cjs/wm-toggletip.cjs.entry.js +120 -120
  38. package/dist/cjs/wm-uploader.cjs.entry.js +441 -441
  39. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  40. package/dist/collection/components/charts/chartFunctions.js +562 -562
  41. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +267 -267
  42. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +125 -125
  43. package/dist/collection/components/charts/wm-chart/wm-chart.js +450 -450
  44. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +207 -207
  45. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +143 -143
  46. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +121 -121
  47. package/dist/collection/components/wm-action-menu/wm-action-menu.js +472 -472
  48. package/dist/collection/components/wm-button/wm-button.js +486 -486
  49. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +983 -983
  50. package/dist/collection/components/wm-datepicker/wm-datepicker.js +491 -491
  51. package/dist/collection/components/wm-file/wm-file.js +313 -313
  52. package/dist/collection/components/wm-file-list/wm-file-list.js +152 -152
  53. package/dist/collection/components/wm-input/wm-input.js +509 -509
  54. package/dist/collection/components/wm-menuitem/wm-menuitem.js +454 -454
  55. package/dist/collection/components/wm-modal/wm-modal-footer.js +138 -138
  56. package/dist/collection/components/wm-modal/wm-modal-header.js +82 -82
  57. package/dist/collection/components/wm-modal/wm-modal.js +462 -462
  58. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +119 -119
  59. package/dist/collection/components/wm-navigation/wm-navigation-item.js +130 -130
  60. package/dist/collection/components/wm-navigation/wm-navigation.js +217 -217
  61. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +106 -106
  62. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +123 -123
  63. package/dist/collection/components/wm-navigator/wm-navigator.js +467 -467
  64. package/dist/collection/components/wm-option/wm-option.js +435 -435
  65. package/dist/collection/components/wm-pagination/wm-pagination.js +362 -362
  66. package/dist/collection/components/wm-search/wm-search.js +439 -439
  67. package/dist/collection/components/wm-select/wm-select.js +1054 -1054
  68. package/dist/collection/components/wm-snackbar/wm-snackbar.js +267 -267
  69. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +211 -211
  70. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +327 -327
  71. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +108 -108
  72. package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +122 -122
  73. package/dist/collection/components/wm-tag-input/wm-tag-input.css +21 -17
  74. package/dist/collection/components/wm-tag-input/wm-tag-input.js +1302 -1295
  75. package/dist/collection/components/wm-timepicker/wm-timepicker.js +605 -605
  76. package/dist/collection/components/wm-toggletip/wm-toggletip.js +243 -243
  77. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +772 -772
  78. package/dist/collection/components/wm-uploader/wm-uploader.js +964 -964
  79. package/dist/collection/components/wm-wrapper/wm-wrapper.js +28 -28
  80. package/dist/collection/dev/scripts.js +20 -20
  81. package/dist/collection/global/__mocks__/functions.js +6 -6
  82. package/dist/collection/global/functions.js +541 -541
  83. package/dist/collection/global/global.js +79 -79
  84. package/dist/collection/global/interfaces.js +49 -49
  85. package/dist/collection/global/intl.js +132 -132
  86. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  87. package/dist/collection/global/services/http-service.js +50 -50
  88. package/dist/collection/lang/lang.js +5 -5
  89. package/dist/collection/lang/missing.js +43 -43
  90. package/dist/collection/lang/piglatin.js +93 -93
  91. package/dist/esm/{chartFunctions-dd9eb9ac.js → chartFunctions-0b53b301.js} +596 -596
  92. package/dist/esm/{functions-f32b1ca4.js → functions-cbb19d50.js} +498 -498
  93. package/dist/esm/{global-7ee0d78d.js → global-2c7bbfe6.js} +72 -72
  94. package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
  95. package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
  96. package/dist/esm/{intl-d101e1a9.js → intl-ffbca53d.js} +131 -131
  97. package/dist/esm/loader.js +1 -1
  98. package/dist/esm/polyfills/core-js.js +0 -0
  99. package/dist/esm/polyfills/dom.js +0 -0
  100. package/dist/esm/polyfills/es5-html-element.js +0 -0
  101. package/dist/esm/polyfills/index.js +0 -0
  102. package/dist/esm/polyfills/system.js +0 -0
  103. package/dist/esm/priv-chart-popover.entry.js +91 -91
  104. package/dist/esm/priv-datepicker.entry.js +657 -657
  105. package/dist/esm/priv-navigator-button.entry.js +19 -19
  106. package/dist/esm/priv-navigator-item.entry.js +23 -23
  107. package/dist/esm/ripple.js +1 -1
  108. package/dist/esm/wm-action-menu_2.entry.js +334 -334
  109. package/dist/esm/wm-button.entry.js +189 -189
  110. package/dist/esm/wm-chart-slice.entry.js +18 -18
  111. package/dist/esm/wm-chart.entry.js +183 -183
  112. package/dist/esm/wm-datepicker.entry.js +263 -263
  113. package/dist/esm/wm-file-list.entry.js +35 -35
  114. package/dist/esm/wm-file.entry.js +181 -181
  115. package/dist/esm/wm-input.entry.js +136 -136
  116. package/dist/esm/wm-modal-footer.entry.js +33 -33
  117. package/dist/esm/wm-modal-header.entry.js +32 -32
  118. package/dist/esm/wm-modal.entry.js +152 -152
  119. package/dist/esm/wm-navigation_3.entry.js +186 -186
  120. package/dist/esm/wm-navigator.entry.js +264 -264
  121. package/dist/esm/wm-network-uploader.entry.js +465 -465
  122. package/dist/esm/wm-option_2.entry.js +768 -768
  123. package/dist/esm/wm-pagination.entry.js +179 -179
  124. package/dist/esm/wm-progress-indicator_3.entry.js +155 -155
  125. package/dist/esm/wm-search.entry.js +184 -184
  126. package/dist/esm/wm-snackbar.entry.js +134 -134
  127. package/dist/esm/wm-tab-item_3.entry.js +264 -264
  128. package/dist/esm/wm-tag-input-row.entry.js +14 -14
  129. package/dist/esm/wm-tag-input.entry.js +948 -941
  130. package/dist/esm/wm-timepicker.entry.js +385 -385
  131. package/dist/esm/wm-toggletip.entry.js +120 -120
  132. package/dist/esm/wm-uploader.entry.js +441 -441
  133. package/dist/esm/wm-wrapper.entry.js +12 -12
  134. package/dist/esm-es5/{chartFunctions-dd9eb9ac.js → chartFunctions-0b53b301.js} +1 -1
  135. package/dist/esm-es5/{global-7ee0d78d.js → global-2c7bbfe6.js} +1 -1
  136. package/dist/esm-es5/{intl-d101e1a9.js → intl-ffbca53d.js} +1 -1
  137. package/dist/esm-es5/loader.js +1 -1
  138. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  139. package/dist/esm-es5/priv-datepicker.entry.js +1 -1
  140. package/dist/esm-es5/ripple.js +1 -1
  141. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  142. package/dist/esm-es5/wm-button.entry.js +1 -1
  143. package/dist/esm-es5/wm-chart.entry.js +1 -1
  144. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  145. package/dist/esm-es5/wm-file.entry.js +1 -1
  146. package/dist/esm-es5/wm-input.entry.js +1 -1
  147. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  148. package/dist/esm-es5/wm-modal.entry.js +1 -1
  149. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  150. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  151. package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
  152. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  153. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  154. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  155. package/dist/esm-es5/wm-search.entry.js +1 -1
  156. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  157. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  158. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  159. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  160. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  161. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  162. package/dist/ripple/{p-725c14b0.system.entry.js → p-00022d17.system.entry.js} +1 -1
  163. package/dist/ripple/{p-b97de06f.system.entry.js → p-0450cdbe.system.entry.js} +1 -1
  164. package/dist/ripple/{p-bfe1062d.entry.js → p-05a17658.entry.js} +1 -1
  165. package/dist/ripple/p-0b6a7b77.system.entry.js +1 -0
  166. package/dist/ripple/{p-b6bf2866.entry.js → p-0e789be7.entry.js} +1 -1
  167. package/dist/ripple/{p-b617b64f.system.entry.js → p-15779c22.system.entry.js} +1 -1
  168. package/dist/ripple/{p-04faca6b.entry.js → p-17487f1b.entry.js} +1 -1
  169. package/dist/ripple/{p-122da0d1.system.entry.js → p-197c83de.system.entry.js} +1 -1
  170. package/dist/ripple/{p-11d98b00.system.entry.js → p-1bad4efe.system.entry.js} +1 -1
  171. package/dist/ripple/{p-252ba295.system.entry.js → p-2ff923ee.system.entry.js} +1 -1
  172. package/dist/ripple/{p-a6afe65a.entry.js → p-31712996.entry.js} +1 -1
  173. package/dist/ripple/{p-f69276d5.system.entry.js → p-31c18f5e.system.entry.js} +1 -1
  174. package/dist/ripple/{p-df28f438.system.js → p-32944b70.system.js} +1 -1
  175. package/dist/ripple/{p-73d277ba.system.entry.js → p-36effc40.system.entry.js} +1 -1
  176. package/dist/ripple/{p-0be94e77.entry.js → p-3807bcae.entry.js} +1 -1
  177. package/dist/ripple/{p-88d17f6b.system.entry.js → p-3aa48fad.system.entry.js} +1 -1
  178. package/dist/ripple/{p-82a97531.system.entry.js → p-419f133c.system.entry.js} +1 -1
  179. package/dist/ripple/{p-13ec8ac0.entry.js → p-438a1e8e.entry.js} +1 -1
  180. package/dist/ripple/{p-19689aac.js → p-4698b365.js} +1 -1
  181. package/dist/ripple/{p-f8d45250.system.entry.js → p-54086f7b.system.entry.js} +1 -1
  182. package/dist/ripple/{p-47f53321.entry.js → p-5497694c.entry.js} +1 -1
  183. package/dist/ripple/{p-fb370a69.entry.js → p-58fbf116.entry.js} +1 -1
  184. package/dist/ripple/{p-14dfc4e7.entry.js → p-65a741c1.entry.js} +1 -1
  185. package/dist/ripple/{p-ac63b3aa.entry.js → p-7e74274b.entry.js} +1 -1
  186. package/dist/ripple/{p-81752607.system.js → p-81ad3fe5.system.js} +1 -1
  187. package/dist/ripple/{p-f3e42327.system.entry.js → p-89db9c27.system.entry.js} +1 -1
  188. package/dist/ripple/{p-4753fbfc.system.entry.js → p-947f01e2.system.entry.js} +1 -1
  189. package/dist/ripple/{p-3aee75e7.entry.js → p-978429f9.entry.js} +1 -1
  190. package/dist/ripple/{p-2c8fd902.system.entry.js → p-97d5b4bd.system.entry.js} +1 -1
  191. package/dist/ripple/{p-67c0ad56.system.entry.js → p-9d6a574b.system.entry.js} +1 -1
  192. package/dist/ripple/{p-c545fe1c.entry.js → p-a3ba2bdd.entry.js} +1 -1
  193. package/dist/ripple/{p-c7567fd3.entry.js → p-a42f5231.entry.js} +1 -1
  194. package/dist/ripple/p-a51aec3f.entry.js +1 -0
  195. package/dist/ripple/{p-b831988d.entry.js → p-a5b86b47.entry.js} +1 -1
  196. package/dist/ripple/{p-4cadf985.entry.js → p-a90b8a08.entry.js} +1 -1
  197. package/dist/ripple/{p-d9b66dca.system.entry.js → p-aabe172c.system.entry.js} +1 -1
  198. package/dist/ripple/{p-69121ad1.entry.js → p-ab2a0aee.entry.js} +1 -1
  199. package/dist/ripple/{p-5fb0aa58.js → p-aed93a25.js} +1 -1
  200. package/dist/ripple/{p-f39ee84b.entry.js → p-b2d75e7d.entry.js} +1 -1
  201. package/dist/ripple/{p-19b897ce.js → p-b410c675.js} +1 -1
  202. package/dist/ripple/{p-4809e419.system.entry.js → p-b6f558f7.system.entry.js} +1 -1
  203. package/dist/ripple/p-bb048fe7.entry.js +1 -0
  204. package/dist/ripple/{p-2805fed6.system.entry.js → p-bced37cf.system.entry.js} +1 -1
  205. package/dist/ripple/{p-c9a1834d.system.entry.js → p-bd0c1e7c.system.entry.js} +1 -1
  206. package/dist/ripple/{p-89f1991f.entry.js → p-c0e183f4.entry.js} +1 -1
  207. package/dist/ripple/{p-7eca18bd.system.entry.js → p-c27eda00.system.entry.js} +1 -1
  208. package/dist/ripple/{p-894bc6c4.system.entry.js → p-cd3e0b8b.system.entry.js} +1 -1
  209. package/dist/ripple/{p-f6b2e4ac.system.js → p-d1af63b5.system.js} +1 -1
  210. package/dist/ripple/{p-30572b71.system.js → p-d41ba263.system.js} +1 -1
  211. package/dist/ripple/{p-db7e6e89.entry.js → p-d8993992.entry.js} +1 -1
  212. package/dist/ripple/{p-f13b239c.system.entry.js → p-da525ed1.system.entry.js} +1 -1
  213. package/dist/ripple/{p-33af1eee.entry.js → p-e6f46289.entry.js} +1 -1
  214. package/dist/ripple/{p-e928f350.entry.js → p-fc967b2c.entry.js} +1 -1
  215. package/dist/ripple/ripple.esm.js +1 -1
  216. package/dist/ripple/ripple.js +1 -1
  217. package/dist/types/components/charts/chartFunctions.d.ts +37 -37
  218. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
  219. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
  220. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +47 -47
  221. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +29 -29
  222. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +20 -20
  223. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
  224. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +49 -49
  225. package/dist/types/components/wm-button/wm-button.d.ts +44 -44
  226. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
  227. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +42 -42
  228. package/dist/types/components/wm-file/wm-file.d.ts +40 -40
  229. package/dist/types/components/wm-file-list/wm-file-list.d.ts +16 -16
  230. package/dist/types/components/wm-input/wm-input.d.ts +57 -57
  231. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  232. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
  233. package/dist/types/components/wm-modal/wm-modal-header.d.ts +10 -10
  234. package/dist/types/components/wm-modal/wm-modal.d.ts +40 -40
  235. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +16 -16
  236. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
  237. package/dist/types/components/wm-navigation/wm-navigation.d.ts +26 -26
  238. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  239. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  240. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  241. package/dist/types/components/wm-option/wm-option.d.ts +34 -34
  242. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  243. package/dist/types/components/wm-search/wm-search.d.ts +77 -77
  244. package/dist/types/components/wm-select/wm-select.d.ts +101 -101
  245. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +30 -30
  246. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +37 -37
  247. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +52 -52
  248. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  249. package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +11 -11
  250. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +137 -136
  251. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +62 -62
  252. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +25 -25
  253. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  254. package/dist/types/components/wm-uploader/wm-uploader.d.ts +99 -99
  255. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  256. package/dist/types/components.d.ts +27 -27
  257. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  258. package/dist/types/global/functions.d.ts +40 -40
  259. package/dist/types/global/global.d.ts +1 -1
  260. package/dist/types/global/interfaces.d.ts +74 -74
  261. package/dist/types/global/intl.d.ts +29 -29
  262. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  263. package/dist/types/global/services/http-service.d.ts +4 -4
  264. package/dist/types/lang/lang.d.ts +5 -5
  265. package/package.json +46 -46
  266. package/dist/ripple/p-37de8e2f.entry.js +0 -1
  267. package/dist/ripple/p-b378e064.system.entry.js +0 -1
  268. package/dist/ripple/p-d2037549.entry.js +0 -1
  269. /package/dist/esm-es5/{functions-f32b1ca4.js → functions-cbb19d50.js} +0 -0
  270. /package/dist/esm-es5/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +0 -0
  271. /package/dist/esm-es5/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +0 -0
  272. /package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
  273. /package/dist/ripple/{p-cfa80f5b.js → p-91480a89.js} +0 -0
  274. /package/dist/ripple/{p-313b6073.system.js → p-9d02957d.system.js} +0 -0
  275. /package/dist/ripple/{p-9eb5a71e.system.js → p-b267e710.system.js} +0 -0
  276. /package/dist/ripple/{p-08b7ec08.system.js → p-f5df5903.system.js} +0 -0
  277. /package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
@@ -1,983 +1,983 @@
1
- import { h } from "@stencil/core";
2
- import { forceUpdate } from "@stencil/core";
3
- import { intl, hasRoomRight, shouldOpenUp } from "../../../global/functions";
4
- export class PrivDatepicker {
5
- constructor() {
6
- this.popupClicked = true;
7
- this.buttonClicked = true;
8
- this.prevClicked = true;
9
- this.nextClicked = true;
10
- this.openUp = false;
11
- this.calendar_months = [
12
- intl.formatMessage({
13
- id: "date.january",
14
- defaultMessage: "January",
15
- description: "Month of the year",
16
- }),
17
- intl.formatMessage({
18
- id: "date.february",
19
- defaultMessage: "February",
20
- description: "Month of the year",
21
- }),
22
- intl.formatMessage({
23
- id: "date.march",
24
- defaultMessage: "March",
25
- description: "Month of the year",
26
- }),
27
- intl.formatMessage({
28
- id: "date.april",
29
- defaultMessage: "April",
30
- description: "Month of the year",
31
- }),
32
- intl.formatMessage({
33
- id: "date.may",
34
- defaultMessage: "May",
35
- description: "Month of the year",
36
- }),
37
- intl.formatMessage({
38
- id: "date.june",
39
- defaultMessage: "June",
40
- description: "Month of the year",
41
- }),
42
- intl.formatMessage({
43
- id: "date.july",
44
- defaultMessage: "July",
45
- description: "Month of the year",
46
- }),
47
- intl.formatMessage({
48
- id: "date.august",
49
- defaultMessage: "August",
50
- description: "Month of the year",
51
- }),
52
- intl.formatMessage({
53
- id: "date.september",
54
- defaultMessage: "September",
55
- description: "Month of the year",
56
- }),
57
- intl.formatMessage({
58
- id: "date.october",
59
- defaultMessage: "October",
60
- description: "Month of the year",
61
- }),
62
- intl.formatMessage({
63
- id: "date.november",
64
- defaultMessage: "November",
65
- description: "Month of the year",
66
- }),
67
- intl.formatMessage({
68
- id: "date.december",
69
- defaultMessage: "December",
70
- description: "Month of the year",
71
- }),
72
- ];
73
- this.weekdays = [
74
- intl.formatMessage({ id: "date.sunday", defaultMessage: "Sunday" }),
75
- intl.formatMessage({ id: "date.monday", defaultMessage: "Monday" }),
76
- intl.formatMessage({ id: "date.tuesday", defaultMessage: "Tuesday" }),
77
- intl.formatMessage({ id: "date.wednesday", defaultMessage: "Wednesday" }),
78
- intl.formatMessage({ id: "date.thursday", defaultMessage: "Thursday" }),
79
- intl.formatMessage({ id: "date.friday", defaultMessage: "Friday" }),
80
- intl.formatMessage({ id: "date.saturday", defaultMessage: "Saturday" }),
81
- ];
82
- this.renderCalendarDate = (date, index) => {
83
- let monthOfDate = this.removeZeroes(String(date[1]));
84
- let dayOfDate = this.removeZeroes(String(date[2]));
85
- let isThisMonth = monthOfDate === this.monthInFocus ? "current-month" : "";
86
- const dateId = date[0] + date[1] + date[2];
87
- const isToday = this.isDateToday(date);
88
- return (h("div", { role: "gridcell", id: `cell-${dateId}-${this.parentId}`, class: `date-cell ${isThisMonth}`, "aria-selected": false, "aria-label": `${isToday
89
- ? `${intl.formatMessage({
90
- id: "date.today",
91
- defaultMessage: "today",
92
- description: "calendar button",
93
- })}, `
94
- : ""}${this.weekdays[index]}, ${this.calendar_months[monthOfDate - 1]} ${dayOfDate}, ${date[0]}`, onClick: (ev) => {
95
- this.handleTriggeredDate(ev.target);
96
- }, onKeyDown: (ev) => this.trapFocusEnd(ev), "data-month": date[1], "data-year": date[0], onBlur: (ev) => ev.stopPropagation() }, dayOfDate));
97
- };
98
- this.disabled = false;
99
- this.isExpanded = false;
100
- this.view = "day";
101
- this.date = new Date();
102
- this.selectedYear = this.date.getUTCFullYear();
103
- this.selectedMonth = this.date.getUTCMonth() + 1;
104
- this.selectedDay = this.date.getUTCDate();
105
- this.monthInFocus = this.selectedMonth;
106
- this.yearInFocus = this.selectedYear;
107
- this.dayInFocus = this.selectedDay;
108
- this.monthNumInFocus = this.selectedMonth;
109
- this.parentId = "";
110
- this.isTabbing = false;
111
- }
112
- handleKey(ev) {
113
- this.prevClicked = false;
114
- this.nextClicked = false;
115
- switch (ev.key) {
116
- case "Enter":
117
- ev.preventDefault();
118
- //Clunky exception for blur validation. Remove when blur reworked.
119
- !ev.target.id.includes("popup-title") && ev.target.click();
120
- break;
121
- case "Escape":
122
- ev.preventDefault();
123
- if (this.isExpanded) {
124
- ev.stopPropagation(); // prevents closing of parent modal
125
- this.closePopup(true);
126
- }
127
- break;
128
- case "PageUp":
129
- ev.preventDefault();
130
- this.backOneMonth();
131
- break;
132
- case "PageDown":
133
- ev.preventDefault();
134
- this.forwardOneMonth();
135
- break;
136
- case "Home":
137
- ev.preventDefault();
138
- this.unfocusCell();
139
- this.dayInFocus = 1;
140
- forceUpdate(this.el);
141
- break;
142
- case "End":
143
- ev.preventDefault();
144
- this.unfocusCell();
145
- this.dayInFocus = this.getMonthDays(this.monthInFocus, this.yearInFocus);
146
- forceUpdate(this.el);
147
- break;
148
- case "ArrowLeft":
149
- ev.preventDefault();
150
- if (this.view === "day") {
151
- this.unfocusCell();
152
- if (this.dayInFocus === 1) {
153
- const newMonth = this.getPreviousMonth(this.monthInFocus, this.yearInFocus);
154
- this.monthInFocus = newMonth.month;
155
- this.yearInFocus = newMonth.year;
156
- this.dayInFocus = this.getMonthDays(this.monthInFocus, this.yearInFocus);
157
- }
158
- else {
159
- this.dayInFocus -= 1;
160
- }
161
- }
162
- else {
163
- this.unfocusMonth();
164
- if (this.monthNumInFocus === 0) {
165
- this.monthNumInFocus = 11;
166
- }
167
- else {
168
- this.monthNumInFocus -= 1;
169
- }
170
- }
171
- break;
172
- case "ArrowRight":
173
- ev.preventDefault();
174
- if (this.view === "day") {
175
- this.unfocusCell();
176
- if (this.dayInFocus === this.getMonthDays(this.monthInFocus, this.yearInFocus)) {
177
- const newMonth = this.getNextMonth(this.monthInFocus, this.yearInFocus);
178
- this.monthInFocus = newMonth.month;
179
- this.yearInFocus = newMonth.year;
180
- this.dayInFocus = 1;
181
- }
182
- else {
183
- this.dayInFocus += 1;
184
- }
185
- }
186
- else {
187
- this.unfocusMonth();
188
- if (this.monthNumInFocus === 11) {
189
- this.monthNumInFocus = 0;
190
- }
191
- else {
192
- this.monthNumInFocus += 1;
193
- }
194
- }
195
- break;
196
- case "ArrowUp":
197
- ev.preventDefault();
198
- if (this.view === "day") {
199
- this.unfocusCell();
200
- if (this.dayInFocus < 8) {
201
- const newMonth = this.getPreviousMonth(this.monthInFocus, this.yearInFocus);
202
- this.monthInFocus = newMonth.month;
203
- this.yearInFocus = newMonth.year;
204
- const numDaysToSubtract = 7 - this.dayInFocus;
205
- this.dayInFocus = this.getMonthDays(this.monthInFocus, this.yearInFocus) - numDaysToSubtract;
206
- }
207
- else {
208
- this.dayInFocus -= 7;
209
- }
210
- }
211
- else {
212
- this.unfocusMonth();
213
- if (this.monthNumInFocus < 3) {
214
- this.monthNumInFocus += 9;
215
- }
216
- else {
217
- this.monthNumInFocus -= 3;
218
- }
219
- }
220
- break;
221
- case "ArrowDown":
222
- ev.preventDefault();
223
- if (!this.isExpanded) {
224
- this.openPopup();
225
- }
226
- else {
227
- if (this.view === "day") {
228
- //If the down arrow is pressed from the month button or the arrow buttons, focus should shift to the current cell in focus
229
- if (!(document.activeElement.shadowRoot || document).activeElement.classList.contains("date-cell")) {
230
- this.focusCell();
231
- break;
232
- }
233
- this.unfocusCell();
234
- const changeoverDate = this.getMonthDays(this.monthInFocus, this.yearInFocus) - 7;
235
- if (this.dayInFocus > changeoverDate) {
236
- const newMonth = this.getNextMonth(this.monthInFocus, this.yearInFocus);
237
- this.monthInFocus = newMonth.month;
238
- this.yearInFocus = newMonth.year;
239
- this.dayInFocus = this.dayInFocus - changeoverDate;
240
- }
241
- else {
242
- this.dayInFocus += 7;
243
- }
244
- }
245
- else {
246
- //If the down arrow is pressed from the arrow buttons or the title box, focus should shift to the current month in focus
247
- const activeEl = (document.activeElement.shadowRoot || document).activeElement;
248
- if (activeEl.tagName === "BUTTON" || activeEl.id.includes("popup-title-year")) {
249
- this.focusMonth();
250
- break;
251
- }
252
- this.unfocusMonth();
253
- if (this.monthNumInFocus > 8) {
254
- this.monthNumInFocus -= 9;
255
- }
256
- else {
257
- this.monthNumInFocus += 3;
258
- }
259
- }
260
- }
261
- break;
262
- }
263
- }
264
- toggleTabbingOn(ev) {
265
- const validKeys = ["Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter"];
266
- if (validKeys.includes(ev.key)) {
267
- this.isTabbing = true;
268
- }
269
- }
270
- //Using mousedown prevents this from running when the keydown listener emits ".click()" for when enter is pressed.
271
- toggleTabbingOff() {
272
- this.isTabbing = false;
273
- }
274
- blurHandler(ev) {
275
- if (!this.popupClicked && !this.buttonClicked && this.isExpanded) {
276
- this.closePopup();
277
- // in this case, the PointerEvent target is identical to the blur events relatedTarget, and is passed on as such
278
- this.popupBlurred.emit({ relatedTarget: ev.target });
279
- }
280
- this.popupClicked = false;
281
- this.buttonClicked = false;
282
- }
283
- handleBlurOnWindow(ev) {
284
- // for cases where the user clicks or uses a shortcut to leave the document
285
- if (this.isExpanded) {
286
- this.closePopup();
287
- this.popupBlurred.emit({ relatedTarget: ev.target });
288
- }
289
- }
290
- componentDidUpdate() {
291
- this.handleSelectedDate();
292
- if (this.isExpanded) {
293
- this.prevClicked
294
- ? this.prevButton.focus()
295
- : this.nextClicked
296
- ? this.nextButton.focus()
297
- : this.view === "day"
298
- ? this.focusCell()
299
- : this.focusMonth();
300
- }
301
- }
302
- componentDidLoad() {
303
- this.handleSelectedDate();
304
- this.setDateValuesForView();
305
- }
306
- zeroPad(value, length) {
307
- if (!String.prototype.padStart) {
308
- String.prototype.padStart = function padStart(targetLength, padString) {
309
- targetLength = targetLength - this.length;
310
- if (targetLength > padString.length) {
311
- padString += padString.repeat(targetLength / padString.length);
312
- }
313
- return padString.slice(0, targetLength) + String(this);
314
- };
315
- }
316
- return `${value.toString()}`.padStart(length, "0");
317
- }
318
- removeZeroes(date) {
319
- return +date < 10 ? +date.slice(1) : +date;
320
- }
321
- isDateToday(date) {
322
- const today = new Date();
323
- const todayDateArray = [
324
- today.getFullYear().toString(),
325
- (today.getMonth() + 1).toString(),
326
- today.getDate().toString(),
327
- ];
328
- //Compare today's date to date and return true if they match
329
- return todayDateArray.reduce((result, val, index) => result && this.removeZeroes(date[index]).toString() === val, true);
330
- }
331
- togglePopup() {
332
- this.isExpanded ? this.closePopup() : this.openPopup();
333
- this.buttonClicked = true;
334
- }
335
- closePopup(returnFocus = false) {
336
- this.isExpanded = false;
337
- this.popupEl.classList.remove("open");
338
- window.setTimeout(() => {
339
- //not using display none in order to get measurements of the popup while hidden
340
- this.popupEl.style.visibility = "hidden";
341
- }, 250);
342
- //Reset values so that menu reopens to day view with selected date in focus
343
- if (this.view === "day") {
344
- this.unfocusCell();
345
- }
346
- this.monthInFocus = this.selectedMonth;
347
- this.yearInFocus = this.selectedYear;
348
- this.dayInFocus = this.selectedDay;
349
- this.changeView("day");
350
- if (returnFocus) {
351
- this.buttonEl.focus();
352
- }
353
- }
354
- openPopup() {
355
- this.panelPosition();
356
- this.setDateValuesForView();
357
- this.prevClicked = false;
358
- this.nextClicked = false;
359
- this.popupEl.style.visibility = "visible";
360
- window.requestAnimationFrame(() => {
361
- this.popupEl.classList.add("open");
362
- });
363
- this.isExpanded = true;
364
- this.focusCell();
365
- }
366
- getMonthDays(month, year) {
367
- const months30 = [4, 6, 9, 11];
368
- const leapYear = year % 4 === 0;
369
- return month === 2 ? (leapYear ? 29 : 28) : months30.includes(month) ? 30 : 31;
370
- }
371
- // 1 => Sunday, 7 => Saturday
372
- getMonthFirstDay(month, year) {
373
- return +new Date(year, month - 1, 1, 12, 0, 0).getDay() + 1;
374
- }
375
- getPreviousMonth(month, year) {
376
- const prevMonth = month > 1 ? month - 1 : 12;
377
- const prevMonthYear = month > 1 ? year : year - 1;
378
- return { month: prevMonth, year: prevMonthYear };
379
- }
380
- getNextMonth(month, year) {
381
- const nextMonth = month < 12 ? month + 1 : 1;
382
- const nextMonthYear = month < 12 ? year : year + 1;
383
- return { month: nextMonth, year: nextMonthYear };
384
- }
385
- getCalendarDates(month, year) {
386
- // Get number of days in the month and the month's first day
387
- const monthDays = this.getMonthDays(month, year);
388
- const monthFirstDay = this.getMonthFirstDay(month, year);
389
- // Get number of days to be displayed from previous and next months
390
- // These ensure a total of 42 days (6 weeks) displayed on the calendar
391
- const daysFromPrevMonth = monthFirstDay - 1;
392
- let daysFromNextMonth = 42 - (daysFromPrevMonth + monthDays);
393
- daysFromNextMonth = daysFromNextMonth > 6 ? daysFromNextMonth - 7 : daysFromNextMonth;
394
- // Get the previous and next months and years
395
- const { month: prevMonth, year: prevMonthYear } = this.getPreviousMonth(month, year);
396
- const { month: nextMonth, year: nextMonthYear } = this.getNextMonth(month, year);
397
- // Get number of days in previous month
398
- const prevMonthDays = this.getMonthDays(prevMonth, prevMonthYear);
399
- // Builds dates to be displayed from previous month. The initialized array is "filled" with an arbitrary number because IE and Edge won't map over an array with empty values.
400
- const prevMonthDates = [...new Array(daysFromPrevMonth).fill("1")].map((_, index) => {
401
- const day = index + 1 + (prevMonthDays - daysFromPrevMonth);
402
- return [prevMonthYear.toString(), this.zeroPad(prevMonth, 2), this.zeroPad(day, 2)];
403
- });
404
- // Builds dates to be displayed from current month. The initialized array is "filled" with an arbitrary number because IE and Edge won't map over an array with empty values.
405
- const thisMonthDates = [...new Array(monthDays).fill("1")].map((_, index) => {
406
- const day = index + 1;
407
- return [year.toString(), this.zeroPad(month, 2), this.zeroPad(day, 2)];
408
- });
409
- // Builds dates to be displayed from next month. The initialized array is "filled" with an arbitrary number because IE and Edge won't map over an array with empty values.
410
- const nextMonthDates = [...new Array(daysFromNextMonth).fill("1")].map((_, index) => {
411
- const day = index + 1;
412
- return [nextMonthYear.toString(), this.zeroPad(nextMonth, 2), this.zeroPad(day, 2)];
413
- });
414
- // Combines all dates from previous, current and next months
415
- return [...prevMonthDates, ...thisMonthDates, ...nextMonthDates];
416
- }
417
- forwardOneMonth() {
418
- this.unfocusCell();
419
- const newMonth = this.getNextMonth(this.monthInFocus, this.yearInFocus);
420
- this.monthInFocus = newMonth.month;
421
- this.yearInFocus = newMonth.year;
422
- const totalDays = this.getMonthDays(this.monthInFocus, this.yearInFocus);
423
- if (this.dayInFocus > this.getMonthDays(this.monthInFocus, this.yearInFocus)) {
424
- this.dayInFocus = totalDays;
425
- }
426
- this.updateLiveRegion(`Displaying ${this.calendar_months[this.monthInFocus - 1]}, ${this.yearInFocus}`);
427
- }
428
- backOneMonth() {
429
- this.unfocusCell();
430
- const newMonth = this.getPreviousMonth(this.monthInFocus, this.yearInFocus);
431
- this.monthInFocus = newMonth.month;
432
- this.yearInFocus = newMonth.year;
433
- const totalDays = this.getMonthDays(this.monthInFocus, this.yearInFocus);
434
- if (this.dayInFocus > this.getMonthDays(this.monthInFocus, this.yearInFocus)) {
435
- this.dayInFocus = totalDays;
436
- }
437
- this.updateLiveRegion(`Viewing ${this.calendar_months[this.monthInFocus - 1]}, ${this.yearInFocus}`);
438
- }
439
- handleTriggeredDate(el) {
440
- this.cellTriggered.emit(el);
441
- // change of input value will trigger the function updating selectedDate
442
- this.closePopup(true);
443
- }
444
- handleSelectedDate() {
445
- //Remove old selection status
446
- if (this.selectedDate) {
447
- this.selectedDate.removeAttribute("aria-selected");
448
- }
449
- //Update selected date to new date inputted/selected
450
- this.selectedDate = this.getCellById(this.selectedYear, this.selectedMonth, this.selectedDay);
451
- if (this.selectedDate) {
452
- this.selectedDate.setAttribute("aria-selected", "true");
453
- }
454
- }
455
- getCellById(year, month, day) {
456
- const id = year + this.zeroPad(month, 2) + this.zeroPad(day, 2);
457
- return this.el.querySelector(`#cell-${id}-${this.parentId}`);
458
- }
459
- unfocusCell() {
460
- const cellToUnfocus = this.getCellById(this.yearInFocus, this.monthInFocus, this.dayInFocus);
461
- cellToUnfocus.tabIndex = -1;
462
- }
463
- focusCell() {
464
- //These two lines of code prevent an error from happening when the day in focus does not exist in a new month selected, e.g., May 31 is in focus, then the user selects "November". It will return focus in the date view to the last day of the month so that focus doesn't fly out of the popup.
465
- const maxDays = this.getMonthDays(this.monthInFocus, this.yearInFocus);
466
- this.dayInFocus = this.dayInFocus > maxDays ? maxDays : this.dayInFocus;
467
- const cellToFocus = this.getCellById(this.yearInFocus, this.monthInFocus, this.dayInFocus);
468
- if (cellToFocus) {
469
- cellToFocus.tabIndex = 0;
470
- cellToFocus.focus();
471
- }
472
- }
473
- unfocusMonth() {
474
- const monthToUnfocus = this.el.querySelector(`#month-${this.monthNumInFocus}-${this.parentId}`);
475
- monthToUnfocus.tabIndex = -1;
476
- }
477
- focusMonth() {
478
- const monthToFocus = this.el.querySelector(`#month-${this.monthNumInFocus}-${this.parentId}`);
479
- monthToFocus.tabIndex = 0;
480
- monthToFocus.focus();
481
- }
482
- trapFocusLeft(ev) {
483
- if (ev.shiftKey && ev.key === "Tab") {
484
- ev.preventDefault();
485
- this.focusCellInView();
486
- }
487
- }
488
- trapFocusEnd(ev) {
489
- if (!ev.shiftKey && ev.key === "Tab") {
490
- ev.preventDefault();
491
- this.prevButton.focus();
492
- }
493
- }
494
- trapFocusRight(ev) {
495
- if (!ev.shiftKey && ev.key === "Tab") {
496
- ev.preventDefault();
497
- this.focusCellInView();
498
- }
499
- }
500
- focusCellInView() {
501
- if (this.view === "day") {
502
- this.focusCell();
503
- }
504
- else {
505
- this.focusMonth();
506
- }
507
- }
508
- toggleBusyAttribute(state) {
509
- this.el.querySelector("#wm-container").setAttribute("aria-busy", state);
510
- }
511
- setDateValuesForView() {
512
- this.selectedYear = this.date.getUTCFullYear();
513
- this.selectedMonth = this.date.getUTCMonth() + 1;
514
- this.selectedDay = this.date.getUTCDate();
515
- this.monthInFocus = this.selectedMonth;
516
- this.yearInFocus = this.selectedYear;
517
- this.dayInFocus = this.selectedDay;
518
- this.monthNumInFocus = this.selectedMonth - 1;
519
- }
520
- updateLiveRegion(text) {
521
- let liveRegion = this.el.querySelector("#live-region");
522
- liveRegion.innerHTML = text;
523
- }
524
- panelPosition() {
525
- // getting a ref to the input el (in datepicker.tsx)
526
- let host = document.getElementById(this.parentId);
527
- const labelHeight = host.shadowRoot.querySelector(".label-wrapper").clientHeight;
528
- this.openUp = shouldOpenUp(host, this.popupEl.clientHeight, labelHeight);
529
- if (hasRoomRight(host, 336)) {
530
- this.popupEl.style.left = "0";
531
- this.popupEl.style.right = "auto";
532
- }
533
- else {
534
- this.popupEl.style.right = "0";
535
- this.popupEl.style.left = "auto";
536
- }
537
- }
538
- changeView(newView) {
539
- this.view = newView;
540
- //Ensure month view always opens to the month last visited in date view
541
- this.monthNumInFocus = this.monthInFocus - 1;
542
- }
543
- renderMonths(month, index) {
544
- return (h("div", { id: `month-${index}-${this.parentId}`, class: `month ${this.selectedMonth - 1 === index ? "selected" : ""}`, role: "gridcell", tabindex: index + 1 === this.monthInFocus ? 0 : -1, onKeyDown: (ev) => this.trapFocusEnd(ev), onBlur: (ev) => ev.stopPropagation(), onClick: () => {
545
- this.monthInFocus = index + 1;
546
- this.changeView("day");
547
- } }, month));
548
- }
549
- render() {
550
- const dates = this.getCalendarDates(this.monthInFocus, this.yearInFocus);
551
- return (h("div", { class: "container", id: "wm-container" }, h("button", { disabled: this.disabled, onClick: this.togglePopup.bind(this), "aria-describedby": `date-input-${this.parentId}`, ref: (el) => (this.buttonEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: `toggle-${this.parentId}` }, h("span", { class: "calendar", title: intl.formatMessage({
552
- id: "date.calendarView",
553
- defaultMessage: "Calendar View",
554
- description: "Calendar button",
555
- }) })), h("div", { class: `popup ${this.view}-view ${this.openUp ? "expand-upwards" : ""} ${this.isTabbing ? "user-is-tabbing" : ""}`, id: `popup-${this.parentId}`, ref: (el) => (this.popupEl = el), onClick: () => (this.popupClicked = true), role: "application", "aria-describedby": "application" }, this.view === "day" ? (h("div", { class: "day-view" }, h("div", { class: "calendar-header" }, h("button", { onClick: () => {
556
- this.prevClicked = true;
557
- this.popupClicked = true;
558
- this.backOneMonth();
559
- }, onKeyDown: (ev) => this.trapFocusLeft(ev), ref: (el) => (this.prevButton = el), class: "arw-btn", "aria-label": intl.formatMessage({
560
- id: "date.selectPreviousMonth",
561
- defaultMessage: "Select previous month",
562
- description: "Calendar button",
563
- }) }, h("span", { class: "mdi" }, "\uF141")), h("div", { id: `popup-title-month-${this.parentId}`, class: "title-box", tabindex: 0, role: "button", onKeyDown: (ev) => {
564
- if (ev.key === "Enter" || ev.key === " ") {
565
- ev.preventDefault();
566
- this.changeView("month");
567
- }
568
- }, onClick: this.changeView.bind(this, "month"), "aria-label": `${intl.formatMessage({
569
- id: "date.currentMonth",
570
- defaultMessage: "current month",
571
- description: "Calendar button",
572
- })}: ${this.calendar_months[this.monthInFocus - 1]}
573
- ${this.yearInFocus}.`, "aria-describedby": "month-title" }, h("span", { class: "title", "aria-hidden": "true" }, this.calendar_months[this.monthInFocus - 1], " ", this.yearInFocus)), h("button", { onClick: () => {
574
- this.nextClicked = true;
575
- this.popupClicked = true;
576
- this.forwardOneMonth();
577
- }, onKeyDown: (ev) => this.trapFocusRight(ev), "aria-label": intl.formatMessage({
578
- id: "date.selectNextMonth",
579
- defaultMessage: "Select next month",
580
- description: "Calendar button",
581
- }), ref: (el) => (this.nextButton = el), class: "arw-btn" }, h("span", { class: "mdi" }, "\uF142"))), h("div", { "aria-labelledby": `popup-title-month-${this.parentId}`, role: "grid", class: "date-grid" }, h("div", { role: "rowgroup", class: "date-header" }, h("div", { role: "row", class: "header-row" }, h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
582
- id: "date.su",
583
- defaultMessage: "Su",
584
- description: "Abbreviated day of the week",
585
- }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
586
- id: "date.mo",
587
- defaultMessage: "Mo",
588
- description: "Abbreviated day of the week",
589
- }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
590
- id: "date.tu",
591
- defaultMessage: "Tu",
592
- description: "Abbreviated day of the week",
593
- }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
594
- id: "date.we",
595
- defaultMessage: "We",
596
- description: "Abbreviated day of the week",
597
- }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
598
- id: "date.th",
599
- defaultMessage: "Th",
600
- description: "Abbreviated day of the week",
601
- }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
602
- id: "date.fr",
603
- defaultMessage: "Fr",
604
- description: "Abbreviated day of the week",
605
- }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
606
- id: "date.sa",
607
- defaultMessage: "Sa",
608
- description: "Abbreviated day of the week",
609
- }))))), h("div", { role: "rowgroup" }, h("div", { role: "row", class: "date-row" }, dates.slice(0, 7).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(7, 14).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(14, 21).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(21, 28).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(28, 35).map((date, i) => this.renderCalendarDate(date, i))), dates.length > 35 ? (h("div", { role: "row" }, dates.slice(35).map((date, i) => this.renderCalendarDate(date, i)))) : (""))))) : (h("div", { class: "month-view" }, h("div", { class: "calendar-header" }, h("button", { onClick: () => {
610
- this.prevClicked = true;
611
- this.popupClicked = true;
612
- this.yearInFocus -= 1;
613
- this.updateLiveRegion(`${this.yearInFocus} selected.`);
614
- }, onKeyDown: (ev) => this.trapFocusLeft(ev), "aria-label": intl.formatMessage({
615
- id: "date.selectPreviousYear",
616
- defaultMessage: "Select previous year",
617
- description: "Calendar button",
618
- }), ref: (el) => (this.prevButton = el), class: "arw-btn" }, h("span", { class: "mdi" }, "\uF141")), h("div", { id: `popup-title-year-${this.parentId}`, tabindex: 0, class: "title-box year", role: "button", onClick: this.changeView.bind(this, "day"), onKeyDown: (ev) => {
619
- if (ev.key === "Enter" || ev.key === " ") {
620
- ev.preventDefault();
621
- this.changeView("day");
622
- }
623
- }, "aria-labelledby": "year-title" }, h("span", { class: "title" }, this.yearInFocus)), h("button", { onClick: () => {
624
- this.nextClicked = true;
625
- this.popupClicked = true;
626
- this.yearInFocus += 1;
627
- this.updateLiveRegion(`${this.yearInFocus} selected.`);
628
- }, "aria-label": intl.formatMessage({
629
- id: "date.selectNextYear",
630
- defaultMessage: "Select next year",
631
- description: "Calendar button",
632
- }), onKeyDown: (ev) => this.trapFocusRight(ev), ref: (el) => (this.nextButton = el), class: "arw-btn" }, h("span", { class: "mdi" }, "\uF142"))), h("div", { "aria-labelledby": `popup-title-year-${this.parentId}`, role: "grid", class: "months" }, h("div", { role: "row", class: "month-row" }, this.calendar_months
633
- .slice(0, 3)
634
- .map((month, index) => this.renderMonths(month, index))), h("div", { role: "row", class: "month-row" }, this.calendar_months
635
- .slice(3, 6)
636
- .map((month, index) => this.renderMonths(month, index + 3))), h("div", { role: "row", class: "month-row" }, this.calendar_months
637
- .slice(6, 9)
638
- .map((month, index) => this.renderMonths(month, index + 6))), h("div", { role: "row", class: "month-row" }, this.calendar_months
639
- .slice(9)
640
- .map((month, index) => this.renderMonths(month, index + 9))))))), this.isExpanded && h("div", { id: "live-region", "aria-live": "polite", "aria-relevant": "text", class: "sr-only" }), h("div", { id: "month-title", class: "sr-only" }, intl.formatMessage({
641
- id: "date.selectMonth",
642
- defaultMessage: "Activate to select a month.",
643
- description: "Calendar button",
644
- })), h("div", { id: "year-title", class: "sr-only" }, intl.formatMessage({
645
- id: "date.selectYear",
646
- defaultMessage: "Activate to select a year.",
647
- description: "Calendar button",
648
- })), h("div", { id: "application", class: "sr-only" }, intl.formatMessage({
649
- id: "date.instructions",
650
- defaultMessage: "Use arrows to select a date in the table. Tab left or right to buttons for selecting previous month, next month, or the month selection table.",
651
- }))));
652
- }
653
- static get is() { return "priv-datepicker"; }
654
- static get originalStyleUrls() {
655
- return {
656
- "$": ["priv-datepicker.scss"]
657
- };
658
- }
659
- static get styleUrls() {
660
- return {
661
- "$": ["priv-datepicker.css"]
662
- };
663
- }
664
- static get properties() {
665
- return {
666
- "disabled": {
667
- "type": "boolean",
668
- "mutable": false,
669
- "complexType": {
670
- "original": "boolean",
671
- "resolved": "boolean",
672
- "references": {}
673
- },
674
- "required": false,
675
- "optional": false,
676
- "docs": {
677
- "tags": [],
678
- "text": ""
679
- },
680
- "attribute": "disabled",
681
- "reflect": false,
682
- "defaultValue": "false"
683
- },
684
- "isExpanded": {
685
- "type": "boolean",
686
- "mutable": true,
687
- "complexType": {
688
- "original": "boolean",
689
- "resolved": "boolean",
690
- "references": {}
691
- },
692
- "required": false,
693
- "optional": false,
694
- "docs": {
695
- "tags": [],
696
- "text": ""
697
- },
698
- "attribute": "is-expanded",
699
- "reflect": true,
700
- "defaultValue": "false"
701
- },
702
- "view": {
703
- "type": "string",
704
- "mutable": true,
705
- "complexType": {
706
- "original": "string",
707
- "resolved": "string",
708
- "references": {}
709
- },
710
- "required": false,
711
- "optional": false,
712
- "docs": {
713
- "tags": [],
714
- "text": ""
715
- },
716
- "attribute": "view",
717
- "reflect": true,
718
- "defaultValue": "\"day\""
719
- },
720
- "date": {
721
- "type": "unknown",
722
- "mutable": true,
723
- "complexType": {
724
- "original": "Date",
725
- "resolved": "Date",
726
- "references": {
727
- "Date": {
728
- "location": "global"
729
- }
730
- }
731
- },
732
- "required": false,
733
- "optional": false,
734
- "docs": {
735
- "tags": [],
736
- "text": ""
737
- },
738
- "defaultValue": "new Date()"
739
- },
740
- "selectedYear": {
741
- "type": "number",
742
- "mutable": true,
743
- "complexType": {
744
- "original": "number",
745
- "resolved": "number",
746
- "references": {}
747
- },
748
- "required": false,
749
- "optional": false,
750
- "docs": {
751
- "tags": [],
752
- "text": ""
753
- },
754
- "attribute": "selected-year",
755
- "reflect": false,
756
- "defaultValue": "this.date.getUTCFullYear()"
757
- },
758
- "selectedMonth": {
759
- "type": "number",
760
- "mutable": true,
761
- "complexType": {
762
- "original": "number",
763
- "resolved": "number",
764
- "references": {}
765
- },
766
- "required": false,
767
- "optional": false,
768
- "docs": {
769
- "tags": [],
770
- "text": ""
771
- },
772
- "attribute": "selected-month",
773
- "reflect": false,
774
- "defaultValue": "this.date.getUTCMonth() + 1"
775
- },
776
- "selectedDay": {
777
- "type": "number",
778
- "mutable": true,
779
- "complexType": {
780
- "original": "number",
781
- "resolved": "number",
782
- "references": {}
783
- },
784
- "required": false,
785
- "optional": false,
786
- "docs": {
787
- "tags": [],
788
- "text": ""
789
- },
790
- "attribute": "selected-day",
791
- "reflect": false,
792
- "defaultValue": "this.date.getUTCDate()"
793
- },
794
- "monthInFocus": {
795
- "type": "number",
796
- "mutable": true,
797
- "complexType": {
798
- "original": "number",
799
- "resolved": "number",
800
- "references": {}
801
- },
802
- "required": false,
803
- "optional": false,
804
- "docs": {
805
- "tags": [],
806
- "text": ""
807
- },
808
- "attribute": "month-in-focus",
809
- "reflect": false,
810
- "defaultValue": "this.selectedMonth"
811
- },
812
- "yearInFocus": {
813
- "type": "number",
814
- "mutable": true,
815
- "complexType": {
816
- "original": "number",
817
- "resolved": "number",
818
- "references": {}
819
- },
820
- "required": false,
821
- "optional": false,
822
- "docs": {
823
- "tags": [],
824
- "text": ""
825
- },
826
- "attribute": "year-in-focus",
827
- "reflect": false,
828
- "defaultValue": "this.selectedYear"
829
- },
830
- "dayInFocus": {
831
- "type": "number",
832
- "mutable": true,
833
- "complexType": {
834
- "original": "number",
835
- "resolved": "number",
836
- "references": {}
837
- },
838
- "required": false,
839
- "optional": false,
840
- "docs": {
841
- "tags": [],
842
- "text": ""
843
- },
844
- "attribute": "day-in-focus",
845
- "reflect": false,
846
- "defaultValue": "this.selectedDay"
847
- },
848
- "parentId": {
849
- "type": "string",
850
- "mutable": true,
851
- "complexType": {
852
- "original": "string",
853
- "resolved": "string",
854
- "references": {}
855
- },
856
- "required": false,
857
- "optional": false,
858
- "docs": {
859
- "tags": [],
860
- "text": ""
861
- },
862
- "attribute": "parent-id",
863
- "reflect": true,
864
- "defaultValue": "\"\""
865
- }
866
- };
867
- }
868
- static get states() {
869
- return {
870
- "monthNumInFocus": {},
871
- "isTabbing": {}
872
- };
873
- }
874
- static get events() {
875
- return [{
876
- "method": "cellTriggered",
877
- "name": "cellTriggered",
878
- "bubbles": true,
879
- "cancelable": true,
880
- "composed": true,
881
- "docs": {
882
- "tags": [],
883
- "text": ""
884
- },
885
- "complexType": {
886
- "original": "HTMLElement",
887
- "resolved": "HTMLElement",
888
- "references": {
889
- "HTMLElement": {
890
- "location": "global"
891
- }
892
- }
893
- }
894
- }, {
895
- "method": "toggleButtonClicked",
896
- "name": "toggleButtonClicked",
897
- "bubbles": true,
898
- "cancelable": true,
899
- "composed": true,
900
- "docs": {
901
- "tags": [],
902
- "text": ""
903
- },
904
- "complexType": {
905
- "original": "HTMLButtonElement",
906
- "resolved": "HTMLButtonElement",
907
- "references": {
908
- "HTMLButtonElement": {
909
- "location": "global"
910
- }
911
- }
912
- }
913
- }, {
914
- "method": "popupClosed",
915
- "name": "popupClosed",
916
- "bubbles": true,
917
- "cancelable": true,
918
- "composed": true,
919
- "docs": {
920
- "tags": [],
921
- "text": ""
922
- },
923
- "complexType": {
924
- "original": "any",
925
- "resolved": "any",
926
- "references": {}
927
- }
928
- }, {
929
- "method": "popupBlurred",
930
- "name": "popupBlurred",
931
- "bubbles": true,
932
- "cancelable": true,
933
- "composed": true,
934
- "docs": {
935
- "tags": [],
936
- "text": ""
937
- },
938
- "complexType": {
939
- "original": "{ relatedTarget: EventTarget | null }",
940
- "resolved": "{ relatedTarget: EventTarget | null; }",
941
- "references": {
942
- "EventTarget": {
943
- "location": "global"
944
- }
945
- }
946
- }
947
- }];
948
- }
949
- static get elementRef() { return "el"; }
950
- static get listeners() {
951
- return [{
952
- "name": "keydown",
953
- "method": "handleKey",
954
- "target": undefined,
955
- "capture": false,
956
- "passive": false
957
- }, {
958
- "name": "keydown",
959
- "method": "toggleTabbingOn",
960
- "target": undefined,
961
- "capture": false,
962
- "passive": false
963
- }, {
964
- "name": "mousedown",
965
- "method": "toggleTabbingOff",
966
- "target": "window",
967
- "capture": false,
968
- "passive": true
969
- }, {
970
- "name": "click",
971
- "method": "blurHandler",
972
- "target": "document",
973
- "capture": false,
974
- "passive": false
975
- }, {
976
- "name": "blur",
977
- "method": "handleBlurOnWindow",
978
- "target": "window",
979
- "capture": false,
980
- "passive": false
981
- }];
982
- }
983
- }
1
+ import { h } from "@stencil/core";
2
+ import { forceUpdate } from "@stencil/core";
3
+ import { intl, hasRoomRight, shouldOpenUp } from "../../../global/functions";
4
+ export class PrivDatepicker {
5
+ constructor() {
6
+ this.popupClicked = true;
7
+ this.buttonClicked = true;
8
+ this.prevClicked = true;
9
+ this.nextClicked = true;
10
+ this.openUp = false;
11
+ this.calendar_months = [
12
+ intl.formatMessage({
13
+ id: "date.january",
14
+ defaultMessage: "January",
15
+ description: "Month of the year",
16
+ }),
17
+ intl.formatMessage({
18
+ id: "date.february",
19
+ defaultMessage: "February",
20
+ description: "Month of the year",
21
+ }),
22
+ intl.formatMessage({
23
+ id: "date.march",
24
+ defaultMessage: "March",
25
+ description: "Month of the year",
26
+ }),
27
+ intl.formatMessage({
28
+ id: "date.april",
29
+ defaultMessage: "April",
30
+ description: "Month of the year",
31
+ }),
32
+ intl.formatMessage({
33
+ id: "date.may",
34
+ defaultMessage: "May",
35
+ description: "Month of the year",
36
+ }),
37
+ intl.formatMessage({
38
+ id: "date.june",
39
+ defaultMessage: "June",
40
+ description: "Month of the year",
41
+ }),
42
+ intl.formatMessage({
43
+ id: "date.july",
44
+ defaultMessage: "July",
45
+ description: "Month of the year",
46
+ }),
47
+ intl.formatMessage({
48
+ id: "date.august",
49
+ defaultMessage: "August",
50
+ description: "Month of the year",
51
+ }),
52
+ intl.formatMessage({
53
+ id: "date.september",
54
+ defaultMessage: "September",
55
+ description: "Month of the year",
56
+ }),
57
+ intl.formatMessage({
58
+ id: "date.october",
59
+ defaultMessage: "October",
60
+ description: "Month of the year",
61
+ }),
62
+ intl.formatMessage({
63
+ id: "date.november",
64
+ defaultMessage: "November",
65
+ description: "Month of the year",
66
+ }),
67
+ intl.formatMessage({
68
+ id: "date.december",
69
+ defaultMessage: "December",
70
+ description: "Month of the year",
71
+ }),
72
+ ];
73
+ this.weekdays = [
74
+ intl.formatMessage({ id: "date.sunday", defaultMessage: "Sunday" }),
75
+ intl.formatMessage({ id: "date.monday", defaultMessage: "Monday" }),
76
+ intl.formatMessage({ id: "date.tuesday", defaultMessage: "Tuesday" }),
77
+ intl.formatMessage({ id: "date.wednesday", defaultMessage: "Wednesday" }),
78
+ intl.formatMessage({ id: "date.thursday", defaultMessage: "Thursday" }),
79
+ intl.formatMessage({ id: "date.friday", defaultMessage: "Friday" }),
80
+ intl.formatMessage({ id: "date.saturday", defaultMessage: "Saturday" }),
81
+ ];
82
+ this.renderCalendarDate = (date, index) => {
83
+ let monthOfDate = this.removeZeroes(String(date[1]));
84
+ let dayOfDate = this.removeZeroes(String(date[2]));
85
+ let isThisMonth = monthOfDate === this.monthInFocus ? "current-month" : "";
86
+ const dateId = date[0] + date[1] + date[2];
87
+ const isToday = this.isDateToday(date);
88
+ return (h("div", { role: "gridcell", id: `cell-${dateId}-${this.parentId}`, class: `date-cell ${isThisMonth}`, "aria-selected": false, "aria-label": `${isToday
89
+ ? `${intl.formatMessage({
90
+ id: "date.today",
91
+ defaultMessage: "today",
92
+ description: "calendar button",
93
+ })}, `
94
+ : ""}${this.weekdays[index]}, ${this.calendar_months[monthOfDate - 1]} ${dayOfDate}, ${date[0]}`, onClick: (ev) => {
95
+ this.handleTriggeredDate(ev.target);
96
+ }, onKeyDown: (ev) => this.trapFocusEnd(ev), "data-month": date[1], "data-year": date[0], onBlur: (ev) => ev.stopPropagation() }, dayOfDate));
97
+ };
98
+ this.disabled = false;
99
+ this.isExpanded = false;
100
+ this.view = "day";
101
+ this.date = new Date();
102
+ this.selectedYear = this.date.getUTCFullYear();
103
+ this.selectedMonth = this.date.getUTCMonth() + 1;
104
+ this.selectedDay = this.date.getUTCDate();
105
+ this.monthInFocus = this.selectedMonth;
106
+ this.yearInFocus = this.selectedYear;
107
+ this.dayInFocus = this.selectedDay;
108
+ this.monthNumInFocus = this.selectedMonth;
109
+ this.parentId = "";
110
+ this.isTabbing = false;
111
+ }
112
+ handleKey(ev) {
113
+ this.prevClicked = false;
114
+ this.nextClicked = false;
115
+ switch (ev.key) {
116
+ case "Enter":
117
+ ev.preventDefault();
118
+ //Clunky exception for blur validation. Remove when blur reworked.
119
+ !ev.target.id.includes("popup-title") && ev.target.click();
120
+ break;
121
+ case "Escape":
122
+ ev.preventDefault();
123
+ if (this.isExpanded) {
124
+ ev.stopPropagation(); // prevents closing of parent modal
125
+ this.closePopup(true);
126
+ }
127
+ break;
128
+ case "PageUp":
129
+ ev.preventDefault();
130
+ this.backOneMonth();
131
+ break;
132
+ case "PageDown":
133
+ ev.preventDefault();
134
+ this.forwardOneMonth();
135
+ break;
136
+ case "Home":
137
+ ev.preventDefault();
138
+ this.unfocusCell();
139
+ this.dayInFocus = 1;
140
+ forceUpdate(this.el);
141
+ break;
142
+ case "End":
143
+ ev.preventDefault();
144
+ this.unfocusCell();
145
+ this.dayInFocus = this.getMonthDays(this.monthInFocus, this.yearInFocus);
146
+ forceUpdate(this.el);
147
+ break;
148
+ case "ArrowLeft":
149
+ ev.preventDefault();
150
+ if (this.view === "day") {
151
+ this.unfocusCell();
152
+ if (this.dayInFocus === 1) {
153
+ const newMonth = this.getPreviousMonth(this.monthInFocus, this.yearInFocus);
154
+ this.monthInFocus = newMonth.month;
155
+ this.yearInFocus = newMonth.year;
156
+ this.dayInFocus = this.getMonthDays(this.monthInFocus, this.yearInFocus);
157
+ }
158
+ else {
159
+ this.dayInFocus -= 1;
160
+ }
161
+ }
162
+ else {
163
+ this.unfocusMonth();
164
+ if (this.monthNumInFocus === 0) {
165
+ this.monthNumInFocus = 11;
166
+ }
167
+ else {
168
+ this.monthNumInFocus -= 1;
169
+ }
170
+ }
171
+ break;
172
+ case "ArrowRight":
173
+ ev.preventDefault();
174
+ if (this.view === "day") {
175
+ this.unfocusCell();
176
+ if (this.dayInFocus === this.getMonthDays(this.monthInFocus, this.yearInFocus)) {
177
+ const newMonth = this.getNextMonth(this.monthInFocus, this.yearInFocus);
178
+ this.monthInFocus = newMonth.month;
179
+ this.yearInFocus = newMonth.year;
180
+ this.dayInFocus = 1;
181
+ }
182
+ else {
183
+ this.dayInFocus += 1;
184
+ }
185
+ }
186
+ else {
187
+ this.unfocusMonth();
188
+ if (this.monthNumInFocus === 11) {
189
+ this.monthNumInFocus = 0;
190
+ }
191
+ else {
192
+ this.monthNumInFocus += 1;
193
+ }
194
+ }
195
+ break;
196
+ case "ArrowUp":
197
+ ev.preventDefault();
198
+ if (this.view === "day") {
199
+ this.unfocusCell();
200
+ if (this.dayInFocus < 8) {
201
+ const newMonth = this.getPreviousMonth(this.monthInFocus, this.yearInFocus);
202
+ this.monthInFocus = newMonth.month;
203
+ this.yearInFocus = newMonth.year;
204
+ const numDaysToSubtract = 7 - this.dayInFocus;
205
+ this.dayInFocus = this.getMonthDays(this.monthInFocus, this.yearInFocus) - numDaysToSubtract;
206
+ }
207
+ else {
208
+ this.dayInFocus -= 7;
209
+ }
210
+ }
211
+ else {
212
+ this.unfocusMonth();
213
+ if (this.monthNumInFocus < 3) {
214
+ this.monthNumInFocus += 9;
215
+ }
216
+ else {
217
+ this.monthNumInFocus -= 3;
218
+ }
219
+ }
220
+ break;
221
+ case "ArrowDown":
222
+ ev.preventDefault();
223
+ if (!this.isExpanded) {
224
+ this.openPopup();
225
+ }
226
+ else {
227
+ if (this.view === "day") {
228
+ //If the down arrow is pressed from the month button or the arrow buttons, focus should shift to the current cell in focus
229
+ if (!(document.activeElement.shadowRoot || document).activeElement.classList.contains("date-cell")) {
230
+ this.focusCell();
231
+ break;
232
+ }
233
+ this.unfocusCell();
234
+ const changeoverDate = this.getMonthDays(this.monthInFocus, this.yearInFocus) - 7;
235
+ if (this.dayInFocus > changeoverDate) {
236
+ const newMonth = this.getNextMonth(this.monthInFocus, this.yearInFocus);
237
+ this.monthInFocus = newMonth.month;
238
+ this.yearInFocus = newMonth.year;
239
+ this.dayInFocus = this.dayInFocus - changeoverDate;
240
+ }
241
+ else {
242
+ this.dayInFocus += 7;
243
+ }
244
+ }
245
+ else {
246
+ //If the down arrow is pressed from the arrow buttons or the title box, focus should shift to the current month in focus
247
+ const activeEl = (document.activeElement.shadowRoot || document).activeElement;
248
+ if (activeEl.tagName === "BUTTON" || activeEl.id.includes("popup-title-year")) {
249
+ this.focusMonth();
250
+ break;
251
+ }
252
+ this.unfocusMonth();
253
+ if (this.monthNumInFocus > 8) {
254
+ this.monthNumInFocus -= 9;
255
+ }
256
+ else {
257
+ this.monthNumInFocus += 3;
258
+ }
259
+ }
260
+ }
261
+ break;
262
+ }
263
+ }
264
+ toggleTabbingOn(ev) {
265
+ const validKeys = ["Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter"];
266
+ if (validKeys.includes(ev.key)) {
267
+ this.isTabbing = true;
268
+ }
269
+ }
270
+ //Using mousedown prevents this from running when the keydown listener emits ".click()" for when enter is pressed.
271
+ toggleTabbingOff() {
272
+ this.isTabbing = false;
273
+ }
274
+ blurHandler(ev) {
275
+ if (!this.popupClicked && !this.buttonClicked && this.isExpanded) {
276
+ this.closePopup();
277
+ // in this case, the PointerEvent target is identical to the blur events relatedTarget, and is passed on as such
278
+ this.popupBlurred.emit({ relatedTarget: ev.target });
279
+ }
280
+ this.popupClicked = false;
281
+ this.buttonClicked = false;
282
+ }
283
+ handleBlurOnWindow(ev) {
284
+ // for cases where the user clicks or uses a shortcut to leave the document
285
+ if (this.isExpanded) {
286
+ this.closePopup();
287
+ this.popupBlurred.emit({ relatedTarget: ev.target });
288
+ }
289
+ }
290
+ componentDidUpdate() {
291
+ this.handleSelectedDate();
292
+ if (this.isExpanded) {
293
+ this.prevClicked
294
+ ? this.prevButton.focus()
295
+ : this.nextClicked
296
+ ? this.nextButton.focus()
297
+ : this.view === "day"
298
+ ? this.focusCell()
299
+ : this.focusMonth();
300
+ }
301
+ }
302
+ componentDidLoad() {
303
+ this.handleSelectedDate();
304
+ this.setDateValuesForView();
305
+ }
306
+ zeroPad(value, length) {
307
+ if (!String.prototype.padStart) {
308
+ String.prototype.padStart = function padStart(targetLength, padString) {
309
+ targetLength = targetLength - this.length;
310
+ if (targetLength > padString.length) {
311
+ padString += padString.repeat(targetLength / padString.length);
312
+ }
313
+ return padString.slice(0, targetLength) + String(this);
314
+ };
315
+ }
316
+ return `${value.toString()}`.padStart(length, "0");
317
+ }
318
+ removeZeroes(date) {
319
+ return +date < 10 ? +date.slice(1) : +date;
320
+ }
321
+ isDateToday(date) {
322
+ const today = new Date();
323
+ const todayDateArray = [
324
+ today.getFullYear().toString(),
325
+ (today.getMonth() + 1).toString(),
326
+ today.getDate().toString(),
327
+ ];
328
+ //Compare today's date to date and return true if they match
329
+ return todayDateArray.reduce((result, val, index) => result && this.removeZeroes(date[index]).toString() === val, true);
330
+ }
331
+ togglePopup() {
332
+ this.isExpanded ? this.closePopup() : this.openPopup();
333
+ this.buttonClicked = true;
334
+ }
335
+ closePopup(returnFocus = false) {
336
+ this.isExpanded = false;
337
+ this.popupEl.classList.remove("open");
338
+ window.setTimeout(() => {
339
+ //not using display none in order to get measurements of the popup while hidden
340
+ this.popupEl.style.visibility = "hidden";
341
+ }, 250);
342
+ //Reset values so that menu reopens to day view with selected date in focus
343
+ if (this.view === "day") {
344
+ this.unfocusCell();
345
+ }
346
+ this.monthInFocus = this.selectedMonth;
347
+ this.yearInFocus = this.selectedYear;
348
+ this.dayInFocus = this.selectedDay;
349
+ this.changeView("day");
350
+ if (returnFocus) {
351
+ this.buttonEl.focus();
352
+ }
353
+ }
354
+ openPopup() {
355
+ this.panelPosition();
356
+ this.setDateValuesForView();
357
+ this.prevClicked = false;
358
+ this.nextClicked = false;
359
+ this.popupEl.style.visibility = "visible";
360
+ window.requestAnimationFrame(() => {
361
+ this.popupEl.classList.add("open");
362
+ });
363
+ this.isExpanded = true;
364
+ this.focusCell();
365
+ }
366
+ getMonthDays(month, year) {
367
+ const months30 = [4, 6, 9, 11];
368
+ const leapYear = year % 4 === 0;
369
+ return month === 2 ? (leapYear ? 29 : 28) : months30.includes(month) ? 30 : 31;
370
+ }
371
+ // 1 => Sunday, 7 => Saturday
372
+ getMonthFirstDay(month, year) {
373
+ return +new Date(year, month - 1, 1, 12, 0, 0).getDay() + 1;
374
+ }
375
+ getPreviousMonth(month, year) {
376
+ const prevMonth = month > 1 ? month - 1 : 12;
377
+ const prevMonthYear = month > 1 ? year : year - 1;
378
+ return { month: prevMonth, year: prevMonthYear };
379
+ }
380
+ getNextMonth(month, year) {
381
+ const nextMonth = month < 12 ? month + 1 : 1;
382
+ const nextMonthYear = month < 12 ? year : year + 1;
383
+ return { month: nextMonth, year: nextMonthYear };
384
+ }
385
+ getCalendarDates(month, year) {
386
+ // Get number of days in the month and the month's first day
387
+ const monthDays = this.getMonthDays(month, year);
388
+ const monthFirstDay = this.getMonthFirstDay(month, year);
389
+ // Get number of days to be displayed from previous and next months
390
+ // These ensure a total of 42 days (6 weeks) displayed on the calendar
391
+ const daysFromPrevMonth = monthFirstDay - 1;
392
+ let daysFromNextMonth = 42 - (daysFromPrevMonth + monthDays);
393
+ daysFromNextMonth = daysFromNextMonth > 6 ? daysFromNextMonth - 7 : daysFromNextMonth;
394
+ // Get the previous and next months and years
395
+ const { month: prevMonth, year: prevMonthYear } = this.getPreviousMonth(month, year);
396
+ const { month: nextMonth, year: nextMonthYear } = this.getNextMonth(month, year);
397
+ // Get number of days in previous month
398
+ const prevMonthDays = this.getMonthDays(prevMonth, prevMonthYear);
399
+ // Builds dates to be displayed from previous month. The initialized array is "filled" with an arbitrary number because IE and Edge won't map over an array with empty values.
400
+ const prevMonthDates = [...new Array(daysFromPrevMonth).fill("1")].map((_, index) => {
401
+ const day = index + 1 + (prevMonthDays - daysFromPrevMonth);
402
+ return [prevMonthYear.toString(), this.zeroPad(prevMonth, 2), this.zeroPad(day, 2)];
403
+ });
404
+ // Builds dates to be displayed from current month. The initialized array is "filled" with an arbitrary number because IE and Edge won't map over an array with empty values.
405
+ const thisMonthDates = [...new Array(monthDays).fill("1")].map((_, index) => {
406
+ const day = index + 1;
407
+ return [year.toString(), this.zeroPad(month, 2), this.zeroPad(day, 2)];
408
+ });
409
+ // Builds dates to be displayed from next month. The initialized array is "filled" with an arbitrary number because IE and Edge won't map over an array with empty values.
410
+ const nextMonthDates = [...new Array(daysFromNextMonth).fill("1")].map((_, index) => {
411
+ const day = index + 1;
412
+ return [nextMonthYear.toString(), this.zeroPad(nextMonth, 2), this.zeroPad(day, 2)];
413
+ });
414
+ // Combines all dates from previous, current and next months
415
+ return [...prevMonthDates, ...thisMonthDates, ...nextMonthDates];
416
+ }
417
+ forwardOneMonth() {
418
+ this.unfocusCell();
419
+ const newMonth = this.getNextMonth(this.monthInFocus, this.yearInFocus);
420
+ this.monthInFocus = newMonth.month;
421
+ this.yearInFocus = newMonth.year;
422
+ const totalDays = this.getMonthDays(this.monthInFocus, this.yearInFocus);
423
+ if (this.dayInFocus > this.getMonthDays(this.monthInFocus, this.yearInFocus)) {
424
+ this.dayInFocus = totalDays;
425
+ }
426
+ this.updateLiveRegion(`Displaying ${this.calendar_months[this.monthInFocus - 1]}, ${this.yearInFocus}`);
427
+ }
428
+ backOneMonth() {
429
+ this.unfocusCell();
430
+ const newMonth = this.getPreviousMonth(this.monthInFocus, this.yearInFocus);
431
+ this.monthInFocus = newMonth.month;
432
+ this.yearInFocus = newMonth.year;
433
+ const totalDays = this.getMonthDays(this.monthInFocus, this.yearInFocus);
434
+ if (this.dayInFocus > this.getMonthDays(this.monthInFocus, this.yearInFocus)) {
435
+ this.dayInFocus = totalDays;
436
+ }
437
+ this.updateLiveRegion(`Viewing ${this.calendar_months[this.monthInFocus - 1]}, ${this.yearInFocus}`);
438
+ }
439
+ handleTriggeredDate(el) {
440
+ this.cellTriggered.emit(el);
441
+ // change of input value will trigger the function updating selectedDate
442
+ this.closePopup(true);
443
+ }
444
+ handleSelectedDate() {
445
+ //Remove old selection status
446
+ if (this.selectedDate) {
447
+ this.selectedDate.removeAttribute("aria-selected");
448
+ }
449
+ //Update selected date to new date inputted/selected
450
+ this.selectedDate = this.getCellById(this.selectedYear, this.selectedMonth, this.selectedDay);
451
+ if (this.selectedDate) {
452
+ this.selectedDate.setAttribute("aria-selected", "true");
453
+ }
454
+ }
455
+ getCellById(year, month, day) {
456
+ const id = year + this.zeroPad(month, 2) + this.zeroPad(day, 2);
457
+ return this.el.querySelector(`#cell-${id}-${this.parentId}`);
458
+ }
459
+ unfocusCell() {
460
+ const cellToUnfocus = this.getCellById(this.yearInFocus, this.monthInFocus, this.dayInFocus);
461
+ cellToUnfocus.tabIndex = -1;
462
+ }
463
+ focusCell() {
464
+ //These two lines of code prevent an error from happening when the day in focus does not exist in a new month selected, e.g., May 31 is in focus, then the user selects "November". It will return focus in the date view to the last day of the month so that focus doesn't fly out of the popup.
465
+ const maxDays = this.getMonthDays(this.monthInFocus, this.yearInFocus);
466
+ this.dayInFocus = this.dayInFocus > maxDays ? maxDays : this.dayInFocus;
467
+ const cellToFocus = this.getCellById(this.yearInFocus, this.monthInFocus, this.dayInFocus);
468
+ if (cellToFocus) {
469
+ cellToFocus.tabIndex = 0;
470
+ cellToFocus.focus();
471
+ }
472
+ }
473
+ unfocusMonth() {
474
+ const monthToUnfocus = this.el.querySelector(`#month-${this.monthNumInFocus}-${this.parentId}`);
475
+ monthToUnfocus.tabIndex = -1;
476
+ }
477
+ focusMonth() {
478
+ const monthToFocus = this.el.querySelector(`#month-${this.monthNumInFocus}-${this.parentId}`);
479
+ monthToFocus.tabIndex = 0;
480
+ monthToFocus.focus();
481
+ }
482
+ trapFocusLeft(ev) {
483
+ if (ev.shiftKey && ev.key === "Tab") {
484
+ ev.preventDefault();
485
+ this.focusCellInView();
486
+ }
487
+ }
488
+ trapFocusEnd(ev) {
489
+ if (!ev.shiftKey && ev.key === "Tab") {
490
+ ev.preventDefault();
491
+ this.prevButton.focus();
492
+ }
493
+ }
494
+ trapFocusRight(ev) {
495
+ if (!ev.shiftKey && ev.key === "Tab") {
496
+ ev.preventDefault();
497
+ this.focusCellInView();
498
+ }
499
+ }
500
+ focusCellInView() {
501
+ if (this.view === "day") {
502
+ this.focusCell();
503
+ }
504
+ else {
505
+ this.focusMonth();
506
+ }
507
+ }
508
+ toggleBusyAttribute(state) {
509
+ this.el.querySelector("#wm-container").setAttribute("aria-busy", state);
510
+ }
511
+ setDateValuesForView() {
512
+ this.selectedYear = this.date.getUTCFullYear();
513
+ this.selectedMonth = this.date.getUTCMonth() + 1;
514
+ this.selectedDay = this.date.getUTCDate();
515
+ this.monthInFocus = this.selectedMonth;
516
+ this.yearInFocus = this.selectedYear;
517
+ this.dayInFocus = this.selectedDay;
518
+ this.monthNumInFocus = this.selectedMonth - 1;
519
+ }
520
+ updateLiveRegion(text) {
521
+ let liveRegion = this.el.querySelector("#live-region");
522
+ liveRegion.innerHTML = text;
523
+ }
524
+ panelPosition() {
525
+ // getting a ref to the input el (in datepicker.tsx)
526
+ let host = document.getElementById(this.parentId);
527
+ const labelHeight = host.shadowRoot.querySelector(".label-wrapper").clientHeight;
528
+ this.openUp = shouldOpenUp(host, this.popupEl.clientHeight, labelHeight);
529
+ if (hasRoomRight(host, 336)) {
530
+ this.popupEl.style.left = "0";
531
+ this.popupEl.style.right = "auto";
532
+ }
533
+ else {
534
+ this.popupEl.style.right = "0";
535
+ this.popupEl.style.left = "auto";
536
+ }
537
+ }
538
+ changeView(newView) {
539
+ this.view = newView;
540
+ //Ensure month view always opens to the month last visited in date view
541
+ this.monthNumInFocus = this.monthInFocus - 1;
542
+ }
543
+ renderMonths(month, index) {
544
+ return (h("div", { id: `month-${index}-${this.parentId}`, class: `month ${this.selectedMonth - 1 === index ? "selected" : ""}`, role: "gridcell", tabindex: index + 1 === this.monthInFocus ? 0 : -1, onKeyDown: (ev) => this.trapFocusEnd(ev), onBlur: (ev) => ev.stopPropagation(), onClick: () => {
545
+ this.monthInFocus = index + 1;
546
+ this.changeView("day");
547
+ } }, month));
548
+ }
549
+ render() {
550
+ const dates = this.getCalendarDates(this.monthInFocus, this.yearInFocus);
551
+ return (h("div", { class: "container", id: "wm-container" }, h("button", { disabled: this.disabled, onClick: this.togglePopup.bind(this), "aria-describedby": `date-input-${this.parentId}`, ref: (el) => (this.buttonEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: `toggle-${this.parentId}` }, h("span", { class: "calendar", title: intl.formatMessage({
552
+ id: "date.calendarView",
553
+ defaultMessage: "Calendar View",
554
+ description: "Calendar button",
555
+ }) })), h("div", { class: `popup ${this.view}-view ${this.openUp ? "expand-upwards" : ""} ${this.isTabbing ? "user-is-tabbing" : ""}`, id: `popup-${this.parentId}`, ref: (el) => (this.popupEl = el), onClick: () => (this.popupClicked = true), role: "application", "aria-describedby": "application" }, this.view === "day" ? (h("div", { class: "day-view" }, h("div", { class: "calendar-header" }, h("button", { onClick: () => {
556
+ this.prevClicked = true;
557
+ this.popupClicked = true;
558
+ this.backOneMonth();
559
+ }, onKeyDown: (ev) => this.trapFocusLeft(ev), ref: (el) => (this.prevButton = el), class: "arw-btn", "aria-label": intl.formatMessage({
560
+ id: "date.selectPreviousMonth",
561
+ defaultMessage: "Select previous month",
562
+ description: "Calendar button",
563
+ }) }, h("span", { class: "mdi" }, "\uF141")), h("div", { id: `popup-title-month-${this.parentId}`, class: "title-box", tabindex: 0, role: "button", onKeyDown: (ev) => {
564
+ if (ev.key === "Enter" || ev.key === " ") {
565
+ ev.preventDefault();
566
+ this.changeView("month");
567
+ }
568
+ }, onClick: this.changeView.bind(this, "month"), "aria-label": `${intl.formatMessage({
569
+ id: "date.currentMonth",
570
+ defaultMessage: "current month",
571
+ description: "Calendar button",
572
+ })}: ${this.calendar_months[this.monthInFocus - 1]}
573
+ ${this.yearInFocus}.`, "aria-describedby": "month-title" }, h("span", { class: "title", "aria-hidden": "true" }, this.calendar_months[this.monthInFocus - 1], " ", this.yearInFocus)), h("button", { onClick: () => {
574
+ this.nextClicked = true;
575
+ this.popupClicked = true;
576
+ this.forwardOneMonth();
577
+ }, onKeyDown: (ev) => this.trapFocusRight(ev), "aria-label": intl.formatMessage({
578
+ id: "date.selectNextMonth",
579
+ defaultMessage: "Select next month",
580
+ description: "Calendar button",
581
+ }), ref: (el) => (this.nextButton = el), class: "arw-btn" }, h("span", { class: "mdi" }, "\uF142"))), h("div", { "aria-labelledby": `popup-title-month-${this.parentId}`, role: "grid", class: "date-grid" }, h("div", { role: "rowgroup", class: "date-header" }, h("div", { role: "row", class: "header-row" }, h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
582
+ id: "date.su",
583
+ defaultMessage: "Su",
584
+ description: "Abbreviated day of the week",
585
+ }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
586
+ id: "date.mo",
587
+ defaultMessage: "Mo",
588
+ description: "Abbreviated day of the week",
589
+ }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
590
+ id: "date.tu",
591
+ defaultMessage: "Tu",
592
+ description: "Abbreviated day of the week",
593
+ }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
594
+ id: "date.we",
595
+ defaultMessage: "We",
596
+ description: "Abbreviated day of the week",
597
+ }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
598
+ id: "date.th",
599
+ defaultMessage: "Th",
600
+ description: "Abbreviated day of the week",
601
+ }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
602
+ id: "date.fr",
603
+ defaultMessage: "Fr",
604
+ description: "Abbreviated day of the week",
605
+ }))), h("div", { role: "columnheader", class: "header-cell" }, h("span", null, intl.formatMessage({
606
+ id: "date.sa",
607
+ defaultMessage: "Sa",
608
+ description: "Abbreviated day of the week",
609
+ }))))), h("div", { role: "rowgroup" }, h("div", { role: "row", class: "date-row" }, dates.slice(0, 7).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(7, 14).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(14, 21).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(21, 28).map((date, i) => this.renderCalendarDate(date, i))), h("div", { role: "row" }, dates.slice(28, 35).map((date, i) => this.renderCalendarDate(date, i))), dates.length > 35 ? (h("div", { role: "row" }, dates.slice(35).map((date, i) => this.renderCalendarDate(date, i)))) : (""))))) : (h("div", { class: "month-view" }, h("div", { class: "calendar-header" }, h("button", { onClick: () => {
610
+ this.prevClicked = true;
611
+ this.popupClicked = true;
612
+ this.yearInFocus -= 1;
613
+ this.updateLiveRegion(`${this.yearInFocus} selected.`);
614
+ }, onKeyDown: (ev) => this.trapFocusLeft(ev), "aria-label": intl.formatMessage({
615
+ id: "date.selectPreviousYear",
616
+ defaultMessage: "Select previous year",
617
+ description: "Calendar button",
618
+ }), ref: (el) => (this.prevButton = el), class: "arw-btn" }, h("span", { class: "mdi" }, "\uF141")), h("div", { id: `popup-title-year-${this.parentId}`, tabindex: 0, class: "title-box year", role: "button", onClick: this.changeView.bind(this, "day"), onKeyDown: (ev) => {
619
+ if (ev.key === "Enter" || ev.key === " ") {
620
+ ev.preventDefault();
621
+ this.changeView("day");
622
+ }
623
+ }, "aria-labelledby": "year-title" }, h("span", { class: "title" }, this.yearInFocus)), h("button", { onClick: () => {
624
+ this.nextClicked = true;
625
+ this.popupClicked = true;
626
+ this.yearInFocus += 1;
627
+ this.updateLiveRegion(`${this.yearInFocus} selected.`);
628
+ }, "aria-label": intl.formatMessage({
629
+ id: "date.selectNextYear",
630
+ defaultMessage: "Select next year",
631
+ description: "Calendar button",
632
+ }), onKeyDown: (ev) => this.trapFocusRight(ev), ref: (el) => (this.nextButton = el), class: "arw-btn" }, h("span", { class: "mdi" }, "\uF142"))), h("div", { "aria-labelledby": `popup-title-year-${this.parentId}`, role: "grid", class: "months" }, h("div", { role: "row", class: "month-row" }, this.calendar_months
633
+ .slice(0, 3)
634
+ .map((month, index) => this.renderMonths(month, index))), h("div", { role: "row", class: "month-row" }, this.calendar_months
635
+ .slice(3, 6)
636
+ .map((month, index) => this.renderMonths(month, index + 3))), h("div", { role: "row", class: "month-row" }, this.calendar_months
637
+ .slice(6, 9)
638
+ .map((month, index) => this.renderMonths(month, index + 6))), h("div", { role: "row", class: "month-row" }, this.calendar_months
639
+ .slice(9)
640
+ .map((month, index) => this.renderMonths(month, index + 9))))))), this.isExpanded && h("div", { id: "live-region", "aria-live": "polite", "aria-relevant": "text", class: "sr-only" }), h("div", { id: "month-title", class: "sr-only" }, intl.formatMessage({
641
+ id: "date.selectMonth",
642
+ defaultMessage: "Activate to select a month.",
643
+ description: "Calendar button",
644
+ })), h("div", { id: "year-title", class: "sr-only" }, intl.formatMessage({
645
+ id: "date.selectYear",
646
+ defaultMessage: "Activate to select a year.",
647
+ description: "Calendar button",
648
+ })), h("div", { id: "application", class: "sr-only" }, intl.formatMessage({
649
+ id: "date.instructions",
650
+ defaultMessage: "Use arrows to select a date in the table. Tab left or right to buttons for selecting previous month, next month, or the month selection table.",
651
+ }))));
652
+ }
653
+ static get is() { return "priv-datepicker"; }
654
+ static get originalStyleUrls() {
655
+ return {
656
+ "$": ["priv-datepicker.scss"]
657
+ };
658
+ }
659
+ static get styleUrls() {
660
+ return {
661
+ "$": ["priv-datepicker.css"]
662
+ };
663
+ }
664
+ static get properties() {
665
+ return {
666
+ "disabled": {
667
+ "type": "boolean",
668
+ "mutable": false,
669
+ "complexType": {
670
+ "original": "boolean",
671
+ "resolved": "boolean",
672
+ "references": {}
673
+ },
674
+ "required": false,
675
+ "optional": false,
676
+ "docs": {
677
+ "tags": [],
678
+ "text": ""
679
+ },
680
+ "attribute": "disabled",
681
+ "reflect": false,
682
+ "defaultValue": "false"
683
+ },
684
+ "isExpanded": {
685
+ "type": "boolean",
686
+ "mutable": true,
687
+ "complexType": {
688
+ "original": "boolean",
689
+ "resolved": "boolean",
690
+ "references": {}
691
+ },
692
+ "required": false,
693
+ "optional": false,
694
+ "docs": {
695
+ "tags": [],
696
+ "text": ""
697
+ },
698
+ "attribute": "is-expanded",
699
+ "reflect": true,
700
+ "defaultValue": "false"
701
+ },
702
+ "view": {
703
+ "type": "string",
704
+ "mutable": true,
705
+ "complexType": {
706
+ "original": "string",
707
+ "resolved": "string",
708
+ "references": {}
709
+ },
710
+ "required": false,
711
+ "optional": false,
712
+ "docs": {
713
+ "tags": [],
714
+ "text": ""
715
+ },
716
+ "attribute": "view",
717
+ "reflect": true,
718
+ "defaultValue": "\"day\""
719
+ },
720
+ "date": {
721
+ "type": "unknown",
722
+ "mutable": true,
723
+ "complexType": {
724
+ "original": "Date",
725
+ "resolved": "Date",
726
+ "references": {
727
+ "Date": {
728
+ "location": "global"
729
+ }
730
+ }
731
+ },
732
+ "required": false,
733
+ "optional": false,
734
+ "docs": {
735
+ "tags": [],
736
+ "text": ""
737
+ },
738
+ "defaultValue": "new Date()"
739
+ },
740
+ "selectedYear": {
741
+ "type": "number",
742
+ "mutable": true,
743
+ "complexType": {
744
+ "original": "number",
745
+ "resolved": "number",
746
+ "references": {}
747
+ },
748
+ "required": false,
749
+ "optional": false,
750
+ "docs": {
751
+ "tags": [],
752
+ "text": ""
753
+ },
754
+ "attribute": "selected-year",
755
+ "reflect": false,
756
+ "defaultValue": "this.date.getUTCFullYear()"
757
+ },
758
+ "selectedMonth": {
759
+ "type": "number",
760
+ "mutable": true,
761
+ "complexType": {
762
+ "original": "number",
763
+ "resolved": "number",
764
+ "references": {}
765
+ },
766
+ "required": false,
767
+ "optional": false,
768
+ "docs": {
769
+ "tags": [],
770
+ "text": ""
771
+ },
772
+ "attribute": "selected-month",
773
+ "reflect": false,
774
+ "defaultValue": "this.date.getUTCMonth() + 1"
775
+ },
776
+ "selectedDay": {
777
+ "type": "number",
778
+ "mutable": true,
779
+ "complexType": {
780
+ "original": "number",
781
+ "resolved": "number",
782
+ "references": {}
783
+ },
784
+ "required": false,
785
+ "optional": false,
786
+ "docs": {
787
+ "tags": [],
788
+ "text": ""
789
+ },
790
+ "attribute": "selected-day",
791
+ "reflect": false,
792
+ "defaultValue": "this.date.getUTCDate()"
793
+ },
794
+ "monthInFocus": {
795
+ "type": "number",
796
+ "mutable": true,
797
+ "complexType": {
798
+ "original": "number",
799
+ "resolved": "number",
800
+ "references": {}
801
+ },
802
+ "required": false,
803
+ "optional": false,
804
+ "docs": {
805
+ "tags": [],
806
+ "text": ""
807
+ },
808
+ "attribute": "month-in-focus",
809
+ "reflect": false,
810
+ "defaultValue": "this.selectedMonth"
811
+ },
812
+ "yearInFocus": {
813
+ "type": "number",
814
+ "mutable": true,
815
+ "complexType": {
816
+ "original": "number",
817
+ "resolved": "number",
818
+ "references": {}
819
+ },
820
+ "required": false,
821
+ "optional": false,
822
+ "docs": {
823
+ "tags": [],
824
+ "text": ""
825
+ },
826
+ "attribute": "year-in-focus",
827
+ "reflect": false,
828
+ "defaultValue": "this.selectedYear"
829
+ },
830
+ "dayInFocus": {
831
+ "type": "number",
832
+ "mutable": true,
833
+ "complexType": {
834
+ "original": "number",
835
+ "resolved": "number",
836
+ "references": {}
837
+ },
838
+ "required": false,
839
+ "optional": false,
840
+ "docs": {
841
+ "tags": [],
842
+ "text": ""
843
+ },
844
+ "attribute": "day-in-focus",
845
+ "reflect": false,
846
+ "defaultValue": "this.selectedDay"
847
+ },
848
+ "parentId": {
849
+ "type": "string",
850
+ "mutable": true,
851
+ "complexType": {
852
+ "original": "string",
853
+ "resolved": "string",
854
+ "references": {}
855
+ },
856
+ "required": false,
857
+ "optional": false,
858
+ "docs": {
859
+ "tags": [],
860
+ "text": ""
861
+ },
862
+ "attribute": "parent-id",
863
+ "reflect": true,
864
+ "defaultValue": "\"\""
865
+ }
866
+ };
867
+ }
868
+ static get states() {
869
+ return {
870
+ "monthNumInFocus": {},
871
+ "isTabbing": {}
872
+ };
873
+ }
874
+ static get events() {
875
+ return [{
876
+ "method": "cellTriggered",
877
+ "name": "cellTriggered",
878
+ "bubbles": true,
879
+ "cancelable": true,
880
+ "composed": true,
881
+ "docs": {
882
+ "tags": [],
883
+ "text": ""
884
+ },
885
+ "complexType": {
886
+ "original": "HTMLElement",
887
+ "resolved": "HTMLElement",
888
+ "references": {
889
+ "HTMLElement": {
890
+ "location": "global"
891
+ }
892
+ }
893
+ }
894
+ }, {
895
+ "method": "toggleButtonClicked",
896
+ "name": "toggleButtonClicked",
897
+ "bubbles": true,
898
+ "cancelable": true,
899
+ "composed": true,
900
+ "docs": {
901
+ "tags": [],
902
+ "text": ""
903
+ },
904
+ "complexType": {
905
+ "original": "HTMLButtonElement",
906
+ "resolved": "HTMLButtonElement",
907
+ "references": {
908
+ "HTMLButtonElement": {
909
+ "location": "global"
910
+ }
911
+ }
912
+ }
913
+ }, {
914
+ "method": "popupClosed",
915
+ "name": "popupClosed",
916
+ "bubbles": true,
917
+ "cancelable": true,
918
+ "composed": true,
919
+ "docs": {
920
+ "tags": [],
921
+ "text": ""
922
+ },
923
+ "complexType": {
924
+ "original": "any",
925
+ "resolved": "any",
926
+ "references": {}
927
+ }
928
+ }, {
929
+ "method": "popupBlurred",
930
+ "name": "popupBlurred",
931
+ "bubbles": true,
932
+ "cancelable": true,
933
+ "composed": true,
934
+ "docs": {
935
+ "tags": [],
936
+ "text": ""
937
+ },
938
+ "complexType": {
939
+ "original": "{ relatedTarget: EventTarget | null }",
940
+ "resolved": "{ relatedTarget: EventTarget | null; }",
941
+ "references": {
942
+ "EventTarget": {
943
+ "location": "global"
944
+ }
945
+ }
946
+ }
947
+ }];
948
+ }
949
+ static get elementRef() { return "el"; }
950
+ static get listeners() {
951
+ return [{
952
+ "name": "keydown",
953
+ "method": "handleKey",
954
+ "target": undefined,
955
+ "capture": false,
956
+ "passive": false
957
+ }, {
958
+ "name": "keydown",
959
+ "method": "toggleTabbingOn",
960
+ "target": undefined,
961
+ "capture": false,
962
+ "passive": false
963
+ }, {
964
+ "name": "mousedown",
965
+ "method": "toggleTabbingOff",
966
+ "target": "window",
967
+ "capture": false,
968
+ "passive": true
969
+ }, {
970
+ "name": "click",
971
+ "method": "blurHandler",
972
+ "target": "document",
973
+ "capture": false,
974
+ "passive": false
975
+ }, {
976
+ "name": "blur",
977
+ "method": "handleBlurOnWindow",
978
+ "target": "window",
979
+ "capture": false,
980
+ "passive": false
981
+ }];
982
+ }
983
+ }