@watermarkinsights/ripple 3.16.0 → 3.17.0-2

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 (267) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{chartFunctions-45d38ae4.js → chartFunctions-0c02a801.js} +425 -421
  3. package/dist/cjs/{functions-23309c38.js → functions-cb39693a.js} +483 -483
  4. package/dist/cjs/{global-5260837d.js → global-4e97582e.js} +62 -62
  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/loader.cjs.js +2 -2
  8. package/dist/cjs/priv-chart-popover.cjs.entry.js +86 -86
  9. package/dist/cjs/priv-datepicker.cjs.entry.js +657 -657
  10. package/dist/cjs/priv-navigator-button.cjs.entry.js +18 -18
  11. package/dist/cjs/priv-navigator-item.cjs.entry.js +23 -23
  12. package/dist/cjs/ripple.cjs.js +2 -2
  13. package/dist/cjs/wm-action-menu_2.cjs.entry.js +329 -329
  14. package/dist/cjs/wm-button.cjs.entry.js +248 -248
  15. package/dist/cjs/wm-chart-slice.cjs.entry.js +13 -13
  16. package/dist/cjs/wm-chart.cjs.entry.js +111 -111
  17. package/dist/cjs/wm-datepicker.cjs.entry.js +265 -265
  18. package/dist/cjs/wm-input.cjs.entry.js +134 -134
  19. package/dist/cjs/wm-modal-footer.cjs.entry.js +33 -33
  20. package/dist/cjs/wm-modal-header.cjs.entry.js +36 -36
  21. package/dist/cjs/wm-modal.cjs.entry.js +163 -163
  22. package/dist/cjs/wm-navigation_3.cjs.entry.js +227 -227
  23. package/dist/cjs/wm-navigator.cjs.entry.js +268 -268
  24. package/dist/cjs/wm-network-uploader.cjs.entry.js +455 -455
  25. package/dist/cjs/wm-option_2.cjs.entry.js +720 -720
  26. package/dist/cjs/wm-pagination.cjs.entry.js +167 -167
  27. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +139 -131
  28. package/dist/cjs/wm-search.cjs.entry.js +232 -232
  29. package/dist/cjs/wm-snackbar.cjs.entry.js +170 -170
  30. package/dist/cjs/wm-tab-item_3.cjs.entry.js +296 -296
  31. package/dist/cjs/wm-tag-input-row.cjs.entry.js +10 -10
  32. package/dist/cjs/wm-tag-input.cjs.entry.js +884 -884
  33. package/dist/cjs/wm-timepicker.cjs.entry.js +383 -383
  34. package/dist/cjs/wm-toggletip.cjs.entry.js +124 -124
  35. package/dist/cjs/wm-uploader.cjs.entry.js +556 -556
  36. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  37. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +258 -258
  38. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +115 -115
  39. package/dist/collection/components/charts/wm-chart/wm-chart.css +81 -84
  40. package/dist/collection/components/charts/wm-chart/wm-chart.js +328 -328
  41. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.css +81 -84
  42. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +194 -195
  43. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.css +86 -0
  44. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +117 -88
  45. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +111 -111
  46. package/dist/collection/components/wm-action-menu/wm-action-menu.js +442 -442
  47. package/dist/collection/components/wm-button/wm-button.js +545 -545
  48. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1024 -1024
  49. package/dist/collection/components/wm-datepicker/wm-datepicker.js +471 -471
  50. package/dist/collection/components/wm-input/wm-input.js +423 -423
  51. package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
  52. package/dist/collection/components/wm-modal/wm-modal-footer.js +136 -136
  53. package/dist/collection/components/wm-modal/wm-modal-header.js +87 -87
  54. package/dist/collection/components/wm-modal/wm-modal.js +461 -461
  55. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +162 -162
  56. package/dist/collection/components/wm-navigation/wm-navigation-item.js +121 -121
  57. package/dist/collection/components/wm-navigation/wm-navigation.js +218 -218
  58. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
  59. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
  60. package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
  61. package/dist/collection/components/wm-option/wm-option.js +428 -428
  62. package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
  63. package/dist/collection/components/wm-search/wm-search.js +480 -480
  64. package/dist/collection/components/wm-select/wm-select.js +1001 -1001
  65. package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
  66. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +216 -216
  67. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +330 -330
  68. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
  69. package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +115 -115
  70. package/dist/collection/components/wm-tag-input/wm-tag-input.js +1201 -1201
  71. package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
  72. package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
  73. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +788 -788
  74. package/dist/collection/components/wm-uploader/wm-uploader.js +1000 -1000
  75. package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
  76. package/dist/collection/dev/scripts.js +20 -20
  77. package/dist/collection/global/__mocks__/functions.js +6 -6
  78. package/dist/collection/global/chartFunctions.js +426 -423
  79. package/dist/collection/global/functions.js +486 -486
  80. package/dist/collection/global/global.js +69 -69
  81. package/dist/collection/global/interfaces.js +49 -49
  82. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  83. package/dist/collection/global/services/http-service.js +50 -50
  84. package/dist/collection/lang/lang.js +5 -5
  85. package/dist/collection/lang/missing.js +43 -43
  86. package/dist/collection/lang/piglatin.js +93 -93
  87. package/dist/esm/{chartFunctions-4433cafc.js → chartFunctions-fe9af0f8.js} +425 -422
  88. package/dist/esm/{functions-14df5b8c.js → functions-478ab920.js} +483 -483
  89. package/dist/esm/{global-0087a2ea.js → global-32a33c56.js} +62 -62
  90. package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
  91. package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
  92. package/dist/esm/loader.js +2 -2
  93. package/dist/esm/polyfills/core-js.js +0 -0
  94. package/dist/esm/polyfills/dom.js +0 -0
  95. package/dist/esm/polyfills/es5-html-element.js +0 -0
  96. package/dist/esm/polyfills/index.js +0 -0
  97. package/dist/esm/polyfills/system.js +0 -0
  98. package/dist/esm/priv-chart-popover.entry.js +86 -86
  99. package/dist/esm/priv-datepicker.entry.js +657 -657
  100. package/dist/esm/priv-navigator-button.entry.js +18 -18
  101. package/dist/esm/priv-navigator-item.entry.js +23 -23
  102. package/dist/esm/ripple.js +2 -2
  103. package/dist/esm/wm-action-menu_2.entry.js +329 -329
  104. package/dist/esm/wm-button.entry.js +248 -248
  105. package/dist/esm/wm-chart-slice.entry.js +13 -13
  106. package/dist/esm/wm-chart.entry.js +111 -111
  107. package/dist/esm/wm-datepicker.entry.js +265 -265
  108. package/dist/esm/wm-input.entry.js +134 -134
  109. package/dist/esm/wm-modal-footer.entry.js +33 -33
  110. package/dist/esm/wm-modal-header.entry.js +36 -36
  111. package/dist/esm/wm-modal.entry.js +163 -163
  112. package/dist/esm/wm-navigation_3.entry.js +227 -227
  113. package/dist/esm/wm-navigator.entry.js +268 -268
  114. package/dist/esm/wm-network-uploader.entry.js +455 -455
  115. package/dist/esm/wm-option_2.entry.js +720 -720
  116. package/dist/esm/wm-pagination.entry.js +167 -167
  117. package/dist/esm/wm-progress-indicator_3.entry.js +139 -131
  118. package/dist/esm/wm-search.entry.js +232 -232
  119. package/dist/esm/wm-snackbar.entry.js +170 -170
  120. package/dist/esm/wm-tab-item_3.entry.js +296 -296
  121. package/dist/esm/wm-tag-input-row.entry.js +10 -10
  122. package/dist/esm/wm-tag-input.entry.js +884 -884
  123. package/dist/esm/wm-timepicker.entry.js +383 -383
  124. package/dist/esm/wm-toggletip.entry.js +124 -124
  125. package/dist/esm/wm-uploader.entry.js +556 -556
  126. package/dist/esm/wm-wrapper.entry.js +12 -12
  127. package/dist/esm-es5/{chartFunctions-4433cafc.js → chartFunctions-fe9af0f8.js} +1 -1
  128. package/dist/esm-es5/{functions-14df5b8c.js → functions-478ab920.js} +0 -0
  129. package/dist/esm-es5/global-32a33c56.js +1 -0
  130. package/dist/esm-es5/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +0 -0
  131. package/dist/esm-es5/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +0 -0
  132. package/dist/esm-es5/loader.js +1 -1
  133. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  134. package/dist/esm-es5/priv-datepicker.entry.js +1 -1
  135. package/dist/esm-es5/ripple.js +1 -1
  136. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  137. package/dist/esm-es5/wm-button.entry.js +1 -1
  138. package/dist/esm-es5/wm-chart.entry.js +1 -1
  139. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  140. package/dist/esm-es5/wm-input.entry.js +1 -1
  141. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  142. package/dist/esm-es5/wm-modal.entry.js +1 -1
  143. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  144. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  145. package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
  146. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  147. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  148. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  149. package/dist/esm-es5/wm-search.entry.js +1 -1
  150. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  151. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  152. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  153. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  154. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  155. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  156. package/dist/ripple/{p-dfe38d43.system.entry.js → p-054ccfa1.system.entry.js} +1 -1
  157. package/dist/ripple/{p-ff011bf3.entry.js → p-09b2c614.entry.js} +1 -1
  158. package/dist/ripple/{p-d063e3e9.entry.js → p-0dd172c2.entry.js} +1 -1
  159. package/dist/ripple/{p-df2bd836.entry.js → p-10d6335d.entry.js} +1 -1
  160. package/dist/ripple/{p-923527d9.system.entry.js → p-1762bc51.system.entry.js} +1 -1
  161. package/dist/ripple/{p-d530a06f.system.entry.js → p-1a1a6d89.system.entry.js} +1 -1
  162. package/dist/ripple/{p-8707f00a.system.entry.js → p-29792d81.system.entry.js} +1 -1
  163. package/dist/ripple/{p-d24ecc0c.js → p-2b929b10.js} +1 -1
  164. package/dist/ripple/{p-aa0e1f8b.system.entry.js → p-2e6988e6.system.entry.js} +1 -1
  165. package/dist/ripple/{p-811380de.entry.js → p-34d6d1d2.entry.js} +1 -1
  166. package/dist/ripple/{p-85ea8ece.entry.js → p-3597b28b.entry.js} +1 -1
  167. package/dist/ripple/{p-1d61c7bd.system.entry.js → p-3efd31ef.system.entry.js} +1 -1
  168. package/dist/ripple/{p-6f7f1331.system.entry.js → p-3fbf3278.system.entry.js} +1 -1
  169. package/dist/ripple/{p-6b4bc7ed.system.entry.js → p-430183de.system.entry.js} +1 -1
  170. package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
  171. package/dist/ripple/{p-b545a4a1.entry.js → p-44da2057.entry.js} +1 -1
  172. package/dist/ripple/p-4a1498f7.system.js +1 -0
  173. package/dist/ripple/p-4f1bf7f5.entry.js +1 -0
  174. package/dist/ripple/{p-32c15757.entry.js → p-5bea2c87.entry.js} +1 -1
  175. package/dist/ripple/{p-0ec5e02c.system.js → p-63190f58.system.js} +0 -0
  176. package/dist/ripple/{p-959aa7ae.system.entry.js → p-695fba1d.system.entry.js} +1 -1
  177. package/dist/ripple/p-791c6577.js +1 -0
  178. package/dist/ripple/{p-2a18f87c.entry.js → p-7a654f2c.entry.js} +1 -1
  179. package/dist/ripple/p-7ce57c62.system.js +1 -0
  180. package/dist/ripple/p-7f621f1c.system.entry.js +1 -0
  181. package/dist/ripple/{p-e3114f71.entry.js → p-87edffcc.entry.js} +1 -1
  182. package/dist/ripple/p-8ee1416a.entry.js +1 -0
  183. package/dist/ripple/{p-47639d21.entry.js → p-9a603f75.entry.js} +1 -1
  184. package/dist/ripple/{p-313b6073.system.js → p-9d02957d.system.js} +0 -0
  185. package/dist/ripple/{p-6c5006d1.entry.js → p-a2663226.entry.js} +1 -1
  186. package/dist/ripple/{p-54fb8d84.entry.js → p-a60407e7.entry.js} +1 -1
  187. package/dist/ripple/{p-05d01f10.system.entry.js → p-b6eb9ed6.system.entry.js} +1 -1
  188. package/dist/ripple/p-bf4bbba3.system.js +1 -0
  189. package/dist/ripple/{p-475e8f32.entry.js → p-c56dc658.entry.js} +1 -1
  190. package/dist/ripple/{p-e62f5770.entry.js → p-c741ddb3.entry.js} +1 -1
  191. package/dist/ripple/{p-9e294a2a.system.entry.js → p-cb22eef3.system.entry.js} +1 -1
  192. package/dist/ripple/{p-fa36e7b3.js → p-cd73566d.js} +0 -0
  193. package/dist/ripple/{p-f48bf28e.system.entry.js → p-d25523dd.system.entry.js} +1 -1
  194. package/dist/ripple/{p-2f9a6860.system.entry.js → p-d872e221.system.entry.js} +1 -1
  195. package/dist/ripple/{p-4325dabd.entry.js → p-d8a12a04.entry.js} +1 -1
  196. package/dist/ripple/{p-31af715e.system.entry.js → p-d9978c48.system.entry.js} +1 -1
  197. package/dist/ripple/p-daec9ed7.system.entry.js +1 -0
  198. package/dist/ripple/{p-ebe7b4fb.entry.js → p-dc7b53bd.entry.js} +1 -1
  199. package/dist/ripple/{p-7d9920ea.system.entry.js → p-df895edb.system.entry.js} +1 -1
  200. package/dist/ripple/{p-5095fe0c.system.entry.js → p-e5a472c8.system.entry.js} +1 -1
  201. package/dist/ripple/{p-671b7adf.entry.js → p-e9b0eccc.entry.js} +1 -1
  202. package/dist/ripple/{p-2d285e1c.system.entry.js → p-ee3b6b4c.system.entry.js} +1 -1
  203. package/dist/ripple/{p-0e3e046c.system.entry.js → p-eea875ce.system.entry.js} +1 -1
  204. package/dist/ripple/{p-5b3a44fe.system.entry.js → p-f0b67d2f.system.entry.js} +1 -1
  205. package/dist/ripple/{p-08b7ec08.system.js → p-f5df5903.system.js} +0 -0
  206. package/dist/ripple/{p-cfea1f6e.entry.js → p-f62d01f9.entry.js} +1 -1
  207. package/dist/ripple/{p-0d0286c5.entry.js → p-f640448f.entry.js} +1 -1
  208. package/dist/ripple/{p-23c428dd.entry.js → p-fbd67b12.entry.js} +1 -1
  209. package/dist/ripple/{p-1a909e18.system.entry.js → p-fccab03d.system.entry.js} +1 -1
  210. package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
  211. package/dist/ripple/ripple.esm.js +1 -1
  212. package/dist/ripple/ripple.js +1 -1
  213. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
  214. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
  215. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +36 -36
  216. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +27 -27
  217. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +19 -17
  218. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
  219. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +47 -47
  220. package/dist/types/components/wm-button/wm-button.d.ts +49 -49
  221. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
  222. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +41 -41
  223. package/dist/types/components/wm-input/wm-input.d.ts +46 -46
  224. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  225. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
  226. package/dist/types/components/wm-modal/wm-modal-header.d.ts +11 -11
  227. package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
  228. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +21 -21
  229. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
  230. package/dist/types/components/wm-navigation/wm-navigation.d.ts +28 -28
  231. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  232. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  233. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  234. package/dist/types/components/wm-option/wm-option.d.ts +35 -35
  235. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  236. package/dist/types/components/wm-search/wm-search.d.ts +86 -86
  237. package/dist/types/components/wm-select/wm-select.d.ts +94 -94
  238. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
  239. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
  240. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
  241. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  242. package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +11 -11
  243. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +126 -126
  244. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +61 -61
  245. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
  246. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  247. package/dist/types/components/wm-uploader/wm-uploader.d.ts +117 -117
  248. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  249. package/dist/types/components.d.ts +29 -27
  250. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  251. package/dist/types/global/chartFunctions.d.ts +30 -29
  252. package/dist/types/global/functions.d.ts +46 -46
  253. package/dist/types/global/global.d.ts +1 -1
  254. package/dist/types/global/interfaces.d.ts +48 -44
  255. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  256. package/dist/types/global/services/http-service.d.ts +4 -4
  257. package/dist/types/lang/lang.d.ts +5 -5
  258. package/package.json +47 -47
  259. package/dist/esm-es5/global-0087a2ea.js +0 -1
  260. package/dist/ripple/p-09dca516.system.js +0 -1
  261. package/dist/ripple/p-20ad8577.entry.js +0 -1
  262. package/dist/ripple/p-276c88b5.system.entry.js +0 -1
  263. package/dist/ripple/p-4033dc2d.system.entry.js +0 -1
  264. package/dist/ripple/p-437c9944.system.js +0 -1
  265. package/dist/ripple/p-479b5d27.js +0 -1
  266. package/dist/ripple/p-71ac86cb.entry.js +0 -1
  267. package/dist/ripple/p-bbaec20d.system.js +0 -1
@@ -1,731 +1,731 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, f as forceUpdate } from './index-17c79cc6.js';
2
- import { i as intl, d as debounce, g as generateId, l as shouldOpenUp, v as getTextDir } from './functions-14df5b8c.js';
2
+ import { i as intl, d as debounce, g as generateId, l as shouldOpenUp, v as getTextDir } from './functions-478ab920.js';
3
3
 
4
4
  const wmOptionCss = ":host(:not(:last-child)),wm-option:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host,wm-option{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host:focus,:host.focus,wm-option:focus,wm-option.focus{outline:none;background:#f4f4f4}:host.icon,wm-option.icon{color:#575195}:host .sr-only,wm-option .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.checkbox:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f131\";display:inline;margin-right:0.25rem;color:#575195}:host([aria-selected=true]),wm-option[aria-selected=true]{background:rgba(46, 27, 70, 0.05);font-weight:500}:host([aria-selected=true]) .checkbox:before,wm-option[aria-selected=true] .checkbox:before{content:\"\\f132\"}:host([aria-disabled=true]),wm-option[aria-disabled=true]{font-style:italic;color:#6b6b6b;cursor:default}:host([aria-disabled=true]) .checkbox:before,wm-option[aria-disabled=true] .checkbox:before{color:#6b6b6b}:host(.multi-option),wm-option.multi-option{background:unset}:host(.hidden),wm-option.hidden,:host(.filtered-out),wm-option.filtered-out{display:none}:host(.duplicate.last),wm-option.duplicate.last{border-bottom:12px solid rgba(46, 27, 70, 0.05)}:host(.hassubinfo),wm-option.hassubinfo{display:-ms-flexbox;display:flex}:host(.hassubinfo) .option-wrapper,wm-option.hassubinfo .option-wrapper{-ms-flex:1;flex:1}:host(.hassubinfo) .subinfo,wm-option.hassubinfo .subinfo{-ms-flex:none;flex:none}.subinfo{font-style:italic}.option-wrapper{display:inline-block}::slotted{font-family:inherit}::slotted(i){font-size:0.875rem}::slotted(i):before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus),wm-option:focus{outline:none;background:#f4f4f4}:host(:hover){background:#f4f4f4;outline:none}";
5
5
 
6
- const Option = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.wmOptionSelected = createEvent(this, "wmOptionSelected", 7);
10
- this.wmKeyUpPressed = createEvent(this, "wmKeyUpPressed", 7);
11
- this.wmKeyDownPressed = createEvent(this, "wmKeyDownPressed", 7);
12
- this.wmEscKeyPressed = createEvent(this, "wmEscKeyPressed", 7);
13
- this.wmHomeKeyPressed = createEvent(this, "wmHomeKeyPressed", 7);
14
- this.wmEndKeyPressed = createEvent(this, "wmEndKeyPressed", 7);
15
- this.wmEnterKeyPressed = createEvent(this, "wmEnterKeyPressed", 7);
16
- this.wmLetterPressed = createEvent(this, "wmLetterPressed", 7);
17
- this.wmOptionBlurred = createEvent(this, "wmOptionBlurred", 7);
18
- this.subinfo = undefined;
19
- this.disabled = false;
20
- this.selected = false;
21
- this.focused = false;
22
- this.searchTerm = "";
23
- }
24
- get hostClasses() {
25
- let classes = [];
26
- if (this.subinfo) {
27
- classes.push("hassubinfo");
28
- }
29
- if (this.parentSelectEl.multiple) {
30
- classes.push("multi-option");
31
- }
32
- if (!this.el.textContent.toLowerCase().includes(this.searchTerm)) {
33
- classes.push("filtered-out");
34
- }
35
- return classes.join(" ");
36
- }
37
- get parentSelectEl() {
38
- var _a;
39
- return ((_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.nodeName) !== "WM-SELECT"
40
- ? this.el.getRootNode().host
41
- : this.el.parentElement;
42
- }
43
- handleKeydown(ev) {
44
- switch (ev.key) {
45
- case "ArrowUp":
46
- ev.preventDefault();
47
- this.wmKeyUpPressed.emit(this.el);
48
- break;
49
- case "ArrowDown":
50
- ev.preventDefault();
51
- this.wmKeyDownPressed.emit(this.el);
52
- break;
53
- case "Enter":
54
- ev.preventDefault();
55
- if (!this.disabled) {
56
- this.el.click();
57
- this.wmEnterKeyPressed.emit(this.el);
58
- }
59
- break;
60
- case " ":
61
- ev.preventDefault();
62
- this.el.click();
63
- break;
64
- case "Escape":
65
- ev.preventDefault();
66
- ev.stopPropagation(); // for instance if select is in a modal, esc should close the select but not the modal
67
- this.wmEscKeyPressed.emit();
68
- break;
69
- case "Home":
70
- ev.preventDefault();
71
- this.wmHomeKeyPressed.emit();
72
- break;
73
- case "End":
74
- ev.preventDefault();
75
- this.wmEndKeyPressed.emit();
76
- break;
77
- default:
78
- this.wmLetterPressed.emit(ev.key);
79
- }
80
- }
81
- handleSelection() {
82
- if (!this.disabled) {
83
- // the parent wm-select is in charge of the actual selection
84
- // using ev.detail because ev.target returns the wm-select for duplicate options
85
- this.wmOptionSelected.emit(this.el);
86
- }
87
- }
88
- handleBlur(ev) {
89
- this.wmOptionBlurred.emit({ relatedTarget: ev.relatedTarget });
90
- }
91
- syncAriaSelected() {
92
- // this function only keeps the aria-selected attr in sync with the selected prop
93
- // all the logic for selecting / deselecting happens in the parent wm-select
94
- this.selected ? this.el.setAttribute("aria-selected", "true") : this.el.removeAttribute("aria-selected");
95
- }
96
- syncAriaDisabled() {
97
- this.disabled ? this.el.setAttribute("aria-disabled", "true") : this.el.removeAttribute("aria-disabled");
98
- }
99
- focusHandler(newValue) {
100
- if (newValue)
101
- this.el.focus();
102
- }
103
- updateDisabledOnClick() {
104
- if (this.disabled && this.el.onclick) {
105
- this.onClickFunc = this.el.onclick;
106
- this.el.onclick = null;
107
- }
108
- else if (!this.disabled && this.onClickFunc) {
109
- this.el.onclick = this.onClickFunc;
110
- }
111
- }
112
- handleSearch(ev) {
113
- // filter is case-insensitive, so
114
- this.searchTerm = ev.detail.searchTerm.toLowerCase();
115
- if (this.searchTerm) {
116
- const regexp = new RegExp(`${this.searchTerm}`, "gi");
117
- const boldedText = this.el.textContent.replace(regexp, (match) => `<strong>${match}</strong>`);
118
- // for voiceover, text splitting is read as separate phrases. i.e. hel<b>lo</b> will be read as "hel lo"
119
- // aria-hidden and sr-only is used to circumvent this
120
- this.textEl.innerHTML = boldedText;
121
- }
122
- else {
123
- this.textEl.innerHTML = this.el.textContent;
124
- }
125
- }
126
- componentWillLoad() {
127
- this.syncAriaSelected();
128
- this.syncAriaDisabled();
129
- this.updateDisabledOnClick();
130
- this.parentSelectEl.addEventListener("wmSelectSearchChanged", (ev) => this.handleSearch(ev));
131
- }
132
- render() {
133
- return (h(Host, { role: "option", tabindex: this.focused ? 0 : -1, class: this.hostClasses }, h("div", { class: `option-wrapper ${this.parentSelectEl.multiple ? "checkbox" : ""}` }, h("span", { "aria-hidden": "true", ref: (el) => (this.textEl = el) }, this.el.textContent), h("span", { class: "sr-only" }, this.el.textContent)), h("div", { class: "subinfo" }, this.subinfo)));
134
- }
135
- get el() { return getElement(this); }
136
- static get watchers() { return {
137
- "selected": ["syncAriaSelected"],
138
- "disabled": ["syncAriaDisabled", "updateDisabledOnClick"],
139
- "focused": ["focusHandler"]
140
- }; }
141
- };
6
+ const Option = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.wmOptionSelected = createEvent(this, "wmOptionSelected", 7);
10
+ this.wmKeyUpPressed = createEvent(this, "wmKeyUpPressed", 7);
11
+ this.wmKeyDownPressed = createEvent(this, "wmKeyDownPressed", 7);
12
+ this.wmEscKeyPressed = createEvent(this, "wmEscKeyPressed", 7);
13
+ this.wmHomeKeyPressed = createEvent(this, "wmHomeKeyPressed", 7);
14
+ this.wmEndKeyPressed = createEvent(this, "wmEndKeyPressed", 7);
15
+ this.wmEnterKeyPressed = createEvent(this, "wmEnterKeyPressed", 7);
16
+ this.wmLetterPressed = createEvent(this, "wmLetterPressed", 7);
17
+ this.wmOptionBlurred = createEvent(this, "wmOptionBlurred", 7);
18
+ this.subinfo = undefined;
19
+ this.disabled = false;
20
+ this.selected = false;
21
+ this.focused = false;
22
+ this.searchTerm = "";
23
+ }
24
+ get hostClasses() {
25
+ let classes = [];
26
+ if (this.subinfo) {
27
+ classes.push("hassubinfo");
28
+ }
29
+ if (this.parentSelectEl.multiple) {
30
+ classes.push("multi-option");
31
+ }
32
+ if (!this.el.textContent.toLowerCase().includes(this.searchTerm)) {
33
+ classes.push("filtered-out");
34
+ }
35
+ return classes.join(" ");
36
+ }
37
+ get parentSelectEl() {
38
+ var _a;
39
+ return ((_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.nodeName) !== "WM-SELECT"
40
+ ? this.el.getRootNode().host
41
+ : this.el.parentElement;
42
+ }
43
+ handleKeydown(ev) {
44
+ switch (ev.key) {
45
+ case "ArrowUp":
46
+ ev.preventDefault();
47
+ this.wmKeyUpPressed.emit(this.el);
48
+ break;
49
+ case "ArrowDown":
50
+ ev.preventDefault();
51
+ this.wmKeyDownPressed.emit(this.el);
52
+ break;
53
+ case "Enter":
54
+ ev.preventDefault();
55
+ if (!this.disabled) {
56
+ this.el.click();
57
+ this.wmEnterKeyPressed.emit(this.el);
58
+ }
59
+ break;
60
+ case " ":
61
+ ev.preventDefault();
62
+ this.el.click();
63
+ break;
64
+ case "Escape":
65
+ ev.preventDefault();
66
+ ev.stopPropagation(); // for instance if select is in a modal, esc should close the select but not the modal
67
+ this.wmEscKeyPressed.emit();
68
+ break;
69
+ case "Home":
70
+ ev.preventDefault();
71
+ this.wmHomeKeyPressed.emit();
72
+ break;
73
+ case "End":
74
+ ev.preventDefault();
75
+ this.wmEndKeyPressed.emit();
76
+ break;
77
+ default:
78
+ this.wmLetterPressed.emit(ev.key);
79
+ }
80
+ }
81
+ handleSelection() {
82
+ if (!this.disabled) {
83
+ // the parent wm-select is in charge of the actual selection
84
+ // using ev.detail because ev.target returns the wm-select for duplicate options
85
+ this.wmOptionSelected.emit(this.el);
86
+ }
87
+ }
88
+ handleBlur(ev) {
89
+ this.wmOptionBlurred.emit({ relatedTarget: ev.relatedTarget });
90
+ }
91
+ syncAriaSelected() {
92
+ // this function only keeps the aria-selected attr in sync with the selected prop
93
+ // all the logic for selecting / deselecting happens in the parent wm-select
94
+ this.selected ? this.el.setAttribute("aria-selected", "true") : this.el.removeAttribute("aria-selected");
95
+ }
96
+ syncAriaDisabled() {
97
+ this.disabled ? this.el.setAttribute("aria-disabled", "true") : this.el.removeAttribute("aria-disabled");
98
+ }
99
+ focusHandler(newValue) {
100
+ if (newValue)
101
+ this.el.focus();
102
+ }
103
+ updateDisabledOnClick() {
104
+ if (this.disabled && this.el.onclick) {
105
+ this.onClickFunc = this.el.onclick;
106
+ this.el.onclick = null;
107
+ }
108
+ else if (!this.disabled && this.onClickFunc) {
109
+ this.el.onclick = this.onClickFunc;
110
+ }
111
+ }
112
+ handleSearch(ev) {
113
+ // filter is case-insensitive, so
114
+ this.searchTerm = ev.detail.searchTerm.toLowerCase();
115
+ if (this.searchTerm) {
116
+ const regexp = new RegExp(`${this.searchTerm}`, "gi");
117
+ const boldedText = this.el.textContent.replace(regexp, (match) => `<strong>${match}</strong>`);
118
+ // for voiceover, text splitting is read as separate phrases. i.e. hel<b>lo</b> will be read as "hel lo"
119
+ // aria-hidden and sr-only is used to circumvent this
120
+ this.textEl.innerHTML = boldedText;
121
+ }
122
+ else {
123
+ this.textEl.innerHTML = this.el.textContent;
124
+ }
125
+ }
126
+ componentWillLoad() {
127
+ this.syncAriaSelected();
128
+ this.syncAriaDisabled();
129
+ this.updateDisabledOnClick();
130
+ this.parentSelectEl.addEventListener("wmSelectSearchChanged", (ev) => this.handleSearch(ev));
131
+ }
132
+ render() {
133
+ return (h(Host, { role: "option", tabindex: this.focused ? 0 : -1, class: this.hostClasses }, h("div", { class: `option-wrapper ${this.parentSelectEl.multiple ? "checkbox" : ""}` }, h("span", { "aria-hidden": "true", ref: (el) => (this.textEl = el) }, this.el.textContent), h("span", { class: "sr-only" }, this.el.textContent)), h("div", { class: "subinfo" }, this.subinfo)));
134
+ }
135
+ get el() { return getElement(this); }
136
+ static get watchers() { return {
137
+ "selected": ["syncAriaSelected"],
138
+ "disabled": ["syncAriaDisabled", "updateDisabledOnClick"],
139
+ "focused": ["focusHandler"]
140
+ }; }
141
+ };
142
142
  Option.style = wmOptionCss;
143
143
 
144
144
  const wmSelectCss = ":host{position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}.wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}.wrapper .label .required{color:#c0392b}.wrapper.label-left{-ms-flex-direction:row;flex-direction:row}.wrapper.label-left .label-wrapper{line-height:2.5rem}.wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}.wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper.invalid .label{color:#c0392b}.wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f026\";margin-left:0.3125rem}[dir=RTL] .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}.wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}.wrapper .button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:#575195;min-width:8.75rem}.wrapper .button-wrapper .displayedoption{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:nowrap;flex-wrap:nowrap;background:transparent;width:100%;border:solid 1px rgba(35, 35, 35, 0.6);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:#575195;font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .button-wrapper .displayedoption{height:2.75rem}}.wrapper .button-wrapper .displayedoption:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f140\";position:absolute;right:0.5625rem;pointer-events:none}.wrapper .button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:transparent;text-decoration:none}.wrapper .button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .button-wrapper .displayedoption:focus{outline:none}.wrapper .button-wrapper .displayedoption::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}.wrapper .button-wrapper .displayedoption.user-is-tabbing:focus::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.wrapper .button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .button-wrapper>.dropdown{-webkit-overflow-scrolling:touch;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:0;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}.wrapper .button-wrapper>.dropdown.upwards{top:unset;bottom:calc(100% - 2.5rem);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.wrapper .button-wrapper>.dropdown.hidden{visibility:hidden}.wrapper .button-wrapper>.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}.wrapper .error-message{color:#c0392b;font-size:0.875rem;margin-top:0.25rem;margin-bottom:0.25rem;display:block;top:100%;left:0;font-style:italic}.options-wrapper{max-height:12.5rem;overflow:auto}.search{-webkit-box-sizing:border-box;box-sizing:border-box;border-bottom:2px solid rgba(46, 27, 70, 0.05);padding:1.25rem}.search .searchfield-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.75rem;width:100%;padding:0 0.75rem;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:1px solid #4a4a4a}.search .searchfield-wrapper:focus,.search .searchfield-wrapper.focus{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}.search .searchfield{width:100%;border:none;outline:none;font-family:inherit;font-size:0.875rem;margin-left:0.25rem}.search .icon:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f349\";color:#6b6b6b;font-size:0.875rem}.search-results-message{padding:1.25rem;color:#4a4a4a;font-size:0.875rem;font-style:italic}.rtl>.dropdown{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.dropdown .option{padding-left:3rem;padding-right:1.25rem}.rtl>.displayedoption{padding:0 0.9375rem 0 1.875rem;text-align:right}.rtl>.displayedoption:before{right:auto;left:0.5625rem}";
145
145
 
146
- const Select = class {
147
- constructor(hostRef) {
148
- registerInstance(this, hostRef);
149
- this.wmSelectDidLoad = createEvent(this, "wmSelectDidLoad", 7);
150
- this.wmSelectBlurred = createEvent(this, "wmSelectBlurred", 7);
151
- this.wmSelectChanged = createEvent(this, "wmSelectChanged", 7);
152
- this.wmComponentBlurred = createEvent(this, "wmComponentBlurred", 7);
153
- this.wmSelectSearchChanged = createEvent(this, "wmSelectSearchChanged", 7);
154
- this.disabled = false;
155
- this.invalid = false;
156
- this.labelPosition = "top";
157
- this.requiredField = false;
158
- this.errorMessage = "";
159
- this.multiple = false;
160
- this.search = false;
161
- this.placeholder = intl.formatMessage({
162
- id: "select.multiPlaceholder",
163
- defaultMessage: "Make a selection",
164
- description: "Placeholder text. Use imperative",
165
- });
166
- this.searchPlaceholder = intl.formatMessage({
167
- id: "select.searchPlaceholder",
168
- defaultMessage: "Search",
169
- description: "Placeholder text. Use imperative",
170
- });
171
- this.allSelectedMessage = intl.formatMessage({
172
- id: "select.allSelected",
173
- defaultMessage: "All selected",
174
- description: "Text displayed when all options are selected",
175
- });
176
- this.requiredMessage = intl.formatMessage({
177
- id: "global.requiredField",
178
- defaultMessage: "required field",
179
- });
180
- this.isTabbing = false;
181
- this.isExpanded = false;
182
- this.announcement = "";
183
- this.keysSoFar = "";
184
- this.searchIndex = 0;
185
- this.keyClear = null;
186
- this.openUp = false;
187
- //////////////////////////////////////
188
- //////////////////////////////////////
189
- // for multiselect button text
190
- this.overflowCount = 0;
191
- this.displayedOptions = [];
192
- this.debouncedSearch = debounce(() => {
193
- this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
194
- if (this.filteredOptions.length) {
195
- this.announce(this.resultsFoundMessage);
196
- }
197
- else {
198
- this.announce(this.noResultsFoundMessage);
199
- }
200
- }, 150);
201
- }
202
- get childOptions() {
203
- return Array.from(this.el.querySelectorAll("wm-option"));
204
- }
205
- get duplicateOptions() {
206
- return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"));
207
- }
208
- get allOptionEls() {
209
- // this includes both slotted wm-options and internally created wm-options
210
- return this.duplicateOptions.concat(this.childOptions);
211
- }
212
- get visibleOptionEls() {
213
- return this.allOptionEls.filter((option) => !option.classList.contains("hidden") && !option.classList.contains("filtered-out"));
214
- }
215
- //////////////////////////////////////
216
- // for search variants
217
- get searchTerm() {
218
- return this.searchFieldEl ? this.searchFieldEl.value : "";
219
- }
220
- get filteredOptions() {
221
- return this.childOptions.filter((option) => { var _a; return (_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.searchTerm.toLowerCase()); });
222
- }
223
- get selectedOptions() {
224
- return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
225
- }
226
- get allSelected() {
227
- return this.childOptions.filter((option) => option.selected).length === this.childOptions.length;
228
- }
229
- //////////////////////////////////////
230
- get resultsFoundMessage() {
231
- return intl.formatMessage({
232
- id: "select.searchResultsFound",
233
- defaultMessage: "{numResults, plural, one {1 option found} other {# options found}}",
234
- description: "The message read by the screen reader, indicating how many results a search returned",
235
- }, { numResults: this.filteredOptions.length });
236
- }
237
- get noResultsFoundMessage() {
238
- return intl.formatMessage({
239
- id: "select.noSearchResults",
240
- defaultMessage: "No results found. Please try your search again.",
241
- description: "The message displayed when no options pass the search filter",
242
- });
243
- }
244
- toggleTabbingOn() {
245
- this.isTabbing = true;
246
- }
247
- toggleTabbingOff() {
248
- this.isTabbing = false;
249
- }
250
- handleOptionSelection(ev) {
251
- const option = ev.detail;
252
- this.focusOption(option);
253
- if (!this.multiple) {
254
- // if the option was already selected, leave selected states untouched and don't fire the event
255
- if (!option.selected) {
256
- this.selectOption(option);
257
- const detail = { changedOption: option, selectedOptions: [option] };
258
- this.wmSelectChanged.emit(detail);
259
- // change is deprecated in favor of wmSelectChanged
260
- // because of issues with React wrappers when using native events name
261
- const event = new CustomEvent("change", { detail: detail });
262
- // @ts-ignore
263
- this.el.dispatchEvent(event);
264
- }
265
- this.close();
266
- }
267
- else {
268
- this.selectOption(option);
269
- // we pass the original option with the event, as it's the only one the devs know or care about
270
- // devs will typically set a `value` on the option, which is not copied over
271
- // we could have taken the value and put it on the duplicate option,
272
- // but this approach is more flexible (what if they want to have a data attribute?)
273
- const isDuplicate = option.classList.contains("duplicate");
274
- const originalOption = isDuplicate ? this.findCorrespondingOption(option) : option;
275
- const selectedOptions = this.childOptions.filter((o) => o.selected);
276
- const detail = { changedOption: originalOption, selectedOptions: selectedOptions };
277
- this.wmSelectChanged.emit(detail);
278
- // change is deprecated in favor of wmSelectChanged
279
- // because of issues with React wrappers when using native events name
280
- const event = new CustomEvent("change", { detail: detail });
281
- // @ts-ignore
282
- this.el.dispatchEvent(event);
283
- }
284
- }
285
- handleChildEnter() {
286
- // only occurs for multiselects. handle the click, then close
287
- this.close();
288
- }
289
- handleChildUp(ev) {
290
- this.moveUp(ev.detail);
291
- }
292
- handleChildDown(ev) {
293
- this.moveDown(ev.detail);
294
- }
295
- moveToFirstOption() {
296
- this.focusOption(this.visibleOptionEls[0]);
297
- }
298
- moveToLastOption() {
299
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
300
- }
301
- closePopupOnEscape() {
302
- this.close();
303
- }
304
- handleOptionBlur(ev) {
305
- // if the Option is blurred to something other than the component emit a blur event with the appropriate relatedTarget
306
- // keeps our component's blur events accurate, and closes when focusing browser address bar
307
- if (!this.isElOrChild(ev.detail.relatedTarget)) {
308
- const event = new CustomEvent("blur");
309
- // @ts-ignore
310
- event.relatedTarget = ev.detail.relatedTarget;
311
- this.el.dispatchEvent(event);
312
- }
313
- }
314
- handleClick(ev) {
315
- if (!this.isElOrChild(ev.target)) {
316
- this.close();
317
- }
318
- }
319
- handleButtonBlur(ev) {
320
- if (this.isElOrChild(ev.relatedTarget)) {
321
- // do not emit a blur event when opening the dropdown and focusing the Options
322
- ev.stopPropagation();
323
- }
324
- }
325
- handleSearchFieldBlur(ev) {
326
- this.searchFieldWrapperEl.classList.remove("focus");
327
- if (this.isElOrChild(ev.relatedTarget)) {
328
- // do not emit a blur event when moving from searchfield to options
329
- ev.stopPropagation();
330
- }
331
- }
332
- handleKey(ev) {
333
- switch (ev.key) {
334
- case "ArrowDown":
335
- if (this.isExpanded === false) {
336
- ev.preventDefault();
337
- this.open("next");
338
- }
339
- break;
340
- case "ArrowUp":
341
- if (this.isExpanded === false) {
342
- ev.preventDefault();
343
- this.open("previous");
344
- }
345
- break;
346
- }
347
- }
348
- componentWillLoad() {
349
- if (!this.label) {
350
- console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
351
- }
352
- this.el.focus = function () {
353
- if (!this.disabled) {
354
- this.shadowRoot.querySelector("button").focus();
355
- }
356
- };
357
- this.uid = this.el.id ? this.el.id : generateId();
358
- if (document.body.classList.contains("wmcl-user-is-tabbing")) {
359
- this.toggleTabbingOn();
360
- }
361
- // set initial selections
362
- if (this.selectedOptions.length > 0) {
363
- this.selectedOptions.forEach((x) => {
364
- this.displayedOptions.push(x);
365
- });
366
- // single Select only, pre-select if no default option from dev
367
- }
368
- else if (!this.multiple) {
369
- this.selectOption(this.allOptionEls[0]);
370
- }
371
- }
372
- componentDidLoad() {
373
- this.wmSelectDidLoad.emit();
374
- this.dropdownEl.classList.add("hidden");
375
- forceUpdate(this.el);
376
- // Dev can overwrite the max-height rule set in the Sass file
377
- if (this.maxHeight) {
378
- this.listboxEl.style.maxHeight = this.maxHeight;
379
- }
380
- if (this.multiple) {
381
- this.updateOptionVisibility();
382
- }
383
- this.setButtonText();
384
- }
385
- componentWillUpdate() {
386
- if (this.multiple) {
387
- // find last visible duplicate option and apply .last class
388
- const visibleDuplicateOptions = this.visibleOptionEls.filter((option) => option.classList.contains("duplicate"));
389
- visibleDuplicateOptions.forEach((option, idx) => {
390
- if (idx === visibleDuplicateOptions.length - 1) {
391
- option.classList.add("last");
392
- }
393
- else {
394
- option.classList.remove("last");
395
- }
396
- });
397
- }
398
- }
399
- moveUp(el) {
400
- const prevEl = this.visibleOptionEls[this.visibleOptionEls.indexOf(el) - 1];
401
- if (prevEl) {
402
- // scroll option to top of dropdown if partially obscured / out of view
403
- if (prevEl.getBoundingClientRect().top < this.listboxEl.getBoundingClientRect().top) {
404
- this.scrollOptionToTop(prevEl);
405
- }
406
- this.focusOption(prevEl);
407
- }
408
- else if (this.search) {
409
- // if top of list and search variant, focus search field
410
- this.searchFieldEl.focus();
411
- }
412
- else {
413
- // if top of list, focus last element
414
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
415
- }
416
- }
417
- moveDown(el) {
418
- const nextEl = this.visibleOptionEls[this.visibleOptionEls.indexOf(el) + 1];
419
- if (nextEl) {
420
- // scroll option to bottom of dropdown if partially obscured / out of view
421
- if (nextEl.getBoundingClientRect().bottom > this.listboxEl.getBoundingClientRect().bottom) {
422
- this.scrollOptionToBottom(nextEl);
423
- }
424
- this.focusOption(nextEl);
425
- }
426
- else {
427
- // if end of list, focus first option in all variants
428
- this.focusOption(this.visibleOptionEls[0]);
429
- }
430
- }
431
- scrollOptionToTop(option) {
432
- this.listboxEl.scrollTop =
433
- option.getBoundingClientRect().top - this.listboxEl.getBoundingClientRect().top + this.listboxEl.scrollTop;
434
- }
435
- scrollOptionToBottom(option) {
436
- this.listboxEl.scrollTop =
437
- option.getBoundingClientRect().bottom -
438
- this.listboxEl.getBoundingClientRect().top +
439
- this.listboxEl.scrollTop -
440
- this.listboxEl.offsetHeight;
441
- }
442
- open(optionToSelect) {
443
- if (!this.disabled) {
444
- const elHeight = this.el.clientHeight;
445
- const buttonHeight = this.buttonEl.clientHeight;
446
- this.openUp = shouldOpenUp(this.el, this.dropdownEl,
447
- // when opening up, dropdown covers both label and button
448
- elHeight,
449
- // when opening down, dropdown covers only the button
450
- buttonHeight);
451
- this.isExpanded = true;
452
- this.dropdownEl.classList.remove("hidden");
453
- window.requestAnimationFrame(() => {
454
- switch (optionToSelect) {
455
- case "next":
456
- // search variant focuses search field
457
- // all others focus option "after" last selected option (this can be the first option)
458
- if (this.search) {
459
- this.searchFieldEl.focus();
460
- this.listboxEl.scrollTop = 0;
461
- }
462
- else {
463
- this.moveDown(this.visibleOptionEls.filter((x) => x.selected).slice(-1)[0]);
464
- }
465
- break;
466
- case "previous":
467
- // search variant focuses last option
468
- // all others focus option "above" first selected option (this can be the last option)
469
- if (this.search) {
470
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
471
- }
472
- else {
473
- this.moveUp(this.visibleOptionEls.filter((x) => x.selected)[0]);
474
- }
475
- break;
476
- default:
477
- // search variant focuses search field
478
- // all others focus the selected option
479
- // if no option is selected (empty multiselect), focuses first option
480
- if (this.search) {
481
- this.searchFieldEl.focus();
482
- this.listboxEl.scrollTop = 0;
483
- }
484
- else if (this.selectedOptions.length > 0) {
485
- this.focusOption(this.visibleOptionEls.filter((x) => x.selected)[0]);
486
- }
487
- else {
488
- this.focusOption(this.visibleOptionEls[0]);
489
- }
490
- break;
491
- }
492
- });
493
- }
494
- }
495
- close(returnFocus = true) {
496
- if (this.isExpanded) {
497
- this.isExpanded = false;
498
- this.allOptionEls.map((i) => (i.focused = false));
499
- window.setTimeout(() => {
500
- this.dropdownEl.classList.add("hidden");
501
- if (this.multiple) {
502
- this.updateOptionVisibility();
503
- }
504
- // clear search field, reset filtered / bolded state of wm-options
505
- if (this.search) {
506
- this.searchFieldEl.value = "";
507
- this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
508
- }
509
- // Returns focus to button after popup closes (no need if user is tabbing)
510
- // Delay is necessary for screenreader to get new expanded state before focus
511
- // window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
512
- // also UX wise, it makes sense for the button to only be focused after the animation is complete
513
- if (returnFocus) {
514
- this.el.focus();
515
- }
516
- }, 150);
517
- }
518
- }
519
- updateOptionVisibility() {
520
- // this runs for search multiselects, where selected options are rendered at the top of the dropdown list
521
- // slotted wm-options are hidden if selected, and duplicate wm-options are made visible if selected
522
- this.childOptions.forEach((option, idx) => {
523
- const duplicateOption = this.duplicateOptions[idx];
524
- if (option.selected) {
525
- option.classList.add("hidden");
526
- duplicateOption.classList.remove("hidden");
527
- }
528
- else {
529
- option.classList.remove("hidden");
530
- duplicateOption.classList.add("hidden");
531
- }
532
- });
533
- }
534
- focusOption(option) {
535
- this.allOptionEls.forEach((i) => (i.focused = i === option));
536
- option.focus();
537
- }
538
- selectOption(option) {
539
- // beware of this function's name. For multiselect it actually toggles the selected state, so it can also deselect the option
540
- if (option.classList.contains("duplicate")) {
541
- // if clicking on a duplicate option, toggle selected property of real one, then rerender
542
- const correspondingOption = this.findCorrespondingOption(option);
543
- correspondingOption.selected = !correspondingOption.selected;
544
- forceUpdate(this.el);
545
- }
546
- else if (this.multiple) {
547
- option.selected = !option.selected;
548
- }
549
- else {
550
- this.childOptions.forEach((x) => (x.selected = x === option));
551
- }
552
- this.setButtonText();
553
- }
554
- findAndFocusOption(ev) {
555
- const character = ev.detail.toUpperCase();
556
- if (!this.keysSoFar) {
557
- for (var i = 0; i < this.allOptionEls.length; i++) {
558
- if (this.allOptionEls[i].focused) {
559
- this.searchIndex = i;
560
- }
561
- }
562
- }
563
- this.keysSoFar += character;
564
- this.clearKeysSoFarAfterDelay();
565
- var nextMatch = this.findMatchInRange(this.allOptionEls, this.searchIndex + 1, this.allOptionEls.length);
566
- if (!nextMatch) {
567
- nextMatch = this.findMatchInRange(this.allOptionEls, 0, this.searchIndex);
568
- }
569
- if (nextMatch) {
570
- this.focusOption(nextMatch);
571
- }
572
- }
573
- clearKeysSoFarAfterDelay() {
574
- if (this.keyClear) {
575
- window.clearTimeout(this.keyClear);
576
- this.keyClear = null;
577
- }
578
- this.keyClear = window.setTimeout(function () {
579
- this.keysSoFar = "";
580
- this.keyClear = null;
581
- }.bind(this), 500);
582
- }
583
- findMatchInRange(list, startIndex, endIndex) {
584
- // Find the first option starting with the keysSoFar substring, searching in
585
- // the specified range of options
586
- for (var n = startIndex; n < endIndex; n++) {
587
- var label = list[n].textContent;
588
- if (label && label.toUpperCase().indexOf(this.keysSoFar) === 0) {
589
- return list[n];
590
- }
591
- }
592
- return null;
593
- }
594
- findCorrespondingOption(el) {
595
- // if duplicate, returns the child wm-option
596
- // if child wm-option, returns duplicate
597
- const isDuplicate = el.classList.contains("duplicate");
598
- return isDuplicate
599
- ? this.childOptions[this.duplicateOptions.indexOf(el)]
600
- : this.duplicateOptions[this.childOptions.indexOf(el)];
601
- }
602
- isElOrChild(el) {
603
- var _a;
604
- // determines whether or not the element is the component, a child of the component, or exists within the component's shadowroot
605
- return el === this.el || this.el.contains(el) || ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(el));
606
- }
607
- exposeErrors() {
608
- // 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
609
- const newId = generateId();
610
- this.errorContainer.id = `wm-errors-${newId}`;
611
- this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
612
- }
613
- renderErrorContainer() {
614
- return (h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
615
- }
616
- handleComponentBlur(ev) {
617
- // Do not close or emit custom blur event when blurring to an element inside (wm-option)
618
- if (!this.el.contains(ev.relatedTarget)) {
619
- this.close(false);
620
- this.wmSelectBlurred.emit();
621
- this.wmComponentBlurred.emit(); // deprecated
622
- }
623
- }
624
- handleSearchFieldKeyDown(ev) {
625
- switch (ev.key) {
626
- case "ArrowDown":
627
- ev.preventDefault();
628
- if (this.visibleOptionEls.length) {
629
- this.focusOption(this.visibleOptionEls[0]);
630
- }
631
- break;
632
- case "ArrowUp":
633
- ev.preventDefault();
634
- if (this.visibleOptionEls.length) {
635
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
636
- }
637
- break;
638
- case "Escape":
639
- ev.preventDefault();
640
- this.close();
641
- break;
642
- }
643
- }
644
- setButtonText() {
645
- this.displayedOptions = this.childOptions
646
- .filter((x) => x.selected)
647
- .map((y) => (!y.classList.contains("hidden") ? y : this.findCorrespondingOption(y)));
648
- // handle overflow + counter for multiselect
649
- if (this.multiple) {
650
- // this is a fixed measurement accounting for the max width of a 3 character overflow counter
651
- const overflowCounterWidth = 38;
652
- const computedStyle = window.getComputedStyle(this.buttonEl);
653
- // there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
654
- const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
655
- const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
656
- const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
657
- let optionsWidths = this.displayedOptions.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
658
- let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
659
- this.overflowCount = 0;
660
- while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
661
- this.overflowCount++;
662
- optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
663
- optionsWidths.pop();
664
- this.displayedOptions.pop();
665
- }
666
- }
667
- }
668
- announce(message) {
669
- // \u00A0 is a non-breaking space character, which causes the message to be read as a new one
670
- if (this.liveRegionEl.textContent === message) {
671
- message += "\u00A0";
672
- }
673
- this.announcement = message;
674
- }
675
- renderButtonText() {
676
- if (this.multiple && this.displayedOptions.length < 1) {
677
- return h("span", null, this.placeholder);
678
- }
679
- else if (this.multiple && this.allSelected && this.overflowCount > 0) {
680
- return this.allSelectedMessage;
681
- }
682
- else {
683
- return this.displayedOptions.map((x, idx) => (h("span", null, idx > 0 ? ", " : "", x.textContent)));
684
- }
685
- }
686
- renderSubinfo() {
687
- // multiselects cannot have subinfo for options
688
- if (!this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo) {
689
- return h("span", { class: "subinfo" }, this.selectedOptions[0].subinfo);
690
- }
691
- }
692
- renderOverflowCount() {
693
- if (this.overflowCount > 0 && !this.allSelected) {
694
- return (h("span", null, h("span", { class: "overflow-counter" }, "+", this.overflowCount)));
695
- }
696
- }
697
- renderSearchField() {
698
- 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.handleSearchFieldKeyDown(ev), onFocus: () => this.searchFieldWrapperEl.classList.add("focus"), onBlur: (ev) => this.handleSearchFieldBlur(ev), onInput: () => this.debouncedSearch(), placeholder: this.searchPlaceholder }))));
699
- }
700
- renderSearchFailedMessage() {
701
- return h("div", { class: "search-results-message" }, this.noResultsFoundMessage);
702
- }
703
- renderDuplicateOptions() {
704
- return Array.from(this.el.children).map((option) => {
705
- return (h("wm-option", { class: "duplicate", selected: option.selected }, option.textContent));
706
- });
707
- }
708
- render() {
709
- const buttonProps = {
710
- id: `selectbtn-${this.uid}`,
711
- ["disabled"]: this.disabled,
712
- ["aria-controls"]: `list-${this.uid}`,
713
- ["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
714
- ["aria-describedby"]: "wm-errors",
715
- ["aria-expanded"]: this.isExpanded ? "true" : "false",
716
- onClick: () => (this.isExpanded ? this.close() : this.open()),
717
- };
718
- 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,
719
- // we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
720
- this.requiredField ? (h("span", { class: "required" }, h("span", { class: "sr-only" }, this.requiredMessage), 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
721
- ? "overflowcontrol hassubinfo"
722
- : "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.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)))));
723
- }
724
- get el() { return getElement(this); }
725
- static get watchers() { return {
726
- "errorMessage": ["exposeErrors"]
727
- }; }
728
- };
146
+ const Select = class {
147
+ constructor(hostRef) {
148
+ registerInstance(this, hostRef);
149
+ this.wmSelectDidLoad = createEvent(this, "wmSelectDidLoad", 7);
150
+ this.wmSelectBlurred = createEvent(this, "wmSelectBlurred", 7);
151
+ this.wmSelectChanged = createEvent(this, "wmSelectChanged", 7);
152
+ this.wmComponentBlurred = createEvent(this, "wmComponentBlurred", 7);
153
+ this.wmSelectSearchChanged = createEvent(this, "wmSelectSearchChanged", 7);
154
+ this.disabled = false;
155
+ this.invalid = false;
156
+ this.labelPosition = "top";
157
+ this.requiredField = false;
158
+ this.errorMessage = "";
159
+ this.multiple = false;
160
+ this.search = false;
161
+ this.placeholder = intl.formatMessage({
162
+ id: "select.multiPlaceholder",
163
+ defaultMessage: "Make a selection",
164
+ description: "Placeholder text. Use imperative",
165
+ });
166
+ this.searchPlaceholder = intl.formatMessage({
167
+ id: "select.searchPlaceholder",
168
+ defaultMessage: "Search",
169
+ description: "Placeholder text. Use imperative",
170
+ });
171
+ this.allSelectedMessage = intl.formatMessage({
172
+ id: "select.allSelected",
173
+ defaultMessage: "All selected",
174
+ description: "Text displayed when all options are selected",
175
+ });
176
+ this.requiredMessage = intl.formatMessage({
177
+ id: "global.requiredField",
178
+ defaultMessage: "required field",
179
+ });
180
+ this.isTabbing = false;
181
+ this.isExpanded = false;
182
+ this.announcement = "";
183
+ this.keysSoFar = "";
184
+ this.searchIndex = 0;
185
+ this.keyClear = null;
186
+ this.openUp = false;
187
+ //////////////////////////////////////
188
+ //////////////////////////////////////
189
+ // for multiselect button text
190
+ this.overflowCount = 0;
191
+ this.displayedOptions = [];
192
+ this.debouncedSearch = debounce(() => {
193
+ this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
194
+ if (this.filteredOptions.length) {
195
+ this.announce(this.resultsFoundMessage);
196
+ }
197
+ else {
198
+ this.announce(this.noResultsFoundMessage);
199
+ }
200
+ }, 150);
201
+ }
202
+ get childOptions() {
203
+ return Array.from(this.el.querySelectorAll("wm-option"));
204
+ }
205
+ get duplicateOptions() {
206
+ return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"));
207
+ }
208
+ get allOptionEls() {
209
+ // this includes both slotted wm-options and internally created wm-options
210
+ return this.duplicateOptions.concat(this.childOptions);
211
+ }
212
+ get visibleOptionEls() {
213
+ return this.allOptionEls.filter((option) => !option.classList.contains("hidden") && !option.classList.contains("filtered-out"));
214
+ }
215
+ //////////////////////////////////////
216
+ // for search variants
217
+ get searchTerm() {
218
+ return this.searchFieldEl ? this.searchFieldEl.value : "";
219
+ }
220
+ get filteredOptions() {
221
+ return this.childOptions.filter((option) => { var _a; return (_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.searchTerm.toLowerCase()); });
222
+ }
223
+ get selectedOptions() {
224
+ return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
225
+ }
226
+ get allSelected() {
227
+ return this.childOptions.filter((option) => option.selected).length === this.childOptions.length;
228
+ }
229
+ //////////////////////////////////////
230
+ get resultsFoundMessage() {
231
+ return intl.formatMessage({
232
+ id: "select.searchResultsFound",
233
+ defaultMessage: "{numResults, plural, one {1 option found} other {# options found}}",
234
+ description: "The message read by the screen reader, indicating how many results a search returned",
235
+ }, { numResults: this.filteredOptions.length });
236
+ }
237
+ get noResultsFoundMessage() {
238
+ return intl.formatMessage({
239
+ id: "select.noSearchResults",
240
+ defaultMessage: "No results found. Please try your search again.",
241
+ description: "The message displayed when no options pass the search filter",
242
+ });
243
+ }
244
+ toggleTabbingOn() {
245
+ this.isTabbing = true;
246
+ }
247
+ toggleTabbingOff() {
248
+ this.isTabbing = false;
249
+ }
250
+ handleOptionSelection(ev) {
251
+ const option = ev.detail;
252
+ this.focusOption(option);
253
+ if (!this.multiple) {
254
+ // if the option was already selected, leave selected states untouched and don't fire the event
255
+ if (!option.selected) {
256
+ this.selectOption(option);
257
+ const detail = { changedOption: option, selectedOptions: [option] };
258
+ this.wmSelectChanged.emit(detail);
259
+ // change is deprecated in favor of wmSelectChanged
260
+ // because of issues with React wrappers when using native events name
261
+ const event = new CustomEvent("change", { detail: detail });
262
+ // @ts-ignore
263
+ this.el.dispatchEvent(event);
264
+ }
265
+ this.close();
266
+ }
267
+ else {
268
+ this.selectOption(option);
269
+ // we pass the original option with the event, as it's the only one the devs know or care about
270
+ // devs will typically set a `value` on the option, which is not copied over
271
+ // we could have taken the value and put it on the duplicate option,
272
+ // but this approach is more flexible (what if they want to have a data attribute?)
273
+ const isDuplicate = option.classList.contains("duplicate");
274
+ const originalOption = isDuplicate ? this.findCorrespondingOption(option) : option;
275
+ const selectedOptions = this.childOptions.filter((o) => o.selected);
276
+ const detail = { changedOption: originalOption, selectedOptions: selectedOptions };
277
+ this.wmSelectChanged.emit(detail);
278
+ // change is deprecated in favor of wmSelectChanged
279
+ // because of issues with React wrappers when using native events name
280
+ const event = new CustomEvent("change", { detail: detail });
281
+ // @ts-ignore
282
+ this.el.dispatchEvent(event);
283
+ }
284
+ }
285
+ handleChildEnter() {
286
+ // only occurs for multiselects. handle the click, then close
287
+ this.close();
288
+ }
289
+ handleChildUp(ev) {
290
+ this.moveUp(ev.detail);
291
+ }
292
+ handleChildDown(ev) {
293
+ this.moveDown(ev.detail);
294
+ }
295
+ moveToFirstOption() {
296
+ this.focusOption(this.visibleOptionEls[0]);
297
+ }
298
+ moveToLastOption() {
299
+ this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
300
+ }
301
+ closePopupOnEscape() {
302
+ this.close();
303
+ }
304
+ handleOptionBlur(ev) {
305
+ // if the Option is blurred to something other than the component emit a blur event with the appropriate relatedTarget
306
+ // keeps our component's blur events accurate, and closes when focusing browser address bar
307
+ if (!this.isElOrChild(ev.detail.relatedTarget)) {
308
+ const event = new CustomEvent("blur");
309
+ // @ts-ignore
310
+ event.relatedTarget = ev.detail.relatedTarget;
311
+ this.el.dispatchEvent(event);
312
+ }
313
+ }
314
+ handleClick(ev) {
315
+ if (!this.isElOrChild(ev.target)) {
316
+ this.close();
317
+ }
318
+ }
319
+ handleButtonBlur(ev) {
320
+ if (this.isElOrChild(ev.relatedTarget)) {
321
+ // do not emit a blur event when opening the dropdown and focusing the Options
322
+ ev.stopPropagation();
323
+ }
324
+ }
325
+ handleSearchFieldBlur(ev) {
326
+ this.searchFieldWrapperEl.classList.remove("focus");
327
+ if (this.isElOrChild(ev.relatedTarget)) {
328
+ // do not emit a blur event when moving from searchfield to options
329
+ ev.stopPropagation();
330
+ }
331
+ }
332
+ handleKey(ev) {
333
+ switch (ev.key) {
334
+ case "ArrowDown":
335
+ if (this.isExpanded === false) {
336
+ ev.preventDefault();
337
+ this.open("next");
338
+ }
339
+ break;
340
+ case "ArrowUp":
341
+ if (this.isExpanded === false) {
342
+ ev.preventDefault();
343
+ this.open("previous");
344
+ }
345
+ break;
346
+ }
347
+ }
348
+ componentWillLoad() {
349
+ if (!this.label) {
350
+ console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
351
+ }
352
+ this.el.focus = function () {
353
+ if (!this.disabled) {
354
+ this.shadowRoot.querySelector("button").focus();
355
+ }
356
+ };
357
+ this.uid = this.el.id ? this.el.id : generateId();
358
+ if (document.body.classList.contains("wmcl-user-is-tabbing")) {
359
+ this.toggleTabbingOn();
360
+ }
361
+ // set initial selections
362
+ if (this.selectedOptions.length > 0) {
363
+ this.selectedOptions.forEach((x) => {
364
+ this.displayedOptions.push(x);
365
+ });
366
+ // single Select only, pre-select if no default option from dev
367
+ }
368
+ else if (!this.multiple) {
369
+ this.selectOption(this.allOptionEls[0]);
370
+ }
371
+ }
372
+ componentDidLoad() {
373
+ this.wmSelectDidLoad.emit();
374
+ this.dropdownEl.classList.add("hidden");
375
+ forceUpdate(this.el);
376
+ // Dev can overwrite the max-height rule set in the Sass file
377
+ if (this.maxHeight) {
378
+ this.listboxEl.style.maxHeight = this.maxHeight;
379
+ }
380
+ if (this.multiple) {
381
+ this.updateOptionVisibility();
382
+ }
383
+ this.setButtonText();
384
+ }
385
+ componentWillUpdate() {
386
+ if (this.multiple) {
387
+ // find last visible duplicate option and apply .last class
388
+ const visibleDuplicateOptions = this.visibleOptionEls.filter((option) => option.classList.contains("duplicate"));
389
+ visibleDuplicateOptions.forEach((option, idx) => {
390
+ if (idx === visibleDuplicateOptions.length - 1) {
391
+ option.classList.add("last");
392
+ }
393
+ else {
394
+ option.classList.remove("last");
395
+ }
396
+ });
397
+ }
398
+ }
399
+ moveUp(el) {
400
+ const prevEl = this.visibleOptionEls[this.visibleOptionEls.indexOf(el) - 1];
401
+ if (prevEl) {
402
+ // scroll option to top of dropdown if partially obscured / out of view
403
+ if (prevEl.getBoundingClientRect().top < this.listboxEl.getBoundingClientRect().top) {
404
+ this.scrollOptionToTop(prevEl);
405
+ }
406
+ this.focusOption(prevEl);
407
+ }
408
+ else if (this.search) {
409
+ // if top of list and search variant, focus search field
410
+ this.searchFieldEl.focus();
411
+ }
412
+ else {
413
+ // if top of list, focus last element
414
+ this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
415
+ }
416
+ }
417
+ moveDown(el) {
418
+ const nextEl = this.visibleOptionEls[this.visibleOptionEls.indexOf(el) + 1];
419
+ if (nextEl) {
420
+ // scroll option to bottom of dropdown if partially obscured / out of view
421
+ if (nextEl.getBoundingClientRect().bottom > this.listboxEl.getBoundingClientRect().bottom) {
422
+ this.scrollOptionToBottom(nextEl);
423
+ }
424
+ this.focusOption(nextEl);
425
+ }
426
+ else {
427
+ // if end of list, focus first option in all variants
428
+ this.focusOption(this.visibleOptionEls[0]);
429
+ }
430
+ }
431
+ scrollOptionToTop(option) {
432
+ this.listboxEl.scrollTop =
433
+ option.getBoundingClientRect().top - this.listboxEl.getBoundingClientRect().top + this.listboxEl.scrollTop;
434
+ }
435
+ scrollOptionToBottom(option) {
436
+ this.listboxEl.scrollTop =
437
+ option.getBoundingClientRect().bottom -
438
+ this.listboxEl.getBoundingClientRect().top +
439
+ this.listboxEl.scrollTop -
440
+ this.listboxEl.offsetHeight;
441
+ }
442
+ open(optionToSelect) {
443
+ if (!this.disabled) {
444
+ const elHeight = this.el.clientHeight;
445
+ const buttonHeight = this.buttonEl.clientHeight;
446
+ this.openUp = shouldOpenUp(this.el, this.dropdownEl,
447
+ // when opening up, dropdown covers both label and button
448
+ elHeight,
449
+ // when opening down, dropdown covers only the button
450
+ buttonHeight);
451
+ this.isExpanded = true;
452
+ this.dropdownEl.classList.remove("hidden");
453
+ window.requestAnimationFrame(() => {
454
+ switch (optionToSelect) {
455
+ case "next":
456
+ // search variant focuses search field
457
+ // all others focus option "after" last selected option (this can be the first option)
458
+ if (this.search) {
459
+ this.searchFieldEl.focus();
460
+ this.listboxEl.scrollTop = 0;
461
+ }
462
+ else {
463
+ this.moveDown(this.visibleOptionEls.filter((x) => x.selected).slice(-1)[0]);
464
+ }
465
+ break;
466
+ case "previous":
467
+ // search variant focuses last option
468
+ // all others focus option "above" first selected option (this can be the last option)
469
+ if (this.search) {
470
+ this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
471
+ }
472
+ else {
473
+ this.moveUp(this.visibleOptionEls.filter((x) => x.selected)[0]);
474
+ }
475
+ break;
476
+ default:
477
+ // search variant focuses search field
478
+ // all others focus the selected option
479
+ // if no option is selected (empty multiselect), focuses first option
480
+ if (this.search) {
481
+ this.searchFieldEl.focus();
482
+ this.listboxEl.scrollTop = 0;
483
+ }
484
+ else if (this.selectedOptions.length > 0) {
485
+ this.focusOption(this.visibleOptionEls.filter((x) => x.selected)[0]);
486
+ }
487
+ else {
488
+ this.focusOption(this.visibleOptionEls[0]);
489
+ }
490
+ break;
491
+ }
492
+ });
493
+ }
494
+ }
495
+ close(returnFocus = true) {
496
+ if (this.isExpanded) {
497
+ this.isExpanded = false;
498
+ this.allOptionEls.map((i) => (i.focused = false));
499
+ window.setTimeout(() => {
500
+ this.dropdownEl.classList.add("hidden");
501
+ if (this.multiple) {
502
+ this.updateOptionVisibility();
503
+ }
504
+ // clear search field, reset filtered / bolded state of wm-options
505
+ if (this.search) {
506
+ this.searchFieldEl.value = "";
507
+ this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
508
+ }
509
+ // Returns focus to button after popup closes (no need if user is tabbing)
510
+ // Delay is necessary for screenreader to get new expanded state before focus
511
+ // window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
512
+ // also UX wise, it makes sense for the button to only be focused after the animation is complete
513
+ if (returnFocus) {
514
+ this.el.focus();
515
+ }
516
+ }, 150);
517
+ }
518
+ }
519
+ updateOptionVisibility() {
520
+ // this runs for search multiselects, where selected options are rendered at the top of the dropdown list
521
+ // slotted wm-options are hidden if selected, and duplicate wm-options are made visible if selected
522
+ this.childOptions.forEach((option, idx) => {
523
+ const duplicateOption = this.duplicateOptions[idx];
524
+ if (option.selected) {
525
+ option.classList.add("hidden");
526
+ duplicateOption.classList.remove("hidden");
527
+ }
528
+ else {
529
+ option.classList.remove("hidden");
530
+ duplicateOption.classList.add("hidden");
531
+ }
532
+ });
533
+ }
534
+ focusOption(option) {
535
+ this.allOptionEls.forEach((i) => (i.focused = i === option));
536
+ option.focus();
537
+ }
538
+ selectOption(option) {
539
+ // beware of this function's name. For multiselect it actually toggles the selected state, so it can also deselect the option
540
+ if (option.classList.contains("duplicate")) {
541
+ // if clicking on a duplicate option, toggle selected property of real one, then rerender
542
+ const correspondingOption = this.findCorrespondingOption(option);
543
+ correspondingOption.selected = !correspondingOption.selected;
544
+ forceUpdate(this.el);
545
+ }
546
+ else if (this.multiple) {
547
+ option.selected = !option.selected;
548
+ }
549
+ else {
550
+ this.childOptions.forEach((x) => (x.selected = x === option));
551
+ }
552
+ this.setButtonText();
553
+ }
554
+ findAndFocusOption(ev) {
555
+ const character = ev.detail.toUpperCase();
556
+ if (!this.keysSoFar) {
557
+ for (var i = 0; i < this.allOptionEls.length; i++) {
558
+ if (this.allOptionEls[i].focused) {
559
+ this.searchIndex = i;
560
+ }
561
+ }
562
+ }
563
+ this.keysSoFar += character;
564
+ this.clearKeysSoFarAfterDelay();
565
+ var nextMatch = this.findMatchInRange(this.allOptionEls, this.searchIndex + 1, this.allOptionEls.length);
566
+ if (!nextMatch) {
567
+ nextMatch = this.findMatchInRange(this.allOptionEls, 0, this.searchIndex);
568
+ }
569
+ if (nextMatch) {
570
+ this.focusOption(nextMatch);
571
+ }
572
+ }
573
+ clearKeysSoFarAfterDelay() {
574
+ if (this.keyClear) {
575
+ window.clearTimeout(this.keyClear);
576
+ this.keyClear = null;
577
+ }
578
+ this.keyClear = window.setTimeout(function () {
579
+ this.keysSoFar = "";
580
+ this.keyClear = null;
581
+ }.bind(this), 500);
582
+ }
583
+ findMatchInRange(list, startIndex, endIndex) {
584
+ // Find the first option starting with the keysSoFar substring, searching in
585
+ // the specified range of options
586
+ for (var n = startIndex; n < endIndex; n++) {
587
+ var label = list[n].textContent;
588
+ if (label && label.toUpperCase().indexOf(this.keysSoFar) === 0) {
589
+ return list[n];
590
+ }
591
+ }
592
+ return null;
593
+ }
594
+ findCorrespondingOption(el) {
595
+ // if duplicate, returns the child wm-option
596
+ // if child wm-option, returns duplicate
597
+ const isDuplicate = el.classList.contains("duplicate");
598
+ return isDuplicate
599
+ ? this.childOptions[this.duplicateOptions.indexOf(el)]
600
+ : this.duplicateOptions[this.childOptions.indexOf(el)];
601
+ }
602
+ isElOrChild(el) {
603
+ var _a;
604
+ // determines whether or not the element is the component, a child of the component, or exists within the component's shadowroot
605
+ return el === this.el || this.el.contains(el) || ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(el));
606
+ }
607
+ exposeErrors() {
608
+ // 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
609
+ const newId = generateId();
610
+ this.errorContainer.id = `wm-errors-${newId}`;
611
+ this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
612
+ }
613
+ renderErrorContainer() {
614
+ return (h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
615
+ }
616
+ handleComponentBlur(ev) {
617
+ // Do not close or emit custom blur event when blurring to an element inside (wm-option)
618
+ if (!this.el.contains(ev.relatedTarget)) {
619
+ this.close(false);
620
+ this.wmSelectBlurred.emit();
621
+ this.wmComponentBlurred.emit(); // deprecated
622
+ }
623
+ }
624
+ handleSearchFieldKeyDown(ev) {
625
+ switch (ev.key) {
626
+ case "ArrowDown":
627
+ ev.preventDefault();
628
+ if (this.visibleOptionEls.length) {
629
+ this.focusOption(this.visibleOptionEls[0]);
630
+ }
631
+ break;
632
+ case "ArrowUp":
633
+ ev.preventDefault();
634
+ if (this.visibleOptionEls.length) {
635
+ this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
636
+ }
637
+ break;
638
+ case "Escape":
639
+ ev.preventDefault();
640
+ this.close();
641
+ break;
642
+ }
643
+ }
644
+ setButtonText() {
645
+ this.displayedOptions = this.childOptions
646
+ .filter((x) => x.selected)
647
+ .map((y) => (!y.classList.contains("hidden") ? y : this.findCorrespondingOption(y)));
648
+ // handle overflow + counter for multiselect
649
+ if (this.multiple) {
650
+ // this is a fixed measurement accounting for the max width of a 3 character overflow counter
651
+ const overflowCounterWidth = 38;
652
+ const computedStyle = window.getComputedStyle(this.buttonEl);
653
+ // there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
654
+ const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
655
+ const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
656
+ const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
657
+ let optionsWidths = this.displayedOptions.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
658
+ let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
659
+ this.overflowCount = 0;
660
+ while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
661
+ this.overflowCount++;
662
+ optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
663
+ optionsWidths.pop();
664
+ this.displayedOptions.pop();
665
+ }
666
+ }
667
+ }
668
+ announce(message) {
669
+ // \u00A0 is a non-breaking space character, which causes the message to be read as a new one
670
+ if (this.liveRegionEl.textContent === message) {
671
+ message += "\u00A0";
672
+ }
673
+ this.announcement = message;
674
+ }
675
+ renderButtonText() {
676
+ if (this.multiple && this.displayedOptions.length < 1) {
677
+ return h("span", null, this.placeholder);
678
+ }
679
+ else if (this.multiple && this.allSelected && this.overflowCount > 0) {
680
+ return this.allSelectedMessage;
681
+ }
682
+ else {
683
+ return this.displayedOptions.map((x, idx) => (h("span", null, idx > 0 ? ", " : "", x.textContent)));
684
+ }
685
+ }
686
+ renderSubinfo() {
687
+ // multiselects cannot have subinfo for options
688
+ if (!this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo) {
689
+ return h("span", { class: "subinfo" }, this.selectedOptions[0].subinfo);
690
+ }
691
+ }
692
+ renderOverflowCount() {
693
+ if (this.overflowCount > 0 && !this.allSelected) {
694
+ return (h("span", null, h("span", { class: "overflow-counter" }, "+", this.overflowCount)));
695
+ }
696
+ }
697
+ renderSearchField() {
698
+ 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.handleSearchFieldKeyDown(ev), onFocus: () => this.searchFieldWrapperEl.classList.add("focus"), onBlur: (ev) => this.handleSearchFieldBlur(ev), onInput: () => this.debouncedSearch(), placeholder: this.searchPlaceholder }))));
699
+ }
700
+ renderSearchFailedMessage() {
701
+ return h("div", { class: "search-results-message" }, this.noResultsFoundMessage);
702
+ }
703
+ renderDuplicateOptions() {
704
+ return Array.from(this.el.children).map((option) => {
705
+ return (h("wm-option", { class: "duplicate", selected: option.selected }, option.textContent));
706
+ });
707
+ }
708
+ render() {
709
+ const buttonProps = {
710
+ id: `selectbtn-${this.uid}`,
711
+ ["disabled"]: this.disabled,
712
+ ["aria-controls"]: `list-${this.uid}`,
713
+ ["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
714
+ ["aria-describedby"]: "wm-errors",
715
+ ["aria-expanded"]: this.isExpanded ? "true" : "false",
716
+ onClick: () => (this.isExpanded ? this.close() : this.open()),
717
+ };
718
+ 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,
719
+ // we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
720
+ this.requiredField ? (h("span", { class: "required" }, h("span", { class: "sr-only" }, this.requiredMessage), 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
721
+ ? "overflowcontrol hassubinfo"
722
+ : "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.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)))));
723
+ }
724
+ get el() { return getElement(this); }
725
+ static get watchers() { return {
726
+ "errorMessage": ["exposeErrors"]
727
+ }; }
728
+ };
729
729
  Select.style = wmSelectCss;
730
730
 
731
731
  export { Option as wm_option, Select as wm_select };