@watermarkinsights/ripple 3.16.0 → 3.17.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{chartFunctions-45d38ae4.js → chartFunctions-0c02a801.js} +425 -421
  3. package/dist/cjs/{functions-23309c38.js → functions-cb39693a.js} +483 -483
  4. package/dist/cjs/{global-5260837d.js → global-4e97582e.js} +62 -62
  5. package/dist/cjs/{http-service-9e8c4dd5.js → http-service-494d81de.js} +49 -49
  6. package/dist/cjs/{interfaces-30a74c1f.js → interfaces-a3338581.js} +29 -29
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/priv-chart-popover.cjs.entry.js +86 -86
  9. package/dist/cjs/priv-datepicker.cjs.entry.js +657 -657
  10. package/dist/cjs/priv-navigator-button.cjs.entry.js +18 -18
  11. package/dist/cjs/priv-navigator-item.cjs.entry.js +23 -23
  12. package/dist/cjs/ripple.cjs.js +2 -2
  13. package/dist/cjs/wm-action-menu_2.cjs.entry.js +329 -329
  14. package/dist/cjs/wm-button.cjs.entry.js +248 -248
  15. package/dist/cjs/wm-chart-slice.cjs.entry.js +13 -13
  16. package/dist/cjs/wm-chart.cjs.entry.js +111 -111
  17. package/dist/cjs/wm-datepicker.cjs.entry.js +265 -265
  18. package/dist/cjs/wm-input.cjs.entry.js +134 -134
  19. package/dist/cjs/wm-modal-footer.cjs.entry.js +33 -33
  20. package/dist/cjs/wm-modal-header.cjs.entry.js +36 -36
  21. package/dist/cjs/wm-modal.cjs.entry.js +163 -163
  22. package/dist/cjs/wm-navigation_3.cjs.entry.js +227 -227
  23. package/dist/cjs/wm-navigator.cjs.entry.js +268 -268
  24. package/dist/cjs/wm-network-uploader.cjs.entry.js +455 -455
  25. package/dist/cjs/wm-option_2.cjs.entry.js +720 -720
  26. package/dist/cjs/wm-pagination.cjs.entry.js +167 -167
  27. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +139 -131
  28. package/dist/cjs/wm-search.cjs.entry.js +232 -232
  29. package/dist/cjs/wm-snackbar.cjs.entry.js +170 -170
  30. package/dist/cjs/wm-tab-item_3.cjs.entry.js +296 -296
  31. package/dist/cjs/wm-tag-input-row.cjs.entry.js +10 -10
  32. package/dist/cjs/wm-tag-input.cjs.entry.js +884 -884
  33. package/dist/cjs/wm-timepicker.cjs.entry.js +383 -383
  34. package/dist/cjs/wm-toggletip.cjs.entry.js +124 -124
  35. package/dist/cjs/wm-uploader.cjs.entry.js +556 -556
  36. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  37. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +258 -258
  38. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +115 -115
  39. package/dist/collection/components/charts/wm-chart/wm-chart.css +81 -84
  40. package/dist/collection/components/charts/wm-chart/wm-chart.js +328 -328
  41. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.css +81 -84
  42. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +194 -195
  43. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.css +86 -0
  44. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +117 -88
  45. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +111 -111
  46. package/dist/collection/components/wm-action-menu/wm-action-menu.js +442 -442
  47. package/dist/collection/components/wm-button/wm-button.js +545 -545
  48. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1024 -1024
  49. package/dist/collection/components/wm-datepicker/wm-datepicker.js +471 -471
  50. package/dist/collection/components/wm-input/wm-input.js +423 -423
  51. package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
  52. package/dist/collection/components/wm-modal/wm-modal-footer.js +136 -136
  53. package/dist/collection/components/wm-modal/wm-modal-header.js +87 -87
  54. package/dist/collection/components/wm-modal/wm-modal.js +461 -461
  55. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +162 -162
  56. package/dist/collection/components/wm-navigation/wm-navigation-item.js +121 -121
  57. package/dist/collection/components/wm-navigation/wm-navigation.js +218 -218
  58. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
  59. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
  60. package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
  61. package/dist/collection/components/wm-option/wm-option.js +428 -428
  62. package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
  63. package/dist/collection/components/wm-search/wm-search.js +480 -480
  64. package/dist/collection/components/wm-select/wm-select.js +1001 -1001
  65. package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
  66. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +216 -216
  67. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +330 -330
  68. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
  69. package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +115 -115
  70. package/dist/collection/components/wm-tag-input/wm-tag-input.js +1201 -1201
  71. package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
  72. package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
  73. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +788 -788
  74. package/dist/collection/components/wm-uploader/wm-uploader.js +1000 -1000
  75. package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
  76. package/dist/collection/dev/scripts.js +20 -20
  77. package/dist/collection/global/__mocks__/functions.js +6 -6
  78. package/dist/collection/global/chartFunctions.js +426 -423
  79. package/dist/collection/global/functions.js +486 -486
  80. package/dist/collection/global/global.js +69 -69
  81. package/dist/collection/global/interfaces.js +49 -49
  82. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  83. package/dist/collection/global/services/http-service.js +50 -50
  84. package/dist/collection/lang/lang.js +5 -5
  85. package/dist/collection/lang/missing.js +43 -43
  86. package/dist/collection/lang/piglatin.js +93 -93
  87. package/dist/esm/{chartFunctions-4433cafc.js → chartFunctions-fe9af0f8.js} +425 -422
  88. package/dist/esm/{functions-14df5b8c.js → functions-478ab920.js} +483 -483
  89. package/dist/esm/{global-0087a2ea.js → global-32a33c56.js} +62 -62
  90. package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
  91. package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
  92. package/dist/esm/loader.js +2 -2
  93. package/dist/esm/polyfills/core-js.js +0 -0
  94. package/dist/esm/polyfills/dom.js +0 -0
  95. package/dist/esm/polyfills/es5-html-element.js +0 -0
  96. package/dist/esm/polyfills/index.js +0 -0
  97. package/dist/esm/polyfills/system.js +0 -0
  98. package/dist/esm/priv-chart-popover.entry.js +86 -86
  99. package/dist/esm/priv-datepicker.entry.js +657 -657
  100. package/dist/esm/priv-navigator-button.entry.js +18 -18
  101. package/dist/esm/priv-navigator-item.entry.js +23 -23
  102. package/dist/esm/ripple.js +2 -2
  103. package/dist/esm/wm-action-menu_2.entry.js +329 -329
  104. package/dist/esm/wm-button.entry.js +248 -248
  105. package/dist/esm/wm-chart-slice.entry.js +13 -13
  106. package/dist/esm/wm-chart.entry.js +111 -111
  107. package/dist/esm/wm-datepicker.entry.js +265 -265
  108. package/dist/esm/wm-input.entry.js +134 -134
  109. package/dist/esm/wm-modal-footer.entry.js +33 -33
  110. package/dist/esm/wm-modal-header.entry.js +36 -36
  111. package/dist/esm/wm-modal.entry.js +163 -163
  112. package/dist/esm/wm-navigation_3.entry.js +227 -227
  113. package/dist/esm/wm-navigator.entry.js +268 -268
  114. package/dist/esm/wm-network-uploader.entry.js +455 -455
  115. package/dist/esm/wm-option_2.entry.js +720 -720
  116. package/dist/esm/wm-pagination.entry.js +167 -167
  117. package/dist/esm/wm-progress-indicator_3.entry.js +139 -131
  118. package/dist/esm/wm-search.entry.js +232 -232
  119. package/dist/esm/wm-snackbar.entry.js +170 -170
  120. package/dist/esm/wm-tab-item_3.entry.js +296 -296
  121. package/dist/esm/wm-tag-input-row.entry.js +10 -10
  122. package/dist/esm/wm-tag-input.entry.js +884 -884
  123. package/dist/esm/wm-timepicker.entry.js +383 -383
  124. package/dist/esm/wm-toggletip.entry.js +124 -124
  125. package/dist/esm/wm-uploader.entry.js +556 -556
  126. package/dist/esm/wm-wrapper.entry.js +12 -12
  127. package/dist/esm-es5/{chartFunctions-4433cafc.js → chartFunctions-fe9af0f8.js} +1 -1
  128. package/dist/esm-es5/{functions-14df5b8c.js → functions-478ab920.js} +0 -0
  129. package/dist/esm-es5/global-32a33c56.js +1 -0
  130. package/dist/esm-es5/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +0 -0
  131. package/dist/esm-es5/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +0 -0
  132. package/dist/esm-es5/loader.js +1 -1
  133. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  134. package/dist/esm-es5/priv-datepicker.entry.js +1 -1
  135. package/dist/esm-es5/ripple.js +1 -1
  136. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  137. package/dist/esm-es5/wm-button.entry.js +1 -1
  138. package/dist/esm-es5/wm-chart.entry.js +1 -1
  139. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  140. package/dist/esm-es5/wm-input.entry.js +1 -1
  141. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  142. package/dist/esm-es5/wm-modal.entry.js +1 -1
  143. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  144. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  145. package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
  146. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  147. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  148. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  149. package/dist/esm-es5/wm-search.entry.js +1 -1
  150. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  151. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  152. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  153. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  154. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  155. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  156. package/dist/ripple/{p-dfe38d43.system.entry.js → p-054ccfa1.system.entry.js} +1 -1
  157. package/dist/ripple/{p-ff011bf3.entry.js → p-09b2c614.entry.js} +1 -1
  158. package/dist/ripple/{p-d063e3e9.entry.js → p-0dd172c2.entry.js} +1 -1
  159. package/dist/ripple/{p-df2bd836.entry.js → p-10d6335d.entry.js} +1 -1
  160. package/dist/ripple/{p-923527d9.system.entry.js → p-1762bc51.system.entry.js} +1 -1
  161. package/dist/ripple/{p-d530a06f.system.entry.js → p-1a1a6d89.system.entry.js} +1 -1
  162. package/dist/ripple/{p-8707f00a.system.entry.js → p-29792d81.system.entry.js} +1 -1
  163. package/dist/ripple/{p-d24ecc0c.js → p-2b929b10.js} +1 -1
  164. package/dist/ripple/{p-aa0e1f8b.system.entry.js → p-2e6988e6.system.entry.js} +1 -1
  165. package/dist/ripple/{p-811380de.entry.js → p-34d6d1d2.entry.js} +1 -1
  166. package/dist/ripple/{p-85ea8ece.entry.js → p-3597b28b.entry.js} +1 -1
  167. package/dist/ripple/{p-1d61c7bd.system.entry.js → p-3efd31ef.system.entry.js} +1 -1
  168. package/dist/ripple/{p-6f7f1331.system.entry.js → p-3fbf3278.system.entry.js} +1 -1
  169. package/dist/ripple/{p-6b4bc7ed.system.entry.js → p-430183de.system.entry.js} +1 -1
  170. package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
  171. package/dist/ripple/{p-b545a4a1.entry.js → p-44da2057.entry.js} +1 -1
  172. package/dist/ripple/p-4a1498f7.system.js +1 -0
  173. package/dist/ripple/p-4f1bf7f5.entry.js +1 -0
  174. package/dist/ripple/{p-32c15757.entry.js → p-5bea2c87.entry.js} +1 -1
  175. package/dist/ripple/{p-0ec5e02c.system.js → p-63190f58.system.js} +0 -0
  176. package/dist/ripple/{p-959aa7ae.system.entry.js → p-695fba1d.system.entry.js} +1 -1
  177. package/dist/ripple/p-791c6577.js +1 -0
  178. package/dist/ripple/{p-2a18f87c.entry.js → p-7a654f2c.entry.js} +1 -1
  179. package/dist/ripple/p-7ce57c62.system.js +1 -0
  180. package/dist/ripple/p-7f621f1c.system.entry.js +1 -0
  181. package/dist/ripple/{p-e3114f71.entry.js → p-87edffcc.entry.js} +1 -1
  182. package/dist/ripple/p-8ee1416a.entry.js +1 -0
  183. package/dist/ripple/{p-47639d21.entry.js → p-9a603f75.entry.js} +1 -1
  184. package/dist/ripple/{p-313b6073.system.js → p-9d02957d.system.js} +0 -0
  185. package/dist/ripple/{p-6c5006d1.entry.js → p-a2663226.entry.js} +1 -1
  186. package/dist/ripple/{p-54fb8d84.entry.js → p-a60407e7.entry.js} +1 -1
  187. package/dist/ripple/{p-05d01f10.system.entry.js → p-b6eb9ed6.system.entry.js} +1 -1
  188. package/dist/ripple/p-bf4bbba3.system.js +1 -0
  189. package/dist/ripple/{p-475e8f32.entry.js → p-c56dc658.entry.js} +1 -1
  190. package/dist/ripple/{p-e62f5770.entry.js → p-c741ddb3.entry.js} +1 -1
  191. package/dist/ripple/{p-9e294a2a.system.entry.js → p-cb22eef3.system.entry.js} +1 -1
  192. package/dist/ripple/{p-fa36e7b3.js → p-cd73566d.js} +0 -0
  193. package/dist/ripple/{p-f48bf28e.system.entry.js → p-d25523dd.system.entry.js} +1 -1
  194. package/dist/ripple/{p-2f9a6860.system.entry.js → p-d872e221.system.entry.js} +1 -1
  195. package/dist/ripple/{p-4325dabd.entry.js → p-d8a12a04.entry.js} +1 -1
  196. package/dist/ripple/{p-31af715e.system.entry.js → p-d9978c48.system.entry.js} +1 -1
  197. package/dist/ripple/p-daec9ed7.system.entry.js +1 -0
  198. package/dist/ripple/{p-ebe7b4fb.entry.js → p-dc7b53bd.entry.js} +1 -1
  199. package/dist/ripple/{p-7d9920ea.system.entry.js → p-df895edb.system.entry.js} +1 -1
  200. package/dist/ripple/{p-5095fe0c.system.entry.js → p-e5a472c8.system.entry.js} +1 -1
  201. package/dist/ripple/{p-671b7adf.entry.js → p-e9b0eccc.entry.js} +1 -1
  202. package/dist/ripple/{p-2d285e1c.system.entry.js → p-ee3b6b4c.system.entry.js} +1 -1
  203. package/dist/ripple/{p-0e3e046c.system.entry.js → p-eea875ce.system.entry.js} +1 -1
  204. package/dist/ripple/{p-5b3a44fe.system.entry.js → p-f0b67d2f.system.entry.js} +1 -1
  205. package/dist/ripple/{p-08b7ec08.system.js → p-f5df5903.system.js} +0 -0
  206. package/dist/ripple/{p-cfea1f6e.entry.js → p-f62d01f9.entry.js} +1 -1
  207. package/dist/ripple/{p-0d0286c5.entry.js → p-f640448f.entry.js} +1 -1
  208. package/dist/ripple/{p-23c428dd.entry.js → p-fbd67b12.entry.js} +1 -1
  209. package/dist/ripple/{p-1a909e18.system.entry.js → p-fccab03d.system.entry.js} +1 -1
  210. package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
  211. package/dist/ripple/ripple.esm.js +1 -1
  212. package/dist/ripple/ripple.js +1 -1
  213. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
  214. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
  215. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +36 -36
  216. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +27 -27
  217. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +19 -17
  218. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
  219. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +47 -47
  220. package/dist/types/components/wm-button/wm-button.d.ts +49 -49
  221. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
  222. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +41 -41
  223. package/dist/types/components/wm-input/wm-input.d.ts +46 -46
  224. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  225. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
  226. package/dist/types/components/wm-modal/wm-modal-header.d.ts +11 -11
  227. package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
  228. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +21 -21
  229. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
  230. package/dist/types/components/wm-navigation/wm-navigation.d.ts +28 -28
  231. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  232. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  233. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  234. package/dist/types/components/wm-option/wm-option.d.ts +35 -35
  235. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  236. package/dist/types/components/wm-search/wm-search.d.ts +86 -86
  237. package/dist/types/components/wm-select/wm-select.d.ts +94 -94
  238. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
  239. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
  240. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
  241. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  242. package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +11 -11
  243. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +126 -126
  244. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +61 -61
  245. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
  246. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  247. package/dist/types/components/wm-uploader/wm-uploader.d.ts +117 -117
  248. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  249. package/dist/types/components.d.ts +29 -27
  250. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  251. package/dist/types/global/chartFunctions.d.ts +30 -29
  252. package/dist/types/global/functions.d.ts +46 -46
  253. package/dist/types/global/global.d.ts +1 -1
  254. package/dist/types/global/interfaces.d.ts +48 -44
  255. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  256. package/dist/types/global/services/http-service.d.ts +4 -4
  257. package/dist/types/lang/lang.d.ts +5 -5
  258. package/package.json +47 -47
  259. package/dist/esm-es5/global-0087a2ea.js +0 -1
  260. package/dist/ripple/p-09dca516.system.js +0 -1
  261. package/dist/ripple/p-20ad8577.entry.js +0 -1
  262. package/dist/ripple/p-276c88b5.system.entry.js +0 -1
  263. package/dist/ripple/p-4033dc2d.system.entry.js +0 -1
  264. package/dist/ripple/p-437c9944.system.js +0 -1
  265. package/dist/ripple/p-479b5d27.js +0 -1
  266. package/dist/ripple/p-71ac86cb.entry.js +0 -1
  267. package/dist/ripple/p-bbaec20d.system.js +0 -1
@@ -1,563 +1,563 @@
1
1
  import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-17c79cc6.js';
2
- import { g as generateId, d as debounce, i as intl, u as hasValidType, q as hideTooltip, r as showTooltip } from './functions-14df5b8c.js';
2
+ import { g as generateId, d as debounce, i as intl, u as hasValidType, q as hideTooltip, r as showTooltip } from './functions-478ab920.js';
3
3
 
4
4
  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}";
5
5
 
6
- const Uploader = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.wmUploaderFilesSelected = createEvent(this, "wmUploaderFilesSelected", 7);
10
- this.wmFilesSelected = createEvent(this, "wmFilesSelected", 7);
11
- this.wmUploaderDeleteFile = createEvent(this, "wmUploaderDeleteFile", 7);
12
- this.wmDeleteFile = createEvent(this, "wmDeleteFile", 7);
13
- this.wmUploaderDownloadFile = createEvent(this, "wmUploaderDownloadFile", 7);
14
- this.wmDownloadFile = createEvent(this, "wmDownloadFile", 7);
15
- this.wmUploaderPreviewFile = createEvent(this, "wmUploaderPreviewFile", 7);
16
- this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
17
- this.sortBy = "date"; // name is descending (a -> z), date is ascending (earlier -> later)
18
- this.showInfo = "time";
19
- this.fileList = []; // the string above transformed into the actual array
20
- this.filesToUpload = []; // input.files that passed validation
21
- this.isTabbing = false;
22
- this.errorList = []; // for errors on a particular file
23
- this.announcement = "";
24
- this.isCondensed = false;
25
- this.inputId = generateId();
26
- this.debouncedResize = debounce(() => {
27
- this.isCondensed = this.el.clientWidth < 500;
28
- // rerender to show filename truncation changes
29
- forceUpdate(this.el);
30
- }, 50);
31
- }
32
- get uploadButtonEl() {
33
- return this.el.shadowRoot.querySelector(`#${this.inputId}`);
34
- }
35
- get tempUploaderType() {
36
- // replace instances of this.tempUploaderType with this.uploaderType once type is fully phased out
37
- return this.type || this.uploaderType;
38
- }
39
- get effectiveMaxSize() {
40
- const defaultMaxSize = 100;
41
- // maxsize cannot be set to over 100Mb
42
- const maxSizeLimit = 100;
43
- return this.maxSize ? Math.min(this.maxSize, maxSizeLimit) : defaultMaxSize;
44
- }
45
- get chMeasure() {
46
- return this.el.shadowRoot.querySelector(".ch-measure").clientWidth;
47
- }
48
- get fileLimitReached() {
49
- return this.maxFiles && this.fileList.length >= this.maxFiles;
50
- }
51
- get fileLimitExceededMessage() {
52
- return intl.formatMessage({
53
- id: "uploader.fileUploadLimitExceeded",
54
- defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
55
- description: "Message displayed when trying to upload too many files",
56
- });
57
- }
58
- get fileLimitReachedMessage() {
59
- return intl.formatMessage({
60
- id: "uploader.fileUploadLimitReached",
61
- defaultMessage: "The maximum number of files has been reached",
62
- description: "Message displayed when trying to upload additional files, but the limit has been reached",
63
- });
64
- }
65
- get fileCountMessage() {
66
- return intl.formatMessage({
67
- id: "uploader.fileCount",
68
- defaultMessage: "{x} of {y} Files",
69
- description: "A count of the number of files currently uploaded",
70
- }, { x: this.fileList.length, y: this.maxFiles });
71
- }
72
- get maxSizeMessage() {
73
- return intl.formatMessage({
74
- id: "uploader.maxSize",
75
- defaultMessage: "Maximum file size {maxSize}MB",
76
- description: "An indicator of the maximum file size the uploader allows",
77
- }, {
78
- maxSize: this.effectiveMaxSize,
79
- });
80
- }
81
- get acceptedFileTypesMessage() {
82
- const validTypes = "." + this.fileTypes.split(" ").join(", .");
83
- return intl.formatMessage({
84
- id: "uploader.acceptedFileTypes",
85
- defaultMessage: "Accepted file {amount, plural, =1 {type} other {types}}: {fileTypes}",
86
- }, {
87
- fileTypes: validTypes,
88
- amount: this.fileTypes.split(" ").length,
89
- });
90
- }
91
- get previewActionMessage() {
92
- return intl.formatMessage({
93
- id: "uploader.previewAction",
94
- defaultMessage: "Preview File",
95
- description: "Label of a button that triggers a file to be previewed",
96
- });
97
- }
98
- get downloadActionMessage() {
99
- return intl.formatMessage({
100
- id: "uploader.downloadAction",
101
- defaultMessage: "Download File",
102
- description: "Label of a button that triggers a file to be downloaded",
103
- });
104
- }
105
- get deleteActionMessage() {
106
- return intl.formatMessage({
107
- id: "uploader.deleteAction",
108
- defaultMessage: "Delete File",
109
- description: "Label of a button that triggers a file to be delete",
110
- });
111
- }
112
- get clearButtonText() {
113
- return intl.formatMessage({
114
- id: "uploader.clearErrorText",
115
- defaultMessage: "Clear",
116
- description: "Text for a button used to clear an error",
117
- });
118
- }
119
- get actionMenuLabel() {
120
- return intl.formatMessage({
121
- id: "uploader.actionMenuLabel",
122
- defaultMessage: "Actions",
123
- description: "Label of a button that opens a menu of file actions",
124
- });
125
- }
126
- toggleTabbingOn() {
127
- this.isTabbing = true;
128
- }
129
- toggleTabbingOff() {
130
- this.isTabbing = false;
131
- }
132
- handleUploadProgress(ev) {
133
- this.fileList.map((i) => {
134
- if (i.id === ev.detail.id) {
135
- i.progress = ev.detail.progress;
136
- forceUpdate(this.el);
137
- }
138
- });
139
- if (ev.detail.progress === 100) {
140
- // inProgressList is not a perfect reflection of how many files are uploading
141
- // because even after progress reached 100% the item should remain in the array
142
- // (should only be removed once it appears in fileList)
143
- this.numFilesInProgress -= 1;
144
- }
145
- // aggregate the percentages for SR to announce progress
146
- if (!this.srProgress && this.numFilesInProgress) {
147
- const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
148
- this.srProgress = setInterval(() => {
149
- const aggregate = this.fileList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
150
- this.announce(intl.formatMessage({
151
- id: "uploader.uploadProgress",
152
- defaultMessage: "Upload progress: {percentage}%",
153
- }, { percentage: Math.floor(aggregate / total) }));
154
- }, 5000);
155
- }
156
- }
157
- parseFiles() {
158
- if (!!this.files) {
159
- if (typeof this.files === "string") {
160
- const list = JSON.parse(this.files);
161
- if (typeof list === "object") {
162
- this.fileList = list;
163
- }
164
- else {
165
- throw new Error("could not parse string passed to files attribute");
166
- }
167
- }
168
- else {
169
- throw new Error("Attribute 'files' should be a string");
170
- }
171
- }
172
- }
173
- parseRejectedFiles() {
174
- if (!!this.rejectedFiles) {
175
- if (typeof this.files === "string") {
176
- const list = JSON.parse(this.rejectedFiles);
177
- if (typeof list === "object") {
178
- this.errorList = list;
179
- }
180
- else {
181
- throw new Error("could not parse string passed to errors attribute");
182
- }
183
- }
184
- else {
185
- throw new Error("Attribute 'rejected-files' should be a string");
186
- }
187
- }
188
- }
189
- uploadNotifications(newNum, oldNum) {
190
- if (oldNum > 0 && newNum === 0) {
191
- setTimeout(() => {
192
- this.notif = null;
193
- }, 20 * 1000);
194
- const message = intl.formatMessage({
195
- id: "uploader.finishedUploading",
196
- defaultMessage: "Finished uploading",
197
- });
198
- this.notif = { message, isError: false };
199
- this.announce(message);
200
- this.numFilesInProgress = null;
201
- clearInterval(this.srProgress);
202
- forceUpdate(this.el);
203
- }
204
- else if (newNum > 0 && newNum != oldNum) {
205
- const message = intl.formatMessage({
206
- id: "uploader.filesUploading",
207
- defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
208
- }, { num: newNum });
209
- this.notif = { message, isError: false };
210
- this.announce(message);
211
- forceUpdate(this.el);
212
- }
213
- }
214
- isValidSize(size) {
215
- return this.convertBytes(size, "MB").size <= this.effectiveMaxSize;
216
- }
217
- convertBytes(bytes, unit) {
218
- // https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
219
- const unitOrder = ["bytes", "KB", "MB", "GB", "TB"];
220
- let unitIndex = 0;
221
- let result = typeof bytes === "number" ? bytes : parseInt(bytes);
222
- if (unit) {
223
- // convert until result matches desired unit
224
- while (unitOrder.indexOf(unit) > unitIndex) {
225
- result /= 1024;
226
- unitIndex++;
227
- }
228
- }
229
- else {
230
- // convert until result is appropriate unit (value is under 1000)
231
- while (result > 1000) {
232
- result /= 1024;
233
- unitIndex++;
234
- }
235
- }
236
- return { size: result, unit: unitOrder[unitIndex] };
237
- }
238
- isDuplicate(name) {
239
- return this.fileList.find((f) => {
240
- const filename = f.type ? f.name + "." + f.type : f.name;
241
- return filename === name;
242
- });
243
- }
244
- isEmpty() {
245
- return !this.fileList.length && !this.errorList.length;
246
- }
247
- get isDisabled() {
248
- // disable if is the uploader is maxed out or if something is uploading
249
- return this.fileLimitReached || this.numFilesInProgress > 0;
250
- }
251
- isItemUploading(item) {
252
- return item.hasOwnProperty("progress") && item.progress < 100;
253
- }
254
- announce(message) {
255
- if (this.liveRegion.textContent === message) {
256
- message += "\u00A0";
257
- }
258
- this.announcement = message;
259
- }
260
- clearError(filename) {
261
- this.errorList = this.errorList.filter((error) => error.name != filename);
262
- this.notif = null;
263
- }
264
- clearErrors() {
265
- this.errorList = [];
266
- this.notif = null;
267
- }
268
- handleFiles(ev) {
269
- this.filesToUpload = [];
270
- const validTypes = this.fileTypes.split(" ").join(", ");
271
- const files = Array.from(ev.target.files);
272
- if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
273
- const errMessage = this.fileLimitExceededMessage;
274
- this.notif = { message: errMessage, isError: true };
275
- this.announce(errMessage);
276
- }
277
- else {
278
- files &&
279
- files.map((file) => {
280
- if (!hasValidType(file, this.fileTypes)) {
281
- const error = {
282
- name: file.name,
283
- message: intl.formatMessage({
284
- id: "uploader.invalidFileType",
285
- defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
286
- }, { validTypes }),
287
- };
288
- this.errorList.push(error);
289
- }
290
- else if (file.size === 0) {
291
- const error = {
292
- name: file.name,
293
- message: intl.formatMessage({
294
- id: "uploader.zeroFileSize",
295
- defaultMessage: "The file must be more than 0 bytes",
296
- description: "Error message when user attempts to upload a file of no size",
297
- }),
298
- };
299
- this.errorList.push(error);
300
- }
301
- else if (!this.isValidSize(file.size)) {
302
- const error = {
303
- name: file.name,
304
- message: intl.formatMessage({
305
- id: "uploader.fileTooLarge",
306
- defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
307
- }, { size: this.effectiveMaxSize }),
308
- };
309
- this.errorList.push(error);
310
- }
311
- else if (this.isDuplicate(file.name)) {
312
- const error = {
313
- name: file.name,
314
- message: intl.formatMessage({
315
- id: "uploader.duplicateName",
316
- defaultMessage: "A file with this name already exists.",
317
- }),
318
- };
319
- this.errorList.push(error);
320
- }
321
- else {
322
- this.filesToUpload.push(file);
323
- }
324
- });
325
- if (this.filesToUpload.length > 0) {
326
- this.numFilesInProgress = this.filesToUpload.length;
327
- this.wmUploaderFilesSelected.emit(this.filesToUpload);
328
- this.wmFilesSelected.emit(this.filesToUpload); // deprecated
329
- }
330
- }
331
- ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
332
- }
333
- previewFile(file) {
334
- this.clearErrors();
335
- this.wmUploaderPreviewFile.emit(file.id);
336
- }
337
- downloadFile(file) {
338
- this.clearErrors();
339
- this.wmUploaderDownloadFile.emit(file.id);
340
- this.wmDownloadFile.emit(file.id); // deprecated
341
- }
342
- deleteFile(file) {
343
- this.clearErrors();
344
- forceUpdate(this.el); // for the button to stop being disabled if num files become < max-files
345
- this.wmUploaderDeleteFile.emit(file.id);
346
- this.wmDeleteFile.emit(file.id); // deprecated
347
- }
348
- componentWillLoad() {
349
- if (!this.buttonText) {
350
- throw new Error("wm-uploader: button-text is a required prop");
351
- }
352
- if (this.type) {
353
- console.warn("wm-uploader: type has been deprecated as of v3.1.0. Please use uploader-type instead.");
354
- }
355
- if (this.tempUploaderType === "1" && !this.emptyStateText) {
356
- throw new Error("wm-uploader: empty-state-text is a required prop");
357
- }
358
- // rerender on resize in case layout needs to change
359
- const resizeObserver = new ResizeObserver(() => this.debouncedResize());
360
- resizeObserver.observe(this.el);
361
- this.parseFiles();
362
- this.clearErrors();
363
- this.parseRejectedFiles();
364
- }
365
- componentDidLoad() {
366
- if (document.body.classList.contains("wmcl-user-is-tabbing")) {
367
- this.toggleTabbingOn();
368
- }
369
- }
370
- uploadButtonOnClick(ev) {
371
- if (this.isDisabled) {
372
- // this is a temporary fix.
373
- // we need the disabled button to be programmatically focusable
374
- // to allow return focus after closing the browser file panel
375
- // since it's focusable the button should respond when activated
376
- // it looks disabled, and announces the reason why the action cannot
377
- // be taken when activated.
378
- ev.preventDefault();
379
- if (this.numFilesInProgress > 0) {
380
- const srMsg = intl.formatMessage({
381
- id: "uploader.waitToUpload",
382
- defaultMessage: "Please wait for current upload to complete before uploading new files.",
383
- description: "Message for screen reader users",
384
- });
385
- this.announce(srMsg);
386
- }
387
- else if (this.fileLimitReached) {
388
- const srMsg = this.fileLimitReachedMessage;
389
- const notif = { message: srMsg, isError: true };
390
- this.notif = notif;
391
- this.announce(srMsg);
392
- }
393
- }
394
- else {
395
- this.clearErrors();
396
- }
397
- }
398
- renderUploadSvg() {
399
- return (h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" }, 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" })));
400
- }
401
- renderIcon() {
402
- // mdi attachment icon (paper clip) is horizontal but we want it vertical
403
- const rotate = this.icon && this.icon === "f066";
404
- return (this.icon && (h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
405
- }
406
- renderInfo() {
407
- return this.info && this.tempUploaderType === "2" ? h("span", { class: "info" }, this.info) : "";
408
- }
409
- renderNotif() {
410
- return this.notif ? h("div", { class: `notif ${this.notif.isError ? "error" : ""}` }, this.notif.message) : "";
411
- }
412
- renderUploadButton(classes) {
413
- return (h("div", { class: "info-wrapper" }, 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) }), h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` }, this.renderIcon(), this.buttonText), this.renderInfo()));
414
- }
415
- renderEmptyState() {
416
- return (h("div", { class: "empty-block" }, this.renderUploadSvg(), h("div", { class: `empty-message` }, this.emptyStateText), this.renderUploadButton("-primary empty-button"), this.renderNotif()));
417
- }
418
- renderFileName(filename, isUploading) {
419
- return (h("div", { class: "left-group" }, h("div", { class: "name-wrapper" }, h("span", { class: "filename", "data-filename": filename, onMouseEnter: (ev) => this.handleFilenameMouseEnter(ev, filename), onMouseLeave: () => hideTooltip() }), isUploading && h("span", { class: "sr-only" }, "uploading"), h("div", { class: "sr-only ch-measure" }))));
420
- }
421
- renderErrorList() {
422
- if (!!this.errorList.length) {
423
- let srMessage = this.errorList.reduce(function (acc, err) {
424
- return acc + `${err.name}: ${err.message} `;
425
- }, "");
426
- this.announce(srMessage);
427
- return (h("ul", { class: "error-list" }, this.errorList.map((err) => {
428
- const clearButtonLabel = intl.formatMessage({
429
- id: "uploader.clearErrorLabel",
430
- defaultMessage: "Clear {fileName} error",
431
- description: "Label for a button used to clear an error, including filename",
432
- }, { fileName: err.name });
433
- return (h("li", null, h("div", { class: "file --error" }, this.renderFileName(err.name, false), h("wm-button", { "permanently-delete": true, "button-type": "textonly", "label-for-identical-buttons": clearButtonLabel, onClick: () => {
434
- this.clearError(err.name);
435
- this.uploadButtonEl.focus();
436
- } }, this.clearButtonText)), h("div", { class: "error-message" }, err.message)));
437
- })));
438
- }
439
- }
440
- renderFileInProgress(item) {
441
- const filename = item.type ? `${item.name}.${item.type}` : item.name;
442
- return (h("li", null, h("div", { class: "file --progress" }, h("div", { class: "progress", style: {
443
- background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
444
- } }), this.renderFileName(filename, this.isItemUploading(item)))));
445
- }
446
- renderFile(item) {
447
- const filename = item.type ? `${item.name}.${item.type}` : item.name;
448
- const hasSingleFileAction = item.fileActions && item.fileActions.split(" ").length === 1;
449
- const showActionMenu = !this.tempUploaderType && this.isCondensed && !hasSingleFileAction;
450
- const showFileInfo = !this.tempUploaderType && !this.isCondensed;
451
- // @ts-ignore it's possible progress is passed in as a string, so we need to check for "100" as well
452
- const showCheckmark = !this.tempUploaderType && (item.progress === 100 || item.progress === "100");
453
- return (h("li", { class: `${this.isCondensed ? "condensed" : ""} ${showCheckmark ? "checked" : ""}` }, h("div", { class: "file --saved" }, this.renderFileName(filename, this.isItemUploading(item)), h("div", { class: "right-group" }, showFileInfo && this.renderFileInfo(item), showActionMenu ? this.renderActionMenu(item) : this.renderFileActions(item)))));
454
- }
455
- handleFilenameMouseEnter(ev, filename) {
456
- // only show tooltip if file name is being truncated (has ellipses)
457
- if (ev.target.textContent.includes("...")) {
458
- showTooltip("bottom", ev.target, filename);
459
- }
460
- }
461
- componentDidRender() {
462
- const files = this.el.shadowRoot.querySelectorAll(".file");
463
- files.forEach((file) => this.truncateFileName(file));
464
- }
465
- truncateFileName(file) {
466
- const leftGroup = file.querySelector(".left-group");
467
- const leftBoundary = leftGroup.getBoundingClientRect().left;
468
- const rightGroup = file.querySelector(".right-group");
469
- const rightBoundary = rightGroup
470
- ? rightGroup.getBoundingClientRect().left
471
- : file.getBoundingClientRect().right - 20;
472
- const filenameEl = file.querySelector(".filename");
473
- const availableSpace = rightBoundary - leftBoundary;
474
- let filename = filenameEl.dataset.filename;
475
- const canFitText = availableSpace > filename.length * this.chMeasure;
476
- if (!canFitText) {
477
- const extension = filename.slice(filename.lastIndexOf("."));
478
- const numFittingCharacters = Math.floor(availableSpace / this.chMeasure);
479
- // three ellipses, three constant characters, extension
480
- const postEllipsesLength = 3 + 3 + extension.length;
481
- let preEllipsesLength = Math.max(2, numFittingCharacters - postEllipsesLength);
482
- const preEllipsesText = filename.slice(0, preEllipsesLength);
483
- const postEllipsesText = filename.slice(filename.indexOf(extension) - 3, filename.length);
484
- filename = `${preEllipsesText.trim()}...${postEllipsesText.trim()}`;
485
- }
486
- filenameEl.textContent = filename;
487
- }
488
- renderFileActions(item) {
489
- const defaultFileActions = "download delete";
490
- const availableActions = item.fileActions || defaultFileActions;
491
- const previewButton = (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) }));
492
- const downloadButton = (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) }));
493
- const deleteButton = (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) }));
494
- return (h("div", { class: "file-controls" }, availableActions.includes("preview") && previewButton, availableActions.includes("download") && downloadButton, availableActions.includes("delete") && deleteButton));
495
- }
496
- renderActionMenu(item) {
497
- const defaultFileActions = "download delete";
498
- const availableActions = item.fileActions || defaultFileActions;
499
- const previewItem = (h("wm-menuitem", { icon: "f208", onClick: () => this.previewFile(item) }, this.previewActionMessage));
500
- const downloadItem = (h("wm-menuitem", { icon: "f1da", onClick: () => this.downloadFile(item) }, this.downloadActionMessage));
501
- const deleteItem = (h("wm-menuitem", { icon: "f1c0", onClick: () => this.deleteFile(item) }, this.deleteActionMessage));
502
- return (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));
503
- }
504
- renderFileInfo(item) {
505
- let elementToRender = undefined;
506
- if (this.showInfo === "time") {
507
- const uploadDate = new Date(Date.parse(item.lastUpdated));
508
- const day = uploadDate.getDate();
509
- const month = uploadDate.getMonth() + 1;
510
- const year = uploadDate.getFullYear();
511
- const time = uploadDate.toLocaleTimeString("en-us", { hour: "numeric", minute: "2-digit" });
512
- const formattedDate = `${month}/${day}/${year} ${time}`;
513
- elementToRender = h("div", { class: "file-info" }, formattedDate);
514
- }
515
- else if (this.showInfo === "size" && item.size) {
516
- const convertedSize = this.convertBytes(item.size);
517
- elementToRender = h("div", { class: "file-info" }, `${convertedSize.size.toFixed(0)} ${convertedSize.unit}`);
518
- }
519
- return elementToRender;
520
- }
521
- renderFileList() {
522
- if (this.fileList) {
523
- this.sortBy === "name"
524
- ? this.fileList.sort((a, b) => a.name.localeCompare(b.name))
525
- : this.fileList.sort((a, b) => Date.parse(a.lastUpdated) - Date.parse(b.lastUpdated));
526
- return (h("div", null, h("ul", { class: "inprogress-list" }, this.fileList.filter((item) => this.isItemUploading(item)).map((item) => this.renderFileInProgress(item))), h("ul", { class: "file-list" }, this.fileList.filter((item) => !this.isItemUploading(item)).map((item) => this.renderFile(item)))));
527
- }
528
- }
529
- legacyRenderHeader() {
530
- return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, h("div", { class: "slot-wrapper" }, h("slot", null), h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderNotif()))));
531
- }
532
- renderHeader() {
533
- return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderRequirements()), h("div", { id: "accepted-types", class: "accepted-types" }, this.acceptedFileTypesMessage), this.renderNotif()));
534
- }
535
- renderRequirements() {
536
- return (h("div", { class: "requirements" }, this.maxFiles && h("span", { id: "file-count" }, this.fileCountMessage), this.maxSize && h("span", { id: "max-size" }, this.maxSizeMessage)));
537
- }
538
- renderFooter() {
539
- return (h("div", { class: "footer" }, h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, h("div", { class: "filecount-wrapper" }, h("div", { class: "filecount" }, intl.formatMessage({
540
- id: "uploader.filesAdded",
541
- defaultMessage: "{numFiles, plural, one {1 file added} other {# files added}}",
542
- }, { numFiles: this.fileList.length })), this.renderUploadButton(`-primary ${this.isDisabled ? "disabled" : ""}`)), this.renderNotif())));
543
- }
544
- renderWithItems() {
545
- // it's possible progress is passed in as a string, so we need to check for "100" as well
546
- const hasNewlyUploadedFiles = this.fileList.filter((file) => file.progress === (typeof file.progress === "number" ? 100 : "100")).length > 0;
547
- return (h("div", null, !this.tempUploaderType && this.renderHeader(), this.tempUploaderType === "2" && this.legacyRenderHeader(), h("div", { class: `list-container type${this.tempUploaderType} ${!this.tempUploaderType && hasNewlyUploadedFiles ? "checkmark-spacer" : ""}` }, this.renderErrorList(), this.renderFileList()), this.tempUploaderType === "1" && this.renderFooter()));
548
- }
549
- render() {
550
- return (h(Host, null, this.isEmpty() && this.tempUploaderType === "1" ? this.renderEmptyState() : this.renderWithItems(), 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
551
- ,
552
- "aria-atomic": "true" }, this.announcement)));
553
- }
554
- get el() { return getElement(this); }
555
- static get watchers() { return {
556
- "files": ["parseFiles"],
557
- "rejectedFiles": ["parseRejectedFiles"],
558
- "numFilesInProgress": ["uploadNotifications"]
559
- }; }
560
- };
6
+ const Uploader = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.wmUploaderFilesSelected = createEvent(this, "wmUploaderFilesSelected", 7);
10
+ this.wmFilesSelected = createEvent(this, "wmFilesSelected", 7);
11
+ this.wmUploaderDeleteFile = createEvent(this, "wmUploaderDeleteFile", 7);
12
+ this.wmDeleteFile = createEvent(this, "wmDeleteFile", 7);
13
+ this.wmUploaderDownloadFile = createEvent(this, "wmUploaderDownloadFile", 7);
14
+ this.wmDownloadFile = createEvent(this, "wmDownloadFile", 7);
15
+ this.wmUploaderPreviewFile = createEvent(this, "wmUploaderPreviewFile", 7);
16
+ this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
17
+ this.sortBy = "date"; // name is descending (a -> z), date is ascending (earlier -> later)
18
+ this.showInfo = "time";
19
+ this.fileList = []; // the string above transformed into the actual array
20
+ this.filesToUpload = []; // input.files that passed validation
21
+ this.isTabbing = false;
22
+ this.errorList = []; // for errors on a particular file
23
+ this.announcement = "";
24
+ this.isCondensed = false;
25
+ this.inputId = generateId();
26
+ this.debouncedResize = debounce(() => {
27
+ this.isCondensed = this.el.clientWidth < 500;
28
+ // rerender to show filename truncation changes
29
+ forceUpdate(this.el);
30
+ }, 50);
31
+ }
32
+ get uploadButtonEl() {
33
+ return this.el.shadowRoot.querySelector(`#${this.inputId}`);
34
+ }
35
+ get tempUploaderType() {
36
+ // replace instances of this.tempUploaderType with this.uploaderType once type is fully phased out
37
+ return this.type || this.uploaderType;
38
+ }
39
+ get effectiveMaxSize() {
40
+ const defaultMaxSize = 100;
41
+ // maxsize cannot be set to over 100Mb
42
+ const maxSizeLimit = 100;
43
+ return this.maxSize ? Math.min(this.maxSize, maxSizeLimit) : defaultMaxSize;
44
+ }
45
+ get chMeasure() {
46
+ return this.el.shadowRoot.querySelector(".ch-measure").clientWidth;
47
+ }
48
+ get fileLimitReached() {
49
+ return this.maxFiles && this.fileList.length >= this.maxFiles;
50
+ }
51
+ get fileLimitExceededMessage() {
52
+ return intl.formatMessage({
53
+ id: "uploader.fileUploadLimitExceeded",
54
+ defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
55
+ description: "Message displayed when trying to upload too many files",
56
+ });
57
+ }
58
+ get fileLimitReachedMessage() {
59
+ return intl.formatMessage({
60
+ id: "uploader.fileUploadLimitReached",
61
+ defaultMessage: "The maximum number of files has been reached",
62
+ description: "Message displayed when trying to upload additional files, but the limit has been reached",
63
+ });
64
+ }
65
+ get fileCountMessage() {
66
+ return intl.formatMessage({
67
+ id: "uploader.fileCount",
68
+ defaultMessage: "{x} of {y} Files",
69
+ description: "A count of the number of files currently uploaded",
70
+ }, { x: this.fileList.length, y: this.maxFiles });
71
+ }
72
+ get maxSizeMessage() {
73
+ return intl.formatMessage({
74
+ id: "uploader.maxSize",
75
+ defaultMessage: "Maximum file size {maxSize}MB",
76
+ description: "An indicator of the maximum file size the uploader allows",
77
+ }, {
78
+ maxSize: this.effectiveMaxSize,
79
+ });
80
+ }
81
+ get acceptedFileTypesMessage() {
82
+ const validTypes = "." + this.fileTypes.split(" ").join(", .");
83
+ return intl.formatMessage({
84
+ id: "uploader.acceptedFileTypes",
85
+ defaultMessage: "Accepted file {amount, plural, =1 {type} other {types}}: {fileTypes}",
86
+ }, {
87
+ fileTypes: validTypes,
88
+ amount: this.fileTypes.split(" ").length,
89
+ });
90
+ }
91
+ get previewActionMessage() {
92
+ return intl.formatMessage({
93
+ id: "uploader.previewAction",
94
+ defaultMessage: "Preview File",
95
+ description: "Label of a button that triggers a file to be previewed",
96
+ });
97
+ }
98
+ get downloadActionMessage() {
99
+ return intl.formatMessage({
100
+ id: "uploader.downloadAction",
101
+ defaultMessage: "Download File",
102
+ description: "Label of a button that triggers a file to be downloaded",
103
+ });
104
+ }
105
+ get deleteActionMessage() {
106
+ return intl.formatMessage({
107
+ id: "uploader.deleteAction",
108
+ defaultMessage: "Delete File",
109
+ description: "Label of a button that triggers a file to be delete",
110
+ });
111
+ }
112
+ get clearButtonText() {
113
+ return intl.formatMessage({
114
+ id: "uploader.clearErrorText",
115
+ defaultMessage: "Clear",
116
+ description: "Text for a button used to clear an error",
117
+ });
118
+ }
119
+ get actionMenuLabel() {
120
+ return intl.formatMessage({
121
+ id: "uploader.actionMenuLabel",
122
+ defaultMessage: "Actions",
123
+ description: "Label of a button that opens a menu of file actions",
124
+ });
125
+ }
126
+ toggleTabbingOn() {
127
+ this.isTabbing = true;
128
+ }
129
+ toggleTabbingOff() {
130
+ this.isTabbing = false;
131
+ }
132
+ handleUploadProgress(ev) {
133
+ this.fileList.map((i) => {
134
+ if (i.id === ev.detail.id) {
135
+ i.progress = ev.detail.progress;
136
+ forceUpdate(this.el);
137
+ }
138
+ });
139
+ if (ev.detail.progress === 100) {
140
+ // inProgressList is not a perfect reflection of how many files are uploading
141
+ // because even after progress reached 100% the item should remain in the array
142
+ // (should only be removed once it appears in fileList)
143
+ this.numFilesInProgress -= 1;
144
+ }
145
+ // aggregate the percentages for SR to announce progress
146
+ if (!this.srProgress && this.numFilesInProgress) {
147
+ const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
148
+ this.srProgress = setInterval(() => {
149
+ const aggregate = this.fileList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
150
+ this.announce(intl.formatMessage({
151
+ id: "uploader.uploadProgress",
152
+ defaultMessage: "Upload progress: {percentage}%",
153
+ }, { percentage: Math.floor(aggregate / total) }));
154
+ }, 5000);
155
+ }
156
+ }
157
+ parseFiles() {
158
+ if (!!this.files) {
159
+ if (typeof this.files === "string") {
160
+ const list = JSON.parse(this.files);
161
+ if (typeof list === "object") {
162
+ this.fileList = list;
163
+ }
164
+ else {
165
+ throw new Error("could not parse string passed to files attribute");
166
+ }
167
+ }
168
+ else {
169
+ throw new Error("Attribute 'files' should be a string");
170
+ }
171
+ }
172
+ }
173
+ parseRejectedFiles() {
174
+ if (!!this.rejectedFiles) {
175
+ if (typeof this.files === "string") {
176
+ const list = JSON.parse(this.rejectedFiles);
177
+ if (typeof list === "object") {
178
+ this.errorList = list;
179
+ }
180
+ else {
181
+ throw new Error("could not parse string passed to errors attribute");
182
+ }
183
+ }
184
+ else {
185
+ throw new Error("Attribute 'rejected-files' should be a string");
186
+ }
187
+ }
188
+ }
189
+ uploadNotifications(newNum, oldNum) {
190
+ if (oldNum > 0 && newNum === 0) {
191
+ setTimeout(() => {
192
+ this.notif = null;
193
+ }, 20 * 1000);
194
+ const message = intl.formatMessage({
195
+ id: "uploader.finishedUploading",
196
+ defaultMessage: "Finished uploading",
197
+ });
198
+ this.notif = { message, isError: false };
199
+ this.announce(message);
200
+ this.numFilesInProgress = null;
201
+ clearInterval(this.srProgress);
202
+ forceUpdate(this.el);
203
+ }
204
+ else if (newNum > 0 && newNum != oldNum) {
205
+ const message = intl.formatMessage({
206
+ id: "uploader.filesUploading",
207
+ defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
208
+ }, { num: newNum });
209
+ this.notif = { message, isError: false };
210
+ this.announce(message);
211
+ forceUpdate(this.el);
212
+ }
213
+ }
214
+ isValidSize(size) {
215
+ return this.convertBytes(size, "MB").size <= this.effectiveMaxSize;
216
+ }
217
+ convertBytes(bytes, unit) {
218
+ // https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
219
+ const unitOrder = ["bytes", "KB", "MB", "GB", "TB"];
220
+ let unitIndex = 0;
221
+ let result = typeof bytes === "number" ? bytes : parseInt(bytes);
222
+ if (unit) {
223
+ // convert until result matches desired unit
224
+ while (unitOrder.indexOf(unit) > unitIndex) {
225
+ result /= 1024;
226
+ unitIndex++;
227
+ }
228
+ }
229
+ else {
230
+ // convert until result is appropriate unit (value is under 1000)
231
+ while (result > 1000) {
232
+ result /= 1024;
233
+ unitIndex++;
234
+ }
235
+ }
236
+ return { size: result, unit: unitOrder[unitIndex] };
237
+ }
238
+ isDuplicate(name) {
239
+ return this.fileList.find((f) => {
240
+ const filename = f.type ? f.name + "." + f.type : f.name;
241
+ return filename === name;
242
+ });
243
+ }
244
+ isEmpty() {
245
+ return !this.fileList.length && !this.errorList.length;
246
+ }
247
+ get isDisabled() {
248
+ // disable if is the uploader is maxed out or if something is uploading
249
+ return this.fileLimitReached || this.numFilesInProgress > 0;
250
+ }
251
+ isItemUploading(item) {
252
+ return item.hasOwnProperty("progress") && item.progress < 100;
253
+ }
254
+ announce(message) {
255
+ if (this.liveRegion.textContent === message) {
256
+ message += "\u00A0";
257
+ }
258
+ this.announcement = message;
259
+ }
260
+ clearError(filename) {
261
+ this.errorList = this.errorList.filter((error) => error.name != filename);
262
+ this.notif = null;
263
+ }
264
+ clearErrors() {
265
+ this.errorList = [];
266
+ this.notif = null;
267
+ }
268
+ handleFiles(ev) {
269
+ this.filesToUpload = [];
270
+ const validTypes = this.fileTypes.split(" ").join(", ");
271
+ const files = Array.from(ev.target.files);
272
+ if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
273
+ const errMessage = this.fileLimitExceededMessage;
274
+ this.notif = { message: errMessage, isError: true };
275
+ this.announce(errMessage);
276
+ }
277
+ else {
278
+ files &&
279
+ files.map((file) => {
280
+ if (!hasValidType(file, this.fileTypes)) {
281
+ const error = {
282
+ name: file.name,
283
+ message: intl.formatMessage({
284
+ id: "uploader.invalidFileType",
285
+ defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
286
+ }, { validTypes }),
287
+ };
288
+ this.errorList.push(error);
289
+ }
290
+ else if (file.size === 0) {
291
+ const error = {
292
+ name: file.name,
293
+ message: intl.formatMessage({
294
+ id: "uploader.zeroFileSize",
295
+ defaultMessage: "The file must be more than 0 bytes",
296
+ description: "Error message when user attempts to upload a file of no size",
297
+ }),
298
+ };
299
+ this.errorList.push(error);
300
+ }
301
+ else if (!this.isValidSize(file.size)) {
302
+ const error = {
303
+ name: file.name,
304
+ message: intl.formatMessage({
305
+ id: "uploader.fileTooLarge",
306
+ defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
307
+ }, { size: this.effectiveMaxSize }),
308
+ };
309
+ this.errorList.push(error);
310
+ }
311
+ else if (this.isDuplicate(file.name)) {
312
+ const error = {
313
+ name: file.name,
314
+ message: intl.formatMessage({
315
+ id: "uploader.duplicateName",
316
+ defaultMessage: "A file with this name already exists.",
317
+ }),
318
+ };
319
+ this.errorList.push(error);
320
+ }
321
+ else {
322
+ this.filesToUpload.push(file);
323
+ }
324
+ });
325
+ if (this.filesToUpload.length > 0) {
326
+ this.numFilesInProgress = this.filesToUpload.length;
327
+ this.wmUploaderFilesSelected.emit(this.filesToUpload);
328
+ this.wmFilesSelected.emit(this.filesToUpload); // deprecated
329
+ }
330
+ }
331
+ ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
332
+ }
333
+ previewFile(file) {
334
+ this.clearErrors();
335
+ this.wmUploaderPreviewFile.emit(file.id);
336
+ }
337
+ downloadFile(file) {
338
+ this.clearErrors();
339
+ this.wmUploaderDownloadFile.emit(file.id);
340
+ this.wmDownloadFile.emit(file.id); // deprecated
341
+ }
342
+ deleteFile(file) {
343
+ this.clearErrors();
344
+ forceUpdate(this.el); // for the button to stop being disabled if num files become < max-files
345
+ this.wmUploaderDeleteFile.emit(file.id);
346
+ this.wmDeleteFile.emit(file.id); // deprecated
347
+ }
348
+ componentWillLoad() {
349
+ if (!this.buttonText) {
350
+ throw new Error("wm-uploader: button-text is a required prop");
351
+ }
352
+ if (this.type) {
353
+ console.warn("wm-uploader: type has been deprecated as of v3.1.0. Please use uploader-type instead.");
354
+ }
355
+ if (this.tempUploaderType === "1" && !this.emptyStateText) {
356
+ throw new Error("wm-uploader: empty-state-text is a required prop");
357
+ }
358
+ // rerender on resize in case layout needs to change
359
+ const resizeObserver = new ResizeObserver(() => this.debouncedResize());
360
+ resizeObserver.observe(this.el);
361
+ this.parseFiles();
362
+ this.clearErrors();
363
+ this.parseRejectedFiles();
364
+ }
365
+ componentDidLoad() {
366
+ if (document.body.classList.contains("wmcl-user-is-tabbing")) {
367
+ this.toggleTabbingOn();
368
+ }
369
+ }
370
+ uploadButtonOnClick(ev) {
371
+ if (this.isDisabled) {
372
+ // this is a temporary fix.
373
+ // we need the disabled button to be programmatically focusable
374
+ // to allow return focus after closing the browser file panel
375
+ // since it's focusable the button should respond when activated
376
+ // it looks disabled, and announces the reason why the action cannot
377
+ // be taken when activated.
378
+ ev.preventDefault();
379
+ if (this.numFilesInProgress > 0) {
380
+ const srMsg = intl.formatMessage({
381
+ id: "uploader.waitToUpload",
382
+ defaultMessage: "Please wait for current upload to complete before uploading new files.",
383
+ description: "Message for screen reader users",
384
+ });
385
+ this.announce(srMsg);
386
+ }
387
+ else if (this.fileLimitReached) {
388
+ const srMsg = this.fileLimitReachedMessage;
389
+ const notif = { message: srMsg, isError: true };
390
+ this.notif = notif;
391
+ this.announce(srMsg);
392
+ }
393
+ }
394
+ else {
395
+ this.clearErrors();
396
+ }
397
+ }
398
+ renderUploadSvg() {
399
+ return (h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" }, 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" })));
400
+ }
401
+ renderIcon() {
402
+ // mdi attachment icon (paper clip) is horizontal but we want it vertical
403
+ const rotate = this.icon && this.icon === "f066";
404
+ return (this.icon && (h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
405
+ }
406
+ renderInfo() {
407
+ return this.info && this.tempUploaderType === "2" ? h("span", { class: "info" }, this.info) : "";
408
+ }
409
+ renderNotif() {
410
+ return this.notif ? h("div", { class: `notif ${this.notif.isError ? "error" : ""}` }, this.notif.message) : "";
411
+ }
412
+ renderUploadButton(classes) {
413
+ return (h("div", { class: "info-wrapper" }, 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) }), h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` }, this.renderIcon(), this.buttonText), this.renderInfo()));
414
+ }
415
+ renderEmptyState() {
416
+ return (h("div", { class: "empty-block" }, this.renderUploadSvg(), h("div", { class: `empty-message` }, this.emptyStateText), this.renderUploadButton("-primary empty-button"), this.renderNotif()));
417
+ }
418
+ renderFileName(filename, isUploading) {
419
+ return (h("div", { class: "left-group" }, h("div", { class: "name-wrapper" }, h("span", { class: "filename", "data-filename": filename, onMouseEnter: (ev) => this.handleFilenameMouseEnter(ev, filename), onMouseLeave: () => hideTooltip() }), isUploading && h("span", { class: "sr-only" }, "uploading"), h("div", { class: "sr-only ch-measure" }))));
420
+ }
421
+ renderErrorList() {
422
+ if (!!this.errorList.length) {
423
+ let srMessage = this.errorList.reduce(function (acc, err) {
424
+ return acc + `${err.name}: ${err.message} `;
425
+ }, "");
426
+ this.announce(srMessage);
427
+ return (h("ul", { class: "error-list" }, this.errorList.map((err) => {
428
+ const clearButtonLabel = intl.formatMessage({
429
+ id: "uploader.clearErrorLabel",
430
+ defaultMessage: "Clear {fileName} error",
431
+ description: "Label for a button used to clear an error, including filename",
432
+ }, { fileName: err.name });
433
+ return (h("li", null, h("div", { class: "file --error" }, this.renderFileName(err.name, false), h("wm-button", { "permanently-delete": true, "button-type": "textonly", "label-for-identical-buttons": clearButtonLabel, onClick: () => {
434
+ this.clearError(err.name);
435
+ this.uploadButtonEl.focus();
436
+ } }, this.clearButtonText)), h("div", { class: "error-message" }, err.message)));
437
+ })));
438
+ }
439
+ }
440
+ renderFileInProgress(item) {
441
+ const filename = item.type ? `${item.name}.${item.type}` : item.name;
442
+ return (h("li", null, h("div", { class: "file --progress" }, h("div", { class: "progress", style: {
443
+ background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
444
+ } }), this.renderFileName(filename, this.isItemUploading(item)))));
445
+ }
446
+ renderFile(item) {
447
+ const filename = item.type ? `${item.name}.${item.type}` : item.name;
448
+ const hasSingleFileAction = item.fileActions && item.fileActions.split(" ").length === 1;
449
+ const showActionMenu = !this.tempUploaderType && this.isCondensed && !hasSingleFileAction;
450
+ const showFileInfo = !this.tempUploaderType && !this.isCondensed;
451
+ // @ts-ignore it's possible progress is passed in as a string, so we need to check for "100" as well
452
+ const showCheckmark = !this.tempUploaderType && (item.progress === 100 || item.progress === "100");
453
+ return (h("li", { class: `${this.isCondensed ? "condensed" : ""} ${showCheckmark ? "checked" : ""}` }, h("div", { class: "file --saved" }, this.renderFileName(filename, this.isItemUploading(item)), h("div", { class: "right-group" }, showFileInfo && this.renderFileInfo(item), showActionMenu ? this.renderActionMenu(item) : this.renderFileActions(item)))));
454
+ }
455
+ handleFilenameMouseEnter(ev, filename) {
456
+ // only show tooltip if file name is being truncated (has ellipses)
457
+ if (ev.target.textContent.includes("...")) {
458
+ showTooltip("bottom", ev.target, filename);
459
+ }
460
+ }
461
+ componentDidRender() {
462
+ const files = this.el.shadowRoot.querySelectorAll(".file");
463
+ files.forEach((file) => this.truncateFileName(file));
464
+ }
465
+ truncateFileName(file) {
466
+ const leftGroup = file.querySelector(".left-group");
467
+ const leftBoundary = leftGroup.getBoundingClientRect().left;
468
+ const rightGroup = file.querySelector(".right-group");
469
+ const rightBoundary = rightGroup
470
+ ? rightGroup.getBoundingClientRect().left
471
+ : file.getBoundingClientRect().right - 20;
472
+ const filenameEl = file.querySelector(".filename");
473
+ const availableSpace = rightBoundary - leftBoundary;
474
+ let filename = filenameEl.dataset.filename;
475
+ const canFitText = availableSpace > filename.length * this.chMeasure;
476
+ if (!canFitText) {
477
+ const extension = filename.slice(filename.lastIndexOf("."));
478
+ const numFittingCharacters = Math.floor(availableSpace / this.chMeasure);
479
+ // three ellipses, three constant characters, extension
480
+ const postEllipsesLength = 3 + 3 + extension.length;
481
+ let preEllipsesLength = Math.max(2, numFittingCharacters - postEllipsesLength);
482
+ const preEllipsesText = filename.slice(0, preEllipsesLength);
483
+ const postEllipsesText = filename.slice(filename.indexOf(extension) - 3, filename.length);
484
+ filename = `${preEllipsesText.trim()}...${postEllipsesText.trim()}`;
485
+ }
486
+ filenameEl.textContent = filename;
487
+ }
488
+ renderFileActions(item) {
489
+ const defaultFileActions = "download delete";
490
+ const availableActions = item.fileActions || defaultFileActions;
491
+ const previewButton = (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) }));
492
+ const downloadButton = (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) }));
493
+ const deleteButton = (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) }));
494
+ return (h("div", { class: "file-controls" }, availableActions.includes("preview") && previewButton, availableActions.includes("download") && downloadButton, availableActions.includes("delete") && deleteButton));
495
+ }
496
+ renderActionMenu(item) {
497
+ const defaultFileActions = "download delete";
498
+ const availableActions = item.fileActions || defaultFileActions;
499
+ const previewItem = (h("wm-menuitem", { icon: "f208", onClick: () => this.previewFile(item) }, this.previewActionMessage));
500
+ const downloadItem = (h("wm-menuitem", { icon: "f1da", onClick: () => this.downloadFile(item) }, this.downloadActionMessage));
501
+ const deleteItem = (h("wm-menuitem", { icon: "f1c0", onClick: () => this.deleteFile(item) }, this.deleteActionMessage));
502
+ return (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));
503
+ }
504
+ renderFileInfo(item) {
505
+ let elementToRender = undefined;
506
+ if (this.showInfo === "time") {
507
+ const uploadDate = new Date(Date.parse(item.lastUpdated));
508
+ const day = uploadDate.getDate();
509
+ const month = uploadDate.getMonth() + 1;
510
+ const year = uploadDate.getFullYear();
511
+ const time = uploadDate.toLocaleTimeString("en-us", { hour: "numeric", minute: "2-digit" });
512
+ const formattedDate = `${month}/${day}/${year} ${time}`;
513
+ elementToRender = h("div", { class: "file-info" }, formattedDate);
514
+ }
515
+ else if (this.showInfo === "size" && item.size) {
516
+ const convertedSize = this.convertBytes(item.size);
517
+ elementToRender = h("div", { class: "file-info" }, `${convertedSize.size.toFixed(0)} ${convertedSize.unit}`);
518
+ }
519
+ return elementToRender;
520
+ }
521
+ renderFileList() {
522
+ if (this.fileList) {
523
+ this.sortBy === "name"
524
+ ? this.fileList.sort((a, b) => a.name.localeCompare(b.name))
525
+ : this.fileList.sort((a, b) => Date.parse(a.lastUpdated) - Date.parse(b.lastUpdated));
526
+ return (h("div", null, h("ul", { class: "inprogress-list" }, this.fileList.filter((item) => this.isItemUploading(item)).map((item) => this.renderFileInProgress(item))), h("ul", { class: "file-list" }, this.fileList.filter((item) => !this.isItemUploading(item)).map((item) => this.renderFile(item)))));
527
+ }
528
+ }
529
+ legacyRenderHeader() {
530
+ return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, h("div", { class: "slot-wrapper" }, h("slot", null), h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderNotif()))));
531
+ }
532
+ renderHeader() {
533
+ return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`), this.renderRequirements()), h("div", { id: "accepted-types", class: "accepted-types" }, this.acceptedFileTypesMessage), this.renderNotif()));
534
+ }
535
+ renderRequirements() {
536
+ return (h("div", { class: "requirements" }, this.maxFiles && h("span", { id: "file-count" }, this.fileCountMessage), this.maxSize && h("span", { id: "max-size" }, this.maxSizeMessage)));
537
+ }
538
+ renderFooter() {
539
+ return (h("div", { class: "footer" }, h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` }, h("div", { class: "filecount-wrapper" }, h("div", { class: "filecount" }, intl.formatMessage({
540
+ id: "uploader.filesAdded",
541
+ defaultMessage: "{numFiles, plural, one {1 file added} other {# files added}}",
542
+ }, { numFiles: this.fileList.length })), this.renderUploadButton(`-primary ${this.isDisabled ? "disabled" : ""}`)), this.renderNotif())));
543
+ }
544
+ renderWithItems() {
545
+ // it's possible progress is passed in as a string, so we need to check for "100" as well
546
+ const hasNewlyUploadedFiles = this.fileList.filter((file) => file.progress === (typeof file.progress === "number" ? 100 : "100")).length > 0;
547
+ return (h("div", null, !this.tempUploaderType && this.renderHeader(), this.tempUploaderType === "2" && this.legacyRenderHeader(), h("div", { class: `list-container type${this.tempUploaderType} ${!this.tempUploaderType && hasNewlyUploadedFiles ? "checkmark-spacer" : ""}` }, this.renderErrorList(), this.renderFileList()), this.tempUploaderType === "1" && this.renderFooter()));
548
+ }
549
+ render() {
550
+ return (h(Host, null, this.isEmpty() && this.tempUploaderType === "1" ? this.renderEmptyState() : this.renderWithItems(), 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
551
+ ,
552
+ "aria-atomic": "true" }, this.announcement)));
553
+ }
554
+ get el() { return getElement(this); }
555
+ static get watchers() { return {
556
+ "files": ["parseFiles"],
557
+ "rejectedFiles": ["parseRejectedFiles"],
558
+ "numFilesInProgress": ["uploadNotifications"]
559
+ }; }
560
+ };
561
561
  Uploader.style = wmUploaderCss;
562
562
 
563
563
  export { Uploader as wm_uploader };