@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,1054 +1,1054 @@
1
- import { h, Host } from "@stencil/core";
2
- import { forceUpdate } from "@stencil/core";
3
- import { generateId, getTextDir, shouldOpenUp, intl, debounce } from "../../global/functions";
4
- import { globalMessages } from "../../global/intl";
5
- export class Select {
6
- constructor() {
7
- this.selectAllMessage = intl.formatMessage({
8
- id: "select.selectAll",
9
- defaultMessage: "Select All",
10
- });
11
- this.deselectAllMessage = intl.formatMessage({
12
- id: "select.deselectAll",
13
- defaultMessage: "Deselect All",
14
- });
15
- this.allOptionsSelectedMessage = intl.formatMessage({
16
- id: "select.allOptionsSelected",
17
- defaultMessage: "All options selected",
18
- });
19
- this.allOptionsDeselectedMessage = intl.formatMessage({
20
- id: "select.allOptionsDeselected",
21
- defaultMessage: "All options deselected",
22
- });
23
- this.keysSoFar = "";
24
- this.searchIndex = 0;
25
- this.openUp = false;
26
- //////////////////////////////////////
27
- //////////////////////////////////////
28
- // for multiselect button text
29
- this.overflowCount = 0;
30
- this.displayedOptions = [];
31
- this.debouncedClearKeysSoFar = debounce(() => {
32
- this.keysSoFar = "";
33
- }, 500);
34
- this.debouncedSearch = debounce(() => {
35
- this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
36
- if (this.filteredOptions.length) {
37
- this.announce(this.resultsFoundMessage);
38
- }
39
- else {
40
- this.announce(this.noResultsFoundMessage);
41
- }
42
- }, 150);
43
- this.disabled = false;
44
- this.invalid = false;
45
- this.maxHeight = undefined;
46
- this.label = undefined;
47
- this.labelPosition = "top";
48
- this.requiredField = false;
49
- this.errorMessage = "";
50
- this.multiple = false;
51
- this.search = false;
52
- this.selectAll = false;
53
- this.placeholder = intl.formatMessage({
54
- id: "select.multiPlaceholder",
55
- defaultMessage: "Make a selection",
56
- description: "Placeholder text. Use imperative",
57
- });
58
- this.searchPlaceholder = intl.formatMessage({
59
- id: "select.searchPlaceholder",
60
- defaultMessage: "Search",
61
- description: "Placeholder text. Use imperative",
62
- });
63
- this.allSelectedMessage = intl.formatMessage({
64
- id: "select.allSelected",
65
- defaultMessage: "All selected",
66
- description: "Text displayed when all options are selected",
67
- });
68
- this.isTabbing = false;
69
- this.isExpanded = false;
70
- this.announcement = "";
71
- }
72
- get childOptions() {
73
- return Array.from(this.el.querySelectorAll("wm-option"));
74
- }
75
- get duplicateOptions() {
76
- return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"));
77
- }
78
- get allOptionEls() {
79
- // this includes both slotted wm-options and internally created wm-options
80
- return this.duplicateOptions.concat(this.childOptions);
81
- }
82
- get visibleOptionEls() {
83
- return this.allOptionEls.filter((option) => !option.classList.contains("hidden") && !option.classList.contains("filtered-out"));
84
- }
85
- //////////////////////////////////////
86
- // for search variants
87
- get searchTerm() {
88
- return this.searchFieldEl ? this.searchFieldEl.value : "";
89
- }
90
- get filteredOptions() {
91
- return this.childOptions.filter((option) => { var _a; return (_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.searchTerm.toLowerCase()); });
92
- }
93
- get selectedOptions() {
94
- return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
95
- }
96
- get allSelected() {
97
- return this.childOptions.every((option) => option.selected);
98
- }
99
- //////////////////////////////////////
100
- get resultsFoundMessage() {
101
- return intl.formatMessage({
102
- id: "select.searchResultsFound",
103
- defaultMessage: "{numResults, plural, one {1 option found} other {# options found}}",
104
- description: "The message read by the screen reader, indicating how many results a search returned",
105
- }, { numResults: this.filteredOptions.length });
106
- }
107
- get noResultsFoundMessage() {
108
- return intl.formatMessage({
109
- id: "select.noSearchResults",
110
- defaultMessage: "No results found. Please try your search again.",
111
- description: "The message displayed when no options pass the search filter",
112
- });
113
- }
114
- toggleTabbingOn() {
115
- this.isTabbing = true;
116
- }
117
- toggleTabbingOff() {
118
- this.isTabbing = false;
119
- }
120
- handleOptionSelection(ev) {
121
- const option = ev.detail;
122
- this.focusOption(option);
123
- if (!this.multiple) {
124
- // if the option was already selected, leave selected states untouched and don't fire the event
125
- if (!option.selected) {
126
- this.selectOption(option);
127
- const detail = { changedOption: option, selectedOptions: [option] };
128
- this.wmSelectChanged.emit(detail);
129
- // change is deprecated in favor of wmSelectChanged
130
- // because of issues with React wrappers when using native events name
131
- const event = new CustomEvent("change", { detail: detail });
132
- // @ts-ignore
133
- this.el.dispatchEvent(event);
134
- }
135
- this.close();
136
- }
137
- else {
138
- this.selectOption(option);
139
- // we pass the original option with the event, as it's the only one the devs know or care about
140
- // devs will typically set a `value` on the option, which is not copied over
141
- // we could have taken the value and put it on the duplicate option,
142
- // but this approach is more flexible (what if they want to have a data attribute?)
143
- const isDuplicate = option.classList.contains("duplicate");
144
- const originalOption = isDuplicate ? this.findCorrespondingOption(option) : option;
145
- const selectedOptions = this.childOptions.filter((o) => o.selected);
146
- const detail = { changedOption: originalOption, selectedOptions: selectedOptions };
147
- this.wmSelectChanged.emit(detail);
148
- // change is deprecated in favor of wmSelectChanged
149
- // because of issues with React wrappers when using native events name
150
- const event = new CustomEvent("change", { detail: detail });
151
- // @ts-ignore
152
- this.el.dispatchEvent(event);
153
- }
154
- }
155
- handleChildEnter() {
156
- // only occurs for multiselects. handle the click, then close
157
- this.close();
158
- }
159
- handleChildUp(ev) {
160
- this.moveUp(ev.detail);
161
- }
162
- handleChildDown(ev) {
163
- this.moveDown(ev.detail);
164
- }
165
- moveToFirstOption() {
166
- this.focusOption(this.visibleOptionEls[0]);
167
- }
168
- moveToLastOption() {
169
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
170
- }
171
- closePopupOnEscape() {
172
- this.close();
173
- }
174
- handleOptionBlur(ev) {
175
- // if the Option is blurred to something other than the component emit a blur event with the appropriate relatedTarget
176
- // keeps our component's blur events accurate, and closes when focusing browser address bar
177
- if (!this.isElOrChild(ev.detail.relatedTarget)) {
178
- const event = new CustomEvent("blur");
179
- // @ts-ignore
180
- event.relatedTarget = ev.detail.relatedTarget;
181
- this.el.dispatchEvent(event);
182
- }
183
- }
184
- handleClick(ev) {
185
- if (!this.isElOrChild(ev.target)) {
186
- this.close();
187
- }
188
- }
189
- handleSelectAllClick() {
190
- this.allSelected ? this.deselectAllOptions() : this.selectAllOptions();
191
- }
192
- selectAllOptions() {
193
- this.allOptionEls.forEach((o) => (o.selected = true));
194
- this.setSelectAllButton();
195
- this.setButtonText();
196
- const detail = { changedOption: null, selectedOptions: this.childOptions };
197
- this.wmSelectChanged.emit(detail);
198
- }
199
- deselectAllOptions() {
200
- this.allOptionEls.forEach((o) => (o.selected = false));
201
- this.setSelectAllButton();
202
- this.setButtonText();
203
- const detail = { changedOption: null, selectedOptions: [] };
204
- this.wmSelectChanged.emit(detail);
205
- }
206
- handleButtonBlur(ev) {
207
- if (this.isElOrChild(ev.relatedTarget)) {
208
- // do not emit a blur event when opening the dropdown and focusing the Options
209
- ev.stopPropagation();
210
- }
211
- }
212
- handleSearchFieldBlur(ev) {
213
- this.searchFieldWrapperEl.classList.remove("focus");
214
- if (this.isElOrChild(ev.relatedTarget)) {
215
- // do not emit a blur event when moving from searchfield to options
216
- ev.stopPropagation();
217
- }
218
- }
219
- handleKey(ev) {
220
- switch (ev.key) {
221
- case "ArrowDown":
222
- if (this.isExpanded === false) {
223
- ev.preventDefault();
224
- this.open("next");
225
- }
226
- break;
227
- case "ArrowUp":
228
- if (this.isExpanded === false) {
229
- ev.preventDefault();
230
- this.open("previous");
231
- }
232
- break;
233
- }
234
- }
235
- componentWillLoad() {
236
- if (!this.label) {
237
- console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
238
- }
239
- this.uid = this.el.id ? this.el.id : generateId();
240
- if (document.body.classList.contains("wmcl-user-is-tabbing")) {
241
- this.toggleTabbingOn();
242
- }
243
- // set initial selections
244
- if (this.selectedOptions.length > 0) {
245
- this.selectedOptions.forEach((x) => {
246
- this.displayedOptions.push(x);
247
- });
248
- // single Select only, pre-select if no default option from dev
249
- }
250
- else if (!this.multiple) {
251
- this.selectOption(this.allOptionEls[0]);
252
- }
253
- }
254
- componentDidLoad() {
255
- this.wmSelectDidLoad.emit();
256
- this.dropdownEl.classList.add("hidden");
257
- forceUpdate(this.el);
258
- // Dev can overwrite the max-height rule set in the Sass file
259
- if (this.maxHeight) {
260
- this.listboxEl.style.maxHeight = this.maxHeight;
261
- }
262
- if (this.multiple) {
263
- this.updateOptionVisibility();
264
- }
265
- this.setButtonText();
266
- }
267
- componentWillUpdate() {
268
- if (this.multiple) {
269
- // find last visible duplicate option and apply .last class
270
- const visibleDuplicateOptions = this.visibleOptionEls.filter((option) => option.classList.contains("duplicate"));
271
- visibleDuplicateOptions.forEach((option, idx) => {
272
- if (idx === visibleDuplicateOptions.length - 1) {
273
- option.classList.add("last");
274
- }
275
- else {
276
- option.classList.remove("last");
277
- }
278
- });
279
- }
280
- }
281
- moveUp(el) {
282
- const focusableEls = this.visibleOptionEls;
283
- if (this.selectAllEl) {
284
- focusableEls.unshift(this.selectAllEl);
285
- }
286
- if (this.searchFieldEl) {
287
- focusableEls.unshift(this.searchFieldEl);
288
- }
289
- const prevEl = focusableEls[focusableEls.indexOf(el) - 1] || focusableEls[focusableEls.length - 1];
290
- if (prevEl) {
291
- this.focusOption(prevEl);
292
- }
293
- }
294
- moveDown(el) {
295
- const focusableEls = this.visibleOptionEls;
296
- if (this.selectAllEl) {
297
- focusableEls.unshift(this.selectAllEl);
298
- }
299
- if (this.searchFieldEl) {
300
- focusableEls.unshift(this.searchFieldEl);
301
- }
302
- const nextEl = focusableEls[focusableEls.indexOf(el) + 1] || focusableEls[0];
303
- if (nextEl) {
304
- this.focusOption(nextEl);
305
- }
306
- }
307
- open(optionToSelect) {
308
- if (!this.disabled) {
309
- const elHeight = this.el.clientHeight;
310
- const buttonHeight = this.buttonEl.clientHeight;
311
- this.openUp = shouldOpenUp(this.el, this.dropdownEl.clientHeight,
312
- // when opening up, dropdown covers both label and button
313
- elHeight,
314
- // when opening down, dropdown covers only the button
315
- buttonHeight);
316
- this.isExpanded = true;
317
- this.dropdownEl.classList.remove("hidden");
318
- window.requestAnimationFrame(() => {
319
- switch (optionToSelect) {
320
- case "next":
321
- // search variant focuses search field
322
- // all others focus option "after" last selected option (this can be the first option)
323
- if (this.search) {
324
- this.searchFieldEl.focus();
325
- this.listboxEl.scrollTop = 0;
326
- }
327
- else {
328
- this.moveDown(this.visibleOptionEls.filter((x) => x.selected).slice(-1)[0]);
329
- }
330
- break;
331
- case "previous":
332
- // search variant focuses last option
333
- // all others focus option "above" first selected option (this can be the last option)
334
- if (this.search) {
335
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
336
- }
337
- else {
338
- this.moveUp(this.visibleOptionEls.filter((x) => x.selected)[0]);
339
- }
340
- break;
341
- default:
342
- // search variant focuses search field
343
- // all others focus the selected option
344
- // if no option is selected (empty multiselect), focuses first option
345
- if (this.search) {
346
- this.searchFieldEl.focus();
347
- this.listboxEl.scrollTop = 0;
348
- }
349
- else if (this.selectedOptions.length > 0) {
350
- this.focusOption(this.visibleOptionEls.filter((x) => x.selected)[0]);
351
- }
352
- else {
353
- this.focusOption(this.visibleOptionEls[0]);
354
- }
355
- break;
356
- }
357
- });
358
- }
359
- }
360
- close(returnFocus = true) {
361
- if (this.isExpanded) {
362
- this.isExpanded = false;
363
- this.allOptionEls.map((i) => (i.focused = false));
364
- window.setTimeout(() => {
365
- this.dropdownEl.classList.add("hidden");
366
- if (this.multiple) {
367
- this.updateOptionVisibility();
368
- }
369
- // clear search field, reset filtered / bolded state of wm-options
370
- if (this.search) {
371
- this.searchFieldEl.value = "";
372
- this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
373
- }
374
- // Returns focus to button after popup closes (no need if user is tabbing)
375
- // Delay is necessary for screenreader to get new expanded state before focus
376
- // window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
377
- // also UX wise, it makes sense for the button to only be focused after the animation is complete
378
- if (returnFocus) {
379
- this.buttonEl.focus();
380
- }
381
- }, 150);
382
- }
383
- }
384
- updateOptionVisibility() {
385
- // this runs for search multiselects, where selected options are rendered at the top of the dropdown list
386
- // slotted wm-options are hidden if selected, and duplicate wm-options are made visible if selected
387
- this.childOptions.forEach((option, idx) => {
388
- const duplicateOption = this.duplicateOptions[idx];
389
- if (option.selected) {
390
- option.classList.add("hidden");
391
- duplicateOption.classList.remove("hidden");
392
- }
393
- else {
394
- option.classList.remove("hidden");
395
- duplicateOption.classList.add("hidden");
396
- }
397
- });
398
- }
399
- focusOption(option) {
400
- this.allOptionEls.forEach((i) => (i.focused = i === option));
401
- // option must be scrolledIntoView before focused
402
- // if focus is called first the option might be positioned incorrectly (in the center of the dropdown) and scrollIntoView will do nothing as the option will already be in view
403
- option.scrollIntoView({ block: "nearest" });
404
- // scrollIntoView does not work when the container of the element it's called on is not rendered to the page (in our case the dropdown is still closed and has transform: scaleY(0))
405
- // when opening the dropdown, scrollIntoView must be delayed to a point where the browser recognizes content within it as able to be scrolled to
406
- // in Safari in particular, the soonest this seems to happen is 20ms. The longest we can wait before any jumping in the open dropdown is noticeable is 60ms
407
- window.setTimeout(() => option.scrollIntoView({ block: "nearest" }), 60);
408
- option.focus();
409
- }
410
- selectOption(option) {
411
- // beware of this function's name. For multiselect it actually toggles the selected state, so it can also deselect the option
412
- if (option.classList.contains("duplicate")) {
413
- // if clicking on a duplicate option, toggle selected property of real one, then rerender
414
- const correspondingOption = this.findCorrespondingOption(option);
415
- correspondingOption.selected = !correspondingOption.selected;
416
- forceUpdate(this.el);
417
- }
418
- else if (this.multiple) {
419
- option.selected = !option.selected;
420
- }
421
- else {
422
- this.childOptions.forEach((x) => (x.selected = x === option));
423
- }
424
- // update the selectAll checkbox when an option is de/selected
425
- // checking is the el is present, implies that this.multiple and this.selectAll are true
426
- if (this.selectAllEl) {
427
- this.setSelectAllButton();
428
- }
429
- this.setButtonText();
430
- }
431
- findAndFocusOption(ev) {
432
- const character = ev.detail.toLowerCase();
433
- if (!this.keysSoFar) {
434
- // if first character entered, set currently focused option as the starting index for the search
435
- this.visibleOptionEls.forEach((option, idx) => {
436
- if (option.focused) {
437
- this.searchIndex = idx;
438
- }
439
- });
440
- }
441
- this.keysSoFar += character;
442
- let nextMatch = this.findMatchInRange(this.visibleOptionEls, this.searchIndex + 1, this.visibleOptionEls.length);
443
- if (!nextMatch) {
444
- // if match can't be found from starting option downwards, search from top
445
- nextMatch = this.findMatchInRange(this.visibleOptionEls, 0, this.searchIndex);
446
- }
447
- if (nextMatch) {
448
- // findMatchInRange still might have returned null, only focus if match found
449
- this.focusOption(nextMatch);
450
- }
451
- this.debouncedClearKeysSoFar();
452
- }
453
- findMatchInRange(list, startIndex, endIndex) {
454
- let match = null;
455
- let optionsInRange = list.slice(startIndex, endIndex);
456
- // Find the first option starting with the keysSoFar substring, searching in
457
- // the specified range of options
458
- optionsInRange.forEach((option) => {
459
- const label = option.textContent;
460
- if (!match && label && label.toLowerCase().startsWith(this.keysSoFar)) {
461
- match = option;
462
- }
463
- });
464
- return match;
465
- }
466
- findCorrespondingOption(el) {
467
- // if duplicate, returns the child wm-option
468
- // if child wm-option, returns duplicate
469
- const isDuplicate = el.classList.contains("duplicate");
470
- return isDuplicate
471
- ? this.childOptions[this.duplicateOptions.indexOf(el)]
472
- : this.duplicateOptions[this.childOptions.indexOf(el)];
473
- }
474
- isElOrChild(el) {
475
- var _a;
476
- // determines whether or not the element is the component, a child of the component, or exists within the component's shadowroot
477
- return el === this.el || this.el.contains(el) || ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(el));
478
- }
479
- exposeErrors() {
480
- // When the error changes, a new id is set for the error container and the button's aria-describedby attribute is updated accordingly. This is to make sure the screen reader announces teh updated errors in Firefox. See this longstanding bug: https://bugzilla.mozilla.org/show_bug.cgi?id=493683
481
- const newId = generateId();
482
- this.errorContainer.id = `wm-errors-${newId}`;
483
- this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
484
- }
485
- renderErrorContainer() {
486
- return (h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
487
- }
488
- handleComponentBlur(ev) {
489
- // Do not close or emit custom blur event when blurring to an element inside (wm-option)
490
- if (!this.el.contains(ev.relatedTarget)) {
491
- this.close(false);
492
- this.wmSelectBlurred.emit();
493
- this.wmComponentBlurred.emit(); // deprecated
494
- }
495
- }
496
- // on search field or select all. keydown on options is handled via events.
497
- handleKeyDown(ev) {
498
- const el = ev.target;
499
- switch (ev.key) {
500
- case "ArrowDown":
501
- ev.preventDefault();
502
- this.moveDown(ev.target);
503
- break;
504
- case "ArrowUp":
505
- ev.preventDefault();
506
- this.moveUp(ev.target);
507
- break;
508
- case "Escape":
509
- ev.preventDefault();
510
- this.close();
511
- break;
512
- case "Enter":
513
- if (el === this.selectAllEl) {
514
- ev.preventDefault();
515
- this.handleSelectAllClick();
516
- this.close();
517
- }
518
- break;
519
- case " ":
520
- if (el === this.selectAllEl) {
521
- ev.preventDefault();
522
- this.handleSelectAllClick();
523
- }
524
- break;
525
- }
526
- }
527
- setButtonText() {
528
- this.displayedOptions = this.childOptions
529
- .filter((x) => x.selected)
530
- .map((y) => (!y.classList.contains("hidden") ? y : this.findCorrespondingOption(y)));
531
- // handle overflow + counter for multiselect
532
- if (this.multiple) {
533
- // this is a fixed measurement accounting for the max width of a 3 character overflow counter
534
- const overflowCounterWidth = 38;
535
- const computedStyle = window.getComputedStyle(this.buttonEl);
536
- // there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
537
- const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
538
- const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
539
- const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
540
- let optionsWidths = this.displayedOptions.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
541
- let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
542
- this.overflowCount = 0;
543
- while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
544
- this.overflowCount++;
545
- optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
546
- optionsWidths.pop();
547
- this.displayedOptions.pop();
548
- }
549
- }
550
- }
551
- setSelectAllButton() {
552
- if (this.allSelected) {
553
- this.selectAllEl.textContent = this.deselectAllMessage;
554
- this.announce(this.allOptionsSelectedMessage);
555
- }
556
- else {
557
- this.selectAllEl.textContent = this.selectAllMessage;
558
- if (this.selectedOptions.length === 0) {
559
- this.announce(this.allOptionsDeselectedMessage);
560
- }
561
- }
562
- }
563
- announce(message) {
564
- // \u00A0 is a non-breaking space character, which causes the message to be read as a new one
565
- if (this.liveRegionEl.textContent === message) {
566
- message += "\u00A0";
567
- }
568
- this.announcement = message;
569
- }
570
- renderButtonText() {
571
- if (this.multiple && this.displayedOptions.length < 1) {
572
- return h("span", null, this.placeholder);
573
- }
574
- else if (this.multiple && this.allSelected && this.overflowCount > 0) {
575
- return this.allSelectedMessage;
576
- }
577
- else {
578
- return this.displayedOptions.map((x, idx) => (h("span", null, idx > 0 ? ", " : "", x.textContent)));
579
- }
580
- }
581
- renderSubinfo() {
582
- // multiselects cannot have subinfo for options
583
- if (!this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo) {
584
- return h("span", { class: "subinfo" }, this.selectedOptions[0].subinfo);
585
- }
586
- }
587
- renderOverflowCount() {
588
- if (this.overflowCount > 0 && !this.allSelected) {
589
- return (h("span", null, h("span", { class: "overflow-counter" }, "+", this.overflowCount)));
590
- }
591
- }
592
- renderSearchField() {
593
- return (h("div", { class: "search" }, h("div", { class: "searchfield-wrapper", ref: (el) => (this.searchFieldWrapperEl = el) }, h("div", { class: "icon" }), h("input", { ref: (el) => (this.searchFieldEl = el), class: "searchfield", role: "combobox", "aria-controls": `list-${this.uid}`, "aria-expanded": this.isExpanded ? "true" : "false", onKeyDown: (ev) => this.handleKeyDown(ev), onFocus: () => this.searchFieldWrapperEl.classList.add("focus"), onBlur: (ev) => this.handleSearchFieldBlur(ev), onInput: () => this.debouncedSearch(), placeholder: this.searchPlaceholder }))));
594
- }
595
- renderSearchFailedMessage() {
596
- return h("div", { class: "search-results-message" }, this.noResultsFoundMessage);
597
- }
598
- renderSelectAllButton() {
599
- if (this.selectAll && this.multiple && this.searchTerm == "") {
600
- return (h("button", { ref: (el) => (this.selectAllEl = el), class: "select-all", onClick: () => this.handleSelectAllClick(), onKeyDown: (ev) => this.handleKeyDown(ev), tabindex: "-1" }, this.allSelected ? this.deselectAllMessage : this.selectAllMessage));
601
- }
602
- }
603
- renderDuplicateOptions() {
604
- return Array.from(this.el.children).map((option) => {
605
- return (h("wm-option", { class: "duplicate", selected: option.selected }, option.textContent));
606
- });
607
- }
608
- render() {
609
- const buttonProps = {
610
- id: `selectbtn-${this.uid}`,
611
- ["disabled"]: this.disabled,
612
- ["aria-controls"]: `list-${this.uid}`,
613
- ["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
614
- ["aria-describedby"]: "wm-errors",
615
- ["aria-expanded"]: this.isExpanded ? "true" : "false",
616
- onClick: () => (this.isExpanded ? this.close() : this.open()),
617
- };
618
- return (h(Host, { onBlur: (ev) => this.handleComponentBlur(ev) }, h("div", { class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.invalid || this.errorMessage ? "invalid" : ""}` }, h("div", { class: "label-wrapper" }, h("label", { class: "label", id: `label-${this.uid}`, htmlFor: `selectbtn-${this.uid}` }, this.label,
619
- // we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
620
- this.requiredField ? (h("span", { class: "required" }, h("span", { class: "sr-only" }, globalMessages.requiredField), h("span", { "aria-hidden": "true" }, "*"))) : (""))), h("div", { class: "button-wrapper" }, h("button", Object.assign({}, buttonProps, { class: `displayedoption ${this.isTabbing ? "user-is-tabbing" : ""}`, ref: (el) => (this.buttonEl = el), onBlur: (ev) => this.handleButtonBlur(ev), onFocus: () => this.close() }), h("span", { class: this.selectedOptions.length > 0 && this.selectedOptions.filter((x) => x.subinfo).length > 0
621
- ? "overflowcontrol hassubinfo"
622
- : "overflowcontrol" }, h("span", { class: "button-text" }, this.renderButtonText()), this.renderSubinfo()), this.renderOverflowCount()), h("div", { class: `dropdown ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, ref: (el) => (this.dropdownEl = el) }, this.search && this.renderSearchField(), h("div", { id: `list-${this.uid}`, class: "options-wrapper", tabindex: -1, role: "listbox", "aria-multiselectable": this.multiple ? "true" : null, "aria-labelledby": `label-${this.uid}`, ref: (el) => (this.listboxEl = el) }, this.search && this.filteredOptions.length === 0 && this.renderSearchFailedMessage(), this.renderSelectAllButton(), this.multiple && this.renderDuplicateOptions(), h("slot", null))), this.renderErrorContainer(), h("div", { id: "announcement", "aria-live": "polite", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
623
- }
624
- static get is() { return "wm-select"; }
625
- static get encapsulation() { return "shadow"; }
626
- static get delegatesFocus() { return true; }
627
- static get originalStyleUrls() {
628
- return {
629
- "$": ["wm-select.scss"]
630
- };
631
- }
632
- static get styleUrls() {
633
- return {
634
- "$": ["wm-select.css"]
635
- };
636
- }
637
- static get properties() {
638
- return {
639
- "disabled": {
640
- "type": "boolean",
641
- "mutable": false,
642
- "complexType": {
643
- "original": "boolean",
644
- "resolved": "boolean",
645
- "references": {}
646
- },
647
- "required": false,
648
- "optional": false,
649
- "docs": {
650
- "tags": [],
651
- "text": ""
652
- },
653
- "attribute": "disabled",
654
- "reflect": true,
655
- "defaultValue": "false"
656
- },
657
- "invalid": {
658
- "type": "boolean",
659
- "mutable": true,
660
- "complexType": {
661
- "original": "boolean",
662
- "resolved": "boolean",
663
- "references": {}
664
- },
665
- "required": false,
666
- "optional": false,
667
- "docs": {
668
- "tags": [],
669
- "text": ""
670
- },
671
- "attribute": "invalid",
672
- "reflect": false,
673
- "defaultValue": "false"
674
- },
675
- "maxHeight": {
676
- "type": "string",
677
- "mutable": false,
678
- "complexType": {
679
- "original": "string",
680
- "resolved": "string | undefined",
681
- "references": {}
682
- },
683
- "required": false,
684
- "optional": true,
685
- "docs": {
686
- "tags": [],
687
- "text": ""
688
- },
689
- "attribute": "max-height",
690
- "reflect": false
691
- },
692
- "label": {
693
- "type": "string",
694
- "mutable": true,
695
- "complexType": {
696
- "original": "string",
697
- "resolved": "string | undefined",
698
- "references": {}
699
- },
700
- "required": false,
701
- "optional": true,
702
- "docs": {
703
- "tags": [],
704
- "text": ""
705
- },
706
- "attribute": "label",
707
- "reflect": false
708
- },
709
- "labelPosition": {
710
- "type": "string",
711
- "mutable": false,
712
- "complexType": {
713
- "original": "\"top\" | \"left\" | \"none\"",
714
- "resolved": "\"left\" | \"none\" | \"top\"",
715
- "references": {}
716
- },
717
- "required": false,
718
- "optional": false,
719
- "docs": {
720
- "tags": [],
721
- "text": ""
722
- },
723
- "attribute": "label-position",
724
- "reflect": false,
725
- "defaultValue": "\"top\""
726
- },
727
- "requiredField": {
728
- "type": "boolean",
729
- "mutable": false,
730
- "complexType": {
731
- "original": "boolean",
732
- "resolved": "boolean",
733
- "references": {}
734
- },
735
- "required": false,
736
- "optional": false,
737
- "docs": {
738
- "tags": [],
739
- "text": ""
740
- },
741
- "attribute": "required-field",
742
- "reflect": false,
743
- "defaultValue": "false"
744
- },
745
- "errorMessage": {
746
- "type": "string",
747
- "mutable": true,
748
- "complexType": {
749
- "original": "string",
750
- "resolved": "string",
751
- "references": {}
752
- },
753
- "required": false,
754
- "optional": false,
755
- "docs": {
756
- "tags": [],
757
- "text": ""
758
- },
759
- "attribute": "error-message",
760
- "reflect": false,
761
- "defaultValue": "\"\""
762
- },
763
- "multiple": {
764
- "type": "boolean",
765
- "mutable": false,
766
- "complexType": {
767
- "original": "boolean",
768
- "resolved": "boolean",
769
- "references": {}
770
- },
771
- "required": false,
772
- "optional": false,
773
- "docs": {
774
- "tags": [],
775
- "text": ""
776
- },
777
- "attribute": "multiple",
778
- "reflect": false,
779
- "defaultValue": "false"
780
- },
781
- "search": {
782
- "type": "boolean",
783
- "mutable": false,
784
- "complexType": {
785
- "original": "boolean",
786
- "resolved": "boolean",
787
- "references": {}
788
- },
789
- "required": false,
790
- "optional": false,
791
- "docs": {
792
- "tags": [],
793
- "text": ""
794
- },
795
- "attribute": "search",
796
- "reflect": false,
797
- "defaultValue": "false"
798
- },
799
- "selectAll": {
800
- "type": "boolean",
801
- "mutable": false,
802
- "complexType": {
803
- "original": "boolean",
804
- "resolved": "boolean",
805
- "references": {}
806
- },
807
- "required": false,
808
- "optional": false,
809
- "docs": {
810
- "tags": [],
811
- "text": ""
812
- },
813
- "attribute": "select-all",
814
- "reflect": false,
815
- "defaultValue": "false"
816
- },
817
- "placeholder": {
818
- "type": "string",
819
- "mutable": false,
820
- "complexType": {
821
- "original": "string",
822
- "resolved": "string",
823
- "references": {}
824
- },
825
- "required": false,
826
- "optional": false,
827
- "docs": {
828
- "tags": [],
829
- "text": ""
830
- },
831
- "attribute": "placeholder",
832
- "reflect": false,
833
- "defaultValue": "intl.formatMessage({\n id: \"select.multiPlaceholder\",\n defaultMessage: \"Make a selection\",\n description: \"Placeholder text. Use imperative\",\n })"
834
- },
835
- "searchPlaceholder": {
836
- "type": "string",
837
- "mutable": false,
838
- "complexType": {
839
- "original": "string",
840
- "resolved": "string",
841
- "references": {}
842
- },
843
- "required": false,
844
- "optional": false,
845
- "docs": {
846
- "tags": [],
847
- "text": ""
848
- },
849
- "attribute": "search-placeholder",
850
- "reflect": false,
851
- "defaultValue": "intl.formatMessage({\n id: \"select.searchPlaceholder\",\n defaultMessage: \"Search\",\n description: \"Placeholder text. Use imperative\",\n })"
852
- },
853
- "allSelectedMessage": {
854
- "type": "string",
855
- "mutable": false,
856
- "complexType": {
857
- "original": "string",
858
- "resolved": "string",
859
- "references": {}
860
- },
861
- "required": false,
862
- "optional": false,
863
- "docs": {
864
- "tags": [],
865
- "text": ""
866
- },
867
- "attribute": "all-selected-message",
868
- "reflect": false,
869
- "defaultValue": "intl.formatMessage({\n id: \"select.allSelected\",\n defaultMessage: \"All selected\",\n description: \"Text displayed when all options are selected\",\n })"
870
- }
871
- };
872
- }
873
- static get states() {
874
- return {
875
- "isTabbing": {},
876
- "isExpanded": {},
877
- "announcement": {}
878
- };
879
- }
880
- static get events() {
881
- return [{
882
- "method": "wmSelectDidLoad",
883
- "name": "wmSelectDidLoad",
884
- "bubbles": true,
885
- "cancelable": true,
886
- "composed": true,
887
- "docs": {
888
- "tags": [],
889
- "text": ""
890
- },
891
- "complexType": {
892
- "original": "void",
893
- "resolved": "void",
894
- "references": {}
895
- }
896
- }, {
897
- "method": "wmSelectBlurred",
898
- "name": "wmSelectBlurred",
899
- "bubbles": true,
900
- "cancelable": true,
901
- "composed": true,
902
- "docs": {
903
- "tags": [],
904
- "text": ""
905
- },
906
- "complexType": {
907
- "original": "void",
908
- "resolved": "void",
909
- "references": {}
910
- }
911
- }, {
912
- "method": "wmSelectChanged",
913
- "name": "wmSelectChanged",
914
- "bubbles": true,
915
- "cancelable": true,
916
- "composed": true,
917
- "docs": {
918
- "tags": [],
919
- "text": ""
920
- },
921
- "complexType": {
922
- "original": "Object",
923
- "resolved": "Object",
924
- "references": {
925
- "Object": {
926
- "location": "global"
927
- }
928
- }
929
- }
930
- }, {
931
- "method": "wmComponentBlurred",
932
- "name": "wmComponentBlurred",
933
- "bubbles": true,
934
- "cancelable": true,
935
- "composed": true,
936
- "docs": {
937
- "tags": [],
938
- "text": ""
939
- },
940
- "complexType": {
941
- "original": "void",
942
- "resolved": "void",
943
- "references": {}
944
- }
945
- }, {
946
- "method": "wmSelectSearchChanged",
947
- "name": "wmSelectSearchChanged",
948
- "bubbles": true,
949
- "cancelable": true,
950
- "composed": true,
951
- "docs": {
952
- "tags": [],
953
- "text": ""
954
- },
955
- "complexType": {
956
- "original": "Object",
957
- "resolved": "Object",
958
- "references": {
959
- "Object": {
960
- "location": "global"
961
- }
962
- }
963
- }
964
- }];
965
- }
966
- static get elementRef() { return "el"; }
967
- static get watchers() {
968
- return [{
969
- "propName": "errorMessage",
970
- "methodName": "exposeErrors"
971
- }];
972
- }
973
- static get listeners() {
974
- return [{
975
- "name": "wmUserIsTabbing",
976
- "method": "toggleTabbingOn",
977
- "target": "window",
978
- "capture": false,
979
- "passive": false
980
- }, {
981
- "name": "wmUserIsNotTabbing",
982
- "method": "toggleTabbingOff",
983
- "target": "window",
984
- "capture": false,
985
- "passive": false
986
- }, {
987
- "name": "wmOptionSelected",
988
- "method": "handleOptionSelection",
989
- "target": undefined,
990
- "capture": false,
991
- "passive": false
992
- }, {
993
- "name": "wmEnterKeyPressed",
994
- "method": "handleChildEnter",
995
- "target": undefined,
996
- "capture": false,
997
- "passive": false
998
- }, {
999
- "name": "wmKeyUpPressed",
1000
- "method": "handleChildUp",
1001
- "target": undefined,
1002
- "capture": false,
1003
- "passive": false
1004
- }, {
1005
- "name": "wmKeyDownPressed",
1006
- "method": "handleChildDown",
1007
- "target": undefined,
1008
- "capture": false,
1009
- "passive": false
1010
- }, {
1011
- "name": "wmHomeKeyPressed",
1012
- "method": "moveToFirstOption",
1013
- "target": undefined,
1014
- "capture": false,
1015
- "passive": false
1016
- }, {
1017
- "name": "wmEndKeyPressed",
1018
- "method": "moveToLastOption",
1019
- "target": undefined,
1020
- "capture": false,
1021
- "passive": false
1022
- }, {
1023
- "name": "wmEscKeyPressed",
1024
- "method": "closePopupOnEscape",
1025
- "target": undefined,
1026
- "capture": false,
1027
- "passive": false
1028
- }, {
1029
- "name": "wmOptionBlurred",
1030
- "method": "handleOptionBlur",
1031
- "target": undefined,
1032
- "capture": false,
1033
- "passive": false
1034
- }, {
1035
- "name": "click",
1036
- "method": "handleClick",
1037
- "target": "document",
1038
- "capture": true,
1039
- "passive": false
1040
- }, {
1041
- "name": "keydown",
1042
- "method": "handleKey",
1043
- "target": undefined,
1044
- "capture": false,
1045
- "passive": false
1046
- }, {
1047
- "name": "wmLetterPressed",
1048
- "method": "findAndFocusOption",
1049
- "target": undefined,
1050
- "capture": false,
1051
- "passive": false
1052
- }];
1053
- }
1054
- }
1
+ import { h, Host } from "@stencil/core";
2
+ import { forceUpdate } from "@stencil/core";
3
+ import { generateId, getTextDir, shouldOpenUp, intl, debounce } from "../../global/functions";
4
+ import { globalMessages } from "../../global/intl";
5
+ export class Select {
6
+ constructor() {
7
+ this.selectAllMessage = intl.formatMessage({
8
+ id: "select.selectAll",
9
+ defaultMessage: "Select All",
10
+ });
11
+ this.deselectAllMessage = intl.formatMessage({
12
+ id: "select.deselectAll",
13
+ defaultMessage: "Deselect All",
14
+ });
15
+ this.allOptionsSelectedMessage = intl.formatMessage({
16
+ id: "select.allOptionsSelected",
17
+ defaultMessage: "All options selected",
18
+ });
19
+ this.allOptionsDeselectedMessage = intl.formatMessage({
20
+ id: "select.allOptionsDeselected",
21
+ defaultMessage: "All options deselected",
22
+ });
23
+ this.keysSoFar = "";
24
+ this.searchIndex = 0;
25
+ this.openUp = false;
26
+ //////////////////////////////////////
27
+ //////////////////////////////////////
28
+ // for multiselect button text
29
+ this.overflowCount = 0;
30
+ this.displayedOptions = [];
31
+ this.debouncedClearKeysSoFar = debounce(() => {
32
+ this.keysSoFar = "";
33
+ }, 500);
34
+ this.debouncedSearch = debounce(() => {
35
+ this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
36
+ if (this.filteredOptions.length) {
37
+ this.announce(this.resultsFoundMessage);
38
+ }
39
+ else {
40
+ this.announce(this.noResultsFoundMessage);
41
+ }
42
+ }, 150);
43
+ this.disabled = false;
44
+ this.invalid = false;
45
+ this.maxHeight = undefined;
46
+ this.label = undefined;
47
+ this.labelPosition = "top";
48
+ this.requiredField = false;
49
+ this.errorMessage = "";
50
+ this.multiple = false;
51
+ this.search = false;
52
+ this.selectAll = false;
53
+ this.placeholder = intl.formatMessage({
54
+ id: "select.multiPlaceholder",
55
+ defaultMessage: "Make a selection",
56
+ description: "Placeholder text. Use imperative",
57
+ });
58
+ this.searchPlaceholder = intl.formatMessage({
59
+ id: "select.searchPlaceholder",
60
+ defaultMessage: "Search",
61
+ description: "Placeholder text. Use imperative",
62
+ });
63
+ this.allSelectedMessage = intl.formatMessage({
64
+ id: "select.allSelected",
65
+ defaultMessage: "All selected",
66
+ description: "Text displayed when all options are selected",
67
+ });
68
+ this.isTabbing = false;
69
+ this.isExpanded = false;
70
+ this.announcement = "";
71
+ }
72
+ get childOptions() {
73
+ return Array.from(this.el.querySelectorAll("wm-option"));
74
+ }
75
+ get duplicateOptions() {
76
+ return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"));
77
+ }
78
+ get allOptionEls() {
79
+ // this includes both slotted wm-options and internally created wm-options
80
+ return this.duplicateOptions.concat(this.childOptions);
81
+ }
82
+ get visibleOptionEls() {
83
+ return this.allOptionEls.filter((option) => !option.classList.contains("hidden") && !option.classList.contains("filtered-out"));
84
+ }
85
+ //////////////////////////////////////
86
+ // for search variants
87
+ get searchTerm() {
88
+ return this.searchFieldEl ? this.searchFieldEl.value : "";
89
+ }
90
+ get filteredOptions() {
91
+ return this.childOptions.filter((option) => { var _a; return (_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.searchTerm.toLowerCase()); });
92
+ }
93
+ get selectedOptions() {
94
+ return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
95
+ }
96
+ get allSelected() {
97
+ return this.childOptions.every((option) => option.selected);
98
+ }
99
+ //////////////////////////////////////
100
+ get resultsFoundMessage() {
101
+ return intl.formatMessage({
102
+ id: "select.searchResultsFound",
103
+ defaultMessage: "{numResults, plural, one {1 option found} other {# options found}}",
104
+ description: "The message read by the screen reader, indicating how many results a search returned",
105
+ }, { numResults: this.filteredOptions.length });
106
+ }
107
+ get noResultsFoundMessage() {
108
+ return intl.formatMessage({
109
+ id: "select.noSearchResults",
110
+ defaultMessage: "No results found. Please try your search again.",
111
+ description: "The message displayed when no options pass the search filter",
112
+ });
113
+ }
114
+ toggleTabbingOn() {
115
+ this.isTabbing = true;
116
+ }
117
+ toggleTabbingOff() {
118
+ this.isTabbing = false;
119
+ }
120
+ handleOptionSelection(ev) {
121
+ const option = ev.detail;
122
+ this.focusOption(option);
123
+ if (!this.multiple) {
124
+ // if the option was already selected, leave selected states untouched and don't fire the event
125
+ if (!option.selected) {
126
+ this.selectOption(option);
127
+ const detail = { changedOption: option, selectedOptions: [option] };
128
+ this.wmSelectChanged.emit(detail);
129
+ // change is deprecated in favor of wmSelectChanged
130
+ // because of issues with React wrappers when using native events name
131
+ const event = new CustomEvent("change", { detail: detail });
132
+ // @ts-ignore
133
+ this.el.dispatchEvent(event);
134
+ }
135
+ this.close();
136
+ }
137
+ else {
138
+ this.selectOption(option);
139
+ // we pass the original option with the event, as it's the only one the devs know or care about
140
+ // devs will typically set a `value` on the option, which is not copied over
141
+ // we could have taken the value and put it on the duplicate option,
142
+ // but this approach is more flexible (what if they want to have a data attribute?)
143
+ const isDuplicate = option.classList.contains("duplicate");
144
+ const originalOption = isDuplicate ? this.findCorrespondingOption(option) : option;
145
+ const selectedOptions = this.childOptions.filter((o) => o.selected);
146
+ const detail = { changedOption: originalOption, selectedOptions: selectedOptions };
147
+ this.wmSelectChanged.emit(detail);
148
+ // change is deprecated in favor of wmSelectChanged
149
+ // because of issues with React wrappers when using native events name
150
+ const event = new CustomEvent("change", { detail: detail });
151
+ // @ts-ignore
152
+ this.el.dispatchEvent(event);
153
+ }
154
+ }
155
+ handleChildEnter() {
156
+ // only occurs for multiselects. handle the click, then close
157
+ this.close();
158
+ }
159
+ handleChildUp(ev) {
160
+ this.moveUp(ev.detail);
161
+ }
162
+ handleChildDown(ev) {
163
+ this.moveDown(ev.detail);
164
+ }
165
+ moveToFirstOption() {
166
+ this.focusOption(this.visibleOptionEls[0]);
167
+ }
168
+ moveToLastOption() {
169
+ this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
170
+ }
171
+ closePopupOnEscape() {
172
+ this.close();
173
+ }
174
+ handleOptionBlur(ev) {
175
+ // if the Option is blurred to something other than the component emit a blur event with the appropriate relatedTarget
176
+ // keeps our component's blur events accurate, and closes when focusing browser address bar
177
+ if (!this.isElOrChild(ev.detail.relatedTarget)) {
178
+ const event = new CustomEvent("blur");
179
+ // @ts-ignore
180
+ event.relatedTarget = ev.detail.relatedTarget;
181
+ this.el.dispatchEvent(event);
182
+ }
183
+ }
184
+ handleClick(ev) {
185
+ if (!this.isElOrChild(ev.target)) {
186
+ this.close();
187
+ }
188
+ }
189
+ handleSelectAllClick() {
190
+ this.allSelected ? this.deselectAllOptions() : this.selectAllOptions();
191
+ }
192
+ selectAllOptions() {
193
+ this.allOptionEls.forEach((o) => (o.selected = true));
194
+ this.setSelectAllButton();
195
+ this.setButtonText();
196
+ const detail = { changedOption: null, selectedOptions: this.childOptions };
197
+ this.wmSelectChanged.emit(detail);
198
+ }
199
+ deselectAllOptions() {
200
+ this.allOptionEls.forEach((o) => (o.selected = false));
201
+ this.setSelectAllButton();
202
+ this.setButtonText();
203
+ const detail = { changedOption: null, selectedOptions: [] };
204
+ this.wmSelectChanged.emit(detail);
205
+ }
206
+ handleButtonBlur(ev) {
207
+ if (this.isElOrChild(ev.relatedTarget)) {
208
+ // do not emit a blur event when opening the dropdown and focusing the Options
209
+ ev.stopPropagation();
210
+ }
211
+ }
212
+ handleSearchFieldBlur(ev) {
213
+ this.searchFieldWrapperEl.classList.remove("focus");
214
+ if (this.isElOrChild(ev.relatedTarget)) {
215
+ // do not emit a blur event when moving from searchfield to options
216
+ ev.stopPropagation();
217
+ }
218
+ }
219
+ handleKey(ev) {
220
+ switch (ev.key) {
221
+ case "ArrowDown":
222
+ if (this.isExpanded === false) {
223
+ ev.preventDefault();
224
+ this.open("next");
225
+ }
226
+ break;
227
+ case "ArrowUp":
228
+ if (this.isExpanded === false) {
229
+ ev.preventDefault();
230
+ this.open("previous");
231
+ }
232
+ break;
233
+ }
234
+ }
235
+ componentWillLoad() {
236
+ if (!this.label) {
237
+ console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
238
+ }
239
+ this.uid = this.el.id ? this.el.id : generateId();
240
+ if (document.body.classList.contains("wmcl-user-is-tabbing")) {
241
+ this.toggleTabbingOn();
242
+ }
243
+ // set initial selections
244
+ if (this.selectedOptions.length > 0) {
245
+ this.selectedOptions.forEach((x) => {
246
+ this.displayedOptions.push(x);
247
+ });
248
+ // single Select only, pre-select if no default option from dev
249
+ }
250
+ else if (!this.multiple) {
251
+ this.selectOption(this.allOptionEls[0]);
252
+ }
253
+ }
254
+ componentDidLoad() {
255
+ this.wmSelectDidLoad.emit();
256
+ this.dropdownEl.classList.add("hidden");
257
+ forceUpdate(this.el);
258
+ // Dev can overwrite the max-height rule set in the Sass file
259
+ if (this.maxHeight) {
260
+ this.listboxEl.style.maxHeight = this.maxHeight;
261
+ }
262
+ if (this.multiple) {
263
+ this.updateOptionVisibility();
264
+ }
265
+ this.setButtonText();
266
+ }
267
+ componentWillUpdate() {
268
+ if (this.multiple) {
269
+ // find last visible duplicate option and apply .last class
270
+ const visibleDuplicateOptions = this.visibleOptionEls.filter((option) => option.classList.contains("duplicate"));
271
+ visibleDuplicateOptions.forEach((option, idx) => {
272
+ if (idx === visibleDuplicateOptions.length - 1) {
273
+ option.classList.add("last");
274
+ }
275
+ else {
276
+ option.classList.remove("last");
277
+ }
278
+ });
279
+ }
280
+ }
281
+ moveUp(el) {
282
+ const focusableEls = this.visibleOptionEls;
283
+ if (this.selectAllEl) {
284
+ focusableEls.unshift(this.selectAllEl);
285
+ }
286
+ if (this.searchFieldEl) {
287
+ focusableEls.unshift(this.searchFieldEl);
288
+ }
289
+ const prevEl = focusableEls[focusableEls.indexOf(el) - 1] || focusableEls[focusableEls.length - 1];
290
+ if (prevEl) {
291
+ this.focusOption(prevEl);
292
+ }
293
+ }
294
+ moveDown(el) {
295
+ const focusableEls = this.visibleOptionEls;
296
+ if (this.selectAllEl) {
297
+ focusableEls.unshift(this.selectAllEl);
298
+ }
299
+ if (this.searchFieldEl) {
300
+ focusableEls.unshift(this.searchFieldEl);
301
+ }
302
+ const nextEl = focusableEls[focusableEls.indexOf(el) + 1] || focusableEls[0];
303
+ if (nextEl) {
304
+ this.focusOption(nextEl);
305
+ }
306
+ }
307
+ open(optionToSelect) {
308
+ if (!this.disabled) {
309
+ const elHeight = this.el.clientHeight;
310
+ const buttonHeight = this.buttonEl.clientHeight;
311
+ this.openUp = shouldOpenUp(this.el, this.dropdownEl.clientHeight,
312
+ // when opening up, dropdown covers both label and button
313
+ elHeight,
314
+ // when opening down, dropdown covers only the button
315
+ buttonHeight);
316
+ this.isExpanded = true;
317
+ this.dropdownEl.classList.remove("hidden");
318
+ window.requestAnimationFrame(() => {
319
+ switch (optionToSelect) {
320
+ case "next":
321
+ // search variant focuses search field
322
+ // all others focus option "after" last selected option (this can be the first option)
323
+ if (this.search) {
324
+ this.searchFieldEl.focus();
325
+ this.listboxEl.scrollTop = 0;
326
+ }
327
+ else {
328
+ this.moveDown(this.visibleOptionEls.filter((x) => x.selected).slice(-1)[0]);
329
+ }
330
+ break;
331
+ case "previous":
332
+ // search variant focuses last option
333
+ // all others focus option "above" first selected option (this can be the last option)
334
+ if (this.search) {
335
+ this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
336
+ }
337
+ else {
338
+ this.moveUp(this.visibleOptionEls.filter((x) => x.selected)[0]);
339
+ }
340
+ break;
341
+ default:
342
+ // search variant focuses search field
343
+ // all others focus the selected option
344
+ // if no option is selected (empty multiselect), focuses first option
345
+ if (this.search) {
346
+ this.searchFieldEl.focus();
347
+ this.listboxEl.scrollTop = 0;
348
+ }
349
+ else if (this.selectedOptions.length > 0) {
350
+ this.focusOption(this.visibleOptionEls.filter((x) => x.selected)[0]);
351
+ }
352
+ else {
353
+ this.focusOption(this.visibleOptionEls[0]);
354
+ }
355
+ break;
356
+ }
357
+ });
358
+ }
359
+ }
360
+ close(returnFocus = true) {
361
+ if (this.isExpanded) {
362
+ this.isExpanded = false;
363
+ this.allOptionEls.map((i) => (i.focused = false));
364
+ window.setTimeout(() => {
365
+ this.dropdownEl.classList.add("hidden");
366
+ if (this.multiple) {
367
+ this.updateOptionVisibility();
368
+ }
369
+ // clear search field, reset filtered / bolded state of wm-options
370
+ if (this.search) {
371
+ this.searchFieldEl.value = "";
372
+ this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
373
+ }
374
+ // Returns focus to button after popup closes (no need if user is tabbing)
375
+ // Delay is necessary for screenreader to get new expanded state before focus
376
+ // window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
377
+ // also UX wise, it makes sense for the button to only be focused after the animation is complete
378
+ if (returnFocus) {
379
+ this.buttonEl.focus();
380
+ }
381
+ }, 150);
382
+ }
383
+ }
384
+ updateOptionVisibility() {
385
+ // this runs for search multiselects, where selected options are rendered at the top of the dropdown list
386
+ // slotted wm-options are hidden if selected, and duplicate wm-options are made visible if selected
387
+ this.childOptions.forEach((option, idx) => {
388
+ const duplicateOption = this.duplicateOptions[idx];
389
+ if (option.selected) {
390
+ option.classList.add("hidden");
391
+ duplicateOption.classList.remove("hidden");
392
+ }
393
+ else {
394
+ option.classList.remove("hidden");
395
+ duplicateOption.classList.add("hidden");
396
+ }
397
+ });
398
+ }
399
+ focusOption(option) {
400
+ this.allOptionEls.forEach((i) => (i.focused = i === option));
401
+ // option must be scrolledIntoView before focused
402
+ // if focus is called first the option might be positioned incorrectly (in the center of the dropdown) and scrollIntoView will do nothing as the option will already be in view
403
+ option.scrollIntoView({ block: "nearest" });
404
+ // scrollIntoView does not work when the container of the element it's called on is not rendered to the page (in our case the dropdown is still closed and has transform: scaleY(0))
405
+ // when opening the dropdown, scrollIntoView must be delayed to a point where the browser recognizes content within it as able to be scrolled to
406
+ // in Safari in particular, the soonest this seems to happen is 20ms. The longest we can wait before any jumping in the open dropdown is noticeable is 60ms
407
+ window.setTimeout(() => option.scrollIntoView({ block: "nearest" }), 60);
408
+ option.focus();
409
+ }
410
+ selectOption(option) {
411
+ // beware of this function's name. For multiselect it actually toggles the selected state, so it can also deselect the option
412
+ if (option.classList.contains("duplicate")) {
413
+ // if clicking on a duplicate option, toggle selected property of real one, then rerender
414
+ const correspondingOption = this.findCorrespondingOption(option);
415
+ correspondingOption.selected = !correspondingOption.selected;
416
+ forceUpdate(this.el);
417
+ }
418
+ else if (this.multiple) {
419
+ option.selected = !option.selected;
420
+ }
421
+ else {
422
+ this.childOptions.forEach((x) => (x.selected = x === option));
423
+ }
424
+ // update the selectAll checkbox when an option is de/selected
425
+ // checking is the el is present, implies that this.multiple and this.selectAll are true
426
+ if (this.selectAllEl) {
427
+ this.setSelectAllButton();
428
+ }
429
+ this.setButtonText();
430
+ }
431
+ findAndFocusOption(ev) {
432
+ const character = ev.detail.toLowerCase();
433
+ if (!this.keysSoFar) {
434
+ // if first character entered, set currently focused option as the starting index for the search
435
+ this.visibleOptionEls.forEach((option, idx) => {
436
+ if (option.focused) {
437
+ this.searchIndex = idx;
438
+ }
439
+ });
440
+ }
441
+ this.keysSoFar += character;
442
+ let nextMatch = this.findMatchInRange(this.visibleOptionEls, this.searchIndex + 1, this.visibleOptionEls.length);
443
+ if (!nextMatch) {
444
+ // if match can't be found from starting option downwards, search from top
445
+ nextMatch = this.findMatchInRange(this.visibleOptionEls, 0, this.searchIndex);
446
+ }
447
+ if (nextMatch) {
448
+ // findMatchInRange still might have returned null, only focus if match found
449
+ this.focusOption(nextMatch);
450
+ }
451
+ this.debouncedClearKeysSoFar();
452
+ }
453
+ findMatchInRange(list, startIndex, endIndex) {
454
+ let match = null;
455
+ let optionsInRange = list.slice(startIndex, endIndex);
456
+ // Find the first option starting with the keysSoFar substring, searching in
457
+ // the specified range of options
458
+ optionsInRange.forEach((option) => {
459
+ const label = option.textContent;
460
+ if (!match && label && label.toLowerCase().startsWith(this.keysSoFar)) {
461
+ match = option;
462
+ }
463
+ });
464
+ return match;
465
+ }
466
+ findCorrespondingOption(el) {
467
+ // if duplicate, returns the child wm-option
468
+ // if child wm-option, returns duplicate
469
+ const isDuplicate = el.classList.contains("duplicate");
470
+ return isDuplicate
471
+ ? this.childOptions[this.duplicateOptions.indexOf(el)]
472
+ : this.duplicateOptions[this.childOptions.indexOf(el)];
473
+ }
474
+ isElOrChild(el) {
475
+ var _a;
476
+ // determines whether or not the element is the component, a child of the component, or exists within the component's shadowroot
477
+ return el === this.el || this.el.contains(el) || ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(el));
478
+ }
479
+ exposeErrors() {
480
+ // When the error changes, a new id is set for the error container and the button's aria-describedby attribute is updated accordingly. This is to make sure the screen reader announces teh updated errors in Firefox. See this longstanding bug: https://bugzilla.mozilla.org/show_bug.cgi?id=493683
481
+ const newId = generateId();
482
+ this.errorContainer.id = `wm-errors-${newId}`;
483
+ this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
484
+ }
485
+ renderErrorContainer() {
486
+ return (h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
487
+ }
488
+ handleComponentBlur(ev) {
489
+ // Do not close or emit custom blur event when blurring to an element inside (wm-option)
490
+ if (!this.el.contains(ev.relatedTarget)) {
491
+ this.close(false);
492
+ this.wmSelectBlurred.emit();
493
+ this.wmComponentBlurred.emit(); // deprecated
494
+ }
495
+ }
496
+ // on search field or select all. keydown on options is handled via events.
497
+ handleKeyDown(ev) {
498
+ const el = ev.target;
499
+ switch (ev.key) {
500
+ case "ArrowDown":
501
+ ev.preventDefault();
502
+ this.moveDown(ev.target);
503
+ break;
504
+ case "ArrowUp":
505
+ ev.preventDefault();
506
+ this.moveUp(ev.target);
507
+ break;
508
+ case "Escape":
509
+ ev.preventDefault();
510
+ this.close();
511
+ break;
512
+ case "Enter":
513
+ if (el === this.selectAllEl) {
514
+ ev.preventDefault();
515
+ this.handleSelectAllClick();
516
+ this.close();
517
+ }
518
+ break;
519
+ case " ":
520
+ if (el === this.selectAllEl) {
521
+ ev.preventDefault();
522
+ this.handleSelectAllClick();
523
+ }
524
+ break;
525
+ }
526
+ }
527
+ setButtonText() {
528
+ this.displayedOptions = this.childOptions
529
+ .filter((x) => x.selected)
530
+ .map((y) => (!y.classList.contains("hidden") ? y : this.findCorrespondingOption(y)));
531
+ // handle overflow + counter for multiselect
532
+ if (this.multiple) {
533
+ // this is a fixed measurement accounting for the max width of a 3 character overflow counter
534
+ const overflowCounterWidth = 38;
535
+ const computedStyle = window.getComputedStyle(this.buttonEl);
536
+ // there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
537
+ const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
538
+ const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
539
+ const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
540
+ let optionsWidths = this.displayedOptions.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
541
+ let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
542
+ this.overflowCount = 0;
543
+ while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
544
+ this.overflowCount++;
545
+ optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
546
+ optionsWidths.pop();
547
+ this.displayedOptions.pop();
548
+ }
549
+ }
550
+ }
551
+ setSelectAllButton() {
552
+ if (this.allSelected) {
553
+ this.selectAllEl.textContent = this.deselectAllMessage;
554
+ this.announce(this.allOptionsSelectedMessage);
555
+ }
556
+ else {
557
+ this.selectAllEl.textContent = this.selectAllMessage;
558
+ if (this.selectedOptions.length === 0) {
559
+ this.announce(this.allOptionsDeselectedMessage);
560
+ }
561
+ }
562
+ }
563
+ announce(message) {
564
+ // \u00A0 is a non-breaking space character, which causes the message to be read as a new one
565
+ if (this.liveRegionEl.textContent === message) {
566
+ message += "\u00A0";
567
+ }
568
+ this.announcement = message;
569
+ }
570
+ renderButtonText() {
571
+ if (this.multiple && this.displayedOptions.length < 1) {
572
+ return h("span", null, this.placeholder);
573
+ }
574
+ else if (this.multiple && this.allSelected && this.overflowCount > 0) {
575
+ return this.allSelectedMessage;
576
+ }
577
+ else {
578
+ return this.displayedOptions.map((x, idx) => (h("span", null, idx > 0 ? ", " : "", x.textContent)));
579
+ }
580
+ }
581
+ renderSubinfo() {
582
+ // multiselects cannot have subinfo for options
583
+ if (!this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo) {
584
+ return h("span", { class: "subinfo" }, this.selectedOptions[0].subinfo);
585
+ }
586
+ }
587
+ renderOverflowCount() {
588
+ if (this.overflowCount > 0 && !this.allSelected) {
589
+ return (h("span", null, h("span", { class: "overflow-counter" }, "+", this.overflowCount)));
590
+ }
591
+ }
592
+ renderSearchField() {
593
+ return (h("div", { class: "search" }, h("div", { class: "searchfield-wrapper", ref: (el) => (this.searchFieldWrapperEl = el) }, h("div", { class: "icon" }), h("input", { ref: (el) => (this.searchFieldEl = el), class: "searchfield", role: "combobox", "aria-controls": `list-${this.uid}`, "aria-expanded": this.isExpanded ? "true" : "false", onKeyDown: (ev) => this.handleKeyDown(ev), onFocus: () => this.searchFieldWrapperEl.classList.add("focus"), onBlur: (ev) => this.handleSearchFieldBlur(ev), onInput: () => this.debouncedSearch(), placeholder: this.searchPlaceholder }))));
594
+ }
595
+ renderSearchFailedMessage() {
596
+ return h("div", { class: "search-results-message" }, this.noResultsFoundMessage);
597
+ }
598
+ renderSelectAllButton() {
599
+ if (this.selectAll && this.multiple && this.searchTerm == "") {
600
+ return (h("button", { ref: (el) => (this.selectAllEl = el), class: "select-all", onClick: () => this.handleSelectAllClick(), onKeyDown: (ev) => this.handleKeyDown(ev), tabindex: "-1" }, this.allSelected ? this.deselectAllMessage : this.selectAllMessage));
601
+ }
602
+ }
603
+ renderDuplicateOptions() {
604
+ return Array.from(this.el.children).map((option) => {
605
+ return (h("wm-option", { class: "duplicate", selected: option.selected }, option.textContent));
606
+ });
607
+ }
608
+ render() {
609
+ const buttonProps = {
610
+ id: `selectbtn-${this.uid}`,
611
+ ["disabled"]: this.disabled,
612
+ ["aria-controls"]: `list-${this.uid}`,
613
+ ["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
614
+ ["aria-describedby"]: "wm-errors",
615
+ ["aria-expanded"]: this.isExpanded ? "true" : "false",
616
+ onClick: () => (this.isExpanded ? this.close() : this.open()),
617
+ };
618
+ return (h(Host, { onBlur: (ev) => this.handleComponentBlur(ev) }, h("div", { class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.invalid || this.errorMessage ? "invalid" : ""}` }, h("div", { class: "label-wrapper" }, h("label", { class: "label", id: `label-${this.uid}`, htmlFor: `selectbtn-${this.uid}` }, this.label,
619
+ // we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
620
+ this.requiredField ? (h("span", { class: "required" }, h("span", { class: "sr-only" }, globalMessages.requiredField), h("span", { "aria-hidden": "true" }, "*"))) : (""))), h("div", { class: "button-wrapper" }, h("button", Object.assign({}, buttonProps, { class: `displayedoption ${this.isTabbing ? "user-is-tabbing" : ""}`, ref: (el) => (this.buttonEl = el), onBlur: (ev) => this.handleButtonBlur(ev), onFocus: () => this.close() }), h("span", { class: this.selectedOptions.length > 0 && this.selectedOptions.filter((x) => x.subinfo).length > 0
621
+ ? "overflowcontrol hassubinfo"
622
+ : "overflowcontrol" }, h("span", { class: "button-text" }, this.renderButtonText()), this.renderSubinfo()), this.renderOverflowCount()), h("div", { class: `dropdown ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, ref: (el) => (this.dropdownEl = el) }, this.search && this.renderSearchField(), h("div", { id: `list-${this.uid}`, class: "options-wrapper", tabindex: -1, role: "listbox", "aria-multiselectable": this.multiple ? "true" : null, "aria-labelledby": `label-${this.uid}`, ref: (el) => (this.listboxEl = el) }, this.search && this.filteredOptions.length === 0 && this.renderSearchFailedMessage(), this.renderSelectAllButton(), this.multiple && this.renderDuplicateOptions(), h("slot", null))), this.renderErrorContainer(), h("div", { id: "announcement", "aria-live": "polite", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
623
+ }
624
+ static get is() { return "wm-select"; }
625
+ static get encapsulation() { return "shadow"; }
626
+ static get delegatesFocus() { return true; }
627
+ static get originalStyleUrls() {
628
+ return {
629
+ "$": ["wm-select.scss"]
630
+ };
631
+ }
632
+ static get styleUrls() {
633
+ return {
634
+ "$": ["wm-select.css"]
635
+ };
636
+ }
637
+ static get properties() {
638
+ return {
639
+ "disabled": {
640
+ "type": "boolean",
641
+ "mutable": false,
642
+ "complexType": {
643
+ "original": "boolean",
644
+ "resolved": "boolean",
645
+ "references": {}
646
+ },
647
+ "required": false,
648
+ "optional": false,
649
+ "docs": {
650
+ "tags": [],
651
+ "text": ""
652
+ },
653
+ "attribute": "disabled",
654
+ "reflect": true,
655
+ "defaultValue": "false"
656
+ },
657
+ "invalid": {
658
+ "type": "boolean",
659
+ "mutable": true,
660
+ "complexType": {
661
+ "original": "boolean",
662
+ "resolved": "boolean",
663
+ "references": {}
664
+ },
665
+ "required": false,
666
+ "optional": false,
667
+ "docs": {
668
+ "tags": [],
669
+ "text": ""
670
+ },
671
+ "attribute": "invalid",
672
+ "reflect": false,
673
+ "defaultValue": "false"
674
+ },
675
+ "maxHeight": {
676
+ "type": "string",
677
+ "mutable": false,
678
+ "complexType": {
679
+ "original": "string",
680
+ "resolved": "string | undefined",
681
+ "references": {}
682
+ },
683
+ "required": false,
684
+ "optional": true,
685
+ "docs": {
686
+ "tags": [],
687
+ "text": ""
688
+ },
689
+ "attribute": "max-height",
690
+ "reflect": false
691
+ },
692
+ "label": {
693
+ "type": "string",
694
+ "mutable": true,
695
+ "complexType": {
696
+ "original": "string",
697
+ "resolved": "string | undefined",
698
+ "references": {}
699
+ },
700
+ "required": false,
701
+ "optional": true,
702
+ "docs": {
703
+ "tags": [],
704
+ "text": ""
705
+ },
706
+ "attribute": "label",
707
+ "reflect": false
708
+ },
709
+ "labelPosition": {
710
+ "type": "string",
711
+ "mutable": false,
712
+ "complexType": {
713
+ "original": "\"top\" | \"left\" | \"none\"",
714
+ "resolved": "\"left\" | \"none\" | \"top\"",
715
+ "references": {}
716
+ },
717
+ "required": false,
718
+ "optional": false,
719
+ "docs": {
720
+ "tags": [],
721
+ "text": ""
722
+ },
723
+ "attribute": "label-position",
724
+ "reflect": false,
725
+ "defaultValue": "\"top\""
726
+ },
727
+ "requiredField": {
728
+ "type": "boolean",
729
+ "mutable": false,
730
+ "complexType": {
731
+ "original": "boolean",
732
+ "resolved": "boolean",
733
+ "references": {}
734
+ },
735
+ "required": false,
736
+ "optional": false,
737
+ "docs": {
738
+ "tags": [],
739
+ "text": ""
740
+ },
741
+ "attribute": "required-field",
742
+ "reflect": false,
743
+ "defaultValue": "false"
744
+ },
745
+ "errorMessage": {
746
+ "type": "string",
747
+ "mutable": true,
748
+ "complexType": {
749
+ "original": "string",
750
+ "resolved": "string",
751
+ "references": {}
752
+ },
753
+ "required": false,
754
+ "optional": false,
755
+ "docs": {
756
+ "tags": [],
757
+ "text": ""
758
+ },
759
+ "attribute": "error-message",
760
+ "reflect": false,
761
+ "defaultValue": "\"\""
762
+ },
763
+ "multiple": {
764
+ "type": "boolean",
765
+ "mutable": false,
766
+ "complexType": {
767
+ "original": "boolean",
768
+ "resolved": "boolean",
769
+ "references": {}
770
+ },
771
+ "required": false,
772
+ "optional": false,
773
+ "docs": {
774
+ "tags": [],
775
+ "text": ""
776
+ },
777
+ "attribute": "multiple",
778
+ "reflect": false,
779
+ "defaultValue": "false"
780
+ },
781
+ "search": {
782
+ "type": "boolean",
783
+ "mutable": false,
784
+ "complexType": {
785
+ "original": "boolean",
786
+ "resolved": "boolean",
787
+ "references": {}
788
+ },
789
+ "required": false,
790
+ "optional": false,
791
+ "docs": {
792
+ "tags": [],
793
+ "text": ""
794
+ },
795
+ "attribute": "search",
796
+ "reflect": false,
797
+ "defaultValue": "false"
798
+ },
799
+ "selectAll": {
800
+ "type": "boolean",
801
+ "mutable": false,
802
+ "complexType": {
803
+ "original": "boolean",
804
+ "resolved": "boolean",
805
+ "references": {}
806
+ },
807
+ "required": false,
808
+ "optional": false,
809
+ "docs": {
810
+ "tags": [],
811
+ "text": ""
812
+ },
813
+ "attribute": "select-all",
814
+ "reflect": false,
815
+ "defaultValue": "false"
816
+ },
817
+ "placeholder": {
818
+ "type": "string",
819
+ "mutable": false,
820
+ "complexType": {
821
+ "original": "string",
822
+ "resolved": "string",
823
+ "references": {}
824
+ },
825
+ "required": false,
826
+ "optional": false,
827
+ "docs": {
828
+ "tags": [],
829
+ "text": ""
830
+ },
831
+ "attribute": "placeholder",
832
+ "reflect": false,
833
+ "defaultValue": "intl.formatMessage({\r\n id: \"select.multiPlaceholder\",\r\n defaultMessage: \"Make a selection\",\r\n description: \"Placeholder text. Use imperative\",\r\n })"
834
+ },
835
+ "searchPlaceholder": {
836
+ "type": "string",
837
+ "mutable": false,
838
+ "complexType": {
839
+ "original": "string",
840
+ "resolved": "string",
841
+ "references": {}
842
+ },
843
+ "required": false,
844
+ "optional": false,
845
+ "docs": {
846
+ "tags": [],
847
+ "text": ""
848
+ },
849
+ "attribute": "search-placeholder",
850
+ "reflect": false,
851
+ "defaultValue": "intl.formatMessage({\r\n id: \"select.searchPlaceholder\",\r\n defaultMessage: \"Search\",\r\n description: \"Placeholder text. Use imperative\",\r\n })"
852
+ },
853
+ "allSelectedMessage": {
854
+ "type": "string",
855
+ "mutable": false,
856
+ "complexType": {
857
+ "original": "string",
858
+ "resolved": "string",
859
+ "references": {}
860
+ },
861
+ "required": false,
862
+ "optional": false,
863
+ "docs": {
864
+ "tags": [],
865
+ "text": ""
866
+ },
867
+ "attribute": "all-selected-message",
868
+ "reflect": false,
869
+ "defaultValue": "intl.formatMessage({\r\n id: \"select.allSelected\",\r\n defaultMessage: \"All selected\",\r\n description: \"Text displayed when all options are selected\",\r\n })"
870
+ }
871
+ };
872
+ }
873
+ static get states() {
874
+ return {
875
+ "isTabbing": {},
876
+ "isExpanded": {},
877
+ "announcement": {}
878
+ };
879
+ }
880
+ static get events() {
881
+ return [{
882
+ "method": "wmSelectDidLoad",
883
+ "name": "wmSelectDidLoad",
884
+ "bubbles": true,
885
+ "cancelable": true,
886
+ "composed": true,
887
+ "docs": {
888
+ "tags": [],
889
+ "text": ""
890
+ },
891
+ "complexType": {
892
+ "original": "void",
893
+ "resolved": "void",
894
+ "references": {}
895
+ }
896
+ }, {
897
+ "method": "wmSelectBlurred",
898
+ "name": "wmSelectBlurred",
899
+ "bubbles": true,
900
+ "cancelable": true,
901
+ "composed": true,
902
+ "docs": {
903
+ "tags": [],
904
+ "text": ""
905
+ },
906
+ "complexType": {
907
+ "original": "void",
908
+ "resolved": "void",
909
+ "references": {}
910
+ }
911
+ }, {
912
+ "method": "wmSelectChanged",
913
+ "name": "wmSelectChanged",
914
+ "bubbles": true,
915
+ "cancelable": true,
916
+ "composed": true,
917
+ "docs": {
918
+ "tags": [],
919
+ "text": ""
920
+ },
921
+ "complexType": {
922
+ "original": "Object",
923
+ "resolved": "Object",
924
+ "references": {
925
+ "Object": {
926
+ "location": "global"
927
+ }
928
+ }
929
+ }
930
+ }, {
931
+ "method": "wmComponentBlurred",
932
+ "name": "wmComponentBlurred",
933
+ "bubbles": true,
934
+ "cancelable": true,
935
+ "composed": true,
936
+ "docs": {
937
+ "tags": [],
938
+ "text": ""
939
+ },
940
+ "complexType": {
941
+ "original": "void",
942
+ "resolved": "void",
943
+ "references": {}
944
+ }
945
+ }, {
946
+ "method": "wmSelectSearchChanged",
947
+ "name": "wmSelectSearchChanged",
948
+ "bubbles": true,
949
+ "cancelable": true,
950
+ "composed": true,
951
+ "docs": {
952
+ "tags": [],
953
+ "text": ""
954
+ },
955
+ "complexType": {
956
+ "original": "Object",
957
+ "resolved": "Object",
958
+ "references": {
959
+ "Object": {
960
+ "location": "global"
961
+ }
962
+ }
963
+ }
964
+ }];
965
+ }
966
+ static get elementRef() { return "el"; }
967
+ static get watchers() {
968
+ return [{
969
+ "propName": "errorMessage",
970
+ "methodName": "exposeErrors"
971
+ }];
972
+ }
973
+ static get listeners() {
974
+ return [{
975
+ "name": "wmUserIsTabbing",
976
+ "method": "toggleTabbingOn",
977
+ "target": "window",
978
+ "capture": false,
979
+ "passive": false
980
+ }, {
981
+ "name": "wmUserIsNotTabbing",
982
+ "method": "toggleTabbingOff",
983
+ "target": "window",
984
+ "capture": false,
985
+ "passive": false
986
+ }, {
987
+ "name": "wmOptionSelected",
988
+ "method": "handleOptionSelection",
989
+ "target": undefined,
990
+ "capture": false,
991
+ "passive": false
992
+ }, {
993
+ "name": "wmEnterKeyPressed",
994
+ "method": "handleChildEnter",
995
+ "target": undefined,
996
+ "capture": false,
997
+ "passive": false
998
+ }, {
999
+ "name": "wmKeyUpPressed",
1000
+ "method": "handleChildUp",
1001
+ "target": undefined,
1002
+ "capture": false,
1003
+ "passive": false
1004
+ }, {
1005
+ "name": "wmKeyDownPressed",
1006
+ "method": "handleChildDown",
1007
+ "target": undefined,
1008
+ "capture": false,
1009
+ "passive": false
1010
+ }, {
1011
+ "name": "wmHomeKeyPressed",
1012
+ "method": "moveToFirstOption",
1013
+ "target": undefined,
1014
+ "capture": false,
1015
+ "passive": false
1016
+ }, {
1017
+ "name": "wmEndKeyPressed",
1018
+ "method": "moveToLastOption",
1019
+ "target": undefined,
1020
+ "capture": false,
1021
+ "passive": false
1022
+ }, {
1023
+ "name": "wmEscKeyPressed",
1024
+ "method": "closePopupOnEscape",
1025
+ "target": undefined,
1026
+ "capture": false,
1027
+ "passive": false
1028
+ }, {
1029
+ "name": "wmOptionBlurred",
1030
+ "method": "handleOptionBlur",
1031
+ "target": undefined,
1032
+ "capture": false,
1033
+ "passive": false
1034
+ }, {
1035
+ "name": "click",
1036
+ "method": "handleClick",
1037
+ "target": "document",
1038
+ "capture": true,
1039
+ "passive": false
1040
+ }, {
1041
+ "name": "keydown",
1042
+ "method": "handleKey",
1043
+ "target": undefined,
1044
+ "capture": false,
1045
+ "passive": false
1046
+ }, {
1047
+ "name": "wmLetterPressed",
1048
+ "method": "findAndFocusOption",
1049
+ "target": undefined,
1050
+ "capture": false,
1051
+ "passive": false
1052
+ }];
1053
+ }
1054
+ }