@watermarkinsights/ripple 3.14.1 → 3.15.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 (263) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{chartFunctions-0ea0888f.js → chartFunctions-08494c24.js} +419 -419
  3. package/dist/cjs/{functions-8d3ceccd.js → functions-e1b590e0.js} +528 -446
  4. package/dist/cjs/{global-12a09ffa.js → global-0a41410c.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 -335
  14. package/dist/cjs/wm-button.cjs.entry.js +248 -241
  15. package/dist/cjs/wm-chart-slice.cjs.entry.js +13 -13
  16. package/dist/cjs/wm-chart.cjs.entry.js +110 -110
  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 -454
  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 +129 -129
  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.cjs.entry.js +579 -579
  32. package/dist/cjs/wm-timepicker.cjs.entry.js +383 -383
  33. package/dist/cjs/wm-toggletip.cjs.entry.js +124 -124
  34. package/dist/cjs/wm-uploader.cjs.entry.js +599 -629
  35. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  36. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +258 -258
  37. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +115 -115
  38. package/dist/collection/components/charts/wm-chart/wm-chart.js +328 -328
  39. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +195 -195
  40. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +88 -88
  41. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +111 -111
  42. package/dist/collection/components/wm-action-menu/wm-action-menu.js +442 -448
  43. package/dist/collection/components/wm-button/wm-button.js +545 -504
  44. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1024 -1024
  45. package/dist/collection/components/wm-datepicker/wm-datepicker.js +471 -471
  46. package/dist/collection/components/wm-input/wm-input.js +423 -423
  47. package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
  48. package/dist/collection/components/wm-modal/wm-modal-footer.js +136 -136
  49. package/dist/collection/components/wm-modal/wm-modal-header.js +87 -87
  50. package/dist/collection/components/wm-modal/wm-modal.js +461 -461
  51. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +162 -162
  52. package/dist/collection/components/wm-navigation/wm-navigation-item.js +121 -121
  53. package/dist/collection/components/wm-navigation/wm-navigation.js +218 -218
  54. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
  55. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
  56. package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
  57. package/dist/collection/components/wm-option/wm-option.js +428 -428
  58. package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
  59. package/dist/collection/components/wm-search/wm-search.js +480 -480
  60. package/dist/collection/components/wm-select/wm-select.js +1001 -1001
  61. package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
  62. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +216 -216
  63. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +330 -330
  64. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
  65. package/dist/collection/components/wm-tag-input/wm-tag-input.js +810 -810
  66. package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
  67. package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
  68. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +788 -787
  69. package/dist/collection/components/wm-uploader/wm-uploader.js +1043 -1072
  70. package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
  71. package/dist/collection/dev/scripts.js +20 -20
  72. package/dist/collection/global/__mocks__/functions.js +6 -6
  73. package/dist/collection/global/chartFunctions.js +421 -421
  74. package/dist/collection/global/functions.js +441 -441
  75. package/dist/collection/global/global.js +69 -69
  76. package/dist/collection/global/interfaces.js +49 -49
  77. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  78. package/dist/collection/global/services/http-service.js +50 -50
  79. package/dist/collection/lang/lang.js +5 -5
  80. package/dist/collection/lang/missing.js +43 -43
  81. package/dist/collection/lang/piglatin.js +93 -93
  82. package/dist/esm/{chartFunctions-6f90586d.js → chartFunctions-a310b9d0.js} +419 -419
  83. package/dist/esm/{functions-11c0c4e2.js → functions-b4b62a23.js} +528 -446
  84. package/dist/esm/{global-5abca73e.js → global-e80a0ec8.js} +62 -62
  85. package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
  86. package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
  87. package/dist/esm/loader.js +2 -2
  88. package/dist/esm/polyfills/core-js.js +0 -0
  89. package/dist/esm/polyfills/dom.js +0 -0
  90. package/dist/esm/polyfills/es5-html-element.js +0 -0
  91. package/dist/esm/polyfills/index.js +0 -0
  92. package/dist/esm/polyfills/system.js +0 -0
  93. package/dist/esm/priv-chart-popover.entry.js +86 -86
  94. package/dist/esm/priv-datepicker.entry.js +657 -657
  95. package/dist/esm/priv-navigator-button.entry.js +18 -18
  96. package/dist/esm/priv-navigator-item.entry.js +23 -23
  97. package/dist/esm/ripple.js +2 -2
  98. package/dist/esm/wm-action-menu_2.entry.js +329 -335
  99. package/dist/esm/wm-button.entry.js +248 -241
  100. package/dist/esm/wm-chart-slice.entry.js +13 -13
  101. package/dist/esm/wm-chart.entry.js +110 -110
  102. package/dist/esm/wm-datepicker.entry.js +265 -265
  103. package/dist/esm/wm-input.entry.js +134 -134
  104. package/dist/esm/wm-modal-footer.entry.js +33 -33
  105. package/dist/esm/wm-modal-header.entry.js +36 -36
  106. package/dist/esm/wm-modal.entry.js +163 -163
  107. package/dist/esm/wm-navigation_3.entry.js +227 -227
  108. package/dist/esm/wm-navigator.entry.js +268 -268
  109. package/dist/esm/wm-network-uploader.entry.js +455 -454
  110. package/dist/esm/wm-option_2.entry.js +720 -720
  111. package/dist/esm/wm-pagination.entry.js +167 -167
  112. package/dist/esm/wm-progress-indicator_3.entry.js +129 -129
  113. package/dist/esm/wm-search.entry.js +232 -232
  114. package/dist/esm/wm-snackbar.entry.js +170 -170
  115. package/dist/esm/wm-tab-item_3.entry.js +296 -296
  116. package/dist/esm/wm-tag-input.entry.js +579 -579
  117. package/dist/esm/wm-timepicker.entry.js +383 -383
  118. package/dist/esm/wm-toggletip.entry.js +124 -124
  119. package/dist/esm/wm-uploader.entry.js +599 -629
  120. package/dist/esm/wm-wrapper.entry.js +12 -12
  121. package/dist/esm-es5/{chartFunctions-6f90586d.js → chartFunctions-a310b9d0.js} +1 -1
  122. package/dist/esm-es5/functions-b4b62a23.js +1 -0
  123. package/dist/esm-es5/global-e80a0ec8.js +1 -0
  124. package/dist/esm-es5/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +0 -0
  125. package/dist/esm-es5/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +0 -0
  126. package/dist/esm-es5/loader.js +1 -1
  127. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  128. package/dist/esm-es5/priv-datepicker.entry.js +1 -1
  129. package/dist/esm-es5/ripple.js +1 -1
  130. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  131. package/dist/esm-es5/wm-button.entry.js +1 -1
  132. package/dist/esm-es5/wm-chart.entry.js +1 -1
  133. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  134. package/dist/esm-es5/wm-input.entry.js +1 -1
  135. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  136. package/dist/esm-es5/wm-modal.entry.js +1 -1
  137. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  138. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  139. package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
  140. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  141. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  142. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  143. package/dist/esm-es5/wm-search.entry.js +1 -1
  144. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  145. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  146. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  147. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  148. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  149. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  150. package/dist/ripple/{p-07ebdcd4.system.entry.js → p-0f08a806.system.entry.js} +1 -1
  151. package/dist/ripple/{p-b793bc6f.system.entry.js → p-1ba2134b.system.entry.js} +1 -1
  152. package/dist/ripple/{p-626d5017.entry.js → p-1c75615f.entry.js} +1 -1
  153. package/dist/ripple/{p-42dbd978.entry.js → p-1cadcfc1.entry.js} +1 -1
  154. package/dist/ripple/{p-b2a9b5d6.system.entry.js → p-2531b343.system.entry.js} +1 -1
  155. package/dist/ripple/p-32da7cdf.entry.js +1 -0
  156. package/dist/ripple/p-375a850f.system.js +1 -0
  157. package/dist/ripple/p-3a71d9a3.entry.js +1 -0
  158. package/dist/ripple/{p-0e22a3a4.entry.js → p-428b8b24.entry.js} +1 -1
  159. package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
  160. package/dist/ripple/{p-80a00759.entry.js → p-477688c8.entry.js} +1 -1
  161. package/dist/ripple/{p-d927de70.system.entry.js → p-4be49461.system.entry.js} +1 -1
  162. package/dist/ripple/{p-7cb0035a.system.entry.js → p-51b60241.system.entry.js} +1 -1
  163. package/dist/ripple/p-5754e2b8.system.js +1 -0
  164. package/dist/ripple/{p-b5b7c71f.system.js → p-591fae61.system.js} +1 -1
  165. package/dist/ripple/p-5f589556.entry.js +1 -0
  166. package/dist/ripple/{p-b4837126.system.entry.js → p-617b738b.system.entry.js} +1 -1
  167. package/dist/ripple/{p-06012eb7.system.entry.js → p-61e2a39a.system.entry.js} +1 -1
  168. package/dist/ripple/{p-5018f8ae.entry.js → p-65d5f494.entry.js} +1 -1
  169. package/dist/ripple/{p-4f3f7b2b.entry.js → p-6ac734b7.entry.js} +1 -1
  170. package/dist/ripple/p-6d7a6954.js +1 -0
  171. package/dist/ripple/{p-97683ddc.entry.js → p-6ddfada6.entry.js} +1 -1
  172. package/dist/ripple/{p-57a718f0.system.entry.js → p-719864a5.system.entry.js} +1 -1
  173. package/dist/ripple/{p-caef11cc.entry.js → p-73a66a6c.entry.js} +1 -1
  174. package/dist/ripple/{p-c656fcf1.entry.js → p-75346877.entry.js} +1 -1
  175. package/dist/ripple/{p-dfa80ed1.entry.js → p-7833008a.entry.js} +1 -1
  176. package/dist/ripple/{p-08fc668c.system.entry.js → p-79542ae3.system.entry.js} +1 -1
  177. package/dist/ripple/{p-4073ac6a.entry.js → p-79b8e996.entry.js} +1 -1
  178. package/dist/ripple/{p-8b54c589.system.entry.js → p-7a07096b.system.entry.js} +1 -1
  179. package/dist/ripple/{p-c4c21c82.system.entry.js → p-93321f18.system.entry.js} +1 -1
  180. package/dist/ripple/p-96b47a13.js +1 -0
  181. package/dist/ripple/{p-c49ef079.system.entry.js → p-981788dd.system.entry.js} +1 -1
  182. package/dist/ripple/p-990db03b.system.entry.js +1 -0
  183. package/dist/ripple/p-99791f7a.system.js +1 -0
  184. package/dist/ripple/{p-e012273a.entry.js → p-9ad7db55.entry.js} +1 -1
  185. package/dist/ripple/{p-910b6dd5.system.entry.js → p-9caf189d.system.entry.js} +1 -1
  186. package/dist/ripple/{p-313b6073.system.js → p-9d02957d.system.js} +0 -0
  187. package/dist/ripple/{p-ffc34819.system.entry.js → p-9ef524df.system.entry.js} +1 -1
  188. package/dist/ripple/{p-84d0d2ff.system.entry.js → p-9fd29197.system.entry.js} +1 -1
  189. package/dist/ripple/{p-f0d3ceb1.system.entry.js → p-a2f8608f.system.entry.js} +1 -1
  190. package/dist/ripple/{p-dc7e5609.system.entry.js → p-aa35c9dd.system.entry.js} +1 -1
  191. package/dist/ripple/{p-6ffdab0d.system.entry.js → p-ab7ce269.system.entry.js} +1 -1
  192. package/dist/ripple/{p-410687ea.entry.js → p-b5a6aebc.entry.js} +1 -1
  193. package/dist/ripple/{p-4650a83c.system.entry.js → p-b6c197c7.system.entry.js} +1 -1
  194. package/dist/ripple/{p-9c60325b.entry.js → p-c5a3766f.entry.js} +1 -1
  195. package/dist/ripple/{p-2af0b657.system.entry.js → p-c95317b4.system.entry.js} +1 -1
  196. package/dist/ripple/p-ce696630.entry.js +1 -0
  197. package/dist/ripple/{p-17438cd5.entry.js → p-d3326191.entry.js} +1 -1
  198. package/dist/ripple/{p-fe4c1194.system.entry.js → p-e47b10b1.system.entry.js} +1 -1
  199. package/dist/ripple/{p-490dafa4.js → p-eb308bc7.js} +1 -1
  200. package/dist/ripple/{p-4afa52d4.entry.js → p-f5cec3d1.entry.js} +1 -1
  201. package/dist/ripple/{p-08b7ec08.system.js → p-f5df5903.system.js} +0 -0
  202. package/dist/ripple/{p-8a2cabf2.entry.js → p-f7c2b508.entry.js} +1 -1
  203. package/dist/ripple/{p-cb357a84.entry.js → p-fcb81a4e.entry.js} +1 -1
  204. package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
  205. package/dist/ripple/ripple.esm.js +1 -1
  206. package/dist/ripple/ripple.js +1 -1
  207. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
  208. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
  209. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +36 -36
  210. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +27 -27
  211. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +17 -17
  212. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
  213. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +47 -47
  214. package/dist/types/components/wm-button/wm-button.d.ts +49 -43
  215. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
  216. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +41 -41
  217. package/dist/types/components/wm-input/wm-input.d.ts +46 -46
  218. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  219. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
  220. package/dist/types/components/wm-modal/wm-modal-header.d.ts +11 -11
  221. package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
  222. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +21 -21
  223. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
  224. package/dist/types/components/wm-navigation/wm-navigation.d.ts +28 -28
  225. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  226. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  227. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  228. package/dist/types/components/wm-option/wm-option.d.ts +35 -35
  229. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  230. package/dist/types/components/wm-search/wm-search.d.ts +86 -86
  231. package/dist/types/components/wm-select/wm-select.d.ts +94 -94
  232. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
  233. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
  234. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
  235. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  236. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +92 -92
  237. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +61 -61
  238. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
  239. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  240. package/dist/types/components/wm-uploader/wm-uploader.d.ts +121 -118
  241. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  242. package/dist/types/components.d.ts +28 -24
  243. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  244. package/dist/types/global/chartFunctions.d.ts +29 -29
  245. package/dist/types/global/functions.d.ts +42 -42
  246. package/dist/types/global/global.d.ts +1 -1
  247. package/dist/types/global/interfaces.d.ts +44 -44
  248. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  249. package/dist/types/global/services/http-service.d.ts +4 -4
  250. package/dist/types/lang/lang.d.ts +5 -5
  251. package/package.json +47 -47
  252. package/dist/esm-es5/functions-11c0c4e2.js +0 -1
  253. package/dist/esm-es5/global-5abca73e.js +0 -1
  254. package/dist/ripple/p-37b0a23c.system.js +0 -1
  255. package/dist/ripple/p-3e875e87.system.entry.js +0 -1
  256. package/dist/ripple/p-42bf2cd4.system.js +0 -1
  257. package/dist/ripple/p-70d0e993.js +0 -1
  258. package/dist/ripple/p-80b62707.entry.js +0 -1
  259. package/dist/ripple/p-d2a11410.entry.js +0 -1
  260. package/dist/ripple/p-db899686.system.js +0 -1
  261. package/dist/ripple/p-e2d5f8bd.js +0 -1
  262. package/dist/ripple/p-e4cb8aad.entry.js +0 -1
  263. package/dist/ripple/p-fa632547.entry.js +0 -1
@@ -3,638 +3,608 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-df6a3611.js');
6
- const functions = require('./functions-8d3ceccd.js');
6
+ const functions = require('./functions-e1b590e0.js');
7
7
 
8
8
  const wmUploaderCss = ":host .wm-button,wm-uploader .wm-button{-ms-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-moz-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;width:inherit;border:2px solid #575195;color:#575195;font-family:inherit;font-size:0.75rem;font-weight:700;height:2.75rem;padding:0 1.3333333333em;cursor:pointer;position:relative;background:#fff;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;text-decoration:none;text-transform:uppercase;letter-spacing:0.01875rem;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}@media screen and (min-width: 48rem){:host .wm-button,wm-uploader .wm-button{height:3.3333333333em}}:host .wm-button.nowrap,wm-uploader .wm-button.nowrap{display:inline-block;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host .wm-button:focus,wm-uploader .wm-button:focus{outline:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wm-button::-moz-focus-inner,wm-uploader .wm-button::-moz-focus-inner{border:0;outline:none}:host .wm-button.user-is-tabbing:focus:not(:disabled):not(.disabled) :host .wm-button.-textonly .button-text,wm-uploader .wm-button.user-is-tabbing:focus:not(:disabled):not(.disabled) :host .wm-button.-textonly .button-text,:host .wm-button.user-is-tabbing:focus:not(:disabled):not(.disabled) wm-uploader .wm-button.-textonly .button-text,wm-uploader .wm-button.user-is-tabbing:focus:not(:disabled):not(.disabled) wm-uploader .wm-button.-textonly .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, #3862e9), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, #3862e9 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}:host .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled),wm-uploader .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled){-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark),wm-uploader .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark){-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}:host .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark)::-moz-focus-inner,wm-uploader .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark)::-moz-focus-inner{border:0}:host .wm-button.dark:not(.-textonly):not(:disabled):not(.disabled),wm-uploader .wm-button.dark:not(.-textonly):not(:disabled):not(.disabled){background:transparent;border:2px solid #fff;color:#fff}:host .wm-button.dark:not(.-textonly):not(:disabled):not(.disabled):hover,wm-uploader .wm-button.dark:not(.-textonly):not(:disabled):not(.disabled):hover{color:#575195;background:#e6e6e6;border:2px solid #e6e6e6}:host .wm-button.dark.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled).dark,wm-uploader .wm-button.dark.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled).dark{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;-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 #c6b4e3;-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 #c6b4e3;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 #c6b4e3;outline:none}:host .wm-button:active:not(:disabled):not(.disabled):not(.-textonly):not(.-actionbutton):not(.displayedoption),wm-uploader .wm-button:active:not(:disabled):not(.disabled):not(.-textonly):not(.-actionbutton):not(.displayedoption){-ms-transform:scale(0.9, 0.9);-webkit-transform:scale(0.9, 0.9);-moz-transform:scale(0.9, 0.9);transform:scale(0.9, 0.9)}:host .wm-button .mdi,wm-uploader .wm-button .mdi{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}:host .wm-button:not(.-icononly):not(.-navigational) .mdi,wm-uploader .wm-button:not(.-icononly):not(.-navigational) .mdi{margin-right:0.3125rem}:host .wm-button[dir=RTL] :not(.-icononly) .mdi,wm-uploader .wm-button[dir=RTL] :not(.-icononly) .mdi{margin-left:0.3125rem;margin-right:0}:host .wm-button.-primary:not(.-textonly),wm-uploader .wm-button.-primary:not(.-textonly){background:#575195;color:#fff}:host .wm-button.-primary:not(.-textonly):not(:focus),wm-uploader .wm-button.-primary:not(.-textonly):not(:focus){-webkit-box-shadow:0 2px 2px 0 rgba(87, 81, 149, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 2px 2px 0 rgba(87, 81, 149, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.2);box-shadow:0 2px 2px 0 rgba(87, 81, 149, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.2)}:host .wm-button.-primary:not(.-textonly):hover:not(:disabled):not(.disabled),wm-uploader .wm-button.-primary:not(.-textonly):hover:not(:disabled):not(.disabled){background:#464177}:host .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled),wm-uploader .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled){color:#575195;background:#fff;border:2px solid #fff}:host .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled):hover,wm-uploader .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled):hover{color:#575195;background:#e6e6e6;border:2px solid #e6e6e6}:host .wm-button.-secondary:hover:not(:disabled):not(.disabled),wm-uploader .wm-button.-secondary:hover:not(:disabled):not(.disabled),:host .wm-button.-icononly:hover:not(:disabled):not(.disabled),wm-uploader .wm-button.-icononly:hover:not(:disabled):not(.disabled){background:#464177;color:#fff}:host .wm-button.-textonly,wm-uploader .wm-button.-textonly{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;display:inline-block;letter-spacing:0;text-transform:none;text-align:initial;font-size:0.875rem;border:none;background:transparent;padding-left:0;padding-right:0;height:auto;border-radius:0;line-height:1}:host .wm-button.-textonly+.-textonly,wm-uploader .wm-button.-textonly+.-textonly{margin-left:0.3125rem}:host .wm-button.-textonly:focus,wm-uploader .wm-button.-textonly:focus{outline:none}:host .wm-button.-textonly::-moz-focus-inner,wm-uploader .wm-button.-textonly::-moz-focus-inner{border:0;outline:none}:host .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled) .button-text,wm-uploader .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled) .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, #3862e9), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, #3862e9 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}:host .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled).dark .button-text,wm-uploader .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled).dark .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, #fff), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, #fff 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}:host .wm-button.-textonly.small,wm-uploader .wm-button.-textonly.small{font-size:0.625rem}:host .wm-button.-textonly:hover:not(:disabled):not(.disabled):not(.-permanentlydelete),wm-uploader .wm-button.-textonly:hover:not(:disabled):not(.disabled):not(.-permanentlydelete){text-decoration:underline}:host .wm-button.-textonly.-permanentlydelete,wm-uploader .wm-button.-textonly.-permanentlydelete{color:#c0392b}:host .wm-button.-textonly.-permanentlydelete:hover:not(:disabled):not(.disabled):not(.dark),wm-uploader .wm-button.-textonly.-permanentlydelete:hover:not(:disabled):not(.disabled):not(.dark){text-decoration:underline;color:#c0392b !important}:host .wm-button.-textonly.dark,wm-uploader .wm-button.-textonly.dark{color:#fff}:host .wm-button.-textonly.dark:hover:not(:disabled):not(.disabled),wm-uploader .wm-button.-textonly.dark:hover:not(:disabled):not(.disabled){text-decoration:underline;color:#fff !important}:host .wm-button.-icononly,wm-uploader .wm-button.-icononly,:host .wm-button.-navigational,wm-uploader .wm-button.-navigational{-webkit-border-radius:50%;-moz-border-radius:50%;-ms-border-radius:50%;border-radius:50%;font-size:1rem;padding:0;height:auto;line-height:1;min-width:2.75rem;min-height:2.75rem;text-align:center;letter-spacing:normal}:host .wm-button.-icononly:not(:focus),wm-uploader .wm-button.-icononly:not(:focus),:host .wm-button.-navigational:not(:focus),wm-uploader .wm-button.-navigational:not(:focus){-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}@media screen and (min-width: 48rem){:host .wm-button.-icononly,wm-uploader .wm-button.-icononly,:host .wm-button.-navigational,wm-uploader .wm-button.-navigational{min-width:2.5rem;min-height:2.5rem}}:host .wm-button.-icononly,wm-uploader .wm-button.-icononly{border-width:1px !important}:host .wm-button.-icononly:before,wm-uploader .wm-button.-icononly: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}:host .wm-button.-navigational,wm-uploader .wm-button.-navigational{border:none !important;background-color:transparent}:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled),wm-uploader .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled){color:#575195}:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled):hover,wm-uploader .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled):hover,:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled).selected,wm-uploader .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled).selected{background-color:#d7d6d9}:host .wm-button.-navigational:before,wm-uploader .wm-button.-navigational: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}:host .wm-button.-permanentlydelete:not(.-textonly),wm-uploader .wm-button.-permanentlydelete:not(.-textonly){background:#c0392b;border-color:#c0392b;color:#fff}:host .wm-button.-permanentlydelete:not(.-textonly):hover:not(:disabled):not(.disabled):not(.dark),wm-uploader .wm-button.-permanentlydelete:not(.-textonly):hover:not(:disabled):not(.disabled):not(.dark){background:#9a2e22;border-color:#9a2e22}:host .wm-button.-pairnegative,wm-uploader .wm-button.-pairnegative{background:#cc4c3e;border-color:#cc4c3e;color:#fff}:host .wm-button.-pairnegative:hover:not(:disabled):not(.disabled),wm-uploader .wm-button.-pairnegative:hover:not(:disabled):not(.disabled){background:#a33d32;border-color:#a33d32}:host .wm-button.-pairpositive,wm-uploader .wm-button.-pairpositive{background:#15868d;border-color:#15868d;color:#fff}:host .wm-button.-pairpositive:hover:not(:disabled):not(.disabled),wm-uploader .wm-button.-pairpositive:hover:not(:disabled):not(.disabled){background:#116b71;border-color:#116b71}:host .wm-button.-selectoronly,wm-uploader .wm-button.-selectoronly{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:block;background:transparent;border:1px solid #575195;border-radius:3px 3px 3px 3px;height:2.75rem;min-width:11.4375rem;padding:0 1.875rem 0 0.9375rem;line-height:normal;font-family:inherit;color:#575195;font-weight:500;font-size:0.875rem;text-transform:none;letter-spacing:0.01875rem;text-align:left}@media screen and (min-width: 48rem){:host .wm-button.-selectoronly,wm-uploader .wm-button.-selectoronly{height:2.5rem}}:host .wm-button.-selectoronly:before,wm-uploader .wm-button.-selectoronly: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;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none}:host .wm-button.-selectoronly:hover:not(:disabled):not(.disabled),wm-uploader .wm-button.-selectoronly:hover:not(:disabled):not(.disabled){background:transparent;text-decoration:none}:host .wm-button.-selectoronly:active,wm-uploader .wm-button.-selectoronly:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}:host .wm-button.-selectoronly::-moz-focus-inner,wm-uploader .wm-button.-selectoronly::-moz-focus-inner{border:0}:host .wm-button.-selectoronly .overflowcontrol,wm-uploader .wm-button.-selectoronly .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:visible}:host .wm-button:disabled,wm-uploader .wm-button:disabled,:host .wm-button.disabled,wm-uploader .wm-button.disabled{background:inherit;border-color:#737373;color:#737373;cursor:default;pointer-events:none}:host .wm-button:disabled.-primary,wm-uploader .wm-button:disabled.-primary,:host .wm-button:disabled.-permanentlydelete,wm-uploader .wm-button:disabled.-permanentlydelete,:host .wm-button:disabled.-pairnegative,wm-uploader .wm-button:disabled.-pairnegative,:host .wm-button:disabled.-pairpositive,wm-uploader .wm-button:disabled.-pairpositive,:host .wm-button.disabled.-primary,wm-uploader .wm-button.disabled.-primary,:host .wm-button.disabled.-permanentlydelete,wm-uploader .wm-button.disabled.-permanentlydelete,:host .wm-button.disabled.-pairnegative,wm-uploader .wm-button.disabled.-pairnegative,:host .wm-button.disabled.-pairpositive,wm-uploader .wm-button.disabled.-pairpositive{background:#737373;color:#fff;border-color:#737373}:host .wm-button:disabled.-secondary,wm-uploader .wm-button:disabled.-secondary,:host .wm-button.disabled.-secondary,wm-uploader .wm-button.disabled.-secondary{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wm-button:disabled.-selectoronly,wm-uploader .wm-button:disabled.-selectoronly,:host .wm-button.disabled.-selectoronly,wm-uploader .wm-button.disabled.-selectoronly{color:#737373}:host .wm-button:disabled.-textonly,wm-uploader .wm-button:disabled.-textonly,:host .wm-button.disabled.-textonly,wm-uploader .wm-button.disabled.-textonly{color:#6b6b6b;background:transparent}:host .wm-button:disabled.dark.-secondary:not(.-permanentlydelete),wm-uploader .wm-button:disabled.dark.-secondary:not(.-permanentlydelete),:host .wm-button:disabled.dark.-textonly,wm-uploader .wm-button:disabled.dark.-textonly,:host .wm-button:disabled.dark.-navigational,wm-uploader .wm-button:disabled.dark.-navigational,:host .wm-button:disabled.dark.-icononly,wm-uploader .wm-button:disabled.dark.-icononly,:host .wm-button.disabled.dark.-secondary:not(.-permanentlydelete),wm-uploader .wm-button.disabled.dark.-secondary:not(.-permanentlydelete),:host .wm-button.disabled.dark.-textonly,wm-uploader .wm-button.disabled.dark.-textonly,:host .wm-button.disabled.dark.-navigational,wm-uploader .wm-button.disabled.dark.-navigational,:host .wm-button.disabled.dark.-icononly,wm-uploader .wm-button.disabled.dark.-icononly{color:#b5b5b5;border-color:#b5b5b5}:host .wm-button:disabled.dark.-primary,wm-uploader .wm-button:disabled.dark.-primary,:host .wm-button:disabled.dark.-permanentlydelete:not(.-textonly),wm-uploader .wm-button:disabled.dark.-permanentlydelete:not(.-textonly),:host .wm-button.disabled.dark.-primary,wm-uploader .wm-button.disabled.dark.-primary,:host .wm-button.disabled.dark.-permanentlydelete:not(.-textonly),wm-uploader .wm-button.disabled.dark.-permanentlydelete:not(.-textonly){background:#a6a6a6;border-color:#a6a6a6;color:#353b48}:host a.wm-button,wm-uploader a.wm-button,:host label.wm-button,wm-uploader label.wm-button{height:auto;padding-top:0.75rem;padding-bottom:0.75rem}:host,wm-uploader{width:100%;height:100%;display:block;position:relative;max-width:1140px}:host[dir=RTL] .mdi,wm-uploader[dir=RTL] .mdi{margin-left:0.3125rem;margin-right:0}:host input:focus+.wm-button.user-is-tabbing,wm-uploader input:focus+.wm-button.user-is-tabbing{-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 !important;-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 !important;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 !important}:host *,wm-uploader *{-webkit-box-sizing:border-box;box-sizing:border-box}.wm-button.disabled{pointer-events:initial !important}.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}.header{margin-bottom:2.5rem}.header.type1,.header.type2{margin-bottom:1rem}.header .slot-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-align:start;align-items:flex-start}.header .info-wrapper{-ms-flex-align:center;align-items:center}.header .info-wrapper .info{font-size:0.875rem;margin-left:1rem}.header .accepted-types{font-size:0.875rem}.header .requirements{font-size:0.875rem;margin-left:1rem}.footer{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:end;align-items:flex-end;padding:0.9375rem 1.875rem}.footer .notif-wrapper{-ms-flex-align:end;align-items:flex-end}.footer .filecount-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.footer .filecount-wrapper .filecount{font-size:0.875rem;margin-right:1rem}.notif-wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;margin-bottom:0.75rem}.notif-wrapper.type1,.notif-wrapper.type2{-ms-flex-direction:column;flex-direction:column;margin-bottom:1rem}.notif-wrapper .requirements{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.notif{padding-top:0.25rem;font-size:0.875rem;font-style:italic}.notif.error{color:#c0392b}.info-wrapper{position:relative;display:-ms-flexbox;display:flex}.name-wrapper{overflow:hidden}.name-wrapper+.file-controls{-ms-flex:none;flex:none;margin-left:1rem}.empty-block{margin:5rem auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center}.empty-block .upload-file{margin-bottom:1.875rem}.empty-block .empty-message{font-size:0.875rem;margin-bottom:0.4375rem}.empty-block .empty-message.large{font-size:1.5rem}.empty-block .info-wrapper{-ms-flex-pack:center;justify-content:center;width:100%}.empty-block .info-wrapper .wm-button{width:auto}.list-container{overflow-y:unset}.list-container.checkmark-spacer{margin-right:2.75rem}.list-container.type1,.list-container.type2{overflow-y:auto}.list-container.type1 ul,.list-container.type2 ul{margin:revert}.list-container.type1 .file-list li,.list-container.type1 .inprogress-list li,.list-container.type2 .file-list li,.list-container.type2 .inprogress-list li{margin-bottom:1.625rem}.list-container.type1 .error-list li,.list-container.type2 .error-list li{margin-bottom:1.25rem}.list-container.type1{padding:0 1.875rem;height:16.25rem}ul{list-style:none;padding:0;width:100%;margin:0}ul li{position:relative;font-size:0.875rem;margin-bottom:0.5rem}ul li .file{min-width:300px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:relative;height:3.5rem;padding:0.5rem 1.25rem;background:#f4f4f4;border:1px solid #6b6b6b;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}ul li .file+.file{margin-top:1.25rem}ul li .file .filename{white-space:nowrap}ul li .file .left-group{overflow:hidden}ul li .file .right-group{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-left:5rem}ul li .file .right-group .file-controls{display:-ms-flexbox;display:flex}ul li .file .right-group .file-info{white-space:nowrap;margin-right:1rem}ul li .file wm-button+wm-button{margin-left:1rem}ul li.condensed .right-group{padding-left:2.5rem}ul li.checked .file: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:\"\\f133\";position:absolute;right:-44px;color:#088000;font-size:28px;line-height:1}ul .progress{position:absolute;left:0;top:0;right:0;height:8px}ul.file-list li,ul.inprogress-list li{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}ul.file-list li .file,ul.inprogress-list li .file{-ms-flex:1;flex:1}ul.error-list li{margin-bottom:0.5rem}ul.error-list li .file{border:1px solid #c0392b;background-color:#f5ebea;height:3.75rem}ul.error-list li .error-message{color:#c0392b;padding-top:0.25rem;font-style:italic}.ch-measure{width:1ch !important}";
9
9
 
10
- const Uploader = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- this.wmUploaderFilesSelected = index.createEvent(this, "wmUploaderFilesSelected", 7);
14
- this.wmFilesSelected = index.createEvent(this, "wmFilesSelected", 7);
15
- this.wmUploaderDeleteFile = index.createEvent(this, "wmUploaderDeleteFile", 7);
16
- this.wmDeleteFile = index.createEvent(this, "wmDeleteFile", 7);
17
- this.wmUploaderDownloadFile = index.createEvent(this, "wmUploaderDownloadFile", 7);
18
- this.wmDownloadFile = index.createEvent(this, "wmDownloadFile", 7);
19
- this.wmUploaderPreviewFile = index.createEvent(this, "wmUploaderPreviewFile", 7);
20
- this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
21
- this.sortBy = "date"; // name is descending (a -> z), date is ascending (earlier -> later)
22
- this.showInfo = "time";
23
- this.fileList = []; // the string above transformed into the actual array
24
- this.filesToUpload = []; // input.files that passed validation
25
- this.isTabbing = false;
26
- this.errorList = []; // for errors on a particular file
27
- this.isCondensed = false;
28
- this.inputId = functions.generateId();
29
- this.debouncedResize = functions.debounce(() => {
30
- this.isCondensed = this.el.clientWidth < 500;
31
- // rerender to show filename truncation changes
32
- index.forceUpdate(this.el);
33
- }, 50);
34
- }
35
- get tooltipEl() {
36
- return document.getElementById("wm-tooltip");
37
- }
38
- get uploadButtonEl() {
39
- return this.el.shadowRoot.querySelector(`#${this.inputId}`);
40
- }
41
- get tempUploaderType() {
42
- // replace instances of this.tempUploaderType with this.uploaderType once type is fully phased out
43
- return this.type || this.uploaderType;
44
- }
45
- get effectiveMaxSize() {
46
- const defaultMaxSize = 100;
47
- // maxsize cannot be set to over 100Mb
48
- const maxSizeLimit = 100;
49
- return this.maxSize ? Math.min(this.maxSize, maxSizeLimit) : defaultMaxSize;
50
- }
51
- get chMeasure() {
52
- return this.el.shadowRoot.querySelector(".ch-measure").clientWidth;
53
- }
54
- get fileLimitReached() {
55
- return this.maxFiles && this.fileList.length >= this.maxFiles;
56
- }
57
- get fileUploadLimitMessage() {
58
- return functions.intl.formatMessage({
59
- id: "uploader.fileUploadLimit",
60
- defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
61
- description: "Message displayed when trying to upload too many files",
62
- });
63
- }
64
- get fileCountMessage() {
65
- return functions.intl.formatMessage({
66
- id: "uploader.fileCount",
67
- defaultMessage: "{x} of {y} Files",
68
- description: "A count of the number of files currently uploaded",
69
- }, { x: this.fileList.length, y: this.maxFiles });
70
- }
71
- get maxSizeMessage() {
72
- return functions.intl.formatMessage({
73
- id: "uploader.maxSize",
74
- defaultMessage: "Maximum file size {maxSize}MB",
75
- description: "An indicator of the maximum file size the uploader allows",
76
- }, {
77
- maxSize: this.effectiveMaxSize,
78
- });
79
- }
80
- get acceptedFileTypesMessage() {
81
- const validTypes = "." + this.fileTypes.split(" ").join(", .");
82
- return functions.intl.formatMessage({
83
- id: "uploader.acceptedFileTypes",
84
- defaultMessage: "Accepted file {amount, plural, =1 {type} other {types}}: {fileTypes}",
85
- }, {
86
- fileTypes: validTypes,
87
- amount: this.fileTypes.split(" ").length,
88
- });
89
- }
90
- get previewActionMessage() {
91
- return functions.intl.formatMessage({
92
- id: "uploader.previewAction",
93
- defaultMessage: "Preview File",
94
- description: "Label of a button that triggers a file to be previewed",
95
- });
96
- }
97
- get downloadActionMessage() {
98
- return functions.intl.formatMessage({
99
- id: "uploader.downloadAction",
100
- defaultMessage: "Download File",
101
- description: "Label of a button that triggers a file to be downloaded",
102
- });
103
- }
104
- get deleteActionMessage() {
105
- return functions.intl.formatMessage({
106
- id: "uploader.deleteAction",
107
- defaultMessage: "Delete File",
108
- description: "Label of a button that triggers a file to be delete",
109
- });
110
- }
111
- get clearButtonText() {
112
- return functions.intl.formatMessage({
113
- id: "uploader.clearErrorText",
114
- defaultMessage: "Clear",
115
- description: "Text for a button used to clear an error",
116
- });
117
- }
118
- get actionMenuLabel() {
119
- return functions.intl.formatMessage({
120
- id: "uploader.actionMenuLabel",
121
- defaultMessage: "Actions",
122
- description: "Label of a button that opens a menu of file actions",
123
- });
124
- }
125
- toggleTabbingOn() {
126
- this.isTabbing = true;
127
- }
128
- toggleTabbingOff() {
129
- this.isTabbing = false;
130
- }
131
- handleUploadProgress(ev) {
132
- this.fileList.map((i) => {
133
- if (i.id === ev.detail.id) {
134
- i.progress = ev.detail.progress;
135
- index.forceUpdate(this.el);
136
- }
137
- });
138
- if (ev.detail.progress === 100) {
139
- // inProgressList is not a perfect reflection of how many files are uploading
140
- // because even after progress reached 100% the item should remain in the array
141
- // (should only be removed once it appears in fileList)
142
- this.numFilesInProgress -= 1;
143
- }
144
- // aggregate the percentages for SR to announce progress
145
- if (!this.srProgress && this.numFilesInProgress) {
146
- const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
147
- this.srProgress = setInterval(() => {
148
- const aggregate = this.fileList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
149
- if (this.liveRegion) {
150
- this.liveRegion.innerHTML = functions.intl.formatMessage({
151
- id: "uploader.uploadProgress",
152
- defaultMessage: "Upload progress: {percentage}%",
153
- }, { percentage: Math.floor(aggregate / total) });
154
- }
155
- }, 5000);
156
- }
157
- }
158
- parseFiles() {
159
- if (!!this.files) {
160
- if (typeof this.files === "string") {
161
- const list = JSON.parse(this.files);
162
- if (typeof list === "object") {
163
- this.fileList = list;
164
- }
165
- else {
166
- throw new Error("could not parse string passed to files attribute");
167
- }
168
- }
169
- else {
170
- throw new Error("Attribute 'files' should be a string");
171
- }
172
- }
173
- }
174
- parseRejectedFiles() {
175
- if (!!this.rejectedFiles) {
176
- if (typeof this.files === "string") {
177
- const list = JSON.parse(this.rejectedFiles);
178
- if (typeof list === "object") {
179
- this.errorList = list;
180
- }
181
- else {
182
- throw new Error("could not parse string passed to errors attribute");
183
- }
184
- }
185
- else {
186
- throw new Error("Attribute 'rejected-files' should be a string");
187
- }
188
- }
189
- }
190
- uploadNotifications(newNum, oldNum) {
191
- if (oldNum > 0 && newNum === 0) {
192
- setTimeout(() => {
193
- this.notif = null;
194
- }, 20 * 1000);
195
- const message = functions.intl.formatMessage({
196
- id: "uploader.finishedUploading",
197
- defaultMessage: "Finished uploading",
198
- });
199
- this.notif = { id: 5, message, isError: false };
200
- if (this.liveRegion) {
201
- this.liveRegion.innerHTML = message;
202
- }
203
- this.numFilesInProgress = null;
204
- clearInterval(this.srProgress);
205
- index.forceUpdate(this.el);
206
- }
207
- else if (newNum > 0 && newNum != oldNum) {
208
- const message = functions.intl.formatMessage({
209
- id: "uploader.filesUploading",
210
- defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
211
- }, { num: newNum });
212
- this.notif = { id: 6, message, isError: false };
213
- if (this.liveRegion) {
214
- this.liveRegion.innerHTML = message;
215
- }
216
- index.forceUpdate(this.el);
217
- }
218
- }
219
- isValidSize(size) {
220
- return this.convertBytes(size, "MB").size <= this.effectiveMaxSize;
221
- }
222
- convertBytes(bytes, unit) {
223
- // https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
224
- const unitOrder = ["bytes", "KB", "MB", "GB", "TB"];
225
- let unitIndex = 0;
226
- let result = typeof bytes === "number" ? bytes : parseInt(bytes);
227
- if (unit) {
228
- // convert until result matches desired unit
229
- while (unitOrder.indexOf(unit) > unitIndex) {
230
- result /= 1024;
231
- unitIndex++;
232
- }
233
- }
234
- else {
235
- // convert until result is appropriate unit (value is under 1000)
236
- while (result > 1000) {
237
- result /= 1024;
238
- unitIndex++;
239
- }
240
- }
241
- return { size: result, unit: unitOrder[unitIndex] };
242
- }
243
- isDuplicate(name) {
244
- return this.fileList.find((f) => {
245
- const filename = f.type ? f.name + "." + f.type : f.name;
246
- return filename === name;
247
- });
248
- }
249
- isEmpty() {
250
- return !this.fileList.length && !this.errorList.length;
251
- }
252
- get isDisabled() {
253
- if (!this.notif) {
254
- if (this.fileLimitReached) {
255
- const errMessage = this.fileUploadLimitMessage;
256
- this.notif = { id: 1, message: errMessage, isError: true };
257
- if (this.liveRegion) {
258
- this.liveRegion.innerHTML = errMessage;
259
- }
260
- }
261
- else {
262
- this.notif = null;
263
- }
264
- }
265
- else if (this.notif.id === 1) {
266
- // to make sure SR don't repeat the error, don't reset it if it already is showing
267
- // just dismiss it if isMax is not true anymore
268
- if (!this.fileLimitReached) {
269
- this.notif = null;
270
- }
271
- // finally do nothing if error 2 is showing (special case when user selects too many files)
272
- }
273
- // disable if is the uploader is maxed out or if something is uploading
274
- return this.fileLimitReached || this.numFilesInProgress > 0;
275
- }
276
- isItemUploading(item) {
277
- return item.hasOwnProperty("progress") && item.progress < 100;
278
- }
279
- clearError(filename) {
280
- this.errorList = this.errorList.filter((error) => error.name != filename);
281
- this.notif = null;
282
- }
283
- clearErrors() {
284
- this.errorList = [];
285
- this.notif = null;
286
- }
287
- handleFiles(ev) {
288
- this.filesToUpload = [];
289
- const validTypes = this.fileTypes.split(" ").join(", ");
290
- const files = Array.from(ev.target.files);
291
- if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
292
- const errMessage = functions.intl.formatMessage({
293
- id: "uploader.fileUploadExceeded",
294
- defaultMessage: "The number of selected files exceeds the limit.",
295
- });
296
- this.notif = { id: 2, message: errMessage, isError: true };
297
- if (this.liveRegion) {
298
- this.liveRegion.innerHTML = errMessage;
299
- }
300
- }
301
- else {
302
- files &&
303
- files.map((file) => {
304
- if (!functions.hasValidType(file, this.fileTypes)) {
305
- const error = {
306
- name: file.name,
307
- message: functions.intl.formatMessage({
308
- id: "uploader.invalidFileType",
309
- defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
310
- }, { validTypes }),
311
- };
312
- this.errorList.push(error);
313
- }
314
- else if (file.size === 0) {
315
- const error = {
316
- name: file.name,
317
- message: functions.intl.formatMessage({
318
- id: "uploader.zeroFileSize",
319
- defaultMessage: "The file must be more than 0 bytes",
320
- description: "Error message when user attempts to upload a file of no size",
321
- }),
322
- };
323
- this.errorList.push(error);
324
- }
325
- else if (!this.isValidSize(file.size)) {
326
- const error = {
327
- name: file.name,
328
- message: functions.intl.formatMessage({
329
- id: "uploader.fileTooLarge",
330
- defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
331
- }, { size: this.effectiveMaxSize }),
332
- };
333
- this.errorList.push(error);
334
- }
335
- else if (this.isDuplicate(file.name)) {
336
- const error = {
337
- name: file.name,
338
- message: functions.intl.formatMessage({
339
- id: "uploader.duplicateName",
340
- defaultMessage: "A file with this name already exists.",
341
- }),
342
- };
343
- this.errorList.push(error);
344
- }
345
- else {
346
- this.filesToUpload.push(file);
347
- }
348
- });
349
- if (this.filesToUpload.length > 0) {
350
- this.numFilesInProgress = this.filesToUpload.length;
351
- this.wmUploaderFilesSelected.emit(this.filesToUpload);
352
- this.wmFilesSelected.emit(this.filesToUpload); // deprecated
353
- }
354
- }
355
- ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
356
- }
357
- previewFile(file) {
358
- this.clearErrors();
359
- this.wmUploaderPreviewFile.emit(file.id);
360
- }
361
- downloadFile(file) {
362
- this.clearErrors();
363
- this.wmUploaderDownloadFile.emit(file.id);
364
- this.wmDownloadFile.emit(file.id); // deprecated
365
- }
366
- deleteFile(file) {
367
- this.clearErrors();
368
- index.forceUpdate(this.el); // for the button to stop being disabled if num files become < max-files
369
- this.wmUploaderDeleteFile.emit(file.id);
370
- this.wmDeleteFile.emit(file.id); // deprecated
371
- }
372
- componentWillLoad() {
373
- if (!this.buttonText) {
374
- throw new Error("wm-uploader: button-text is a required prop");
375
- }
376
- if (this.type) {
377
- console.warn("wm-uploader: type has been deprecated as of v3.1.0. Please use uploader-type instead.");
378
- }
379
- if (this.tempUploaderType === "1" && !this.emptyStateText) {
380
- throw new Error("wm-uploader: empty-state-text is a required prop");
381
- }
382
- // rerender on resize in case layout needs to change
383
- const resizeObserver = new ResizeObserver(() => this.debouncedResize());
384
- resizeObserver.observe(this.el);
385
- this.parseFiles();
386
- this.clearErrors();
387
- this.parseRejectedFiles();
388
- }
389
- componentDidLoad() {
390
- if (document.body.classList.contains("wmcl-user-is-tabbing")) {
391
- this.toggleTabbingOn();
392
- }
393
- }
394
- showTooltip(anchorEl, tooltipText) {
395
- this.tooltipEl.textContent = tooltipText;
396
- this.positionTooltip("bottom", anchorEl, this.tooltipEl);
397
- this.tooltipEl.style.transitionDelay = "500ms";
398
- this.tooltipEl.style.opacity = "1";
399
- }
400
- hideTooltip() {
401
- this.tooltipEl.style.transitionDelay = "0s";
402
- this.tooltipEl.style.opacity = "0";
403
- }
404
- positionTooltip(tPos, anchorEl, tooltipEl) {
405
- const tooltipHeight = tooltipEl.getBoundingClientRect().height;
406
- const tooltipWidth = tooltipEl.getBoundingClientRect().width;
407
- // to get the center positions, calculate the difference between the button width and the tooltip width
408
- const verticalDiff = (anchorEl.getBoundingClientRect().height - tooltipHeight) / 2;
409
- const horizontalDiff = (anchorEl.getBoundingClientRect().width - tooltipWidth) / 2;
410
- // the naming convention defaults to center in the absence of a value
411
- // "top" and "bottom" imply centering horizontally; "right" and "left" imply centering vertically
412
- // therefore we first set to center and adjust accordingly
413
- let verticalPos = anchorEl.getBoundingClientRect().top + verticalDiff;
414
- let horizontalPos = anchorEl.getBoundingClientRect().left + horizontalDiff;
415
- if (tPos.includes("top")) {
416
- verticalPos = anchorEl.getBoundingClientRect().top - tooltipHeight - 8;
417
- }
418
- if (tPos.includes("bottom")) {
419
- verticalPos = anchorEl.getBoundingClientRect().bottom + 8;
420
- }
421
- if (tPos.includes("left")) {
422
- horizontalPos = anchorEl.getBoundingClientRect().left - tooltipWidth - 8;
423
- }
424
- if (tPos.includes("right")) {
425
- horizontalPos = anchorEl.getBoundingClientRect().right + 8;
426
- }
427
- // after all positioning has been calculated, if tooltip is off-screen or closer than 24px it is readjusted
428
- // this only occurs when the tooltip is overflowing to the left and is positioned top or bottom
429
- // (button placed too far left, or screen size under 268px)
430
- horizontalPos = Math.max(horizontalPos, 24);
431
- tooltipEl.style.top = (verticalPos / 16).toString() + "rem";
432
- tooltipEl.style.left = (horizontalPos / 16).toString() + "rem";
433
- }
434
- uploadButtonOnClick(ev) {
435
- if (this.isDisabled) {
436
- // this is a temporary fix.
437
- // we need the disabled button to be programmatically focusable
438
- // to allow return focus after closing the browser file panel
439
- // since it's focusable the button should respond when activated
440
- // it looks disabled, and announces the reason why the action cannot
441
- // be taken when activated.
442
- // this is not pretty duplicating a intl message + the logic of isDisabled,
443
- // but not worth a bigger refactor since this is only until we get the UX for disabled elements and refactor all interactive els.
444
- ev.preventDefault();
445
- if (this.liveRegion) {
446
- let errMsg = "";
447
- if (this.numFilesInProgress > 0) {
448
- errMsg = functions.intl.formatMessage({
449
- id: "uploader.waitToUpload",
450
- defaultMessage: "Please wait for current upload to complete before uploading new files.",
451
- description: "Message for screen reader users",
452
- });
453
- }
454
- else if (this.fileLimitReached) {
455
- errMsg = this.fileUploadLimitMessage;
456
- }
457
- if (errMsg) {
458
- // clear and set again to re-announce if button is clicked several times
459
- // (can't be done inside setTimeout because of scope, hence the promise)
460
- this.liveRegion.innerHTML = "";
461
- new Promise((resolve) => {
462
- setTimeout(() => {
463
- resolve("");
464
- }, 500);
465
- }).then(() => (this.liveRegion.innerHTML = errMsg));
466
- }
467
- }
468
- }
469
- else {
470
- this.clearErrors();
471
- }
472
- }
473
- renderUploadSvg() {
474
- return (index.h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" }, index.h("path", { transform: "rotate(-180.000000) translate(-452, -255.5)", fill: "#eae8ec", d: "M361,249.681818 L361,197.318182 C361,194.118182 365.555061,191.5 371.122358,191.5 L391.316463,191.5 L391.286495,200.562515 L369.871211,200.600292 L369.885404,200.622146 L369.886423,246.655947 L443.657038,246.840767 L443.657038,200.622146 L421.683537,200.622146 L421.683537,191.5 L441.978865,191.5 C447.546162,191.5 452,194.118182 452,197.318182 L452,249.681818 C452,252.881818 447.546162,255.5 441.978865,255.5 L371.122358,255.5 C365.504449,255.5 361,252.881818 361,249.681818 Z M391.5,207 L406,221 L420.5,207 L409.625,207 L409.625,172 L402.375,172 L402.375,207 L391.5,207 Z" })));
475
- }
476
- renderIcon() {
477
- // mdi attachment icon (paper clip) is horizontal but we want it vertical
478
- const rotate = this.icon && this.icon === "f066";
479
- return (this.icon && (index.h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
480
- }
481
- renderInfo() {
482
- return this.info && this.tempUploaderType === "2" ? index.h("span", { class: "info" }, this.info) : "";
483
- }
484
- renderNotif() {
485
- return this.notif ? index.h("div", { class: `notif ${this.notif.isError ? "error" : ""}` }, this.notif.message) : "";
486
- }
487
- renderUploadButton(classes) {
488
- return (index.h("div", { class: "info-wrapper" }, index.h("input", { name: this.inputId, id: this.inputId, class: "sr-only", "aria-describedby": "file-count max-size accepted-types", type: "file", multiple: true, onClick: (ev) => this.uploadButtonOnClick(ev), onChange: (ev) => this.handleFiles(ev) }), index.h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` }, this.renderIcon(), this.buttonText), this.renderInfo()));
489
- }
490
- renderEmptyState() {
491
- return (index.h("div", { class: "empty-block" }, this.renderUploadSvg(), index.h("div", { class: `empty-message` }, this.emptyStateText), this.renderUploadButton("-primary empty-button"), this.renderNotif()));
492
- }
493
- renderFileName(filename, isUploading) {
494
- return (index.h("div", { class: "left-group" }, index.h("div", { class: "name-wrapper" }, index.h("span", { class: "filename", "data-filename": filename, onMouseEnter: (ev) => this.handleFilenameMouseEnter(ev, filename), onMouseLeave: () => this.hideTooltip() }), isUploading && index.h("span", { class: "sr-only" }, "uploading"), index.h("div", { class: "sr-only ch-measure" }))));
495
- }
496
- renderErrorList() {
497
- if (!!this.errorList.length) {
498
- if (this.liveRegion) {
499
- let srMessage = this.errorList.reduce(function (acc, err) {
500
- return acc + `${err.name}: ${err.message} `;
501
- }, "");
502
- this.liveRegion.innerHTML = srMessage;
503
- }
504
- return (index.h("ul", { class: "error-list" }, this.errorList.map((err) => {
505
- const clearButtonLabel = functions.intl.formatMessage({
506
- id: "uploader.clearErrorLabel",
507
- defaultMessage: "Clear {fileName} error",
508
- description: "Label for a button used to clear an error, including filename",
509
- }, { fileName: err.name });
510
- return (index.h("li", null, index.h("div", { class: "file --error" }, this.renderFileName(err.name, false), index.h("wm-button", { "permanently-delete": true, "button-type": "textonly", "label-for-identical-buttons": clearButtonLabel, onClick: () => {
511
- this.clearError(err.name);
512
- this.uploadButtonEl.focus();
513
- } }, this.clearButtonText)), index.h("div", { class: "error-message" }, err.message)));
514
- })));
515
- }
516
- }
517
- renderFileInProgress(item) {
518
- const filename = item.type ? `${item.name}.${item.type}` : item.name;
519
- return (index.h("li", null, index.h("div", { class: "file --progress" }, index.h("div", { class: "progress", style: {
520
- background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
521
- } }), this.renderFileName(filename, this.isItemUploading(item)))));
522
- }
523
- renderFile(item) {
524
- const filename = item.type ? `${item.name}.${item.type}` : item.name;
525
- const hasSingleFileAction = item.fileActions && item.fileActions.split(" ").length === 1;
526
- const showActionMenu = !this.tempUploaderType && this.isCondensed && !hasSingleFileAction;
527
- const showFileInfo = !this.tempUploaderType && !this.isCondensed;
528
- // @ts-ignore it's possible progress is passed in as a string, so we need to check for "100" as well
529
- const showCheckmark = !this.tempUploaderType && (item.progress === 100 || item.progress === "100");
530
- return (index.h("li", { class: `${this.isCondensed ? "condensed" : ""} ${showCheckmark ? "checked" : ""}` }, index.h("div", { class: "file --saved" }, this.renderFileName(filename, this.isItemUploading(item)), index.h("div", { class: "right-group" }, showFileInfo && this.renderFileInfo(item), showActionMenu ? this.renderActionMenu(item) : this.renderFileActions(item)))));
531
- }
532
- handleFilenameMouseEnter(ev, filename) {
533
- // only show tooltip if file name is being truncated (has ellipses)
534
- if (ev.target.textContent.includes("...")) {
535
- this.showTooltip(ev.target, filename);
536
- }
537
- }
538
- componentDidRender() {
539
- const files = this.el.shadowRoot.querySelectorAll(".file");
540
- files.forEach((file) => this.truncateFileName(file));
541
- }
542
- truncateFileName(file) {
543
- const leftGroup = file.querySelector(".left-group");
544
- const leftBoundary = leftGroup.getBoundingClientRect().left;
545
- const rightGroup = file.querySelector(".right-group");
546
- const rightBoundary = rightGroup
547
- ? rightGroup.getBoundingClientRect().left
548
- : file.getBoundingClientRect().right - 20;
549
- const filenameEl = file.querySelector(".filename");
550
- const availableSpace = rightBoundary - leftBoundary;
551
- let filename = filenameEl.dataset.filename;
552
- const canFitText = availableSpace > filename.length * this.chMeasure;
553
- if (!canFitText) {
554
- const extension = filename.slice(filename.lastIndexOf("."));
555
- const numFittingCharacters = Math.floor(availableSpace / this.chMeasure);
556
- // three ellipses, three constant characters, extension
557
- const postEllipsesLength = 3 + 3 + extension.length;
558
- let preEllipsesLength = Math.max(2, numFittingCharacters - postEllipsesLength);
559
- const preEllipsesText = filename.slice(0, preEllipsesLength);
560
- const postEllipsesText = filename.slice(filename.indexOf(extension) - 3, filename.length);
561
- filename = `${preEllipsesText.trim()}...${postEllipsesText.trim()}`;
562
- }
563
- filenameEl.textContent = filename;
564
- }
565
- renderFileActions(item) {
566
- const defaultFileActions = "download delete";
567
- const availableActions = item.fileActions || defaultFileActions;
568
- const previewButton = (index.h("wm-button", { class: "preview-button", "button-type": "icononly", tooltip: "Preview", "tooltip-position": "bottom", "label-for-identical-buttons": `preview ${item.name}`, icon: "f208", onClick: () => this.previewFile(item) }));
569
- const downloadButton = (index.h("wm-button", { class: "download-button", "button-type": "icononly", tooltip: "Download", "tooltip-position": "bottom", "label-for-identical-buttons": `download ${item.name}`, icon: "f1da", onClick: () => this.downloadFile(item) }));
570
- const deleteButton = (index.h("wm-button", { class: "delete-button", "button-type": "icononly", tooltip: "Delete", "tooltip-position": "bottom", "label-for-identical-buttons": `delete ${item.name}`, icon: "f1c0", onClick: () => this.deleteFile(item) }));
571
- return (index.h("div", { class: "file-controls" }, availableActions.includes("preview") && previewButton, availableActions.includes("download") && downloadButton, availableActions.includes("delete") && deleteButton));
572
- }
573
- renderActionMenu(item) {
574
- const defaultFileActions = "download delete";
575
- const availableActions = item.fileActions || defaultFileActions;
576
- const previewItem = (index.h("wm-menuitem", { icon: "f208", onClick: () => this.previewFile(item) }, this.previewActionMessage));
577
- const downloadItem = (index.h("wm-menuitem", { icon: "f1da", onClick: () => this.downloadFile(item) }, this.downloadActionMessage));
578
- const deleteItem = (index.h("wm-menuitem", { icon: "f1c0", onClick: () => this.deleteFile(item) }, this.deleteActionMessage));
579
- return (index.h("wm-action-menu", { "action-menu-type": "icon", tooltip: this.actionMenuLabel, "tooltip-position": "bottom", "label-for-identical-buttons": `${item.name} ${this.actionMenuLabel}` }, availableActions.includes("preview") && previewItem, availableActions.includes("download") && downloadItem, availableActions.includes("delete") && deleteItem));
580
- }
581
- renderFileInfo(item) {
582
- let elementToRender = undefined;
583
- if (this.showInfo === "time") {
584
- const uploadDate = new Date(Date.parse(item.lastUpdated));
585
- const day = uploadDate.getDate();
586
- const month = uploadDate.getMonth() + 1;
587
- const year = uploadDate.getFullYear();
588
- const time = uploadDate.toLocaleTimeString("en-us", { hour: "numeric", minute: "2-digit" });
589
- const formattedDate = `${month}/${day}/${year} ${time}`;
590
- elementToRender = index.h("div", { class: "file-info" }, formattedDate);
591
- }
592
- else if (this.showInfo === "size" && item.size) {
593
- const convertedSize = this.convertBytes(item.size);
594
- elementToRender = index.h("div", { class: "file-info" }, `${convertedSize.size.toFixed(0)} ${convertedSize.unit}`);
595
- }
596
- return elementToRender;
597
- }
598
- renderFileList() {
599
- if (this.fileList) {
600
- this.sortBy === "name"
601
- ? this.fileList.sort((a, b) => a.name.localeCompare(b.name))
602
- : this.fileList.sort((a, b) => Date.parse(a.lastUpdated) - Date.parse(b.lastUpdated));
603
- return (index.h("div", null, index.h("ul", { class: "inprogress-list" }, this.fileList.filter((item) => this.isItemUploading(item)).map((item) => this.renderFileInProgress(item))), index.h("ul", { class: "file-list" }, this.fileList.filter((item) => !this.isItemUploading(item)).map((item) => this.renderFile(item)))));
604
- }
605
- }
606
- legacyRenderHeader() {
607
- return (index.h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, index.h("div", { class: "slot-wrapper" }, index.h("slot", null), index.h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderNotif()))));
608
- }
609
- renderHeader() {
610
- return (index.h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, index.h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderRequirements()), index.h("div", { id: "accepted-types", class: "accepted-types" }, this.acceptedFileTypesMessage), this.renderNotif()));
611
- }
612
- renderRequirements() {
613
- return (index.h("div", { class: "requirements" }, this.maxFiles && index.h("span", { id: "file-count" }, this.fileCountMessage), this.maxSize && index.h("span", { id: "max-size" }, this.maxSizeMessage)));
614
- }
615
- renderFooter() {
616
- return (index.h("div", { class: "footer" }, index.h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, index.h("div", { class: "filecount-wrapper" }, index.h("div", { class: "filecount" }, functions.intl.formatMessage({
617
- id: "uploader.filesAdded",
618
- defaultMessage: "{numFiles, plural, one {1 file added} other {# files added}}",
619
- }, { numFiles: this.fileList.length })), this.renderUploadButton(`-primary ${this.isDisabled ? "disabled" : ""}`)), this.renderNotif())));
620
- }
621
- renderWithItems() {
622
- // it's possible progress is passed in as a string, so we need to check for "100" as well
623
- const hasNewlyUploadedFiles = this.fileList.filter((file) => file.progress === (typeof file.progress === "number" ? 100 : "100")).length > 0;
624
- return (index.h("div", null, !this.tempUploaderType && this.renderHeader(), this.tempUploaderType === "2" && this.legacyRenderHeader(), index.h("div", { class: `list-container type${this.tempUploaderType} ${!this.tempUploaderType && hasNewlyUploadedFiles ? "checkmark-spacer" : ""}` }, this.renderErrorList(), this.renderFileList()), this.tempUploaderType === "1" && this.renderFooter()));
625
- }
626
- render() {
627
- return (index.h(index.Host, null, this.isEmpty() && this.tempUploaderType === "1" ? this.renderEmptyState() : this.renderWithItems(), index.h("div", { ref: (el) => (this.liveRegion = el), class: "live-region sr-only", "aria-live": "assertive" // since it's directly linked to the action the user took, it should be read in priority. With polite, some messages get dismissed in favor of the page title
628
- ,
629
- "aria-atomic": "true" })));
630
- }
631
- get el() { return index.getElement(this); }
632
- static get watchers() { return {
633
- "files": ["parseFiles"],
634
- "rejectedFiles": ["parseRejectedFiles"],
635
- "numFilesInProgress": ["uploadNotifications"]
636
- }; }
637
- };
10
+ const Uploader = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.wmUploaderFilesSelected = index.createEvent(this, "wmUploaderFilesSelected", 7);
14
+ this.wmFilesSelected = index.createEvent(this, "wmFilesSelected", 7);
15
+ this.wmUploaderDeleteFile = index.createEvent(this, "wmUploaderDeleteFile", 7);
16
+ this.wmDeleteFile = index.createEvent(this, "wmDeleteFile", 7);
17
+ this.wmUploaderDownloadFile = index.createEvent(this, "wmUploaderDownloadFile", 7);
18
+ this.wmDownloadFile = index.createEvent(this, "wmDownloadFile", 7);
19
+ this.wmUploaderPreviewFile = index.createEvent(this, "wmUploaderPreviewFile", 7);
20
+ this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
21
+ this.sortBy = "date"; // name is descending (a -> z), date is ascending (earlier -> later)
22
+ this.showInfo = "time";
23
+ this.fileList = []; // the string above transformed into the actual array
24
+ this.filesToUpload = []; // input.files that passed validation
25
+ this.isTabbing = false;
26
+ this.errorList = []; // for errors on a particular file
27
+ this.announcement = "";
28
+ this.isCondensed = false;
29
+ this.inputId = functions.generateId();
30
+ this.debouncedResize = functions.debounce(() => {
31
+ this.isCondensed = this.el.clientWidth < 500;
32
+ // rerender to show filename truncation changes
33
+ index.forceUpdate(this.el);
34
+ }, 50);
35
+ }
36
+ get tooltipEl() {
37
+ return document.getElementById("wm-tooltip");
38
+ }
39
+ get uploadButtonEl() {
40
+ return this.el.shadowRoot.querySelector(`#${this.inputId}`);
41
+ }
42
+ get tempUploaderType() {
43
+ // replace instances of this.tempUploaderType with this.uploaderType once type is fully phased out
44
+ return this.type || this.uploaderType;
45
+ }
46
+ get effectiveMaxSize() {
47
+ const defaultMaxSize = 100;
48
+ // maxsize cannot be set to over 100Mb
49
+ const maxSizeLimit = 100;
50
+ return this.maxSize ? Math.min(this.maxSize, maxSizeLimit) : defaultMaxSize;
51
+ }
52
+ get chMeasure() {
53
+ return this.el.shadowRoot.querySelector(".ch-measure").clientWidth;
54
+ }
55
+ get fileLimitReached() {
56
+ return this.maxFiles && this.fileList.length >= this.maxFiles;
57
+ }
58
+ get fileLimitExceededMessage() {
59
+ return functions.intl.formatMessage({
60
+ id: "uploader.fileUploadLimitExceeded",
61
+ defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
62
+ description: "Message displayed when trying to upload too many files",
63
+ });
64
+ }
65
+ get fileLimitReachedMessage() {
66
+ return functions.intl.formatMessage({
67
+ id: "uploader.fileUploadLimitReached",
68
+ defaultMessage: "The maximum number of files has been reached",
69
+ description: "Message displayed when trying to upload additional files, but the limit has been reached",
70
+ });
71
+ }
72
+ get fileCountMessage() {
73
+ return functions.intl.formatMessage({
74
+ id: "uploader.fileCount",
75
+ defaultMessage: "{x} of {y} Files",
76
+ description: "A count of the number of files currently uploaded",
77
+ }, { x: this.fileList.length, y: this.maxFiles });
78
+ }
79
+ get maxSizeMessage() {
80
+ return functions.intl.formatMessage({
81
+ id: "uploader.maxSize",
82
+ defaultMessage: "Maximum file size {maxSize}MB",
83
+ description: "An indicator of the maximum file size the uploader allows",
84
+ }, {
85
+ maxSize: this.effectiveMaxSize,
86
+ });
87
+ }
88
+ get acceptedFileTypesMessage() {
89
+ const validTypes = "." + this.fileTypes.split(" ").join(", .");
90
+ return functions.intl.formatMessage({
91
+ id: "uploader.acceptedFileTypes",
92
+ defaultMessage: "Accepted file {amount, plural, =1 {type} other {types}}: {fileTypes}",
93
+ }, {
94
+ fileTypes: validTypes,
95
+ amount: this.fileTypes.split(" ").length,
96
+ });
97
+ }
98
+ get previewActionMessage() {
99
+ return functions.intl.formatMessage({
100
+ id: "uploader.previewAction",
101
+ defaultMessage: "Preview File",
102
+ description: "Label of a button that triggers a file to be previewed",
103
+ });
104
+ }
105
+ get downloadActionMessage() {
106
+ return functions.intl.formatMessage({
107
+ id: "uploader.downloadAction",
108
+ defaultMessage: "Download File",
109
+ description: "Label of a button that triggers a file to be downloaded",
110
+ });
111
+ }
112
+ get deleteActionMessage() {
113
+ return functions.intl.formatMessage({
114
+ id: "uploader.deleteAction",
115
+ defaultMessage: "Delete File",
116
+ description: "Label of a button that triggers a file to be delete",
117
+ });
118
+ }
119
+ get clearButtonText() {
120
+ return functions.intl.formatMessage({
121
+ id: "uploader.clearErrorText",
122
+ defaultMessage: "Clear",
123
+ description: "Text for a button used to clear an error",
124
+ });
125
+ }
126
+ get actionMenuLabel() {
127
+ return functions.intl.formatMessage({
128
+ id: "uploader.actionMenuLabel",
129
+ defaultMessage: "Actions",
130
+ description: "Label of a button that opens a menu of file actions",
131
+ });
132
+ }
133
+ toggleTabbingOn() {
134
+ this.isTabbing = true;
135
+ }
136
+ toggleTabbingOff() {
137
+ this.isTabbing = false;
138
+ }
139
+ handleUploadProgress(ev) {
140
+ this.fileList.map((i) => {
141
+ if (i.id === ev.detail.id) {
142
+ i.progress = ev.detail.progress;
143
+ index.forceUpdate(this.el);
144
+ }
145
+ });
146
+ if (ev.detail.progress === 100) {
147
+ // inProgressList is not a perfect reflection of how many files are uploading
148
+ // because even after progress reached 100% the item should remain in the array
149
+ // (should only be removed once it appears in fileList)
150
+ this.numFilesInProgress -= 1;
151
+ }
152
+ // aggregate the percentages for SR to announce progress
153
+ if (!this.srProgress && this.numFilesInProgress) {
154
+ const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
155
+ this.srProgress = setInterval(() => {
156
+ const aggregate = this.fileList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
157
+ this.announce(functions.intl.formatMessage({
158
+ id: "uploader.uploadProgress",
159
+ defaultMessage: "Upload progress: {percentage}%",
160
+ }, { percentage: Math.floor(aggregate / total) }));
161
+ }, 5000);
162
+ }
163
+ }
164
+ parseFiles() {
165
+ if (!!this.files) {
166
+ if (typeof this.files === "string") {
167
+ const list = JSON.parse(this.files);
168
+ if (typeof list === "object") {
169
+ this.fileList = list;
170
+ }
171
+ else {
172
+ throw new Error("could not parse string passed to files attribute");
173
+ }
174
+ }
175
+ else {
176
+ throw new Error("Attribute 'files' should be a string");
177
+ }
178
+ }
179
+ }
180
+ parseRejectedFiles() {
181
+ if (!!this.rejectedFiles) {
182
+ if (typeof this.files === "string") {
183
+ const list = JSON.parse(this.rejectedFiles);
184
+ if (typeof list === "object") {
185
+ this.errorList = list;
186
+ }
187
+ else {
188
+ throw new Error("could not parse string passed to errors attribute");
189
+ }
190
+ }
191
+ else {
192
+ throw new Error("Attribute 'rejected-files' should be a string");
193
+ }
194
+ }
195
+ }
196
+ uploadNotifications(newNum, oldNum) {
197
+ if (oldNum > 0 && newNum === 0) {
198
+ setTimeout(() => {
199
+ this.notif = null;
200
+ }, 20 * 1000);
201
+ const message = functions.intl.formatMessage({
202
+ id: "uploader.finishedUploading",
203
+ defaultMessage: "Finished uploading",
204
+ });
205
+ this.notif = { message, isError: false };
206
+ this.announce(message);
207
+ this.numFilesInProgress = null;
208
+ clearInterval(this.srProgress);
209
+ index.forceUpdate(this.el);
210
+ }
211
+ else if (newNum > 0 && newNum != oldNum) {
212
+ const message = functions.intl.formatMessage({
213
+ id: "uploader.filesUploading",
214
+ defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
215
+ }, { num: newNum });
216
+ this.notif = { message, isError: false };
217
+ this.announce(message);
218
+ index.forceUpdate(this.el);
219
+ }
220
+ }
221
+ isValidSize(size) {
222
+ return this.convertBytes(size, "MB").size <= this.effectiveMaxSize;
223
+ }
224
+ convertBytes(bytes, unit) {
225
+ // https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
226
+ const unitOrder = ["bytes", "KB", "MB", "GB", "TB"];
227
+ let unitIndex = 0;
228
+ let result = typeof bytes === "number" ? bytes : parseInt(bytes);
229
+ if (unit) {
230
+ // convert until result matches desired unit
231
+ while (unitOrder.indexOf(unit) > unitIndex) {
232
+ result /= 1024;
233
+ unitIndex++;
234
+ }
235
+ }
236
+ else {
237
+ // convert until result is appropriate unit (value is under 1000)
238
+ while (result > 1000) {
239
+ result /= 1024;
240
+ unitIndex++;
241
+ }
242
+ }
243
+ return { size: result, unit: unitOrder[unitIndex] };
244
+ }
245
+ isDuplicate(name) {
246
+ return this.fileList.find((f) => {
247
+ const filename = f.type ? f.name + "." + f.type : f.name;
248
+ return filename === name;
249
+ });
250
+ }
251
+ isEmpty() {
252
+ return !this.fileList.length && !this.errorList.length;
253
+ }
254
+ get isDisabled() {
255
+ // disable if is the uploader is maxed out or if something is uploading
256
+ return this.fileLimitReached || this.numFilesInProgress > 0;
257
+ }
258
+ isItemUploading(item) {
259
+ return item.hasOwnProperty("progress") && item.progress < 100;
260
+ }
261
+ announce(message) {
262
+ if (this.liveRegion.textContent === message) {
263
+ message += "\u00A0";
264
+ }
265
+ this.announcement = message;
266
+ }
267
+ clearError(filename) {
268
+ this.errorList = this.errorList.filter((error) => error.name != filename);
269
+ this.notif = null;
270
+ }
271
+ clearErrors() {
272
+ this.errorList = [];
273
+ this.notif = null;
274
+ }
275
+ handleFiles(ev) {
276
+ this.filesToUpload = [];
277
+ const validTypes = this.fileTypes.split(" ").join(", ");
278
+ const files = Array.from(ev.target.files);
279
+ if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
280
+ const errMessage = this.fileLimitExceededMessage;
281
+ this.notif = { message: errMessage, isError: true };
282
+ this.announce(errMessage);
283
+ }
284
+ else {
285
+ files &&
286
+ files.map((file) => {
287
+ if (!functions.hasValidType(file, this.fileTypes)) {
288
+ const error = {
289
+ name: file.name,
290
+ message: functions.intl.formatMessage({
291
+ id: "uploader.invalidFileType",
292
+ defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
293
+ }, { validTypes }),
294
+ };
295
+ this.errorList.push(error);
296
+ }
297
+ else if (file.size === 0) {
298
+ const error = {
299
+ name: file.name,
300
+ message: functions.intl.formatMessage({
301
+ id: "uploader.zeroFileSize",
302
+ defaultMessage: "The file must be more than 0 bytes",
303
+ description: "Error message when user attempts to upload a file of no size",
304
+ }),
305
+ };
306
+ this.errorList.push(error);
307
+ }
308
+ else if (!this.isValidSize(file.size)) {
309
+ const error = {
310
+ name: file.name,
311
+ message: functions.intl.formatMessage({
312
+ id: "uploader.fileTooLarge",
313
+ defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
314
+ }, { size: this.effectiveMaxSize }),
315
+ };
316
+ this.errorList.push(error);
317
+ }
318
+ else if (this.isDuplicate(file.name)) {
319
+ const error = {
320
+ name: file.name,
321
+ message: functions.intl.formatMessage({
322
+ id: "uploader.duplicateName",
323
+ defaultMessage: "A file with this name already exists.",
324
+ }),
325
+ };
326
+ this.errorList.push(error);
327
+ }
328
+ else {
329
+ this.filesToUpload.push(file);
330
+ }
331
+ });
332
+ if (this.filesToUpload.length > 0) {
333
+ this.numFilesInProgress = this.filesToUpload.length;
334
+ this.wmUploaderFilesSelected.emit(this.filesToUpload);
335
+ this.wmFilesSelected.emit(this.filesToUpload); // deprecated
336
+ }
337
+ }
338
+ ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
339
+ }
340
+ previewFile(file) {
341
+ this.clearErrors();
342
+ this.wmUploaderPreviewFile.emit(file.id);
343
+ }
344
+ downloadFile(file) {
345
+ this.clearErrors();
346
+ this.wmUploaderDownloadFile.emit(file.id);
347
+ this.wmDownloadFile.emit(file.id); // deprecated
348
+ }
349
+ deleteFile(file) {
350
+ this.clearErrors();
351
+ index.forceUpdate(this.el); // for the button to stop being disabled if num files become < max-files
352
+ this.wmUploaderDeleteFile.emit(file.id);
353
+ this.wmDeleteFile.emit(file.id); // deprecated
354
+ }
355
+ componentWillLoad() {
356
+ if (!this.buttonText) {
357
+ throw new Error("wm-uploader: button-text is a required prop");
358
+ }
359
+ if (this.type) {
360
+ console.warn("wm-uploader: type has been deprecated as of v3.1.0. Please use uploader-type instead.");
361
+ }
362
+ if (this.tempUploaderType === "1" && !this.emptyStateText) {
363
+ throw new Error("wm-uploader: empty-state-text is a required prop");
364
+ }
365
+ // rerender on resize in case layout needs to change
366
+ const resizeObserver = new ResizeObserver(() => this.debouncedResize());
367
+ resizeObserver.observe(this.el);
368
+ this.parseFiles();
369
+ this.clearErrors();
370
+ this.parseRejectedFiles();
371
+ }
372
+ componentDidLoad() {
373
+ if (document.body.classList.contains("wmcl-user-is-tabbing")) {
374
+ this.toggleTabbingOn();
375
+ }
376
+ }
377
+ showTooltip(anchorEl, tooltipText) {
378
+ this.tooltipEl.textContent = tooltipText;
379
+ this.positionTooltip("bottom", anchorEl, this.tooltipEl);
380
+ this.tooltipEl.style.transitionDelay = "500ms";
381
+ this.tooltipEl.style.opacity = "1";
382
+ }
383
+ hideTooltip() {
384
+ this.tooltipEl.style.transitionDelay = "0s";
385
+ this.tooltipEl.style.opacity = "0";
386
+ }
387
+ positionTooltip(tPos, anchorEl, tooltipEl) {
388
+ const tooltipHeight = tooltipEl.getBoundingClientRect().height;
389
+ const tooltipWidth = tooltipEl.getBoundingClientRect().width;
390
+ // to get the center positions, calculate the difference between the button width and the tooltip width
391
+ const verticalDiff = (anchorEl.getBoundingClientRect().height - tooltipHeight) / 2;
392
+ const horizontalDiff = (anchorEl.getBoundingClientRect().width - tooltipWidth) / 2;
393
+ // the naming convention defaults to center in the absence of a value
394
+ // "top" and "bottom" imply centering horizontally; "right" and "left" imply centering vertically
395
+ // therefore we first set to center and adjust accordingly
396
+ let verticalPos = anchorEl.getBoundingClientRect().top + verticalDiff;
397
+ let horizontalPos = anchorEl.getBoundingClientRect().left + horizontalDiff;
398
+ if (tPos.includes("top")) {
399
+ verticalPos = anchorEl.getBoundingClientRect().top - tooltipHeight - 8;
400
+ }
401
+ if (tPos.includes("bottom")) {
402
+ verticalPos = anchorEl.getBoundingClientRect().bottom + 8;
403
+ }
404
+ if (tPos.includes("left")) {
405
+ horizontalPos = anchorEl.getBoundingClientRect().left - tooltipWidth - 8;
406
+ }
407
+ if (tPos.includes("right")) {
408
+ horizontalPos = anchorEl.getBoundingClientRect().right + 8;
409
+ }
410
+ // after all positioning has been calculated, if tooltip is off-screen or closer than 24px it is readjusted
411
+ // this only occurs when the tooltip is overflowing to the left and is positioned top or bottom
412
+ // (button placed too far left, or screen size under 268px)
413
+ horizontalPos = Math.max(horizontalPos, 24);
414
+ tooltipEl.style.top = (verticalPos / 16).toString() + "rem";
415
+ tooltipEl.style.left = (horizontalPos / 16).toString() + "rem";
416
+ }
417
+ uploadButtonOnClick(ev) {
418
+ if (this.isDisabled) {
419
+ // this is a temporary fix.
420
+ // we need the disabled button to be programmatically focusable
421
+ // to allow return focus after closing the browser file panel
422
+ // since it's focusable the button should respond when activated
423
+ // it looks disabled, and announces the reason why the action cannot
424
+ // be taken when activated.
425
+ ev.preventDefault();
426
+ if (this.numFilesInProgress > 0) {
427
+ const srMsg = functions.intl.formatMessage({
428
+ id: "uploader.waitToUpload",
429
+ defaultMessage: "Please wait for current upload to complete before uploading new files.",
430
+ description: "Message for screen reader users",
431
+ });
432
+ this.announce(srMsg);
433
+ }
434
+ else if (this.fileLimitReached) {
435
+ const srMsg = this.fileLimitReachedMessage;
436
+ const notif = { message: srMsg, isError: true };
437
+ this.notif = notif;
438
+ this.announce(srMsg);
439
+ }
440
+ }
441
+ else {
442
+ this.clearErrors();
443
+ }
444
+ }
445
+ renderUploadSvg() {
446
+ return (index.h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" }, index.h("path", { transform: "rotate(-180.000000) translate(-452, -255.5)", fill: "#eae8ec", d: "M361,249.681818 L361,197.318182 C361,194.118182 365.555061,191.5 371.122358,191.5 L391.316463,191.5 L391.286495,200.562515 L369.871211,200.600292 L369.885404,200.622146 L369.886423,246.655947 L443.657038,246.840767 L443.657038,200.622146 L421.683537,200.622146 L421.683537,191.5 L441.978865,191.5 C447.546162,191.5 452,194.118182 452,197.318182 L452,249.681818 C452,252.881818 447.546162,255.5 441.978865,255.5 L371.122358,255.5 C365.504449,255.5 361,252.881818 361,249.681818 Z M391.5,207 L406,221 L420.5,207 L409.625,207 L409.625,172 L402.375,172 L402.375,207 L391.5,207 Z" })));
447
+ }
448
+ renderIcon() {
449
+ // mdi attachment icon (paper clip) is horizontal but we want it vertical
450
+ const rotate = this.icon && this.icon === "f066";
451
+ return (this.icon && (index.h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
452
+ }
453
+ renderInfo() {
454
+ return this.info && this.tempUploaderType === "2" ? index.h("span", { class: "info" }, this.info) : "";
455
+ }
456
+ renderNotif() {
457
+ return this.notif ? index.h("div", { class: `notif ${this.notif.isError ? "error" : ""}` }, this.notif.message) : "";
458
+ }
459
+ renderUploadButton(classes) {
460
+ return (index.h("div", { class: "info-wrapper" }, index.h("input", { name: this.inputId, id: this.inputId, class: "sr-only", "aria-describedby": "file-count max-size accepted-types", type: "file", multiple: true, onClick: (ev) => this.uploadButtonOnClick(ev), onChange: (ev) => this.handleFiles(ev) }), index.h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` }, this.renderIcon(), this.buttonText), this.renderInfo()));
461
+ }
462
+ renderEmptyState() {
463
+ return (index.h("div", { class: "empty-block" }, this.renderUploadSvg(), index.h("div", { class: `empty-message` }, this.emptyStateText), this.renderUploadButton("-primary empty-button"), this.renderNotif()));
464
+ }
465
+ renderFileName(filename, isUploading) {
466
+ return (index.h("div", { class: "left-group" }, index.h("div", { class: "name-wrapper" }, index.h("span", { class: "filename", "data-filename": filename, onMouseEnter: (ev) => this.handleFilenameMouseEnter(ev, filename), onMouseLeave: () => this.hideTooltip() }), isUploading && index.h("span", { class: "sr-only" }, "uploading"), index.h("div", { class: "sr-only ch-measure" }))));
467
+ }
468
+ renderErrorList() {
469
+ if (!!this.errorList.length) {
470
+ let srMessage = this.errorList.reduce(function (acc, err) {
471
+ return acc + `${err.name}: ${err.message} `;
472
+ }, "");
473
+ this.announce(srMessage);
474
+ return (index.h("ul", { class: "error-list" }, this.errorList.map((err) => {
475
+ const clearButtonLabel = functions.intl.formatMessage({
476
+ id: "uploader.clearErrorLabel",
477
+ defaultMessage: "Clear {fileName} error",
478
+ description: "Label for a button used to clear an error, including filename",
479
+ }, { fileName: err.name });
480
+ return (index.h("li", null, index.h("div", { class: "file --error" }, this.renderFileName(err.name, false), index.h("wm-button", { "permanently-delete": true, "button-type": "textonly", "label-for-identical-buttons": clearButtonLabel, onClick: () => {
481
+ this.clearError(err.name);
482
+ this.uploadButtonEl.focus();
483
+ } }, this.clearButtonText)), index.h("div", { class: "error-message" }, err.message)));
484
+ })));
485
+ }
486
+ }
487
+ renderFileInProgress(item) {
488
+ const filename = item.type ? `${item.name}.${item.type}` : item.name;
489
+ return (index.h("li", null, index.h("div", { class: "file --progress" }, index.h("div", { class: "progress", style: {
490
+ background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
491
+ } }), this.renderFileName(filename, this.isItemUploading(item)))));
492
+ }
493
+ renderFile(item) {
494
+ const filename = item.type ? `${item.name}.${item.type}` : item.name;
495
+ const hasSingleFileAction = item.fileActions && item.fileActions.split(" ").length === 1;
496
+ const showActionMenu = !this.tempUploaderType && this.isCondensed && !hasSingleFileAction;
497
+ const showFileInfo = !this.tempUploaderType && !this.isCondensed;
498
+ // @ts-ignore it's possible progress is passed in as a string, so we need to check for "100" as well
499
+ const showCheckmark = !this.tempUploaderType && (item.progress === 100 || item.progress === "100");
500
+ return (index.h("li", { class: `${this.isCondensed ? "condensed" : ""} ${showCheckmark ? "checked" : ""}` }, index.h("div", { class: "file --saved" }, this.renderFileName(filename, this.isItemUploading(item)), index.h("div", { class: "right-group" }, showFileInfo && this.renderFileInfo(item), showActionMenu ? this.renderActionMenu(item) : this.renderFileActions(item)))));
501
+ }
502
+ handleFilenameMouseEnter(ev, filename) {
503
+ // only show tooltip if file name is being truncated (has ellipses)
504
+ if (ev.target.textContent.includes("...")) {
505
+ this.showTooltip(ev.target, filename);
506
+ }
507
+ }
508
+ componentDidRender() {
509
+ const files = this.el.shadowRoot.querySelectorAll(".file");
510
+ files.forEach((file) => this.truncateFileName(file));
511
+ }
512
+ truncateFileName(file) {
513
+ const leftGroup = file.querySelector(".left-group");
514
+ const leftBoundary = leftGroup.getBoundingClientRect().left;
515
+ const rightGroup = file.querySelector(".right-group");
516
+ const rightBoundary = rightGroup
517
+ ? rightGroup.getBoundingClientRect().left
518
+ : file.getBoundingClientRect().right - 20;
519
+ const filenameEl = file.querySelector(".filename");
520
+ const availableSpace = rightBoundary - leftBoundary;
521
+ let filename = filenameEl.dataset.filename;
522
+ const canFitText = availableSpace > filename.length * this.chMeasure;
523
+ if (!canFitText) {
524
+ const extension = filename.slice(filename.lastIndexOf("."));
525
+ const numFittingCharacters = Math.floor(availableSpace / this.chMeasure);
526
+ // three ellipses, three constant characters, extension
527
+ const postEllipsesLength = 3 + 3 + extension.length;
528
+ let preEllipsesLength = Math.max(2, numFittingCharacters - postEllipsesLength);
529
+ const preEllipsesText = filename.slice(0, preEllipsesLength);
530
+ const postEllipsesText = filename.slice(filename.indexOf(extension) - 3, filename.length);
531
+ filename = `${preEllipsesText.trim()}...${postEllipsesText.trim()}`;
532
+ }
533
+ filenameEl.textContent = filename;
534
+ }
535
+ renderFileActions(item) {
536
+ const defaultFileActions = "download delete";
537
+ const availableActions = item.fileActions || defaultFileActions;
538
+ const previewButton = (index.h("wm-button", { class: "preview-button", "button-type": "icononly", tooltip: "Preview", "tooltip-position": "bottom", "label-for-identical-buttons": `preview ${item.name}`, icon: "f208", onClick: () => this.previewFile(item) }));
539
+ const downloadButton = (index.h("wm-button", { class: "download-button", "button-type": "icononly", tooltip: "Download", "tooltip-position": "bottom", "label-for-identical-buttons": `download ${item.name}`, icon: "f1da", onClick: () => this.downloadFile(item) }));
540
+ const deleteButton = (index.h("wm-button", { class: "delete-button", "button-type": "icononly", tooltip: "Delete", "tooltip-position": "bottom", "label-for-identical-buttons": `delete ${item.name}`, icon: "f1c0", onClick: () => this.deleteFile(item) }));
541
+ return (index.h("div", { class: "file-controls" }, availableActions.includes("preview") && previewButton, availableActions.includes("download") && downloadButton, availableActions.includes("delete") && deleteButton));
542
+ }
543
+ renderActionMenu(item) {
544
+ const defaultFileActions = "download delete";
545
+ const availableActions = item.fileActions || defaultFileActions;
546
+ const previewItem = (index.h("wm-menuitem", { icon: "f208", onClick: () => this.previewFile(item) }, this.previewActionMessage));
547
+ const downloadItem = (index.h("wm-menuitem", { icon: "f1da", onClick: () => this.downloadFile(item) }, this.downloadActionMessage));
548
+ const deleteItem = (index.h("wm-menuitem", { icon: "f1c0", onClick: () => this.deleteFile(item) }, this.deleteActionMessage));
549
+ return (index.h("wm-action-menu", { "action-menu-type": "icon", tooltip: this.actionMenuLabel, "tooltip-position": "bottom", "label-for-identical-buttons": `${item.name} ${this.actionMenuLabel}` }, availableActions.includes("preview") && previewItem, availableActions.includes("download") && downloadItem, availableActions.includes("delete") && deleteItem));
550
+ }
551
+ renderFileInfo(item) {
552
+ let elementToRender = undefined;
553
+ if (this.showInfo === "time") {
554
+ const uploadDate = new Date(Date.parse(item.lastUpdated));
555
+ const day = uploadDate.getDate();
556
+ const month = uploadDate.getMonth() + 1;
557
+ const year = uploadDate.getFullYear();
558
+ const time = uploadDate.toLocaleTimeString("en-us", { hour: "numeric", minute: "2-digit" });
559
+ const formattedDate = `${month}/${day}/${year} ${time}`;
560
+ elementToRender = index.h("div", { class: "file-info" }, formattedDate);
561
+ }
562
+ else if (this.showInfo === "size" && item.size) {
563
+ const convertedSize = this.convertBytes(item.size);
564
+ elementToRender = index.h("div", { class: "file-info" }, `${convertedSize.size.toFixed(0)} ${convertedSize.unit}`);
565
+ }
566
+ return elementToRender;
567
+ }
568
+ renderFileList() {
569
+ if (this.fileList) {
570
+ this.sortBy === "name"
571
+ ? this.fileList.sort((a, b) => a.name.localeCompare(b.name))
572
+ : this.fileList.sort((a, b) => Date.parse(a.lastUpdated) - Date.parse(b.lastUpdated));
573
+ return (index.h("div", null, index.h("ul", { class: "inprogress-list" }, this.fileList.filter((item) => this.isItemUploading(item)).map((item) => this.renderFileInProgress(item))), index.h("ul", { class: "file-list" }, this.fileList.filter((item) => !this.isItemUploading(item)).map((item) => this.renderFile(item)))));
574
+ }
575
+ }
576
+ legacyRenderHeader() {
577
+ return (index.h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, index.h("div", { class: "slot-wrapper" }, index.h("slot", null), index.h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderNotif()))));
578
+ }
579
+ renderHeader() {
580
+ return (index.h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, index.h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderRequirements()), index.h("div", { id: "accepted-types", class: "accepted-types" }, this.acceptedFileTypesMessage), this.renderNotif()));
581
+ }
582
+ renderRequirements() {
583
+ return (index.h("div", { class: "requirements" }, this.maxFiles && index.h("span", { id: "file-count" }, this.fileCountMessage), this.maxSize && index.h("span", { id: "max-size" }, this.maxSizeMessage)));
584
+ }
585
+ renderFooter() {
586
+ return (index.h("div", { class: "footer" }, index.h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, index.h("div", { class: "filecount-wrapper" }, index.h("div", { class: "filecount" }, functions.intl.formatMessage({
587
+ id: "uploader.filesAdded",
588
+ defaultMessage: "{numFiles, plural, one {1 file added} other {# files added}}",
589
+ }, { numFiles: this.fileList.length })), this.renderUploadButton(`-primary ${this.isDisabled ? "disabled" : ""}`)), this.renderNotif())));
590
+ }
591
+ renderWithItems() {
592
+ // it's possible progress is passed in as a string, so we need to check for "100" as well
593
+ const hasNewlyUploadedFiles = this.fileList.filter((file) => file.progress === (typeof file.progress === "number" ? 100 : "100")).length > 0;
594
+ return (index.h("div", null, !this.tempUploaderType && this.renderHeader(), this.tempUploaderType === "2" && this.legacyRenderHeader(), index.h("div", { class: `list-container type${this.tempUploaderType} ${!this.tempUploaderType && hasNewlyUploadedFiles ? "checkmark-spacer" : ""}` }, this.renderErrorList(), this.renderFileList()), this.tempUploaderType === "1" && this.renderFooter()));
595
+ }
596
+ render() {
597
+ return (index.h(index.Host, null, this.isEmpty() && this.tempUploaderType === "1" ? this.renderEmptyState() : this.renderWithItems(), index.h("div", { ref: (el) => (this.liveRegion = el), class: "live-region sr-only", "aria-live": "assertive" // since it's directly linked to the action the user took, it should be read in priority. With polite, some messages get dismissed in favor of the page title
598
+ ,
599
+ "aria-atomic": "true" }, this.announcement)));
600
+ }
601
+ get el() { return index.getElement(this); }
602
+ static get watchers() { return {
603
+ "files": ["parseFiles"],
604
+ "rejectedFiles": ["parseRejectedFiles"],
605
+ "numFilesInProgress": ["uploadNotifications"]
606
+ }; }
607
+ };
638
608
  Uploader.style = wmUploaderCss;
639
609
 
640
610
  exports.wm_uploader = Uploader;