@watermarkinsights/ripple 3.11.0-7 → 3.11.0

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 (307) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{chartFunctions-44ae2eee.js → chartFunctions-847c1e8b.js} +420 -420
  3. package/dist/cjs/{functions-1a67b971.js → functions-e80fc415.js} +1921 -477
  4. package/dist/cjs/{global-1d0db5b3.js → global-8910723e.js} +60 -60
  5. package/dist/cjs/{http-service-494d81de.js → http-service-9e8c4dd5.js} +49 -49
  6. package/dist/cjs/{index-acad7ab3.js → index-df6a3611.js} +4 -1
  7. package/dist/cjs/{interfaces-a3338581.js → interfaces-30a74c1f.js} +29 -29
  8. package/dist/cjs/loader.cjs.js +3 -3
  9. package/dist/cjs/priv-chart-popover.cjs.entry.js +87 -87
  10. package/dist/cjs/priv-datepicker.cjs.entry.js +658 -658
  11. package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
  12. package/dist/cjs/priv-navigator-item.cjs.entry.js +24 -24
  13. package/dist/cjs/ripple.cjs.js +3 -3
  14. package/dist/cjs/wm-action-menu_2.cjs.entry.js +336 -336
  15. package/dist/cjs/wm-button.cjs.entry.js +227 -227
  16. package/dist/cjs/wm-chart-slice.cjs.entry.js +14 -14
  17. package/dist/cjs/wm-chart.cjs.entry.js +111 -111
  18. package/dist/cjs/wm-datepicker.cjs.entry.js +266 -266
  19. package/dist/cjs/wm-input.cjs.entry.js +135 -135
  20. package/dist/cjs/wm-modal-footer.cjs.entry.js +34 -34
  21. package/dist/cjs/wm-modal-header.cjs.entry.js +37 -37
  22. package/dist/cjs/wm-modal.cjs.entry.js +164 -164
  23. package/dist/cjs/wm-navigation_3.cjs.entry.js +228 -228
  24. package/dist/cjs/wm-navigator.cjs.entry.js +269 -269
  25. package/dist/cjs/wm-network-uploader.cjs.entry.js +453 -453
  26. package/dist/cjs/wm-option_2.cjs.entry.js +485 -485
  27. package/dist/cjs/wm-pagination.cjs.entry.js +168 -168
  28. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +130 -130
  29. package/dist/cjs/wm-search.cjs.entry.js +233 -233
  30. package/dist/cjs/wm-snackbar.cjs.entry.js +171 -171
  31. package/dist/cjs/wm-tab-item_3.cjs.entry.js +297 -297
  32. package/dist/cjs/wm-tag-input.cjs.entry.js +580 -580
  33. package/dist/cjs/wm-timepicker.cjs.entry.js +384 -384
  34. package/dist/cjs/wm-toggletip.cjs.entry.js +125 -125
  35. package/dist/cjs/wm-uploader.cjs.entry.js +608 -608
  36. package/dist/cjs/wm-wrapper.cjs.entry.js +13 -13
  37. package/dist/collection/collection-manifest.json +1 -1
  38. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +258 -258
  39. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +115 -115
  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.js +195 -195
  42. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +88 -88
  43. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +111 -111
  44. package/dist/collection/components/wm-action-menu/wm-action-menu.js +448 -448
  45. package/dist/collection/components/wm-button/wm-button.js +491 -491
  46. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1024 -1024
  47. package/dist/collection/components/wm-datepicker/wm-datepicker.js +471 -471
  48. package/dist/collection/components/wm-input/wm-input.js +423 -423
  49. package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
  50. package/dist/collection/components/wm-modal/wm-modal-footer.js +136 -136
  51. package/dist/collection/components/wm-modal/wm-modal-header.js +87 -87
  52. package/dist/collection/components/wm-modal/wm-modal.js +461 -461
  53. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +162 -162
  54. package/dist/collection/components/wm-navigation/wm-navigation-item.js +121 -121
  55. package/dist/collection/components/wm-navigation/wm-navigation.js +218 -218
  56. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
  57. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
  58. package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
  59. package/dist/collection/components/wm-option/wm-option.js +414 -414
  60. package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
  61. package/dist/collection/components/wm-search/wm-search.js +480 -480
  62. package/dist/collection/components/wm-select/wm-select.js +718 -718
  63. package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
  64. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +216 -216
  65. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +330 -330
  66. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
  67. package/dist/collection/components/wm-tag-input/wm-tag-input.js +810 -810
  68. package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
  69. package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
  70. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +785 -785
  71. package/dist/collection/components/wm-uploader/wm-uploader.js +1051 -1051
  72. package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
  73. package/dist/collection/dev/scripts.js +20 -20
  74. package/dist/collection/global/__mocks__/functions.js +6 -6
  75. package/dist/collection/global/chartFunctions.js +421 -421
  76. package/dist/collection/global/functions.js +468 -468
  77. package/dist/collection/global/global.js +67 -67
  78. package/dist/collection/global/interfaces.js +49 -49
  79. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  80. package/dist/collection/global/services/http-service.js +50 -50
  81. package/dist/collection/lang/lang.js +5 -5
  82. package/dist/collection/lang/missing.js +43 -43
  83. package/dist/collection/lang/piglatin.js +93 -93
  84. package/dist/esm/{chartFunctions-8fa800a6.js → chartFunctions-60cabc24.js} +420 -420
  85. package/dist/esm/{functions-61c7bb1f.js → functions-dde318c0.js} +1921 -477
  86. package/dist/esm/{global-95c6121b.js → global-efcb3f02.js} +60 -60
  87. package/dist/esm/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +49 -49
  88. package/dist/esm/{index-7603f98e.js → index-17c79cc6.js} +4 -1
  89. package/dist/esm/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +29 -29
  90. package/dist/esm/loader.js +3 -3
  91. package/dist/esm/polyfills/core-js.js +0 -0
  92. package/dist/esm/polyfills/css-shim.js +1 -1
  93. package/dist/esm/polyfills/dom.js +0 -0
  94. package/dist/esm/polyfills/es5-html-element.js +0 -0
  95. package/dist/esm/polyfills/index.js +0 -0
  96. package/dist/esm/polyfills/system.js +0 -0
  97. package/dist/esm/priv-chart-popover.entry.js +87 -87
  98. package/dist/esm/priv-datepicker.entry.js +658 -658
  99. package/dist/esm/priv-navigator-button.entry.js +19 -19
  100. package/dist/esm/priv-navigator-item.entry.js +24 -24
  101. package/dist/esm/ripple.js +3 -3
  102. package/dist/esm/wm-action-menu_2.entry.js +336 -336
  103. package/dist/esm/wm-button.entry.js +227 -227
  104. package/dist/esm/wm-chart-slice.entry.js +14 -14
  105. package/dist/esm/wm-chart.entry.js +111 -111
  106. package/dist/esm/wm-datepicker.entry.js +266 -266
  107. package/dist/esm/wm-input.entry.js +135 -135
  108. package/dist/esm/wm-modal-footer.entry.js +34 -34
  109. package/dist/esm/wm-modal-header.entry.js +37 -37
  110. package/dist/esm/wm-modal.entry.js +164 -164
  111. package/dist/esm/wm-navigation_3.entry.js +228 -228
  112. package/dist/esm/wm-navigator.entry.js +269 -269
  113. package/dist/esm/wm-network-uploader.entry.js +453 -453
  114. package/dist/esm/wm-option_2.entry.js +485 -485
  115. package/dist/esm/wm-pagination.entry.js +168 -168
  116. package/dist/esm/wm-progress-indicator_3.entry.js +130 -130
  117. package/dist/esm/wm-search.entry.js +233 -233
  118. package/dist/esm/wm-snackbar.entry.js +171 -171
  119. package/dist/esm/wm-tab-item_3.entry.js +297 -297
  120. package/dist/esm/wm-tag-input.entry.js +580 -580
  121. package/dist/esm/wm-timepicker.entry.js +384 -384
  122. package/dist/esm/wm-toggletip.entry.js +125 -125
  123. package/dist/esm/wm-uploader.entry.js +608 -608
  124. package/dist/esm/wm-wrapper.entry.js +13 -13
  125. package/dist/esm-es5/{chartFunctions-8fa800a6.js → chartFunctions-60cabc24.js} +1 -1
  126. package/dist/esm-es5/functions-dde318c0.js +1 -0
  127. package/dist/esm-es5/global-efcb3f02.js +1 -0
  128. package/dist/esm-es5/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +0 -0
  129. package/dist/esm-es5/{index-7603f98e.js → index-17c79cc6.js} +1 -1
  130. package/dist/esm-es5/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +0 -0
  131. package/dist/esm-es5/loader.js +1 -1
  132. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  133. package/dist/esm-es5/priv-datepicker.entry.js +1 -1
  134. package/dist/esm-es5/priv-navigator-button.entry.js +1 -1
  135. package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
  136. package/dist/esm-es5/ripple.js +1 -1
  137. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  138. package/dist/esm-es5/wm-button.entry.js +1 -1
  139. package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
  140. package/dist/esm-es5/wm-chart.entry.js +1 -1
  141. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  142. package/dist/esm-es5/wm-input.entry.js +1 -1
  143. package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
  144. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  145. package/dist/esm-es5/wm-modal.entry.js +1 -1
  146. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  147. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  148. package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
  149. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  150. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  151. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  152. package/dist/esm-es5/wm-search.entry.js +1 -1
  153. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  154. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  155. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  156. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  157. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  158. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  159. package/dist/esm-es5/wm-wrapper.entry.js +1 -1
  160. package/dist/ripple/p-008292f6.system.js +1 -0
  161. package/dist/ripple/p-05757c14.entry.js +1 -0
  162. package/dist/ripple/p-06618a34.entry.js +1 -0
  163. package/dist/ripple/p-068e874b.entry.js +1 -0
  164. package/dist/ripple/{p-f5df5903.system.js → p-08b7ec08.system.js} +0 -0
  165. package/dist/ripple/{p-73d66b0a.system.entry.js → p-0e605966.system.entry.js} +1 -1
  166. package/dist/ripple/p-0f4a6a8f.entry.js +1 -0
  167. package/dist/ripple/{p-68155230.system.entry.js → p-158f538a.system.entry.js} +1 -1
  168. package/dist/ripple/p-199f825e.js +1 -0
  169. package/dist/ripple/p-1cee0339.entry.js +1 -0
  170. package/dist/ripple/{p-eee347b4.system.entry.js → p-1eb5cb0d.system.entry.js} +1 -1
  171. package/dist/ripple/{p-eacd33cc.system.entry.js → p-25696dab.system.entry.js} +1 -1
  172. package/dist/ripple/p-262c75ff.entry.js +1 -0
  173. package/dist/ripple/{p-90ed3268.system.entry.js → p-27253ed2.system.entry.js} +1 -1
  174. package/dist/ripple/{p-3f1d8211.system.entry.js → p-29425d92.system.entry.js} +1 -1
  175. package/dist/ripple/{p-9d02957d.system.js → p-313b6073.system.js} +0 -0
  176. package/dist/ripple/p-321daa60.entry.js +1 -0
  177. package/dist/ripple/{p-d3ed8b65.system.entry.js → p-35f21755.system.entry.js} +1 -1
  178. package/dist/ripple/{p-d81a4e7c.system.entry.js → p-3b77a3f7.system.entry.js} +1 -1
  179. package/dist/ripple/{p-398b2486.system.entry.js → p-3d4bf3df.system.entry.js} +1 -1
  180. package/dist/ripple/p-416944fd.entry.js +1 -0
  181. package/dist/ripple/p-425ef815.entry.js +1 -0
  182. package/dist/ripple/p-4296b0ba.entry.js +1 -0
  183. package/dist/ripple/p-43b09b72.entry.js +1 -0
  184. package/dist/ripple/{p-fdc4a599.system.entry.js → p-4f393ce8.system.entry.js} +1 -1
  185. package/dist/ripple/p-57c94258.entry.js +1 -0
  186. package/dist/ripple/{p-1df2adee.system.entry.js → p-59678b70.system.entry.js} +1 -1
  187. package/dist/ripple/p-6220c94d.entry.js +1 -0
  188. package/dist/ripple/{p-c873b490.system.entry.js → p-6bfc949d.system.entry.js} +1 -1
  189. package/dist/ripple/p-6dbc79be.entry.js +1 -0
  190. package/dist/ripple/{p-a0c3ef16.system.js → p-726b9452.system.js} +1 -1
  191. package/dist/ripple/{p-aa7dfaae.system.js → p-72c1052f.system.js} +1 -1
  192. package/dist/ripple/p-789e0afa.entry.js +1 -0
  193. package/dist/ripple/{p-8aa9f811.js → p-7cb0b2a5.js} +1 -1
  194. package/dist/ripple/{p-43f1298b.js → p-888bec42.js} +0 -0
  195. package/dist/ripple/{p-42aa51fe.system.entry.js → p-8fab569a.system.entry.js} +1 -1
  196. package/dist/ripple/p-962f51ff.entry.js +1 -0
  197. package/dist/ripple/p-98c9b376.entry.js +1 -0
  198. package/dist/ripple/p-9d069ec5.entry.js +1 -0
  199. package/dist/ripple/p-9ec9ba5b.entry.js +1 -0
  200. package/dist/ripple/{p-fd8070fb.js → p-a6d6eae7.js} +0 -0
  201. package/dist/ripple/p-aacdaa79.entry.js +1 -0
  202. package/dist/ripple/{p-212aac05.system.entry.js → p-ad60e3ba.system.entry.js} +1 -1
  203. package/dist/ripple/p-b0536ddb.entry.js +1 -0
  204. package/dist/ripple/{p-487f7419.system.entry.js → p-b0ba5460.system.entry.js} +1 -1
  205. package/dist/ripple/p-b1928a70.js +1 -0
  206. package/dist/ripple/p-b9d5b407.entry.js +1 -0
  207. package/dist/ripple/{p-3e6498ea.system.entry.js → p-bc207b54.system.entry.js} +1 -1
  208. package/dist/ripple/{p-44035b02.system.entry.js → p-bd9e6e7b.system.entry.js} +1 -1
  209. package/dist/ripple/p-c0ab18ce.entry.js +1 -0
  210. package/dist/ripple/{p-28bf6a2e.system.js → p-c1185f13.system.js} +1 -1
  211. package/dist/ripple/p-c2abdcba.js +1 -0
  212. package/dist/ripple/{p-1242752c.system.entry.js → p-c62df7fc.system.entry.js} +1 -1
  213. package/dist/ripple/{p-ac2485a6.system.entry.js → p-c78f0984.system.entry.js} +1 -1
  214. package/dist/ripple/{p-9f12284b.system.entry.js → p-d0369e2f.system.entry.js} +1 -1
  215. package/dist/ripple/{p-5471864e.system.entry.js → p-d1eff01f.system.entry.js} +1 -1
  216. package/dist/ripple/p-d2996c45.entry.js +1 -0
  217. package/dist/ripple/{p-75ef731b.system.entry.js → p-d934e3bb.system.entry.js} +1 -1
  218. package/dist/ripple/p-d9b98c9d.entry.js +1 -0
  219. package/dist/ripple/{p-ae6cfbca.system.entry.js → p-db44eb6f.system.entry.js} +1 -1
  220. package/dist/ripple/p-dee93986.entry.js +1 -0
  221. package/dist/ripple/p-e4e70417.entry.js +1 -0
  222. package/dist/ripple/{p-3b3e847c.system.entry.js → p-f17076c4.system.entry.js} +1 -1
  223. package/dist/ripple/{p-cbaa2b18.system.entry.js → p-f2959770.system.entry.js} +1 -1
  224. package/dist/ripple/p-fa8569d2.system.js +1 -0
  225. package/dist/ripple/{p-72eb5064.system.entry.js → p-fb4d6afd.system.entry.js} +1 -1
  226. package/dist/ripple/{p-e180001c.system.entry.js → p-fffdb4fb.system.entry.js} +1 -1
  227. package/dist/ripple/ripple.esm.js +1 -1
  228. package/dist/ripple/ripple.js +1 -1
  229. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
  230. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
  231. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +36 -36
  232. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +27 -27
  233. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +17 -17
  234. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
  235. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +47 -47
  236. package/dist/types/components/wm-button/wm-button.d.ts +43 -43
  237. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
  238. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +41 -41
  239. package/dist/types/components/wm-input/wm-input.d.ts +46 -46
  240. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  241. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
  242. package/dist/types/components/wm-modal/wm-modal-header.d.ts +11 -11
  243. package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
  244. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +21 -21
  245. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
  246. package/dist/types/components/wm-navigation/wm-navigation.d.ts +28 -28
  247. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  248. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  249. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  250. package/dist/types/components/wm-option/wm-option.d.ts +32 -32
  251. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  252. package/dist/types/components/wm-search/wm-search.d.ts +86 -86
  253. package/dist/types/components/wm-select/wm-select.d.ts +66 -66
  254. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
  255. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
  256. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
  257. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  258. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +92 -92
  259. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +61 -61
  260. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
  261. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  262. package/dist/types/components/wm-uploader/wm-uploader.d.ts +115 -115
  263. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  264. package/dist/types/components.d.ts +24 -24
  265. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  266. package/dist/types/global/chartFunctions.d.ts +29 -29
  267. package/dist/types/global/functions.d.ts +42 -42
  268. package/dist/types/global/global.d.ts +1 -1
  269. package/dist/types/global/interfaces.d.ts +44 -44
  270. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  271. package/dist/types/global/services/http-service.d.ts +4 -4
  272. package/dist/types/lang/lang.d.ts +5 -5
  273. package/package.json +47 -47
  274. package/dist/esm-es5/functions-61c7bb1f.js +0 -15
  275. package/dist/esm-es5/global-95c6121b.js +0 -1
  276. package/dist/ripple/p-00fa3d4b.entry.js +0 -1
  277. package/dist/ripple/p-0f33461d.entry.js +0 -1
  278. package/dist/ripple/p-15b1c11b.js +0 -16
  279. package/dist/ripple/p-30745db6.entry.js +0 -1
  280. package/dist/ripple/p-358bde27.entry.js +0 -1
  281. package/dist/ripple/p-35cfcf9f.entry.js +0 -1
  282. package/dist/ripple/p-379b125b.entry.js +0 -1
  283. package/dist/ripple/p-4d59fe86.entry.js +0 -1
  284. package/dist/ripple/p-520b0f54.entry.js +0 -1
  285. package/dist/ripple/p-5e041c35.entry.js +0 -1
  286. package/dist/ripple/p-694ae9fe.system.js +0 -1
  287. package/dist/ripple/p-76ca7498.system.js +0 -15
  288. package/dist/ripple/p-7fae0cc2.entry.js +0 -1
  289. package/dist/ripple/p-8caae464.entry.js +0 -1
  290. package/dist/ripple/p-8d347cd5.entry.js +0 -1
  291. package/dist/ripple/p-92226595.entry.js +0 -1
  292. package/dist/ripple/p-9fe64cec.entry.js +0 -1
  293. package/dist/ripple/p-a82d37d8.entry.js +0 -1
  294. package/dist/ripple/p-a9e0ce88.entry.js +0 -1
  295. package/dist/ripple/p-b3c71506.js +0 -1
  296. package/dist/ripple/p-b8d06eff.js +0 -1
  297. package/dist/ripple/p-ba168596.entry.js +0 -1
  298. package/dist/ripple/p-cd4fda75.entry.js +0 -1
  299. package/dist/ripple/p-d3603def.entry.js +0 -1
  300. package/dist/ripple/p-e49b9a96.entry.js +0 -1
  301. package/dist/ripple/p-e748e22b.entry.js +0 -1
  302. package/dist/ripple/p-e75e75e0.entry.js +0 -1
  303. package/dist/ripple/p-ed657559.entry.js +0 -1
  304. package/dist/ripple/p-ed7169e8.entry.js +0 -1
  305. package/dist/ripple/p-f0656464.entry.js +0 -1
  306. package/dist/ripple/p-f12a510f.entry.js +0 -1
  307. package/dist/ripple/p-f36b74bf.entry.js +0 -1
@@ -1,1051 +1,1051 @@
1
- import { Component, Element, Event, h, Host, Prop, State, Listen, Watch } from "@stencil/core";
2
- import { forceUpdate } from "@stencil/core";
3
- import { debounce, generateId, hasValidType, intl } from "../../global/functions";
4
- export class Uploader {
5
- constructor() {
6
- this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
7
- this.defaultMaxSize = 100;
8
- this.maxSize = this.defaultMaxSize; // in Mb
9
- this.sortBy = "date"; // name is descending (a -> z), date is ascending (earlier -> later)
10
- this.showInfo = "time";
11
- this.fileList = []; // the string above transformed into the actual array
12
- this.filesToUpload = []; // input.files that passed validation
13
- this.isTabbing = false;
14
- this.errorList = []; // for errors on a particular file
15
- this.isCondensed = false;
16
- this.inputId = generateId();
17
- this.debouncedResize = debounce(() => {
18
- this.isCondensed = this.el.clientWidth < 500;
19
- // rerender to show filename truncation changes
20
- forceUpdate(this.el);
21
- }, 50);
22
- }
23
- get tooltipEl() {
24
- return document.getElementById("wm-tooltip");
25
- }
26
- get tempUploaderType() {
27
- // replace instances of this.tempUploaderType with this.uploaderType once type is fully phased out
28
- return this.type || this.uploaderType;
29
- }
30
- get chMeasure() {
31
- return this.el.shadowRoot.querySelector(".ch-measure").clientWidth;
32
- }
33
- get fileLimitReached() {
34
- return this.maxFiles && this.fileList.length >= this.maxFiles;
35
- }
36
- get fileUploadLimitMessage() {
37
- return intl.formatMessage({
38
- id: "uploader.fileUploadLimit",
39
- defaultMessage: "Maximum number of files reached",
40
- description: "Message displayed when reaching the file upload limit",
41
- });
42
- }
43
- get fileCountMessage() {
44
- return this.fileLimitReached
45
- ? this.fileUploadLimitMessage
46
- : intl.formatMessage({
47
- id: "uploader.fileCount",
48
- defaultMessage: "{x} of {y} Files",
49
- description: "A count of the number of files currently uploaded",
50
- }, { x: this.fileList.length, y: this.maxFiles });
51
- }
52
- get maxSizeMessage() {
53
- return intl.formatMessage({
54
- id: "uploader.maxSize",
55
- defaultMessage: "Maximum file size {maxSize}MB",
56
- description: "An indicator of the maximum file size the uploader allows",
57
- }, {
58
- maxSize: this.maxSize,
59
- });
60
- }
61
- get acceptedFileTypesMessage() {
62
- const validTypes = "." + this.fileTypes.split(" ").join(", .");
63
- return intl.formatMessage({
64
- id: "uploader.acceptedFileTypes",
65
- defaultMessage: "Accepted file {amount, plural, =1 {type} other {types}}: {fileTypes}",
66
- }, {
67
- fileTypes: validTypes,
68
- amount: this.fileTypes.split(" ").length,
69
- });
70
- }
71
- get previewActionMessage() {
72
- return intl.formatMessage({
73
- id: "uploader.previewAction",
74
- defaultMessage: "Preview File",
75
- description: "Label of a button that triggers a file to be previewed",
76
- });
77
- }
78
- get downloadActionMessage() {
79
- return intl.formatMessage({
80
- id: "uploader.downloadAction",
81
- defaultMessage: "Download File",
82
- description: "Label of a button that triggers a file to be downloaded",
83
- });
84
- }
85
- get deleteActionMessage() {
86
- return intl.formatMessage({
87
- id: "uploader.deleteAction",
88
- defaultMessage: "Delete File",
89
- description: "Label of a button that triggers a file to be delete",
90
- });
91
- }
92
- get actionMenuLabel() {
93
- return intl.formatMessage({
94
- id: "uploader.actionMenuLabel",
95
- defaultMessage: "Actions",
96
- description: "Label of a button that opens a menu of file actions",
97
- });
98
- }
99
- toggleTabbingOn() {
100
- this.isTabbing = true;
101
- }
102
- toggleTabbingOff() {
103
- this.isTabbing = false;
104
- }
105
- handleUploadProgress(ev) {
106
- this.fileList.map((i) => {
107
- if (i.id === ev.detail.id) {
108
- i.progress = ev.detail.progress;
109
- forceUpdate(this.el);
110
- }
111
- });
112
- if (ev.detail.progress === 100) {
113
- // inProgressList is not a perfect reflection of how many files are uploading
114
- // because even after progress reached 100% the item should remain in the array
115
- // (should only be removed once it appears in fileList)
116
- this.numFilesInProgress -= 1;
117
- }
118
- // aggregate the percentages for SR to announce progress
119
- if (!this.srProgress && this.numFilesInProgress) {
120
- const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
121
- this.srProgress = setInterval(() => {
122
- const aggregate = this.fileList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
123
- if (this.liveRegion) {
124
- this.liveRegion.innerHTML = intl.formatMessage({
125
- id: "uploader.uploadProgress",
126
- defaultMessage: "Upload progress: {percentage}%",
127
- }, { percentage: Math.floor(aggregate / total) });
128
- }
129
- }, 5000);
130
- }
131
- }
132
- parseFiles() {
133
- if (!!this.files) {
134
- if (typeof this.files === "string") {
135
- const list = JSON.parse(this.files);
136
- if (typeof list === "object") {
137
- this.fileList = list;
138
- }
139
- else {
140
- throw new Error("could not parse string passed to files attribute");
141
- }
142
- }
143
- else {
144
- throw new Error("Attribute 'files' should be a string");
145
- }
146
- }
147
- }
148
- parseRejectedFiles() {
149
- if (!!this.rejectedFiles) {
150
- if (typeof this.files === "string") {
151
- const list = JSON.parse(this.rejectedFiles);
152
- if (typeof list === "object") {
153
- this.errorList = list;
154
- }
155
- else {
156
- throw new Error("could not parse string passed to errors attribute");
157
- }
158
- }
159
- else {
160
- throw new Error("Attribute 'rejected-files' should be a string");
161
- }
162
- }
163
- }
164
- setMaxSize() {
165
- // Max size can't be set above 100Mb
166
- this.maxSize = this.maxSize > this.defaultMaxSize ? this.defaultMaxSize : this.maxSize;
167
- }
168
- uploadNotifications(newNum, oldNum) {
169
- if (oldNum > 0 && newNum === 0) {
170
- setTimeout(() => {
171
- this.notif = null;
172
- }, 20 * 1000);
173
- const message = intl.formatMessage({
174
- id: "uploader.finishedUploading",
175
- defaultMessage: "Finished uploading",
176
- });
177
- this.notif = { id: 5, message };
178
- if (this.liveRegion) {
179
- this.liveRegion.innerHTML = message;
180
- }
181
- this.numFilesInProgress = null;
182
- clearInterval(this.srProgress);
183
- forceUpdate(this.el);
184
- }
185
- else if (newNum > 0 && newNum != oldNum) {
186
- const message = intl.formatMessage({
187
- id: "uploader.filesUploading",
188
- defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
189
- }, { num: newNum });
190
- this.notif = { id: 6, message };
191
- if (this.liveRegion) {
192
- this.liveRegion.innerHTML = message;
193
- }
194
- forceUpdate(this.el);
195
- }
196
- }
197
- isValidSize(size) {
198
- return this.convertBytes(size, "MB").size <= this.maxSize;
199
- }
200
- convertBytes(bytes, unit) {
201
- // https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
202
- const unitOrder = ["bytes", "KB", "MB", "GB", "TB"];
203
- let unitIndex = 0;
204
- let result = bytes;
205
- if (unit) {
206
- // convert until result matches desired unit
207
- while (unitOrder.indexOf(unit) > unitIndex) {
208
- result /= 1024;
209
- unitIndex++;
210
- }
211
- }
212
- else {
213
- // convert until result is appropriate unit (value is under 1000)
214
- while (result > 1000) {
215
- result /= 1024;
216
- unitIndex++;
217
- }
218
- }
219
- return { size: result, unit: unitOrder[unitIndex] };
220
- }
221
- isDuplicate(name) {
222
- return this.fileList.find((f) => {
223
- const filename = f.type ? f.name + "." + f.type : f.name;
224
- return filename === name;
225
- });
226
- }
227
- isEmpty() {
228
- return !this.fileList.length && !this.errorList.length;
229
- }
230
- get isDisabled() {
231
- if (!this.notif) {
232
- if (this.fileLimitReached) {
233
- const errMessage = this.fileUploadLimitMessage;
234
- this.notif = { id: 1, message: errMessage };
235
- if (this.liveRegion) {
236
- this.liveRegion.innerHTML = errMessage;
237
- }
238
- }
239
- else {
240
- this.notif = null;
241
- }
242
- }
243
- else if (this.notif.id === 1) {
244
- // to make sure SR don't repeat the error, don't reset it if it already is showing
245
- // just dismiss it if isMax is not true anymore
246
- if (!this.fileLimitReached) {
247
- this.notif = null;
248
- }
249
- // finally do nothing if error 2 is showing (special case when user selects too many files)
250
- }
251
- // disable if is the uploader is maxed out or if something is uploading
252
- return this.fileLimitReached || this.numFilesInProgress > 0;
253
- }
254
- isItemUploading(item) {
255
- return item.hasOwnProperty("progress") && item.progress < 100;
256
- }
257
- clearErrors() {
258
- this.errorList = [];
259
- this.notif = null;
260
- }
261
- handleFiles(ev) {
262
- this.filesToUpload = [];
263
- const validTypes = this.fileTypes.split(" ").join(", ");
264
- const files = Array.from(ev.target.files);
265
- if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
266
- const errMessage = intl.formatMessage({
267
- id: "uploader.fileUploadExceeded",
268
- defaultMessage: "The number of selected files exceeds the limit.",
269
- });
270
- this.notif = { id: 2, message: errMessage };
271
- if (this.liveRegion) {
272
- this.liveRegion.innerHTML = errMessage;
273
- }
274
- }
275
- else {
276
- files &&
277
- files.map((file) => {
278
- if (!hasValidType(file, this.fileTypes)) {
279
- const error = {
280
- name: file.name,
281
- message: intl.formatMessage({
282
- id: "uploader.invalidFileType",
283
- defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
284
- }, { validTypes }),
285
- };
286
- this.errorList.push(error);
287
- }
288
- else if (file.size === 0) {
289
- const error = {
290
- name: file.name,
291
- message: intl.formatMessage({
292
- id: "uploader.zeroFileSize",
293
- defaultMessage: "The file must be more than 0 bytes",
294
- description: "Error message when user attempts to upload a file of no size",
295
- }),
296
- };
297
- this.errorList.push(error);
298
- }
299
- else if (!this.isValidSize(file.size)) {
300
- const error = {
301
- name: file.name,
302
- message: intl.formatMessage({
303
- id: "uploader.fileTooLarge",
304
- defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
305
- }, { size: this.maxSize }),
306
- };
307
- this.errorList.push(error);
308
- }
309
- else if (this.isDuplicate(file.name)) {
310
- const error = {
311
- name: file.name,
312
- message: intl.formatMessage({
313
- id: "uploader.duplicateName",
314
- defaultMessage: "A file with this name already exists.",
315
- }),
316
- };
317
- this.errorList.push(error);
318
- }
319
- else {
320
- this.filesToUpload.push(file);
321
- }
322
- });
323
- if (this.filesToUpload.length > 0) {
324
- this.numFilesInProgress = this.filesToUpload.length;
325
- this.wmUploaderFilesSelected.emit(this.filesToUpload);
326
- this.wmFilesSelected.emit(this.filesToUpload); // deprecated
327
- }
328
- }
329
- ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
330
- }
331
- previewFile(file) {
332
- this.clearErrors();
333
- this.wmUploaderPreviewFile.emit(file.id);
334
- }
335
- downloadFile(file) {
336
- this.clearErrors();
337
- this.wmUploaderDownloadFile.emit(file.id);
338
- this.wmDownloadFile.emit(file.id); // deprecated
339
- }
340
- deleteFile(file) {
341
- this.clearErrors();
342
- forceUpdate(this.el); // for the button to stop being disabled if num files become < max-files
343
- this.wmUploaderDeleteFile.emit(file.id);
344
- this.wmDeleteFile.emit(file.id); // deprecated
345
- }
346
- componentWillLoad() {
347
- if (!this.buttonText) {
348
- throw new Error("wm-uploader: button-text is a required prop");
349
- }
350
- if (this.type) {
351
- console.warn("wm-uploader: type has been deprecated as of v3.1.0. Please use uploader-type instead.");
352
- }
353
- if (this.tempUploaderType === "1" && !this.emptyStateText) {
354
- throw new Error("wm-uploader: empty-state-text is a required prop");
355
- }
356
- // rerender on resize in case layout needs to change
357
- const resizeObserver = new ResizeObserver(() => this.debouncedResize());
358
- resizeObserver.observe(this.el);
359
- this.setMaxSize();
360
- this.parseFiles();
361
- this.clearErrors();
362
- this.parseRejectedFiles();
363
- }
364
- componentDidLoad() {
365
- if (document.body.classList.contains("wmcl-user-is-tabbing")) {
366
- this.toggleTabbingOn();
367
- }
368
- }
369
- showTooltip(anchorEl, tooltipText) {
370
- this.tooltipEl.textContent = tooltipText;
371
- this.positionTooltip("bottom", anchorEl, this.tooltipEl);
372
- this.tooltipEl.style.transitionDelay = "500ms";
373
- this.tooltipEl.style.opacity = "1";
374
- }
375
- hideTooltip() {
376
- this.tooltipEl.style.transitionDelay = "0s";
377
- this.tooltipEl.style.opacity = "0";
378
- }
379
- positionTooltip(tPos, anchorEl, tooltipEl) {
380
- const tooltipHeight = tooltipEl.getBoundingClientRect().height;
381
- const tooltipWidth = tooltipEl.getBoundingClientRect().width;
382
- // to get the center positions, calculate the difference between the button width and the tooltip width
383
- const verticalDiff = (anchorEl.getBoundingClientRect().height - tooltipHeight) / 2;
384
- const horizontalDiff = (anchorEl.getBoundingClientRect().width - tooltipWidth) / 2;
385
- // the naming convention defaults to center in the absence of a value
386
- // "top" and "bottom" imply centering horizontally; "right" and "left" imply centering vertically
387
- // therefore we first set to center and adjust accordingly
388
- let verticalPos = anchorEl.getBoundingClientRect().top + verticalDiff;
389
- let horizontalPos = anchorEl.getBoundingClientRect().left + horizontalDiff;
390
- if (tPos.includes("top")) {
391
- verticalPos = anchorEl.getBoundingClientRect().top - tooltipHeight - 8;
392
- }
393
- if (tPos.includes("bottom")) {
394
- verticalPos = anchorEl.getBoundingClientRect().bottom + 8;
395
- }
396
- if (tPos.includes("left")) {
397
- horizontalPos = anchorEl.getBoundingClientRect().left - tooltipWidth - 8;
398
- }
399
- if (tPos.includes("right")) {
400
- horizontalPos = anchorEl.getBoundingClientRect().right + 8;
401
- }
402
- // after all positioning has been calculated, if tooltip is off-screen or closer than 24px it is readjusted
403
- // this only occurs when the tooltip is overflowing to the left and is positioned top or bottom
404
- // (button placed too far left, or screen size under 268px)
405
- horizontalPos = Math.max(horizontalPos, 24);
406
- tooltipEl.style.top = (verticalPos / 16).toString() + "rem";
407
- tooltipEl.style.left = (horizontalPos / 16).toString() + "rem";
408
- }
409
- uploadButtonOnClick(ev) {
410
- if (this.isDisabled) {
411
- // this is a temporary fix.
412
- // we need the disabled button to be programmatically focusable
413
- // to allow return focus after closing the browser file panel
414
- // since it's focusable the button should respond when activated
415
- // it looks disabled, and announces the reason why the action cannot
416
- // be taken when activated.
417
- // this is not pretty duplicating a intl message + the logic of isDisabled,
418
- // but not worth a bigger refactor since this is only until we get the UX for disabled elements and refactor all interactive els.
419
- ev.preventDefault();
420
- if (this.liveRegion) {
421
- let errMsg = "";
422
- if (this.numFilesInProgress > 0) {
423
- errMsg = intl.formatMessage({
424
- id: "uploader.waitToUpload",
425
- defaultMessage: "Please wait for current upload to complete before uploading new files.",
426
- description: "Message for screen reader users",
427
- });
428
- }
429
- else if (this.fileLimitReached) {
430
- errMsg = this.fileUploadLimitMessage;
431
- }
432
- if (errMsg) {
433
- // clear and set again to re-announce if button is clicked several times
434
- // (can't be done inside setTimeout because of scope, hence the promise)
435
- this.liveRegion.innerHTML = "";
436
- new Promise((resolve) => {
437
- setTimeout(() => {
438
- resolve("");
439
- }, 500);
440
- }).then(() => (this.liveRegion.innerHTML = errMsg));
441
- }
442
- }
443
- }
444
- else {
445
- this.clearErrors();
446
- }
447
- }
448
- renderUploadSvg() {
449
- return (h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" },
450
- 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" })));
451
- }
452
- renderIcon() {
453
- // mdi attachment icon (paper clip) is horizontal but we want it vertical
454
- const rotate = this.icon && this.icon === "f066";
455
- return (this.icon && (h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
456
- }
457
- renderInfo() {
458
- return this.info && this.tempUploaderType === "2" ? h("span", { class: "info" }, this.info) : "";
459
- }
460
- renderNotif() {
461
- return this.notif ? h("div", { class: "notif" }, this.notif.message) : "";
462
- }
463
- renderUploadButton(classes) {
464
- return (h("div", { class: "info-wrapper" },
465
- 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) }),
466
- h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` },
467
- this.renderIcon(),
468
- this.buttonText),
469
- this.renderInfo()));
470
- }
471
- renderEmptyState() {
472
- return (h("div", { class: "empty-block" },
473
- this.renderUploadSvg(),
474
- h("div", { class: `empty-message` }, this.emptyStateText),
475
- this.renderUploadButton("-primary empty-button"),
476
- this.renderNotif()));
477
- }
478
- renderFileName(filename, isUploading) {
479
- return (h("div", { class: "left-group" },
480
- h("div", { class: "name-wrapper" },
481
- h("span", { class: "filename", "data-filename": filename, onMouseEnter: (ev) => this.handleFilenameMouseEnter(ev, filename), onMouseLeave: () => this.hideTooltip() }),
482
- isUploading && h("span", { class: "sr-only" }, "uploading"),
483
- h("div", { class: "sr-only ch-measure" }))));
484
- }
485
- renderErrorList() {
486
- if (!!this.errorList.length) {
487
- if (this.liveRegion) {
488
- let srMessage = this.errorList.reduce(function (acc, err) {
489
- return acc + `${err.name}: ${err.message} `;
490
- }, "");
491
- this.liveRegion.innerHTML = srMessage;
492
- }
493
- return (h("ul", { class: "error-list" }, this.errorList.map((err) => (h("li", null,
494
- h("div", { class: "file --error" }, this.renderFileName(err.name, false)),
495
- h("div", { class: "error-message" }, err.message))))));
496
- }
497
- }
498
- renderFileInProgress(item) {
499
- const filename = item.type ? `${item.name}.${item.type}` : item.name;
500
- return (h("li", null,
501
- h("div", { class: "file --progress" },
502
- h("div", { class: "progress", style: {
503
- background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
504
- } }),
505
- this.renderFileName(filename, this.isItemUploading(item)))));
506
- }
507
- renderFile(item) {
508
- const filename = item.type ? `${item.name}.${item.type}` : item.name;
509
- const hasSingleFileAction = item.fileActions && item.fileActions.split(" ").length === 1;
510
- const showActionMenu = !this.tempUploaderType && this.isCondensed && !hasSingleFileAction;
511
- const showFileInfo = !this.tempUploaderType && !this.isCondensed;
512
- const showCheckmark = !this.tempUploaderType && item.progress === 100;
513
- return (h("li", { class: `${this.isCondensed ? "condensed" : ""} ${showCheckmark ? "checked" : ""}` },
514
- h("div", { class: "file --saved" },
515
- this.renderFileName(filename, this.isItemUploading(item)),
516
- h("div", { class: "right-group" },
517
- showFileInfo && this.renderFileInfo(item),
518
- showActionMenu ? this.renderActionMenu(item) : this.renderFileActions(item)))));
519
- }
520
- handleFilenameMouseEnter(ev, filename) {
521
- // only show tooltip if file name is being truncated (has ellipses)
522
- if (ev.target.textContent.includes("...")) {
523
- this.showTooltip(ev.target, filename);
524
- }
525
- }
526
- componentDidRender() {
527
- const files = this.el.shadowRoot.querySelectorAll(".file");
528
- files.forEach((file) => this.truncateFileName(file));
529
- }
530
- truncateFileName(file) {
531
- const leftGroup = file.querySelector(".left-group");
532
- const leftBoundary = leftGroup.getBoundingClientRect().left;
533
- const rightGroup = file.querySelector(".right-group");
534
- const rightBoundary = rightGroup
535
- ? rightGroup.getBoundingClientRect().left
536
- : file.getBoundingClientRect().right - 20;
537
- const filenameEl = file.querySelector(".filename");
538
- const availableSpace = rightBoundary - leftBoundary;
539
- let filename = filenameEl.dataset.filename;
540
- const canFitText = availableSpace > filename.length * this.chMeasure;
541
- if (!canFitText) {
542
- const extension = filename.slice(filename.lastIndexOf("."));
543
- const numFittingCharacters = Math.floor(availableSpace / this.chMeasure);
544
- // three ellipses, three constant characters, extension
545
- const postEllipsesLength = 3 + 3 + extension.length;
546
- let preEllipsesLength = Math.max(2, numFittingCharacters - postEllipsesLength);
547
- const preEllipsesText = filename.slice(0, preEllipsesLength);
548
- const postEllipsesText = filename.slice(filename.indexOf(extension) - 3, filename.length);
549
- filename = `${preEllipsesText.trim()}...${postEllipsesText.trim()}`;
550
- }
551
- filenameEl.textContent = filename;
552
- }
553
- renderFileActions(item) {
554
- const defaultFileActions = "download delete";
555
- const availableActions = item.fileActions || defaultFileActions;
556
- 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) }));
557
- 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) }));
558
- 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) }));
559
- return (h("div", { class: "file-controls" },
560
- availableActions.includes("preview") && previewButton,
561
- availableActions.includes("download") && downloadButton,
562
- availableActions.includes("delete") && deleteButton));
563
- }
564
- renderActionMenu(item) {
565
- const defaultFileActions = "download delete";
566
- const availableActions = item.fileActions || defaultFileActions;
567
- const previewItem = (h("wm-menuitem", { icon: "f208", onClick: () => this.previewFile(item) }, this.previewActionMessage));
568
- const downloadItem = (h("wm-menuitem", { icon: "f1da", onClick: () => this.downloadFile(item) }, this.downloadActionMessage));
569
- const deleteItem = (h("wm-menuitem", { icon: "f1c0", onClick: () => this.deleteFile(item) }, this.deleteActionMessage));
570
- return (h("wm-action-menu", { "action-menu-type": "icon", tooltip: this.actionMenuLabel, "tooltip-position": "bottom", "label-for-identical-buttons": `${item.name} ${this.actionMenuLabel}` },
571
- availableActions.includes("preview") && previewItem,
572
- availableActions.includes("download") && downloadItem,
573
- availableActions.includes("delete") && deleteItem));
574
- }
575
- renderFileInfo(item) {
576
- let elementToRender = undefined;
577
- if (this.showInfo === "time") {
578
- const uploadDate = new Date(Date.parse(item.lastUpdated));
579
- const day = uploadDate.getDate();
580
- const month = uploadDate.getMonth() + 1;
581
- const year = uploadDate.getFullYear();
582
- const time = uploadDate.toLocaleTimeString("en-us", { hour: "numeric", minute: "2-digit" });
583
- const formattedDate = `${month}/${day}/${year} ${time}`;
584
- elementToRender = h("div", { class: "file-info" }, formattedDate);
585
- }
586
- else if (this.showInfo === "size" && item.size) {
587
- const convertedSize = this.convertBytes(item.size);
588
- elementToRender = h("div", { class: "file-info" }, `${convertedSize.size.toFixed(0)} ${convertedSize.unit}`);
589
- }
590
- return elementToRender;
591
- }
592
- renderFileList() {
593
- if (this.fileList) {
594
- this.sortBy === "name"
595
- ? this.fileList.sort((a, b) => a.name.localeCompare(b.name))
596
- : this.fileList.sort((a, b) => Date.parse(a.lastUpdated) - Date.parse(b.lastUpdated));
597
- return (h("div", null,
598
- h("ul", { class: "inprogress-list" }, this.fileList.filter((item) => this.isItemUploading(item)).map((item) => this.renderFileInProgress(item))),
599
- h("ul", { class: "file-list" }, this.fileList.filter((item) => !this.isItemUploading(item)).map((item) => this.renderFile(item)))));
600
- }
601
- }
602
- legacyRenderHeader() {
603
- return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
604
- h("div", { class: "slot-wrapper" },
605
- h("slot", null),
606
- h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
607
- this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`),
608
- this.renderNotif()))));
609
- }
610
- renderHeader() {
611
- return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
612
- h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
613
- this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`),
614
- this.renderRequirements()),
615
- h("div", { id: "accepted-types", class: "accepted-types" }, this.acceptedFileTypesMessage),
616
- this.renderNotif()));
617
- }
618
- renderRequirements() {
619
- return (h("div", { class: "requirements" },
620
- this.maxFiles && h("span", { id: "file-count" }, this.fileCountMessage),
621
- this.maxSize !== this.defaultMaxSize && h("span", { id: "max-size" }, this.maxSizeMessage)));
622
- }
623
- renderFooter() {
624
- return (h("div", { class: "footer" },
625
- h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
626
- h("div", { class: "filecount-wrapper" },
627
- h("div", { class: "filecount" }, intl.formatMessage({
628
- id: "uploader.filesAdded",
629
- defaultMessage: "{numFiles, plural, one {1 file added} other {# files added}}",
630
- }, { numFiles: this.fileList.length })),
631
- this.renderUploadButton(`-primary ${this.isDisabled ? "disabled" : ""}`)),
632
- this.renderNotif())));
633
- }
634
- renderWithItems() {
635
- const hasNewlyUploadedFiles = this.fileList.filter((file) => file.progress === 100).length > 0;
636
- return (h("div", null,
637
- !this.tempUploaderType && this.renderHeader(),
638
- this.tempUploaderType === "2" && this.legacyRenderHeader(),
639
- h("div", { class: `list-container type${this.tempUploaderType} ${!this.tempUploaderType && hasNewlyUploadedFiles ? "checkmark-spacer" : ""}` },
640
- this.renderErrorList(),
641
- this.renderFileList()),
642
- this.tempUploaderType === "1" && this.renderFooter()));
643
- }
644
- render() {
645
- return (h(Host, null,
646
- this.isEmpty() && this.tempUploaderType === "1" ? this.renderEmptyState() : this.renderWithItems(),
647
- 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
648
- , "aria-atomic": "true" })));
649
- }
650
- static get is() { return "wm-uploader"; }
651
- static get encapsulation() { return "shadow"; }
652
- static get originalStyleUrls() { return {
653
- "$": ["wm-uploader.scss"]
654
- }; }
655
- static get styleUrls() { return {
656
- "$": ["wm-uploader.css"]
657
- }; }
658
- static get properties() { return {
659
- "uploaderType": {
660
- "type": "string",
661
- "mutable": true,
662
- "complexType": {
663
- "original": "\"1\" | \"2\"",
664
- "resolved": "\"1\" | \"2\" | undefined",
665
- "references": {}
666
- },
667
- "required": false,
668
- "optional": true,
669
- "docs": {
670
- "tags": [],
671
- "text": ""
672
- },
673
- "attribute": "uploader-type",
674
- "reflect": false
675
- },
676
- "type": {
677
- "type": "string",
678
- "mutable": false,
679
- "complexType": {
680
- "original": "\"1\" | \"2\"",
681
- "resolved": "\"1\" | \"2\" | undefined",
682
- "references": {}
683
- },
684
- "required": false,
685
- "optional": true,
686
- "docs": {
687
- "tags": [],
688
- "text": ""
689
- },
690
- "attribute": "type",
691
- "reflect": false
692
- },
693
- "buttonText": {
694
- "type": "string",
695
- "mutable": false,
696
- "complexType": {
697
- "original": "string",
698
- "resolved": "string",
699
- "references": {}
700
- },
701
- "required": true,
702
- "optional": false,
703
- "docs": {
704
- "tags": [],
705
- "text": ""
706
- },
707
- "attribute": "button-text",
708
- "reflect": false
709
- },
710
- "info": {
711
- "type": "string",
712
- "mutable": false,
713
- "complexType": {
714
- "original": "string",
715
- "resolved": "string | undefined",
716
- "references": {}
717
- },
718
- "required": false,
719
- "optional": true,
720
- "docs": {
721
- "tags": [],
722
- "text": ""
723
- },
724
- "attribute": "info",
725
- "reflect": false
726
- },
727
- "emptyStateText": {
728
- "type": "string",
729
- "mutable": false,
730
- "complexType": {
731
- "original": "string",
732
- "resolved": "string",
733
- "references": {}
734
- },
735
- "required": true,
736
- "optional": false,
737
- "docs": {
738
- "tags": [],
739
- "text": ""
740
- },
741
- "attribute": "empty-state-text",
742
- "reflect": false
743
- },
744
- "icon": {
745
- "type": "string",
746
- "mutable": false,
747
- "complexType": {
748
- "original": "string",
749
- "resolved": "string",
750
- "references": {}
751
- },
752
- "required": true,
753
- "optional": false,
754
- "docs": {
755
- "tags": [],
756
- "text": ""
757
- },
758
- "attribute": "icon",
759
- "reflect": false
760
- },
761
- "fileTypes": {
762
- "type": "string",
763
- "mutable": false,
764
- "complexType": {
765
- "original": "string",
766
- "resolved": "string",
767
- "references": {}
768
- },
769
- "required": false,
770
- "optional": false,
771
- "docs": {
772
- "tags": [],
773
- "text": ""
774
- },
775
- "attribute": "file-types",
776
- "reflect": false,
777
- "defaultValue": "\"pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv\""
778
- },
779
- "maxSize": {
780
- "type": "number",
781
- "mutable": true,
782
- "complexType": {
783
- "original": "number",
784
- "resolved": "number",
785
- "references": {}
786
- },
787
- "required": false,
788
- "optional": false,
789
- "docs": {
790
- "tags": [],
791
- "text": ""
792
- },
793
- "attribute": "max-size",
794
- "reflect": false,
795
- "defaultValue": "this.defaultMaxSize"
796
- },
797
- "maxFiles": {
798
- "type": "number",
799
- "mutable": false,
800
- "complexType": {
801
- "original": "number",
802
- "resolved": "number | undefined",
803
- "references": {}
804
- },
805
- "required": false,
806
- "optional": true,
807
- "docs": {
808
- "tags": [],
809
- "text": ""
810
- },
811
- "attribute": "max-files",
812
- "reflect": false
813
- },
814
- "sortBy": {
815
- "type": "string",
816
- "mutable": false,
817
- "complexType": {
818
- "original": "\"name\" | \"date\"",
819
- "resolved": "\"date\" | \"name\"",
820
- "references": {}
821
- },
822
- "required": false,
823
- "optional": false,
824
- "docs": {
825
- "tags": [],
826
- "text": ""
827
- },
828
- "attribute": "sort-by",
829
- "reflect": false,
830
- "defaultValue": "\"date\""
831
- },
832
- "showInfo": {
833
- "type": "string",
834
- "mutable": false,
835
- "complexType": {
836
- "original": "\"time\" | \"size\" | \"none\"",
837
- "resolved": "\"none\" | \"size\" | \"time\"",
838
- "references": {}
839
- },
840
- "required": false,
841
- "optional": false,
842
- "docs": {
843
- "tags": [],
844
- "text": ""
845
- },
846
- "attribute": "show-info",
847
- "reflect": false,
848
- "defaultValue": "\"time\""
849
- },
850
- "files": {
851
- "type": "string",
852
- "mutable": false,
853
- "complexType": {
854
- "original": "string",
855
- "resolved": "string | undefined",
856
- "references": {}
857
- },
858
- "required": false,
859
- "optional": true,
860
- "docs": {
861
- "tags": [],
862
- "text": ""
863
- },
864
- "attribute": "files",
865
- "reflect": false
866
- },
867
- "filesToUpload": {
868
- "type": "unknown",
869
- "mutable": false,
870
- "complexType": {
871
- "original": "File[]",
872
- "resolved": "File[]",
873
- "references": {
874
- "File": {
875
- "location": "global"
876
- }
877
- }
878
- },
879
- "required": false,
880
- "optional": false,
881
- "docs": {
882
- "tags": [],
883
- "text": ""
884
- },
885
- "defaultValue": "[]"
886
- },
887
- "rejectedFiles": {
888
- "type": "string",
889
- "mutable": false,
890
- "complexType": {
891
- "original": "string",
892
- "resolved": "string | undefined",
893
- "references": {}
894
- },
895
- "required": false,
896
- "optional": true,
897
- "docs": {
898
- "tags": [],
899
- "text": ""
900
- },
901
- "attribute": "rejected-files",
902
- "reflect": false
903
- }
904
- }; }
905
- static get states() { return {
906
- "isTabbing": {},
907
- "errorList": {},
908
- "notif": {},
909
- "numFilesInProgress": {},
910
- "isCondensed": {}
911
- }; }
912
- static get events() { return [{
913
- "method": "wmUploaderFilesSelected",
914
- "name": "wmUploaderFilesSelected",
915
- "bubbles": true,
916
- "cancelable": true,
917
- "composed": true,
918
- "docs": {
919
- "tags": [],
920
- "text": ""
921
- },
922
- "complexType": {
923
- "original": "any",
924
- "resolved": "any",
925
- "references": {}
926
- }
927
- }, {
928
- "method": "wmFilesSelected",
929
- "name": "wmFilesSelected",
930
- "bubbles": true,
931
- "cancelable": true,
932
- "composed": true,
933
- "docs": {
934
- "tags": [],
935
- "text": ""
936
- },
937
- "complexType": {
938
- "original": "any",
939
- "resolved": "any",
940
- "references": {}
941
- }
942
- }, {
943
- "method": "wmUploaderDeleteFile",
944
- "name": "wmUploaderDeleteFile",
945
- "bubbles": true,
946
- "cancelable": true,
947
- "composed": true,
948
- "docs": {
949
- "tags": [],
950
- "text": ""
951
- },
952
- "complexType": {
953
- "original": "any",
954
- "resolved": "any",
955
- "references": {}
956
- }
957
- }, {
958
- "method": "wmDeleteFile",
959
- "name": "wmDeleteFile",
960
- "bubbles": true,
961
- "cancelable": true,
962
- "composed": true,
963
- "docs": {
964
- "tags": [],
965
- "text": ""
966
- },
967
- "complexType": {
968
- "original": "any",
969
- "resolved": "any",
970
- "references": {}
971
- }
972
- }, {
973
- "method": "wmUploaderDownloadFile",
974
- "name": "wmUploaderDownloadFile",
975
- "bubbles": true,
976
- "cancelable": true,
977
- "composed": true,
978
- "docs": {
979
- "tags": [],
980
- "text": ""
981
- },
982
- "complexType": {
983
- "original": "any",
984
- "resolved": "any",
985
- "references": {}
986
- }
987
- }, {
988
- "method": "wmDownloadFile",
989
- "name": "wmDownloadFile",
990
- "bubbles": true,
991
- "cancelable": true,
992
- "composed": true,
993
- "docs": {
994
- "tags": [],
995
- "text": ""
996
- },
997
- "complexType": {
998
- "original": "any",
999
- "resolved": "any",
1000
- "references": {}
1001
- }
1002
- }, {
1003
- "method": "wmUploaderPreviewFile",
1004
- "name": "wmUploaderPreviewFile",
1005
- "bubbles": true,
1006
- "cancelable": true,
1007
- "composed": true,
1008
- "docs": {
1009
- "tags": [],
1010
- "text": ""
1011
- },
1012
- "complexType": {
1013
- "original": "any",
1014
- "resolved": "any",
1015
- "references": {}
1016
- }
1017
- }]; }
1018
- static get elementRef() { return "el"; }
1019
- static get watchers() { return [{
1020
- "propName": "files",
1021
- "methodName": "parseFiles"
1022
- }, {
1023
- "propName": "rejectedFiles",
1024
- "methodName": "parseRejectedFiles"
1025
- }, {
1026
- "propName": "maxSize",
1027
- "methodName": "setMaxSize"
1028
- }, {
1029
- "propName": "numFilesInProgress",
1030
- "methodName": "uploadNotifications"
1031
- }]; }
1032
- static get listeners() { return [{
1033
- "name": "wmUserIsTabbing",
1034
- "method": "toggleTabbingOn",
1035
- "target": "window",
1036
- "capture": false,
1037
- "passive": false
1038
- }, {
1039
- "name": "wmUserIsNotTabbing",
1040
- "method": "toggleTabbingOff",
1041
- "target": "window",
1042
- "capture": false,
1043
- "passive": false
1044
- }, {
1045
- "name": "wmUploadProgress",
1046
- "method": "handleUploadProgress",
1047
- "target": undefined,
1048
- "capture": false,
1049
- "passive": false
1050
- }]; }
1051
- }
1
+ import { Component, Element, Event, h, Host, Prop, State, Listen, Watch } from "@stencil/core";
2
+ import { forceUpdate } from "@stencil/core";
3
+ import { debounce, generateId, hasValidType, intl } from "../../global/functions";
4
+ export class Uploader {
5
+ constructor() {
6
+ this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
7
+ this.defaultMaxSize = 100;
8
+ this.maxSize = this.defaultMaxSize; // in Mb
9
+ this.sortBy = "date"; // name is descending (a -> z), date is ascending (earlier -> later)
10
+ this.showInfo = "time";
11
+ this.fileList = []; // the string above transformed into the actual array
12
+ this.filesToUpload = []; // input.files that passed validation
13
+ this.isTabbing = false;
14
+ this.errorList = []; // for errors on a particular file
15
+ this.isCondensed = false;
16
+ this.inputId = generateId();
17
+ this.debouncedResize = debounce(() => {
18
+ this.isCondensed = this.el.clientWidth < 500;
19
+ // rerender to show filename truncation changes
20
+ forceUpdate(this.el);
21
+ }, 50);
22
+ }
23
+ get tooltipEl() {
24
+ return document.getElementById("wm-tooltip");
25
+ }
26
+ get tempUploaderType() {
27
+ // replace instances of this.tempUploaderType with this.uploaderType once type is fully phased out
28
+ return this.type || this.uploaderType;
29
+ }
30
+ get chMeasure() {
31
+ return this.el.shadowRoot.querySelector(".ch-measure").clientWidth;
32
+ }
33
+ get fileLimitReached() {
34
+ return this.maxFiles && this.fileList.length >= this.maxFiles;
35
+ }
36
+ get fileUploadLimitMessage() {
37
+ return intl.formatMessage({
38
+ id: "uploader.fileUploadLimit",
39
+ defaultMessage: "Maximum number of files reached",
40
+ description: "Message displayed when reaching the file upload limit",
41
+ });
42
+ }
43
+ get fileCountMessage() {
44
+ return this.fileLimitReached
45
+ ? this.fileUploadLimitMessage
46
+ : intl.formatMessage({
47
+ id: "uploader.fileCount",
48
+ defaultMessage: "{x} of {y} Files",
49
+ description: "A count of the number of files currently uploaded",
50
+ }, { x: this.fileList.length, y: this.maxFiles });
51
+ }
52
+ get maxSizeMessage() {
53
+ return intl.formatMessage({
54
+ id: "uploader.maxSize",
55
+ defaultMessage: "Maximum file size {maxSize}MB",
56
+ description: "An indicator of the maximum file size the uploader allows",
57
+ }, {
58
+ maxSize: this.maxSize,
59
+ });
60
+ }
61
+ get acceptedFileTypesMessage() {
62
+ const validTypes = "." + this.fileTypes.split(" ").join(", .");
63
+ return intl.formatMessage({
64
+ id: "uploader.acceptedFileTypes",
65
+ defaultMessage: "Accepted file {amount, plural, =1 {type} other {types}}: {fileTypes}",
66
+ }, {
67
+ fileTypes: validTypes,
68
+ amount: this.fileTypes.split(" ").length,
69
+ });
70
+ }
71
+ get previewActionMessage() {
72
+ return intl.formatMessage({
73
+ id: "uploader.previewAction",
74
+ defaultMessage: "Preview File",
75
+ description: "Label of a button that triggers a file to be previewed",
76
+ });
77
+ }
78
+ get downloadActionMessage() {
79
+ return intl.formatMessage({
80
+ id: "uploader.downloadAction",
81
+ defaultMessage: "Download File",
82
+ description: "Label of a button that triggers a file to be downloaded",
83
+ });
84
+ }
85
+ get deleteActionMessage() {
86
+ return intl.formatMessage({
87
+ id: "uploader.deleteAction",
88
+ defaultMessage: "Delete File",
89
+ description: "Label of a button that triggers a file to be delete",
90
+ });
91
+ }
92
+ get actionMenuLabel() {
93
+ return intl.formatMessage({
94
+ id: "uploader.actionMenuLabel",
95
+ defaultMessage: "Actions",
96
+ description: "Label of a button that opens a menu of file actions",
97
+ });
98
+ }
99
+ toggleTabbingOn() {
100
+ this.isTabbing = true;
101
+ }
102
+ toggleTabbingOff() {
103
+ this.isTabbing = false;
104
+ }
105
+ handleUploadProgress(ev) {
106
+ this.fileList.map((i) => {
107
+ if (i.id === ev.detail.id) {
108
+ i.progress = ev.detail.progress;
109
+ forceUpdate(this.el);
110
+ }
111
+ });
112
+ if (ev.detail.progress === 100) {
113
+ // inProgressList is not a perfect reflection of how many files are uploading
114
+ // because even after progress reached 100% the item should remain in the array
115
+ // (should only be removed once it appears in fileList)
116
+ this.numFilesInProgress -= 1;
117
+ }
118
+ // aggregate the percentages for SR to announce progress
119
+ if (!this.srProgress && this.numFilesInProgress) {
120
+ const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
121
+ this.srProgress = setInterval(() => {
122
+ const aggregate = this.fileList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
123
+ if (this.liveRegion) {
124
+ this.liveRegion.innerHTML = intl.formatMessage({
125
+ id: "uploader.uploadProgress",
126
+ defaultMessage: "Upload progress: {percentage}%",
127
+ }, { percentage: Math.floor(aggregate / total) });
128
+ }
129
+ }, 5000);
130
+ }
131
+ }
132
+ parseFiles() {
133
+ if (!!this.files) {
134
+ if (typeof this.files === "string") {
135
+ const list = JSON.parse(this.files);
136
+ if (typeof list === "object") {
137
+ this.fileList = list;
138
+ }
139
+ else {
140
+ throw new Error("could not parse string passed to files attribute");
141
+ }
142
+ }
143
+ else {
144
+ throw new Error("Attribute 'files' should be a string");
145
+ }
146
+ }
147
+ }
148
+ parseRejectedFiles() {
149
+ if (!!this.rejectedFiles) {
150
+ if (typeof this.files === "string") {
151
+ const list = JSON.parse(this.rejectedFiles);
152
+ if (typeof list === "object") {
153
+ this.errorList = list;
154
+ }
155
+ else {
156
+ throw new Error("could not parse string passed to errors attribute");
157
+ }
158
+ }
159
+ else {
160
+ throw new Error("Attribute 'rejected-files' should be a string");
161
+ }
162
+ }
163
+ }
164
+ setMaxSize() {
165
+ // Max size can't be set above 100Mb
166
+ this.maxSize = this.maxSize > this.defaultMaxSize ? this.defaultMaxSize : this.maxSize;
167
+ }
168
+ uploadNotifications(newNum, oldNum) {
169
+ if (oldNum > 0 && newNum === 0) {
170
+ setTimeout(() => {
171
+ this.notif = null;
172
+ }, 20 * 1000);
173
+ const message = intl.formatMessage({
174
+ id: "uploader.finishedUploading",
175
+ defaultMessage: "Finished uploading",
176
+ });
177
+ this.notif = { id: 5, message };
178
+ if (this.liveRegion) {
179
+ this.liveRegion.innerHTML = message;
180
+ }
181
+ this.numFilesInProgress = null;
182
+ clearInterval(this.srProgress);
183
+ forceUpdate(this.el);
184
+ }
185
+ else if (newNum > 0 && newNum != oldNum) {
186
+ const message = intl.formatMessage({
187
+ id: "uploader.filesUploading",
188
+ defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
189
+ }, { num: newNum });
190
+ this.notif = { id: 6, message };
191
+ if (this.liveRegion) {
192
+ this.liveRegion.innerHTML = message;
193
+ }
194
+ forceUpdate(this.el);
195
+ }
196
+ }
197
+ isValidSize(size) {
198
+ return this.convertBytes(size, "MB").size <= this.maxSize;
199
+ }
200
+ convertBytes(bytes, unit) {
201
+ // https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
202
+ const unitOrder = ["bytes", "KB", "MB", "GB", "TB"];
203
+ let unitIndex = 0;
204
+ let result = bytes;
205
+ if (unit) {
206
+ // convert until result matches desired unit
207
+ while (unitOrder.indexOf(unit) > unitIndex) {
208
+ result /= 1024;
209
+ unitIndex++;
210
+ }
211
+ }
212
+ else {
213
+ // convert until result is appropriate unit (value is under 1000)
214
+ while (result > 1000) {
215
+ result /= 1024;
216
+ unitIndex++;
217
+ }
218
+ }
219
+ return { size: result, unit: unitOrder[unitIndex] };
220
+ }
221
+ isDuplicate(name) {
222
+ return this.fileList.find((f) => {
223
+ const filename = f.type ? f.name + "." + f.type : f.name;
224
+ return filename === name;
225
+ });
226
+ }
227
+ isEmpty() {
228
+ return !this.fileList.length && !this.errorList.length;
229
+ }
230
+ get isDisabled() {
231
+ if (!this.notif) {
232
+ if (this.fileLimitReached) {
233
+ const errMessage = this.fileUploadLimitMessage;
234
+ this.notif = { id: 1, message: errMessage };
235
+ if (this.liveRegion) {
236
+ this.liveRegion.innerHTML = errMessage;
237
+ }
238
+ }
239
+ else {
240
+ this.notif = null;
241
+ }
242
+ }
243
+ else if (this.notif.id === 1) {
244
+ // to make sure SR don't repeat the error, don't reset it if it already is showing
245
+ // just dismiss it if isMax is not true anymore
246
+ if (!this.fileLimitReached) {
247
+ this.notif = null;
248
+ }
249
+ // finally do nothing if error 2 is showing (special case when user selects too many files)
250
+ }
251
+ // disable if is the uploader is maxed out or if something is uploading
252
+ return this.fileLimitReached || this.numFilesInProgress > 0;
253
+ }
254
+ isItemUploading(item) {
255
+ return item.hasOwnProperty("progress") && item.progress < 100;
256
+ }
257
+ clearErrors() {
258
+ this.errorList = [];
259
+ this.notif = null;
260
+ }
261
+ handleFiles(ev) {
262
+ this.filesToUpload = [];
263
+ const validTypes = this.fileTypes.split(" ").join(", ");
264
+ const files = Array.from(ev.target.files);
265
+ if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
266
+ const errMessage = intl.formatMessage({
267
+ id: "uploader.fileUploadExceeded",
268
+ defaultMessage: "The number of selected files exceeds the limit.",
269
+ });
270
+ this.notif = { id: 2, message: errMessage };
271
+ if (this.liveRegion) {
272
+ this.liveRegion.innerHTML = errMessage;
273
+ }
274
+ }
275
+ else {
276
+ files &&
277
+ files.map((file) => {
278
+ if (!hasValidType(file, this.fileTypes)) {
279
+ const error = {
280
+ name: file.name,
281
+ message: intl.formatMessage({
282
+ id: "uploader.invalidFileType",
283
+ defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
284
+ }, { validTypes }),
285
+ };
286
+ this.errorList.push(error);
287
+ }
288
+ else if (file.size === 0) {
289
+ const error = {
290
+ name: file.name,
291
+ message: intl.formatMessage({
292
+ id: "uploader.zeroFileSize",
293
+ defaultMessage: "The file must be more than 0 bytes",
294
+ description: "Error message when user attempts to upload a file of no size",
295
+ }),
296
+ };
297
+ this.errorList.push(error);
298
+ }
299
+ else if (!this.isValidSize(file.size)) {
300
+ const error = {
301
+ name: file.name,
302
+ message: intl.formatMessage({
303
+ id: "uploader.fileTooLarge",
304
+ defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
305
+ }, { size: this.maxSize }),
306
+ };
307
+ this.errorList.push(error);
308
+ }
309
+ else if (this.isDuplicate(file.name)) {
310
+ const error = {
311
+ name: file.name,
312
+ message: intl.formatMessage({
313
+ id: "uploader.duplicateName",
314
+ defaultMessage: "A file with this name already exists.",
315
+ }),
316
+ };
317
+ this.errorList.push(error);
318
+ }
319
+ else {
320
+ this.filesToUpload.push(file);
321
+ }
322
+ });
323
+ if (this.filesToUpload.length > 0) {
324
+ this.numFilesInProgress = this.filesToUpload.length;
325
+ this.wmUploaderFilesSelected.emit(this.filesToUpload);
326
+ this.wmFilesSelected.emit(this.filesToUpload); // deprecated
327
+ }
328
+ }
329
+ ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
330
+ }
331
+ previewFile(file) {
332
+ this.clearErrors();
333
+ this.wmUploaderPreviewFile.emit(file.id);
334
+ }
335
+ downloadFile(file) {
336
+ this.clearErrors();
337
+ this.wmUploaderDownloadFile.emit(file.id);
338
+ this.wmDownloadFile.emit(file.id); // deprecated
339
+ }
340
+ deleteFile(file) {
341
+ this.clearErrors();
342
+ forceUpdate(this.el); // for the button to stop being disabled if num files become < max-files
343
+ this.wmUploaderDeleteFile.emit(file.id);
344
+ this.wmDeleteFile.emit(file.id); // deprecated
345
+ }
346
+ componentWillLoad() {
347
+ if (!this.buttonText) {
348
+ throw new Error("wm-uploader: button-text is a required prop");
349
+ }
350
+ if (this.type) {
351
+ console.warn("wm-uploader: type has been deprecated as of v3.1.0. Please use uploader-type instead.");
352
+ }
353
+ if (this.tempUploaderType === "1" && !this.emptyStateText) {
354
+ throw new Error("wm-uploader: empty-state-text is a required prop");
355
+ }
356
+ // rerender on resize in case layout needs to change
357
+ const resizeObserver = new ResizeObserver(() => this.debouncedResize());
358
+ resizeObserver.observe(this.el);
359
+ this.setMaxSize();
360
+ this.parseFiles();
361
+ this.clearErrors();
362
+ this.parseRejectedFiles();
363
+ }
364
+ componentDidLoad() {
365
+ if (document.body.classList.contains("wmcl-user-is-tabbing")) {
366
+ this.toggleTabbingOn();
367
+ }
368
+ }
369
+ showTooltip(anchorEl, tooltipText) {
370
+ this.tooltipEl.textContent = tooltipText;
371
+ this.positionTooltip("bottom", anchorEl, this.tooltipEl);
372
+ this.tooltipEl.style.transitionDelay = "500ms";
373
+ this.tooltipEl.style.opacity = "1";
374
+ }
375
+ hideTooltip() {
376
+ this.tooltipEl.style.transitionDelay = "0s";
377
+ this.tooltipEl.style.opacity = "0";
378
+ }
379
+ positionTooltip(tPos, anchorEl, tooltipEl) {
380
+ const tooltipHeight = tooltipEl.getBoundingClientRect().height;
381
+ const tooltipWidth = tooltipEl.getBoundingClientRect().width;
382
+ // to get the center positions, calculate the difference between the button width and the tooltip width
383
+ const verticalDiff = (anchorEl.getBoundingClientRect().height - tooltipHeight) / 2;
384
+ const horizontalDiff = (anchorEl.getBoundingClientRect().width - tooltipWidth) / 2;
385
+ // the naming convention defaults to center in the absence of a value
386
+ // "top" and "bottom" imply centering horizontally; "right" and "left" imply centering vertically
387
+ // therefore we first set to center and adjust accordingly
388
+ let verticalPos = anchorEl.getBoundingClientRect().top + verticalDiff;
389
+ let horizontalPos = anchorEl.getBoundingClientRect().left + horizontalDiff;
390
+ if (tPos.includes("top")) {
391
+ verticalPos = anchorEl.getBoundingClientRect().top - tooltipHeight - 8;
392
+ }
393
+ if (tPos.includes("bottom")) {
394
+ verticalPos = anchorEl.getBoundingClientRect().bottom + 8;
395
+ }
396
+ if (tPos.includes("left")) {
397
+ horizontalPos = anchorEl.getBoundingClientRect().left - tooltipWidth - 8;
398
+ }
399
+ if (tPos.includes("right")) {
400
+ horizontalPos = anchorEl.getBoundingClientRect().right + 8;
401
+ }
402
+ // after all positioning has been calculated, if tooltip is off-screen or closer than 24px it is readjusted
403
+ // this only occurs when the tooltip is overflowing to the left and is positioned top or bottom
404
+ // (button placed too far left, or screen size under 268px)
405
+ horizontalPos = Math.max(horizontalPos, 24);
406
+ tooltipEl.style.top = (verticalPos / 16).toString() + "rem";
407
+ tooltipEl.style.left = (horizontalPos / 16).toString() + "rem";
408
+ }
409
+ uploadButtonOnClick(ev) {
410
+ if (this.isDisabled) {
411
+ // this is a temporary fix.
412
+ // we need the disabled button to be programmatically focusable
413
+ // to allow return focus after closing the browser file panel
414
+ // since it's focusable the button should respond when activated
415
+ // it looks disabled, and announces the reason why the action cannot
416
+ // be taken when activated.
417
+ // this is not pretty duplicating a intl message + the logic of isDisabled,
418
+ // but not worth a bigger refactor since this is only until we get the UX for disabled elements and refactor all interactive els.
419
+ ev.preventDefault();
420
+ if (this.liveRegion) {
421
+ let errMsg = "";
422
+ if (this.numFilesInProgress > 0) {
423
+ errMsg = intl.formatMessage({
424
+ id: "uploader.waitToUpload",
425
+ defaultMessage: "Please wait for current upload to complete before uploading new files.",
426
+ description: "Message for screen reader users",
427
+ });
428
+ }
429
+ else if (this.fileLimitReached) {
430
+ errMsg = this.fileUploadLimitMessage;
431
+ }
432
+ if (errMsg) {
433
+ // clear and set again to re-announce if button is clicked several times
434
+ // (can't be done inside setTimeout because of scope, hence the promise)
435
+ this.liveRegion.innerHTML = "";
436
+ new Promise((resolve) => {
437
+ setTimeout(() => {
438
+ resolve("");
439
+ }, 500);
440
+ }).then(() => (this.liveRegion.innerHTML = errMsg));
441
+ }
442
+ }
443
+ }
444
+ else {
445
+ this.clearErrors();
446
+ }
447
+ }
448
+ renderUploadSvg() {
449
+ return (h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" },
450
+ 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" })));
451
+ }
452
+ renderIcon() {
453
+ // mdi attachment icon (paper clip) is horizontal but we want it vertical
454
+ const rotate = this.icon && this.icon === "f066";
455
+ return (this.icon && (h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
456
+ }
457
+ renderInfo() {
458
+ return this.info && this.tempUploaderType === "2" ? h("span", { class: "info" }, this.info) : "";
459
+ }
460
+ renderNotif() {
461
+ return this.notif ? h("div", { class: "notif" }, this.notif.message) : "";
462
+ }
463
+ renderUploadButton(classes) {
464
+ return (h("div", { class: "info-wrapper" },
465
+ 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) }),
466
+ h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` },
467
+ this.renderIcon(),
468
+ this.buttonText),
469
+ this.renderInfo()));
470
+ }
471
+ renderEmptyState() {
472
+ return (h("div", { class: "empty-block" },
473
+ this.renderUploadSvg(),
474
+ h("div", { class: `empty-message` }, this.emptyStateText),
475
+ this.renderUploadButton("-primary empty-button"),
476
+ this.renderNotif()));
477
+ }
478
+ renderFileName(filename, isUploading) {
479
+ return (h("div", { class: "left-group" },
480
+ h("div", { class: "name-wrapper" },
481
+ h("span", { class: "filename", "data-filename": filename, onMouseEnter: (ev) => this.handleFilenameMouseEnter(ev, filename), onMouseLeave: () => this.hideTooltip() }),
482
+ isUploading && h("span", { class: "sr-only" }, "uploading"),
483
+ h("div", { class: "sr-only ch-measure" }))));
484
+ }
485
+ renderErrorList() {
486
+ if (!!this.errorList.length) {
487
+ if (this.liveRegion) {
488
+ let srMessage = this.errorList.reduce(function (acc, err) {
489
+ return acc + `${err.name}: ${err.message} `;
490
+ }, "");
491
+ this.liveRegion.innerHTML = srMessage;
492
+ }
493
+ return (h("ul", { class: "error-list" }, this.errorList.map((err) => (h("li", null,
494
+ h("div", { class: "file --error" }, this.renderFileName(err.name, false)),
495
+ h("div", { class: "error-message" }, err.message))))));
496
+ }
497
+ }
498
+ renderFileInProgress(item) {
499
+ const filename = item.type ? `${item.name}.${item.type}` : item.name;
500
+ return (h("li", null,
501
+ h("div", { class: "file --progress" },
502
+ h("div", { class: "progress", style: {
503
+ background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
504
+ } }),
505
+ this.renderFileName(filename, this.isItemUploading(item)))));
506
+ }
507
+ renderFile(item) {
508
+ const filename = item.type ? `${item.name}.${item.type}` : item.name;
509
+ const hasSingleFileAction = item.fileActions && item.fileActions.split(" ").length === 1;
510
+ const showActionMenu = !this.tempUploaderType && this.isCondensed && !hasSingleFileAction;
511
+ const showFileInfo = !this.tempUploaderType && !this.isCondensed;
512
+ const showCheckmark = !this.tempUploaderType && item.progress === 100;
513
+ return (h("li", { class: `${this.isCondensed ? "condensed" : ""} ${showCheckmark ? "checked" : ""}` },
514
+ h("div", { class: "file --saved" },
515
+ this.renderFileName(filename, this.isItemUploading(item)),
516
+ h("div", { class: "right-group" },
517
+ showFileInfo && this.renderFileInfo(item),
518
+ showActionMenu ? this.renderActionMenu(item) : this.renderFileActions(item)))));
519
+ }
520
+ handleFilenameMouseEnter(ev, filename) {
521
+ // only show tooltip if file name is being truncated (has ellipses)
522
+ if (ev.target.textContent.includes("...")) {
523
+ this.showTooltip(ev.target, filename);
524
+ }
525
+ }
526
+ componentDidRender() {
527
+ const files = this.el.shadowRoot.querySelectorAll(".file");
528
+ files.forEach((file) => this.truncateFileName(file));
529
+ }
530
+ truncateFileName(file) {
531
+ const leftGroup = file.querySelector(".left-group");
532
+ const leftBoundary = leftGroup.getBoundingClientRect().left;
533
+ const rightGroup = file.querySelector(".right-group");
534
+ const rightBoundary = rightGroup
535
+ ? rightGroup.getBoundingClientRect().left
536
+ : file.getBoundingClientRect().right - 20;
537
+ const filenameEl = file.querySelector(".filename");
538
+ const availableSpace = rightBoundary - leftBoundary;
539
+ let filename = filenameEl.dataset.filename;
540
+ const canFitText = availableSpace > filename.length * this.chMeasure;
541
+ if (!canFitText) {
542
+ const extension = filename.slice(filename.lastIndexOf("."));
543
+ const numFittingCharacters = Math.floor(availableSpace / this.chMeasure);
544
+ // three ellipses, three constant characters, extension
545
+ const postEllipsesLength = 3 + 3 + extension.length;
546
+ let preEllipsesLength = Math.max(2, numFittingCharacters - postEllipsesLength);
547
+ const preEllipsesText = filename.slice(0, preEllipsesLength);
548
+ const postEllipsesText = filename.slice(filename.indexOf(extension) - 3, filename.length);
549
+ filename = `${preEllipsesText.trim()}...${postEllipsesText.trim()}`;
550
+ }
551
+ filenameEl.textContent = filename;
552
+ }
553
+ renderFileActions(item) {
554
+ const defaultFileActions = "download delete";
555
+ const availableActions = item.fileActions || defaultFileActions;
556
+ 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) }));
557
+ 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) }));
558
+ 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) }));
559
+ return (h("div", { class: "file-controls" },
560
+ availableActions.includes("preview") && previewButton,
561
+ availableActions.includes("download") && downloadButton,
562
+ availableActions.includes("delete") && deleteButton));
563
+ }
564
+ renderActionMenu(item) {
565
+ const defaultFileActions = "download delete";
566
+ const availableActions = item.fileActions || defaultFileActions;
567
+ const previewItem = (h("wm-menuitem", { icon: "f208", onClick: () => this.previewFile(item) }, this.previewActionMessage));
568
+ const downloadItem = (h("wm-menuitem", { icon: "f1da", onClick: () => this.downloadFile(item) }, this.downloadActionMessage));
569
+ const deleteItem = (h("wm-menuitem", { icon: "f1c0", onClick: () => this.deleteFile(item) }, this.deleteActionMessage));
570
+ return (h("wm-action-menu", { "action-menu-type": "icon", tooltip: this.actionMenuLabel, "tooltip-position": "bottom", "label-for-identical-buttons": `${item.name} ${this.actionMenuLabel}` },
571
+ availableActions.includes("preview") && previewItem,
572
+ availableActions.includes("download") && downloadItem,
573
+ availableActions.includes("delete") && deleteItem));
574
+ }
575
+ renderFileInfo(item) {
576
+ let elementToRender = undefined;
577
+ if (this.showInfo === "time") {
578
+ const uploadDate = new Date(Date.parse(item.lastUpdated));
579
+ const day = uploadDate.getDate();
580
+ const month = uploadDate.getMonth() + 1;
581
+ const year = uploadDate.getFullYear();
582
+ const time = uploadDate.toLocaleTimeString("en-us", { hour: "numeric", minute: "2-digit" });
583
+ const formattedDate = `${month}/${day}/${year} ${time}`;
584
+ elementToRender = h("div", { class: "file-info" }, formattedDate);
585
+ }
586
+ else if (this.showInfo === "size" && item.size) {
587
+ const convertedSize = this.convertBytes(item.size);
588
+ elementToRender = h("div", { class: "file-info" }, `${convertedSize.size.toFixed(0)} ${convertedSize.unit}`);
589
+ }
590
+ return elementToRender;
591
+ }
592
+ renderFileList() {
593
+ if (this.fileList) {
594
+ this.sortBy === "name"
595
+ ? this.fileList.sort((a, b) => a.name.localeCompare(b.name))
596
+ : this.fileList.sort((a, b) => Date.parse(a.lastUpdated) - Date.parse(b.lastUpdated));
597
+ return (h("div", null,
598
+ h("ul", { class: "inprogress-list" }, this.fileList.filter((item) => this.isItemUploading(item)).map((item) => this.renderFileInProgress(item))),
599
+ h("ul", { class: "file-list" }, this.fileList.filter((item) => !this.isItemUploading(item)).map((item) => this.renderFile(item)))));
600
+ }
601
+ }
602
+ legacyRenderHeader() {
603
+ return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
604
+ h("div", { class: "slot-wrapper" },
605
+ h("slot", null),
606
+ h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
607
+ this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`),
608
+ this.renderNotif()))));
609
+ }
610
+ renderHeader() {
611
+ return (h("div", { class: `header ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
612
+ h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
613
+ this.renderUploadButton(`-secondary ${this.isDisabled ? "disabled" : ""}`),
614
+ this.renderRequirements()),
615
+ h("div", { id: "accepted-types", class: "accepted-types" }, this.acceptedFileTypesMessage),
616
+ this.renderNotif()));
617
+ }
618
+ renderRequirements() {
619
+ return (h("div", { class: "requirements" },
620
+ this.maxFiles && h("span", { id: "file-count" }, this.fileCountMessage),
621
+ this.maxSize !== this.defaultMaxSize && h("span", { id: "max-size" }, this.maxSizeMessage)));
622
+ }
623
+ renderFooter() {
624
+ return (h("div", { class: "footer" },
625
+ h("div", { class: `notif-wrapper ${this.tempUploaderType ? `type${this.tempUploaderType}` : ""}` },
626
+ h("div", { class: "filecount-wrapper" },
627
+ h("div", { class: "filecount" }, intl.formatMessage({
628
+ id: "uploader.filesAdded",
629
+ defaultMessage: "{numFiles, plural, one {1 file added} other {# files added}}",
630
+ }, { numFiles: this.fileList.length })),
631
+ this.renderUploadButton(`-primary ${this.isDisabled ? "disabled" : ""}`)),
632
+ this.renderNotif())));
633
+ }
634
+ renderWithItems() {
635
+ const hasNewlyUploadedFiles = this.fileList.filter((file) => file.progress === 100).length > 0;
636
+ return (h("div", null,
637
+ !this.tempUploaderType && this.renderHeader(),
638
+ this.tempUploaderType === "2" && this.legacyRenderHeader(),
639
+ h("div", { class: `list-container type${this.tempUploaderType} ${!this.tempUploaderType && hasNewlyUploadedFiles ? "checkmark-spacer" : ""}` },
640
+ this.renderErrorList(),
641
+ this.renderFileList()),
642
+ this.tempUploaderType === "1" && this.renderFooter()));
643
+ }
644
+ render() {
645
+ return (h(Host, null,
646
+ this.isEmpty() && this.tempUploaderType === "1" ? this.renderEmptyState() : this.renderWithItems(),
647
+ 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
648
+ , "aria-atomic": "true" })));
649
+ }
650
+ static get is() { return "wm-uploader"; }
651
+ static get encapsulation() { return "shadow"; }
652
+ static get originalStyleUrls() { return {
653
+ "$": ["wm-uploader.scss"]
654
+ }; }
655
+ static get styleUrls() { return {
656
+ "$": ["wm-uploader.css"]
657
+ }; }
658
+ static get properties() { return {
659
+ "uploaderType": {
660
+ "type": "string",
661
+ "mutable": true,
662
+ "complexType": {
663
+ "original": "\"1\" | \"2\"",
664
+ "resolved": "\"1\" | \"2\" | undefined",
665
+ "references": {}
666
+ },
667
+ "required": false,
668
+ "optional": true,
669
+ "docs": {
670
+ "tags": [],
671
+ "text": ""
672
+ },
673
+ "attribute": "uploader-type",
674
+ "reflect": false
675
+ },
676
+ "type": {
677
+ "type": "string",
678
+ "mutable": false,
679
+ "complexType": {
680
+ "original": "\"1\" | \"2\"",
681
+ "resolved": "\"1\" | \"2\" | undefined",
682
+ "references": {}
683
+ },
684
+ "required": false,
685
+ "optional": true,
686
+ "docs": {
687
+ "tags": [],
688
+ "text": ""
689
+ },
690
+ "attribute": "type",
691
+ "reflect": false
692
+ },
693
+ "buttonText": {
694
+ "type": "string",
695
+ "mutable": false,
696
+ "complexType": {
697
+ "original": "string",
698
+ "resolved": "string",
699
+ "references": {}
700
+ },
701
+ "required": true,
702
+ "optional": false,
703
+ "docs": {
704
+ "tags": [],
705
+ "text": ""
706
+ },
707
+ "attribute": "button-text",
708
+ "reflect": false
709
+ },
710
+ "info": {
711
+ "type": "string",
712
+ "mutable": false,
713
+ "complexType": {
714
+ "original": "string",
715
+ "resolved": "string | undefined",
716
+ "references": {}
717
+ },
718
+ "required": false,
719
+ "optional": true,
720
+ "docs": {
721
+ "tags": [],
722
+ "text": ""
723
+ },
724
+ "attribute": "info",
725
+ "reflect": false
726
+ },
727
+ "emptyStateText": {
728
+ "type": "string",
729
+ "mutable": false,
730
+ "complexType": {
731
+ "original": "string",
732
+ "resolved": "string",
733
+ "references": {}
734
+ },
735
+ "required": true,
736
+ "optional": false,
737
+ "docs": {
738
+ "tags": [],
739
+ "text": ""
740
+ },
741
+ "attribute": "empty-state-text",
742
+ "reflect": false
743
+ },
744
+ "icon": {
745
+ "type": "string",
746
+ "mutable": false,
747
+ "complexType": {
748
+ "original": "string",
749
+ "resolved": "string",
750
+ "references": {}
751
+ },
752
+ "required": true,
753
+ "optional": false,
754
+ "docs": {
755
+ "tags": [],
756
+ "text": ""
757
+ },
758
+ "attribute": "icon",
759
+ "reflect": false
760
+ },
761
+ "fileTypes": {
762
+ "type": "string",
763
+ "mutable": false,
764
+ "complexType": {
765
+ "original": "string",
766
+ "resolved": "string",
767
+ "references": {}
768
+ },
769
+ "required": false,
770
+ "optional": false,
771
+ "docs": {
772
+ "tags": [],
773
+ "text": ""
774
+ },
775
+ "attribute": "file-types",
776
+ "reflect": false,
777
+ "defaultValue": "\"pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv\""
778
+ },
779
+ "maxSize": {
780
+ "type": "number",
781
+ "mutable": true,
782
+ "complexType": {
783
+ "original": "number",
784
+ "resolved": "number",
785
+ "references": {}
786
+ },
787
+ "required": false,
788
+ "optional": false,
789
+ "docs": {
790
+ "tags": [],
791
+ "text": ""
792
+ },
793
+ "attribute": "max-size",
794
+ "reflect": false,
795
+ "defaultValue": "this.defaultMaxSize"
796
+ },
797
+ "maxFiles": {
798
+ "type": "number",
799
+ "mutable": false,
800
+ "complexType": {
801
+ "original": "number",
802
+ "resolved": "number | undefined",
803
+ "references": {}
804
+ },
805
+ "required": false,
806
+ "optional": true,
807
+ "docs": {
808
+ "tags": [],
809
+ "text": ""
810
+ },
811
+ "attribute": "max-files",
812
+ "reflect": false
813
+ },
814
+ "sortBy": {
815
+ "type": "string",
816
+ "mutable": false,
817
+ "complexType": {
818
+ "original": "\"name\" | \"date\"",
819
+ "resolved": "\"date\" | \"name\"",
820
+ "references": {}
821
+ },
822
+ "required": false,
823
+ "optional": false,
824
+ "docs": {
825
+ "tags": [],
826
+ "text": ""
827
+ },
828
+ "attribute": "sort-by",
829
+ "reflect": false,
830
+ "defaultValue": "\"date\""
831
+ },
832
+ "showInfo": {
833
+ "type": "string",
834
+ "mutable": false,
835
+ "complexType": {
836
+ "original": "\"time\" | \"size\" | \"none\"",
837
+ "resolved": "\"none\" | \"size\" | \"time\"",
838
+ "references": {}
839
+ },
840
+ "required": false,
841
+ "optional": false,
842
+ "docs": {
843
+ "tags": [],
844
+ "text": ""
845
+ },
846
+ "attribute": "show-info",
847
+ "reflect": false,
848
+ "defaultValue": "\"time\""
849
+ },
850
+ "files": {
851
+ "type": "string",
852
+ "mutable": false,
853
+ "complexType": {
854
+ "original": "string",
855
+ "resolved": "string | undefined",
856
+ "references": {}
857
+ },
858
+ "required": false,
859
+ "optional": true,
860
+ "docs": {
861
+ "tags": [],
862
+ "text": ""
863
+ },
864
+ "attribute": "files",
865
+ "reflect": false
866
+ },
867
+ "filesToUpload": {
868
+ "type": "unknown",
869
+ "mutable": false,
870
+ "complexType": {
871
+ "original": "File[]",
872
+ "resolved": "File[]",
873
+ "references": {
874
+ "File": {
875
+ "location": "global"
876
+ }
877
+ }
878
+ },
879
+ "required": false,
880
+ "optional": false,
881
+ "docs": {
882
+ "tags": [],
883
+ "text": ""
884
+ },
885
+ "defaultValue": "[]"
886
+ },
887
+ "rejectedFiles": {
888
+ "type": "string",
889
+ "mutable": false,
890
+ "complexType": {
891
+ "original": "string",
892
+ "resolved": "string | undefined",
893
+ "references": {}
894
+ },
895
+ "required": false,
896
+ "optional": true,
897
+ "docs": {
898
+ "tags": [],
899
+ "text": ""
900
+ },
901
+ "attribute": "rejected-files",
902
+ "reflect": false
903
+ }
904
+ }; }
905
+ static get states() { return {
906
+ "isTabbing": {},
907
+ "errorList": {},
908
+ "notif": {},
909
+ "numFilesInProgress": {},
910
+ "isCondensed": {}
911
+ }; }
912
+ static get events() { return [{
913
+ "method": "wmUploaderFilesSelected",
914
+ "name": "wmUploaderFilesSelected",
915
+ "bubbles": true,
916
+ "cancelable": true,
917
+ "composed": true,
918
+ "docs": {
919
+ "tags": [],
920
+ "text": ""
921
+ },
922
+ "complexType": {
923
+ "original": "any",
924
+ "resolved": "any",
925
+ "references": {}
926
+ }
927
+ }, {
928
+ "method": "wmFilesSelected",
929
+ "name": "wmFilesSelected",
930
+ "bubbles": true,
931
+ "cancelable": true,
932
+ "composed": true,
933
+ "docs": {
934
+ "tags": [],
935
+ "text": ""
936
+ },
937
+ "complexType": {
938
+ "original": "any",
939
+ "resolved": "any",
940
+ "references": {}
941
+ }
942
+ }, {
943
+ "method": "wmUploaderDeleteFile",
944
+ "name": "wmUploaderDeleteFile",
945
+ "bubbles": true,
946
+ "cancelable": true,
947
+ "composed": true,
948
+ "docs": {
949
+ "tags": [],
950
+ "text": ""
951
+ },
952
+ "complexType": {
953
+ "original": "any",
954
+ "resolved": "any",
955
+ "references": {}
956
+ }
957
+ }, {
958
+ "method": "wmDeleteFile",
959
+ "name": "wmDeleteFile",
960
+ "bubbles": true,
961
+ "cancelable": true,
962
+ "composed": true,
963
+ "docs": {
964
+ "tags": [],
965
+ "text": ""
966
+ },
967
+ "complexType": {
968
+ "original": "any",
969
+ "resolved": "any",
970
+ "references": {}
971
+ }
972
+ }, {
973
+ "method": "wmUploaderDownloadFile",
974
+ "name": "wmUploaderDownloadFile",
975
+ "bubbles": true,
976
+ "cancelable": true,
977
+ "composed": true,
978
+ "docs": {
979
+ "tags": [],
980
+ "text": ""
981
+ },
982
+ "complexType": {
983
+ "original": "any",
984
+ "resolved": "any",
985
+ "references": {}
986
+ }
987
+ }, {
988
+ "method": "wmDownloadFile",
989
+ "name": "wmDownloadFile",
990
+ "bubbles": true,
991
+ "cancelable": true,
992
+ "composed": true,
993
+ "docs": {
994
+ "tags": [],
995
+ "text": ""
996
+ },
997
+ "complexType": {
998
+ "original": "any",
999
+ "resolved": "any",
1000
+ "references": {}
1001
+ }
1002
+ }, {
1003
+ "method": "wmUploaderPreviewFile",
1004
+ "name": "wmUploaderPreviewFile",
1005
+ "bubbles": true,
1006
+ "cancelable": true,
1007
+ "composed": true,
1008
+ "docs": {
1009
+ "tags": [],
1010
+ "text": ""
1011
+ },
1012
+ "complexType": {
1013
+ "original": "any",
1014
+ "resolved": "any",
1015
+ "references": {}
1016
+ }
1017
+ }]; }
1018
+ static get elementRef() { return "el"; }
1019
+ static get watchers() { return [{
1020
+ "propName": "files",
1021
+ "methodName": "parseFiles"
1022
+ }, {
1023
+ "propName": "rejectedFiles",
1024
+ "methodName": "parseRejectedFiles"
1025
+ }, {
1026
+ "propName": "maxSize",
1027
+ "methodName": "setMaxSize"
1028
+ }, {
1029
+ "propName": "numFilesInProgress",
1030
+ "methodName": "uploadNotifications"
1031
+ }]; }
1032
+ static get listeners() { return [{
1033
+ "name": "wmUserIsTabbing",
1034
+ "method": "toggleTabbingOn",
1035
+ "target": "window",
1036
+ "capture": false,
1037
+ "passive": false
1038
+ }, {
1039
+ "name": "wmUserIsNotTabbing",
1040
+ "method": "toggleTabbingOff",
1041
+ "target": "window",
1042
+ "capture": false,
1043
+ "passive": false
1044
+ }, {
1045
+ "name": "wmUploadProgress",
1046
+ "method": "handleUploadProgress",
1047
+ "target": undefined,
1048
+ "capture": false,
1049
+ "passive": false
1050
+ }]; }
1051
+ }