@duetds/components 4.32.0 → 4.33.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 (350) hide show
  1. package/hydrate/index.js +1933 -87
  2. package/lib/cjs/{dom-a28e5c5f.js → dom-c850c8d7.js} +1 -1
  3. package/lib/cjs/duet-alert.cjs.entry.js +2 -2
  4. package/lib/cjs/duet-badge.cjs.entry.js +1 -1
  5. package/lib/cjs/duet-button_2.cjs.entry.js +4 -4
  6. package/lib/cjs/duet-caption_4.cjs.entry.js +17 -10
  7. package/lib/cjs/duet-card.cjs.entry.js +3 -3
  8. package/lib/cjs/duet-checkbox.cjs.entry.js +2 -2
  9. package/lib/cjs/duet-choice_2.cjs.entry.js +40 -18
  10. package/lib/cjs/duet-collapsible.cjs.entry.js +4 -1
  11. package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
  12. package/lib/cjs/duet-date-picker.cjs.entry.js +7 -7
  13. package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
  14. package/lib/cjs/duet-editable-table-button_3.cjs.entry.js +232 -0
  15. package/lib/cjs/{duet-table.cjs.entry.js → duet-editable-table_3.cjs.entry.js} +206 -2
  16. package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
  17. package/lib/cjs/duet-footer.cjs.entry.js +2 -2
  18. package/lib/cjs/duet-grid_2.cjs.entry.js +52 -4
  19. package/lib/cjs/duet-header_2.cjs.entry.js +3 -3
  20. package/lib/cjs/duet-hero.cjs.entry.js +2 -2
  21. package/lib/cjs/duet-icon.cjs.entry.js +4 -4
  22. package/lib/cjs/duet-input_2.cjs.entry.js +6 -6
  23. package/lib/cjs/duet-layout.cjs.entry.js +1 -1
  24. package/lib/cjs/duet-list_2.cjs.entry.js +2 -2
  25. package/lib/cjs/duet-modal.cjs.entry.js +3 -3
  26. package/lib/cjs/duet-notification_2.cjs.entry.js +2 -2
  27. package/lib/cjs/duet-number-input.cjs.entry.js +2 -2
  28. package/lib/cjs/duet-progress.cjs.entry.js +75 -0
  29. package/lib/cjs/duet-radio_2.cjs.entry.js +2 -2
  30. package/lib/cjs/duet-range-slider.cjs.entry.js +2 -2
  31. package/lib/cjs/duet-select.cjs.entry.js +5 -5
  32. package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
  33. package/lib/cjs/duet-tab_2.cjs.entry.js +3 -3
  34. package/lib/cjs/duet-textarea.cjs.entry.js +5 -5
  35. package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
  36. package/lib/cjs/duet-tooltip.cjs.entry.js +2 -2
  37. package/lib/cjs/duet-tray.cjs.entry.js +3 -3
  38. package/lib/cjs/duet-upload.cjs.entry.js +1089 -0
  39. package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
  40. package/lib/cjs/duet.cjs.js +4 -4
  41. package/lib/cjs/{focus-utils-55b5a616.js → focus-utils-a7a1fb8b.js} +1 -1
  42. package/lib/cjs/{index-03ed1f55.js → index-b724d698.js} +5 -2
  43. package/lib/cjs/js-utils-33a9dbe3.js +16 -0
  44. package/lib/cjs/{language-utils-48b8860b.js → language-utils-aa282901.js} +6 -2
  45. package/lib/cjs/loader.cjs.js +3 -3
  46. package/lib/cjs/{shadow-css-6560c90c.js → shadow-css-e3edeed1.js} +9 -10
  47. package/lib/cjs/{token-utils-13e5d13e.js → token-utils-63a9c8dc.js} +1 -1
  48. package/lib/cjs/{tokens.module-53b3bd92.js → tokens.module-6b2df1c2.js} +2 -0
  49. package/lib/cjs/{watch-options-3877c082.js → watch-options-d88afac0.js} +29 -6
  50. package/lib/collection/collection-manifest.json +15 -2
  51. package/lib/collection/components/duet-checkbox/duet-checkbox.css +1 -1
  52. package/lib/collection/components/duet-choice/duet-choice.js +95 -21
  53. package/lib/collection/components/duet-date-picker/duet-date-picker.js +9 -9
  54. package/lib/collection/components/duet-editable-table/duet-editable-table-button.css +32 -0
  55. package/lib/collection/components/duet-editable-table/duet-editable-table-button.js +218 -0
  56. package/lib/collection/components/duet-editable-table/duet-editable-table-item.css +36 -0
  57. package/lib/collection/components/duet-editable-table/duet-editable-table-item.js +203 -0
  58. package/lib/collection/components/duet-editable-table/duet-editable-table-tabledata.js +13 -0
  59. package/lib/collection/components/duet-editable-table/duet-editable-table.css +16 -0
  60. package/lib/collection/components/duet-editable-table/duet-editable-table.js +348 -0
  61. package/lib/collection/components/duet-grid/duet-grid.js +57 -6
  62. package/lib/collection/components/duet-heading/duet-heading.css +3 -0
  63. package/lib/collection/components/duet-heading/duet-heading.js +7 -6
  64. package/lib/collection/components/duet-icon/duet-icon.js +2 -6
  65. package/lib/collection/components/duet-input/duet-input.css +15 -0
  66. package/lib/collection/components/duet-input/duet-input.js +4 -4
  67. package/lib/collection/components/duet-paragraph/duet-paragraph.css +6 -0
  68. package/lib/collection/components/duet-paragraph/duet-paragraph.js +34 -3
  69. package/lib/collection/components/duet-progress/duet-progress.css +103 -0
  70. package/lib/collection/components/duet-progress/duet-progress.js +240 -0
  71. package/lib/collection/components/duet-select/duet-select.css +15 -0
  72. package/lib/collection/components/duet-select/duet-select.js +3 -3
  73. package/lib/collection/components/duet-tab-group/duet-tab-group.css +2 -2
  74. package/lib/collection/components/duet-textarea/duet-textarea.css +19 -0
  75. package/lib/collection/components/duet-textarea/duet-textarea.js +5 -4
  76. package/lib/collection/components/duet-upload/duet-upload-aria-status.js +217 -0
  77. package/lib/collection/components/duet-upload/duet-upload-editable-item-error.js +16 -0
  78. package/lib/collection/components/duet-upload/duet-upload-editable-item-inprogres.js +8 -0
  79. package/lib/collection/components/duet-upload/duet-upload-editable-item-success.js +30 -0
  80. package/lib/collection/components/duet-upload/duet-upload-validators.js +93 -0
  81. package/lib/collection/components/duet-upload/duet-upload.css +64 -0
  82. package/lib/collection/components/duet-upload/duet-upload.js +1838 -0
  83. package/lib/collection/components/duet-upload/errorcodes.utils.js +32 -0
  84. package/lib/collection/components/duet-upload/mock.helpers.js +91 -0
  85. package/lib/collection/components/duet-upload/upload.helpers.js +13 -0
  86. package/lib/collection/components/duet-upload/xhr.helpers.js +30 -0
  87. package/lib/collection/utils/js-utils.js +12 -0
  88. package/lib/collection/utils/language-utils.js +6 -3
  89. package/lib/collection/utils/watch-options.js +35 -6
  90. package/lib/custom-elements-bundle/index.d.ts +36 -0
  91. package/lib/custom-elements-bundle/index.js +1917 -277
  92. package/lib/duet/duet.esm.js +1 -1
  93. package/lib/duet/duet.js +1 -1
  94. package/lib/duet/{p-1391ec53.entry.js → p-00735436.entry.js} +1 -1
  95. package/lib/duet/p-060d79be.entry.js +4 -0
  96. package/lib/duet/p-0d22396e.system.js +16 -0
  97. package/lib/duet/p-10deead0.system.js +4 -0
  98. package/lib/duet/{p-72fd384a.entry.js → p-1208c84f.entry.js} +1 -1
  99. package/lib/duet/p-12721178.js +4 -0
  100. package/lib/duet/p-155ef581.system.entry.js +4 -0
  101. package/lib/duet/{p-08729381.entry.js → p-16c48c5d.entry.js} +1 -1
  102. package/lib/duet/p-1797df7b.system.entry.js +4 -0
  103. package/lib/duet/p-1a08fc22.system.entry.js +4 -0
  104. package/lib/duet/{p-b6a0caf8.system.entry.js → p-237e47b4.system.entry.js} +1 -1
  105. package/lib/duet/{p-4fcbcecd.system.entry.js → p-2443bdca.system.entry.js} +1 -1
  106. package/lib/duet/{p-432ba72e.system.entry.js → p-263bc9cd.system.entry.js} +1 -1
  107. package/lib/duet/p-2764f081.js +4 -0
  108. package/lib/duet/{p-b0bbbdba.system.entry.js → p-27d80cef.system.entry.js} +1 -1
  109. package/lib/duet/p-28e02c08.entry.js +4 -0
  110. package/lib/duet/{p-8740fa38.entry.js → p-2bb1460c.entry.js} +1 -1
  111. package/lib/duet/p-33c58756.entry.js +4 -0
  112. package/lib/duet/{p-9cdd361e.js → p-35a3794e.js} +0 -0
  113. package/lib/duet/{p-8c511832.system.entry.js → p-374fb7e6.system.entry.js} +1 -1
  114. package/lib/duet/{p-5a817929.system.entry.js → p-387823af.system.entry.js} +1 -1
  115. package/lib/duet/{p-a678da8c.entry.js → p-3af5d66f.entry.js} +1 -1
  116. package/lib/duet/{p-322d1c38.js → p-3c1971d8.js} +1 -1
  117. package/lib/duet/{p-d13874cb.entry.js → p-4607af59.entry.js} +1 -1
  118. package/lib/duet/{p-2c0dd9ba.system.entry.js → p-48d1eb1f.system.entry.js} +1 -1
  119. package/lib/duet/p-4a87e9ab.system.entry.js +4 -0
  120. package/lib/duet/{p-92103298.system.entry.js → p-4b6ebe40.system.entry.js} +1 -1
  121. package/lib/duet/{p-6cf41bfe.system.entry.js → p-4e28da18.system.entry.js} +1 -1
  122. package/lib/duet/p-548d484e.js +4 -0
  123. package/lib/duet/{p-2c679963.entry.js → p-5826523b.entry.js} +1 -1
  124. package/lib/duet/{p-7331f2fe.system.entry.js → p-58750bae.system.entry.js} +1 -1
  125. package/lib/duet/{p-7a868085.entry.js → p-597d99c7.entry.js} +1 -1
  126. package/lib/duet/p-5ea0cd19.entry.js +4 -0
  127. package/lib/duet/p-63d5bf73.system.entry.js +4 -0
  128. package/lib/duet/{p-68d09837.system.entry.js → p-67d9a9a9.system.entry.js} +1 -1
  129. package/lib/duet/{p-9542c540.entry.js → p-6a19b5ec.entry.js} +1 -1
  130. package/lib/duet/p-6cc3be76.system.entry.js +4 -0
  131. package/lib/duet/p-6e363557.system.js +4 -0
  132. package/lib/duet/{p-3b3bac3f.system.entry.js → p-6e6e76db.system.entry.js} +1 -1
  133. package/lib/duet/p-70fafc98.system.js +4 -0
  134. package/lib/duet/{p-2d1e2b23.system.entry.js → p-7368b14e.system.entry.js} +1 -1
  135. package/lib/duet/{p-2a3411b5.system.entry.js → p-751542a0.system.entry.js} +1 -1
  136. package/lib/duet/{p-b75c5f13.entry.js → p-794659ac.entry.js} +1 -1
  137. package/lib/duet/{p-b04d738f.system.entry.js → p-7e8d5bb9.system.entry.js} +1 -1
  138. package/lib/duet/p-7fee0d23.system.entry.js +4 -0
  139. package/lib/duet/p-81867417.system.js +4 -0
  140. package/lib/duet/{p-84ece735.entry.js → p-86daec1c.entry.js} +1 -1
  141. package/lib/duet/{p-94a5fd74.system.entry.js → p-8b5ca0e7.system.entry.js} +1 -1
  142. package/lib/duet/{p-ffc2ffff.entry.js → p-8cb7416d.entry.js} +1 -1
  143. package/lib/duet/p-8f826843.system.entry.js +4 -0
  144. package/lib/duet/p-94169303.entry.js +4 -0
  145. package/lib/duet/{p-807b2087.entry.js → p-9481e312.entry.js} +1 -1
  146. package/lib/duet/{p-977f2826.entry.js → p-984576c9.entry.js} +1 -1
  147. package/lib/duet/p-987edcd0.js +15 -0
  148. package/lib/duet/p-9d73343a.entry.js +4 -0
  149. package/lib/duet/{p-8652a7ab.system.entry.js → p-9dca5c22.system.entry.js} +1 -1
  150. package/lib/duet/p-a207b008.entry.js +4 -0
  151. package/lib/duet/p-a5b9c192.system.entry.js +4 -0
  152. package/lib/duet/p-a6a84ec6.entry.js +4 -0
  153. package/lib/duet/{p-9f0f5674.entry.js → p-a890da72.entry.js} +1 -1
  154. package/lib/duet/{p-0f2a478e.entry.js → p-a9859a82.entry.js} +1 -1
  155. package/lib/duet/{p-3040debf.entry.js → p-aba68b7b.entry.js} +1 -1
  156. package/lib/duet/p-acc57c77.entry.js +4 -0
  157. package/lib/duet/{p-2826f987.js → p-ad07f399.js} +1 -1
  158. package/lib/duet/{p-fb898d94.system.entry.js → p-aee24388.system.entry.js} +1 -1
  159. package/lib/duet/p-aef1b720.system.entry.js +4 -0
  160. package/lib/duet/{p-00eac879.system.entry.js → p-af41d894.system.entry.js} +1 -1
  161. package/lib/duet/p-b25d3769.js +4 -0
  162. package/lib/duet/{p-43dde575.system.entry.js → p-b32224fe.system.entry.js} +1 -1
  163. package/lib/duet/{p-f13a0883.entry.js → p-b3744481.entry.js} +1 -1
  164. package/lib/duet/{p-b374d7c2.system.js → p-b42d81c3.system.js} +1 -1
  165. package/lib/duet/{p-ed479d09.system.entry.js → p-b4e87f02.system.entry.js} +1 -1
  166. package/lib/duet/{p-b9683731.entry.js → p-bf93a991.entry.js} +1 -1
  167. package/lib/duet/{p-a962c8c1.system.js → p-c18a599e.system.js} +0 -0
  168. package/lib/duet/p-c2e77278.entry.js +4 -0
  169. package/lib/duet/p-c34329f3.entry.js +4 -0
  170. package/lib/duet/{p-c19094dd.entry.js → p-c36b4da0.entry.js} +1 -1
  171. package/lib/duet/{p-8002a095.entry.js → p-cdd70b93.entry.js} +1 -1
  172. package/lib/duet/p-d1c19f04.system.entry.js +4 -0
  173. package/lib/duet/{p-cc0bd28f.system.entry.js → p-d3a3c3c7.system.entry.js} +1 -1
  174. package/lib/duet/{p-19c28d99.system.entry.js → p-d4118b6e.system.entry.js} +1 -1
  175. package/lib/duet/{p-abd3bfb4.system.entry.js → p-d744d188.system.entry.js} +1 -1
  176. package/lib/duet/p-ddb6344c.system.js +4 -0
  177. package/lib/duet/p-de07c7d7.entry.js +4 -0
  178. package/lib/duet/{p-57cb58d4.system.entry.js → p-dfe79666.system.entry.js} +1 -1
  179. package/lib/duet/{p-c723d36e.system.js → p-e12f2b8b.system.js} +1 -1
  180. package/lib/duet/p-e2a44156.js +4 -0
  181. package/lib/duet/p-e76b722f.entry.js +4 -0
  182. package/lib/duet/{p-0b9b6393.entry.js → p-e964d062.entry.js} +1 -1
  183. package/lib/duet/p-eb55ccd2.system.js +4 -0
  184. package/lib/duet/p-f0a4b68d.system.entry.js +4 -0
  185. package/lib/duet/p-f364eb96.entry.js +4 -0
  186. package/lib/duet/{p-fbb7d194.entry.js → p-f8ce39fb.entry.js} +1 -1
  187. package/lib/esm/{dom-8516b24e.js → dom-58cd15f6.js} +1 -1
  188. package/lib/esm/duet-alert.entry.js +2 -2
  189. package/lib/esm/duet-badge.entry.js +1 -1
  190. package/lib/esm/duet-button_2.entry.js +4 -4
  191. package/lib/esm/duet-caption_4.entry.js +17 -10
  192. package/lib/esm/duet-card.entry.js +3 -3
  193. package/lib/esm/duet-checkbox.entry.js +2 -2
  194. package/lib/esm/duet-choice_2.entry.js +41 -19
  195. package/lib/esm/duet-collapsible.entry.js +4 -1
  196. package/lib/esm/duet-cookie-consent.entry.js +1 -1
  197. package/lib/esm/duet-date-picker.entry.js +7 -7
  198. package/lib/esm/duet-divider_2.entry.js +1 -1
  199. package/lib/esm/duet-editable-table-button_3.entry.js +226 -0
  200. package/lib/esm/{duet-table.entry.js → duet-editable-table_3.entry.js} +205 -3
  201. package/lib/esm/duet-empty-state.entry.js +1 -1
  202. package/lib/esm/duet-footer.entry.js +2 -2
  203. package/lib/esm/duet-grid_2.entry.js +52 -4
  204. package/lib/esm/duet-header_2.entry.js +3 -3
  205. package/lib/esm/duet-hero.entry.js +2 -2
  206. package/lib/esm/duet-icon.entry.js +4 -4
  207. package/lib/esm/duet-input_2.entry.js +6 -6
  208. package/lib/esm/duet-layout.entry.js +1 -1
  209. package/lib/esm/duet-list_2.entry.js +2 -2
  210. package/lib/esm/duet-modal.entry.js +3 -3
  211. package/lib/esm/duet-notification_2.entry.js +2 -2
  212. package/lib/esm/duet-number-input.entry.js +2 -2
  213. package/lib/esm/duet-progress.entry.js +71 -0
  214. package/lib/esm/duet-radio_2.entry.js +2 -2
  215. package/lib/esm/duet-range-slider.entry.js +2 -2
  216. package/lib/esm/duet-select.entry.js +5 -5
  217. package/lib/esm/duet-step_2.entry.js +1 -1
  218. package/lib/esm/duet-tab_2.entry.js +3 -3
  219. package/lib/esm/duet-textarea.entry.js +5 -5
  220. package/lib/esm/duet-toggle.entry.js +1 -1
  221. package/lib/esm/duet-tooltip.entry.js +2 -2
  222. package/lib/esm/duet-tray.entry.js +3 -3
  223. package/lib/esm/duet-upload.entry.js +1085 -0
  224. package/lib/esm/duet-visually-hidden.entry.js +1 -1
  225. package/lib/esm/duet.js +4 -4
  226. package/lib/esm/{focus-utils-6a282066.js → focus-utils-1fe0dcd0.js} +1 -1
  227. package/lib/esm/{index-3a265449.js → index-84d97bd1.js} +5 -2
  228. package/lib/esm/js-utils-b69f17df.js +14 -0
  229. package/lib/esm/{language-utils-d5c38f65.js → language-utils-344d894c.js} +6 -3
  230. package/lib/esm/loader.js +3 -3
  231. package/lib/esm/{shadow-css-9178c864.js → shadow-css-7c726abb.js} +9 -10
  232. package/lib/esm/{token-utils-5a35377f.js → token-utils-590d9413.js} +1 -1
  233. package/lib/esm/{tokens.module-edb66c04.js → tokens.module-49cbf963.js} +3 -1
  234. package/lib/esm/watch-options-dd55bce8.js +57 -0
  235. package/lib/esm-es5/{dom-8516b24e.js → dom-58cd15f6.js} +0 -0
  236. package/lib/esm-es5/duet-alert.entry.js +1 -1
  237. package/lib/esm-es5/duet-badge.entry.js +1 -1
  238. package/lib/esm-es5/duet-button_2.entry.js +1 -1
  239. package/lib/esm-es5/duet-caption_4.entry.js +2 -2
  240. package/lib/esm-es5/duet-card.entry.js +1 -1
  241. package/lib/esm-es5/duet-checkbox.entry.js +1 -1
  242. package/lib/esm-es5/duet-choice_2.entry.js +2 -2
  243. package/lib/esm-es5/duet-collapsible.entry.js +1 -1
  244. package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
  245. package/lib/esm-es5/duet-date-picker.entry.js +1 -1
  246. package/lib/esm-es5/duet-divider_2.entry.js +1 -1
  247. package/lib/esm-es5/duet-editable-table-button_3.entry.js +4 -0
  248. package/lib/esm-es5/duet-editable-table_3.entry.js +4 -0
  249. package/lib/esm-es5/duet-empty-state.entry.js +1 -1
  250. package/lib/esm-es5/duet-footer.entry.js +1 -1
  251. package/lib/esm-es5/duet-grid_2.entry.js +2 -2
  252. package/lib/esm-es5/duet-header_2.entry.js +1 -1
  253. package/lib/esm-es5/duet-hero.entry.js +1 -1
  254. package/lib/esm-es5/duet-icon.entry.js +1 -1
  255. package/lib/esm-es5/duet-input_2.entry.js +1 -1
  256. package/lib/esm-es5/duet-layout.entry.js +1 -1
  257. package/lib/esm-es5/duet-list_2.entry.js +1 -1
  258. package/lib/esm-es5/duet-modal.entry.js +1 -1
  259. package/lib/esm-es5/duet-notification_2.entry.js +1 -1
  260. package/lib/esm-es5/duet-number-input.entry.js +1 -1
  261. package/lib/esm-es5/duet-progress.entry.js +4 -0
  262. package/lib/esm-es5/duet-radio_2.entry.js +1 -1
  263. package/lib/esm-es5/duet-range-slider.entry.js +1 -1
  264. package/lib/esm-es5/duet-select.entry.js +1 -1
  265. package/lib/esm-es5/duet-step_2.entry.js +1 -1
  266. package/lib/esm-es5/duet-tab_2.entry.js +2 -2
  267. package/lib/esm-es5/duet-textarea.entry.js +1 -1
  268. package/lib/esm-es5/duet-toggle.entry.js +1 -1
  269. package/lib/esm-es5/duet-tooltip.entry.js +1 -1
  270. package/lib/esm-es5/duet-tray.entry.js +1 -1
  271. package/lib/esm-es5/duet-upload.entry.js +4 -0
  272. package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
  273. package/lib/esm-es5/duet.js +1 -1
  274. package/lib/esm-es5/{focus-utils-6a282066.js → focus-utils-1fe0dcd0.js} +1 -1
  275. package/lib/esm-es5/index-84d97bd1.js +4 -0
  276. package/lib/esm-es5/js-utils-b69f17df.js +4 -0
  277. package/lib/esm-es5/{language-utils-d5c38f65.js → language-utils-344d894c.js} +1 -1
  278. package/lib/esm-es5/loader.js +1 -1
  279. package/lib/esm-es5/shadow-css-7c726abb.js +15 -0
  280. package/lib/esm-es5/{token-utils-5a35377f.js → token-utils-590d9413.js} +1 -1
  281. package/lib/esm-es5/tokens.module-49cbf963.js +4 -0
  282. package/lib/esm-es5/watch-options-dd55bce8.js +4 -0
  283. package/lib/types/components/duet-choice/duet-choice.d.ts +20 -1
  284. package/lib/types/components/duet-date-picker/duet-date-picker.d.ts +5 -5
  285. package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +72 -0
  286. package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +72 -0
  287. package/lib/types/components/duet-editable-table/duet-editable-table-tabledata.d.ts +7 -0
  288. package/lib/types/components/duet-editable-table/duet-editable-table.d.ts +84 -0
  289. package/lib/types/components/duet-grid/duet-grid.d.ts +16 -2
  290. package/lib/types/components/duet-heading/duet-heading.d.ts +2 -2
  291. package/lib/types/components/duet-icon/duet-icon.d.ts +1 -1
  292. package/lib/types/components/duet-paragraph/duet-paragraph.d.ts +9 -1
  293. package/lib/types/components/duet-progress/duet-progress.d.ts +64 -0
  294. package/lib/types/components/duet-upload/duet-upload-aria-status.d.ts +49 -0
  295. package/lib/types/components/duet-upload/duet-upload-editable-item-error.d.ts +7 -0
  296. package/lib/types/components/duet-upload/duet-upload-editable-item-inprogres.d.ts +7 -0
  297. package/lib/types/components/duet-upload/duet-upload-editable-item-success.d.ts +8 -0
  298. package/lib/types/components/duet-upload/duet-upload-validators.d.ts +12 -0
  299. package/lib/types/components/duet-upload/duet-upload.d.ts +380 -0
  300. package/lib/types/components/duet-upload/errorcodes.utils.d.ts +8 -0
  301. package/lib/types/components/duet-upload/mock.helpers.d.ts +2 -0
  302. package/lib/types/components/duet-upload/upload.helpers.d.ts +1 -0
  303. package/lib/types/components/duet-upload/xhr.helpers.d.ts +18 -0
  304. package/lib/types/components.d.ts +789 -19
  305. package/lib/types/utils/js-utils.d.ts +1 -0
  306. package/lib/types/utils/language-utils.d.ts +5 -1
  307. package/lib/types/utils/watch-options.d.ts +2 -0
  308. package/package.json +6 -6
  309. package/lib/cjs/duet-fieldset.cjs.entry.js +0 -62
  310. package/lib/duet/p-0058512b.js +0 -4
  311. package/lib/duet/p-0b00e8d6.system.js +0 -16
  312. package/lib/duet/p-15922601.system.js +0 -4
  313. package/lib/duet/p-194e25ce.system.entry.js +0 -4
  314. package/lib/duet/p-1d87ea02.system.entry.js +0 -4
  315. package/lib/duet/p-3618aaee.entry.js +0 -4
  316. package/lib/duet/p-40d68321.entry.js +0 -4
  317. package/lib/duet/p-418b2ce7.system.js +0 -4
  318. package/lib/duet/p-43e39d98.system.js +0 -4
  319. package/lib/duet/p-4603830b.entry.js +0 -4
  320. package/lib/duet/p-52d7fbec.entry.js +0 -4
  321. package/lib/duet/p-60478325.system.entry.js +0 -4
  322. package/lib/duet/p-64ed7add.entry.js +0 -4
  323. package/lib/duet/p-6a356ab1.system.js +0 -4
  324. package/lib/duet/p-753b406c.entry.js +0 -4
  325. package/lib/duet/p-76c00d0c.entry.js +0 -4
  326. package/lib/duet/p-85fe1132.js +0 -4
  327. package/lib/duet/p-8c8e82aa.system.js +0 -4
  328. package/lib/duet/p-9a89ec39.js +0 -4
  329. package/lib/duet/p-a11df1b6.js +0 -15
  330. package/lib/duet/p-a1eccee1.system.entry.js +0 -4
  331. package/lib/duet/p-a89e88a3.js +0 -4
  332. package/lib/duet/p-ade33230.entry.js +0 -4
  333. package/lib/duet/p-cb827bb7.entry.js +0 -4
  334. package/lib/duet/p-d85fba2c.system.entry.js +0 -4
  335. package/lib/duet/p-dfa90f8a.system.entry.js +0 -4
  336. package/lib/duet/p-e6b9bd1d.entry.js +0 -4
  337. package/lib/duet/p-ec3eef3a.entry.js +0 -4
  338. package/lib/duet/p-ee64d6be.system.entry.js +0 -4
  339. package/lib/duet/p-f113671b.system.entry.js +0 -4
  340. package/lib/duet/p-f2f04396.entry.js +0 -4
  341. package/lib/duet/p-f364ce8b.system.entry.js +0 -4
  342. package/lib/duet/p-fc6624fe.system.entry.js +0 -4
  343. package/lib/esm/duet-fieldset.entry.js +0 -58
  344. package/lib/esm/watch-options-de55ea78.js +0 -35
  345. package/lib/esm-es5/duet-fieldset.entry.js +0 -4
  346. package/lib/esm-es5/duet-table.entry.js +0 -4
  347. package/lib/esm-es5/index-3a265449.js +0 -4
  348. package/lib/esm-es5/shadow-css-9178c864.js +0 -15
  349. package/lib/esm-es5/tokens.module-edb66c04.js +0 -4
  350. package/lib/esm-es5/watch-options-de55ea78.js +0 -4
@@ -0,0 +1,1089 @@
1
+ /*!
2
+ * Built with Duet Design System
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index = require('./index-b724d698.js');
9
+ const createId = require('./create-id-c3b984b1.js');
10
+ const jsUtils = require('./js-utils-33a9dbe3.js');
11
+ const languageUtils = require('./language-utils-aa282901.js');
12
+ const themeableComponent = require('./themeable-component-0c1be552.js');
13
+ require('./string-utils-267e3dbb.js');
14
+
15
+ const errorCodes = [
16
+ {
17
+ type: "default",
18
+ system_message: "unknown error",
19
+ message: {
20
+ fi: "Tapahtui tuntematon virhe, ole hyvä ja yritä uudelleen.",
21
+ sv: "Ett okänt fel uppstod, försök igen.",
22
+ en: "An unknown error occured, please try again."
23
+ }
24
+ },
25
+ {
26
+ type: "400",
27
+ system_message: "Bad Request: The server could not understand the request due to invalid syntax.",
28
+ message: {
29
+ fi: "Tiedostoa ei hyväksytty.",
30
+ sv: "Servern avvisade din fil.",
31
+ en: "The server rejected your file."
32
+ }
33
+ },
34
+ {
35
+ type: "401",
36
+ system_message: "Not Authenticated: The client must authenticate itself to get the requested response...",
37
+ message: {
38
+ fi: "Vain kirjautunut käyttäjä voi lähettää tiedostoja.",
39
+ sv: "Du måste vara inloggad för att ladda upp filer.",
40
+ en: "You need to be logged in to upload files."
41
+ }
42
+ },
43
+ {
44
+ type: "403",
45
+ system_message: "No Access: The client does not have access rights to the content.",
46
+ message: {
47
+ fi: "Ei oikeuksia lähettää tiedostoja.",
48
+ sv: "Du har inte rätt åtkomsträttigheter för att ladda upp filer.",
49
+ en: "You do not have the correct access rights to upload files."
50
+ }
51
+ },
52
+ {
53
+ type: "413",
54
+ system_message: "Payload too large",
55
+ message: {
56
+ fi: "Tiedosto oli liian vastaanotettavaksi.",
57
+ sv: "Filen var för stor för servern att hantera.",
58
+ en: "The file was to large for the server to handle."
59
+ }
60
+ },
61
+ {
62
+ type: "415",
63
+ system_message: "Unsupported media type",
64
+ message: {
65
+ fi: "Tiedoston tyyppi oli väärä.",
66
+ sv: "Servern avvisade filen eftersom den hade fel typ.",
67
+ en: "The server rejected the file because it had the wrong type."
68
+ }
69
+ },
70
+ {
71
+ type: "429",
72
+ system_message: "Too many request from same address",
73
+ message: {
74
+ fi: "Liian monta yritystä, ole hyvä ja yritä myöhemmin uudelleen.",
75
+ sv: "Servern har fått många förfrågningar från dig, försök igen senare.",
76
+ en: "The server has received to many request from you, please try again later."
77
+ }
78
+ },
79
+ {
80
+ type: "500",
81
+ system_message: "Internal Server Error",
82
+ message: {
83
+ fi: "Palvelin ilmoitti tuntemattomasta virheestä ja lataus epäonnistui.",
84
+ sv: "Servern rapporterade ett okänt fel och uppladdningen misslyckades.",
85
+ en: "The server reported an unknown error and the upload failed."
86
+ }
87
+ },
88
+ {
89
+ type: "duet-upload-100",
90
+ system_message: "File extension not allowed",
91
+ message: {
92
+ fi: "Tiedoston tyyppi ei ole sallittu.",
93
+ sv: "Du kan inte ladda upp filer av den type.",
94
+ en: "You cannot upload files with that extension."
95
+ }
96
+ },
97
+ {
98
+ type: "duet-upload-001",
99
+ system_message: "File transfer failed",
100
+ message: {
101
+ fi: "Tiedoston lähetys keskeytyi, ole hyvä ja yritä uudelleen.",
102
+ sv: "Din anslutning till servern avbröts, försök igen.",
103
+ en: "Your connection to the server was interrupted, try again."
104
+ }
105
+ },
106
+ {
107
+ type: "duet-upload-101",
108
+ system_message: "File mimetype not allowed",
109
+ message: {
110
+ fi: "Tiedoston tyyppi ei ole sallittu.",
111
+ sv: "Du kan inte ladda upp filer av den typ.",
112
+ en: "You cannot upload files of that type."
113
+ }
114
+ },
115
+ {
116
+ type: "duet-upload-201",
117
+ system_message: "File is too large",
118
+ message: {
119
+ fi: "Tiedosto on liian iso.",
120
+ sv: "Filen är större än tillåtet.",
121
+ en: "The file is larger than permitted."
122
+ }
123
+ },
124
+ {
125
+ type: "duet-upload-202",
126
+ system_message: "The combined size of all files is too large",
127
+ message: {
128
+ fi: "Tiedostojen yhteenlaskettu koko on liian iso.",
129
+ sv: "Du har nått den maximala kombinerade filstorleken.",
130
+ en: "You have reached the maximum combined filesize."
131
+ }
132
+ },
133
+ {
134
+ type: "duet-upload-301",
135
+ system_message: "The maximum file limit has been reached",
136
+ message: {
137
+ fi: "Liitteiden maksimimäärä saavutettu.",
138
+ sv: "Maximalt antal bilagor har uppnåtts.",
139
+ en: "Maximum number of attachments reached."
140
+ }
141
+ }
142
+ ];
143
+
144
+ const getError = (code) => {
145
+ let error = {
146
+ type: undefined,
147
+ system_message: undefined,
148
+ message: undefined,
149
+ };
150
+ error = errorCodes.filter(errorItem => {
151
+ // the == is intentional we may be comparing numbers to strings - and that is ok here
152
+ return errorItem.type == code;
153
+ })[0];
154
+ if (!error) {
155
+ error = errorCodes.filter(errorItem => {
156
+ return errorItem.type === "default";
157
+ })[0];
158
+ }
159
+ return error;
160
+ };
161
+ const getI18nError = (errorCode) => {
162
+ const errorFromJson = getError(errorCode);
163
+ const i18String = languageUtils.getLocaleString(errorFromJson.message);
164
+ if (i18String === "" || !i18String) {
165
+ return errorFromJson.system_message;
166
+ }
167
+ else {
168
+ return i18String;
169
+ }
170
+ };
171
+
172
+ const ErrorItem = ({ data }) => {
173
+ const { item, error } = data;
174
+ const { name } = item;
175
+ const { type } = error;
176
+ return (index.h("span", { class: "duet-upload-item-error", role: "status" },
177
+ index.h("duet-paragraph", { class: "duet-upload-item-name", color: "danger", margin: "none", weight: "semi-bold" },
178
+ index.h("duet-icon", { margin: "none", size: "xx-small", name: "messaging-attachment" }),
179
+ " ",
180
+ name),
181
+ index.h("duet-paragraph", { class: "duet-upload-item-error-label", size: "small", margin: "none", color: "danger" }, getI18nError(type))));
182
+ };
183
+
184
+ const ProgressItem = ({ progress, name }) => (index.h("span", null,
185
+ index.h("duet-paragraph", { color: "secondary", margin: "none", size: "small" }, name),
186
+ index.h("duet-spacer", { size: "xx-small" }),
187
+ index.h("duet-progress", { progress: Math.ceil(progress), "aria-hidden": true })));
188
+
189
+ const formatBytes = (bytes, decimals = 2) => {
190
+ if (bytes === 0) {
191
+ return "0 Bytes";
192
+ }
193
+ const k = 1024;
194
+ const dm = decimals < 0 ? 0 : decimals;
195
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
196
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
197
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
198
+ };
199
+
200
+ const SuccessItem = ({ data, showLinks }) => {
201
+ const { item, size, uploaded, url, meta } = data;
202
+ const { name } = item;
203
+ const ContentName = (index.h("span", { class: "duet-upload-item-name" },
204
+ index.h("duet-icon", { margin: "none", size: "xx-small", name: "messaging-attachment" }),
205
+ index.h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
206
+ name));
207
+ const SizeText = (index.h("span", { class: "duet-upload-item-size", style: { fontSize: "14px", fontWeight: "400" } },
208
+ "(",
209
+ formatBytes(size),
210
+ ")"));
211
+ const FilenameLine = uploaded && url && showLinks ? (index.h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
212
+ index.h("duet-link", { url: url, external: true }, ContentName),
213
+ index.h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
214
+ SizeText)) : (index.h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
215
+ ContentName,
216
+ index.h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
217
+ SizeText));
218
+ const Badges = meta && meta.badges ? (index.h("span", null,
219
+ index.h("duet-spacer", { size: "xx-small" }),
220
+ meta.badges.map(badgeText => (index.h("duet-badge", { color: "primary" }, badgeText))))) : undefined;
221
+ return (index.h("span", { class: "duet-upload-item-success" },
222
+ index.h("div", null, FilenameLine),
223
+ Badges));
224
+ };
225
+
226
+ const validateFileExtension = (name, allowedExtensions) => {
227
+ if (!allowedExtensions) {
228
+ return true;
229
+ }
230
+ const ext = name.split(".");
231
+ const validExtension = allowedExtensions.split(",");
232
+ const extension = ext[ext.length - 1];
233
+ return validExtension.includes(extension);
234
+ };
235
+ const validateFileMime = (type, allowedMimetypes) => {
236
+ if (!allowedMimetypes || !type) {
237
+ return true;
238
+ }
239
+ const validMimeTypes = allowedMimetypes.split(",");
240
+ let valid = false;
241
+ validMimeTypes.forEach(mimeType => {
242
+ const allowedTypes = mimeType.split("/");
243
+ const fileType = type.split("/");
244
+ if (allowedTypes[0] === fileType[0] && (allowedTypes[1] === fileType[1] || allowedTypes[1] === "*")) {
245
+ valid = true;
246
+ }
247
+ });
248
+ return valid;
249
+ };
250
+ const validateFileSize = (size, maxBytes) => {
251
+ if (!maxBytes || !size) {
252
+ return true;
253
+ }
254
+ return maxBytes >= size;
255
+ };
256
+ const validateFile = (item, validators) => {
257
+ const { allowedMimetypes, allowedExtensions, maxBytes } = validators;
258
+ let valid = false;
259
+ let errorMessage = getError("default");
260
+ if (item) {
261
+ const { name, type, size } = item;
262
+ const mime = validateFileMime(type, allowedMimetypes);
263
+ const ext = validateFileExtension(name, allowedExtensions);
264
+ const bytes = validateFileSize(size, maxBytes);
265
+ if (!mime) {
266
+ errorMessage = getError("duet-upload-101");
267
+ }
268
+ if (!ext) {
269
+ errorMessage = getError("duet-upload-100");
270
+ }
271
+ if (!bytes) {
272
+ errorMessage = getError("duet-upload-201");
273
+ }
274
+ valid = mime && ext && bytes;
275
+ }
276
+ else {
277
+ valid = false;
278
+ }
279
+ return {
280
+ valid,
281
+ errorMessage: valid ? undefined : languageUtils.getLocaleString(errorMessage.message),
282
+ errorSystem: valid ? undefined : errorMessage.system_message,
283
+ errorType: valid ? undefined : errorMessage.type,
284
+ };
285
+ };
286
+ const validateTotalSizeIsAboveMax = (filelist, maxTotalBytes) => {
287
+ let total = 0;
288
+ if (maxTotalBytes) {
289
+ filelist.forEach(item => {
290
+ if (item.valid && item.size) {
291
+ total += item.size;
292
+ }
293
+ });
294
+ if (total < maxTotalBytes) {
295
+ return true;
296
+ }
297
+ }
298
+ return false;
299
+ };
300
+ const validateTotalAmountIsAboveMax = (filelist, maxFiles) => {
301
+ let total = 0;
302
+ if (maxFiles) {
303
+ filelist.forEach(item => {
304
+ if (item.valid) {
305
+ total++;
306
+ }
307
+ });
308
+ if (total > maxFiles) {
309
+ return true;
310
+ }
311
+ }
312
+ return false;
313
+ };
314
+
315
+ const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress }) => {
316
+ const { type = "POST", xhr, uri, argument = null, headers = null } = options;
317
+ xhr.open(type, `${uri}${argument || ""}`, true);
318
+ const { data, name } = payload;
319
+ // headers must be added after open
320
+ if (headers) {
321
+ Object.keys(headers).forEach(key => {
322
+ xhr.setRequestHeader(key, headers[key]);
323
+ });
324
+ }
325
+ if (type === "POST") {
326
+ xhr.onreadystatechange = () => {
327
+ // Call a function when the state changes.
328
+ if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status < 300) {
329
+ // Request finished without errors
330
+ onSuccess(xhr, name, xhr.status);
331
+ }
332
+ if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 300 && xhr.status < 999) {
333
+ // Request finished with errors
334
+ onFailure(xhr, name, xhr.status);
335
+ }
336
+ };
337
+ onProgress(name);
338
+ }
339
+ xhr.send(data);
340
+ return xhr;
341
+ };
342
+
343
+ const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}";
344
+
345
+ let DuetUpload = class {
346
+ constructor(hostRef) {
347
+ index.registerInstance(this, hostRef);
348
+ this.duetChange = index.createEvent(this, "duetChange", 3);
349
+ this.duetBlur = index.createEvent(this, "duetBlur", 7);
350
+ this.duetFocus = index.createEvent(this, "duetFocus", 7);
351
+ this.duetDone = index.createEvent(this, "duetDone", 3);
352
+ this.duetState = index.createEvent(this, "duetState", 3);
353
+ this.duetDelete = index.createEvent(this, "duetDelete", 3);
354
+ this.duetCancel = index.createEvent(this, "duetCancel", 3);
355
+ this.duetProgress = index.createEvent(this, "duetProgress", 3);
356
+ this.duetUpload = index.createEvent(this, "duetUpload", 3);
357
+ /**
358
+ * Own Properties
359
+ */
360
+ this.buttonId = createId.createID("DuetButton");
361
+ this.labelId = createId.createID("DuetLabel");
362
+ this.uploadId = createId.createID("DuetUpload");
363
+ this.editableTableId = createId.createID("DuetEditableTable");
364
+ this.filesInProgress = new Map();
365
+ this.fileMaxReached = false;
366
+ this.bytesMaxReached = false;
367
+ //region Internally exposed properties
368
+ /**
369
+ * Properties
370
+ */
371
+ this.DefaultGroups = {
372
+ inprogress: "inprogress",
373
+ success: "success",
374
+ failure: "failure",
375
+ };
376
+ /**
377
+ * State() variables
378
+ */
379
+ this.tick = Date.now();
380
+ /**
381
+ * If external is set to true, the upload component will not actually upload the files, but only keep states
382
+ * it will be up to you to handle the upload and return progress information to the upload-component
383
+ */
384
+ this.external = false;
385
+ /**
386
+ * If set the upload component will not display an upload button, you will have to create on yourself
387
+ * and call the exposed methods startUpload
388
+ */
389
+ this.hideButton = false;
390
+ /**
391
+ * Default actions added to all files
392
+ */
393
+ this.actions = [
394
+ {
395
+ icon: "action-delete",
396
+ color: "color-danger",
397
+ color_hover: "category-home",
398
+ id: "delete",
399
+ map: ["success", "failure"],
400
+ label: {
401
+ fi: "Poista tiedosto",
402
+ en: "Poista tiedosto",
403
+ sv: "Ta bort filen",
404
+ },
405
+ },
406
+ {
407
+ icon: "navigation-close",
408
+ color: "primary",
409
+ color_hover: "category-home",
410
+ id: "cancel",
411
+ map: ["inprogress"],
412
+ label: {
413
+ fi: "Keskeytä lähetys",
414
+ en: "Cancel the upload",
415
+ sv: "Stop överföringen",
416
+ },
417
+ },
418
+ ];
419
+ /**
420
+ * If enabled the filelist will create links on successfully uploaded items,
421
+ * this requires the server can respond with link URIs in the correct format
422
+ */
423
+ this.showLinks = false;
424
+ /**
425
+ * Property to change the aria upload progress text read aloud by screenreaders
426
+ * @default {
427
+ fi: "Lisää liite",
428
+ sv: "Lägg till en bilaga",
429
+ en: "Choose files",
430
+ }
431
+ */
432
+ this.statusLabelDefaults = {
433
+ fi: {
434
+ inProgress: "Lähetetään {filesUploaded} lähetettävästä {filesTotal} tiedostosta",
435
+ inProgressWithErrors: "Lähetetään {filesInProgress} tiedostoa, lähetetty {filesUploaded} lähetettävästä {filesTotal} tiedostosta, {filesWithErrors} tiedostossa on virheitä",
436
+ done: "Kaikki {filesTotal} tiedostoa lähetetty onnistuneesti",
437
+ doneWithErrors: "Lähetys valmis, {filesUploaded} tiedostoa on lähetetty onnistuneesti, {filesWithErrors} tiedostossa oli virheitä",
438
+ files: "tiedostot",
439
+ file: "tiedosto",
440
+ },
441
+ sv: {
442
+ inProgress: "Adding {filesUploaded} of {filesTotal}",
443
+ inProgressWithErrors: "Laddar upp {filesInProgress}, {filesUploaded} uppladdad av {filesTotal}, {filesWithErrors} misslyckades",
444
+ done: "Alla {filesTotal} har lagts till",
445
+ doneWithErrors: "Handling slutförd, {filesUploaded} har lagts till, {filesWithErrors} misslyckades",
446
+ files: "filer",
447
+ file: "fil",
448
+ },
449
+ en: {
450
+ inProgress: "Adding {filesUploaded} of {filesTotal}",
451
+ inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
452
+ done: "All {filesTotal} added successfully",
453
+ doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
454
+ files: "tiedostoa",
455
+ file: "tiedosto",
456
+ },
457
+ };
458
+ /**
459
+ * Strings used for the status aria-label
460
+ */
461
+ this.statusMessageLabel = languageUtils.getLocaleString(this.statusLabelDefaults);
462
+ /**
463
+ * Property to change descriptionDefaults defaults on the component.
464
+ * normally you would handle these strings on an application level and override @label when needed
465
+ * @default {
466
+ fi: "Lisää liite",
467
+ sv: "Lägg till en bilaga",
468
+ en: "Add an attachment",
469
+ }
470
+ */
471
+ this.buttonLabelDefaults = {
472
+ fi: "Lisää liite",
473
+ sv: "Lägg till en bilaga",
474
+ en: "Add an attachment",
475
+ };
476
+ /**
477
+ * Label of button
478
+ * @default { fi: "Lisää liite", sv: "Lägg till en bilaga", en: "Add an attachment" }
479
+ */
480
+ this.buttonLabel = languageUtils.getLocaleString(this.buttonLabelDefaults);
481
+ /**
482
+ * accessible Label of button
483
+ */
484
+ this.accessibleButtonLabel = undefined;
485
+ /**
486
+ * Theme of the input.
487
+ */
488
+ this.theme = "";
489
+ /**
490
+ * Makes the input component disabled. This prevents users from being able to
491
+ * interact with the upload component, and conveys its inactive state to assistive technologies.
492
+ */
493
+ this.disabled = false;
494
+ /**
495
+ * Controls the margin of the component.
496
+ */
497
+ this.margin = "auto";
498
+ /**
499
+ * Set whether the input is required or not. Please note that this is necessary for
500
+ * accessible inputs when the user is required to fill them. When using this property
501
+ * you need to also set “novalidate” attribute to your form element to prevent
502
+ * browser from displaying its own validation errors.
503
+ */
504
+ this.required = false;
505
+ /**
506
+ * Visually hides the groups labels in the editable table list used to display the list of files
507
+ */
508
+ this.hideGroups = false;
509
+ /**
510
+ * Map of string that contain list of uploaded files.
511
+ */
512
+ this.files = new Map();
513
+ /**
514
+ * Property to read if filelist contains errors or not
515
+ */
516
+ this.valid = !this.required;
517
+ /**
518
+ * Property to change labelDefaults defaults on the component.
519
+ * normally you would handle these strings on an application level and override @label when needed
520
+ * @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
521
+ */
522
+ this.labelDefaults = {
523
+ fi: "Lisää liite",
524
+ sv: "Lägg till en bilaga",
525
+ en: "Add attachments",
526
+ };
527
+ /**
528
+ * Label for the input.
529
+ * @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
530
+ */
531
+ this.label = languageUtils.getLocaleString(this.labelDefaults);
532
+ /**
533
+ * Property to change descriptionDefaults defaults on the component.
534
+ * normally you would handle these strings on an application level and override @label when needed
535
+ * @default {
536
+ fi: "Voit liittää {filetypes}-muotoisia tiedostoja sekä yleisimpiä videotiedostoja. Voit lähettää {maxbytes} verran tiedostoja yhdellä kertaa, ja lisätä enintään {maxfiles} liitettä kerrallaan.",
537
+ sv: "Du kan bifoga filer i flg. formater {filetypes} samt de vanligaste videofilerna. Du kan ladda upp {maxbytes} filer åt gången och lägga till upp till {maxfiles} bilagor åt gången.",
538
+ en: "You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytes} of files at a time, and add up to {maxfiles} attachments at a time.",
539
+ }
540
+ */
541
+ this.descriptionDefaults = {
542
+ fi: "Voit liittää {filetypes}-muotoisia tiedostoja sekä yleisimpiä videotiedostoja. Voit lähettää {maxbytes} verran tiedostoja yhdellä kertaa, ja lisätä enintään {maxfiles} liitettä kerrallaan.",
543
+ sv: "Du kan bifoga filer i flg. formater {filetypes} samt de vanligaste videofilerna. Du kan ladda upp {maxbytes} filer åt gången och lägga till upp till {maxfiles} bilagor åt gången.",
544
+ en: "You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytes} of files at a time, and add up to {maxfiles} attachments at a time.",
545
+ };
546
+ /**
547
+ * Description for the upload component.
548
+ * @default {
549
+ fi: "Voit liittää {filetypes}-muotoisia tiedostoja sekä yleisimpiä videotiedostoja. Voit lähettää {maxbytes} verran tiedostoja yhdellä kertaa, ja lisätä enintään {maxfiles} liitettä kerrallaan.",
550
+ sv: "Du kan bifoga filer i flg. formater {filetypes} samt de vanligaste videofilerna. Du kan ladda upp {maxbytes} filer åt gången och lägga till upp till {maxfiles} bilagor åt gången.",
551
+ en: "You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytes} of files at a time, and add up to {maxfiles} attachments at a time.",
552
+ }
553
+ */
554
+ this.description = languageUtils.getLocaleString(this.descriptionDefaults);
555
+ /**
556
+ * Defaults for the filelist's empty state.
557
+ * @default {
558
+ fi: "Ei vielä lisättyjä tiedostoja.",
559
+ sv: "Inga filer har lagts till ännu.",
560
+ en: "No files added yet.",
561
+ }
562
+ */
563
+ this.fileListEmptyDefaults = {
564
+ fi: "Ei vielä lisättyjä tiedostoja.",
565
+ sv: "Inga filer har lagts till ännu.",
566
+ en: "No files added yet.",
567
+ };
568
+ /**
569
+ * Label for the filelist's empty state.
570
+ * @default { fi: "Ei vielä lisättyjä tiedostoja.",sv: "Inga filer har lagts till ännu.",en: "No files added yet."}
571
+ */
572
+ this.fileListEmpty = languageUtils.getLocaleString(this.fileListEmptyDefaults);
573
+ /**
574
+ * Display the input in error state along with an error message.
575
+ */
576
+ this.error = "";
577
+ /**
578
+ * Use maxBytes to specify the maximum size in Bytes of a file that can be uploaded.
579
+ */
580
+ this.maxBytes = 200000000;
581
+ /**
582
+ * Use maxBytesTotal to specify the maximum size in Bytes of All files combined that can be uploaded.
583
+ */
584
+ this.maxBytesTotal = undefined;
585
+ /**
586
+ * Use maxFiles to specify the maximum amount of files that can be uploaded
587
+ */
588
+ this.maxFiles = 99;
589
+ /**
590
+ * A string of commaseperated file type values that are allowed
591
+ * @example: .pdf,.doc,.docx
592
+ */
593
+ this.allowedExtensions = "all";
594
+ /**
595
+ * A string of commaseperated mime type values that are allowed
596
+ * @example: image/*,application/msword,
597
+ */
598
+ this.allowedMimetypes = "*";
599
+ /**
600
+ * Use multiple to allow the user to select multiple files when uploading
601
+ */
602
+ this.multiple = true;
603
+ /**
604
+ * Use limitSelection to enforce the value in allowedExtension & allowedMimetypes when selecting files,
605
+ * by default this is off, setting this to true will limit the users choices to what has been explicitly set
606
+ */
607
+ this.limitSelection = false;
608
+ //region Private functions
609
+ /**
610
+ * Private functions
611
+ */
612
+ this.listenForActionEvents = () => {
613
+ this.element.addEventListener("duetEditableItemAction", (e) => {
614
+ const detail = e.detail;
615
+ const { action, keyName, originalEvent } = detail;
616
+ switch (action) {
617
+ case "delete":
618
+ this.onDelete(keyName, originalEvent);
619
+ break;
620
+ case "cancel":
621
+ this.onCancel(keyName, originalEvent);
622
+ break;
623
+ // code block
624
+ }
625
+ });
626
+ };
627
+ this.verifyValidity = () => {
628
+ const { invalid, valid } = this.getFilesAsArray();
629
+ const oldValid = this.valid;
630
+ this.valid = invalid.length === 0 && valid.length !== 0;
631
+ if (this.valid !== oldValid) {
632
+ this.duetState.emit({
633
+ originalEvent: undefined,
634
+ data: { valid: this.valid, from: "componentWillRender" },
635
+ component: "duet-upload",
636
+ });
637
+ }
638
+ };
639
+ this.getGroupFromItemData = (item) => {
640
+ if (item.valid && item.progress === 100) {
641
+ // if the item has a group, move the file to that group instead
642
+ // of into the standard success group
643
+ if (item.group) {
644
+ return item.group;
645
+ }
646
+ return this.DefaultGroups.success;
647
+ }
648
+ else if (item.progress > 0 && item.progress !== 100) {
649
+ return this.DefaultGroups.inprogress;
650
+ }
651
+ else if (!item.valid) {
652
+ return this.DefaultGroups.failure;
653
+ }
654
+ else if (item.group) {
655
+ return item.group;
656
+ }
657
+ else {
658
+ return "none";
659
+ }
660
+ };
661
+ this.getItemHTMLFromItemData = (data, group) => {
662
+ if (group === this.DefaultGroups.success) {
663
+ return index.h(SuccessItem, { data: data, showLinks: this.showLinks });
664
+ }
665
+ else if (group === this.DefaultGroups.inprogress) {
666
+ return index.h(ProgressItem, { progress: data.progress, name: data.item.name });
667
+ }
668
+ else if (group === this.DefaultGroups.failure) {
669
+ return index.h(ErrorItem, { data: data });
670
+ }
671
+ else if (data.group) {
672
+ return data.html;
673
+ }
674
+ else {
675
+ return "none";
676
+ }
677
+ };
678
+ this.convertToDuetEditableTableItems = () => {
679
+ // we're always recreating the map - in order to force an update down stream.
680
+ const itemData = new Map();
681
+ //walk the files Map and convert to DuetEditableTableItemData
682
+ this.files.forEach((data, key, _originalMap) => {
683
+ const group = this.getGroupFromItemData(data);
684
+ const item = this.getItemHTMLFromItemData(data, group);
685
+ itemData.set(key, {
686
+ uid: data.uid,
687
+ item,
688
+ group,
689
+ });
690
+ });
691
+ return itemData;
692
+ };
693
+ this.kick = jsUtils.debounce(() => {
694
+ this.tick = Date.now();
695
+ }, 30); // will trigger re-render
696
+ this.genHashName = () => Date.now().toString(36) + Math.random();
697
+ this.updateValueInMap = (item, key, value, kick = true) => {
698
+ const fileItem = this.files.get(item);
699
+ fileItem[key] = value;
700
+ this.files.set(item, fileItem);
701
+ if (kick) {
702
+ this.kick();
703
+ }
704
+ };
705
+ this.updateProgress = (ev, name) => {
706
+ console.log(this.filesInProgress.size);
707
+ const updateProgressHelper = percentComplete => {
708
+ this.updateValueInMap(name, "progress", percentComplete);
709
+ this.onProgress(name, percentComplete, ev);
710
+ };
711
+ if (ev.lengthComputable) {
712
+ const percentComplete = (ev.loaded / ev.total) * 100;
713
+ updateProgressHelper(percentComplete);
714
+ }
715
+ else {
716
+ console.log("cant read progress");
717
+ }
718
+ };
719
+ this.trackProgress = (name, remove = false) => {
720
+ if (remove) {
721
+ this.filesInProgress.delete(name);
722
+ }
723
+ else {
724
+ this.filesInProgress.set(name, "inprogress");
725
+ }
726
+ if (this.filesInProgress.size === 0) {
727
+ this.onDone();
728
+ }
729
+ };
730
+ this.getFilesAsArray = () => {
731
+ const filesInQueue = [];
732
+ const filesInError = [];
733
+ this.files.forEach(value => {
734
+ if (value.valid && !value.deleted) {
735
+ filesInQueue.push(value);
736
+ }
737
+ else if (!value.valid && !value.deleted) {
738
+ filesInError.push(value);
739
+ }
740
+ });
741
+ return { valid: filesInQueue, invalid: filesInError };
742
+ };
743
+ this.resetFormFields = () => {
744
+ /**
745
+ * You cannot modify a FileList, nor remove single items from it
746
+ * This completely removes all items in the FileList
747
+ * We reset the form fields to always be able to re-upload files
748
+ * and because we handle all uploads and states internally in the component (not relying on native form elements)
749
+ */
750
+ this.nativeInput.value = "";
751
+ };
752
+ this.startUpload = async (ev, metaData = undefined) => {
753
+ await this.setFocus();
754
+ this.metaData = metaData;
755
+ this.nativeInput.click();
756
+ this.onUpload(ev, metaData);
757
+ ev.stopPropagation();
758
+ ev.preventDefault();
759
+ return;
760
+ };
761
+ //endregion
762
+ //region Eventlisteners for the XHR requests
763
+ /**
764
+ * Eventlisteners for the XHR requests
765
+ */
766
+ this.transferComplete = name => {
767
+ this.updateValueInMap(name, "progress", 100, false);
768
+ this.trackProgress(name, true);
769
+ };
770
+ this.transferDone = (xhr, name, status) => {
771
+ this.updateValueInMap(name, "status", status, false);
772
+ this.updateValueInMap(name, "uploaded", true, false);
773
+ try {
774
+ const response = JSON.parse(xhr.response);
775
+ this.updateValueInMap(name, "url", response.url);
776
+ }
777
+ catch (e) {
778
+ this.updateValueInMap(name, "url", null);
779
+ console.error("Server did not respond with expected response {url: string}");
780
+ }
781
+ return;
782
+ };
783
+ this.transferDoneWithFailure = (xhr, name, status) => {
784
+ try {
785
+ const { error } = JSON.parse(xhr.response);
786
+ this.updateValueInMap(name, "error", { message: error.message, type: error.type }, false);
787
+ }
788
+ catch (e) {
789
+ console.error("Server did not respond with expected response error:{message: string, type: int}");
790
+ this.updateValueInMap(name, "error", { type: status }, false);
791
+ }
792
+ this.updateValueInMap(name, "valid", false, true);
793
+ };
794
+ this.transferFailed = name => {
795
+ this.updateValueInMap(name, "error", getError("duet-upload-001"));
796
+ };
797
+ this.transferCanceled = name => {
798
+ this.files.delete(name);
799
+ this.validateTotals(name);
800
+ this.kick();
801
+ };
802
+ this.validateTotals = (name) => {
803
+ const isTotalSizeOverMaxSize = validateTotalSizeIsAboveMax(this.files, this.maxBytesTotal);
804
+ const isTotalFileAmountAboveMax = validateTotalAmountIsAboveMax(this.files, this.maxFiles);
805
+ if (isTotalSizeOverMaxSize && name) {
806
+ this.updateValueInMap(name, "error", getError("duet-upload-202"), false);
807
+ }
808
+ if (isTotalFileAmountAboveMax && name) {
809
+ this.updateValueInMap(name, "error", getError("duet-upload-301"), false);
810
+ }
811
+ this.bytesMaxReached = isTotalSizeOverMaxSize;
812
+ this.fileMaxReached = isTotalFileAmountAboveMax;
813
+ return {
814
+ bytesMaxReached: isTotalSizeOverMaxSize,
815
+ fileMaxReached: isTotalFileAmountAboveMax,
816
+ };
817
+ };
818
+ this.onDelete = (key, ev) => {
819
+ const deletedItem = this.files.get(key);
820
+ this.files.delete(key);
821
+ this.validateTotals();
822
+ this.kick();
823
+ this.duetDelete.emit({
824
+ originalEvent: ev,
825
+ data: { deletion: deletedItem },
826
+ component: "duet-upload",
827
+ });
828
+ if (!this.external) {
829
+ this.makeXHRDeleteRequest(deletedItem);
830
+ }
831
+ this.resetFormFields();
832
+ };
833
+ this.onCancel = (key, ev) => {
834
+ const cancelledItem = this.files.get(key);
835
+ this.files.delete(key);
836
+ if (!this.external) {
837
+ const { xhr } = cancelledItem;
838
+ xhr.abort();
839
+ }
840
+ else {
841
+ this.kick();
842
+ }
843
+ this.resetFormFields();
844
+ this.duetCancel.emit({
845
+ originalEvent: ev,
846
+ data: { cancelled: cancelledItem },
847
+ component: "duet-upload",
848
+ });
849
+ };
850
+ this.onUpload = (ev, metaData) => {
851
+ this.duetUpload.emit({
852
+ originalEvent: ev,
853
+ metaData,
854
+ component: "duet-upload",
855
+ });
856
+ };
857
+ this.onBlur = (ev) => {
858
+ this.duetBlur.emit({
859
+ originalEvent: ev,
860
+ component: "duet-upload",
861
+ });
862
+ };
863
+ this.onProgress = (key, percentComplete, ev) => {
864
+ this.duetChange.emit({
865
+ originalEvent: ev,
866
+ data: {
867
+ key,
868
+ percentComplete,
869
+ },
870
+ component: "duet-upload",
871
+ });
872
+ };
873
+ this.onFocus = (ev) => {
874
+ this.duetFocus.emit({
875
+ originalEvent: ev,
876
+ component: "duet-upload",
877
+ });
878
+ };
879
+ this.onDone = () => {
880
+ this.duetDone.emit({
881
+ component: "duet-upload",
882
+ data: { files: this.files },
883
+ });
884
+ };
885
+ }
886
+ watchValidHandler(newValue, oldValue) {
887
+ if (newValue !== oldValue) {
888
+ this.kick();
889
+ }
890
+ }
891
+ //endregion
892
+ /**
893
+ * Component lifecycle events.
894
+ */
895
+ componentWillLoad() {
896
+ themeableComponent.inheritGlobalTheme(this);
897
+ this.listenForActionEvents();
898
+ }
899
+ componentWillRender() {
900
+ // listen to the events from the component
901
+ this.verifyValidity();
902
+ }
903
+ //endregion
904
+ //region XHR requests
905
+ /**
906
+ * XHR request utilities
907
+ */
908
+ makeXHRPostRequest(data) {
909
+ const xhr = new XMLHttpRequest();
910
+ const name = data.get("name");
911
+ xhr.upload.addEventListener("progress", ev => {
912
+ this.updateProgress(ev, name);
913
+ });
914
+ xhr.upload.addEventListener("load", () => {
915
+ this.transferComplete(name);
916
+ });
917
+ xhr.upload.addEventListener("error", () => {
918
+ this.transferFailed(name);
919
+ });
920
+ xhr.upload.addEventListener("abort", () => {
921
+ this.transferCanceled(name);
922
+ });
923
+ return makeXhrRequest({
924
+ payload: { data, name },
925
+ options: { type: "POST", uri: this.uri, xhr, argument: null, headers: null },
926
+ onFailure: this.transferDoneWithFailure,
927
+ onSuccess: this.transferDone,
928
+ onProgress: this.trackProgress,
929
+ });
930
+ }
931
+ makeXHRDeleteRequest(data) {
932
+ const { uid, item } = data;
933
+ const xhr = new XMLHttpRequest();
934
+ // don't present server issues to user on deletes, just remove them from the visible list
935
+ return makeXhrRequest({
936
+ payload: { data: null, name },
937
+ options: {
938
+ type: "DELETE",
939
+ xhr,
940
+ uri: this.uri,
941
+ arguments: `?key=${uid}&name=${item.name}`,
942
+ headers: {
943
+ "x-fileuid": uid,
944
+ "x-filename": item.name,
945
+ },
946
+ },
947
+ onFailure: this.transferDoneWithFailure,
948
+ onSuccess: this.transferDone,
949
+ onProgress: this.trackProgress,
950
+ });
951
+ }
952
+ //endregion
953
+ //region EventHandlers
954
+ /**
955
+ * Component event handling.
956
+ */
957
+ async onChange(ev) {
958
+ var _a;
959
+ const selectedFiles = Array.from((_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.files);
960
+ // FileList is a nice array like structure but
961
+ // to ensure uniqueness of files we use a mapping structure and
962
+ // key to the name (makes it easier to delete as well)
963
+ if (selectedFiles) {
964
+ for (const item of selectedFiles) {
965
+ const { valid, errorMessage, errorType, errorSystem } = validateFile(item, {
966
+ maxBytes: this.maxBytes,
967
+ allowedExtensions: this.allowedExtensions,
968
+ allowedMimetypes: this.allowedMimetypes,
969
+ });
970
+ const uid = this.genHashName();
971
+ const fileListItem = {
972
+ uid,
973
+ item: item,
974
+ size: item.size,
975
+ meta: this.metaData,
976
+ uploaded: false,
977
+ valid,
978
+ error: {
979
+ type: valid ? undefined : errorType,
980
+ message: valid ? undefined : errorMessage,
981
+ system_message: valid ? undefined : errorSystem,
982
+ },
983
+ progress: 0,
984
+ deleted: false,
985
+ xhr: false,
986
+ url: false,
987
+ };
988
+ this.files.set(item.name, fileListItem);
989
+ // validate that we haven't hit any maxfiles or maxbytes limits before we upload
990
+ const { bytesMaxReached, fileMaxReached } = this.validateTotals(item.name);
991
+ if (bytesMaxReached) {
992
+ // in case one of the global maxes have been reached, invalidate the file
993
+ this.updateValueInMap(item.name, "valid", false, false);
994
+ }
995
+ else if (fileMaxReached) {
996
+ // in case one of the global maxes have been reached, invalidate the file
997
+ this.updateValueInMap(item.name, "valid", false, false);
998
+ }
999
+ else if (valid && !this.external) {
1000
+ // if all is well AND external file upload handling has not been set, start upload
1001
+ const data = new FormData();
1002
+ data.append("file", item);
1003
+ data.append("uid", uid);
1004
+ data.append("name", item.name);
1005
+ data.append("metadata", JSON.stringify({ uid, url: this.uri, size: item.size, meta: fileListItem.meta }));
1006
+ try {
1007
+ fileListItem.xhr = await this.makeXHRPostRequest(data);
1008
+ }
1009
+ catch (e) {
1010
+ // in case one of the global maxes have been reached, invalidate the file
1011
+ this.updateValueInMap(item.name, "valid", false, false);
1012
+ }
1013
+ }
1014
+ // kick the stat to force update
1015
+ this.kick();
1016
+ }
1017
+ }
1018
+ // reset the form, so that a user may upload a file again (with the same name)
1019
+ this.resetFormFields();
1020
+ // reset the internal metaData state
1021
+ this.metaData = undefined;
1022
+ this.duetChange.emit({
1023
+ originalEvent: ev,
1024
+ data: { files: this.files },
1025
+ component: "duet-upload",
1026
+ });
1027
+ }
1028
+ //endregion
1029
+ /**
1030
+ * Sets focus on the specified `duet-input`. Use this method instead of the global
1031
+ * `input.focus()`.
1032
+ */
1033
+ async setFocus(options) {
1034
+ if (this.nativeInput) {
1035
+ this.nativeInput.focus(options);
1036
+ }
1037
+ return;
1038
+ }
1039
+ /**
1040
+ * Method for invoking the upload sequence
1041
+ */
1042
+ async upload(metaData = undefined) {
1043
+ await this.setFocus();
1044
+ this.metaData = metaData;
1045
+ this.nativeInput.click();
1046
+ return;
1047
+ }
1048
+ /**
1049
+ * Get list of files, divided in errors and valid sections
1050
+ */
1051
+ async getFiles() {
1052
+ if (!this.files || this.files.size === 0) {
1053
+ return false;
1054
+ }
1055
+ return this.getFilesAsArray();
1056
+ }
1057
+ /**
1058
+ * Convenience method for updating a of an item in the files attribute
1059
+ */
1060
+ async updateValue(item, key, value) {
1061
+ this.updateValueInMap(item, key, value);
1062
+ }
1063
+ /**
1064
+ * render() function
1065
+ * Always the last one in the class.
1066
+ */
1067
+ render() {
1068
+ const identifier = this.identifier || this.uploadId;
1069
+ let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
1070
+ caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
1071
+ caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
1072
+ return (index.h(index.Host, { class: { "duet-m-0": this.margin === "none" } }, index.h("duet-fieldset", { label: this.label, caption: caption }, index.h("slot", { name: "header" }), !this.files.size && (index.h("duet-label", { theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
1073
+ "duet-upload-filelist-empty": !this.files.size,
1074
+ "duet-upload-filelist": true,
1075
+ "duet-upload-filelist-filled": this.files.size,
1076
+ }, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && index.h("slot", { name: "fileheader" }), !!this.files.size && (index.h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.statusMessageLabel })), !!this.files.size && (index.h("duet-editable-table", { "aria-live": "polite", "aria-relevant": "removals", accessibleRole: "log", id: this.editableTableId, groups: this.groups, actions: this.actions, hideGroups: this.hideGroups, items: this.convertToDuetEditableTableItems() })), !!this.files.size && index.h("slot", { name: "filefooter" }), index.h("duet-spacer", { size: "large" }), !this.hideButton && (index.h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle" }, this.buttonLabel)), index.h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (index.h("duet-alert", null, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), index.h("duet-spacer", { size: "medium" }), index.h("duet-visually-hidden", null, index.h("input", { ref: input => {
1077
+ this.nativeInput = input;
1078
+ }, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
1079
+ "duet-upload": true,
1080
+ }, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
1081
+ }
1082
+ get element() { return index.getElement(this); }
1083
+ static get watchers() { return {
1084
+ "valid": ["watchValidHandler"]
1085
+ }; }
1086
+ };
1087
+ DuetUpload.style = duetUploadCss;
1088
+
1089
+ exports.duet_upload = DuetUpload;